Miles Sound System sets a pointer to a logger function in the exported function "MilesStartup", which can be set by passing a pointer to your logging function in the first parameter. Since this call is inline, we just hook the function that Respawn used for the audio logger instead, which has the actual print within the function stripped.
Only add to detour if the VFTable pointer didn't exist yet. Not declaring these in the anonymous namespace significantly reduces code size and unnecessary memory allocations. We might want to consider refactoring this, although it will probably require a big change.
Server classes are only included on dedicated and host, client didn't use them. These files included the keyvalues header. Added header file to fix the compile errors.
* Immediately display the "Stop Server" and "Change Level" buttons when hoststate indicated there is an active game, since stopping the server or switching levels is still valid when the server is not simulating.
* Only display the AINetwork/NavMesh rebuild/reload and Settings Reparse buttons when the server is simulating.
Used proper enum for context. The low level tier1 stuff should print in COMMON.
Also added newlines where missing, the logging system will undergo a change where a newline will only be appended if we are logging in the same context without a newline.
We used the hoststate levelname string, but this only applies to the host. Keep the levelname that was passed to 'Mod_LoadPakForMap()', and set the init bool after we ran 'Mod_GetLevelSettings()'.
When you connect to a server, the server sends its playlists down to the client. When we disconnect from the server, we reload the playlists so that our panels, and the game itself, presents the playlists that are on the clients disk. The reload never really happened as we checked if the call was not from the main thread, but since the large refactor several months ago, the call will always be issued from the main thread. I removed the dispatching code and made it only run on the client.
Fix bug where 'Mod_LevelHasChanged(...)' returns false even though it had changed. The static var was set in a different function which worked with the old system. The static var is now set within 'Mod_GetLevelSettings()', if 'Mod_LevelHasChanged()' returns true.
* Promoted size types in CUtlBuffer to int64.
* Fixed bug where CUtlBuffer::GetPtr returns a 64bit pointer that was promoted from a 32bit integral type.
* Use int64/size_t for anything strlen, pointer subtraction, etc..
* Removed invalid structure alignment declarations.
Previously we used Json, however the rest of the game features KeyValues. I changed the system to feature KeyValues instead, to maintain consistency. Also improved the logic behind loading/parsing so we don't reparse the same level settings file if the pointer is still valid and we are on the same level.
'ImGuiConfig::Load()' was loading from the new path, however 'ImGuiConfig::Save()' was not. Defined path as constant expression to avoid this problem in the future. Also loading the files through the engine's API from now on.
'MemAllocSingleton()->Free()' does not call the object's destructor. Ideally we override the default memalloc system with that of the engine, but unlike other Valve Source games, Apex Legends is monolithic and does not export 'MemAllocSingleton()' from tier0. We could manually patch the executable to 'export' this, might need a code cave as this function got inlined practically everywhere.., but even then, this results in a circular import as we import the gamesdk from the exe, which might just work, but Windows 7 is usually a lot less tolerant in approaches like these.
We should explore this in the future.
These methods where only used for and by the VPKDir_t structure.
Also renamed variable and method names to reflect new changes regarding the use of KeyValues by creating a structure with all values defined during file lookup rather than doing this during the pack process.