PPU: Sprite interlace flag support (untested)
This commit is contained in:
parent
76d1aa82e5
commit
002cda8cf6
2 changed files with 9 additions and 7 deletions
15
Core/Ppu.cpp
15
Core/Ppu.cpp
|
@ -128,6 +128,7 @@ void Ppu::EvaluateNextLineSprites()
|
||||||
memset(_spritePalette, 0, sizeof(_spritePalette));
|
memset(_spritePalette, 0, sizeof(_spritePalette));
|
||||||
_spriteCount = 0;
|
_spriteCount = 0;
|
||||||
uint16_t totalWidth = 0;
|
uint16_t totalWidth = 0;
|
||||||
|
uint16_t screenY = _objInterlace ? ((_frameCount & 0x01) ? ((_scanline << 1) + 1) : (_scanline << 1)) : _scanline;
|
||||||
|
|
||||||
for(int i = 0; i < 512; i += 4) {
|
for(int i = 0; i < 512; i += 4) {
|
||||||
uint8_t y = _oamRam[i + 1];
|
uint8_t y = _oamRam[i + 1];
|
||||||
|
@ -138,7 +139,7 @@ void Ppu::EvaluateNextLineSprites()
|
||||||
uint8_t largeSprite = (highTableValue & 0x02) >> 1;
|
uint8_t largeSprite = (highTableValue & 0x02) >> 1;
|
||||||
uint8_t height = _oamSizes[_oamMode][largeSprite][1] << 3;
|
uint8_t height = _oamSizes[_oamMode][largeSprite][1] << 3;
|
||||||
|
|
||||||
if(y > _scanline + 1 || y + height <= _scanline + 1) {
|
if(y > screenY + 1 || y + height <= screenY + 1) {
|
||||||
//Not visible on this scanline
|
//Not visible on this scanline
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -168,11 +169,11 @@ void Ppu::EvaluateNextLineSprites()
|
||||||
uint8_t yOffset;
|
uint8_t yOffset;
|
||||||
int rowOffset;
|
int rowOffset;
|
||||||
if(info.VerticalMirror) {
|
if(info.VerticalMirror) {
|
||||||
yOffset = (height - 1 - (_scanline + 1 - y)) & 0x07;
|
yOffset = (height - 1 - (screenY + 1 - y)) & 0x07;
|
||||||
rowOffset = (height - 1 - (_scanline + 1 - y)) >> 3;
|
rowOffset = (height - 1 - (screenY + 1 - y)) >> 3;
|
||||||
} else {
|
} else {
|
||||||
yOffset = (_scanline + 1 - y) & 0x07;
|
yOffset = (screenY + 1 - y) & 0x07;
|
||||||
rowOffset = (_scanline + 1 - y) >> 3;
|
rowOffset = (screenY + 1 - y) >> 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t row = (info.TileRow + rowOffset) & 0x0F;
|
uint8_t row = (info.TileRow + rowOffset) & 0x0F;
|
||||||
|
@ -1428,7 +1429,7 @@ void Ppu::Write(uint32_t addr, uint8_t value)
|
||||||
_colorMathClipMode = (ColorWindowMode)((value >> 6) & 0x03);
|
_colorMathClipMode = (ColorWindowMode)((value >> 6) & 0x03);
|
||||||
_colorMathPreventMode = (ColorWindowMode)((value >> 4) & 0x03);
|
_colorMathPreventMode = (ColorWindowMode)((value >> 4) & 0x03);
|
||||||
_colorMathAddSubscreen = (value & 0x02) != 0;
|
_colorMathAddSubscreen = (value & 0x02) != 0;
|
||||||
_directColorMode = (value & 0x01) != 0; //TODO
|
_directColorMode = (value & 0x01) != 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x2131:
|
case 0x2131:
|
||||||
|
@ -1457,7 +1458,7 @@ void Ppu::Write(uint32_t addr, uint8_t value)
|
||||||
_mode7.ExtBgEnabled = (value & 0x40) != 0;
|
_mode7.ExtBgEnabled = (value & 0x40) != 0;
|
||||||
_hiResMode = (value & 0x08) != 0;
|
_hiResMode = (value & 0x08) != 0;
|
||||||
_overscanMode = (value & 0x04) != 0;
|
_overscanMode = (value & 0x04) != 0;
|
||||||
//_objInterlace = (value & 0x02) != 0; //TODO
|
_objInterlace = (value & 0x02) != 0;
|
||||||
_screenInterlace = (value & 0x01) != 0;
|
_screenInterlace = (value & 0x01) != 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ private:
|
||||||
|
|
||||||
bool _hiResMode = false;
|
bool _hiResMode = false;
|
||||||
bool _screenInterlace = false;
|
bool _screenInterlace = false;
|
||||||
|
bool _objInterlace = false;
|
||||||
bool _overscanMode = false;
|
bool _overscanMode = false;
|
||||||
bool _directColorMode = false;
|
bool _directColorMode = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue