Forced the exception check only for ARAM DMA transfers.

Removed the Eternal Darkness boot hack and replaced it with an exception check.
This commit is contained in:
skidau 2013-03-26 08:23:20 +11:00
parent dfa1845ae1
commit 0ccaaee38c
4 changed files with 9 additions and 18 deletions

View File

@ -250,8 +250,6 @@ void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata
if(tsLast) if(tsLast)
tsLast->next = ne; tsLast->next = ne;
tsLast = ne; tsLast = ne;
SetDowncount(ne->type, cyclesIntoFuture);
} }
// Same as ScheduleEvent_Threadsafe(0, ...) EXCEPT if we are already on the CPU thread // Same as ScheduleEvent_Threadsafe(0, ...) EXCEPT if we are already on the CPU thread
@ -262,7 +260,6 @@ void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata)
{ {
std::lock_guard<std::recursive_mutex> lk(externalEventSection); std::lock_guard<std::recursive_mutex> lk(externalEventSection);
event_types[event_type].callback(userdata, 0); event_types[event_type].callback(userdata, 0);
SetDowncount(event_type, 0);
} }
else else
ScheduleEvent_Threadsafe(0, event_type, userdata); ScheduleEvent_Threadsafe(0, event_type, userdata);
@ -416,14 +413,8 @@ void SetMaximumSlice(int maximumSliceLength)
maxSliceLength = maximumSliceLength; maxSliceLength = maximumSliceLength;
} }
void SetDowncount(int event_type, int cycles) void ForceExceptionCheck(int cycles)
{ {
if (event_types[event_type].name == "SetToken")
return;
if (cycles == 0)
cycles = 100; // External Exception latency. Paper Mario TTYD freezes in fight scenes if this is zero.
if (downcount > cycles) if (downcount > cycles)
{ {
slicelength -= (downcount - cycles); // Account for cycles already executed by adjusting the slicelength slicelength -= (downcount - cycles); // Account for cycles already executed by adjusting the slicelength
@ -486,7 +477,6 @@ void MoveEvents()
void Advance() void Advance()
{ {
MoveEvents(); MoveEvents();
int cyclesExecuted = slicelength - downcount; int cyclesExecuted = slicelength - downcount;

View File

@ -92,7 +92,7 @@ void SetFakeTBStartValue(u64 val);
u64 GetFakeTBStartTicks(); u64 GetFakeTBStartTicks();
void SetFakeTBStartTicks(u64 val); void SetFakeTBStartTicks(u64 val);
void SetDowncount(int event_type, int cycles); void ForceExceptionCheck(int cycles);
extern int downcount; extern int downcount;
extern int slicelength; extern int slicelength;

View File

@ -696,6 +696,10 @@ void Do_ARAM_DMA()
g_dspState.DSPControl.DMAState = 1; g_dspState.DSPControl.DMAState = 1;
CoreTiming::ScheduleEvent_Threadsafe(0, et_GenerateDSPInterrupt, INT_ARAM | (1<<16)); CoreTiming::ScheduleEvent_Threadsafe(0, et_GenerateDSPInterrupt, INT_ARAM | (1<<16));
// Force an early exception check. Fixes RE2 audio.
if (g_arDMA.Cnt.count == 4096)
CoreTiming::ForceExceptionCheck(100);
// Real hardware DMAs in 32byte chunks, but we can get by with 8byte chunks // Real hardware DMAs in 32byte chunks, but we can get by with 8byte chunks
if (g_arDMA.Cnt.dir) if (g_arDMA.Cnt.dir)
{ {

View File

@ -642,14 +642,11 @@ void SetCpStatusRegister()
void SetCpControlRegister() void SetCpControlRegister()
{ {
// If the new fifo is being attached We make sure there wont be SetFinish event pending. // If the new fifo is being attached, force an exception check
// This protection fix eternal darkness booting, because the second SetFinish event when it is booting // This fixes the hang while booting Eternal Darkness
// seems invalid or has a bug and hang the game.
if (!fifo.bFF_GPReadEnable && m_CPCtrlReg.GPReadEnable && !m_CPCtrlReg.BPEnable) if (!fifo.bFF_GPReadEnable && m_CPCtrlReg.GPReadEnable && !m_CPCtrlReg.BPEnable)
{ {
ProcessFifoEvents(); CoreTiming::ForceExceptionCheck(0);
PixelEngine::ResetSetFinish();
} }
fifo.bFF_BPInt = m_CPCtrlReg.BPInt; fifo.bFF_BPInt = m_CPCtrlReg.BPInt;