atimach64gx: Check end of regs region.

There's only up to 256 regs.
This commit is contained in:
joevt 2024-04-20 01:04:05 -07:00 committed by dingusdev
parent 0d1a2d3010
commit e6d669d187
1 changed files with 2 additions and 2 deletions

View File

@ -539,7 +539,7 @@ uint32_t AtiMach64Gx::read(uint32_t rgn_start, uint32_t offset, int size)
if (offset < this->vram_size) {
return read_mem(&this->vram_ptr[offset], size);
}
if (offset >= this->mm_regs_offset) {
if (offset >= this->mm_regs_offset && offset < this->mm_regs_offset + 0x400) {
return BYTESWAP_SIZED(read_reg(offset - this->mm_regs_offset, size), size);
}
return 0;
@ -561,7 +561,7 @@ void AtiMach64Gx::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int
if (offset < this->vram_size) {
return write_mem(&this->vram_ptr[offset], value, size);
}
if (offset >= this->mm_regs_offset) {
if (offset >= this->mm_regs_offset && offset < this->mm_regs_offset + 0x400) {
return write_reg(offset - this->mm_regs_offset, BYTESWAP_SIZED(value, size), size);
}
return;