Remove NSAutoreleasePools that are no longer necessary now that pools
are properly declared at thread entry/exit. I am leaving the ones in Wiiuse while there's still a small hope that it may be used outside of Dolphin, though. Move the fixed MAP_32BIT definition for OS X to Common.h. UDPNunchuk.cpp was deleted, so update the scons build. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5864 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
1e4f3c589d
commit
2bcdf4f5a4
|
@ -257,7 +257,6 @@ env['HAVE_WX'] = 0
|
|||
# OS X specifics
|
||||
if sys.platform == 'darwin':
|
||||
compileFlags.append('-mmacosx-version-min=10.5')
|
||||
cppDefines.append('MAP_32BIT=0')
|
||||
if not env['nowx']:
|
||||
cppDefines.append('HAVE_WX=1')
|
||||
conf = env.Configure(custom_tests = tests)
|
||||
|
@ -322,10 +321,9 @@ if not sys.platform == 'win32' and not sys.platform == 'darwin':
|
|||
wxmods.remove('gl')
|
||||
env['HAVE_WX'] = conf.CheckWXConfig(2.8, wxmods, 0)
|
||||
wxconfig.ParseWXConfig(env)
|
||||
|
||||
if not env['HAVE_WX'] and not env['nowx']:
|
||||
print "WX libraries not found - see config.log"
|
||||
Exit(1)
|
||||
if not env['HAVE_WX']:
|
||||
print "WX libraries not found - see config.log"
|
||||
Exit(1)
|
||||
|
||||
conf.Define('HAVE_WX', env['HAVE_WX'])
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ extern const char *netplay_dolphin_ver;
|
|||
|
||||
#ifdef __APPLE__
|
||||
#if defined HAVE_WX && HAVE_WX
|
||||
#define MAP_32BIT 0 // MAP_32BIT is a Linux-specific mmap(2) flag
|
||||
#define USE_WX 1 // Use wxGLCanvas
|
||||
#endif // HAVE_WX
|
||||
#else // __APPLE__
|
||||
|
|
|
@ -322,14 +322,13 @@ int appleMain(int argc, char *argv[]);
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
cocoaArgc = argc;
|
||||
cocoaArgv = argv;
|
||||
|
||||
cocoaCreateApp();
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
CocoaThread *thread = [[CocoaThread alloc] init];
|
||||
NSEvent *event = [[NSEvent alloc] init];
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@implementation NSApplication(i)
|
||||
- (void)appRunning
|
||||
{
|
||||
_running = 1;
|
||||
_running = 1;
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -14,22 +14,20 @@
|
|||
@implementation cocoaAppDelegate : NSObject
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||
{
|
||||
return NSTerminateCancel;
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
@end
|
||||
|
||||
void cocoaCreateApp()
|
||||
{
|
||||
ProcessSerialNumber psn;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
if (!GetCurrentProcess(&psn)) {
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
TransformProcessType(&psn,
|
||||
kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
}
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (NSApp == nil) {
|
||||
[NSApplication sharedApplication];
|
||||
//TODO : Create menu
|
||||
|
@ -41,16 +39,12 @@ void cocoaCreateApp()
|
|||
}
|
||||
|
||||
[NSApp appRunning];
|
||||
|
||||
[pool release];
|
||||
|
||||
}
|
||||
|
||||
bool cocoaKeyCode(NSEvent *event)
|
||||
{
|
||||
static bool CMDDown = false, QDown = false;
|
||||
bool Return = false;
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSConnection *connec = [[NSConnection new] autorelease];
|
||||
|
||||
|
@ -78,15 +72,11 @@ bool cocoaKeyCode(NSEvent *event)
|
|||
if( QDown && CMDDown )
|
||||
Return = true;
|
||||
|
||||
[pool release];
|
||||
return Return;
|
||||
}
|
||||
|
||||
bool cocoaSendEvent(NSEvent *event)
|
||||
{
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if ( event != nil ) {
|
||||
switch ([event type]) {
|
||||
case NSKeyDown:
|
||||
|
@ -100,10 +90,5 @@ bool cocoaSendEvent(NSEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[pool release];
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,39 +1,27 @@
|
|||
#import "cocoaGL.h"
|
||||
|
||||
NSWindow *cocoaGLCreateWindow(int w,int h)
|
||||
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 = [[NSWindow alloc] initWithContentRect: NSMakeRect(50, 50, w, h)
|
||||
styleMask: NSTitledWindowMask | NSResizableWindowMask
|
||||
backing: NSBackingStoreBuffered defer: FALSE];
|
||||
[window setReleasedWhenClosed: YES];
|
||||
|
||||
[window setTitle:@"Dolphin on OSX"];
|
||||
//[window makeKeyAndOrderFront: nil];
|
||||
|
||||
[pool release];
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void cocoaGLSetTitle(NSWindow *win, const char *title)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[win setTitle: [[[NSString alloc] initWithCString: title encoding: NSASCIIStringEncoding] autorelease]];
|
||||
|
||||
[pool release];
|
||||
[win setTitle: [[[NSString alloc] initWithCString: title
|
||||
encoding: NSASCIIStringEncoding] autorelease]];
|
||||
}
|
||||
|
||||
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
int value = 0;
|
||||
[ctx setValues:&value forParameter:NSOpenGLCPSwapInterval];
|
||||
|
||||
|
@ -44,23 +32,15 @@ void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
|||
}
|
||||
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;
|
||||
|
@ -87,9 +67,8 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
|||
attr[i] = 0;
|
||||
|
||||
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||
if (fmt == nil) {
|
||||
if (fmt == nil) {
|
||||
printf("failed to create pixel format\n");
|
||||
[pool release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -99,51 +78,32 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
|||
|
||||
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 cocoaGLDeleteWindow(NSWindow *window)
|
||||
{
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[window close];
|
||||
[pool release];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window)
|
||||
void cocoaGLSwap(NSOpenGLContext *ctx, NSWindow *window)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
[window makeKeyAndOrderFront: nil];
|
||||
|
||||
ctx = [NSOpenGLContext currentContext];
|
||||
if (ctx != nil)
|
||||
if (ctx != nil)
|
||||
[ctx flushBuffer];
|
||||
else
|
||||
printf("bad cocoa gl ctx\n");
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
|
|
@ -1,39 +1,27 @@
|
|||
#import "cocoaGL.h"
|
||||
|
||||
NSWindow *cocoaGLCreateWindow(int w,int h)
|
||||
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 = [[NSWindow alloc] initWithContentRect: NSMakeRect(50, 50, w, h)
|
||||
styleMask: NSTitledWindowMask | NSResizableWindowMask
|
||||
backing: NSBackingStoreBuffered defer: FALSE];
|
||||
[window setReleasedWhenClosed: YES];
|
||||
|
||||
[window setTitle:@"Dolphin on OSX"];
|
||||
//[window makeKeyAndOrderFront: nil];
|
||||
|
||||
[pool release];
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void cocoaGLSetTitle(NSWindow *win, const char *title)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[win setTitle: [[[NSString alloc] initWithCString: title encoding: NSASCIIStringEncoding] autorelease]];
|
||||
|
||||
[pool release];
|
||||
[win setTitle: [[[NSString alloc] initWithCString: title
|
||||
encoding: NSASCIIStringEncoding] autorelease]];
|
||||
}
|
||||
|
||||
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
int value = 0;
|
||||
[ctx setValues:&value forParameter:NSOpenGLCPSwapInterval];
|
||||
|
||||
|
@ -44,23 +32,15 @@ void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
|||
}
|
||||
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;
|
||||
|
@ -87,9 +67,8 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
|||
attr[i] = 0;
|
||||
|
||||
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||
if (fmt == nil) {
|
||||
if (fmt == nil) {
|
||||
printf("failed to create pixel format\n");
|
||||
[pool release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -99,51 +78,32 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
|||
|
||||
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 cocoaGLDeleteWindow(NSWindow *window)
|
||||
{
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[window close];
|
||||
[pool release];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window)
|
||||
void cocoaGLSwap(NSOpenGLContext *ctx, NSWindow *window)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
[window makeKeyAndOrderFront: nil];
|
||||
|
||||
ctx = [NSOpenGLContext currentContext];
|
||||
if (ctx != nil)
|
||||
if (ctx != nil)
|
||||
[ctx flushBuffer];
|
||||
else
|
||||
printf("bad cocoa gl ctx\n");
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ files = [
|
|||
'WiimoteEmu/Attachment/Classic.cpp',
|
||||
'WiimoteEmu/Attachment/Attachment.cpp',
|
||||
'WiimoteEmu/Attachment/Nunchuk.cpp',
|
||||
'WiimoteEmu/Attachment/UDPNunchuk.cpp',
|
||||
'WiimoteEmu/Attachment/Drums.cpp',
|
||||
'WiimoteEmu/Attachment/Guitar.cpp',
|
||||
'WiimoteEmu/EmuSubroutines.cpp',
|
||||
|
|
Loading…
Reference in New Issue