2020-08-24 03:10:58 +00:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from plist import to_plist
|
|
|
|
|
|
|
|
import xml.etree.ElementTree as ET
|
|
|
|
|
|
|
|
from machines import MACHINES
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
apple1_children = None
|
|
|
|
apple2_children = ["apple2", "apple2p", "apple2jp"]
|
|
|
|
apple3_children = None
|
|
|
|
apple2e_children = ["apple2e", "apple2ees", "apple2euk", "apple2ep", "apple2ee", "apple2eeuk", "apple2eefr"]
|
|
|
|
apple2c_children = ["apple2c", "apple2cp"]
|
|
|
|
apple2gs_children = ["apple2gsr0", "apple2gsr1", "apple2gs"]
|
2020-09-12 22:01:08 +00:00
|
|
|
laser_children = ["laser2c", "laser128", "las128ex", "las128e2"]
|
2020-09-14 22:24:09 +00:00
|
|
|
ii_clones_children = ["ace100", "albert",
|
2020-08-24 03:10:58 +00:00
|
|
|
"am100", "am64", "basis108", "craft2p",
|
|
|
|
"dodo", "elppa", "hkc8800a", "ivelultr",
|
|
|
|
"maxxi", "microeng", "prav82", "prav8m",
|
|
|
|
"space84", "uniap2en", "uniap2pt", "uniap2ti"]
|
2021-03-14 17:23:43 +00:00
|
|
|
iie_clones_children = ["mprof3", "prav8c", "spectred", "tk3000", "zijini"]
|
2020-09-03 02:06:41 +00:00
|
|
|
cec_children = ["cec2000", "cece", "cecg", "ceci", "cecm"]
|
2020-09-14 22:24:09 +00:00
|
|
|
agat_children = ["agat7", "agat9"]
|
2020-08-24 03:10:58 +00:00
|
|
|
|
2021-03-27 02:01:56 +00:00
|
|
|
mac_nubus_children = [
|
2021-03-27 02:21:56 +00:00
|
|
|
"macii", "maciihmu", "mac2fdhd", "maciix", "maciicx", "maciici", "maciisi", "maciivx", "maciivi",
|
2021-03-27 02:01:56 +00:00
|
|
|
"maclc", "maclc2", "maclc3"]
|
|
|
|
|
|
|
|
# se/30 and classic 2 are implemented as a nubus but i'm sticking then with the 128 due to the form factor.
|
|
|
|
mac_128k_children = ["mac128k", "mac512k", "mac512ke", "macplus",
|
|
|
|
"macse", "macsefd", "macse30", "macclasc", "macclas2"]
|
2021-01-17 05:56:42 +00:00
|
|
|
|
2020-08-24 03:10:58 +00:00
|
|
|
tree = [
|
|
|
|
("Apple I", "apple1", apple1_children),
|
|
|
|
("Apple ][", "apple2", apple2_children),
|
|
|
|
("Apple IIe", "apple2e", apple2e_children),
|
|
|
|
("Apple //c", "apple2c", apple2c_children),
|
|
|
|
("Apple IIgs", "apple2gs", apple2gs_children),
|
|
|
|
("Apple ///", "apple3", apple3_children),
|
|
|
|
("II Clones", None, ii_clones_children),
|
|
|
|
("IIe Clones", None, iie_clones_children),
|
2020-09-14 22:24:09 +00:00
|
|
|
("Laser", "laser128", laser_children),
|
|
|
|
("Agat", "agat7", agat_children),
|
|
|
|
("China Education Computer", None, cec_children),
|
2021-03-27 02:01:56 +00:00
|
|
|
("Macintosh (Compact)", "macse30", mac_128k_children),
|
2021-03-31 01:21:12 +00:00
|
|
|
("Macintosh (NuBus)", "maciix", mac_nubus_children),
|
2020-08-24 03:10:58 +00:00
|
|
|
]
|
|
|
|
|
2020-09-05 21:35:19 +00:00
|
|
|
env = {'DYLD_FALLBACK_FRAMEWORK_PATH': '../embedded'}
|
|
|
|
st = subprocess.run(["../embedded/mame64", "-listfull", *MACHINES], check=True, capture_output=True, text=True, env=env)
|
2020-08-24 03:10:58 +00:00
|
|
|
# Name: Description:
|
|
|
|
# apple2gs "Apple IIgs (ROM03)"
|
|
|
|
# apple2gsr0 "Apple IIgs (ROM00)"
|
|
|
|
|
|
|
|
names = {}
|
|
|
|
|
|
|
|
t = st.stdout
|
|
|
|
lines = t.split("\n")
|
|
|
|
lines.pop(0)
|
|
|
|
for x in lines:
|
|
|
|
x = x.strip()
|
|
|
|
if x == "": continue
|
|
|
|
m = re.fullmatch(r"^([A-Za-z0-9_]+)\s+\"([^\"]+)\"$", x)
|
|
|
|
if not m:
|
|
|
|
print("hmmm....", x)
|
|
|
|
continue
|
|
|
|
name = m[1]
|
|
|
|
desc = m[2]
|
|
|
|
|
|
|
|
names[name] = desc
|
|
|
|
|
|
|
|
|
|
|
|
def make_children(clist):
|
|
|
|
global names
|
|
|
|
return [
|
2020-08-26 02:23:08 +00:00
|
|
|
{ "description": names[x], "value": x}
|
2020-08-24 03:10:58 +00:00
|
|
|
for x in clist
|
|
|
|
]
|
|
|
|
|
2020-08-26 02:23:08 +00:00
|
|
|
data = []
|
2020-08-24 03:10:58 +00:00
|
|
|
|
|
|
|
for x in tree:
|
|
|
|
desc, value, children = x
|
|
|
|
tmp = { "description": desc }
|
|
|
|
if value: tmp["value"] = value
|
|
|
|
if children: tmp["children"] = make_children(children)
|
|
|
|
|
2020-08-26 02:23:08 +00:00
|
|
|
data.append(tmp)
|
|
|
|
|
2020-09-03 02:06:41 +00:00
|
|
|
path = "../Ample/Resources/models.plist"
|
2020-08-26 02:23:08 +00:00
|
|
|
with open(path, "w") as f:
|
|
|
|
f.write(to_plist(data))
|
2020-08-24 03:10:58 +00:00
|
|
|
|