diff --git a/bin/GameIndex.dbf b/bin/GameIndex.dbf index 8310f96f82..7f429e6cf1 100644 --- a/bin/GameIndex.dbf +++ b/bin/GameIndex.dbf @@ -9269,6 +9269,7 @@ Serial = SLUS-21735 Name = Mana Khemia - Alchemists of Al-Revis Region = NTSC-U Compat = 5 +DMABusyHack = 1 --------------------------------------------- Serial = SLUS-21736 Name = Wall-E diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 1eeddf48e1..0209dc62e9 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -51,6 +51,7 @@ enum GamefixId Fix_EETiming, Fix_SkipMpeg, Fix_OPHFlag, + Fix_DMABusy, GamefixId_COUNT }; @@ -339,7 +340,8 @@ struct Pcsx2Config IPUWaitHack :1, // FFX FMV, makes GIF flush before doing IPU work. Fixes bad graphics overlay. EETimingHack :1, // General purpose timing hack. SkipMPEGHack :1, // Skips MPEG videos (Katamari and other games need this) - OPHFlagHack :1; // Skips MPEG videos (Katamari and other games need this) + OPHFlagHack :1, // Bleach Blade Battlers + DMABusyHack :1; // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems. BITFIELD_END GamefixOptions(); @@ -483,7 +485,8 @@ TraceLogFilters& SetTraceConfig(); #define CHECK_IPUWAITHACK (EmuConfig.Gamefixes.IPUWaitHack) // Special Fix For FFX #define CHECK_EETIMINGHACK (EmuConfig.Gamefixes.EETimingHack) // Fix all scheduled events to happen in 1 cycle. #define CHECK_SKIPMPEGHACK (EmuConfig.Gamefixes.SkipMPEGHack) // Finds sceMpegIsEnd pattern to tell the game the mpeg is finished (Katamari and a lot of games need this) -#define CHECK_OPHFLAGHACK (EmuConfig.Gamefixes.OPHFlagHack) +#define CHECK_OPHFLAGHACK (EmuConfig.Gamefixes.OPHFlagHack) // Bleach Blade Battlers +#define CHECK_DMABUSYHACK (EmuConfig.Gamefixes.DMABusyHack) // Denies writes to the DMAC when it's busy. This is correct behaviour but bad timing can cause problems. //------------ Advanced Options!!! --------------- #define CHECK_VU_OVERFLOW (EmuConfig.Cpu.Recompiler.vuOverflow) diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 0402d37fe8..ffbf76e410 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -251,7 +251,8 @@ const wxChar *const tbl_GamefixNames[] = L"IpuWait", L"EETiming", L"SkipMpeg", - L"OPHFlag" + L"OPHFlag", + L"DMABusy" }; const __fi wxChar* EnumToString( GamefixId id ) @@ -308,6 +309,7 @@ void Pcsx2Config::GamefixOptions::Set( GamefixId id, bool enabled ) case Fix_EETiming: EETimingHack = enabled; break; case Fix_SkipMpeg: SkipMPEGHack = enabled; break; case Fix_OPHFlag: OPHFlagHack = enabled; break; + case Fix_DMABusy: DMABusyHack = enabled; break; jNO_DEFAULT; } @@ -328,6 +330,7 @@ bool Pcsx2Config::GamefixOptions::Get( GamefixId id ) const case Fix_EETiming: return EETimingHack; case Fix_SkipMpeg: return SkipMPEGHack; case Fix_OPHFlag: return OPHFlagHack; + case Fix_DMABusy: return DMABusyHack; jNO_DEFAULT } @@ -348,6 +351,7 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini ) IniBitBool( EETimingHack ); IniBitBool( SkipMPEGHack ); IniBitBool( OPHFlagHack ); + IniBitBool( DMABusyHack ); } Pcsx2Config::Pcsx2Config() diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index e5c3a29acb..0a9a600b61 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -246,7 +246,7 @@ void SysCoreThread::DoCpuExecute() void SysCoreThread::ExecuteTaskInThread() { - Threading::EnableHiresScheduler(); + Threading::EnableHiresScheduler(); // Note that *something* in SPU2-X and GSdx also set the timer resolution to 1ms. m_sem_event.WaitWithoutYield(); m_mxcsr_saved.bitmask = _mm_getcsr(); diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index 60cb67d958..e7f02a045f 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -83,6 +83,13 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) L" * Growlanser II and III\n" L" * Wizardry" ) + }, + { + _("Ignore DMAC writes when it is busy."), + pxEt( "!ContextTip:Gamefixes:DMA Busy hack", + L"Known to affect following games:\n" + L" * Mana Khemia 1 (Going \"off campus\")\n" + ) } }; diff --git a/pcsx2/ps2/LegacyDmac.cpp b/pcsx2/ps2/LegacyDmac.cpp index a0ce46eb8d..931dbd5a5e 100644 --- a/pcsx2/ps2/LegacyDmac.cpp +++ b/pcsx2/ps2/LegacyDmac.cpp @@ -429,12 +429,13 @@ __fi bool dmacWrite32( u32 mem, mem32_t& value ) } } - //DMA Writes are invalid to everything except the STR on CHCR when it is busy - if((mem & 0xf0)) + // DMA Writes are invalid to everything except the STR on CHCR when it is busy + // There's timing problems with many games. Gamefix time! + if( CHECK_DMABUSYHACK && (mem & 0xf0) ) { if((psHu32(mem & ~0xff) & 0x100) && dmacRegs.ctrl.DMAE && !psHu8(DMAC_ENABLER+2)) { - //DevCon.Warning("Write to DMA addr %x while STR is busy! Ignoring", mem); + DevCon.Warning("Gamefix: Write to DMA addr %x while STR is busy! Ignoring", mem); return false; } } diff --git a/pcsx2/windows/DwmSetup.cpp b/pcsx2/windows/DwmSetup.cpp index 75246ac9e9..9c3c048d7c 100644 --- a/pcsx2/windows/DwmSetup.cpp +++ b/pcsx2/windows/DwmSetup.cpp @@ -44,6 +44,7 @@ void pxDwm_Load() { Console.WriteLn( "[Dwm] Desktop Window Manager detected." ); + // Seems to set the Windows timer resolution to 10ms if(FAILED(pDwmEnableMMCSS(TRUE))) Console.WriteLn("[Dwm] DwmEnableMMCSS returned a failure code."); }