202 Commits

Author SHA1 Message Date
Kawe Mazidjatari
c42b128672 Engine: hoststate loop cleanup
Logic hasn't been changed, conditions have been brought into the loop itself
2024-02-06 14:33:40 +01:00
Kawe Mazidjatari
7eff7f4ce2 Engine: add missing include
Needed for NucleusID_t.
2024-02-04 18:26:04 +01:00
Kawe Mazidjatari
8da31dd15c Engine: use NucleusID_t type for CClient 2024-02-04 12:50:36 +01:00
Kawe Mazidjatari
1361bfb172 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-01-21 21:29:23 +01:00
Kawe Mazidjatari
c9a9b01bf2 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-01-21 20:23:25 +01:00
Kawe Mazidjatari
1b0cc4d188 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-01-14 11:31:16 +01:00
Kawe Mazidjatari
cd82e22ea3 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-01-12 00:52:07 +01:00
Kawe Mazidjatari
078c241a0d 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-01-12 00:25:19 +01:00
Kawe Mazidjatari
8aa8323ea4 DataCache: enable old gather props in proper location
Fix hack and handle this properly.
2024-01-07 12:28:31 +01:00
Kawe Mazidjatari
5979153306 DataCache: clear fallback handler if main pak gets unloaded
If common.rpak is unloaded, the fallback model handles/pointers become invalid.
2024-01-07 00:02:26 +01:00
Kawe Mazidjatari
e416bdbbfe 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-01-05 01:22:55 +01:00
Kawe Mazidjatari
6b708e33ea 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-01-04 21:19:32 +01:00
Kawe Mazidjatari
4cfcdcd863 ModelLoader: don't compile sprite functions for dedicated 2024-01-02 17:08:08 +01:00
Kawe Mazidjatari
e825a1e7a8 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-01-02 15:21:36 +01:00
Kawe Mazidjatari
b25bc7c455 RConServer: remove extraneous copy
CSocketCreator::GetAcceptedSocketAddress() returns a reference.
2024-01-01 20:09:32 +01:00
Kawe Mazidjatari
073abad6a8 CEngine: rename fields 2024-01-01 16:46:02 +01:00
Kawe Mazidjatari
bf5734f5d6 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.
2023-12-30 17:38:54 +01:00
Kawe Mazidjatari
d592bb2241 InputSystem: fix controller hold keys not working
Should've been !keyInfo.m_bKeyDown.
2023-12-30 17:32:38 +01:00
Kawe Mazidjatari
c5808e1117 Server: improve extended client class
Use setters/getters and make members private and only accessible from CClient or CClientExtended.
2023-12-30 15:05:14 +01:00
Kawe Mazidjatari
b1eb8ae26f CL_MoveEx: const correctness 2023-12-30 14:33:42 +01:00
Kawe Mazidjatari
89320b48ad Server: rename 'ServerPlayer_t' to 'CClientExtended'
A more correct name + comments as to why this structure exists.
2023-12-30 02:51:02 +01:00
Kawe Mazidjatari
caba6a7aba 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.
2023-12-30 01:17:39 +01:00
Kawe Mazidjatari
0c56af38fc Server: add CServer::BroadcastMessage()
Add CServer::BroadcastMessage and rename CServer::FrameJob parameter.
2023-12-29 23:06:49 +01:00
Amos
492af0d5d1 Fix dedicated compile errors 2023-12-27 13:22:33 +01:00
Kawe Mazidjatari
20112679cd Engine: reversed some CGame field names
Reversable thanks to the CInputSystem rebuild.
2023-12-26 11:32:27 +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
3873cc81c2 InputSystem: rename function parameter 2023-12-25 19:36:59 +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
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
d42ca04e8c EngineAPI: key event dispatcher rebuild 2023-12-24 16:29:42 +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
d608c734bd Add/update core headers 2023-12-23 01:22:02 +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
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
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
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
9c6417ee4e Fix memory leak in token authentication system
Must free claims after creating them!
2023-10-31 19:14:07 +01:00
Kawe Mazidjatari
4ef4a0b803 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).
2023-10-22 17:00:56 +02:00
Kawe Mazidjatari
e99e1c40e0 Drop a warning when someone fails authentication 2023-10-21 11:24:51 +02:00
Kawe Mazidjatari
bbe163f58c Add comments on newly added code 2023-10-20 19:30:07 +02:00
Kawe Mazidjatari
9b3024a874 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.
2023-10-20 19:12:42 +02:00
Kawe Mazidjatari
f3f042ae63 Add configurable server cvars for auth system
The command execute is now guarded off on the client with the cvar 'sv_allowClientSideCfgExec' instead of 'sv_cheats'.
2023-10-15 16:30:29 +02:00
Kawe Mazidjatari
b9a24b30af Change JSON field types send to master server
They were all strings; changed them to what made most sense for each field type. Changes:
"hidden": string -> bool
"port": string -> int
"checksum": string -> uint
"playerCount": string -> int
"maxPlayers": string -> int
2023-10-15 10:47:19 +02:00
Kawe Mazidjatari
59fab7ac93 Client token authentication implementation
The game internally obtains a auth token from Origin. On connect to a gameserver, it will send it to the masterserver. The master server will create a JWT token and send this back to the client. The client stores this token in 3 userinfo cvars (token, sig1, sig2). the sig1 and sig2 cvars are there to compensate for the truncation caused by sending the cvar, as each cvar string length could be up to 255 (byte max). The server verifies this token (the signature, timestamp, expiry); if they are valid, the has successfully authenticated and will connect.
2023-10-15 10:40:46 +02:00
Kawe Mazidjatari
0eddec2473 Reduce duplicate code
Make a method for setting the host state.
2023-10-12 17:07:35 +02:00
Kawe Mazidjatari
d83270a541 Netchan: comment out unused code 2023-10-08 16:37:35 +02:00
Kawe Mazidjatari
7232c735ac Null console commands past the 512th byte
A mistake has been made, certain area's of the engine actually do allow strings larger than 128 bytes, just one routine that doesn't (console commands). Tokenizer only tokenizes it up to 512 bytes, so null all the other bytes past this. This still fixes the flaw mentioned in the comment at the place where the nulling happens.
2023-09-23 14:04:49 +02:00