521 Commits

Author SHA1 Message Date
Kawe Mazidjatari
4c6840be6c Light cleanup for 'CMapLoadHelper' ctor 2023-05-22 12:08:02 +02:00
Kawe Mazidjatari
2d0c033f95 Fix LUMP_GAME_LUMP not loading from the disk
Last lump to not load from the disk, see function 'AddGameLump' for details as to how this is performed.
2023-05-21 18:08:07 +02:00
Kawe Mazidjatari
27925d3b7d Fix compiler warning causing compile errors
Unused initialized local variable.
2023-05-21 01:59:37 +02:00
Kawe Mazidjatari
ecf7f973f8 Allow to load all lumps from disk
This commit allows for loading all lumps from disk, if the m_bExternal var is set, it also attempts to load the lumps listed in the function 'IsLumpTypeExternal' from the cache, but through a different code path, which causes a crash. Setting this to false allows for loading it in the ctor.
2023-05-20 21:44:53 +02:00
rexx
66f52dea23 fix missing valid external lump check
bsp_lump loading was missing a check for if the lump is supposed to be able to load from disk

also removes VERTEX lumps from loading from disk due to crashes that occur when they are kept
2023-05-20 14:54:00 +01:00
rexx
d7f0de9d40 fix external bsp_lump loading
previously the lump data was being freed immediately after loading. this sets m_pRawData to nullptr so that doesn't happen
2023-05-20 13:49:12 +01:00
Kawe Mazidjatari
4297cd9ce3 Experimental BSP_LUMP loading hook
The 'CMapLoadHelper' constructor has been rebuild to load lump files too (if they exist). Currently, the game only reads the packed BSP file, or lumps if they exist in the filesystem cache. The newly added logic also reads them from a file. This is currently broken, most likely due to alignment problems. Experimental.
2023-05-20 14:06:36 +02:00
Kawe Mazidjatari
44edef1724 Add BSP types
Type 'StaticPropLump_t' has been moved to 'gamebspfile.h'.
2023-05-20 14:03:44 +02:00
rexx
d521c67367 Hook CMapLoadHelper ctor
This will be used for enabling bsp_lump file loading in the future
2023-05-19 20:21:11 +01:00
Kawe Mazidjatari
53788d5ba5 Potential fix for intermittent crash during playlists reload
This should fix a rare crash that happens when the playlists file is reloaded during disconnect. The client fetches the playlists from the server on connect. On disconnect, we want to reload the one from the client so that if the player want's to create his own game, that he would have his own playlists. The fix is to delay the reload of the playlists file to the beginning of the next frame.
2023-05-16 00:44:59 +02:00
Kawe Mazidjatari
8acfad5556 Fix aligned memalloc singleton
Properly fix the aligned memalloc singleton in the SDK; the implementation now uses a callback based approach for calling the allocator and deallocator.
2023-05-15 20:47:17 +02:00
Kawe Mazidjatari
7ddd33c8de Force name consistency
Renamed to just 'netconsole' as it was phrased like that throughout other files.
2023-05-15 18:00:51 +02:00
Kawe Mazidjatari
552f5f750c Fix crash in 'CClient::ActivatePlayer'
Set the persistence fields to 'ready' in 'CClient::ActivatePlayer', before executing the rest of the function. Previously, it was set in 'CVEngineServer::PersistenceAvailable', but this is too late. The function 'FairFight_Init' was actually 'CClient::ActivatePlayer', and thus it has been moved to the correct file, and the old file defining it previously has been removed.
2023-05-15 17:19:18 +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
904976e4f5 Move shared files from server 2023-05-13 22:54:15 +02:00
Kawe Mazidjatari
67fb566dfb Compile launcher as separate library again 2023-05-13 20:03:42 +02:00
Kawe Mazidjatari
b94a9dcd7c Add dedicated server engine library
Added to CMake projects.
2023-05-13 17:48:00 +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
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
d825fb9f58 Adjust type for 'g_pMallocPool' and rename
Adjusted type to 'CAlignedMemAlloc' and renamed it to 'g_pAlignedMemAlloc'. This global allocates  memory aligned.
2023-05-06 17:48:43 +02:00
Kawe Mazidjatari
75ccebb4b6 Squirrel system restructure
Properly decouple squirrel and game code. This makes it easier to reverse engineer more of this squirrel system, and to compile them as individual libraries later on when moving to CMake to significantly decrease compile times.
2023-05-06 16:23:56 +02:00
Kawe Mazidjatari
848098c71d Update state machine initialization order
* Run autoexec(_dev).cfg before anything else.
* Always initialize RCON (only gets ran if an actual password is set).
* Removed 'Cbuf_Execute()' call from 'CHostState::LoadConfig', let it run in the frame loop instead.
* Removed hardcoded set call for 'net_usesocketsforloopback', will be set in autoexec from now on.
2023-04-30 11:39:20 +02:00
Kawe Mazidjatari
f97cf6c249 RCON socket bind improvement
Check 'net_usesocketsforloopback' before binding sockets; allows binding to loopback as well.
2023-04-30 11:32:51 +02:00
Kawe Mazidjatari
90cf742fb5 Don't check for ban if client is a loopback address 2023-04-30 11:31:05 +02:00
Kawe Mazidjatari
17c8a5e49c Add const getter for 'CNetChan::remote_address'
Return as const reference.
2023-04-30 11:11:33 +02:00
Kawe Mazidjatari
f319fc0846 Use server global variables for client loops
Use server global variables for determining the num clients to loop over. This is cheaper and better than always looping over MAX_PLAYERS.
2023-04-30 01:50:38 +02:00
Kawe Mazidjatari
6b23570beb Ban system bug fix and improvements
* Format the ip as '[ip]:port' in all logging calls for consistency.
* Fixed a bug causing the IP to be send up as full instead of base only to master server (should always be base only).
* Temporarily uncommented the plugin callback logic.
2023-04-30 01:29:54 +02:00
Kawe Mazidjatari
98f09b25de CClient: Member type improvements
* Made 'm_nUserID' signed.
2023-04-30 01:26:37 +02:00
Kawe Mazidjatari
4ec8e67d9b CNetChan: Getters improvements
* Allow for requesting address base only.
* Added new getter 'GetPort'.
2023-04-30 01:24:45 +02:00
Kawe Mazidjatari
78a86fed6a Log address of 'SV_BroadcastVoiceData' 2023-04-29 21:07:45 +02:00
Kawe Mazidjatari
55aa254e6b Merge branch 'bulk_check' into indev 2023-04-29 21:01:59 +02:00
Kawe Mazidjatari
a5bc2f77cb Fix broken 'SV_IsClientBanned' implementation
SV_IsClientBanned is now checked after the creating of CClient, and thus 'CServer::AuthClient' has been inlined into 'CServer::ConnectClient'. Since we have to request the master server to check whether or not this particular client is globally banned, we have to detach it into a separate thread, and process the results back into the main thread once finished. This takes too much time, so we connect the client anyways and if the master server marked it as 'banned', we disconnect it right away.
2023-04-29 20:36:29 +02:00
Kawe Mazidjatari
3ea49766c6 Light banning code improvements
* Removed extraneous std::string constructors (everything using the bansystem used raw char pointers).
* Improved logging and function comments.
2023-04-29 12:15: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
ab9d36e0d8 Send client's persona name to the master server
Will be used on the master server for additional checking.
2023-04-29 00:05:47 +02:00
Kawe Mazidjatari
48bc69b028 Initial implementation of bulk ban checking
Initial implementation of the bulk ban check system. This implementation takes a snapshot of the currently connected clients, sends it up to the master server, and the master server returns anything within this list that is marked 'banned'. The server would then kick the player from the server. This commit also removes the global banned list cache, as the bulk checking system offers a lot more freedom regarding banning specific players and have it sync across all available servers.
2023-04-28 23:47:58 +02:00
Kawe Mazidjatari
a1c97e1b39 Fix assignment bug
Sigscan results returned to the wrong var.
2023-04-26 23:31:03 +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
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
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
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
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