From dd7da2fae96b9ba6bdbc28f7b26469373801f21e Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Thu, 4 Jul 2013 03:07:44 +0000 Subject: Make the plug-ins use ARC in 64-bit mode. Change how the preprocessor macros are managed on OS X. Set the name of the product to the target name. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@85795 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- .../DFXVideo/macsrc/PluginConfigController.m | 54 ++++++++++++---------- macosx/plugins/DFXVideo/macsrc/PluginGLView.m | 17 ++++--- .../DFXVideo/macsrc/PluginWindowController.m | 11 +++-- macosx/plugins/DFXVideo/macsrc/drawgl.m | 3 +- 4 files changed, 51 insertions(+), 34 deletions(-) (limited to 'macosx/plugins/DFXVideo/macsrc') diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m index 83f74540..e4a54e9d 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m @@ -3,7 +3,8 @@ #include "cfg.h" #include "menu.h" #include "externals.h" -#include "SGPUPreferences.h" +#import "SGPUPreferences.h" +#import "ARCBridge.h" #ifdef ENABLE_NLS #include @@ -52,10 +53,11 @@ void AboutDlgProc() NSString *path = [bundle pathForResource:@"Credits" ofType:@"rtf"]; NSAttributedString *credits; if (path) { - credits = [[[NSAttributedString alloc] initWithPath: path - documentAttributes:NULL] autorelease]; + credits = [[NSAttributedString alloc] initWithPath: path + documentAttributes:NULL]; + AUTORELEASEOBJNORETURN(credits); } else { - credits = [[[NSAttributedString alloc] initWithString:@""] autorelease]; + credits = AUTORELEASEOBJ([[NSAttributedString alloc] initWithString:@""]); } // Get Application Icon @@ -125,18 +127,18 @@ void ReadConfig(void) NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:NO], @"FPS Counter", - [NSNumber numberWithBool:NO], @"Auto Full Screen", - [NSNumber numberWithBool:NO], @"Frame Skipping", - [NSNumber numberWithBool:YES], @"Frame Limit", - [NSNumber numberWithBool:NO], @"VSync", - [NSNumber numberWithBool:NO], @"Enable Hacks", - [NSNumber numberWithInt:1], @"Dither Mode", - [NSNumber numberWithUnsignedInt:0], @"Hacks", + @NO, @"FPS Counter", + @NO, @"Auto Full Screen", + @NO, @"Frame Skipping", + @YES, @"Frame Limit", + @NO, @"VSync", + @NO, @"Enable Hacks", + @1, @"Dither Mode", + @((unsigned int)0), @"Hacks", [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], @"VertexShader", [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], @"FragmentShader", [NSNumber numberWithBool:NO], @"UseShader", - [NSNumber numberWithInt:4], @"ShaderQuality", + @4, @"ShaderQuality", nil], PrefsKey, nil]]; @@ -254,24 +256,24 @@ void ReadConfig(void) } - (IBAction)selectShader:(id)sender { - NSOpenPanel *openPanel = [[NSOpenPanel openPanel] retain]; + NSOpenPanel *openPanel = RETAINOBJ([NSOpenPanel openPanel]); [openPanel setAllowsMultipleSelection:NO]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanChooseFiles:YES]; if ([openPanel runModal] == NSFileHandlingPanelOKButton) { if ([sender tag] == 1) { - [vertexPath release]; - vertexPath = [[openPanel URL] copy]; + RELEASEOBJ(vertexPath); + vertexPath = RETAINOBJ([openPanel URL]); [vertexShaderViewablePath setTitleWithMnemonic:[vertexPath path]]; } else { - [fragmentPath release]; - fragmentPath = [[openPanel URL] copy]; + RELEASEOBJ(fragmentPath); + fragmentPath = RETAINOBJ([openPanel URL]); [fragmentShaderViewablePath setTitleWithMnemonic:[fragmentPath path]]; } } - [openPanel release]; + RELEASEOBJ(openPanel); } - (void)loadValues @@ -281,7 +283,7 @@ void ReadConfig(void) ReadConfig(); /* load from preferences */ - [keyValues release]; + RELEASEOBJ(keyValues); keyValues = [[defaults dictionaryForKey:PrefsKey] mutableCopy]; { @@ -299,8 +301,8 @@ void ReadConfig(void) vertexPath = [selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"]; fragmentPath = [selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"]; } - [vertexPath retain]; - [fragmentPath retain]; + RETAINOBJNORETURN(vertexPath); + RETAINOBJNORETURN(fragmentPath); } [fpsCounter setIntValue:[[keyValues objectForKey:@"FPS Counter"] intValue]]; [autoFullScreen setIntValue:[[keyValues objectForKey:@"Auto Full Screen"] intValue]]; @@ -312,8 +314,10 @@ void ReadConfig(void) [ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] intValue]]; [shaderQualitySelector selectItemAtIndex:[[keyValues objectForKey:@"ShaderQuality"] intValue] - 1]; - [vertexShaderViewablePath setTitleWithMnemonic:[vertexPath path]]; - [fragmentShaderViewablePath setTitleWithMnemonic:[fragmentPath path]]; + [vertexShaderViewablePath setTitleWithMnemonic:[vertexPath lastPathComponent]]; + [vertexShaderViewablePath setToolTip:[vertexPath path]]; + [fragmentShaderViewablePath setTitleWithMnemonic:[fragmentPath lastPathComponent]]; + [fragmentShaderViewablePath setToolTip:[fragmentPath path]]; unsigned int hackValues = [[keyValues objectForKey:@"Hacks"] unsignedIntValue]; @@ -335,6 +339,7 @@ void ReadConfig(void) shadersView = [[shadersView subviews] objectAtIndex:0]; } +#if !__has_feature(objc_arc) - (void)dealloc { [vertexPath release]; @@ -343,6 +348,7 @@ void ReadConfig(void) [super dealloc]; } +#endif @end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m index e287c803..ade33fcf 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m @@ -26,6 +26,7 @@ #undef BOOL #include "gpu.h" #include "swap.h" +#import "ARCBridge.h" #include extern time_t tStart; @@ -90,7 +91,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) glLock = [[NSLock alloc] init]; if (nil == glLock) { - [self autorelease]; + AUTORELEASEOBJNORETURN(self); return nil; } @@ -120,12 +121,12 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) if (!pixFmt) { NSLog(@"No OpenGL pixel format found!\n"); - [self release]; + AUTORELEASEOBJNORETURN(self); return nil; } } - [self setPixelFormat:[pixFmt autorelease]]; + [self setPixelFormat:AUTORELEASEOBJ(pixFmt)]; /* long swapInterval = 1 ; @@ -179,7 +180,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) image_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; image_base = (GLubyte *) calloc(((IMAGE_COUNT * image_width * image_height) / 3) * 4, image_depth >> 3); if (image_base == nil) { - [self release]; + AUTORELEASEOBJNORETURN(self); return nil; } @@ -215,12 +216,16 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) [NSOpenGLContext clearCurrentContext]; [glLock unlock]; - [glLock release]; - + if (image_base) free(image_base); + +#if !__has_feature(objc_arc) + [glLock release]; + [super dealloc]; +#endif } - (BOOL)isOpaque diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m index 7bfa656f..47d9a512 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m @@ -18,8 +18,8 @@ #import "PluginWindowController.h" #import "PluginWindow.h" -#import "Carbon/Carbon.h" #include "externals.h" +#import "ARCBridge.h" #undef BOOL NSWindow *gameWindow; @@ -63,13 +63,18 @@ NSRect windowFrame; { if (fullWindow) { [fullWindow orderOut:self]; +#if !__has_feature(objc_arc) + [fullWindow autorelease]; fullWindow = nil; +#endif } windowFrame = [[self window] frame]; +#if !__has_feature(objc_arc) [super dealloc]; +#endif } // forget keyDownEvents @@ -154,7 +159,7 @@ NSRect windowFrame; if (fullWindow) { [fullWindow orderOut:self]; - [fullWindow autorelease]; + AUTORELEASEOBJNORETURN(fullWindow); fullWindow = nil; [[glView openGLContext] setView:glView]; @@ -217,7 +222,7 @@ NSRect windowFrame; return NO; } [[NSNotificationCenter defaultCenter] postNotificationName:@"emuWindowDidClose" object:self]; - [gameController autorelease]; + AUTORELEASEOBJNORETURN(gameController); gameController = nil; gameWindow = nil; diff --git a/macosx/plugins/DFXVideo/macsrc/drawgl.m b/macosx/plugins/DFXVideo/macsrc/drawgl.m index 5eae22dd..f965817b 100755 --- a/macosx/plugins/DFXVideo/macsrc/drawgl.m +++ b/macosx/plugins/DFXVideo/macsrc/drawgl.m @@ -23,6 +23,7 @@ #include "draw.h" #include "gpu.h" #include "menu.h" +#include "ARCBridge.h" //////////////////////////////////////////////////////////////////////////////////// // misc globals @@ -132,7 +133,7 @@ void CloseDisplay(void) { if (gameController) { [gameController close]; - [gameController release]; + RELEASEOBJ(gameController); gameController = nil; gameWindow = nil; } -- cgit v1.2.3