2676 Commits

Author SHA1 Message Date
Kawe Mazidjatari
a061f7dd00 Optimize C2S_CONNECT vuln fix
Save 2 bytes from segment padding by performing zero test at original address followed by the long jump to patch, there were 5 bytes, zero test only requires 2, thus only 3 bytes were nopped with these changes.
2023-05-31 21:25:16 +02:00
Kawe Mazidjatari
619bbd161c Fix stringcmd replay exploit
This commit fixes an engine bug where netmessages are getting copied into the replay buffer, while these messages should never be replayed. The engine performs an internal check on 'CNetMessage::m_nGroup', and if its NOT 2, the message is getting copied into the replay buffer. All messages returning false in 'ShouldReplayMessage' are not getting copied into the replay buffer anymore. This exploit has been used in the past to route clients that were watching a replay to an arbitrary server, which essentially forms an info leak as the client attempts to connect to the arbitrary server on its own. The exploit also allows for some form of remote code execution, depending on if the client was launched in developer mode or not.
2023-05-30 23:01:46 +02:00
Kawe Mazidjatari
c3cbdea12c Add netmessage enumeration
Enumeration of all netmessage types.
2023-05-30 21:55:47 +02:00
Kawe Mazidjatari
c2799ff68c Fix bug in vulnerability patch
Value should be treated as unsigned, else negative values could still be used to read outside the static buffer.
2023-05-30 20:24:52 +02:00
Amos
46fafef60c Fix vulnerability in C2S_CONNECT message parser
Thanks Robotic for reporting the crash!
2023-05-30 10:03:53 +02:00
Kawe Mazidjatari
abef34d3ef CPackedStore refactor
* Improve naming convention, and make it more consistent.
* Use engine types as much as possible.
* Reduced the amount of string copy constructions.
2023-05-29 21:41:17 +02:00
Kawe Mazidjatari
7f15b94cd9 String tools improvements
* Add 'V_IsValidPath'.
* Add optional parameter to 'V_StripLastDir', in which the new length of the string gets written into.
2023-05-29 21:37:15 +02:00
Kawe Mazidjatari
7e2b249ef6 CUtlString improvements
* Add method for finding a substring ('CUtlString::Find').
* Add method for appending a slash ('CUtlString::AppendSlash').
* Add 'CUtlString' overload for 'CUtlString::IsEqual_CaseSensitive'.
* Add 'CUtlString' overload for 'CUtlString::IsEqual_CaseInsensitive'.
* Add optional parameter to strip trailing slashes in 'CUtlString::DirName'.
* Add optional parameter to strip trailing slashes in 'CUtlString::StripFilename'.
2023-05-29 21:35:12 +02:00
Kawe Mazidjatari
04856caf05 Display and host using playlists instead of gamemode
This should show the actual playlist rather than the gamemode.
2023-05-29 21:13:28 +02:00
Kawe Mazidjatari
e2338d8231 Disable client project
Disabled for now due to errors.
2023-05-29 21:11:36 +02:00
Kawe Mazidjatari
b4cc52c3d9 Rename protocol projects
Renamed
2023-05-29 21:11:17 +02:00
Kawe Mazidjatari
0fe6af008c Fix data truncation on VPK unpack
If the chunk if uncompressed, continue the loop instead of breaking out of it. Only 2 files were affected by this bug from original VPK's: 'notosansjp-regular.vfont' and 'notosanstc-regular.vfont'.
2023-05-29 15:56:59 +02:00
Kawe Mazidjatari
71b7770968 Add BSP converter batch file
Automate BSP version conversions.
2023-05-29 01:04:39 +02:00
Kawe Mazidjatari
054b123004 Don't load certain lumps for dedicated
This significantly reduces disk size, and also reduces memory usage.
2023-05-29 01:03:27 +02:00
Kawe Mazidjatari
245d13cea8 Create map rename script
Rename all files associated to a BSP with a single command.
2023-05-28 10:31:17 +02:00
Kawe Mazidjatari
417e91b8d9 Merge recastnavigation/recastnavigation@9432fd6381 2023-05-27 16:02:48 +02:00
Kawe Mazidjatari
78a962ed2f CMapLoadHelper: ctor cleanup
Slightly improved code, actual functionality hasn't changed.
2023-05-26 21:54:24 +02:00
Kawe Mazidjatari
11f20348ac Move GdiPlus header to launcher PCH
Only used by the SDK launcher for the dashboard.
2023-05-26 21:53:25 +02:00
Kawe Mazidjatari
7c944b6dfb Fix intermittent PDB creation error
Option '/Zf' requires '/Zi', else it gets ignored.
2023-05-25 22:25:33 +02:00
Kawe Mazidjatari
f122e856fb Determine whether or not to newline
Errors/warnings should be newlined, even if engine code doesn't provide it.
2023-05-22 23:17:50 +02:00
Kawe Mazidjatari
bafaa1b7de Remove unused enum 2023-05-22 22:46:18 +02:00
Kawe Mazidjatari
b75c32903f Allow lumps to be read from filesystem cache
Only certain lumps can be cached; see switch case in 'IsLumpIdxCachable'. Attempting to load anything else from cache results in a code crash or invalid data.
2023-05-22 22:40:27 +02:00
Kawe Mazidjatari
1fbc3291c7 Fix EOF read errors and PAKFILE_LUMP not loading correctly when discrete
This commit adds support for loading cubemap lumps from the disk, several patches and hooks had to be implemented to make this work. Since the game was trying to read the pakfile lump from the BSP file (even when absent), it would read EOF (heavily reduces down map loading performance).
2023-05-22 12:32:49 +02:00
Kawe Mazidjatari
ceb438b7ca Add BSP header definitions 2023-05-22 12:29:23 +02:00
Kawe Mazidjatari
4c6840be6c Light cleanup for 'CMapLoadHelper' ctor 2023-05-22 12:08:02 +02:00
Kawe Mazidjatari
2d0c033f95 Fix LUMP_GAME_LUMP not loading from the disk
Last lump to not load from the disk, see function 'AddGameLump' for details as to how this is performed.
2023-05-21 18:08:07 +02:00
Kawe Mazidjatari
5fcf430be5 Add GameLump data types 2023-05-21 18:07:04 +02:00
Kawe Mazidjatari
27925d3b7d Fix compiler warning causing compile errors
Unused initialized local variable.
2023-05-21 01:59:37 +02:00
Kawe Mazidjatari
ecf7f973f8 Allow to load all lumps from disk
This commit allows for loading all lumps from disk, if the m_bExternal var is set, it also attempts to load the lumps listed in the function 'IsLumpTypeExternal' from the cache, but through a different code path, which causes a crash. Setting this to false allows for loading it in the ctor.
2023-05-20 21:44:53 +02:00
rexx
66f52dea23 fix missing valid external lump check
bsp_lump loading was missing a check for if the lump is supposed to be able to load from disk

