Commit Graph

43 Commits

Author SHA1 Message Date
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 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 8207775256 Fix out of bounds read bug on open bus read
This bug doesn't affect many games but makes sanitizers unhappy.
Also fix some minor FIFO clear bug
2021-08-24 19:55:37 +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 a3377c2ac1 Minor DMA cleanup 2021-08-21 18:10:12 +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
David Guillen Fandos 836e51b694 Fix some UB behaviour 2021-07-01 12:06:57 +02:00
David Guillen Fandos 8dbf5f6c17 Enable big-endian devices: gc/wii
This patch adds big-endian compatibility in gpsp (in general but only
for the interpreter). There's no performance hit for little-endian
platforms (should be a no-op) and only add a small overhead in memory
accesses for big-endian platforms.

Most memory accesses are wrapped with a byteswap instruction and I/O reg
accesses are also rewired for proper access (using macros). Video
rendering has been fixed to also do byteswaps but there's a couple of
games and rendering modes that still seem broken (but they amount to
less than 20 games in my tests with 1K ROMs).

This also adds build rules and CI for NGC/WII/WIIU (untested)
2021-06-27 01:16:28 +02:00
David Guillen Fandos 349e47f0b2 Small fixes to division by zero
This causes crashes in PSP quite often in many games. Other CPUs might
(depending on the processor state) silently return zero or some
undefined value.
The fix is borrowed from ReGBA's codebase
2021-02-23 20:27:59 +01:00
twinaphex 6ddc6f494d Turn two functions static 2014-12-13 05:01:02 +01:00
twinaphex 320bf35a8c Get rid of unnecessary macros for sound_timer_queue functions - it
is pretty apparent what this does on its face, and a macro is somewhat
unnecessary for so few invocations
2014-12-12 17:33:29 +01:00
twinaphex 7a0b0cba45 Style nits 2014-12-10 15:47:19 +01:00
twinaphex 1cd8bb5235 Get rid of unused variable 'audio_buffer_size' to silence another warning 2014-12-10 15:29:29 +01:00
aliaspider f10da5d664 cleanups 2014-12-10 13:10:25 +01:00
aliaspider ad485d434a implement retro_serialize/unserialize 2014-12-10 11:06:17 +01:00
twinaphex 35b71ff223 Clean up some unused stuff 2014-12-09 21:32:00 +01:00
twinaphex 99e6e574d3 De-macroize render_sample macros 2014-12-09 21:21:09 +01:00
twinaphex 01ac6359fd Get rid of gbc_sound_load_wave_ram macro 2014-12-09 19:13:35 +01:00
twinaphex 109ba4d286 Simplify gbc_sound_wave_update 2014-12-09 19:10:45 +01:00
twinaphex a6905d9da2 Simplify sound_timer function 2014-12-09 19:02:07 +01:00
twinaphex 5fc2752771 Simplify render_audio 2014-12-09 17:52:17 +01:00
twinaphex 8baf91c105 Remove non-libretro code in sound.c 2014-12-09 16:55:59 +01:00
aliaspider a859afadfd fix sound 2014-12-09 05:47:45 +01:00
aliaspider cd185c849b enable sound ( still broken ) 2014-12-09 05:36:30 +01:00
aliaspider b69fee8b31 video output now works in statically linked builds.
core can't be used as a shared library yet due to the dynarec not
working when compiled with -fPIC
2014-12-09 05:16:09 +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
Dave ffa573f880 raspberry pi port 2013-03-07 23:16:38 +02:00
notaz 6a298de481 u8/caanoo release 2012-10-06 21:04:55 +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 2455b6a30e unify non-psp synchronize(), fix a few sound issues
..like ignoring real buffer size and not stopping sound thread on exit
2011-09-04 20:19:07 +03:00
notaz ee0a3871f9 get rid of GP2X_BUILD checks where they are not really needed 2011-09-03 01:01:17 +03:00
notaz e9c7b1376a race condition fix from 2007 (gpsp09-2xb_1) 2009-05-21 18:49:42 +03:00
notaz 2823a4c819 original source from gpsp09-2xb_src.tar.bz2 2009-05-21 18:48:31 +03:00