603 Commits

Author SHA1 Message Date
Kawe Mazidjatari
2ed56d7317 More mapped out fields for server and client class 2023-02-17 23:59:37 +01:00
Kawe Mazidjatari
a0cc101b29 Rebuild 'Host_Status_PrintClient'
This function has been rebuild by popular demand. Its the exact same as the one found within the executable but it logs the client's nucleus id as well, which is useful for identifying a cheater and taking necessary actions.
2023-02-15 20:54:09 +01:00
Kawe Mazidjatari
eaf1e3632e Implement 'COM_FormatSeconds' 2023-02-15 20:50:12 +01:00
Kawe Mazidjatari
06698bea33 Implement 'CNetChan::GetTimeConnected'
'CNetChan::GetConnectTime' has been removed in favor of 'CNetChan::GetTimeConnected'.
2023-02-15 20:49:14 +01:00
Kawe Mazidjatari
fc1a773836 Add 'g_NetTime' to SDK
Official name = 'net_time'.
2023-02-15 20:47:58 +01:00
Kawe Mazidjatari
8550d7a865 Rename 'TickUpdate' to 'nettick_t' and move to public
Renamed, and moved to public. also added additional static assertions to avoid alignment mistakes in the future.
2023-02-15 17:52:25 +01:00
Kawe Mazidjatari
ccf221fd6e CNetChan fixup
* Renamed member variable; m_bUnkTickBool is m_nServerCPU.
* Removed member variable 'm_bRetrySendLong'; does not exist in s3.
2023-02-15 17:35:47 +01:00
Kawe Mazidjatari
15e9259b77 Use server current time for reload logic
Use server's current time for reload logic instead of a dedicated fast timer.
2023-02-12 15:32:34 +01:00
Kawe Mazidjatari
612ab83b20 Use 'GetNumClients' for hosting and status bar
Use 'GetNumClients' instead of iterating over the client array twice. Also fixed a bug causing the status bar only to display real clients, buts were never counted.
2023-02-12 15:21:33 +01:00
Kawe Mazidjatari
decf3552ea Add 'GetNumClients'
Gets the total amount of clients on the server (both fake and real clients).
2023-02-12 15:20:11 +01:00
Kawe Mazidjatari
1db53a135f Fix dedicated.dll compile error
'g_svNetKey' no longer exists.
2023-02-12 11:49:39 +01:00
Kawe Mazidjatari
236eb861d5 Add global netadr to SDK
Global from engine used in the 'status' command etc..
2023-02-12 11:32:05 +01:00
Kawe Mazidjatari
e98a6c31e9 Improve netkey logic
Removed extraneous copy of the base64 netkey. The base64 key is now directly obtained from the netkey singleton.
2023-02-12 02:28:03 +01:00
Kawe Mazidjatari
0734d56fe2 Add reversed 'CNetKey' class
Confirmed size, mostly unknown still. But some of this seems to be data related to OpenSSL.
2023-02-12 02:15:58 +01:00
Kawe Mazidjatari
654e4e4271 Fix color mismatch
Fix mismatching marker color.
2023-02-04 19:15:08 +01:00
Kawe Mazidjatari
60ab35b5c4 Light optimizations for string utils
* Changed 'CreateDirectories' to only copy sanitized path if pointer to string is passed.
* Changed 'IsValidBase64' to only tokenize base64 value if pointer to string is passed.
2023-02-04 15:59:45 +01:00
Kawe Mazidjatari
0dace8eea3 Fix crash during init
If an error occurs during init, and 'Error' is called, the program will segfault. Fixed by only running the 'send' code from RCON after it has been initialized.
2023-02-04 01:34:08 +01:00
Kawe Mazidjatari
ffcefdd64e Rename 'g_pNetKey' to 'g_NetKey'
Not a pointer in engine code, only in SDK.
2023-01-31 23:44:01 +01:00
Kawe Mazidjatari
e50601ed29 Rename 'g_bDedicated' to 'm_bIsDedicated' 2023-01-31 22:40:15 +01:00
Kawe Mazidjatari
6e32464519 Rename 's_bDedicated' to 's_bIsDedicated'
's_bIsDedicated' is the original name (see TRACEINIT in game executable).
2023-01-31 22:30:45 +01:00
Kawe Mazidjatari
2ecc556d08 Fix CClientState shifted pointer
Shifted pointer address was wrong, this approach is more robust.
2023-01-31 20:54:58 +01:00
Kawe Mazidjatari
462439b1dc Improve string formatting
Flip bracket.
2023-01-31 17:10:17 +01:00
Kawe Mazidjatari
c0a38a6c26 Additional renames 2023-01-31 16:21:51 +01:00
Kawe Mazidjatari
c17913bfe9 Light cleanup of pak load api var names
* Rename some pakload api vars.
* Removed 2 duplicate pointers from (g_ClientState_Shifted and g_pakLoadJobID).
* Removed unnecessary signonstate check in 'Mod_ProcessPakQueue' for dedicated.
2023-01-31 16:09:30 +01:00
Kawe Mazidjatari
8b6e22473e Fix clang-cl compile errors
Unfortunately clang-cl doesn't support __FUNCTION__ macro concat. Some SSE stuff in mathlib/navmesh rendering also needs to be made portable at some point.
2023-01-31 14:31:17 +01:00
Kawe Mazidjatari
0a319971dd Hook ResizeBuffers to obtain rect size during resize
Required as the initialization only sets it to the startup rect size. This will always be up-to-date during resizes.
2023-01-30 22:08:01 +01:00
Kawe Mazidjatari
c84622cfd6 DirectX hook refactor
Refactored code to only feature game pointers, this avoids the unnecessary overhead that was previously caused by creating our own device pointers, swapchain, etc.. This commit also fixes the classic 'black screen' problem when the aspect ratio is set to 4:3 - 5:4, however, a similar bug returned for this causing Dear ImGui to not draw at all when the aspect ratio is set to 4:3 - 5:4. This commit also moves the old HwndProc hook to 'CGame::WindowProc'.
2023-01-30 20:18:11 +01:00
Kawe Mazidjatari
8ed5a3a695 Connect RCON to localhost by machine name
Connect to local host using machine name when ip is set to 'localhost'.
2023-01-29 17:12:33 +01:00
Kawe Mazidjatari
5f56c23af2 Compile CRConServer for gamesdk
RCON can now be used on the host game as well (previously dedicated exclusive).
2023-01-29 16:07:02 +01:00
Kawe Mazidjatari
b98eee0268 RCON system refactor and improvements
* Use game's CNetAdr RCON and socket creator.
* Add support for constructing host from [ip]:port format in the netconsole client.
* Pass 'netadr_t' parameter by reference to 'CSocketCreator::OnSocketAccepted'.
2023-01-29 15:24:24 +01:00
Kawe Mazidjatari
6df498e5c8 Rename 'v_netadr_t' to 'netadr_t'
Name was used for compatibility reasons. No longer necessary.
2023-01-29 15:12:27 +01:00
Amos
b965e04dd4 Update signature for 'g_pNetKey' 2023-01-27 10:36:38 +01:00
Kawe Mazidjatari
61684ddf87 Create cvar for global banned list queries
This was planned to be changed a long time ago. This change allows dedicated server users to disable the logic as well.
2023-01-26 21:20:11 +01:00
Kawe Mazidjatari
59a917a2bc Light cleanup 2023-01-26 03:00:23 +01:00
Kawe Mazidjatari
f47fb63e5f Fix dedicated server compile errors
Huge cleanup for dedicated. All patches in 'opcodes.cpp' are now directly applied to the executable, and kept as reference in the source file. The patch logic is commented. Any other patches for the dedicated server executable should be documented in the patch file found in 'r5dev/resource/patch'.
2023-01-26 02:59:50 +01:00
Kawe Mazidjatari
9ea06aa65d Use 'Assert' instead 2023-01-25 19:21:06 +01:00
Kawe Mazidjatari
a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +01:00
Kawe Mazidjatari
8d6358512b Debug overlay cleanup 2023-01-24 18:43:00 +01:00
Kawe Mazidjatari
19447f1122 Improve debug draw depth test toggle logic
* Add box depth test cvar from engine for 'CBaseAnimating::DrawServerHitboxes'.
* Use noDepthTest field from OverlayBox_t instead of the cvar.
2023-01-24 12:05:09 +01:00
Kawe Mazidjatari
d97678e059 Fix potential compiler error
Potential problem of "type 'x' already defined".
2023-01-23 23:17:51 +01:00
Kawe Mazidjatari
502a1d2324 Switch box overlay transform type to 'matrix3x4_t'
Actual type turned out to be 'matrix3x4_t' after further reverse engineering.
2023-01-23 02:20:21 +01:00
Kawe Mazidjatari
07ef57536d Add modelinfo vftable pointers 2023-01-22 16:48:16 +01:00
Kawe Mazidjatari
4ca0146499 EngineTrace improvements
Add server's EngineTrace to SDK, unfortunately it does not have a exposed factory interface unlike the client's version.
2023-01-21 16:24:36 +01:00
Kawe Mazidjatari
e3b72b5e75 Fix formatting of address debug
Separator should be at the bottom.
2023-01-21 16:17:08 +01:00
Kawe Mazidjatari
0d9a66a6cf Mod_GetAllInstalledMaps: light cleanup 2023-01-21 15:39:18 +01:00
Kawe Mazidjatari
7b669ea8c6 Engine trace cleanup
Separate into different files to make it easier for other classes to access.
2023-01-20 17:20:50 +01:00
Kawe Mazidjatari
1544442cc4 Add CClient::SetSignonState to SDK
Backwards compatible up to S0.
2023-01-20 16:01:39 +01:00
Kawe Mazidjatari
9e490c16cc Rename unknown field in CClientState
Field 'field_AC' is 'm_nInSequenceNr'.
2023-01-20 16:01:00 +01:00
Kawe Mazidjatari
21f4d0fa07 Initial working bots implementation
* Changed 'CClient' handle time to 'edict_t' which is an alias of 'uint16_t'.
* Changed 'g_pServerGameDLL' and 'g_pServerGameClients' init (obtain from factory instead).
* Use interface version macro's for obtaining factory pointers instead.
* Added 'g_pServerGameEntities'.
2023-01-16 21:09:21 +01:00
Marvin D
75b90d9294 Forgot changing HS_SHUTDOWN 2022-12-22 00:53:09 +01:00