From ef33b2211472de446634778cec555d9718737a8c Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Sat, 13 Mar 2010 08:23:07 +0000 Subject: [PATCH] Attempted fix to get gust games and fatal frame working w/o a gamefix hack. I was only able to test Ar Tonelico which worked with this fix, comment if this breaks fatal frame (or a gust game or anything else...) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2706 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/HwWrite.cpp | 27 ++++++++++++++------------- pcsx2/x86/microVU.cpp | 4 ---- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/pcsx2/HwWrite.cpp b/pcsx2/HwWrite.cpp index f13284a616..2645af5fef 100644 --- a/pcsx2/HwWrite.cpp +++ b/pcsx2/HwWrite.cpp @@ -30,9 +30,10 @@ static __forceinline void DmaExec8( void (*func)(), u32 mem, u8 value ) u32 qwcRegister = (mem | 0x20) & ~0x1; //Need to remove the lower bit else we end up clearing TADR //It's invalid for the hardware to write a DMA while it is active, not without Suspending the DMAC - if ((value & 0x1) && ((psHu8(mem) & 0x1) == 0x1) && dmacRegs->ctrl.DMAE) - { - DevCon.Warning( L"DMAExec8 Attempt to run DMA while one is already active in %s(%x)", ChcrName(mem), mem ); + if ((value & 0x1) && ((psHu8(mem) & 0x1) == 0x1) && dmacRegs->ctrl.DMAE) { + DevCon.Warning(L"DMAExec8 Attempt to run DMA while one is already active in %s(%x)", ChcrName(mem), mem); + func(); + return; } // Upper 16bits of QWC should not be written since QWC is 16bits in size. @@ -56,9 +57,10 @@ static __forceinline void DmaExec16( void (*func)(), u32 mem, u16 value ) tDMA_CHCR chcr(value); //It's invalid for the hardware to write a DMA while it is active, not without Suspending the DMAC - if (chcr.STR && reg->chcr.STR && dmacRegs->ctrl.DMAE) - { - DevCon.Warning( L"DMAExec16 Attempt to run DMA while one is already active in %s(%x)", ChcrName(mem), mem ); + if (chcr.STR && reg->chcr.STR && dmacRegs->ctrl.DMAE) { + DevCon.Warning(L"DMAExec16 Attempt to run DMA while one is already active in %s(%x)", ChcrName(mem), mem ); + func(); + return; } // Note: pad is the padding right above qwc, so we're testing whether qwc @@ -84,13 +86,12 @@ static void DmaExec( void (*func)(), u32 mem, u32 value ) tDMA_CHCR chcr(value); //It's invalid for the hardware to write a DMA while it is active, not without Suspending the DMAC - if (chcr.STR && reg->chcr.STR && dmacRegs->ctrl.DMAE) - { - DevCon.Warning( L"DMAExec32 Attempt to run DMA while one is already active in %s(%x)", ChcrName(mem), mem ); - //DevCon.Warning( L"DMAExec32: chcr value = 0x%x", value); - // Returning here breaks every single Gust game written. :( - // Not returning here breaks Fatal Frame. Gamefix time. - if (CHECK_DMAEXECHACK) return; + if (chcr.STR && reg->chcr.STR && dmacRegs->ctrl.DMAE) { + DevCon.Warning(L"DMAExec32 Attempt to run DMA while one is already active in %s(%x)", ChcrName(mem), mem); + // When DMA is active only STR field is writable, so we just + // call the dma transfer function w/o modifying CHCR contents... + func(); + return; // Test with Gust games and fatal frame } // Note: pad is the padding right above qwc, so we're testing whether qwc diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index a5bf8a9abe..14da883f17 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -249,11 +249,7 @@ _mVUt _f void* mVUsearchProg(u32 startPC, uptr pState) { microProgramQuick& quick = mVU->prog.quick[startPC/8]; microProgramList& list = mVU->prog.prog [startPC/8]; if(!quick.prog) { // If null, we need to search for new program -#ifdef __LINUX__ deque::iterator it = list.list->begin(); -#else - deque::const_iterator it = list.list->begin(); -#endif for ( ; it != list.list->end(); it++) { if (mVUcmpProg(*it[0], 0)) { quick.block = it[0]->block[startPC/8];