Skip to content

Commit

Permalink
GS-CLUT: Handle invalidation on wrapping writes
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Feb 2, 2023
1 parent f018845 commit 6700d6a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pcsx2/GS/GSClut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ bool GSClut::InvalidateRange(u32 start_block, u32 end_block, bool is_draw)
GIFRegTEX0 next_cbp;
next_cbp.U64 = m_write.next_tex0;

// Handle wrapping writes. Star Wars Battlefront 2 does this.
if ((end_block & 0xF000) < (start_block & 0xF000))
{
if ((next_cbp.CBP + 3U) <= end_block)
next_cbp.CBP += 0x4000;

end_block += 0x4000;
}

if ((next_cbp.CBP + 3U) >= start_block && end_block >= next_cbp.CBP)
{
m_write.dirty |= is_draw ? 2 : 1;
Expand Down

0 comments on commit 6700d6a

Please sign in to comment.