101 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
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
9792ce6951 Launcher: initialize all member vars
Suppress IntelliSense warnings.
2024-06-01 11:49:15 +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
33f926da74 Launcher: fix compiler error
Prototype changed in commit c261db243e7de0a57445ed9bb036238a7171e572.
2024-06-01 11:46:05 +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
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
Kawe Mazidjatari
6a99c1bd5c Launcher: untoggle windowed mode by default and rename field
Untoggled by default due to popular demand (most wanted to launch full screen). Also renamed maxFPS field to fpsMax to remain consistency with the actual cvar name.
2024-06-01 11:43:08 +02:00
Kawe Mazidjatari
890ffa923e Launcher: light overhaul and use KeyValues class
Reworked some of the code to make globals static and used KeyValues class to parse VDF files instead.
2024-06-01 11:35:07 +02:00
Kawe Mazidjatari
eae0d0964b Tier0: iostream light cleanup
- Take const char* directly instead of making extraneous copies
- Add overload for reading strings into fixed size buffers
2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
ff98df556c Fix unresolved external symbols
These projects used 'V_FixSlashes' but weren't licked to Tier1.
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
ec825962b6 These files are now located in the bin dir 2024-04-05 16:34:28 +02:00
Kawe Mazidjatari
aa13725f15 Add table for affinity mask
Small usage table.
2024-04-05 15:57:33 +02:00
Kawe Mazidjatari
85f988dcd7 Launch center screen
Make the SDK launcher appear on the center of the client's screen.
2023-07-25 01:05:05 +02:00
Kawe Mazidjatari
ddfaea6ce2 Fix client.dll loading
* Moved dedicated server command line parameter init to 'init.cpp'.
* Registered 'SV_Main' on the client, this is engine code (lower level 'local' server wrappers).
* Disabled registration of Weapon_Bolt, although this is shared game code, this particular file is only used for the SERVER at this moment.
* Added the '-noserverdll' command lien parameter to instruct our loader.dll to load the client.dll instead.
* Adjusted the loader and sdklauncher project to support the loading of client.dll.
2023-07-19 16:00:36 +02:00
Kawe Mazidjatari
df5a8bdd68 SDK launcher defines cleanup
Some of its defines were located in the 'launcher' library directory, but it only contained defines for the SDK launcher, this has been moved to 'sdklauncher_const.h'. Also renamed the 'launcher_pch.h' PCH to 'sdklauncher_pch.h' to avoid confusion with 'launcher' and 'sdklauncher'.
2023-07-15 18:43:25 +02:00
Kawe Mazidjatari
c46d80872a Implement launcher settings check
Discard and overwrite the settings file if the file version has changed.
2023-07-15 17:50:54 +02:00
Kawe Mazidjatari
afb09e1d05 Cleanup CFG directory
Move to dedicated subdirectories.
2023-07-13 23:15:10 +02:00
Kawe Mazidjatari
f6236359aa Fix debugger working directory for SDK launcher
Working directory was incorrect.
2023-07-13 00:15:37 +02:00
Kawe Mazidjatari
dca89a32d3 SDK launcher bug fixes and improvements
- Added missing implementation for 'numworkerthreads' text box.
- Swapped 'single-core server' toggle with 'processor affinity' text box.
- Performed additional light code cleanup.

