From 52a2d3dbdc036cef59fa207c21a21dd7a12f1cfd Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Thu, 15 Nov 2018 21:58:04 +0100 Subject: [PATCH] dsp: mask aica ram addr to avoid overflow fixes ninja assault crash when starting a game --- core/hw/aica/dsp_interp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/hw/aica/dsp_interp.cpp b/core/hw/aica/dsp_interp.cpp index 045140c47..09b1a74f0 100644 --- a/core/hw/aica/dsp_interp.cpp +++ b/core/hw/aica/dsp_interp.cpp @@ -266,7 +266,7 @@ void AICADSP_Step(struct dsp_t *DSP) //if (NOFL) // MEMVAL[(step + 2) & 3] = (*(s16 *)&aica_ram[ADDR]) << 8; //else - MEMVAL[(step + 2) & 3] = UNPACK(*(u16 *)&aica_ram[ADDR]); + MEMVAL[(step + 2) & 3] = UNPACK(*(u16 *)&aica_ram[ADDR & ARAM_MASK]); } if (MWT) { @@ -274,7 +274,7 @@ void AICADSP_Step(struct dsp_t *DSP) //if (NOFL) // *(s16 *)&aica_ram[ADDR] = SHIFTED >> 8; //else - *(u16 *)&aica_ram[ADDR] = PACK(SHIFTED); + *(u16 *)&aica_ram[ADDR & ARAM_MASK] = PACK(SHIFTED); } } }