From 92b5620497c6b8f85db5c2f0f06eef630450da1c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 24 Jan 2022 17:19:34 -0500 Subject: [PATCH] VGM export: fix sample glitch if length&255==0 --- src/engine/platform/arcade.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index 28246ef4d..6070dc537 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -259,7 +259,7 @@ int DivPlatformArcade::dispatch(DivCommand c) { addWrite(0x10086+(pcmChan<<3),3+((s->rendOffP>>16)<<3)); addWrite(0x10084+(pcmChan<<3),(s->rendOffP)&0xff); addWrite(0x10085+(pcmChan<<3),(s->rendOffP>>8)&0xff); - addWrite(0x10006+(pcmChan<<3),MIN(255,((s->rendOffP&0xffff)+s->rendLength)>>8)); + addWrite(0x10006+(pcmChan<<3),MIN(255,((s->rendOffP&0xffff)+s->rendLength-1)>>8)); if (s->loopStart<0 || s->loopStart>=(int)s->rendLength) { addWrite(0x10086+(pcmChan<<3),2+((s->rendOffP>>16)<<3)); } else { @@ -286,7 +286,7 @@ int DivPlatformArcade::dispatch(DivCommand c) { addWrite(0x10086+(pcmChan<<3),3+((s->rendOffP>>16)<<3)); addWrite(0x10084+(pcmChan<<3),(s->rendOffP)&0xff); addWrite(0x10085+(pcmChan<<3),(s->rendOffP>>8)&0xff); - addWrite(0x10006+(pcmChan<<3),MIN(255,((s->rendOffP&0xffff)+s->rendLength)>>8)); + addWrite(0x10006+(pcmChan<<3),MIN(255,((s->rendOffP&0xffff)+s->rendLength-1)>>8)); if (s->loopStart<0 || s->loopStart>=(int)s->rendLength) { addWrite(0x10086+(pcmChan<<3),2+((s->rendOffP>>16)<<3)); } else {