From 84aee3906bf3be89eff55b4ac25c68646aea4a2b Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Sun, 1 Jun 2025 01:36:41 +0100 Subject: [PATCH] "verbose" command line argument to log to stdout --- src/Cemu/Logging/CemuLogging.cpp | 4 ++++ src/config/LaunchSettings.cpp | 6 ++++++ src/config/LaunchSettings.h | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/Cemu/Logging/CemuLogging.cpp b/src/Cemu/Logging/CemuLogging.cpp index 5cde2a7fb8..f3575cc92f 100644 --- a/src/Cemu/Logging/CemuLogging.cpp +++ b/src/Cemu/Logging/CemuLogging.cpp @@ -3,6 +3,7 @@ #include "util/helpers/helpers.h" #include "config/CemuConfig.h" #include "config/ActiveSettings.h" +#include "config/LaunchSettings.h" #include #include @@ -144,6 +145,9 @@ bool cemuLog_log(LogType type, std::string_view text) if (!cemuLog_isLoggingEnabled(type)) return false; + if (LaunchSettings::Verbose()) + std::cout << text << std::endl; + cemuLog_writeLineToLog(text); const auto it = std::find_if(g_logging_window_mapping.cbegin(), g_logging_window_mapping.cend(), diff --git a/src/config/LaunchSettings.cpp b/src/config/LaunchSettings.cpp index b2b0c08a04..fde205398a 100644 --- a/src/config/LaunchSettings.cpp +++ b/src/config/LaunchSettings.cpp @@ -59,6 +59,9 @@ bool LaunchSettings::HandleCommandline(const std::vector& args) desc.add_options() ("help,h", "This help screen") ("version,v", "Displays the version of Cemu") +#if !BOOST_OS_WINDOWS + ("verbose", "Log to stdout") +#endif ("game,g", po::wvalue(), "Path of game to launch") ("title-id,t", po::value(), "Title ID of the title to be launched (overridden by --game)") @@ -125,6 +128,9 @@ bool LaunchSettings::HandleCommandline(const std::vector& args) return false; // exit in main } + if (vm.count("verbose")) + s_verbose = true; + if (vm.count("game")) { std::wstring tmp = vm["game"].as(); diff --git a/src/config/LaunchSettings.h b/src/config/LaunchSettings.h index d1bed9e151..13665cb749 100644 --- a/src/config/LaunchSettings.h +++ b/src/config/LaunchSettings.h @@ -22,6 +22,8 @@ class LaunchSettings static std::optional RenderUpsideDownEnabled() { return s_render_upside_down; } static std::optional FullscreenEnabled() { return s_fullscreen; } + static bool Verbose() { return s_verbose; } + static bool GDBStubEnabled() { return s_enable_gdbstub; } static bool NSightModeEnabled() { return s_nsight_mode; } @@ -40,6 +42,8 @@ class LaunchSettings inline static std::optional s_render_upside_down{}; inline static std::optional s_fullscreen{}; + + inline static bool s_verbose = false; inline static bool s_enable_gdbstub = false; inline static bool s_nsight_mode = false;