72 Commits

Author SHA1 Message Date
Kawe Mazidjatari
0aa62890bb /W4: Remove unreferenced local variables
Removed additional dead code.
2023-04-02 10:50:59 +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
62be540702 Properly shutdown SpdLog
Shutdown SpdLog on SDK shutdown or crash, this makes sure the buffers gets flushed.
2023-03-18 14:10:29 +01:00
Kawe Mazidjatari
fc5aa2aafe Cleanup console.cpp 2023-03-15 21:32:08 +01:00
Kawe Mazidjatari
cac2c6a917 Make 'sig_getadr' a console command
Changed to hidden ConCommand.
2023-03-15 21:11:20 +01:00
Kawe Mazidjatari
19d21300a3 Use cached ImGui IO reference 2023-02-18 15:50:12 +01:00
Kawe Mazidjatari
c253fd8b44 Update console code
'SetConsoleBackgroundColor' takes a DWORD.
2023-02-18 15:49:04 +01:00
Kawe Mazidjatari
b7dd5e11c1 Fix bug causing init errors not getting logged
Initialize console and spdlog before anything else that is using the console to log errors to (in this case, winsock init errors were never getting logged).
2023-01-31 17:09:56 +01:00
Kawe Mazidjatari
e783309d76 Add hook error detection in system hooking 2023-01-30 22:09:15 +01:00
Kawe Mazidjatari
0a319971dd Hook ResizeBuffers to obtain rect size during resize
Required as the initialization only sets it to the startup rect size. This will always be up-to-date during resizes.
2023-01-30 22:08:01 +01:00
Kawe Mazidjatari
2e6381cfc6 Add hook error detection in input hooking 2023-01-30 21:45:53 +01:00
Kawe Mazidjatari
c84622cfd6 DirectX hook refactor
Refactored code to only feature game pointers, this avoids the unnecessary overhead that was previously caused by creating our own device pointers, swapchain, etc.. This commit also fixes the classic 'black screen' problem when the aspect ratio is set to 4:3 - 5:4, however, a similar bug returned for this causing Dear ImGui to not draw at all when the aspect ratio is set to 4:3 - 5:4. This commit also moves the old HwndProc hook to 'CGame::WindowProc'.
2023-01-30 20:18:11 +01:00
Kawe Mazidjatari
0f9c9d5ae4 Add 'g_pImmediateContext' to SDK
Grab ptr to game dx device context.
2023-01-30 16:10:46 +01:00
Kawe Mazidjatari
c86c965290 Disable Dear ImGui 'ctrl+tab' shortcut menu
This menu isn't in much need, in fact; we didn't even knew it existed until someone started to complain about it! Currently, the drawing logic isn't setup to support this properly either. Disabled the shortcut menu.
2023-01-29 19:07:02 +01:00
Kawe Mazidjatari
938df1dd89 Check visible panels in wrapper instead of imgui itself
The SDK's DX interface is much easier to expose to Dear ImGui than game/engine implementations.
2023-01-26 20:00:52 +01:00
Kawe Mazidjatari
a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +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
d9ac275d71 Fix bug where input is lost during resize
This commit fixes a bug causing all input to be lost. This gets triggered when either the console or server browser window is drawing while the user tabs out of the full-screen window, or resizes the game window.
2022-12-22 17:49:38 +01:00
Kawe Mazidjatari
2501c37044 Globally convert all byte patterns to strings
These get reconverted to masked byte patterns at runtime. With the signature map cache system, this will only happen when building the cache.
2022-12-01 22:44:55 +01:00
Kawe Mazidjatari
d3b2893cdc Change ImGui config file path and use engine's FileSystem API
'ImGuiConfig::Load()' was loading from the new path, however 'ImGuiConfig::Save()' was not. Defined path as constant expression to avoid this problem in the future. Also loading the files through the engine's API from now on.
2022-11-24 10:45:42 +01: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
729475c74c Light cleanup
Use NO_ERROR instead of NULL for error code parameter passed to Error(..).
2022-09-14 01:14:51 +02:00
Kawe Mazidjatari
3d6d6644bd Logging bug fix and error handling improvements
* Replaced the boolean 'fatal' parameter with a error code parameter, anything non-null will prompt a message (fatal) and terminate the process with given error code.
* Fixed bug where the global ostreamsink for spdlog did NOT get cleared in 'SQVM_PrintFunc' when cvar 'sq_showvmoutput' was < 3. Moved to global scope.
* Added error message for when detouring the process has failed, with the error code.
* Only call 'Plat_GetProcessUpTime()' once per log, (improves performance and fixes bug where the error message box would show a different time stamp than what is logged into the console or file).
* All TIER0 loggers only log to notify and console when the SDK engine has fully initialized and detoured all functions.
2022-09-14 00:39:38 +02:00
Kye
a976d2868e
Cleaned up uMsg switch statement 2022-09-13 12:29:36 +10:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +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
656b0be3ec Improve threading (work in progress)
* Only run '_DownloadPlaylists_f()' in the main thread, schedule for next frame if we aren't in the main thread. (this should fix crash cases related to disconnecting from the game).

