From b7ff6dd9c65c967538283b8fe323a7aa7477591a Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 1 Aug 2024 12:04:59 +0000 Subject: [PATCH] Windows: Disable logging if SilentLog is enabled --- Source/Windows/ARM64EC/Module.cpp | 2 +- Source/Windows/Common/Logging.cpp | 6 ++++++ Source/Windows/WOW64/Module.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index 1caab003a..5e9364b84 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -408,13 +408,13 @@ extern "C" void SyncThreadContext(CONTEXT* Context) { } void ProcessInit() { - FEX::Windows::Logging::Init(); FEX::Config::InitializeConfigs(); FEXCore::Config::Initialize(); FEXCore::Config::AddLayer(FEX::Config::CreateGlobalMainLayer()); FEXCore::Config::AddLayer(FEX::Config::CreateMainLayer()); FEXCore::Config::Load(); FEXCore::Config::ReloadMetaLayer(); + FEX::Windows::Logging::Init(); FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_IS64BIT_MODE, "1"); diff --git a/Source/Windows/Common/Logging.cpp b/Source/Windows/Common/Logging.cpp index a7f7c26ad..0e9b8c961 100644 --- a/Source/Windows/Common/Logging.cpp +++ b/Source/Windows/Common/Logging.cpp @@ -1,5 +1,6 @@ // SPDX-License-Identifier: MIT #include +#include #include #include @@ -33,6 +34,11 @@ static void AssertHandler(const char* Message) { namespace FEX::Windows::Logging { void Init() { + FEX_CONFIG_OPT(SilentLog, SILENTLOG); + if (SilentLog()) { + return; + } + WineDbgOut = reinterpret_cast(GetProcAddress(GetModuleHandleA("ntdll.dll"), "__wine_dbg_output")); if (!WineDbgOut) { const auto Path = fextl::fmt::format("{}\\fex-{}.log", getenv("LOCALAPPDATA"), GetCurrentProcessId()); diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index 16882e66e..6135669f6 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -410,13 +410,13 @@ public: }; void BTCpuProcessInit() { - FEX::Windows::Logging::Init(); FEX::Config::InitializeConfigs(); FEXCore::Config::Initialize(); FEXCore::Config::AddLayer(FEX::Config::CreateGlobalMainLayer()); FEXCore::Config::AddLayer(FEX::Config::CreateMainLayer()); FEXCore::Config::Load(); FEXCore::Config::ReloadMetaLayer(); + FEX::Windows::Logging::Init(); FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_IS_INTERPRETER, "0"); FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_INTERPRETER_INSTALLED, "0");