define mess and some other small fixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1493 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-12-10 23:23:05 +00:00
parent c26c92cffd
commit 32a7c530e6
7 changed files with 68 additions and 47 deletions

View File

@ -99,8 +99,8 @@ vars.AddVariables(
allowed_values = ('release', 'devel', 'debug'), allowed_values = ('release', 'devel', 'debug'),
ignorecase = 2 ignorecase = 2
), ),
EnumVariable('osx', 'Choose a backend (WIP)', '32coca', EnumVariable('osx', 'Choose a backend (WIP)', '32cocoa',
allowed_values = ('32x11', '32coca', '64coca'), allowed_values = ('32x11', '32cocoa', '64cocoa'),
ignorecase = 2 ignorecase = 2
), ),
PathVariable('wxconfig', 'Path to the wxconfig', None), PathVariable('wxconfig', 'Path to the wxconfig', None),
@ -192,9 +192,9 @@ env['HAVE_WX'] = conf.CheckWXConfig('2.8', ['adv', 'core', 'base'],
#osx 64 specifics #osx 64 specifics
if sys.platform == 'darwin': if sys.platform == 'darwin':
if env['osx'] == '64coca': if env['osx'] == '64cocoa':
compileFlags += ['-arch' , 'x86_64', '-DOSX64'] compileFlags += ['-arch' , 'x86_64', '-DOSX64']
if env['osx'] == '64coca' or env['osx'] == '32coca': if not env['osx'] == '32x11':
env['HAVE_X11'] = 0 env['HAVE_X11'] = 0
env['HAVE_COCOA'] = conf.CheckPKG('cocoa') env['HAVE_COCOA'] = conf.CheckPKG('cocoa')
else: else:
@ -219,7 +219,6 @@ conf.Finish()
#wx windows flags #wx windows flags
if env['HAVE_WX']: if env['HAVE_WX']:
wxconfig.ParseWXConfig(env) wxconfig.ParseWXConfig(env)
compileFlags += ['-DUSE_WX']
else: else:
print "WX not found or disabled, not building GUI" print "WX not found or disabled, not building GUI"

View File

@ -17,6 +17,7 @@
#ifndef _CONFIG_H #ifndef _CONFIG_H
#define _CONFIG_H #define _CONFIG_H
//#define USE_WX 1
// Log in two categories, andsave three other options in the same byte // Log in two categories, andsave three other options in the same byte
#define CONF_LOG 1 #define CONF_LOG 1

View File

@ -41,6 +41,7 @@ struct RECT
#include <SDL.h> #include <SDL.h>
#endif #endif
// Handles OpenGL and the window // Handles OpenGL and the window
// externals // externals
@ -63,11 +64,13 @@ void OpenGL_SwapBuffers()
{ {
#if USE_SDL #if USE_SDL
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
#elif defined(OSX64) #elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLSwap(GLWin.cocoaCtx,GLWin.cocoaWin); cocoaGLSwap(GLWin.cocoaCtx,GLWin.cocoaWin);
#elif defined(_WIN32) #elif defined(_WIN32)
SwapBuffers(hDC); SwapBuffers(hDC);
#else // GLX #elif defined(USE_WX) && USE_WX
GLWin.Wxcs->SwapBuffers();
#elif defined(HAVE_X11) && HAVE_X11
glXSwapBuffers(GLWin.dpy, GLWin.win); glXSwapBuffers(GLWin.dpy, GLWin.win);
#endif #endif
} }
@ -76,7 +79,7 @@ void OpenGL_SetWindowText(const char *text)
{ {
#if USE_SDL #if USE_SDL
SDL_WM_SetCaption(text, NULL); SDL_WM_SetCaption(text, NULL);
#elif defined(OSX64) #elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLSetTitle(); cocoaGLSetTitle();
#elif defined(_WIN32) #elif defined(_WIN32)
SetWindowText(EmuWindow::GetWnd(), text); SetWindowText(EmuWindow::GetWnd(), text);
@ -89,7 +92,7 @@ void OpenGL_SetWindowText(const char *text)
#endif #endif
} }
unsigned int Callback_PeekMessages() unsigned int Callback_PeekMessages()
{ {
#ifdef _WIN32 #ifdef _WIN32
//TODO: peekmessage //TODO: peekmessage
@ -202,6 +205,17 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
GLWin.height = nBackbufferHeight; GLWin.height = nBackbufferHeight;
GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height); GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height);
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode); GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
#elif defined(USE_WX) && USE_WX
int attrib[2];
attrib[0] = WX_GL_DEPTH_SIZE;
attrib[1] = 32;
wxFrame *frame = new wxFrame((wxFrame *)NULL, -1, _("Test frame"), wxPoint(50,50), wxSize(400,400) );
GLWin.Wxcs = new wxGLCanvas(frame, -1, wxPoint(0,0), wxSize(400,400), wxSUNKEN_BORDER, _("some text"));
frame->Show(TRUE);
GLWin.Wxcs->SetCurrent();
#elif defined(_WIN32) #elif defined(_WIN32)
// create the window // create the window
if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL) if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
@ -372,7 +386,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
GLWin.attr.colormap = cmap; GLWin.attr.colormap = cmap;
GLWin.attr.border_pixel = 0; GLWin.attr.border_pixel = 0;
#ifndef __APPLE__ #if defined(HAVE_XXF86VM) && HAVE_XXF86VM
// get a connection // get a connection
XF86VidModeQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion); XF86VidModeQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
@ -482,14 +496,14 @@ bool OpenGL_MakeCurrent()
SDL_Quit(); SDL_Quit();
return false; return false;
} }
#elif defined(OSX64) #elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
#elif defined(_WIN32) #elif defined(_WIN32)
if (!wglMakeCurrent(hDC,hRC)) { if (!wglMakeCurrent(hDC,hRC)) {
MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return false; return false;
} }
#else // GLX #elif defined(HAVE_X11) && HAVE_X11
Window winDummy; Window winDummy;
unsigned int borderDummy; unsigned int borderDummy;
// connect the glx-context to the window // connect the glx-context to the window
@ -520,11 +534,14 @@ void OpenGL_Update()
if (!surface) return; if (!surface) return;
nBackbufferWidth = surface->w; nBackbufferWidth = surface->w;
nBackbufferHeight = surface->h; nBackbufferHeight = surface->h;
#elif defined(OSX64) #elif defined(HAVE_COCOA) && HAVE_COCOA
RECT rcWindow; RECT rcWindow;
rcWindow.right = GLWin.width; rcWindow.right = GLWin.width;
rcWindow.bottom = GLWin.height; rcWindow.bottom = GLWin.height;
#elif defined(USE_WX) && USE_WX
RECT rcWindow;
// TODO fill in
#elif defined(_WIN32) #elif defined(_WIN32)
RECT rcWindow; RECT rcWindow;
if (!EmuWindow::GetParentWnd()) { if (!EmuWindow::GetParentWnd()) {
@ -552,7 +569,7 @@ void OpenGL_Update()
nBackbufferWidth = width; nBackbufferWidth = width;
nBackbufferHeight = height; nBackbufferHeight = height;
#else // GLX #elif defined(HAVE_X11) && HAVE_X11
// We just check all of our events here // We just check all of our events here
XEvent event; XEvent event;
KeySym key; KeySym key;
@ -669,8 +686,8 @@ void OpenGL_Shutdown()
{ {
#if USE_SDL #if USE_SDL
SDL_Quit(); SDL_Quit();
#elif defined(OSX64) #elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLDelete(GLWin.cocoaCtx); cocoaGLDelete(GLWin.cocoaCtx);
#elif defined(_WIN32) #elif defined(_WIN32)
if (hRC) // Do We Have A Rendering Context? if (hRC) // Do We Have A Rendering Context?
{ {
@ -706,7 +723,7 @@ void OpenGL_Shutdown()
XCloseDisplay(GLWin.dpy); XCloseDisplay(GLWin.dpy);
GLWin.ctx = NULL; GLWin.ctx = NULL;
} }
#ifndef __APPLE__ #if defined(HAVE_XXF86VM) && HAVE_XXF86VM
/* switch back to original desktop resolution if we were in fs */ /* switch back to original desktop resolution if we were in fs */
if (GLWin.dpy != NULL) { if (GLWin.dpy != NULL) {
if (GLWin.fs) { if (GLWin.fs) {

View File

@ -18,6 +18,7 @@
#ifndef _GLINIT_H #ifndef _GLINIT_H
#define _GLINIT_H #define _GLINIT_H
#include "Config.h"
#include "pluginspecs_video.h" #include "pluginspecs_video.h"
#ifdef _WIN32 #ifdef _WIN32
@ -32,25 +33,25 @@
#else // linux basic definitions #else // linux basic definitions
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#if defined(USE_WX) && USE_WX
#include <GL/glew.h>
#include "wx/wx.h"
#include "wx/glcanvas.h"
#undef HAVE_X11
#elif defined(HAVE_X11) && HAVE_X11
#define I_NEED_OS2_H // HAXXOR #define I_NEED_OS2_H // HAXXOR
//#include <GL/glew.h>
#if defined(HAVE_X11) && HAVE_X11
#include <GL/glxew.h> #include <GL/glxew.h>
#else #elif defined(HAVE_COCOA) && HAVE_COCOA
#undef BOOL
#include <GL/glew.h> #include <GL/glew.h>
#include "cocoaGL.h" #include "cocoaGL.h"
#endif #endif // end USE_WX
#if defined(__APPLE__) #if defined(__APPLE__)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#else #else
#include <GL/gl.h> #include <GL/gl.h>
#endif #endif
//#include <GL/glx.h>
#define __inline inline #define __inline inline
#include <sys/timeb.h> // ftime(), struct timeb #include <sys/timeb.h> // ftime(), struct timeb
@ -85,39 +86,40 @@ inline unsigned long timeGetTime()
#define GL_REPORT_ERRORD() #define GL_REPORT_ERRORD()
#endif #endif
#ifndef _WIN32 #ifndef _WIN32
#undef I_NEED_OS2_H
#undef BOOL
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#ifndef __APPLE__ #if defined(HAVE_XXF86VM) && HAVE_XXF86VM
#include <X11/extensions/xf86vmode.h> #include <X11/extensions/xf86vmode.h>
#endif #endif // XXF86VM
//#include <gtk/gtk.h> #endif // X11
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
typedef struct { typedef struct {
int screen; int screen;
#if defined(OSX64) #if defined(HAVE_COCOA) && HAVE_COCOA
NSWindow *cocoaWin; NSWindow *cocoaWin;
NSOpenGLContext *cocoaCtx; NSOpenGLContext *cocoaCtx;
#else //linux #elif defined(HAVE_X11) && HAVE_X11
Window win; Window win;
Display *dpy; Display *dpy;
GLXContext ctx; GLXContext ctx;
XSetWindowAttributes attr; XSetWindowAttributes attr;
Bool fs; Bool fs;
Bool doubleBuffered; Bool doubleBuffered;
#ifndef __APPLE__ #if defined(HAVE_XXF86VM) && HAVE_XXF86VM
XF86VidModeModeInfo deskMode; XF86VidModeModeInfo deskMode;
#endif #endif // XXF86VM
#endif #endif // X11
#if defined(USE_WX) && USE_WX
wxGLCanvas *Wxcs;
#endif
int x, y; int x, y;
unsigned int width, height; unsigned int width, height;
unsigned int depth; unsigned int depth;

View File

@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Config.h"
#include "GLUtil.h" #include "GLUtil.h"
#include "Profiler.h" #include "Profiler.h"
#include "x64Emitter.h" #include "x64Emitter.h"

View File

@ -142,8 +142,7 @@ bool Renderer::Create2()
wglSwapIntervalEXT(0); wglSwapIntervalEXT(0);
else else
ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n"); ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n");
#else #elif defined(HAVE_X11) && HAVE_X11
#ifdef __linux__
if (glXSwapIntervalSGI) if (glXSwapIntervalSGI)
glXSwapIntervalSGI(0); glXSwapIntervalSGI(0);
else else
@ -153,7 +152,7 @@ bool Renderer::Create2()
//TODO //TODO
#endif #endif
#endif
// check the max texture width and height // check the max texture width and height
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&g_MaxTexWidth); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&g_MaxTexWidth);
g_MaxTexHeight = g_MaxTexWidth; g_MaxTexHeight = g_MaxTexWidth;

View File

@ -154,7 +154,8 @@ void DllConfig(HWND _hParent)
frame->ShowModal(); frame->ShowModal();
//win.SetHWND(0); //win.SetHWND(0);
#elif defined(HAVE_WX) && HAVE_WX #elif defined(HAVE_X11) && HAVE_X11
#if defined(HAVE_XXF86VM) && HAVE_XXF86VM
ConfigDialog frame(NULL); ConfigDialog frame(NULL);
g_Config.Load(); g_Config.Load();
int glxMajorVersion, glxMinorVersion; int glxMajorVersion, glxMinorVersion;
@ -188,6 +189,7 @@ void DllConfig(HWND _hParent)
} }
XFree(modes); XFree(modes);
frame.ShowModal(); frame.ShowModal();
#endif
#else #else
//TODO //TODO
#endif #endif
@ -235,9 +237,9 @@ void Video_DoState(unsigned char **ptr, int mode) {
// PanicAlert("Can't Activate The GL Rendering Context for saving"); // PanicAlert("Can't Activate The GL Rendering Context for saving");
// return; // return;
// } // }
#elif defined(OSX64) #elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
#else // Linux #elif defined(HAVE_X11) && HAVE_X11
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx); glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
#endif #endif