From 532f78740af82edcf4abaa8c4326374d1626164f Mon Sep 17 00:00:00 2001 From: rogerman Date: Thu, 18 Feb 2016 07:35:07 +0000 Subject: [PATCH] Cocoa Port: - Silence a bunch of console warnings. --- desmume/src/cocoa/cocoa_input.mm | 11 ++++++++++- desmume/src/cocoa/cocoa_rom.mm | 4 +--- desmume/src/cocoa/cocoa_util.mm | 5 +++-- desmume/src/cocoa/userinterface/appDelegate.mm | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/desmume/src/cocoa/cocoa_input.mm b/desmume/src/cocoa/cocoa_input.mm index 895eb7edf..d5ce17a77 100644 --- a/desmume/src/cocoa/cocoa_input.mm +++ b/desmume/src/cocoa/cocoa_input.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012-2015 DeSmuME team + Copyright (C) 2012-2016 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -543,12 +543,15 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE); avgMicLevel = 0.0f; } + NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; [self setMicLevel:avgMicLevel]; if (delegate != nil && [delegate respondsToSelector:@selector(doMicLevelUpdateFromController:)]) { [[self delegate] doMicLevelUpdateFromController:self]; } + + [tempPool release]; } - (uint8_t) handleMicSampleRead:(CoreAudioInput *)caInput softwareMic:(AudioGenerator *)sampleGenerator @@ -586,6 +589,8 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE); isEnabled:(BOOL)isHardwareEnabled isLocked:(BOOL)isHardwareLocked { + NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; + if (deviceInfo->objectID == kAudioObjectUnknown) { [self setHardwareMicInfoString:@"No hardware input detected."]; @@ -613,13 +618,17 @@ SineWaveGenerator sineWaveGenerator(250.0, MIC_SAMPLE_RATE); isEnabled:isHardwareEnabled isLocked:isHardwareLocked]; } + + [tempPool release]; } - (void) handleMicHardwareGainChanged:(float)gainValue { if (delegate != nil && [delegate respondsToSelector:@selector(doMicHardwareGainChangedFromController:gain:)]) { + NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; [[self delegate] doMicHardwareGainChangedFromController:self gain:gainValue]; + [tempPool release]; } } diff --git a/desmume/src/cocoa/cocoa_rom.mm b/desmume/src/cocoa/cocoa_rom.mm index 08d6914c5..692dba661 100644 --- a/desmume/src/cocoa/cocoa_rom.mm +++ b/desmume/src/cocoa/cocoa_rom.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2015 DeSmuME team + Copyright (C) 2011-2016 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -273,12 +273,10 @@ static NSMutableDictionary *saveTypeValues = nil; NSString *advscDBPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"Advanscene_DatabasePath"]; if (advscDBPath != nil) { - NSError *xmlError = [[NSError alloc] init]; NSXMLParser *advscDB = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL fileURLWithPath:advscDBPath]]; [advscDB setDelegate:self]; [advscDB parse]; [advscDB release]; - [xmlError release]; } NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"DidLoad", self.fileURL, @"URL", nil]; diff --git a/desmume/src/cocoa/cocoa_util.mm b/desmume/src/cocoa/cocoa_util.mm index c3c17d88d..d202f03b2 100644 --- a/desmume/src/cocoa/cocoa_util.mm +++ b/desmume/src/cocoa/cocoa_util.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012-2013 DeSmuME team + Copyright (C) 2012-2016 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -121,7 +121,8 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain]; + (NSInteger) getIBActionSenderTag:(id)sender { NSInteger senderTag = 0; - if ([sender isKindOfClass:[NSButton class]]) + if ([sender isKindOfClass:[NSButton class]] || + [sender isKindOfClass:[NSMenuItem class]]) { senderTag = [sender tag]; } diff --git a/desmume/src/cocoa/userinterface/appDelegate.mm b/desmume/src/cocoa/userinterface/appDelegate.mm index 0bd1a5732..aa267e54f 100644 --- a/desmume/src/cocoa/userinterface/appDelegate.mm +++ b/desmume/src/cocoa/userinterface/appDelegate.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2015 DeSmuME Team + Copyright (C) 2011-2016 DeSmuME Team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -248,7 +248,7 @@ [emuControl updateMicStatusIcon]; //Bring the application to the front - [NSApp activateIgnoringOtherApps:TRUE]; + [NSApp activateIgnoringOtherApps:YES]; [self restoreDisplayWindowStates]; // Load a new ROM on launch per user preferences.