Gericom / GBARunner3

205 stars 28 forks source link

Handle gba irqs during sd cache fetches #53

Closed Gericom closed 5 months ago

Gericom commented 10 months ago

Currently while an sd cache fetch happens no gba irqs can be handled. This can lead to glitches, especially for vcount and hblank irqs that are used for scanline effects. This happens for example in Mario Kart Super Circuit and F-Zero - Maximum Velocity.

When the irqs don't cause more cache misses, they can be handled completely even during the sd cache fetch, largely preventing glitches. To do this the reentrancy of all memory emulation code needs to be considered. Furthermore context switches need to be implemented. Special care is needed for the return from a gba irq to switch back to the context where the fetch was happening. Some games also have nested irqs, which may also need consideration.