4620 Commits

Author SHA1 Message Date
Kawe Mazidjatari
3f12f6f203 Common: fix regression causing game modes not to work properly in retail mode
mp_gamemode's development flag added back in commit 3209af9a6c2509e5e6969199f5d9913b0ddb6ed0 as it was being set internally only previously, but we have to run it through cbuf in the following frame when we launch into the new map to allow the engine to apply it to all global states properly, to run it through cbuf the developmentonly flag needs to be removed from the cvar.
v2.5_rc5_event
2024-12-06 23:49:51 +01:00
Kawe Mazidjatari
551840e6a3 NetworkSystem: fix bug when checking for pending map change
We need to check if it has a string before calling Playlists_Parse(), because if it has it will be emptied so the check afterwards won't work.
2024-12-05 23:38:53 +01:00
Kawe Mazidjatari
8490344d93 Server: fix bug in CC_CreateFakePlayer_f
- We don't need to call CVEngineServer::LockNetworkStringTables, as CVEngineServer::CreateFakeClient already does this.
- We should never run CVEngineServer::CreateFakeClient() and CServerGameClients::ClientFullyConnect() when we aren't doing this from the server frame thread, or when we are doing it outside the server frame thread while its active. We not wait and help with other jobs until the server frame thread is finished before adding our bot.
- Removed team number check, this is already performed in CClient::SetTeam().
2024-12-05 20:10:07 +01:00
Kawe Mazidjatari
6a8eb40930 Engine: light cleanup on CVEngineServer 2024-12-05 20:05:39 +01:00
Kawe Mazidjatari
8c85e1ec68 Revert "Engine: properly detect if we are in single player mode"
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.
2024-12-05 20:05:13 +01:00
Kawe Mazidjatari
9939d963ef Engine: properly detect if we are in single player mode
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.
2024-12-05 15:57:48 +01:00
Kawe Mazidjatari
3d8d0b37a6 NetworkSystem: remove default assignments for map and playlist
No longer needed as of commit 3209af9a6c2509e5e6969199f5d9913b0ddb6ed0. These defaults were for the server browser but this code has now been moved over properly.
2024-12-05 15:55:36 +01:00
Kawe Mazidjatari
3209af9a6c Engine: large server host code refactor
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.
2024-12-05 15:53:40 +01:00
Kawe Mazidjatari
67b43192ef RTech: add pointer to requested map-to-load buffer
Will be used for server launching rework.
2024-12-05 13:53:50 +01:00
Kawe Mazidjatari
fbf95f64ad Common: fully replace 'mp_common' change callback
There was a bug where we only removed the old change callback on the dedicated server. On client builds we added a second one causing SetupGameMode to be called twice, and the second call will be with the incorrect (previously set) gamemode. We now fully replace the callback because the one we have in the SDK is identical to the one in the engine, except it does not call SetupGamemode through the client's engine interface.
2024-12-05 13:50:38 +01:00
Kawe Mazidjatari
7fd33da180 Common: only rerun 'language->SetValue()' when provided language is unsuppported
The function was always ran, but it should only be run if the language provided isn't supported.
2024-12-05 13:25:49 +01:00
Kawe Mazidjatari
e0c7a9b980 CMake: fix typo in comment 2024-12-05 13:19:35 +01:00
Kawe Mazidjatari
fd0521fce6
Merge pull request #134 from O-Robotic/p4sync
Tier0: Fix resource leak in CFrameTask
2024-12-04 16:58:32 +01:00
O-Robotic
e38d9ab1e9 Tier0: Fix resource leak in CFrameTask
The m_nDelayedFrames counter was being decremented when it was 0, this caused the removal logic to never remove anything from the list as m_nDelayedFrames was never 0
2024-12-04 13:23:50 +00:00
Kawe Mazidjatari
8237f2b1f3 BanSystem: use automatic JSON type classification
New feature as of commit 138600a3a6dafeae3d441e6a3c74b865ea88f1d3.
2024-11-29 14:51:30 +01:00
Kawe Mazidjatari
163f38c87d NetworkSystem: use automatic JSON type classification
New feature as of commit 138600a3a6dafeae3d441e6a3c74b865ea88f1d3.
2024-11-29 14:50:51 +01:00
Kawe Mazidjatari
138600a3a6 Tier2: implement new JSON tools
Implemented robust and cheap number parser, which can parse numbers from json string and json numbers. Strings can be hexadecimal, octal and decimal. Converter gets selected at compile time. Also implemented a few inlines that return user provided default if value wasn't found or didn't match specified or classified type.
2024-11-29 14:44:22 +01:00
Kawe Mazidjatari
77851d9ad7 ImguiSystem: reset keydown state properly once window closes
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.
2024-11-28 00:26:15 +01:00
Kawe Mazidjatari
c8e8bea154 Windows: remove extraneous code
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.
2024-11-24 14:52:31 +01:00
Kawe Mazidjatari
f7f9e9e425 VGUI: use actual game window size for debug text positioning 2024-11-24 14:50:15 +01:00
Kawe Mazidjatari
7ec1e679fd Engine: properly adjust window size when buffers are resized
The engine never updates CGame's window size members when the window size is adjusted. This patch now calls CGame::SetWindowSize() when the window is resized to make sure these members are always in sync.
2024-11-24 14:48:45 +01:00
Kawe Mazidjatari
7ee1626233 Engine: add setters for game window rect 2024-11-24 14:45:02 +01:00
Kawe Mazidjatari
bb99cec2fe ImGui: remove extraneous code
No longer needed as we don't call the ImGui window procedure if no imgui surface is drawn.
2024-11-24 14:02:38 +01:00
Kawe Mazidjatari
fd04eef1ce ImguiSystem: add method for checking if we have an active surface 2024-11-24 14:02:37 +01:00
Kawe Mazidjatari
02a0088deb VGUI: reverse engineer and rework CEngineVGui vftable 2024-11-24 12:17:23 +01:00
Kawe Mazidjatari
c09e6d6948 Engine: expose Host_Error
Should be callable by other code.
2024-11-24 12:12:38 +01:00
Kawe Mazidjatari
ec77faeb97 Engine: fix incorrect function pointer for sigscan debugger 2024-11-24 12:07:43 +01:00
Kawe Mazidjatari
ab0ec34e80 Engine: fix underflow vulnerability in CL_CopyNewEntity
Code only checked upper bounds, this patch adds an additional lower bounds check.
2024-11-24 12:05:49 +01:00
Kawe Mazidjatari
2128b0ad04 Engine: properly handle under/overflows in CL_CopyExistingEntity
The engine expects the pbError parameter to be set when there is an error. Also call Host_Error to let the user know why we errored out.
2024-11-24 12:03:08 +01:00
Kawe Mazidjatari
10b466bde7 Engine: use new reverse engineered types for CL_CopyExistingEntity 2024-11-24 11:59:55 +01:00
Kawe Mazidjatari
ffbbbfc483 Engine: fully reverse engineer CEntityInfo & CEntityReadInfo 2024-11-24 11:55:53 +01:00
Kawe Mazidjatari
1fd4c25cd0 Engine: fix imgui regression causing inputs to be stuck
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.
2024-11-24 00:40:44 +01:00
Kawe Mazidjatari
bae7df37ae MaterialSystem: don't sample imgui frames if window is occluded
Check if the window is occluded first before sampling. Massive runtime load reduction when application minimized in full-screen mode.

