mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 07:35:41 +00:00
CPU/PGXP: Track valid Z for lower/upper halves of 32-bit values
Dragon Valor writes both lower and upper halfwords separately from non-valid-Z values. The Z needs to be cleared out.
This commit is contained in:
parent
ea4efb4e52
commit
7476baced6
|
@ -46,7 +46,9 @@ enum : u32
|
|||
VALID_X = (1u << 0),
|
||||
VALID_Y = (1u << 1),
|
||||
VALID_Z = (1u << 2),
|
||||
VALID_TAINTED_Z = (1u << 31),
|
||||
VALID_LOWZ = (1u << 16), // Valid Z from the low part of a 32-bit value.
|
||||
VALID_HIGHZ = (1u << 17), // Valid Z from the high part of a 32-bit value.
|
||||
VALID_TAINTED_Z = (1u << 31), // X/Y has been changed, Z may not be accurate.
|
||||
|
||||
VALID_XY = (VALID_X | VALID_Y),
|
||||
VALID_XYZ = (VALID_X | VALID_Y | VALID_Z),
|
||||
|
@ -338,7 +340,10 @@ ALWAYS_INLINE_RELEASE void CPU::PGXP::WriteMem(const PGXP_value* value, u32 addr
|
|||
PGXP_value* pMem = GetPtr(addr);
|
||||
|
||||
if (pMem)
|
||||
{
|
||||
*pMem = *value;
|
||||
pMem->flags |= VALID_LOWZ | VALID_HIGHZ;
|
||||
}
|
||||
}
|
||||
|
||||
ALWAYS_INLINE_RELEASE void CPU::PGXP::WriteMem16(const PGXP_value* src, u32 addr)
|
||||
|
@ -368,6 +373,13 @@ ALWAYS_INLINE_RELEASE void CPU::PGXP::WriteMem16(const PGXP_value* src, u32 addr
|
|||
{
|
||||
dest->z = src->z;
|
||||
dest->SetValid(COMP_Z);
|
||||
dest->flags |= hiword ? VALID_HIGHZ : VALID_LOWZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest->flags &= hiword ? ~VALID_HIGHZ : ~VALID_LOWZ;
|
||||
if (dest->flags & VALID_Z && !(dest->flags & (VALID_HIGHZ | VALID_LOWZ)))
|
||||
dest->flags &= ~VALID_Z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue