diff --git a/plugins/GSdx/GSDeviceDX.h b/plugins/GSdx/GSDeviceDX.h index 76edd69393..84b76b0190 100644 --- a/plugins/GSdx/GSDeviceDX.h +++ b/plugins/GSdx/GSDeviceDX.h @@ -76,6 +76,7 @@ public: uint32 fst:1; uint32 logz:1; uint32 rtcopy:1; + uint32 wildhack:2; }; uint32 key; diff --git a/plugins/GSdx/GSRendererDX.cpp b/plugins/GSdx/GSRendererDX.cpp index 88c183082d..e4cf039058 100644 --- a/plugins/GSdx/GSRendererDX.cpp +++ b/plugins/GSdx/GSRendererDX.cpp @@ -145,6 +145,9 @@ 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. diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index f714652180..1cd4769907 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -421,6 +421,7 @@ void GSHacksDlg::OnInit() CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfig("UserHacks_AlphaHack", 0)); CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 0)); CheckDlgButton(m_hWnd, IDC_SPRITEHACK, theApp.GetConfig("UserHacks_SpriteHack", 0)); + CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfig("UserHacks_WildHack", 0)); SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0)); SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("UserHacks_SkipDraw", 0), 0)); @@ -446,6 +447,7 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK)); theApp.SetConfig("UserHacks_SpriteHack", (int)IsDlgButtonChecked(m_hWnd, IDC_SPRITEHACK)); theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0)); + theApp.SetConfig("UserHacks_WildHack", (int)IsDlgButtonChecked(m_hWnd, IDC_WILDHACK)); EndDialog(m_hWnd, id); } break; } diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 9e4f528908..2270a5c285 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -26,6 +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); @@ -583,6 +584,8 @@ 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)) diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 726917048c..7303f94a29 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -76,6 +76,7 @@ public: bool m_complete; bool m_repeating; bool m_spritehack_t; + int m_wildhack_t; vector* m_p2t; public: @@ -120,6 +121,7 @@ protected: list 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); diff --git a/plugins/GSdx/GSTextureFX11.cpp b/plugins/GSdx/GSTextureFX11.cpp index 84189a7d85..7227c877d0 100644 --- a/plugins/GSdx/GSTextureFX11.cpp +++ b/plugins/GSdx/GSTextureFX11.cpp @@ -88,12 +88,13 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb) if(i == m_vs.end()) { - string str[4]; + 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.rtcopy); + str[4] = format("%d", sel.wildhack); D3D11_SHADER_MACRO macro[] = { @@ -101,6 +102,7 @@ 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}, }; diff --git a/plugins/GSdx/GSTextureFX9.cpp b/plugins/GSdx/GSTextureFX9.cpp index a8e0d913b3..fa86ccaca3 100644 --- a/plugins/GSdx/GSTextureFX9.cpp +++ b/plugins/GSdx/GSTextureFX9.cpp @@ -67,13 +67,14 @@ void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb) if(i == m_vs.end()) { - string str[5]; + string str[6]; 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[] = { @@ -82,6 +83,7 @@ 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}, }; diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index eb8c3ee183..40adf9b42a 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -74,14 +74,14 @@ IDB_LOGO10 BITMAP "res\\logo10.bmp" // Dialog // -IDD_HACKS DIALOGEX 0, 0, 316, 133 +IDD_HACKS DIALOGEX 0, 0, 315, 203 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Hacks Configuration" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,259,112,50,14 - GROUPBOX "Hack",IDC_STATIC,7,7,76,100 - GROUPBOX "Description",IDC_STATIC,86,7,223,100 + DEFPUSHBUTTON "OK",IDOK,258,182,50,14 + GROUPBOX "Hack",IDC_STATIC,7,7,76,165 + GROUPBOX "Description",IDC_STATIC,85,7,223,165 LTEXT "MSAA",IDC_STATIC,14,20,20,8 LTEXT "Skipdraw",IDC_STATIC,14,37,30,8 EDITTEXT IDC_SKIPDRAWHACKEDIT,45,35,24,14,ES_RIGHT | ES_AUTOHSCROLL @@ -94,8 +94,10 @@ BEGIN LTEXT "Works around some shadow problems",IDC_STATIC,92,54,120,8 LTEXT "May fix displaced fog or blend effects",IDC_STATIC,92,71,117,8 LTEXT "Fixes character sprites in some 2D games",IDC_STATIC,92,88,129,8 - LTEXT "USE AT YOUR OWN RISK!",IDC_STATIC,7,115,84,8,WS_DISABLED + LTEXT "USE AT YOUR OWN RISK!",IDC_STATIC,7,182,84,8,WS_DISABLED COMBOBOX IDC_MSAACB,35,18,44,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "WildArmsOffset",IDC_WILDHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,14,105,64,10 + LTEXT "Lowers GS precission. Can fix text in Wild Arms and others.",IDC_STATIC,92,105,200,11 END IDD_SHADEBOOST DIALOGEX 0, 0, 316, 129 @@ -256,9 +258,9 @@ BEGIN IDD_HACKS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 309 + RIGHTMARGIN, 308 TOPMARGIN, 7 - BOTTOMMARGIN, 126 + BOTTOMMARGIN, 196 END IDD_SHADEBOOST, DIALOG diff --git a/plugins/GSdx/res/tfx.fx b/plugins/GSdx/res/tfx.fx index 96f4354ff2..67da6f3ca2 100644 --- a/plugins/GSdx/res/tfx.fx +++ b/plugins/GSdx/res/tfx.fx @@ -13,6 +13,7 @@ #define VS_BPPZ 0 #define VS_TME 1 #define VS_FST 1 +#define VS_WILDHACK 0 #endif #ifndef GS_IIP @@ -620,7 +621,13 @@ 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 @@ -767,7 +774,13 @@ VS_OUTPUT vs_main(VS_INPUT input) { if(VS_FST) { + #if VS_WILDHACK == 1 + output.t.xy = (input.t & 0x3FEF) * TextureScale; + #elif VS_WILDHACK == 2 + output.t.xy = (input.t & 0x3FF7) * TextureScale; + #else output.t.xy = input.t * TextureScale; + #endif output.t.w = 1.0f; } else diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index 766ba83657..8bcb3fcb2f 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -88,6 +88,7 @@ #define IDC_CONTRAST_TEXT 2063 #define IDC_MSAACB 2070 #define IDC_HACKSBUTTON 2071 +#define IDC_WILDHACK 2072 #define IDC_COLORSPACE 3000 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001 @@ -106,7 +107,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10012 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 2072 +#define _APS_NEXT_CONTROL_VALUE 2073 #define _APS_NEXT_SYMED_VALUE 5000 #endif #endif