VideoBackends: Merge ShowConfig functions.

This commit is contained in:
degasus 2016-01-13 21:38:11 +01:00
parent 7833ff25df
commit 5f2f462067
12 changed files with 21 additions and 44 deletions

View File

@ -21,7 +21,7 @@ class VideoBackend : public VideoBackendBase
void Video_Prepare() override;
void Video_Cleanup() override;
void ShowConfig(void* parent) override;
void InitBackendInfo() override;
unsigned int PeekMessages() override;

View File

@ -66,7 +66,7 @@ std::string VideoBackend::GetConfigName() const
return "gfx_dx11";
}
void InitBackendInfo()
void VideoBackend::InitBackendInfo()
{
HRESULT hr = DX11::D3D::LoadDXGI();
if (SUCCEEDED(hr))
@ -143,12 +143,6 @@ void InitBackendInfo()
DX11::D3D::UnloadD3D();
}
void VideoBackend::ShowConfig(void* hParent)
{
InitBackendInfo();
Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName());
}
bool VideoBackend::Initialize(void* window_handle)
{
if (window_handle == nullptr)

View File

@ -21,7 +21,7 @@ class VideoBackend : public VideoBackendBase
void Video_Prepare() override;
void Video_Cleanup() override;
void ShowConfig(void* parent) override;
void InitBackendInfo() override;
unsigned int PeekMessages() override;

View File

@ -67,7 +67,7 @@ std::string VideoBackend::GetConfigName() const
return "gfx_dx12";
}
void InitBackendInfo()
void VideoBackend::InitBackendInfo()
{
HRESULT hr = D3D::LoadDXGI();
if (FAILED(hr))
@ -157,12 +157,6 @@ void InitBackendInfo()
D3D::UnloadDXGI();
}
void VideoBackend::ShowConfig(void* hParent)
{
InitBackendInfo();
Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName());
}
bool VideoBackend::Initialize(void* window_handle)
{
if (window_handle == nullptr)

View File

@ -32,7 +32,7 @@
namespace Null
{
static void InitBackendInfo()
void VideoBackend::InitBackendInfo()
{
g_Config.backend_info.APIType = API_NONE;
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
@ -50,12 +50,6 @@ static void InitBackendInfo()
g_Config.backend_info.AAModes = {1};
}
void VideoBackend::ShowConfig(void* parent)
{
InitBackendInfo();
Host_ShowVideoConfig(parent, GetDisplayName(), GetConfigName());
}
bool VideoBackend::Initialize(void* window_handle)
{
InitializeShared();

View File

@ -19,7 +19,7 @@ class VideoBackend : public VideoBackendBase
void Video_Prepare() override;
void Video_Cleanup() override;
void ShowConfig(void* parent) override;
void InitBackendInfo() override;
unsigned int PeekMessages() override { return 0; }
};

View File

@ -21,7 +21,7 @@ class VideoBackend : public VideoBackendBase
void Video_Prepare() override;
void Video_Cleanup() override;
void ShowConfig(void* parent) override;
void InitBackendInfo() override;
unsigned int PeekMessages() override;
};

View File

@ -111,7 +111,7 @@ static std::vector<std::string> GetShaders(const std::string& sub_dir = "")
return result;
}
static void InitBackendInfo()
void VideoBackend::InitBackendInfo()
{
g_Config.backend_info.APIType = API_OPENGL;
g_Config.backend_info.bSupportsExclusiveFullscreen = false;
@ -137,14 +137,6 @@ static void InitBackendInfo()
g_Config.backend_info.AnaglyphShaders = GetShaders(ANAGLYPH_DIR DIR_SEP);
}
void VideoBackend::ShowConfig(void* parent_handle)
{
if (!m_initialized)
InitBackendInfo();
Host_ShowVideoConfig(parent_handle, GetDisplayName(), GetConfigName());
}
bool VideoBackend::Initialize(void* window_handle)
{
InitBackendInfo();

View File

@ -139,7 +139,7 @@ std::string VideoSoftware::GetConfigName() const
return "gfx_software";
}
static void InitBackendInfo()
void VideoSoftware::InitBackendInfo()
{
g_Config.backend_info.APIType = API_NONE;
g_Config.backend_info.bSupports3DVision = false;
@ -152,13 +152,6 @@ static void InitBackendInfo()
g_Config.backend_info.AAModes = {1};
}
void VideoSoftware::ShowConfig(void* hParent)
{
if (!m_initialized)
InitBackendInfo();
Host_ShowVideoConfig(hParent, GetDisplayName(), GetConfigName());
}
bool VideoSoftware::Initialize(void* window_handle)
{
InitBackendInfo();

View File

@ -26,7 +26,7 @@ class VideoSoftware : public VideoBackendBase
void Video_Prepare() override;
void Video_Cleanup() override;
void ShowConfig(void* parent) override;
void InitBackendInfo() override;
unsigned int PeekMessages() override;
};

View File

@ -9,6 +9,7 @@
#include "Common/Event.h"
#include "Common/Flag.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
#include "Core/Host.h"
#include "VideoCommon/AsyncRequests.h"
#include "VideoCommon/BPStructs.h"
@ -157,6 +158,14 @@ u16 VideoBackendBase::Video_GetBoundingBox(int index)
return result;
}
void VideoBackendBase::ShowConfig(void* parent_handle)
{
if (!m_initialized)
InitBackendInfo();
Host_ShowVideoConfig(parent_handle, GetDisplayName(), GetConfigName());
}
void VideoBackendBase::InitializeShared()
{
memset(&g_main_cp_state, 0, sizeof(g_main_cp_state));

View File

@ -75,7 +75,8 @@ public:
virtual std::string GetDisplayName() const { return GetName(); }
virtual std::string GetConfigName() const = 0;
virtual void ShowConfig(void*) = 0;
void ShowConfig(void*);
virtual void InitBackendInfo() = 0;
virtual void Video_Prepare() = 0;
void Video_ExitLoop();