PPU: Fixed out-of-bounds memory accesses due to vram/cgram pointers not wrapping
This commit is contained in:
parent
da2d93aaed
commit
fa36f36314
1 changed files with 3 additions and 3 deletions
|
@ -183,7 +183,7 @@ void Ppu::Write(uint32_t addr, uint8_t value)
|
|||
//VMDATAL - VRAM Data Write low byte
|
||||
_vram[_vramAddress << 1] = value;
|
||||
if(!_vramAddrIncrementOnSecondReg) {
|
||||
_vramAddress += _vramIncrementValue;
|
||||
_vramAddress = (_vramIncrementValue + _vramIncrementValue) & 0x7FFF;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -191,7 +191,7 @@ void Ppu::Write(uint32_t addr, uint8_t value)
|
|||
//VMDATAH - VRAM Data Write high byte
|
||||
_vram[(_vramAddress << 1) + 1] = value;
|
||||
if(_vramAddrIncrementOnSecondReg) {
|
||||
_vramAddress += _vramIncrementValue;
|
||||
_vramAddress = (_vramIncrementValue + _vramIncrementValue) & 0x7FFF;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -203,7 +203,7 @@ void Ppu::Write(uint32_t addr, uint8_t value)
|
|||
case 0x2122:
|
||||
//CGRAM Data write (CGDATA)
|
||||
_cgram[_cgramAddress] = value;
|
||||
_cgramAddress++;
|
||||
_cgramAddress = (_cgramAddress + 1) & (Ppu::CgRamSize - 1);
|
||||
break;
|
||||
|
||||
case 0x4200:
|
||||
|
|
Loading…
Add table
Reference in a new issue