RCON was using buffer types and size types inconsistently, which required having to do many casts. Normalized type usage to reduce the number of casts required.
- Directly copy available bytes into message buffer instead of 1 per iteration.
- Use an actual frame header and make desync error detection more robust.
- Only lookup the map key once, and construct its name with already known size.
- Store pointers to entry blocks rather than copying it, since by the time we build the tree, the entry block vector is guaranteed to not change. It is also qualified as const.
Changed in commit b1d81e2dc54596fff7efa31fd874134c3c2671a3, sizes must now be provided to minimize the amount of strlen's performed by protobuf internally.
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.
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.
- 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.
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.
- 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.
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.
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).
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.
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.
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).
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.
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.
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.