mirror of
https://github.com/ksherlock/ample.git
synced 2025-01-24 06:29:47 +00:00
enable launching.
This commit is contained in:
parent
9f0b5a5df2
commit
3634890100
@ -23,6 +23,7 @@
|
||||
|
||||
/* kvo */
|
||||
@property NSString *commandLine;
|
||||
@property NSArray *args;
|
||||
|
||||
@property NSString *mameROM;
|
||||
@property BOOL mameWindow;
|
||||
@ -135,9 +136,10 @@ static NSString * JoinArguments(NSArray *argv) {
|
||||
NSMutableString *rv = [NSMutableString new];
|
||||
|
||||
|
||||
unsigned ix = 0;
|
||||
//unsigned ix = 0;
|
||||
[rv appendString: @"mame"];
|
||||
for (NSString *s in argv) {
|
||||
if (ix++) [rv appendString: @" "];
|
||||
[rv appendString: @" "];
|
||||
NSUInteger l = [s length];
|
||||
|
||||
if (!l) {
|
||||
@ -194,7 +196,7 @@ static NSString * JoinArguments(NSArray *argv) {
|
||||
|
||||
NSMutableArray *argv = [NSMutableArray new];
|
||||
|
||||
[argv addObject: @"mame"];
|
||||
//[argv addObject: @"mame"];
|
||||
[argv addObject: _mameROM];
|
||||
|
||||
if (_mameDebug) [argv addObject: @"-debug"];
|
||||
@ -225,23 +227,25 @@ static NSString * JoinArguments(NSArray *argv) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// -speed n
|
||||
// -scale n
|
||||
|
||||
NSArray *args;
|
||||
args = [_slotController args];
|
||||
if ([args count]) {
|
||||
[argv addObjectsFromArray: args];
|
||||
NSArray *tmp;
|
||||
tmp = [_slotController args];
|
||||
if ([tmp count]) {
|
||||
[argv addObjectsFromArray: tmp];
|
||||
}
|
||||
|
||||
args = [_mediaController args];
|
||||
if ([args count]) {
|
||||
[argv addObjectsFromArray: args];
|
||||
|
||||
tmp = [_mediaController args];
|
||||
if ([tmp count]) {
|
||||
[argv addObjectsFromArray: tmp];
|
||||
}
|
||||
|
||||
if (_mameNoThrottle) [argv addObject: @"-nothrottle"];
|
||||
|
||||
|
||||
[self setCommandLine: JoinArguments(argv)]; //[argv componentsJoinedByString:@" "]];
|
||||
[self setArgs: argv];
|
||||
}
|
||||
|
||||
-(IBAction)modelClick:(id)sender {
|
||||
@ -323,6 +327,26 @@ static NSString * JoinArguments(NSArray *argv) {
|
||||
return [a count];
|
||||
}
|
||||
|
||||
#pragma mark - IBActions
|
||||
|
||||
- (IBAction)launchAction:(id)sender {
|
||||
if (![_args count]) return;
|
||||
|
||||
NSError *error = nil;
|
||||
NSURL *url = [NSURL fileURLWithPath: @"/usr/local/bin/mame"];
|
||||
|
||||
NSTask *task = [NSTask launchedTaskWithExecutableURL: url
|
||||
arguments: _args
|
||||
error: &error
|
||||
terminationHandler: ^(NSTask *t){
|
||||
|
||||
|
||||
|
||||
|
||||
}];
|
||||
if (error) NSLog(@"launchAction: %@", error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
@ -740,6 +740,9 @@
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="launchAction:" target="Voe-Tx-rLC" id="469-Yy-fyx"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QSr-Gw-xV3">
|
||||
<rect key="frame" x="18" y="62" width="91" height="18"/>
|
||||
|
@ -2,9 +2,9 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<false/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -47,7 +47,7 @@ const unsigned kMemoryMask = 1 << 16;
|
||||
[super viewDidLoad];
|
||||
// Do view setup here.
|
||||
|
||||
[self setModel: @"apple2gs"];
|
||||
//[self setModel: @"apple2gs"];
|
||||
}
|
||||
|
||||
-(void)reset {
|
||||
@ -272,6 +272,11 @@ static void DeactivateMenus(NSArray *items, NSPopUpButton *button) {
|
||||
|
||||
-(void)loadMachine: (NSString *)model {
|
||||
|
||||
if (!model) {
|
||||
[self resetMachine];
|
||||
return;
|
||||
}
|
||||
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSURL *url= [bundle URLForResource: model withExtension: @"plist"];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user