Merge pull request #10922 from Pokechu22/apploader-hle-no-replace

Boot_BS2Emu: Create an actual function for AppLoaderReport
This commit is contained in:
Admiral H. Curtiss 2022-07-30 14:05:58 +02:00 committed by GitHub
commit 4b6ad977c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 13 deletions

View File

@ -148,7 +148,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume,
// TODO - Make Apploader(or just RunFunction()) debuggable!!!
// Call iAppLoaderEntry.
DEBUG_LOG_FMT(MASTER_LOG, "Call iAppLoaderEntry");
DEBUG_LOG_FMT(BOOT, "Call iAppLoaderEntry");
const u32 iAppLoaderFuncAddr = is_wii ? 0x80004000 : 0x80003100;
PowerPC::ppcState.gpr[3] = iAppLoaderFuncAddr + 0;
PowerPC::ppcState.gpr[4] = iAppLoaderFuncAddr + 4;
@ -159,15 +159,16 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume,
const u32 iAppLoaderClose = PowerPC::Read_U32(iAppLoaderFuncAddr + 8);
// iAppLoaderInit
DEBUG_LOG_FMT(MASTER_LOG, "Call iAppLoaderInit");
HLE::Patch(0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
DEBUG_LOG_FMT(BOOT, "Call iAppLoaderInit");
PowerPC::HostWrite_U32(0x4E800020, 0x81300000); // Write BLR
HLE::Patch(0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
PowerPC::ppcState.gpr[3] = 0x81300000;
RunFunction(iAppLoaderInit);
// iAppLoaderMain - Here we load the apploader, the DOL (the exe) and the FST (filesystem).
// To give you an idea about where the stuff is located on the disc take a look at yagcd
// ch 13.
DEBUG_LOG_FMT(MASTER_LOG, "Call iAppLoaderMain");
DEBUG_LOG_FMT(BOOT, "Call iAppLoaderMain");
PowerPC::ppcState.gpr[3] = 0x81300004;
PowerPC::ppcState.gpr[4] = 0x81300008;
@ -185,7 +186,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume,
const u32 length = PowerPC::Read_U32(0x81300008);
const u32 dvd_offset = PowerPC::Read_U32(0x8130000c) << (is_wii ? 2 : 0);
INFO_LOG_FMT(MASTER_LOG, "DVDRead: offset: {:08x} memOffset: {:08x} length: {}", dvd_offset,
INFO_LOG_FMT(BOOT, "DVDRead: offset: {:08x} memOffset: {:08x} length: {}", dvd_offset,
ram_address, length);
DVDRead(volume, dvd_offset, ram_address, length, partition);
@ -199,7 +200,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume,
}
// iAppLoaderClose
DEBUG_LOG_FMT(MASTER_LOG, "call iAppLoaderClose");
DEBUG_LOG_FMT(BOOT, "call iAppLoaderClose");
RunFunction(iAppLoaderClose);
HLE::UnPatch("AppLoaderReport");

View File

@ -125,7 +125,7 @@ const char* ElfReader::GetSectionName(int section) const
// This is just a simple elf loader, good enough to load elfs generated by devkitPPC
bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
{
INFO_LOG_FMT(MASTER_LOG, "String section: {}", header->e_shstrndx);
INFO_LOG_FMT(BOOT, "String section: {}", header->e_shstrndx);
if (bRelocate)
{
@ -133,14 +133,14 @@ bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
return false;
}
INFO_LOG_FMT(MASTER_LOG, "{} segments:", header->e_phnum);
INFO_LOG_FMT(BOOT, "{} segments:", header->e_phnum);
// Copy segments into ram.
for (int i = 0; i < header->e_phnum; i++)
{
Elf32_Phdr* p = segments + i;
INFO_LOG_FMT(MASTER_LOG, "Type: {} Vaddr: {:08x} Filesz: {} Memsz: {}", p->p_type, p->p_vaddr,
INFO_LOG_FMT(BOOT, "Type: {} Vaddr: {:08x} Filesz: {} Memsz: {}", p->p_type, p->p_vaddr,
p->p_filesz, p->p_memsz);
if (p->p_type == PT_LOAD)
@ -157,12 +157,11 @@ bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
if (srcSize < dstSize)
Memory::Memset(writeAddr + srcSize, 0, dstSize - srcSize); // zero out bss
INFO_LOG_FMT(MASTER_LOG, "Loadable Segment Copied to {:08x}, size {:08x}", writeAddr,
p->p_memsz);
INFO_LOG_FMT(BOOT, "Loadable Segment Copied to {:08x}, size {:08x}", writeAddr, p->p_memsz);
}
}
INFO_LOG_FMT(MASTER_LOG, "Done loading.");
INFO_LOG_FMT(BOOT, "Done loading.");
return true;
}

View File

@ -58,7 +58,7 @@ constexpr std::array<Hook, 23> os_patches{{
{"GeckoCodehandler", HLE_Misc::GeckoCodeHandlerICacheFlush, HookType::Start, HookFlag::Fixed},
{"GeckoHandlerReturnTrampoline", HLE_Misc::GeckoReturnTrampoline, HookType::Replace, HookFlag::Fixed},
{"AppLoaderReport", HLE_OS::HLE_GeneralDebugPrint, HookType::Replace, HookFlag::Fixed} // apploader needs OSReport-like function
{"AppLoaderReport", HLE_OS::HLE_GeneralDebugPrint, HookType::Start, HookFlag::Fixed} // apploader needs OSReport-like function
}};
// clang-format on