The single-core dedi cvar now only gets set when 1 bit is set in the affinity mask, as that implies single core usage.
2023-07-13 00:14:47 +02:00
Kawe Mazidjatari
8ea2eac0fc Move launcher/loader consts
Move to shared PCH as these are low level defines.
2023-07-02 02:46:58 +02:00
Kawe Mazidjatari
0207c69b36 Fix SDK launcher compatibility with SDK loader
Since the SDK loader (loader.dll) is taking care of loading the DLL with the process, the SDK launcher no longer needs to inject it. Replaced call 'DetourCreateProcessWithDllsA' with 'CreateProcessA', and performed additional cleanup
2023-07-01 23:27:29 +02:00
Kawe Mazidjatari
884decd090 Set default debugger parameters
The debugger can now be immediately invoked on all runtime projects after generating the solution without having to set anything up.
2023-06-24 15:46:56 +02:00
Kawe Mazidjatari
3f8baf6f68 Allow setting compile options for specific targets
Previously, it was all controlled from the global init (applied to all projects), but some projects need different options. With these changes, you can disable the common options applied in the 'add_module' macro, and set your own if desired.
2023-06-17 00:45:27 +02:00
Kawe Mazidjatari
11f20348ac Move GdiPlus header to launcher PCH
Only used by the SDK launcher for the dashboard.
2023-05-26 21:53:25 +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
5577d4fe87 Use dedicated PCH for sdklauncher
SDKLauncher now uses its own PCH.
2023-05-14 01:23:31 +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
de572f675c Fix launcher bug
No Queued Packets Thread has been renamed to Queued Packets Thread, and therefore its toggle should be inverted. Enabled by default.
2023-04-30 21:44:06 +02:00
Kawe Mazidjatari
0399d753f4 Properly toggle cvars in sdk launcher
Toggle them on or off instead of just on. Else disabling the toggle wouldn't disable then in the runtime as the default value of these cvars is '1'.
2023-04-25 00:47:44 +02:00
Kawe Mazidjatari
32d04645ca Put launcher playlists parsing code in try catch block
Avoid crash due to exceptions.
2023-04-03 18:38:20 +02:00
Kawe Mazidjatari
87831050e9 Fix SDK launcher compiler warning
Unused param.
2023-04-03 13:12:36 +02:00
Kawe Mazidjatari
fee5f7608e Fix SDK launcher bug
Add missing argument for string format specifier. Fixed additional compiler warnings by casting types/commenting unused.
2023-04-03 13:12:22 +02:00
Kawe Mazidjatari
5aea2f4261 RCON system upgrade
RCON upgrade with additional logging system improvements:
* Netconsole's can now log received messages in color, even when the RCON server has ANSI colors disabled; logs are fully composed locally.
* RCON server now also sends the log type over the wire, along with the (already existing) context.
* SDK logging code is now shared with the standalone netconsole application.
* Improved logging readability for the standalone netconsole application.
2023-03-27 02:01:48 +02:00
Kawe Mazidjatari
13d9ba3e13 Save SDK Launcher state in settings file
Store the state of the SDK launcher (toggled/text options) to a file on the disk to persist state.
2023-03-24 00:10:48 +01:00
Kawe Mazidjatari
b169a78542 Force consistency within code
* Use C-style format specifiers everywhere.
* Use std::string as much as possible.
* Reorder CSurface class structure by groups.
* Light optimizations in 'CSurface::ForwardCommandToGame'.
2023-03-22 00:28:41 +01:00
Kawe Mazidjatari
8177707413 SDK Launcher light refactor
* Fixed bug causing command line interface not to work properly.
* Optimized warning text and instructions.
* Terminal will not be freed when compiled in Debug/Profile.
* The console will now forward the command to all game window instances.
2023-03-21 00:14:54 +01:00
Kawe Mazidjatari
6a8085f024 Rename UI class to 'CSurface' 2023-03-20 11:16:29 +01:00
Kawe Mazidjatari
7b2a5d5d12 Initial major launcher code refactor
* Removed most boilerplate/duplicate code from launcher API.
* Make launcher API more friendly for external usage.
2023-03-20 10:26:43 +01:00
Kawe Mazidjatari
8a95c956d5 Make launcher UI code compatible with older compilers
Make it compatible with older versions of the Visual Studio 2017 compiler.
2023-03-20 00:01:49 +01:00
Kawe Mazidjatari
180d762089 Fix SDK launcher bugs
Fixed bugs preventing the SDK launcher from working when compiled using the Visual Studio 2017 compiler.
2023-03-19 11:20:04 +01:00
Kawe Mazidjatari
46ddaf9b01 Add ability to deselect a map in the SDK launcher 2023-02-12 20:30:35 +01:00
Kawe Mazidjatari
7928ac3b4c Fix SDK Launcher compiler error
Path has to be changed due to project include changes. The r5dev directory is no longer a system include, however, the compiler expects includes from system when compiling resources.
2023-02-06 23:53:32 +01:00
Kawe Mazidjatari
3af4ccebc3 Fix SDK launcher bug
Asan: used destroyed temporary to construct '-numreservedcores'.
Changed logic to only pass to engine when input is actually a number and its value is > -1.
2023-01-21 15:34:37 +01:00
Kawe Mazidjatari
aed8656d56 SDK Launcher: slight UX improvement
Make UI more symmetrical by aligning elements more precisely together.
2023-01-21 14:59:42 +01:00
Kawe Mazidjatari
54f08bd887 Work-in-progress user command executor
* Added some getters in 'CBaseEntity' and 'CServerNetworkProperty'.
* Implemented 'CPlayer::SetTimeBase'.
* WIP implementation of 'CPlayer::RunNullCommand'.
2023-01-19 15:25:45 +01:00
Kawe Mazidjatari
96fb0519d9 Update launcher help text 2023-01-16 17:59:49 +01:00
Kawe Mazidjatari
91d55bb670 Launcher improvements
* Enabled '-forceborder' as this has been fixed in the engine.
* Enabled 'UpdateSDK', we will attempt to create an updater using a batch file.
* Less boilerplate code (will be reduced even more in the future).
* Renamed 'No border' to 'Borderless'.
2022-12-07 01:07:26 +01:00