fix potential issues with 32bit GPU writes

This commit is contained in:
Arisotura 2022-04-10 15:11:30 +02:00
parent 0294bcb5f2
commit 529a690089
1 changed files with 24 additions and 23 deletions

View File

@ -532,31 +532,32 @@ void Unit::Write32(u32 addr, u32 val)
return; return;
} }
if (!Enabled) return; if (Enabled)
switch (addr & 0x00000FFF)
{ {
case 0x028: switch (addr & 0x00000FFF)
if (val & 0x08000000) val |= 0xF0000000; {
BGXRef[0] = val; case 0x028:
if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0]; if (val & 0x08000000) val |= 0xF0000000;
return; BGXRef[0] = val;
case 0x02C: if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0];
if (val & 0x08000000) val |= 0xF0000000; return;
BGYRef[0] = val; case 0x02C:
if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0]; if (val & 0x08000000) val |= 0xF0000000;
return; BGYRef[0] = val;
if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0];
return;
case 0x038: case 0x038:
if (val & 0x08000000) val |= 0xF0000000; if (val & 0x08000000) val |= 0xF0000000;
BGXRef[1] = val; BGXRef[1] = val;
if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1]; if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1];
return; return;
case 0x03C: case 0x03C:
if (val & 0x08000000) val |= 0xF0000000; if (val & 0x08000000) val |= 0xF0000000;
BGYRef[1] = val; BGYRef[1] = val;
if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1]; if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1];
return; return;
}
} }
Write16(addr, val&0xFFFF); Write16(addr, val&0xFFFF);