101 Commits

Author SHA1 Message Date
Kawe Mazidjatari
41f801365a CConsole: fixed color bug when missing newline
* Fixed bug where the in-game console could not color the line when no newline was found.
* Changed behavior to only newline when: '\n' has been found, or the context has changed (using a print without newline will continue to print on the same line in the console).
* Pass ImVec4 parameter in 'CTextLogger::InsertTextAt' by reference.
2022-09-19 20:21:18 +02:00
Kawe Mazidjatari
a3027a8fd1 Upgrade Dear ImGui from 1.87 to 1.88
Upgrade includes all the modifications we brought to the library (SetWindowScrollX/Y, autocaret end, mouse state adjustments for game, highlight around input selection, hotkeys, etc..).
2022-09-02 02:22:39 +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
45c147087a Fixed console logger selection while mutating entries bug
* Fixed bug where attempting to select text, while auto scroll is disabled, and entries are being removed, while entries are also being added, causes the start of the selection to not adjust with the number of lines being removed, which then causes it to move with the deletion.
2022-08-30 22:54:34 +02:00
Kawe Mazidjatari
d1d523fd12 Update imgui_logger.cpp 2022-08-30 21:28:26 +02:00
Kawe Mazidjatari
3414a2cd2c ImGui panel improvements
* Eliminated all forms of concurrency for CConsole logger.
* Used enum for determining which theme user loaded (DEFAULT, LEGACY, MODERN).
* Fixed issue where browser panel doesn't have the same frame padding as the console for the modern theme.
* Fixed issue where the history items count shows number higher than maximum until updated (updates vector before displaying, else this happens in g_pConsole->RunTask which is the operation that happens before we add new elements to the vector, thus showing the wrong count as this size is getting corrected the next frame after we painted, we don't update the summary each frame for performance reasons).
2022-08-22 01:10:18 +02:00
Kawe Mazidjatari
8476d22777 Fix concurrent access to several CConsole members
* Fix concurrent access to CConsole::m_Logger.
* Fix concurrent access to CConsole::m_vHistory.
* Additional DX system cleanup.
2022-08-21 19:35:06 +02:00
Kawe Mazidjatari
52e19e9ad6 Single-thread the game console
Run all task in the same thread used to run the browser/console frame and remove all mutexes.
2022-08-20 01:48:42 +02:00
Kawe Mazidjatari
329621c6ad Move all public headers into root of 'public' 2022-08-09 17:18:07 +02:00
Kawe Mazidjatari
e92b5d1300 General cleanup
Use c++ methods, remove unnecessary casts, unnecessary use of auto, etc..
2022-08-09 15:19:12 +02:00
Kawe Mazidjatari
f015667f88 Light ImGui cleanup
* CTextLogger: Explicit cast return value of size() to int when testing int value against size_t.
* CBrowser: Run think and request thread on client.dll, but for the request, only the refresh.
2022-08-09 12:13:31 +02:00
Amos
69b385a21a Change type to int in for loop
Tests against int, not size_t.
2022-06-30 11:29:36 +02:00
Kawe Mazidjatari
3323c3fadb Small ImGui theme adjustments 2022-06-27 14:48:03 +02:00
Kawe Mazidjatari
98c43fd6c1 Rename CConLog to ConLog_t 2022-06-26 17:40:02 +02:00
Kawe Mazidjatari
5480d450a2 Update imgui_logger.cpp 2022-06-26 17:10:52 +02:00
Kawe Mazidjatari
efe71fbe24 ImGui console UX improvements
* Fixed click-through parent window.
* Keep selection position when lines get cleared.
* Keep cursor position when lines get cleared.
* Ensure cursor visibility when dragging cursor outside rect.
* Falter free scrolling in autocomplete window.
* Falter free scrolling in logging window (window no longer stutters when lines get cleared).
2022-06-26 16:47:00 +02:00
Kawe Mazidjatari
d7a004a0eb Fixed bug where auto-scrolling occasionally gets disabled
Issue happened when scrolling back, most of the time it will work, but there is always jitter in the first frame after the change which could result in ImGui::GetScrollY() <= ImGui::GetScrollMaxY() resulting in auto-scroll disable.
Only scroll back if ImGui::GetScrollY() <= ImGui::GetScrollMaxY() and always reset value of CConsole::m_nScrollBack.
2022-06-24 18:28:26 +02:00
Kawe Mazidjatari
cdc32531eb Prevent selection in console when scrollbar is active
Fixed issue where scrolling with the scrollbar would select text whilst sliding.
Improved UX by not showing the text edit cursor when scrollbar is hovered.
2022-06-24 17:43:50 +02:00
Kawe Mazidjatari
88259a69ae Allow selection while cursor is no longer hovered over child window 2022-06-24 15:23:14 +02:00
Kawe Mazidjatari
2eda8235b7 Slight theming tweaks
Minor improvements to small detail:
No child border on console on default theme (this is invisible).
Tweaked first use size and min size where by default the text would always perfectly align between ScrollY min and max.
2022-06-24 12:45:47 +02:00
Kawe Mazidjatari
add5c577ff Improve ImGui theme system
-imgui_theme "modern" = Respawn theme.
-imgui_theme "legacy" = Valve theme.
No args = default theme.
2022-06-24 12:22:04 +02:00
Kawe Mazidjatari
e1ede0c995 Remove unused function from imgui_logger.cpp 2022-06-24 12:12:00 +02:00
Kawe Mazidjatari
145b5dcd13 CTextLogger cleanup
Reordered structure.
Use C++ style casts.
changed m_flLastClick (float) to double.
2022-06-22 00:33:12 +02:00
Kawe Mazidjatari
76ec4b8f4a Improve console scrolling
Moved auto scrolling logic to CTextLogger.
Removed redundant code in CTextLogger.
Added bool param to CTextLogger::RemoveLine to determine whether or not to lock the mutex (internal operations should not lock).
Fixed issue where scrolling with cursor is not possible when auto-scroll is set or ScrollY is towards its max.
Fixed copy button (copy all text in console via GUI, ctrl + a - ctrl + v alternative).
2022-06-21 23:25:15 +02:00
Kawe Mazidjatari
a436b70601 CConsole / CTextLogger optimizations
CConsole: cast to proper types.
CTextLogger: only compute line string if filter is active.
2022-06-21 20:20:12 +02:00
Kawe Mazidjatari
3e2c395584 Don't append newlines on obtained text
Newlines are added through the SDK, and the CTextLogger class has been modified to insert a newline when in encounters a newline character.
2022-06-21 11:32:40 +02:00
Kawe Mazidjatari
a534ef1e3c Type untyped variables in CTextLogger
All of these are known types that aren't going to change.
2022-06-21 11:13:30 +02:00
Kawe Mazidjatari
f7dd4089f0 Logger improvements
Fix crash cases due to concurrent access and wrong type casting.
Improve filter logic (now greys out everything outside criteria).

TODO: Return 'size_t' for everything size related.
2022-06-21 10:14:20 +02:00
Kawe Mazidjatari
da299a002c Reimplement text filter
Could be better at some point, currently removes anything not matching criteria resulting in gaps.
But on the other side it might be good as the location of all occurrences are known (should make it easier to see when it is logged during the process).

Revisit in the future.
2022-06-20 20:21:52 +02:00
Kawe Mazidjatari
7d749fc53a Skip space characters properly in CTextLogger 2022-06-20 13:23:38 +02:00
Kawe Mazidjatari
f52bfb139e Remove m_bReadOnly from CTextLogger
User can't modify the log text, it can only be modified through code.
2022-06-20 13:23:11 +02:00
Kawe Mazidjatari
33aebfb89d ImGui theme improvements 2022-06-20 13:05:50 +02:00
Kawe Mazidjatari
28f0df81c6 Fix crash case
Prevent concurrent access to CTextLogger::m_Lines.
Additional cleanup.
2022-06-20 11:01:53 +02:00
Kawe Mazidjatari
1b81f2d1eb Modify CTextLogger
Redact and modify CTextLogger (copy of CTextEditor) to fit logger usage.
Removed most unnecessary methods/code and members.
2022-06-20 10:17:11 +02:00
Kawe Mazidjatari
fed337fbbd Add imgui_logger.cpp
A copy of CTextEditor
2022-06-20 10:14:43 +02:00
Kawe Mazidjatari
f1091fef0e imgui_editor.cpp class rename 2022-06-20 10:05:32 +02:00
Kawe Mazidjatari
20eabe4b8e Update imgui_editor.h 2022-06-19 10:54:11 +02:00
Kawe Mazidjatari
40a0c8878a Rename TextEditor members 2022-06-19 10:51:45 +02:00
Kawe Mazidjatari
0c11011567 Add ImGuiColorTextEdit to project 2022-06-18 23:23: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
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
637041d5e7 Use 'fs' instead of 'std::filesystem' 2022-05-16 21:54:46 +02:00
Kawe Mazidjatari
84fe122e43 Update ImGui lib
Update to 1.87
2022-04-24 20:52:40 +02:00
Kawe Mazidjatari
6f268c0978 Check if ImGui config file exist before attempting to parse it 2022-03-27 12:09:46 +02:00
Amos
6583e174de Implement custom paks loading per level
Game will check scripts/levels/mapname.json and load all rpaks in the rpak field.
Game now also unloads pak files loaded by the SDK preventing crashes and unnecessary memory usage.

VPK's and STBSP's are planned to be added as well.
2022-03-01 02:39:46 +01:00
Amos
a1f96797c0 Console and Browser UX improvements
* Log warnings
* Improve style
* Vector size is now controlled by ConVar instead
* Keep current item in view when console is cleaning up the vector. This doesn't work ideally as its hard to keep track of the current item, and the scroll is a float. In the future it might be better to grab the first vertex of the center line on the console and track that perhaps.
2022-01-22 15:51:09 +01:00
Amos
d4dc9d7c3e Implement new ImGui Input Text flag to move cursor to the end of char buffer 2022-01-17 23:21:19 +01:00
Amos
e6254e3a03 Fix issue with ImGui windows where input could loose focus and not work
'ImGui_ImplWin32_WndProcHandler' has to be called at all times from the HwndProc handler as it has to track all events to prevent issues with input.
2022-01-12 13:11:18 +01:00
IcePixelx
421d5e3c73 Removed obselete funtion from ImGui::Hotkey 2021-12-28 03:07:37 +01:00