dsp: mask aica ram addr to avoid overflow

fixes ninja assault crash when starting a game
This commit is contained in:
Flyinghead 2018-11-15 21:58:04 +01:00
parent 1055c8366f
commit 52a2d3dbdc
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}
}