added support for the wii mem dump (again)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@526 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7d07881116
commit
6c007ceff0
|
@ -210,99 +210,111 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
|
|||
{
|
||||
LOG(BOOT, "Faking Wii BIOS...");
|
||||
|
||||
// load settings.txt
|
||||
{
|
||||
std::string filename("WII/setting-eur.txt");
|
||||
if (VolumeHandler::IsValid())
|
||||
{
|
||||
switch(VolumeHandler::GetVolume()->GetCountry())
|
||||
{
|
||||
case DiscIO::IVolume::COUNTRY_JAP:
|
||||
filename = "WII/setting-jpn.txt";
|
||||
break;
|
||||
FILE* pDump = fopen("WII/dump_0x0000_0x4000.bin", "rb");
|
||||
if (pDump != NULL)
|
||||
{
|
||||
LOG(MASTER_LOG, "Init from memory dump.");
|
||||
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
filename = "WII/setting-usa.txt";
|
||||
break;
|
||||
fread(Memory::GetMainRAMPtr(), 1, 16384, pDump);
|
||||
fclose(pDump);
|
||||
pDump = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// load settings.txt
|
||||
{
|
||||
std::string filename("WII/setting-eur.txt");
|
||||
if (VolumeHandler::IsValid())
|
||||
{
|
||||
switch(VolumeHandler::GetVolume()->GetCountry())
|
||||
{
|
||||
case DiscIO::IVolume::COUNTRY_JAP:
|
||||
filename = "WII/setting-jpn.txt";
|
||||
break;
|
||||
|
||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
||||
filename = "WII/setting-eur.txt";
|
||||
break;
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
filename = "WII/setting-usa.txt";
|
||||
break;
|
||||
|
||||
default:
|
||||
PanicAlert("Unknown country. Wii boot process will be switched to European settings.");
|
||||
filename = "WII/setting-eur.txt";
|
||||
break;
|
||||
}
|
||||
}
|
||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
||||
filename = "WII/setting-eur.txt";
|
||||
break;
|
||||
|
||||
FILE* pTmp = fopen(filename.c_str(), "rb");
|
||||
if (!pTmp)
|
||||
{
|
||||
LOG(MASTER_LOG, "Cant find setting file");
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
PanicAlert("Unknown country. Wii boot process will be switched to European settings.");
|
||||
filename = "WII/setting-eur.txt";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fread(Memory::GetPointer(0x3800), 256, 1, pTmp);
|
||||
fclose(pTmp);
|
||||
}
|
||||
FILE* pTmp = fopen(filename.c_str(), "rb");
|
||||
if (!pTmp)
|
||||
{
|
||||
LOG(MASTER_LOG, "Cant find setting file");
|
||||
return false;
|
||||
}
|
||||
|
||||
// int global vars
|
||||
{
|
||||
// updated with info from wiibrew.org
|
||||
Memory::Write_U32(0x5d1c9ea3, 0x00000018); // magic word it is a wii disc
|
||||
Memory::Write_U32(0x0D15EA5E, 0x00000020);
|
||||
Memory::Write_U32(0x00000001, 0x00000024);
|
||||
Memory::Write_U32(0x01800000, 0x00000028);
|
||||
Memory::Write_U32(0x00000023, 0x0000002c);
|
||||
Memory::Write_U32(0x00000000, 0x00000030); // Init
|
||||
Memory::Write_U32(0x817FEC60, 0x00000034); // Init
|
||||
// 38, 3C should get start, size of FST through apploader
|
||||
Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
|
||||
Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
|
||||
Memory::Write_U32(0x01800000, 0x000000f0); // "simulated memory size" (debug mode?)
|
||||
Memory::Write_U32(0x8179b500, 0x000000f4); // __start
|
||||
Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
|
||||
Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
|
||||
Memory::Write_U16(0x0000, 0x000030e6); // Console type
|
||||
Memory::Write_U32(0x00000000, 0x000030c0); // EXI
|
||||
Memory::Write_U32(0x00000000, 0x000030c4); // EXI
|
||||
Memory::Write_U32(0x00000000, 0x000030dc); // Time
|
||||
Memory::Write_U32(0x00000000, 0x000030d8); // Time
|
||||
Memory::Write_U32(0x00000000, 0x000030f0); // apploader
|
||||
Memory::Write_U32(0x01800000, 0x00003100); // BAT
|
||||
Memory::Write_U32(0x01800000, 0x00003104); // BAT
|
||||
Memory::Write_U32(0x00000000, 0x0000310c); // Init
|
||||
Memory::Write_U32(0x8179d500, 0x00003110); // Init
|
||||
Memory::Write_U32(0x04000000, 0x00003118);
|
||||
Memory::Write_U32(0x04000000, 0x0000311c); // BAT
|
||||
Memory::Write_U32(0x93400000, 0x00003120); // BAT
|
||||
Memory::Write_U32(0x90000800, 0x00003124); // Init - MEM2 low
|
||||
Memory::Write_U32(0x933e0000, 0x00003128); // Init - MEM2 high
|
||||
Memory::Write_U32(0x933e0000, 0x00003130); // IOS MEM2 low
|
||||
Memory::Write_U32(0x93400000, 0x00003134); // IOS MEM2 high
|
||||
Memory::Write_U32(0x00000011, 0x00003138); // Console type
|
||||
Memory::Write_U16(0x0113, 0x0000315e); // apploader
|
||||
Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
|
||||
Memory::Write_U8(0x80, 0x0000315c); // OSInit
|
||||
Memory::Write_U8(0x00, 0x00000006); // DVDInit
|
||||
Memory::Write_U8(0x00, 0x00000007); // DVDInit
|
||||
Memory::Write_U32(0x00000005, 0x000000cc); // VIInit
|
||||
Memory::Write_U16(0x0000, 0x000030e0); // PADInit
|
||||
fread(Memory::GetPointer(0x3800), 256, 1, pTmp);
|
||||
fclose(pTmp);
|
||||
}
|
||||
|
||||
// clear exception handler
|
||||
for (int i = 0x3000; i <= 0x3038; i += 4)
|
||||
{
|
||||
Memory::Write_U32(0x00000000, 0x80000000 + i);
|
||||
}
|
||||
// int global vars
|
||||
{
|
||||
// updated with info from wiibrew.org
|
||||
Memory::Write_U32(0x5d1c9ea3, 0x00000018); // magic word it is a wii disc
|
||||
Memory::Write_U32(0x0D15EA5E, 0x00000020);
|
||||
Memory::Write_U32(0x00000001, 0x00000024);
|
||||
Memory::Write_U32(0x01800000, 0x00000028);
|
||||
Memory::Write_U32(0x00000023, 0x0000002c);
|
||||
Memory::Write_U32(0x00000000, 0x00000030); // Init
|
||||
Memory::Write_U32(0x817FEC60, 0x00000034); // Init
|
||||
// 38, 3C should get start, size of FST through apploader
|
||||
Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
|
||||
Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
|
||||
Memory::Write_U32(0x01800000, 0x000000f0); // "simulated memory size" (debug mode?)
|
||||
Memory::Write_U32(0x8179b500, 0x000000f4); // __start
|
||||
Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
|
||||
Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
|
||||
Memory::Write_U16(0x0000, 0x000030e6); // Console type
|
||||
Memory::Write_U32(0x00000000, 0x000030c0); // EXI
|
||||
Memory::Write_U32(0x00000000, 0x000030c4); // EXI
|
||||
Memory::Write_U32(0x00000000, 0x000030dc); // Time
|
||||
Memory::Write_U32(0x00000000, 0x000030d8); // Time
|
||||
Memory::Write_U32(0x00000000, 0x000030f0); // apploader
|
||||
Memory::Write_U32(0x01800000, 0x00003100); // BAT
|
||||
Memory::Write_U32(0x01800000, 0x00003104); // BAT
|
||||
Memory::Write_U32(0x00000000, 0x0000310c); // Init
|
||||
Memory::Write_U32(0x8179d500, 0x00003110); // Init
|
||||
Memory::Write_U32(0x04000000, 0x00003118);
|
||||
Memory::Write_U32(0x04000000, 0x0000311c); // BAT
|
||||
Memory::Write_U32(0x93400000, 0x00003120); // BAT
|
||||
Memory::Write_U32(0x90000800, 0x00003124); // Init - MEM2 low
|
||||
Memory::Write_U32(0x933e0000, 0x00003128); // Init - MEM2 high
|
||||
Memory::Write_U32(0x933e0000, 0x00003130); // IOS MEM2 low
|
||||
Memory::Write_U32(0x93400000, 0x00003134); // IOS MEM2 high
|
||||
Memory::Write_U32(0x00000011, 0x00003138); // Console type
|
||||
Memory::Write_U16(0x0113, 0x0000315e); // apploader
|
||||
Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
|
||||
Memory::Write_U8(0x80, 0x0000315c); // OSInit
|
||||
Memory::Write_U8(0x00, 0x00000006); // DVDInit
|
||||
Memory::Write_U8(0x00, 0x00000007); // DVDInit
|
||||
Memory::Write_U32(0x00000005, 0x000000cc); // VIInit
|
||||
Memory::Write_U16(0x0000, 0x000030e0); // PADInit
|
||||
|
||||
// app
|
||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x3180), 0, 4);
|
||||
Memory::Write_U8(0x80, 0x00003184);
|
||||
}
|
||||
// clear exception handler
|
||||
for (int i = 0x3000; i <= 0x3038; i += 4)
|
||||
{
|
||||
Memory::Write_U32(0x00000000, 0x80000000 + i);
|
||||
}
|
||||
|
||||
// app
|
||||
VolumeHandler::ReadToPtr(Memory::GetPointer(0x3180), 0, 4);
|
||||
Memory::Write_U8(0x80, 0x00003184);
|
||||
}
|
||||
}
|
||||
|
||||
// apploader
|
||||
if (VolumeHandler::IsValid())
|
||||
if (VolumeHandler::IsValid() && VolumeHandler::IsWii())
|
||||
{
|
||||
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
|
||||
m_MSR.FP = 1;
|
||||
|
|
Loading…
Reference in New Issue