This also fixes the issue where the console would scroll all the way to the top when the application is minimized in full screen mode, as we can't calculate the window sizes properly causing SetScrollPos to set the pos to a large negative value.
2024-11-23 01:22:32 +01:00
Kawe Mazidjatari
7febdde3d4 GameUI: light console code cleanup and optimizations
Use static functions instead of an std::function for stuff that could've easily been a static or inline. This imposes less overhead to the runtime.
2024-11-23 01:09:21 +01:00
Kawe Mazidjatari
e05d137acd GameUI: developer console UX improvements
A common request was to make the tab key select the highlighted item in the autocomplete suggest window, much like the enter key. This key however could also be used to instantly select the first item in the autocomplete suggest window without having to move the cursor there.
2024-11-23 01:05:04 +01:00
Kawe Mazidjatari
bd06ddcb74 GameUI: improve comment regarding parked autocomplete suggest position
Make sure this doesn't get confused with out of screen while still indexing into the list.
2024-11-23 01:03:29 +01:00
Kawe Mazidjatari
8c7bb52673 GameUI: enforce consistency in file 2024-11-23 01:01:45 +01:00
Kawe Mazidjatari
6f534e9811 ImGui: readjust and fix imgui keybind configuration
In commit f5f14c153f0115af7a0ac5fe3b4be98b3816be84, a change was made to switch the default keys to pgup and pgdown. It appears however that these keys were used for the chat window.

