- 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.
Network addresses should always be stored as base only (without their port numbers), since all additional data can change on reconnects which will make comparisons impossible.
nRead was incorrectly placed, it should've been in the parse call. This is used to process the string buffer at once since we already know the size of the string buffer.
No longer needed as of commit 3209af9a6c2509e5e6969199f5d9913b0ddb6ed0. These defaults were for the server browser but this code has now been moved over properly.
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.
Field name and field type were incorrectly set, GetServerByToken only returns 1 server and is always an object but it was always treated as an array of servers. Fixed field name and field type.
CServer::GetClient() will never return NULL as it returns address of client in array. Removed extraneous checks as its misleading, and added const where possible.
Properly load it from CServerGameDLL::DLLInit (and new in this commit, the client's shared globals from CHLClient::Init), this way we can also avoid the double dereference which improves performance. Also performed an architectural change where anything outside Game DLL code uses the shared interface pointer instead of the objects directly.
During port to new performant JSON utils system in commit a5e05d3996ae95876fcac09affeaa043a768e749, the typo was made causing EULA not to display during tests. Fix field name typo.
Now uses new JSON member lookup utilities implemented in commit f6e93ee457876ce869ce04067fe9344ff81083ca. All lookups (typically 3 per member) have been reduced to 1 by caching and reusing all value pointers or iterators. Also added error strings for 2 missing error cases in CPylon::GetEULA(), previously it would only set the error string during fetch error, but not when the data is missing or the schema is incorrect.
This patch splits host logic from CServerListManager. CServerListManager is actually meant for the client to manage the server list to which the client could connect to. The hosting logic has been moved to the new CServerHostManager class.
Previously, we stored all the hosting details in CServerListManager, with connection criteria in CPylon, this data has been moved over to CServerHostManager as well.
Previously, we also needed a mutex to access the server host data, function HostState_KeepAlive() has been refactored to the point this mutex is no longer necessary as the only threaded process is the actual request, the rest is being applied in the main thread. We also now only construct a NetGameServer_t struct if we actually plan to host.
Access to CPylon::m_Language is now also protected by a mutex, as the change callback of cvar 'language' and the threaded method 'CPylon::QueryServer()' are competing for access.
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project.
This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console).
Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
Properly implement the ConCommandBase and ConCommand classes so we could statically construct all ConCommand objects in the global scope of each translation unit, this way we don't need to put them in a global file and deal with preprocessor directives to compile then in/out for certain projects.
* Make sure we read the banlist from platform as well, just like how we write to it.
* Use strtoull() instead of atoll() for nucleus id values, nucleus id is unsigned so we must convert to unsigned.
* Remove extraneous try catches, these were previously used for integral type conversions that threw exceptions, but the current ones do not throw so the try catch is unnecessary.
* Use CThreadFastMutex instead
* Rename ISurface to IDebugSurface to prevent a potential name collision with VGUI's ISurface iface if we ever add it
* Fix race condition when setting CPylon::m_HostIP from materialsystem thread, this has been dispatched to the main thread
* Marked 'pylon_matchmaking_hostname' FCVAR_MATERIAL_SYSTEM_THREAD as we use it in the server browser panel.
Avoid heap memory allocation and a level of indirection. This allows the compiler to optimize the program even more. No logic has been changed in this patch.
Remove workaround that was implemented to counter a crash during the beginning of this project, this issue was long solved but the workaround was never removed. Clearing the last precached VPK name prevents the engine from helping other threads to properly unload existing handles, if at all.
The KeyValues class belongs here. Also reimplemented most loading methods for KeyValues, and adjusted the VPK building code to account for it. Pointers to the engine's implementation of KeyValues have been moved to a separate header ('keyvalues_iface.h'), as this allows external tools code to utilize the standalone KeyValues class implementation. Playlist utilities are completely separated from the KeyValues header; these have nothing to do with KeyValues other than manipulating a global KeyValues object for the playlists, and thus have been named as such and moved to rtech/playlists.
Display the EULA (fetched from masterserver), which the end user MUST accept before they can make use of the multiplayer features of R5Reloaded. NOTE: user doesn't need to agree to this to use the listenserver.
They were all strings; changed them to what made most sense for each field type. Changes:
"hidden": string -> bool
"port": string -> int
"checksum": string -> uint
"playerCount": string -> int
"maxPlayers": string -> int
The game internally obtains a auth token from Origin. On connect to a gameserver, it will send it to the masterserver. The master server will create a JWT token and send this back to the client. The client stores this token in 3 userinfo cvars (token, sig1, sig2). the sig1 and sig2 cvars are there to compensate for the truncation caused by sending the cvar, as each cvar string length could be up to 255 (byte max). The server verifies this token (the signature, timestamp, expiry); if they are valid, the has successfully authenticated and will connect.
The member must contain a copy of the string, pointing it to the buffer used by the language cvar results in undefined behavior. Several cases were the string pointed to random data were reported.