111 Commits

Author SHA1 Message Date
Kawe Mazidjatari
27f9d6b110 SQVM logging improvements
* Allow setting logging level in retail mode.
* Also color log on error to the in-game console overlays when log level < 2.
2022-08-14 15:20:28 +02:00
Kawe Mazidjatari
e92b5d1300 General cleanup
Use c++ methods, remove unnecessary casts, unnecessary use of auto, etc..
2022-08-09 15:19:12 +02:00
Kawe Mazidjatari
8c6ee8a834 Remove 'm' prefix from dll globals
Large commit.
2022-08-09 03:02:00 +02:00
Kawe Mazidjatari
9d06a02614 General cleanup
* Use Cbuf functions for executing commands in ImGui panels.
* Use const qualifiers for all vftable indexes.
2022-08-09 02:35:00 +02:00
Kawe Mazidjatari
be01006ca0 Light cleanup of SQVM_PrintFunc 2022-08-08 18:17:40 +02:00
Kawe Mazidjatari
8fde529e2b Print script errors to the console at all times
This change prints script errors and their callstack to the console even when sq_showvmoutput < 2 (this avoids confusion when running a dedicated server and the server 'appears' to shutdown the game on its own. You could also check the script log files which are written to at all times, but having some indication is nice).
2022-08-08 17:49:46 +02:00
Kawe Mazidjatari
3f8476db88 Logging system light refactor
* Use responceid from server to determine in which context to log.
* Moved all script loggers from combined enums to minus instead (SERVER = -3, CLIENT = -2, UI = -1 SERVER_CODE = 0, etc), this makes it much easier to align stuff in combined systems such as the RUI logger or NetMsg().
* Color log networked RCON messages properly on the client.
* Added dedicated logger for all received RCON messages (net_console.log).
* Log commands submitted through in-game console (allows for easier debugging when going through log files).
2022-08-03 18:34:44 +02:00
Kawe Mazidjatari
9775fc4bba RCON system overhaul
* Implemented robust length-prefix framing logic for non-blocking sockets (previously used character sequences to determine length, but you cannot use character sequences on protocol buffers as its binary data. This logic should fix all problems regarding some commands not getting networked properly to the server and stuff not getting printed on the client).
* Increased buffer size to std::vector::max_size when netconsole is authenticated (MAX_NETCONSOLE_INPUT_LEN still remains enforced on accepted but not authenticated connections to prevent attackers from crashing the server).
* Process max 1024 bytes each recv buffer iteration.
* Additional optimizations and cleanup.
2022-08-02 23:58:43 +02:00
Kawe Mazidjatari
19d264ec11 Implement RCON_PasswordChanged_f and ConVar improvements
* Changing RCON passwords on the server now closes all connections and re-initializes the system.
* Fully mapped out VFTable interface for IConVar* (used for ConVar callbacks, see callback.cpp).
2022-07-25 19:35:08 +02:00
Kawe Mazidjatari
b075977dd7 Add new member to SQVM struct
'_nnativecalls' used in 'SQVM::CallNative()' [r5apex.exe+10A05F0].
2022-07-03 15:57:58 +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
e17d72571d Merge branch 'indev' into pylon_new 2022-06-30 20:19:13 +02:00
Amos
1186533652 Use Squirrel type alias 2022-06-30 11:30:11 +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
2e4c3f5fde Remove comment
Forgotten.
2022-06-27 16:57:11 +02:00
Kawe Mazidjatari
2a5cbf9b22 Switch to uint32_t for script checksums
Crc32 is unsigned int (32-bit).
2022-06-27 16:56:20 +02:00
Kawe Mazidjatari
1d7b32b789 Preparation work for pylon master server implementation 2022-06-27 16:54:40 +02:00
Kawe Mazidjatari
98c43fd6c1 Rename CConLog to ConLog_t 2022-06-26 17:40:02 +02:00
Kawe Mazidjatari
426ae0c4cd Bad logic logging improvements
Log bad logic in colors for every game logic error.
Added 'g_flErrorTimeStamp' and a hook to 'SQVM_LogicError'.
2022-06-22 12:12:08 +02:00
Kawe Mazidjatari
98741a9591 Remove redundant 'PrintPercentageEscape' calls 2022-06-21 10:12:15 +02:00
Kawe Mazidjatari
0de09217bc Log process uptime
Log actual process uptime in all (post init) loggers.
The actual process uptime is obtained from the engine (Plat_FloatTime()).
2022-06-20 15:48:33 +02:00
Kawe Mazidjatari
1764f039cf CConsole improvements: Add selectable logger text
CConsole now uses a dedicated class for logging text (modified CTextEditor class (CTextLogger)). The class uses an ImDraw list with a character vector to draw the text.

