changeset 2520:0e9d7ef03983

Update PCM cur_ptr to ST when channel is not playing. Fixes sound effects in Final Fight CD
author Michael Pavone <pavone@retrodev.com>
date Mon, 07 Oct 2024 21:38:54 -0700
parents 0fae9d6a77c4
children 8cf7cadc17ee
files rf5c164.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rf5c164.c	Sat Oct 05 23:31:59 2024 -0700
+++ b/rf5c164.c	Mon Oct 07 21:38:54 2024 -0700
@@ -107,6 +107,11 @@
 			} else {
 				pcm->channels[pcm->cur_channel].trigger = 0;
 			}
+		} else if (pcm->flags & FLAG_SOUNDING) {
+			//Final Fight CD seems to expect this to get updated to some non-terminal value while the channel is not enabled
+			//Ares seems to keep the current pointer and ST in sync at all times for this state
+			//TODO: confirm exact behavior on hardware
+			pcm->channels[pcm->cur_channel].cur_ptr = pcm->channels[pcm->cur_channel].regs[ST] << 19;
 		}
 		write_if_not_sounding(pcm);
 		CHECK;