move bios settings to be handled as a slot option.

This commit is contained in:
Kelvin Sherlock
2022-04-30 10:14:37 -04:00
parent f52470eb2e
commit 4ffd8d1f44
13 changed files with 408 additions and 241 deletions

View File

@@ -56,6 +56,7 @@ SLOTS = (
SLOT_NAMES = {
"ramsize": "RAM",
"bios": "ROM",
"sl0": "Slot 0",
"sl1": "Slot 1",
"sl2": "Slot 2",

View File

@@ -415,6 +415,31 @@ def make_ram(machine):
"options": options
}
def make_bios(m):
options = [
{
"value": x.get("name"),
"description": x.get("description")
}
for x in m.findall('./biosset')
]
if not options: return None
options.insert(0, {"value": "", "description": "—Default—", "default": True })
return {
"name": "bios",
"description": SLOT_NAMES["bios"],
"options": options
}
def make_smartport(machine):
@@ -494,18 +519,6 @@ def make_slot(m, slotname, nodes):
}
def make_bios(m):
bios = []
for x in m.findall('./biosset'):
bios.append({
"value": x.get("name"),
"description": x.get("description")
})
return bios
devices = {}
@@ -559,9 +572,11 @@ for m in machines:
# ss = {}
slots = []
slots.append(make_ram(machine))
x = make_bios(machine)
if x: slots.append(x)
smartport = make_smartport(machine)
if (smartport):
if smartport:
slots.append({
"name": "smartport",
"description": "Disk Drives",
@@ -583,9 +598,6 @@ for m in machines:
data["slots"] = slots
bios = make_bios(machine)
if bios: data["bios"] = bios
devices = make_devices()
if smartport: devices.insert(0, smartport)
data["devices"] = devices