97 Commits

Author SHA1 Message Date
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
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
9f8ff78a8d Color logging improvements
Check local variable for overriding colors instead of relying on the global one set from 'sqstd_aux_printerror()'. This should make it render properly in the in-game console.
2022-05-20 02:14:54 +02:00
Kawe Mazidjatari
1fb89c35c8 Rename to more appropriate name 2022-05-20 01:16:30 +02:00
Kawe Mazidjatari
ad90ef6813 Rename to more appropriate name 2022-05-20 01:12:05 +02:00
Kawe Mazidjatari
8c76283ba1 Color log game logic errors 2022-05-20 01:07:42 +02:00
Amos
02744e2569 Fix alignment for SQVM struct 2022-05-19 10:56:27 +02:00
Kawe Mazidjatari
8816a28372 SQVM cleanup
The SDK could now obtain context index for builds before S3
2022-05-19 02:19:43 +02:00
Kawe Mazidjatari
ddfdb4ffd8 See description
Add '-nodiscord' and '-nobakedparticles' to launch params for dedicated.
Add hook for 'MemAlloc_Internal()'.
Rename loggers to be more consistent with naming.
Revert omitting frame pointers.
2022-05-17 23:00:30 +02:00
Kawe Mazidjatari
3144227ec8 Update GetAdr implementations to feature spdlog
Fixed all alignments and reduced code verbosity
2022-05-13 14:53:25 +02:00
Kawe Mazidjatari
452c8afcf3 Display '%' symbol properly in console 2022-05-10 23:32:44 +02:00
Kawe Mazidjatari
868d6ea14a Extraneous string array 2022-05-10 18:09:31 +02:00
Kawe Mazidjatari
46134434a9 Show script error callstacks and context in colors in the external console
Show colors on console and use color constant to determine color instead of comparing strings in the console render loop. removed 5 string compares which should once again bump the performance quite a bit. The last string compares will be removed soon
2022-05-09 21:21:05 +02:00
Kawe Mazidjatari
611ea6447a Console performance improvements and bug fixes
* Heavily reduced string compares for coloring logs (the left overs require a dedicated hook, this is for the future)
The new method uses a ImVec 4 constant containing the color obtained via a switch case by context, this is then out into the new CConLog structure where the loop in the console will now gather the colors directly from.
Error/Warning use a single constant.

* Fixed bugs in several log locations where the ostringstream was cleared before the emission causing double logs.

* Added global log mutex to log wrappers that lacked those.
2022-05-09 02:20:07 +02:00