GS: new wx config dialog working on windows

This commit is contained in:
kojin 2021-08-10 01:38:46 -04:00 committed by tellowkrinkle
parent be3253bf87
commit 1e35398a84
14 changed files with 131 additions and 1511 deletions

View File

@ -655,6 +655,7 @@ set(pcsx2GSSources
GS/Renderers/OpenGL/GSTextureCacheOGL.cpp
GS/Renderers/OpenGL/GSTextureOGL.cpp
GS/Window/GSSetting.cpp
GS/Window/GSwxDialog.cpp
)
# GS headers
@ -724,7 +725,7 @@ set(pcsx2GSHeaders
GS/Window/GSCaptureDlg.h
GS/Window/GSDialog.h
GS/Window/GSSetting.h
GS/Window/GSSettingsDlg.h
GS/Window/GSwxDialog.h
)
if(WIN32)
@ -797,7 +798,6 @@ if(WIN32)
GS/Renderers/DX11/GSTextureFX11.cpp
GS/Window/GSCaptureDlg.cpp
GS/Window/GSDialog.cpp
GS/Window/GSSettingsDlg.cpp
)
list(APPEND pcsx2GSHeaders
GS/Renderers/DX11/D3D.h
@ -889,12 +889,10 @@ else(WIN32)
list(APPEND pcsx2GSSources
GS/GS_res.cpp
GS/Window/GSwxDialog.cpp
)
list(APPEND pcsx2GSHeaders
GS/GS_res.h
GS/Window/GSwxDialog.h
)
endif(WIN32)

View File

@ -14,6 +14,7 @@
*/
#include "PrecompiledHeader.h"
#include "GS/Window/GSwxDialog.h"
#include "GS.h"
#include "GSUtil.h"
#include "Renderers/SW/GSRendererSW.h"
@ -30,16 +31,11 @@
#include "Renderers/DX11/GSRendererDX11.h"
#include "Renderers/DX11/GSDevice11.h"
#include "Window/GSSettingsDlg.h"
#include "GS/Renderers/DX11/D3D.h"
static HRESULT s_hr = E_FAIL;
#else
#include "GS/Window/GSwxDialog.h"
#endif
#include <fstream>
@ -568,22 +564,12 @@ void GSconfigure()
theApp.SetConfigDir();
theApp.Init();
#ifdef _WIN32
GSDialog::InitCommonControls();
if (GSSettingsDlg().DoModal() == IDOK)
{
// Force a reload of the gs state
theApp.SetCurrentRendererType(GSRendererType::Undefined);
}
#else
if (RunwxDialog())
{
theApp.ReloadConfig();
// Force a reload of the gs state
theApp.SetCurrentRendererType(GSRendererType::Undefined);
}
#endif
}
catch (GSRecoverableError)
{

View File

@ -97,130 +97,6 @@ IDR_FONT_ROBOTO RCDATA "res\\fonts-roboto\\Roboto-Regul
// Dialog
//
IDD_HACKS DIALOGEX 0, 0, 210, 289
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Settings & Hacks"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
// Rendering Hacks:
GROUPBOX "Rendering Hacks",IDC_STATIC,7,7,196,114,0,WS_EX_TRANSPARENT
// Column one - HW Hacks
CONTROL "Auto Flush",IDC_AUTO_FLUSH_HW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,19,55,8
CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,32,92,8
CONTROL "Disable Safe Features",IDC_SAFE_FEATURES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,45,85,8
// Column two - HW hacks
CONTROL "Fast Texture Invalidation",IDC_FAST_TC_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,19,93,8
CONTROL "Frame Buffer Conversion",IDC_CPU_FB_CONVERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,32,93,8
CONTROL "Memory Wrapping",IDC_MEMORY_WRAPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,45,75,8
CONTROL "Preload Frame Data",IDC_PRELOAD_GS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,58,80,8
// Columns end
//
RTEXT "Half-screen Fix:",IDC_HALF_SCREEN_TS_TEXT,14,73,62,8
COMBOBOX IDC_HALF_SCREEN_TS,80,70,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Trilinear Filtering:",IDC_TRI_FILTER_TEXT,16,88,60,8
COMBOBOX IDC_TRI_FILTER,80,85,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Skipdraw Range:",IDC_SKIPDRAWHACK_TEXT,14,103,62,8
EDITTEXT IDC_SKIPDRAWOFFSETEDIT,80,100,58,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SKIPDRAWOFFSET,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
EDITTEXT IDC_SKIPDRAWHACKEDIT,138,100,58,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
// Upscaling Hacks:
GROUPBOX "Upscaling Hacks",IDC_STATIC,7,124,196,75,0,WS_EX_TRANSPARENT
CONTROL "Align Sprite",IDC_ALIGN_SPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,136,55,8
CONTROL "Merge Sprite",IDC_MERGE_PP_SPRITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,71,136,55,8
CONTROL "Wild Arms Offset",IDC_WILDHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,130,136,70,8
RTEXT "Half-pixel Offset:",IDC_OFFSETHACK_TEXT,14,151,62,8
COMBOBOX IDC_OFFSETHACK,80,148,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Round Sprite:",IDC_ROUND_SPRITE_TEXT,30,166,46,8
COMBOBOX IDC_ROUND_SPRITE,80,163,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Texture Offsets:",IDC_TCOFFSET_TEXT,14,181,62,8
RTEXT "X:",IDC_TCOFFSETX_TEXT,81,181,10,8
EDITTEXT IDC_TCOFFSETX2,94,178,44,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_TCOFFSETX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
RTEXT "Y:",IDC_TCOFFSETY_TEXT,139,181,10,8
EDITTEXT IDC_TCOFFSETY2,152,178,44,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_TCOFFSETY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
// OpenGL Advanced Settings:
GROUPBOX "OpenGL Advanced Settings",IDC_STATIC,7,202,196,61,0,WS_EX_TRANSPARENT
RTEXT "Geometry Shader:",IDC_GEOMETRY_SHADER_TEXT,14,216,62,8
COMBOBOX IDC_GEOMETRY_SHADER_OVERRIDE,80,213,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Image Load Store:",IDC_IMAGE_LOAD_STORE_TEXT,14,231,62,8
COMBOBOX IDC_IMAGE_LOAD_STORE,80,228,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Sparse Texture:",IDC_SPARSE_TEXTURE_TEXT,14,246,62,8
COMBOBOX IDC_SPARSE_TEXTURE,80,243,116,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
// General Settings:
DEFPUSHBUTTON "OK",IDOK,52,269,50,14
DEFPUSHBUTTON "Cancel",IDCANCEL,108,269,50,14
END
IDD_SHADER DIALOGEX 0, 0, 248, 230
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Shader Configuration"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "Texture Filtering of Display",IDC_LINEAR_PRESENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,100,10
CONTROL "FXAA Shader (PgUp)",IDC_FXAA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,19,80,10
CONTROL "Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,32,90,10
LTEXT "Shade Boost Brightness",IDC_BRIGHTNESS_TEXT,16,50,80,8
CONTROL "",IDC_BRIGHTNESS_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,95,48,122,15
RTEXT "100",IDC_BRIGHTNESS_VALUE,221,50,12,8
LTEXT "Shade Boost Contrast",IDC_CONTRAST_TEXT,16,75,80,8
CONTROL "",IDC_CONTRAST_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,95,73,122,15
RTEXT "100",IDC_CONTRAST_VALUE,221,75,12,8
LTEXT "Shade Boost Saturation",IDC_SATURATION_TEXT,16,100,80,8
CONTROL "",IDC_SATURATION_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,95,98,122,15
RTEXT "100",IDC_SATURATION_VALUE,221,100,12,8
CONTROL "External Shader (Home)",IDC_SHADER_FX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,116,91,10
LTEXT "External Shader",IDC_SHADER_FX_TEXT,16,131,75,8
EDITTEXT IDC_SHADER_FX_EDIT,16,139,170,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_SHADER_FX_BUTTON,196,139,37,14
LTEXT "External Shader Config",IDC_SHADER_FX_CONF_TEXT,16,156,75,8
PUSHBUTTON "Browse",IDC_SHADER_FX_CONF_BUTTON,196,164,37,14
EDITTEXT IDC_SHADER_FX_CONF_EDIT,16,164,170,14,ES_AUTOHSCROLL
COMBOBOX IDC_TVSHADER,75,184,98,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "TV Shader:",IDC_STATIC,16,186,55,8
DEFPUSHBUTTON "OK",IDOK,71,208,50,14
DEFPUSHBUTTON "Cancel",IDCANCEL,127,208,50,14
END
IDD_OSD DIALOGEX 0, 0, 210, 205
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "OSD Configuration"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
// Enable/Disable
CONTROL "Enable Statistics Monitor",IDC_OSD_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,7,88,10
CONTROL "Enable Log",IDC_OSD_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,7,54,10
// Font Settings
GROUPBOX "Font",IDC_STATIC,7,20,196,100,0,WS_EX_TRANSPARENT
LTEXT "Size:",IDC_OSD_SIZE_TEXT,16,34,25,8
EDITTEXT IDC_OSD_SIZE_EDIT,112,31,83,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_OSD_SIZE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
LTEXT "Red:",IDC_OSD_COLOR_RED_TEXT,16,51,25,8
CONTROL "",IDC_OSD_COLOR_RED_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,107,49,76,15
RTEXT "255",IDC_OSD_COLOR_RED_AMOUNT,184,52,12,8
LTEXT "Green:",IDC_OSD_COLOR_GREEN_TEXT,16,68,25,8
CONTROL "",IDC_OSD_COLOR_GREEN_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,107,66,76,15
RTEXT "255",IDC_OSD_COLOR_GREEN_AMOUNT,184,69,12,8
LTEXT "Blue:",IDC_OSD_COLOR_BLUE_TEXT,16,86,25,8
CONTROL "",IDC_OSD_COLOR_BLUE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,107,83,76,15
RTEXT "255",IDC_OSD_COLOR_BLUE_AMOUNT,184,86,12,8
LTEXT "Opacity:",IDC_OSD_OPACITY_TEXT,16,104,50,8
CONTROL "",IDC_OSD_OPACITY_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,107,100,76,15
RTEXT "100",IDC_OSD_OPACITY_AMOUNT,184,104,12,8
// Log Settings
GROUPBOX "Log Messages",IDC_STATIC,7,125,196,52,0,WS_EX_TRANSPARENT
LTEXT "Timeout (seconds):",IDC_OSD_TIMEOUT_TEXT,16,139,75,8
EDITTEXT IDC_OSD_TIMEOUT_EDIT,112,135,83,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "", IDC_OSD_TIMEOUT,"msctls_updown32", UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
LTEXT "Max:",IDC_OSD_MAX_LOG_TEXT,16,158,25,8
EDITTEXT IDC_OSD_MAX_LOG_EDIT,112,155,83,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
CONTROL "", IDC_OSD_MAX_LOG,"msctls_updown32", UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
// OK/CANCEL
DEFPUSHBUTTON "OK",IDOK,52,183,50,14
DEFPUSHBUTTON "Cancel",IDCANCEL,108,183,50,14
END
IDD_CAPTURE DIALOGEX 0, 0, 279, 71
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Capture settings"
@ -238,53 +114,6 @@ BEGIN
COMBOBOX IDC_COLORSPACE,102,47,48,32,CBS_DROPDOWNLIST | WS_TABSTOP
END
IDD_CONFIG DIALOGEX 0, 0, 242, 315
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Graphics Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
// General Settings:
LTEXT "Renderer:",IDC_STATIC,7,8,79,8
COMBOBOX IDC_RENDERER,71,6,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Adapter:",IDC_ADAPTER_TEXT,7,23,79,8
COMBOBOX IDC_ADAPTER,71,21,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Interlacing (F5):",IDC_INTERLACE_TEXT,7,38,55,8
COMBOBOX IDC_INTERLACE,71,36,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Texture Filtering:",IDC_FILTER_TEXT,7,53,79,8
COMBOBOX IDC_FILTER,71,51,166,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "OSD Configuration",IDC_OSDBUTTON,11,274,108,14
PUSHBUTTON "Shader Configuration",IDC_SHADEBUTTON,125,274,108,14
DEFPUSHBUTTON "OK",IDOK,69,294,50,14
PUSHBUTTON "Cancel",IDCANCEL,125,294,50,14
GROUPBOX "Hardware Renderer Settings",IDC_STATIC,7,67,230,154,BS_CENTER
CONTROL "Accurate DATE",IDC_ACCURATE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,77,63,10
CONTROL "GPU Palette Conversion",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,93,87,10
CONTROL "Conservative Buffer Allocation",IDC_CONSERVATIVE_FB,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,93,110,10
LTEXT "Internal Resolution:",IDC_UPSCALE_MULTIPLIER_TEXT,23,109,79,8
COMBOBOX IDC_UPSCALE_MULTIPLIER,105,107,127,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Anisotropic Filtering:",IDC_AFCOMBO_TEXT,23,125,79,8
COMBOBOX IDC_AFCOMBO,105,123,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Dithering (PgDn):",IDC_DITHERING_TEXT,23,141,79,8
COMBOBOX IDC_DITHERING,105,139,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Mipmapping (Ins):",IDC_MIPMAP_HW_TEXT,23,157,79,8
COMBOBOX IDC_MIPMAP_HW,105,155,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "CRC Hack Level:",IDC_CRC_LEVEL_TEXT,23,173,79,8
COMBOBOX IDC_CRC_LEVEL,105,171,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Blending Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,23,189,79,8
COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,187,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_ACCURATE_BLEND_UNIT_D3D11,105,187,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,205,71,10
PUSHBUTTON "Advanced Settings and Hacks",IDC_HACKSBUTTON,105,203,127,14
GROUPBOX "Software Renderer Settings",IDC_STATIC,7,224,230,44,BS_CENTER
CONTROL "Auto Flush",IDC_AUTO_FLUSH_SW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,236,90,10
CONTROL "Edge Anti-aliasing (Del)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,236,90,10
LTEXT "Rendering threads:",IDC_SWTHREADS_TEXT,125,252,65,8
EDITTEXT IDC_SWTHREADS_EDIT,197,250,34,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,0,0,11,14
CONTROL "Mipmapping",IDC_MIPMAP_SW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,250,90,10
END
/////////////////////////////////////////////////////////////////////////////
//
@ -294,37 +123,6 @@ END
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_HACKS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 154
VERTGUIDE, 14
VERTGUIDE, 84
VERTGUIDE, 88
VERTGUIDE, 146
TOPMARGIN, 7
BOTTOMMARGIN, 229
HORZGUIDE, 51
HORZGUIDE, 64
HORZGUIDE, 77
END
IDD_SHADER, DIALOG
BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 242
TOPMARGIN, 7
BOTTOMMARGIN, 244
END
IDD_OSD, DIALOG
BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 242
TOPMARGIN, 7
BOTTOMMARGIN, 244
END
IDD_CAPTURE, DIALOG
BEGIN
VERTGUIDE, 6
@ -332,19 +130,6 @@ BEGIN
VERTGUIDE, 271
HORZGUIDE, 54
END
IDD_CONFIG, DIALOG
BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 237
VERTGUIDE, 11
VERTGUIDE, 22
VERTGUIDE, 101
VERTGUIDE, 105
VERTGUIDE, 232
TOPMARGIN, 6
BOTTOMMARGIN, 367
END
END
#endif // APSTUDIO_INVOKED

View File

@ -49,6 +49,30 @@ namespace D3D
return factory;
}
std::vector<std::string> GetAdapterList(IDXGIFactory2* factory)
{
ASSERT(factory);
UINT index = 0;
wil::com_ptr_nothrow<IDXGIAdapter1> adapter;
std::vector<std::string> adapter_list;
while (factory->EnumAdapters1(index, adapter.put()) != DXGI_ERROR_NOT_FOUND)
{
DXGI_ADAPTER_DESC1 desc;
std::string name;
if (SUCCEEDED(adapter->GetDesc1(&desc)))
name = convert_utf16_to_utf8(desc.Description);
adapter_list.push_back(std::move(name));
index++;
}
return adapter_list;
}
wil::com_ptr_nothrow<IDXGIAdapter1> GetAdapterFromIndex(IDXGIFactory2* factory, int index)
{
ASSERT(factory);

View File

@ -25,6 +25,9 @@ namespace D3D
// create a dxgi factory
wil::com_ptr_nothrow<IDXGIFactory2> CreateFactory(bool debug);
// get a list of adapters
std::vector<std::string> GetAdapterList(IDXGIFactory2* factory);
// get an adapter based on position
// assuming no one removes/moves it, it should always have the same id
// however in the event that the adapter is not found due to the above, use the default

View File

@ -15,9 +15,6 @@
#include "PrecompiledHeader.h"
#include "GSSetting.h"
#ifdef _WIN32
#include "GS/resource.h"
#endif
#ifdef _WIN32
#define cvtString(s) L##s

View File

@ -38,7 +38,6 @@ const wchar_t* dialog_message(int ID, bool* updateText = NULL);
const char* dialog_message(int ID, bool* updateText = NULL);
#endif
#ifndef _WIN32
enum
{
// Renderer
@ -52,6 +51,9 @@ enum
IDC_MIPMAP_HW,
IDC_CRC_LEVEL,
IDC_ACCURATE_BLEND_UNIT,
#ifdef _WIN32
IDC_ACCURATE_BLEND_UNIT_D3D11,
#endif
// Rendering Hacks
IDC_AUTO_FLUSH_HW,
IDC_TC_DEPTH,
@ -91,6 +93,12 @@ enum
IDC_OSD_MONITOR,
IDC_OSD_MAX_LOG,
IDC_OSD_MAX_LOG_EDIT,
// Shader Configuration
IDC_SHADEBOOST,
IDC_SHADER_FX,
IDC_FXAA,
IDC_LINEAR_PRESENT,
#ifndef _WIN32
// Shader
IDR_CONVERT_GLSL,
IDR_FXAA_FX,
@ -101,12 +109,7 @@ enum
IDR_TFX_VGS_GLSL,
IDR_TFX_FS_GLSL,
IDR_TFX_CL,
// Shader Configuration
IDC_SHADEBOOST,
IDC_SHADER_FX,
IDC_FXAA,
IDC_LINEAR_PRESENT,
// Fonts
IDR_FONT_ROBOTO,
};
#endif
};

