diff --git a/Source/Core/Core/IOS/IPC.cpp b/Source/Core/Core/IOS/IPC.cpp index 85f30f2752..6655b5f6da 100644 --- a/Source/Core/Core/IOS/IPC.cpp +++ b/Source/Core/Core/IOS/IPC.cpp @@ -86,6 +86,8 @@ static CoreTiming::EventType* s_event_sdio_notify; static u64 s_last_reply_time; +static u64 s_active_title_id; + static constexpr u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL; static constexpr u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x200000000ULL; @@ -412,6 +414,14 @@ static void SDIO_EventNotify_CPUThread(u64 userdata, s64 cycles_late) device->EventNotify(); } +// The title ID is a u64 where the first 32 bits are used for the title type. +// For IOS title IDs, the type will always be 00000001 (system), and the lower 32 bits +// are used for the IOS major version -- which is what we want here. +u32 GetVersion() +{ + return static_cast(s_active_title_id); +} + bool SetupMemory(u64 ios_title_id) { auto target_imv = std::find_if( @@ -424,6 +434,8 @@ bool SetupMemory(u64 ios_title_id) return false; } + s_active_title_id = ios_title_id; + Memory::Write_U32(target_imv->mem1_physical_size, ADDR_MEM1_SIZE); Memory::Write_U32(target_imv->mem1_simulated_size, ADDR_MEM1_SIM_SIZE); Memory::Write_U32(target_imv->mem1_end, ADDR_MEM1_END); diff --git a/Source/Core/Core/IOS/IPC.h b/Source/Core/Core/IOS/IPC.h index 79549b2e9e..7508be12f9 100644 --- a/Source/Core/Core/IOS/IPC.h +++ b/Source/Core/Core/IOS/IPC.h @@ -51,6 +51,8 @@ void Init(); // Needs to be called after Reset(true) to recreate the device tree void Reinit(); +u32 GetVersion(); + bool SetupMemory(u64 ios_title_id); // Shutdown