Fix Xenosaga 2 and 3 fog effect, not sure it's handled correctly but at least it's handled.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2050 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2009-10-21 12:36:32 +00:00
parent 43bac9c6a9
commit 81bdda2d27
1 changed files with 12 additions and 6 deletions

View File

@ -554,10 +554,10 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
GSVector4 size = GSVector4(dstsize).xyxy(); GSVector4 size = GSVector4(dstsize).xyxy();
GSVector4 scale = GSVector4(dst->m_texture->GetScale()).xyxy(); GSVector4 scale = GSVector4(dst->m_texture->GetScale()).xyxy();
int bw = 64; int blockWidth = 64;
int bh = TEX0.PSM == PSM_PSMCT32 || TEX0.PSM == PSM_PSMCT24 ? 32 : 64; int blockHeight = TEX0.PSM == PSM_PSMCT32 || TEX0.PSM == PSM_PSMCT24 ? 32 : 64;
GSVector4i br(0, 0, bw, bh); GSVector4i br(0, 0, blockWidth, blockHeight);
int sw = (int)dst->m_TEX0.TBW << 6; int sw = (int)dst->m_TEX0.TBW << 6;
@ -565,11 +565,11 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
int dh = 1 << TEX0.TH; int dh = 1 << TEX0.TH;
if(sw != 0) if(sw != 0)
for(int dy = 0; dy < dh; dy += bh) for(int dy = 0; dy < dh; dy += blockHeight)
{ {
for(int dx = 0; dx < dw; dx += bw) for(int dx = 0; dx < dw; dx += blockWidth)
{ {
int o = dy * dw / bh + dx; int o = dy * dw / blockHeight + dx;
int sx = o % sw; int sx = o % sw;
int sy = o / sw; int sy = o / sw;
@ -664,6 +664,12 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
src->m_fmt = FMT_8H; src->m_fmt = FMT_8H;
src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
break; break;
case PSM_PSMT8:
//Not sure, this wasn't handled at all.
//Xenosaga 2 and 3 use it, Tales of Legendia as well.
//It's always used for fog like effects.
src->m_fmt = FMT_8;
break;
case PSM_PSMT4HL: case PSM_PSMT4HL:
src->m_fmt = FMT_4HL; src->m_fmt = FMT_4HL;
src->m_palette = m_renderer->m_dev->CreateTexture(256, 1); src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);