Merge pull request #12570 from AdmiralCurtiss/system-ios
Core: Move Emulation IOS instance to System.
This commit is contained in:
commit
c61f9d92c7
|
@ -573,7 +573,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
||||||
// Because there is no TMD to get the requested system (IOS) version from,
|
// Because there is no TMD to get the requested system (IOS) version from,
|
||||||
// we default to IOS58, which is the version used by the Homebrew Channel.
|
// we default to IOS58, which is the version used by the Homebrew Channel.
|
||||||
SetupWiiMemory(system, IOS::HLE::IOSC::ConsoleType::Retail);
|
SetupWiiMemory(system, IOS::HLE::IOSC::ConsoleType::Retail);
|
||||||
IOS::HLE::GetIOS()->BootIOS(Titles::IOS(58));
|
system.GetIOS()->BootIOS(Titles::IOS(58));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -701,7 +701,7 @@ void UpdateStateFlags(std::function<void(StateFlags*)> update_function)
|
||||||
{
|
{
|
||||||
CreateSystemMenuTitleDirs();
|
CreateSystemMenuTitleDirs();
|
||||||
const std::string file_path = Common::GetTitleDataPath(Titles::SYSTEM_MENU) + "/" WII_STATE;
|
const std::string file_path = Common::GetTitleDataPath(Titles::SYSTEM_MENU) + "/" WII_STATE;
|
||||||
const auto fs = IOS::HLE::GetIOS()->GetFS();
|
const auto fs = Core::System::GetInstance().GetIOS()->GetFS();
|
||||||
constexpr IOS::HLE::FS::Mode rw_mode = IOS::HLE::FS::Mode::ReadWrite;
|
constexpr IOS::HLE::FS::Mode rw_mode = IOS::HLE::FS::Mode::ReadWrite;
|
||||||
const auto file = fs->CreateAndOpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, file_path,
|
const auto file = fs->CreateAndOpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, file_path,
|
||||||
{rw_mode, rw_mode, rw_mode});
|
{rw_mode, rw_mode, rw_mode});
|
||||||
|
@ -721,7 +721,7 @@ void UpdateStateFlags(std::function<void(StateFlags*)> update_function)
|
||||||
|
|
||||||
void CreateSystemMenuTitleDirs()
|
void CreateSystemMenuTitleDirs()
|
||||||
{
|
{
|
||||||
const auto& es = IOS::HLE::GetIOS()->GetESCore();
|
const auto& es = Core::System::GetInstance().GetIOS()->GetESCore();
|
||||||
es.CreateTitleDirectories(Titles::SYSTEM_MENU, IOS::SYSMENU_GID);
|
es.CreateTitleDirectories(Titles::SYSTEM_MENU, IOS::SYSMENU_GID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ bool CBoot::SetupWiiMemory(Core::System& system, IOS::HLE::IOSC::ConsoleType con
|
||||||
const std::string settings_file_path(Common::GetTitleDataPath(Titles::SYSTEM_MENU) +
|
const std::string settings_file_path(Common::GetTitleDataPath(Titles::SYSTEM_MENU) +
|
||||||
"/" WII_SETTING);
|
"/" WII_SETTING);
|
||||||
|
|
||||||
const auto fs = IOS::HLE::GetIOS()->GetFS();
|
const auto fs = system.GetIOS()->GetFS();
|
||||||
{
|
{
|
||||||
Common::SettingsHandler::Buffer data;
|
Common::SettingsHandler::Buffer data;
|
||||||
const auto file = fs->OpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, settings_file_path,
|
const auto file = fs->OpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, settings_file_path,
|
||||||
|
@ -502,7 +502,7 @@ static void WriteEmptyPlayRecord()
|
||||||
{
|
{
|
||||||
CreateSystemMenuTitleDirs();
|
CreateSystemMenuTitleDirs();
|
||||||
const std::string file_path = Common::GetTitleDataPath(Titles::SYSTEM_MENU) + "/play_rec.dat";
|
const std::string file_path = Common::GetTitleDataPath(Titles::SYSTEM_MENU) + "/play_rec.dat";
|
||||||
const auto fs = IOS::HLE::GetIOS()->GetFS();
|
const auto fs = Core::System::GetInstance().GetIOS()->GetFS();
|
||||||
constexpr IOS::HLE::FS::Mode rw_mode = IOS::HLE::FS::Mode::ReadWrite;
|
constexpr IOS::HLE::FS::Mode rw_mode = IOS::HLE::FS::Mode::ReadWrite;
|
||||||
const auto playrec_file = fs->CreateAndOpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, file_path,
|
const auto playrec_file = fs->CreateAndOpenFile(IOS::SYSMENU_UID, IOS::SYSMENU_GID, file_path,
|
||||||
{rw_mode, rw_mode, rw_mode});
|
{rw_mode, rw_mode, rw_mode});
|
||||||
|
@ -559,11 +559,11 @@ bool CBoot::EmulatedBS2_Wii(Core::System& system, const Core::CPUThreadGuard& gu
|
||||||
const u64 ios = ios_override >= 0 ? Titles::IOS(static_cast<u32>(ios_override)) : tmd.GetIOSId();
|
const u64 ios = ios_override >= 0 ? Titles::IOS(static_cast<u32>(ios_override)) : tmd.GetIOSId();
|
||||||
|
|
||||||
const auto console_type = volume.GetTicket(data_partition).GetConsoleType();
|
const auto console_type = volume.GetTicket(data_partition).GetConsoleType();
|
||||||
if (!SetupWiiMemory(system, console_type) || !IOS::HLE::GetIOS()->BootIOS(ios))
|
if (!SetupWiiMemory(system, console_type) || !system.GetIOS()->BootIOS(ios))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto di =
|
auto di =
|
||||||
std::static_pointer_cast<IOS::HLE::DIDevice>(IOS::HLE::GetIOS()->GetDeviceByName("/dev/di"));
|
std::static_pointer_cast<IOS::HLE::DIDevice>(system.GetIOS()->GetDeviceByName("/dev/di"));
|
||||||
|
|
||||||
di->InitializeIfFirstTime();
|
di->InitializeIfFirstTime();
|
||||||
di->ChangePartition(data_partition);
|
di->ChangePartition(data_partition);
|
||||||
|
@ -596,7 +596,7 @@ bool CBoot::EmulatedBS2_Wii(Core::System& system, const Core::CPUThreadGuard& gu
|
||||||
|
|
||||||
// Warning: This call will set incorrect running game metadata if our volume parameter
|
// Warning: This call will set incorrect running game metadata if our volume parameter
|
||||||
// doesn't point to the same disc as the one that's inserted in the emulated disc drive!
|
// doesn't point to the same disc as the one that's inserted in the emulated disc drive!
|
||||||
IOS::HLE::GetIOS()->GetESDevice()->DIVerify(tmd, volume.GetTicket(partition));
|
system.GetIOS()->GetESDevice()->DIVerify(tmd, volume.GetTicket(partition));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "Core/IOS/ES/Formats.h"
|
#include "Core/IOS/ES/Formats.h"
|
||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/IOS/IOSC.h"
|
#include "Core/IOS/IOSC.h"
|
||||||
|
#include "Core/System.h"
|
||||||
#include "Core/WiiUtils.h"
|
#include "Core/WiiUtils.h"
|
||||||
#include "DiscIO/VolumeWad.h"
|
#include "DiscIO/VolumeWad.h"
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ bool CBoot::BootNANDTitle(Core::System& system, const u64 title_id)
|
||||||
state->type = 0x04; // TYPE_NANDBOOT
|
state->type = 0x04; // TYPE_NANDBOOT
|
||||||
});
|
});
|
||||||
|
|
||||||
auto es = IOS::HLE::GetIOS()->GetESDevice();
|
auto es = system.GetIOS()->GetESDevice();
|
||||||
const IOS::ES::TicketReader ticket = es->GetCore().FindSignedTicket(title_id);
|
const IOS::ES::TicketReader ticket = es->GetCore().FindSignedTicket(title_id);
|
||||||
auto console_type = IOS::HLE::IOSC::ConsoleType::Retail;
|
auto console_type = IOS::HLE::IOSC::ConsoleType::Retail;
|
||||||
if (ticket.IsValid())
|
if (ticket.IsValid())
|
||||||
|
@ -34,7 +35,7 @@ bool CBoot::BootNANDTitle(Core::System& system, const u64 title_id)
|
||||||
|
|
||||||
bool CBoot::Boot_WiiWAD(Core::System& system, const DiscIO::VolumeWAD& wad)
|
bool CBoot::Boot_WiiWAD(Core::System& system, const DiscIO::VolumeWAD& wad)
|
||||||
{
|
{
|
||||||
if (!WiiUtils::InstallWAD(*IOS::HLE::GetIOS(), wad, WiiUtils::InstallType::Temporary))
|
if (!WiiUtils::InstallWAD(*system.GetIOS(), wad, WiiUtils::InstallType::Temporary))
|
||||||
{
|
{
|
||||||
PanicAlertFmtT("Cannot boot this WAD because it could not be installed to the NAND.");
|
PanicAlertFmtT("Cannot boot this WAD because it could not be installed to the NAND.");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ void UpdateWantDeterminism(bool initial)
|
||||||
|
|
||||||
RunAsCPUThread([&] {
|
RunAsCPUThread([&] {
|
||||||
s_wants_determinism = new_want_determinism;
|
s_wants_determinism = new_want_determinism;
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
const auto ios = system.GetIOS();
|
||||||
if (ios)
|
if (ios)
|
||||||
ios->UpdateWantDeterminism(new_want_determinism);
|
ios->UpdateWantDeterminism(new_want_determinism);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ void Init(Core::System& system, const Sram* override_sram)
|
||||||
void Shutdown(Core::System& system)
|
void Shutdown(Core::System& system)
|
||||||
{
|
{
|
||||||
// IOS should always be shut down regardless of IsWii because it can be running in GC mode (MIOS).
|
// IOS should always be shut down regardless of IsWii because it can be running in GC mode (MIOS).
|
||||||
IOS::HLE::Shutdown(); // Depends on Memory
|
IOS::HLE::Shutdown(system); // Depends on Memory
|
||||||
system.GetWiiIPC().Shutdown();
|
system.GetWiiIPC().Shutdown();
|
||||||
|
|
||||||
system.GetSystemTimers().Shutdown();
|
system.GetSystemTimers().Shutdown();
|
||||||
|
@ -111,7 +111,7 @@ void DoState(Core::System& system, PointerWrap& p)
|
||||||
{
|
{
|
||||||
system.GetWiiIPC().DoState(p);
|
system.GetWiiIPC().DoState(p);
|
||||||
p.DoMarker("IOS");
|
p.DoMarker("IOS");
|
||||||
IOS::HLE::GetIOS()->DoState(p);
|
system.GetIOS()->DoState(p);
|
||||||
p.DoMarker("IOS::HLE");
|
p.DoMarker("IOS::HLE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ void ProcessorInterfaceManager::ToggleResetButtonCallback(Core::System& system,
|
||||||
void ProcessorInterfaceManager::IOSNotifyResetButtonCallback(Core::System& system, u64 userdata,
|
void ProcessorInterfaceManager::IOSNotifyResetButtonCallback(Core::System& system, u64 userdata,
|
||||||
s64 cyclesLate)
|
s64 cyclesLate)
|
||||||
{
|
{
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
const auto ios = system.GetIOS();
|
||||||
if (!ios)
|
if (!ios)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ void ProcessorInterfaceManager::IOSNotifyResetButtonCallback(Core::System& syste
|
||||||
void ProcessorInterfaceManager::IOSNotifyPowerButtonCallback(Core::System& system, u64 userdata,
|
void ProcessorInterfaceManager::IOSNotifyPowerButtonCallback(Core::System& system, u64 userdata,
|
||||||
s64 cyclesLate)
|
s64 cyclesLate)
|
||||||
{
|
{
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
const auto ios = system.GetIOS();
|
||||||
if (!ios)
|
if (!ios)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void SystemTimersManager::IPC_HLE_UpdateCallback(Core::System& system, u64 userd
|
||||||
{
|
{
|
||||||
if (system.IsWii())
|
if (system.IsWii())
|
||||||
{
|
{
|
||||||
IOS::HLE::GetIOS()->UpdateDevices();
|
system.GetIOS()->UpdateDevices();
|
||||||
auto& system_timers = system.GetSystemTimers();
|
auto& system_timers = system.GetSystemTimers();
|
||||||
system.GetCoreTiming().ScheduleEvent(system_timers.m_ipc_hle_period - cycles_late,
|
system.GetCoreTiming().ScheduleEvent(system_timers.m_ipc_hle_period - cycles_late,
|
||||||
system_timers.m_event_type_ipc_hle);
|
system_timers.m_event_type_ipc_hle);
|
||||||
|
|
|
@ -140,8 +140,8 @@ void WiiIPC::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
if ((val >> 2 & 1 && wii_ipc.m_ctrl.IY1) || (val >> 1 & 1 && wii_ipc.m_ctrl.IY2))
|
if ((val >> 2 & 1 && wii_ipc.m_ctrl.IY1) || (val >> 1 & 1 && wii_ipc.m_ctrl.IY2))
|
||||||
wii_ipc.m_ppc_irq_flags |= INT_CAUSE_IPC_BROADWAY;
|
wii_ipc.m_ppc_irq_flags |= INT_CAUSE_IPC_BROADWAY;
|
||||||
if (wii_ipc.m_ctrl.X1)
|
if (wii_ipc.m_ctrl.X1)
|
||||||
HLE::GetIOS()->EnqueueIPCRequest(wii_ipc.m_ppc_msg);
|
system.GetIOS()->EnqueueIPCRequest(wii_ipc.m_ppc_msg);
|
||||||
HLE::GetIOS()->UpdateIPC();
|
system.GetIOS()->UpdateIPC();
|
||||||
system.GetCoreTiming().ScheduleEvent(0, wii_ipc.m_event_type_update_interrupts,
|
system.GetCoreTiming().ScheduleEvent(0, wii_ipc.m_event_type_update_interrupts,
|
||||||
0);
|
0);
|
||||||
}));
|
}));
|
||||||
|
@ -152,7 +152,7 @@ void WiiIPC::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
MMIO::ComplexWrite<u32>([](Core::System& system, u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](Core::System& system, u32, u32 val) {
|
||||||
auto& wii_ipc = system.GetWiiIPC();
|
auto& wii_ipc = system.GetWiiIPC();
|
||||||
wii_ipc.m_ppc_irq_flags &= ~val;
|
wii_ipc.m_ppc_irq_flags &= ~val;
|
||||||
HLE::GetIOS()->UpdateIPC();
|
system.GetIOS()->UpdateIPC();
|
||||||
system.GetCoreTiming().ScheduleEvent(0, wii_ipc.m_event_type_update_interrupts,
|
system.GetCoreTiming().ScheduleEvent(0, wii_ipc.m_event_type_update_interrupts,
|
||||||
0);
|
0);
|
||||||
}));
|
}));
|
||||||
|
@ -163,7 +163,7 @@ void WiiIPC::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
wii_ipc.m_ppc_irq_masks = val;
|
wii_ipc.m_ppc_irq_masks = val;
|
||||||
if (wii_ipc.m_ppc_irq_masks & INT_CAUSE_IPC_BROADWAY) // wtf?
|
if (wii_ipc.m_ppc_irq_masks & INT_CAUSE_IPC_BROADWAY) // wtf?
|
||||||
wii_ipc.Reset();
|
wii_ipc.Reset();
|
||||||
HLE::GetIOS()->UpdateIPC();
|
system.GetIOS()->UpdateIPC();
|
||||||
system.GetCoreTiming().ScheduleEvent(0, wii_ipc.m_event_type_update_interrupts,
|
system.GetCoreTiming().ScheduleEvent(0, wii_ipc.m_event_type_update_interrupts,
|
||||||
0);
|
0);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -602,7 +602,7 @@ std::optional<DIDevice::DIResult> DIDevice::StartImmediateTransfer(const IOCtlRe
|
||||||
|
|
||||||
static std::shared_ptr<DIDevice> GetDevice()
|
static std::shared_ptr<DIDevice> GetDevice()
|
||||||
{
|
{
|
||||||
auto ios = GetIOS();
|
auto ios = Core::System::GetInstance().GetIOS();
|
||||||
if (!ios)
|
if (!ios)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto di = ios->GetDeviceByName("/dev/di");
|
auto di = ios->GetDeviceByName("/dev/di");
|
||||||
|
|
|
@ -28,7 +28,7 @@ OpenRequest::OpenRequest(Core::System& system, const u32 address_) : Request(sys
|
||||||
auto& memory = system.GetMemory();
|
auto& memory = system.GetMemory();
|
||||||
path = memory.GetString(memory.Read_U32(address + 0xc));
|
path = memory.GetString(memory.Read_U32(address + 0xc));
|
||||||
flags = static_cast<OpenMode>(memory.Read_U32(address + 0x10));
|
flags = static_cast<OpenMode>(memory.Read_U32(address + 0x10));
|
||||||
const EmulationKernel* ios = GetIOS();
|
const EmulationKernel* ios = system.GetIOS();
|
||||||
if (ios)
|
if (ios)
|
||||||
{
|
{
|
||||||
uid = ios->GetUidForPPC();
|
uid = ios->GetUidForPPC();
|
||||||
|
|
|
@ -131,15 +131,15 @@ void ESDevice::InitializeEmulationState(CoreTiming::CoreTimingManager& core_timi
|
||||||
{
|
{
|
||||||
s_finish_init_event =
|
s_finish_init_event =
|
||||||
core_timing.RegisterEvent("IOS-ESFinishInit", [](Core::System& system_, u64, s64) {
|
core_timing.RegisterEvent("IOS-ESFinishInit", [](Core::System& system_, u64, s64) {
|
||||||
GetIOS()->GetESDevice()->FinishInit();
|
system_.GetIOS()->GetESDevice()->FinishInit();
|
||||||
});
|
});
|
||||||
s_reload_ios_for_ppc_launch_event = core_timing.RegisterEvent(
|
s_reload_ios_for_ppc_launch_event = core_timing.RegisterEvent(
|
||||||
"IOS-ESReloadIOSForPPCLaunch", [](Core::System& system_, u64 ios_id, s64) {
|
"IOS-ESReloadIOSForPPCLaunch", [](Core::System& system_, u64 ios_id, s64) {
|
||||||
GetIOS()->GetESDevice()->LaunchTitle(ios_id, HangPPC::Yes);
|
system_.GetIOS()->GetESDevice()->LaunchTitle(ios_id, HangPPC::Yes);
|
||||||
});
|
});
|
||||||
s_bootstrap_ppc_for_launch_event =
|
s_bootstrap_ppc_for_launch_event =
|
||||||
core_timing.RegisterEvent("IOS-ESBootstrapPPCForLaunch", [](Core::System& system_, u64, s64) {
|
core_timing.RegisterEvent("IOS-ESBootstrapPPCForLaunch", [](Core::System& system_, u64, s64) {
|
||||||
GetIOS()->GetESDevice()->BootstrapPPC();
|
system_.GetIOS()->GetESDevice()->BootstrapPPC();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,6 @@
|
||||||
|
|
||||||
namespace IOS::HLE
|
namespace IOS::HLE
|
||||||
{
|
{
|
||||||
static std::unique_ptr<EmulationKernel> s_ios;
|
|
||||||
|
|
||||||
constexpr u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
|
constexpr u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
|
||||||
static CoreTiming::EventType* s_event_enqueue;
|
static CoreTiming::EventType* s_event_enqueue;
|
||||||
static CoreTiming::EventType* s_event_finish_ppc_bootstrap;
|
static CoreTiming::EventType* s_event_finish_ppc_bootstrap;
|
||||||
|
@ -284,7 +282,7 @@ Kernel::Kernel(IOSC::ConsoleType console_type) : m_iosc(console_type)
|
||||||
{
|
{
|
||||||
// Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static,
|
// Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static,
|
||||||
// using more than one IOS instance at a time is not supported.
|
// using more than one IOS instance at a time is not supported.
|
||||||
ASSERT(GetIOS() == nullptr);
|
ASSERT(Core::System::GetInstance().GetIOS() == nullptr);
|
||||||
|
|
||||||
m_is_responsible_for_nand_root = !Core::WiiRootIsInitialized();
|
m_is_responsible_for_nand_root = !Core::WiiRootIsInitialized();
|
||||||
if (m_is_responsible_for_nand_root)
|
if (m_is_responsible_for_nand_root)
|
||||||
|
@ -477,8 +475,8 @@ private:
|
||||||
static void FinishIOSBoot(Core::System& system, u64 ios_title_id)
|
static void FinishIOSBoot(Core::System& system, u64 ios_title_id)
|
||||||
{
|
{
|
||||||
// Shut down the active IOS first before switching to the new one.
|
// Shut down the active IOS first before switching to the new one.
|
||||||
s_ios.reset();
|
system.SetIOS(nullptr);
|
||||||
s_ios = std::make_unique<EmulationKernel>(system, ios_title_id);
|
system.SetIOS(std::make_unique<EmulationKernel>(system, ios_title_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr SystemTimers::TimeBaseTick GetIOSBootTicks(u32 version)
|
static constexpr SystemTimers::TimeBaseTick GetIOSBootTicks(u32 version)
|
||||||
|
@ -959,8 +957,9 @@ void Init(Core::System& system)
|
||||||
|
|
||||||
s_event_enqueue =
|
s_event_enqueue =
|
||||||
core_timing.RegisterEvent("IPCEvent", [](Core::System& system_, u64 userdata, s64) {
|
core_timing.RegisterEvent("IPCEvent", [](Core::System& system_, u64 userdata, s64) {
|
||||||
if (s_ios)
|
auto* ios = system_.GetIOS();
|
||||||
s_ios->HandleIPCEvent(userdata);
|
if (ios)
|
||||||
|
ios->HandleIPCEvent(userdata);
|
||||||
});
|
});
|
||||||
|
|
||||||
ESDevice::InitializeEmulationState(core_timing);
|
ESDevice::InitializeEmulationState(core_timing);
|
||||||
|
@ -976,7 +975,7 @@ void Init(Core::System& system)
|
||||||
core_timing.RegisterEvent("FinishDICommand", DIDevice::FinishDICommandCallback);
|
core_timing.RegisterEvent("FinishDICommand", DIDevice::FinishDICommandCallback);
|
||||||
|
|
||||||
// Start with IOS80 to simulate part of the Wii boot process.
|
// Start with IOS80 to simulate part of the Wii boot process.
|
||||||
s_ios = std::make_unique<EmulationKernel>(system, Titles::SYSTEM_MENU_IOS);
|
system.SetIOS(std::make_unique<EmulationKernel>(system, Titles::SYSTEM_MENU_IOS));
|
||||||
// On a Wii, boot2 launches the system menu IOS, which then launches the system menu
|
// On a Wii, boot2 launches the system menu IOS, which then launches the system menu
|
||||||
// (which bootstraps the PPC). Bootstrapping the PPC results in memory values being set up.
|
// (which bootstraps the PPC). Bootstrapping the PPC results in memory values being set up.
|
||||||
// This means that the constants in the 0x3100 region are always set up by the time
|
// This means that the constants in the 0x3100 region are always set up by the time
|
||||||
|
@ -985,17 +984,12 @@ void Init(Core::System& system)
|
||||||
SetupMemory(system.GetMemory(), Titles::SYSTEM_MENU_IOS, MemorySetupType::Full);
|
SetupMemory(system.GetMemory(), Titles::SYSTEM_MENU_IOS, MemorySetupType::Full);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown(Core::System& system)
|
||||||
{
|
{
|
||||||
s_ios.reset();
|
system.SetIOS(nullptr);
|
||||||
ESDevice::FinalizeEmulationState();
|
ESDevice::FinalizeEmulationState();
|
||||||
}
|
}
|
||||||
|
|
||||||
EmulationKernel* GetIOS()
|
|
||||||
{
|
|
||||||
return s_ios.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Based on a hardware test, a device takes at least ~2700 ticks to reply to an IPC request.
|
// Based on a hardware test, a device takes at least ~2700 ticks to reply to an IPC request.
|
||||||
// Depending on how much work a command performs, this can take much longer (10000+)
|
// Depending on how much work a command performs, this can take much longer (10000+)
|
||||||
// especially if the NAND filesystem is accessed.
|
// especially if the NAND filesystem is accessed.
|
||||||
|
|
|
@ -217,7 +217,6 @@ private:
|
||||||
|
|
||||||
// Used for controlling and accessing an IOS instance that is tied to emulation.
|
// Used for controlling and accessing an IOS instance that is tied to emulation.
|
||||||
void Init(Core::System& system);
|
void Init(Core::System& system);
|
||||||
void Shutdown();
|
void Shutdown(Core::System& system);
|
||||||
EmulationKernel* GetIOS();
|
|
||||||
|
|
||||||
} // namespace IOS::HLE
|
} // namespace IOS::HLE
|
||||||
|
|
|
@ -61,6 +61,8 @@ struct System::Impl
|
||||||
bool m_sound_stream_running = false;
|
bool m_sound_stream_running = false;
|
||||||
bool m_audio_dump_started = false;
|
bool m_audio_dump_started = false;
|
||||||
|
|
||||||
|
std::unique_ptr<IOS::HLE::EmulationKernel> m_ios;
|
||||||
|
|
||||||
AudioInterface::AudioInterfaceManager m_audio_interface;
|
AudioInterface::AudioInterfaceManager m_audio_interface;
|
||||||
CoreTiming::CoreTimingManager m_core_timing;
|
CoreTiming::CoreTimingManager m_core_timing;
|
||||||
CommandProcessor::CommandProcessorManager m_command_processor;
|
CommandProcessor::CommandProcessorManager m_command_processor;
|
||||||
|
@ -140,6 +142,16 @@ void System::SetAudioDumpStarted(bool started)
|
||||||
m_impl->m_audio_dump_started = started;
|
m_impl->m_audio_dump_started = started;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOS::HLE::EmulationKernel* System::GetIOS() const
|
||||||
|
{
|
||||||
|
return m_impl->m_ios.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void System::SetIOS(std::unique_ptr<IOS::HLE::EmulationKernel> ios)
|
||||||
|
{
|
||||||
|
m_impl->m_ios = std::move(ios);
|
||||||
|
}
|
||||||
|
|
||||||
AudioInterface::AudioInterfaceManager& System::GetAudioInterface() const
|
AudioInterface::AudioInterfaceManager& System::GetAudioInterface() const
|
||||||
{
|
{
|
||||||
return m_impl->m_audio_interface;
|
return m_impl->m_audio_interface;
|
||||||
|
|
|
@ -53,6 +53,10 @@ namespace GPFifo
|
||||||
{
|
{
|
||||||
class GPFifoManager;
|
class GPFifoManager;
|
||||||
}
|
}
|
||||||
|
namespace IOS::HLE
|
||||||
|
{
|
||||||
|
class EmulationKernel;
|
||||||
|
}
|
||||||
namespace HSP
|
namespace HSP
|
||||||
{
|
{
|
||||||
class HSPManager;
|
class HSPManager;
|
||||||
|
@ -148,6 +152,9 @@ public:
|
||||||
bool IsAudioDumpStarted() const;
|
bool IsAudioDumpStarted() const;
|
||||||
void SetAudioDumpStarted(bool started);
|
void SetAudioDumpStarted(bool started);
|
||||||
|
|
||||||
|
IOS::HLE::EmulationKernel* GetIOS() const;
|
||||||
|
void SetIOS(std::unique_ptr<IOS::HLE::EmulationKernel> ios);
|
||||||
|
|
||||||
AudioInterface::AudioInterfaceManager& GetAudioInterface() const;
|
AudioInterface::AudioInterfaceManager& GetAudioInterface() const;
|
||||||
CPU::CPUManager& GetCPU() const;
|
CPU::CPUManager& GetCPU() const;
|
||||||
CoreTiming::CoreTimingManager& GetCoreTiming() const;
|
CoreTiming::CoreTimingManager& GetCoreTiming() const;
|
||||||
|
|
|
@ -321,7 +321,7 @@ void InitializeWiiFileSystemContents(
|
||||||
std::optional<DiscIO::Riivolution::SavegameRedirect> save_redirect,
|
std::optional<DiscIO::Riivolution::SavegameRedirect> save_redirect,
|
||||||
const BootSessionData& boot_session_data)
|
const BootSessionData& boot_session_data)
|
||||||
{
|
{
|
||||||
const auto fs = IOS::HLE::GetIOS()->GetFS();
|
const auto fs = Core::System::GetInstance().GetIOS()->GetFS();
|
||||||
|
|
||||||
// Some games (such as Mario Kart Wii) assume that NWC24 files will always be present
|
// Some games (such as Mario Kart Wii) assume that NWC24 files will always be present
|
||||||
// even upon the first launch as they are normally created by the system menu.
|
// even upon the first launch as they are normally created by the system menu.
|
||||||
|
@ -397,7 +397,7 @@ void CleanUpWiiFileSystemContents(const BootSessionData& boot_session_data)
|
||||||
File::MoveWithOverwrite(redirect.temp_path, redirect.real_path);
|
File::MoveWithOverwrite(redirect.temp_path, redirect.real_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
IOS::HLE::EmulationKernel* ios = IOS::HLE::GetIOS();
|
IOS::HLE::EmulationKernel* ios = Core::System::GetInstance().GetIOS();
|
||||||
|
|
||||||
// clear the redirects in the session FS, otherwise the back-copy might grab redirected files
|
// clear the redirects in the session FS, otherwise the back-copy might grab redirected files
|
||||||
s_nand_redirects.clear();
|
s_nand_redirects.clear();
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
||||||
#include "Core/IOS/Uids.h"
|
#include "Core/IOS/Uids.h"
|
||||||
#include "Core/SysConf.h"
|
#include "Core/SysConf.h"
|
||||||
|
#include "Core/System.h"
|
||||||
#include "DiscIO/DiscExtractor.h"
|
#include "DiscIO/DiscExtractor.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "DiscIO/Filesystem.h"
|
#include "DiscIO/Filesystem.h"
|
||||||
|
@ -1004,7 +1005,7 @@ bool RepairNAND(IOS::HLE::Kernel& ios)
|
||||||
|
|
||||||
static std::shared_ptr<IOS::HLE::Device> GetBluetoothDevice()
|
static std::shared_ptr<IOS::HLE::Device> GetBluetoothDevice()
|
||||||
{
|
{
|
||||||
auto* ios = IOS::HLE::GetIOS();
|
auto* ios = Core::System::GetInstance().GetIOS();
|
||||||
return ios ? ios->GetDeviceByName("/dev/usb/oh1/57e/305") : nullptr;
|
return ios ? ios->GetDeviceByName("/dev/usb/oh1/57e/305") : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,12 @@ void Platform::UpdateRunningFlag()
|
||||||
{
|
{
|
||||||
if (m_shutdown_requested.TestAndClear())
|
if (m_shutdown_requested.TestAndClear())
|
||||||
{
|
{
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
auto& system = Core::System::GetInstance();
|
||||||
|
const auto ios = system.GetIOS();
|
||||||
const auto stm = ios ? ios->GetDeviceByName("/dev/stm/eventhook") : nullptr;
|
const auto stm = ios ? ios->GetDeviceByName("/dev/stm/eventhook") : nullptr;
|
||||||
if (!m_tried_graceful_shutdown.IsSet() && stm &&
|
if (!m_tried_graceful_shutdown.IsSet() && stm &&
|
||||||
std::static_pointer_cast<IOS::HLE::STMEventHookDevice>(stm)->HasHookInstalled())
|
std::static_pointer_cast<IOS::HLE::STMEventHookDevice>(stm)->HasHookInstalled())
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
system.GetProcessorInterface().PowerButton_Tap();
|
system.GetProcessorInterface().PowerButton_Tap();
|
||||||
m_tried_graceful_shutdown.Set();
|
m_tried_graceful_shutdown.Set();
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ void WiimoteControllersWidget::ConnectWidgets()
|
||||||
|
|
||||||
void WiimoteControllersWidget::OnBluetoothPassthroughResetPressed()
|
void WiimoteControllersWidget::OnBluetoothPassthroughResetPressed()
|
||||||
{
|
{
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
const auto ios = Core::System::GetInstance().GetIOS();
|
||||||
|
|
||||||
if (!ios)
|
if (!ios)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ void WiimoteControllersWidget::OnBluetoothPassthroughResetPressed()
|
||||||
|
|
||||||
void WiimoteControllersWidget::OnBluetoothPassthroughSyncPressed()
|
void WiimoteControllersWidget::OnBluetoothPassthroughSyncPressed()
|
||||||
{
|
{
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
const auto ios = Core::System::GetInstance().GetIOS();
|
||||||
|
|
||||||
if (!ios)
|
if (!ios)
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,7 +252,7 @@ void NetworkWidget::Update()
|
||||||
// needed because there's a race condition on the IOS instance otherwise
|
// needed because there's a race condition on the IOS instance otherwise
|
||||||
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||||
|
|
||||||
auto* ios = IOS::HLE::GetIOS();
|
auto* ios = guard.GetSystem().GetIOS();
|
||||||
if (!ios)
|
if (!ios)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@ void SetUserDirectory(std::string custom_path)
|
||||||
|
|
||||||
bool TriggerSTMPowerEvent()
|
bool TriggerSTMPowerEvent()
|
||||||
{
|
{
|
||||||
const auto ios = IOS::HLE::GetIOS();
|
const auto ios = Core::System::GetInstance().GetIOS();
|
||||||
if (!ios)
|
if (!ios)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue