233 Commits

Author SHA1 Message Date
Kawe Mazidjatari
54536a2652 Parameterize changelevel or map in CServerListManager::LaunchServer()
Parameterized; whether or not to drop all clients (map = drop, changelevel = keep).
2023-07-19 02:21:58 +02:00
Kawe Mazidjatari
398c0f1ddc ConVar flags tools refactor
Previously, we had 3 containers mapping ConVar flags for utilities, and none of them contained all flags. This refactor moved everything into a single container class where user can get strings by flags, or the other way around. The new class contains every flag. This also means that every flag can be used to list convars by flags using the command 'convar_findByFlags'. The 'ConVar_ParseFlagString' now also supports every flag. Code has been tested and confirmed to work as designed.
2023-07-03 13:48:13 +02:00
Kawe Mazidjatari
7691fa1b5f Light console optimizations 2023-06-17 16:30:10 +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
48c2401cf9 Fix rare crash on Dear ImGui shutdown
Fix a rare crash that occurs in AMD driver code, when ImGui shutdown was called. The crash did not occur if the library was shutdown after having rendered one of the ImGui panels for one frame. The fix is to just never call 'ImGui_ImplDX11_NewFrame()', 'ImGui_ImplWin32_NewFrame()' and 'ImGui::NewFrame()', 'ImGui::EndFrame()', 'ImGui::Render()' if none of the windows are visible. code has been tested on a system that would trigger the crash, and after the patch, the crash no longer happened.
2023-06-15 21:33:37 +02:00
Kawe Mazidjatari
04856caf05 Display and host using playlists instead of gamemode
This should show the actual playlist rather than the gamemode.
2023-05-29 21:13:28 +02:00
Kawe Mazidjatari
d5f3228ab0 Fix intermittent bug in server browser
On some compile runs, the 'LoadTextureBuffer' call is getting optimized out as 'ret' is only used for the assert statement, but on release, the assert statements does nothing and thus the compiler got rid of the call. This code should not be fired in this function, but rather in the initialization routine anyways. The code has been moved to 'CBrowser::Init', and the issue has been fixed.
2023-05-15 09:54:18 +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
d809a9f633 Use PCH generated from VPC globally
This reduced output code size with 40KiB, improved compile times and appeared to improve runtime performance as well.
2023-05-14 02:10:17 +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
75ccebb4b6 Squirrel system restructure
Properly decouple squirrel and game code. This makes it easier to reverse engineer more of this squirrel system, and to compile them as individual libraries later on when moving to CMake to significantly decrease compile times.
2023-05-06 16:23:56 +02:00
Kawe Mazidjatari
199c4caede Fix compiler warning
Cast to 'size_t' to suppress warnings.
2023-05-03 23:59:56 +02:00
Kawe Mazidjatari
d978d0c745 Reduce address buffer size to 128
128 is the max size that the entire address string could be (with it being ipv6 and bracketed with ports).
2023-04-30 02:10:57 +02:00
Kawe Mazidjatari
4554a92e27 Prevent connecting to null address string
Add check to prevent connect code getting fired if address buffer is empty.
2023-04-30 02:08:40 +02:00
Kawe Mazidjatari
8898b44dee Fix memory leak in ImGui panels
Properly release texture buffers.
2023-04-23 20:34:36 +02:00
Kawe Mazidjatari
8bf105b072 Smoother fade animation for ImGui panels
Fade out when disabled too, in steps of 0.5f. SDK fixed frame has been increased to 100tps.
2023-04-16 02:45:22 +02:00
Kawe Mazidjatari
096091e56f CConsole::LoadFlagIcons: Break out on failure 2023-04-16 00:41:48 +02:00
Kawe Mazidjatari
617b7b1948 Fix bug caused by compiler optimization
The 'private' server icon did not load in release builds due to the call to 'LoadTextureBuffer' getting optimized away by the use of the const qualifier. Removing the qualifier fixed the bug.
2023-04-16 00:40:44 +02:00
Kawe Mazidjatari
dbf3b5b91d Improve ImGui logger API
* Better structure packing (reduced padding).
* 'CTextLogger::GetFilter' now returns a reference to 'm_itFilter'.
* Added additional setters and getters.
2023-04-09 22:35:55 +02:00
Kawe Mazidjatari
a7cab1d891 Fix potential security flaws caused by uncontrolled format strings
Make sure format strings are string literals to avoid an uncontrolled format string situation.
2023-04-08 19:10:59 +02:00
Kawe Mazidjatari
dc6bdc4a3a Fix incorrect ctor order 2023-04-08 17:46:08 +02:00
Kawe Mazidjatari
16910aa45c Use custom string formatter
Enforce consistency through code base by using the same format specifiers.
2023-04-08 10:50:32 +02:00
Kawe Mazidjatari
a63d66b667 /W4: Fix unreferenced symbol bugs
Return value of 'g_pMasterServer->GetServerByToken' was never checked. Added check to improve the error messages that could be displayed.
2023-04-02 17:14:29 +02:00
Kawe Mazidjatari
ae431c6ac2 /W4: Fix unreferenced symbol warnings
Fix verbose unreferenced symbol warnings.
2023-04-02 17:02:04 +02:00
Kawe Mazidjatari
a4a2f34c10 /W4: Fix signed/unsigned mismatch
This commit fixes warnings and bugs caused by signed/unsigned mismatch.
2023-04-02 12:09:43 +02:00
Kawe Mazidjatari
4357c9dbf3 Fix many compiler warnings
Fix many compiler warnings indicating potentially unwanted implicit conversions/truncations.
2023-04-02 00:59:24 +02:00
Kawe Mazidjatari
a7158d0881 CConsole::AddLog optimizations
Use FormatV to format the string, and use the move constructor to move it into the conlog structure.
2023-04-01 21:42:34 +02:00
Kawe Mazidjatari
29616f4810 Rename 'g_vAllMaps' to 'g_InstalledMaps' 2023-03-31 00:35:01 +02:00
Kawe Mazidjatari
f9c5986245 Upgrade Dear ImGui to 1.89.4
Upgrade and light restructure of ImGui directory.
2023-03-29 00:19:19 +02:00
Kawe Mazidjatari
4e12402c76 Fix bug causing completion list to never update
Use actual 'partial' command input buffer instead of the explicit command name.
2023-03-17 19:24:54 +01:00
Kawe Mazidjatari
fd1a5d76cf Utilize the internal autocomplete suggest system
Utilize 'ConCommand::AutoCompleteSuggest' instead of our temporary inline console solution. This fixes all crashes caused by calling command autocomplete callbacks that uses the newer system (e.g. 'ent_fire').
2023-03-17 00:17:35 +01:00
Kawe Mazidjatari
612ab83b20 Use 'GetNumClients' for hosting and status bar
Use 'GetNumClients' instead of iterating over the client array twice. Also fixed a bug causing the status bar only to display real clients, buts were never counted.
2023-02-12 15:21:33 +01:00
Kawe Mazidjatari
3139948141 Rename mutex guard lock
Already one named 'l' in this scope. It will work just fine, but having a different name is better.
2023-02-12 11:24:34 +01:00
Kawe Mazidjatari
26f52eea28 Server browser hosting logic improvements
* Added missing mutex lock in 'CBrowser::UpdateHostingStatus' when host status is 'NOT_HOSTING'.
* Use server's remote checksum to test whether or not the checksum is valid, as this is the one that will be used for hosting.
* Construct 'NetGameServer_t' from the main thread instead, and dispatch back into separate thread for remote query.
2023-02-12 11:22:18 +01:00
Kawe Mazidjatari
e98a6c31e9 Improve netkey logic
Removed extraneous copy of the base64 netkey. The base64 key is now directly obtained from the netkey singleton.
2023-02-12 02:28:03 +01:00
Kawe Mazidjatari
99b057438f More fixes for console
* Fix 'ClearAutoComplete' getting called recursively for some single operations.
* Fix unnecessary mutex lock.
2023-02-06 21:43:43 +01:00
Kawe Mazidjatari
308a700e25 Fix console bug
Fix bug causing autocomplete to not work correctly when command is picked from the suggestion list.
2023-02-06 02:12:53 +01:00
Kawe Mazidjatari
9e9614f908 Only reclaim focus where necessary
Only reclaim it when its actually needed to be reclaimed, else other UI components will not work properly.
2023-02-06 00:04:08 +01:00
Kawe Mazidjatari
d93e5f9d97 Fix a few console bugs
* Fix console always reclaiming focus when input field is empty.
* Always clear auto complete vector once item has been selected.
2023-02-05 22:50:11 +01:00
Kawe Mazidjatari
116d2acae8 Don't update every frame
Don't update completion callback every frame, only when the input has changed.
2023-02-05 21:10:39 +01:00
Kawe Mazidjatari
a8ef2b74cd Implement ConCommand completion logic
Implementation of the ConCommand completion logic for the Dear ImGui console panel.
2023-02-05 19:21:39 +01:00
Kawe Mazidjatari
4116edfe4c Server browser UX improvement
Auto focus token input field when private server modal is invoked or a token is submitted without success.
2023-02-04 20:04:23 +01:00
Kawe Mazidjatari
b160f39379 Improve server browser styling
Set minimum window size based on theme, so that if there are more servers than displayable, the last listing wouldn't clip under the panel frame.
2023-02-04 01:03:18 +01:00
Kawe Mazidjatari
0227f1bca3 Adjust the width too 2023-01-30 01:59:25 +01:00
Kawe Mazidjatari
3eae093dc6 Console theme improvements
* Adjust window min size based on theme to always make the log lines line up when the window height is set to its min.
* Pad logger border with 1 for all themes.
2023-01-30 01:52:32 +01:00
Kawe Mazidjatari
a872c9ac7a Server browser theme improvements
* Pad server list tables properly.
* Pad and size private server modal properly for each theme.
* Light code cleanup.
2023-01-30 01:18:51 +01:00
Kawe Mazidjatari
9164856b95 Fix browser display defect
Fix defect causing frames to not animate properly when browser menu is invoked.
2023-01-29 19:30:37 +01:00
Kawe Mazidjatari
682f29e69a Console UX improvements 2023-01-28 14:21:18 +01:00
Kawe Mazidjatari
96e482f814 Server browser UX improvements 2023-01-28 14:20:57 +01:00