gsdx:windows: Rework hacks dialog to use tooltips

Changes the three-state checkboxes to comboboxes.
Removes the hack description box.
Hides Alpha and Alpha Stencil when OpenGL is selected.
Rearranges the hacks dialog.
This commit is contained in:
Jonathan Li 2015-08-08 19:17:26 +01:00
parent fcc8a941b0
commit c72b4d6e8a
3 changed files with 68 additions and 58 deletions

View File

@ -551,8 +551,13 @@ int swap_states(int a)
}
}
void GSHacksDlg::OnInit()
{
bool dx9 = (int)SendMessage(GetDlgItem(GetParent(m_hWnd), IDC_RENDERER), CB_GETCURSEL, 0, 0) / 3 == 0;
{
HWND hwnd_renderer = GetDlgItem(GetParent(m_hWnd), IDC_RENDERER);
int renderer = SendMessage(hwnd_renderer, CB_GETITEMDATA, SendMessage(hwnd_renderer, CB_GETCURSEL, 0, 0), 0);
// It can only be accessed with a HW renderer, so this is sufficient.
bool dx9 = renderer == 0;
bool dx11 = renderer == 3;
bool ogl = renderer == 12;
unsigned short cb = 0;
if(dx9) for(unsigned short i = 0; i < 17; i++)
@ -589,12 +594,13 @@ 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));
CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfig("UserHacks_AlphaStencil", 0));
CheckDlgButton(m_hWnd, IDC_ROUND_SPRITE, swap_states(theApp.GetConfig("UserHacks_round_sprite_offset", 0)));
CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfig("UserHacks_align_sprite_X", 0));
ComboBoxInit(IDC_ROUND_SPRITE, theApp.m_gs_hack, theApp.GetConfig("UserHacks_round_sprite_offset", 0));
ComboBoxInit(IDC_SPRITEHACK, theApp.m_gs_hack, theApp.GetConfig("UserHacks_SpriteHack", 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));
@ -604,8 +610,23 @@ void GSHacksDlg::OnInit()
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETPOS, 0, MAKELPARAM((theApp.GetConfig("UserHacks_TCOffset", 0) >> 16) & 0xFFFF, 0));
// Hacks descriptions
SetWindowText(GetDlgItem(m_hWnd, IDC_HACK_DESCRIPTION), "Hover over an item to get a description.");
ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), ogl ? SW_HIDE : SW_SHOW);
ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), ogl ? SW_HIDE : SW_SHOW);
AddTooltip(IDC_SKIPDRAWHACKEDIT);
AddTooltip(IDC_SKIPDRAWHACK);
AddTooltip(IDC_ALPHAHACK);
AddTooltip(IDC_OFFSETHACK);
AddTooltip(IDC_SPRITEHACK);
AddTooltip(IDC_WILDHACK);
AddTooltip(IDC_MSAACB);
AddTooltip(IDC_ALPHASTENCIL);
AddTooltip(IDC_ALIGN_SPRITE);
AddTooltip(IDC_ROUND_SPRITE);
AddTooltip(IDC_TCOFFSETX);
AddTooltip(IDC_TCOFFSETX2);
AddTooltip(IDC_TCOFFSETY);
AddTooltip(IDC_TCOFFSETY2);
}
void GSHacksDlg::UpdateControls()
@ -615,28 +636,6 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_SETCURSOR:
{
bool updateText = true;
POINT pos;
GetCursorPos(&pos);
ScreenToClient(m_hWnd, &pos);
HWND hoveredwnd = ChildWindowFromPointEx(m_hWnd, pos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT);
if (hoveredwnd != hovered_window)
hovered_window = hoveredwnd;
else
break;
const char *helpstr = dialog_message(GetDlgCtrlID(hoveredwnd), &updateText);
if(updateText)
SetWindowText(GetDlgItem(m_hWnd, IDC_HACK_DESCRIPTION), helpstr);
} break;
case WM_COMMAND:
{
int id = LOWORD(wParam);
@ -645,14 +644,21 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
case IDOK:
{
INT_PTR data;
if (ComboBoxGetSelData(IDC_ROUND_SPRITE, data))
{
theApp.SetConfig("UserHacks_round_sprite_offset", (int)data);
}
if (ComboBoxGetSelData(IDC_SPRITEHACK, data))
{
theApp.SetConfig("UserHacks_SpriteHack", (int)data);
}
theApp.SetConfig("UserHacks_MSAA", cb2msaa[(int)SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_GETCURSEL, 0, 0)]);
theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK));
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));
theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL));
theApp.SetConfig("UserHacks_round_sprite_offset", swap_states((int)IsDlgButtonChecked(m_hWnd, IDC_ROUND_SPRITE)));
theApp.SetConfig("Userhacks_align_sprite_X", (int)IsDlgButtonChecked(m_hWnd, IDC_ALIGN_SPRITE));
unsigned int TCOFFSET = SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0) & 0xFFFF;

