mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
GPU: Update GPUSTAT if raster has passed to the next line
Fixes games which poll GPUSTAT, including The Next Tetris (Europe).
This commit is contained in:
parent
b0b1fd8f1a
commit
34f1c644f5
|
@ -235,7 +235,14 @@ u32 GPU::ReadRegister(u32 offset)
|
||||||
return ReadGPUREAD();
|
return ReadGPUREAD();
|
||||||
|
|
||||||
case 0x04:
|
case 0x04:
|
||||||
|
{
|
||||||
|
// code can be dependent on the odd/even bit, so update the GPU state when reading.
|
||||||
|
// we can mitigate this slightly by only updating when the raster is actually hitting a new line
|
||||||
|
if (IsRasterScanlinePending())
|
||||||
|
m_tick_event->InvokeEarly(true);
|
||||||
|
|
||||||
return m_GPUSTAT.bits;
|
return m_GPUSTAT.bits;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log_ErrorPrintf("Unhandled register read: %02X", offset);
|
Log_ErrorPrintf("Unhandled register read: %02X", offset);
|
||||||
|
@ -455,6 +462,11 @@ void GPU::UpdateSliceTicks()
|
||||||
m_tick_event->SetPeriod(GPUTicksToSystemTicks(ticks_until_hblank));
|
m_tick_event->SetPeriod(GPUTicksToSystemTicks(ticks_until_hblank));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GPU::IsRasterScanlinePending() const
|
||||||
|
{
|
||||||
|
return (GetPendingGPUTicks() + m_crtc_state.current_tick_in_scanline) >= m_crtc_state.horizontal_total;
|
||||||
|
}
|
||||||
|
|
||||||
void GPU::Execute(TickCount ticks)
|
void GPU::Execute(TickCount ticks)
|
||||||
{
|
{
|
||||||
// convert cpu/master clock to GPU ticks, accounting for partial cycles because of the non-integer divider
|
// convert cpu/master clock to GPU ticks, accounting for partial cycles because of the non-integer divider
|
||||||
|
|
|
@ -310,6 +310,9 @@ protected:
|
||||||
/// Returns the number of pending GPU ticks.
|
/// Returns the number of pending GPU ticks.
|
||||||
TickCount GetPendingGPUTicks() const;
|
TickCount GetPendingGPUTicks() const;
|
||||||
|
|
||||||
|
/// Returns true if enough ticks have passed for the raster to be on the next line.
|
||||||
|
bool IsRasterScanlinePending() const;
|
||||||
|
|
||||||
/// Returns true if scanout should be interlaced.
|
/// Returns true if scanout should be interlaced.
|
||||||
bool IsDisplayInterlaced() const { return !m_force_progressive_scan && m_GPUSTAT.In480iMode(); }
|
bool IsDisplayInterlaced() const { return !m_force_progressive_scan && m_GPUSTAT.In480iMode(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue