4572 Commits

Author SHA1 Message Date
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
Kawe Mazidjatari
d276a8c850 RTech: rework pak load command API
- renamed pak_swap to pak_requestswap.
- Installed autocompletion callback for pak_requestswap.
- use const where possible.
- improved logging on success/failures.
- use new reversed types and fields to determine when to skip an asset in Pak_ListTypes_f.
- only allow unloading or swapping of a specific pak file if its status is PAK_STATUS_LOADED.
2024-11-17 14:04:29 +01:00
Kawe Mazidjatari
64393f6e5f RTech: constify parameter for Pak_UnloadAsync
Unmodified, should be const.
2024-11-17 14:01:04 +01:00
Kawe Mazidjatari
77637019d1 RTech: make warning for non-certain builds only
This warning should be for non-cert builds only, all command code calling this function is already warning on their own, and in actual runtime code, silent failure is prefered as there are other warning/error routines there. The non-string version of this function should always be prevered however as its much faster.
2024-11-17 13:58:30 +01:00
Kawe Mazidjatari
953bdf5d5f RTech: rename PakLoadedInfo_s member variable
Follow the naming convention of the rest of the structure.
2024-11-17 13:56:07 +01:00
Kawe Mazidjatari
874314ee1c Core: fix linker error for dedicated server builds
ImguiSystem should not be compiled for dedicated server builds.
2024-11-17 13:54:57 +01:00
Kawe Mazidjatari
72c71fac8b RTech: use Pak_UnloadAsyncAndWait for pak swap
Use the actual api as this allows for helping other jobs as well rather than burning all cpu in our own thread.
2024-11-17 11:51:45 +01:00
Kawe Mazidjatari
ba83bd9ae9 MaterialSystem: fix compile error for no-dx builds
PakLoadFuncs_s::WaitAsync was renamed to PakLoadFuncs_s::WaitForAsyncLoad.
2024-11-17 11:50:41 +01:00
Kawe Mazidjatari
d655ae8b4d Tier0: bump sig cache version to 0x2F
Force full rebuild of RVA cache.
2024-11-17 03:17:28 +01:00
Kawe Mazidjatari
d444900b9a ImguiSystem: fix regression causing initial logs to not render
Since directx initialized a lot later then when we first start logging, and since we no longer lock and log when the system isn't initialized as per commit 0dde788aa737d2bdb85a8493b4f8f1e549c44ecb, initial logs will not be stored for rendering.

The imgui console will now instead check if the system has been explicitly disabled, or has been disabled due to an error. If an error occurs, the buffer will also be cleared. This way we still avoid locking and logging anything at all times when -noimgui was passed in.
2024-11-17 03:15:31 +01:00
Kawe Mazidjatari
f5f14c153f ImguiSystem: change default keys
The home key should be reserved for console input as this is useful when running script code through the console, and needing to switch cursor positions to fix a typo or copy something. Page Up and Page Down weren't used and are less likely to be used by something in the game, remapped the defaults' secondary to these keys.
2024-11-17 03:09:03 +01:00
Kawe Mazidjatari
7a40db4d85 RTech: reverse engineer and document most of pak load api
Most of the pak load functions are now reverse engineered, documented and ready to be used from the API handle. Structure is confirmed to align with the engine.
2024-11-17 02:20:40 +01:00
Kawe Mazidjatari
3eea52b199 RTech: rename pak fifo lock state pointer
Should be called g_bPakFifoLockAcquiredInMainThread, as the system has to account for the lock depth if the lock was acquired in the main thread.
2024-11-17 02:19:54 +01:00
Kawe Mazidjatari
35c6655e20 RTech: change async handle status struct name suffix
Changed suffix from '_t' to '_s' to maintain consistency throughout the rest of the RTech project.
2024-11-17 02:03:31 +01:00
Kawe Mazidjatari
1c36dfa484 RTech: rename member variables
The streaming asset counter only counts for optional assets. PakMemoryData_s::guidDescriptors should also be pageDescriptors.
2024-11-17 02:01:51 +01:00
Kawe Mazidjatari
3d56934cc0 RTech: reverse more fields for pak load system
Reversed more fields and cleaned up rebuilded routines. This will make debugging the system a lot easier.
2024-11-16 21:35:09 +01:00
Kawe Mazidjatari
19896857e2 RTech: disable assertion for log channels in FS_CloseAsyncFile
FS_OpenAsyncFile is inline in StreamDB_Init, and in our implementation, FS_OpenAsyncFile is the only place channel id's get mapped to file slots, so it will be null for stbsp's. Commented assert out as there isn't anything we could do about this besides rebuilding StreamDB_Init which is a large task.
2024-11-16 21:33:00 +01:00
Kawe Mazidjatari
add4037504 Tier0: add enum for job priorities
32 bit enum, enumerants unknown and pending reversal.
2024-11-16 21:30:58 +01:00
Kawe Mazidjatari
1ec3df5874 RTech: add note for improvements in Pak_Swap_f
Should use the wait version of unload as that allows for helping other jobs and speeding up the process.
2024-11-16 15:41:06 +01:00
Kawe Mazidjatari
3f3b69e2bb RTech: use log channel of to-swap pak file
Reuse the channel id.
2024-11-16 15:40:19 +01:00
Kawe Mazidjatari
5d20256f10 RTech: user or script requested paks should use channel 8 2024-11-16 15:39:55 +01:00
Kawe Mazidjatari
03d19344fe RTech: implement pak and async read logging per channel
The engine assigns channel ID's to paks, which it then uses to determine whether to error out or warn when a certain pak file failed to load.

