4706 Commits

Author SHA1 Message Date
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
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