3683 Commits

Author SHA1 Message Date
Kawe Mazidjatari
569ee78df7 Launcher: parse maps and playlists on surface setup
This allows you to scroll through the combo list with the scroll wheel without uncollapsing it.
2024-06-01 11:52:52 +02:00
Kawe Mazidjatari
bbd80e4416 Common: unmark "set" command from FCVAR_DEVELOPMENTONLY from dedicated
"set" is already marked as FCVAR_CHEATS, and typically used when sv_cheats 1; remove FCVAR_DEVELOPMENTONLY from dedi builds as well.
2024-06-01 11:52:52 +02:00
Kawe Mazidjatari
bdc4112c55 Game: remove game dll flag from "script" cmd
Prevent remote execution, should be done through RCON instead for security.
2024-06-01 11:52:52 +02:00
Kawe Mazidjatari
900df8bc6f Resource: update vpk build list and remove old build scripts
2 new maps added, which will be includes in the next release. The dedi could still be used to build the vpk's, but ReVPK is prefered. Removed old build scripts.
2024-06-01 11:51:32 +02:00
Kawe Mazidjatari
a07069f8f8 Miles: refer to 'MILES_DEFAULT_LANGUAGE' instead of 'english'
Enforce 'MILES_DEFAULT_LANGUAGE' as the default rather than "english", even though "english" will always be the default. Also marked cvar 'miles_debug' as FCVAR_DEVELOPMENTONLY.
2024-06-01 11:49:16 +02:00
Kawe Mazidjatari
126591cb1f Miles: put event queue warnings behind a cvar
These warnings can get verbose, especially if events from the map itself are missing. Put behind a cvar and enabled it by default in development configurations.
2024-06-01 11:49:16 +02:00
Kawe Mazidjatari
bdc7929286 Launcher: several fixes and improvements
- Reload map list each time the combo box is opened (needs to refresh if user installed a new map while launcher is still open).
- Reload playlists each time the combo box is opened (makes sure that the list is up-to-date if user modified it in any way).
- Use global VPK dir regex to parse out map names.
2024-06-01 11:49:16 +02:00
Kawe Mazidjatari
84abfced6a VpkLib: make regex available to other code and utilize those instead
Prevent copies or similar patterns that might not work as good.
2024-06-01 11:49:16 +02:00
Kawe Mazidjatari
da09d8b631 CppKore: add callback for drop down opened event 2024-06-01 11:49:16 +02:00
Kawe Mazidjatari
299ab763e4 VpkLib: light cleanup
Improve global names, initialize VPKDirHeader_t structure, make inlines for checking if language or target exists.
2024-06-01 11:49:15 +02:00
Kawe Mazidjatari
aa6a5dcb6e NetCon: rename to 'netcon'; remove platform suffix
Netcon is no longer 32bits. Previously it was made 32bits to maximize system compatibility, but this was unfortunately too hard to maintain after the migration to CMake, it was also no longer worth it as the tool never got used on 32bit platforms. Renamed to avoid confusion.
2024-06-01 11:49:15 +02:00
Kawe Mazidjatari
fa04053de7 Resource: use default protoc instead of custom one
No need to use the custom one.
2024-06-01 11:49:15 +02:00
Kawe Mazidjatari
9792ce6951 Launcher: initialize all member vars
Suppress IntelliSense warnings.
2024-06-01 11:49:15 +02:00
Kawe Mazidjatari
8cfcc00bc5 PluginSystem: add callback for chatroom receiver
Allow plugins to block chat msg's based on their text.
2024-06-01 11:49:15 +02:00
Kawe Mazidjatari
699469f7b6 Server: add getter for net name in CBaseCombatCharacter 2024-06-01 11:49:15 +02:00
Kawe Mazidjatari
06a71903f5 Server: add getter for Nucleus ID in CPlayer 2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
c4a2d61905 Launcher: fix use after free (ASAN)
The launcher would regularly throw the PSA (Program Compatibility Assistance) notification upon exit. Running the program with address sanitizer revealed 'CSurface::GetControlValue()' returned a pointer to a temporary buffer, this is destroyed as 'Forms::Control::Text()' returns class String by value. 'CSurface::GetControlValue()' is no longer necessary since we moved to the official KeyValues class, so this function has been removed all together and the issue has therefore been fixed.
2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
101962f5ce Engine: simplify "script" command callback for server
Code actually doesn't need to be ran in the server frame thread. All the code really does is preparation work. Run it in the main thread but do join the server frame thread (FCVAR_SERVER_FRAME_THREAD) as we can't do concurrent work on the server VM.
2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
1b6d37725b Engine: don't broadcast voice data on training dedi
Training dedi doesn't support broadcasting voice data, return out.
2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
9db094b98d Engine: add command line statics for dedicated server and light cleanup
CGameServer::SpawnServer() pointer to engine/server/server.h, and renamed it to CServer::SpawnServer().
2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
3883597cb2 RTech: fix bitwise order in define
Put in parentheses.
2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
6b7e0d574d VScript: fix method order
More logical order of newly added methods.
2024-06-01 11:49:14 +02:00
Kawe Mazidjatari
b622854d85 Squirrel: fix struct name
bufCopy is actually bufPos as this indicated the current pos in the text buffer as it gets parsed out.
2024-06-01 11:49:13 +02:00
Kawe Mazidjatari
d4f9ac279c VScript: move script run code to dedicated method 2024-06-01 11:49:13 +02:00
Kawe Mazidjatari
0cea07ab8f VScript: properly implement script command callback
Previously we did sq_pushroottable() and a subsequent sq_call() after compiling the text buffer, but this didn't work for code that was threaded, or using Get/SetNetVar* functions.

