From 787fdbbdc05dc2fda7423db9d610c18761fb1ad2 Mon Sep 17 00:00:00 2001 From: nakeee Date: Mon, 12 Oct 2009 20:33:01 +0000 Subject: [PATCH] SW plugin: compile on linux git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4413 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 1 - .../Plugin_VideoSoftware/Src/GLUtil.cpp | 127 ++++-------------- .../Plugin_VideoSoftware/Src/PixelEngine.cpp | 2 +- .../Plugin_VideoSoftware/Src/SConscript | 5 - 4 files changed, 25 insertions(+), 110 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 839594771c..a9079746fb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -59,7 +59,6 @@ void OpenGL_SwapBuffers() cocoaGLSwap(GLWin.cocoaCtx,GLWin.cocoaWin); #elif defined(_WIN32) SwapBuffers(hDC); - #elif defined(HAVE_X11) && HAVE_X11 glXSwapBuffers(GLWin.dpy, GLWin.win); #endif diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp index ab5b2e0879..cdb87fdabd 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp @@ -53,14 +53,12 @@ extern HINSTANCE g_hInstance; void OpenGL_SwapBuffers() { -#if USE_SDL - SDL_GL_SwapBuffers(); +#if defined(USE_WX) && USE_WX + GLWin.glCanvas->SwapBuffers(); #elif defined(HAVE_COCOA) && HAVE_COCOA cocoaGLSwap(GLWin.cocoaCtx,GLWin.cocoaWin); #elif defined(_WIN32) SwapBuffers(hDC); -#elif defined(USE_WX) && USE_WX - GLWin.glCanvas->SwapBuffers(); #elif defined(HAVE_X11) && HAVE_X11 glXSwapBuffers(GLWin.dpy, GLWin.win); #endif @@ -78,15 +76,13 @@ u32 OpenGL_GetBackbufferHeight() void OpenGL_SetWindowText(const char *text) { -#if USE_SDL - SDL_WM_SetCaption(text, NULL); +#if defined(USE_WX) && USE_WX + GLWin.frame->SetTitle(wxString::FromAscii(text)); #elif defined(HAVE_COCOA) && HAVE_COCOA cocoaGLSetTitle(GLWin.cocoaWin, text); #elif defined(_WIN32) - // TODO convert text to unicode and change SetWindowTextA to SetWindowText + // TODO convert text to unicode and change SetWindowTextA to SetWindowText SetWindowTextA(EmuWindow::GetWnd(), text); -#elif defined(USE_WX) && USE_WX - GLWin.frame->SetTitle(wxString::FromAscii(text)); #elif defined(HAVE_X11) && HAVE_X11 // GLX /** * Tell X to ask the window manager to set the window title. (X @@ -147,27 +143,11 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight g_VideoInitialize.pPeekMessages = &Callback_PeekMessages; g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay; -#if USE_SDL - //init sdl video - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - //TODO : Display an error message - SDL_Quit(); - return false; - } - - //setup ogl to use double buffering - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -#elif defined(HAVE_COCOA) && HAVE_COCOA - GLWin.width = s_backbuffer_width; - GLWin.height = s_backbuffer_height; - GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height); - GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode); -#elif defined(USE_WX) && USE_WX +#if defined(USE_WX) && USE_WX int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0}; - wxSize size(_iwidth, _iheight); - if (!g_Config.renderToMainframe || - g_VideoInitialize.pWindowHandle == NULL) { + wxSize size(_twidth, _theight); + if ( g_VideoInitialize.pWindowHandle == NULL) { GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle, -1, _("Dolphin"), wxPoint(50,50), size); } else { @@ -175,24 +155,19 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight -1, _("Dolphin"), wxPoint(50,50), size); } -#if defined(__APPLE__) - GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, wxPoint(0,0), size, 0, wxT("Dolphin"), args, wxNullPalette); -#else GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args, wxPoint(0,0), size, wxSUNKEN_BORDER); GLWin.glCtxt = new wxGLContext(GLWin.glCanvas); -#endif - GLWin.frame->Show(TRUE); GLWin.glCanvas->Show(TRUE); -#if defined(__APPLE__) - GLWin.glCanvas->SetCurrent(); -#else GLWin.glCanvas->SetCurrent(*GLWin.glCtxt); - // GLWin.glCtxt->SetCurrent(*GLWin.glCanvas); -#endif +#elif defined(HAVE_COCOA) && HAVE_COCOA + GLWin.width = s_backbuffer_width; + GLWin.height = s_backbuffer_height; + GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height); + GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode); #elif defined(_WIN32) // --------------------------------------------------------------------------------------- @@ -454,36 +429,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight bool OpenGL_MakeCurrent() { -#if USE_SDL - // Note: The reason for having the call to SDL_SetVideoMode in here instead - // of in OpenGL_Create() is that "make current" is part of the video - // mode setting and is not available as a separate call in SDL. We - // have to do "make current" here because this method runs in the CPU - // thread while OpenGL_Create() runs in a diferent thread and "make - // current" has to be done in the same thread that will be making - // calls to OpenGL. - - // Fetch video info. - const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); - if (!videoInfo) { - // TODO: Display an error message. - SDL_Quit(); - return false; - } - // Compute video mode flags. - const int videoFlags = SDL_OPENGL - | ( videoInfo->hw_available ? SDL_HWSURFACE : SDL_SWSURFACE ) - | ( g_Config.bFullscreen ? SDL_FULLSCREEN : 0); - // Set vide mode. - // TODO: Can we use this field or is a separate field needed? - int _twidth = s_backbuffer_width; - int _theight = s_backbuffer_height; - SDL_Surface *screen = SDL_SetVideoMode(_twidth, _theight, 0, videoFlags); - if (!screen) { - //TODO : Display an error message - SDL_Quit(); - return false; - } +#if defined(USE_WX) && USE_WX + GLWin.glCanvas->SetCurrent(*GLWin.glCtxt); #elif defined(HAVE_COCOA) && HAVE_COCOA cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); #elif defined(_WIN32) @@ -491,13 +438,6 @@ bool OpenGL_MakeCurrent() PanicAlert("(5) Can't Activate The GL Rendering Context."); return false; } -#elif defined(USE_WX) && USE_WX -#if defined(__APPLE__) - GLWin.glCanvas->SetCurrent(); -#else - GLWin.glCanvas->SetCurrent(*GLWin.glCtxt); -#endif - return true; #elif defined(HAVE_X11) && HAVE_X11 Window winDummy; unsigned int borderDummy; @@ -518,35 +458,21 @@ bool OpenGL_MakeCurrent() #endif return true; } - - -// ======================================================================================= // Update window width, size and etc. Called from Render.cpp -// ---------------- void OpenGL_Update() { -#if USE_SDL - SDL_Surface *surface = SDL_GetVideoSurface(); +#if defined(USE_WX) && USE_WX RECT rcWindow = {0}; - if (!surface) - return; - s_backbuffer_width = surface->w; - s_backbuffer_height = surface->h; - - rcWindow.right = surface->w; - rcWindow.bottom = surface->h; + rcWindow.right = GLWin.width; + rcWindow.bottom = GLWin.height; + + // TODO fill in #elif defined(HAVE_COCOA) && HAVE_COCOA RECT rcWindow = {0}; rcWindow.right = GLWin.width; rcWindow.bottom = GLWin.height; -#elif defined(USE_WX) && USE_WX - RECT rcWindow = {0}; - rcWindow.right = GLWin.width; - rcWindow.bottom = GLWin.height; - - // TODO fill in #elif defined(_WIN32) RECT rcWindow; if (!EmuWindow::GetParentWnd()) @@ -647,18 +573,15 @@ void OpenGL_Update() } -// ======================================================================================= // Close plugin -// ---------------- void OpenGL_Shutdown() { -#if USE_SDL - SDL_Quit(); -#elif defined(HAVE_COCOA) && HAVE_COCOA - cocoaGLDelete(GLWin.cocoaCtx); -#elif defined(USE_WX) && USE_WX +#if defined(USE_WX) && USE_WX delete GLWin.glCanvas; delete GLWin.frame; +#elif defined(HAVE_COCOA) && HAVE_COCOA + cocoaGLDelete(GLWin.cocoaCtx); + #elif defined(_WIN32) if (hRC) // Do We Have A Rendering Context? { @@ -679,9 +602,7 @@ void OpenGL_Shutdown() if (hDC && !ReleaseDC(EmuWindow::GetWnd(), hDC)) // Are We Able To Release The DC { -#ifndef SETUP_TIMER_WAITING // This fails ERROR_LOG(VIDEO, "Release Device Context Failed."); -#endif hDC = NULL; // Set DC To NULL } #elif defined(HAVE_X11) && HAVE_X11 diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/PixelEngine.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/PixelEngine.cpp index cae026b62d..bbcb2ae0ac 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/PixelEngine.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/PixelEngine.cpp @@ -37,7 +37,7 @@ enum }; // STATE_TO_SAVE -PEReg PixelEngine::pereg; +PEReg pereg; static bool g_bSignalTokenInterrupt; static bool g_bSignalFinishInterrupt; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript index cf538d6acb..196ca3a6a2 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript @@ -46,11 +46,6 @@ libs = [ gfxenv = env.Clone() -files += [ - 'main.cpp', - 'GLUtil.cpp', - ] - if sys.platform == 'win32': files += [ 'Win32.cpp' ]