fix: read mame hiscore.dat where the cores open it

mame2000 opens hiscore.dat, history.dat and mameinfo.dat from IMAMEBASEPATH, the content directory (src/libretro/fileio.c:1002-1014, libretro.c:1044-1052). mame2014 and mame2015 open hiscore.dat through emu_file with no search path, the working directory (src/emu/hiscore.c:330-337, fileio.c:141-143). With no load_from the entries claimed system/ and the packs shipped files neither core opens there. ANoteOutsideTheSystemDirCarriesLoadFrom holds libretro notes and load_from together.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 10:02:30 +02:00
1 parent 62a4f19ce3
commit e255348f52
4 files changed
+41 -6

No files matched your search

+9 -6
View File
@@ -34,15 +34,16 @@ notes: |
files:
- name: hiscore.dat
load_from: content_dir
required: false
category: game_data
system: arcade
sha1: "21ddda0c61bd4f1cc04fb9d09e16d403d620f9e8"
md5: "9b262149ec70cbda741a8ba55784f8e1"
size: 36182
source_ref: "src/hiscore.c:18,132-146,252-254, src/cpuintrf.c:664-666"
source_ref: "src/hiscore.c:18,132-146,252-254, src/cpuintrf.c:664-666, src/libretro/fileio.c:1002-1014, src/libretro/libretro.c:1044-1052"
note: >-
high score definitions, loaded from ROM directory. metadata/hiscore.dat
high score definitions, opened from IMAMEBASEPATH, the directory of the loaded content. metadata/hiscore.dat
of the core repository. is_mem_range reads only "cpu:addr:len:start:end"
lines under a "gamename:" header.
@@ -55,18 +56,20 @@ files:
note: "cheat definitions, loaded from system_dir/mame2000/cheat/"
- name: history.dat
load_from: content_dir
required: false
category: game_data
system: arcade
source_ref: "src/datafile.c:52,281,541"
note: "game history database, loaded from ROM directory"
source_ref: "src/datafile.c:52,281,541, src/libretro/fileio.c:1002-1014"
note: "game history database, opened from IMAMEBASEPATH, the directory of the loaded content"
- name: mameinfo.dat
load_from: content_dir
required: false
category: game_data
system: arcade
source_ref: "src/datafile.c:53,281,568"
note: "game technical info database, loaded from ROM directory"
source_ref: "src/datafile.c:53,281,568, src/libretro/fileio.c:1002-1014"
note: "game technical info database, opened from IMAMEBASEPATH, the directory of the loaded content"
- name: neogeo.zip
required: true
+1
View File
@@ -102,6 +102,7 @@ notes: |
files:
# Data files
- name: hiscore.dat
load_from: working_directory
required: false
category: game_data
system: arcade
+1
View File
@@ -91,6 +91,7 @@ notes: |
files:
# Data files
- name: hiscore.dat
load_from: working_directory
installed_on: [recalbox]
required: false
category: game_data
+30
View File
@@ -5511,6 +5511,36 @@ class AHashScanLabelNamesNoOtherDump(unittest.TestCase):
self.assertEqual(sorted(set(clashes)), [])
class ANoteOutsideTheSystemDirCarriesLoadFrom(unittest.TestCase):
"""mame2000 opens hiscore.dat, history.dat and mameinfo.dat from the
directory of the loaded content (src/libretro/fileio.c:1002-1014), and
mame2014 and mame2015 open hiscore.dat from the working directory
(src/emu/hiscore.c:330-337). Their notes said so, but no load_from did:
the entries claimed system/hiscore.dat and the RetroArch pack shipped a
file neither core opens there. A libretro entry whose note places the
read outside the system directory declares where."""
ELSEWHERE = re.compile(
r"\b(?:opened|read|loaded)\b[^.]*?\bfrom (?:the )?(?:working directory|"
r"ROM directory|content directory|directory of the loaded content)"
r"|IMAMEBASEPATH",
re.IGNORECASE,
)
def test_prose_and_load_from_agree(self):
offenders = []
for path in sorted((ROOT / "emulators").glob("*.yml")):
profile = yaml.safe_load(path.read_text(encoding="utf-8")) or {}
if profile.get("type") != "libretro":
continue
for entry in profile.get("files") or []:
if entry.get("path") or entry.get("load_from") or entry.get("mode") == "standalone":
continue
if self.ELSEWHERE.search(str(entry.get("note") or "")):
offenders.append(f"{path.name}: {entry.get('name')}")
self.assertEqual(offenders, [])
class ReportsHoldTheDataTrees(unittest.TestCase):
"""Run on their own, the README, site and slot reports resolved against
data/ without the shared hold, so a concurrent refresh could swap a tree