93 Commits

Author SHA1 Message Date
Connor McLaughlin
914b9bf738 SPU: Drain transfer FIFO when cancelling transfer
The busy bit got stuck on otherwise, which broke the Spanish translation
of Vagrant Story.
2021-01-18 20:43:10 +10:00
Connor McLaughlin
11992bde4e TimingEvents: Use function pointers instead of std::function 2021-01-10 01:45:07 +10:00
Connor McLaughlin
15652b4c1f SPU: Fix a few cases where SPU interrupts weren't firing 2021-01-10 01:39:21 +10:00
Connor McLaughlin
73f6521452 SPU: Check voice addresses on IRQ re-enable
NASCAR 2001 music depends on the IRQ firing multiple times, when the
voice address is still set to the IRQ address.
2021-01-05 00:46:41 +10:00
Connor McLaughlin
a90c25d0e7 SPU: Ignore manually set loop address only on first block
Fixes occasional missing dialogue in Valkyrie Profile.
2020-12-06 00:35:54 +10:00
Connor McLaughlin
917fa5dd0e SPU: Only ignore loop address for not-pending-on voices
Fixes softlocks during dialog in The Misadventures of Tron Bonne.
2020-11-25 22:45:03 +10:00
Connor McLaughlin
65be904d15 SPU: Only log warning about FIFO lost on writes 2020-11-14 23:20:28 +10:00
Connor McLaughlin
3f937a2a39 SPU: Port reverb algorithm changes from Mednafen 2020-11-14 23:20:28 +10:00
Connor McLaughlin
34a808c258 SPU: Zero previous block ADPCM samples on key on
Fixes clicking in background in Breath of Fire III.
2020-10-29 01:30:40 +10:00
Connor McLaughlin
1b618b8c46 SPU: Don't block ADPCM loop flag when setting/keying on in same slice
Fixes repeated sounds in Re-Loaded: The Hardcore Sequel.
2020-10-24 20:27:06 +10:00
Connor McLaughlin
98987643b3 SPU: Always reset address on loop end regardless of repeat
Fixes menu music in Madden NFL 99.
2020-10-24 19:42:23 +10:00
Connor McLaughlin
325f83065c SPU: Always inline SPU::ExecuteVoice 2020-10-18 14:54:38 +10:00
Connor McLaughlin
245edd94d7 SPU: Eliminiate conditional in interpolation 2020-10-18 14:54:38 +10:00
Connor McLaughlin
6a4a47fbdf SPU: Set block counter to zero on key on
Fixes clicking in Final Fantasy VIII intro FMV.
2020-10-08 00:41:50 +10:00
Connor McLaughlin
27697d0508 System: Implement CPU overclocking [SAVEVERSION+]
Partial credit to @CookiePLMonster as well.
2020-09-30 23:48:34 +10:00
Connor McLaughlin
13e3095801 Core: Don't link to imgui for libretro core 2020-09-01 12:22:32 +10:00
Connor McLaughlin
223074b78f SPU: Fix activating transfer event with a downcount of 0
Happened when loading states.
2020-08-09 04:29:43 +10:00
Connor McLaughlin
b6f871d2b9
JIT optimizations and refactoring (#675)
* CPU/Recompiler: Use rel32 call where possible for no-args

* JitCodeBuffer: Support using preallocated buffer

* CPU/Recompiler/AArch64: Use bl instead of blr for short branches

* CPU/CodeCache: Allocate recompiler buffer in program space

This means we don't need 64-bit moves for every call out of the
recompiler.

* GTE: Don't store as u16 and load as u32

* CPU/Recompiler: Add methods to emit global load/stores

* GTE: Convert class to namespace

* CPU/Recompiler: Call GTE functions directly

* Settings: Turn into a global variable

* GPU: Replace local pointers with global

* InterruptController: Turn into a global pointer

* System: Replace local pointers with global

* Timers: Turn into a global instance

* DMA: Turn into a global instance

* SPU: Turn into a global instance

* CDROM: Turn into a global instance

* MDEC: Turn into a global instance

* Pad: Turn into a global instance

* SIO: Turn into a global instance

* CDROM: Move audio FIFO to the heap

* CPU/Recompiler: Drop ASMFunctions

No longer needed since we have code in the same 4GB window.

* CPUCodeCache: Turn class into namespace

* Bus: Local pointer -> global pointers

* CPU: Turn class into namespace

* Bus: Turn into namespace

* GTE: Store registers in CPU state struct

Allows relative addressing on ARM.

* CPU/Recompiler: Align code storage to page size

* CPU/Recompiler: Fix relative branches on A64

* HostInterface: Local references to global

* System: Turn into a namespace, move events out

* Add guard pages

* Android: Fix build
2020-07-31 17:09:18 +10:00
Connor McLaughlin
f28ef01d24 CDROM: Move audio FIFO to CDROM class and skip sectors when unempty
Fixes cutscene audio in Nickelodeon Rugrats - Search for Reptar.
2020-07-22 00:05:52 +10:00
Connor McLaughlin
a5fe740e30 Fix a bunch of compiler warnings 2020-07-09 13:30:16 +10:00
Connor McLaughlin
614ea632a5 SPU: Log warning when data is lost due to reg clear 2020-06-29 14:45:03 +10:00
Connor McLaughlin
531c3ad5fa AudioStream: Replace buffer queue with ring buffer
Should achieve a decent overall minimum latency reduction.
2020-06-07 01:22:03 +10:00
Connor McLaughlin
8eb3ac69b2 SPU: Update ADSR envelope when register changes
Fixes menu sounds in Final Fantasy 7 staying audible for too long.
2020-06-02 01:59:49 +10:00
Connor McLaughlin
1eecd50f3d SPU: Run SPU when changing regs on voice pending key-on
Fixes menu/cursor sounds with different frequencies in Final Fantasy 7.
2020-05-18 00:59:13 +10:00
Connor McLaughlin
03080351c8 SPU: Reset ADPCM decoder last samples on key on 2020-05-18 00:50:55 +10:00
Connor McLaughlin
d461d7c87a SPU: Fix reverb write regression from e07d3c9d 2020-05-13 13:47:33 +10:00
Connor McLaughlin
e07d3c9db2 SPU: Fix array bounds overflow in register reads 2020-05-13 12:37:13 +10:00
Connor McLaughlin
634880b5e3 SPU: Clamp before applying main volume not after
Fixes popping in Monkey Magic.
2020-05-12 02:15:18 +10:00
Connor McLaughlin
9959440a3a SPU: Align starting addresses to two words
Fixes interrupts firing early and occasional broken speech in Valkyrie
Profile.
2020-05-08 21:36:47 +10:00
Connor McLaughlin
226459b60f SPU: Add missing register read for ENDX 2020-04-30 01:12:17 +10:00
Connor McLaughlin
a5ff904b33 SPU: Clear ENDX flag on key on 2020-04-28 20:30:16 +10:00
Connor McLaughlin
be9033b6c0 SPU: Add missing clamp in ADPCM decoder 2020-04-28 17:55:43 +10:00
Connor McLaughlin
b16ecd7a86 SPU: ENDX register should get set when looping as well as muting 2020-04-28 16:57:14 +10:00
Connor McLaughlin
8605620c24 SPU: Force all voices off when SPUCNT.15=0 2020-04-27 23:33:24 +10:00
Connor McLaughlin
191c3450cc SPU: Port reverb algorithm from Mednafen-PSX 2020-04-25 00:37:02 +10:00
Connor McLaughlin
e34b78ab80 SPU: Fix pitch modulation 2020-04-24 15:50:35 +10:00
Connor McLaughlin
045c4d1745 SPU: Fix adsr_volume read for pending key-on voice
Fixes cutscene audio in Spyro 2, probably others.
2020-04-19 18:19:55 +10:00
Connor McLaughlin
fc3efebb38 Revert "SPU: Use reverb formula from Mednafen-PSX"
This reverts commit 809b9f89ca0a24934ffa13c7901345ed0aa82eeb.
2020-04-11 15:04:04 +10:00
Connor McLaughlin
809b9f89ca SPU: Use reverb formula from Mednafen-PSX 2020-04-11 00:40:28 +10:00
Connor McLaughlin
0006052728 SPU: Fix some registers not being saved to state 2020-04-08 20:33:39 +10:00
Connor McLaughlin
1d948a53e0 SPU: Reinitialize transfer event on loading state 2020-04-02 00:17:15 +10:00
Connor McLaughlin
423f04325f SPU: Implement timing for RAM reads/writes 2020-03-29 01:12:37 +10:00
Connor McLaughlin
f23bcc0faa SPU: Ignore loop start flag when repeat address is explicitly set
Fixes dialog/softlock in Thousand Arms.
2020-03-27 01:42:59 +10:00
Connor McLaughlin
08ad5aad53 SPU: Run muted voices when IRQ is enabled
Fixes SPU timeout in Casper. We can still optimize for most games where
interrupts are not used by completely ignoring muted voices in those.
2020-03-27 01:42:43 +10:00
Connor McLaughlin
18cc3d5932 SPU: Stub out external volume registers
If nothing else, it'll avoid spamming the log.
2020-03-24 00:22:02 +10:00
Connor McLaughlin
7317c83a3c SPU: Implement internal volume sweep register reads
Fixes muted audio in Michelin Rally Masters.
2020-03-24 00:21:52 +10:00
Connor McLaughlin
4c2597acf3 SPU: Process key on/off at next 44100hz cycle
Some games, particularly CART World Series and Monkey Hero, depend on
this behaviour.
2020-03-24 00:21:32 +10:00
Connor McLaughlin
7ac48cd8d6 SPU: Swap read/write ready bits
Nocash might be incorrect here.
2020-03-23 00:29:18 +10:00
Connor McLaughlin
7a89c787b8 SPU: Fix some reverb registers not being saved to state 2020-03-23 00:29:10 +10:00
Connor McLaughlin
d47a82d591 SPU: Implement noise functionality 2020-03-23 00:29:00 +10:00