CClient array is part of the CPlayer class. The array has been added, filling up most of the 'unknown' gap. Vtable override functions have been added as the array is static, and therefore requires an implementation of the vtable, these are just stubs however, since the vtable pointer points to the implementation in the engine.
Moved construction logic to separate method, and call that from constructor instead. When willing to change the entire context on the same object, you can now just call 'InitFromXXXX()'. Previously, a whole new object would be generated and copied into ours, and then deleted again.
It was still crashing as the thisptr should actually be passed into the alloc callback. Changed and the function call is now identical to engine's impl. Tested in Debug, Profile and Release, Release has also been tested with LTCG.
The initialization crash has been fixed in commit '15244bf2', where if the 'platform/mods' folder didn't exist, an exception would be raised and the process would be aborted. Now, when that folder is absent, the mod system won't initialize.
- Added command line parameter '-modsystem_debug' to allow debugging during init, as we initialize before the first Cbuf_Execute() call (responsible for executing command line post engine init).
- Added warning to 'CLocalize::LoadLocalizationFileLists', when a mod localization file fails to load.
- All mod instances are now added to a single vector, but their 'state' determine whether or not they are enabled. This allows for toggling them on while in-game in the future, without having to rebuild the engine mod list.
- Changed all filesystem calls to use that of the engine instead.
- Changed all container types to valve ones, to maintain compatibility with the filesystem of the engine, and perhaps other things in the future.
- Forced all loads/writes to "PLATFORM" path (this is where the 'mods' folder resides).
- Forced localization files to be only read from the mod instance's directory.
- Allocated each mod instance dynamically, and stored their pointers in the modlist vector to reduce memory overhead during the move operation to modlist, and potential growth of modlist vector (which if required, will reallocate everything, and thus move it all. This especially is expensive with nested vectors (CUtlVector anly supports being nested as a pointer)).
Remove 'FileExists' check, if open fails, NULL file handle is returned and we just check on that. Also, commit 'a90302f0' introduced the option to open RSON files from path ID's, but the ID was only passed in the FileExist function, the actual 'Open' call did not receive the path ID argument, and therefore, did not open from there.
Crash occurred as the arguments to the alloc/free callbacks would involve the 'this' pointer, and therefore, the registers would shift and misalign. The fix is to just make the functions static and call the pointers directly from the singleton exposed by the engine. Additional cleanup has been performed by adding typedefs for the function pointers.
Only block 'CLC_SetPlaylistVarOverride' messages when cheats are disabled. The server still needs to be able to override client playlist vars (using 'SVC_PlaylistOverrides'). This isn't a problem, as on any disconnect, the client will reload its own bundled copy.
Remove the option to disable dynamic init, it was broken anyways as the string was getting constructed, and therefore, dynamic memory could be allocated if string exceeds a certain size where it has to be moved from stack to heap. The only functions we were interested in, while not allocating anything have been made static instead in the last refactor round.
- Only process referenced pack files, previously, if an entry in the VPK file was build into a pack of index 128, the code would generate a list of pack files from 0 to 128.
- Added documentation to VPK structure.
This commit fixes the following bugs:
- Use of STL map on CUtlString, CUtlString does not have a lesser operator, thus it always fails to check whether or not the string is already present in the map. The tree structure cannot contain duplicates per tree scope.
- Use of backward slashes in vpk file tree structure, path separators should always be a forwards slash. The code was originally designed to be forwards slash only, but some paths were adjusted to take backwards slash, as the KeyValues class treats the '/' char as a delimiter for subfields. This has therefore lead into the whole code changing to it. The code has now been changed to the point where only the KeyValues utilities take the backward slash paths.
- Trailing slash character on file path, that ended up getting written as-is in the path tree.
The VPK tree builder is now part of a separate nested class in 'VPKDir_t'.
In some code paths of 'V_StripLastDir', the string length value was never set. The return type of this function has changed to return always return the length of the new string. An additional bug in 'CUtlString::DirName' has been fixed, where the length was only set if the trailing slashed weren't stripped.
Light code cleanup: use references instead of pointers as much as possible, additional use of const qualifiers, and usage of provided iteration macros for CUtlVector.
On the game's filesystem, the slash always appeared, when running this code on a reimplemented filesystem, no slash was found at the end of the path. This change ensures there is always a slash.
This commit fixes an issue where the console window would shrink with 1 unit when calling 'SetConsoleBackgroundColor'. The bottom should be incremented by 1 each time its getting called, as it appears to be decremented again in WINAPI 'SetConsoleScreenBufferInfoEx'.
Enabling LTCG caused the emplacement order to be different, which is most likely due to additional optimizations for the binary search logic. Reverted to fix this bug.