Commit Graph

7 Commits

Author SHA1 Message Date
David Guillen Fandos 64d0a066b4 Move interpreter to use CXX so that we can simplify some bits 2023-11-03 00:09:08 +01:00
David Guillen Fandos 7127ec6408 Improve DMA and BIOS reads 2023-10-01 23:51:53 +02:00
David Guillen Fandos ae048beb9c Rework RTC and break it into GPIO, with RTC and Rumble (GPIO3)
This adds Rumble support for GPIO3-enabled games (Drill Dozer).
2023-09-20 22:46:06 +02:00
David Guillen Fandos c0d8ffaa38 Adding DMA transfer "Sleep" mode
This accounts for DMA stealing cycles from the CPU whenever the CPU
triggers a DMA (does not affect H/V blank or sound DMAs).
Works by moving the CPU to a PAUSED state where the cycles are accounted
for, reusing a similar mechanism for HALT/STOP.

Fixes a couple of games, notably GTA that has a DMA/IRQ race condition
(likely a bug really) if cycles are grossly miscalculated.
2023-09-08 19:44:13 +02:00
David Guillen Fandos 2352adcc50 Improve savestate loading to avoid corrupting the current state
It should not happen since the magic value and version would normally
discard incompatible savestates, however it's preferrable to check
before loading the state (it's just some minor sanity check).
2023-09-07 20:26:44 +02:00
David Guillen Fandos 55c6a69ccd Move flag regs to unserialized area
This is only used in x86 (mips and arm use native regs and never spill)
2021-08-28 17:50:25 +02:00
David Guillen Fandos 7068cbc95b New savestate implementation
This uses BSON as savestate format, to allow external tools to parse it
(so that we can add proper test of the states). The BSON is not 100%
correct according to spec (no ordered keys) but can be parsed by most
libraries.

This fixes also a bug in the savestate palette color recalculation that
was wrongly overwritting the original palette (which could cause some
problems on some games).

Also fixes some potential issues by serializing some more stuff and
cleans up unused stuff.

Testing shows that states look good and there's only minor differences
in audio ticks, related to buffer sizes (since buffer flushes are
de-synced from video frames due to different frequency).
2021-08-24 17:15:27 +02:00