mirror of https://github.com/ksherlock/ample.git
updated python for more machines (--extra)
This commit is contained in:
parent
56b34a4099
commit
6b331240c9
|
@ -43,10 +43,34 @@ MACHINES = (
|
|||
# "unitron", "utrn1024",
|
||||
|
||||
#atari
|
||||
"st", "megast"
|
||||
"st", "megast",
|
||||
)
|
||||
|
||||
|
||||
MACHINES_EXTRA = MACHINES + (
|
||||
|
||||
# other (for Ample-lite...)
|
||||
# DEC
|
||||
"vt52", "vt100", "vt101", "vt102", "vt240",
|
||||
"ds2100", "ds3100", "ds5k133", "pdp11qb", "pdp11ub", "pdp11ub2",
|
||||
# IBM
|
||||
"rtpc010", "rtpc015", "rtpc020", "rtpc025", "rtpca25",
|
||||
# HP
|
||||
"hp9k310", "hp9k320", "hp9k330", "hp9k332", "hp9k340", "hp9k360", "hp9k370", "hp9k380", "hp9k382",
|
||||
# Intergraph
|
||||
"ip2000", "ip2400", "ip2500", "ip2700", "ip2800", "ip6000", "ip6400", "ip6700", "ip6800",
|
||||
# MIPS
|
||||
"rc2030", "rs2030", "rc3230", "rs3230",
|
||||
# SGI
|
||||
"indigo", "indigo2_4415", "indigo_r4000", "indigo_r4400", "indy_4610", "indy_4613", "indy_5015", "pi4d20", "pi4d25", "pi4d30", "pi4d35",
|
||||
# Sony
|
||||
"nws3260", "nws3410", "nws1580", "nws5000x",
|
||||
# SUN
|
||||
"sun1", "sun2_50", "sun2_120", "sun3_50", "sun3_60", "sun3_110", "sun3_150", "sun3_260", "sun3_e", "sun3_80", "sun4_40", "sun4_50", "sun4_20", "sun4_25", "sun4_65",
|
||||
# "sun3_460", "sun4_400", "sun4_110", "sun4_300", "sun4_60", "sun4_75", "sun_s10", "sun_s20"
|
||||
|
||||
)
|
||||
|
||||
|
||||
SLOTS = (
|
||||
"sl0", "sl1", "sl2", "sl3",
|
||||
|
@ -64,7 +88,10 @@ SLOTS = (
|
|||
"pds", "pds030", "lcpds",
|
||||
|
||||
# st
|
||||
"centronics", "mdin", "mdout"
|
||||
"centronics", "mdin", "mdout",
|
||||
|
||||
# dec
|
||||
"eia", "host", "com_prt", "prt_port"
|
||||
)
|
||||
|
||||
SLOT_NAMES = {
|
||||
|
@ -99,4 +126,9 @@ SLOT_NAMES = {
|
|||
"centronics": "Printer",
|
||||
"mdin": "MIDI In",
|
||||
"mdout": "MIDI Out",
|
||||
|
||||
"eia": "Modem",
|
||||
"host": "Modem",
|
||||
"com_prt": "Modem",
|
||||
"prt_port": "Printer"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
import subprocess
|
||||
|
||||
|
||||
def run(*args):
|
||||
|
||||
env = {'DYLD_FALLBACK_FRAMEWORK_PATH': '../embedded'}
|
||||
path = "../embedded/mame64"
|
||||
path = "../mame/mame-x64"
|
||||
|
||||
st = subprocess.run([path, *args], capture_output=True, env=env, text=True, check=True)
|
||||
|
||||
#if st.returncode != 0:
|
||||
# print("mame error: {}".format(m))
|
||||
# exit(1)
|
||||
|
||||
return st.stdout
|
|
@ -1,12 +1,13 @@
|
|||
import argparse
|
||||
import subprocess
|
||||
import hashlib
|
||||
|
||||
from copy import deepcopy
|
||||
from plist import to_plist
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from machines import MACHINES, SLOTS, SLOT_NAMES
|
||||
from machines import MACHINES, MACHINES_EXTRA, SLOTS, SLOT_NAMES
|
||||
import mame
|
||||
|
||||
# macintosh errata:
|
||||
# maclc has scsi:1 - scsi:7 and lcpds slots, but none are currently configurable.
|
||||
|
@ -75,14 +76,7 @@ def load_machine(name):
|
|||
rootname = name
|
||||
if name in machine_cache: return machine_cache[name]
|
||||
|
||||
# print(" {}".format(name))
|
||||
env = {'DYLD_FALLBACK_FRAMEWORK_PATH': '../embedded'}
|
||||
st = subprocess.run(["../embedded/mame64", name, "-listxml"], capture_output=True, env=env)
|
||||
if st.returncode != 0:
|
||||
print("mame error: {}".format(name))
|
||||
return False
|
||||
|
||||
xml = st.stdout
|
||||
xml = mame.run(name, "-listxml")
|
||||
root = ET.fromstring(xml)
|
||||
|
||||
for x in root.findall("./machine"):
|
||||
|
@ -458,6 +452,7 @@ def make_ram(machine):
|
|||
if len(options) == 0 and machine.get('name') == 'las3000':
|
||||
options.append( { "intValue": 192, "description": "192K", "value": "192K", "default": True} )
|
||||
|
||||
if not options: return None
|
||||
|
||||
# sort and add empty starting entry.
|
||||
options.sort(key=lambda x: x["intValue"])
|
||||
|
@ -598,15 +593,36 @@ def make_slot(m, slotname, nodes):
|
|||
}
|
||||
|
||||
|
||||
def file_changed(path, data):
|
||||
# check if a file has changed.
|
||||
|
||||
try:
|
||||
with open(path, mode='rb') as f:
|
||||
d1 = hashlib.file_digest(f, 'sha256')
|
||||
except Exception as e:
|
||||
return 'new'
|
||||
|
||||
d2 = hashlib.sha256(bytes(data, 'utf8'))
|
||||
|
||||
if d1.digest() == d2.digest(): return False
|
||||
return 'updated'
|
||||
|
||||
|
||||
|
||||
devices = {}
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('machine', nargs="*")
|
||||
p.add_argument('--extra', action='store_true')
|
||||
args = p.parse_args()
|
||||
|
||||
extra = args.extra
|
||||
machines = args.machine
|
||||
if not machines: machines = MACHINES
|
||||
if not machines:
|
||||
if extra:
|
||||
machines = MACHINES_EXTRA
|
||||
else:
|
||||
machines = MACHINES
|
||||
|
||||
for m in machines:
|
||||
|
||||
|
@ -615,13 +631,6 @@ for m in machines:
|
|||
machine = load_machine_recursive(m)
|
||||
if not machine:
|
||||
exit(1)
|
||||
# env = {'DYLD_FALLBACK_FRAMEWORK_PATH': '../embedded'}
|
||||
# st = subprocess.run(["../embedded/mame64", m, "-listxml"], capture_output=True, env=env)
|
||||
# if st.returncode != 0:
|
||||
# print("mame error: {}".format(m))
|
||||
# exit(1)
|
||||
# xml = st.stdout
|
||||
# root = ET.fromstring(xml)
|
||||
|
||||
data = { }
|
||||
|
||||
|
@ -637,6 +646,7 @@ for m in machines:
|
|||
|
||||
# node = machine.find('display[@tag="screen"]')
|
||||
node = machine.find('./display')
|
||||
#print('display:', node.get('tag'))
|
||||
hscale = 2
|
||||
if m[0:3] == "mac": hscale = 1
|
||||
data["resolution"] = [int(node.get("width")), int(node.get("height")) * hscale]
|
||||
|
@ -650,7 +660,8 @@ for m in machines:
|
|||
|
||||
# ss = {}
|
||||
slots = []
|
||||
slots.append(make_ram(machine))
|
||||
x = make_ram(machine)
|
||||
if x: slots.append(x)
|
||||
x = make_bios(machine)
|
||||
if x: slots.append(x)
|
||||
|
||||
|
@ -684,8 +695,12 @@ for m in machines:
|
|||
|
||||
|
||||
path = "../Ample/Resources/{}.plist".format(m)
|
||||
pl = to_plist(data)
|
||||
st = file_changed(path, pl)
|
||||
if st == False: continue
|
||||
print(m + ':', st)
|
||||
with open(path, "w") as f:
|
||||
f.write(to_plist(data))
|
||||
f.write(pl)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import subprocess
|
||||
|
||||
from plist import to_plist
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from machines import MACHINES
|
||||
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
from plist import to_plist
|
||||
from machines import MACHINES, MACHINES_EXTRA
|
||||
import mame
|
||||
|
||||
|
||||
apple1_children = None
|
||||
apple2_children = ["apple2", "apple2p", "apple2jp"]
|
||||
|
@ -46,7 +47,20 @@ mac_128k_children = ["mac128k", "mac512k", "mac512ke", "macplus",
|
|||
|
||||
atari_st_children = ["st", "megast"]
|
||||
|
||||
tree = [
|
||||
dec_vt_children = ["vt52", "vt100", "vt101", "vt102", "vt240"]
|
||||
dec_children = ["ds2100", "ds3100", "ds5k133", "pdp11qb", "pdp11ub", "pdp11ub2"]
|
||||
ibm_rt_children = ["rtpc010", "rtpc015", "rtpc020", "rtpc025", "rtpca25"]
|
||||
hp_9000_children = ["hp9k310", "hp9k320", "hp9k330", "hp9k332", "hp9k340", "hp9k360", "hp9k370", "hp9k380", "hp9k382"]
|
||||
intergraph_children = ["ip2000", "ip2400", "ip2500", "ip2700", "ip2800", "ip6000", "ip6400", "ip6700", "ip6800"]
|
||||
mips_children = ["rc2030", "rs2030", "rc3230", "rs3230"]
|
||||
sgi_children = ["indigo", "indigo2_4415", "indigo_r4000", "indigo_r4400", "indy_4610", "indy_4613", "indy_5015", "pi4d20", "pi4d25", "pi4d30", "pi4d35"]
|
||||
sony_children = ["nws3260", "nws3410", "nws1580", "nws5000x"]
|
||||
sun_children = [
|
||||
"sun1", "sun2_50", "sun2_120", "sun3_50", "sun3_60", "sun3_110", "sun3_150", "sun3_260", "sun3_e", "sun3_80",
|
||||
"sun4_40", "sun4_50", "sun4_20", "sun4_25", "sun4_65",
|
||||
]
|
||||
|
||||
TREE = [
|
||||
("Apple I", "apple1", apple1_children),
|
||||
("Apple ][", "apple2", apple2_children),
|
||||
("Apple IIe", "apple2e", apple2e_children),
|
||||
|
@ -63,18 +77,50 @@ tree = [
|
|||
("Macintosh (II)", "maciix", mac_ii_children),
|
||||
("Macintosh (Quadra)", None, mac_quadra_children),
|
||||
("Macintosh (LC)", None, mac_lc_children),
|
||||
("Atari ST", "st", atari_st_children)
|
||||
("Atari ST", "st", atari_st_children),
|
||||
]
|
||||
|
||||
env = {'DYLD_FALLBACK_FRAMEWORK_PATH': '../embedded'}
|
||||
st = subprocess.run(["../embedded/mame64", "-listfull", *MACHINES], check=True, capture_output=True, text=True, env=env)
|
||||
TREE_EXTRA = TREE + [
|
||||
("DEC VT", None, dec_vt_children),
|
||||
("DEC", None, dec_children),
|
||||
("HP 9000", None, hp_9000_children),
|
||||
("IBM RT", None, ibm_rt_children),
|
||||
("Intergraph", None, intergraph_children),
|
||||
("MIPS", None, mips_children),
|
||||
("SGI", None, sgi_children),
|
||||
("Sony", None, sony_children),
|
||||
("SUN", None, sun_children),
|
||||
]
|
||||
|
||||
|
||||
|
||||
extra = False
|
||||
machines = MACHINES
|
||||
tree = TREE
|
||||
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--extra', action='store_true')
|
||||
p.add_argument('machine', nargs="*")
|
||||
args = p.parse_args()
|
||||
|
||||
extra = args.extra
|
||||
|
||||
if extra:
|
||||
machines = MACHINES_EXTRA
|
||||
tree = TREE_EXTRA
|
||||
|
||||
|
||||
# Name: Description:
|
||||
# apple2gs "Apple IIgs (ROM03)"
|
||||
# apple2gsr0 "Apple IIgs (ROM00)"
|
||||
|
||||
names = {}
|
||||
|
||||
t = st.stdout
|
||||
#t = st.stdout
|
||||
|
||||
t = mame.run("-listfull", *machines)
|
||||
|
||||
lines = t.split("\n")
|
||||
lines.pop(0)
|
||||
for x in lines:
|
||||
|
@ -99,6 +145,7 @@ def make_children(clist):
|
|||
|
||||
data = []
|
||||
|
||||
|
||||
for x in tree:
|
||||
desc, value, children = x
|
||||
tmp = { "description": desc }
|
||||
|
@ -107,7 +154,10 @@ for x in tree:
|
|||
|
||||
data.append(tmp)
|
||||
|
||||
path = "../Ample/Resources/models.plist"
|
||||
if extra:
|
||||
path = "../Ample/Resources/models~extra.plist"
|
||||
else:
|
||||
path = "../Ample/Resources/models.plist"
|
||||
with open(path, "w") as f:
|
||||
f.write(to_plist(data))
|
||||
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import argparse
|
||||
import subprocess
|
||||
|
||||
from plist import to_plist
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
from html.parser import HTMLParser
|
||||
from os.path import splitext
|
||||
|
||||
|
||||
from machines import MACHINES
|
||||
|
||||
from machines import MACHINES, MACHINES_EXTRA
|
||||
import mame
|
||||
from plist import to_plist
|
||||
|
||||
|
||||
# a2pcxport dependencies. not automatically included though
|
||||
|
@ -35,12 +33,18 @@ EXTRA_MACHINES = [
|
|||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--full', action='store_true')
|
||||
p.add_argument('--extra', action='store_true')
|
||||
p.add_argument('machine', nargs="*")
|
||||
args = p.parse_args()
|
||||
|
||||
# full = args.full
|
||||
extra = args.extra
|
||||
machines = args.machine
|
||||
if not machines: machines = [ *MACHINES, *EXTRA_MACHINES]
|
||||
if not machines:
|
||||
if extra:
|
||||
machines = [ *MACHINES_EXTRA, *EXTRA_MACHINES]
|
||||
else:
|
||||
machines = [ *MACHINES, *EXTRA_MACHINES]
|
||||
|
||||
# roms stored in other files.
|
||||
xEXCLUDE = [
|
||||
|
@ -164,12 +168,7 @@ for m in machines:
|
|||
|
||||
print(m)
|
||||
|
||||
env = {'DYLD_FALLBACK_FRAMEWORK_PATH': '../embedded'}
|
||||
st = subprocess.run(["../embedded/mame64", m, "-listxml"], capture_output=True, env=env)
|
||||
if st.returncode != 0:
|
||||
print("mame error: {}".format(m))
|
||||
exit(1)
|
||||
xml = st.stdout
|
||||
xml = mame.run(m, "-listxml")
|
||||
root = ET.fromstring(xml)
|
||||
|
||||
data = { }
|
||||
|
@ -213,5 +212,10 @@ ROMS.sort(key=lambda x: x.get('description'))
|
|||
|
||||
|
||||
# print(ROMS)
|
||||
with open("../Ample/Resources/roms.plist", "w") as f:
|
||||
if extra:
|
||||
path = "../Ample/Resources/roms~extra.plist"
|
||||
else:
|
||||
path = "../Ample/Resources/roms.plist"
|
||||
|
||||
with open(path, "w") as f:
|
||||
f.write(to_plist(ROMS))
|
||||
|
|
Loading…
Reference in New Issue