Skip to content

Commit

Permalink
Quiet some deprecated warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddTheSane committed Aug 1, 2020
1 parent 4248ba8 commit 38a5b2d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cocoa/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

36 changes: 18 additions & 18 deletions Cocoa/Document.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];
});
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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];
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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];
Expand Down Expand Up @@ -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];
}
Expand Down
4 changes: 2 additions & 2 deletions Cocoa/GBCheatWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions Cocoa/GBImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Cocoa/GBPreferencesWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 38a5b2d

Please sign in to comment.