4650 Commits

Author SHA1 Message Date
Kawe Mazidjatari
3cbdab512d RenderSystem: reverse engineer more of 'TextureAsset_s'
Reversed the last used frame (last time the texture was accumulated), and the last time the texture was credited. Also reversed the actual histogram bin fields; in Apex Legends there is a new one for the GPU driven texture streaming system.
2025-01-06 17:09:14 +01:00
Kawe Mazidjatari
b617caf1d8 MaterialSystem: add histogram bin count define
Will be used in the future.
2025-01-06 17:06:59 +01:00
Kawe Mazidjatari
538df8e02c RTech: enforce member name consistency 2025-01-06 16:57:07 +01:00
Kawe Mazidjatari
05f37cad73 RTech: move forward delcarations out of public headers
These are only used by the runtime's global state.
2025-01-06 16:43:21 +01:00
Kawe Mazidjatari
e6c7c7d279 RenderSystem: enforce type and type name consistency
Use same types used by the game in either the public presentations or binary code. And enforce type name consistency.
2025-01-06 16:41:25 +01:00
Kawe Mazidjatari
62d0dab7cd GFX: add support for creating cubemap textures
Later versions of the game store their cube maps in the RPak as DDS textures now, the engine needs a modification to its texture creation code to support these.
2025-01-06 16:35:36 +01:00
Kawe Mazidjatari
746660490b MaterialSystem: add more reversed types for texture streaming
Reverse engineered.
2025-01-06 16:26:23 +01:00
Kawe Mazidjatari
059f9fc82d RTech: move and rename texture streaming global state struct
More correct names.
2025-01-06 00:53:54 +01:00
Kawe Mazidjatari
aefebd846e MaterialSystem: decouple texture streaming code 2025-01-06 00:44:23 +01:00
Kawe Mazidjatari
aba1ed26b5 RTech: map more fields out for StreamDB_s
More fields reverse engineered.
2025-01-06 00:39:59 +01:00
Kawe Mazidjatari
48e79faffa RTech: search for pattern again
The extra runtime overhead this creates is negligible as all patterns will be searched once, and have their results being cached off. Due to a planned future change, we can't extern it anymore.
2025-01-06 00:37:00 +01:00
Kawe Mazidjatari
49d1f6f1fe RTech: remove unused define
As of commit 3b44bbc6bc8cf26136c5bf6db05a84907f74e089, no longer used.
2025-01-04 17:41:11 +01:00
Kawe Mazidjatari
3b44bbc6bc MaterialSystem: remove the need for a dummy STBSP file
As of commit 5e0c24ad8437a02c1c62325d1d0e5f39e6684f90, the dummy file is no longer necessary.
2025-01-04 17:40:43 +01:00
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