mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-19 15:22:35 -05:00
refactor: deduplicate manufacturer prefix list
This commit is contained in:
+9
-5
@@ -647,6 +647,14 @@ def resolve_platform_cores(
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
MANUFACTURER_PREFIXES = (
|
||||||
|
"microsoft-", "nintendo-", "sony-", "sega-", "snk-", "panasonic-",
|
||||||
|
"nec-", "epoch-", "mattel-", "fairchild-", "hartung-", "tiger-",
|
||||||
|
"magnavox-", "philips-", "bandai-", "casio-", "coleco-",
|
||||||
|
"commodore-", "sharp-", "sinclair-", "atari-",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _norm_system_id(sid: str) -> str:
|
def _norm_system_id(sid: str) -> str:
|
||||||
"""Normalize system ID for cross-platform matching.
|
"""Normalize system ID for cross-platform matching.
|
||||||
|
|
||||||
@@ -655,11 +663,7 @@ def _norm_system_id(sid: str) -> str:
|
|||||||
(e.g., "microsoft-xbox", "nintendo-wii-u").
|
(e.g., "microsoft-xbox", "nintendo-wii-u").
|
||||||
"""
|
"""
|
||||||
s = sid.lower().replace("_", "-")
|
s = sid.lower().replace("_", "-")
|
||||||
for prefix in ("microsoft-", "nintendo-", "sony-", "sega-",
|
for prefix in MANUFACTURER_PREFIXES:
|
||||||
"snk-", "panasonic-", "nec-", "epoch-", "mattel-",
|
|
||||||
"fairchild-", "hartung-", "tiger-", "magnavox-",
|
|
||||||
"philips-", "bandai-", "casio-", "coleco-",
|
|
||||||
"commodore-", "sharp-", "sinclair-"):
|
|
||||||
if s.startswith(prefix):
|
if s.startswith(prefix):
|
||||||
s = s[len(prefix):]
|
s = s[len(prefix):]
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(__file__))
|
sys.path.insert(0, os.path.dirname(__file__))
|
||||||
from common import (
|
from common import (
|
||||||
|
MANUFACTURER_PREFIXES,
|
||||||
_build_validation_index, build_zip_contents_index, check_file_validation,
|
_build_validation_index, build_zip_contents_index, check_file_validation,
|
||||||
check_inside_zip, compute_hashes, fetch_large_file, filter_files_by_mode,
|
check_inside_zip, compute_hashes, fetch_large_file, filter_files_by_mode,
|
||||||
group_identical_platforms, list_emulator_profiles, list_platform_system_ids,
|
group_identical_platforms, list_emulator_profiles, list_platform_system_ids,
|
||||||
@@ -256,11 +257,7 @@ def generate_pack(
|
|||||||
display_parts = []
|
display_parts = []
|
||||||
for sid in system_filter:
|
for sid in system_filter:
|
||||||
s = sid.lower().replace("_", "-")
|
s = sid.lower().replace("_", "-")
|
||||||
for prefix in ("microsoft-", "nintendo-", "sony-", "sega-", "snk-",
|
for prefix in MANUFACTURER_PREFIXES:
|
||||||
"panasonic-", "nec-", "epoch-", "mattel-", "fairchild-",
|
|
||||||
"hartung-", "tiger-", "magnavox-", "philips-", "bandai-",
|
|
||||||
"casio-", "coleco-", "commodore-", "sharp-", "sinclair-",
|
|
||||||
"atari-"):
|
|
||||||
if s.startswith(prefix):
|
if s.startswith(prefix):
|
||||||
s = s[len(prefix):]
|
s = s[len(prefix):]
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user