2903 Commits

Author SHA1 Message Date
Kawe Mazidjatari
40bcef2682 Fixup exec paths in 'build_all_vpk.cfg'
Point to new location that changed in commit afb09e1d.
2023-07-14 00:39:08 +02:00
Kawe Mazidjatari
afb09e1d05 Cleanup CFG directory
Move to dedicated subdirectories.
2023-07-13 23:15:10 +02:00
Amos
47b6b17207 Should be SDK_ARRAYSIZE 2023-07-13 08:18:28 +02:00
Kawe Mazidjatari
f6236359aa Fix debugger working directory for SDK launcher
Working directory was incorrect.
2023-07-13 00:15:37 +02:00
Kawe Mazidjatari
dca89a32d3 SDK launcher bug fixes and improvements
- Added missing implementation for 'numworkerthreads' text box.
- Swapped 'single-core server' toggle with 'processor affinity' text box.
- Performed additional light code cleanup.

The single-core dedi cvar now only gets set when 1 bit is set in the affinity mask, as that implies single core usage.
2023-07-13 00:14:47 +02:00
Kawe Mazidjatari
0de507713b Make fbits inline, and add PopCount
Floating point bitwise functions are now inline, also implemented a 'PopCount' function, which replicates the '__popcnt' instruction, but does not require the CPU to feature the instruction. This was mainly added as the SDK launcher doesn't check the CPU for SSSe3/popcnt, as it doesn't involve any instruction sets past SSE2.
2023-07-13 00:06:56 +02:00
Amos
9e899084e9 Make netchan getters/setters inline
Simple enough to be inline, also added additional assertions to methods getting from CNetChan::m_DataFlow.
2023-07-12 17:43:55 +02:00
Amos
2f209ddb60 Remove 'g_pClient' pointer
The whole array is part of the CServer class.
2023-07-12 09:14:33 +02:00
Amos
c6a9b855a2 Make simple CClient getters, inline
Small enough to be inline.
2023-07-12 09:11:31 +02:00
Amos
ccdfed1c19 Use CServer's 'GetClient'
Use the CServer's 'GetClient' method for obtaining clients by index.
2023-07-12 08:56:17 +02:00
Amos
126091d3bc Update CServer class
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.
2023-07-11 08:42:02 +02:00
Amos
9a4ee75f2e Make inline
Simple CServer getters.
2023-07-11 07:44:48 +02:00
Kawe Mazidjatari
728eff81c8 Remove devonly flag from 'sv_single_core_dedi' cvar
Allow setting this in retail mode.
2023-07-11 00:18:58 +02:00
Kawe Mazidjatari
3391b1b1f0 Optimize the finding of fallback models
Don't construct a new string, just test the mdl strings right away using 'V_ComparePath'.
2023-07-10 19:17:00 +02:00
Kawe Mazidjatari
dbb18e586d Add 'V_ComparePath'
Add function to compare paths for equality, while ignoring case and path separators.
2023-07-10 19:16:12 +02:00
Kawe Mazidjatari
6f441292d0 CModule construction optimization
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.
2023-07-10 13:54:00 +02:00
Kawe Mazidjatari
8b0fecf8bc Add aligned memalloc overrides
Make sure these are getting overridden with our implementation as well.
2023-07-10 13:51:14 +02:00
Kawe Mazidjatari
65e973f76b Remove redundant check
Pointer for RSON object was already checked above.
2023-07-10 13:50:05 +02:00
Kawe Mazidjatari
8cb46354e6 Permanently fix aligned memalloc crash
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.
2023-07-10 13:49:36 +02:00
Kawe Mazidjatari
cb2850f938 Update packedstore.cpp 2023-07-10 01:38:29 +02:00
Kawe Mazidjatari
804b46998f Enable the modsystem again
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.
2023-07-09 22:51:14 +02:00
Kawe Mazidjatari
15244bf27a Modsystem improvements
- 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)).
2023-07-09 22:49:46 +02:00
Kawe Mazidjatari
e4a3bdbb2e Add internal CLocalize functions to address getters 2023-07-09 22:24:29 +02:00
Kawe Mazidjatari
5e880ec92a Added function documentation to RSON class 2023-07-09 22:20:26 +02:00
Kawe Mazidjatari
b1147a9a42 Let the caller deal with checking for NULL 2023-07-09 22:17:42 +02:00
Kawe Mazidjatari
d5f74dc245 Add constants for script paths
Game script path and its compile list.
2023-07-09 20:12:09 +02:00
Kawe Mazidjatari
e2bf1b7a99 Add CUtlString less function
Used for CUtlMap.
2023-07-09 20:10:53 +02:00
Kawe Mazidjatari
91a8ad7cfd RSON::LoadFromFile light cleanup and bug fix
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.
2023-07-09 20:09:50 +02:00
Kawe Mazidjatari
4e8b27a1e9 Allow overriding path separator to list generated by 'RecursiveFindFilesMatchingName' 2023-07-09 20:05:47 +02:00
Kawe Mazidjatari
248efc114b Fix aligned memalloc crash when compiled with LTCG
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.
2023-07-09 20:03:57 +02:00
Kawe Mazidjatari
a90302f09f Allow loading RSON files by path ID 2023-07-08 22:45:35 +02:00
Kawe Mazidjatari
4f806ee2ba Remove dead cvar
No longer used.
2023-07-08 18:28:27 +02:00
Kawe Mazidjatari
6891d88294 Add usage text to modsystem cvar init
Allow adding usage texts as well. Renamed 'helpString' field to 'helpText'.
2023-07-08 13:28:44 +02:00
Kawe Mazidjatari
8f480d924b Add cvars for modsystem
Add cvars to enable/disable the modsystem, also added cvars to toggle modsystem debug.
2023-07-08 13:22:30 +02:00
Kawe Mazidjatari
f6650df951 Remove 'SVC_PlaylistOverrides' patch
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.
2023-07-08 03:07:19 +02:00
Kawe Mazidjatari
8d78b3a7e8 More suitable way of obtaining module handles
The SDK module handle was available in DLL init, executable module can be retrieved with PEB.
2023-07-08 03:05:10 +02:00
Kawe Mazidjatari
b4cd72034e CModule: light cleanup
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.
2023-07-08 03:01:54 +02:00
Kawe Mazidjatari
ca423c0dcf CMDLCache: light cleanup 2023-07-08 02:45:08 +02:00
Kawe Mazidjatari
2afec89c2f CCrashHandler: light cleanup 2023-07-08 02:44:33 +02:00
Kawe Mazidjatari
0110cd91c2 Fix typos 2023-07-08 02:20:33 +02:00
Kawe Mazidjatari
2565ff44ef Light VPK code optimizations
Cache string buffer ptr.
2023-07-08 02:18:18 +02:00
Amos
e9335d062f Fix playlist overrides exploit
Only allow playlist overrides when cheats are enabled on the server.
2023-07-07 09:14:39 +02:00
Kawe Mazidjatari
deb913e47b Merge recastnavigation/recastnavigation@603dc88e5d 2023-07-06 10:10:50 +02:00
Kawe Mazidjatari
2e12a581e5 Merge recastnavigation/recastnavigation@99b6c3306e 2023-07-06 10:09:36 +02:00
Kawe Mazidjatari
43aeaeb19c
Merge pull request #102 from Mauler125/vpklib_fix
Vpklib fix
2023-07-06 00:52:26 +02:00
Kawe Mazidjatari
c215fcc171 VPK utility code improvements
- 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.
2023-07-06 00:49:17 +02:00
Kawe Mazidjatari
5939e05331 Fix incorrect VPK tree during build
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'.
2023-07-05 23:04:07 +02:00
Kawe Mazidjatari
77299dd3de Remove extraneous 'V_FixSlashes' call
No need to fix slashes when stripping last dir. We can always fix them up on a subsequent call to 'V_FixSlashes' if we ever need to.
2023-07-05 22:08:32 +02:00
Kawe Mazidjatari
42d12a644e Fix bug in 'V_StripLastDir' and 'CUtlString::DirName'
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.
2023-07-05 21:50:36 +02:00
Kawe Mazidjatari
819b3aeb16 Move and rename 'IsValidUTF8', 'UTF8CharLength'
Moved to strtools (tier1); utility will be renamed and decoupled into 'stl_utility' soon.
2023-07-04 23:01:13 +02:00