View File

@ -48,8 +48,6 @@ class GSHacksDlg : public GSDialog
bool isdx9;
HWND hovered_window;
void UpdateControls();
protected:

View File

@ -89,34 +89,33 @@ IDB_LOGOGL BITMAP "res\\logo-ogl.bmp"
// Dialog
//
IDD_HACKS DIALOGEX 0, 0, 315, 247
IDD_HACKS DIALOGEX 0, 0, 147, 182
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,222,50,14
GROUPBOX "Hack",IDC_STATIC,7,7,86,212,0,WS_EX_TRANSPARENT
GROUPBOX "Description",IDC_STATIC,96,7,212,212
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,57,34,10
CONTROL "Half-pixel Offset",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,73,65,10
CONTROL "Sprite",IDC_SPRITEHACK,"Button",BS_AUTO3STATE | WS_TABSTOP,14,89,35,10
LTEXT "USE AT YOUR OWN RISK!",IDC_STATIC,7,225,84,11,WS_DISABLED
COMBOBOX IDC_MSAACB,35,18,54,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Wild Arms Offset",IDC_WILDHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,134,64,10
LTEXT "TEXT_GOES_HERE",IDC_HACK_DESCRIPTION,102,20,199,192
CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,123,66,10
CONTROL "Round Sprite",IDC_ROUND_SPRITE,"Button",BS_AUTO3STATE | WS_TABSTOP,14,140,66,8
CONTROL "Align Sprite",IDC_ALIGN_SPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,158,60,10
LTEXT "TC Offset X",IDC_STATIC_TCOFFSETX,14,176,37,8
EDITTEXT IDC_TCOFFSETX2,53,174,35,14,ES_RIGHT | ES_AUTOHSCROLL
CONTROL "",IDC_TCOFFSETX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,86,174,11,14
EDITTEXT IDC_TCOFFSETY2,53,191,35,14,ES_RIGHT | ES_AUTOHSCROLL
CONTROL "",IDC_TCOFFSETY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,86,191,11,14
LTEXT "TC Offset Y",IDC_STATIC_TCOFFSETY,14,193,37,8
DEFPUSHBUTTON "OK",IDOK,84,163,56,14
GROUPBOX "USE AT YOUR OWN RISK!",IDC_STATIC,7,7,133,155,0,WS_EX_TRANSPARENT
RTEXT "MSAA:",IDC_STATIC,58,20,22,8
RTEXT "Skipdraw:",IDC_STATIC,48,36,32,8
EDITTEXT IDC_SKIPDRAWHACKEDIT,84,33,48,14,ES_RIGHT | ES_AUTOHSCROLL
CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,113,34,11,14
CONTROL "Alpha",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,64,34,8
CONTROL "Half-pixel Offset",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,51,65,8
COMBOBOX IDC_MSAACB,84,17,48,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Wild Arms Offset",IDC_WILDHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,64,64,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,84,51,48,8
RTEXT "TC Offset X:",IDC_STATIC,36,128,44,8
EDITTEXT IDC_TCOFFSETX2,84,126,48,14,ES_RIGHT | ES_AUTOHSCROLL
CONTROL "",IDC_TCOFFSETX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,121,127,11,14
EDITTEXT IDC_TCOFFSETY2,84,144,48,14,ES_RIGHT | ES_AUTOHSCROLL
CONTROL "",IDC_TCOFFSETY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,121,144,11,14
RTEXT "TC Offset Y:",IDC_STATIC,32,147,48,8
COMBOBOX IDC_ROUND_SPRITE,84,91,48,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Round Sprite:",IDC_STATIC,35,93,45,8
RTEXT "Sprite:",IDC_STATIC,58,109,22,8
COMBOBOX IDC_SPRITEHACK,84,107,48,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_SHADEBOOST DIALOGEX 0, 0, 316, 129
@ -249,9 +248,16 @@ BEGIN
IDD_HACKS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 308
RIGHTMARGIN, 140
VERTGUIDE, 14
VERTGUIDE, 80
VERTGUIDE, 84
VERTGUIDE, 132
TOPMARGIN, 7
BOTTOMMARGIN, 236
BOTTOMMARGIN, 177
HORZGUIDE, 51
HORZGUIDE, 64
HORZGUIDE, 77
END
IDD_SHADEBOOST, DIALOG