mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-01 00:27:20 -05:00
feat: settle a file only when the run uses it
hle_fallback needs the file to change the run: Beetle PSX hashes every file of its folder, so opened is not used. PCSX-ReARMed hides the BIOS logo by default: its BIOS load line stands for the bios stage. A check runs again only when the oracle entries of its content and core change, and the rules run on every pass from the kept records.
This commit is contained in:
1 parent
a17406edae
commit
70c3bbd853
8 files changed
+111
-21
No files matched your search
@@ -14,6 +14,9 @@
|
||||
# cores:. A line a core logs and then carries on (a fallback to a
|
||||
# built-in BIOS) is not an error pattern.
|
||||
# error_screens per core, the sha1 of a frame that shows its BIOS error message.
|
||||
# bios_patterns per core, log lines by which it says it loaded the console's
|
||||
# own BIOS: they stand for the bios-stage screens of a core
|
||||
# that hides them by default.
|
||||
#
|
||||
# A run that reaches no reference frame, matches no pattern or screen and
|
||||
# does not end on one colour is `unknown`: frames that differ from another
|
||||
@@ -47,7 +50,11 @@ cores:
|
||||
Without a BIOS, or with one of the wrong size, it logs "Using HLE BIOS"
|
||||
and runs its own (frontend/libretro.c:3893-3899 at c8816799). The BIOS
|
||||
boot logo is off by default (pcsx_rearmed_show_bios_bootlogo), so its
|
||||
runs reach no bios-stage screen.
|
||||
runs reach no bios-stage screen: the line it logs once a file passes
|
||||
its signature check and is kept stands for them.
|
||||
bios_patterns:
|
||||
- pattern: '^found (US|EU|JP) BIOS file, crc32 '
|
||||
source_ref: frontend/libretro.c:3646-3669 at c8816799
|
||||
error_patterns: []
|
||||
error_screens: []
|
||||
"PCSX1":
|
||||
|
||||
@@ -155,6 +155,14 @@ class RuleTable(unittest.TestCase):
|
||||
optional = rules.rule_need(NONE_BOOTS, PRESENT, {"name": "a", "required": False})
|
||||
self.assertEqual([v.field for v in optional], ["hle_fallback"])
|
||||
|
||||
def test_a_file_the_content_never_uses_settles_nothing(self) -> None:
|
||||
unused = run(rules.BOOTS, "bios.bin", ("game",))
|
||||
self.assertFalse(rules.read(NONE_BOOTS, unused, unused, unused))
|
||||
self.assertEqual(rules.rule_need(NONE_BOOTS, unused, self.ENTRY, used=False), [])
|
||||
# A wrong file that hangs where no file boots: the core reads it.
|
||||
self.assertTrue(rules.read(NONE_BOOTS, unused, run(rules.HANG), unused))
|
||||
self.assertTrue(rules.read(NONE_BOOTS, PRESENT, None, None))
|
||||
|
||||
def test_fails_without_and_boots_alone_settles_required(self) -> None:
|
||||
for failure in rules.FAILS:
|
||||
verdicts = rules.rule_need(run(failure, "none"), PRESENT, self.ENTRY)
|
||||
@@ -397,6 +405,19 @@ class StateAndResume(Workspace):
|
||||
self.assertTrue(campaign.should_run({**done, "status": "pending"}, "a", "d"))
|
||||
self.assertFalse(campaign.should_run({**done, "status": "failed"}, "a", "d"))
|
||||
|
||||
def test_only_its_own_oracle_entries_make_a_check_run_again(self) -> None:
|
||||
key = [hashlib.sha1(b"GAME").hexdigest(), "Fake"]
|
||||
before = self.make().oracle_digest(key)
|
||||
data = yaml.safe_load(self.oracle.read_text())
|
||||
data["content"][0]["references"]["Other"] = {"recorded_from": "2026-10-27-000000000000",
|
||||
"frames": [{"sha1": "a" * 40, "stage": "game",
|
||||
"shows": "x"}]}
|
||||
self.oracle.write_text(yaml.safe_dump(data), encoding="utf-8")
|
||||
self.assertEqual(self.make().oracle_digest(key), before)
|
||||
data["cores"] = {"Fake": {"error_patterns": [{"pattern": "BIOS", "reason": "r"}]}}
|
||||
self.oracle.write_text(yaml.safe_dump(data), encoding="utf-8")
|
||||
self.assertNotEqual(self.make().oracle_digest(key), before)
|
||||
|
||||
def test_evidence_does_not_change_the_digest(self) -> None:
|
||||
profile = yaml.safe_load(PROFILE)
|
||||
before = campaign.profile_digest(profile)
|
||||
|
||||
@@ -211,6 +211,13 @@ class OracleTests(unittest.TestCase):
|
||||
self.assertEqual((evidence["rule"], evidence["frame"], evidence["stages"]),
|
||||
("reference_frame", 20, ["bios", "game"]))
|
||||
|
||||
def test_a_bios_load_line_stands_for_hidden_bios_screens(self) -> None:
|
||||
oracle = {**self.ORACLE, "bios_patterns": [r"^found US BIOS file"]}
|
||||
verdict, evidence = core_probe.judge(
|
||||
self.rep(frames((0, self.TITLE)), logs=["found US BIOS file, crc32 1: x"]), oracle)
|
||||
self.assertEqual((verdict, evidence["stages"]), ("boots", ["bios", "game"]))
|
||||
self.assertEqual(core_probe.judge(self.rep(frames((0, self.TITLE))), oracle)[1]["stages"], ["game"])
|
||||
|
||||
def test_the_bios_screens_alone_are_not_a_boot(self) -> None:
|
||||
# A console that shows its logo and then refuses the disc never reached the game.
|
||||
verdict, evidence = core_probe.judge(
|
||||
@@ -275,6 +282,7 @@ class OracleTests(unittest.TestCase):
|
||||
picked = core_probe.oracle_for(data, "a" * 40, "Fake")
|
||||
self.assertEqual(picked["references"], [{"sha1": self.TITLE, "stage": "game", "shows": "t"}])
|
||||
self.assertEqual(picked["error_patterns"], ["shared", "own"])
|
||||
self.assertEqual(picked["bios_patterns"], [])
|
||||
self.assertEqual(core_probe.oracle_for(data, "b" * 40, "Fake")["references"], [])
|
||||
self.assertEqual(core_probe.oracle_for(data, "a" * 40, "Nobody")["error_patterns"], ["shared"])
|
||||
|
||||
@@ -283,7 +291,7 @@ class OracleTests(unittest.TestCase):
|
||||
data = yaml.safe_load(core_probe.DEFAULT_ORACLE.read_text(encoding="utf-8"))
|
||||
patterns = list(data.get("error_patterns") or ())
|
||||
for core in (data.get("cores") or {}).values():
|
||||
patterns += core.get("error_patterns") or []
|
||||
patterns += (core.get("error_patterns") or []) + (core.get("bios_patterns") or [])
|
||||
for screen in core.get("error_screens") or ():
|
||||
self.assertRegex(screen["sha1"], r"^[0-9a-f]{40}$")
|
||||
for pattern in patterns:
|
||||
|
||||
Reference in new issue
Block a user