File diff suppressed because it is too large Load Diff

View File

@ -1,104 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2021 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "GSDialog.h"
#include "GSSetting.h"
class GSShaderDlg : public GSDialog
{
int m_saturation;
int m_brightness;
int m_contrast;
void UpdateControls();
protected:
void OnInit();
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GSShaderDlg();
};
class GSHacksDlg : public GSDialog
{
int m_old_skipdraw_offset;
int m_old_skipdraw;
void UpdateControls();
protected:
void OnInit();
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GSHacksDlg();
};
class GSOSDDlg : public GSDialog
{
struct
{
int r;
int g;
int b;
int a;
} m_color;
void UpdateControls();
protected:
void OnInit();
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GSOSDDlg();
};
class GSSettingsDlg : public GSDialog
{
struct Adapter
{
std::string name;
std::string id;
D3D_FEATURE_LEVEL level;
Adapter(const std::string& n, const std::string& i, const D3D_FEATURE_LEVEL& l)
: name(n)
, id(i)
, level(l)
{
}
};
std::vector<GSSetting> m_renderers;
std::vector<Adapter> m_d3d11_adapters;
std::vector<Adapter>* m_current_adapters;
std::string m_last_selected_adapter_id;
std::vector<Adapter> EnumerateD3D11Adapters();
void UpdateAdapters();
void UpdateControls();
protected:
void OnInit();
bool OnCommand(HWND hWnd, UINT id, UINT code);
public:
GSSettingsDlg();
};

View File

@ -16,6 +16,10 @@
#include "PrecompiledHeader.h"
#include "GSwxDialog.h"
#ifdef _WIN32
#include "GS/Renderers/DX11/D3D.h"
#endif
using namespace GSSettingsDialog;
namespace
@ -37,10 +41,8 @@ namespace
}
}
size_t get_config_index(const std::vector<GSSetting>& s, const char* str)
size_t get_config_index(const std::vector<GSSetting>& s, int value)
{
int value = theApp.GetConfigI(str);
for (size_t i = 0; i < s.size(); i++)
{
if (s[i].value == value)
@ -151,7 +153,7 @@ void GSUIElementHolder::Load()
case UIElem::Type::Choice:
{
GSwxChoice* choice = static_cast<GSwxChoice*>(elem.control);
choice->SetSelection(get_config_index(choice->settings, elem.config));
choice->SetSelection(get_config_index(choice->settings, theApp.GetConfigI(elem.config)));
break;
}
case UIElem::Type::Spin:
@ -554,14 +556,12 @@ Dialog::Dialog()
auto* top_grid = new wxFlexGridSizer(2, 5, 5);
top_grid->SetFlexibleDirection(wxHORIZONTAL);
m_ui.addComboBoxAndLabel(top_grid, "Renderer:", "Renderer", &theApp.m_gs_renderers);
m_renderer_select = m_ui.addComboBoxAndLabel(top_grid, "Renderer:", "Renderer", &theApp.m_gs_renderers);
m_renderer_select->Bind(wxEVT_CHOICE, &Dialog::OnRendererChange, this);
#ifdef _WIN32
add_label(this, top_grid, "Adapter:");
wxArrayString m_adapter_str;
//add_settings_to_array_string(theApp.m_gs_renderers, m_adapter_str);
m_adapter_str.Add("Default");
m_adapter_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_adapter_str);
m_adapter_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, {});
top_grid->Add(m_adapter_select, wxSizerFlags().Expand());
#endif
@ -604,13 +604,69 @@ void Dialog::CallUpdate(wxCommandEvent&)
Update();
}
void Dialog::OnRendererChange(wxCommandEvent&)
{
PopulateAdapterList();
}
GSRendererType Dialog::GetSelectedRendererType()
{
int index = m_renderer_select->GetSelection();
// there is no currently selected renderer or the combo box has more entries than the renderer list or the current selection is negative
// make sure you haven't made a mistake initializing everything
ASSERT(index < theApp.m_gs_renderers.size() || index >= 0);
const GSRendererType type = static_cast<GSRendererType>(
theApp.m_gs_renderers[index].value
);
return type;
}
void Dialog::PopulateAdapterList()
{
#ifdef _WIN32
m_adapter_select->Clear();
if (GetSelectedRendererType() == GSRendererType::DX1011_HW)
{
auto factory = D3D::CreateFactory(false);
auto adapter_list = D3D::GetAdapterList(factory.get());
wxArrayString adapter_arr_string;
for (const auto name : adapter_list)
{
adapter_arr_string.push_back(
convert_utf8_to_utf16(name)
);
}
m_adapter_select->Insert(adapter_arr_string, 0);
m_adapter_select->Enable();
m_adapter_select->SetSelection(
theApp.GetConfigI("adapter_index")
);
}
else
{
m_adapter_select->Disable();
}
#endif
}
void Dialog::Load()
{
m_ui.Load();
#ifdef _WIN32
m_adapter_select->SetSelection(0);
GSRendererType renderer = GSRendererType(theApp.GetConfigI("Renderer"));
if (renderer == GSRendererType::Undefined)
renderer = D3D::ShouldPreferD3D() ? GSRendererType::DX1011_HW : GSRendererType::OGL_HW;
m_renderer_select->SetSelection(get_config_index(theApp.m_gs_renderers, static_cast<int>(renderer)));
#endif
PopulateAdapterList();
m_hacks_panel->Load();
m_renderer_panel->Load();
m_rec_panel->Load();
@ -622,6 +678,17 @@ void Dialog::Load()
void Dialog::Save()
{
m_ui.Save();
#ifdef _WIN32
// only save the adapter when it makes sense to
// prevents changing the adapter, switching to another renderer and saving
if (GetSelectedRendererType() == GSRendererType::DX1011_HW)
{
const int current_adapter =
m_adapter_select->GetSelection();
theApp.SetConfig("adapter_index", current_adapter);
}
#endif
m_hacks_panel->Save();
m_renderer_panel->Save();
@ -634,7 +701,6 @@ void Dialog::Save()
void Dialog::Update()
{
m_ui.Update();
m_adapter_select->Disable();
m_hacks_panel->Update();
m_renderer_panel->Update();

View File

@ -172,7 +172,9 @@ namespace GSSettingsDialog
GSUIElementHolder m_ui;
wxBoxSizer* m_top_box;
wxChoice* m_renderer_select;
wxChoice* m_adapter_select;
wxArrayString m_adapter_arr_string;
RendererTab* m_renderer_panel;
HacksTab* m_hacks_panel;
DebugTab* m_debug_panel;
@ -187,6 +189,9 @@ namespace GSSettingsDialog
void Save();
void Update();
void CallUpdate(wxCommandEvent& event);
void OnRendererChange(wxCommandEvent& event);
void PopulateAdapterList();
GSRendererType GetSelectedRendererType();
};
} // namespace GSSettingsDialog

View File

@ -4,49 +4,6 @@
// Microsoft Visual C++ generated include file.
// Used by GS.rc
//
// General Dialog:
#define IDD_CONFIG 2001
#define IDB_NULL 2002
#define IDB_LOGO11 2003
#define IDB_LOGOGL 2004
#define IDC_NULL 2005
#define IDC_LOGO11 2006
#define IDC_LOGOGL 2007
#define IDC_ADAPTER_TEXT 2008
#define IDC_ADAPTER 2009
#define IDC_RENDERER 2010
#define IDC_FILTER_TEXT 2011
#define IDC_FILTER 2012
#define IDC_INTERLACE_TEXT 2013
#define IDC_INTERLACE 2014
#define IDC_HACKSBUTTON 2015
#define IDC_OSDBUTTON 2016
#define IDC_SHADEBUTTON 2017
// Hardware Renderer Settings:
#define IDC_PALTEX 2030
#define IDC_CONSERVATIVE_FB 2031
#define IDC_UPSCALE_MULTIPLIER 2032
#define IDC_UPSCALE_MULTIPLIER_TEXT 2033
#define IDC_AFCOMBO_TEXT 2034
#define IDC_AFCOMBO 2035
#define IDC_MIPMAP_HW 2036
#define IDC_MIPMAP_HW_TEXT 2037
#define IDC_CRC_LEVEL 2038
#define IDC_CRC_LEVEL_TEXT 2039
#define IDC_HACKS_ENABLED 2040
#define IDC_ACCURATE_DATE 2041
#define IDC_ACCURATE_BLEND_UNIT 2042
#define IDC_ACCURATE_BLEND_UNIT_D3D11 2043
#define IDC_ACCURATE_BLEND_UNIT_TEXT 2044
#define IDC_DITHERING 2045
#define IDC_DITHERING_TEXT 2046
// Software Renderer Settings:
#define IDC_MIPMAP_SW 2060
#define IDC_AA1 2061
#define IDC_SWTHREADS_TEXT 2062
#define IDC_SWTHREADS 2063
#define IDC_SWTHREADS_EDIT 2064
#define IDC_AUTO_FLUSH_SW 2065
// Capture:
#define IDD_CAPTURE 2090
#define IDC_FILENAME 2091
@ -56,89 +13,7 @@
#define IDC_HEIGHT 2095
#define IDC_CONFIGURE 2096
#define IDC_COLORSPACE 2097
// Hardware Hacks:
#define IDC_WILDHACK 2100
#define IDC_OFFSETHACK 2101
#define IDC_OFFSETHACK_TEXT 2102
#define IDC_TCOFFSETX 2103
#define IDC_TCOFFSETX2 2104
#define IDC_TCOFFSETX_TEXT 2105
#define IDC_TCOFFSETY 2106
#define IDC_TCOFFSETY2 2107
#define IDC_TCOFFSETY_TEXT 2108
#define IDC_TCOFFSET_TEXT 2109
#define IDC_ROUND_SPRITE 2110
#define IDC_ROUND_SPRITE_TEXT 2111
#define IDC_ALIGN_SPRITE 2112
#define IDC_TC_DEPTH 2113
#define IDC_PRELOAD_GS 2114
#define IDC_FAST_TC_INV 2115
#define IDC_AUTO_FLUSH_HW 2116
#define IDC_MEMORY_WRAPPING 2117
#define IDC_TRI_FILTER 2118
#define IDC_TRI_FILTER_TEXT 2119
#define IDC_SAFE_FEATURES 2120
#define IDC_MERGE_PP_SPRITE 2121
#define IDC_CPU_FB_CONVERSION 2122
#define IDC_SKIPDRAWHACK 2123
#define IDC_SKIPDRAWHACK_TEXT 2124
#define IDC_SKIPDRAWHACKEDIT 2125
#define IDC_SKIPDRAWOFFSET 2126
#define IDC_SKIPDRAWOFFSETEDIT 2127
#define IDC_HALF_SCREEN_TS 2128
#define IDC_HALF_SCREEN_TS_TEXT 2129
// Shader:
#define IDC_SHADEBOOST 2140
#define IDC_FXAA 2141
#define IDC_SATURATION_SLIDER 2142
#define IDC_BRIGHTNESS_SLIDER 2143
#define IDC_CONTRAST_SLIDER 2144
#define IDC_SATURATION_TEXT 2145
#define IDC_BRIGHTNESS_TEXT 2146
#define IDC_CONTRAST_TEXT 2147
#define IDC_SATURATION_VALUE 2148
#define IDC_CONTRAST_VALUE 2149
#define IDC_BRIGHTNESS_VALUE 2150
#define IDC_SHADER_FX 2151
#define IDC_SHADER_FX_EDIT 2152
#define IDC_SHADER_FX_CONF_EDIT 2153
#define IDC_SHADER_FX_BUTTON 2154
#define IDC_SHADER_FX_CONF_BUTTON 2155
#define IDC_SHADER_FX_TEXT 2156
#define IDC_SHADER_FX_CONF_TEXT 2157
#define IDC_TVSHADER 2158
#define IDC_LINEAR_PRESENT 2159
// OSD:
#define IDC_OSD_LOG 2170
#define IDC_OSD_MONITOR 2171
#define IDC_OSD_COLOR_RED_SLIDER 2172
#define IDC_OSD_COLOR_RED_TEXT 2173
#define IDC_OSD_COLOR_RED_AMOUNT 2174
#define IDC_OSD_COLOR_BLUE_SLIDER 2175
#define IDC_OSD_COLOR_BLUE_TEXT 2176
#define IDC_OSD_COLOR_BLUE_AMOUNT 2177
#define IDC_OSD_COLOR_GREEN_SLIDER 2178
#define IDC_OSD_COLOR_GREEN_TEXT 2179
#define IDC_OSD_COLOR_GREEN_AMOUNT 2180
#define IDC_OSD_TIMEOUT 2181
#define IDC_OSD_TIMEOUT_EDIT 2182
#define IDC_OSD_TIMEOUT_TEXT 2183
#define IDC_OSD_SIZE 2184
#define IDC_OSD_SIZE_EDIT 2185
#define IDC_OSD_OPACITY_SLIDER 2186
#define IDC_OSD_OPACITY_AMOUNT 2187
#define IDC_OSD_MAX_LOG 2188
#define IDC_OSD_MAX_LOG_EDIT 2189
#define IDC_OSD_MAX_LOG_TEXT 2190
#define IDC_OSD_SIZE_TEXT 2191
#define IDC_OSD_OPACITY_TEXT 2192
// OpenGL Advanced Settings:
#define IDC_GEOMETRY_SHADER_OVERRIDE 2200
#define IDC_GEOMETRY_SHADER_TEXT 2201
#define IDC_IMAGE_LOAD_STORE 2202
#define IDC_IMAGE_LOAD_STORE_TEXT 2203
#define IDC_SPARSE_TEXTURE 2204
#define IDC_SPARSE_TEXTURE_TEXT 2205
#define IDR_CONVERT_FX 10000
#define IDR_TFX_FX 10001
#define IDR_MERGE_FX 10002
@ -165,7 +40,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 10019
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2194
#define _APS_NEXT_CONTROL_VALUE 2098
#define _APS_NEXT_SYMED_VALUE 5000
#endif
#endif

View File

@ -305,6 +305,7 @@
<ClCompile Include="Gif_Logger.cpp" />
<ClCompile Include="Gif_Unit.cpp" />
<ClCompile Include="GS\Renderers\DX11\D3D.cpp" />
<ClCompile Include="GS\Window\GSwxDialog.cpp" />
<ClCompile Include="gui\AppGameDatabase.cpp" />
<ClCompile Include="gui\AppUserMode.cpp" />
<ClCompile Include="gui\CheckedStaticBox.cpp" />
@ -487,7 +488,6 @@
<ClCompile Include="GS\Renderers\OpenGL\GSRendererOGL.cpp" />
<ClCompile Include="GS\Renderers\SW\GSRendererSW.cpp" />
<ClCompile Include="GS\Window\GSSetting.cpp" />
<ClCompile Include="GS\Window\GSSettingsDlg.cpp" />
<ClCompile Include="GS\Renderers\SW\GSSetupPrimCodeGenerator.cpp" />
<ClCompile Include="GS\Renderers\SW\GSSetupPrimCodeGenerator.all.cpp" />
<ClCompile Include="GS\Renderers\OpenGL\GSShaderOGL.cpp" />
@ -744,6 +744,7 @@
<ClInclude Include="GameDatabase.h" />
<ClInclude Include="Gif_Unit.h" />
<ClInclude Include="GS\Renderers\DX11\D3D.h" />
<ClInclude Include="GS\Window\GSwxDialog.h" />
<ClInclude Include="gui\AppGameDatabase.h" />
<ClInclude Include="gui\CheckedStaticBox.h" />
<ClInclude Include="gui\i18n.h" />
@ -848,7 +849,6 @@
<ClInclude Include="GS\Renderers\SW\GSRendererSW.h" />
<ClInclude Include="GS\Renderers\SW\GSScanlineEnvironment.h" />
<ClInclude Include="GS\Window\GSSetting.h" />
<ClInclude Include="GS\Window\GSSettingsDlg.h" />
<ClInclude Include="GS\Renderers\SW\GSSetupPrimCodeGenerator.h" />
<ClInclude Include="GS\Renderers\SW\GSSetupPrimCodeGenerator.all.h" />
<ClInclude Include="GS\Renderers\OpenGL\GSShaderOGL.h" />

View File

@ -1598,7 +1598,7 @@
<ClCompile Include="GS\Window\GSSetting.cpp">
<Filter>System\Ps2\GS\Window</Filter>
</ClCompile>
<ClCompile Include="GS\Window\GSSettingsDlg.cpp">
<ClCompile Include="GS\Window\GSwxDialog.cpp">
<Filter>System\Ps2\GS\Window</Filter>
</ClCompile>
<ClCompile Include="GS\Renderers\DX11\D3D.cpp">
@ -2556,9 +2556,6 @@
<ClInclude Include="GS\Renderers\Common\GSFastList.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\resource.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS.h">
<Filter>System\Ps2</Filter>
</ClInclude>
@ -2697,7 +2694,10 @@
<ClInclude Include="GS\Window\GSSetting.h">
<Filter>System\Ps2\GS\Window</Filter>
</ClInclude>
<ClInclude Include="GS\Window\GSSettingsDlg.h">
<ClInclude Include="GS\resource.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\Window\GSwxDialog.h">
<Filter>System\Ps2\GS\Window</Filter>
</ClInclude>
<ClInclude Include="GS\Renderers\DX11\D3D.h">