From 9130ad8fbee4d32a6456e73c59df961870d76f85 Mon Sep 17 00:00:00 2001 From: Zachary Lockwood Date: Sun, 20 Mar 2022 09:47:06 -0400 Subject: [PATCH] Add support for overriding the IOS that boots with a wii game --- Source/Core/Core/Boot/Boot_BS2Emu.cpp | 5 ++++- Source/Core/Core/Config/MainSettings.cpp | 1 + Source/Core/Core/Config/MainSettings.h | 1 + Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index 8903985453..1265317a90 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -478,8 +478,11 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::VolumeDisc& volume, Memory::Write_U32(0, 0x3194); Memory::Write_U32(static_cast(data_partition.offset >> 2), 0x3198); + const s32 ios_override = Config::Get(Config::MAIN_OVERRIDE_BOOT_IOS); + const u64 ios = ios_override >= 0 ? Titles::IOS(static_cast(ios_override)) : tmd.GetIOSId(); + const auto console_type = volume.GetTicket(data_partition).GetConsoleType(); - if (!SetupWiiMemory(console_type) || !IOS::HLE::GetIOS()->BootIOS(tmd.GetIOSId())) + if (!SetupWiiMemory(console_type) || !IOS::HLE::GetIOS()->BootIOS(ios)) return false; auto di = diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 506663b9ec..502f106c65 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -182,6 +182,7 @@ const Info MAIN_GFX_BACKEND{{System::Main, "Core", "GFXBackend"}, const Info MAIN_GPU_DETERMINISM_MODE{{System::Main, "Core", "GPUDeterminismMode"}, "auto"}; +const Info MAIN_OVERRIDE_BOOT_IOS{{System::Main, "Core", "OverrideBootIOS"}, -1}; GPUDeterminismMode GetGPUDeterminismMode() { diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index cec5cf45b7..638d52d226 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -130,6 +130,7 @@ extern const Info MAIN_ALLOW_SD_WRITES; extern const Info MAIN_ENABLE_SAVESTATES; extern const Info MAIN_FALLBACK_REGION; extern const Info MAIN_REAL_WII_REMOTE_REPEAT_REPORTS; +extern const Info MAIN_OVERRIDE_BOOT_IOS; // Main.DSP diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index 2dd5a5697d..0026205144 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -126,6 +126,7 @@ bool IsSettingSaveable(const Config::Location& config_location) &Config::MAIN_SYNC_GPU_MAX_DISTANCE.GetLocation(), &Config::MAIN_SYNC_GPU_MIN_DISTANCE.GetLocation(), &Config::MAIN_SYNC_GPU_OVERCLOCK.GetLocation(), + &Config::MAIN_OVERRIDE_BOOT_IOS.GetLocation(), // UI.General