From 48aa3b438f1de94d8cdc3293e97022b7fdf37c9d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 20 Oct 2024 18:10:57 -0500 Subject: [PATCH] YM2608: fix possible crash --- src/engine/platform/ym2608.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index a9c430f4b..f025562f7 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -487,11 +487,11 @@ void DivPlatformYM2608::acquire_ymfm(short** buf, size_t len) { ssge->get_last_out(ssgOut); for (int i=(6+isCSM); i<(9+isCSM); i++) { - oscBuf[i]->data[oscBuf[i]->needle++]=ssgOut.data[i-6]<<1; + oscBuf[i]->data[oscBuf[i]->needle++]=ssgOut.data[i-6-isCSM]<<1; } for (int i=(9+isCSM); i<(15+isCSM); i++) { - oscBuf[i]->data[oscBuf[i]->needle++]=(adpcmAChan[i-9]->get_last_out(0)+adpcmAChan[i-9]->get_last_out(1))>>1; + oscBuf[i]->data[oscBuf[i]->needle++]=(adpcmAChan[i-9-isCSM]->get_last_out(0)+adpcmAChan[i-9]->get_last_out(1))>>1; } oscBuf[15+isCSM]->data[oscBuf[15+isCSM]->needle++]=(abe->get_last_out(0)+abe->get_last_out(1))>>1;