41 Commits

Author SHA1 Message Date
Kawe Mazidjatari
2d87e082f1 /W4: Fix unreferenced symbol bugs
Fixed bugs that was caused by symbols that were defined, but never used.
* 'UnsignedIntConvertToFltSIMD' never used its input parameter.
* The results from the call to 'sq_call' were never checked, so if a failure took place, it was never logged.
* 'CheckForWarnings' never used the 'context' parameter, but this was required as context types of 'eDLL_T::SYSTEM_WARNING' or 'context == eDLL_T::SYSTEM_ERROR', should be returning the warning/error color as well.
* Renamed 'GetHiddenServerConnectStatus' to 'GetHiddenServerName' and added more dedicated error handling within its logic, as the results from the call 'g_pMasterServer->GetServerByToken' was never checked.
2023-04-02 17:11:14 +02:00
Kawe Mazidjatari
29616f4810 Rename 'g_vAllMaps' to 'g_InstalledMaps' 2023-03-31 00:35:01 +02:00
Kawe Mazidjatari
d9a6ab5cf6 Optimize script functions
Light cleanup and optimizations for Squirrel script functions. Use existing pointers or references as much as possible in place of extraneous string copies.
2023-03-25 17:54:05 +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
419bf12e06 Add abstracted functions to determine build type
Allow scripters to determine whether or not this is a dedicated server or client only build. Note that these should not be abused in scripts! Since the client dll doesn't support running games locally, loading up the lobby isn't going to work when you leave a match (which is the current implementation in the scripts). with this, the scripter could do other things such as loading the title screen, or connecting to a remote lobby server if this happens to be a client only build.
2023-01-31 22:26:29 +01:00
Kawe Mazidjatari
29ca97f6b0 Light squirrel code cleanup
* Renamed 'SetEncKeyAndConnect' to 'ConnectToListedServer'.
* Renamed 'JoinPrivateServerFromMenu' to 'ConnectToHiddenServer'.
* Renamed 'GetPrivateServerMessage' to 'GetHiddenServerConnectStatus'.
* Cache game server ref in 'ConnectToListedServer'.
2023-01-28 13:28:27 +01:00
Kawe Mazidjatari
3cbd98b900 Expose kick/ban/unban to UI SQVM 2022-09-16 01:40:17 +02:00
Kawe Mazidjatari
a68f55dac0 Move unban logic to CBanSystem and expose to Squirrel
New unban function in SERVER context 'UnbanPlayer(string criteria)'.
2022-09-16 00:51:35 +02:00
Kawe Mazidjatari
9c9843a0fc Centralize kick/ban wrappers to CBanSystem and add new server functions for kicking/banning players 2022-09-15 23:13:37 +02:00
Kawe Mazidjatari
c936683cea Update sqinit.cpp 2022-09-11 00:39:39 +02:00
Kawe Mazidjatari
ab8fc757c8 Fix concurrent access to 'g_vAllPlaylists' and 'g_vAllMaps' 2022-08-29 11:55:58 +02:00
Kawe Mazidjatari
656b0be3ec Improve threading (work in progress)
* Only run '_DownloadPlaylists_f()' in the main thread, schedule for next frame if we aren't in the main thread. (this should fix crash cases related to disconnecting from the game).

