mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-17 22:32:31 -05:00
feat: load_platform_config merges all metadata from registry
This commit is contained in:
@@ -7,6 +7,9 @@ platforms:
|
|||||||
source_url: https://raw.githubusercontent.com/libretro/libretro-database/master/dat/System.dat
|
source_url: https://raw.githubusercontent.com/libretro/libretro-database/master/dat/System.dat
|
||||||
source_format: clrmamepro_dat
|
source_format: clrmamepro_dat
|
||||||
hash_type: sha1
|
hash_type: sha1
|
||||||
|
verification_mode: existence
|
||||||
|
base_destination: system
|
||||||
|
case_insensitive_fs: true
|
||||||
schedule: weekly
|
schedule: weekly
|
||||||
cores: all_libretro
|
cores: all_libretro
|
||||||
target_scraper: retroarch_targets
|
target_scraper: retroarch_targets
|
||||||
|
|||||||
@@ -191,10 +191,9 @@ def load_platform_config(platform_name: str, platforms_dir: str = "platforms") -
|
|||||||
system.setdefault("files", []).append(gf)
|
system.setdefault("files", []).append(gf)
|
||||||
existing.add(key)
|
existing.add(key)
|
||||||
|
|
||||||
# Merge cores from _registry.yml if the registry has a broader list.
|
# Merge metadata from _registry.yml. The registry is our curated source;
|
||||||
# The scraped YAML may have an incomplete cores list; the registry is
|
# the scraped YAML may be incomplete (missing cores, metadata fields).
|
||||||
# our curated source and supplements it. This affects all consumers:
|
# Registry fields supplement (not replace) the scraped config.
|
||||||
# generate_pack, verify, generate_truth, diff_truth.
|
|
||||||
registry_path = os.path.join(platforms_dir, "_registry.yml")
|
registry_path = os.path.join(platforms_dir, "_registry.yml")
|
||||||
if os.path.exists(registry_path):
|
if os.path.exists(registry_path):
|
||||||
reg_real = os.path.realpath(registry_path)
|
reg_real = os.path.realpath(registry_path)
|
||||||
@@ -203,18 +202,25 @@ def load_platform_config(platform_name: str, platforms_dir: str = "platforms") -
|
|||||||
_shared_yml_cache[reg_real] = yaml.safe_load(f) or {}
|
_shared_yml_cache[reg_real] = yaml.safe_load(f) or {}
|
||||||
reg = _shared_yml_cache[reg_real]
|
reg = _shared_yml_cache[reg_real]
|
||||||
reg_entry = reg.get("platforms", {}).get(platform_name, {})
|
reg_entry = reg.get("platforms", {}).get(platform_name, {})
|
||||||
|
|
||||||
|
# Merge cores (union for lists, override for all_libretro)
|
||||||
reg_cores = reg_entry.get("cores")
|
reg_cores = reg_entry.get("cores")
|
||||||
if reg_cores is not None:
|
if reg_cores is not None:
|
||||||
cfg_cores = config.get("cores")
|
cfg_cores = config.get("cores")
|
||||||
if reg_cores == "all_libretro":
|
if reg_cores == "all_libretro":
|
||||||
config["cores"] = "all_libretro"
|
config["cores"] = "all_libretro"
|
||||||
elif isinstance(reg_cores, list) and isinstance(cfg_cores, list):
|
elif isinstance(reg_cores, list) and isinstance(cfg_cores, list):
|
||||||
# Union: registry supplements scraped cores
|
|
||||||
merged_set = {str(c) for c in cfg_cores} | {str(c) for c in reg_cores}
|
merged_set = {str(c) for c in cfg_cores} | {str(c) for c in reg_cores}
|
||||||
config["cores"] = sorted(merged_set)
|
config["cores"] = sorted(merged_set)
|
||||||
elif isinstance(reg_cores, list) and cfg_cores is None:
|
elif isinstance(reg_cores, list) and cfg_cores is None:
|
||||||
config["cores"] = reg_cores
|
config["cores"] = reg_cores
|
||||||
|
|
||||||
|
# Merge other metadata: registry supplements missing fields
|
||||||
|
for field in ("hash_type", "verification_mode", "base_destination",
|
||||||
|
"case_insensitive_fs", "standalone_cores"):
|
||||||
|
if field in reg_entry and field not in config:
|
||||||
|
config[field] = reg_entry[field]
|
||||||
|
|
||||||
_platform_config_cache[cache_key] = config
|
_platform_config_cache[cache_key] = config
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user