From 43c18bb5525a32e2ac31fff5cfe819fe3eef251b Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 3 Jun 2009 23:38:31 +0000 Subject: [PATCH] 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 --- Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp | 33 +++----- Source/Plugins/Plugin_VideoOGL/Src/Config.cpp | 6 +- Source/Plugins/Plugin_VideoOGL/Src/Config.h | 2 +- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 84 +++++++++---------- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 2 +- 5 files changed, 59 insertions(+), 68 deletions(-) diff --git a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp b/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp index 49a7ccd20b..93a8cc89a2 100644 --- a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp +++ b/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp @@ -217,7 +217,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) 0x8000003c Size of FST Size 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(0x0D15EA5E, 0x00000020); // Another magic word 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(0x93b00000, 0x00003134); // IOS MEM2 high Memory::Write_U32(0x00000011, 0x00003138); // Console type - - // Pass the "#002 check" - 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); - } - + // 40 is copied from 88 after running apploader + Memory::Write_U32(0x00062507, 0x00003144); // IOS date in USA format Memory::Write_U16(0x0113, 0x0000315e); // Apploader 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(0x00, 0x00000006); // DVDInit @@ -278,7 +265,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) // Fake the VI Init of the BIOS 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) { 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); 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, 0x80000800); // write default FPU 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; 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 - // 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 // was not reset correctly. DEBUG_LOG(BOOT, "Run iAppLoaderMain"); @@ -380,6 +365,10 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug) DEBUG_LOG(BOOT, "Run 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 std::string gameID = VolumeHandler::GetVolume()->GetUniqueID(); PatchEngine::LoadPatches(gameID.c_str()); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index 74b5039204..58f4ae7c00 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -81,6 +81,7 @@ void Config::Load() iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, 0); iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0); + iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0); } void Config::GameIniLoad() { @@ -115,8 +116,8 @@ void Config::GameIniLoad() { if (iniFile->Exists("Video", "UseXFB")) iniFile->Get("Video", "UseXFB", &bUseXFB, 0); - if (iniFile->Exists("Video", "Hack")) - iniFile->Get("Video", "Hack", &iPhackvalue, 0); + if (iniFile->Exists("Video", "ProjectionHack")) + iniFile->Get("Video", "ProjectionHack", &iPhackvalue, 0); } void Config::Save() @@ -165,6 +166,7 @@ void Config::Save() iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); iniFile.Set("Hacks", "EFBCopyDisableHotKey", bEFBCopyDisableHotKey); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM); + iniFile.Set("Hacks", "ProjectionHack", iPhackvalue); iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini"); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index 37ebb0a2e9..e34f84eaf1 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -45,7 +45,7 @@ struct Config void Load(); void GameIniLoad(); void Save(); - void UpdateHack(); + void UpdateProjectionHack(); // General bool bFullscreen; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 28aa978534..ceca9c1de6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -76,7 +76,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl { g_Config.Load(); g_Config.GameIniLoad(); - g_Config.UpdateHack(); + g_Config.UpdateProjectionHack(); } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -518,7 +518,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) g_Config.iPhackvalue = m_PhackvalueCB->GetSelection(); if (g_Config.iPhackvalue >= 0) { - g_Config.UpdateHack(); + g_Config.UpdateProjectionHack(); } break; } @@ -639,51 +639,51 @@ void ConfigDialog::UpdateGUI() m_FullscreenCB->Enable(!g_Config.renderToMainframe); m_WindowResolutionCB->Enable(!g_Config.renderToMainframe); } -void Config::UpdateHack() +void Config::UpdateProjectionHack() { switch(g_Config.iPhackvalue) - { - case OGL_HACK_NONE: - g_Config.bProjHack1 = 0; - g_Config.bPhackvalue1 = 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; + { + case OGL_HACK_NONE: + g_Config.bProjHack1 = 0; + g_Config.bPhackvalue1 = 0; + g_Config.bPhackvalue2 = 0; break; - case OGL_HACK_BLEACH_VERSUS_CRUSADE: - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 0.5f; - g_Config.bPhackvalue1 = 0; - g_Config.bProjHack1 = 0; + case OGL_HACK_ZELDA_TP_BLOOM_HACK: + g_Config.bPhackvalue1 = 1; + g_Config.bProjHack1 = 1; 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; + 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; + 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; + } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 6662896db2..4d2d219850 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -261,7 +261,7 @@ void Initialize(void *init) g_Config.Load(); 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 {