diff --git a/plugins/GSdx/GSCrc.cpp b/plugins/GSdx/GSCrc.cpp index f624fdaf77..f21c3799c4 100644 --- a/plugins/GSdx/GSCrc.cpp +++ b/plugins/GSdx/GSCrc.cpp @@ -141,7 +141,9 @@ CRC::Game CRC::m_games[] = {0x4C94B32C, SimpsonsGame, Unknown, 0}, {0xD71B57F4, Genji, Unknown, 0}, {0x23A97857, StarOcean3, JPUNDUB, 0}, - {0xCC96CE93, ValkyrieProfile2, JPUNDUB, 0}, + {0xCC96CE93, ValkyrieProfile2, US, 0}, + {0x774DE8E2, ValkyrieProfile2, JP, 0}, + {0x47B9B2FD, RadiataStories, US, 0}, }; hash_map CRC::m_map; diff --git a/plugins/GSdx/GSCrc.h b/plugins/GSdx/GSCrc.h index d33543d694..8247e4fec0 100644 --- a/plugins/GSdx/GSCrc.h +++ b/plugins/GSdx/GSCrc.h @@ -73,6 +73,7 @@ public: Genji, StarOcean3, ValkyrieProfile2, + RadiataStories, TitleCount, }; diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 6a91778758..d7de1efd3b 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -2251,6 +2251,26 @@ bool GSC_ValkyrieProfile2(const GSFrameInfo& fi, int& skip) return true; } +bool GSC_RadiataStories(const GSFrameInfo& fi, int& skip) +{ + if(skip == 0) + { + if(fi.TME && fi.FBP == fi.TBP0 && fi.FPSM == PSM_PSMCT32 && fi.TPSM == PSM_PSMT4HH) + { + skip = 1000; // + } + } + else + { + if(!(fi.TME && fi.FBP == fi.TBP0 && fi.FPSM == PSM_PSMCT32 && fi.TPSM == PSM_PSMT4HH)) + { + skip = 0; + } + } + + return true; +} + bool GSState::IsBadFrame(int& skip) { GSFrameInfo fi; @@ -2300,6 +2320,7 @@ bool GSState::IsBadFrame(int& skip) map[CRC::Genji] = GSC_Genji; map[CRC::StarOcean3] = GSC_StarOcean3; map[CRC::ValkyrieProfile2] = GSC_ValkyrieProfile2; + map[CRC::RadiataStories] = GSC_RadiataStories; } // TODO: just set gsc in SetGameCRC once diff --git a/plugins/GSdx/GSTextureCacheSW.cpp b/plugins/GSdx/GSTextureCacheSW.cpp index 0e2aa894a6..572097ba58 100644 --- a/plugins/GSdx/GSTextureCacheSW.cpp +++ b/plugins/GSdx/GSTextureCacheSW.cpp @@ -260,98 +260,76 @@ bool GSTextureCacheSW::GSTexture::Update(const GIFRegTEX0& TEX0, const GIFRegTEX m_complete = true; // lame, but better than nothing } - GSLocalMemory& mem = m_state->m_mem; - uint32 bp = TEX0.TBP0; uint32 bw = TEX0.TBW; - GSLocalMemory::readTextureBlock rtxb = psm.rtxbP; - - int bytes = psm.pal > 0 ? 1 : 4; - - uint32 pitch = (1 << m_tw) * bytes; - - uint8* dst = (uint8*)m_buff + pitch * r.top; + bool repeating = tw > (bw << 6); // TODO: bw == 0 uint32 blocks = 0; - if(tw <= (bw << 6)) + GSLocalMemory& mem = m_state->m_mem; + + GSLocalMemory::readTextureBlock rtxb = psm.rtxbP; + + int shift = psm.pal == 0 ? 2 : 0; + + uint32 pitch = (1 << m_tw) << shift; + + uint8* dst = (uint8*)m_buff + pitch * r.top; + + for(int y = r.top, o = pitch * s.y; y < r.bottom; y += s.y, dst += o) { - for(int y = r.top, o = pitch * s.y; y < r.bottom; y += s.y, dst += o) + uint32 base = psm.bn(0, y, bp, bw); + + for(int x = r.left; x < r.right; x += s.x) { - uint32 base = psm.bn(0, y, bp, bw); + uint32 block = base + psm.blockOffset[x >> 3]; - for(int x = r.left; x < r.right; x += s.x) + if(block < MAX_BLOCKS) { - uint32 block = base + psm.blockOffset[x >> 3]; + uint32 row = block >> 5; + uint32 col = 1 << (block & 31); - if(block < MAX_BLOCKS) + if((m_valid[row] & col) == 0) { - uint32 row = block >> 5; - uint32 col = 1 << (block & 31); - - if((m_valid[row] & col) == 0) + if(!repeating) { m_valid[row] |= col; - - (mem.*rtxb)(block, &dst[x * bytes], pitch, TEXA); - - blocks++; } + + (mem.*rtxb)(block, &dst[x << shift], pitch, TEXA); + + blocks++; } } } } - else + + if(blocks > 0) { - // unfortunatelly a block may be part of the same texture multiple times at different places (tw 1024 > tbw 640, between 640 -> 1024 it is repeated from the next row), - // so just can't set the block's bit to valid in one pass, even if 99.9% of the games don't address the repeated part at the right side - - // TODO: still bogus if those repeated parts aren't fetched together - - for(int y = r.top, o = pitch * s.y; y < r.bottom; y += s.y, dst += o) + if(repeating) { - uint32 base = psm.bn(0, y, bp, bw); - - for(int x = r.left; x < r.right; x += s.x) + for(int y = r.top; y < r.bottom; y += s.y) { - uint32 block = base + psm.blockOffset[x >> 3]; + uint32 base = psm.bn(0, y, bp, bw); - if(block < MAX_BLOCKS) + for(int x = r.left; x < r.right; x += s.x) { - uint32 row = block >> 5; - uint32 col = 1 << (block & 31); + uint32 block = base + psm.blockOffset[x >> 3]; - if((m_valid[row] & col) == 0) + if(block < MAX_BLOCKS) { - (mem.*rtxb)(block, &dst[x * bytes], pitch, TEXA); + uint32 row = block >> 5; + uint32 col = 1 << (block & 31); - blocks++; + m_valid[row] |= col; } } } } - for(int y = r.top; y < r.bottom; y += s.y) - { - uint32 base = psm.bn(0, y, bp, bw); - - for(int x = r.left; x < r.right; x += s.x) - { - uint32 block = base + psm.blockOffset[x >> 3]; - - if(block < MAX_BLOCKS) - { - uint32 row = block >> 5; - uint32 col = 1 << (block & 31); - - m_valid[row] |= col; - } - } - } + m_state->m_perfmon.Put(GSPerfMon::Unswizzle, s.x * s.y * blocks << shift); } - m_state->m_perfmon.Put(GSPerfMon::Unswizzle, s.x * s.y * bytes * blocks); - return true; } diff --git a/plugins/GSdx/GSVector.h b/plugins/GSdx/GSVector.h index b0e1e9d2d6..3e13c5c879 100644 --- a/plugins/GSdx/GSVector.h +++ b/plugins/GSdx/GSVector.h @@ -1029,9 +1029,13 @@ public: return _mm_movemask_epi8(m) == 0xffff; } - bool anytrue() const + bool allfalse() const { - return _mm_movemask_epi8(m) != 0x0000; + #if _M_SSE >= 0x401 + return _mm_testz_si128(m, m); + #else + return _mm_movemask_epi8(m) == 0; + #endif } #if _M_SSE >= 0x401 @@ -2544,7 +2548,12 @@ public: bool allfalse() const { + #if _M_SSE >= 0x401 + __m128i a = _mm_castps_si128(m); + return _mm_testz_si128(a, a); + #else return _mm_movemask_ps(m) == 0; + #endif } // TODO: insert