mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-01 14:15:16 +02:00
Allow disabling the F1 menu through mkxp.json
This commit is contained in:
parent
22138c855a
commit
d568423774
5 changed files with 23 additions and 5 deletions
|
@ -28,6 +28,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
||||||
|
|
||||||
@property (retain,nonatomic) NSString *gameTitle;
|
@property (retain,nonatomic) NSString *gameTitle;
|
||||||
@property (retain,nonatomic) NSNumber *showResetButton;
|
@property (retain,nonatomic) NSNumber *showResetButton;
|
||||||
|
@property (retain,nonatomic) NSNumber *showSettingsButton;
|
||||||
|
|
||||||
-(void)updateFPSDisplay:(uint32_t)value;
|
-(void)updateFPSDisplay:(uint32_t)value;
|
||||||
@end
|
@end
|
||||||
|
@ -36,6 +37,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
||||||
|
|
||||||
@synthesize gameTitle;
|
@synthesize gameTitle;
|
||||||
@synthesize showResetButton;
|
@synthesize showResetButton;
|
||||||
|
@synthesize showSettingsButton;
|
||||||
|
|
||||||
+(MKXPZTouchBar*)sharedTouchBar {
|
+(MKXPZTouchBar*)sharedTouchBar {
|
||||||
if (!_sharedTouchBar)
|
if (!_sharedTouchBar)
|
||||||
|
@ -47,13 +49,20 @@ MKXPZTouchBar *_sharedTouchBar;
|
||||||
self = [super init];
|
self = [super init];
|
||||||
self.delegate = self;
|
self.delegate = self;
|
||||||
|
|
||||||
NSMutableArray *items = [NSMutableArray arrayWithArray:@[@"function", NSTouchBarItemIdentifierFlexibleSpace, @"icon", @"fps", NSTouchBarItemIdentifierFlexibleSpace, @"rebind"]];
|
bool showReset = [showResetButton boolValue];
|
||||||
// Only show the reset button if resetting is enabled
|
bool showSettings = [showSettingsButton boolValue];
|
||||||
if ([showResetButton boolValue]) [items addObject:@"reset"];
|
|
||||||
|
NSMutableArray *items = [NSMutableArray arrayWithArray:@[@"function", NSTouchBarItemIdentifierFlexibleSpace, @"icon", @"fps"]];
|
||||||
|
|
||||||
|
if (showReset || showSettings) {
|
||||||
|
[items addObject:NSTouchBarItemIdentifierFlexibleSpace];
|
||||||
|
if (showReset) [items addObject:@"reset"];
|
||||||
|
if (showSettings) [items addObject:@"rebind"];
|
||||||
|
}
|
||||||
self.defaultItemIdentifiers = items;
|
self.defaultItemIdentifiers = items;
|
||||||
|
|
||||||
fpsLabel = [NSTextField labelWithString:@"Loading..."];
|
fpsLabel = [NSTextField labelWithString:@"Loading..."];
|
||||||
fpsLabel.alignment = NSTextAlignmentCenter;
|
fpsLabel.alignment = (showReset || showSettings) ? NSTextAlignmentCenter : NSTextAlignmentRight;
|
||||||
fpsLabel.font = [NSFont labelFontOfSize:NSFont.smallSystemFontSize];
|
fpsLabel.font = [NSFont labelFontOfSize:NSFont.smallSystemFontSize];
|
||||||
|
|
||||||
functionKeys = [NSSegmentedControl segmentedControlWithLabels:@[@"F5", @"F6", @"F7", @"F8", @"F9"] trackingMode:NSSegmentSwitchTrackingMomentary target:self action:@selector(simFunctionKey)];
|
functionKeys = [NSSegmentedControl segmentedControlWithLabels:@[@"F5", @"F6", @"F7", @"F8", @"F9"] trackingMode:NSSegmentSwitchTrackingMomentary target:self action:@selector(simFunctionKey)];
|
||||||
|
@ -163,6 +172,7 @@ void initTouchBar(SDL_Window *win, Config &conf) {
|
||||||
MKXPZTouchBar.sharedTouchBar.parent = windowinfo.info.cocoa.window;
|
MKXPZTouchBar.sharedTouchBar.parent = windowinfo.info.cocoa.window;
|
||||||
MKXPZTouchBar.sharedTouchBar.gameTitle = @(conf.game.title.c_str());
|
MKXPZTouchBar.sharedTouchBar.gameTitle = @(conf.game.title.c_str());
|
||||||
MKXPZTouchBar.sharedTouchBar.showResetButton = [NSNumber numberWithBool:conf.enableReset];
|
MKXPZTouchBar.sharedTouchBar.showResetButton = [NSNumber numberWithBool:conf.enableReset];
|
||||||
|
MKXPZTouchBar.sharedTouchBar.showSettingsButton = [NSNumber numberWithBool:conf.enableSettings];
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTouchBarFPSDisplay(uint32_t value) {
|
void updateTouchBarFPSDisplay(uint32_t value) {
|
||||||
|
|
|
@ -199,6 +199,11 @@
|
||||||
// (default: enabled)
|
// (default: enabled)
|
||||||
//
|
//
|
||||||
// "enableReset": true,
|
// "enableReset": true,
|
||||||
|
|
||||||
|
// Enable F1/keybinding menu
|
||||||
|
// (default: enabled)
|
||||||
|
//
|
||||||
|
// "enableSettings": true,
|
||||||
|
|
||||||
|
|
||||||
// Allow symlinks for game assets to be followed
|
// Allow symlinks for game assets to be followed
|
||||||
|
|
|
@ -130,6 +130,7 @@ void Config::read(int argc, char *argv[]) {
|
||||||
{"gameFolder", ""},
|
{"gameFolder", ""},
|
||||||
{"anyAltToggleFS", false},
|
{"anyAltToggleFS", false},
|
||||||
{"enableReset", true},
|
{"enableReset", true},
|
||||||
|
{"enableSettings", true},
|
||||||
{"allowSymlinks", false},
|
{"allowSymlinks", false},
|
||||||
{"dataPathOrg", ""},
|
{"dataPathOrg", ""},
|
||||||
{"dataPathApp", ""},
|
{"dataPathApp", ""},
|
||||||
|
@ -235,6 +236,7 @@ try { exp } catch (...) {}
|
||||||
SET_STRINGOPT(gameFolder, gameFolder);
|
SET_STRINGOPT(gameFolder, gameFolder);
|
||||||
SET_OPT(anyAltToggleFS, boolean);
|
SET_OPT(anyAltToggleFS, boolean);
|
||||||
SET_OPT(enableReset, boolean);
|
SET_OPT(enableReset, boolean);
|
||||||
|
SET_OPT(enableSettings, boolean);
|
||||||
SET_OPT(allowSymlinks, boolean);
|
SET_OPT(allowSymlinks, boolean);
|
||||||
SET_STRINGOPT(dataPathOrg, dataPathOrg);
|
SET_STRINGOPT(dataPathOrg, dataPathOrg);
|
||||||
SET_STRINGOPT(dataPathApp, dataPathApp);
|
SET_STRINGOPT(dataPathApp, dataPathApp);
|
||||||
|
|
|
@ -69,6 +69,7 @@ struct Config {
|
||||||
|
|
||||||
bool anyAltToggleFS;
|
bool anyAltToggleFS;
|
||||||
bool enableReset;
|
bool enableReset;
|
||||||
|
bool enableSettings;
|
||||||
bool allowSymlinks;
|
bool allowSymlinks;
|
||||||
bool pathCache;
|
bool pathCache;
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key.keysym.scancode == SDL_SCANCODE_F1)
|
if (event.key.keysym.scancode == SDL_SCANCODE_F1 && rtData.config.enableSettings)
|
||||||
{
|
{
|
||||||
#ifndef MKXPZ_BUILD_XCODE
|
#ifndef MKXPZ_BUILD_XCODE
|
||||||
if (!sMenu)
|
if (!sMenu)
|
||||||
|
|
Loading…
Add table
Reference in a new issue