From 6dca01ad274e46383a4a97b4b0c1eabfcd83a7d6 Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Wed, 13 Jan 2021 13:59:28 -0500 Subject: [PATCH 1/3] Annotate properties as nonatomic. --- Cocoa/AppDelegate.h | 12 +++--- Cocoa/BigSurToolbar.h | 2 +- Cocoa/Document.h | 66 ++++++++++++++++----------------- Cocoa/GBAudioClient.h | 6 +-- Cocoa/GBCheatTextFieldCell.h | 2 +- Cocoa/GBCheatWindowController.h | 19 +++++----- Cocoa/GBImageView.h | 10 ++--- Cocoa/GBMemoryByteArray.h | 4 +- Cocoa/GBOpenGLView.h | 2 +- Cocoa/GBPreferencesWindow.h | 44 +++++++++++----------- Cocoa/GBTerminalTextFieldCell.h | 2 +- Cocoa/GBView.h | 10 ++--- 12 files changed, 89 insertions(+), 90 deletions(-) diff --git a/Cocoa/AppDelegate.h b/Cocoa/AppDelegate.h index 8f915653..e74b1916 100644 --- a/Cocoa/AppDelegate.h +++ b/Cocoa/AppDelegate.h @@ -2,15 +2,15 @@ @interface AppDelegate : NSObject -@property IBOutlet NSWindow *preferencesWindow; -@property (strong) IBOutlet NSView *graphicsTab; -@property (strong) IBOutlet NSView *emulationTab; -@property (strong) IBOutlet NSView *audioTab; -@property (strong) IBOutlet NSView *controlsTab; +@property (nonatomic, strong) IBOutlet NSWindow *preferencesWindow; +@property (nonatomic, strong) IBOutlet NSView *graphicsTab; +@property (nonatomic, strong) IBOutlet NSView *emulationTab; +@property (nonatomic, strong) IBOutlet NSView *audioTab; +@property (nonatomic, strong) IBOutlet NSView *controlsTab; - (IBAction)showPreferences: (id) sender; - (IBAction)toggleDeveloperMode:(id)sender; - (IBAction)switchPreferencesTab:(id)sender; -@property (weak) IBOutlet NSMenuItem *linkCableMenuItem; +@property (nonatomic, weak) IBOutlet NSMenuItem *linkCableMenuItem; @end diff --git a/Cocoa/BigSurToolbar.h b/Cocoa/BigSurToolbar.h index ea8b3700..9057d340 100644 --- a/Cocoa/BigSurToolbar.h +++ b/Cocoa/BigSurToolbar.h @@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, NSWindowToolbarStyle) { } API_AVAILABLE(macos(11.0)); @interface NSWindow (toolbarStyle) -@property NSWindowToolbarStyle toolbarStyle API_AVAILABLE(macos(11.0)); +@property (nonatomic) NSWindowToolbarStyle toolbarStyle API_AVAILABLE(macos(11.0)); @end @interface NSImage (SFSymbols) diff --git a/Cocoa/Document.h b/Cocoa/Document.h index bf5d9c0e..b6516467 100644 --- a/Cocoa/Document.h +++ b/Cocoa/Document.h @@ -6,39 +6,39 @@ @class GBCheatWindowController; @interface Document : NSDocument -@property (readonly) GB_gameboy_t *gb; -@property (strong) IBOutlet GBView *view; -@property (strong) IBOutlet NSTextView *consoleOutput; -@property (strong) IBOutlet NSPanel *consoleWindow; -@property (strong) IBOutlet NSTextField *consoleInput; -@property (strong) IBOutlet NSWindow *mainWindow; -@property (strong) IBOutlet NSView *memoryView; -@property (strong) IBOutlet NSPanel *memoryWindow; -@property (readonly) GB_gameboy_t *gameboy; -@property (strong) IBOutlet NSTextField *memoryBankInput; -@property (strong) IBOutlet NSToolbarItem *memoryBankItem; -@property (strong) IBOutlet GBImageView *tilesetImageView; -@property (strong) IBOutlet NSPopUpButton *tilesetPaletteButton; -@property (strong) IBOutlet GBImageView *tilemapImageView; -@property (strong) IBOutlet NSPopUpButton *tilemapPaletteButton; -@property (strong) IBOutlet NSPopUpButton *tilemapMapButton; -@property (strong) IBOutlet NSPopUpButton *TilemapSetButton; -@property (strong) IBOutlet NSButton *gridButton; -@property (strong) IBOutlet NSTabView *vramTabView; -@property (strong) IBOutlet NSPanel *vramWindow; -@property (strong) IBOutlet NSTextField *vramStatusLabel; -@property (strong) IBOutlet NSTableView *paletteTableView; -@property (strong) IBOutlet NSTableView *spritesTableView; -@property (strong) IBOutlet NSPanel *printerFeedWindow; -@property (strong) IBOutlet NSImageView *feedImageView; -@property (strong) IBOutlet NSTextView *debuggerSideViewInput; -@property (strong) IBOutlet NSTextView *debuggerSideView; -@property (strong) IBOutlet GBSplitView *debuggerSplitView; -@property (strong) IBOutlet NSBox *debuggerVerticalLine; -@property (strong) IBOutlet NSPanel *cheatsWindow; -@property (strong) IBOutlet GBCheatWindowController *cheatWindowController; -@property (readonly) Document *partner; -@property (readonly) bool isSlave; +@property (nonatomic, readonly) GB_gameboy_t *gb; +@property (nonatomic, strong) IBOutlet GBView *view; +@property (nonatomic, strong) IBOutlet NSTextView *consoleOutput; +@property (nonatomic, strong) IBOutlet NSPanel *consoleWindow; +@property (nonatomic, strong) IBOutlet NSTextField *consoleInput; +@property (nonatomic, strong) IBOutlet NSWindow *mainWindow; +@property (nonatomic, strong) IBOutlet NSView *memoryView; +@property (nonatomic, strong) IBOutlet NSPanel *memoryWindow; +@property (nonatomic, readonly) GB_gameboy_t *gameboy; +@property (nonatomic, strong) IBOutlet NSTextField *memoryBankInput; +@property (nonatomic, strong) IBOutlet NSToolbarItem *memoryBankItem; +@property (nonatomic, strong) IBOutlet GBImageView *tilesetImageView; +@property (nonatomic, strong) IBOutlet NSPopUpButton *tilesetPaletteButton; +@property (nonatomic, strong) IBOutlet GBImageView *tilemapImageView; +@property (nonatomic, strong) IBOutlet NSPopUpButton *tilemapPaletteButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *tilemapMapButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *TilemapSetButton; +@property (nonatomic, strong) IBOutlet NSButton *gridButton; +@property (nonatomic, strong) IBOutlet NSTabView *vramTabView; +@property (nonatomic, strong) IBOutlet NSPanel *vramWindow; +@property (nonatomic, strong) IBOutlet NSTextField *vramStatusLabel; +@property (nonatomic, strong) IBOutlet NSTableView *paletteTableView; +@property (nonatomic, strong) IBOutlet NSTableView *spritesTableView; +@property (nonatomic, strong) IBOutlet NSPanel *printerFeedWindow; +@property (nonatomic, strong) IBOutlet NSImageView *feedImageView; +@property (nonatomic, strong) IBOutlet NSTextView *debuggerSideViewInput; +@property (nonatomic, strong) IBOutlet NSTextView *debuggerSideView; +@property (nonatomic, strong) IBOutlet GBSplitView *debuggerSplitView; +@property (nonatomic, strong) IBOutlet NSBox *debuggerVerticalLine; +@property (nonatomic, strong) IBOutlet NSPanel *cheatsWindow; +@property (nonatomic, strong) IBOutlet GBCheatWindowController *cheatWindowController; +@property (nonatomic, readonly) Document *partner; +@property (nonatomic, readonly) bool isSlave; -(uint8_t) readMemory:(uint16_t) addr; -(void) writeMemory:(uint16_t) addr value:(uint8_t)value; diff --git a/Cocoa/GBAudioClient.h b/Cocoa/GBAudioClient.h index aa7be8c2..03ed7011 100644 --- a/Cocoa/GBAudioClient.h +++ b/Cocoa/GBAudioClient.h @@ -2,9 +2,9 @@ #import @interface GBAudioClient : NSObject -@property (strong) void (^renderBlock)(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer); -@property (readonly) UInt32 rate; -@property (readonly, getter=isPlaying) bool playing; +@property (nonatomic, strong) void (^renderBlock)(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer); +@property (nonatomic, readonly) UInt32 rate; +@property (nonatomic, readonly, getter=isPlaying) bool playing; -(void) start; -(void) stop; -(id) initWithRendererBlock:(void (^)(UInt32 sampleRate, UInt32 nFrames, GB_sample_t *buffer)) block diff --git a/Cocoa/GBCheatTextFieldCell.h b/Cocoa/GBCheatTextFieldCell.h index 473e0f30..e7fd9177 100644 --- a/Cocoa/GBCheatTextFieldCell.h +++ b/Cocoa/GBCheatTextFieldCell.h @@ -1,5 +1,5 @@ #import @interface GBCheatTextFieldCell : NSTextFieldCell -@property bool usesAddressFormat; +@property (nonatomic) bool usesAddressFormat; @end diff --git a/Cocoa/GBCheatWindowController.h b/Cocoa/GBCheatWindowController.h index f70553e6..eddebc5a 100644 --- a/Cocoa/GBCheatWindowController.h +++ b/Cocoa/GBCheatWindowController.h @@ -3,15 +3,14 @@ #import "Document.h" @interface GBCheatWindowController : NSObject -@property (weak) IBOutlet NSTableView *cheatsTable; -@property (weak) IBOutlet NSTextField *addressField; -@property (weak) IBOutlet NSTextField *valueField; -@property (weak) IBOutlet NSTextField *oldValueField; -@property (weak) IBOutlet NSButton *oldValueCheckbox; -@property (weak) IBOutlet NSTextField *descriptionField; -@property (weak) IBOutlet NSTextField *importCodeField; -@property (weak) IBOutlet NSTextField *importDescriptionField; -@property (weak) IBOutlet Document *document; +@property (nonatomic, weak) IBOutlet NSTableView *cheatsTable; +@property (nonatomic, weak) IBOutlet NSTextField *addressField; +@property (nonatomic, weak) IBOutlet NSTextField *valueField; +@property (nonatomic, weak) IBOutlet NSTextField *oldValueField; +@property (nonatomic, weak) IBOutlet NSButton *oldValueCheckbox; +@property (nonatomic, weak) IBOutlet NSTextField *descriptionField; +@property (nonatomic, weak) IBOutlet NSTextField *importCodeField; +@property (nonatomic, weak) IBOutlet NSTextField *importDescriptionField; +@property (nonatomic, weak) IBOutlet Document *document; - (void)cheatsUpdated; @end - diff --git a/Cocoa/GBImageView.h b/Cocoa/GBImageView.h index d5ee534b..0b93e667 100644 --- a/Cocoa/GBImageView.h +++ b/Cocoa/GBImageView.h @@ -3,17 +3,17 @@ @protocol GBImageViewDelegate; @interface GBImageViewGridConfiguration : NSObject -@property NSColor *color; -@property NSUInteger size; +@property (nonatomic, strong) NSColor *color; +@property (nonatomic) NSUInteger size; - (instancetype) initWithColor: (NSColor *) color size: (NSUInteger) size; @end @interface GBImageView : NSImageView -@property (nonatomic) NSArray *horizontalGrids; -@property (nonatomic) NSArray *verticalGrids; +@property (nonatomic, strong) NSArray *horizontalGrids; +@property (nonatomic, strong) NSArray *verticalGrids; @property (nonatomic) bool displayScrollRect; @property NSRect scrollRect; -@property (weak) IBOutlet id delegate; +@property (nonatomic, weak) IBOutlet id delegate; @end @protocol GBImageViewDelegate diff --git a/Cocoa/GBMemoryByteArray.h b/Cocoa/GBMemoryByteArray.h index e3ed71f8..17abe205 100644 --- a/Cocoa/GBMemoryByteArray.h +++ b/Cocoa/GBMemoryByteArray.h @@ -12,6 +12,6 @@ typedef enum { @interface GBMemoryByteArray : HFByteArray - (instancetype) initWithDocument:(Document *)document; -@property uint16_t selectedBank; -@property GB_memory_mode_t mode; +@property (nonatomic) uint16_t selectedBank; +@property (nonatomic) GB_memory_mode_t mode; @end diff --git a/Cocoa/GBOpenGLView.h b/Cocoa/GBOpenGLView.h index 5f875ab2..66001c9d 100644 --- a/Cocoa/GBOpenGLView.h +++ b/Cocoa/GBOpenGLView.h @@ -2,5 +2,5 @@ #import "GBGLShader.h" @interface GBOpenGLView : NSOpenGLView -@property GBGLShader *shader; +@property (nonatomic) GBGLShader *shader; @end diff --git a/Cocoa/GBPreferencesWindow.h b/Cocoa/GBPreferencesWindow.h index 43a8f1d7..85ad6b37 100644 --- a/Cocoa/GBPreferencesWindow.h +++ b/Cocoa/GBPreferencesWindow.h @@ -2,27 +2,27 @@ #import @interface GBPreferencesWindow : NSWindow -@property IBOutlet NSTableView *controlsTableView; -@property IBOutlet NSPopUpButton *graphicsFilterPopupButton; -@property (strong) IBOutlet NSButton *analogControlsCheckbox; -@property (strong) IBOutlet NSButton *aspectRatioCheckbox; -@property (strong) IBOutlet NSPopUpButton *highpassFilterPopupButton; -@property (strong) IBOutlet NSPopUpButton *colorCorrectionPopupButton; -@property (strong) IBOutlet NSPopUpButton *frameBlendingModePopupButton; -@property (strong) IBOutlet NSPopUpButton *colorPalettePopupButton; -@property (strong) IBOutlet NSPopUpButton *displayBorderPopupButton; -@property (strong) IBOutlet NSPopUpButton *rewindPopupButton; -@property (strong) IBOutlet NSButton *configureJoypadButton; -@property (strong) IBOutlet NSButton *skipButton; -@property (strong) IBOutlet NSMenuItem *bootROMsFolderItem; -@property (strong) IBOutlet NSPopUpButtonCell *bootROMsButton; -@property (strong) IBOutlet NSPopUpButton *rumbleModePopupButton; -@property (weak) IBOutlet NSSlider *temperatureSlider; -@property (weak) IBOutlet NSSlider *interferenceSlider; -@property (weak) IBOutlet NSPopUpButton *dmgPopupButton; -@property (weak) IBOutlet NSPopUpButton *sgbPopupButton; -@property (weak) IBOutlet NSPopUpButton *cgbPopupButton; -@property (weak) IBOutlet NSPopUpButton *preferredJoypadButton; -@property (weak) IBOutlet NSPopUpButton *playerListButton; +@property (nonatomic, strong) IBOutlet NSTableView *controlsTableView; +@property (nonatomic, strong) IBOutlet NSPopUpButton *graphicsFilterPopupButton; +@property (nonatomic, strong) IBOutlet NSButton *analogControlsCheckbox; +@property (nonatomic, strong) IBOutlet NSButton *aspectRatioCheckbox; +@property (nonatomic, strong) IBOutlet NSPopUpButton *highpassFilterPopupButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *colorCorrectionPopupButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *frameBlendingModePopupButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *colorPalettePopupButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *displayBorderPopupButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *rewindPopupButton; +@property (nonatomic, strong) IBOutlet NSButton *configureJoypadButton; +@property (nonatomic, strong) IBOutlet NSButton *skipButton; +@property (nonatomic, strong) IBOutlet NSMenuItem *bootROMsFolderItem; +@property (nonatomic, strong) IBOutlet NSPopUpButtonCell *bootROMsButton; +@property (nonatomic, strong) IBOutlet NSPopUpButton *rumbleModePopupButton; +@property (nonatomic, weak) IBOutlet NSSlider *temperatureSlider; +@property (nonatomic, weak) IBOutlet NSSlider *interferenceSlider; +@property (nonatomic, weak) IBOutlet NSPopUpButton *dmgPopupButton; +@property (nonatomic, weak) IBOutlet NSPopUpButton *sgbPopupButton; +@property (nonatomic, weak) IBOutlet NSPopUpButton *cgbPopupButton; +@property (nonatomic, weak) IBOutlet NSPopUpButton *preferredJoypadButton; +@property (nonatomic, weak) IBOutlet NSPopUpButton *playerListButton; @end diff --git a/Cocoa/GBTerminalTextFieldCell.h b/Cocoa/GBTerminalTextFieldCell.h index 484e0c35..b7603360 100644 --- a/Cocoa/GBTerminalTextFieldCell.h +++ b/Cocoa/GBTerminalTextFieldCell.h @@ -2,5 +2,5 @@ #include @interface GBTerminalTextFieldCell : NSTextFieldCell -@property GB_gameboy_t *gb; +@property (nonatomic) GB_gameboy_t *gb; @end diff --git a/Cocoa/GBView.h b/Cocoa/GBView.h index 26fce14a..f9aab83e 100644 --- a/Cocoa/GBView.h +++ b/Cocoa/GBView.h @@ -14,12 +14,12 @@ typedef enum { @interface GBView : NSView - (void) flip; - (uint32_t *) pixels; -@property (weak) IBOutlet Document *document; -@property GB_gameboy_t *gb; +@property (nonatomic, weak) IBOutlet Document *document; +@property (nonatomic) GB_gameboy_t *gb; @property (nonatomic) GB_frame_blending_mode_t frameBlendingMode; -@property (getter=isMouseHidingEnabled) BOOL mouseHidingEnabled; -@property bool isRewinding; -@property NSView *internalView; +@property (nonatomic, getter=isMouseHidingEnabled) BOOL mouseHidingEnabled; +@property (nonatomic) bool isRewinding; +@property (nonatomic, strong) NSView *internalView; - (void) createInternalView; - (uint32_t *)currentBuffer; - (uint32_t *)previousBuffer; From 1707c8818a75f33cf063f01ef47cb91b1bd094de Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Fri, 15 Jan 2021 00:06:21 -0500 Subject: [PATCH 2/3] Fix broken sprite rendering in the VRAM viewer due to mis-calculation of image data size. --- Cocoa/Document.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cocoa/Document.m b/Cocoa/Document.m index 0beceabd..305eac18 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -1692,7 +1692,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) switch (columnIndex) { case 0: return [Document imageFromData:[NSData dataWithBytesNoCopy:oamInfo[row].image - length:64 * 4 + length:64 * 4 * 2 freeWhenDone:NO] width:8 height:oamHeight From bbfd16f63dbb18e5a4d70985b3c9d54e7b623189 Mon Sep 17 00:00:00 2001 From: phobos2390 Date: Mon, 25 Jan 2021 23:37:46 -0700 Subject: [PATCH 3/3] Fix for tolower extension signed char issue --- SDL/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SDL/main.c b/SDL/main.c index 63a61c91..9025403a 100644 --- a/SDL/main.c +++ b/SDL/main.c @@ -524,9 +524,9 @@ restart: char extension[4] = {0,}; if (path_length > 4) { if (filename[path_length - 4] == '.') { - extension[0] = tolower(filename[path_length - 3]); - extension[1] = tolower(filename[path_length - 2]); - extension[2] = tolower(filename[path_length - 1]); + extension[0] = tolower((unsigned char)filename[path_length - 3]); + extension[1] = tolower((unsigned char)filename[path_length - 2]); + extension[2] = tolower((unsigned char)filename[path_length - 1]); } } if (strcmp(extension, "isx") == 0) {