From 38a5b2d07ac13c5d429c24d37cd8b5403703d1a1 Mon Sep 17 00:00:00 2001 From: "C.W. Betts" Date: Thu, 30 Jul 2020 19:18:28 -0600 Subject: [PATCH] Quiet some deprecated warnings. --- Cocoa/Document.h | 2 +- Cocoa/Document.m | 36 ++++++++++++++++----------------- Cocoa/GBCheatWindowController.m | 4 ++-- Cocoa/GBImageView.m | 6 +++--- Cocoa/GBPreferencesWindow.m | 4 ++-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cocoa/Document.h b/Cocoa/Document.h index 660d7bc27..44a66d417 100644 --- a/Cocoa/Document.h +++ b/Cocoa/Document.h @@ -39,7 +39,7 @@ -(uint8_t) readMemory:(uint16_t) addr; -(void) writeMemory:(uint16_t) addr value:(uint8_t)value; --(void) performAtomicBlock: (void (^)())block; +-(void) performAtomicBlock: (void (^ NS_NOESCAPE)(void))block; @end diff --git a/Cocoa/Document.m b/Cocoa/Document.m index ece80922c..2439b6deb 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -231,7 +231,7 @@ - (void) updateBorderMode - (void) updateRumbleMode { - GB_set_rumble_mode(&gb, [[NSUserDefaults standardUserDefaults] integerForKey:@"GBRumbleMode"]); + GB_set_rumble_mode(&gb, (GB_rumble_mode_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"GBRumbleMode"]); } - (void) initCommon @@ -282,7 +282,7 @@ - (void) vblank GB_set_pixels_output(&gb, self.view.pixels); if (self.vramWindow.isVisible) { dispatch_async(dispatch_get_main_queue(), ^{ - self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0; + self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSWindowStyleMaskFullScreen) != 0; [self reloadVRAMData: nil]; }); } @@ -399,8 +399,8 @@ - (void) run [self.audioClient stop]; self.audioClient = nil; self.view.mouseHidingEnabled = NO; - GB_save_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] UTF8String]); - GB_save_cheats(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"cht"] UTF8String]); + GB_save_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] fileSystemRepresentation]); + GB_save_cheats(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"cht"] fileSystemRepresentation]); unsigned time_to_alarm = GB_time_to_alarm(&gb); if (time_to_alarm) { @@ -425,7 +425,7 @@ - (void) run - (void) start { if (running) return; - self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSFullScreenWindowMask) != 0; + self.view.mouseHidingEnabled = (self.mainWindow.styleMask & NSWindowStyleMaskFullScreen) != 0; [[[NSThread alloc] initWithTarget:self selector:@selector(run) object:nil] start]; } @@ -705,18 +705,18 @@ - (void) loadROM NSString *rom_warnings = [self captureOutputForBlock:^{ GB_debugger_clear_symbols(&gb); if ([[self.fileType pathExtension] isEqualToString:@"isx"]) { - GB_load_isx(&gb, [self.fileName UTF8String]); - GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"ram"] UTF8String]); + GB_load_isx(&gb, [self.fileName fileSystemRepresentation]); + GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"ram"] fileSystemRepresentation]); } else { - GB_load_rom(&gb, [self.fileName UTF8String]); + GB_load_rom(&gb, [self.fileName fileSystemRepresentation]); } - GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] UTF8String]); - GB_load_cheats(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"cht"] UTF8String]); + GB_load_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] fileSystemRepresentation]); + GB_load_cheats(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"cht"] fileSystemRepresentation]); [self.cheatWindowController cheatsUpdated]; - GB_debugger_load_symbol_file(&gb, [[[NSBundle mainBundle] pathForResource:@"registers" ofType:@"sym"] UTF8String]); - GB_debugger_load_symbol_file(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sym"] UTF8String]); + GB_debugger_load_symbol_file(&gb, [[[NSBundle mainBundle] pathForResource:@"registers" ofType:@"sym"] fileSystemRepresentation]); + GB_debugger_load_symbol_file(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sym"] fileSystemRepresentation]); }]; if (rom_warnings && !rom_warning_issued) { rom_warning_issued = true; @@ -1013,7 +1013,7 @@ - (IBAction)saveState:(id)sender { bool __block success = false; [self performAtomicBlock:^{ - success = GB_save_state(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]] UTF8String]) == 0; + success = GB_save_state(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]] fileSystemRepresentation]) == 0; }]; if (!success) { @@ -1027,7 +1027,7 @@ - (IBAction)loadState:(id)sender bool __block success = false; NSString *error = [self captureOutputForBlock:^{ - success = GB_load_state(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]] UTF8String]) == 0; + success = GB_load_state(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:[NSString stringWithFormat:@"s%ld", (long)[sender tag] ]] fileSystemRepresentation]) == 0; }]; if (!success) { @@ -1060,7 +1060,7 @@ - (void) writeMemory:(uint16_t)addr value:(uint8_t)value GB_write_memory(&gb, addr, value); } -- (void) performAtomicBlock: (void (^)())block +- (void) performAtomicBlock: (void (^ NS_NOESCAPE)(void))block { while (!GB_is_inited(&gb)); bool was_running = running && !GB_debugger_is_stopped(&gb); @@ -1073,7 +1073,7 @@ - (void) performAtomicBlock: (void (^)())block } } -- (NSString *) captureOutputForBlock: (void (^)())block +- (NSString *) captureOutputForBlock: (void (^ NS_NOESCAPE)(void))block { capturedOutput = [[NSMutableString alloc] init]; [self performAtomicBlock:block]; @@ -1655,14 +1655,14 @@ - (IBAction)savePrinterFeed:(id)sender NSSavePanel * savePanel = [NSSavePanel savePanel]; [savePanel setAllowedFileTypes:@[@"png"]]; [savePanel beginSheetModalForWindow:self.printerFeedWindow completionHandler:^(NSInteger result) { - if (result == NSFileHandlingPanelOKButton) { + if (result == NSModalResponseOK) { [savePanel orderOut:self]; CGImageRef cgRef = [self.feedImageView.image CGImageForProposedRect:NULL context:nil hints:nil]; NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgRef]; [imageRep setSize:(NSSize){160, self.feedImageView.image.size.height / 2}]; - NSData *data = [imageRep representationUsingType:NSPNGFileType properties:@{}]; + NSData *data = [imageRep representationUsingType:NSBitmapImageFileTypePNG properties:@{}]; [data writeToURL:savePanel.URL atomically:NO]; [self.printerFeedWindow setIsVisible:NO]; } diff --git a/Cocoa/GBCheatWindowController.m b/Cocoa/GBCheatWindowController.m index c10e2a945..fdcb4d615 100644 --- a/Cocoa/GBCheatWindowController.m +++ b/Cocoa/GBCheatWindowController.m @@ -135,7 +135,7 @@ - (void)tableViewSelectionDidChange:(NSNotification *)notification size_t cheatCount; const GB_cheat_t *const *cheats = GB_get_cheats(gb, &cheatCount); - unsigned row = self.cheatsTable.selectedRow; + NSInteger row = self.cheatsTable.selectedRow; const GB_cheat_t *cheat = NULL; if (row >= cheatCount) { static const GB_cheat_t template = { @@ -203,7 +203,7 @@ - (IBAction)updateCheat:(id)sender size_t cheatCount; const GB_cheat_t *const *cheats = GB_get_cheats(gb, &cheatCount); - unsigned row = self.cheatsTable.selectedRow; + NSInteger row = self.cheatsTable.selectedRow; [self.document performAtomicBlock:^{ if (row >= cheatCount) { diff --git a/Cocoa/GBImageView.m b/Cocoa/GBImageView.m index 3525e72ec..1f9a2b7d6 100644 --- a/Cocoa/GBImageView.m +++ b/Cocoa/GBImageView.m @@ -76,19 +76,19 @@ - (void)drawRect:(NSRect)dirtyRect - (void)setHorizontalGrids:(NSArray *)horizontalGrids { self->_horizontalGrids = horizontalGrids; - [self setNeedsDisplay]; + [self setNeedsDisplay:YES]; } - (void)setVerticalGrids:(NSArray *)verticalGrids { self->_verticalGrids = verticalGrids; - [self setNeedsDisplay]; + [self setNeedsDisplay:YES]; } - (void)setDisplayScrollRect:(bool)displayScrollRect { self->_displayScrollRect = displayScrollRect; - [self setNeedsDisplay]; + [self setNeedsDisplay:YES]; } - (void)updateTrackingAreas diff --git a/Cocoa/GBPreferencesWindow.m b/Cocoa/GBPreferencesWindow.m index aa219d867..ac7428167 100644 --- a/Cocoa/GBPreferencesWindow.m +++ b/Cocoa/GBPreferencesWindow.m @@ -260,13 +260,13 @@ - (IBAction)highpassFilterChanged:(id)sender - (IBAction)changeAnalogControls:(id)sender { - [[NSUserDefaults standardUserDefaults] setBool: [(NSButton *)sender state] == NSOnState + [[NSUserDefaults standardUserDefaults] setBool: [(NSButton *)sender state] == NSControlStateValueOn forKey:@"GBAnalogControls"]; } - (IBAction)changeAspectRatio:(id)sender { - [[NSUserDefaults standardUserDefaults] setBool: [(NSButton *)sender state] != NSOnState + [[NSUserDefaults standardUserDefaults] setBool: [(NSButton *)sender state] != NSControlStateValueOn forKey:@"GBAspectRatioUnkept"]; [[NSNotificationCenter defaultCenter] postNotificationName:@"GBAspectChanged" object:nil]; }