mirror of
https://github.com/ksherlock/ample.git
synced 2025-01-24 21:33:37 +00:00
Change wording on system mame preference.
disable path when using standard mame new functions to calculate mame executable path.
This commit is contained in:
parent
1f47c7be88
commit
348353199f
@ -33,6 +33,7 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="pathChanged:" target="-2" id="RRj-dC-q2y"/>
|
<action selector="pathChanged:" target="-2" id="RRj-dC-q2y"/>
|
||||||
|
<binding destination="yvB-HG-64y" name="enabled" keyPath="values.UseCustomMame" id="iex-A9-Db6"/>
|
||||||
<binding destination="yvB-HG-64y" name="value" keyPath="values.MamePath" id="H3O-1l-peo"/>
|
<binding destination="yvB-HG-64y" name="value" keyPath="values.MamePath" id="H3O-1l-peo"/>
|
||||||
</connections>
|
</connections>
|
||||||
</textField>
|
</textField>
|
||||||
@ -57,14 +58,14 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="j7D-jC-17Q">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="j7D-jC-17Q">
|
||||||
<rect key="frame" x="96" y="208" width="137" height="18"/>
|
<rect key="frame" x="96" y="208" width="139" height="18"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<buttonCell key="cell" type="check" title="Use System MAME" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="V61-mz-QFo">
|
<buttonCell key="cell" type="check" title="Use Custom MAME" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="V61-mz-QFo">
|
||||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
<connections>
|
<connections>
|
||||||
<binding destination="yvB-HG-64y" name="value" keyPath="values.UseSystemMame" id="jIh-qD-e5H"/>
|
<binding destination="yvB-HG-64y" name="value" keyPath="values.UseCustomMame" id="lH4-dm-kQC"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>UseSystemMame</key>
|
<key>UseCustomMame</key>
|
||||||
<true/>
|
<false/>
|
||||||
<key>AutoCloseLogWindow</key>
|
<key>AutoCloseLogWindow</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>MamePath</key>
|
<key>MamePath</key>
|
||||||
|
@ -91,6 +91,39 @@ static NSString *kContextMachine = @"kContextMachine";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NSURL *MameURL(void) {
|
||||||
|
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
NSBundle *bundle = [NSBundle mainBundle];
|
||||||
|
|
||||||
|
if ([defaults boolForKey: @"UseSystemMame"]) {
|
||||||
|
NSString *path = [defaults stringForKey: @"MamePath"];
|
||||||
|
if (![path length]) return [NSURL fileURLWithPath: path];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [bundle URLForAuxiliaryExecutable: @"mame64"];
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *MamePath(void) {
|
||||||
|
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
NSBundle *bundle = [NSBundle mainBundle];
|
||||||
|
|
||||||
|
NSString *path;
|
||||||
|
|
||||||
|
if ([defaults boolForKey: @"UseCustomMame"]) {
|
||||||
|
path = [defaults stringForKey: @"MamePath"];
|
||||||
|
if ([path length]) return path;
|
||||||
|
}
|
||||||
|
path = [bundle pathForAuxiliaryExecutable: @"mame64"];
|
||||||
|
if ([path length]) return path;
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static NSString * JoinArguments(NSArray *argv) {
|
static NSString * JoinArguments(NSArray *argv) {
|
||||||
|
|
||||||
static NSCharacterSet *safe = nil;
|
static NSCharacterSet *safe = nil;
|
||||||
@ -110,7 +143,10 @@ static NSString * JoinArguments(NSArray *argv) {
|
|||||||
|
|
||||||
|
|
||||||
//unsigned ix = 0;
|
//unsigned ix = 0;
|
||||||
[rv appendString: @"mame"];
|
//[rv appendString: @"mame"];
|
||||||
|
NSString *path = MamePath();
|
||||||
|
path = path ? [path lastPathComponent] : @"mame";
|
||||||
|
[rv appendString: path];
|
||||||
for (NSString *s in argv) {
|
for (NSString *s in argv) {
|
||||||
[rv appendString: @" "];
|
[rv appendString: @" "];
|
||||||
NSUInteger l = [s length];
|
NSUInteger l = [s length];
|
||||||
@ -224,17 +260,20 @@ static NSString * JoinArguments(NSArray *argv) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (IBAction)launchAction:(id)sender {
|
- (IBAction)launchAction:(id)sender {
|
||||||
|
|
||||||
if (![_args count]) return;
|
if (![_args count]) return;
|
||||||
|
|
||||||
|
NSURL *url = MameURL();
|
||||||
|
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
if (!url) {
|
||||||
|
NSAlert *alert = [NSAlert new];
|
||||||
|
|
||||||
NSString *path = [defaults stringForKey: @"MamePath"];
|
[alert setMessageText: @"Unable to find MAME executable path"];
|
||||||
if (![path length]) path = @"/usr/local/bin/mame";
|
[alert runModal];
|
||||||
|
return;
|
||||||
NSURL *url = [NSURL fileURLWithPath: path];
|
}
|
||||||
|
|
||||||
NSTask *task = [NSTask new];
|
NSTask *task = [NSTask new];
|
||||||
[task setExecutableURL: url];
|
[task setExecutableURL: url];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user