3438 Commits

Author SHA1 Message Date
Kawe Mazidjatari
8ae53d8336 CL_MoveEx: const correctness 2024-04-05 17:19:30 +02:00
Kawe Mazidjatari
e551e58a7d Server: rename 'ServerPlayer_t' to 'CClientExtended'
A more correct name + comments as to why this structure exists.
2024-04-05 17:19:30 +02:00
Kawe Mazidjatari
0cab94fb12 Server: sync client's clock with server's
This should in theory fix the server and client desync that takes place after multiple hours of uptime without disconnecting or reloading. Note that in this version of the engine the server tick is only send on connect (Titanfall 2 does seem to send it every tick, as this netmsg is also responsible for updating the server percentage on the 'cl_showfps' HUD, which does work as designed). The patched code still writes a 'statistics only' server tick update every tick, but only sends full if the interval time has been reached for that particular client instance.
2024-04-05 17:19:30 +02:00
Kawe Mazidjatari
35de4a2c15 Server: add CServer::BroadcastMessage()
Add CServer::BroadcastMessage and rename CServer::FrameJob parameter.
2024-04-05 17:19:29 +02:00
Kawe Mazidjatari
d8e3aa85f9 MaterialSystem: add note 2024-04-05 17:19:29 +02:00
Kawe Mazidjatari
a831494c43 NVIDIA: make vars static 2024-04-05 17:19:29 +02:00
Amos
35bec64a5f Fix dedicated compile errors 2024-04-05 17:19:29 +02:00
Kawe Mazidjatari
abe6d10830 NVIDIA: enable gfx_nvnUseMarkersToOptimize by default
Enabled by default, and removed playerprofile flag as we want to be able to disable this in the future may it cause problems. All tests done so far (on different hardware) yielded more latency reduction/performance improvements. Also added updated note for convar promo_version_accepted.
2024-04-05 17:19:29 +02:00
Kawe Mazidjatari
1f7bbe5b92 Recast: make detail mesh edge detection more robust
Merge recastnavitagion/recastnavitagion@c393777d26
Instead of using a distance check which can fail at large magnitudes due
to low precision we can check whether the edges are actually on the
hull.
2024-04-05 17:19:29 +02:00
Kawe Mazidjatari
e3bf2036b3 Recast: fix:rcBuildLayerRegions missing areaType
Merge recastnavitagion/recastnavitagion@ddaa361b08
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
714674ae33 Engine: reversed some CGame field names
Reversable thanks to the CInputSystem rebuild.
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
365448b8c7 MaterialSystem: fix console not drawing in the 4:3/5:4 aspect ratio modes
DrawImGui should be called BEFORE ID3D11DeviceContext::ClearRenderTargetView() or ID3D11DeviceContext::End(). Moved drawing code to SpinPresent which is just before the clear/end calls are being made. Console now draws in the 4:3/5:4 aspect ratio video modes.
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
77a20f4d9e NVIDIA: move markers to actual IDXGISwapChain::Present runtime call
Testing revealed better latency reduction when moved directly here as we also take into account the additional buffy copy's the game does in SpinPresent, our new render thread frame limiter and and ImGui. The difference is very large when the render thread frame limiter is used. The code still passes NVIDIA's reflex testing utility after this patch.
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
fde79e9f93 NVIDIA: only run latency on success
Only run latency markers if NvAPI_D3D_SetSleepMode returned NVAPI_OK.
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
81ccefb74d 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.
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
c954640527 InputSystem: rename function parameter 2024-04-05 17:12:53 +02:00
Kawe Mazidjatari
b162b10598 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!
2024-04-05 17:12:52 +02:00
Kawe Mazidjatari
735a9e0489 NVIDIA: properly enqueue frame ID
Sync Frame ID between main thread and render thread, this changes makes the integration PASS the reflex test utility.
2024-04-05 17:12:52 +02:00
Kawe Mazidjatari
83b95d23c9 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.
2024-04-05 17:12:52 +02:00
Kawe Mazidjatari
4d521b60c9 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.
2024-04-05 17:12:52 +02:00
Kawe Mazidjatari
65bff96db1 NVIDIA: low latency code decouple 2024-04-05 17:12:52 +02:00
Kawe Mazidjatari
fd8b2f255e NVIDIA: add TRIGGER_FLASH marker to input event handler 2024-04-05 17:12:52 +02:00
Kawe Mazidjatari
47dfc39ad5 NVIDIA: add PC_LATENCY_PING marker to msg pump 2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
053a1ca9e0 Tier0: add template inline for FindPatternSIMD
This allows for directly setting a function pointer without double casting it, and significantly reduce code verbosity.
2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
05352d9d17 Tier1: temporarily comment
Unused and causes errors due to unimplemented mutex class (needs to be reversed still).
2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
13fa6d902b EngineAPI: key event dispatcher rebuild 2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
02b0a5c7df InputSystem: make InputEventCallback_t return type bool 2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
99a24d9254 InputSystem: add reversed KeyInfo_t and KeyEvent_t struct
Almost fully mapped out, the unknown fields seem to be unused or padding.
2024-04-05 17:10:59 +02:00
Kawe Mazidjatari
44cf99acc1 InputSystem: add comment to field 2024-04-05 17:10:59 +02:00
Kawe Mazidjatari
0067a57aa8 InputSystem: add inline helpers 2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
b72f02d123 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.
2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
94d01c39b3 Tier1: make CTier1AppSystem iface public 2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
4e3fdab7e7 InputSystem: joystick deadzone indices and event input callback types
Adjust iface accordingly.
2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
bbebbdac13 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.
2024-04-05 17:09:47 +02:00
Kawe Mazidjatari
bd35ec6525 Create utlstringmap.h 2024-04-05 17:04:53 +02:00
Kawe Mazidjatari
e64e5674c8 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.
2024-04-05 16:55:29 +02:00
Kawe Mazidjatari
7d0b2d7450 Add/update core headers 2024-04-05 16:53:51 +02:00
Kawe Mazidjatari
1b2ce75e81 Add PCLSTATS marker 2024-04-05 16:49:30 +02:00
Kawe Mazidjatari
59e0bfa10b NVIDIA: initial implementation of latency markers 2024-04-05 16:45:05 +02:00
Kawe Mazidjatari
d3d80398e3 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).
2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
c8b5f47c80 Add packet header flags 2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
51b866f6a1 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.
2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
82c522a424 Use size types for keyvaluesystem interface 2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
f609f16427 Don't compile debug code in cert builds 2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
fe650711c2 ConCommand: marked 'script(_...)' FCVAR_DEVELOPMENTONLY 2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
144d5f62e1 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.
2024-04-05 16:41:09 +02:00
Kawe Mazidjatari
3831058f81 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).
2024-04-05 16:41:09 +02:00
Kawe Mazidjatari
c86f0c5c6a 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.
2024-04-05 16:41:08 +02:00
Kawe Mazidjatari
699a4ce464 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'.
2024-04-05 16:39:22 +02:00
Kawe Mazidjatari
ea8074dff9 Fix bug in utllinkedlist
Should return template type (default 'unsigned short') instead of int as Count.
2024-04-05 16:34:30 +02:00