3380 Commits

Author SHA1 Message Date
Kawe Mazidjatari
10017fd84e NVIDIA: only run latency on success
Only run latency markers if NvAPI_D3D_SetSleepMode returned NVAPI_OK.
2023-12-25 23:43:41 +01:00
Kawe Mazidjatari
af8a3add00 NVIDIA: limit to 1 sleep per frame
The purpose of this bool was to only limit nv sleep to 1 per frame, but the bool was never reset.
2023-12-25 22:36:35 +01:00
Kawe Mazidjatari
8791745ad4
Merge pull request #115 from Mauler125/nvidia_reflex_markers
NVIDIA latency marker implementation
2023-12-25 19:39:14 +01:00
Kawe Mazidjatari
3873cc81c2 InputSystem: rename function parameter 2023-12-25 19:36:59 +01:00
Kawe Mazidjatari
acbf0352da NVIDIA: always run PC Latency stats
PCLStats is not NVIDIA hardware bound as per Reflex's documentation, and runs separately from the NVIDIA Reflex code. Always enable!
2023-12-25 19:24:42 +01:00
Kawe Mazidjatari
0251c59227 NVIDIA: properly enqueue frame ID
Sync Frame ID between main thread and render thread, this changes makes the integration PASS the reflex test utility.
2023-12-25 19:23:01 +01:00
Kawe Mazidjatari
c3fed1dc2a MaterialSystem: Expose the proper pointer
The first pointer was a pointing to a pointer to g_MaterialSystem. The new pointer points directly to g_MaterialSystem. Also added CMaterialSystem::GetCurrentFrameCount() for g_FrameNum.
2023-12-25 18:47:05 +01:00
Kawe Mazidjatari
bbb5811bbf Engine: fix incorrect function names
Was actually pointing to Host_Init_DuringVideo, not Host_Init. Added all Host_Init functions to avoid confusion in the future.
2023-12-25 02:24:23 +01:00
Kawe Mazidjatari
f08f9dd4cb NVIDIA: low latency code decouple 2023-12-25 01:46:39 +01:00
Kawe Mazidjatari
6575f80447 NVIDIA: add TRIGGER_FLASH marker to input event handler 2023-12-24 22:32:58 +01:00
Kawe Mazidjatari
0e62280896 NVIDIA: add PC_LATENCY_PING marker to msg pump 2023-12-24 20:38:50 +01:00
Kawe Mazidjatari
aa1a43ac4f Tier0: add template inline for FindPatternSIMD
This allows for directly setting a function pointer without double casting it, and significantly reduce code verbosity.
2023-12-24 20:38:07 +01:00
Kawe Mazidjatari
76b927e3b0 Tier1: temporarily comment
Unused and causes errors due to unimplemented mutex class (needs to be reversed still).
2023-12-24 16:33:20 +01:00
Kawe Mazidjatari
d42ca04e8c EngineAPI: key event dispatcher rebuild 2023-12-24 16:29:42 +01:00
Kawe Mazidjatari
30518e1f64 InputSystem: make InputEventCallback_t return type bool 2023-12-24 15:23:05 +01:00
Kawe Mazidjatari
98d47ce8ed InputSystem: add reversed KeyInfo_t and KeyEvent_t struct
Almost fully mapped out, the unknown fields seem to be unused or padding.
2023-12-24 15:17:08 +01:00
Kawe Mazidjatari
fc668bb7f5 InputSystem: add comment to field 2023-12-24 15:15:17 +01:00
Kawe Mazidjatari
00622ec968 InputSystem: add inline helpers 2023-12-24 03:05:29 +01:00
Kawe Mazidjatari
ccfef821b0 InputSystem: fixup enumerants and controller structs
Enumerants:
* ButtonCode_t::JOYSTICK_MAX_BUTTON_COUNT = 32 (previously 26, incorrect...).
* AnalogCode_t::JOYSTICK_FIRST_AXIS = 2 (previously 4, incorrect...).
* Added: ButtonCode_t::KEY_CREDITSIGN (k104, last key).
* Fixed up Xbox controller enums.

Structs xdevice_t:
* Added partially reversed unkownhiddevice_t structure (used for non-xbox hardware).

