mirror of
https://github.com/ksherlock/ample.git
synced 2025-01-23 15:30:08 +00:00
updates
This commit is contained in:
parent
568b653200
commit
12dd0e2c5e
@ -115,6 +115,7 @@ static NSString *kMyContext = @"kMyContext";
|
|||||||
|
|
||||||
-(void)buildCommandLine {
|
-(void)buildCommandLine {
|
||||||
|
|
||||||
|
static NSString *EmptyArg = @"\"\"";
|
||||||
|
|
||||||
if (!_mameROM) {
|
if (!_mameROM) {
|
||||||
[self setCommandLine: @""];
|
[self setCommandLine: @""];
|
||||||
@ -154,10 +155,14 @@ static NSString *kMyContext = @"kMyContext";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NSArray *args = [_slotController args];
|
NSArray *args = [_slotController args];
|
||||||
if ([args count]) {
|
for (NSString *x in args) {
|
||||||
[argv addObjectsFromArray: args];
|
[argv addObject: [x length] ? x : EmptyArg];
|
||||||
}
|
}
|
||||||
|
// if ([args count]) {
|
||||||
|
// [argv addObjectsFromArray: args];
|
||||||
|
// }
|
||||||
|
|
||||||
if (_mameNoThrottle) [argv addObject: @"-nothrottle"];
|
if (_mameNoThrottle) [argv addObject: @"-nothrottle"];
|
||||||
|
|
||||||
|
@ -763,13 +763,6 @@
|
|||||||
<binding destination="Voe-Tx-rLC" name="value" keyPath="self.mameSquarePixels" id="rNk-1d-QZl"/>
|
<binding destination="Voe-Tx-rLC" name="value" keyPath="self.mameSquarePixels" id="rNk-1d-QZl"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<pathControl verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4bN-As-LRL">
|
|
||||||
<rect key="frame" x="398" y="96" width="204" height="25"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
||||||
<pathCell key="cell" selectable="YES" editable="YES" alignment="left" placeholderString="Floppy 1" pathStyle="popUp" id="3aA-ge-m45">
|
|
||||||
<font key="font" metaFont="system"/>
|
|
||||||
</pathCell>
|
|
||||||
</pathControl>
|
|
||||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cFJ-CO-Dzm" customClass="FlippedView">
|
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cFJ-CO-Dzm" customClass="FlippedView">
|
||||||
<rect key="frame" x="20" y="169" width="306" height="570"/>
|
<rect key="frame" x="20" y="169" width="306" height="570"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="306" height="500"/>
|
<rect key="frame" x="0.0" y="0.0" width="306" height="500"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="none" selectionHighlightStyle="none" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="16" outlineTableColumn="pBj-py-R6a" id="sIz-DD-PZQ">
|
<outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="none" selectionHighlightStyle="none" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" outlineTableColumn="pBj-py-R6a" id="sIz-DD-PZQ">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="306" height="500"/>
|
<rect key="frame" x="0.0" y="0.0" width="306" height="500"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<size key="intercellSpacing" width="2" height="3"/>
|
<size key="intercellSpacing" width="2" height="3"/>
|
||||||
@ -78,11 +78,18 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</tableCellView>
|
</tableCellView>
|
||||||
<tableCellView identifier="ItemView" id="yGq-lc-RCM" customClass="TablePathView">
|
<tableCellView identifier="ItemView" id="yGq-lc-RCM" customClass="TablePathView">
|
||||||
<rect key="frame" x="1" y="41" width="304" height="40"/>
|
<rect key="frame" x="1" y="41" width="304" height="27"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
<pathControl verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f7R-TO-fmF">
|
||||||
|
<rect key="frame" x="0.0" y="1" width="251" height="22"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||||
|
<pathCell key="cell" controlSize="small" selectable="YES" editable="YES" alignment="left" pathStyle="popUp" id="dcz-8y-tKb">
|
||||||
|
<font key="font" metaFont="smallSystem"/>
|
||||||
|
</pathCell>
|
||||||
|
</pathControl>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zNo-ij-mUl">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zNo-ij-mUl">
|
||||||
<rect key="frame" x="273" y="5" width="33" height="27"/>
|
<rect key="frame" x="278" y="4" width="23" height="18"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||||
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSStopProgressFreestandingTemplate" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="IZA-Tu-olu">
|
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSStopProgressFreestandingTemplate" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="IZA-Tu-olu">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
@ -92,15 +99,14 @@
|
|||||||
<action selector="buttonDelete:" target="-2" id="f30-YS-1UK"/>
|
<action selector="buttonDelete:" target="-2" id="f30-YS-1UK"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<pathControl verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f7R-TO-fmF">
|
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="jeU-0Q-Eps">
|
||||||
<rect key="frame" x="0.0" y="8" width="207" height="22"/>
|
<rect key="frame" x="256" y="6" width="14" height="14"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMinY="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<pathCell key="cell" controlSize="small" selectable="YES" editable="YES" alignment="left" pathStyle="popUp" id="dcz-8y-tKb">
|
<imageCell key="cell" enabled="NO" refusesFirstResponder="YES" alignment="left" image="NSStatusUnavailable" id="dtr-VF-lvn"/>
|
||||||
<font key="font" metaFont="smallSystem"/>
|
</imageView>
|
||||||
</pathCell>
|
|
||||||
</pathControl>
|
|
||||||
</subviews>
|
</subviews>
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="imageView" destination="jeU-0Q-Eps" id="Cjz-C6-w1l"/>
|
||||||
<outlet property="pathControl" destination="f7R-TO-fmF" id="oH7-N3-JC7"/>
|
<outlet property="pathControl" destination="f7R-TO-fmF" id="oH7-N3-JC7"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableCellView>
|
</tableCellView>
|
||||||
@ -127,6 +133,7 @@
|
|||||||
</scrollView>
|
</scrollView>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
|
<image name="NSStatusUnavailable" width="16" height="16"/>
|
||||||
<image name="NSStopProgressFreestandingTemplate" width="14" height="14"/>
|
<image name="NSStopProgressFreestandingTemplate" width="14" height="14"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
@ -58,15 +58,6 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-(void)prepareCell: (id)cell {
|
|
||||||
[(NSTextFieldCell *)cell setTitle: _title];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(Class)cellClass {
|
|
||||||
return [NSTextFieldCell class];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSString *)viewIdentifier {
|
-(NSString *)viewIdentifier {
|
||||||
return @"CategoryView";
|
return @"CategoryView";
|
||||||
}
|
}
|
||||||
@ -114,15 +105,7 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)prepareCell: (id)cell {
|
|
||||||
[(NSPathCell *)cell setURL: _url];
|
|
||||||
[(NSPathCell *)cell setPathStyle: NSPathStylePopUp];
|
|
||||||
// [(NSTextFieldCell *)cell setTitle: @"xxx"];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(Class)cellClass {
|
|
||||||
return [NSPathCell class];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSString *)viewIdentifier {
|
-(NSString *)viewIdentifier {
|
||||||
return @"ItemView";
|
return @"ItemView";
|
||||||
@ -131,19 +114,6 @@
|
|||||||
-(void)prepareView: (TablePathView *)view {
|
-(void)prepareView: (TablePathView *)view {
|
||||||
NSPathControl *pc = [view pathControl];
|
NSPathControl *pc = [view pathControl];
|
||||||
|
|
||||||
#if 0
|
|
||||||
Class pcClass = [NSPathControl class];
|
|
||||||
if (!pc) {
|
|
||||||
for (NSView *v in [view subviews]) {
|
|
||||||
if ([v isKindOfClass: pcClass]) {
|
|
||||||
pc = v;
|
|
||||||
[view setPathControl: pc];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!pc) return;
|
|
||||||
#endif
|
|
||||||
[pc setURL: _url]; //??? will binding take care of it?
|
[pc setURL: _url]; //??? will binding take care of it?
|
||||||
[pc unbind: @"value"];
|
[pc unbind: @"value"];
|
||||||
[pc bind: @"value" toObject: self withKeyPath: @"url" options: nil];
|
[pc bind: @"value" toObject: self withKeyPath: @"url" options: nil];
|
||||||
@ -244,14 +214,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
|
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
|
||||||
return [item isGroupItem];
|
return NO; //[item isGroupItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
|
||||||
[item prepareCell: cell];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item {
|
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item {
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -8,8 +8,13 @@
|
|||||||
|
|
||||||
#import "SlotViewController.h"
|
#import "SlotViewController.h"
|
||||||
|
|
||||||
|
const unsigned kMemoryMask = 1 << 16;
|
||||||
|
|
||||||
@interface SlotViewController () {
|
@interface SlotViewController () {
|
||||||
|
|
||||||
|
unsigned _slots_explicit;
|
||||||
|
unsigned _slots_valid;
|
||||||
|
unsigned _slots_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (weak) IBOutlet NSPopUpButton *ram_menu;
|
@property (weak) IBOutlet NSPopUpButton *ram_menu;
|
||||||
@ -80,7 +85,10 @@
|
|||||||
[self setMemoryBytes: 0];
|
[self setMemoryBytes: 0];
|
||||||
[self setResolution: NSMakeSize(0, 0)];
|
[self setResolution: NSMakeSize(0, 0)];
|
||||||
|
|
||||||
|
_slots_default = 0;
|
||||||
|
_slots_explicit = 0;
|
||||||
|
_slots_valid = 0;
|
||||||
|
|
||||||
[self setArgs: @[]];
|
[self setArgs: @[]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +99,8 @@ static NSFont *ItalicMenuFont(void) {
|
|||||||
return [NSFont fontWithDescriptor: fd2 size: [font pointSize]];
|
return [NSFont fontWithDescriptor: fd2 size: [font pointSize]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
// entry 0 will always be empty.
|
||||||
|
static int SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
||||||
|
|
||||||
static NSDictionary *attr = nil;
|
static NSDictionary *attr = nil;
|
||||||
if (!attr) {
|
if (!attr) {
|
||||||
@ -114,9 +123,9 @@ static void SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
|||||||
NSString *title = [d objectForKey: @"description"];
|
NSString *title = [d objectForKey: @"description"];
|
||||||
NSAttributedString *t = [[NSAttributedString alloc] initWithString: title attributes: attr];
|
NSAttributedString *t = [[NSAttributedString alloc] initWithString: title attributes: attr];
|
||||||
[item setAttributedTitle: t];
|
[item setAttributedTitle: t];
|
||||||
return;
|
return ix;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)syncMemory {
|
-(void)syncMemory {
|
||||||
@ -124,70 +133,101 @@ static void SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
|||||||
int ix = 0;
|
int ix = 0;
|
||||||
NSArray *items = [_machine objectForKey: @"RAM"];
|
NSArray *items = [_machine objectForKey: @"RAM"];
|
||||||
|
|
||||||
SetDefaultMenu(items, _ram_menu);
|
unsigned default_index = SetDefaultMenu(items, _ram_menu);
|
||||||
|
_slots_valid |= kMemoryMask;
|
||||||
|
_slots_default &= ~kMemoryMask;
|
||||||
|
if (default_index) _slots_default |= kMemoryMask;
|
||||||
|
|
||||||
for (NSDictionary *d in items) {
|
if (_slots_explicit & kMemoryMask) {
|
||||||
unsigned size = [(NSNumber *)[d objectForKey: @"value"] unsignedIntValue];
|
// if ram was explicitly set, try to keep it.
|
||||||
if (size == _memoryBytes) {
|
|
||||||
[_ram_menu selectItemAtIndex: ix];
|
|
||||||
[self setMemory: [d objectForKey: @"description"]];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
++ix;
|
|
||||||
}
|
|
||||||
|
|
||||||
[self setMemoryBytes: 0];
|
for (NSDictionary *d in items) {
|
||||||
[self setMemory: @""];
|
unsigned size = [(NSNumber *)[d objectForKey: @"value"] unsignedIntValue];
|
||||||
[_ram_menu selectItemAtIndex: 0];
|
if (size == _memoryBytes) {
|
||||||
/* set to default */
|
[_ram_menu selectItemAtIndex: ix];
|
||||||
|
[self setMemory: [d objectForKey: @"description"]];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
++ix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_slots_explicit &= ~kMemoryMask;
|
||||||
|
if (default_index) {
|
||||||
|
NSDictionary *d = [items objectAtIndex: default_index];
|
||||||
|
|
||||||
|
[_ram_menu selectItemAtIndex: default_index];
|
||||||
|
[self setMemory: [d objectForKey: @"description"]];
|
||||||
|
[self setMemoryBytes: [(NSNumber *)[d objectForKey: @"value"] unsignedIntValue]];
|
||||||
|
} else {
|
||||||
|
[self setMemoryBytes: 0];
|
||||||
|
[self setMemory: @""];
|
||||||
|
[_ram_menu selectItemAtIndex: 0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)syncSlot: (NSString *)slot button: (NSPopUpButton *)button {
|
-(void)syncSlot: (NSString *)slot button: (NSPopUpButton *)button index: (unsigned)index {
|
||||||
|
|
||||||
NSString *value = [self valueForKey: slot];
|
NSString *value = [self valueForKey: slot];
|
||||||
NSArray *items = [_machine objectForKey: slot];
|
NSArray *items = [_machine objectForKey: slot];
|
||||||
|
|
||||||
SetDefaultMenu(items, button);
|
unsigned mask = 1 << index;
|
||||||
|
|
||||||
if (![value length]) return;
|
|
||||||
|
|
||||||
|
_slots_default &= ~mask;
|
||||||
|
|
||||||
if (![items count]) {
|
if (![items count]) {
|
||||||
[self setValue: @"" forKey: slot];
|
[self setValue: @"" forKey: slot];
|
||||||
|
_slots_explicit &= ~mask;
|
||||||
|
_slots_valid &= ~mask;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_slots_valid |= mask;
|
||||||
|
|
||||||
int ix = 0;
|
unsigned default_index = SetDefaultMenu(items, button);
|
||||||
for (NSDictionary *d in items) {
|
|
||||||
if ([value isEqualToString: [d objectForKey: @"value"]]) {
|
|
||||||
|
|
||||||
[button selectItemAtIndex: ix];
|
if (default_index) _slots_default |= mask;
|
||||||
return;
|
|
||||||
|
|
||||||
|
if (_slots_explicit & mask) {
|
||||||
|
int ix = 0;
|
||||||
|
for (NSDictionary *d in items) {
|
||||||
|
if ([value isEqualToString: [d objectForKey: @"value"]]) {
|
||||||
|
|
||||||
|
[button selectItemAtIndex: ix];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
++ix;
|
||||||
}
|
}
|
||||||
++ix;
|
|
||||||
}
|
}
|
||||||
[self setValue: @"" forKey: slot];
|
_slots_explicit &= ~mask;
|
||||||
[button selectItemAtIndex: 0];
|
if (default_index) {
|
||||||
|
NSDictionary *d = [items objectAtIndex: default_index];
|
||||||
|
[button selectItemAtIndex: default_index];
|
||||||
|
[self setValue: [d objectForKey: @"value"] forKey: slot];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
[self setValue: @"" forKey: slot];
|
||||||
|
[button selectItemAtIndex: 0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)syncSlots {
|
-(void)syncSlots {
|
||||||
|
|
||||||
[self syncMemory];
|
[self syncMemory];
|
||||||
[self syncSlot: @"sl0" button: _sl0_menu];
|
[self syncSlot: @"sl0" button: _sl0_menu index: 0];
|
||||||
[self syncSlot: @"sl1" button: _sl1_menu];
|
[self syncSlot: @"sl1" button: _sl1_menu index: 1];
|
||||||
[self syncSlot: @"sl2" button: _sl2_menu];
|
[self syncSlot: @"sl2" button: _sl2_menu index: 2];
|
||||||
[self syncSlot: @"sl3" button: _sl3_menu];
|
[self syncSlot: @"sl3" button: _sl3_menu index: 3];
|
||||||
[self syncSlot: @"sl4" button: _sl4_menu];
|
[self syncSlot: @"sl4" button: _sl4_menu index: 4];
|
||||||
[self syncSlot: @"sl5" button: _sl5_menu];
|
[self syncSlot: @"sl5" button: _sl5_menu index: 5];
|
||||||
[self syncSlot: @"sl6" button: _sl6_menu];
|
[self syncSlot: @"sl6" button: _sl6_menu index: 6];
|
||||||
[self syncSlot: @"sl7" button: _sl7_menu];
|
[self syncSlot: @"sl7" button: _sl7_menu index: 7];
|
||||||
[self syncSlot: @"rs232" button: _rs232_menu];
|
[self syncSlot: @"rs232" button: _rs232_menu index: 8];
|
||||||
[self syncSlot: @"aux" button: _aux_menu];
|
[self syncSlot: @"aux" button: _aux_menu index: 9];
|
||||||
[self syncSlot: @"exp" button: _exp_menu];
|
[self syncSlot: @"exp" button: _exp_menu index: 10];
|
||||||
[self syncSlot: @"gameio" button: _game_menu];
|
[self syncSlot: @"gameio" button: _game_menu index: 11];
|
||||||
[self syncSlot: @"modem" button: _modem_menu];
|
[self syncSlot: @"modem" button: _modem_menu index: 12];
|
||||||
[self syncSlot: @"printer" button: _printer_menu];
|
[self syncSlot: @"printer" button: _printer_menu index: 13];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)loadMachine: (NSString *)model {
|
-(void)loadMachine: (NSString *)model {
|
||||||
@ -232,6 +272,8 @@ static void SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
|||||||
// NSInteger ix = [sender indexOfSelectedItem];
|
// NSInteger ix = [sender indexOfSelectedItem];
|
||||||
|
|
||||||
NSString *key = Names[tag];
|
NSString *key = Names[tag];
|
||||||
|
|
||||||
|
_slots_explicit |= (1 << tag);
|
||||||
|
|
||||||
NSDictionary *o = [[sender selectedItem] representedObject];
|
NSDictionary *o = [[sender selectedItem] representedObject];
|
||||||
|
|
||||||
@ -248,6 +290,8 @@ static void SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
|||||||
[self setMemory: title];
|
[self setMemory: title];
|
||||||
[self setMemoryBytes: [(NSNumber *)[o objectForKey: @"value"] unsignedIntValue]];
|
[self setMemoryBytes: [(NSNumber *)[o objectForKey: @"value"] unsignedIntValue]];
|
||||||
|
|
||||||
|
_slots_explicit |= kMemoryMask;
|
||||||
|
|
||||||
// if pull-down menu
|
// if pull-down menu
|
||||||
if ([sender pullsDown])
|
if ([sender pullsDown])
|
||||||
[sender setTitle: title];
|
[sender setTitle: title];
|
||||||
@ -255,29 +299,49 @@ static void SetDefaultMenu(NSArray *items, NSPopUpButton *button) {
|
|||||||
[self rebuildArgs];
|
[self rebuildArgs];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL should_add_arg(unsigned slot, unsigned valid_slots, unsigned explicit_slots, unsigned default_slots, NSString *value) {
|
||||||
|
|
||||||
|
unsigned mask = 1 << slot;
|
||||||
|
if (~valid_slots & mask) return NO;
|
||||||
|
|
||||||
|
if (default_slots & mask) {
|
||||||
|
if (explicit_slots & mask)
|
||||||
|
return YES;
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
return [value length];
|
||||||
|
}
|
||||||
|
|
||||||
-(void)rebuildArgs {
|
-(void)rebuildArgs {
|
||||||
|
|
||||||
NSMutableArray *args = [NSMutableArray new];
|
NSMutableArray *args = [NSMutableArray new];
|
||||||
|
|
||||||
#define _(a, b) if ([a length]) { [args addObject: b]; [args addObject: a]; }
|
|
||||||
|
/* if there IS a default card for the slot and nothing is selected, need to -sl0 "" it. */
|
||||||
|
|
||||||
|
|
||||||
_(_memory, @"-ramsize")
|
#define _(ix, a, b) \
|
||||||
|
if (should_add_arg(ix, _slots_valid, _slots_explicit, _slots_default, a)) { \
|
||||||
|
[args addObject: b]; [args addObject: a]; \
|
||||||
|
} \
|
||||||
|
|
||||||
_(_sl0, @"-sl0")
|
_(16, _memory, @"-ramsize")
|
||||||
_(_sl1, @"-sl1")
|
|
||||||
_(_sl2, @"-sl2")
|
|
||||||
_(_sl3, @"-sl3")
|
|
||||||
_(_sl4, @"-sl4")
|
|
||||||
_(_sl5, @"-sl5")
|
|
||||||
_(_sl6, @"-sl6")
|
|
||||||
_(_sl7, @"-sl7")
|
|
||||||
|
|
||||||
_(_rs232, @"-rs232")
|
_(0, _sl0, @"-sl0")
|
||||||
_(_aux, @"-aux")
|
_(1, _sl1, @"-sl1")
|
||||||
_(_exp, @"-exp")
|
_(2, _sl2, @"-sl2")
|
||||||
_(_gameio, @"-gameio")
|
_(3, _sl3, @"-sl3")
|
||||||
_(_printer, @"-printer")
|
_(4, _sl4, @"-sl4")
|
||||||
_(_modem, @"-modem")
|
_(5, _sl5, @"-sl5")
|
||||||
|
_(6, _sl6, @"-sl6")
|
||||||
|
_(7, _sl7, @"-sl7")
|
||||||
|
|
||||||
|
_(8, _rs232, @"-rs232")
|
||||||
|
_(9, _aux, @"-aux")
|
||||||
|
_(10, _exp, @"-exp")
|
||||||
|
_(11, _gameio, @"-gameio")
|
||||||
|
_(12, _printer, @"-printer")
|
||||||
|
_(13, _modem, @"-modem")
|
||||||
|
|
||||||
|
|
||||||
[self setArgs: args];
|
[self setArgs: args];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user