From 0dadc124d388fc50f69492ecbc30c7c438584a86 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 17 Feb 2016 21:59:03 +0100 Subject: [PATCH] gsdx-ogl: invert behavior of unsafe user hack It would be on by default. Unsafe & fast path. The hack is a security if someone encounters any issue v2: update Windows gui file v3: fix typo in tooltip and linux gui --- plugins/GSdx/GSLinuxDialog.cpp | 4 ++-- plugins/GSdx/GSRendererOGL.cpp | 6 +++--- plugins/GSdx/GSRendererOGL.h | 2 +- plugins/GSdx/GSSetting.cpp | 5 ++--- plugins/GSdx/GSSetting.h | 2 +- plugins/GSdx/GSSettingsDlg.cpp | 8 ++++---- plugins/GSdx/GSdx.rc | 2 +- plugins/GSdx/resource.h | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/plugins/GSdx/GSLinuxDialog.cpp b/plugins/GSdx/GSLinuxDialog.cpp index e5c72d711e..f5d67a1f08 100644 --- a/plugins/GSdx/GSLinuxDialog.cpp +++ b/plugins/GSdx/GSLinuxDialog.cpp @@ -351,7 +351,7 @@ void populate_hack_table(GtkWidget* hack_table) GtkWidget* hack_tco_entry = CreateTextBox("UserHacks_TCOffset"); GtkWidget* align_sprite_check = CreateCheckBox("Align sprite hack", "UserHacks_align_sprite_X"); GtkWidget* preload_gs_check = CreateCheckBox("Preload Frame", "preload_frame_with_gs_data"); - GtkWidget* hack_unsafe_fbmask = CreateCheckBox("Fast Accurate Blending", "UserHacks_unsafe_fbmask"); + GtkWidget* hack_safe_fbmask = CreateCheckBox("Safe Accurate Blending", "UserHacks_safe_fbmask"); GtkWidget* hack_sprite_box = CreateComboBoxFromVector(theApp.m_gs_hack, "UserHacks_SpriteHack"); GtkWidget* hack_sprite_label = left_label("Alpha-Sprite Hack:"); @@ -376,7 +376,7 @@ void populate_hack_table(GtkWidget* hack_table) InsertWidgetInTable(hack_table , hack_enble_check); InsertWidgetInTable(hack_table , hack_wild_check , align_sprite_check); InsertWidgetInTable(hack_table , hack_offset_check , preload_gs_check); - InsertWidgetInTable(hack_table , hack_unsafe_fbmask); + InsertWidgetInTable(hack_table , hack_safe_fbmask); InsertWidgetInTable(hack_table , hack_sprite_label , hack_sprite_box ); InsertWidgetInTable(hack_table , stretch_hack_label , stretch_hack_box ); InsertWidgetInTable(hack_table , hack_skipdraw_label , hack_skipdraw_spin); diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 2abf60a48d..053701dddd 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -37,7 +37,7 @@ GSRendererOGL::GSRendererOGL() UserHacks_TCOffset = theApp.GetConfig("UserHacks_TCOffset", 0); UserHacks_TCO_x = (UserHacks_TCOffset & 0xFFFF) / -1000.0f; UserHacks_TCO_y = ((UserHacks_TCOffset >> 16) & 0xFFFF) / -1000.0f; - UserHacks_unsafe_fbmask = theApp.GetConfig("UserHacks_unsafe_fbmask", false); + UserHacks_safe_fbmask = theApp.GetConfig("UserHacks_safe_fbmask", false); m_prim_overlap = PRIM_OVERLAP_UNKNOW; @@ -45,7 +45,7 @@ GSRendererOGL::GSRendererOGL() UserHacks_TCOffset = 0; UserHacks_TCO_x = 0; UserHacks_TCO_y = 0; - UserHacks_unsafe_fbmask = false; + UserHacks_safe_fbmask = false; } } @@ -324,7 +324,7 @@ bool GSRendererOGL::EmulateTextureShuffleAndFbmask(GSDeviceOGL::PSSelector& ps_s TextureBarrier() will guarantee that writes have completed and caches have been invalidated before subsequent Draws are executed. */ - if (!(~ff_fbmask & ~zero_fbmask & 0x7) && UserHacks_unsafe_fbmask) { + if (!(~ff_fbmask & ~zero_fbmask & 0x7) && !UserHacks_safe_fbmask) { GL_INS("FBMASK Unsafe SW emulated fb_mask:%x on %d bits format", m_context->FRAME.FBMSK, (GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt == 2) ? 16 : 32); m_unsafe_fbmask = true; diff --git a/plugins/GSdx/GSRendererOGL.h b/plugins/GSdx/GSRendererOGL.h index 7516ab90c6..aec13e21a1 100644 --- a/plugins/GSdx/GSRendererOGL.h +++ b/plugins/GSdx/GSRendererOGL.h @@ -53,7 +53,7 @@ class GSRendererOGL : public GSRendererHW unsigned int UserHacks_TCOffset; float UserHacks_TCO_x, UserHacks_TCO_y; - bool UserHacks_unsafe_fbmask; + bool UserHacks_safe_fbmask; GSDeviceOGL::VSConstantBuffer vs_cb; GSDeviceOGL::PSConstantBuffer ps_cb; diff --git a/plugins/GSdx/GSSetting.cpp b/plugins/GSdx/GSSetting.cpp index c31e78e633..2c5fe63d77 100644 --- a/plugins/GSdx/GSSetting.cpp +++ b/plugins/GSdx/GSSetting.cpp @@ -102,9 +102,8 @@ const char* dialog_message(int ID, bool* updateText) { "High:\nExtend it to destination alpha blending and color wrapping. (help shadow and fog effect). A good CPU is required.\n\n" "Full:\nExcept few cases, the blending unit will be fully emulated by the shader. It is ultra slow! It is intended for debug.\n\n" "Ultra:\nThe blending unit will be completely emulated by the shader. It is ultra slow! It is intended for debug."; - case IDC_UNSAFE_FBMASK: - return "Relies on undefined hardware behavior to accelerate accurate blending operation.\n\n" - "It provides a major boost on the Xenosaga Series.\n"; + case IDC_SAFE_FBMASK: + return "By default, accurate blending relies on undefined hardware behavior to be fast.\nThis option enables a slower but safer behavior if anyone encounters an issue.\n"; case IDC_TC_DEPTH: return "Allows the conversion of Depth buffer from/to Color buffer. It is used for blur & depth of field effects"; case IDC_AFCOMBO: diff --git a/plugins/GSdx/GSSetting.h b/plugins/GSdx/GSSetting.h index 72231e2ee8..54e680485f 100644 --- a/plugins/GSdx/GSSetting.h +++ b/plugins/GSdx/GSSetting.h @@ -60,7 +60,7 @@ enum { IDC_TCOFFSETY2, IDC_PALTEX, IDC_ACCURATE_BLEND_UNIT, - IDC_UNSAFE_FBMASK, + IDC_SAFE_FBMASK, IDC_ACCURATE_DATE, IDC_TC_DEPTH, IDC_CRC_LEVEL, diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index 3c32326892..c7813ab354 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -658,7 +658,7 @@ void GSHacksDlg::OnInit() CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfig("UserHacks_AlphaStencil", 0)); CheckDlgButton(m_hWnd, IDC_PRELOAD_GS, theApp.GetConfig("preload_frame_with_gs_data", 0)); CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfig("UserHacks_align_sprite_X", 0)); - CheckDlgButton(m_hWnd, IDC_UNSAFE_FBMASK, theApp.GetConfig("UserHacks_unsafe_fbmask", 0)); + CheckDlgButton(m_hWnd, IDC_SAFE_FBMASK, theApp.GetConfig("UserHacks_safe_fbmask", 0)); ComboBoxInit(IDC_ROUND_SPRITE, theApp.m_gs_hack, theApp.GetConfig("UserHacks_round_sprite_offset", 0)); @@ -675,7 +675,7 @@ void GSHacksDlg::OnInit() ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), ogl ? SW_HIDE : SW_SHOW); ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), ogl ? SW_HIDE : SW_SHOW); - ShowWindow(GetDlgItem(m_hWnd, IDC_UNSAFE_FBMASK), ogl ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(m_hWnd, IDC_SAFE_FBMASK), ogl ? SW_SHOW : SW_HIDE); AddTooltip(IDC_SKIPDRAWHACKEDIT); @@ -693,7 +693,7 @@ void GSHacksDlg::OnInit() AddTooltip(IDC_TCOFFSETY); AddTooltip(IDC_TCOFFSETY2); AddTooltip(IDC_PRELOAD_GS); - AddTooltip(IDC_UNSAFE_FBMASK); + AddTooltip(IDC_SAFE_FBMASK); } void GSHacksDlg::UpdateControls() @@ -728,7 +728,7 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL)); theApp.SetConfig("preload_frame_with_gs_data", (int)IsDlgButtonChecked(m_hWnd, IDC_PRELOAD_GS)); theApp.SetConfig("Userhacks_align_sprite_X", (int)IsDlgButtonChecked(m_hWnd, IDC_ALIGN_SPRITE)); - theApp.SetConfig("UserHacks_unsafe_fbmask", (int)IsDlgButtonChecked(m_hWnd, IDC_UNSAFE_FBMASK)); + theApp.SetConfig("UserHacks_safe_fbmask", (int)IsDlgButtonChecked(m_hWnd, IDC_SAFE_FBMASK)); unsigned int TCOFFSET = SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0) & 0xFFFF; diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index 4a6c5ba924..7f5cd709aa 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -105,7 +105,7 @@ BEGIN CONTROL "Half-pixel Offset",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,51,70,8 COMBOBOX IDC_MSAACB,88,17,58,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Wild Arms Offset",IDC_WILDHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,64,70,8 - CONTROL "Fast accurate blending",IDC_UNSAFE_FBMASK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,77,90,8 + CONTROL "Safe accurate blending",IDC_SAFE_FBMASK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,77,90,8 CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,77,57,8 CONTROL "Align Sprite",IDC_ALIGN_SPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,51,58,8 RTEXT "TC Offset X:",IDC_STATIC,40,146,44,8 diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index 386d5f516b..f9cea6952e 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -89,7 +89,7 @@ #define IDC_MIPMAP 2084 #define IDC_PRELOAD_GS 2085 #define IDC_TVSHADER 2086 -#define IDC_UNSAFE_FBMASK 2087 +#define IDC_SAFE_FBMASK 2087 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001 #define IDR_MERGE_FX 10002