General:
* Added static assertions for structure sizes.
2023-12-24 02:58:11 +01:00
Kawe Mazidjatari
e8f480bba4 Tier1: make CTier1AppSystem iface public 2023-12-24 02:48:49 +01:00
Kawe Mazidjatari
01b805f801 InputSystem: joystick deadzone indices and event input callback types
Adjust iface accordingly.
2023-12-23 19:37:39 +01:00
Kawe Mazidjatari
4ba6227759 InputSystem: largely reversed struct and fully reversed iface
Struct has been largely mapped out (still requires a bit of work, mostly the Xbox/Hid data structures). The vftable has been fully mapped out.
2023-12-23 17:23:17 +01:00
Kawe Mazidjatari
69e64ac8c3 Create utlstringmap.h 2023-12-23 17:21:20 +01:00
Kawe Mazidjatari
953bf9bd0d InputSystem: update button codes
Xbox enumerants have changed as the game supports Xbox One controllers. Since the joystick button count has changed, 'JOYSTICK_MAX_BUTTON_COUNT' has also changed which affects the size of datatypes used by the CInputSystem class.
2023-12-23 01:51:31 +01:00
Kawe Mazidjatari
d608c734bd Add/update core headers 2023-12-23 01:22:02 +01:00
Kawe Mazidjatari
3327654413 Add PCLSTATS marker 2023-12-23 01:15:43 +01:00
Kawe Mazidjatari
5105ea771d NVIDIA: initial implementation of latency markers 2023-12-22 14:42:28 +01:00
Kawe Mazidjatari
9d5c237338 Add new reversed packet header flags
These flags only exist in the respawn version of the engine. Renamed 'CNetChan::unknown_challenge_var' to 'CNetChan::m_nRealTimePackets'. This field counts the number of packets sent while the frame time wasn't prescaled with the 'host_timescale' cvar, see r5apex.exe+0x3093C0 (140309FC0).
2023-12-22 13:19:06 +01:00
Kawe Mazidjatari
78d6077b7f Add packet header flags 2023-12-22 13:12:55 +01:00
Kawe Mazidjatari
f312c408f0 NVIDIA: check if adapter is from NVIDIA in GFX_SetLatencyMarker()
Moved adapter vendor check to its own func, added a global which could be used to fully disable the low latency system. Also added groundwork for the (future) PCL stats implementation.
2023-12-20 22:21:31 +01:00
Kawe Mazidjatari
4c04d76ceb Use size types for keyvaluesystem interface 2023-12-20 21:14:18 +01:00
Kawe Mazidjatari
d76f3a712b Don't compile debug code in cert builds 2023-12-20 21:12:39 +01:00
Kawe Mazidjatari
219f0252b9 Add missing files
These are pre-generated, as mbedtls is reconfigured with a new CMakeLists.
2023-11-26 13:51:31 +01:00
Kawe Mazidjatari
e345be1e32 ConCommand: marked 'script(_...)' FCVAR_DEVELOPMENTONLY 2023-11-26 13:22:22 +01:00
Kawe Mazidjatari
e541814482 IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
2023-11-26 13:21:20 +01:00
Kawe Mazidjatari
e0a60a14e5 New method for IDetour
This will deprecate IDetour::Attach and IDetour::Detatch. This should reduce the chances of potential errors caused by using the wrong function in the wrong method (e.g. using DetourAttach in IDetour::Detatch).
2023-11-26 11:42:26 +01:00
Kawe Mazidjatari
fa2a005d34 Check if we have enough room for new execution markers
Make sure we always have enough room for new execution markers. Engine normally truncates the head of the vector if out of room; we want to avoid it as this will cause the cookies to shift, and thus cause them to misalign with their respective commands.
2023-11-25 17:41:08 +01:00
Kawe Mazidjatari
7648d19fa9 Implement CCommandBuffer
Code is based on Valve's implementation, with the following changes:
- Usage of 64bit signed size types.
- Usage of const where possible.
- Removal of field 'CCommandBuffer::m_nLastUsedArgSSize'.

Code is tested and compiles on all supported compilers.
2023-11-25 12:00:47 +01:00
Kawe Mazidjatari
236dc31292 Fix bug in utllinkedlist
Should return template type (default 'unsigned short') instead of int as Count.
2023-11-25 11:29:58 +01:00
Kawe Mazidjatari
e5d8f46c61 CCommand adjustments
Moved inlines to header; made ArgC return 32bit integer instead.
2023-11-25 11:27:47 +01:00
Kawe Mazidjatari
167ef46dcb Add additional warning codes to thirdparty warning suppressor 2023-11-25 11:24:06 +01:00
Kawe Mazidjatari
26a7e90354 Fix compiler warnings on Visual Studio 2017
Should not be a constexpr, this caused cryptic errors in template code when compiling the code with older compilers.
2023-11-25 11:23:19 +01:00
Kawe Mazidjatari
35fe8dad04 Fix declaration/implementation mismatch 2023-11-25 11:21:51 +01:00
Kawe Mazidjatari
e269d9d548 Add missing help strings 2023-11-10 01:29:50 +01:00
Kawe Mazidjatari
4301c3c8d6 Add promo version cvars
Used for showing promo's like events such as tournaments.
2023-11-10 01:27:19 +01:00
Kawe Mazidjatari
8932a9bfec Fix emblem misalignment 2023-11-01 02:08:08 +01:00
Kawe Mazidjatari
46b9561ae9 Update emblem for 2.4 release 2023-11-01 01:49:24 +01:00
Kawe Mazidjatari
9c6417ee4e Fix memory leak in token authentication system
Must free claims after creating them!
2023-10-31 19:14:07 +01:00
Kawe Mazidjatari
278d24930b Put lag compensation clamping in a separate method, under a cvar that is disabled for now
There have been reports of hit registration issues, this is most likely caused by the clamping system to mitigate an exploit. Put behind a convar and disabled for now until debugged.
2023-10-25 23:31:02 +02:00
Kawe Mazidjatari
193cc9b19b Show a more detailed error if the EULA request failed 2023-10-25 23:29:37 +02:00