From ac6d34cd10ca8d184abdfa4dabde9117b7fa2d55 Mon Sep 17 00:00:00 2001 From: tmator Date: Tue, 12 Aug 2008 23:17:29 +0000 Subject: [PATCH] Added mth patchs / icon and a fist SDL support on OGL plugin, not work ... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@182 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 18 ++++++- Source/Core/DolphinWX/src/SConscript | 20 ++++++- Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp | 54 ++++++++++++++++--- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 6 ++- Source/Plugins/Plugin_VideoOGL/Src/SConscript | 4 +- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 10 +++- 6 files changed, 100 insertions(+), 12 deletions(-) diff --git a/SConstruct b/SConstruct index bce187fa12..56cf544b86 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,10 @@ import os import sys +# TODO: What is the current Dolphin version? +dolphin_version = '1.04' +Export('dolphin_version') + warnings = ' -Wall -Wwrite-strings -Wfloat-equal -Wshadow -Wpointer-arith -Wpacked -Wno-conversion' nonactive_warnings = '-Wunreachable-code' @@ -25,7 +29,17 @@ include_paths = ["../../../Core/Common/Src", # "../../../Plugins/Plugin_VideoOGL/Src/Windows", ] +builders = {} if sys.platform == 'darwin': + from plistlib import writePlist + def create_plist(target, source, env): + properties = {} + for src_node in source: + properties.update(src_node.value) + for dst_node in target: + writePlist(properties, str(dst_node)) + builders['Plist'] = Builder(action = create_plist) + dirs = ["Source/Core/Common/Src", "Externals/Bochs_disasm", "Source/Core/Core/Src", @@ -64,7 +78,9 @@ env = Environment(CC="gcc", CPPPATH=include_paths, LIBPATH=lib_paths, ENV={'PATH' : os.environ['PATH'], - 'HOME' : os.environ['HOME']}) + 'HOME' : os.environ['HOME']}, + BUILDERS = builders, + ) Export('env') diff --git a/Source/Core/DolphinWX/src/SConscript b/Source/Core/DolphinWX/src/SConscript index 63f008c621..028023fd40 100644 --- a/Source/Core/DolphinWX/src/SConscript +++ b/Source/Core/DolphinWX/src/SConscript @@ -19,7 +19,25 @@ files = ["BootManager.cpp", wxenv = env.Copy(CXXFLAGS = "`wx-config --cppflags` -DUSE_XPM_BITMAPS -DwxNEEDS_CHARPP", LINKFLAGS = "-L/usr/local/lib -pthread `wx-config --libs`") -if sys.platform == 'darwin': +if sys.platform == 'darwin': + icon = 'Dolphin' + version = "svn" wxenv.Program("../../../../Binary/mac/Dolphin.app/Contents/MacOS/Dolphin", files, LIBS = ["debwx", "discio", "core", "bdisasm", "videocommon", "common" , "z"]) + wxenv.Command("../../../../Binary/mac/Dolphin.app/Contents/Resources/" + icon + ".icns", "../resources/" + icon + ".icns", Copy("$TARGET", "$SOURCE")) + wxenv.Plist("../../../../Binary/mac/Dolphin.app/Contents/Info.plist", Value(dict( + CFAppleHelpAnchor = 'index', + CFBundleExecutable = 'Dolphin', + CFBundleGetInfoHTML = 'Dolphin ' + version, + CFBundleIconFile = icon, + CFBundleIdentifier = 'com.dolphin-emu.dolphin', + CFBundleName = 'Dolphin', + CFBundlePackageType = 'APPL', + CFBundleShortVersionString = version, + CFBundleSignature = 'dlfn', + CFBundleVersion = version, + LSRequiresCarbon = True, + NSPrefPaneIconFile = icon, + NSPrefPaneIconLabel = 'Dolphin', + ))) else: wxenv.Program("../../../../Binary/linux/Dolphin", files, LIBS = ["debwx", "discio", "core", "bdisasm", "videocommon", "common"]) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp index 820b69ac7d..b086c7cdec 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp @@ -23,6 +23,10 @@ #endif #include "GLInit.h" +#ifdef MACOSX +#include "SDL/SDL.h" +#endif + // Handles OpenGL and the window @@ -45,8 +49,10 @@ void OpenGL_SwapBuffers() { #ifdef _WIN32 SwapBuffers(hDC); -#else +#elifdef __linux__ glXSwapBuffers(GLWin.dpy, GLWin.win); +#else //others + SDL_GL_SwapBuffers(); #endif } @@ -54,12 +60,14 @@ void OpenGL_SetWindowText(const char *text) { #ifdef _WIN32 SetWindowText(EmuWindow::GetWnd(), text); -#else +#elifdef __linux__ /** * Tell X to ask the window manager to set the window title. (X * itself doesn't provide window title functionality.) */ XStoreName(GLWin.dpy, GLWin.win, text); +#else + SDL_WM_SetCaption(text, NULL); #endif } @@ -76,12 +84,14 @@ BOOL Callback_PeekMessages() DispatchMessage(&msg); } return TRUE; -#else +#elifdef __linux__ XEvent event; while (XPending(GLWin.dpy) > 0) { XNextEvent(GLWin.dpy, &event); } return TRUE; +#else + //TODO #endif } @@ -253,7 +263,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight return false; } -#else +#elifdef __linux__ XVisualInfo *vi; Colormap cmap; int dpyWidth, dpyHeight; @@ -380,6 +390,32 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight "GPU", None, NULL, 0, NULL); XMapRaised(GLWin.dpy, GLWin.win); } +#else + //SDL fo other OS (osx, bsd, ...) + int videoFlags; + SDL_Surface *screen; + const SDL_VideoInfo *videoInfo; + + //init sdl video + SDL_Init(SDL_INIT_VIDEO); + //fetch video info + videoInfo = SDL_GetVideoInfo(); + + //hw o sw ogl ? + if (videoInfo->hw_available) + videoFlags |= SDL_HWSURFACE; + else + videoFlags |= SDL_SWSURFACE; + + + //fullscreen or not + if(g_Config.bFullscreen) + videoFlags |= SDL_FULLSCREEN; + + //setup ogl to use double buffering + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + screen = SDL_SetVideoMode(_twidth, _theight, 24, SDL_OPENGL|SDL_RESIZABLE); #endif return true; } @@ -391,7 +427,7 @@ bool OpenGL_MakeCurrent() MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return false; } -#else +#elifdef __linux__ Window winDummy; unsigned int borderDummy; // connect the glx-context to the window @@ -408,6 +444,10 @@ bool OpenGL_MakeCurrent() XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask ); +#else + + //TODO + #endif return true; } @@ -466,7 +506,7 @@ void OpenGL_Shutdown() MessageBox(NULL,"Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); hDC = NULL; // Set DC To NULL } -#else // linux +#elifdef __linux__ if (GLWin.ctx) { if (!glXMakeCurrent(GLWin.dpy, None, NULL)) @@ -483,5 +523,7 @@ void OpenGL_Shutdown() XF86VidModeSetViewPort(GLWin.dpy, GLWin.screen, 0, 0); } } +#else + SDL_Quit(); #endif } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 7c08dfab7e..30f41e0763 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -115,11 +115,15 @@ bool Renderer::Create2() wglSwapIntervalEXT(0); else ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n"); -#else +#elifdef __linux__ if (glXSwapIntervalSGI) glXSwapIntervalSGI(0); else ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n"); +#else + + //TODO + #endif // check the max texture width and height diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index 2f40e10cf5..d4f717a229 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -25,8 +25,8 @@ files = ["BPStructs.cpp", "GUI/ConfigDlg.cpp", ] if sys.platform == 'darwin': - gfxenv=env.Copy(CXXFLAGS = " -DMACOSX=1 `wx-config --cppflags` ", LINKFLAGS = " -framework OpenGL -framework Cg `wx-config --libs` ") - gfxenv.SharedLibrary("../../../../Binary/mac/Plugins/zeroogl.so", files, LIBS=["videocommon", "common", "cairo", "GLEW"]) + gfxenv=env.Copy(CXXFLAGS = " -DMACOSX=1 `wx-config --cppflags` ", LINKFLAGS = " -framework SDL -framework OpenGL -framework Cg `wx-config --libs` ") + gfxenv.SharedLibrary("../../../../Binary/mac/Plugins/zeroogl.so", files, LIBS=["videocommon", "common", "GLEW"]) else: gfxenv=env.Copy(CXXFLAGS = " `wx-config --cppflags` `pkg-config --cflags xxf86vm` ", LINKFLAGS = "`wx-config --libs` `pkg-config --libs xxf86vm` ") gfxenv.SharedLibrary("../../../../Binary/linux/Plugins/zeroogl.so", files, LIBS=["videocommon", "common", "cairo", "GL", "GLU", "GLEW", "CgGL", "Cg", "X11"]) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 1c63f90a33..83018e6a13 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -21,6 +21,10 @@ #include "OS\Win32.h" #endif +#ifdef MACOSX +#include "SDL/SDL.h" +#endif + #include "GUI/ConfigDlg.h" #include "Render.h" @@ -90,7 +94,7 @@ void DllConfig(HWND _hParent) frame.ShowModal(); win.SetHWND(0); -#else +#elifdef __linux__ ConfigDialog frame(NULL); g_Config.Load(); XVisualInfo *vi; @@ -126,6 +130,10 @@ void DllConfig(HWND _hParent) } } frame.ShowModal(); +#else + + //TODO + #endif }