support for bios in the slot controller.

This commit is contained in:
Kelvin Sherlock 2022-04-30 10:16:05 -04:00
parent 4ffd8d1f44
commit 23a05d5414
3 changed files with 17 additions and 8 deletions

View File

@ -10,6 +10,17 @@
#import <Cocoa/Cocoa.h>
#import "Media.h"
/* number of slot types. bitmask used so should be < sizeof(unsigned *8) */
#define SLOT_COUNT 23
static_assert(SLOT_COUNT <= sizeof(unsigned) * 8, "too many slot types");
#define kSMARTPORT_SLOT 21
#define kBIOS_SLOT 22
#ifndef SIZEOF
#define SIZEOF(x) (sizeof(x) / sizeof(x[0]))
#endif
//NS_ASSUME_NONNULL_BEGIN
@class Slot, SlotOption, SlotTableCellView;

View File

@ -101,9 +101,10 @@ static NSDictionary *IndexMap = nil;
@"nbe": @20,
@"smartport": @21,
#define kSMARTPORT 21
@"bios": @22,
};
static_assert(kSMARTPORT_SLOT == 21, "Smartport != 21");
static_assert(kBIOS_SLOT == 22, "Bios != 22");
}
-(void)reset {
@ -156,7 +157,7 @@ static NSDictionary *IndexMap = nil;
// { 'sl3' : 'uthernet' }
// special case for smartport since the name isn't used.
if (_index == kSMARTPORT) {
if (_index == kSMARTPORT_SLOT) {
SlotOption *option = [_options objectAtIndex: _selectedIndex];
[option reserialize: dict];
return;
@ -387,7 +388,7 @@ static NSDictionary *IndexMap = nil;
// [menu setItemArray: ] doesn't work prior to 10.14, apparently.
[menu removeAllItems];
if (_index == kSMARTPORT) {
if (_index == kSMARTPORT_SLOT) {
//[menu setItemArray: @[]];
[button setHidden: YES];
} else {

View File

@ -16,11 +16,7 @@
#import <objc/runtime.h>
/* number of slot types. bitmask used so should be < sizeof(unsigned *8) */
#define SLOT_COUNT 22
static_assert(SLOT_COUNT <= sizeof(unsigned) * 8, "too many slot types");
#define SIZEOF(x) (sizeof(x) / sizeof(x[0]))
static unsigned RootKey = 0;
@ -120,6 +116,7 @@ static unsigned RootKey = 0;
_slot_object[i] = nil;
}
_slot_value[kBIOS_SLOT] = nil; // don't copy over to other machines.
extern NSArray *BuildSlots(NSString *name, NSDictionary *data);
_root = BuildSlots(_machine, d);