From d4d4adcfb91a44038283f07a4c493d6a1a1dbf19 Mon Sep 17 00:00:00 2001 From: Cynthia Date: Sun, 21 Jun 2026 18:15:52 -0700 Subject: [PATCH] custom argstr for non-standalone titles, cos names - renamed cli flags (and their associated API functions as requested) - title arguments can now apply to non standalone titles. - are cleared after first RPX is launched. --- src/Cafe/CafeSystem.cpp | 47 +++++++++++++++++------------------ src/config/LaunchSettings.cpp | 14 +++++------ src/config/LaunchSettings.h | 9 ++++--- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index 524ea32c..20a76812 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -687,7 +687,7 @@ namespace CafeSystem void MountExtras() { - for (const auto& [host_path, emulatedPath] : LaunchSettings::ExtraMounts()) + for (const auto& [host_path, emulatedPath] : LaunchSettings::CosMounts()) { FSCDeviceHostFS_Mount(boost::nowide::narrow(emulatedPath), _pathToUtf8(host_path), FSC_PRIORITY_BASE); } @@ -695,7 +695,7 @@ namespace CafeSystem void UnmountExtras() { - for (const auto& [_, emulatedPath] : LaunchSettings::ExtraMounts()) + for (const auto& [_, emulatedPath] : LaunchSettings::CosMounts()) { fsc_unmount(boost::nowide::narrow(emulatedPath), FSC_PRIORITY_BASE); } @@ -978,13 +978,11 @@ namespace CafeSystem std::string GetForegroundTitleArgStr() { + auto optional_arguments = LaunchSettings::CosArgstr(); + if (optional_arguments.has_value()) + return *optional_arguments; if (sLaunchModeIsStandalone) - { - auto optional_arguments = LaunchSettings::StandaloneTitleArguments(); - if (optional_arguments.has_value()) - return *optional_arguments; return ""; - } auto& update = sGameInfo_ForegroundTitle.GetUpdate(); if (update.IsValid()) return update.GetArgStr(); @@ -1067,25 +1065,26 @@ namespace CafeSystem { if(!sSystemRunning) return; - coreinit::OSSchedulerEnd(); - Latte_Stop(); - // reset Cafe OS userspace modules - snd_core::reset(); - coreinit::OSAlarm_Shutdown(); - GX2::_GX2DriverReset(); - nn::save::ResetToDefaultState(); - coreinit::__OSDeleteAllActivePPCThreads(); - RPLLoader_UnloadAll(); + coreinit::OSSchedulerEnd(); + Latte_Stop(); + // reset Cafe OS userspace modules + snd_core::reset(); + coreinit::OSAlarm_Shutdown(); + GX2::_GX2DriverReset(); + nn::save::ResetToDefaultState(); + coreinit::__OSDeleteAllActivePPCThreads(); + RPLLoader_UnloadAll(); for(auto it = s_iosuModules.rbegin(); it != s_iosuModules.rend(); ++it) (*it)->TitleStop(); - // reset Cemu subsystems - PPCRecompiler_Shutdown(); - GraphicPack2::Reset(); - UnmountCurrentTitle(); - UnmountExtras(); - MlcStorageUnmountAllTitles(); - UnmountBaseDirectories(); - DestroyMemorySpace(); + // reset Cemu subsystems + PPCRecompiler_Shutdown(); + GraphicPack2::Reset(); + UnmountCurrentTitle(); + UnmountExtras(); + MlcStorageUnmountAllTitles(); + UnmountBaseDirectories(); + DestroyMemorySpace(); + LaunchSettings::ClearCosArgstr(); sSystemRunning = false; } diff --git a/src/config/LaunchSettings.cpp b/src/config/LaunchSettings.cpp index 10aec810..2d4a5316 100644 --- a/src/config/LaunchSettings.cpp +++ b/src/config/LaunchSettings.cpp @@ -71,9 +71,9 @@ bool LaunchSettings::HandleCommandline(const std::vector& args) ("account,a", po::value(), "Persistent id of account") - ("extra-mounts", po::wvalue>()->composing(), "A series of mounts in the form of: (path on host:path within emulated system, e.g. `/tmp:/vol/temporary/`)") + ("cos-mounts", po::wvalue>()->composing(), "A series of mounts in the form of: (path on host:path within emulated system, e.g. `/tmp:/vol/temporary/`)") ("forward-console-logging", "Forward OSReport, OSConsoleWrite, etc. to stdout/stderr.") - ("standalone-title-arguments", po::value(), "Custom arguments to pass as arguments to a standalone RPX that is launched.") + ("cos-argstr", po::value(), "A custom argstr used to override to the arguments to the first RPX that is launched, will be unset after the first launch.") ("force-interpreter", po::value()->implicit_value(true), "Force interpreter CPU emulation, disables recompiler. Useful for debugging purposes where you want to get accurate memory accesses and stack traces.") ("force-multicore-interpreter", po::value()->implicit_value(true), "Force multi-core interpreter CPU emulation, disables recompiler. Only useful for getting stack traces, but slightly faster than the single-core interpreter mode.") @@ -199,12 +199,12 @@ bool LaunchSettings::HandleCommandline(const std::vector& args) s_forward_console_logging = true; } - if (vm.count("standalone-title-arguments")) - s_standalone_title_arguments = vm["standalone-title-arguments"].as(); + if (vm.count("cos-argstr")) + s_cos_argstr = vm["cos-argstr"].as(); - if (vm.count("extra-mounts")) + if (vm.count("cos-mounts")) { - for (const auto& argument : vm["extra-mounts"].as>()) + for (const auto& argument : vm["cos-mounts"].as>()) { size_t colon_location = argument.find(L':'); if (colon_location == std::wstring::npos) @@ -213,7 +213,7 @@ bool LaunchSettings::HandleCommandline(const std::vector& args) continue; } - s_extra_mounts[argument.substr(0, colon_location)] = argument.substr(colon_location + 1); + s_cos_mounts[argument.substr(0, colon_location)] = argument.substr(colon_location + 1); } } diff --git a/src/config/LaunchSettings.h b/src/config/LaunchSettings.h index ffce3895..df52a84b 100644 --- a/src/config/LaunchSettings.h +++ b/src/config/LaunchSettings.h @@ -26,8 +26,9 @@ public: static bool Verbose() { return s_verbose; } static bool ForwardConsoleLogging() { return s_forward_console_logging; } - static std::optional StandaloneTitleArguments() { return s_standalone_title_arguments; } - static std::unordered_map& ExtraMounts() { return s_extra_mounts; } + static std::optional CosArgstr() { return s_cos_argstr; } + static void ClearCosArgstr() { s_cos_argstr.reset(); } + static std::unordered_map& CosMounts() { return s_cos_mounts; } static bool GDBStubEnabled() { return s_enable_gdbstub; } static bool NSightModeEnabled() { return s_nsight_mode; } @@ -51,8 +52,8 @@ private: inline static bool s_verbose = false; inline static bool s_forward_console_logging = false; - inline static std::optional s_standalone_title_arguments{}; - inline static std::unordered_map s_extra_mounts{}; + inline static std::optional s_cos_argstr{}; + inline static std::unordered_map s_cos_mounts{}; inline static bool s_enable_gdbstub = false; inline static bool s_nsight_mode = false;