Regression was caused in commit 3bb4ee625863c1dd503f07e0d480f4b3fd302c48. The new sound engine has breaking changes in its exports. Added shim layer to fix incompatibilities on the export 'MilesSampleSetSourceRaw'.
Internal structure 'IntProjectData_t' has changed, padding size adjusted to accommodate changes.
Sound engine taken from retail build R5pc_r5-61_J318_CL651503_2020_10_14_18_51.
The code originally fetches available and selected languages from Origin/EADesktop. The issue however is that its hard to change the language through the Origin/EADesktop app. The second issue is that the languages returned by Origin/EADesktop isn't necvesarily supported by our version of the game, for example, the original implementation of EbisuSDK_GetLanguage() also returns ar_SA, which is supported by the retail version of the game, but our version doesn't have the code to render this language. The code has been rewritten to allow the user to easily change the language using the command line '-language' parameter. The miles code has also been slightly adjusted to fetch the language directly from HEbisuSDK_GetLanguage() instead of miles_language since otherwise we would still error out in engine code as miles_language will be out of sync.
Enforce 'MILES_DEFAULT_LANGUAGE' as the default rather than "english", even though "english" will always be the default. Also marked cvar 'miles_debug' as FCVAR_DEVELOPMENTONLY.
These warnings can get verbose, especially if events from the map itself are missing. Put behind a cvar and enabled it by default in development configurations.
This patch adds miles globals and additional code to prevent banks from loading that don't exist. It falls back to "english" if requested language isn't installed.
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project.
This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console).
Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
Originally, we store the search results in a CMemory instance which we then assign to the actual function pointer. CMemory is just a pointer class; we can assign the results directly to the actual function pointer. This commit reduces a lot of code verbosity, and also reduced roughly 2KiB worth of static pointers in the resulting executable. This commit also officially deprecates the support for any GameDLL's below S3 (Season 3), since it makes more sense to port the assets from earlier/later games back to the version this SDK supports.
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
Find regex pattern:
inline auto ([a-zA-Z0-9_]+) = ([a-zA-Z0-9_]+)\.RCast<([a-zA-Z0-9_:<>*]+) *\(\*\)\(([^)]*)\)>\(\);
Replace regex pattern:
inline $3(*$1)($4);
This commit also removes the unnecessary initialization (which was required to type the auto variables),
and therefore removed 6kb of unnecessary dynamic initialization code.
*Use unordered_map to get mpdule sections instead, as this is more performant than comparing strings.
* Removed 'm_SectionName' field from ModuleSections_t, as the unordered map now keeps track of them.
* Removed all extraneous module section copies.
* Renamed 'GetImportedFunction' to 'GetImportedSymbol'.
* Renamed 'GetExportedFunction' to 'GetExportedSymbol'.
*Made a static version of 'GetImportedSymbol' and 'GetExportedSymbol', so it could be used on raw module base addresses.
*Created inlines for getting the DOS and NT headers.
*Improved formatting so the code could be read more easily on a vertical monitor.
Previously, it was all controlled from the global init (applied to all projects), but some projects need different options. With these changes, you can disable the common options applied in the 'add_module' macro, and set your own if desired.
Treat them as errors globally. Most of the time a warning is a bug, or problem in code that could be solved in a different (better) manner. Thirdparty code have this disabled. The warnings as errors option can be globally disabled through the CMake GUI, but this is not recommended.
Use the 'add_module' macro to add modules without creating duplicate code. This macro also takes a reuse PCH as parameter, so modules that need a precompiled header, could reuse those from different targets that compile them. This commit also restructures the group order of the generated solution files for easier code navigation.
* All libraries have been isolated from each other, and build into separate artifacts.
* Project has been restructured to support isolating libraries.
* CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example).
* Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp).
TODO:
* Add a batch file to autogenerate all projects.
* Add support for dedicated server.
* Add support for client dll.
Bugs:
* Game crashes on the title screen after the UI script compiler has finished (root cause unknown).
* Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
Log the amount of time it took to initialize miles. Also log the language it gets initialized with, as this has been a common problem in the past. This should make it easier to see the problem regarding audio initialization failures.
Unfortunately clang-cl doesn't support __FUNCTION__ macro concat. Some SSE stuff in mathlib/navmesh rendering also needs to be made portable at some point.
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.
TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.