OpenGL: save projection hack setting

wii: pass 002 check correctly (i think :p ) also copy 10bytes from disc start instead of just 6

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3316 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-06-03 23:38:31 +00:00
parent 1e2bedbf7e
commit 43c18bb552
5 changed files with 59 additions and 68 deletions

View File

@ -217,7 +217,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
0x8000003c Size of FST Size 0x8000003c Size of FST Size
0x80000060 Copyright code */ 0x80000060 Copyright code */
DVDInterface::DVDRead(0x00000000, 0x00000000, 6); // Game Code DVDInterface::DVDRead(0x00000000, 0x00000000, 10); // Game Code
Memory::Write_U32(0x5d1c9ea3, 0x00000018); // Magic word it is a wii disc Memory::Write_U32(0x5d1c9ea3, 0x00000018); // Magic word it is a wii disc
Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
Memory::Write_U32(0x00000001, 0x00000024); // Unknown Memory::Write_U32(0x00000001, 0x00000024); // Unknown
@ -250,24 +250,11 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
Memory::Write_U32(0x93ae0000, 0x00003130); // IOS MEM2 low Memory::Write_U32(0x93ae0000, 0x00003130); // IOS MEM2 low
Memory::Write_U32(0x93b00000, 0x00003134); // IOS MEM2 high Memory::Write_U32(0x93b00000, 0x00003134); // IOS MEM2 high
Memory::Write_U32(0x00000011, 0x00003138); // Console type Memory::Write_U32(0x00000011, 0x00003138); // Console type
// 40 is copied from 88 after running apploader
// Pass the "#002 check" Memory::Write_U32(0x00062507, 0x00003144); // IOS date in USA format
u64 TMDOffset = 0;
if (VolumeHandler::GetTMDOffset(1, TMDOffset))
{
// IOS Version from TMD
VolumeHandler::RAWReadToPtr(Memory::GetPointer(0x00003141), TMDOffset + 0x18B, 1);
Memory::Write_U16(0xffff, 0x00003142); // IOS revision
Memory::Write_U32(0x00062507, 0x00003144); // Date in USA format
}
else
{
// Fake IOS9 Version 2.4
Memory::Write_U64(0x0009020400062507ULL, 0x00003140);
}
Memory::Write_U16(0x0113, 0x0000315e); // Apploader Memory::Write_U16(0x0113, 0x0000315e); // Apploader
Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code Memory::Write_U32(0x0000FF16, 0x00003158); // DDR ram vendor code
Memory::Write_U32(0x00000000, 0x00003160); // Init semaphore (sysmenu waits for this to clear)
Memory::Write_U8(0x80, 0x0000315c); // OSInit Memory::Write_U8(0x80, 0x0000315c); // OSInit
Memory::Write_U8(0x00, 0x00000006); // DVDInit Memory::Write_U8(0x00, 0x00000006); // DVDInit
@ -278,7 +265,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
// Fake the VI Init of the BIOS // Fake the VI Init of the BIOS
Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x000000CC); Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x000000CC);
// Clear exception handler. Why? Don't we begin with only zeroes? // Clear exception handler. Why? Don't we begin with only zeros?
for (int i = 0x3000; i <= 0x3038; i += 4) for (int i = 0x3000; i <= 0x3038; i += 4)
{ {
Memory::Write_U32(0x00000000, 0x80000000 + i); Memory::Write_U32(0x00000000, 0x80000000 + i);
@ -315,8 +302,6 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
m_MSR.FP = 1; m_MSR.FP = 1;
//TODO: Game iso info to 0x80000000 according to yagcd - or does apploader do this?
Memory::Write_U32(0x4c000064, 0x80000300); // write default DFI Handler: rfi Memory::Write_U32(0x4c000064, 0x80000300); // write default DFI Handler: rfi
Memory::Write_U32(0x4c000064, 0x80000800); // write default FPU Handler: rfi Memory::Write_U32(0x4c000064, 0x80000800); // write default FPU Handler: rfi
Memory::Write_U32(0x4c000064, 0x80000C00); // write default Syscall Handler: rfi Memory::Write_U32(0x4c000064, 0x80000C00); // write default Syscall Handler: rfi
@ -354,9 +339,9 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
PowerPC::ppcState.gpr[3] = 0x81300000; PowerPC::ppcState.gpr[3] = 0x81300000;
RunFunction(iAppLoaderInit); RunFunction(iAppLoaderInit);
// Let the apploader load the exe to memory. At this point I get an unknwon IPC command // Let the apploader load the exe to memory. At this point I get an unknown IPC command
// (command zero) when I load Wii Sports or other games a second time. I don't notice // (command zero) when I load Wii Sports or other games a second time. I don't notice
// any side effects however. It's a little disconcerning however that Start after Stop // any side effects however. It's a little disconcerting however that Start after Stop
// behaves differently than the first Start after starting Dolphin. It means something // behaves differently than the first Start after starting Dolphin. It means something
// was not reset correctly. // was not reset correctly.
DEBUG_LOG(BOOT, "Run iAppLoaderMain"); DEBUG_LOG(BOOT, "Run iAppLoaderMain");
@ -380,6 +365,10 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
DEBUG_LOG(BOOT, "Run iAppLoaderClose"); DEBUG_LOG(BOOT, "Run iAppLoaderClose");
RunFunction(iAppLoaderClose); RunFunction(iAppLoaderClose);
// Pass the "#002 check"
// Apploader writes the IOS version and revision here, we copy it
Memory::Write_U32(Memory::Read_U32(0x80003188), 0x00003140);
// Load patches and run startup patches // Load patches and run startup patches
std::string gameID = VolumeHandler::GetVolume()->GetUniqueID(); std::string gameID = VolumeHandler::GetVolume()->GetUniqueID();
PatchEngine::LoadPatches(gameID.c_str()); PatchEngine::LoadPatches(gameID.c_str());

View File

@ -81,6 +81,7 @@ void Config::Load()
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0); iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0);
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0); iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
} }
void Config::GameIniLoad() { void Config::GameIniLoad() {
@ -115,8 +116,8 @@ void Config::GameIniLoad() {
if (iniFile->Exists("Video", "UseXFB")) if (iniFile->Exists("Video", "UseXFB"))
iniFile->Get("Video", "UseXFB", &bUseXFB, 0); iniFile->Get("Video", "UseXFB", &bUseXFB, 0);
if (iniFile->Exists("Video", "Hack")) if (iniFile->Exists("Video", "ProjectionHack"))
iniFile->Get("Video", "Hack", &iPhackvalue, 0); iniFile->Get("Video", "ProjectionHack", &iPhackvalue, 0);
} }
void Config::Save() void Config::Save()
@ -165,6 +166,7 @@ void Config::Save()
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable);
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey); iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini"); iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini");
} }