* Locked read/write to CBrowser members (thread for obtaining the server list is detached, but once the 'slow' post operation in this thread is complete, mutex lock is acquired (locking the render thread if the browser is active) to set the string members of CBrowser, this operation is very fast as we only set the string and the color after the http post operation (this never caused a crash, but the behavior without any lock mechanism is technically undefined regardless).

* Obtain the host name dynamically from the ConVar 'pylon_matchmaking_hostname' (atomic operation). Initial approach was deleting the whole master server pointer just to construct a new httpclient object..
2022-08-27 18:57:56 +02:00
Kawe Mazidjatari
4056fd7143 Even more warnings 2022-08-14 18:40:06 +02:00
Kawe Mazidjatari
bf3b7bdace Server browser cleanup
* Moved server utility to dedicated class shared by browser panel and UI script VM.
* Additional code improvements and optimizations.
2022-08-14 15:43:49 +02:00
Kawe Mazidjatari
eca293e551 Flip order between GetServerMap and GetServerPlaylist 2022-07-01 23:37:27 +02:00
Kawe Mazidjatari
6b48d42609 Adapt new master server features to SQVM
* Adapted current/max players to SQVM.
* Improved exception handling in SQVM.
2022-07-01 23:33:47 +02:00
Kawe Mazidjatari
cdcc87b54b Renamed master server related stuff 2022-07-01 10:29:27 +02:00
Kawe Mazidjatari
d417b60e69 Near finished master server improvements
* Added working players/maxplayers fields for master server.
* Fixed popstylevar assert in CBrowser (SetStyleVar and the corresponding PopStyleVar where not within the same scope).
2022-07-01 02:20:47 +02:00
Kawe Mazidjatari
a20d6a163e Work-in-progress pylon master server implementation
Still in development.
Implemented new fields provided by pylon-ms.
2022-06-28 00:47:01 +02:00
Kawe Mazidjatari
1d7b32b789 Preparation work for pylon master server implementation 2022-06-27 16:54:40 +02:00
Kawe Mazidjatari
86c1322aa0 Update sqinit.cpp 2022-05-29 02:08:07 +02:00
Kawe Mazidjatari
5adaf48d33 Add 'ShutdownHostGame()' to all VM's
Calling this before connecting to a different (remote or local) server avoids crashing in the VM's during shutdown.
2022-05-28 17:27:52 +02:00
Kawe Mazidjatari
de2e91220d Cast to wider type 2022-05-27 16:28:03 +02:00
Kawe Mazidjatari
28ff12272f Cleanup 2022-05-27 14:39:43 +02:00
Kawe Mazidjatari
58d46c0a8c Rename class 'IBrowser' to 'CBrowser'
Renamed 'g_pIBrowser' to 'g_pBrowser' as well
2022-05-27 02:44:36 +02:00
Kawe Mazidjatari
47d2e4c915 See description
* Added new function 'GetAvailablePlaylists' to all VM's.
* Moved function 'GetAvailableMaps' from UI VM to all VM's.
* Improved logic behind 'GetAvailableMaps'.
* Server browser and SQVM now rely on 'MOD_GetAllInstalledMaps'. This new function populates the global vector 'g_vAllMaps' with all installed maps.
* Improved 'KeyValues' structure to use union for shared members.
2022-05-27 02:08:51 +02:00
Kawe Mazidjatari
4b72afb74f Light refactor for logging
Moved logging functions to dbg.h (tier0) and export them from the dll.
Added additional functions for checking bad pointers (debug only!).
Reduced output code size.
2022-05-25 14:18:29 +02:00
Kawe Mazidjatari
52883808e1 Reversed CServer structure (almost complete). See desc
* Mostly rebuild CServer structure.
* Partially rebuild CNetworkStringTable structure.
* Partially rebuild CNetworkStringTableContainer structure.
* Removed redundant patterns which are now covered in the data structure.
2022-05-20 20:14:39 +02:00
Kawe Mazidjatari
efb7c36408 Light project restructure
Moved server/client headers and implementations into dedicated subfolder.
Renamed Some classes to match the game binary (e.g. CBaseClient is now CClient).
Removed redundant files.
2022-05-20 11:52:19 +02:00
Kawe Mazidjatari
93f634022a Get all available maps from VPK instead
Before we used the stbsp's, but we don't need to copy these for each maps (we could load existing ones to get working texture streaming for maps that don't have this)
2022-05-04 17:36:23 +02:00
Kawe Mazidjatari
b4485f1d23 Add extra SQVM features
Added 'GetNumHumanPlayers' and 'GetNumFakeClients' to SERVER vm
Changed hardcoded strings in UI 'GetPromoData' to localization keys

TODO: add localization files to SDK
2022-04-02 13:03:11 +02:00
Kawe Mazidjatari
79f99970c6 Implemented SERVER, CLIENT and UI script commands
User can now execute script on the SERVER, CLIENT and UI vm's through the SDK
2022-03-30 22:54:33 +02:00
Kawe Mazidjatari
ecb2bc54ad More SQ types and 'sq_compilebuffer()' AOB + prototype
Added signature and prototype for 'sq_compilebuffer()'.
Added 'SQBufState' structure to sqtypes.
Adapt entirely to SQ types for all sqapi functions.
2022-03-30 00:06:52 +02:00
Kawe Mazidjatari
28b1718cb1 Add Squirrel typedefs 2022-03-29 22:27:56 +02:00
Kawe Mazidjatari
446f13680f Improve SQVM function registration and add SERVER and CLIENT logic
SERVER and CLIENT functions can now be registered as well.
For checking whether to register for CLIENT or UI, we now check its context instead of comparing pointers. For server, a dedicated function was build.
2022-03-28 19:34:51 +02:00
Kawe Mazidjatari
73cdaf18e3 Slight cleanup 2022-03-28 12:02:11 +02:00
Kawe Mazidjatari
a49a5bb781 AIN build and saving now fully works
AI is pretty much completed.
All that has to be done currently is making a simplified mesh of a map to cast a NavMesh on.
2022-03-21 13:48:34 +01:00
Amos
c187bed4c5 RCON implementation (see description)
* Fully rewritten protocol agnostic CNetAdr class
* Fully rebuilded legacy CNetAdr class
* Fully rebuilded dual-stack CSocketCreator class
* New project "netconsole" added (lightweight netconsole for RCON)

RCON is still work in progress
2022-02-06 16:48:52 +01:00
Amos
fc4a426ca2 Fix missing std::string casts 2022-01-16 12:40:25 +01:00
Amos
f909635526 Separate SQVM function namespaces per VM type
* Separate based on VM type instead.
* Allow compilation for DEDICATED.
2022-01-16 00:35:39 +01:00
Amos
d5b2e58dae Code base refactor + major performance and readability improvement. Read description for details.
* Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable.
* Document most functions with valve style 'Purpose' blocks.
* Rename variables to match the rest of the codebase and Valve's naming convention.
* Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK.

* Obtain globals or pointers directly instead of waiting for runtime initialized data.
* Dynamically search for all functions and globals (this doesn't count for dedicated yet!).
* Initialize most in-SDK variables.

* Move certain prints and other utilities under ConVars to reduce verbosity and increase performance.
* Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future.
* Type global var pointers appropriately if class or type is known and implemented.
* Forward declare 'CClient' class to avoid having 2 'g_pClient' copies.
* Add IDA's pseudo definitions for easier prototyping with decompiled assembly code.

* RPAK decompress Command callback implementation.
* Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\').

* VPK decompress Command callback implementation.
* Move CRC32 ands Adler32 to implementation files.

* Server will print out more details about the connecting client.

* Upgrade ImGui lib to v1.86.
* Don't compile id3dx.h for dedicated.
* Don't compile id3dx.cpp for dedicated
* Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console

* Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors.
* Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up.
* Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
2021-12-25 22:36:38 +01:00