[Feature Request] Managing Multi-Title Game Collections using JSON Build Manifests

Aperta
#19,907 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
65/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github-actions, json, python
Ambito
build-system

Direzione di ricerca

Create compile_cheats.py and build_targets.json in libretro-database. First read the .cht format and existing cht/ directory structure. Implement script that loads manifest, concatenates source .cht files with re-indexed cheats, and writes flat files. Done when GitHub Actions runs script on src/ changes and generates valid self-contained .cht files.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature request

Summary

RetroArch currently treats each .cht file as self-contained, which creates maintenance problems when multiple game variants share overlapping cheat codes. For example:

While cheat codes can already be shared conceptually across game variants, each file currently contains redundant or mismatched entries, requiring manual synchronization across files.


Problem Description

  • Issue 1: Cheat code definitions are not synchronized across different versions or bundled titles. Updating or adding cheats remains tedious and error-prone.
  • Issue 2: There is no reliable way to associate cheats with specific sub-titles (e.g., “Super Mario Bros. 3” vs “The Lost Levels”) without messy, inconsistent manual descriptions.
  • Issue 3: Altering RetroArch's runtime parser or using custom text directives inside .cht files breaks backward compatibility for older versions of RetroArch and third-party tools.

Proposed Solution: JSON Build-Time Compiler for Multiple Titles

Introduce a build-time compiler script within the libretro-database repository that operates entirely on standard .cht files and external build configuration.

Instead of inserting inline linking syntax into cheat files, cheat codes are broken into modular, valid .cht source files for individual games. A JSON manifest maps composite titles (games containing multiple titles or game bundles) to their respective component .cht files. The repository build script reads the manifest, combines the source files, automatically prefixes sub-game descriptions, re-indexes cheat counters, and generates flat, self-contained .cht files for release.


Example Setup

1. Granular Source Files (Standard .cht Format)

Cheat sets are split into modular source files for single titles, containing only valid .cht syntax:

  • src/snes/sub/Super Mario All-Stars - Super Mario Bros. (USA).cht
  • src/snes/sub/Super Mario All-Stars - Super Mario Bros. 2 (USA).cht
  • src/snes/sub/Super Mario All-Stars - Super Mario Bros. 3 (USA).cht
  • src/snes/sub/Super Mario All-Stars - Super Mario Bros. - The Lost Levels (USA).cht
  • src/snes/sub/Super Mario World (USA).cht

Example standard contents of src/snes/sub/Super Mario All-Stars - Super Mario Bros. (USA).cht:

cheats = 2

cheat0_desc = "Infinite Lives"
cheat0_code = "C264-A40D"
cheat0_enable = false

cheat1_desc = "Always Have Super Mushroom"
cheat1_code = "CB6A-DFA4"
cheat1_enable = false

2. JSON Assembly Manifest (build_targets.json)

Composition for titles with multiple titles or bundled collections is managed using a clean JSON build configuration file:

{
  "cht/Nintendo - Super Nintendo Entertainment System/Super Mario All-Stars (USA).cht": [
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. (USA).cht",
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. 2 (USA).cht",
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. 3 (USA).cht",
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. - The Lost Levels (USA).cht"
  ],
  "cht/Nintendo - Super Nintendo Entertainment System/Super Mario All-Stars + Super Mario World (USA).cht": [
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. (USA).cht",
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. 2 (USA).cht",
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. 3 (USA).cht",
    "src/snes/sub/Super Mario All-Stars - Super Mario Bros. - The Lost Levels (USA).cht",
    "src/snes/sub/Super Mario World (USA).cht"
  ]
}

3. Build Script Execution (compile_cheats.py)

A build script integrated into libretro-database handles compilation:

  1. Iterates over target definitions in the JSON manifest.
  2. Loads all referenced source .cht files sequentially for titles with multiple titles.
  3. Automatically formats descriptions (e.g., adding sub-game tags like [SMB3] Infinite Lives) to preserve sub-title identification cleanly.
  4. Concatenates the entries while re-indexing cheats = X and cheatN_* blocks sequentially.
  5. Deduplicates identical entries to prevent code collisions.
  6. Writes the finished flat file to the production cht/ directory.

Benefits

  • 100% Backward Compatibility: Distributed .cht files remain fully standard, self-contained files. No RetroArch emulator code changes are required.
  • Single Source of Truth: Modular cheat files (e.g., Super Mario Bros. 3) are updated once, and the compiler automatically updates all collection releases.
  • Clean Configuration via JSON: Keeping title relationships in JSON avoids cluttering .cht source files with non-standard directives.
  • CI/CD Integration: Builds can run automatically on GitHub Actions whenever a pull request modifies source files in src/.
Lingua principale
C
Stelle
14.6k
Fork
2.4k
Merge medio
2g 5h
PR unite (30g)
63

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libretro/RetroArch

Tutte le issue di libretro/RetroArch

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.