refactor: standardize hack filenames to [Hack] and flatten to platform root
Switch the library naming convention from "Pokemon - <Name> (Hack)" to "Pokemon - <Name> [Hack][version][tags]", and place hacks in the platform root (roms/<plat>/) instead of a Hacks/ subfolder. Applied across the live valhalla library (272 hack/fan-game files) via scripts/standardize-names.py. - romhack-import.py / romhack-fetch.py: emit [Hack], write to roms/<plat>/ - romhack-pc-migrate.py: emit [Hack] - build-romhack-vault.py (archived): update documented library_path - standardize-names.py: new one-shot, self-fetching standardizer (idempotent; pipes \n-only bytes over SSH to avoid Windows CRLF corrupting filenames) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
52ee1b98a1
commit
ae56d101b7
+10
-10
@@ -2,12 +2,12 @@
|
||||
"""Import a drop-folder of mixed Pokémon hack files into the valhalla library.
|
||||
|
||||
Handles a folder containing any mix of:
|
||||
- completed ROMs (.gba/.gbc/.gb/.nds) -> validated, clean-named, copied to roms/<plat>/Hacks/
|
||||
- patches (.ips/.bps/.ups/.xdelta) -> applied to an owned base, placed in Hacks/, archived
|
||||
- completed ROMs (.gba/.gbc/.gb/.nds) -> validated, clean-named, copied to roms/<plat>/
|
||||
- patches (.ips/.bps/.ups/.xdelta) -> applied to an owned base, placed in roms/<plat>/, archived
|
||||
- documentation (.pdf/.txt/.png/.md) -> archived under PATCHES/_docs/
|
||||
- archives (.zip/.rar/.7z) -> extracted and recursed (same rules), source kept
|
||||
|
||||
Naming matches the rest of the library: "Pokemon - <Hack> (Hack).<ext>"
|
||||
Naming matches the rest of the library: "Pokemon - <Hack> [Hack].<ext>"
|
||||
(version/junk parentheticals are stripped from the source filename).
|
||||
|
||||
Base ROM for a patch is auto-detected: BPS/UPS embed source CRC32 so the correct
|
||||
@@ -89,7 +89,7 @@ NAME_OVERRIDES = [
|
||||
]
|
||||
# Files we will NOT auto-place (unidentified / need user to name). Reported instead.
|
||||
SKIP_NAME_SUBSTR = ["beta 15 + expansion"]
|
||||
# Known base ROMs in a drop folder — place under roms/<plat>/, not Hacks/
|
||||
# Known base ROMs in a drop folder — placed under roms/<plat>/ (un-tagged, no [Hack])
|
||||
BASE_ROM_FILES = [
|
||||
("fire red (j)", "gba", "Pokemon - Fire Red (J) (V1.0).gba"),
|
||||
]
|
||||
@@ -205,7 +205,7 @@ def place_rom(src, plat, hackname, origin):
|
||||
if is_skip_name(origin):
|
||||
report.append(("ROM", "NEEDS-ID", origin, "unidentified hack — tell me the name", ""))
|
||||
return
|
||||
out_name = f"Pokemon - {hackname} (Hack).{plat}"
|
||||
out_name = f"Pokemon - {hackname} [Hack].{plat}"
|
||||
err, padto = validate(src, plat)
|
||||
if err:
|
||||
report.append(("ROM", "FAIL", origin, err, "")); return
|
||||
@@ -213,11 +213,11 @@ def place_rom(src, plat, hackname, origin):
|
||||
if padto and len(data) < padto:
|
||||
data += b"\xff" * (padto - len(data))
|
||||
if PLACE:
|
||||
d = os.path.join(ROMS, plat, "Hacks"); os.makedirs(d, exist_ok=True)
|
||||
d = os.path.join(ROMS, plat); os.makedirs(d, exist_ok=True)
|
||||
with open(os.path.join(d, out_name), "wb") as f:
|
||||
f.write(data)
|
||||
report.append(("ROM", "OK", origin, f"{len(data):,}b crc={zlib.crc32(data)&0xffffffff:08x}",
|
||||
f"{plat}/Hacks/{out_name}"))
|
||||
f"{plat}/{out_name}"))
|
||||
|
||||
|
||||
def try_apply(patch, base_key, out):
|
||||
@@ -314,8 +314,8 @@ def process_file(path, origin=None):
|
||||
|
||||
def place_pc_archive(path, hackname, origin, variant=None):
|
||||
tag = variant or detect_variant(path) or ""
|
||||
suffix = f" {tag}" if tag else ""
|
||||
out_name = f"Pokemon - {hackname} (Hack){suffix}.zip"
|
||||
suffix = tag if tag else ""
|
||||
out_name = f"Pokemon - {hackname} [Hack]{suffix}.zip"
|
||||
dest_dir = pc_dest_dir(tag)
|
||||
dest = os.path.join(dest_dir, out_name)
|
||||
ext = os.path.splitext(path)[1].lower()
|
||||
@@ -352,7 +352,7 @@ def place_pc_archive(path, hackname, origin, variant=None):
|
||||
def place_pc_installer(path, hackname, origin):
|
||||
"""Wrap a standalone .exe installer in a zip so RomM can serve it."""
|
||||
tag = detect_variant(path) or "[Installer]"
|
||||
out_name = f"Pokemon - {hackname} (Hack) {tag}.zip"
|
||||
out_name = f"Pokemon - {hackname} [Hack]{tag}.zip"
|
||||
dest_dir = pc_dest_dir(tag)
|
||||
dest = os.path.join(dest_dir, out_name)
|
||||
tmp_zip = dest + ".part"
|
||||
|
||||
Reference in New Issue
Block a user