gsdx: wrap gs page/block instead to skip them

Fix FMV of Thrillville when coupled with wrap_gs_mem = 1
This commit is contained in:
Gregory Hainaut 2016-10-25 22:49:05 +02:00
parent db4b4fb166
commit 5dfb7d63dc
2 changed files with 28 additions and 43 deletions

View File

@ -645,14 +645,11 @@ vector<GSVector2i>* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0)
for(int x = 0, i = y << 7; x < tw; x += bs.x, i += bs.x)
{
uint32 page = (base + off->block.col[x >> 3]) >> 5;
uint32 page = ((base + off->block.col[x >> 3]) >> 5) % MAX_PAGES;
if(page < MAX_PAGES)
{
tmp[page].insert(i >> 3); // ((y << 7) | x) >> 3
}
}
}
// combine the lower 5 bits of the address into a 9:5 pointer:mask form, so the "valid bits" can be tested against an uint32 array
@ -2114,10 +2111,8 @@ uint32* GSOffset::GetPages(const GSVector4i& rect, uint32* pages, GSVector4i* bb
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 n = (base + block.col[x]) >> 5;
uint32 n = ((base + block.col[x]) >> 5) % MAX_PAGES;
if(n < MAX_PAGES)
{
uint32& row = tmp[n >> 5];
uint32 col = 1 << (n & 31);
@ -2129,7 +2124,6 @@ uint32* GSOffset::GetPages(const GSVector4i& rect, uint32* pages, GSVector4i* bb
}
}
}
}
*p++ = (uint32)EOP;
@ -2167,14 +2161,11 @@ GSVector4i* GSOffset::GetPagesAsBits(const GSVector4i& rect, GSVector4i* pages,
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 n = (base + block.col[x]) >> 5;
uint32 n = ((base + block.col[x]) >> 5) % MAX_PAGES;
if(n < MAX_PAGES)
{
((uint32*)pages)[n >> 5] |= 1 << (n & 31);
}
}
}
return pages;

View File

@ -278,10 +278,8 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
for(int x = r.left, i = (y << 7) + x; x < r.right; x += bs.x, i += bs.x)
{
uint32 block = base + off->block.col[x];
uint32 block = (base + off->block.col[x]) % MAX_BLOCKS;
if(block < MAX_BLOCKS)
{
uint32 row = i >> 5;
uint32 col = 1 << (i & 31);
@ -296,7 +294,6 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
}
}
}
}
else
{
for(int y = r.top; y < r.bottom; y += bs.y, dst += block_pitch)
@ -305,10 +302,8 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 block = base + off->block.col[x];
uint32 block = (base + off->block.col[x]) % MAX_BLOCKS;
if(block < MAX_BLOCKS)
{
uint32 row = block >> 5;
uint32 col = 1 << (block & 31);
@ -323,7 +318,6 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
}
}
}
}
if(blocks > 0)
{