The defaults have been adjusted to (backtick and f10) for console, and (insert and f11) for the browser.

There was also a bug in ImGuiConfig::Save() where it double nested the keyvalues, this has also been fixed. The keyvalue file now parser properly.

The option panel in the console has been slightly reworked to also show the secondary binding options for both the console als browser allowing the user to change both the primary and secondary for both windows without having to manually edit the files.
2024-11-23 00:09:21 +01:00
Kawe Mazidjatari
6ed6711426 Core: use fallback session UUID if CreateUUID fails
Instead of a hard application failure, use a fallback UUID.
2024-11-22 15:07:41 +01:00
Kawe Mazidjatari
a003e21f6e Tier0: return empty if UuidToStringA fails
UuidToStringA could fail, return an empty in this case.
2024-11-22 15:05:35 +01:00
Kawe Mazidjatari
59bdc55d15 Tier0: utility cleanup
Cleanup by qualifying anything const that isn't or shouldn't be modified. Also made an optimization StringReplaceC (String Replace Copied), to only start copying if the substring to replace even exists in the given input.
2024-11-22 15:04:05 +01:00
Kawe Mazidjatari
a6a0226481 ImguiSystem: use initializer list for constructor 2024-11-20 17:26:53 +01:00
Kawe Mazidjatari
2f618bbe04 Miles: use stack buffer for stream file path
Stack buffer of MAX_PATH is more then enough for this, avoid allocating the string to heap. Also made the return value of v_Miles_Initialize const.
2024-11-20 17:24:56 +01:00
Kawe Mazidjatari
f78a842744 Resource: update cleanup automation script
These files are no longer used and could cause problems, added them to list of files to cleanup after an update is installed.
2024-11-20 17:22:49 +01:00
Kawe Mazidjatari
f212e96a96 Engine: decouple imgui window procedure from main
Light cleanup.
2024-11-20 17:12:42 +01:00
Kawe Mazidjatari
e4dafa240e Windows: do not run DX hook when DXGI_PRESENT_TEST is set
Present only returns the status when DXGI_PRESENT_TEST is set, no data will be renderer and displayed. We should not run the frame rate limiting logic, and NVIDIA reflex on this!
2024-11-20 15:15:54 +01:00
Kawe Mazidjatari
745024d198 LiveAPI: always set POD stack var if loop has ran, don't check it
No point checking on this, removes an extra instruction.
v2.5_r5
2024-11-18 01:36:32 +01:00
Kawe Mazidjatari
9b2034d897 LiveAPI: make code compatible with coroutines
The script engine supports running coroutines, which means we cannot use statics for each message as 2 coroutines could fight for a event mesage

I.e. we have 2 coroutines handling a player damaged event, the message could be populated with a mix of data between the 2 coroutines.

Therefore, we cannot optimize this by statically allocating it and must allocate it for each coroutine separately. The extra memory and cpu overhead caused by this is still very low.
2024-11-18 01:32:32 +01:00
Kawe Mazidjatari
e5b6e3eb6e ModSystem: fix unwanted double-nesting when writing status list
The keyvalues file is written incorrectly as we double nest the mod list by calling FindKey on "ModList" with the create parameter set. The constructor of KeyValues already creates the root object called "ModList" in which the list should be stored.

The list is now properly parsed, making the enable/disable feature for individual mods work again.
2024-11-17 21:54:24 +01:00
Kawe Mazidjatari
eb374b4328 Tier0: bump game sdk version to 013
Force new version on master server.
2024-11-17 16:48:38 +01:00