gsdx: Split TC offset hack into X and Y components

This commit is contained in:
Jonathan Li 2018-09-10 21:13:34 +01:00
parent 2f5ba10e6b
commit 3fe9ff7ac8
7 changed files with 19 additions and 19 deletions

View File

@ -436,8 +436,9 @@ void populate_hack_table(GtkWidget* hack_table)
GtkWidget* hack_skipdraw_label = left_label("Skipdraw Range:");
CreateSkipdrawSpinButtons(0, 10000);
GtkWidget* hack_wild_check = CreateCheckBox("Wild Arms Hack", "UserHacks_WildHack");
GtkWidget* hack_tco_label = left_label("Texture Offset: 0x");
GtkWidget* hack_tco_entry = CreateTextBox("UserHacks_TCOffset");
GtkWidget* hack_tco_label = left_label("Texture Offset:");
GtkWidget* hack_tco_x_spin = CreateSpinButton(0, 10000, "UserHacks_TCOffsetX");
GtkWidget* hack_tco_y_spin = CreateSpinButton(0, 10000, "UserHacks_TCOffsetY");
GtkWidget* align_sprite_check = CreateCheckBox("Align Sprite", "UserHacks_align_sprite_X");
GtkWidget* preload_gs_check = CreateCheckBox("Preload Frame Data", "preload_frame_with_gs_data");
GtkWidget* hack_fast_inv = CreateCheckBox("Fast Texture Invalidation", "UserHacks_DisablePartialInvalidation");
@ -464,7 +465,8 @@ void populate_hack_table(GtkWidget* hack_table)
AddTooltip(hack_wild_check, IDC_WILDHACK);
AddTooltip(hack_sprite_label, hack_sprite_box, IDC_SPRITEHACK);
AddTooltip(hack_tco_label, IDC_TCOFFSETX);
AddTooltip(hack_tco_entry, IDC_TCOFFSETX);
AddTooltip(hack_tco_x_spin, IDC_TCOFFSETX);
AddTooltip(hack_tco_y_spin, IDC_TCOFFSETX);
AddTooltip(align_sprite_check, IDC_ALIGN_SPRITE);
AddTooltip(stretch_hack_label, stretch_hack_box, IDC_ROUND_SPRITE);
AddTooltip(preload_gs_check, IDC_PRELOAD_GS);
@ -493,7 +495,7 @@ void populate_hack_table(GtkWidget* hack_table)
InsertWidgetInTable(hack_table , hack_sprite_label , hack_sprite_box );
InsertWidgetInTable(hack_table , stretch_hack_label , stretch_hack_box );
InsertWidgetInTable(hack_table , hack_skipdraw_label , s_hack_skipdraw_offset_spin, s_hack_skipdraw_spin);
InsertWidgetInTable(hack_table , hack_tco_label , hack_tco_entry);
InsertWidgetInTable(hack_table , hack_tco_label , hack_tco_x_spin, hack_tco_y_spin);
}
void populate_main_table(GtkWidget* main_table)

View File

@ -315,7 +315,7 @@ void GSRendererDX::EmulateTextureSampler(const GSTextureCache::Source* tex)
}
// TC Offset Hack
m_ps_sel.tcoffsethack = !!m_userhacks_tcoffset;
m_ps_sel.tcoffsethack = m_userhacks_tcoffset;
ps_cb.TC_OffsetHack = GSVector4(m_userhacks_tcoffset_x, m_userhacks_tcoffset_y).xyxy() / WH.xyxy();
// Only enable clamping in CLAMP mode. REGION_CLAMP will be done manually in the shader

View File

