diff --git a/macos/Dependencies/dependencies.make b/macos/Dependencies/dependencies.make index 47d0b35a..28b1e7f6 100644 --- a/macos/Dependencies/dependencies.make +++ b/macos/Dependencies/dependencies.make @@ -141,7 +141,8 @@ $(LIBDIR)/libpixman-1.a: $(DOWNLOADS)/pixman/Makefile $(DOWNLOADS)/pixman/Makefile: $(DOWNLOADS)/pixman/autogen.sh cd $(DOWNLOADS)/pixman; \ - $(AUTOGEN) --enable-static=yes --enable-shared=no + $(AUTOGEN) --enable-static=yes --enable-shared=no \ + --disable-arm-a64-neon $(DOWNLOADS)/pixman/autogen.sh: $(CLONE) $(GITLAB)/mkxp-z/pixman $(DOWNLOADS)/pixman diff --git a/macos/views/TouchBar.mm b/macos/views/TouchBar.mm index 24c2b863..a92a9e13 100644 --- a/macos/views/TouchBar.mm +++ b/macos/views/TouchBar.mm @@ -27,17 +27,14 @@ MKXPZTouchBar *_sharedTouchBar; } @property (retain,nonatomic) NSString *gameTitle; -@property (retain,nonatomic) NSNumber *showResetButton; -@property (retain,nonatomic) NSNumber *showSettingsButton; -(void)updateFPSDisplay:(uint32_t)value; +-(void)setBarLayoutWithSettingsButton:(bool)showSettings andResetButton:(bool)showReset; @end @implementation MKXPZTouchBar @synthesize gameTitle; -@synthesize showResetButton; -@synthesize showSettingsButton; +(MKXPZTouchBar*)sharedTouchBar { if (!_sharedTouchBar) @@ -45,12 +42,16 @@ MKXPZTouchBar *_sharedTouchBar; return _sharedTouchBar; } --(instancetype)init { - self = [super init]; - self.delegate = self; - - bool showReset = [showResetButton boolValue]; - bool showSettings = [showSettingsButton boolValue]; +-(void)setBarLayoutWithSettingsButton:(bool)showSettings andResetButton:(bool)showReset { + if (!functionKeys) { + functionKeys = [NSSegmentedControl segmentedControlWithLabels:@[@"F5", @"F6", @"F7", @"F8", @"F9"] trackingMode:NSSegmentSwitchTrackingMomentary target:self action:@selector(simFunctionKey)]; + functionKeys.segmentStyle = NSSegmentStyleSeparated; + } + if (!fpsLabel) { + fpsLabel = [NSTextField labelWithString:@"Loading..."]; + fpsLabel.alignment = (showReset || showSettings) ? NSTextAlignmentCenter : NSTextAlignmentRight; + fpsLabel.font = [NSFont labelFontOfSize:NSFont.smallSystemFontSize]; + } NSMutableArray *items = [NSMutableArray arrayWithArray:@[@"function", NSTouchBarItemIdentifierFlexibleSpace]]; @@ -58,20 +59,18 @@ MKXPZTouchBar *_sharedTouchBar; [items addObject:@"icon"]; [items addObject:@"fps"]; [items addObject:NSTouchBarItemIdentifierFlexibleSpace]; - if (showReset) [items addObject:@"reset"]; if (showSettings) [items addObject:@"rebind"]; + if (showReset) [items addObject:@"reset"]; } else { [items addObject:@"fps"]; [items addObject:@"icon"]; } self.defaultItemIdentifiers = items; - - fpsLabel = [NSTextField labelWithString:@"Loading..."]; - fpsLabel.alignment = (showReset || showSettings) ? NSTextAlignmentCenter : NSTextAlignmentRight; - fpsLabel.font = [NSFont labelFontOfSize:NSFont.smallSystemFontSize]; - - functionKeys = [NSSegmentedControl segmentedControlWithLabels:@[@"F5", @"F6", @"F7", @"F8", @"F9"] trackingMode:NSSegmentSwitchTrackingMomentary target:self action:@selector(simFunctionKey)]; - functionKeys.segmentStyle = NSSegmentStyleSeparated; +} + +-(instancetype)init { + self = [super init]; + self.delegate = self; return self; } @@ -173,11 +172,11 @@ void initTouchBar(SDL_Window *win, Config &conf) { SDL_SysWMinfo windowinfo{}; SDL_GetWindowWMInfo(win, &windowinfo); - windowinfo.info.cocoa.window.touchBar = MKXPZTouchBar.sharedTouchBar; - MKXPZTouchBar.sharedTouchBar.parent = windowinfo.info.cocoa.window; - MKXPZTouchBar.sharedTouchBar.gameTitle = @(conf.game.title.c_str()); - MKXPZTouchBar.sharedTouchBar.showResetButton = [NSNumber numberWithBool:conf.enableReset]; - MKXPZTouchBar.sharedTouchBar.showSettingsButton = [NSNumber numberWithBool:conf.enableSettings]; + MKXPZTouchBar *tb = MKXPZTouchBar.sharedTouchBar; + windowinfo.info.cocoa.window.touchBar = tb; + tb.parent = windowinfo.info.cocoa.window; + tb.gameTitle = @(conf.game.title.c_str()); + [tb setBarLayoutWithSettingsButton:conf.enableSettings andResetButton:conf.enableReset]; } void updateTouchBarFPSDisplay(uint32_t value) { diff --git a/src/config.cpp b/src/config.cpp index b25b558f..39451b7d 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -128,7 +128,6 @@ Config::Config() {} void Config::read(int argc, char *argv[]) { auto optsJ = json::object({ {"rgssVersion", 0}, - {"preferMetalRenderer", true}, {"debugMode", false}, {"printFPS", false}, {"winResizable", true}, @@ -143,12 +142,10 @@ void Config::read(int argc, char *argv[]) { {"frameSkip", false}, {"syncToRefreshrate", false}, {"solidFonts", false}, -#ifdef __APPLE__ -#ifdef __x86_64__ - {"preferMetalRenderer", false}, -#else +#if defined(__APPLE__) && defined(__aarch64__) {"preferMetalRenderer", true}, -#endif +#else + {"preferMetalRenderer", false}, #endif {"subImageFix", false}, #ifdef __WIN32__ diff --git a/src/util/sdl-util.h b/src/util/sdl-util.h index edc25f39..839c161c 100644 --- a/src/util/sdl-util.h +++ b/src/util/sdl-util.h @@ -28,9 +28,7 @@ struct AtomicFlag void wait() { - while (SDL_AtomicGet(&atom)) { - usleep(5000); - } + while (SDL_AtomicGet(&atom)) {} } void reset()