mirror of
https://github.com/ksherlock/ample.git
synced 2024-09-27 15:58:52 +00:00
mameMachine -> machine
also add machine name to window title.
This commit is contained in:
parent
37b085e45f
commit
e9d348ec71
@ -434,7 +434,7 @@ DQ
|
|||||||
</tabViewItem>
|
</tabViewItem>
|
||||||
</tabViewItems>
|
</tabViewItems>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="-2" name="hidden" keyPath="mameMachine" id="Fok-Xt-d2z">
|
<binding destination="-2" name="hidden" keyPath="machine" id="odt-eJ-VrX">
|
||||||
<dictionary key="options">
|
<dictionary key="options">
|
||||||
<string key="NSValueTransformerName">NSIsNil</string>
|
<string key="NSValueTransformerName">NSIsNil</string>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
@ -26,6 +26,8 @@ static NSString *kContextMachine = @"kContextMachine";
|
|||||||
|
|
||||||
@interface LaunchWindowController () {
|
@interface LaunchWindowController () {
|
||||||
BOOL _loadingBookmark;
|
BOOL _loadingBookmark;
|
||||||
|
NSString *_machine;
|
||||||
|
NSDictionary *_machineDescription;
|
||||||
}
|
}
|
||||||
@property (strong) IBOutlet MediaViewController *mediaController;
|
@property (strong) IBOutlet MediaViewController *mediaController;
|
||||||
@property (strong) IBOutlet SlotViewController *slotController;
|
@property (strong) IBOutlet SlotViewController *slotController;
|
||||||
@ -39,7 +41,7 @@ static NSString *kContextMachine = @"kContextMachine";
|
|||||||
@property NSString *commandLine;
|
@property NSString *commandLine;
|
||||||
@property NSArray *args;
|
@property NSArray *args;
|
||||||
|
|
||||||
@property NSString *mameMachine;
|
@property NSString *machine;
|
||||||
@property BOOL mameDebug;
|
@property BOOL mameDebug;
|
||||||
@property BOOL mameSquarePixels;
|
@property BOOL mameSquarePixels;
|
||||||
@property BOOL mameMouse;
|
@property BOOL mameMouse;
|
||||||
@ -131,7 +133,7 @@ static int EffectsIndex(NSString *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(void)reset {
|
-(void)reset {
|
||||||
[self setMameMachine: nil];
|
[self setMachine: nil];
|
||||||
|
|
||||||
[self setMameSpeed: 1];
|
[self setMameSpeed: 1];
|
||||||
[self setMameBGFX: YES];
|
[self setMameBGFX: YES];
|
||||||
@ -222,7 +224,7 @@ static void AddSubview(NSView *parent, NSView *child) {
|
|||||||
if (_loadingBookmark) return;
|
if (_loadingBookmark) return;
|
||||||
|
|
||||||
NSString *machine = [_machineViewController machine];
|
NSString *machine = [_machineViewController machine];
|
||||||
[self setMameMachine: machine];
|
[self setMachine: machine];
|
||||||
[_slotController setMachine: machine];
|
[_slotController setMachine: machine];
|
||||||
[self updateSoftwareList];
|
[self updateSoftwareList];
|
||||||
[self buildCommandLine];
|
[self buildCommandLine];
|
||||||
@ -233,6 +235,21 @@ static void AddSubview(NSView *parent, NSView *child) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-(NSString *)machine {
|
||||||
|
return _machine;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)setMachine:(NSString *)machine {
|
||||||
|
if (_machine == machine) return;
|
||||||
|
_machine = machine;
|
||||||
|
_machineDescription = MameMachine(machine);
|
||||||
|
|
||||||
|
NSString *title = _machineDescription
|
||||||
|
? [NSString stringWithFormat: @"Ample – %@", [_machineDescription objectForKey: @"description"]]
|
||||||
|
: @"Ample";
|
||||||
|
|
||||||
|
[[self window] setTitle: title];
|
||||||
|
}
|
||||||
|
|
||||||
static NSString * JoinArguments(NSArray *argv, NSString *argv0) {
|
static NSString * JoinArguments(NSArray *argv, NSString *argv0) {
|
||||||
|
|
||||||
@ -374,7 +391,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
if (!_mameMachine) {
|
if (!_machine) {
|
||||||
[self setCommandLine: @""];
|
[self setCommandLine: @""];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -382,7 +399,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
NSMutableArray *argv = [NSMutableArray new];
|
NSMutableArray *argv = [NSMutableArray new];
|
||||||
|
|
||||||
//[argv addObject: @"mame"];
|
//[argv addObject: @"mame"];
|
||||||
[argv addObject: _mameMachine];
|
[argv addObject: _machine];
|
||||||
|
|
||||||
if (_software) {
|
if (_software) {
|
||||||
NSString *name = [_softwareSet nameForSoftware: _software];
|
NSString *name = [_softwareSet nameForSoftware: _software];
|
||||||
@ -525,7 +542,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
return [_args count] ? YES : NO;
|
return [_args count] ? YES : NO;
|
||||||
}
|
}
|
||||||
if (cmd == @selector(addBookmark:)) {
|
if (cmd == @selector(addBookmark:)) {
|
||||||
return _mameMachine ? YES : NO;
|
return _machine ? YES : NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
@ -547,7 +564,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
|
|
||||||
NSSavePanel *p = [NSSavePanel savePanel];
|
NSSavePanel *p = [NSSavePanel savePanel];
|
||||||
|
|
||||||
NSString *defaultName = [_mameMachine stringByAppendingString: @".sh"];
|
NSString *defaultName = [_machine stringByAppendingString: @".sh"];
|
||||||
|
|
||||||
[p setTitle: @"Export Shell Script"];
|
[p setTitle: @"Export Shell Script"];
|
||||||
[p setExtensionHidden: NO];
|
[p setExtensionHidden: NO];
|
||||||
@ -603,7 +620,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
|
|
||||||
-(void)updateSoftwareList {
|
-(void)updateSoftwareList {
|
||||||
|
|
||||||
_softwareSet = [SoftwareSet softwareSetForMachine: _mameMachine];
|
_softwareSet = [SoftwareSet softwareSetForMachine: _machine];
|
||||||
|
|
||||||
[_softwareListControl setAutocompleteDelegate: _softwareSet];
|
[_softwareListControl setAutocompleteDelegate: _softwareSet];
|
||||||
|
|
||||||
@ -631,12 +648,11 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
|
|
||||||
-(IBAction)addBookmark:(id)sender {
|
-(IBAction)addBookmark:(id)sender {
|
||||||
|
|
||||||
if (!_mameMachine) return;
|
if (!_machine) return;
|
||||||
|
|
||||||
NSString *name = nil;
|
NSString *name = nil;
|
||||||
NSDictionary *d = MameMachine(_mameMachine);
|
if (_machineDescription) name = [_machineDescription objectForKey:@"description"];
|
||||||
if (d) name = [d objectForKey:@"description"];
|
if (!name) name = _machine;
|
||||||
if (!name) name = _mameMachine;
|
|
||||||
|
|
||||||
|
|
||||||
if (_software) {
|
if (_software) {
|
||||||
@ -697,7 +713,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
|
|
||||||
[self reset];
|
[self reset];
|
||||||
|
|
||||||
[self setMameMachine: machine];
|
[self setMachine: machine];
|
||||||
[self updateSoftwareList];
|
[self updateSoftwareList];
|
||||||
[_softwareListControl setObjectValue: nil]; // will reload the completion list.
|
[_softwareListControl setObjectValue: nil]; // will reload the completion list.
|
||||||
|
|
||||||
@ -780,7 +796,7 @@ static NSString *ShellQuote(NSString *s) {
|
|||||||
|
|
||||||
NSMutableDictionary *dict = [NSMutableDictionary new];
|
NSMutableDictionary *dict = [NSMutableDictionary new];
|
||||||
|
|
||||||
[dict setObject: _mameMachine forKey: @"machine"];
|
[dict setObject: _machine forKey: @"machine"];
|
||||||
[dict setObject: @232 forKey: @"version"];
|
[dict setObject: @232 forKey: @"version"];
|
||||||
[_machineViewController saveBookmark: dict];
|
[_machineViewController saveBookmark: dict];
|
||||||
[_slotController saveBookmark: dict];
|
[_slotController saveBookmark: dict];
|
||||||
|
Loading…
Reference in New Issue
Block a user