202 Commits

Author SHA1 Message Date
Kawe Mazidjatari
da6ffe9005 Engine: implement pak preloading
Some specific paks are loaded through code (common.rpak, ui.rpak. etc). We have implemented a system that also loads 2 common rpaks that are of our own (common_sdk.rpak and ui_sdk.rpak).

There is al additional syustem we had implemented earlier that allows you to mount rpaks during level load, which will get loaded before the actual level rpak, this is useful as when we port a map that has evolved slightly from its original one, only needing 20 new models, it makes more sense to load the original rpak + a new one that contains the 20 new models to save disk space.

This is also useful for mounting paks specific to mods for a certain map, however since we have some core mods (flowstate) we have to add it to the settings for for each level. These paks also get dropped and reloaded each time on level changes causing longer load times and more memory usage during level loads.

This system mounts paks after all common paks are loaded (from both the engine and sdk), and keeps them active just like the common paks throughout level changes until they are either manually unloaded, or the game has been closed.
2024-11-14 14:54:27 +01:00
Kawe Mazidjatari
46e2424bb2 Engine: increase default stringcmd quota to 32
16 was causing the clients to get kicked when they hover and moving their cursor over the characters in character select very fast. The scripts tell the server to update the view to other clients but unfortunately the system relies on string commands (ClientCommand) and is pending a rewrite to incorporate a proper RPC just like Server and UI has. For now we increase the limit to 32 as 32 is still outside the exploitable range when the game is ran without dev tools enabled.
2024-11-12 02:08:40 +01:00
Kawe Mazidjatari
a809b1f262 Server: remove exraneous client pointer check
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.
2024-11-11 17:47:36 +01:00
Kawe Mazidjatari
43e162711e Core: add option to run the game fully offline
The game can now be ran fully offline by providing '-offline' to the command line arguments. The engine will auto execute 'system/autoexec_offline.cfg' which overrides other autoexecs to ensure the game runs offline. The system/autoexec_offline.cfg file only overrides the variables it sets.
2024-11-09 01:22:43 +01:00
Kawe Mazidjatari
a702323181 Pylon: add option to fully disable matchmaking server connection
Fully disable the system if pylon_matchmaking_enabled is false.
2024-11-09 01:19:23 +01:00
Kawe Mazidjatari
d0ec49cc52 RTech: fix resource leak
CustomPakData_t::numHandles was never decremented on unload, causing pakId == PAK_INVALID_HANDLE to be true and triggering the assert. Due to this, we either never unload resources properly on subsequent unloads and loads, or we would run out of pak slots as numHandles will reach MAX_CUSTOM_PAKS. Also added a comment explaining why this loop isn't ran in reverse.
2024-11-08 21:51:04 +01:00
Kawe Mazidjatari
046c37f160 Engine: improve level pak unload logic
Only handle level related paks and data when we are processing the level pak (the 4th pak in the list).
2024-10-07 11:17:16 +02:00
Kawe Mazidjatari
e925f4cb6e Engine: fix level pak unloading crash
Changing the load/unload system to FILO caused a crash when loading 3 level paks, either through request load or level settings, and then unloading them in reverse order. This is a regression caused when the pak loading and unloading system was reworked. Changing the system back to FIFO fixes the issue.
2024-10-07 11:07:06 +02:00
Kawe Mazidjatari
56b884c7ff Engine: remove duplicate forward declaration 2024-10-06 11:47:30 +02:00
Kawe Mazidjatari
04afde3a80 Common: rename netmsg function 2024-10-04 12:50:03 +02:00
Kawe Mazidjatari
432cb923cc Engine: fix compile error
Netmsg is defined as SVC_SetClassVar, not as SVC_SetClassSettingsVar. Rename was missed before submitting b11d7e3c9b1555673d6cb490e60eca19153195e9.
2024-09-28 12:28:28 +02:00
Kawe Mazidjatari
b11d7e3c9b Engine: add new netmsg 'SVC_SetClassVar'
Netmessage SVC_SetClassVar allows the server to change class settings securely on the client. This was implemented due to popular demand, and previous approaches using a combination of ClientCommands (Cbuf and NET_StringCmd) were deemed insecure and unreliable.
2024-09-25 20:08:28 +02:00
Kawe Mazidjatari
8abbed283e Engine: add implementation for registering new netmessages 2024-09-25 15:04:45 +02:00
Kawe Mazidjatari
10efa56c58 Engine: don't run NVIDIA Reflex if -gfx_disableLowLatency was specified
This command line argument should fully disable NVIDIA Reflex, AMD Anti-Lag 2 and PCL statistics.
2024-09-16 16:27:02 +02:00
Kawe Mazidjatari
0eb0d73ae1 Game: make AI utility class instance static
Static allocation instead of dynamic.
2024-09-16 14:15:15 +02:00
Kawe Mazidjatari
690272e8e1 Engine: fix compile error for dedicated server
NormalizeFrameRate should not be compiled for dedicated as g_pGame only exists on client builds.
2024-09-14 12:11:29 +02:00
Kawe Mazidjatari
720584be25 AMD: Implement Anti-Lag 2 SDK
AMD's equivalent of NVIDIA Reflex.
2024-09-14 11:57:18 +02:00
Kawe Mazidjatari
d399b486b6 NVIDIA: rename Reflex function prefixes
Prevent ambiguity when AMD Anti-Lag 2 is implemented.
2024-09-13 21:29:25 +02:00
Kawe Mazidjatari
d95d071afd Tier1: properly implement ConVar change callbacks
Change callbacks actually take a structure of 2 pointers, one being for the callback itself, and the other being 'userdata' which typically is used to sync the ConVar with VGUI slider elements. This issue was noticed after implementing the ADS scalars and attempting to hook them up to VGUI, only to find out it would crash due to this lacking detail. All change callback prototypes had to be adjusted.
2024-08-05 00:45:30 +02:00
Kawe Mazidjatari
1e667c8f30 Engine: use CThreadMutex for installed maps global
Use the type used by the engine instead of STD.
2024-08-03 11:03:39 +02:00
Kawe Mazidjatari
1c2c61a397 Engine: fix compile error
Preprocessor directive should've been used on newly added CHLClient::Init + fixed missing include.
2024-07-31 22:38:44 +02:00
Kawe Mazidjatari
044528b9b1 Game: properly load shared global vars for game dll's
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.
2024-07-31 22:18:33 +02:00
Kawe Mazidjatari
e41366f065 Client: reverse client entity list class
Fully reversed.
2024-07-31 15:06:54 +02:00
Kawe Mazidjatari
7eb6017c16 Core: update copyright notice headers
Fix corrupted copyright symbol.
2024-07-29 21:09:55 +02:00
Kawe Mazidjatari
6c6a9b0140 Core: move all base integral types to dedicated header
There was always a problem dealing with core integral types accros various projects, since we typically only use IDA's pseudo definitions for rebuilding decompiled functions. It however did define almost all the integral types we use throughout the SDK. These types have been commented out and a new header has been made that defines everything we need (and we can add more in the future if this deems necessary). This new header is included with tier0/basetypes.h, so all projects have access to it and the tier0 headers will work out of the box without defining anything new.
2024-07-06 17:10:21 +02:00
Kawe Mazidjatari
20e0d0ee53 Client: add note for reconnect logic
Potential engine bug that needs to be fixed to allow reconnecting to listen server without killing it.
2024-07-05 15:56:07 +02:00
Kawe Mazidjatari
a1bd8bd012 Engine: add reconnect logic and concommand for client
Allow the user to reconnect to a server by running 'reconnect', this also allows for reparsing all client side scripts while debugging the game on a dedicated server.
2024-07-01 00:20:03 +02:00
Kawe Mazidjatari
aa3e33a497 Engine: flip lump loading check
Make it more obvious what we are loading and what not (instead of checking if its client only, check if the server should load it since the client needs everything). This will also make sure that we never load other lumps even if they are present in the VPK or disk (they aren't for dedi builds).
2024-06-27 00:07:58 +02:00
Kawe Mazidjatari
358a2c4bf0 Engine: improve naming convention for RCON
Make it more consistent with the rest of the SDK. Nothing logic wise has been changed in this patch.
2024-06-17 15:24:08 +02:00
Kawe Mazidjatari
501c6bd512 Engine: add ConCommand for re-logging installed netkey
Some users complained about not being able to practically retrieve the installed netkey from the application's console as it bets buried under newer logs (and eventually cleared). This ConCommand allows the user to query the installed key without having to look through session logs.
2024-06-07 22:34:50 +02:00
Kawe Mazidjatari
442f28e6cc Engine: check for bitbuf overflow after reading voice data 2024-05-31 13:44:27 +02:00
Kawe Mazidjatari
371ece6005 Engine: make debug statement a warning 2024-05-26 13:13:33 +02:00
Kawe Mazidjatari
20d3a66b8e Engine: add functionality to run game without the platform system
Unbind the game from the platform system, which is useful when developing for or debugging the game. This was supposed to make it into the SDK back in 2021, but wasn't due to the ability to spoof usernames. This is no longer possible on servers requiring authentication as the player's name is actually checked along with the Nucleus ID.
2024-05-17 11:12:57 +02:00
Kawe Mazidjatari
f0fe2bf58f Engine: fix client dll compile error
This code should not compile for client.dll.
2024-05-07 15:02:36 +02:00
Kawe Mazidjatari
5b0303357f Engine: fix stack smash in client side UserMessage processor
Unclamped CBitRead::ReadBits() call on stack buffer of MAX_USER_MSG_DATA bytes. Function has been rebuilt with additional clamping to mitigate the problem.
2024-05-07 14:44:12 +02:00
Kawe Mazidjatari
a61c475379 Engine: fix numerous exploitable bugs in voice protocol
- Fixed stack smash in CClient:ProcessVoiceData (oob read on bitbuf).
- Fixed stack smash in CClient:ProcessDurangoVoiceData (oob read on bitbuf).
- Fixed ability to bypass team check on Durango voice packets if forced as reliable from the sender (client).
- Incorporated the following missing checks in the durango version of voice broadcasting:
  - Enforce chat between multiple teams using cvar 'sv_alltalk'.
  - Ability to also disable Durango voice data with cvar 'sv_voiceenable'.
  - Ability to echo voice with Durango voice data using cvar 'sv_voiceEcho'.
2024-05-07 14:05:11 +02:00
Kawe Mazidjatari
29fd9e3ed7 VpkLib: make regex available to other code and utilize those instead
Prevent copies or similar patterns that might not work as good.
2024-04-23 00:03:31 +02:00
Kawe Mazidjatari
b5616999ab PluginSystem: add callback for chatroom receiver
Allow plugins to block chat msg's based on their text.
2024-04-20 23:27:00 +02:00
Kawe Mazidjatari
7bc7c9d2f4 Engine: simplify "script" command callback for server
Code actually doesn't need to be ran in the server frame thread. All the code really does is preparation work. Run it in the main thread but do join the server frame thread (FCVAR_SERVER_FRAME_THREAD) as we can't do concurrent work on the server VM.
2024-04-20 01:33:34 +02:00
Kawe Mazidjatari
84daa21cfd Engine: don't broadcast voice data on training dedi
Training dedi doesn't support broadcasting voice data, return out.
2024-04-20 01:00:49 +02:00
Kawe Mazidjatari
85b7f84d47 Engine: add command line statics for dedicated server and light cleanup
CGameServer::SpawnServer() pointer to engine/server/server.h, and renamed it to CServer::SpawnServer().
2024-04-20 00:59:39 +02:00
Kawe Mazidjatari
1455017419 VScript: properly implement script command callback
Previously we did sq_pushroottable() and a subsequent sq_call() after compiling the text buffer, but this didn't work for code that was threaded, or using Get/SetNetVar* functions.

The second issue was that the callback for the "script" command was ran in the main thread. Server script should always run in the server frame thread, the Set/GetNetVar* functions check thread id to retrieve the correct VM context, so running server script from the main thread ended up with Set/GetNetVar* functions retrieving the client VM context rather than server's, causing undefined behavior.

Script commands are now queued to the server frame thread, ultimately fixing this bug.

Also fixed a small bug with function 'sq_compilebuffer()'; it takes an extra argument but this wasn't taken into account in the SDK.
2024-04-19 12:56:10 +02:00
Kawe Mazidjatari
fdbd9a6452 Engine: fix incorrect assignment on rcon socket bind
The assignment on the ternary operator should be flipped, bug was spotted during beta testing.
2024-04-15 23:58:16 +02:00
Kawe Mazidjatari
28d8dc25e5 Engine: move unrestricted command exec code to separate function 2024-04-14 23:25:36 +02:00
Kawe Mazidjatari
7791daef87 Engine: enforce rcon convar name consistency
Removed extra '_' from sv_rcon_whitelist_address, its now sv_rcon_whitelistaddress.
2024-04-14 16:14:19 +02:00
Kawe Mazidjatari
b8bde9ad0e Engine: use dedicated convar to determine rcon server socket bind
Decoupled from net_usesocketforloopback since we actually don't want this to be tied with that of the game. Now it by default does not bind to the loopback socket unlike the game.
2024-04-14 16:11:58 +02:00
Kawe Mazidjatari
07e944ff70 Engine: remove extraneous trailing semi-colon 2024-04-13 15:50:21 +02:00
Kawe Mazidjatari
00e9840353 Server: add option to respect game state when performing auto reload
Can be toggled with the new cvar 'host_autoReloadRespectGameState', and used in combination with the new server script func 'SetAutoReloadState( bool state )'. This makes sure that even when the timer reaches 'host_autoReloadRate', it would wait with the reload until the game itself is finished (which is when SetAutoReloadState( true ) is being called from scripts).
2024-04-12 22:06:31 +02:00
Kawe Mazidjatari
891f1796b0 Engine: exec liveapi.cfg on start
Allow configuration of the LiveAPI system
2024-04-12 20:53:19 +02:00
Kawe Mazidjatari
513316b6a0 Engine: fix typo in CClientState member variable name
Renamed from m_nProcesseedDeltaTick to m_nProcessedDeltaTick.
2024-04-12 20:35:19 +02:00