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.
- 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.
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.
- 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).
- 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.
- 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.
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.
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.
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.
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.
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.
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).
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().
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.
We should return with the result -1 instead of executing the rest of the code because a slot idx of -1 is invalid and our structure pointer will be NULL. Very rare crash but it has happened a few times since the initial release of this project!
Engine bug that was caused after a refactor of the HUD system. The scalars were set to a child object instead of the root structure which is what Hud_SetScale() expects. Reworked the assembly code and the overlays now draw properly on the smart pistol and rocket launcher.
g_pEngineClient is an interface only class (does not contain any members), however it was pointing directly to the vftable instead of to a pointer to a vftable, therefore, using its vftable would cause a crash or otherwise undefined behavior. Changed initialization to point to the pointer to the vftable instead to yield correct behavior.
All 3 elements are of type i32, set dword instead of qword wide; reduces stack frame with 2 bytes and ensures we do not write past our array. Also fixed a type in a comment.
When using the gpu driven texture streaming system, alphasort world textures wouldn't stream because the compute shader was never executed during the alphasort render pass. The system has been modified to accomodate for the 3rd render pass, and the compute shaders now gets executed when alphasort gets rendered. Translucent materials now appear correct and stream in properly on all levels.
A code path was missed during the static texture array increase; r15 was set to module base but should've been set to the address of our new static texture array. The crash occurs when setting the cvar `stream_mode` to "all". After this change, all stream modes work as intended. This is so far the only issue that has encountered after increasing the array in commit 4de8a7d8ae.
The JSON root is now an array of objects, instead of an object with enumerated objects who's total size was controlled by another field name. This significantly simplifies the file format and parsing code. Also added a object type check for each ban entry to make sure we don't process faulty entries; these get reported to the console as a warning.
The net key is configured before the first Cbuf_Execute() call is fired, this results in the key getting configured twice when using `+net_useRandomKey <val>` over the command line. Make a dedicated command line argument (`-norandomkey`) to fix this problem.
The game is supposed to load the Mandarin streaming source file when schinese or tchinese is selected, however this didn't happen as the game's language is handled slightly different. Load mandaring streaming source files when either of the 2 languages are selected as these files contain the required audio for both. Fixes the issue where Mandarin audio couldn't be used when using schinese or tchinese language.
We need to look for the library from the directory the RPak was being loaded from. Use the new feature introduced in commit 17c07be6af to make sure we always attempt to LoadLibrary() the image exactly from where the rpak was loaded from.
This is useful for when we load an from a mod directory, and this rpak has a .dll which needs to be loaded along with the rpak, instead of going over each mod again (since caller doesn't know actual open path) we can just retrieve the actual load path of our rpak and from there LoadLibrary the linked image file.
Add command line arguments to allow disabling the plugin system, also placed the debug prints behind a convar that can be toggled through the command line and developer console. The actual instance loading/unloading code has also been moved into the class.
The command handler used the IVEngineClient interface to check if we are connected and are on a listen server. This interface is NULL on the dedicated server. The command handler has been rewritten to take this into account now.