diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h
index 2d2587138e..c2cbf0b92b 100644
--- a/Source/Core/Core/Host.h
+++ b/Source/Core/Core/Host.h
@@ -42,6 +42,8 @@ void Host_UpdateLogDisplay();
void Host_UpdateMainFrame();
void Host_UpdateStatusBar(const std::string& text, int Filed = 0);
void Host_UpdateTitle(const std::string& title);
+void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
+ const std::string& config_name);
// TODO (neobrain): Remove these from host!
void* Host_GetInstance();
diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt
index 685f2d30c4..6d044d3279 100644
--- a/Source/Core/DolphinWX/CMakeLists.txt
+++ b/Source/Core/DolphinWX/CMakeLists.txt
@@ -123,6 +123,7 @@ else()
endif()
endif()
+set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
if(WIN32)
set(SRCS ${SRCS} stdafx.cpp)
diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj b/Source/Core/DolphinWX/DolphinWX.vcxproj
index b56308c6a4..a2ffefb6e0 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcxproj
+++ b/Source/Core/DolphinWX/DolphinWX.vcxproj
@@ -74,6 +74,7 @@
+
@@ -125,7 +126,6 @@
-
diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj.filters b/Source/Core/DolphinWX/DolphinWX.vcxproj.filters
index 19ddf71a1b..ec98fb5e26 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcxproj.filters
+++ b/Source/Core/DolphinWX/DolphinWX.vcxproj.filters
@@ -27,6 +27,7 @@
+
@@ -155,7 +156,6 @@
-
diff --git a/Source/Core/DolphinWX/GLInterface/AGL.h b/Source/Core/DolphinWX/GLInterface/AGL.h
index 8f75df51cd..490691338d 100644
--- a/Source/Core/DolphinWX/GLInterface/AGL.h
+++ b/Source/Core/DolphinWX/GLInterface/AGL.h
@@ -8,7 +8,7 @@
#import
#endif
-#include "DolphinWX/GLInterface/InterfaceBase.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
class cInterfaceAGL : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/GLInterface/EGL.h b/Source/Core/DolphinWX/GLInterface/EGL.h
index c525b4d7a7..e2994f3b96 100644
--- a/Source/Core/DolphinWX/GLInterface/EGL.h
+++ b/Source/Core/DolphinWX/GLInterface/EGL.h
@@ -8,7 +8,7 @@
#include
#include "Core/ConfigManager.h"
-#include "DolphinWX/GLInterface/InterfaceBase.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
class cPlatform
diff --git a/Source/Core/DolphinWX/GLInterface/GLInterface.cpp b/Source/Core/DolphinWX/GLInterface/GLInterface.cpp
new file mode 100644
index 0000000000..bb9ce669e2
--- /dev/null
+++ b/Source/Core/DolphinWX/GLInterface/GLInterface.cpp
@@ -0,0 +1,23 @@
+// Copyright 2014 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
+
+GLWindow GLWin;
+
+cInterfaceBase* HostGL_CreateGLInterface()
+{
+ #if defined(USE_EGL) && USE_EGL
+ return new cInterfaceEGL;
+ #elif defined(__APPLE__)
+ return new cInterfaceAGL;
+ #elif defined(_WIN32)
+ return new cInterfaceWGL;
+ #elif defined(HAVE_X11) && HAVE_X11
+ return new cInterfaceGLX;
+ #else
+ return nullptr;
+ #endif
+}
diff --git a/Source/Core/DolphinWX/GLInterface/GLInterface.h b/Source/Core/DolphinWX/GLInterface/GLInterface.h
index edd7d93665..26c92f53d4 100644
--- a/Source/Core/DolphinWX/GLInterface/GLInterface.h
+++ b/Source/Core/DolphinWX/GLInterface/GLInterface.h
@@ -108,5 +108,4 @@ typedef struct {
unsigned int width, height;
} GLWindow;
-extern cInterfaceBase *GLInterface;
extern GLWindow GLWin;
diff --git a/Source/Core/DolphinWX/GLInterface/GLX.h b/Source/Core/DolphinWX/GLInterface/GLX.h
index ca64e62b48..1ded9ec331 100644
--- a/Source/Core/DolphinWX/GLInterface/GLX.h
+++ b/Source/Core/DolphinWX/GLInterface/GLX.h
@@ -6,8 +6,8 @@
#include
-#include "DolphinWX/GLInterface/InterfaceBase.h"
#include "DolphinWX/GLInterface/X11_Util.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
class cInterfaceGLX : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/GLInterface/WGL.h b/Source/Core/DolphinWX/GLInterface/WGL.h
index 7a0d3ff20d..529168b578 100644
--- a/Source/Core/DolphinWX/GLInterface/WGL.h
+++ b/Source/Core/DolphinWX/GLInterface/WGL.h
@@ -5,7 +5,7 @@
#pragma once
#include
-#include "DolphinWX/GLInterface/InterfaceBase.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
class cInterfaceWGL : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp
index 18a693fb82..a49cb2fed3 100644
--- a/Source/Core/DolphinWX/Main.cpp
+++ b/Source/Core/DolphinWX/Main.cpp
@@ -46,6 +46,7 @@
#include "DolphinWX/Frame.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/Main.h"
+#include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/CodeWindow.h"
#include "DolphinWX/Debugger/JitWindow.h"
@@ -699,3 +700,11 @@ void Host_ConnectWiimote(int wm_idx, bool connect)
{
CFrame::ConnectWiimote(wm_idx, connect);
}
+
+void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
+ const std::string& config_name)
+{
+ VideoConfigDiag diag((wxWindow*)parent, WxStrToStr(backend_name),
+ WxStrToStr(config_name));
+ diag.ShowModal();
+}
diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp
index fccd2d3d92..68ae7fa0ee 100644
--- a/Source/Core/DolphinWX/MainAndroid.cpp
+++ b/Source/Core/DolphinWX/MainAndroid.cpp
@@ -127,6 +127,8 @@ void Host_SysMessage(const char *fmt, ...)
void Host_SetWiiMoteConnectionState(int _State) {}
+void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
+
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
std::vector m_volume_names;
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp
index df9276bb59..91986dacd3 100644
--- a/Source/Core/DolphinWX/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/MainNoGUI.cpp
@@ -17,6 +17,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreParameter.h"
+#include "Core/Host.h"
#include "Core/HW/Wiimote.h"
#include "Core/PowerPC/PowerPC.h"
@@ -135,6 +136,8 @@ void Host_SysMessage(const char *fmt, ...)
void Host_SetWiiMoteConnectionState(int _State) {}
+void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
+
#if HAVE_X11
void X11_MainLoop()
{
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp
index 37d7fb8bbd..997fc5a1c5 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.cpp
+++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp
@@ -31,6 +31,7 @@
#include "DolphinWX/Main.h"
#include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h"
+#include "VideoBackends/OGL/main.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index a2534b56a1..fc797ebdec 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -5,10 +5,6 @@
#include "Common/Thread.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
-#if USE_EGL
-#include "DolphinWX/GLInterface/GLInterface.h"
-#endif
-
#ifdef CIFACE_USE_XINPUT
#include "InputCommon/ControllerInterface/XInput/XInput.h"
#endif
@@ -57,16 +53,10 @@ void ControllerInterface::Initialize()
ciface::XInput::Init(m_devices);
#endif
#ifdef CIFACE_USE_XLIB
-#if USE_EGL
-if (GLWin.platform == EGL_PLATFORM_X11) {
-#endif
ciface::Xlib::Init(m_devices, m_hwnd);
#ifdef CIFACE_USE_X11_XINPUT2
ciface::XInput2::Init(m_devices, m_hwnd);
#endif
-#if USE_EGL
-}
-#endif
#endif
#ifdef CIFACE_USE_OSX
ciface::OSX::Init(m_devices, m_hwnd);
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp
index 7b70871ccb..f81f277a36 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.cpp
@@ -6,6 +6,7 @@
#include
#include "Common/Logging/Log.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#if defined(__linux__) || defined(__APPLE__)
diff --git a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h
index cb52c6ba53..b7cacd7650 100644
--- a/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h
+++ b/Source/Core/VideoBackends/OGL/GLExtensions/GLExtensions.h
@@ -4,8 +4,6 @@
#include
-#include "DolphinWX/GLInterface/GLInterface.h"
-
#include "VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h"
#include "VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h"
#include "VideoBackends/OGL/GLExtensions/ARB_debug_output.h"
diff --git a/Source/Core/DolphinWX/GLInterface/InterfaceBase.h b/Source/Core/VideoBackends/OGL/GLInterfaceBase.h
similarity index 83%
rename from Source/Core/DolphinWX/GLInterface/InterfaceBase.h
rename to Source/Core/VideoBackends/OGL/GLInterfaceBase.h
index c709e52bf5..bfddeb0c70 100644
--- a/Source/Core/DolphinWX/GLInterface/InterfaceBase.h
+++ b/Source/Core/VideoBackends/OGL/GLInterfaceBase.h
@@ -41,3 +41,9 @@ public:
virtual void Update() { }
virtual bool PeekMessages() { return false; }
};
+
+extern cInterfaceBase *GLInterface;
+
+// This function has to be defined along the Host_ functions from Core/Host.h.
+// Current canonical implementation: DolphinWX/GLInterface/GLInterface.cpp.
+cInterfaceBase* HostGL_CreateGLInterface();
diff --git a/Source/Core/VideoBackends/OGL/GLUtil.cpp b/Source/Core/VideoBackends/OGL/GLUtil.cpp
index 97d4378239..ac3894e42d 100644
--- a/Source/Core/VideoBackends/OGL/GLUtil.cpp
+++ b/Source/Core/VideoBackends/OGL/GLUtil.cpp
@@ -8,13 +8,13 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/Render.h"
#include "VideoBackends/OGL/VideoBackend.h"
#include "VideoCommon/VideoConfig.h"
-GLWindow GLWin;
cInterfaceBase *GLInterface;
namespace OGL
@@ -35,15 +35,7 @@ void VideoBackend::UpdateFPSDisplay(const std::string& text)
}
void InitInterface()
{
- #if defined(USE_EGL) && USE_EGL
- GLInterface = new cInterfaceEGL;
- #elif defined(__APPLE__)
- GLInterface = new cInterfaceAGL;
- #elif defined(_WIN32)
- GLInterface = new cInterfaceWGL;
- #elif defined(HAVE_X11) && HAVE_X11
- GLInterface = new cInterfaceGLX;
- #endif
+ GLInterface = HostGL_CreateGLInterface();
}
GLuint OpenGL_CompileProgram(const char* vertexShader, const char* fragmentShader)
diff --git a/Source/Core/VideoBackends/OGL/GLUtil.h b/Source/Core/VideoBackends/OGL/GLUtil.h
index a46e381586..16c91baa65 100644
--- a/Source/Core/VideoBackends/OGL/GLUtil.h
+++ b/Source/Core/VideoBackends/OGL/GLUtil.h
@@ -5,7 +5,6 @@
#pragma once
#include "Common/MathUtil.h"
-#include "DolphinWX/GLInterface/GLInterface.h"
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#include "VideoCommon/VideoConfig.h"
diff --git a/Source/Core/VideoBackends/OGL/PerfQuery.cpp b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
index 8e2de6dd4e..178ef7108e 100644
--- a/Source/Core/VideoBackends/OGL/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include "DolphinWX/GLInterface/GLInterface.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/PerfQuery.h"
#include "VideoCommon/RenderBase.h"
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index c9b373918b..a3bba96fd1 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -20,6 +20,7 @@
#include "Core/Movie.h"
#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/main.h"
#include "VideoBackends/OGL/PostProcessing.h"
@@ -1459,7 +1460,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
if (!bLastFrameDumped)
{
#ifdef _WIN32
- bAVIDumping = AVIDump::Start((HWND)((cInterfaceWGL*)GLInterface)->m_window_handle, w, h);
+ bAVIDumping = AVIDump::Start(nullptr, w, h);
#else
bAVIDumping = AVIDump::Start(w, h);
#endif
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
index c9bf699843..2b422e1f55 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/SamplerCache.h"
#include "VideoCommon/DriverDetails.h"
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp
index 145bc0086e..9837795ce6 100644
--- a/Source/Core/VideoBackends/OGL/TextureCache.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp
@@ -19,6 +19,7 @@
#include "Core/HW/Memmap.h"
#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoBackends/OGL/Render.h"
#include "VideoBackends/OGL/TextureCache.h"
diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp
index 8ee6471019..aa042c3405 100644
--- a/Source/Core/VideoBackends/OGL/main.cpp
+++ b/Source/Core/VideoBackends/OGL/main.cpp
@@ -49,6 +49,7 @@ Make AA apply instantly during gameplay if possible
#include "Core/Host.h"
#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/PerfQuery.h"
#include "VideoBackends/OGL/PostProcessing.h"
@@ -82,11 +83,6 @@ Make AA apply instantly during gameplay if possible
#include "Common/IniFile.h"
#endif
-#if defined(HAVE_WX) && HAVE_WX
-#include "DolphinWX/VideoConfigDiag.h"
-#include "DolphinWX/Debugger/DebuggerPanel.h"
-#endif // HAVE_WX
-
namespace OGL
{
@@ -160,11 +156,8 @@ static void InitBackendInfo()
void VideoBackend::ShowConfig(void *_hParent)
{
-#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo();
- VideoConfigDiag diag((wxWindow*)_hParent, "OpenGL", "gfx_opengl");
- diag.ShowModal();
-#endif
+ Host_ShowVideoConfig(_hParent, "OpenGL", "gfx_opengl");
}
bool VideoBackend::Initialize(void *&window_handle)
diff --git a/Source/Core/VideoBackends/OGL/main.h b/Source/Core/VideoBackends/OGL/main.h
index 0866e823a7..82edcab740 100644
--- a/Source/Core/VideoBackends/OGL/main.h
+++ b/Source/Core/VideoBackends/OGL/main.h
@@ -4,4 +4,6 @@
#pragma once
+#include
+
#include "VideoCommon/MainBase.h"
diff --git a/Source/Core/VideoBackends/Software/EfbCopy.cpp b/Source/Core/VideoBackends/Software/EfbCopy.cpp
index 479cc35ddc..5c4e1e24c3 100644
--- a/Source/Core/VideoBackends/Software/EfbCopy.cpp
+++ b/Source/Core/VideoBackends/Software/EfbCopy.cpp
@@ -4,6 +4,7 @@
#include "Core/Core.h"
#include "Core/HW/Memmap.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/Software/BPMemLoader.h"
#include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/EfbCopy.h"
diff --git a/Source/Core/VideoBackends/Software/HwRasterizer.cpp b/Source/Core/VideoBackends/Software/HwRasterizer.cpp
index 5645c26bf9..05460da312 100644
--- a/Source/Core/VideoBackends/Software/HwRasterizer.cpp
+++ b/Source/Core/VideoBackends/Software/HwRasterizer.cpp
@@ -5,6 +5,7 @@
#include "Common/Common.h"
#include "Common/MemoryUtil.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/Software/BPMemLoader.h"
#include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/HwRasterizer.h"
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp
index f94fad595a..c94e19a31f 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.cpp
+++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp
@@ -8,6 +8,7 @@
#include "Common/Common.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/Software/RasterFont.h"
#include "VideoBackends/Software/SWCommandProcessor.h"
diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp
index c4a6d2f0c8..7a0e88011f 100644
--- a/Source/Core/VideoBackends/Software/SWmain.cpp
+++ b/Source/Core/VideoBackends/Software/SWmain.cpp
@@ -12,9 +12,11 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
+#include "Core/Host.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/VideoInterface.h"
+#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#include "VideoBackends/Software/BPMemLoader.h"
#include "VideoBackends/Software/Clipper.h"
@@ -65,10 +67,7 @@ std::string VideoSoftware::GetName() const
void VideoSoftware::ShowConfig(void *_hParent)
{
-#if defined(HAVE_WX) && HAVE_WX
- VideoConfigDialog diag((wxWindow*)_hParent, "Software", "gfx_software");
- diag.ShowModal();
-#endif
+ Host_ShowVideoConfig(_hParent, "Software", "gfx_software");
}
bool VideoSoftware::Initialize(void *&window_handle)