mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Eliminated the plugin interface. Merged DX9/DX11/OGL video plugins into Dolphin. It could still use a lot of cleanup. Lots of things are still named "plugin". Software renderer is temporarily disabled until it gets some namespaces. I only updated vs08/10, Linux/OSX builds are broken.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6996 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -20,8 +20,7 @@
|
||||
|
||||
#include "TextureConverter.h"
|
||||
#include "Render.h"
|
||||
|
||||
|
||||
#include "HW/Memmap.h"
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
@ -272,7 +271,7 @@ GLuint FramebufferManager::GetEFBDepthTexture(const EFBRectangle& sourceRc)
|
||||
|
||||
void FramebufferManager::CopyToRealXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma)
|
||||
{
|
||||
u8* xfb_in_ram = Memory_GetPtr(xfbAddr);
|
||||
u8* xfb_in_ram = Memory::GetPointer(xfbAddr);
|
||||
if (!xfb_in_ram)
|
||||
{
|
||||
WARN_LOG(VIDEO, "Tried to copy to invalid XFB address");
|
||||
|
@ -19,6 +19,10 @@
|
||||
#include "VideoConfig.h"
|
||||
#include "IniFile.h"
|
||||
#include "Setup.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
#include "VideoBackend.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
#include "Render.h"
|
||||
#include "VertexShaderManager.h"
|
||||
@ -29,7 +33,6 @@
|
||||
#include "EmuWindow.h"
|
||||
static HDC hDC = NULL; // Private GDI Device Context
|
||||
static HGLRC hRC = NULL; // Permanent Rendering Context
|
||||
extern HINSTANCE g_hInstance;
|
||||
#else
|
||||
GLWindow GLWin;
|
||||
#endif
|
||||
@ -79,8 +82,16 @@ void OpenGL_SetWindowText(const char *text)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void*& VideoWindowHandle()
|
||||
{
|
||||
return SConfig::GetInstance().m_LocalCoreStartupParameter.hMainWindow;
|
||||
}
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
|
||||
// Draw messages on top of the screen
|
||||
unsigned int Callback_PeekMessages()
|
||||
unsigned int VideoBackend::PeekMessages()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// TODO: peekmessage
|
||||
@ -99,13 +110,15 @@ unsigned int Callback_PeekMessages()
|
||||
}
|
||||
|
||||
// Show the current FPS
|
||||
void UpdateFPSDisplay(const char *text)
|
||||
void VideoBackend::UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
char temp[100];
|
||||
snprintf(temp, sizeof temp, "%s | OpenGL | %s", svn_rev_str, text);
|
||||
OpenGL_SetWindowText(temp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
void XEventThread();
|
||||
|
||||
@ -291,7 +304,7 @@ void XEventThread()
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((unsigned long) event.xclient.data.l[0] == XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", False))
|
||||
g_VideoInitialize.pCoreMessage(WM_USER_STOP);
|
||||
Core::Callback_CoreMessage(WM_USER_STOP);
|
||||
if ((unsigned long) event.xclient.data.l[0] == XInternAtom(GLWin.evdpy, "RESIZE", False))
|
||||
XMoveResizeWindow(GLWin.evdpy, GLWin.win, event.xclient.data.l[1],
|
||||
event.xclient.data.l[2], event.xclient.data.l[3], event.xclient.data.l[4]);
|
||||
@ -307,20 +320,17 @@ void XEventThread()
|
||||
|
||||
// Create rendering window.
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
|
||||
bool OpenGL_Create(int _iwidth, int _iheight)
|
||||
{
|
||||
int _tx, _ty, _twidth, _theight;
|
||||
g_VideoInitialize.pGetWindowSize(_tx, _ty, _twidth, _theight);
|
||||
Core::Callback_VideoGetWindowSize(_tx, _ty, _twidth, _theight);
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = _twidth;
|
||||
s_backbuffer_height = _theight;
|
||||
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||
|
||||
#if defined(USE_WX) && USE_WX
|
||||
GLWin.panel = (wxPanel *)g_VideoInitialize.pWindowHandle;
|
||||
GLWin.panel = (wxPanel *)VideoWindowHandle();
|
||||
GLWin.glCanvas = new wxGLCanvas(GLWin.panel, wxID_ANY, NULL,
|
||||
wxPoint(0, 0), wxSize(_twidth, _theight));
|
||||
GLWin.glCanvas->Show(true);
|
||||
@ -333,7 +343,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
initWithAttributes: attr];
|
||||
if (fmt == nil) {
|
||||
printf("failed to create pixel format\n");
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GLWin.cocoaCtx = [[NSOpenGLContext alloc]
|
||||
@ -341,7 +351,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
[fmt release];
|
||||
if (GLWin.cocoaCtx == nil) {
|
||||
printf("failed to create context\n");
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GLWin.cocoaWin = [[NSWindow alloc]
|
||||
@ -353,10 +363,10 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
|
||||
|
||||
#elif defined(_WIN32)
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Please wait..."));
|
||||
if (g_VideoInitialize.pWindowHandle == NULL)
|
||||
VideoWindowHandle() = (void*)EmuWindow::Create((HWND)VideoWindowHandle(), GetModuleHandle(0), _T("Please wait..."));
|
||||
if (VideoWindowHandle() == NULL)
|
||||
{
|
||||
g_VideoInitialize.pSysMessage("failed to create window");
|
||||
Host_SysMessage("failed to create window");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -438,7 +448,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
|
||||
GLWin.dpy = XOpenDisplay(0);
|
||||
GLWin.evdpy = XOpenDisplay(0);
|
||||
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
||||
GLWin.parent = (Window)VideoWindowHandle();
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
if (GLWin.parent == 0)
|
||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||
@ -482,9 +492,9 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
GLWin.height = _theight;
|
||||
|
||||
CreateXWindow();
|
||||
g_VideoInitialize.pWindowHandle = (void *)GLWin.win;
|
||||
VideoWindowHandle() = (void *)GLWin.win;
|
||||
#endif
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OpenGL_MakeCurrent()
|
||||
@ -498,7 +508,7 @@ bool OpenGL_MakeCurrent()
|
||||
return wglMakeCurrent(hDC,hRC) ? true : false;
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
#if defined(HAVE_WX) && (HAVE_WX)
|
||||
g_VideoInitialize.pGetWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
|
||||
Core::Callback_VideoGetWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
|
||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y, GLWin.width, GLWin.height);
|
||||
#endif
|
||||
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "VideoConfig.h"
|
||||
#include "MathUtil.h"
|
||||
#include "Thread.h"
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define GLEW_STATIC
|
||||
@ -85,7 +84,7 @@ extern GLWindow GLWin;
|
||||
// Public OpenGL util
|
||||
|
||||
// Initialization / upkeep
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||
bool OpenGL_Create(int _width, int _height);
|
||||
void OpenGL_Shutdown();
|
||||
void OpenGL_Update();
|
||||
bool OpenGL_MakeCurrent();
|
||||
|
@ -22,9 +22,5 @@
|
||||
#include "VideoConfig.h"
|
||||
|
||||
#include "VideoCommon.h"
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
// A global plugin specification
|
||||
extern PLUGIN_GLOBALS* globals;
|
||||
|
||||
#endif // _GLOBALS_H_
|
||||
|
@ -324,7 +324,6 @@ void PixelShaderCache::DisableShader()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//bind a program if is diferent from the binded oone
|
||||
void PixelShaderCache::SetCurrentShader(GLuint Shader)
|
||||
{
|
||||
@ -341,22 +340,21 @@ void PixelShaderCache::SetCurrentShader(GLuint Shader)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OGL
|
||||
|
||||
|
||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
void Renderer::SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
float f[4] = { f1, f2, f3, f4 };
|
||||
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
|
||||
}
|
||||
|
||||
void SetPSConstant4fv(unsigned int const_number, const float *f)
|
||||
void Renderer::SetPSConstant4fv(unsigned int const_number, const float *f)
|
||||
{
|
||||
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
|
||||
}
|
||||
|
||||
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
void Renderer::SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
{
|
||||
for (unsigned int i = 0; i < count; i++,f+=4)
|
||||
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number + i, f);
|
||||
}
|
||||
|
||||
} // namespace OGL
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "FramebufferManager.h"
|
||||
#include "Fifo.h"
|
||||
#include "Debugger.h"
|
||||
#include "Core.h"
|
||||
|
||||
#include "main.h" // Local
|
||||
#ifdef _WIN32
|
||||
@ -962,7 +963,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
{
|
||||
if (g_bSkipCurrentFrame || (!XFBWrited && (!g_ActiveConfig.bUseXFB || !g_ActiveConfig.bUseRealXFB)) || !fbWidth || !fbHeight)
|
||||
{
|
||||
g_VideoInitialize.pCopiedToXFB(false);
|
||||
Core::Callback_VideoCopiedToXFB(false);
|
||||
return;
|
||||
}
|
||||
// this function is called after the XFB field is changed, not after
|
||||
@ -974,7 +975,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
const XFBSourceBase* const* xfbSourceList = FramebufferManager::GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount);
|
||||
if ((!xfbSourceList || xfbCount == 0) && g_ActiveConfig.bUseXFB && !g_ActiveConfig.bUseRealXFB)
|
||||
{
|
||||
g_VideoInitialize.pCopiedToXFB(false);
|
||||
Core::Callback_VideoCopiedToXFB(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1365,7 +1366,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
// Renderer::SetZBufferRender();
|
||||
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget,
|
||||
// GetTargetWidth(), GetTargetHeight());
|
||||
g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
|
||||
Core::Callback_VideoCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
|
||||
XFBWrited = false;
|
||||
}
|
||||
|
||||
@ -1485,6 +1486,9 @@ void Renderer::FlipImageData(u8 *data, int w, int h)
|
||||
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
extern bool g_aspect_wide;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
void TakeScreenshot(ScrStrct* threadStruct)
|
||||
{
|
||||
@ -1495,7 +1499,7 @@ void TakeScreenshot(ScrStrct* threadStruct)
|
||||
// Handle aspect ratio for the final ScrStrct to look exactly like what's on screen.
|
||||
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH)
|
||||
{
|
||||
bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9;
|
||||
bool use16_9 = g_aspect_wide;
|
||||
|
||||
// Check for force-settings and override.
|
||||
if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9)
|
||||
@ -1589,7 +1593,7 @@ void Renderer::SetWindowSize(int width, int height)
|
||||
// Scale the window size by the EFB scale.
|
||||
CalculateTargetScale(width, height, width, height);
|
||||
|
||||
g_VideoInitialize.pRequestWindowSize(width, height);
|
||||
Core::Callback_VideoRequestWindowSize(width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,15 @@ public:
|
||||
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
||||
|
||||
void SetWindowSize(int width, int height);
|
||||
|
||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
||||
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
||||
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f);
|
||||
|
||||
void SetVSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
||||
void SetVSConstant4fv(unsigned int const_number, const float *f);
|
||||
void SetMultiVSConstant3fv(unsigned int const_number, unsigned int count, const float *f);
|
||||
void SetMultiVSConstant4fv(unsigned int const_number, unsigned int count, const float *f);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
// Fast image conversion using OpenGL shaders.
|
||||
// This kind of stuff would be a LOT nicer with OpenCL.
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "TextureConverter.h"
|
||||
#include "TextureConversionShader.h"
|
||||
#include "TextureCache.h"
|
||||
@ -28,8 +30,8 @@
|
||||
#include "VideoConfig.h"
|
||||
#include "ImageWrite.h"
|
||||
#include "Render.h"
|
||||
#include <math.h>
|
||||
#include "FileUtil.h"
|
||||
#include "HW/Memmap.h"
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
@ -265,7 +267,7 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf
|
||||
if (texconv_shader.glprogid == 0)
|
||||
return;
|
||||
|
||||
u8 *dest_ptr = Memory_GetPtr(address);
|
||||
u8 *dest_ptr = Memory::GetPointer(address);
|
||||
|
||||
GLuint source_texture = bFromZBuffer ? FramebufferManager::ResolveAndGetDepthTarget(source) : FramebufferManager::ResolveAndGetRenderTarget(source);
|
||||
|
||||
@ -336,7 +338,7 @@ u64 EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
|
||||
if (texconv_shader.glprogid == 0)
|
||||
return 0;
|
||||
|
||||
u8 *dest_ptr = Memory_GetPtr(address);
|
||||
u8 *dest_ptr = Memory::GetPointer(address);
|
||||
|
||||
int width = (source.right - source.left) >> bScaleByHalf;
|
||||
int height = (source.bottom - source.top) >> bScaleByHalf;
|
||||
@ -405,7 +407,7 @@ void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* des
|
||||
// Should be scale free.
|
||||
void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTexture)
|
||||
{
|
||||
u8* srcAddr = Memory_GetPtr(xfbAddr);
|
||||
u8* srcAddr = Memory::GetPointer(xfbAddr);
|
||||
if (!srcAddr)
|
||||
{
|
||||
WARN_LOG(VIDEO, "Tried to decode from invalid memory address");
|
||||
|
@ -210,19 +210,17 @@ void VertexShaderCache::SetCurrentShader(GLuint Shader)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OGL
|
||||
|
||||
void SetVSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
void Renderer::SetVSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, const_number, f1, f2, f3, f4);
|
||||
}
|
||||
|
||||
void SetVSConstant4fv(unsigned int const_number, const float *f)
|
||||
void Renderer::SetVSConstant4fv(unsigned int const_number, const float *f)
|
||||
{
|
||||
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, const_number, f);
|
||||
}
|
||||
|
||||
void SetMultiVSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
void Renderer::SetMultiVSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
{
|
||||
if(GLEW_EXT_gpu_program_parameters)
|
||||
{
|
||||
@ -235,7 +233,7 @@ void SetMultiVSConstant4fv(unsigned int const_number, unsigned int count, const
|
||||
}
|
||||
}
|
||||
|
||||
void SetMultiVSConstant3fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
void Renderer::SetMultiVSConstant3fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
{
|
||||
if(GLEW_EXT_gpu_program_parameters)
|
||||
{
|
||||
@ -262,3 +260,5 @@ void SetMultiVSConstant3fv(unsigned int const_number, unsigned int count, const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OGL
|
||||
|
27
Source/Plugins/Plugin_VideoOGL/Src/VideoBackend.h
Normal file
27
Source/Plugins/Plugin_VideoOGL/Src/VideoBackend.h
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
#ifndef OGL_VIDEO_BACKEND_H_
|
||||
#define OGL_VIDEO_BACKEND_H_
|
||||
|
||||
#include "VideoBackendBase.h"
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
|
||||
class VideoBackend : public VideoBackendHLE
|
||||
{
|
||||
void Initialize();
|
||||
void Shutdown();
|
||||
|
||||
std::string GetName();
|
||||
|
||||
void Video_Prepare();
|
||||
|
||||
void ShowConfig(void* parent);
|
||||
|
||||
void UpdateFPSDisplay(const char*);
|
||||
unsigned int PeekMessages();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -92,109 +92,21 @@ Make AA apply instantly during gameplay if possible
|
||||
#include "Setup.h"
|
||||
#include "DLCache.h"
|
||||
#include "FramebufferManager.h"
|
||||
#include "Core.h"
|
||||
|
||||
#include "VideoState.h"
|
||||
#include "VideoBackend.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
// Logging
|
||||
int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
|
||||
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
wxLocale *InitLanguageSupport()
|
||||
namespace OGL
|
||||
{
|
||||
wxLocale *m_locale;
|
||||
unsigned int language = 0;
|
||||
|
||||
IniFile ini;
|
||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
ini.Get("Interface", "Language", &language, wxLANGUAGE_DEFAULT);
|
||||
|
||||
// Load language if possible, fall back to system default otherwise
|
||||
if(wxLocale::IsAvailable(language))
|
||||
{
|
||||
m_locale = new wxLocale(language);
|
||||
|
||||
m_locale->AddCatalogLookupPathPrefix(wxT("Languages"));
|
||||
|
||||
m_locale->AddCatalog(wxT("dolphin-emu"));
|
||||
|
||||
if(!m_locale->IsOk())
|
||||
{
|
||||
PanicAlertT("Error loading selected language. Falling back to system default.");
|
||||
delete m_locale;
|
||||
m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlertT("The selected language is not supported by your system. Falling back to system default.");
|
||||
m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
|
||||
}
|
||||
return m_locale;
|
||||
}
|
||||
|
||||
class wxDLLApp : public wxApp
|
||||
std::string VideoBackend::GetName()
|
||||
{
|
||||
bool OnInit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
// ------------------
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
|
||||
{
|
||||
static wxLocale *m_locale;
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
wxSetInstance((HINSTANCE)hinstDLL);
|
||||
wxInitialize();
|
||||
m_locale = InitLanguageSupport();
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
wxUninitialize();
|
||||
delete m_locale;
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)");
|
||||
#elif defined _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin OpenGL (Debug)");
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, _trans("Dolphin OpenGL"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
||||
{
|
||||
globals = _pPluginGlobals;
|
||||
LogManager::SetInstance((LogManager*)globals->logManager);
|
||||
}
|
||||
|
||||
void *DllDebugger(void *_hParent, bool Show)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
return new GFXDebuggerPanel((wxWindow *)_hParent);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
return "OpenGL";
|
||||
}
|
||||
|
||||
void GetShaders(std::vector<std::string> &shaders)
|
||||
@ -231,7 +143,7 @@ void InitBackendInfo()
|
||||
g_Config.backend_info.bSupportsPixelLighting = true;
|
||||
}
|
||||
|
||||
void DllConfig(void *_hParent)
|
||||
void VideoBackend::ShowConfig(void *_hParent)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
InitBackendInfo();
|
||||
@ -249,18 +161,15 @@ void DllConfig(void *_hParent)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Initialize(void *init)
|
||||
void VideoBackend::Initialize()
|
||||
{
|
||||
InitBackendInfo();
|
||||
|
||||
frameCount = 0;
|
||||
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
|
||||
// Create a shortcut to _pVideoInitialize that can also update it
|
||||
g_VideoInitialize = *(_pVideoInitialize);
|
||||
InitXFBConvTables();
|
||||
|
||||
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
|
||||
g_Config.GameIniLoad(globals->game_ini);
|
||||
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
|
||||
|
||||
g_Config.UpdateProjectionHack();
|
||||
#if defined _WIN32
|
||||
@ -269,25 +178,20 @@ void Initialize(void *init)
|
||||
#endif
|
||||
UpdateActiveConfig();
|
||||
|
||||
if (!OpenGL_Create(g_VideoInitialize, 640, 480))
|
||||
if (!OpenGL_Create(640, 480))
|
||||
{
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
||||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||
|
||||
// Now the window handle is written
|
||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||
|
||||
OSD::AddMessage("Dolphin OpenGL Video Plugin.", 5000);
|
||||
s_PluginInitialized = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// This is called after Initialize() from the Core
|
||||
// Run from the graphics thread
|
||||
void Video_Prepare()
|
||||
void VideoBackend::Video_Prepare()
|
||||
{
|
||||
OpenGL_MakeCurrent();
|
||||
//if (!Renderer::Init()) {
|
||||
@ -296,7 +200,7 @@ void Video_Prepare()
|
||||
// exit(1);
|
||||
//}
|
||||
|
||||
g_renderer = new OGL::Renderer;
|
||||
g_renderer = new Renderer;
|
||||
|
||||
s_efbAccessRequested = FALSE;
|
||||
s_FifoShuttingDown = FALSE;
|
||||
@ -305,31 +209,31 @@ void Video_Prepare()
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
|
||||
g_texture_cache = new OGL::TextureCache;
|
||||
g_texture_cache = new TextureCache;
|
||||
|
||||
BPInit();
|
||||
g_vertex_manager = new OGL::VertexManager;
|
||||
g_vertex_manager = new VertexManager;
|
||||
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
||||
OpcodeDecoder_Init();
|
||||
OGL::VertexShaderCache::Init();
|
||||
VertexShaderCache::Init();
|
||||
VertexShaderManager::Init();
|
||||
OGL::PixelShaderCache::Init();
|
||||
PixelShaderCache::Init();
|
||||
PixelShaderManager::Init();
|
||||
OGL::PostProcessing::Init();
|
||||
PostProcessing::Init();
|
||||
GL_REPORT_ERRORD();
|
||||
VertexLoaderManager::Init();
|
||||
OGL::TextureConverter::Init();
|
||||
TextureConverter::Init();
|
||||
DLCache::Init();
|
||||
|
||||
// Notify the core that the video plugin is ready
|
||||
g_VideoInitialize.pCoreMessage(WM_USER_CREATE);
|
||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
||||
|
||||
s_PluginInitialized = true;
|
||||
INFO_LOG(VIDEO, "Video plugin initialized.");
|
||||
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
void VideoBackend::Shutdown()
|
||||
{
|
||||
s_PluginInitialized = false;
|
||||
|
||||
@ -354,3 +258,5 @@ void Shutdown()
|
||||
delete g_renderer;
|
||||
OpenGL_Shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,9 +18,6 @@
|
||||
#ifndef _MAIN_H_
|
||||
#define _MAIN_H_
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
#include "MainBase.h"
|
||||
|
||||
extern SVideoInitialize g_VideoInitialize;
|
||||
|
||||
#endif // _MAIN_H_
|
||||
|
Reference in New Issue
Block a user