more osx64 work
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@963 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d3da9a67d7
commit
8f3aa9e67b
|
@ -63,6 +63,8 @@ void OpenGL_SwapBuffers()
|
||||||
{
|
{
|
||||||
#if USE_SDL
|
#if USE_SDL
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
|
#elif defined(OSX64)
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
SwapBuffers(hDC);
|
SwapBuffers(hDC);
|
||||||
#else // GLX
|
#else // GLX
|
||||||
|
@ -74,6 +76,8 @@ 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(_WIN32)
|
#elif defined(_WIN32)
|
||||||
SetWindowText(EmuWindow::GetWnd(), text);
|
SetWindowText(EmuWindow::GetWnd(), text);
|
||||||
#else // GLX
|
#else // GLX
|
||||||
|
@ -85,13 +89,19 @@ void OpenGL_SetWindowText(const char *text)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(OSX64)
|
||||||
|
unsigned int Callback_PeekMessages()
|
||||||
|
#else
|
||||||
BOOL Callback_PeekMessages()
|
BOOL Callback_PeekMessages()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#if USE_SDL
|
#if USE_SDL
|
||||||
// TODO: There is no documentation of this function and the calling code
|
// TODO: There is no documentation of this function and the calling code
|
||||||
// ignores the return value, so I have no idea what would be the
|
// ignores the return value, so I have no idea what would be the
|
||||||
// proper value to return.
|
// proper value to return.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#elif defined(OSX64)
|
||||||
|
return FALSE;
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
//TODO: peekmessage
|
//TODO: peekmessage
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
@ -199,6 +209,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||||
|
|
||||||
//setup ogl to use double buffering
|
//setup ogl to use double buffering
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
#elif defined(OSX64)
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
// create the window
|
// create the window
|
||||||
|
@ -479,6 +490,8 @@ bool OpenGL_MakeCurrent()
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#elif defined(OSX64)
|
||||||
|
|
||||||
#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);
|
||||||
|
@ -515,6 +528,8 @@ void OpenGL_Update()
|
||||||
if (!surface) return;
|
if (!surface) return;
|
||||||
nBackbufferWidth = surface->w;
|
nBackbufferWidth = surface->w;
|
||||||
nBackbufferHeight = surface->h;
|
nBackbufferHeight = surface->h;
|
||||||
|
#elif defined(OSX64)
|
||||||
|
RECT rcWindow;
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
if (!EmuWindow::GetParentWnd()) return;
|
if (!EmuWindow::GetParentWnd()) return;
|
||||||
|
@ -650,6 +665,8 @@ void OpenGL_Shutdown()
|
||||||
{
|
{
|
||||||
#if USE_SDL
|
#if USE_SDL
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
#elif defined(OSX64)
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
if (hRC) // Do We Have A Rendering Context?
|
if (hRC) // Do We Have A Rendering Context?
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,8 +34,11 @@
|
||||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||||
#define I_NEED_OS2_H // HAXXOR
|
#define I_NEED_OS2_H // HAXXOR
|
||||||
//#include <GL/glew.h>
|
//#include <GL/glew.h>
|
||||||
|
#if !defined(OSX64)
|
||||||
#include <GL/glxew.h>
|
#include <GL/glxew.h>
|
||||||
|
#else
|
||||||
|
#include <GL/glew.h>
|
||||||
|
#endif
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
|
@ -97,11 +100,15 @@ typedef struct {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int screen;
|
int screen;
|
||||||
Window win;
|
Window win;
|
||||||
|
#if defined(OSX64)
|
||||||
|
|
||||||
|
#else //linux
|
||||||
GLXContext ctx;
|
GLXContext ctx;
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
Bool fs;
|
Bool fs;
|
||||||
Bool doubleBuffered;
|
Bool doubleBuffered;
|
||||||
XF86VidModeModeInfo deskMode;
|
XF86VidModeModeInfo deskMode;
|
||||||
|
#endif
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
unsigned int depth;
|
unsigned int depth;
|
||||||
|
|
|
@ -15,11 +15,13 @@
|
||||||
// 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/
|
||||||
|
|
||||||
|
#if !defined(OSX64)
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/filepicker.h>
|
#include <wx/filepicker.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/aboutdlg.h>
|
#include <wx/aboutdlg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(OSX64)
|
||||||
#include "../Debugger/Debugger.h" // for the CDebugger class
|
#include "../Debugger/Debugger.h" // for the CDebugger class
|
||||||
#include "../Debugger/PBView.h"
|
#include "../Debugger/PBView.h"
|
||||||
#include "Console.h" // open and close console, clear console window
|
#include "Console.h" // open and close console, clear console window
|
||||||
|
#endif
|
||||||
#include "../Logging/Logging.h" // for global logging values
|
#include "../Logging/Logging.h" // for global logging values
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,8 +73,9 @@ std::vector<u16> viupd(15); // the length of the update frequency bar
|
||||||
// ---------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------
|
||||||
// Classes
|
// Classes
|
||||||
// -------------
|
// -------------
|
||||||
|
#if !defined(OSX64)
|
||||||
extern CDebugger* m_frame;
|
extern CDebugger* m_frame;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
|
@ -143,7 +146,9 @@ void Logging(int a)
|
||||||
{
|
{
|
||||||
std::string sfbuff;
|
std::string sfbuff;
|
||||||
sfbuff = sfbuff + writeMessage(ii, 0);
|
sfbuff = sfbuff + writeMessage(ii, 0);
|
||||||
|
#if !defined(OSX64)
|
||||||
aprintf(ii, (char *)sfbuff.c_str());
|
aprintf(ii, (char *)sfbuff.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
|
@ -254,7 +259,9 @@ void Logging(int a)
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
// Print
|
// Print
|
||||||
// ----------------
|
// ----------------
|
||||||
|
#if !defined(OSX64)
|
||||||
ClearScreen();
|
ClearScreen();
|
||||||
|
#endif
|
||||||
__Log("%s", sbuff.c_str());
|
__Log("%s", sbuff.c_str());
|
||||||
sbuff.clear(); strcpy(buffer, "");
|
sbuff.clear(); strcpy(buffer, "");
|
||||||
// ================
|
// ================
|
||||||
|
|
|
@ -41,7 +41,9 @@
|
||||||
#include "PixelShaderManager.h"
|
#include "PixelShaderManager.h"
|
||||||
#include "VertexLoader.h"
|
#include "VertexLoader.h"
|
||||||
#include "XFB.h"
|
#include "XFB.h"
|
||||||
|
#if !defined(OSX64)
|
||||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
#include "Debugger/Debugger.h" // for the CDebugger class
|
||||||
|
#endif
|
||||||
#include "Logging/Logging.h" // for Logging()
|
#include "Logging/Logging.h" // for Logging()
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -59,7 +61,9 @@ struct MESSAGE
|
||||||
|
|
||||||
CGcontext g_cgcontext;
|
CGcontext g_cgcontext;
|
||||||
CGprofile g_cgvProf, g_cgfProf;
|
CGprofile g_cgvProf, g_cgfProf;
|
||||||
|
#if !defined(OSX64)
|
||||||
extern CDebugger* m_frame; // the debugging class
|
extern CDebugger* m_frame; // the debugging class
|
||||||
|
#endif
|
||||||
|
|
||||||
static int g_MaxTexWidth = 0, g_MaxTexHeight = 0;
|
static int g_MaxTexWidth = 0, g_MaxTexHeight = 0;
|
||||||
static RasterFont* s_pfont = NULL;
|
static RasterFont* s_pfont = NULL;
|
||||||
|
@ -743,11 +747,12 @@ void Renderer::SwapBuffers()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write logging data to debugger
|
// Write logging data to debugger
|
||||||
|
#if !defined(OSX64)
|
||||||
if(m_frame)
|
if(m_frame)
|
||||||
{
|
{
|
||||||
Logging(0);
|
Logging(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (g_Config.bOverlayStats) {
|
if (g_Config.bOverlayStats) {
|
||||||
char st[2048];
|
char st[2048];
|
||||||
char *p = st;
|
char *p = st;
|
||||||
|
|
|
@ -26,11 +26,8 @@ files = [
|
||||||
'VertexLoaderManager.cpp',
|
'VertexLoaderManager.cpp',
|
||||||
'VertexShaderManager.cpp',
|
'VertexShaderManager.cpp',
|
||||||
'XFB.cpp',
|
'XFB.cpp',
|
||||||
'GUI/ConfigDlg.cpp',
|
|
||||||
'Logging/Console.cpp',
|
'Logging/Console.cpp',
|
||||||
'Logging/Logging.cpp',
|
'Logging/Logging.cpp',
|
||||||
'Debugger/Debugger.cpp',
|
|
||||||
'Debugger/PBView.cpp',
|
|
||||||
]
|
]
|
||||||
compileFlags = [
|
compileFlags = [
|
||||||
'-fPIC',
|
'-fPIC',
|
||||||
|
@ -43,6 +40,26 @@ libs = [
|
||||||
|
|
||||||
gfxenv = env.Clone()
|
gfxenv = env.Clone()
|
||||||
|
|
||||||
|
if not gfxenv['osx64']:
|
||||||
|
files += [
|
||||||
|
'GUI/ConfigDlg.cpp',
|
||||||
|
'Debugger/Debugger.cpp',
|
||||||
|
'Debugger/PBView.cpp',
|
||||||
|
]
|
||||||
|
|
||||||
|
if gfxenv['osx64']:
|
||||||
|
files += [ 'cocoaGL.m' ]
|
||||||
|
compileFlags += [
|
||||||
|
'-x',
|
||||||
|
'objective-c++',
|
||||||
|
]
|
||||||
|
linkFlags += [
|
||||||
|
'-framework',
|
||||||
|
'cocoa',
|
||||||
|
'-arch',
|
||||||
|
'x86_64'
|
||||||
|
]
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
platform = 'mac'
|
platform = 'mac'
|
||||||
# SDL is currently the only way to get video on Mac OS X.
|
# SDL is currently the only way to get video on Mac OS X.
|
||||||
|
@ -87,9 +104,8 @@ gfxenv.Append(
|
||||||
LINKFLAGS = linkFlags,
|
LINKFLAGS = linkFlags,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not env['osx64']:
|
gfxenv.SharedLibrary(
|
||||||
gfxenv.SharedLibrary(
|
|
||||||
'../../../../Binary/%s/Plugins/zeroogl.so' % platform,
|
'../../../../Binary/%s/Plugins/zeroogl.so' % platform,
|
||||||
files,
|
files,
|
||||||
LIBS = gfxenv['LIBS'] + libs
|
LIBS = libs
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,25 +25,25 @@
|
||||||
|
|
||||||
class VertexLoaderUID
|
class VertexLoaderUID
|
||||||
{
|
{
|
||||||
u32 id[5];
|
u32 vid[5];
|
||||||
public:
|
public:
|
||||||
VertexLoaderUID() {}
|
VertexLoaderUID() {}
|
||||||
void InitFromCurrentState(int vtx_attr_group) {
|
void InitFromCurrentState(int vtx_attr_group) {
|
||||||
id[0] = g_VtxDesc.Hex & 0xFFFFFFFF;
|
vid[0] = g_VtxDesc.Hex & 0xFFFFFFFF;
|
||||||
id[1] = g_VtxDesc.Hex >> 32;
|
vid[1] = g_VtxDesc.Hex >> 32;
|
||||||
id[2] = g_VtxAttr[vtx_attr_group].g0.Hex & ~VAT_0_FRACBITS;
|
vid[2] = g_VtxAttr[vtx_attr_group].g0.Hex & ~VAT_0_FRACBITS;
|
||||||
id[3] = g_VtxAttr[vtx_attr_group].g1.Hex & ~VAT_1_FRACBITS;
|
vid[3] = g_VtxAttr[vtx_attr_group].g1.Hex & ~VAT_1_FRACBITS;
|
||||||
id[4] = g_VtxAttr[vtx_attr_group].g2.Hex & ~VAT_2_FRACBITS;
|
vid[4] = g_VtxAttr[vtx_attr_group].g2.Hex & ~VAT_2_FRACBITS;
|
||||||
}
|
}
|
||||||
bool operator < (const VertexLoaderUID &other) const {
|
bool operator < (const VertexLoaderUID &other) const {
|
||||||
if (id[0] < other.id[0])
|
if (vid[0] < other.vid[0])
|
||||||
return true;
|
return true;
|
||||||
else if (id[0] > other.id[0])
|
else if (vid[0] > other.vid[0])
|
||||||
return false;
|
return false;
|
||||||
for (int i = 1; i < 5; ++i) {
|
for (int i = 1; i < 5; ++i) {
|
||||||
if (id[i] < other.id[i])
|
if (vid[i] < other.vid[i])
|
||||||
return true;
|
return true;
|
||||||
else if (id[i] > other.id[i])
|
else if (vid[i] > other.vid[i])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -843,29 +843,29 @@ float* VertexShaderMngr::GetPosNormalMat()
|
||||||
|
|
||||||
// Mash together all the inputs that contribute to the code of a generated vertex shader into
|
// Mash together all the inputs that contribute to the code of a generated vertex shader into
|
||||||
// a unique identifier, basically containing all the bits. Yup, it's a lot ....
|
// a unique identifier, basically containing all the bits. Yup, it's a lot ....
|
||||||
void VertexShaderMngr::GetVertexShaderId(VERTEXSHADERUID& id, u32 components)
|
void VertexShaderMngr::GetVertexShaderId(VERTEXSHADERUID& vid, u32 components)
|
||||||
{
|
{
|
||||||
u32 zbufrender = (bpmem.ztex2.op == ZTEXTURE_ADD) || Renderer::GetZBufferTarget() != 0;
|
u32 zbufrender = (bpmem.ztex2.op == ZTEXTURE_ADD) || Renderer::GetZBufferTarget() != 0;
|
||||||
id.values[0] = components |
|
vid.values[0] = components |
|
||||||
(xfregs.numTexGens << 23) |
|
(xfregs.numTexGens << 23) |
|
||||||
(xfregs.nNumChans << 27) |
|
(xfregs.nNumChans << 27) |
|
||||||
((u32)xfregs.bEnableDualTexTransform << 29) |
|
((u32)xfregs.bEnableDualTexTransform << 29) |
|
||||||
(zbufrender << 30);
|
(zbufrender << 30);
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
id.values[1+i] = xfregs.colChans[i].color.enablelighting ?
|
vid.values[1+i] = xfregs.colChans[i].color.enablelighting ?
|
||||||
(u32)xfregs.colChans[i].color.hex :
|
(u32)xfregs.colChans[i].color.hex :
|
||||||
(u32)xfregs.colChans[i].color.matsource;
|
(u32)xfregs.colChans[i].color.matsource;
|
||||||
id.values[1+i] |= (xfregs.colChans[i].alpha.enablelighting ?
|
vid.values[1+i] |= (xfregs.colChans[i].alpha.enablelighting ?
|
||||||
(u32)xfregs.colChans[i].alpha.hex :
|
(u32)xfregs.colChans[i].alpha.hex :
|
||||||
(u32)xfregs.colChans[i].alpha.matsource) << 15;
|
(u32)xfregs.colChans[i].alpha.matsource) << 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fog
|
// fog
|
||||||
id.values[1] |= (((u32)bpmem.fog.c_proj_fsel.fsel & 3) << 30);
|
vid.values[1] |= (((u32)bpmem.fog.c_proj_fsel.fsel & 3) << 30);
|
||||||
id.values[2] |= (((u32)bpmem.fog.c_proj_fsel.fsel >> 2) << 30);
|
vid.values[2] |= (((u32)bpmem.fog.c_proj_fsel.fsel >> 2) << 30);
|
||||||
|
|
||||||
u32* pcurvalue = &id.values[3];
|
u32* pcurvalue = &vid.values[3];
|
||||||
for (int i = 0; i < xfregs.numTexGens; ++i) {
|
for (int i = 0; i < xfregs.numTexGens; ++i) {
|
||||||
TexMtxInfo tinfo = xfregs.texcoords[i].texmtxinfo;
|
TexMtxInfo tinfo = xfregs.texcoords[i].texmtxinfo;
|
||||||
if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP)
|
if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP)
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <OpenGL/CGLRenderers.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void cocoaGLCreateApp();
|
||||||
|
|
||||||
|
NSWindow *cocoaGLCreateWindow(int w,int h);
|
||||||
|
|
||||||
|
void cocoaGLSetTitle();
|
||||||
|
|
||||||
|
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win);
|
||||||
|
|
||||||
|
NSOpenGLContext* cocoaGLInit(int mode);
|
||||||
|
|
||||||
|
void cocoaGLDelete(NSOpenGLContext *ctx);
|
||||||
|
|
||||||
|
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
#import "cocoaGL.h"
|
||||||
|
|
||||||
|
@implementation NSApplication(i)
|
||||||
|
- (void)appRunning
|
||||||
|
{
|
||||||
|
_running = 1;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface cocoaAppDelegate : NSObject
|
||||||
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation cocoaAppDelegate : NSObject
|
||||||
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
|
{
|
||||||
|
return NSTerminateCancel;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
void cocoaGLCreateApp()
|
||||||
|
{
|
||||||
|
ProcessSerialNumber psn;
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
|
if (!GetCurrentProcess(&psn)) {
|
||||||
|
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||||
|
SetFrontProcess(&psn);
|
||||||
|
}
|
||||||
|
|
||||||
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
if (NSApp == nil) {
|
||||||
|
[NSApplication sharedApplication];
|
||||||
|
//TODO : Create menu
|
||||||
|
[NSApp finishLaunching];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([NSApp delegate] == nil) {
|
||||||
|
[NSApp setDelegate:[[cocoaAppDelegate alloc] init]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[NSApp appRunning];
|
||||||
|
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NSWindow *cocoaGLCreateWindow(int w,int h)
|
||||||
|
{
|
||||||
|
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
NSWindow *window;
|
||||||
|
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(50,50,w,h)
|
||||||
|
styleMask:NSTitledWindowMask | NSResizableWindowMask
|
||||||
|
backing:NSBackingStoreBuffered
|
||||||
|
defer:FALSE];
|
||||||
|
|
||||||
|
[window setTitle:@"Dolphin on OSX"];
|
||||||
|
[window makeKeyAndOrderFront: nil];
|
||||||
|
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cocoaGLSetTitle()
|
||||||
|
{
|
||||||
|
//todo
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
int value = 0;
|
||||||
|
[ctx setValues:&value forParameter:NSOpenGLCPSwapInterval];
|
||||||
|
|
||||||
|
if (ctx) {
|
||||||
|
|
||||||
|
[ctx setView:[win contentView]];
|
||||||
|
[ctx update];
|
||||||
|
[ctx makeCurrentContext];
|
||||||
|
} else {
|
||||||
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
}
|
||||||
|
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NSOpenGLContext* cocoaGLInit(int mode)
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
|
NSOpenGLPixelFormatAttribute attr[32];
|
||||||
|
NSOpenGLPixelFormat *fmt;
|
||||||
|
NSOpenGLContext *context;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
attr[i++] = NSOpenGLPFADepthSize;
|
||||||
|
attr[i++] = 24;
|
||||||
|
attr[i++] = NSOpenGLPFADoubleBuffer;
|
||||||
|
|
||||||
|
attr[i++] = NSOpenGLPFASampleBuffers;
|
||||||
|
attr[i++] = mode;
|
||||||
|
attr[i++] = NSOpenGLPFASamples;
|
||||||
|
attr[i++] = 1;
|
||||||
|
|
||||||
|
//if opengl < 1.3 uncomment this twoo lines to use software renderer
|
||||||
|
//attr[i++] = NSOpenGLPFARendererID;
|
||||||
|
//attr[i++] = kCGLRendererGenericFloatID;
|
||||||
|
|
||||||
|
attr[i++] = NSOpenGLPFAScreenMask;
|
||||||
|
attr[i++] = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID());
|
||||||
|
|
||||||
|
attr[i] = 0;
|
||||||
|
|
||||||
|
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||||
|
if (fmt == nil) {
|
||||||
|
printf("failed to create pixel format\n");
|
||||||
|
[pool release];
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
|
||||||
|
|
||||||
|
[fmt release];
|
||||||
|
|
||||||
|
if (context == nil) {
|
||||||
|
printf("failed to create context\n");
|
||||||
|
[pool release];
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
return context;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void cocoaGLDelete(NSOpenGLContext *ctx)
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
[ctx clearDrawable];
|
||||||
|
[ctx release];
|
||||||
|
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window)
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
[window makeKeyAndOrderFront: nil];
|
||||||
|
|
||||||
|
ctx = [NSOpenGLContext currentContext];
|
||||||
|
if (ctx != nil) {
|
||||||
|
[ctx flushBuffer];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("bad cocoa gl ctx\n");
|
||||||
|
}
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
}
|
|
@ -21,11 +21,13 @@
|
||||||
#include "OS/Win32.h"
|
#include "OS/Win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__) && !defined(OSX64)
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OSX64)
|
||||||
#include "GUI/ConfigDlg.h"
|
#include "GUI/ConfigDlg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "LookUpTables.h"
|
#include "LookUpTables.h"
|
||||||
|
@ -45,14 +47,19 @@
|
||||||
#include "XFBConvert.h"
|
#include "XFBConvert.h"
|
||||||
|
|
||||||
#include "VideoState.h"
|
#include "VideoState.h"
|
||||||
|
#if !defined(OSX64)
|
||||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
#include "Debugger/Debugger.h" // for the CDebugger class
|
||||||
|
#endif
|
||||||
SVideoInitialize g_VideoInitialize;
|
SVideoInitialize g_VideoInitialize;
|
||||||
#define VERSION_STRING "0.1"
|
#define VERSION_STRING "0.1"
|
||||||
|
|
||||||
// Create debugging window. We can't use Show() here as usual because then DLL_PROCESS_DETACH will
|
// Create debugging window. We can't use Show() here as usual because then DLL_PROCESS_DETACH will
|
||||||
// be called immediately. And if we use ShowModal() we block the main video window from appearing.
|
// be called immediately. And if we use ShowModal() we block the main video window from appearing.
|
||||||
// So I've made a separate function called DoDllDebugger() that creates the window.
|
// So I've made a separate function called DoDllDebugger() that creates the window.
|
||||||
|
#if defined(OSX64)
|
||||||
|
void DllDebugger(HWND _hParent) { }
|
||||||
|
void DoDllDebugger() { }
|
||||||
|
#else
|
||||||
CDebugger* m_frame;
|
CDebugger* m_frame;
|
||||||
void DllDebugger(HWND _hParent)
|
void DllDebugger(HWND _hParent)
|
||||||
{
|
{
|
||||||
|
@ -71,6 +78,7 @@ void DoDllDebugger()
|
||||||
m_frame = new CDebugger(NULL);
|
m_frame = new CDebugger(NULL);
|
||||||
m_frame->Show();
|
m_frame->Show();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||||
{
|
{
|
||||||
|
@ -289,8 +297,11 @@ bool ScreenShot(TCHAR *File)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if defined(OSX64)
|
||||||
|
unsigned int Video_Screenshot(TCHAR* _szFilename)
|
||||||
|
#else
|
||||||
BOOL Video_Screenshot(TCHAR* _szFilename)
|
BOOL Video_Screenshot(TCHAR* _szFilename)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (ScreenShot(_szFilename))
|
if (ScreenShot(_szFilename))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue