4742 Commits

Author SHA1 Message Date
Kawe Mazidjatari
3c30d959dd Engine: fix uncontrolled format string vulnerability
This code is only ever used by the master server, but we should still avoid uncontrolled format strings from anything providing it remotely.
2025-02-09 02:07:19 +01:00
Kawe Mazidjatari
1e1fe1beff Recast: use emplace_back
Avoid std::string copy, construct it in place.
2025-02-09 02:03:55 +01:00
Kawe Mazidjatari
0a0eeca20a NetCon: update code to use new RCON API
Changed in commit b1d81e2dc54596fff7efa31fd874134c3c2671a3, sizes must now be provided to minimize the amount of strlen's performed by protobuf internally.
2025-02-09 02:02:17 +01:00
Kawe Mazidjatari
b0423ee74b Engine: use a more sane limit for desync check
m_RecvBuffer.max_size() can be very large, just check on RCON_MAX_PAYLOAD_SIZE (1 MiB), if its larger than that, then the stream has definitely being desynced or malformed. Also drop the client on null payloads because the payload should never be 0.
2025-02-09 01:58:32 +01:00
Kawe Mazidjatari
fdab5dea84 Engine: clamp sv_rcon_maxframesize
Make sure it cannot be set to very high numbers, making the protection guard useless.
2025-02-09 01:38:07 +01:00
Kawe Mazidjatari
f491f3dfe3 Engine: fix regression in message processor
Old regression that was caused by implementing the ability to disconnect the socket from anywhere in the rcon code, but it was never accounted for in CNetConBase::ProcessBuffer() and CNetConBase::Recv(). ProcessBuffer() must return directly when ProcessMessage() failed, and Recv() must break out if ProcessBuffer() returned false.
2025-02-09 01:37:09 +01:00
Kawe Mazidjatari
b1d81e2dc5 Engine: strong optimizations for RCON system
- All serializations now expect exact buffer lengths (which we knew for every call, but didn't make use of).
- The prefix is now also constructed directly into the send buffer
- The send buffer copies have been completely removed, the data that has been rendered into the only existing buffer will be used directly.
2025-02-09 01:23:05 +01:00
Kawe Mazidjatari
e223cec9c2 Engine: don't grow the string buffer
Just switch the format string instead, avoids reallocs.
2025-02-09 00:52:32 +01:00
Kawe Mazidjatari
7607ca073f Engine: fix typo 2025-02-09 00:51:51 +01:00
Kawe Mazidjatari
8b0bdae883 NetCon: fix command line parsing bug
-ansicolor is the only possible command line parameter, if its passed we need to shift the indices for the next one if user provided address and key.
2025-02-09 00:45:46 +01:00
Kawe Mazidjatari
f0f90e5c1b Launcher: use emplace_back
Avoid copy.
2025-02-09 00:42:40 +01:00
Kawe Mazidjatari
d36ea4d769 ImGui: strong optimizations for color logger
Don't recalculate the length of each text on the lines displayed when pushing it to the draw list. Also use the already calculated length for intermediate operations.
2025-02-09 00:34:15 +01:00
Kawe Mazidjatari
1331c3c67b VGui: use cached string lengths for notify logs
Don't recalculate the string length when displaying it on the VGui console.
2025-02-09 00:30:06 +01:00
Kawe Mazidjatari
26ec02f302 GameUI: use cached string lengths where possible
Performance improvements.
2025-02-09 00:27:29 +01:00
Kawe Mazidjatari
73b517600d NetworkSystem: use cached string lengths where possible
Avoid doing internal strlen() when length is already known.
2025-02-07 21:48:50 +01:00
Kawe Mazidjatari
bfe96e9ccd Game: use cached string lengths where possible
Avoid doing internal strlen() when length is already known.
2025-02-07 21:47:36 +01:00
Kawe Mazidjatari
8646dfa516 Client: use cached string lengths where possible
Avoid doing internal strlen() when length is already known.
2025-02-07 21:47:09 +01:00
Kawe Mazidjatari
fde639e167 NetworkSystem: optimize server list construction
Use emplace_back to construct in place, and transfer ownership of allocated memory.
2025-02-07 21:42:44 +01:00
Kawe Mazidjatari
bb566cd1fd NetworkSystem: use cached string lengths where possible
No need to do another strlen internally in rapidjson's value wrapper. We already know its length.
2025-02-07 21:40:33 +01:00
Kawe Mazidjatari
e27fc72e25 NetworkSystem: update function documentation 2025-02-07 21:39:22 +01:00
Kawe Mazidjatari
18e71086b6 Tier2: strong optimizations for JSON tools
- Fetch field name strlen at compile time using rapidjson's string refs.
- Use from_chars to do string to number conversions which isn't locale aware, for maximum speed.
2025-02-07 21:38:03 +01:00
Kawe Mazidjatari
4188c13780 Core: add character conversion header to PCH
Wil be used for JSON_ParseNumber optimizations
2025-02-07 17:37:15 +01:00
Kawe Mazidjatari
13301bceae CMake: move project "vphysics" under "System"
vphysics is a system.
2025-02-05 00:50:32 +01:00
Kawe Mazidjatari
d6cff51624 Particle: add pak to load after effects
Future planned porting of effects assets will be moved into this rpak file. This pak file loads directly after effects.rpak is loaded, and only if it was loaded.
2025-02-05 00:49:28 +01:00
Kawe Mazidjatari
ff303d5de8 Engine: add pak to load after common_early
common_roots.rpak is loaded directly after common_early.rpak, and is necessary to store player layouts (these must be loaded before common.rpak is loaded to preserve the correct order of the linked list).
2025-02-05 00:47:04 +01:00
Kawe Mazidjatari
d7ebf62c38 Detours: only keep duplication tracking code in debug builds
This serves no purpose in release builds as all these issues must be resolved first before making a release.
2025-02-05 00:36:48 +01:00
Kawe Mazidjatari
27285fc087 MaterialSystem: add pak load for startup_sdk.rpak
Allow the startup_sdk.rpak file to be loaded directly after startup.rpak, while also offering the ability to patch assets in startup.rpak.
2025-02-04 17:51:34 +01:00
Kawe Mazidjatari
eaf313ab7a Engine: don't wait on ui_sdk.rpak for dedicated
Dedicated shouldn't load any ui pak file.
2025-02-04 17:32:20 +01:00
Kawe Mazidjatari
e8fc542907 Engine: light cleanup for Mod_QueuedPakCacheFrame 2025-02-04 17:30:57 +01:00
Kawe Mazidjatari
3ac646da64 GameUI: fix bug in CBrowser::UpdateHostingStatus()
Member netGameServer::hidden should be set if serverVisibility == ServerVisibility_e::HIDDEN.
2025-02-03 21:20:37 +01:00
Kawe Mazidjatari
e55975100e Engine: wait for all paks before releasing FIFO lock
Make sure that every pak is fully loaded before we continue with the level load. Previously we would only wait on paks loaded by CommonPakData_s, but we should also wait on paks loaded by CustomPakData_s. This fixes all rare crash cases caused by this.
2025-02-03 21:15:42 +01:00
Kawe Mazidjatari
949b71a162 Engine: unload paks in FILO order
Due to the rework on repak and the ability to rebuilt entire map rpaks in original quality, we no longer need to do the hack of unloading paks in FIFO order. Properly unload all SDK paks in the same order engine paks are unloaded, which is FILO.
Custom level paks are now also loaded after mp_lobby.rpak, this allows custom level paks to use assets from mp_lobby too without having to copy them over.
2025-02-03 15:43:58 +01:00
Kawe Mazidjatari
c4bf79376e Engine: enforce type name consistency on runtime pak symbols
Make it consistent with the rest of the code base.
2025-02-03 14:06:45 +01:00
Kawe Mazidjatari
72cbe5bc63 Tier1: increase buffer sizes for help command
Text typically gets truncated on concommands/convars with long help texts, this code is also very old. Increasing the buffer sizes fixed the problem. Code now also logs the usage texts if this is available (usage texts is newer than this code, so it was never taken into account).
2025-02-03 13:58:47 +01:00
Kawe Mazidjatari
d810768895 Engine: use correct method for detouring datablock processor
Should be using DetourSetup here as that one handles attaching and detaching.
2025-02-03 13:22:37 +01:00
Kawe Mazidjatari
456a68af05 GameUI: use cached module handle to retrieve resources
Use the one we cache during the initialization of the SDK, which is faster than looking for it again.
2025-02-03 12:52:30 +01:00
Kawe Mazidjatari
b8550c9f32 VScript: map more fields out for SquirrelVM
Newly reverse engineered fields.
2025-02-03 12:14:50 +01:00
Kawe Mazidjatari
24bce8ee73 Revert "LiveAPI: make code compatible with coroutines"
This reverts commit 9b2034d897e68e2c8677df739e14c77a59901652.
Squirrel coroutines cannot stop during native code execution, it can only happen after a native call has been completed which means that commit 9b2034d897e68e2c8677df739e14c77a59901652 is unnecessary. Revert back to using static objects as this is a lot more performant than allocating/freeing the message each time an event occurs.
2025-02-03 12:13:37 +01:00
Kawe Mazidjatari
8339c44c25 Client: fix underflow and overflow vulnerability in entitylist
Reported by @dr3murr
CClientEntityList::GetClientNetworkable() and CClientEntityList::GetClientEntity() lacked a proper clamp on the 'entNum' parameter. CClientEntityList::GetClientEntity() only handled entNum == -1 cases prior to this patch.
2025-02-02 23:46:59 +01:00
Kawe Mazidjatari
5a6c655196 Recast: fix infinite loop in dtNavMeshQuery::raycast()
Status changes, but the code never acts accordingly on the new status.
2025-02-02 15:00:19 +01:00
Kawe Mazidjatari
56aba36b8c Codecs: disable Miles bank patch validation
The validation code uses internal structures of the Miles Sound System which is different for each version of the sound engine versions we support, which makes switching banks impossible without recompiling the SDK. The bank patches rarely fail, but if we decide to keep this we should seek for an alternative approach i.e. using the DLL interfaces directly.
2025-02-02 14:58:41 +01:00
Kawe Mazidjatari
f18dd71f4b Core: use correct format specifier for image build timestamp
_IMAGE_FILE_HEADER::TimeDateStamp is an unsigned 32 bit integer.
2025-02-02 14:55:03 +01:00
Kawe Mazidjatari
51931b59db RTech: rename member variable
This variable actually represents the structure size, which is the header + the rest of the data in the structure of the asset.
2025-02-02 14:53:48 +01:00
Kawe Mazidjatari
b288d072db Tier0: use cached results from GetInternalStreamMode()
No need to call it again.
2025-02-02 14:52:05 +01:00
Kawe Mazidjatari
e63660b549 Tier0: fix bug in CIOStream::Pad()
We must always use the remainder when writing out padding. The bug was that it would still do the full count or PAD_BUF_SIZE at all times even though the remainder is 20 for example. This fixes the last few rare alignment problems.
2025-02-02 14:51:29 +01:00
Kawe Mazidjatari
c8ee0d4333 Core: improve logger performance
- Drop the need for the ImGui logger sink, we can just use the buffer we already rendered into for the terminal sink.
- Remove ANSI rows inserted by the logger before file logging using offsets and ranges to significantly improve the performance.
- For ANSI row constants, use std::string so appending can use the precomputed string length instead of running strlen() each time internally.
2025-02-02 14:47:57 +01:00
Kawe Mazidjatari
b4f68d69ce Launcher: improve dropdown UI name
Name it "mode" as that is more known for gamers.
2025-02-02 14:41:20 +01:00
Kawe Mazidjatari
0f17987599 Common: improve SVC_SetClassVar member variable naming
This netmessage interfaces with the settings kay values system.
2025-02-02 14:34:57 +01:00
Kawe Mazidjatari
452c226316 Server: improve error message on empty class var value
Should be value as this is a key value system.
2025-02-02 14:32:11 +01:00
Kawe Mazidjatari
66a271d003 Server: fix member variable typo 2025-02-02 14:31:20 +01:00