From 94f2ad92633fb2736cea296665a2b7487e6a4ec4 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Fri, 24 Mar 2017 08:52:01 +0000 Subject: [PATCH] gsdx: Move renderer config loading from GSOpen2 to _GSOpen Some duplicate logic is avoided this way. --- plugins/GSdx/GS.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index a2253ab7cf..2d91bab31b 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -211,9 +211,18 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t GSDevice* dev = NULL; bool old_api = *dsp == NULL; + // Fresh start up or config file changed if(renderer == GSRendererType::Undefined) { renderer = static_cast(theApp.GetConfigI("Renderer")); +#ifdef _WIN32 + if (renderer == GSRendererType::Default) + { + renderer = GSUtil::GetBestRenderer(); + if (renderer == GSRendererType::OGL_HW) + theApp.SetConfig("crc_hack_level", static_cast(CRCHackLevel::Partial)); + } +#endif } if(threads == -1) @@ -472,25 +481,12 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags) bool toggle_state = !!(flags & 4); GSRendererType renderer = s_renderer; - // Fresh start up or config file changed - if (renderer == GSRendererType::Undefined) - { - renderer = static_cast(theApp.GetConfigI("Renderer")); -#ifdef _WIN32 - if (renderer == GSRendererType::Default) - { - renderer = GSUtil::GetBestRenderer(); - if (renderer == GSRendererType::OGL_HW) - theApp.SetConfig("crc_hack_level", static_cast(CRCHackLevel::Partial)); - } -#endif - } - else if (stored_toggle_state != toggle_state) + + if (renderer != GSRendererType::Undefined && stored_toggle_state != toggle_state) { #ifdef _WIN32 GSRendererType best_sw_renderer = GSUtil::CheckDirect3D11Level() >= D3D_FEATURE_LEVEL_10_0 ? GSRendererType::DX1011_SW : GSRendererType::DX9_SW; - switch (renderer) { // Use alternative renderer (SW if currently using HW renderer, and vice versa, keeping the same API and API version) case GSRendererType::DX9_SW: renderer = GSRendererType::DX9_HW; break;