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.
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!
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.
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.
- 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.