Commit Graph

27 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 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 7f07da9ade Make sound control deterministic by having proper reset 2023-06-12 20:24:18 +02:00
David Guillen Fandos 8c6ff8d358 Simplify I/O writes further
Improve FIFO writes, make them a bit faster
2023-04-20 00:52:30 +02:00
David Guillen Fandos bc8c07272b Add DMA cycle accounting for H/V blank and sound DMA
This is just responsible for a few cycles every frame (could be around 1
and 2% depending on the game usage) but makes emulation a bit more
accurate and potentially faster.
2021-12-21 12:02:48 +01:00
jdgleaver 20bd7c111b Calculate number of audio samples to read per frame deterministically 2021-11-29 17:45:06 +00:00
jdgleaver f8359a74d3 Send audio samples to frontend with correct pacing 2021-11-29 15:10:38 +00:00
David Guillen Fandos 8da094d7e0 Add 60FPS overclock hack
Let's see, this should fix issues on platforms that do not support
running the emu at 59.73 FPS. We run the emu at fake 60fps, which means
we produce more audio samples than the original device.

Instead of missing samples (which produce cracks in the audio) we should
be producing some extra samples, which will result in a frame drop every
now and then (like every minute or so, so it's not noticeable).
2021-10-20 01:15:40 +02:00
David Guillen Fandos 6a59c71d55 Get rid of enums (to u32) for better compat
Serialization code needs u32 to ensure compatiblity. In platforms with
short enums this goes very wrong. Fixes issues on 3DS platform.
2021-10-15 21:28:40 +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
David Guillen Fandos 1e976fb312 Remove unused stuff and fix const variables
Trying to figure out what needs to be part of a savestate :)
2021-08-24 10:57:30 +02:00
David Guillen Fandos 5fe5121c81 Remove pointer from sound struct, use index instead
This makes serialization possible, previously it was broken.
2021-07-27 21:45:15 +02:00
David Guillen Fandos c9421e6929 Some small cleanup to make the code more C++ conformant 2021-07-11 13:35:21 +02:00
twinaphex 7a0b0cba45 Style nits 2014-12-10 15:47:19 +01:00
aliaspider a926a68eb3 cleanups 2014-12-10 12:53:26 +01:00
aliaspider ad485d434a implement retro_serialize/unserialize 2014-12-10 11:06:17 +01:00
twinaphex 471a94f890 Move IN_MEMORY_C ifdefs to memory.c 2014-12-09 21:37:58 +01:00
twinaphex 35b71ff223 Clean up some unused stuff 2014-12-09 21:32:00 +01:00
twinaphex 8baf91c105 Remove non-libretro code in sound.c 2014-12-09 16:55:59 +01:00
aliaspider cd185c849b enable sound ( still broken ) 2014-12-09 05:36:30 +01:00
aliaspider 8f9b841f72 can compile 2014-12-09 00:17:28 +01:00
twinaphex 093a70482f Get rid of PND_BUILD/RPI_BUILD/POLLUX_BUILD/GIZ_BUILD 2014-07-14 04:50:52 +02:00
notaz 108c704a36 initial Caanoo port
plus some random tweaks
2012-10-06 19:15:06 +03:00
notaz 40a392b00d make sound reinitable
this will be used for Caanoo overclocking workaround
2012-10-05 02:00:26 +03:00
notaz 2f1c528a6c tweak sound buffering and timing to better match pandora's refresh.
this also changes how direct sound channels are started and
sample step precision is increased to hopefully fix gbc + direct
channel desync that has been reported on the forums.
2011-09-08 00:48:33 +03:00
notaz bbba320911 enable -Wall and fix warnings reported by it 2011-09-06 00:18:06 +03:00
notaz 2823a4c819 original source from gpsp09-2xb_src.tar.bz2 2009-05-21 18:48:31 +03:00