mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +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) NSNumber *showResetButton;
|
||||
@property (retain,nonatomic) NSNumber *showSettingsButton;
|
||||
|
||||
-(void)updateFPSDisplay:(uint32_t)value;
|
||||
@end
|
||||
|
@ -36,6 +37,7 @@ MKXPZTouchBar *_sharedTouchBar;
|
|||
|
||||
@synthesize gameTitle;
|
||||
@synthesize showResetButton;
|
||||
@synthesize showSettingsButton;
|
||||
|
||||
+(MKXPZTouchBar*)sharedTouchBar {
|
||||
if (!_sharedTouchBar)
|
||||
|
@ -47,13 +49,20 @@ MKXPZTouchBar *_sharedTouchBar;
|
|||
self = [super init];
|
||||
self.delegate = self;
|
||||
|
||||
NSMutableArray *items = [NSMutableArray arrayWithArray:@[@"function", NSTouchBarItemIdentifierFlexibleSpace, @"icon", @"fps", NSTouchBarItemIdentifierFlexibleSpace, @"rebind"]];
|
||||
// Only show the reset button if resetting is enabled
|
||||
if ([showResetButton boolValue]) [items addObject:@"reset"];
|
||||
bool showReset = [showResetButton boolValue];
|
||||
bool showSettings = [showSettingsButton boolValue];
|
||||
|
||||
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;
|
||||
|
||||
fpsLabel = [NSTextField labelWithString:@"Loading..."];
|
||||
fpsLabel.alignment = NSTextAlignmentCenter;
|
||||
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)];
|
||||
|
@ -163,6 +172,7 @@ void initTouchBar(SDL_Window *win, Config &conf) {
|
|||
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];
|
||||
}
|
||||
|
||||
void updateTouchBarFPSDisplay(uint32_t value) {
|
||||
|
|
|
@ -200,6 +200,11 @@
|
|||
//
|
||||
// "enableReset": true,
|
||||
|
||||
// Enable F1/keybinding menu
|
||||
// (default: enabled)
|
||||
//
|
||||
// "enableSettings": true,
|
||||
|
||||
|
||||
// Allow symlinks for game assets to be followed
|
||||
// (default: disabled)
|
||||
|
|
|
@ -130,6 +130,7 @@ void Config::read(int argc, char *argv[]) {
|
|||
{"gameFolder", ""},
|
||||
{"anyAltToggleFS", false},
|
||||
{"enableReset", true},
|
||||
{"enableSettings", true},
|
||||
{"allowSymlinks", false},
|
||||
{"dataPathOrg", ""},
|
||||
{"dataPathApp", ""},
|
||||
|
@ -235,6 +236,7 @@ try { exp } catch (...) {}
|
|||
SET_STRINGOPT(gameFolder, gameFolder);
|
||||
SET_OPT(anyAltToggleFS, boolean);
|
||||
SET_OPT(enableReset, boolean);
|
||||
SET_OPT(enableSettings, boolean);
|
||||
SET_OPT(allowSymlinks, boolean);
|
||||
SET_STRINGOPT(dataPathOrg, dataPathOrg);
|
||||
SET_STRINGOPT(dataPathApp, dataPathApp);
|
||||
|
|
|
@ -69,6 +69,7 @@ struct Config {
|
|||
|
||||
bool anyAltToggleFS;
|
||||
bool enableReset;
|
||||
bool enableSettings;
|
||||
bool allowSymlinks;
|
||||
bool pathCache;
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
break;
|
||||
}
|
||||
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_F1)
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_F1 && rtData.config.enableSettings)
|
||||
{
|
||||
#ifndef MKXPZ_BUILD_XCODE
|
||||
if (!sMenu)
|
||||
|
|
Loading…
Add table
Reference in a new issue