Skip to content

Compositor: skip existing output under either image suffix - #275

Open
helipdx wants to merge 1 commit into
Gemba:masterfrom
helipdx:compositor-skip-alt-suffix
Open

helipdx wants to merge 1 commit into
Gemba:masterfrom
helipdx:compositor-skip-alt-suffix

Conversation

@helipdx

@helipdx helipdx commented Oct 22, 2026

Copy link
Copy Markdown

Summary

Compositor::saveAll forces every composited output filename to end in .png and
skips a resource only when QFileInfo::exists() finds that exact .png path.
A resource that already exists as .jpg (an ES-DE/theme default, an older
Skyscraper run with no artwork.xml, or a user-placed image) is invisible to
that check, so a skipExisting* rerun writes a second, redundant .png beside
it instead of recognizing the file as present.

AbstractFrontend::doCopy, the raw-copy path used for resources the
artwork.xml does not layer, already builds a .jpg<->.png altTgt and
treats either as present; saveAll had no equivalent for composited output.

Fix

Adds Compositor::existsWithAltSuffix, used at all five per-type skip checks
in saveAll (cover, screenshot/miximage, wheel, marquee, texture), mirroring
doCopy's suffix swap. On skip, the gamelist field is still set to the forced
.png path, matching doCopy's own behavior of leaving tgt unchanged on its
skip path.

With the shipped, unmodified artwork.xml this only reaches two output types:
the ES-DE "screenshot"-type output (the composited screenshot+cover+wheel
image - either the miximages folder under --flags miximages, or the plain
screenshots folder without it) and marquee (resource="wheel", no <layer>
children, a 1:1 remap rather than a real composite). Cover, plain screenshot,
wheel, backcover, fanart, manual, texture and video are not composited under
that file and already go through doCopy's correct check.

Testing

  • Builds clean against current master, upstream's own test/ suite passes
    unchanged.
  • Measured with a synthetic 120-game fixture (offscreen QPA): renaming an
    existing composited output's .png to .jpg and rerunning with
    skipExisting* set previously wrote a new, byte-identical duplicate file
    and left both suffixes on disk; with this fix it writes nothing and leaves
    only the .jpg. Every other measured case (cold build, reuse rerun,
    missing-cover repair, raw-copy .jpg survival, gamelist fields) is
    unchanged.
  • Reproduced and fixed against a real ScreenScraper resource cache and ROM
    library (not just the synthetic fixture): a real, fully-cached game's
    composited screenshot and marquee output, renamed to .jpg, is duplicated
    by the pre-fix binary and left untouched by the patched one, byte-identical
    hash before and after.
  • Running as the production Skyscraper binary against a real library's
    generate --reuse-media: unaffected systems produce byte-identical
    gamelists to their pre-fix backups, no new .png/.jpg suffix duplicates
    introduced anywhere.

Opened separately from #271, which this does not depend on or build toward.

🤖 Generated with Claude Code

Compositor::saveAll forces every composited output filename to end in
.png and then skips it only when QFileInfo::exists() finds that exact
.png path. A resource that already exists as .jpg (an ES-DE/theme
default, an older Skyscraper run with no artwork.xml, or a user-placed
image) is invisible to that check, so a skipExisting* rerun writes a
second, redundant .png beside it instead of recognizing the file as
present. AbstractFrontend::doCopy, the raw-copy path used for resources
the artwork.xml does not layer, already builds a .jpg<->.png altTgt and
treats either as present; saveAll had no equivalent.

Add Compositor::existsWithAltSuffix, used at all five per-type skip
checks in saveAll (cover, screenshot/miximage, wheel, marquee, texture),
mirroring doCopy's suffix swap. On skip, the gamelist field is still set
to the forced .png path, same as doCopy leaves tgt unchanged on its own
skip path.

With the shipped, unmodified artwork.xml this only reaches two output
types: the ES-DE miximage (type="screenshot", three layered resources)
and marquee (type="marquee" resource="wheel", no <layer> children, a
1:1 remap rather than a real composite). Cover, plain screenshot, wheel,
backcover, fanart, manual, texture and video are not composited under
that file and already go through doCopy's correct check.

Measured with retrodeck-scraper's tools/verify/measure_media_reuse.py
(120 synthetic games, -t 1, offscreen QPA): renaming an existing
miximage .png to .jpg and rerunning with skipExisting* set previously
wrote 1 new file / 30,703 bytes and left both suffixes on disk
(binary 48317d63e55ae37ea2dd3853ccb707a4409759d41630c88555de896697f4ad17,
this branch's parent, 9a26d43). This build writes 0 files / 0 bytes and
leaves only the .jpg. Every other measured case (cold build, reuse
rerun, missing-cover repair, raw-copy .jpg survival, miximage gamelist
fields) is unchanged, including byte counts.

Not yet run against the real library on Bazzite - both documented SSH
addresses timed out this session. docs/TODO.md in retrodeck-scraper
carries the follow-up to build and test this branch there before it is
considered for upstream.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant