diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index 888d58f22b..c08bad8d2c 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -31,6 +31,8 @@ GSDevice11::GSDevice11() memset(&m_vs_cb_cache, 0, sizeof(m_vs_cb_cache)); memset(&m_ps_cb_cache, 0, sizeof(m_ps_cb_cache)); + UserHacks_NVIDIAHack = !!theApp.GetConfig("UserHacks_NVIDIAHack", 0) && !!theApp.GetConfig("UserHacks", 0); + m_state.topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; m_state.bf = -1; } @@ -655,7 +657,19 @@ void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, {GSVector4(left, bottom, 0.5f, 1.0f), GSVector2(sr.x, sr.w)}, {GSVector4(right, bottom, 0.5f, 1.0f), GSVector2(sr.z, sr.w)}, }; - + + /* NVIDIA HACK!!!! + For some reason this function ball's up on drivers after 320.18 causing a weird stretching issue. + The only way around this seems to be adding a small value to the x, y coords for part of the + vertex data but doing it only on the first vertex of the 4 seems to do it (it doesn't seem to matter)*/ + if(UserHacks_NVIDIAHack) + { + //Smallest value i could get away with before it starts stretching again :( + vertices[0].p.x += 0.000002f; + vertices[0].p.y += 0.000002f; + } + /*END OF HACK*/ + IASetVertexBuffer(vertices, sizeof(vertices[0]), countof(vertices)); IASetInputLayout(m_convert.il); IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index 94a7626df1..5e6e3b3b0d 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -81,6 +81,8 @@ class GSDevice11 : public GSDeviceDX public: // TODO CComPtr m_rs; + bool UserHacks_NVIDIAHack; + struct { CComPtr il; diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index f9dda3e383..a4f7e65be8 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -522,6 +522,7 @@ void GSHacksDlg::OnInit() CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfig("UserHacks_WildHack", 0)); CheckDlgButton(m_hWnd, IDC_AGGRESSIVECRC, theApp.GetConfig("UserHacks_AggressiveCRC", 0)); CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfig("UserHacks_AlphaStencil", 0)); + CheckDlgButton(m_hWnd, IDC_CHECK_NVIDIA_HACK, theApp.GetConfig("UserHacks_NVIDIAHack", 0)); CheckDlgButton(m_hWnd, IDC_CHECK_DISABLE_ALL_HACKS, theApp.GetConfig("UserHacks_DisableCrcHacks", 0)); SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0)); @@ -601,6 +602,12 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) "Improves many shadows which are normally overdrawn in parts, may affect other effects.\n" "Will disable partial transparency in some games or even prevent drawing some elements altogether."; break; + case IDC_CHECK_NVIDIA_HACK: + helpstr = "This is a hack to work around problems with recent NVIDIA drivers causing odd stretching problems in DirectX 11 only" + "when using Upscaling.\n\n" + "Try not to use this unless your game Videos or 2D screens are stretching outside the frame.\n\n" + "If you have an AMD/ATi graphics card you should not needs this."; + break; case IDC_CHECK_DISABLE_ALL_HACKS: helpstr = "FOR TESTING ONLY!!\n\n" "Disable all CRC hacks - will break many games. Overrides CrcHacksExclusion at gsdx.ini\n" @@ -648,6 +655,7 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) theApp.SetConfig("UserHacks_WildHack", (int)IsDlgButtonChecked(m_hWnd, IDC_WILDHACK)); theApp.SetConfig("UserHacks_AggressiveCRC", (int)IsDlgButtonChecked(m_hWnd, IDC_AGGRESSIVECRC)); theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL)); + theApp.SetConfig("UserHacks_NVIDIAHack", (int)IsDlgButtonChecked(m_hWnd, IDC_CHECK_NVIDIA_HACK)); theApp.SetConfig("UserHacks_DisableCrcHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_CHECK_DISABLE_ALL_HACKS)); unsigned int TCOFFSET = SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0) & 0xFFFF; diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 6920f55666..161bffee64 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -28,7 +28,7 @@ GSTextureCache::GSTextureCache(GSRenderer* r) m_spritehack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SpriteHack", 0) : 0; UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks", 0) && !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0); - + UserHacks_NVIDIAHack = !!theApp.GetConfig("UserHacks_NVIDIAHack", 0) && !!theApp.GetConfig("UserHacks", 0); m_paltex = !!theApp.GetConfig("paltex", 0); m_temp = (uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 32); @@ -219,7 +219,15 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int if(ww > 0 && hh > 0) { - dst->m_texture->SetScale(GSVector2((float)w / ww, (float)h / hh)); + if(UserHacks_NVIDIAHack) + { + //Nvidia hackage!! to revert to original remove both " - 0.01f"'s + dst->m_texture->SetScale(GSVector2((float)w / ww - 0.01f, (float)h / hh - 0.01f)); + } + else + { + dst->m_texture->SetScale(GSVector2((float)w / ww, (float)h / hh)); + } } } } diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 5b1d7824ac..55a54ef40e 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -28,6 +28,7 @@ class GSTextureCache { public: enum {RenderTarget, DepthStencil}; + bool UserHacks_NVIDIAHack; class Surface : public GSAlignedClass<32> { diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index 4c84a66a7a..d8e9aa0d0d 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -85,34 +85,35 @@ IDB_LOGO10 BITMAP "res\\logo10.bmp" // Dialog // -IDD_HACKS DIALOGEX 0, 0, 315, 236 +IDD_HACKS DIALOGEX 0, 0, 315, 246 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,258,215,50,14 - GROUPBOX "Hack",IDC_STATIC,7,7,86,201,0,WS_EX_TRANSPARENT - GROUPBOX "Description",IDC_STATIC,96,7,212,201 + DEFPUSHBUTTON "OK",IDOK,258,225,50,14 + GROUPBOX "Hack",IDC_STATIC,7,7,86,214,0,WS_EX_TRANSPARENT + GROUPBOX "Description",IDC_STATIC,96,7,212,214 LTEXT "MSAA",IDC_STATIC_MSAA,14,20,20,8 LTEXT "Skipdraw",IDC_STATIC_SKIPDRAW,14,37,30,8 EDITTEXT IDC_SKIPDRAWHACKEDIT,53,35,35,14,ES_RIGHT | ES_AUTOHSCROLL CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,88,35,10,14 - CONTROL "Alpha",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,54,34,10 - CONTROL "Half-pixel Offset",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,65,10 - CONTROL "Sprite",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,14,88,35,10 - LTEXT "USE AT YOUR OWN RISK!",IDC_STATIC,7,218,84,11,WS_DISABLED + CONTROL "Alpha",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,53,34,10 + CONTROL "Half-pixel Offset",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,69,65,10 + CONTROL "Sprite",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,14,85,35,10 + LTEXT "USE AT YOUR OWN RISK!",IDC_STATIC,7,228,84,11,WS_DISABLED COMBOBOX IDC_MSAACB,35,18,54,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "WildArmsOffset",IDC_WILDHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,14,105,64,10 - LTEXT "TEXT_GOES_HERE",IDC_HACK_DESCRIPTION,102,20,199,183 - CONTROL "Aggressive-CRC",IDC_AGGRESSIVECRC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,122,66,10 - CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,139,66,10 - CONTROL "Disable CRCs",IDC_CHECK_DISABLE_ALL_HACKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,156,58,10 - LTEXT "TC Offset X",IDC_STATIC_TCOFFSETX,14,173,37,8 - EDITTEXT IDC_TCOFFSETX2,53,171,35,14,ES_RIGHT | ES_AUTOHSCROLL - CONTROL "",IDC_TCOFFSETX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,87,171,11,14 - EDITTEXT IDC_TCOFFSETY2,53,188,35,14,ES_RIGHT | ES_AUTOHSCROLL - CONTROL "",IDC_TCOFFSETY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,86,188,11,14 - LTEXT "TC Offset Y",IDC_STATIC_TCOFFSETY,14,190,37,8 + CONTROL "WildArmsOffset",IDC_WILDHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,14,102,64,10 + LTEXT "TEXT_GOES_HERE",IDC_HACK_DESCRIPTION,102,20,199,192 + CONTROL "Aggressive-CRC",IDC_AGGRESSIVECRC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,119,66,10 + CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,136,66,10 + CONTROL "Disable CRCs",IDC_CHECK_DISABLE_ALL_HACKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,168,58,10 + LTEXT "TC Offset X",IDC_STATIC_TCOFFSETX,14,186,37,8 + EDITTEXT IDC_TCOFFSETX2,53,184,35,14,ES_RIGHT | ES_AUTOHSCROLL + CONTROL "",IDC_TCOFFSETX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,86,184,11,14 + EDITTEXT IDC_TCOFFSETY2,53,201,35,14,ES_RIGHT | ES_AUTOHSCROLL + CONTROL "",IDC_TCOFFSETY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,86,201,11,14 + LTEXT "TC Offset Y",IDC_STATIC_TCOFFSETY,14,203,37,8 + CONTROL "NVIDIA Hack",IDC_CHECK_NVIDIA_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,152,57,10 END IDD_SHADEBOOST DIALOGEX 0, 0, 316, 129 @@ -139,8 +140,8 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Settings..." FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL IDB_LOGO10,IDC_LOGO11,"Static",SS_BITMAP | SS_CENTERIMAGE,7,7,175,42 - CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP | SS_CENTERIMAGE,7,7,175,44 + CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP | SS_CENTERIMAGE,7,7,175,42 + CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP | SS_CENTERIMAGE,7,7,175,44 LTEXT "Resolution:",IDC_STATIC,7,73,37,8 COMBOBOX IDC_RESOLUTION,71,71,72,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Renderer:",IDC_STATIC,7,88,34,8 @@ -203,7 +204,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Settings..." FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44 + CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44 LTEXT "Resolution:",IDC_STATIC,7,59,37,8 COMBOBOX IDC_RESOLUTION,80,57,102,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Renderer:",IDC_STATIC,7,74,34,8 @@ -219,7 +220,7 @@ BEGIN CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,161,11,14 DEFPUSHBUTTON "OK",IDOK,43,178,50,14 PUSHBUTTON "Cancel",IDCANCEL,96,178,50,14 - CONTROL IDB_LOGO10,IDC_LOGO11,"Static",SS_BITMAP,7,7,173,42 + CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,7,7,173,42 LTEXT "Internal Resolution:",IDC_STATIC,7,135,64,8 COMBOBOX IDC_SCALE,80,132,102,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10 @@ -230,7 +231,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Settings..." FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL IDB_LOGO10,IDC_LOGO11,"Static",SS_BITMAP | SS_CENTERIMAGE,6,6,173,42 + CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP | SS_CENTERIMAGE,6,6,173,42 DEFPUSHBUTTON "OK",IDOK,35,321,50,14 LTEXT "Renderer:",IDC_STATIC,6,72,34,8 COMBOBOX IDC_RENDERER,70,70,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -250,7 +251,7 @@ BEGIN LTEXT "Original PS2 resolution :",IDC_STATIC,10,120,80,8 CONTROL "Edge anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,297,93,10 PUSHBUTTON "Cancel",IDCANCEL,89,321,50,14 - CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP | SS_CENTERIMAGE,6,6,175,44 + CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP | SS_CENTERIMAGE,6,6,175,44 GROUPBOX "D3D Internal resolution (can cause glitches)",IDC_STATIC,6,102,175,64,BS_CENTER GROUPBOX "Software Mode Settings",IDC_STATIC,6,265,175,50,BS_CENTER GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,200,175,63,BS_CENTER @@ -281,7 +282,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 308 TOPMARGIN, 7 - BOTTOMMARGIN, 229 + BOTTOMMARGIN, 239 END IDD_SHADEBOOST, DIALOG diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index 245b9ffe55..c0d4f80af9 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -67,6 +67,7 @@ #define IDC_TCOFFSETY 2084 #define IDC_TCOFFSETY2 2085 #define IDC_FXAA 2086 +#define IDC_CHECK_NVIDIA_HACK 2087 #define IDC_COLORSPACE 3000 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001