233 Commits

Author SHA1 Message Date
Kawe Mazidjatari
1b3223d5cb Sync 'sv_globalBanlist' with global banned list toggle 2023-01-28 13:05:02 +01:00
Kawe Mazidjatari
61684ddf87 Create cvar for global banned list queries
This was planned to be changed a long time ago. This change allows dedicated server users to disable the logic as well.
2023-01-26 21:20:11 +01:00
Kawe Mazidjatari
34fddd52a8 Add cvar/command flag tooltip
Show a more detailed description of all flags set on cvar/command when user hovers its mouse over the flags texture.
2022-12-29 13:30:33 +01:00
Kawe Mazidjatari
604e4a6705 Fix console bug stripping all spaces from paste
Fixed a bug that gets triggered when pasting some text in the input field that containing space characters. All spaces will be lost during the paste.
Issue has been fixed by removing an extraneous check for space characters, the initial space character input already gets blocked in case 'ImGuiInputTextFlags_CallbackEdit'.
2022-12-21 23:46:27 +01:00
Kawe Mazidjatari
81154df155 Improve Server Browser host panel
* Immediately display the "Stop Server" and "Change Level" buttons when hoststate indicated there is an active game, since stopping the server or switching levels is still valid when the server is not simulating.
* Only display the AINetwork/NavMesh rebuild/reload and Settings Reparse buttons when the server is simulating.
2022-11-26 17:04:12 +01:00
Kawe Mazidjatari
6eb31ad881 Only activate server command panel when server is simulating
Only activate the command panel in the host section of the Server Browser when the server is actually simulating. Else we can crash the server by submitting commands when its in an uninitialized state.
Client AI Settings reparse is also only executed when the client is simulating from now on.
2022-11-23 12:30:15 +01:00
Kawe Mazidjatari
9533afc628 Add new 'shortcut' buttons to host panel
* Added "Rebuild AI Network" (rebuilds the AIN file).
* Added "NavMesh Hot Swap" (hot reloads the navmesh files).
* Added "AI Settings Reparse" (reparses ai settings on the server and client).
2022-11-14 01:04:01 +01:00
Kawe Mazidjatari
11fa1c5119 Add case insensitive search for developer console input field
This has been requested by a user. This change will allow for searching convars from partial input regardless of the case.
2022-11-13 23:44:30 +01:00
Kawe Mazidjatari
cf1adef1a2 Add FCVAR_RELEASE unknown and extended flag textures
If FCVAR_RELEASE but not restricted by context, then display this texture in the console suggestion window.
2022-11-11 20:12:20 +01:00
Kawe Mazidjatari
525999be40 Trim value from ConVar among with the delimiter
Trim anything past the space/semicolon character as well, this is required for CCvar::FindVar(...).
2022-11-11 01:19:49 +01:00
Kawe Mazidjatari
b81566604f Fix edge case where user could still enter tilde/space characters as first characters in console
This could be done by entering a character in the console (setting m_nInputTextLen > 0), then selecting and replacing valid 'first' character out for a tilde/space. This fixes the issue.
2022-11-10 22:03:27 +01:00
Kawe Mazidjatari
5dd5f2ad11 Fix issue caused by iData->BufTextLen always being NULL in ImGuiInputTextFlags_CallbackCharFilter
iData->BufTextLen is always 0 in the ImGuiInputTextFlags_CallbackCharFilter event. ImGuiInputTextFlags_CallbackAlways is called before ImGuiInputTextFlags_CallbackCharFilter in the same frame, so we can obtain the lenght from there and perform the test to discard unwanted characters from the input field.
2022-11-10 22:01:34 +01:00
Kawe Mazidjatari
5564c4f29b CConsole: more robust input character filtering
Filter the back quote, tilde and space character properly.
2022-11-10 21:19:17 +01:00
Kawe Mazidjatari
a8fd5a24f5 Add flag textures and logic for 3 or more flags
Only check if FCVAR_DEVELOPMENTONLY or FCVAR_CHEAT is set and return a blue/red colored checkered texture. Return a rainbow checkered if 3 or more flags are encountered which are not indexed. Return half texture if 2 flags are encountered, but the second bit is not indexed.
2022-11-10 01:17:53 +01:00
Kawe Mazidjatari
3b5428051c CConsole cleanup and optimizations
* Add const qualifier to method 'GetHistory'.
* Acquire mutex lock at the start of new method 'RemoveLog'.
2022-10-24 00:50:07 +02:00
Kawe Mazidjatari
b97176a04b CBrowser: light cleanup 2022-10-21 21:28:51 +02:00
Kawe Mazidjatari
4509bc385b CConsole::SuggestPanel inprovements
* Cache m_vSuggest.size().
* Use const reference to m_vSuggest[i].
2022-10-20 15:22:20 +02:00
Kawe Mazidjatari
f6e0fd8d92 Remove extraneous string copy constructor 2022-10-20 15:07:40 +02:00
Kawe Mazidjatari
f887ac509e Use StringRTrim to trim convar string before building console summary 2022-10-20 14:57:45 +02:00
Kawe Mazidjatari
49658c498f Fix private server modal size not being set correctly
ImGui::PopStyleVar() had to be called before ISurface::DrawSurface().
2022-10-20 14:37:21 +02:00
Kawe Mazidjatari
c7d828610d Fix server browser not claiming focus on window apparition
The console draws focus as it does SetKeyboardFocusHere(-1) (on the previous widget, which is the input text field). We don't do this in the server browser, so we must explicitly claim focus by calling SetNextWindowFocus() once before the next frame gets renderer.
2022-10-20 14:23:24 +02:00
Kawe Mazidjatari
5f84803ac6 ImGui and DirectX code improvements
* Fix history duplication by removing trailing white space characters from submitted commands in console.
* Fix out of range exception caused by caching svConVar.size() in CConsole::BuildSummary while we are modifying it.
* Fixed memory leak  caused by extraneous Strdup calls in CConsole.
* Renamed variables and structure members, static vars in id3dx.cpp are not prefixed with s_, IBrowser_Config is now m_BrowserConfig.
* Performed code cleanup in id3dx.cpp.
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
31845425d6 Only enable/disable input system on open/close events
Previously we enabled/disabled the input system each frame, depending on the state of the ImGui windows. This commit changes the behavior into only enabling/disabling when the menu's are closed (either through the keyboard or the close button).

