Forced the external exception check to occur sooner by changing the downcount.
Fixes issue 5825.
This commit is contained in:
parent
bb3ce1f8d3
commit
1d550f4496
|
@ -250,6 +250,8 @@ 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
|
||||||
|
@ -260,6 +262,7 @@ 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);
|
||||||
|
@ -413,6 +416,21 @@ void SetMaximumSlice(int maximumSliceLength)
|
||||||
maxSliceLength = maximumSliceLength;
|
maxSliceLength = maximumSliceLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetDowncount(int event_type, 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)
|
||||||
|
{
|
||||||
|
slicelength -= (downcount - cycles); // Account for cycles already executed by adjusting the slicelength
|
||||||
|
downcount = cycles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ResetSliceLength()
|
void ResetSliceLength()
|
||||||
{
|
{
|
||||||
maxSliceLength = MAX_SLICE_LENGTH;
|
maxSliceLength = MAX_SLICE_LENGTH;
|
||||||
|
|
|
@ -92,6 +92,8 @@ void SetFakeTBStartValue(u64 val);
|
||||||
u64 GetFakeTBStartTicks();
|
u64 GetFakeTBStartTicks();
|
||||||
void SetFakeTBStartTicks(u64 val);
|
void SetFakeTBStartTicks(u64 val);
|
||||||
|
|
||||||
|
void SetDowncount(int event_type, int cycles);
|
||||||
|
|
||||||
extern int downcount;
|
extern int downcount;
|
||||||
extern int slicelength;
|
extern int slicelength;
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ void Init()
|
||||||
isHiWatermarkActive = false;
|
isHiWatermarkActive = false;
|
||||||
isLoWatermarkActive = false;
|
isLoWatermarkActive = false;
|
||||||
|
|
||||||
et_UpdateInterrupts = CoreTiming::RegisterEvent("UpdateInterrupts", UpdateInterrupts_Wrapper);
|
et_UpdateInterrupts = CoreTiming::RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Read16(u16& _rReturnValue, const u32 _Address)
|
void Read16(u16& _rReturnValue, const u32 _Address)
|
||||||
|
|
Loading…
Reference in New Issue