Paks loaded with a higher channel ID, such as the load screens or gladiator cards, won't call Error() in the engine if the loading thereof failed, where paks with a lower channel ID, such as common.rpak will.

Paks with a higher channel ID are quite verbose in the console, as the game often switches between gladiator card rpaks from scripts to update the banners in the world dynamically. User can now explicitly set the channel ID, with the default being 4 which only logs core engine and sdk paks, along with preloaded and level paks.

The async file read system uses a similar concept, this was confirmed when reversing Pak_SetupBuffersAndLoad as this calls FS_OpenAsyncFile for its patch files with the log channel that was assigned during Pak_LoadAsync. This code already had logging, but has been adjusted to follow the design of the system. Async file reads however are disabled by default as these are very verbose and will degrade performance of the game.
2024-11-16 15:28:53 +01:00
Kawe Mazidjatari
0dde788aa7 GameUI: only log to ImGui console if ImguiSystem is initialized
If disabled, there is no point in logging to the imgui console, so save on memory and avoid locking a mutex.
2024-11-16 14:09:23 +01:00
Kawe Mazidjatari
e2b931d6d8 ImguiSystem: perform atomic exchange before acquiring snapshot lock
Significantly improves performance when none of the imgui surfaces are being drawn.
2024-11-15 20:33:57 +01:00
Kawe Mazidjatari
4d2ac77ac7 ImguiSystem: fix compile error
Small typo; vector template arguments cannot be const pointers.
2024-11-15 20:10:02 +01:00
Kawe Mazidjatari
8de652b4c9 ImguiSystem: improve API and performance
Instead of manually calling each surface instance directly from CImguiSystem::SampleFrame(), allow the caller to install their own surfaces. Also, only lock the buffer mutex if we are going to take a snapshot of the draw data. The system now also only renders to the backend if there's draw data to be rendered. Slightly reworked and reordered the control flow of the system to make it easier to catch bugs. The system can now also be disabled using the -noimgui command line option.
2024-11-15 19:48:03 +01:00
Kawe Mazidjatari
68b7c25a10 InputSystem: fully implement CInputStackSystem in the SDK
The implementation currently only servers as reference, but if we ever have to replace the engine's implementation with the SDK's one, it should now be fully compatible and working.
2024-11-15 15:59:37 +01:00
Kawe Mazidjatari
3dcb058774 Tier0: implement DLL_EXT_STRING macro
This will be used to construct AppSystemInfo_t objects.
2024-11-15 15:40:12 +01:00
Kawe Mazidjatari
440e5f7fe1 CMake: define _DLL_EXT for all projects
This is necessary for the macro DLL_EXT_STRING which will be implemented in the next commit.
2024-11-15 15:39:11 +01:00
Kawe Mazidjatari
d4d2244b93 Engine: inherit IEngineAPI through CTier1AppSystem
Must be inherited through CTier1AppSystem to match the game's interface. Removed extraneous IAppSystem virtual method declarations as they are no longer needed to pad the vftable out.
2024-11-15 15:24:55 +01:00
Kawe Mazidjatari
1e7bfcde2e AppFrameWork: adjust IAppSystem interface
In this engine, GetTier() doesn't exist, GetDependencies() however does exist (confirmed by the vftable for CInputStackSystem) and therefore we should adjust all interfaces to make it use this instead.
2024-11-15 14:58:57 +01:00
Kawe Mazidjatari
f45ca75474 ReVPK: use Min operator provided by basetypes
Use Min() from basetypes as this is the prefered min operator.
2024-11-15 14:02:06 +01:00
Kawe Mazidjatari
20e212b1ea VpkLib: use Min operator provided by basetypes
Use Min() from basetypes as this is the prefered min operator.
2024-11-15 14:01:47 +01:00
Kawe Mazidjatari
aac8c84442 VpkLib: use correct type for chunk offset
This var must be unsigned as VPKChunkDescriptor_t's ctor takes an u64 for chunk offset.
2024-11-15 13:59:12 +01:00
Kawe Mazidjatari
bc54931408 Engine: detour function CEngineAPI::OnStartup()
Allows for initializing SDK code before or after CEngineAPI::OnStartup().
2024-11-15 13:49:29 +01:00
Kawe Mazidjatari
7114bc6a40 InputSystem: rework CInputStackSystem::PopInputContext()
The method in the engine now takes a pointer to a context and pops it if its found in the stack by index. Adjusted SDK rebuild to reflect this change. The rest of the input stack system remained unchanged.
2024-11-15 13:44:56 +01:00
Kawe Mazidjatari
18545ec422 Tier1: implement PopAt in CUtlStack
SourceSDK doesn't contain this feature, but it has to be implemented for reworking CInputStackSystem::PopInputContext() as this has changed; the method allows for popping the provided index to element rather than following a strict push/pop order.
2024-11-15 13:42:47 +01:00
Kawe Mazidjatari
f0fcb821a8 Engine: only call ImguiSystem message handler when imgui surface is active
Save even more performance by not calling the ImguiSystem message handler at all when the imgui surface isn't active; we don't need to track input movement at all when this isn't active. Also dropped the blockage of all window messages except 'WM_SETCURSOR', added a detailed comment as to why this is blocked.
2024-11-15 13:40:39 +01:00
Kawe Mazidjatari
36bee21784 Engine: set correct type for member variable
Member variable 'm_pInputContext_Maybe' is confirmed to be 'm_hInputContext', set correct type.
2024-11-15 13:38:02 +01:00
Kawe Mazidjatari
fa949c8e6a ImguiSystem: don't run the message handler if the system isn't initialized
ImGui_ImplWin32_WndProcHandler will return out early anyways if Dear Imgui itself isn't initialized, there is therefore no need to lock any mutex here when the system isn't initialized. Return out early.
2024-11-14 23:30:08 +01:00
Kawe Mazidjatari
a331d43488 ImguiSystem: fix input latency caused by mutex
There were reports of high input latency even though we implemented NVIDIA Reflex and AMD Anti-Lag 2.
The reason for this increased latency was because CThreadFastMutex was being used in the window procedure instead of a CThread mutex.