View File

@ -45,7 +45,7 @@ struct Config
void Load(); void Load();
void GameIniLoad(); void GameIniLoad();
void Save(); void Save();
void UpdateHack(); void UpdateProjectionHack();
// General // General
bool bFullscreen; bool bFullscreen;

View File

@ -76,7 +76,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
{ {
g_Config.Load(); g_Config.Load();
g_Config.GameIniLoad(); g_Config.GameIniLoad();
g_Config.UpdateHack(); g_Config.UpdateProjectionHack();
} }
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
@ -518,7 +518,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
g_Config.iPhackvalue = m_PhackvalueCB->GetSelection(); g_Config.iPhackvalue = m_PhackvalueCB->GetSelection();
if (g_Config.iPhackvalue >= 0) if (g_Config.iPhackvalue >= 0)
{ {
g_Config.UpdateHack(); g_Config.UpdateProjectionHack();
} }
break; break;
} }
@ -639,51 +639,51 @@ void ConfigDialog::UpdateGUI()
m_FullscreenCB->Enable(!g_Config.renderToMainframe); m_FullscreenCB->Enable(!g_Config.renderToMainframe);
m_WindowResolutionCB->Enable(!g_Config.renderToMainframe); m_WindowResolutionCB->Enable(!g_Config.renderToMainframe);
} }
void Config::UpdateHack() void Config::UpdateProjectionHack()
{ {
switch(g_Config.iPhackvalue) switch(g_Config.iPhackvalue)
{ {
case OGL_HACK_NONE: case OGL_HACK_NONE:
g_Config.bProjHack1 = 0; g_Config.bProjHack1 = 0;
g_Config.bPhackvalue1 = 0; g_Config.bPhackvalue1 = 0;
g_Config.bPhackvalue2 = 0; g_Config.bPhackvalue2 = 0;
break;
case OGL_HACK_ZELDA_TP_BLOOM_HACK:
g_Config.bPhackvalue1 = 1;
g_Config.bProjHack1 = 1;
break;
case OGL_HACK_SUPER_MARIO_GALAXY:
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.00006f;
g_Config.bPhackvalue2 = 0;
g_Config.bProjHack1 = 0;
break;
case OGL_HACK_MARIO_KART_WII:
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.0006f;
g_Config.bPhackvalue2 = 0;
g_Config.bProjHack1 = 0;
break;
case OGL_HACK_SONIC_AND_THE_BLACK_KNIGHT:
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.00002f;
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 1.999980f;
break; break;
case OGL_HACK_BLEACH_VERSUS_CRUSADE: case OGL_HACK_ZELDA_TP_BLOOM_HACK:
g_Config.bPhackvalue2 = 1; g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue2 = 0.5f; g_Config.bProjHack1 = 1;
g_Config.bPhackvalue1 = 0;
g_Config.bProjHack1 = 0;
break; break;
case OGL_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME: case OGL_HACK_SUPER_MARIO_GALAXY:
g_Config.bPhackvalue1 = 1; g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.8f; g_Config.fhackvalue1 = 0.00006f;
g_Config.bPhackvalue2 = 1; g_Config.bPhackvalue2 = 0;
g_Config.fhackvalue2 = 1.2f; g_Config.bProjHack1 = 0;
g_Config.bProjHack1 = 0;
break; break;
} case OGL_HACK_MARIO_KART_WII:
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.0006f;
g_Config.bPhackvalue2 = 0;
g_Config.bProjHack1 = 0;
break;
case OGL_HACK_SONIC_AND_THE_BLACK_KNIGHT:
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.00002f;
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 1.999980f;
break;
case OGL_HACK_BLEACH_VERSUS_CRUSADE:
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 0.5f;
g_Config.bPhackvalue1 = 0;
g_Config.bProjHack1 = 0;
break;
case OGL_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME:
g_Config.bPhackvalue1 = 1;
g_Config.fhackvalue1 = 0.8f;
g_Config.bPhackvalue2 = 1;
g_Config.fhackvalue2 = 1.2f;
g_Config.bProjHack1 = 0;
break;
}
} }

View File

@ -261,7 +261,7 @@ void Initialize(void *init)
g_Config.Load(); g_Config.Load();
g_Config.GameIniLoad(); g_Config.GameIniLoad();
g_Config.UpdateHack(); g_Config.UpdateProjectionHack();
if (!OpenGL_Create(g_VideoInitialize, 640, 480)) // 640x480 will be the default if all else fails if (!OpenGL_Create(g_VideoInitialize, 640, 480)) // 640x480 will be the default if all else fails
{ {