718 Commits

Author SHA1 Message Date
Kawe Mazidjatari
0d390955fd Engine: partial rebuild for data block sender/receiver
This patch partially rebuilds the data block sender/receiver. The receiver leaks memory if the sender sends a bogus LZ4 packet, it would allocate memory to copy the encoded data into, from which it would decode it to the scratch buffer, but it would never deallocate this temporary buffer is the LZ4 decoder failed. This has been fixed. The second reason to rebuild these was to look into potential compression optimization. The data block rebuild now also features the latest LZ4 codec.
2024-04-05 17:59:53 +02:00
Kawe Mazidjatari
c786d86eae Engine: fix netchan bugs and add SendData()
Fixed bug in CNetChan::SendNetMsg() where the return value of INetMessage::WriteToBuffer() was not checked, nor did we return if the stream we added the message in was overflowed. If the function gets to the stage of writing the msg in the buffer, we need to return true only if we didn't overflow AND if the msg was successfully written. Also added a method for sending bitbuf data into stream of choice.
2024-04-05 17:59:53 +02:00
Kawe Mazidjatari
8b53027264 Engine: fix bug in networking code caused by incorrect constants
Mixed MAX_BACKUP_COMMANDS with MAX_NEW_COMMANDS, added proper (confirmed) defines. Also fixed MAX_BACKUP_COMMANDS_PROCESS, which was 60 but was supposed to be 64, so we were 4 backup commands short in CPlayer::ProcessUsercmds().
2024-04-05 17:59:53 +02:00
Kawe Mazidjatari
d22800b43b Engine: fix bug causing level assets to not load properly
The level has changed when strcmp returns a non-null value.
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
ab5e009f8b Engine: remove unused variable
No longer used as of commit b29be00d.
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
b094040c64 Engine: revert server tick msg rebuild to old behavior
Only update statistics, this code was mainly added for testing, but testing revealed no additional performance or smoothness improvements, even during >6 hour sessions. The clock drift already gets corrected each frame from Host_RunFrame(). Only update statistics to update CPU and frame times on the client's debug panels if enabled.
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
60a3cee531 Engine: hoststate loop cleanup
Logic hasn't been changed, conditions have been brought into the loop itself
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
8feffd2487 Engine: add missing include
Needed for NucleusID_t.
2024-04-05 17:56:53 +02:00
Kawe Mazidjatari
dd20e9f4aa Engine: use NucleusID_t type for CClient 2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
fcf3a09418 Make singletons use static memory
Avoid heap memory allocation and a level of indirection. This allows the compiler to optimize the program even more. No logic has been changed in this patch.
2024-04-05 17:52:57 +02:00
Kawe Mazidjatari
fe2a95e4ec RTech: major pak system overhaul and rebuild
* split rtech_game and rtech_utils cpp files into multiple files
* rebuilt several large pak load routines for debugging and custom implementations
* moved rson code to rtech_game
* reworked and improved engine and sdk pak precache system
* reversed more of the jobthreads system
2024-04-05 17:51:19 +02:00
Kawe Mazidjatari
3c10bf0e8d Netconsole: refactor & improvements
* Fix multiple issues related to threading, such as not locking the mutex when using thread-unsafe members or methods.
* Netconsole now logs its output to a file on the disk.
* Properly handle close events, to allow netconsole to shutdown properly, so stuff like log buffers could flush properly. Input is now ran in a separate thread so main thread could check if we need to shutdown, and do so if needed. This was needed as previously input was ran in the main thread and the issue is that its blocking until an input is given.
2024-04-05 17:46:55 +02:00
Kawe Mazidjatari
ee82d5d8e0 Tier1: move KeyValues class to Tier1
The KeyValues class belongs here. Also reimplemented most loading methods for KeyValues, and adjusted the VPK building code to account for it. Pointers to the engine's implementation of KeyValues have been moved to a separate header ('keyvalues_iface.h'), as this allows external tools code to utilize the standalone KeyValues class implementation. Playlist utilities are completely separated from the KeyValues header; these have nothing to do with KeyValues other than manipulating a global KeyValues object for the playlists, and thus have been named as such and moved to rtech/playlists.
2024-04-05 17:42:05 +02:00
Kawe Mazidjatari
b2ce189ba1 Tools: rename NETCONSOLE define to _TOOLS
Rename since this would actually be used for all tools. Also moved 'plat_time.cpp' to tier0 so anything could compile it.
2024-04-05 17:35:10 +02:00
Kawe Mazidjatari
82b56fed5c DataCache: enable old gather props in proper location
Fix hack and handle this properly.
2024-04-05 17:26:16 +02:00
Kawe Mazidjatari
a85d9a556e DataCache: clear fallback handler if main pak gets unloaded
If common.rpak is unloaded, the fallback model handles/pointers become invalid.
2024-04-05 17:24:29 +02:00
Kawe Mazidjatari
1f4a96a3d6 DataCache: add proper fallback mdl handler and fix rendering
Add a proper class for dealing with fallback models and the warnings thereof. Also reverted the 'old_gather_props' removal, as otherwise fallback models won't draw (new gather props solution doesn't call CMDLCache::GetHardwareData()).
2024-04-05 17:24:29 +02:00
Kawe Mazidjatari
0f3a40ee1f DataCache: harden mdl error handling logic
Rebuild 'CMDLCache::GetPhysicsGeometry()' and properly handle missing cache pointers. Also cleaned up various methods in CMDLCache and renamed 'studiophysicscache_t' to 'studiophysicsref_t'. The changes made the 'old_gather_props' convar hack redundant and has thus been removed.
2024-04-05 17:24:28 +02:00
Kawe Mazidjatari
5763e0ee20 ModelLoader: don't compile sprite functions for dedicated 2024-04-05 17:19:34 +02:00
Kawe Mazidjatari
edc52ad669 IDetour: remove extraneous pointer assignments
Originally, we store the search results in a CMemory instance which we then assign to the actual function pointer. CMemory is just a pointer class; we can assign the results directly to the actual function pointer. This commit reduces a lot of code verbosity, and also reduced roughly 2KiB worth of static pointers in the resulting executable. This commit also officially deprecates the support for any GameDLL's below S3 (Season 3), since it makes more sense to port the assets from earlier/later games back to the version this SDK supports.
2024-04-05 17:19:32 +02:00
Kawe Mazidjatari
a27f1b7fc9 RConServer: remove extraneous copy
CSocketCreator::GetAcceptedSocketAddress() returns a reference.
2024-04-05 17:19:31 +02:00
Kawe Mazidjatari
4934528909 CEngine: rename fields 2024-04-05 17:19:31 +02:00
Kawe Mazidjatari
f2da299b99 InputSystem: add note to 'CGame::DispatchKeyEvent()'
These are hardcoded delay values for if you want to pick and swap an item from the ground. Perhaps nice to make a cvar and an in-game UI setting for adjusting them.
2024-04-05 17:19:31 +02:00
Kawe Mazidjatari
145943d3a6 InputSystem: fix controller hold keys not working
Should've been !keyInfo.m_bKeyDown.
2024-04-05 17:19:31 +02:00
Kawe Mazidjatari
e2b508748d Server: improve extended client class
Use setters/getters and make members private and only accessible from CClient or CClientExtended.
2024-04-05 17:19:30 +02:00
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
Amos
35bec64a5f Fix dedicated compile errors 2024-04-05 17:19:29 +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
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
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
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
13fa6d902b EngineAPI: key event dispatcher rebuild 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
7d0b2d7450 Add/update core headers 2024-04-05 16:53:51 +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
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
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
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
b24e5815bc Fix memory leak in token authentication system
Must free claims after creating them!
2024-04-05 16:34:29 +02:00
Kawe Mazidjatari
c6f2c99619 Improve client-side online authentication error handling and UX
Display the error to the user without having to open the developer console or terminal window. This patch also adds printing to COM_ExplainDisconnection (which has been stripped out of the retail binary).
2024-04-05 16:34:28 +02:00
Kawe Mazidjatari
5e53a75571 Drop a warning when someone fails authentication 2024-04-05 16:34:28 +02:00
Kawe Mazidjatari
b37a3bdeba Add comments on newly added code 2024-04-05 16:28:59 +02:00
Kawe Mazidjatari
cbf370019d Don't query JWT token if we connect to localhost
Localhost in many cases implies usage of listen server; these don't require auth on loopback connections.
2024-04-05 16:24:47 +02:00