@ -30,7 +30,7 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc)
, m_reset(false)
, m_upscale_multiplier(1)
, m_tc(tc)
, m_userhacks_tcoffset(0)
, m_userhacks_tcoffset(false)
, m_userhacks_tcoffset_x(0)
, m_userhacks_tcoffset_y(0)
, m_channel_shuffle(false)
@ -45,9 +45,9 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc)
m_userhacks_disable_gs_mem_clear = theApp.GetConfigB("UserHacks_DisableGsMemClear");
m_userHacks_HPO = theApp.GetConfigI("UserHacks_HalfPixelOffset");
m_userHacks_merge_sprite = theApp.GetConfigB("UserHacks_merge_pp_sprite");
m_userhacks_tcoffset = theApp.GetConfigI("UserHacks_TCOffset");
m_userhacks_tcoffset_x = (m_userhacks_tcoffset & 0xFFFF) / -1000.0f;
m_userhacks_tcoffset_y = ((m_userhacks_tcoffset >> 16) & 0xFFFF) / -1000.0f;
m_userhacks_tcoffset_x = theApp.GetConfigI("UserHacks_TCOffsetX") / -1000.0f;
m_userhacks_tcoffset_y = theApp.GetConfigI("UserHacks_TCOffsetY") / -1000.0f;
m_userhacks_tcoffset = m_userhacks_tcoffset_x < 0.0f || m_userhacks_tcoffset_y < 0.0f;
} else {
m_userhacks_align_sprite_X = false;
m_userhacks_round_sprite_offset = 0;

View File

@ -150,7 +150,7 @@ protected:
int m_userhacks_round_sprite_offset;
int m_userHacks_HPO;
unsigned int m_userhacks_tcoffset;
bool m_userhacks_tcoffset;
float m_userhacks_tcoffset_x;
float m_userhacks_tcoffset_y;

View File

@ -838,7 +838,7 @@ void GSRendererOGL::EmulateTextureSampler(const GSTextureCache::Source* tex)
}
// TC Offset Hack
m_ps_sel.tcoffsethack = !!m_userhacks_tcoffset;
m_ps_sel.tcoffsethack = m_userhacks_tcoffset;
ps_cb.TC_OH_TS = GSVector4(1/16.0f, 1/16.0f, m_userhacks_tcoffset_x, m_userhacks_tcoffset_y) / WH.xyxy();

View File

@ -712,10 +712,10 @@ void GSHacksDlg::OnInit()
SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_SkipDraw"), 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_TCOffset") & 0xFFFF, 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_TCOffsetX"), 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETPOS, 0, MAKELPARAM((theApp.GetConfigI("UserHacks_TCOffset") >> 16) & 0xFFFF, 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_TCOffsetY"), 0));
// Direct3D-only hacks:
EnableWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), !ogl);
@ -870,11 +870,8 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
theApp.SetConfig("UserHacks_unscale_point_line", (int)IsDlgButtonChecked(m_hWnd, IDC_UNSCALE_POINT_LINE));
theApp.SetConfig("wrap_gs_mem", (int)IsDlgButtonChecked(m_hWnd, IDC_MEMORY_WRAPPING));
theApp.SetConfig("UserHacks_merge_pp_sprite", (int)IsDlgButtonChecked(m_hWnd, IDC_MERGE_PP_SPRITE));
unsigned int TCOFFSET = SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0) & 0xFFFF;
TCOFFSET |= (SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_GETPOS, 0, 0) & 0xFFFF) << 16;
theApp.SetConfig("UserHacks_TCOffset", TCOFFSET);
theApp.SetConfig("UserHacks_TCOffsetX", SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0));
theApp.SetConfig("UserHacks_TCOffsetY", SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_GETPOS, 0, 0));
EndDialog(m_hWnd, id);
} break;

View File

@ -444,7 +444,8 @@ void GSdxApp::Init()
m_default_configuration["UserHacks_SkipDraw"] = "0";
m_default_configuration["UserHacks_SkipDraw_Offset"] = "0";
m_default_configuration["UserHacks_SpriteHack"] = "0";
m_default_configuration["UserHacks_TCOffset"] = "0";
m_default_configuration["UserHacks_TCOffsetX"] = "0";
m_default_configuration["UserHacks_TCOffsetY"] = "0";
m_default_configuration["UserHacks_TextureInsideRt"] = "0";
m_default_configuration["UserHacks_TriFilter"] = std::to_string(static_cast<int8>(TriFiltering::None));
m_default_configuration["UserHacks_WildHack"] = "0";