The contention for CImguiSystem::m_systemInitState in CImguiSystem::MessageHandler() is high, and therefore we should not use CThreadFastMutex as its only effective  in its fastness when the contention isn't high. Using CThreadMutex instead resulted in an extreme reduction of input latency.
2024-11-14 23:28:47 +01:00
Kawe Mazidjatari
b88ed6d5cb Resource: fix typo in CFG file header
This is the server's offline configuration file.
2024-11-14 15:51:10 +01:00
Kawe Mazidjatari
14e0c8f5e4 Engine: separate server and client offline configuration files
Dedicated server or Client only builds will warn to the console if something is trying to set a convar, or execute a concommand that doesn't exist. Dedicated server builds don't have client commands/convars, and visa versa.
2024-11-14 15:49:57 +01:00
Kawe Mazidjatari
3d5ddd2bed Client: update the "name" convar in "cl_setname" concommand callback
Update the name everywhere in code.
2024-11-14 15:44:27 +01:00
Kawe Mazidjatari
e8fe12b4fd Engine: fix heap buffer overflow
Should always leave 1 byte for the null terminator in the persona name buffer.
2024-11-14 15:26:40 +01:00
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
b3796c32cc Tier2: fix regression preventing remote errors from being logged
When CURLParams::failOnError is set, it makes code stop instantly when the request has errored somewhere (400 or higher response codes), but this prevents code from displaying the error reason attached to the failed request.

Setting this to false by default fixes the problem; if this option needs to be used it should be set explicitly.
2024-11-14 14:27:31 +01:00
Kawe Mazidjatari
ad741882ae DataCache: only check on DC_INVALID_HANDLE in debug builds
In release we should only check if the handle is NULL for performance reasons (the release engine executable never sets DC_INVALID_HANDLE on invalid handles. In debug we also check on DC_INVALID_HANDLE as this is easier to cache in memory.
2024-11-14 14:21:01 +01:00
Kawe Mazidjatari
abe5578557 RTech: add param to LoadFromFile for parse failures
Gets set if parsing failed.
2024-11-14 13:38:28 +01:00