The second issue was that the callback for the "script" command was ran in the main thread. Server script should always run in the server frame thread, the Set/GetNetVar* functions check thread id to retrieve the correct VM context, so running server script from the main thread ended up with Set/GetNetVar* functions retrieving the client VM context rather than server's, causing undefined behavior.

Script commands are now queued to the server frame thread, ultimately fixing this bug.

Also fixed a small bug with function 'sq_compilebuffer()'; it takes an extra argument but this wasn't taken into account in the SDK.
2024-06-01 11:49:13 +02:00
Kawe Mazidjatari
72709eeb5e VScript: add CSquirrelVM::ExecuteFunction()
Executes script code by function handle.
2024-06-01 11:49:13 +02:00
Kawe Mazidjatari
fb9ba0e454 Squirrel: add multiple SQ API functions
Added:
- sq_getstackobj
- sq_pop
- sq_addref
- sq_release
- SQVM::Pop
- RefTable::Get
- RefTable::AddRef
- RefTable::Release
2024-06-01 11:47:45 +02:00
Kawe Mazidjatari
639f4741b1 VScript: add ScriptStatus_t enum
Enum values are correct based on 'CSquirrelVM::ExecuteFunction()'.
2024-06-01 11:46:05 +02:00
Kawe Mazidjatari
33f926da74 Launcher: fix compiler error
Prototype changed in commit c261db243e7de0a57445ed9bb036238a7171e572.
2024-06-01 11:46:05 +02:00
Kawe Mazidjatari
cfc2deada4 Resource: add LiveAPI documentation 2024-06-01 11:45:25 +02:00
Kawe Mazidjatari
a54fec9e18 ImGui: increase base64 key buf size
Make buffer size as large as that of the engine itself (used to represent the string in class CNetKey).
2024-06-01 11:43:11 +02:00
Kawe Mazidjatari
8ac582ee82 ImGui: improve browser modal QOL
Hitting enter will now also submit the request.
2024-06-01 11:43:11 +02:00
Kawe Mazidjatari
535d2cdfba ImGui: fix server modal token input bug
The string buffer was moved to the stack on a recent refactor, but the data must persist even outside the function scope. Moved back to class in form of a buffer.
2024-06-01 11:43:11 +02:00
Kawe Mazidjatari
afb53b899c ImGui: update default server browser width
As of the recent layout changes, buttons and widgets looks the sharpest on this width; default to this width instead.
2024-06-01 11:43:11 +02:00
Kawe Mazidjatari
e7d3e8d23d NetConsole: log header/version as soon as possible
Logged right after console and terminal is initialized.
2024-06-01 11:43:11 +02:00
Kawe Mazidjatari
9a3ea6b53a Resource: add missing command line parameter client configs
Since the implementation of the loader system, client's need '-noserverdll' to work properly when launched from the SDK launcher.
2024-06-01 11:43:11 +02:00
Kawe Mazidjatari
861b4b6b2b Launcher: surface and launcher code overhaul
- SDK Launcher is now a proper GUI app (no longer defaults to terminal, but can of course still be used in the terminal).
- Set uniform font on all controls (GetStockObject sometimes returns fonts that isn't currently supported on the UI layout causing text to clip; we don't show in other languages or character encodings so we should just default to Microsoft Sans Serif).
- Make anchors uniform for all controls (resize not yet supported).
- Don't attempt to send commands to game instances if command string is null or empty.
- Clamp surface console list size to window size.
- Remove surface console logger boilerplate (surface logging is now a dedicated function).
- Use actual SDK logging system for console prints/warnings/errors.
- Fixed bug where the use of a shared stack buffer caused truncated parts of the file name to end up in the command line text.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
5d680c89d9 Windows: fix prototype mismatch
Mismatched since commit acaf3fdfad319cea142ba58ce9214aec14715ff0.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
dc8a22c05e Windows: move console color init code to separate function
Reserve Console_Init() for actual console init, if code only needs colors (e.g. a console application that already has a console), then they should call Console_ColorInit().
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
8e81d99585 CppKore: fix potential font resource leak
As of commit 168ad9aabd624510045d56aabcbfeff6f4aaad6f, we can assign uniform fonts to all child controls, but only 1 control can own the font resource. This is by default false since we do not want to free the resource when destroying the child controls, but we do want to free it once the parent window gets destroyed.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
d5db4674a4 CppKore: add getter for child control count 2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
4c99efa889 CppKore: try parent font if current is absent
This allows for setting uniform fonts on all controls, by only assigning the font once to the parent control. Else each control needs to have its own set.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
29ff073ae3 NetConsole: fix command line bug
Recently, encryption was implemented in the RCON system, but the command line initialization code wasn't adapted to this new logic. Code has now been adapted.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
d80268492a Tier1: fix typo in byteswap.h 2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
8ffb647686 Server: use correct type for hull data used for AI Network
System uses a CVarBitVec for this hull block data.
2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
9de5f4988f RTech: fixed streamed pak decoding progression bug
During beta tests on a Linux system, we encountered an issue where the I/O could be slower and thus result in not enough bytes being streamed by the time we invoke the decoder (lenStreamed == bufSizeNeeded at this point), after 16 calls with lenStreamed == bufSizeNeeded, the engine errors as ZSTD_NO_FORWARD_PROGRESS_MAX would be reached. Added value of 'ZSTD_nextSrcSizeToDecompress()' to 'PakDecoder_s::bufferSizeNeeded' to make sure we never call the decoder without any new streamed bytes. Also increased the value of ZSTD_NO_FORWARD_PROGRESS_MAX to 1024 since this fixed the issue without applying the aforementioned patch, this was increased as a hardening measure.
2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
59d4affebe Server: removed unreferenced local variable
Unused variable as current time calculation ended up being unnecessary, removed to suppress compiler warning.
2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
b201ca7a5b Engine: fix incorrect assignment on rcon socket bind
The assignment on the ternary operator should be flipped, bug was spotted during beta testing.
2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
88bb1307be Engine: move unrestricted command exec code to separate function 2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
cb72778a25 Core: allow launching dedicated server without terminal window
The terminal window isn't always necessary, especially on Linux systems. In fact, it causes issues on some Wine environments. Allow user to disable it with -noconsole. This option only exists on the dedicated server. The client builds have the console disabled by default, and can enable them with -wconsole.
2024-06-01 11:43:09 +02:00