From 07e4b4f7c4079a8cef8f8e875ad281b508fc63e8 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 22 Sep 2015 03:25:37 +0300 Subject: [PATCH] VideoBackend: Video config filename is now exposed in VideoBackends. It reduces redundancy. Needed make possible to save current video config. --- Source/Core/VideoBackends/D3D/VideoBackend.h | 1 + Source/Core/VideoBackends/D3D/main.cpp | 9 +++++++-- Source/Core/VideoBackends/OGL/VideoBackend.h | 1 + Source/Core/VideoBackends/OGL/main.cpp | 9 +++++++-- Source/Core/VideoBackends/Software/SWmain.cpp | 9 +++++++-- Source/Core/VideoBackends/Software/VideoBackend.h | 1 + Source/Core/VideoCommon/VideoBackendBase.h | 1 + 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/VideoBackend.h b/Source/Core/VideoBackends/D3D/VideoBackend.h index 7ab12f7d9d..117b2ef8ef 100644 --- a/Source/Core/VideoBackends/D3D/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D/VideoBackend.h @@ -17,6 +17,7 @@ class VideoBackend : public VideoBackendHardware std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 66d23116fd..d2aca5bb93 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -64,6 +64,11 @@ std::string VideoBackend::GetDisplayName() const return "Direct3D"; } +std::string VideoBackend::GetConfigName() const +{ + return "gfx_dx11"; +} + void InitBackendInfo() { HRESULT hr = DX11::D3D::LoadDXGI(); @@ -148,7 +153,7 @@ void InitBackendInfo() void VideoBackend::ShowConfig(void *hParent) { InitBackendInfo(); - Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_dx11"); + Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); } bool VideoBackend::Initialize(void *window_handle) @@ -161,7 +166,7 @@ bool VideoBackend::Initialize(void *window_handle) frameCount = 0; - g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini"); + g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + GetConfigName() + ".ini"); g_Config.GameIniLoad(); g_Config.UpdateProjectionHack(); g_Config.VerifyValidity(); diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h index e42813c3cb..9226f3dbe9 100644 --- a/Source/Core/VideoBackends/OGL/VideoBackend.h +++ b/Source/Core/VideoBackends/OGL/VideoBackend.h @@ -17,6 +17,7 @@ class VideoBackend : public VideoBackendHardware std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 1b4ae331b6..be991a33a2 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -97,6 +97,11 @@ std::string VideoBackend::GetDisplayName() const return "OpenGL"; } +std::string VideoBackend::GetConfigName() const +{ + return "gfx_opengl"; +} + static std::vector GetShaders(const std::string &sub_dir = "") { std::vector paths = DoFileSearch({"*.glsl"}, { @@ -134,7 +139,7 @@ void VideoBackend::ShowConfig(void *_hParent) { if (!s_BackendInitialized) InitBackendInfo(); - Host_ShowVideoConfig(_hParent, GetDisplayName(), "gfx_opengl"); + Host_ShowVideoConfig(_hParent, GetDisplayName(), GetConfigName()); } bool VideoBackend::Initialize(void *window_handle) @@ -144,7 +149,7 @@ bool VideoBackend::Initialize(void *window_handle) frameCount = 0; - g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini"); + g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + GetConfigName() + ".ini"); g_Config.GameIniLoad(); g_Config.UpdateProjectionHack(); g_Config.VerifyValidity(); diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index 12713bcc4e..370a723ddb 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -67,14 +67,19 @@ std::string VideoSoftware::GetDisplayName() const return "Software Renderer"; } +std::string VideoSoftware::GetConfigName() const +{ + return "gfx_software"; +} + void VideoSoftware::ShowConfig(void *hParent) { - Host_ShowVideoConfig(hParent, GetDisplayName(), "gfx_software"); + Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName()); } bool VideoSoftware::Initialize(void *window_handle) { - g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); + g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + GetConfigName() + ".ini").c_str()); InitInterface(); GLInterface->SetMode(GLInterfaceMode::MODE_DETECT); diff --git a/Source/Core/VideoBackends/Software/VideoBackend.h b/Source/Core/VideoBackends/Software/VideoBackend.h index e34ae07f9a..6b4c79a5c7 100644 --- a/Source/Core/VideoBackends/Software/VideoBackend.h +++ b/Source/Core/VideoBackends/Software/VideoBackend.h @@ -19,6 +19,7 @@ class VideoSoftware : public VideoBackend std::string GetName() const override; std::string GetDisplayName() const override; + std::string GetConfigName() const override; void EmuStateChange(EMUSTATE_CHANGE newState) override; diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index f6cd1d12bf..8a8a48f1bd 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -72,6 +72,7 @@ public: virtual std::string GetName() const = 0; virtual std::string GetDisplayName() const { return GetName(); } + virtual std::string GetConfigName() const = 0; virtual void ShowConfig(void*) = 0;