2642 Commits

Author SHA1 Message Date
Kawe Mazidjatari
0399d753f4 Properly toggle cvars in sdk launcher
Toggle them on or off instead of just on. Else disabling the toggle wouldn't disable then in the runtime as the default value of these cvars is '1'.
2023-04-25 00:47:44 +02:00
Kawe Mazidjatari
d9fa611418 Add new callbacks to server functions
A few new callback hooks which are perhaps useful in the future.
2023-04-25 00:46:45 +02:00
Kawe Mazidjatari
000f7c7f82 CPylon parsing/logging code deduplication
Deduplicated parsing and logging code. Results are a lot more consistent and comprehensive.
2023-04-25 00:45:39 +02:00
Kawe Mazidjatari
f0a561552b CPylon server query code deduplication
Created another dedicated wrapper for handling API requests; significantly reduced duplicate code.
2023-04-24 01:55:37 +02:00
Kawe Mazidjatari
aff4b6125e CPylon error handling code deduplication
Deduplicate code.
2023-04-24 00:32:27 +02:00
rexx
3eb660c9f7 enable pluginsystem 2023-04-23 22:28:16 +01:00
Kawe Mazidjatari
59b685b7ee Fix unreachable code warning
This code isn't reachable, removed.
2023-04-23 20:35:08 +02:00
Kawe Mazidjatari
8898b44dee Fix memory leak in ImGui panels
Properly release texture buffers.
2023-04-23 20:34:36 +02:00
Kawe Mazidjatari
615de70b1f Fix shutdown crash
Fixed crash due to destructor of CSocketCreator being called during shutdown. If the socket fails to close, an error is logged. But at this point, all sockets have been closed already and the logger system has already been destroyed. Allocated as dynamic memory to avoid destructor being called at this stage.
2023-04-23 18:01:30 +02:00
Kawe Mazidjatari
1eef4aacb4 Improve signatures
Better signatures, and fix signature/compile errors for s1 and s2.
2023-04-23 17:05:00 +02:00
Kawe Mazidjatari
b11e5d539c Light code cleanup
Compiler output did not change; logic remained identical.
2023-04-23 11:35:09 +02:00
Kawe Mazidjatari
02bef4c2dd Light cleanup in CPylon
Force consistency.
2023-04-22 22:00:20 +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
df81d52398 Improve assert
Fix assert condition where iSocket and GetAcceptedSocketCount are both 0.
2023-04-22 21:46:05 +02:00
Kawe Mazidjatari
13fcdaa442 Fix bug in 'CServer::AuthClient'
The IP that is sent to the server should be in base format only (no brackets or port). The buffer size was also too small to contain the entire length of the full IP address with port and brackets.
2023-04-22 20:30:53 +02:00
Kawe Mazidjatari
d56c24ce05 'CNetConBase::Recv' cleanup 2023-04-22 18:13:42 +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
9b65c7e59c Light cleanup 2023-04-22 16:49:22 +02:00
Kawe Mazidjatari
be61c93c85 RCON system improvements
* Added more error handling throughout code.
* Marked function parameters 'const' where possible.
* Updated comments.
2023-04-22 16:02:54 +02:00
Kawe Mazidjatari
8aed88a0b5 Make it easier to distinguish netconsole logs from rcon logs
Log net console timestamps with parentheses, and rcon logs with brackets. This makes it much easier to determine who the owner of the log is.
2023-04-19 02:05:58 +02:00
Kawe Mazidjatari
39445eecc4 Add missing check
This fixes the bug where RCON address couldn't be set from the '[::]:port' format.
2023-04-19 01:52:05 +02:00
Kawe Mazidjatari
e51336dd5a Add 'bf_write::WriteBytes' 2023-04-19 01:36:35 +02:00
Kawe Mazidjatari
83d5deb109 Remove unused type
No longer used; replaced with cvar 'sv_rcon_maxpacketsize'.
2023-04-19 01:36:10 +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
d22b91fd72 Rename enumerant in 'CCrashHandler' 2023-04-18 20:13:51 +02:00
Kawe Mazidjatari
5a90e2cff3 Remove deprecated workaround
No longer required as of commit f520cab4.
2023-04-18 18:41:06 +02:00
rexx
f520cab44b fix static prop exceptions
This fixes the exceptions that were caused by loading ported bsps with replaced models
CStaticProp::Init was using static prop lump data to request non-existent skins due to the replaced models, causing invalid material pointers to be fetched.
When encountered, these skins will be forced to 0 and an error will be printed.
Ideally these issues are fixed from within the bsp file before they are shipped.
2023-04-18 16:56:35 +01: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
050a27e387 Fix compiler warning on dedicated server
Mark parameter as unused.
2023-04-16 15:51:51 +02:00
Kawe Mazidjatari
2caede5099 Add asserts in CSocketCreator 2023-04-16 15:51:16 +02:00
Kawe Mazidjatari
b5b379fff9 Determine net console frame tick rate using an interval 2023-04-16 15:49:07 +02:00
Kawe Mazidjatari
bd1bec3cfe Several RCON bug fixes and improvements
* Fixed uncontrolled format specifier in 'NetMsg' call on the RCON client.
* Removed extraneous call to 'PrintPercentageEscape'.
* Compare, and disable RCON logs if user attempts to connect to listen server's RCON.
2023-04-16 12:05:39 +02:00
Kawe Mazidjatari
5f4b436ec6 Only attempt to send RCON log if its not from the client 2023-04-16 11:59:56 +02:00
Kawe Mazidjatari
a11012f3bf Set port on global netadr object
Set the port so it could be used to compare addresses.
2023-04-16 11:58:37 +02:00
Kawe Mazidjatari
35e0d9e8c8 Disable 'cl_threaded_bone_setup' at all times
Disabled in the gamesdk at all times as users have reported issues that causes the game to freeze when switching from a remote server to a listen server. The engine bug still needs to be addressed.
2023-04-16 11:57:45 +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
021242ece9 Fix unused variable warning for netconsole project 2023-04-16 01:25:39 +02:00
Kawe Mazidjatari
b8035120de Assign unused constructor parameter 2023-04-16 01:23:38 +02:00
Kawe Mazidjatari
4827a3cc84 Fix 'unreachable code' compiler warning 2023-04-16 01:23:11 +02:00
Kawe Mazidjatari
75b9c71fd7 Enable compiler warning level 4 for executable projects 2023-04-16 01:18:12 +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
9287f00841 Fixed performance bug in standalone netconsole
When unconnected, the frame loop would run as fast as it could. Moved thread sleeper at the bottom in the outer scope of the function to prevent this behavior in all cases.
2023-04-16 01:00:07 +02:00
Kawe Mazidjatari
096091e56f CConsole::LoadFlagIcons: Break out on failure 2023-04-16 00:41:48 +02:00
Kawe Mazidjatari
617b7b1948 Fix bug caused by compiler optimization
The 'private' server icon did not load in release builds due to the call to 'LoadTextureBuffer' getting optimized away by the use of the const qualifier. Removing the qualifier fixed the bug.
2023-04-16 00:40:44 +02:00
Kawe Mazidjatari
3d49d07953 NET_ReceiveDatagram: light code improvement 2023-04-16 00:36:30 +02:00
Kawe Mazidjatari
72a0399427 Add 'ip' cvar to SDK 2023-04-16 00:32:50 +02:00
Kawe Mazidjatari
abf74d71a0 Add missing definition for 'NET_Config' 2023-04-16 00:32:11 +02:00