Another refinement to the Wild Arms hack by KrossX.
The hack now only applies to one kind of geometry (sent using  the unpacked UV handler).
This works nicer in Wild Arms as it fixes "jumpy" characters.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5124 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2012-03-08 17:18:22 +00:00
parent 9aa9808c2f
commit 1595136a9d
12 changed files with 35 additions and 34 deletions

View File

@ -308,6 +308,7 @@ CRC::Game CRC::m_games[] =
{0x60A42FF5, MidnightClub3, US, 0}, //remix
{0x4B1A0FFA, XmenOriginsWolverine, US, 0},
{0xBFF3DBCB, CallofDutyFinalFronts, US, 0},
{0xB78A5F5A, CallofDutyFinalFronts, EU, 0},
{0xD03D4C77, SpyroNewBeginning, US, 0},
{0x0EE5646B, SpyroNewBeginning, EU, 0},
{0x7ACF7E03, SpyroNewBeginning, NoRegion, 0},

View File

@ -31,6 +31,7 @@ GSRendererDX::GSRendererDX(GSTextureCache* tc, const GSVector2& pixelcenter)
m_fba = !!theApp.GetConfig("fba", 1);
UserHacks_AlphaHack = !!theApp.GetConfig("UserHacks_AlphaHack", 0) && !!theApp.GetConfig("UserHacks", 0);
UserHacks_WildHack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_WildHack", 0) : 0;
}
GSRendererDX::~GSRendererDX()
@ -145,9 +146,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
vs_sel.logz = dev->HasDepth32() ? 0 : m_logz ? 1 : 0;
vs_sel.rtcopy = !!rtcopy;
if(tex) vs_sel.wildhack = tex->m_wildhack_t;
else vs_sel.wildhack = 0;
// The real GS appears to do no masking based on the Z buffer format and writing larger Z values
// than the buffer supports seems to be an error condition on the real GS, causing it to crash.
// We are probably receiving bad coordinates from VU1 in these cases.

View File

@ -36,6 +36,8 @@ protected:
virtual void SetupIA() = 0;
virtual void UpdateFBA(GSTexture* rt) {}
int UserHacks_WildHack;
public:
GSRendererDX(GSTextureCache* tc, const GSVector2& pixelcenter = GSVector2(0, 0));
virtual ~GSRendererDX();

View File

@ -45,8 +45,17 @@ void GSRendererDX11::SetupIA()
if(dev->IAMapVertexBuffer(&ptr, sizeof(GSVertex), m_vertex.next))
{
GSVector4i::storent(ptr, m_vertex.buff, sizeof(GSVertex) * m_vertex.next);
GSVector4i::storent(ptr, m_vertex.buff, sizeof(GSVertex) * m_vertex.next);
if(UserHacks_WildHack && !isPackedUV_HackFlag)
{
GSVertex* RESTRICT d = (GSVertex*)ptr;
for(unsigned int i = 0; i < m_vertex.next; i++, d++)
if(PRIM->TME && PRIM->FST)
d->UV &= UserHacks_WildHack == 1 ? 0x3FEF3FEF : 0x3FF73FF7;
}
dev->IAUnmapVertexBuffer();
}

View File

@ -199,7 +199,15 @@ void GSRendererDX9::SetupIA()
{
if(PRIM->FST)
{
t = GSVector4(GSVector4i::load(s->UV).upl16());
if(UserHacks_WildHack && !isPackedUV_HackFlag)
{
t = GSVector4(GSVector4i::load(UserHacks_WildHack == 1?
s->UV & 0x3FEF3FEF : s->UV & 0x3FF73FF7).upl16());
//printf("GSDX: %08X | D3D9(%d) %s\n", s->UV & 0x3FEF3FEF, m_vertex.next, i == 0 ? "*" : "");
}
else
t = GSVector4(GSVector4i::load(s->UV).upl16());
}
else
{

View File

@ -464,6 +464,8 @@ void GSState::GIFPackedRegHandlerUV(const GIFPackedReg* RESTRICT r)
GSVector4i v = GSVector4i::loadl(r) & GSVector4i::x00003fff();
m_v.UV = (uint32)GSVector4i::store(v.ps32(v));
isPackedUV_HackFlag = true;
}
template<uint32 prim, uint32 adc>
@ -652,7 +654,9 @@ void GSState::GIFRegHandlerST(const GIFReg* RESTRICT r)
void GSState::GIFRegHandlerUV(const GIFReg* RESTRICT r)
{
m_v.UV = r->UV.u32[0] & 0x3fff3fff;
m_v.UV = r->UV.u32[0] & 0x3fff3fff;
isPackedUV_HackFlag = false;
}
template<uint32 prim, uint32 adc>

View File

@ -194,6 +194,8 @@ public:
GSDump m_dump;
bool m_nativeres;
bool isPackedUV_HackFlag;
int s_n;
bool s_dump;
bool s_save;

View File

@ -26,7 +26,7 @@ GSTextureCache::GSTextureCache(GSRenderer* r)
: m_renderer(r)
{
m_spritehack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SpriteHack", 0) : 0;
m_wildhack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_WildHack", 0) : 0;
UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks", 0) && !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0);
m_paltex = !!theApp.GetConfig("paltex", 0);
@ -584,8 +584,6 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
bool hack = false;
src->m_wildhack_t = m_wildhack; // dunno where to put it really, but works fine here.
if(dst == NULL)
{
if(m_spritehack && (TEX0.PSM == PSM_PSMT8 || TEX0.PSM == PSM_PSMT8H))

View File

@ -76,7 +76,6 @@ public:
bool m_complete;
bool m_repeating;
bool m_spritehack_t;
int m_wildhack_t;
vector<GSVector2i>* m_p2t;
public:
@ -121,7 +120,6 @@ protected:
list<Target*> m_dst[2];
bool m_paltex;
int m_spritehack;
int m_wildhack;
uint8* m_temp;
virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL);

View File

@ -88,13 +88,12 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
if(i == m_vs.end())
{
string str[5];
string str[4];
str[0] = format("%d", sel.bppz);
str[1] = format("%d", sel.tme);
str[2] = format("%d", sel.fst);
str[3] = format("%d", sel.rtcopy);
str[4] = format("%d", sel.wildhack);
D3D11_SHADER_MACRO macro[] =
{
@ -102,7 +101,6 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
{"VS_TME", str[1].c_str()},
{"VS_FST", str[2].c_str()},
{"VS_RTCOPY", str[3].c_str()},
{"VS_WILDHACK", str[4].c_str()},
{NULL, NULL},
};

View File

@ -67,14 +67,13 @@ void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
if(i == m_vs.end())
{
string str[6];
string str[5];
str[0] = format("%d", sel.bppz);
str[1] = format("%d", sel.tme);
str[2] = format("%d", sel.fst);
str[3] = format("%d", sel.logz);
str[4] = format("%d", sel.rtcopy);
str[5] = format("%d", sel.wildhack);
D3DXMACRO macro[] =
{
@ -83,7 +82,6 @@ void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
{"VS_FST", str[2].c_str()},
{"VS_LOGZ", str[3].c_str()},
{"VS_RTCOPY", str[4].c_str()},
{"VS_WILDHACK", str[5].c_str()},
{NULL, NULL},
};

View File

@ -13,7 +13,6 @@
#define VS_BPPZ 0
#define VS_TME 1
#define VS_FST 1
#define VS_WILDHACK 0
#endif
#ifndef GS_IIP
@ -621,13 +620,7 @@ VS_OUTPUT vs_main(VS_INPUT input)
{
if(VS_FST)
{
#if VS_WILDHACK == 1
output.t.xy = (input.uv & 0x3FEF) * TextureScale;
#elif VS_WILDHACK == 2
output.t.xy = (input.uv & 0x3FF7) * TextureScale;
#else
output.t.xy = input.uv * TextureScale;
#endif
output.t.w = 1.0f;
}
else
@ -774,15 +767,7 @@ VS_OUTPUT vs_main(VS_INPUT input)
{
if(VS_FST)
{
#if VS_WILDHACK == 1
output.t.x = (frac(floor(input.t.x / 16.0)/2.0) > 0.4 ? input.t.x - 16.0 : input.t.x) * TextureScale.x;
output.t.y = (frac(floor(input.t.y / 16.0)/2.0) > 0.4 ? input.t.y - 16.0 : input.t.y) * TextureScale.y;
#elif VS_WILDHACK == 2
output.t.x = (frac(floor(input.t.x / 8.0)/2.0) > 0.4 ? input.t.x - 8.0 : input.t.x) * TextureScale.x;
output.t.y = (frac(floor(input.t.y / 8.0)/2.0) > 0.4 ? input.t.y - 8.0 : input.t.y) * TextureScale.y;
#else
output.t.xy = input.t * TextureScale;
#endif
output.t.xy = input.t * TextureScale;
output.t.w = 1.0f;
}
else