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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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