From 9e7495e407d470c98c0927d62555cb74f2e46f0e Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 27 Nov 2022 10:19:23 +0100 Subject: [PATCH] Added new logger types (AudioSystem & VideoSystem) These loggers are to be used for hooking and logging Miles Audio and Bink Video systems. --- r5dev/rtech/rtech_utils.cpp | 4 ++-- r5dev/tier0/dbg.cpp | 18 ++++++++++++++++-- r5dev/tier0/dbg.h | 32 ++++++++++++++++++++------------ r5dev/tier1/IConVar.cpp | 4 +++- r5dev/tier1/cvar.cpp | 2 ++ r5dev/tier1/cvar.h | 2 ++ r5dev/vgui/vgui_debugpanel.cpp | 4 ++++ 7 files changed, 49 insertions(+), 17 deletions(-) diff --git a/r5dev/rtech/rtech_utils.cpp b/r5dev/rtech/rtech_utils.cpp index fceb852b..7f331071 100644 --- a/r5dev/rtech/rtech_utils.cpp +++ b/r5dev/rtech/rtech_utils.cpp @@ -580,7 +580,7 @@ void RTech::CreateDXTexture(TextureHeader_t* textureHeader, int64_t imageData) const D3D11_SUBRESOURCE_DATA* subResData = (D3D11_SUBRESOURCE_DATA*)((uint8_t*)initialData + offsetStartResourceData); const HRESULT createTextureRes = (*g_ppGameDevice)->CreateTexture2D(&textureDesc, subResData, &textureHeader->m_ppTexture); if (createTextureRes < S_OK) - Error(eDLL_T::RTECH, EXIT_FAILURE, "Couldn't create texture \"%s\": error code %08x\n", textureHeader->m_pDebugName, createTextureRes); + Error(eDLL_T::RTECH, EXIT_FAILURE, "Couldn't create texture \"%s\": error code = %08x\n", textureHeader->m_pDebugName, createTextureRes); D3D11_SHADER_RESOURCE_VIEW_DESC shaderResource{}; shaderResource.Format = dxgiFormat; @@ -598,7 +598,7 @@ void RTech::CreateDXTexture(TextureHeader_t* textureHeader, int64_t imageData) const HRESULT createShaderResourceRes = (*g_ppGameDevice)->CreateShaderResourceView(textureHeader->m_ppTexture, &shaderResource, &textureHeader->m_ppShaderResourceView); if (createShaderResourceRes < S_OK) - Error(eDLL_T::RTECH, EXIT_FAILURE, "Couldn't create shader resource view for texture \"%s\": error code %08x\n", textureHeader->m_pDebugName, createShaderResourceRes); + Error(eDLL_T::RTECH, EXIT_FAILURE, "Couldn't create shader resource view for texture \"%s\": error code = %08x\n", textureHeader->m_pDebugName, createShaderResourceRes); } #pragma warning( pop ) #endif diff --git a/r5dev/tier0/dbg.cpp b/r5dev/tier0/dbg.cpp index 13cbf4ae..78506aa2 100644 --- a/r5dev/tier0/dbg.cpp +++ b/r5dev/tier0/dbg.cpp @@ -188,6 +188,8 @@ void NetMsg(EGlobalContext_t context, const char* fmt, ...) case EGlobalContext_t::NATIVE_FS: case EGlobalContext_t::NATIVE_RTECH: case EGlobalContext_t::NATIVE_MS: + case EGlobalContext_t::NATIVE_AUDIO: + case EGlobalContext_t::NATIVE_VIDEO: case EGlobalContext_t::NETCON_S: case EGlobalContext_t::COMMON_C: { @@ -242,7 +244,13 @@ void NetMsg(EGlobalContext_t context, const char* fmt, ...) color = ImVec4(0.36f, 0.70f, 0.35f, 1.00f); break; case eDLL_T::MS: - color = ImVec4(0.75f, 0.41f, 0.67f, 1.00f); + color = ImVec4(0.75f, 0.30f, 0.68f, 1.00f); + break; + case eDLL_T::AUDIO: + color = ImVec4(0.85f, 0.51f, 0.00f, 1.00f); + break; + case eDLL_T::VIDEO: + color = ImVec4(0.73f, 0.00f, 0.92f, 1.00f); break; case eDLL_T::NETCON: color = ImVec4(0.81f, 0.81f, 0.81f, 1.00f); @@ -373,7 +381,13 @@ void DevMsg(eDLL_T context, const char* fmt, ...) color = ImVec4(0.36f, 0.70f, 0.35f, 1.00f); break; case eDLL_T::MS: - color = ImVec4(0.75f, 0.41f, 0.67f, 1.00f); + color = ImVec4(0.75f, 0.30f, 0.68f, 1.00f); + break; + case eDLL_T::AUDIO: + color = ImVec4(0.85f, 0.51f, 0.00f, 1.00f); + break; + case eDLL_T::VIDEO: + color = ImVec4(0.73f, 0.00f, 0.92f, 1.00f); break; case eDLL_T::NETCON: color = ImVec4(0.81f, 0.81f, 0.81f, 1.00f); diff --git a/r5dev/tier0/dbg.h b/r5dev/tier0/dbg.h index aa98c1b9..a5a7cc8f 100644 --- a/r5dev/tier0/dbg.h +++ b/r5dev/tier0/dbg.h @@ -26,6 +26,8 @@ enum class EGlobalContext_t : int NATIVE_FS, NATIVE_RTECH, NATIVE_MS, + NATIVE_AUDIO, + NATIVE_VIDEO, NETCON_S, COMMON_C, WARNING_C, @@ -35,18 +37,20 @@ enum class EGlobalContext_t : int enum class eDLL_T : int { - SERVER = 0, // server.dll (GameDLL) - CLIENT = 1, // client.dll (GameDLL) - UI = 2, // ui.dll (GameDLL) - ENGINE = 3, // engine.dll (Wrapper) - FS = 4, // filesystem_stdio.dll (FileSystem API) - RTECH = 5, // rtech_game.dll (RTech API) - MS = 6, // materialsystem_dx11.dll (MaterialSystem API) - NETCON = 7, // netconsole impl (RCON wire) - COMMON = 8 // general (No specific subsystem) + SERVER = 0, // server.dll (GameDLL) + CLIENT = 1, // client.dll (GameDLL) + UI = 2, // ui.dll (GameDLL) + ENGINE = 3, // engine.dll (Wrapper) + FS = 4, // filesystem_stdio.dll (FileSystem API) + RTECH = 5, // rtech_game.dll (RTech API) + MS = 6, // materialsystem_dx11.dll (MaterialSystem API) + AUDIO = 7, // binkawin64/mileswin64.dll (AudioSystem API) + VIDEO = 8, // bink2w64 (VideoSystem API) + NETCON = 9, // netconsole impl (RCON wire) + COMMON = 10 // general (No specific subsystem) }; -static const string sDLL_T[9] = +static const string sDLL_T[11] = { "Native(S):", "Native(C):", @@ -55,11 +59,13 @@ static const string sDLL_T[9] = "Native(F):", "Native(R):", "Native(M):", + "Native(A):", + "Native(V):", "Netcon(X):", "" }; -static const string sANSI_DLL_T[9] = +static const string sANSI_DLL_T[11] = { "\033[38;2;059;120;218mNative(S):", "\033[38;2;118;118;118mNative(C):", @@ -67,7 +73,9 @@ static const string sANSI_DLL_T[9] = "\033[38;2;204;204;204mNative(E):", "\033[38;2;097;214;214mNative(F):", "\033[38;2;092;181;089mNative(R):", - "\033[38;2;192;105;173mNative(M):", + "\033[38;2;192;077;173mNative(M):", + "\033[38;2;218;113;000mNative(A):", + "\033[38;2;185;000;235mNative(V):", "\033[38;2;204;204;204mNetcon(X):", "\033[38;2;255;204;153m" }; diff --git a/r5dev/tier1/IConVar.cpp b/r5dev/tier1/IConVar.cpp index 99af8f9f..8d79c0e5 100644 --- a/r5dev/tier1/IConVar.cpp +++ b/r5dev/tier1/IConVar.cpp @@ -166,8 +166,10 @@ void ConVar::Init(void) con_notify_native_ui_clr = ConVar::Create("con_notify_native_ui_clr" , "200 60 60 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native UI RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); con_notify_native_engine_clr = ConVar::Create("con_notify_native_engine_clr", "255 255 255 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Native engine RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); con_notify_native_fs_clr = ConVar::Create("con_notify_native_fs_clr" , "0 100 225 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native FileSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); - con_notify_native_rtech_clr = ConVar::Create("con_notify_native_rtech_clr" , "25 100 100 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native RTech RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); + con_notify_native_rtech_clr = ConVar::Create("con_notify_native_rtech_clr" , "25 120 20 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native RTech RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); con_notify_native_ms_clr = ConVar::Create("con_notify_native_ms_clr" , "200 20 180 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native MaterialSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); + con_notify_native_audio_clr = ConVar::Create("con_notify_native_audio_clr" , "205 55 0 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native AudioSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); + con_notify_native_video_clr = ConVar::Create("con_notify_native_video_clr" , "115 0 235 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Native VideoSystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); con_notify_netcon_clr = ConVar::Create("con_notify_netcon_clr" , "255 255 255 255", FCVAR_MATERIAL_SYSTEM_THREAD, "Net console RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); con_notify_common_clr = ConVar::Create("con_notify_common_clr" , "255 140 80 255" , FCVAR_MATERIAL_SYSTEM_THREAD, "Common RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); diff --git a/r5dev/tier1/cvar.cpp b/r5dev/tier1/cvar.cpp index 19fafbc0..ad5c6311 100644 --- a/r5dev/tier1/cvar.cpp +++ b/r5dev/tier1/cvar.cpp @@ -139,6 +139,8 @@ ConVar* con_notify_native_engine_clr = nullptr; ConVar* con_notify_native_fs_clr = nullptr; ConVar* con_notify_native_rtech_clr = nullptr; ConVar* con_notify_native_ms_clr = nullptr; +ConVar* con_notify_native_audio_clr = nullptr; +ConVar* con_notify_native_video_clr = nullptr; ConVar* con_notify_netcon_clr = nullptr; ConVar* con_notify_common_clr = nullptr; ConVar* con_notify_warning_clr = nullptr; diff --git a/r5dev/tier1/cvar.h b/r5dev/tier1/cvar.h index 674093a0..e3716039 100644 --- a/r5dev/tier1/cvar.h +++ b/r5dev/tier1/cvar.h @@ -135,6 +135,8 @@ extern ConVar* con_notify_native_engine_clr; extern ConVar* con_notify_native_fs_clr; extern ConVar* con_notify_native_rtech_clr; extern ConVar* con_notify_native_ms_clr; +extern ConVar* con_notify_native_audio_clr; +extern ConVar* con_notify_native_video_clr; extern ConVar* con_notify_netcon_clr; extern ConVar* con_notify_common_clr; extern ConVar* con_notify_warning_clr; diff --git a/r5dev/vgui/vgui_debugpanel.cpp b/r5dev/vgui/vgui_debugpanel.cpp index 6b919f5b..63186deb 100644 --- a/r5dev/vgui/vgui_debugpanel.cpp +++ b/r5dev/vgui/vgui_debugpanel.cpp @@ -274,6 +274,10 @@ Color CTextOverlay::GetLogColorForType(const EGlobalContext_t context) const return { con_notify_native_rtech_clr->GetColor() }; case EGlobalContext_t::NATIVE_MS: return { con_notify_native_ms_clr->GetColor() }; + case EGlobalContext_t::NATIVE_AUDIO: + return { con_notify_native_audio_clr->GetColor() }; + case EGlobalContext_t::NATIVE_VIDEO: + return { con_notify_native_video_clr->GetColor() }; case EGlobalContext_t::NETCON_S: return { con_notify_netcon_clr->GetColor() }; case EGlobalContext_t::COMMON_C: