From a9c18c57e40416374c75b3738ab103af5bbdbe16 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 24 May 2016 21:52:06 +0200 Subject: [PATCH] gsdx option: use the new GetConfig* function v2: add PSX stuff ssakash review --- plugins/GSdx/GLLoader.cpp | 8 +-- plugins/GSdx/GS.cpp | 32 +++++----- plugins/GSdx/GS.h | 3 - plugins/GSdx/GSCapture.cpp | 10 ++-- plugins/GSdx/GSCaptureDlg.cpp | 8 +-- plugins/GSdx/GSCrc.cpp | 2 +- plugins/GSdx/GSDevice11.cpp | 34 +++++------ plugins/GSdx/GSDevice9.cpp | 40 ++++++------- plugins/GSdx/GSDeviceDX.cpp | 2 +- plugins/GSdx/GSDeviceOGL.cpp | 20 +++---- plugins/GSdx/GSHwHack.cpp | 2 +- plugins/GSdx/GSLinuxDialog.cpp | 74 +++++++++++------------ plugins/GSdx/GSRenderer.cpp | 18 +++--- plugins/GSdx/GSRendererCL.cpp | 2 +- plugins/GSdx/GSRendererCS.cpp | 2 +- plugins/GSdx/GSRendererDX.cpp | 16 +++-- plugins/GSdx/GSRendererHW.cpp | 28 +++++---- plugins/GSdx/GSRendererOGL.cpp | 12 ++-- plugins/GSdx/GSSettingsDlg.cpp | 92 ++++++++++++++--------------- plugins/GSdx/GSState.cpp | 26 ++++---- plugins/GSdx/GSTexture11.cpp | 2 +- plugins/GSdx/GSTexture9.cpp | 2 +- plugins/GSdx/GSTextureCache.cpp | 18 +++--- plugins/GSdx/GSTextureFX11.cpp | 8 +-- plugins/GSdx/GSTextureFX9.cpp | 6 +- plugins/GSdx/GSTextureOGL.cpp | 2 +- plugins/GSdx/GSTextureSW.cpp | 2 +- plugins/GSdx/GSWndEGL.cpp | 4 +- plugins/GSdx/GSWndOGL.cpp | 4 +- plugins/GSdx/GSdx.cpp | 10 ---- plugins/GSdx/GSdx.h | 2 - plugins/GSdx/PSX/GPU.cpp | 4 +- plugins/GSdx/PSX/GPULocalMemory.cpp | 4 +- plugins/GSdx/PSX/GPURenderer.cpp | 16 ++--- plugins/GSdx/PSX/GPUSettingsDlg.cpp | 20 +++---- 35 files changed, 266 insertions(+), 269 deletions(-) diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index ac5437897f..159e989772 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -223,8 +223,8 @@ namespace GLLoader { std::string opt("override_"); opt += name; - if (theApp.GetConfig(opt.c_str(), -1) != -1) { - found = !!theApp.GetConfig(opt.c_str(), -1); + if (theApp.GetConfigI(opt.c_str()) != -1) { + found = theApp.GetConfigB(opt.c_str()); fprintf(stderr, "Override %s detection (%s)\n", name.c_str(), found ? "Enabled" : "Disabled"); } @@ -256,8 +256,8 @@ namespace GLLoader { if (strstr(vendor, "VMware")) // Assume worst case because I don't know the real status mesa_amd_buggy_driver = intel_buggy_driver = true; - if (theApp.GetConfig("override_geometry_shader", -1) != -1) { - found_geometry_shader = !!theApp.GetConfig("override_geometry_shader", -1); + if (theApp.GetConfigI("override_geometry_shader") != -1) { + found_geometry_shader = theApp.GetConfigB("override_geometry_shader"); fprintf(stderr, "Overriding geometry shaders detection\n"); } diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 3b3ab17034..d7e68f7a3c 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -186,12 +186,12 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t if(renderer == GSRendererType::Undefined) { - renderer = static_cast(theApp.GetConfig("Renderer", static_cast(GSRendererType::Default))); + renderer = static_cast(theApp.GetConfigI("Renderer")); } if(threads == -1) { - threads = theApp.GetConfig("extrathreads", DEFAULT_EXTRA_RENDERING_THREADS); + threads = theApp.GetConfigI("extrathreads"); } GSWnd* wnd[2] = { NULL, NULL }; @@ -362,8 +362,8 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t { // old-style API expects us to create and manage our own window: - int w = theApp.GetConfig("ModeWidth", 0); - int h = theApp.GetConfig("ModeHeight", 0); + int w = theApp.GetConfigI("ModeWidth"); + int h = theApp.GetConfigI("ModeHeight"); #if defined(__unix__) for(uint32 i = 0; i < 2; i++) { @@ -465,7 +465,7 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t return -1; } - if (renderer == GSRendererType::OGL_HW && theApp.GetConfig("debug_glsl_shader", 0) == 2) { + if (renderer == GSRendererType::OGL_HW && theApp.GetConfigI("debug_glsl_shader") == 2) { printf("GSdx: test OpenGL shader. Please wait...\n\n"); static_cast(s_gs->m_dev)->SelfShaderTest(); printf("\nGSdx: test OpenGL shader done. It will now exit\n"); @@ -489,7 +489,7 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags) #else GSRendererType default_renderer = GSRendererType::Default; #endif - renderer = static_cast(theApp.GetConfig("Renderer", static_cast(default_renderer))); + renderer = static_cast(theApp.GetConfigI("Renderer")); } else if (stored_toggle_state != toggle_state) { @@ -545,7 +545,7 @@ EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt) // Legacy GUI expects to acquire vsync from the configuration files. - s_vsync = !!theApp.GetConfig("vsync", 0); + s_vsync = !!theApp.GetConfigI("vsync"); if(mt == 2) { @@ -563,7 +563,7 @@ EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt) { // normal init - renderer = static_cast(theApp.GetConfig("Renderer", static_cast(GSRendererType::Default))); + renderer = static_cast(theApp.GetConfigI("Renderer")); } *dsp = NULL; @@ -883,7 +883,7 @@ EXPORT_C_(int) GSsetupRecording(int start, void* data) return 0; } #if defined(__unix__) - if (!theApp.GetConfig("capture_enabled", 0)) { + if (!theApp.GetConfigB("capture_enabled")) { printf("GSdx: Recording is disabled\n"); return 0; } @@ -1072,7 +1072,7 @@ EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) uint8 regs[0x2000]; GSsetBaseMem(regs); - s_vsync = !!theApp.GetConfig("vsync", 0); + s_vsync = theApp.GetConfigB("vsync"); HWND hWnd = NULL; @@ -1515,7 +1515,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) GSRendererType m_renderer; // Allow to easyly switch between SW/HW renderer -> this effectively removes the ability to select the renderer by function args - m_renderer = static_cast(theApp.GetConfig("Renderer", static_cast(GSRendererType::Default))); + m_renderer = static_cast(theApp.GetConfigI("Renderer")); // alternatively: // m_renderer = static_cast(renderer); @@ -1537,7 +1537,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) GSsetBaseMem(regs); - s_vsync = !!theApp.GetConfig("vsync", 0); + s_vsync = theApp.GetConfigB("vsync"); void* hWnd = NULL; @@ -1635,8 +1635,8 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) //while(IsWindowVisible(hWnd)) //FIXME map? - int finished = theApp.GetConfig("linux_replay", 1); - if (theApp.GetConfig("dump", 0)) { + int finished = theApp.GetConfigI("linux_replay"); + if (theApp.GetConfigI("dump")) { fprintf(stderr, "Dump is enabled. Replay will be disabled\n"); finished = 1; } @@ -1706,11 +1706,11 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) } } - if (theApp.GetConfig("linux_replay", 1) > 1) { + if (theApp.GetConfigI("linux_replay") > 1) { // Print some nice stats // Skip first frame (shader compilation populate the result) // it divides by 10 the standard deviation... - float n = (float)theApp.GetConfig("linux_replay", 1) - 1.0f; + float n = (float)theApp.GetConfigI("linux_replay") - 1.0f; float mean = 0; float sd = 0; for (auto i = stats.begin()+1; i != stats.end(); i++) { diff --git a/plugins/GSdx/GS.h b/plugins/GSdx/GS.h index 6ccd371d13..cb3c47d74d 100644 --- a/plugins/GSdx/GS.h +++ b/plugins/GSdx/GS.h @@ -1272,9 +1272,6 @@ struct GSFreezeData {int size; uint8* data;}; enum stateType {ST_WRITE, ST_TRANSFER, ST_VSYNC}; -// default gs config settings -#define DEFAULT_EXTRA_RENDERING_THREADS 2 - enum class GSVideoMode : uint8 { Unknown, diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index 0c564edc51..c219fdad6e 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -380,10 +380,10 @@ GSCapture::GSCapture() : m_capturing(false), m_frame(0) , m_out_dir("/tmp/GSdx_Capture") // FIXME Later add an option { - m_out_dir = theApp.GetConfig("capture_out_dir", "/tmp/GSdx_Capture"); - m_threads = theApp.GetConfig("capture_threads", 4); + m_out_dir = theApp.GetConfigS("capture_out_dir"); + m_threads = theApp.GetConfigI("capture_threads"); #if defined(__unix__) - m_compression_level = theApp.GetConfig("png_compression_level", Z_BEST_SPEED); + m_compression_level = theApp.GetConfigI("png_compression_level"); #endif } @@ -488,8 +488,8 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recomendedResolution, float a // Really cheap recording m_frame = 0; // Add option !!! - m_size.x = theApp.GetConfig("capture_resx", 1280); - m_size.y = theApp.GetConfig("capture_resy", 1024); + m_size.x = theApp.GetConfigI("capture_resx"); + m_size.y = theApp.GetConfigI("capture_resy"); for(int i = 0; i < m_threads; i++) { m_workers.push_back(new GSPng::Worker()); diff --git a/plugins/GSdx/GSCaptureDlg.cpp b/plugins/GSdx/GSCaptureDlg.cpp index 7c34743f6f..d993d5dc9b 100644 --- a/plugins/GSdx/GSCaptureDlg.cpp +++ b/plugins/GSdx/GSCaptureDlg.cpp @@ -26,9 +26,9 @@ GSCaptureDlg::GSCaptureDlg() : GSDialog(IDD_CAPTURE) { - m_width = theApp.GetConfig("CaptureWidth", 640); - m_height = theApp.GetConfig("CaptureHeight", 480); - m_filename = theApp.GetConfig("CaptureFileName", ""); + m_width = theApp.GetConfigI("CaptureWidth"); + m_height = theApp.GetConfigI("CaptureHeight"); + m_filename = theApp.GetConfigS("CaptureFileName"); } int GSCaptureDlg::GetSelCodec(Codec& c) @@ -64,7 +64,7 @@ void GSCaptureDlg::OnInit() m_codecs.clear(); - _bstr_t selected = theApp.GetConfig("CaptureVideoCodecDisplayName", "").c_str(); + _bstr_t selected = theApp.GetConfigS("CaptureVideoCodecDisplayName").c_str(); ComboBoxAppend(IDC_CODECS, "Uncompressed", 0, true); diff --git a/plugins/GSdx/GSCrc.cpp b/plugins/GSdx/GSCrc.cpp index 9f5a73d5fc..e3e4ce09bb 100644 --- a/plugins/GSdx/GSCrc.cpp +++ b/plugins/GSdx/GSCrc.cpp @@ -538,7 +538,7 @@ CRC::Game CRC::Lookup(uint32 crc) printf("GSdx Lookup CRC:%X\n", crc); if(m_map.empty()) { - string exclusions = theApp.GetConfig( "CrcHacksExclusions", "" ); + string exclusions = theApp.GetConfigS("CrcHacksExclusions"); if (exclusions.length() != 0) printf( "GSdx: CrcHacksExclusions: %s\n", exclusions.c_str() ); diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index 073c4a8322..5b537fc3a5 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -62,7 +62,7 @@ bool GSDevice11::Create(GSWnd* wnd) CComPtr adapter; D3D_DRIVER_TYPE driver_type = D3D_DRIVER_TYPE_HARDWARE; - std::string adapter_id = theApp.GetConfig("Adapter", "default"); + std::string adapter_id = theApp.GetConfigS("Adapter"); if (adapter_id == "default") ; @@ -110,7 +110,7 @@ bool GSDevice11::Create(GSWnd* wnd) scd.Windowed = TRUE; - spritehack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SpriteHack", 0) : 0; + spritehack = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_SpriteHack") : 0; // NOTE : D3D11_CREATE_DEVICE_SINGLETHREADED // This flag is safe as long as the DXGI's internal message pump is disabled or is on the // same thread as the GS window (which the emulator makes sure of, if it utilizes a @@ -240,20 +240,20 @@ bool GSDevice11::Create(GSWnd* wnd) CompileShader((const char *)shader.data(), shader.size(), "interlace.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_interlace.ps[i]); } - // Shade Boost + // Shade Boos + + int ShadeBoost_Contrast = theApp.GetConfigI("ShadeBoost_Contrast"); + int ShadeBoost_Brightness = theApp.GetConfigI("ShadeBoost_Brightness"); + int ShadeBoost_Saturation = theApp.GetConfigI("ShadeBoost_Saturation"); + + string str[3]; - int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50); - int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50); - int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50); - - string str[3]; - str[0] = format("%d", ShadeBoost_Saturation); str[1] = format("%d", ShadeBoost_Brightness); str[2] = format("%d", ShadeBoost_Contrast); D3D_SHADER_MACRO macro[] = - { + { {"SB_SATURATION", str[0].c_str()}, {"SB_BRIGHTNESS", str[1].c_str()}, {"SB_CONTRAST", str[2].c_str()}, @@ -314,18 +314,18 @@ bool GSDevice11::Create(GSWnd* wnd) memset(&sd, 0, sizeof(sd)); - sd.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR; + sd.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR; sd.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MinLOD = -FLT_MAX; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); sd.ComparisonFunc = D3D11_COMPARISON_NEVER; hr = m_dev->CreateSamplerState(&sd, &m_convert.ln); - sd.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; + sd.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; hr = m_dev->CreateSamplerState(&sd, &m_convert.pt); @@ -367,7 +367,7 @@ bool GSDevice11::Create(GSWnd* wnd) if(m_wnd->IsManaged()) { - SetExclusive(!theApp.GetConfig("windowed", 1)); + SetExclusive(!theApp.GetConfigB("windowed")); } return true; @@ -758,7 +758,7 @@ void GSDevice11::InitExternalFX() if (!ExShader_Compiled) { try { - std::string config_name(theApp.GetConfig("shaderfx_conf", "shaders/GSdx_FX_Settings.ini")); + std::string config_name(theApp.GetConfigS("shaderfx_conf")); std::ifstream fconfig(config_name); std::stringstream shader; if (fconfig.good()) @@ -766,7 +766,7 @@ void GSDevice11::InitExternalFX() else fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str()); - std::string shader_name(theApp.GetConfig("shaderfx_glsl", "shaders/GSdx.fx")); + std::string shader_name(theApp.GetConfigS("shaderfx_glsl")); std::ifstream fshader(shader_name); if (fshader.good()) { @@ -1265,7 +1265,7 @@ void GSDevice11::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector GSVector2i size = rt ? rt->GetSize() : ds->GetSize(); if(m_state.viewport != size) { - bool isNative = theApp.GetConfig("upscale_multiplier", 1) == 1; + bool isNative = theApp.GetConfigI("upscale_multiplier") == 1; m_state.viewport = size; D3D11_VIEWPORT vp; diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 13f52b052c..93e9aa77e8 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -57,7 +57,7 @@ static void FindAdapter(IDirect3D9 *d3d9, UINT &adapter, D3DDEVTYPE &devtype, st devtype = D3DDEVTYPE_HAL; if (!adapter_id.length()) - adapter_id = theApp.GetConfig("Adapter", "default"); + adapter_id = theApp.GetConfigS("Adapter"); if (adapter_id == "default") ; @@ -178,7 +178,7 @@ uint32 GSDevice9::GetMaxDepth(uint32 msaa, std::string adapter_id) void GSDevice9::ForceValidMsaaConfig() { - if(0 == GetMaxDepth(theApp.GetConfig("UserHacks_MSAA", 0))) + if(0 == GetMaxDepth(theApp.GetConfigI("UserHacks_MSAA"))) { theApp.SetConfig("UserHacks_MSAA", 0); // replace invalid msaa value in ini file with 0. } @@ -304,8 +304,8 @@ bool GSDevice9::Create(GSWnd* wnd) m_convert.bs.BlendEnable = false; m_convert.bs.RenderTargetWriteMask = D3DCOLORWRITEENABLE_RGBA; - D3DTEXTUREFILTERTYPE LinearToAnisotropic = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; - D3DTEXTUREFILTERTYPE PointToAnisotropic = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; + D3DTEXTUREFILTERTYPE LinearToAnisotropic = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; + D3DTEXTUREFILTERTYPE PointToAnisotropic = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; m_convert.ln.FilterMin[0] = LinearToAnisotropic; m_convert.ln.FilterMag[0] = LinearToAnisotropic; @@ -313,7 +313,7 @@ bool GSDevice9::Create(GSWnd* wnd) m_convert.ln.FilterMag[1] = LinearToAnisotropic; m_convert.ln.AddressU = D3DTADDRESS_CLAMP; m_convert.ln.AddressV = D3DTADDRESS_CLAMP; - m_convert.ln.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + m_convert.ln.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); m_convert.pt.FilterMin[0] = PointToAnisotropic; m_convert.pt.FilterMag[0] = PointToAnisotropic; @@ -321,7 +321,7 @@ bool GSDevice9::Create(GSWnd* wnd) m_convert.pt.FilterMag[1] = PointToAnisotropic; m_convert.pt.AddressU = D3DTADDRESS_CLAMP; m_convert.pt.AddressV = D3DTADDRESS_CLAMP; - m_convert.pt.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + m_convert.pt.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); // merge @@ -348,20 +348,20 @@ bool GSDevice9::Create(GSWnd* wnd) CompileShader((const char *)shader.data(), shader.size(), "interlace.fx", format("ps_main%d", i), nullptr, &m_interlace.ps[i]); } - // Shade Boost + // Shade Boost + + int ShadeBoost_Contrast = theApp.GetConfigI("ShadeBoost_Contrast"); + int ShadeBoost_Brightness = theApp.GetConfigI("ShadeBoost_Brightness"); + int ShadeBoost_Saturation = theApp.GetConfigI("ShadeBoost_Saturation"); + + string str[3]; - int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50); - int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50); - int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50); - - string str[3]; - str[0] = format("%d", ShadeBoost_Saturation); str[1] = format("%d", ShadeBoost_Brightness); str[2] = format("%d", ShadeBoost_Contrast); D3D_SHADER_MACRO macro[] = - { + { {"SB_SATURATION", str[0].c_str()}, {"SB_BRIGHTNESS", str[1].c_str()}, {"SB_CONTRAST", str[2].c_str()}, @@ -403,7 +403,7 @@ bool GSDevice9::Reset(int w, int h) HRESULT hr; - int mode = (!m_wnd->IsManaged() || theApp.GetConfig("windowed", 1)) ? Windowed : Fullscreen; + int mode = (!m_wnd->IsManaged() || theApp.GetConfigB("windowed")) ? Windowed : Fullscreen; if(mode == DontCare) { @@ -461,9 +461,9 @@ bool GSDevice9::Reset(int w, int h) // m_pp.Flags |= D3DPRESENTFLAG_VIDEO; // enables tv-out (but I don't think anyone would still use a regular tv...) - int mw = theApp.GetConfig("ModeWidth", 0); - int mh = theApp.GetConfig("ModeHeight", 0); - int mrr = theApp.GetConfig("ModeRefreshRate", 0); + int mw = theApp.GetConfigI("ModeWidth"); + int mh = theApp.GetConfigI("ModeHeight"); + int mrr = theApp.GetConfigI("ModeRefreshRate"); if(m_wnd->IsManaged() && mode == Fullscreen && mw > 0 && mh > 0 && mrr >= 0) { @@ -945,7 +945,7 @@ void GSDevice9::InitExternalFX() if (!ExShader_Compiled) { try { - std::string config_name(theApp.GetConfig("shaderfx_conf", "shaders/GSdx_FX_Settings.ini")); + std::string config_name(theApp.GetConfigS("shaderfx_conf")); std::ifstream fconfig(config_name); std::stringstream shader; if (fconfig.good()) @@ -953,7 +953,7 @@ void GSDevice9::InitExternalFX() else fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str()); - std::string shader_name(theApp.GetConfig("shaderfx_glsl", "shaders/GSdx.fx")); + std::string shader_name(theApp.GetConfigS("shaderfx_glsl")); std::ifstream fshader(shader_name); if (fshader.good()) { diff --git a/plugins/GSdx/GSDeviceDX.cpp b/plugins/GSdx/GSDeviceDX.cpp index 2844f37e40..2d8f15da20 100644 --- a/plugins/GSdx/GSDeviceDX.cpp +++ b/plugins/GSdx/GSDeviceDX.cpp @@ -30,7 +30,7 @@ bool GSDeviceDX::s_old_d3d_compiler_dll; GSDeviceDX::GSDeviceDX() { - m_msaa = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_MSAA", 0) : 0; + m_msaa = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_MSAA") : 0; m_msaa_desc.Count = 1; m_msaa_desc.Quality = 0; diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 9f58924040..60cf148be9 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -74,7 +74,7 @@ GSDeviceOGL::GSDeviceOGL() m_debug_gl_file = fopen("GSdx_opengl_debug.txt","w"); #endif - m_debug_gl_call = !!theApp.GetConfig("debug_opengl", 0); + m_debug_gl_call = theApp.GetConfigB("debug_opengl"); } GSDeviceOGL::~GSDeviceOGL() @@ -180,7 +180,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // Debug helper // **************************************************************** #ifdef ENABLE_OGL_DEBUG - if (theApp.GetConfig("debug_opengl", 0)) { + if (theApp.GetConfigB("debug_opengl")) { glDebugMessageCallback((GLDEBUGPROC)DebugOutputToFile, NULL); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); @@ -200,7 +200,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd) { GL_PUSH("GSDeviceOGL::Various"); - m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0)); + m_shader = new GSShaderOGL(theApp.GetConfigB("debug_glsl_shader")); glGenFramebuffers(1, &m_fbo); // Always write to the first buffer @@ -259,7 +259,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd) m_convert.cb = new GSUniformBufferOGL(g_convert_index, sizeof(ConvertConstantBuffer)); // Upload once and forget about it ConvertConstantBuffer cb; - cb.ScalingFactor = GSVector4i(theApp.GetConfig("upscale_multiplier", 1)); + cb.ScalingFactor = GSVector4i(theApp.GetConfigI("upscale_multiplier")); m_convert.cb->upload(&cb); vs = m_shader->Compile("convert.glsl", "vs_main", GL_VERTEX_SHADER, convert_glsl); @@ -317,9 +317,9 @@ bool GSDeviceOGL::Create(GSWnd* wnd) { GL_PUSH("GSDeviceOGL::Shadeboost"); - int ShadeBoost_Contrast = theApp.GetConfig("ShadeBoost_Contrast", 50); - int ShadeBoost_Brightness = theApp.GetConfig("ShadeBoost_Brightness", 50); - int ShadeBoost_Saturation = theApp.GetConfig("ShadeBoost_Saturation", 50); + int ShadeBoost_Contrast = theApp.GetConfigI("ShadeBoost_Contrast"); + int ShadeBoost_Brightness = theApp.GetConfigI("ShadeBoost_Brightness"); + int ShadeBoost_Saturation = theApp.GetConfigI("ShadeBoost_Saturation"); std::string shade_macro = format("#define SB_SATURATION %d.0\n", ShadeBoost_Saturation) + format("#define SB_BRIGHTNESS %d.0\n", ShadeBoost_Brightness) + format("#define SB_CONTRAST %d.0\n", ShadeBoost_Contrast); @@ -687,7 +687,7 @@ GLuint GSDeviceOGL::CreateSampler(bool bilinear, bool tau, bool tav, bool aniso) glSamplerParameterf(sampler, GL_TEXTURE_MIN_LOD, 0); glSamplerParameterf(sampler, GL_TEXTURE_MAX_LOD, 6); - int anisotropy = theApp.GetConfig("MaxAnisotropy", 0); + int anisotropy = theApp.GetConfigI("MaxAnisotropy"); if (GLLoader::found_GL_EXT_texture_filter_anisotropic && anisotropy && aniso) glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)anisotropy); @@ -1264,7 +1264,7 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex) return; } - std::string config_name(theApp.GetConfig("shaderfx_conf", "dummy.ini")); + std::string config_name(theApp.GetConfigS("shaderfx_conf")); std::ifstream fconfig(config_name); std::stringstream config; if (fconfig.good()) @@ -1272,7 +1272,7 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex) else fprintf(stderr, "Warning failed to load '%s'. External Shader might be wrongly configured\n", config_name.c_str()); - std::string shader_name(theApp.GetConfig("shaderfx_glsl", "dummy.glsl")); + std::string shader_name(theApp.GetConfigS("shaderfx_glsl")); std::ifstream fshader(shader_name); std::stringstream shader; if (!fshader.good()) { diff --git a/plugins/GSdx/GSHwHack.cpp b/plugins/GSdx/GSHwHack.cpp index 04c5129ce8..a3f1377ced 100644 --- a/plugins/GSdx/GSHwHack.cpp +++ b/plugins/GSdx/GSHwHack.cpp @@ -2435,7 +2435,7 @@ void GSState::SetupCrcHack() { GetSkipCount lut[CRC::TitleCount]; - s_crc_hack_level = theApp.GetConfig("crc_hack_level", 3); + s_crc_hack_level = theApp.GetConfigI("crc_hack_level"); memset(lut, 0, sizeof(lut)); diff --git a/plugins/GSdx/GSLinuxDialog.cpp b/plugins/GSdx/GSLinuxDialog.cpp index 9d07cd8d4f..78033a4027 100644 --- a/plugins/GSdx/GSLinuxDialog.cpp +++ b/plugins/GSdx/GSLinuxDialog.cpp @@ -59,10 +59,10 @@ void CB_ChangedComboBox(GtkComboBox *combo, gpointer user_data) } } -GtkWidget* CreateComboBoxFromVector(const vector& s, const char* opt_name, int32_t opt_default = 0) +GtkWidget* CreateComboBoxFromVector(const vector& s, const char* opt_name) { GtkWidget* combo_box = gtk_combo_box_text_new(); - int32_t opt_value = theApp.GetConfig(opt_name, opt_default); + int32_t opt_value = theApp.GetConfigI(opt_name); int opt_position = 0; for(size_t i = 0; i < s.size(); i++) @@ -102,10 +102,10 @@ void CB_EntryActived(GtkEntry *entry, gpointer user_data) theApp.SetConfig((char*)user_data, hex_value); } -GtkWidget* CreateTextBox(const char* opt_name, int opt_default = 0) { +GtkWidget* CreateTextBox(const char* opt_name) { GtkWidget* entry = gtk_entry_new(); - int hex_value = theApp.GetConfig(opt_name, opt_default); + int hex_value = theApp.GetConfigI(opt_name); gchar* data=(gchar *)g_malloc(sizeof(gchar)*40); sprintf(data,"%X", hex_value); @@ -124,11 +124,11 @@ void CB_ToggleCheckBox(GtkToggleButton *togglebutton, gpointer user_data) theApp.SetConfig((char*)user_data, (int)gtk_toggle_button_get_active(togglebutton)); } -GtkWidget* CreateCheckBox(const char* label, const char* opt_name, bool opt_default = false) +GtkWidget* CreateCheckBox(const char* label, const char* opt_name) { GtkWidget* check = gtk_check_button_new_with_label(label); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), theApp.GetConfig(opt_name, opt_default)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), theApp.GetConfigB(opt_name)); g_signal_connect(check, "toggled", G_CALLBACK(CB_ToggleCheckBox), const_cast(opt_name)); @@ -140,11 +140,11 @@ void CB_SpinButton(GtkSpinButton *spin, gpointer user_data) theApp.SetConfig((char*)user_data, (int)gtk_spin_button_get_value(spin)); } -GtkWidget* CreateSpinButton(double min, double max, const char* opt_name, int opt_default = 0) +GtkWidget* CreateSpinButton(double min, double max, const char* opt_name) { GtkWidget* spin = gtk_spin_button_new_with_range(min, max, 1); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), theApp.GetConfig(opt_name, opt_default)); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), theApp.GetConfigI(opt_name)); g_signal_connect(spin, "value-changed", G_CALLBACK(CB_SpinButton), const_cast(opt_name)); @@ -156,7 +156,7 @@ void CB_RangeChanged(GtkRange* range, gpointer user_data) theApp.SetConfig((char*)user_data, (int)gtk_range_get_value(range)); } -GtkWidget* CreateScale(const char* opt_name, int opt_default = 0) +GtkWidget* CreateScale(const char* opt_name) { #if GTK_MAJOR_VERSION < 3 GtkWidget* scale = gtk_hscale_new_with_range(0, 200, 10); @@ -165,7 +165,7 @@ GtkWidget* CreateScale(const char* opt_name, int opt_default = 0) #endif gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_RIGHT); - gtk_range_set_value(GTK_RANGE(scale), theApp.GetConfig(opt_name, opt_default)); + gtk_range_set_value(GTK_RANGE(scale), theApp.GetConfigI(opt_name)); g_signal_connect(scale, "value-changed", G_CALLBACK(CB_RangeChanged), const_cast(opt_name)); @@ -177,11 +177,11 @@ void CB_PickFile(GtkFileChooserButton *chooser, gpointer user_data) theApp.SetConfig((char*)user_data, gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser))); } -GtkWidget* CreateFileChooser(GtkFileChooserAction action, const char* label, const char* opt_name, const char* opt_default) +GtkWidget* CreateFileChooser(GtkFileChooserAction action, const char* label, const char* opt_name) { GtkWidget* chooser = gtk_file_chooser_button_new(label, action); - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser), theApp.GetConfig(opt_name, opt_default).c_str()); + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser), theApp.GetConfigS(opt_name).c_str()); g_signal_connect(chooser, "file-set", G_CALLBACK(CB_PickFile), const_cast(opt_name)); @@ -222,23 +222,23 @@ GtkWidget* CreateTableInBox(GtkWidget* parent_box, const char* frame_title, int void populate_hw_table(GtkWidget* hw_table) { GtkWidget* filter_label = left_label("Texture Filtering:"); - GtkWidget* filter_combo_box = CreateComboBoxFromVector(theApp.m_gs_filter, "filter", 2); + GtkWidget* filter_combo_box = CreateComboBoxFromVector(theApp.m_gs_filter, "filter"); GtkWidget* fsaa_label = left_label("Internal Resolution:"); - GtkWidget* fsaa_combo_box = CreateComboBoxFromVector(theApp.m_gs_upscale_multiplier, "upscale_multiplier", 1); + GtkWidget* fsaa_combo_box = CreateComboBoxFromVector(theApp.m_gs_upscale_multiplier, "upscale_multiplier"); GtkWidget* af_label = left_label("Anisotropic Filtering:"); - GtkWidget* af_combo_box = CreateComboBoxFromVector(theApp.m_gs_max_anisotropy, "MaxAnisotropy", 0); + GtkWidget* af_combo_box = CreateComboBoxFromVector(theApp.m_gs_max_anisotropy, "MaxAnisotropy"); GtkWidget* crc_label = left_label("Automatic CRC level:"); - GtkWidget* crc_combo_box = CreateComboBoxFromVector(theApp.m_gs_crc_level, "crc_hack_level", 3); + GtkWidget* crc_combo_box = CreateComboBoxFromVector(theApp.m_gs_crc_level, "crc_hack_level"); GtkWidget* paltex_check = CreateCheckBox("Allow 8 bits textures", "paltex"); - GtkWidget* acc_date_check = CreateCheckBox("Accurate Date", "accurate_date", false); - GtkWidget* large_fb_check = CreateCheckBox("Large Framebuffer", "large_framebuffer", true); + GtkWidget* acc_date_check = CreateCheckBox("Accurate Date", "accurate_date"); + GtkWidget* large_fb_check = CreateCheckBox("Large Framebuffer", "large_framebuffer"); GtkWidget* acc_bld_label = left_label("Blending Unit Accuracy:"); - GtkWidget* acc_bld_combo_box = CreateComboBoxFromVector(theApp.m_gs_acc_blend_level, "accurate_blending_unit", 1); + GtkWidget* acc_bld_combo_box = CreateComboBoxFromVector(theApp.m_gs_acc_blend_level, "accurate_blending_unit"); // Some helper string AddTooltip(paltex_check, IDC_PALTEX); @@ -262,9 +262,9 @@ void populate_hw_table(GtkWidget* hw_table) void populate_gl_table(GtkWidget* gl_table) { GtkWidget* gl_gs_label = left_label("Geometry Shader:"); - GtkWidget* gl_gs_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_geometry_shader", -1); + GtkWidget* gl_gs_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_geometry_shader"); GtkWidget* gl_ils_label = left_label("Image Load Store:"); - GtkWidget* gl_ils_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_shader_image_load_store", -1); + GtkWidget* gl_ils_combo = CreateComboBoxFromVector(theApp.m_gs_gl_ext, "override_GL_ARB_shader_image_load_store"); s_table_line = 0; InsertWidgetInTable(gl_table , gl_gs_label , gl_gs_combo); @@ -274,10 +274,10 @@ void populate_gl_table(GtkWidget* gl_table) void populate_sw_table(GtkWidget* sw_table) { GtkWidget* threads_label = left_label("Extra rendering threads:"); - GtkWidget* threads_spin = CreateSpinButton(0, 32, "extrathreads", DEFAULT_EXTRA_RENDERING_THREADS); + GtkWidget* threads_spin = CreateSpinButton(0, 32, "extrathreads"); GtkWidget* aa_check = CreateCheckBox("Edge anti-aliasing (AA1)", "aa1"); - GtkWidget* mipmap_check = CreateCheckBox("Mipmap", "mipmap", true); + GtkWidget* mipmap_check = CreateCheckBox("Mipmap", "mipmap"); AddTooltip(aa_check, IDC_AA1); AddTooltip(mipmap_check, IDC_MIPMAP); @@ -290,8 +290,8 @@ void populate_sw_table(GtkWidget* sw_table) void populate_shader_table(GtkWidget* shader_table) { - GtkWidget* shader = CreateFileChooser(GTK_FILE_CHOOSER_ACTION_OPEN, "Select an external shader", "shaderfx_glsl", "dummy.glsl"); - GtkWidget* shader_conf = CreateFileChooser(GTK_FILE_CHOOSER_ACTION_OPEN, "Then select a config", "shaderfx_conf", "dummy.ini"); + GtkWidget* shader = CreateFileChooser(GTK_FILE_CHOOSER_ACTION_OPEN, "Select an external shader", "shaderfx_glsl"); + GtkWidget* shader_conf = CreateFileChooser(GTK_FILE_CHOOSER_ACTION_OPEN, "Then select a config", "shaderfx_conf"); GtkWidget* shader_label = left_label("External shader glsl"); GtkWidget* shader_conf_label = left_label("External shader conf"); @@ -303,13 +303,13 @@ void populate_shader_table(GtkWidget* shader_table) GtkWidget* tv_shader = CreateComboBoxFromVector(theApp.m_gs_tv_shaders, "TVShader"); // Shadeboost scale - GtkWidget* sb_brightness = CreateScale("ShadeBoost_Brightness", 50); + GtkWidget* sb_brightness = CreateScale("ShadeBoost_Brightness"); GtkWidget* sb_brightness_label = left_label("Shade Boost Brightness:"); - GtkWidget* sb_contrast = CreateScale("ShadeBoost_Contrast", 50); + GtkWidget* sb_contrast = CreateScale("ShadeBoost_Contrast"); GtkWidget* sb_contrast_label = left_label("Shade Boost Contrast:"); - GtkWidget* sb_saturation = CreateScale("ShadeBoost_Saturation", 50); + GtkWidget* sb_saturation = CreateScale("ShadeBoost_Saturation"); GtkWidget* sb_saturation_label = left_label("Shade Boost Saturation:"); AddTooltip(shadeboost_check, IDC_SHADEBOOST); @@ -380,9 +380,9 @@ void populate_hack_table(GtkWidget* hack_table) void populate_main_table(GtkWidget* main_table) { GtkWidget* render_label = left_label("Renderer:"); - GtkWidget* render_combo_box = CreateComboBoxFromVector(theApp.m_gs_renderers, "Renderer", static_cast(GSRendererType::Default)); + GtkWidget* render_combo_box = CreateComboBoxFromVector(theApp.m_gs_renderers, "Renderer"); GtkWidget* interlace_label = left_label("Interlacing (F5):"); - GtkWidget* interlace_combo_box = CreateComboBoxFromVector(theApp.m_gs_interlace, "interlace", 7); + GtkWidget* interlace_combo_box = CreateComboBoxFromVector(theApp.m_gs_interlace, "interlace"); s_table_line = 0; InsertWidgetInTable(main_table, render_label, render_combo_box); @@ -417,14 +417,14 @@ void populate_record_table(GtkWidget* record_table) { GtkWidget* capture_check = CreateCheckBox("Enable Recording (with F12)", "capture_enabled"); GtkWidget* resxy_label = left_label("Resolution:"); - GtkWidget* resx_spin = CreateSpinButton(256, 8192, "capture_resx", 1280); - GtkWidget* resy_spin = CreateSpinButton(256, 8192, "capture_resy", 1024); + GtkWidget* resx_spin = CreateSpinButton(256, 8192, "capture_resx"); + GtkWidget* resy_spin = CreateSpinButton(256, 8192, "capture_resy"); GtkWidget* threads_label = left_label("Saving Threads:"); - GtkWidget* threads_spin = CreateSpinButton(1, 32, "capture_threads", 4); + GtkWidget* threads_spin = CreateSpinButton(1, 32, "capture_threads"); GtkWidget* out_dir_label = left_label("Output Directory:"); - GtkWidget* out_dir = CreateFileChooser(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, "Select a directory", "capture_out_dir", "/tmp"); + GtkWidget* out_dir = CreateFileChooser(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, "Select a directory", "capture_out_dir"); GtkWidget* png_label = left_label("PNG Compression Level:"); - GtkWidget* png_level = CreateSpinButton(1, 9, "png_compression_level", 1); + GtkWidget* png_level = CreateSpinButton(1, 9, "png_compression_level"); InsertWidgetInTable(record_table , capture_check); InsertWidgetInTable(record_table , resxy_label , resx_spin , resy_spin); @@ -498,8 +498,8 @@ bool RunLinuxDialog() return_value = gtk_dialog_run (GTK_DIALOG (dialog)); // Compatibility & not supported option - int mode_width = theApp.GetConfig("ModeWidth", 640); - int mode_height = theApp.GetConfig("ModeHeight", 480); + int mode_width = theApp.GetConfigI("ModeWidth"); + int mode_height = theApp.GetConfigI("ModeHeight"); theApp.SetConfig("ModeHeight", mode_height); theApp.SetConfig("ModeWidth", mode_width); theApp.SetConfig("msaa", 0); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 2ae94eadc1..585d55b043 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -40,15 +40,15 @@ GSRenderer::GSRenderer() { m_GStitleInfoBuffer[0] = 0; - m_interlace = theApp.GetConfig("interlace", 7) % s_interlace_nb; - m_aspectratio = theApp.GetConfig("aspectratio", 1) % s_aspect_ratio_nb; - m_shader = theApp.GetConfig("TVShader", 0) % s_post_shader_nb; - m_filter = theApp.GetConfig("filter", 1); - m_vsync = !!theApp.GetConfig("vsync", 0); - m_aa1 = !!theApp.GetConfig("aa1", 0); - m_fxaa = !!theApp.GetConfig("fxaa", 0); - m_shaderfx = !!theApp.GetConfig("shaderfx", 0); - m_shadeboost = !!theApp.GetConfig("ShadeBoost", 0); + m_interlace = theApp.GetConfigI("interlace") % s_interlace_nb; + m_aspectratio = theApp.GetConfigI("AspectRatio") % s_aspect_ratio_nb; + m_shader = theApp.GetConfigI("TVShader") % s_post_shader_nb; + m_filter = theApp.GetConfigI("filter"); + m_vsync = theApp.GetConfigB("vsync"); + m_aa1 = theApp.GetConfigB("aa1"); + m_fxaa = theApp.GetConfigB("fxaa"); + m_shaderfx = theApp.GetConfigB("shaderfx"); + m_shadeboost = theApp.GetConfigB("ShadeBoost"); } GSRenderer::~GSRenderer() diff --git a/plugins/GSdx/GSRendererCL.cpp b/plugins/GSdx/GSRendererCL.cpp index c7c718b5c3..895f01d2d7 100644 --- a/plugins/GSdx/GSRendererCL.cpp +++ b/plugins/GSdx/GSRendererCL.cpp @@ -1870,7 +1870,7 @@ GSRendererCL::CL::CL() WIs = INT_MAX; version = INT_MAX; - std::string ocldev = theApp.GetConfig("ocldev", ""); + std::string ocldev = theApp.GetConfigS("ocldev"); #ifdef IOCL_DEBUG ocldev = "Intel(R) Corporation Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz OpenCL C 1.2 CPU"; diff --git a/plugins/GSdx/GSRendererCS.cpp b/plugins/GSdx/GSRendererCS.cpp index 3fc96ee6bf..e5f6cf8e8d 100644 --- a/plugins/GSdx/GSRendererCS.cpp +++ b/plugins/GSdx/GSRendererCS.cpp @@ -103,7 +103,7 @@ bool GSRendererCS::CreateDevice(GSDevice* dev_unk) sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MinLOD = -FLT_MAX; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); sd.ComparisonFunc = D3D11_COMPARISON_NEVER; hr = (*dev)->CreateSamplerState(&sd, &m_ss); diff --git a/plugins/GSdx/GSRendererDX.cpp b/plugins/GSdx/GSRendererDX.cpp index b0a7baa82c..7bb81ea8de 100644 --- a/plugins/GSdx/GSRendererDX.cpp +++ b/plugins/GSdx/GSRendererDX.cpp @@ -27,13 +27,19 @@ GSRendererDX::GSRendererDX(GSTextureCache* tc, const GSVector2& pixelcenter) : GSRendererHW(tc) , m_pixelcenter(pixelcenter) { - m_logz = !!theApp.GetConfig("logz", 0); - m_fba = !!theApp.GetConfig("fba", 1); + m_logz = theApp.GetConfigB("logz"); + m_fba = theApp.GetConfigB("fba"); - UserHacks_AlphaHack = !!theApp.GetConfig("UserHacks_AlphaHack", 0) && !!theApp.GetConfig("UserHacks", 0); - UserHacks_AlphaStencil = !!theApp.GetConfig("UserHacks_AlphaStencil", 0) && !!theApp.GetConfig("UserHacks", 0); + if (theApp.GetConfigB("UserHacks")) { + UserHacks_AlphaHack = theApp.GetConfigB("UserHacks_AlphaHack"); + UserHacks_AlphaStencil = theApp.GetConfigB("UserHacks_AlphaStencil"); + UserHacks_TCOffset = theApp.GetConfigI("UserHacks_TCOffset"); + } else { + UserHacks_AlphaHack = false; + UserHacks_AlphaStencil = false; + UserHacks_TCOffset = 0; + } - UserHacks_TCOffset = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_TCOffset", 0) : 0; UserHacks_TCO_x = (UserHacks_TCOffset & 0xFFFF) / -1000.0f; UserHacks_TCO_y = ((UserHacks_TCOffset >> 16) & 0xFFFF) / -1000.0f; } diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index ebeb95cc0c..3811b25c35 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -31,20 +31,26 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc) , m_channel_shuffle(false) , m_double_downscale(false) { - m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", 1); - m_large_framebuffer = !!theApp.GetConfig("large_framebuffer", 1); - m_userhacks_align_sprite_X = !!theApp.GetConfig("UserHacks_align_sprite_X", 0) && !!theApp.GetConfig("UserHacks", 0); - m_userhacks_round_sprite_offset = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_round_sprite_offset", 0) : 0; - m_userhacks_disable_gs_mem_clear = theApp.GetConfig("UserHacks_DisableGsMemClear", 0) && theApp.GetConfig("UserHacks", 0); + m_upscale_multiplier = theApp.GetConfigI("upscale_multiplier"); + m_large_framebuffer = theApp.GetConfigI("large_framebuffer"); + if (theApp.GetConfigB("UserHacks")) { + m_userhacks_align_sprite_X = theApp.GetConfigB("UserHacks_align_sprite_X"); + m_userhacks_round_sprite_offset = theApp.GetConfigI("UserHacks_round_sprite_offset"); + m_userhacks_disable_gs_mem_clear = theApp.GetConfigB("UserHacks_DisableGsMemClear"); + } else { + m_userhacks_align_sprite_X = false; + m_userhacks_round_sprite_offset = 0; + m_userhacks_disable_gs_mem_clear = false; + } if (!m_upscale_multiplier) { //Custom Resolution - m_width = theApp.GetConfig("resx", m_width); - m_height = theApp.GetConfig("resy", m_height); + m_width = theApp.GetConfigI("resx"); + m_height = theApp.GetConfigI("resy"); } if (m_upscale_multiplier == 1) { // hacks are only needed for upscaling issues. m_userhacks_round_sprite_offset = 0; - m_userhacks_align_sprite_X = 0; + m_userhacks_align_sprite_X = 0; } } @@ -749,8 +755,8 @@ GSRendererHW::Hacks::Hacks() , m_oo(NULL) , m_cu(NULL) { - bool is_opengl = (static_cast(theApp.GetConfig("Renderer", static_cast(GSRendererType::Default))) == GSRendererType::OGL_HW); - bool can_handle_depth = (!theApp.GetConfig("UserHacks", 0) || !theApp.GetConfig("UserHacks_DisableDepthSupport", 0)) && is_opengl; + bool is_opengl = (static_cast(theApp.GetConfigI("Renderer")) == GSRendererType::OGL_HW); + bool can_handle_depth = (!theApp.GetConfigB("UserHacks") || !theApp.GetConfigB("UserHacks_DisableDepthSupport")) && is_opengl; m_oi_list.push_back(HackEntry(CRC::FFXII, CRC::EU, &GSRendererHW::OI_FFXII)); m_oi_list.push_back(HackEntry(CRC::FFX, CRC::RegionCount, &GSRendererHW::OI_FFX)); @@ -796,7 +802,7 @@ void GSRendererHW::Hacks::SetGameCRC(const CRC::Game& game) m_oi = &GSRendererHW::OI_PointListPalette; } - bool hack = theApp.GetConfig("UserHacks_ColorDepthClearOverlap", 0) && theApp.GetConfig("UserHacks", 0); + bool hack = theApp.GetConfigB("UserHacks_ColorDepthClearOverlap") && theApp.GetConfigB("UserHacks"); if (hack && !m_oi) { // FIXME: Enable this code in the future. I think it could replace // most of the "old" OI hack. So far code was tested on GoW2 & SimpsonsGame with diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index baacc9a21a..d6723a7860 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -27,23 +27,23 @@ GSRendererOGL::GSRendererOGL() : GSRendererHW(new GSTextureCacheOGL(this)) { - m_accurate_date = !!theApp.GetConfig("accurate_date", 0); + m_accurate_date = theApp.GetConfigB("accurate_date"); - m_sw_blending = theApp.GetConfig("accurate_blending_unit", 1); + m_sw_blending = theApp.GetConfigI("accurate_blending_unit"); // Hope nothing requires too many draw calls. m_drawlist.reserve(2048); - UserHacks_TCOffset = theApp.GetConfig("UserHacks_TCOffset", 0); + UserHacks_TCOffset = theApp.GetConfigI("UserHacks_TCOffset"); UserHacks_TCO_x = (UserHacks_TCOffset & 0xFFFF) / -1000.0f; UserHacks_TCO_y = ((UserHacks_TCOffset >> 16) & 0xFFFF) / -1000.0f; - UserHacks_safe_fbmask = !!theApp.GetConfig("UserHacks_safe_fbmask", 0); - UserHacks_merge_sprite = !!theApp.GetConfig("UserHacks_merge_pp_sprite", 0); + UserHacks_safe_fbmask = theApp.GetConfigB("UserHacks_safe_fbmask"); + UserHacks_merge_sprite = theApp.GetConfigB("UserHacks_merge_pp_sprite"); m_prim_overlap = PRIM_OVERLAP_UNKNOW; m_unsafe_fbmask = false; - if (!theApp.GetConfig("UserHacks", 0)) { + if (!theApp.GetConfigB("UserHacks")) { UserHacks_TCOffset = 0; UserHacks_TCO_x = 0; UserHacks_TCO_y = 0; diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index b34ebbd4f8..db8bf92c99 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -115,7 +115,7 @@ void GSSettingsDlg::OnInit() } } - std::string adapter_setting = theApp.GetConfig("Adapter", "default"); + std::string adapter_setting = theApp.GetConfigS("Adapter"); vector adapter_settings; unsigned int adapter_sel = 0; @@ -129,7 +129,7 @@ void GSSettingsDlg::OnInit() adapter_settings.push_back(GSSetting(i, adapters[i].name.c_str(), "")); } - std::string ocldev = theApp.GetConfig("ocldev", ""); + std::string ocldev = theApp.GetConfigS("ocldev"); unsigned int ocl_sel = 0; @@ -147,32 +147,32 @@ void GSSettingsDlg::OnInit() ComboBoxInit(IDC_OPENCL_DEVICE, m_ocl_devs, ocl_sel); UpdateRenderers(); - ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfig("Interlace", 7)); // 7 = "auto", detects interlace based on SMODE2 register - ComboBoxInit(IDC_UPSCALE_MULTIPLIER, theApp.m_gs_upscale_multiplier, theApp.GetConfig("upscale_multiplier", 1)); - ComboBoxInit(IDC_AFCOMBO, theApp.m_gs_max_anisotropy, theApp.GetConfig("MaxAnisotropy", 0)); - ComboBoxInit(IDC_FILTER, theApp.m_gs_filter, theApp.GetConfig("filter", 2)); - ComboBoxInit(IDC_ACCURATE_BLEND_UNIT, theApp.m_gs_acc_blend_level, theApp.GetConfig("accurate_blending_unit", 1)); - ComboBoxInit(IDC_CRC_LEVEL, theApp.m_gs_crc_level, theApp.GetConfig("crc_hack_level", 3)); + ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfigI("Interlace")); + ComboBoxInit(IDC_UPSCALE_MULTIPLIER, theApp.m_gs_upscale_multiplier, theApp.GetConfigI("upscale_multiplier")); + ComboBoxInit(IDC_AFCOMBO, theApp.m_gs_max_anisotropy, theApp.GetConfigI("MaxAnisotropy")); + ComboBoxInit(IDC_FILTER, theApp.m_gs_filter, theApp.GetConfigI("filter")); + ComboBoxInit(IDC_ACCURATE_BLEND_UNIT, theApp.m_gs_acc_blend_level, theApp.GetConfigI("accurate_blending_unit")); + ComboBoxInit(IDC_CRC_LEVEL, theApp.m_gs_crc_level, theApp.GetConfigI("crc_hack_level")); + + CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfigB("paltex")); + CheckDlgButton(m_hWnd, IDC_LARGE_FB, theApp.GetConfigB("large_framebuffer")); + CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfigB("logz")); + CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfigB("fba")); + CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfigB("aa1")); + CheckDlgButton(m_hWnd, IDC_MIPMAP, theApp.GetConfigB("mipmap")); + CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfigB("accurate_date")); - CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfig("paltex", 0)); - CheckDlgButton(m_hWnd, IDC_LARGE_FB, theApp.GetConfig("large_framebuffer", 1)); - CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfig("logz", 1)); - CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfig("fba", 1)); - CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfig("aa1", 0)); - CheckDlgButton(m_hWnd, IDC_MIPMAP, theApp.GetConfig("mipmap", 1)); - CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfig("accurate_date", 0)); - // Hacks - CheckDlgButton(m_hWnd, IDC_HACKS_ENABLED, theApp.GetConfig("UserHacks", 0)); + CheckDlgButton(m_hWnd, IDC_HACKS_ENABLED, theApp.GetConfigB("UserHacks")); SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(8192, 256)); - SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resx", 1024), 0)); + SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("resx"), 0)); SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETRANGE, 0, MAKELPARAM(8192, 256)); - SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resy", 1024), 0)); + SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("resy"), 0)); SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 0)); - SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("extrathreads", DEFAULT_EXTRA_RENDERING_THREADS), 0)); + SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("extrathreads"), 0)); AddTooltip(IDC_FILTER); AddTooltip(IDC_CRC_LEVEL); @@ -316,8 +316,8 @@ void GSSettingsDlg::UpdateRenderers() } else { - GSRendererType best_renderer = (level >= D3D_FEATURE_LEVEL_10_0) ? GSRendererType::DX1011_HW : GSRendererType::DX9_HW; - renderer_setting = static_cast(theApp.GetConfig("Renderer", static_cast(best_renderer))); + //GSRendererType best_renderer = (level >= D3D_FEATURE_LEVEL_10_0) ? GSRendererType::DX1011_HW : GSRendererType::DX9_HW; + renderer_setting = static_cast(theApp.GetConfigI("Renderer")); } GSRendererType renderer_sel = GSRendererType::Default; @@ -438,21 +438,21 @@ GSShaderDlg::GSShaderDlg() : void GSShaderDlg::OnInit() { //TV Shader - ComboBoxInit(IDC_TVSHADER, theApp.m_gs_tv_shaders, theApp.GetConfig("TVshader", 0)); + ComboBoxInit(IDC_TVSHADER, theApp.m_gs_tv_shaders, theApp.GetConfigI("TVshader")); //Shade Boost - CheckDlgButton(m_hWnd, IDC_SHADEBOOST, theApp.GetConfig("ShadeBoost", 0)); - contrast = theApp.GetConfig("ShadeBoost_Contrast", 50); - brightness = theApp.GetConfig("ShadeBoost_Brightness", 50); - saturation = theApp.GetConfig("ShadeBoost_Saturation", 50); + CheckDlgButton(m_hWnd, IDC_SHADEBOOST, theApp.GetConfigB("ShadeBoost")); + contrast = theApp.GetConfigI("ShadeBoost_Contrast"); + brightness = theApp.GetConfigI("ShadeBoost_Brightness"); + saturation = theApp.GetConfigI("ShadeBoost_Saturation"); // External FX shader - CheckDlgButton(m_hWnd, IDC_SHADER_FX, theApp.GetConfig("shaderfx", 0)); - SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfig("shaderfx_glsl", "shaders\\GSdx.fx").c_str()); - SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfig("shaderfx_conf", "shaders\\GSdx_FX_Settings.ini").c_str()); + CheckDlgButton(m_hWnd, IDC_SHADER_FX, theApp.GetConfigB("shaderfx")); + SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfigS("shaderfx_glsl").c_str()); + SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfigS("shaderfx_conf").c_str()); // FXAA shader - CheckDlgButton(m_hWnd, IDC_FXAA, theApp.GetConfig("Fxaa", 0)); + CheckDlgButton(m_hWnd, IDC_FXAA, theApp.GetConfigB("fxaa")); AddTooltip(IDC_SHADEBOOST); AddTooltip(IDC_SHADER_FX); @@ -658,29 +658,29 @@ void GSHacksDlg::OnInit() SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text); } - SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_SETCURSEL, msaa2cb[min(theApp.GetConfig("UserHacks_MSAA", 0), 16)], 0); + SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_SETCURSEL, msaa2cb[min(theApp.GetConfigI("UserHacks_MSAA"), 16)], 0); - CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfig("UserHacks_AlphaHack", 0)); - CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 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_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_SAFE_FBMASK, theApp.GetConfig("UserHacks_safe_fbmask", 0)); - CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfig("UserHacks_DisableDepthSupport", 0)); - CheckDlgButton(m_hWnd, IDC_FAST_TC_INV, theApp.GetConfig("UserHacks_DisablePartialInvalidation", 0)); + CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfigB("UserHacks_AlphaHack")); + CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfigB("UserHacks_HalfPixelOffset")); + CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfigI("UserHacks_WildHack")); + CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfigB("UserHacks_AlphaStencil")); + CheckDlgButton(m_hWnd, IDC_PRELOAD_GS, theApp.GetConfigB("preload_frame_with_gs_data")); + CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfigB("UserHacks_align_sprite_X")); + CheckDlgButton(m_hWnd, IDC_SAFE_FBMASK, theApp.GetConfigB("UserHacks_safe_fbmask")); + CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfigB("UserHacks_DisableDepthSupport")); + CheckDlgButton(m_hWnd, IDC_FAST_TC_INV, theApp.GetConfigB("UserHacks_DisablePartialInvalidation")); - 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)); + ComboBoxInit(IDC_ROUND_SPRITE, theApp.m_gs_hack, theApp.GetConfigI("UserHacks_round_sprite_offset")); + ComboBoxInit(IDC_SPRITEHACK, theApp.m_gs_hack, theApp.GetConfigI("UserHacks_SpriteHack")); 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)); + 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.GetConfig("UserHacks_TCOffset", 0) & 0xFFFF, 0)); + SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("UserHacks_TCOffset") & 0xFFFF, 0)); 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)); + SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETPOS, 0, MAKELPARAM((theApp.GetConfigI("UserHacks_TCOffset") >> 16) & 0xFFFF, 0)); ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), ogl ? SW_HIDE : SW_SHOW); ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), ogl ? SW_HIDE : SW_SHOW); diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 6eb5388f29..dc1dfa5916 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -43,19 +43,19 @@ GSState::GSState() , m_options(0) , m_frameskip(0) { - m_nativeres = theApp.GetConfig("upscale_multiplier",1) == 1; - m_mipmap = !!theApp.GetConfig("mipmap", 1); - m_NTSC_Saturation = !!theApp.GetConfig("NTSC_Saturation", true); - m_userhacks_skipdraw = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SkipDraw", 0) : 0; + m_nativeres = theApp.GetConfigI("upscale_multiplier") == 1; + m_mipmap = theApp.GetConfigB("mipmap"); + m_NTSC_Saturation = theApp.GetConfigB("NTSC_Saturation"); + m_userhacks_skipdraw = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_SkipDraw") : 0; s_n = 0; - s_dump = !!theApp.GetConfig("dump", 0); - s_save = !!theApp.GetConfig("save", 0); - s_savet = !!theApp.GetConfig("savet", 0); - s_savez = !!theApp.GetConfig("savez", 0); - s_savef = !!theApp.GetConfig("savef", 0); - s_saven = theApp.GetConfig("saven", 0); - s_savel = theApp.GetConfig("savel", 5000); + s_dump = theApp.GetConfigB("dump"); + s_save = theApp.GetConfigB("save"); + s_savet = theApp.GetConfigB("savet"); + s_savez = theApp.GetConfigB("savez"); + s_savef = theApp.GetConfigB("savef"); + s_saven = theApp.GetConfigI("saven"); + s_savel = theApp.GetConfigI("savel"); #if defined(__unix__) if (s_dump) { GSmkdir("/tmp/GS_HW_dump"); @@ -71,8 +71,8 @@ GSState::GSState() //s_saven = 0; //s_savel = 0; - UserHacks_WildHack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_WildHack", 0) : 0; - m_crc_hack_level = theApp.GetConfig("crc_hack_level", 3); + UserHacks_WildHack = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_WildHack") : 0; + m_crc_hack_level = theApp.GetConfigI("crc_hack_level"); memset(&m_v, 0, sizeof(m_v)); memset(&m_vertex, 0, sizeof(m_vertex)); diff --git a/plugins/GSdx/GSTexture11.cpp b/plugins/GSdx/GSTexture11.cpp index 409a565b1c..59e10fb151 100644 --- a/plugins/GSdx/GSTexture11.cpp +++ b/plugins/GSdx/GSTexture11.cpp @@ -179,7 +179,7 @@ bool GSTexture11::Save(const string& fn, bool user_image, bool dds) return false; } - int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfig("png_compression_level", Z_BEST_SPEED); + int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level"); bool success = GSPng::Save(format, fn, static_cast(sm.pData), desc.Width, desc.Height, sm.RowPitch, compression); m_ctx->Unmap(res, 0); diff --git a/plugins/GSdx/GSTexture9.cpp b/plugins/GSdx/GSTexture9.cpp index e322c2ee37..ae413d7ce6 100644 --- a/plugins/GSdx/GSTexture9.cpp +++ b/plugins/GSdx/GSTexture9.cpp @@ -201,7 +201,7 @@ bool GSTexture9::Save(const string& fn, bool user_image, bool dds) return false; } - int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfig("png_compression_level", Z_BEST_SPEED); + int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level"); bool success = GSPng::Save(format, fn, static_cast(slr.pBits), desc.Width, desc.Height, slr.Pitch, compression, rb_swapped); surface->UnlockRect(); diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 5f69216fad..3c499dc106 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -28,14 +28,14 @@ bool GSTextureCache::m_disable_partial_invalidation = false; GSTextureCache::GSTextureCache(GSRenderer* r) : m_renderer(r) { - s_IS_OPENGL = (static_cast(theApp.GetConfig("Renderer", static_cast(GSRendererType::Default))) == GSRendererType::OGL_HW); + s_IS_OPENGL = (static_cast(theApp.GetConfigI("Renderer")) == GSRendererType::OGL_HW); - if (theApp.GetConfig("UserHacks", 0)) { - m_spritehack = theApp.GetConfig("UserHacks_SpriteHack", 0); - UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0); - m_preload_frame = !!theApp.GetConfig("preload_frame_with_gs_data", 0); - m_disable_partial_invalidation = !!theApp.GetConfig("UserHacks_DisablePartialInvalidation", 0); - m_can_convert_depth = !theApp.GetConfig("UserHacks_DisableDepthSupport", 0); + if (theApp.GetConfigB("UserHacks")) { + m_spritehack = theApp.GetConfigI("UserHacks_SpriteHack"); + UserHacks_HalfPixelOffset = theApp.GetConfigB("UserHacks_HalfPixelOffset"); + m_preload_frame = theApp.GetConfigB("preload_frame_with_gs_data"); + m_disable_partial_invalidation = theApp.GetConfigB("UserHacks_DisablePartialInvalidation"); + m_can_convert_depth = !theApp.GetConfigB("UserHacks_DisableDepthSupport"); } else { m_spritehack = 0; UserHacks_HalfPixelOffset = false; @@ -44,9 +44,9 @@ GSTextureCache::GSTextureCache(GSRenderer* r) m_can_convert_depth = true; } - m_paltex = !!theApp.GetConfig("paltex", 0); + m_paltex = theApp.GetConfigB("paltex"); m_can_convert_depth &= s_IS_OPENGL; // only supported by openGL so far - m_crc_hack_level = theApp.GetConfig("crc_hack_level", 3); + m_crc_hack_level = theApp.GetConfigI("crc_hack_level"); // In theory 4MB is enough but 9MB is safer for overflow (8MB // isn't enough in custom resolution) diff --git a/plugins/GSdx/GSTextureFX11.cpp b/plugins/GSdx/GSTextureFX11.cpp index 77cf05d2fb..00619a7848 100644 --- a/plugins/GSdx/GSTextureFX11.cpp +++ b/plugins/GSdx/GSTextureFX11.cpp @@ -54,13 +54,13 @@ bool GSDevice11::CreateTextureFX() memset(&sd, 0, sizeof(sd)); - sd.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; + sd.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; sd.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MinLOD = -FLT_MAX; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); sd.ComparisonFunc = D3D11_COMPARISON_NEVER; hr = m_dev->CreateSamplerState(&sd, &m_palette_ss); @@ -269,7 +269,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe memset(&sd, 0, sizeof(sd)); - af.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; + af.Filter = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; sd.Filter = ssel.ltf ? af.Filter : D3D11_FILTER_MIN_MAG_MIP_POINT; sd.AddressU = ssel.tau ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP; @@ -277,7 +277,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sd.MinLOD = -FLT_MAX; sd.MaxLOD = FLT_MAX; - sd.MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + sd.MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); sd.ComparisonFunc = D3D11_COMPARISON_NEVER; m_dev->CreateSamplerState(&sd, &ss0); diff --git a/plugins/GSdx/GSTextureFX9.cpp b/plugins/GSdx/GSTextureFX9.cpp index 66f735c17c..e6d2f1efb4 100644 --- a/plugins/GSdx/GSTextureFX9.cpp +++ b/plugins/GSdx/GSTextureFX9.cpp @@ -213,8 +213,8 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel memset(ss, 0, sizeof(*ss)); - ss->Anisotropic[0] = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; - ss->Anisotropic[1] = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; + ss->Anisotropic[0] = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; + ss->Anisotropic[1] = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; ss->FilterMin[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT; ss->FilterMag[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT; ss->FilterMip[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT; @@ -223,7 +223,7 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel ss->FilterMip[1] = ss->Anisotropic[1]; ss->AddressU = ssel.tau ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP; ss->AddressV = ssel.tav ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP; - ss->MaxAnisotropy = theApp.GetConfig("MaxAnisotropy", 0); + ss->MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy"); ss->MaxLOD = ULONG_MAX; diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index c28a2e95b8..0fb114688a 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -477,7 +477,7 @@ bool GSTextureOGL::Save(const string& fn, bool user_image, bool dds) glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); } - int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfig("png_compression_level", Z_BEST_SPEED); + int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level"); return GSPng::Save(fmt, fn, image.get(), m_size.x, m_size.y, pitch, compression); } diff --git a/plugins/GSdx/GSTextureSW.cpp b/plugins/GSdx/GSTextureSW.cpp index 43e7222bbe..2a848e72ec 100644 --- a/plugins/GSdx/GSTextureSW.cpp +++ b/plugins/GSdx/GSTextureSW.cpp @@ -94,6 +94,6 @@ bool GSTextureSW::Save(const string& fn, bool user_image, bool dds) #else GSPng::Format fmt = GSPng::RGB_PNG; #endif - int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfig("png_compression_level", Z_BEST_SPEED); + int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level"); return GSPng::Save(fmt, fn, static_cast(m_data), m_size.x, m_size.y, m_pitch, compression); } diff --git a/plugins/GSdx/GSWndEGL.cpp b/plugins/GSdx/GSWndEGL.cpp index ee66b05109..d129e7e8e0 100644 --- a/plugins/GSdx/GSWndEGL.cpp +++ b/plugins/GSdx/GSWndEGL.cpp @@ -164,8 +164,8 @@ bool GSWndEGL::Create(const string& title, int w, int h) throw GSDXRecoverableError(); if(w <= 0 || h <= 0) { - w = theApp.GetConfig("ModeWidth", 640); - h = theApp.GetConfig("ModeHeight", 480); + w = theApp.GetConfigI("ModeWidth"); + h = theApp.GetConfigI("ModeHeight"); } m_managed = true; diff --git a/plugins/GSdx/GSWndOGL.cpp b/plugins/GSdx/GSWndOGL.cpp index 786cb86701..f664eaafa0 100644 --- a/plugins/GSdx/GSWndOGL.cpp +++ b/plugins/GSdx/GSWndOGL.cpp @@ -173,8 +173,8 @@ bool GSWndOGL::Create(const string& title, int w, int h) throw GSDXRecoverableError(); if(w <= 0 || h <= 0) { - w = theApp.GetConfig("ModeWidth", 640); - h = theApp.GetConfig("ModeHeight", 480); + w = theApp.GetConfigI("ModeWidth"); + h = theApp.GetConfigI("ModeHeight"); } m_managed = true; diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index b75105af75..934dc8812d 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -400,11 +400,6 @@ void GSdxApp::SetConfigDir(const char* dir) } } -string GSdxApp::GetConfig(const char* entry, const char* value) -{ - return GetConfigS(entry); -} - string GSdxApp::GetConfigS(const char* entry) { char buff[4096] = {0}; @@ -425,11 +420,6 @@ void GSdxApp::SetConfig(const char* entry, const char* value) WritePrivateProfileString(m_section.c_str(), entry, value, m_ini.c_str()); } -int GSdxApp::GetConfig(const char* entry, int value) -{ - return GetConfigI(entry); -} - int GSdxApp::GetConfigI(const char* entry) { auto def = m_default_configuration.find(entry); diff --git a/plugins/GSdx/GSdx.h b/plugins/GSdx/GSdx.h index 4c34b6b00c..31a5cc31c1 100644 --- a/plugins/GSdx/GSdx.h +++ b/plugins/GSdx/GSdx.h @@ -52,9 +52,7 @@ public: bool LoadResource(int id, vector& buff, const char* type = NULL); - string GetConfig(const char* entry, const char* value); void SetConfig(const char* entry, const char* value); - int GetConfig(const char* entry, int value); void SetConfig(const char* entry, int value); // Avoid issue with overloading int GetConfigI(const char* entry); diff --git a/plugins/GSdx/PSX/GPU.cpp b/plugins/GSdx/PSX/GPU.cpp index baf3fca2ee..6c26a94d82 100644 --- a/plugins/GSdx/PSX/GPU.cpp +++ b/plugins/GSdx/PSX/GPU.cpp @@ -110,8 +110,8 @@ EXPORT_C_(int32) GPUopen(void* hWnd) return -1; #endif - GPURendererType renderer = static_cast(theApp.GetConfig("Renderer", static_cast(GPURendererType::D3D9_SW))); - int threads = theApp.GetConfig("extrathreads", DEFAULT_EXTRA_RENDERING_THREADS); + GPURendererType renderer = static_cast(theApp.GetConfigI("Renderer")); + int threads = theApp.GetConfigI("extrathreads"); switch(renderer) { diff --git a/plugins/GSdx/PSX/GPULocalMemory.cpp b/plugins/GSdx/PSX/GPULocalMemory.cpp index 0218dcfc78..d7b3e513aa 100644 --- a/plugins/GSdx/PSX/GPULocalMemory.cpp +++ b/plugins/GSdx/PSX/GPULocalMemory.cpp @@ -34,8 +34,8 @@ const GSVector4i GPULocalMemory::m_rxxx(0x0000001f); GPULocalMemory::GPULocalMemory() { - m_scale.x = std::min(std::max(theApp.GetConfig("scale_x", 0), 0), 2); - m_scale.y = std::min(std::max(theApp.GetConfig("scale_y", 0), 0), 2); + m_scale.x = std::min(std::max(theApp.GetConfigI("scale_x"), 0), 2); + m_scale.y = std::min(std::max(theApp.GetConfigI("scale_y"), 0), 2); // diff --git a/plugins/GSdx/PSX/GPURenderer.cpp b/plugins/GSdx/PSX/GPURenderer.cpp index 32338c5efb..db84940f3b 100644 --- a/plugins/GSdx/PSX/GPURenderer.cpp +++ b/plugins/GSdx/PSX/GPURenderer.cpp @@ -32,14 +32,14 @@ map GPURenderer::m_wnd2gpu; GPURenderer::GPURenderer(GSDevice* dev) : m_dev(dev) { - m_filter = theApp.GetConfig("filter", 0); - m_dither = theApp.GetConfig("dithering", 1); - m_aspectratio = theApp.GetConfig("AspectRatio", 1); - m_vsync = !!theApp.GetConfig("vsync", 0); - m_fxaa = !!theApp.GetConfig("fxaa", 0); - m_shaderfx = !!theApp.GetConfig("shaderfx", 0); - m_scale = m_mem.GetScale(); - m_shadeboost = !!theApp.GetConfig("ShadeBoost", 0); + m_filter = theApp.GetConfigI("filter"); + m_dither = theApp.GetConfigI("dithering"); + m_aspectratio = theApp.GetConfigI("AspectRatio"); + m_vsync = theApp.GetConfigB("vsync"); + m_fxaa = theApp.GetConfigB("fxaa"); + m_shaderfx = theApp.GetConfigB("shaderfx"); + m_scale = m_mem.GetScale(); + m_shadeboost = theApp.GetConfigB("ShadeBoost"); #ifdef _WIN32 diff --git a/plugins/GSdx/PSX/GPUSettingsDlg.cpp b/plugins/GSdx/PSX/GPUSettingsDlg.cpp index 59ccf07597..9e01910b71 100644 --- a/plugins/GSdx/PSX/GPUSettingsDlg.cpp +++ b/plugins/GSdx/PSX/GPUSettingsDlg.cpp @@ -46,9 +46,9 @@ void GPUSettingsDlg::OnInit() if(CComPtr d3d = Direct3DCreate9(D3D_SDK_VERSION)) { - uint32 w = theApp.GetConfig("ModeWidth", 0); - uint32 h = theApp.GetConfig("ModeHeight", 0); - uint32 hz = theApp.GetConfig("ModeRefreshRate", 0); + uint32 w = theApp.GetConfigI("ModeWidth"); + uint32 h = theApp.GetConfigI("ModeHeight"); + uint32 hz = theApp.GetConfigI("ModeRefreshRate"); uint32 n = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); @@ -66,16 +66,16 @@ void GPUSettingsDlg::OnInit() } } - ComboBoxInit(IDC_RENDERER, theApp.m_gpu_renderers, theApp.GetConfig("Renderer", static_cast(GPURendererType::D3D9_SW))); - ComboBoxInit(IDC_FILTER, theApp.m_gpu_filter, theApp.GetConfig("filter", 0)); - ComboBoxInit(IDC_DITHERING, theApp.m_gpu_dithering, theApp.GetConfig("dithering", 1)); - ComboBoxInit(IDC_ASPECTRATIO, theApp.m_gpu_aspectratio, theApp.GetConfig("AspectRatio", 1)); - ComboBoxInit(IDC_SCALE, theApp.m_gpu_scale, theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2)); + ComboBoxInit(IDC_RENDERER, theApp.m_gpu_renderers, theApp.GetConfigI("Renderer")); + ComboBoxInit(IDC_FILTER, theApp.m_gpu_filter, theApp.GetConfigI("filter")); + ComboBoxInit(IDC_DITHERING, theApp.m_gpu_dithering, theApp.GetConfigI("dithering")); + ComboBoxInit(IDC_ASPECTRATIO, theApp.m_gpu_aspectratio, theApp.GetConfigI("AspectRatio")); + ComboBoxInit(IDC_SCALE, theApp.m_gpu_scale, theApp.GetConfigI("scale_x") | (theApp.GetConfigI("scale_y") << 2)); - CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1)); + CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfigB("windowed")); SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 0)); - SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("extrathreads", DEFAULT_EXTRA_RENDERING_THREADS), 0)); + SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfigI("extrathreads"), 0)); UpdateControls(); }