debug: add CLI option to have multi-core interpreter (#1553)

This option still allows you to have proper stack traces for crashes or for the PPC debugger, but is a lot faster then the really slow interpreter (especially when loading into large games like BotW where there has to be a lot of asset decompressing). It makes memory access breakpoints much more brittle though, so it's not a perfect option.

Normal users should of course stick with using the recompiler.
This commit is contained in:
Crementif 2025-05-04 18:04:26 +02:00 committed by GitHub
parent d083fc0470
commit 352a918494
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 4 deletions

View file

@ -844,7 +844,7 @@ namespace CafeSystem
module->TitleStart(); module->TitleStart();
cemu_initForGame(); cemu_initForGame();
// enter scheduler // enter scheduler
if (ActiveSettings::GetCPUMode() == CPUMode::MulticoreRecompiler && !LaunchSettings::ForceInterpreter()) if ((ActiveSettings::GetCPUMode() == CPUMode::MulticoreRecompiler || LaunchSettings::ForceMultiCoreInterpreter()) && !LaunchSettings::ForceInterpreter())
coreinit::OSSchedulerBegin(3); coreinit::OSSchedulerBegin(3);
else else
coreinit::OSSchedulerBegin(1); coreinit::OSSchedulerBegin(1);

View file

@ -669,9 +669,9 @@ void PPCRecompiler_init()
ppcRecompilerEnabled = false; ppcRecompilerEnabled = false;
return; return;
} }
if (LaunchSettings::ForceInterpreter()) if (LaunchSettings::ForceInterpreter() || LaunchSettings::ForceMultiCoreInterpreter())
{ {
cemuLog_log(LogType::Force, "Recompiler disabled. Command line --force-interpreter was passed"); cemuLog_log(LogType::Force, "Recompiler disabled. Command line --force-interpreter or force-multicore-interpreter was passed");
return; return;
} }
if (ppcRecompilerInstanceData) if (ppcRecompilerInstanceData)

View file

@ -69,7 +69,8 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
("account,a", po::value<std::string>(), "Persistent id of account") ("account,a", po::value<std::string>(), "Persistent id of account")
("force-interpreter", po::value<bool>()->implicit_value(true), "Force interpreter CPU emulation, disables recompiler") ("force-interpreter", po::value<bool>()->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<bool>()->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.")
("enable-gdbstub", po::value<bool>()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger"); ("enable-gdbstub", po::value<bool>()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger");
po::options_description hidden{ "Hidden options" }; po::options_description hidden{ "Hidden options" };
@ -176,6 +177,9 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
if(vm.count("force-interpreter")) if(vm.count("force-interpreter"))
s_force_interpreter = vm["force-interpreter"].as<bool>(); s_force_interpreter = vm["force-interpreter"].as<bool>();
if(vm.count("force-multicore-interpreter"))
s_force_multicore_interpreter = vm["force-multicore-interpreter"].as<bool>();
if (vm.count("enable-gdbstub")) if (vm.count("enable-gdbstub"))
s_enable_gdbstub = vm["enable-gdbstub"].as<bool>(); s_enable_gdbstub = vm["enable-gdbstub"].as<bool>();

View file

@ -26,6 +26,7 @@ public:
static bool NSightModeEnabled() { return s_nsight_mode; } static bool NSightModeEnabled() { return s_nsight_mode; }
static bool ForceInterpreter() { return s_force_interpreter; }; static bool ForceInterpreter() { return s_force_interpreter; };
static bool ForceMultiCoreInterpreter() { return s_force_multicore_interpreter; }
static std::optional<uint32> GetPersistentId() { return s_persistent_id; } static std::optional<uint32> GetPersistentId() { return s_persistent_id; }
@ -44,6 +45,7 @@ private:
inline static bool s_nsight_mode = false; inline static bool s_nsight_mode = false;
inline static bool s_force_interpreter = false; inline static bool s_force_interpreter = false;
inline static bool s_force_multicore_interpreter = false;
inline static std::optional<uint32> s_persistent_id{}; inline static std::optional<uint32> s_persistent_id{};