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.
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.
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.
- 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.
For future updates, this allows for customizing the main menu to its full extend without modifying larger ui rpak files as we separate all title screen assets and put it into this new pak.
This reverts commit 9939d963efa13332a1b9c2cf0d53bd90bc772ed1. It turns out we actually should check on !g_pServer->IsActive() as we shouldn't restrict on our listen server. Development code heavily relies on this.
This check is meant to drop the restrictions if we are in single player mode, we should however properly check in this by checking the actual game mode rather than if the listen server is running.
This code was written at the start of the project before much of the engine was reverse engineered. There were some design problems where core server functions were shared with UI script.
A second problem was that not everything was properly synced between another; CServerHostManager held its own instance of the server name and server description, while the engine has actual convars to store these. So scripters weren't able to get the server name and server description if the server was a listen server and launched through the title screen.
The CServerHostManager class has been reworked to not keep a second instance, and the script functions for creating the servers have been reworked to always store the name and description in aforementioned convars.
Also moved the CreateServer and DestroyServer function to the UI namespace of scripts, and it is now only registered in UI context. The server should use GameRules_ChangeMap() to switch levels instead.
UI script also no longer registers core server functions, this was a design mistake and has been fully factored out in this patch.
The server script function 'SetClassVarSynced' has also been deprecated and removed, since calling this sends a netmsg to all connected clients, and running this once will not apply the new class var values to clients connecting afterwards. This should be managed through player.SetClassVar in the connect codecallbacks in scripts.
In commit 1fd4c25cd0188f96c7d1fe7b0a8b072763eed032, an attempt was made to fix this by calling the message handler with WM_NULL, but WM_KILLFOCUS should've been passed instead, as Dear ImGui clears the keydown state with this message. WM_NULL does nothing.
PostMessage hooks are no longer needed as we properly handle the messages when the imgui window procedure is running. The g_nWindowRect global is also no longer necessary because we now properly update the CGame's window size members as of commit 7ec1e679fd2676cde8e286812a0f5bec454f7d92.
Holding a key while closing the panel will keep the message in the event queue, the next time one of the windows are opened, the message will be spammed. Send a null msg to clear it properly.
Must be inherited through CTier1AppSystem to match the game's interface. Removed extraneous IAppSystem virtual method declarations as they are no longer needed to pad the vftable out.
In this engine, GetTier() doesn't exist, GetDependencies() however does exist (confirmed by the vftable for CInputStackSystem) and therefore we should adjust all interfaces to make it use this instead.
Save even more performance by not calling the ImguiSystem message handler at all when the imgui surface isn't active; we don't need to track input movement at all when this isn't active. Also dropped the blockage of all window messages except 'WM_SETCURSOR', added a detailed comment as to why this is blocked.
Dedicated server or Client only builds will warn to the console if something is trying to set a convar, or execute a concommand that doesn't exist. Dedicated server builds don't have client commands/convars, and visa versa.