From 944844bfba844c80ca415935fe70634d6c8f86a9 Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Mon, 24 Aug 2009 04:04:10 +0000 Subject: [PATCH] Fix Pikmin PAL not booting thanks to LordMark for figuring it out ! :D Added "AccurateFCMP" ini setting which fixes Nights, Paper Mario games... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4042 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/CoreParameter.cpp | 1 + Source/Core/Core/Src/CoreParameter.h | 4 ++- Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 2 +- .../Src/PowerPC/Jit64/Jit_FloatingPoint.cpp | 3 ++- Source/Core/DolphinWX/Src/BootManager.cpp | 1 + .../VideoCommon/Src/PixelShaderManager.cpp | 3 ++- Source/Core/VideoCommon/Src/XFMemory.h | 2 ++ Source/Core/VideoCommon/Src/XFStructs.cpp | 27 ++++++++++++------- .../Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h | 6 ++--- .../Plugin_DSP_HLE/Src/UCodes/UCodes.cpp | 4 +-- Source/Plugins/Plugin_VideoOGL/Src/Config.cpp | 2 ++ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 1 + 12 files changed, 38 insertions(+), 18 deletions(-) diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index fd4f966e7f..7b020c94fb 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -44,6 +44,7 @@ void SCoreStartupParameter::LoadDefaults() bDSPThread = true; bLockThreads = true; bEnableFPRF = false; + bAccurateFCMP = false; bWii = false; SelectedLanguage = 0; iTLBHack = 0; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 18c3e67205..736514fa56 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -57,6 +57,9 @@ struct SCoreStartupParameter bool bJITBranchOff; bool bJITProfiledReJIT; + bool bEnableFPRF; + bool bAccurateFCMP; + bool bUseDualCore; bool bDSPThread; bool bSkipIdle; @@ -65,7 +68,6 @@ struct SCoreStartupParameter bool bUseFastMem; bool bLockThreads; bool bOptimizeQuantizers; - bool bEnableFPRF; bool bEnableCheats; bool bEnableIsoCache; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 634d92a962..1a932ce308 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -210,7 +210,7 @@ void Jit64::Init() jo.enableFastMem = false; #endif jo.assumeFPLoadFromMem = true; - jo.fpAccurateFcmp = false; + jo.fpAccurateFcmp = Core::GetStartupParameter().bEnableFPRF || Core::GetStartupParameter().bAccurateFCMP; jo.optimizeGatherPipe = true; jo.fastInterrupts = false; jo.accurateSinglePrecision = true; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp index 4277753adf..8b00e7165a 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -205,9 +205,10 @@ void Jit64::fmrx(UGeckoInstruction inst) fpr.LoadToX64(d, true); // we don't want to destroy the high bit MOVSD(fpr.RX(d), fpr.R(b)); } - + void Jit64::fcmpx(UGeckoInstruction inst) { + // TODO : this causes crashes in Nights, and broken graphics in Paper Mario, Super Paper Mario INSTRUCTION_START; if(Core::g_CoreStartupParameter.bJITOff || jo.fpAccurateFcmp || Core::g_CoreStartupParameter.bJITFloatingPointOff) { diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 5e98123b07..86dcf0e04a 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -132,6 +132,7 @@ bool BootCore(const std::string& _rFilename) ini->Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); ini->Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers); ini->Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); + ini->Get("Core", "AccurateFCMP", &StartUp.bAccurateFCMP, StartUp.bAccurateFCMP); ini->Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); // ------------------------------------------------ diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index c0d8a7e4c6..946548e56d 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -122,7 +122,8 @@ void PixelShaderManager::SetConstants() if (s_bZBiasChanged || s_bDepthRangeChanged) { - //ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias); + //ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias); + // TODO : Should this use 16777216.0f or 16777215.0f ? SetPSConstant4f(C_ZBIAS+1, lastDepthRange[0] / 16777216.0f, lastDepthRange[1] / 16777216.0f, 0, (float)( (((int)lastZBias<<8)>>8))/16777216.0f); s_bZBiasChanged = s_bDepthRangeChanged = false; } diff --git a/Source/Core/VideoCommon/Src/XFMemory.h b/Source/Core/VideoCommon/Src/XFMemory.h index 872861f2f5..10f554072a 100644 --- a/Source/Core/VideoCommon/Src/XFMemory.h +++ b/Source/Core/VideoCommon/Src/XFMemory.h @@ -91,6 +91,8 @@ #define XFMEM_SETMATRIXINDA 0x1018 #define XFMEM_SETMATRIXINDB 0x1019 #define XFMEM_SETVIEWPORT 0x101a +#define XFMEM_SETZSCALE 0x101c +#define XFMEM_SETZOFFSET 0x101f #define XFMEM_SETPROJECTION 0x1020 #define XFMEM_SETNUMTEXGENS 0x103f #define XFMEM_SETTEXMTXINFO 0x1040 diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp index 9a96c3294a..f058ccee01 100644 --- a/Source/Core/VideoCommon/Src/XFStructs.cpp +++ b/Source/Core/VideoCommon/Src/XFStructs.cpp @@ -169,6 +169,24 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) } break; + // GXSetZScaleOffset ? + // Actually everything i tried didn't seem to change anything x) + case XFMEM_SETZSCALE: + // paper mario writes 16777216.0f, 1677721.75 + // Killer 7 writes 16777216.0f here + WARN_LOG(VIDEO, "Set ZScale : %x=%x\n", address, data); + break; + + case XFMEM_SETZOFFSET: + // paper mario writes 16777216.0f, 5033165.0f + // Killer 7 alterns this between 16777216.0f and 16710107.0f + WARN_LOG(VIDEO, "Set ZOffset : %x=%x\n", address, data); + break; + + // -------------- + // Unknown Regs + // -------------- + // Maybe these are for Normals? case 0x1048: //xfregs.texcoords[0].nrmmtxinfo.hex = data; break; ?? case 0x1049: @@ -181,21 +199,12 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) DEBUG_LOG(VIDEO, "Possible Normal Mtx XF reg?: %x=%x\n", address, data); break; - // -------------- - // Unknown Regs - // -------------- case 0x1013: case 0x1014: case 0x1015: case 0x1016: case 0x1017: - case 0x101c: - // paper mario writes 16777216.0f, 1677721.75 - // Killer 7 writes 0x4b800000 here on 3D rendering only - case 0x101f: - // paper mario writes 16777216.0f, 5033165.0f - // Killer 7 alterns this between 0x4b800000 and 0x4b7ef9db on 3D rendering default: WARN_LOG(VIDEO, "Unknown XF Reg: %x=%x\n", address, data); break; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h index a2d725087f..071a315a85 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h @@ -199,8 +199,7 @@ private: switch (m_CRC) { case 0x42f64ac4: // Luigi - case 0x267fd05a: // Pikmin PAL - case 0x4be6a5cb: // AC, Pikmin + case 0x4be6a5cb: // AC, Pikmin NTSC case 0x088e38a5: // IPL - JAP case 0xd73338cf: // IPL return true; @@ -217,7 +216,8 @@ private: { switch (m_CRC) { - case 0x56d36052: + case 0x56d36052: // Super Mario Sunshine + case 0x267fd05a: // Pikmin PAL return true; default: return false; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp index b0a2657343..6e6a5dac8a 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp @@ -57,7 +57,6 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0x088e38a5: // IPL - JAP case 0xd73338cf: // IPL case 0x42f64ac4: // Luigi - case 0x267fd05a: // Pikmin PAL case 0x4be6a5cb: // AC, Pikmin INFO_LOG(DSPHLE, "CRC %08x: JAC (early Zelda) ucode chosen", _CRC); return new CUCode_Zelda(_rMailHandler, _CRC); @@ -66,6 +65,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0x86840740: // Zelda WW - US case 0x56d36052: // Mario Sunshine case 0x2fcdf1ec: // Mario Kart, zelda 4 swords + case 0x267fd05a: // Pikmin PAL INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", _CRC); return new CUCode_Zelda(_rMailHandler, _CRC); @@ -83,7 +83,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0xfa450138: // wii sports - PAL case 0xadbc06bd: // Elebits case 0x4cc52064: // Bleach: Versus Crusade - case 0xd9c4bf34: // WiiMenu ... pray + case 0xd9c4bf34: // WiiMenu INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC); return new CUCode_AXWii(_rMailHandler, _CRC); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index 3976be2094..0282a58cd7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -110,6 +110,8 @@ void Config::GameIniLoad() if (iniFile->Exists("Video", "EFBToTextureEnable")) iniFile->Get("Video", "EFBToTextureEnable", &bCopyEFBToRAM, 0); + bCopyEFBToRAM = !bCopyEFBToRAM; + if (iniFile->Exists("Video", "SafeTextureCache")) iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 539ba0d643..bb745d5bfd 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1451,6 +1451,7 @@ void UpdateViewport() glViewport(GLx, GLy, GLWidth, GLHeight); // GLDepthRange - this could be a source of trouble - see the viewport hacks. + // TODO : Should this use 16777216.0f or 16777215.0f ? double GLNear = (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777215.0f; double GLFar = xfregs.rawViewport[5] / 16777215.0f; glDepthRange(GLNear, GLFar);