gsdx: Store the current renderer in GSdxApp

This commit is contained in:
Jonathan Li 2017-03-24 08:53:33 +00:00 committed by Gregory Hainaut
parent 94f2ad9263
commit a5282daf91
3 changed files with 23 additions and 8 deletions

View File

@ -62,7 +62,6 @@ extern bool RunLinuxDialog();
static GSRenderer* s_gs = NULL;
static void (*s_irq)() = NULL;
static uint8* s_basemem = NULL;
static GSRendererType s_renderer = GSRendererType::Undefined;
static bool s_framelimit = true;
static bool s_vsync = false;
static bool s_exclusive = true;
@ -170,7 +169,7 @@ EXPORT_C GSshutdown()
delete s_gs;
s_gs = nullptr;
s_renderer = GSRendererType::Undefined;
theApp.SetCurrentRendererType(GSRendererType::Undefined);
#ifdef _WIN32
@ -232,7 +231,7 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
try
{
if (s_renderer != renderer)
if (theApp.GetCurrentRendererType() != renderer)
{
// Emulator has made a render change request, which requires a completely
// new s_gs -- if the emu doesn't save/restore the GS state across this
@ -241,6 +240,8 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
delete s_gs;
s_gs = NULL;
theApp.SetCurrentRendererType(renderer);
}
std::shared_ptr<GSWnd> window;
@ -419,8 +420,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
}
if (s_gs == NULL)
return -1;
s_renderer = renderer;
}
s_gs->m_wnd = window;
@ -480,7 +479,7 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
static bool stored_toggle_state = false;
bool toggle_state = !!(flags & 4);
GSRendererType renderer = s_renderer;
GSRendererType renderer = theApp.GetCurrentRendererType();
if (renderer != GSRendererType::Undefined && stored_toggle_state != toggle_state)
{
@ -811,7 +810,7 @@ EXPORT_C GSconfigure()
if(GSSettingsDlg().DoModal() == IDOK)
{
// Force a reload of the gs state
s_renderer = GSRendererType::Undefined;
theApp.SetCurrentRendererType(GSRendererType::Undefined);
}
#else
@ -819,7 +818,7 @@ EXPORT_C GSconfigure()
if (RunLinuxDialog()) {
theApp.ReloadConfig();
// Force a reload of the gs state
s_renderer = GSRendererType::Undefined;
theApp.SetCurrentRendererType(GSRendererType::Undefined);
}
#endif

View File

@ -142,6 +142,8 @@ void GSdxApp::Init()
return;
is_initialised = true;
m_current_renderer_type = GSRendererType::Undefined;
if (m_ini.empty())
m_ini = "inis/GSdx.ini";
m_section = "Settings";
@ -497,3 +499,13 @@ void GSdxApp::SetConfig(const char* entry, int value)
SetConfig(entry, buff);
}
void GSdxApp::SetCurrentRendererType(GSRendererType type)
{
m_current_renderer_type = type;
}
GSRendererType GSdxApp::GetCurrentRendererType()
{
return m_current_renderer_type;
}

View File

@ -22,6 +22,7 @@
#pragma once
#include "GSSetting.h"
#include "GS.h"
class GSdxApp
{
@ -31,6 +32,7 @@ class GSdxApp
#if defined(__unix__)
std::map< std::string, std::string > m_configuration_map;
#endif
GSRendererType m_current_renderer_type;
public:
GSdxApp();
@ -60,6 +62,8 @@ public:
bool GetConfigB(const char* entry);
string GetConfigS(const char* entry);
void SetCurrentRendererType(GSRendererType type);
GSRendererType GetCurrentRendererType();
void SetConfigDir(const char* dir);