From 0f74f1ffb3500daa733d07d2e3c7ea8dae13e71e Mon Sep 17 00:00:00 2001 From: Sepalani Date: Tue, 2 May 2017 20:47:47 +0100 Subject: [PATCH] HLE: Use a proper apploader OSReport --- Source/Core/Core/Boot/Boot_BS2Emu.cpp | 8 ++++---- Source/Core/Core/HLE/HLE.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index a42da732b5..72a3b8359e 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -111,8 +111,6 @@ bool CBoot::EmulatedBS2_GC(bool skip_app_loader) // HIO checks this // PowerPC::HostWrite_U16(0x8200, 0x000030e6); // Console type - HLE::Patch(0x81300000, "OSReport"); // HLE OSReport for Apploader - if (!DVDInterface::IsDiscInside()) return false; @@ -163,6 +161,7 @@ bool CBoot::EmulatedBS2_GC(bool skip_app_loader) // iAppLoaderInit DEBUG_LOG(MASTER_LOG, "Call iAppLoaderInit"); + HLE::Patch(0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader PowerPC::ppcState.gpr[3] = 0x81300000; RunFunction(iAppLoaderInit); @@ -191,6 +190,7 @@ bool CBoot::EmulatedBS2_GC(bool skip_app_loader) // iAppLoaderClose DEBUG_LOG(MASTER_LOG, "call iAppLoaderClose"); RunFunction(iAppLoaderClose); + HLE::UnPatch("AppLoaderReport"); // return PC = PowerPC::ppcState.gpr[3]; @@ -358,8 +358,6 @@ bool CBoot::EmulatedBS2_Wii() Memory::Write_U32(0x4c000064, 0x00000800); // Write default FPU Handler: rfi Memory::Write_U32(0x4c000064, 0x00000C00); // Write default Syscall Handler: rfi - HLE::Patch(0x81300000, "OSReport"); // HLE OSReport for Apploader - PowerPC::ppcState.gpr[1] = 0x816ffff0; // StackPointer // Execute the apploader @@ -391,6 +389,7 @@ bool CBoot::EmulatedBS2_Wii() // iAppLoaderInit DEBUG_LOG(BOOT, "Run iAppLoaderInit"); + HLE::Patch(0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader PowerPC::ppcState.gpr[3] = 0x81300000; RunFunction(iAppLoaderInit); @@ -416,6 +415,7 @@ bool CBoot::EmulatedBS2_Wii() // iAppLoaderClose DEBUG_LOG(BOOT, "Run iAppLoaderClose"); RunFunction(iAppLoaderClose); + HLE::UnPatch("AppLoaderReport"); IOS::HLE::Device::ES::DIVerify(tmd, DVDInterface::GetVolume().GetTicket()); diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp index 3135b9ea82..4671ce1fd8 100644 --- a/Source/Core/Core/HLE/HLE.cpp +++ b/Source/Core/Core/HLE/HLE.cpp @@ -57,7 +57,7 @@ static const SPatch OSPatches[] = { // This needs to be put before vprintf (because vprintf is called indirectly by this) {"JUTWarningConsole_f", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, - {"OSReport", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_REPLACE, HLE_TYPE_DEBUG}, // apploader needs OSReport replace hook + {"OSReport", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, {"DEBUGPrint", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, {"WUD_DEBUGPrint", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, {"vprintf", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_START, HLE_TYPE_DEBUG}, @@ -69,6 +69,7 @@ static const SPatch OSPatches[] = { {"GeckoCodehandler", HLE_Misc::GeckoCodeHandlerICacheFlush, HLE_HOOK_START, HLE_TYPE_FIXED}, {"GeckoHandlerReturnTrampoline", HLE_Misc::GeckoReturnTrampoline, HLE_HOOK_REPLACE, HLE_TYPE_FIXED}, + {"AppLoaderReport", HLE_OS::HLE_GeneralDebugPrint, HLE_HOOK_REPLACE, HLE_TYPE_FIXED} // apploader needs OSReport-like function }; static const SPatch OSBreakPoints[] = {