From e50fb6ec9f8144f895923c232365ba4472a007ad Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Fri, 19 Feb 2010 10:37:31 +0000 Subject: [PATCH] GSdx: - Finally made some user hacks available in the configuration dialog. There are no warnings yet, and I don't like the placement either, but that'll have to wait. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2606 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSRendererHW.h | 8 ++++---- plugins/GSdx/GSSettingsDlg.cpp | 14 ++++++++++---- plugins/GSdx/GSState.cpp | 15 ++++----------- plugins/GSdx/GSState.h | 2 +- plugins/GSdx/GSdx.rc | 14 ++++++++++---- plugins/GSdx/resource.h | 7 ++++++- 6 files changed, 35 insertions(+), 25 deletions(-) diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index 725b0bb4c2..0c178d7626 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -33,7 +33,7 @@ class GSRendererHW : public GSRendererT int m_width; int m_height; int m_upscale_multiplier; - int m_gamefix_skipdraw; + int m_UserHacks_SkipDraw; int m_skip; bool m_reset; @@ -532,7 +532,7 @@ protected: void Draw() { - if(IsBadFrame(m_skip, m_gamefix_skipdraw)) return; + if(IsBadFrame(m_skip, m_UserHacks_SkipDraw)) return; GSDrawingEnvironment& env = m_env; GSDrawingContext* context = m_context; @@ -714,7 +714,7 @@ public: , m_upscale_multiplier(1) , m_skip(0) , m_reset(false) - , m_gamefix_skipdraw (0) + , m_UserHacks_SkipDraw (0) { if(!m_nativeres) { @@ -728,7 +728,7 @@ public: m_height = 512 * m_upscale_multiplier; //448 is also common, but this is not always detected right. } } - m_gamefix_skipdraw = theApp.GetConfig("gamefix_skipdraw", m_gamefix_skipdraw); + m_UserHacks_SkipDraw = theApp.GetConfig("UserHacks_SkipDraw", m_UserHacks_SkipDraw); } virtual ~GSRendererHW() diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index 870f17dc8e..eee659630e 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -140,7 +140,12 @@ void GSSettingsDlg::OnInit() CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfig("aa1", 0)); CheckDlgButton(m_hWnd, IDC_BLUR, theApp.GetConfig("blur", 0)); CheckDlgButton(m_hWnd, IDC_NATIVERES, theApp.GetConfig("nativeres", 0)); - + // Hacks + CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfig("UserHacks_AlphaHack", 0)); + CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 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)); + SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(8192, 256)); SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resx", 1024), 0)); @@ -209,12 +214,13 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1)); theApp.SetConfig("blur", (int)IsDlgButtonChecked(m_hWnd, IDC_BLUR)); theApp.SetConfig("nativeres", (int)IsDlgButtonChecked(m_hWnd, IDC_NATIVERES)); - theApp.SetConfig("resx", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_GETPOS, 0, 0)); theApp.SetConfig("resy", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_GETPOS, 0, 0)); theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)); - - //theApp.SetConfig("gamefix_skipdraw", 0); + // Hacks + theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK)); + theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK)); + theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0)); } return __super::OnCommand(hWnd, id, code); diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index a1edf57669..d7c4af7eff 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -2472,7 +2472,7 @@ bool GSC_RadiataStories(const GSFrameInfo& fi, int& skip) return true; } -bool GSState::IsBadFrame(int& skip, int gamefix_skipdraw) +bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw) { GSFrameInfo fi; @@ -2534,25 +2534,18 @@ bool GSState::IsBadFrame(int& skip, int gamefix_skipdraw) return false; } - if(skip == 0) + if(skip == 0 && (UserHacks_SkipDraw > 0) ) { if(fi.TME) { if(GSUtil::HasSharedBits(fi.FBP, fi.FPSM, fi.TBP0, fi.TPSM)) { - if (gamefix_skipdraw > 0) { - skip = gamefix_skipdraw; - } + skip = UserHacks_SkipDraw; } - // depth textures (bully, mgs3s1 intro, Front Mission 5 (needs skip = 2, therefore the gamefix)) - if(fi.TPSM == PSM_PSMZ32 || fi.TPSM == PSM_PSMZ24 || fi.TPSM == PSM_PSMZ16 || fi.TPSM == PSM_PSMZ16S) { - if (gamefix_skipdraw > 0) { - skip = gamefix_skipdraw; - } - else skip = 1; // Remove, once the gui part is done + skip = UserHacks_SkipDraw; } } } diff --git a/plugins/GSdx/GSState.h b/plugins/GSdx/GSState.h index 202fb2e8a8..914ea9d1e8 100644 --- a/plugins/GSdx/GSState.h +++ b/plugins/GSdx/GSState.h @@ -130,7 +130,7 @@ class GSState : public GSAlignedClass<16> void FlushWrite(); protected: - bool IsBadFrame(int& skip, int gamefix_skipdraw); + bool IsBadFrame(int& skip, int UserHacks_SkipDraw); typedef void (GSState::*VertexKickPtr)(bool skip); diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index 3ddf3178fb..f2fccd9404 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -153,13 +153,13 @@ BEGIN CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10 END -IDD_CONFIG2 DIALOGEX 0, 0, 187, 258 +IDD_CONFIG2 DIALOGEX 0, 0, 187, 302 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Settings..." FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,6,6,173,42 - DEFPUSHBUTTON "OK",IDOK,41,239,50,14 + DEFPUSHBUTTON "OK",IDOK,41,275,50,14 LTEXT "Renderer:",IDC_STATIC,6,57,34,8 COMBOBOX IDC_RENDERER,70,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Interlacing (F5):",IDC_STATIC,6,73,53,8 @@ -183,8 +183,14 @@ BEGIN CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,188,93,10 CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,202,141,10 CONTROL "Enable output merger blur effect",IDC_BLUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,216,121,10 - PUSHBUTTON "Cancel",IDCANCEL,95,239,50,14 + PUSHBUTTON "Cancel",IDCANCEL,95,275,50,14 CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,6,6,175,44 + CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,239,51,10 + CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,85,239,51,10 + GROUPBOX "Hacks (try to fix bad graphics)",IDC_USERHACKS,13,228,161,40,BS_CENTER + EDITTEXT IDC_SKIPDRAWHACKEDIT,55,251,40,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,94,253,11,14 + LTEXT "SkipDraw:",IDC_STATIC,20,255,33,8 END @@ -231,7 +237,7 @@ BEGIN LEFTMARGIN, 6 RIGHTMARGIN, 181 TOPMARGIN, 6 - BOTTOMMARGIN, 252 + BOTTOMMARGIN, 296 END END #endif // APSTUDIO_INVOKED diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index 44d2a6b438..1734620a16 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -33,15 +33,20 @@ #define IDC_RENDERER 2029 #define IDC_INTERLACE 2030 #define IDC_ASPECTRATIO 2031 +#define IDC_ALPHAHACK 2031 #define IDC_SWTHREADS 2032 #define IDC_SCALE 2033 #define IDC_UPSCALE_MULTIPLIER 2033 #define IDC_BROWSE 2034 +#define IDC_OFFSETHACK 2034 #define IDC_FILENAME 2035 +#define IDC_SKIPDRAWHACK 2035 #define IDC_WIDTH 2036 #define IDC_HEIGHT 2037 #define IDC_CONFIGURE 2038 #define IDC_WINDOWED 2039 +#define IDC_USERHACKS 2040 +#define IDC_SKIPDRAWHACKEDIT 2041 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001 #define IDR_MERGE_FX 10002 @@ -55,7 +60,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10005 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 2040 +#define _APS_NEXT_CONTROL_VALUE 2042 #define _APS_NEXT_SYMED_VALUE 5000 #endif #endif