Skip to content

PyUI: identify ROMs for achievement progress with Cheevos's helper - #1888

Merged
ryanmsartor merged 2 commits into
spruceUI:Developmentfrom
abalakh:cheevos_identify_rom
Oct 18, 2026
Merged

ryanmsartor merged 2 commits into
spruceUI:Developmentfrom
abalakh:cheevos_identify_rom

Conversation

@abalakh

@abalakh abalakh commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

View achievement progress identified unknown ROMs through an identify-rom command added to the bundled RAOfflineProxy. Proxy updates replace that directory: the nightly-54 refresh already removed the command, hiding the action. Cheevos now ships the helper (App/Cheevos/identify-rom.sh), and the installed proxy stays unmodified.

  • Offer the action when Cheevos's config.json has "gameProgress": 2 and ships identify-rom.sh, instead of checking for the proxy's file.
  • Keep the loaded CheevosCacheManager mapping as the first fast path, with no subprocess, ROM checks or cache access.
  • Run the helper in its own session with a per-lookup scratch directory under Saves/cheevos/cache/identify-work. B and the 60 s timeout stop the whole process group, escalating to SIGKILL; the scratch directory is removed either way.
  • Accept only the helper's documented results: malformed output or a crash is a failed lookup, and a structured error survives a nonzero exit. Add a message for the new "dependency" reason.
  • Remove cheevos_identification_cache.py: saved path associations now live in Cheevos, in the same rom-identifications.json.

Tested on Miyoo Mini+.

Requires Cheevos v0.2.2+. With an older Cheevos the action stays hidden.

View achievement progress identified unknown ROMs through an
identify-rom command added to the bundled RAOfflineProxy. Proxy updates
replace that directory: the nightly-54 refresh already removed the
command, hiding the action. Cheevos now ships the helper
(App/Cheevos/identify-rom.sh), and the installed proxy stays unmodified.

- Offer the action when Cheevos's config.json has "gameProgress": 2 and
  ships identify-rom.sh, instead of checking for the proxy's file.
- Keep the loaded CheevosCacheManager mapping as the first fast path,
  with no subprocess, ROM checks or cache access.
- Run the helper in its own session with a per-lookup scratch directory
  under Saves/cheevos/cache/identify-work. B and the 60 s timeout stop
  the whole process group, escalating to SIGKILL; the scratch directory
  is removed either way.
- Accept only the helper's documented results: malformed output or a
  crash is a failed lookup, and a structured error survives a nonzero
  exit. Add a message for the new "dependency" reason.
- Remove cheevos_identification_cache.py: saved path associations now
  live in Cheevos, in the same rom-identifications.json.

Tested on Miyoo Mini+.

Requires Cheevos v0.2.2+. With an older Cheevos the action stays hidden.
Starting Cheevos's identify-rom.sh from PyUI takes 0.9-2.4 s on a
Miyoo Mini+, even when Cheevos has already saved the ROM's game, so
View achievement progress showed "Checking RetroAchievements..." for
that long every time. Spruce 4.5.5 answered saved paths in-process.

Read rom-identifications.json before starting the helper, and use only
a match saved under the ROM's absolute path: versions 1 and 2, at most
256 KB, real game IDs only. Misses, expiry, virtual IDs and saving stay
with the helper. The read takes under 1 ms on a Mini+.
@ryanmsartor
ryanmsartor merged commit 03c3ff3 into spruceUI:Development Oct 18, 2026
1 check failed
abalakh added a commit to spruceUI/cheevos that referenced this pull request Oct 19, 2026
Each identification helper run is a new process. Asking RA through
Python first imported ssl and http.client (0.45 s on a Miyoo Mini+) and
resolved RA's address through the C library (0.3-0.8 s). Spruce ships a
static curl for every platform and makes its own HTTPS requests with
it; curl answers RA's r=gameid in 0.3-0.6 s, process included.

- Add platform/curl_transport.py: GET through the curl on Spruce's PATH,
  matching HttpTransport: certificates from $SSL_CERT_FILE, no
  ~/.curlrc, proxies or redirects, a 15 s limit, TLS failures on RA's
  hosts retried over HTTP, and RA's Date for the app clock. No answer is
  offline. Any other failure (curl missing, not executable, built for
  another architecture, unexpected output) falls back to Python's HTTPS
  for the rest of the run.
- Move RA's hosts, Response and default_user_agent to
  ra_client/common.py, so the helper loads no TLS code.
- Document that Spruce now reads saved matches from
  rom-identifications.json itself (spruceUI/spruceOS#1888), which makes
  a match's shape a contract.

On a Miyoo Mini+, the RA step took 0.6-1.3 s instead of 1.8-2.1 s, and
a new SNES zip 2.5-3.7 s instead of 3.8-4.2 s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants