Skip to content

Commit

Permalink
fix potential issues with 32bit GPU writes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Apr 10, 2022
1 parent 0294bcb commit 529a690
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/GPU2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,31 +532,32 @@ void Unit::Write32(u32 addr, u32 val)
return;
}

if (!Enabled) return;

switch (addr & 0x00000FFF)
if (Enabled)
{
case 0x028:
if (val & 0x08000000) val |= 0xF0000000;
BGXRef[0] = val;
if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0];
return;
case 0x02C:
if (val & 0x08000000) val |= 0xF0000000;
BGYRef[0] = val;
if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0];
return;

case 0x038:
if (val & 0x08000000) val |= 0xF0000000;
BGXRef[1] = val;
if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1];
return;
case 0x03C:
if (val & 0x08000000) val |= 0xF0000000;
BGYRef[1] = val;
if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1];
return;
switch (addr & 0x00000FFF)
{
case 0x028:
if (val & 0x08000000) val |= 0xF0000000;
BGXRef[0] = val;
if (GPU::VCount < 192) BGXRefInternal[0] = BGXRef[0];
return;
case 0x02C:
if (val & 0x08000000) val |= 0xF0000000;
BGYRef[0] = val;
if (GPU::VCount < 192) BGYRefInternal[0] = BGYRef[0];
return;

case 0x038:
if (val & 0x08000000) val |= 0xF0000000;
BGXRef[1] = val;
if (GPU::VCount < 192) BGXRefInternal[1] = BGXRef[1];
return;
case 0x03C:
if (val & 0x08000000) val |= 0xF0000000;
BGYRef[1] = val;
if (GPU::VCount < 192) BGYRefInternal[1] = BGYRef[1];
return;
}
}

Write16(addr, val&0xFFFF);
Expand Down

0 comments on commit 529a690

Please sign in to comment.