mirror of https://github.com/snes9xgit/snes9x.git
Pass OAM tests now.
This commit is contained in:
parent
645f47187a
commit
893069da5f
2
ppu.cpp
2
ppu.cpp
|
@ -485,7 +485,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
|||
|
||||
case 0x2102: // OAMADDL
|
||||
PPU.OAMAddr = ((Memory.FillRAM[0x2103] & 1) << 8) | Byte;
|
||||
PPU.OAMFlip = 2;
|
||||
PPU.OAMFlip = 0;
|
||||
PPU.OAMReadFlip = 0;
|
||||
PPU.SavedOAMAddr = PPU.OAMAddr;
|
||||
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
|
||||
|
|
44
ppu.h
44
ppu.h
|
@ -419,6 +419,12 @@ static inline void FLUSH_REDRAW (void)
|
|||
|
||||
static inline void REGISTER_2104 (uint8 Byte)
|
||||
{
|
||||
if (!(PPU.OAMFlip & 1))
|
||||
{
|
||||
PPU.OAMWriteRegister &= 0xff00;
|
||||
PPU.OAMWriteRegister |= Byte;
|
||||
}
|
||||
|
||||
if (PPU.OAMAddr & 0x100)
|
||||
{
|
||||
int addr = ((PPU.OAMAddr & 0x10f) << 1) + (PPU.OAMFlip & 1);
|
||||
|
@ -440,33 +446,8 @@ static inline void REGISTER_2104 (uint8 Byte)
|
|||
pObj->Size = Byte & 128;
|
||||
}
|
||||
|
||||
PPU.OAMFlip ^= 1;
|
||||
if (!(PPU.OAMFlip & 1))
|
||||
{
|
||||
++PPU.OAMAddr;
|
||||
PPU.OAMAddr &= 0x1ff;
|
||||
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
|
||||
{
|
||||
PPU.FirstSprite = (PPU.OAMAddr & 0xfe) >> 1;
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1))
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!(PPU.OAMFlip & 1))
|
||||
{
|
||||
PPU.OAMWriteRegister &= 0xff00;
|
||||
PPU.OAMWriteRegister |= Byte;
|
||||
PPU.OAMFlip |= 1;
|
||||
if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1))
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
else
|
||||
else if (PPU.OAMFlip & 1)
|
||||
{
|
||||
PPU.OAMWriteRegister &= 0x00ff;
|
||||
uint8 lowbyte = (uint8) (PPU.OAMWriteRegister);
|
||||
|
@ -499,15 +480,24 @@ static inline void REGISTER_2104 (uint8 Byte)
|
|||
PPU.OBJ[addr].VPos = highbyte;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PPU.OAMFlip &= ~1;
|
||||
PPU.OAMFlip ^= 1;
|
||||
if (!(PPU.OAMFlip & 1))
|
||||
{
|
||||
++PPU.OAMAddr;
|
||||
PPU.OAMAddr &= 0x1ff;
|
||||
if (PPU.OAMPriorityRotation && PPU.FirstSprite != (PPU.OAMAddr >> 1))
|
||||
{
|
||||
PPU.FirstSprite = (PPU.OAMAddr & 0xfe) >> 1;
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PPU.OAMPriorityRotation && (PPU.OAMAddr & 1))
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// This code is correct, however due to Snes9x's inaccurate timings, some games might be broken by this chage. :(
|
||||
|
|
Loading…
Reference in New Issue