From 024440a55eeb7136f757885cde7d9e0ecb7814f2 Mon Sep 17 00:00:00 2001 From: Edo Date: Wed, 25 Jan 2023 18:59:15 +0000 Subject: [PATCH] [General]: Cleanup usage of outputdebugstring (#733) --- src/Components/Modules/Exception.cpp | 2 ++ src/Components/Modules/Zones.cpp | 5 ----- src/Steam/Interfaces/SteamRemoteStorage.cpp | 2 ++ src/Steam/Proxy.hpp | 16 +++++++++++----- src/Steam/Steam.cpp | 2 ++ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index f02c307b..7860a375 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -134,7 +134,9 @@ namespace Components if (!MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, static_cast(MiniDumpType), &ex, nullptr, nullptr)) { MessageBoxA(nullptr, Utils::String::Format("There was an error creating the minidump ({})! Hit OK to close the program.", Utils::GetLastWindowsError()), "ERROR", MB_OK | MB_ICONERROR); +#ifdef _DEBUG OutputDebugStringA("Failed to create new minidump!"); +#endif Utils::OutputDebugLastError(); TerminateProcess(GetCurrentProcess(), ExceptionInfo->ExceptionRecord->ExceptionCode); } diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index 42801f28..cfcd276b 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -1979,11 +1979,6 @@ namespace Components //material->drawSurf[9] = material359.drawSurf[1]; //material->drawSurf[10] = material359.drawSurf[2]; //material->drawSurf[11] = material359.drawSurf[3]; - - if (material359.sGameFlags & 0x100) - { - //OutputDebugStringA(""); - } } return result; diff --git a/src/Steam/Interfaces/SteamRemoteStorage.cpp b/src/Steam/Interfaces/SteamRemoteStorage.cpp index 2cbe6620..0974512b 100644 --- a/src/Steam/Interfaces/SteamRemoteStorage.cpp +++ b/src/Steam/Interfaces/SteamRemoteStorage.cpp @@ -16,7 +16,9 @@ namespace Steam int RemoteStorage::FileRead(const char *pchFile, void *pvData, int cubDataToRead) { +#ifdef _DEBUG OutputDebugStringA(pchFile); +#endif return 0; } diff --git a/src/Steam/Proxy.hpp b/src/Steam/Proxy.hpp index 27c0cf30..cec5a8fc 100644 --- a/src/Steam/Proxy.hpp +++ b/src/Steam/Proxy.hpp @@ -156,24 +156,30 @@ namespace Steam template T invoke(const std::string& methodName, Args... args) { - if(!this->interfacePtr) + if (!this->interfacePtr) { - OutputDebugStringA(::Utils::String::VA("Steam interface pointer is invalid (%s)!\n", methodName.data())); +#ifdef _DEBUG + OutputDebugStringA(::Utils::String::Format("Steam interface pointer is invalid '{}'!\n", methodName)); +#endif return T(); } auto method = this->getMethod(methodName); if (!method.first) { - OutputDebugStringA(::Utils::String::VA("Steam interface method %s not found!\n", methodName.data())); +#ifdef _DEBUG + OutputDebugStringA(::Utils::String::Format("Steam interface method '{}' not found!\n", methodName)); +#endif return T(); } std::size_t argc = method.second; constexpr std::size_t passedArgc = Interface::AddSizes::value; - if(passedArgc != argc) + if (passedArgc != argc) { - OutputDebugStringA(::Utils::String::VA("Steam interface arguments for method %s do not match (expected %d bytes, but got %d bytes)!\n", methodName.data(), argc, passedArgc)); +#ifdef _DEBUG + OutputDebugStringA(::Utils::String::Format("Steam interface arguments for method '{}' do not match (expected {} bytes, but got {} bytes)!\n", methodName, argc, passedArgc)); +#endif return T(); } diff --git a/src/Steam/Steam.cpp b/src/Steam/Steam.cpp index 9e206af9..37ec9361 100644 --- a/src/Steam/Steam.cpp +++ b/src/Steam/Steam.cpp @@ -123,7 +123,9 @@ namespace Steam if (!Proxy::Inititalize()) { +#ifdef _DEBUG OutputDebugStringA("Steam proxy not initialized properly"); +#endif Components::StartupMessages::AddMessage("Warning:\nUnable to connect to Steam. Steam features will be unavailable"); } else