347 Commits

Author SHA1 Message Date
Kawe Mazidjatari
cfa2172322 Undo CUtlBuffer::ParseToken patch
The bug was only reproduced on the compiled implementation in the game executable. The CUtlBuffer::ParseToken implementation in the SDK did not bug on the same input string. More research is required, and a possible good fix would be to just hook and replace the game's implementation with that of the SDK.
2023-06-23 00:27:24 +02:00
Kawe Mazidjatari
6361e64b5c Improve readability
Break up lines so they fit on a vertical monitor.
2023-06-19 22:42:25 +02:00
Kawe Mazidjatari
3f8baf6f68 Allow setting compile options for specific targets
Previously, it was all controlled from the global init (applied to all projects), but some projects need different options. With these changes, you can disable the common options applied in the 'add_module' macro, and set your own if desired.
2023-06-17 00:45:27 +02:00
Kawe Mazidjatari
4969a84030 Fix desync in CUtlbuffer::ParseToken
The if statement comparing 'nLen' with 'nMaxLen' increments 'nLen' first at all times, but the statement below that checks the delimiters seeks -1 from current pos, causing a desync. This could result in reading arbitrary memory on certain strings. This fix also fixes the useless need to 'snag' the delimiters from tokens.
2023-06-07 21:21:55 +02:00
Kawe Mazidjatari
8e1019a265 Make simple CNetAdr methods inline
Should be inline for their simplicity to improve performance.
2023-06-05 01:45:33 +02:00
Kawe Mazidjatari
63ca5d9d98 Make small bitbuf methods inline
Make inline to boost performance.
2023-06-03 18:04:38 +02:00
Kawe Mazidjatari
7f15b94cd9 String tools improvements
* Add 'V_IsValidPath'.
* Add optional parameter to 'V_StripLastDir', in which the new length of the string gets written into.
2023-05-29 21:37:15 +02:00
Kawe Mazidjatari
7e2b249ef6 CUtlString improvements
* Add method for finding a substring ('CUtlString::Find').
* Add method for appending a slash ('CUtlString::AppendSlash').
* Add 'CUtlString' overload for 'CUtlString::IsEqual_CaseSensitive'.
* Add 'CUtlString' overload for 'CUtlString::IsEqual_CaseInsensitive'.
* Add optional parameter to strip trailing slashes in 'CUtlString::DirName'.
* Add optional parameter to strip trailing slashes in 'CUtlString::StripFilename'.
2023-05-29 21:35:12 +02:00
Kawe Mazidjatari
11864f8902 Add all public headers to CMake projects
Added all public headers to CMake projects, also moved some files around in the public directory. Translation units have been moved to the libraries that were responsible for implementing them, as this game is monolithic.
2023-05-15 14:47:03 +02:00
Kawe Mazidjatari
9f44bcc818 Treat compiler warnings as errors
Treat them as errors globally. Most of the time a warning is a bug, or problem in code that could be solved in a different (better) manner. Thirdparty code have this disabled. The warnings as errors option can be globally disabled through the CMake GUI, but this is not recommended.
2023-05-15 09:44:26 +02:00
Kawe Mazidjatari
6a86ae2606 Cleanup CMakeLists files
Light cleanup in CMakeLists files. Split protocols and improve filter names.
2023-05-14 17:36:08 +02:00
Kawe Mazidjatari
7248c8aab7 Fix compiler warning
Use size_t instead to avoid the type truncation warning.
2023-05-14 02:11:29 +02:00
Kawe Mazidjatari
d809a9f633 Use PCH generated from VPC globally
This reduced output code size with 40KiB, improved compile times and appeared to improve runtime performance as well.
2023-05-14 02:10:17 +02:00
Kawe Mazidjatari
7ef50395eb Remove unused header file 2023-05-13 14:02:16 +02:00
Kawe Mazidjatari
8dbc2024c6 CMake code improvements
Use the 'add_module' macro to add modules without creating duplicate code. This macro also takes a reuse PCH as parameter, so modules that need a precompiled header, could reuse those from different targets that compile them. This commit also restructures the group order of the generated solution files for easier code navigation.
2023-05-13 00:14:53 +02:00
Kawe Mazidjatari
ee636477ce Uncomment
Header file exists, but is stubbed; uncomment.
2023-05-11 21:35:54 +02:00
Kawe Mazidjatari
f120354e96 Initial port to CMake
* All libraries have been isolated from each other, and build into separate artifacts.
* Project has been restructured to support isolating libraries.
* CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example).
* Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp).

TODO:
* Add a batch file to autogenerate all projects.
* Add support for dedicated server.
* Add support for client dll.

Bugs:
* Game crashes on the title screen after the UI script compiler has finished (root cause unknown).
* Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
2023-05-10 00:05:38 +02:00
Kawe Mazidjatari
359820615f Move low level code to tier0/tier1
Moved to tier0/tier1 so it could be compiled into a static library in the future.
2023-05-06 22:59:01 +02:00
Kawe Mazidjatari
39ccf8636d Force ConVar getters as inline 2023-05-03 23:59:33 +02:00
rexx
bcc51460bc
new new modsystem pr (#96)
* modsystem v2 initial commit

* call CModSystem::Init

* clean up custom cvar value handling

* add mod script compiling support

* add error check to script rson loading

yes this error is a duplicate but this one exits the game

* fix typo

* fix compile error
2023-05-02 19:26:49 +01:00
rexx
1055ba8994 add serverbrowser convars to fix script error 2023-05-01 20:41:27 +01:00
rexx
f90bba9d85 Fix compile
This assert was accidentally left in to catch any invalid calling of CNetAdr::ToString
2023-05-01 15:15:06 +01:00
Kawe Mazidjatari
366ff3fb4f Remove devonly flag from 'net_usesocketsforloopback' 2023-05-01 00:01:18 +02:00
Kawe Mazidjatari
ef20846314 Remove extraneous include 2023-04-30 21:43:08 +02:00
Kawe Mazidjatari
cc38fabaa7 Change default value of 'rcon_password'
Changed to '[loopback]:37015' (always works, regardless of address type).
2023-04-30 11:57:49 +02:00
Kawe Mazidjatari
c6748edcc9 Reboot RCON server if 'net_usesocketsforloopback' changed
Reboot so it could update accordingly, just like the game's UDP sockets.
2023-04-30 11:34:47 +02:00
Kawe Mazidjatari
55aa254e6b Merge branch 'bulk_check' into indev 2023-04-29 21:01:59 +02:00
Kawe Mazidjatari
d52074238f Mark pylon refresh cvars as devonly
Marked 'sv_pylonRefreshRate' and 'sv_banlistRefreshRate' as development only.
2023-04-29 20:44:51 +02:00
rexx
dca27475ec (re)implement sv_alltalk
Rebuilds SV_BroadcastVoiceData with an additional check of "sv_alltalk" cvar to disable team checking, allowing for servers to enable global voice chat
2023-04-29 11:11:10 +01:00
Kawe Mazidjatari
7739e56b0d Adjust default value of cvar 'sv_banlistRefreshRate'
Set to 30 sec.
2023-04-28 23:48:30 +02:00
Kawe Mazidjatari
d69451466c Add assert in 'CNetAdr::ToString'
Main thread only from now on. Any other thread should manually pass in a buffer.
2023-04-22 21:46:37 +02:00
Kawe Mazidjatari
9829684183 Set max value for rcon cvars
Clamp 'sv_rcon_maxsockets' and 'sv_rcon_maxconnections' to MAX_PLAYERS as it could otherwise crash the game if set too high.
2023-04-22 18:13:27 +02:00
Kawe Mazidjatari
50b3273101 Add change callback for 'sv_rcon_maxconnections'
If 'sv_rcon_maxconnections' is set higher than current auth socket count, reopen listen socket. If its set lower, close all sockets until auth socket count matches 'sv_rcon_maxconnections'. Sockets are getting closed in reverse order, so the netcon that connected last will be disconnected first.
2023-04-22 16:51:18 +02:00
Kawe Mazidjatari
e51336dd5a Add 'bf_write::WriteBytes' 2023-04-19 01:36:35 +02:00
Kawe Mazidjatari
179bd31ee6 Initial large refactor of the RCON implementation
* Decoding and encoding is done into a single buffer, from raw buffers to avoid extraneous copies.
* Added base class holding all core logic for encoding, decoding, receiving and processing of the RCON protocol. This code was initially identical between all implementations of RCON, deduplicating this avoids bugs.
* Added more sophisticated error handling, stop right away when decoding for example fails.
* Added ability to have more than one active authenticated net console on the server. Controlled by cvar 'sv_rcon_maxconnections' (default 1).
* Max packet size for accepted, but not authenticated sockets is now controled by cvar 'sv_rcon_maxpacketsize' (default 1024).
2023-04-19 01:35:31 +02:00
Kawe Mazidjatari
437a54486d Fix typo in 'bf_write' 2023-04-18 20:14:20 +02:00
Kawe Mazidjatari
85f586bd2e RCON server improvements
* Prevent attacker from being able to abuse and overflow the banned list vector.
* Improved IPv6 comparison performance.
* Change size fields of payload frame from unsigned to signed.
* Close all accepted sockets on RCON server shutdown.
2023-04-16 17:51:48 +02:00
Kawe Mazidjatari
c354d7ae02 Add ability to compare IPv6 addresses 2023-04-16 11:55:57 +02:00
Kawe Mazidjatari
8bf105b072 Smoother fade animation for ImGui panels
Fade out when disabled too, in steps of 0.5f. SDK fixed frame has been increased to 100tps.
2023-04-16 02:45:22 +02:00
Kawe Mazidjatari
e0e7adbed4 Rename 'ip' cvar global to avoid conflicts
Avoid shadowing conflicts due to short name.
2023-04-16 01:17:46 +02:00
Kawe Mazidjatari
72a0399427 Add 'ip' cvar to SDK 2023-04-16 00:32:50 +02:00
Kawe Mazidjatari
fd5b840ba9 Light cleanup of the 'CNetAdr' class 2023-04-16 00:08:06 +02:00
Kawe Mazidjatari
0ffcca14ab Add 'sv_cheats' cvar to SDK 2023-04-15 00:18:13 +02:00
Kawe Mazidjatari
2aa20fbf18 Fix compiler warnings
* Explicitly cast to types.
* Mark parameter unused in release.
2023-04-10 23:45:09 +02:00
Kawe Mazidjatari
b45055dafd Fix debug compile errors 2023-04-10 22:31:42 +02:00
Kawe Mazidjatari
b75fb7913f Rename symbols 2023-04-10 19:14:59 +02:00
Kawe Mazidjatari
e77b301f2b Remove unused ConVar
No longer required.
2023-04-10 15:05:05 +02:00
Kawe Mazidjatari
6a69965b33 Improve 'bf_read' and 'bf_write'
* Implemented a proper initializer for the mask tables (s_nMaskTable has been removed).
* Implemented write methods in 'bf_write'. There are still some missing methods; there have to be added in later.
* Documented most functions.
2023-04-10 15:02:56 +02:00
Kawe Mazidjatari
7aa07083ca CBitRead::ReadString: Improve readability
The intention of null-terminating the string is clearer when using '\0' instead of '0' or 'NULL'.
2023-04-09 23:35:58 +02:00
Kawe Mazidjatari
678c6dc833 Add proper timing logic for server statistics
Update rate is now controller by a cvar.
2023-04-09 11:06:55 +02:00