also removes VERTEX lumps from loading from disk due to crashes that occur when they are kept
2023-05-20 14:54:00 +01:00
rexx
d7f0de9d40 fix external bsp_lump loading
previously the lump data was being freed immediately after loading. this sets m_pRawData to nullptr so that doesn't happen
2023-05-20 13:49:12 +01:00
Kawe Mazidjatari
4297cd9ce3 Experimental BSP_LUMP loading hook
The 'CMapLoadHelper' constructor has been rebuild to load lump files too (if they exist). Currently, the game only reads the packed BSP file, or lumps if they exist in the filesystem cache. The newly added logic also reads them from a file. This is currently broken, most likely due to alignment problems. Experimental.
2023-05-20 14:06:36 +02:00
Kawe Mazidjatari
e338f0331a Add filesystem cache types
Types for file system cache.
2023-05-20 14:04:33 +02:00
Kawe Mazidjatari
44edef1724 Add BSP types
Type 'StaticPropLump_t' has been moved to 'gamebspfile.h'.
2023-05-20 14:03:44 +02:00
Kawe Mazidjatari
56f4dd927a Add VGui progress bar types 2023-05-20 14:01:19 +02:00
rexx
d521c67367 Hook CMapLoadHelper ctor
This will be used for enabling bsp_lump file loading in the future
2023-05-19 20:21:11 +01:00
Kawe Mazidjatari
c0c6c735a7 Improve build system
Added option: /Zf (Faster PDB generation); this was required as we enabled /MP. Without this, the compiler regularly fails to create a PDB.
Added option:  /EHsc (Standard C++ exception handling).
2023-05-18 14:07:52 +02:00
Kawe Mazidjatari
53788d5ba5 Potential fix for intermittent crash during playlists reload
This should fix a rare crash that happens when the playlists file is reloaded during disconnect. The client fetches the playlists from the server on connect. On disconnect, we want to reload the one from the client so that if the player want's to create his own game, that he would have his own playlists. The fix is to delay the reload of the playlists file to the beginning of the next frame.
2023-05-16 00:44:59 +02:00
rexx
14e19f38ef fix compiling
compiling was broken due to some spdlog warnings being treated as errors incorrectly
2023-05-15 20:16:58 +01:00
Kawe Mazidjatari
0dc2e110a6
Merge pull request #99 from Mauler125/aligned_memalloc
Fix aligned memalloc
2023-05-15 20:50:56 +02:00
Kawe Mazidjatari
8acfad5556 Fix aligned memalloc singleton
Properly fix the aligned memalloc singleton in the SDK; the implementation now uses a callback based approach for calling the allocator and deallocator.
2023-05-15 20:47:17 +02:00
Kawe Mazidjatari
95316ab1c8 Improve code for uniform random stream
Use 'std::lock_guard' for mutex management. Also fixed a compiler warning that got triggered by having a mutex unlock placed at an unreachable code path in 'CGaussianRandomStream::RandomFloat'.
2023-05-15 20:45:57 +02:00
Kawe Mazidjatari
b87dd0943f Fix compiler warnings
Use NOTE_UNUSED instead to suppress warnings.
2023-05-15 20:43:24 +02:00
Kawe Mazidjatari
7ddd33c8de Force name consistency
Renamed to just 'netconsole' as it was phrased like that throughout other files.
2023-05-15 18:00:51 +02:00
Kawe Mazidjatari
552f5f750c Fix crash in 'CClient::ActivatePlayer'
Set the persistence fields to 'ready' in 'CClient::ActivatePlayer', before executing the rest of the function. Previously, it was set in 'CVEngineServer::PersistenceAvailable', but this is too late. The function 'FairFight_Init' was actually 'CClient::ActivatePlayer', and thus it has been moved to the correct file, and the old file defining it previously has been removed.
2023-05-15 17:19:18 +02:00
Kawe Mazidjatari
9a9813512c Add AVI public headers to CMakeLists 2023-05-15 15:01:25 +02:00
Kawe Mazidjatari
11864f8902 Add all public headers to CMake projects
Added all public headers to CMake projects, also moved some files around in the public directory. Translation units have been moved to the libraries that were responsible for implementing them, as this game is monolithic.
2023-05-15 14:47:03 +02:00
Kawe Mazidjatari
a421a2bdec Regroup VGui projects
Moved under 'System'.
2023-05-15 09:54:43 +02:00
Kawe Mazidjatari
d5f3228ab0 Fix intermittent bug in server browser
On some compile runs, the 'LoadTextureBuffer' call is getting optimized out as 'ret' is only used for the assert statement, but on release, the assert statements does nothing and thus the compiler got rid of the call. This code should not be fired in this function, but rather in the initialization routine anyways. The code has been moved to 'CBrowser::Init', and the issue has been fixed.
2023-05-15 09:54:18 +02:00
Kawe Mazidjatari
f943fe8509 RecastMesh.cpp: Fix compiler warning
2 warnings:
Operation 'lkup[arr[i] & 0xF] | 0x8000;' returns an int, but should return a unsigned short; added explicit cast.
Operation 'arr[i] & 0xF' could read up to 64 bytes, while the stack buffer is only 16 bytes. Switched to operation: ''arr[i] & 0x3'.

The static buffer has also been declare const now.
2023-05-15 09:51:27 +02:00