gsdx:windows: Open sub dialogs using temporary objects

This prevents the dialog from preserving state after it is closed, which
simplifies the logic slightly for reopening the dialog.

Also remove an unused variable.
This commit is contained in:
Jonathan Li 2018-08-23 00:26:59 +01:00
parent eb104f60e2
commit 4d8dea0892
2 changed files with 15 additions and 23 deletions

View File

@ -222,15 +222,21 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
break; break;
case IDC_SHADEBUTTON: case IDC_SHADEBUTTON:
if (code == BN_CLICKED) if (code == BN_CLICKED)
ShaderDlg.DoModal(); GSShaderDlg().DoModal();
break; break;
case IDC_OSDBUTTON: case IDC_OSDBUTTON:
if (code == BN_CLICKED) if (code == BN_CLICKED)
OSDDlg.DoModal(); GSOSDDlg().DoModal();
break; break;
case IDC_HACKSBUTTON: case IDC_HACKSBUTTON:
if (code == BN_CLICKED) if (code == BN_CLICKED)
HacksDlg.DoModal(); {
INT_PTR data;
std::string adapter_id;
if (ComboBoxGetSelData(IDC_ADAPTER, data))
adapter_id = adapters[data].id;
GSHacksDlg(adapter_id).DoModal();
}
break; break;
case IDOK: case IDOK:
{ {
@ -319,9 +325,6 @@ void GSSettingsDlg::UpdateRenderers()
if (!ComboBoxGetSelData(IDC_ADAPTER, i)) if (!ComboBoxGetSelData(IDC_ADAPTER, i))
return; return;
// Ugggh
HacksDlg.SetAdapter(adapters[(int)i].id);
D3D_FEATURE_LEVEL level = adapters[(int)i].level; D3D_FEATURE_LEVEL level = adapters[(int)i].level;
std::vector<GSSetting> renderers; std::vector<GSSetting> renderers;
@ -640,8 +643,9 @@ bool GSShaderDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
// Hacks Dialog // Hacks Dialog
GSHacksDlg::GSHacksDlg() : GSHacksDlg::GSHacksDlg(const std::string &adapter_id)
GSDialog(IDD_HACKS) : GSDialog{IDD_HACKS}
, m_adapter_id(adapter_id)
{ {
memset(msaa2cb, 0, sizeof(msaa2cb)); memset(msaa2cb, 0, sizeof(msaa2cb));
memset(cb2msaa, 0, sizeof(cb2msaa)); memset(cb2msaa, 0, sizeof(cb2msaa));
@ -665,7 +669,7 @@ void GSHacksDlg::OnInit()
{ {
if( i == 1) continue; if( i == 1) continue;
int depth = GSDevice9::GetMaxDepth(i, adapter_id); int depth = GSDevice9::GetMaxDepth(i, m_adapter_id);
if(depth) if(depth)
{ {

View File

@ -44,7 +44,7 @@ class GSHacksDlg : public GSDialog
{ {
unsigned short cb2msaa[17]; unsigned short cb2msaa[17];
unsigned short msaa2cb[17]; unsigned short msaa2cb[17];
std::string adapter_id; std::string m_adapter_id;
int m_old_skipdraw_offset; int m_old_skipdraw_offset;
int m_old_skipdraw; int m_old_skipdraw;
@ -55,13 +55,7 @@ protected:
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam); bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public: public:
GSHacksDlg(); GSHacksDlg(const std::string &adapter_id);
// Ugh
void SetAdapter(std::string adapter_id_)
{
adapter_id = adapter_id_;
}
}; };
class GSOSDDlg : public GSDialog class GSOSDDlg : public GSDialog
@ -92,7 +86,6 @@ class GSSettingsDlg : public GSDialog
std::vector<Adapter> adapters; std::vector<Adapter> adapters;
std::vector<GSSetting> m_ocl_devs; std::vector<GSSetting> m_ocl_devs;
uint32 m_lastValidMsaa; // used to revert to previous dialog value if the user changed to invalid one, or lesser one and canceled
void UpdateRenderers(); void UpdateRenderers();
void UpdateControls(); void UpdateControls();
@ -101,11 +94,6 @@ protected:
void OnInit(); void OnInit();
bool OnCommand(HWND hWnd, UINT id, UINT code); bool OnCommand(HWND hWnd, UINT id, UINT code);
// Shade Boost
GSShaderDlg ShaderDlg;
GSHacksDlg HacksDlg;
GSOSDDlg OSDDlg;
public: public:
GSSettingsDlg(); GSSettingsDlg();
}; };