5471 Commits
Author SHA1 Message Date
Kawe Mazidjatari c49e0d2123 Tier2: improve branch prediction for JSON_StringToNumber()
Check for error before checking if the iterator points to the end of the string.
2025-06-22 14:09:45 +02:00
Kawe Mazidjatari 02cba0fb86 Tier2: fix incorrect return type for JSON_TypeToString()
Should return const char*, function is currently unused so this wasn't noticed until now.
2025-06-22 14:08:23 +02:00
Kawe Mazidjatari 4d34fff29f BanSystem: lookup performance overhaul
The ban system now uses an hash map containing 16-byte IPv6 entries which uses a custom simple hashing algorithm accelerated by SIMD. This is much faster than the previous approach which used a raw vector containing the string representations of the IPv6 entries (which also used the slow string comparisons). The new system has an average constant time complexity, so users with large amount of banned ip adresses and nucleus id's will not experience performance regressions.
2025-06-21 16:30:36 +02:00
Kawe Mazidjatari 21787ba131 CMake: suppress wd4706 warnings in thrdparty projects
Triggered by Mbed TLS, suppress it (thirdparty only!).
2025-06-21 16:16:44 +02:00
Kawe Mazidjatari b46061ea89 Engine: server-side RCON improvements
- Use the new IPv6 lookup system for fast IP address lookup, now uses the actual 16 byte address storage (which is much faster to lookup and compare while being smaller than the string represenation).
- Check return value of CNetAdr::SetFromString() and handle errors.
- Clear banned list on shutdown (fixes the edge-case bug where remote console access would be disabled during the life of the process once the banned list overflowed as a reboot wouldn't clear it).
- Only try to initialize the socket once, stop as soon as a rare error occurs instead of retrying every frame.
- Only print hacking attempts warnings when the cvar `rcon_debug` is enabled as this can be verbose during attacks.
2025-06-21 16:15:34 +02:00
Kawe Mazidjatari 1f1a5cbee3 Tier2: add utilities for fast IPv6 storage and lookup
Fast utilities for a pending BanSystem performance overhaul.
2025-06-21 16:05:42 +02:00
Kawe Mazidjatari 28712e26d1 Engine: allow DNS lookup for RCON address
Allow DNS address lookup, just like the game's UDP socket.
2025-06-21 15:52:37 +02:00
Kawe Mazidjatari b3f4295665 Engine: adjust use cases of CNetAdr::CompareAdr()
Light API change in commit afb3a9aca7 to make it more clear and avoid future bugs -- the type NA_LOOPBACK is now checked on the passed-in instance instead.
2025-06-21 15:50:24 +02:00
Kawe Mazidjatari 5b74b42cbc Tier2: CSocketCreater class improvements
- Const correctness.
- Check return value of CNetAdr::SetFromSockadr() and handle it.
- Light cleanup in intermediate code and documentation.
2025-06-21 15:47:38 +02:00
Kawe Mazidjatari 7a1f30cf25 Tier1: CNetAdr class improvements
- Const correctness.
- Document all methods.
- Make CompareAdr() check if the passed-in netadr_t instance if off type NA_LOOPBACK instead (should avoid confusion in the future, this change requires a few use cases to be adjusted as well in the code base which will come in a future patch).
- Make CompareAdr() cheaper.
- Fix bug in ToString() where the buffer might not be null-terminated after the call to strncpy.
- Fix bug in SetFromSockadr() where inet_ntop() recv'd the incorrect size for string buffer.
- Check for error on inet_ntop() call in SetFromSockadr().
- Properly check for characters in string before determining whether to format the address as IPv4 or IPv6 (now matches the game's implementation).
2025-06-21 15:45:49 +02:00
Kawe Mazidjatari afb3a9aca7 Tier1: improve CNetAdr::ToString()
Return the number of characters written.
2025-06-20 22:32:50 +02:00
Kawe Mazidjatari 5e19ac6453 Tier1: simplify CNetAdr::ToSockadr()
- Make user responsible for giving a clear sockaddr_storage instance (SDK nulls it on all use cases already).
- Remove the need for inet_pton -- we already have a valid, ready to use in6_addr structure.
2025-06-20 22:29:28 +02:00
Kawe Mazidjatari 39e3d4456f Launcher: auto-detect numeric base for processor affinity mask
Minor UX improvement.
2025-06-19 12:21:06 +02:00
Kawe Mazidjatari 85a46ea79f Launcher: minor code cleanup
Use remap indices to reduce code complexity.
2025-06-19 12:20:52 +02:00
Kawe Mazidjatari bca9ff69b1 Launcher: store main panel data to VDF as well
The SDK Launcher now remembers every entry.
2025-06-19 12:20:15 +02:00
Kawe Mazidjatari 8c55ee9e32 Engine: minor remote console (RCON) improvements
- Improve ConnectedNetConsoleData_s member variable naming consistency.
- Use exactly the number of bytes needed for storing the Base64 AES-128 netkey for RCON encryption, and use the size to copy the results from the stack faster.
- Use the correct integral size types.
2025-06-19 12:12:43 +02:00
Kawe Mazidjatari a445ad2ad7 UISDK: create SDK plugin for RUI
Slightly different plugin than PluginSDK; this loads using the RPak dll loading tech.
2025-06-19 12:11:13 +02:00
Kawe Mazidjatari 0a04bbe23a Rui: improve Rui structures 2025-06-19 12:08:46 +02:00
Kawe Mazidjatari d1766f955f Thirdparty: upgrade Mbed TLS to v3.6.3.1 2025-06-19 12:05:47 +02:00
Kawe Mazidjatari aa789c31fa Thirdparty: upgrade SpdLog to 1.15.3 2025-06-19 12:03:39 +02:00
Kawe Mazidjatari e718e512a7 Client: don't bind client core functions to UI VM
UI VM doesn't need 3D debug drawing from code.
2025-05-26 22:44:20 +02:00
Kawe Mazidjatari 3339ff730a Client: remove script only console variables
Cleanup: these have been moved to the SDK's core mod which is a script made for dealing with stuff like this.
2025-05-26 22:41:45 +02:00
Kawe Mazidjatari 9d67e46c75 Server: rename GetServerID() to GetSessionID()
Avoid confusion with GetServerID() introduced in commit 2da030ba19.
2025-05-26 22:40:33 +02:00
Kawe Mazidjatari 2da030ba19 Client: implement GetServerID()
Allow CLIENT and UI VM to retrieve the current game server ID.
2025-05-26 22:39:41 +02:00
Kawe Mazidjatari 31f37eaef8 Engine: implement remote session ID for host
Replicated cvar containing the session ID for remote which the clients could use as the server ID.
2025-05-26 22:37:51 +02:00
Kawe Mazidjatari ae28a059fc Detours: only check ASLR registry entry on NT 6.0 and NT 6.1
MoveImages no longer exists on NT 6.2 and higher; ASLR is always enabled so we should use the ASLR code regardless of this registry entry.
2025-05-26 17:32:21 +02:00
Kawe Mazidjatari e0ea354350 Detours: fix incorrect skip count for reserved system DLL address ranges
This regression was caused in commit 9ad1cae791, we should've used the old constants again to increment this.
2025-05-26 17:30:06 +02:00
Kawe Mazidjatari 848eb08d2f Detours: remove unused DETOUR_TRACE() call
These variables no longer exists, fixes compile errors when enabling DETOUR_TRACE().
2025-05-26 17:28:10 +02:00
Kawe Mazidjatari e6df40b380 VScript: rewrite ModSystem script parser
Before, we compiled all our mod scripts after the core scripts had been compiled. This required several hacks to get working (deferring compile buffer freeing, appending a mod identifier to the path and scanning for it, etc..). Even after all the hacks, it still didn't work properly as local structures couldn't be defined in mod scripts without crashing the engine. The system has now been completely rewritten to append mod scripts into the same array all the core scripts are being added into, and compile everything in 1 go. This allows for removing every hack that was added to get the previous system to work, and also ensures we never load more scripts than MAX_SCRIPT_FILES_TO_LOAD, and enforces that every script (even from mods!) has an unique file name. This new implementation appears very robust during my extensive tests.
2025-05-26 13:09:17 +02:00
Kawe Mazidjatari 6c5c2f8b0a RTech: add timer to Pak_RequestSwap_f()
Report how long the hot swap took.
2025-05-26 10:39:19 +02:00
Kawe Mazidjatari 7e3919c6e8 PluginSDK: minor formatting fix
Make it consistent with the rest of the file.
2025-05-26 10:34:52 +02:00
Kawe Mazidjatari f75670e274 Tier0: increment sigcache version
Force full rebuild on next launch to improve subsequent launch speeds.
2025-05-24 01:03:03 +02:00
Kawe Mazidjatari 978de2aaa9 RTech: use full arg string for RPak tools commands to fix break set
Patch paks contain characters that are filtered by the break set causing autocomplete to fail on them. Use the full argument string after the 0th arg to avoid this.
2025-05-24 00:43:33 +02:00
Kawe Mazidjatari 0dfbb7ccef Tier1: support checking if ArgS() is all num
Currently, CCommand::HasOnlyDigits() only supports args in the argument vector, but not ArgS() which is also commonly used.
2025-05-24 00:35:46 +02:00
Kawe Mazidjatari bb1dd80149 RTech: fix UAF in Pak_RequestSwap_f()
We cannot use members of the pak info structure after the unload was initiated as they get clobbered and freed. Store them on the stack until the unload job is finished and provide it back to Pak_LoadAsync(). This is a development only feature so this bug doesn't affect the rest of the game's runtime.
2025-05-24 00:08:09 +02:00
Kawe Mazidjatari 581bdff6c1 RTech: change bit for ZStd pak encoder
Respawn started using 1<<9 for Oodle 2 weeks after the R5sdk implemented ZStd using the same bit. Changed to the last bit to fix the current conflict and avoid future conflicts. Lets hope they don't use this bit!
This is a breaking change and requires all encoded SDK RPak files to be rebuilt.
2025-05-22 21:10:27 +02:00
Kawe Mazidjatari 9ad1cae791 Thirdparty: fix Detours system DLL memory avoidance when ASLR is disabled
Some users reported issues with the game no longer launching if operated on a system with ASLR disabled. This patch takes these scenarios into account. We should not look for ASLR address space if ASLR is disabled as this will fail.
2025-05-22 14:28:09 +02:00
Kawe Mazidjatari e1bc098a70 Resource: update NavMesh build script
Updated to use the Recast project files instead now, and added newly shipped maps.
2025-05-21 18:09:48 +02:00
Kawe Mazidjatari 4547884a30 Resource: add RPak build script
Script for RPak build automation.
2025-05-21 18:08:02 +02:00
Kawe Mazidjatari d45c792dcd Resource: update VPK build script
Updated to reflect new changes in commit 7acac73432, and added newly shipped maps.
2025-05-21 18:07:34 +02:00
Kawe Mazidjatari 7acac73432 ReVPK: improve command line interface
Use '-' prefix for consistency with the rest of the tools and code base. Also slightly improved usage guide print.
2025-05-21 17:56:00 +02:00
Kawe Mazidjatari e7210b7107 Resource: enable rui_codeAsserts by default on dev
Enabled by default on development configurations.
2025-05-17 23:22:23 +02:00
Kawe Mazidjatari c2765e1f0c RTech: disable rui_codeAsserts by default
Can get verbose on level changes.
2025-05-17 23:19:12 +02:00
Kawe Mazidjatari eb9cd4be24 RTech: implement code assertion handler for Rui library
The Rui library contains assertions but if they fail they never get logged anywhere. Implemented handler that will log it to the console if cvar `rui_codeAsserts` is set (enabled by default because these are very rare/never happen and we should catch and fix them at all times).
2025-05-17 18:10:22 +02:00
Kawe Mazidjatari cc2e24cf57 Engine: fix incorrect member order for clock drift mgr tick counts
Server tick comes before Client tick. Server tick is at 0x8C while Client tick is at 0x90.
2025-05-17 18:03:27 +02:00
Kawe Mazidjatari 3ed1b67663 Recast: make application background uniform
Make it uniform until an artificial horizon or skybox variant is implemented.
2025-05-14 20:37:15 +02:00
Kawe Mazidjatari 7991c2e18d Recast: fix typo in comment 2025-05-14 20:30:08 +02:00
Kawe Mazidjatari 6f106998bc RTech: rename array manager class
Its not a hash map but a fixed array manager.
2025-05-14 20:29:49 +02:00
Kawe Mazidjatari 2e1f967bf8 Resource: properly fix the HUD scaling regression
This fixes every overlay (including the VGui sprite animations for the SRAM rocket launcher). This is the correct way of fixing the function as it was clearly not updated to match the new changes unlike Hud_SetScaleX() and Hud_SetScaleY().
2025-05-11 13:57:50 +02:00
Kawe Mazidjatari 9a73a944ad Common: cmd "weapon_reparse" should be FCVAR_GAMEDLL for dedicated
If sv_cheats is 1 and we run "weapon_reparse" on the client, the client will forward this command to the server as well so the server could reload its weapon scripts and be in-sync. However this command did not have the proper flags for this to function. Dedicated builds now have the right flags for this command, it now functions as intended.
2025-05-10 15:32:17 +02:00