Skip to content

Commit

Permalink
natural keyboard, layout awareness.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksherlock committed Jan 18, 2025
1 parent 9c4d8ea commit 7bb5776
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Ample/LaunchWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,36 @@
return [dict objectForKey: machine];
}

static BOOL NeedsNatural(NSString *machine) {

static NSSet *set = nil;

/* these all have really strange keyboards */
if (!set) {
NSArray *machines = @[
@"bbcb", @"bbca", @"bbcb_de", @"bbcb_us", @"bbcb_no", @"bbcbp", @"bbcbp128", @"bbcm", @"bbcmt", @"bbcmc", @"electron",
@"c64", @"c64c", @"c128"
];
set = [NSSet setWithArray: machines];
}
return [set containsObject: machine];
}

static BOOL HasLayout(NSString *machine) {

static NSSet *set = nil;

/* these have a layout which adds 10% to the height. */
if (!set) {
NSArray *machines = @[
@"bbcb", @"bbca", @"bbcb_de", @"bbcb_us", @"bbcb_no", @"bbcbp", @"bbcbp128", @"bbcm", @"bbcmt", @"bbcmc", @"electron",
@"vt100", @"vt101", @"vt102", @"vt105", @"vt131", @"vt180"
];
set = [NSSet setWithArray: machines];
}
return [set containsObject: machine];
}

@interface LaunchWindowController () {
BOOL _loadingBookmark;
NSString *_machine;
Expand Down Expand Up @@ -483,6 +513,9 @@ -(void)buildCommandLine {
// -confirm_quit?
[argv addObject: @"-skip_gameinfo"];

// natural keyboard on by default.
if (NeedsNatural(_machine))
[argv addObject: @"-natural"];

if (_mameMouse)
[argv addObject: @"-mouse"]; // capture the mouse cursor when over the window.
Expand Down Expand Up @@ -533,6 +566,10 @@ -(void)buildCommandLine {
screen.height = round(screen.width * 3 / 4);
}

if (HasLayout(_machine)) {
screen.height = round(screen.height * 1.1);
}

[argv addObject: @"-window"];
NSString *res = [NSString stringWithFormat: @"%ux%u",
(unsigned)(_mameWindowMode * screen.width),
Expand Down

0 comments on commit 7bb5776

Please sign in to comment.