* Locked read/write to CBrowser members (thread for obtaining the server list is detached, but once the 'slow' post operation in this thread is complete, mutex lock is acquired (locking the render thread if the browser is active) to set the string members of CBrowser, this operation is very fast as we only set the string and the color after the http post operation (this never caused a crash, but the behavior without any lock mechanism is technically undefined regardless).

* Obtain the host name dynamically from the ConVar 'pylon_matchmaking_hostname' (atomic operation). Initial approach was deleting the whole master server pointer just to construct a new httpclient object..
2022-08-27 18:57:56 +02:00
Kawe Mazidjatari
2010e11310 Add 'fatal' functionality to Error()
When fatal is set, the function will show a error dialogue, which will halt the process and close when the message is dismissed. Else we will end up in a crash.
2022-08-22 12:42:41 +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
Marvin D
eeec292238 Don't need to run CBuf_Execute. Game does it itself.
* How did I forget to remember that for almost a year..
* Connect and disconnect commands also fixed now.
2022-08-19 22:25:26 +02:00
Kawe Mazidjatari
6764b5e56e Implement frame tasks
Run all Cbuf_Execute calls in the main thread. This should fix every problem related to (but not only):
* Connecting to server while RUI dialogue is still open.
* Connecting to server while in an active game.
* Running 'weapon_reparse'.
2022-08-19 21:33:31 +02:00
Kawe Mazidjatari
bf3b7bdace Server browser cleanup
* Moved server utility to dedicated class shared by browser panel and UI script VM.
* Additional code improvements and optimizations.
2022-08-14 15:43:49 +02:00
Kawe Mazidjatari
88b3336758 Many small code improvements and optimizations
* Use c++ methods as much as possible.
* Use enum types for accessing NavMesh objects from array.
* Use size_t for for loops when testing against size types.
* Don't compute strlen twice of more on the same string.
* Don't use unnecessary c string casts if there is a method with a std::string overload.
* Don't create string objects from string pointers if we could use them directly.
* Don't initialize RCON password twice on each change, and don't set if the new password equals the old.
2022-08-11 11:07:45 +02:00
Kawe Mazidjatari
329621c6ad Move all public headers into root of 'public' 2022-08-09 17:18:07 +02:00
Kawe Mazidjatari
8c6ee8a834 Remove 'm' prefix from dll globals
Large commit.
2022-08-09 03:02:00 +02:00
Kawe Mazidjatari
feef90c44f Light cleanup of the detours init system 2022-07-26 03:00:51 +02:00
Kawe Mazidjatari
b846809ac3 Give process time to shutdown properly
Game gets max 10 seconds to shutdown properly when closed directly by the external console window (g_pHostState->m_iNextState = HostStates_t::HS_SHUTDOWN).
2022-07-26 00:36:35 +02:00
Kawe Mazidjatari
d4f9e68930 'g_ppGameDevice' confirmed compatible with earlier builds 2022-07-21 16:56:25 +02:00
Kawe Mazidjatari
33f517d809 Use XOR operator for toggling menu's 2022-06-22 10:19:44 +02:00
PixieCore
a2a04bfb7f Fix other seasons. 2022-06-19 18:09:02 +02:00
PixieCore
8bf08af7b9 Start of RTech::CreateDXTexture rebuild.
* Currently crashes due to stack corruption.
2022-06-19 18:07:43 +02:00
Kawe Mazidjatari
aaf6e46871 ImGui panel improvements
Slight optimizations and cleanup.
Added fade-in effect.
2022-06-09 02:22:01 +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
3144227ec8 Update GetAdr implementations to feature spdlog
Fixed all alignments and reduced code verbosity
2022-05-13 14:53:25 +02:00
Kawe Mazidjatari
116d66f241 Fix Dear ImGui shutdown assert 2022-05-07 17:13:37 +02:00
Kawe Mazidjatari
a479b4ac78 See description
Fixed rare crash in CMDLCache when buffer itteration returns invalid pointer (not null!) for handle.

Made all variables and functions used by BuildPropStaticFrustumCullMap searched dynamically (these should also work on s0, s1 and s2, they are compared but at the moment untested).

TODO: Fix deref crash properly (see bsplib.cpp l291).
2022-05-01 05:38:51 +02:00