I added a simple callback to ImGui::Begin which will be called when the close button on the ImGui panel is pressed and the callback pointer isn't nullptr, this was required as there was otherwise no way to determine when the close button was clicked.
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
44f2f87460 CConsole: heavy cleanup
* Move all default assignments to constructor.
* Rename cvar 'con_max_size_logvector' to 'con_max_lines'.
* Rename cvar 'con_max_size_history' to 'con_max_history'.
* Use array indexes instead of hardcoding context prefixes.
* Added netcon context prefix to help legend.
* Added public method to obtain history as string vector.
* Added public method to clear history.
* Internal CConsole::AddLog no longer locks the mutex.
* CConsole::LoadFlagIcons accesses resource vector by reference.
* Implemented "HELP", "HISTORY" and "CLEAR" as real console commands: "con_help", "con_history", "con_clearlines".
* Added a new command "con_clearhistory" (clears the dev console submission history).
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
d113774a6d Console improvements and new command
* Commented "ImGui::SetItemDefaultFocus()", this seems to somewhat fix the issue where the input field does not claim focus on console invocation.
* Added command "con_removeline" (removes lines from start to end index).
2022-10-20 12:29:49 +02:00
Kawe Mazidjatari
dac63ee5ef Add FCVAR_REPLICATED console flag icon 2022-10-11 01:22:21 +02:00
Kawe Mazidjatari
10f728081c CConsole::FindFromPartial light cleanup
Improve readability by moving logic out of conditional scopes.
2022-10-07 22:31:16 +02:00
Kawe Mazidjatari
84b4772006 Refresh server list when the browser is activated 2022-09-14 02:39:55 +02:00
Kawe Mazidjatari
577a8760cd CConsole: add more color coded flags
* Added more color coded flags to the console autocomplete window.
* Removed 'hidden' as FCVAR_HIDDEN is now enforced on the autocomplete window.
* force real-time CommandBase flags (previously compile-time).
2022-09-12 01:49:51 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
8c1d22f560 Console bug fixes
* Fixed bug where in several occasions 'm_bSuggestActive' would be true while we have nothing to suggest.
* Fixed bug where using the submit button in the console would not invoke the logic behind 'm_bModifyInput' in the text edit callback, but instead, being cleared within the scope of the submit button.
* Properly erase the ConVar past the ' ' or ';' character instead of null terminating it.
2022-09-07 01:55:52 +02:00
Kawe Mazidjatari
708e6992e4 Server browser UX improvements
* Removed extraneous text line for hosting, combined error and hosting into 1.
* Removed extraneous 'Force Start' button. The server will now 'Force Start' when the visibility is offline, else require the user to fill out the required fields in order to host the server.
* Only clear the request message when the color is green and we are no longer hosting. All errors will remain until the server is restarted through the browser panel.
2022-09-07 01:12:22 +02:00
Kawe Mazidjatari
2887e79bcb CBroswer: fix 'Stop Server' button not appearing when server script error occurs while client is attempting to connect 2022-09-05 22:32:47 +02:00
Kawe Mazidjatari
28ddf2a380 CConsole: fix bug where history scrolling did not work even when input was empty
* Reset when buffer is empty.
* Show suggestions when only 1 character has been entered.
2022-09-05 01:33:40 +02:00
Kawe Mazidjatari
900cc4dd9a CConsole: remove 'ImGuiInputTextFlags_NoUndoRedo' flag
The buffer desync defect has been fixed as of Dear ImGui v1.88.
You can now undo/redo console input.
2022-09-02 02:24:04 +02:00
Kawe Mazidjatari
54fc85e1d3 CConsole: modify input chars using the callback
Light preparation for when the lib gets updated to 1.88 to enable undo/redo again.
2022-09-02 01:18:36 +02:00
Kawe Mazidjatari
13c91c72fa Add 'Reload Banlist' button 2022-09-01 01:20:27 +02:00
Kawe Mazidjatari
41fda3a8ac Clear message when modal is closed with the 'Close' or 'X' button
This does not happen when you connect, because then you can retrieve the name of the server you connected to the next time you open the modal.
2022-08-31 21:49:28 +02:00
Kawe Mazidjatari
66ea9484e9 Hidden server modal sanity check
* Check if the input field isn't empty.
2022-08-31 17:23:23 +02:00
Kawe Mazidjatari
0309d9cd6b Server browser UX improvements
* Use proper method of obtaining content regions for buttons.
* Set min and default size to (928 - 524), this improves the anti-aliasing effect even more.
* Significantly decrease the size of the private server modal.
* Removed extraneous min window size constraint set by 'ImGuiConfig::InitStyle()'.
2022-08-31 15:45:12 +02:00
Kawe Mazidjatari
eca922d3df Fix console autocomplete window not padding elements correctly when size is between the clamped values 2022-08-31 13:00:02 +02:00
Kawe Mazidjatari
a5f71dc4d8 Change default size for browser window
Default size is tested to show the least amount of anti-aliasing effects.
2022-08-31 02:16:40 +02:00
Kawe Mazidjatari
8712f7db81 Fix concurrency of g_svNetKey
* Fix concurrency of g_svNetKey.
* Improve logging.
* Overall code cleanup.
2022-08-30 01:22:53 +02:00
Kawe Mazidjatari
e54c2df621 Light cleanup 2022-08-29 14:00:54 +02:00
Kawe Mazidjatari
ab8fc757c8 Fix concurrent access to 'g_vAllPlaylists' and 'g_vAllMaps' 2022-08-29 11:55:58 +02:00
Kawe Mazidjatari
73ff0bd0c1 Licht cleanup
* Removed unnecessary header files.
* Removed unnecessary c-string cast.
* Use lock_guard for mutex.
2022-08-29 03:03:53 +02:00
Kawe Mazidjatari
e174cb2b1d Turn static var into member 2022-08-29 02:38:19 +02:00
Kawe Mazidjatari
0f488c685c Move simple task to global fixed frame
Avoids having to create threads for tiny little things.
2022-08-29 02:21:32 +02:00
Kawe Mazidjatari
50fceec016 Update error messages 2022-08-29 00:19:11 +02:00
Kawe Mazidjatari
f6d8a966a3 Don't reload level when reparsing weapon scripts 2022-08-28 17:42:58 +02:00