bool operator()(const BootParameters::IPL& ipl) const { NOTICE_LOG(BOOT, "Booting GC IPL: %s", ipl.path.c_str()); if (!File::Exists(ipl.path)) { if (ipl.disc) PanicAlertT("Cannot start the game, because the GC IPL could not be found."); else PanicAlertT("Cannot find the GC IPL."); return false; } if (!Load_BS2(ipl.path)) return false; if (ipl.disc) { NOTICE_LOG(BOOT, "Inserting disc: %s", ipl.disc->path.c_str()); SetDisc(DiscIO::CreateVolumeFromFilename(ipl.disc->path)); } if (LoadMapFromFilename()) HLE::PatchFunctions(); return true; }
bool CBoot::Boot_ELF(const char *filename) { const u64 filesize = File::GetSize(filename); u8 *mem = new u8[(size_t)filesize]; { File::IOFile f(filename, "rb"); f.ReadBytes(mem, (size_t)filesize); } ElfReader reader(mem); reader.LoadInto(0x80000000); if (!reader.LoadSymbols()) { if (LoadMapFromFilename(filename)) HLE::PatchFunctions(); } else { HLE::PatchFunctions(); } PC = reader.GetEntryPoint(); delete[] mem; return true; }
bool CBoot::Boot_ELF(const std::string& filename) { // Read ELF from file size_t filesize = File::GetSize(filename); auto elf = std::make_unique<u8[]>(filesize); { File::IOFile f(filename, "rb"); f.ReadBytes(elf.get(), filesize); } // Load ELF into GameCube Memory ElfReader reader(elf.get()); if (!reader.LoadIntoMemory()) return false; // Set up MSR and the BAT SPR registers. UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); m_MSR.FP = 1; m_MSR.DR = 1; m_MSR.IR = 1; m_MSR.EE = 1; PowerPC::ppcState.spr[SPR_IBAT0U] = 0x80001fff; PowerPC::ppcState.spr[SPR_IBAT0L] = 0x00000002; PowerPC::ppcState.spr[SPR_IBAT4U] = 0x90001fff; PowerPC::ppcState.spr[SPR_IBAT4L] = 0x10000002; PowerPC::ppcState.spr[SPR_DBAT0U] = 0x80001fff; PowerPC::ppcState.spr[SPR_DBAT0L] = 0x00000002; PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff; PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a; PowerPC::ppcState.spr[SPR_DBAT4U] = 0x90001fff; PowerPC::ppcState.spr[SPR_DBAT4L] = 0x10000002; PowerPC::ppcState.spr[SPR_DBAT5U] = 0xd0001fff; PowerPC::ppcState.spr[SPR_DBAT5L] = 0x1000002a; if (IsElfWii(filename)) HID4.SBE = 1; PowerPC::DBATUpdated(); PowerPC::IBATUpdated(); if (!reader.LoadSymbols()) { if (LoadMapFromFilename()) HLE::PatchFunctions(); } else { HLE::PatchFunctions(); } PC = reader.GetEntryPoint(); return true; }
bool operator()(const BootParameters::Executable& executable) const { NOTICE_LOG(BOOT, "Booting from executable: %s", executable.path.c_str()); if (!executable.reader->IsValid()) return false; if (!executable.reader->LoadIntoMemory()) { PanicAlertT("Failed to load the executable to memory."); return false; } SetDefaultDisc(); SetupMSR(); SetupBAT(config.bWii); CopyDefaultExceptionHandlers(); if (config.bWii) { PowerPC::ppcState.spr[SPR_HID0] = 0x0011c464; PowerPC::ppcState.spr[SPR_HID4] = 0x82000000; // Set a value for the SP. It doesn't matter where this points to, // as long as it is a valid location. This value is taken from a homebrew binary. PowerPC::ppcState.gpr[1] = 0x8004d4bc; // 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. SetupWiiMemory(); IOS::HLE::GetIOS()->BootIOS(Titles::IOS(58)); } else { SetupGCMemory(); } PC = executable.reader->GetEntryPoint(); if (executable.reader->LoadSymbols() || LoadMapFromFilename()) { UpdateDebugger_MapLoaded(); HLE::PatchFunctions(); } return true; }
bool operator()(BootParameters::Disc& disc) const { NOTICE_LOG(BOOT, "Booting from disc: %s", disc.path.c_str()); const DiscIO::Volume* volume = SetDisc(std::move(disc.volume)); if (!volume) return false; if (!EmulatedBS2(config.bWii, *volume)) return false; // Try to load the symbol map if there is one, and then scan it for // and eventually replace code if (LoadMapFromFilename()) HLE::PatchFunctions(); return true; }