4637 Commits

Author SHA1 Message Date
Kawe Mazidjatari
bd9beaa33a Resource: improve assembly code formatting
Don't use byte opcodes, and suffix hexadecimal values with 'h'.
2025-01-03 22:36:31 +01:00
Kawe Mazidjatari
5e0c24ad84 Resource: patch out forced texture streaming disable code
If we do not have resident pages, then we can still rely on the GPU driven texture streaming system. However, this code forces the mode to TSM_OPMODE_LEGACY_PICMIP. This is a bug because it contradicts the ability to switch between the dynamic and static systems. Patched the jump from a conditional one to an unconditional one to always skip over this broken code.

This also ultimately drops the need for having a dummy STBSP file, and the benefit of not having a dummy STBSP file is that 'hasResidentPages' will be false, which disables the STBSP world texture crediting code, reducing frame times.
2025-01-03 22:32:37 +01:00
Kawe Mazidjatari
36d2b3534a MaterialSystem: properly switch between static and dynamic texture streaming systems
The engine has a bug where it would use GPU feedback even when a static precomputed texture streaming database file exists. If we have an STBSP file for the given level or override, load that in and disable GPU feedback so proper use of the static file could be made. Else we load gpu_driven.stbsp which is a dummy to enable the dynamic, GPU based texture streaming system.
2025-01-03 15:19:48 +01:00
Kawe Mazidjatari
d20488c919 RTech: add constant for GPU driven texure streaming database file
This is a dummy file which enables the GPU driven texture streaming system, which loads/drops textures based on GPU feedback rather than a static texture streaming database file.
2025-01-03 15:15:36 +01:00
Kawe Mazidjatari
f0511a89a7 Common: add cvar 'gpu_driven_tex_stream'
Also compiled out stream_overlay and stream_overlay_mode for dedicated server builds; texture streaming is a client only feature.
2025-01-03 15:13:27 +01:00
Kawe Mazidjatari
8720dde3cb MaterialSystem: obtain texture streaming instance pointer 2025-01-03 14:06:17 +01:00
Kawe Mazidjatari
6ae072386d RTech: add texture streaming database types to SDK 2025-01-03 14:05:21 +01:00
Kawe Mazidjatari
6bf516f1ef MaterialSystem: implement stream info dump command
Implement the ability to dump the entire texture streaming debug info to the console. This will also log it to the log file.
2025-01-01 22:49:18 +01:00
Kawe Mazidjatari
b75655c101 Tier0: binary io stream class refactor
Class has been reworked to always take the reverve seek amount into account when adding to output size. Previously, we still incremented the output size even when we seeked back and modified data rather than appending to the end.

The manual write size calculation was a design choice as seeking and calling tellp is slow.

The enum has also been slightly reworked by removing the BINARY enumerant, and adding a new mode which allows you to open a stream in read/write mode.
2025-01-01 22:44:43 +01:00
Kawe Mazidjatari
4ffcc4ca75 RTech: show header alignments in asset types overview
Show the asset's header's requested memory alignment.
2025-01-01 21:42:59 +01:00
Kawe Mazidjatari
bef61249fd RTech: function qualification and symbol naming consistency improvements
Use static and const where possible, and rename 'segments' to 'slabs' as this represents a huge buffer in which pages are allocated to, and slab fits this name better.
2025-01-01 21:40:04 +01:00
Kawe Mazidjatari
c6d451c753 Recast: implement editor window resizing
Small UX improvement.
2025-01-01 21:36:01 +01:00
Kawe Mazidjatari
26f48507f4 Tier0: pattern searching code improvements
Eliminate extraneous type promotion/demotion.
2025-01-01 21:33:02 +01:00
Kawe Mazidjatari
2a357914da Windows: enfore naming consistency
Enforce consistency throughout the rest of the file.
2025-01-01 21:28:04 +01:00
Kawe Mazidjatari
92842e4ac2 Windows: cleanup CreateTextureResource and improve performance
Use an actual static structure array rather than a std::pair, and make sure the array is sized exactly to what we need (there are 62, the rest was also part of the game, but not from the bytesPerPixel array and therefore shouldn't have been copied. Also improved the error message to always show the texture as some paks don't have texture names.
2025-01-01 21:17:20 +01:00
Kawe Mazidjatari
5f8afd9cf0 VGui: add note for improving stream overlay in the future
Needs to be separated out and either run in ImGui or a panel outside the game.
2025-01-01 21:07:41 +01:00
Kawe Mazidjatari
5369b21a64 GameUI: use V_isspace instead
This should be the fastest version available without any additional locale awareness.
2025-01-01 20:42:42 +01:00
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