Text could be selected by double click (word), triple click (line), a selection by dragging the cursor, or everything with 'ctrl + a'.
2022-06-20 10:31:09 +02:00
Kawe Mazidjatari
f98a575dfa Fix S1 compiler errors 2022-06-18 21:24:02 +02:00
Kawe Mazidjatari
963ec33e9f Format function parameters the same as the game 2022-06-18 17:53:59 +02:00
Kawe Mazidjatari
9fd39d4e21 CModule class optimizations
Module segments are now part of the class to eliminate unnecessary re-inits and copies.
2022-06-13 23:34:06 +02:00
Kawe Mazidjatari
162e709190 General cleanup and improvements 2022-06-12 17:41:26 +02:00
Amos
3683a9d108 Optimizations
Remove extraneous 'c_str()' calls
2022-06-09 11:38:31 +02:00
Kawe Mazidjatari
f1f0ca35f8 Merge branch 'master' into indev 2022-06-02 02:02:36 +02:00
rexx
5e58b7a5d3 fix access violation on script command
running "script_client" from main menu would cause an access violation when attempting to access m_hVM from the CSquirrelVM instance for the client vm, which has not been created by this point
2022-06-01 19:57:39 +01:00
Kawe Mazidjatari
148a6f424c Update sqscript.cpp 2022-05-30 01:45:06 +02:00
Kawe Mazidjatari
86c1322aa0 Update sqinit.cpp 2022-05-29 02:08:07 +02:00
Kawe Mazidjatari
377b5dc262 Fix dereference crash if pointer exceeds int32 size
The crash only happened when the game executable had the ASLR flag set, because only then the pointer value overflowed the int32 type due to my bad cast
2022-05-29 00:39:13 +02:00
Kawe Mazidjatari
9aa665b374 Remove extraneous deref
Caused crash when calling sq_getstring/sq_getinteger.
Forgot to remove this after derefing it from the VM pointer.
2022-05-29 00:02:03 +02:00
Kawe Mazidjatari
61c7dbf5c1 Fix memory leaks 2022-05-28 23:05:10 +02:00
Kawe Mazidjatari
f2cc3ea379 Set the native name field for squirrel functions 2022-05-28 22:28:18 +02:00
Kawe Mazidjatari
e735683940 SquirrelVM refactor
The game uses 2 types, CSquirrelVM (mostly exposed to the VScript API of the engine) and HSQUIRRELVM (mostly used for internal squirrel functions like sq_pushbool etc..).

This refactor properly splits the CSquirrelVM* functions from the HSQUIRRELVM (SQVM*) ones. The functions have also been renamed accordingly and the prototypes have been adjusted to use the correct pointer type.
2022-05-28 22:02:00 +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
7db3e16a97 Align and use SQVM struct for builds below S3 2022-05-27 14:39:29 +02:00
Kawe Mazidjatari
e6ef3d71f1 Rename variable 'g_pIConsole' to 'g_pConsole' 2022-05-27 02:46:13 +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
8bf6c196cd Improved SQVM structure
* Added more fields to the existing structure.
* Removed redundant C string casts.
Note: The global context objects appear to be a different class containing a pointer (0x8 in) to the VM objects.
2022-05-21 18:15:48 +02:00
Amos
d46db531a0 Use of v->GetContext() 2022-05-21 11:15:36 +02:00
rexx
e5880fe590 rename SQFuncRegistration to ScriptFunctionBinding_t 2022-05-20 20:33:37 +01:00