mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-15 14:33:47 -06:00
feat: record config installs in shell extractors
ROCKNIX, EmuELEC, AmberELEC, EmuDeck and RetroDECK records citing a config now carry the code installing it, whether that keeps a file already there, and the launch code rewriting its keys. Rescraped at the pinned revisions. Records the shipped code never reads are no longer written: EmuELEC's mame.ini folders (MAME.opt turns paths off), AmberELEC's atari800.cfg (read only under an option that is off), the six RetroDECK XRoar ROM lists no machine looks up, and the ROCKNIX melonDS DSi BIOS keys (DSiExternalBIOSEnable is set by no shipped ini). Conditions added: ROCKNIX and AmberELEC amiberry kickstarts hold only outside a WHDLoad --autoload boot, ROCKNIX NanoBoyAdvance exits without its BIOS, the EmuELEC scummvm.ini copy runs from an action no launch passes, and the EmuDeck melonDS.toml keys need ExternalBIOSEnable (DS) or ConsoleType 1 (DSi).
This commit is contained in:
1 parent
3129eaf10c
commit
c5d3e85bac
16 files changed
+1153
-418
No files matched your search
@@ -35,6 +35,8 @@ PLACEHOLDER = "RETRODECKBIOSDIR"
|
||||
# gzdoom/component_prepare.sh:27 rewrites to $roms_path.
|
||||
ROMS_PLACEHOLDER = "RETRODECKROMSDIR"
|
||||
CORE_OPTIONS = "retroarch/rd_assets/rd_config/retroarch-core-options.cfg"
|
||||
# XRoar ROM lists RetroDECK's xroar.conf defines that no machine looks up.
|
||||
UNREAD_ROMLISTS = frozenset({"coco1", "coco1e", "coco1e_ext", "coco2", "coco2_ext", "coco2b"})
|
||||
# The component that runs libretro cores.
|
||||
LIBRETRO_COMPONENT = "retroarch"
|
||||
# Values of a core option that name a file rather than a setting.
|
||||
@@ -301,6 +303,19 @@ class Component:
|
||||
if copied is None:
|
||||
raise LauncherPatternMissing(f"{script.path}:{number}", f"no preset copied to {target}")
|
||||
preset = f"{self.name}/rd_assets/rd_config/{copied[1]}"
|
||||
# The reset copies the preset over the user's file, then fills its
|
||||
# placeholders: that is the install, and nothing keeps an older file.
|
||||
evidence: dict[str, Any] = {
|
||||
"installs": {
|
||||
"path": target,
|
||||
"source_ref": source_ref(
|
||||
[(script.path, copied[0])]
|
||||
+ [(script.path, line) for _v, line in substitutions.values()]
|
||||
),
|
||||
},
|
||||
"kept_if_present": False,
|
||||
"overrides": self.launch_rewrites(target),
|
||||
}
|
||||
text = self.read(preset)
|
||||
if text is None:
|
||||
raise LauncherPatternMissing(preset, "preset is missing")
|
||||
@@ -332,10 +347,10 @@ class Component:
|
||||
self.record(
|
||||
"passes_path", [], [(preset, line_no)] + applied,
|
||||
search_dir=value, passes_to=f"{self.config_name(target)} {where}",
|
||||
fails_when_missing=False,
|
||||
fails_when_missing=False, **evidence,
|
||||
)
|
||||
if key == "rompath":
|
||||
self.romlists(preset, text, value, applied)
|
||||
self.romlists(preset, text, value, applied, evidence)
|
||||
if not found:
|
||||
raise LauncherPatternMissing(preset, f"no {PLACEHOLDER} line")
|
||||
|
||||
@@ -349,10 +364,28 @@ class Component:
|
||||
found[m.group(1)] = (f"${m.group(2)}", line_no)
|
||||
return found
|
||||
|
||||
def launch_rewrites(self, target: str) -> list[str]:
|
||||
"""The sed lines of the component launcher rewriting ``target``."""
|
||||
path = f"{self.name}/component_launcher.sh"
|
||||
text = self.read(path)
|
||||
if text is None:
|
||||
return []
|
||||
return [
|
||||
source_ref([(path, number)])
|
||||
for number, line in enumerate(text.splitlines(), 1)
|
||||
if re.search(r"\bsed\b.*\s-i\b", line) and target in line
|
||||
]
|
||||
|
||||
def romlists(
|
||||
self, preset: str, text: str, rompath: str, applied: list[tuple[str, int]]
|
||||
self, preset: str, text: str, rompath: str, applied: list[tuple[str, int]],
|
||||
evidence: dict[str, Any],
|
||||
) -> None:
|
||||
"""XRoar's `romlist NAME=a,b,@other`: the names tried for each ROM, in order."""
|
||||
"""XRoar's `romlist NAME=a,b,@other`: the names tried for each ROM, in order.
|
||||
|
||||
A list no XRoar machine or cartridge looks up is no read: coco1,
|
||||
coco1e, coco1e_ext, coco2, coco2_ext and coco2b are defined by XRoar
|
||||
(src/xroar.c:663-670) and named by nothing else.
|
||||
"""
|
||||
lists: dict[str, tuple[int, list[str]]] = {}
|
||||
for line_no, line in enumerate(text.splitlines(), 1):
|
||||
found = re.match(r"^romlist\s+([\w-]+)=(.*)$", line.strip())
|
||||
@@ -375,10 +408,12 @@ class Component:
|
||||
return list(dict.fromkeys(names))
|
||||
|
||||
for name, (line_no, _items) in lists.items():
|
||||
if name in UNREAD_ROMLISTS:
|
||||
continue
|
||||
self.record(
|
||||
"names_searched", expand(name, (name,)), [(preset, line_no)] + applied,
|
||||
slot=name, search_dir=rompath, passes_to=f"romlist {name}",
|
||||
fails_when_missing=False,
|
||||
fails_when_missing=False, **evidence,
|
||||
)
|
||||
|
||||
def read_launcher(self) -> None:
|
||||
@@ -480,6 +515,7 @@ def core_options(read: Read) -> list[Launcher]:
|
||||
]
|
||||
if not copied:
|
||||
raise LauncherPatternMissing(prepare_path, "the core options preset is never copied")
|
||||
target = _words(prepare.splitlines()[copied[0] - 1].strip())[-1]
|
||||
records = []
|
||||
for line_no, line in enumerate(text.splitlines(), 1):
|
||||
found = re.match(r'^([\w.-]+)\s*=\s*"([^"]*)"$', line.strip())
|
||||
@@ -489,6 +525,8 @@ def core_options(read: Read) -> list[Launcher]:
|
||||
records.append(Launcher(
|
||||
emulator=LIBRETRO_COMPONENT, build="libretro", kind="core_option", names=[value],
|
||||
passes_to=f"core option {key}", fails_when_missing=False,
|
||||
installs={"path": target, "source_ref": source_ref([(prepare_path, copied[0])])},
|
||||
kept_if_present=False, overrides=[],
|
||||
source_ref=source_ref([(CORE_OPTIONS, line_no), (prepare_path, copied[0])]),
|
||||
))
|
||||
if not records:
|
||||
|
||||
Reference in new issue
Block a user