Commit Graph

7 Commits

Author SHA1 Message Date
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 1d1c719372 Remove COMPLETED_FRAME flag to simplify things 2023-09-06 00:48:37 +02:00
David Guillen Fandos 1d972ec7ff Improve GBC sound by fixing its deferred rendering
This fixes many games that use the PSG, particuarly the noise generator.
It is very noticeable in explosion/collision sounds with Sonic and Kirby
games, where the noise channel is rapidly tweaked.
2023-07-14 00:37:33 +02:00
David Guillen Fandos 34eb7a3bf3 Fix reset() issue with dynarec flushing
On a reset bios_swi_entrypoint can end up pointing to code over the
watermark, due to block_lookup_address_arm looking up the function
instead of translating it.
Fix it by making flush and init different functions (albeit similar).

Tested by running and resetting games automatically, causing ~10% of
games to crash.
2023-06-09 20:21:35 +02:00
David Guillen Fandos eb50c15b1c Remove CHANGED_PC_STATUS, simplify update flow 2023-04-24 20:24:03 +02:00
David Guillen Fandos bc0a3cf2c1 Fix big endian targets state unserialize
Converted palette was missing a byte swap after state unserialization
This should likely fix WiiU graphics when using rewind and similar
techniques that rely on states.
2021-11-20 11:00:42 +01: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