diff --git a/Source/Core/DSPCore/Src/DSPIntExtOps.cpp b/Source/Core/DSPCore/Src/DSPIntExtOps.cpp index 124869ca8e..a9c3f5c49f 100644 --- a/Source/Core/DSPCore/Src/DSPIntExtOps.cpp +++ b/Source/Core/DSPCore/Src/DSPIntExtOps.cpp @@ -40,6 +40,17 @@ namespace DSPInterpreter namespace Ext { +inline bool IsSameMemArea(u16 a, u16 b) +{ +//LM:AX games have probs with this,... more tests needed +#if 0 + if ((a>>12)==(b>>12)) //from http://code.google.com/p/dolphin-emu/wiki/DSP_todo (Luigi research) + return true; + else +#endif + return false; +} + // DR $arR // xxxx xxxx 0000 01rr // Decrement addressing register $arR. @@ -290,11 +301,21 @@ void ld(const UDSPInstruction& opc) if (sreg != 0x03) { writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg])); - writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + + if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3])) + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + else + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); } else { writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg])); - writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + + if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3])) + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + else + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, dreg, dsp_increment_addr_reg(dreg)); } @@ -312,11 +333,21 @@ void ldn(const UDSPInstruction& opc) if (sreg != 0x03) { writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg])); - writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + + if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3])) + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + else + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg])); } else { writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg])); - writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + + if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3])) + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + else + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + dreg])); } @@ -335,11 +366,21 @@ void ldm(const UDSPInstruction& opc) if (sreg != 0x03) { writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg])); - writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + + if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3])) + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + else + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); } else { writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg])); - writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + + if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3])) + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + else + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, dreg, dsp_increment_addr_reg(dreg)); } @@ -358,11 +399,21 @@ void ldnm(const UDSPInstruction& opc) if (sreg != 0x03) { writeToBackLog(0, (dreg << 1) + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[sreg])); - writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + + if (IsSameMemArea(g_dsp.r[sreg],g_dsp.r[0x3])) + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[sreg])); + else + writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg])); } else { writeToBackLog(0, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r[dreg])); - writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + + if (IsSameMemArea(g_dsp.r[dreg],g_dsp.r[0x3])) + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[dreg])); + else + writeToBackLog(1, rreg + DSP_REG_AXH0, dsp_dmem_read(g_dsp.r[0x3])); + writeToBackLog(2, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + dreg])); } diff --git a/Source/Core/DSPCore/Src/DspIntMultiplier.cpp b/Source/Core/DSPCore/Src/DspIntMultiplier.cpp index b53edad26f..d7d20ef434 100644 --- a/Source/Core/DSPCore/Src/DspIntMultiplier.cpp +++ b/Source/Core/DSPCore/Src/DspIntMultiplier.cpp @@ -32,9 +32,11 @@ inline s64 dsp_get_multiply_prod(u16 a, u16 b, bool sign) { s64 prod; +#if 0 //causing probs with all games atm if (sign && g_dsp.r[DSP_REG_SR] & SR_MUL_UNSIGNED) prod = (u64)a * (u64)b; // won't overflow 32-bits else +#endif prod = (s32)(s16)a * (s32)(s16)b; // won't overflow 32-bits // Conditionally multiply by 2. diff --git a/Source/Core/VideoCommon/Src/GlobalControl.cpp b/Source/Core/VideoCommon/Src/GlobalControl.cpp index f345502e27..8e47a0e538 100644 --- a/Source/Core/VideoCommon/Src/GlobalControl.cpp +++ b/Source/Core/VideoCommon/Src/GlobalControl.cpp @@ -95,6 +95,7 @@ void UpdateProjectionHack(int iPhackvalue) fhackvalue1 = 0.0075f; bPhackvalue2 = 0; bProjHack1 = 0; + break; case PROJECTION_HACK_BATEN_KAITOS: bPhackvalue1 = 1; fhackvalue1 = 0.0026f; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp index e933dd1298..71d18f5492 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp @@ -201,7 +201,7 @@ void Enumerate() a.supports_resz = D3D_OK == D3D->CheckDeviceFormat( i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_RESZ); - a.supports_resz = D3D_OK == D3D->CheckDeviceFormat( + a.supports_null = D3D_OK == D3D->CheckDeviceFormat( i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_NULL);