feat: use PICO-8 built-in cover art from .p8.png cartridge files#3119
Merged
feat: use PICO-8 built-in cover art from .p8.png cartridge files#3119
Conversation
Co-authored-by: gantoine <[email protected]>
Copilot
AI
changed the title
[WIP] Add feature to use Pico-8 built-in cover art
feat: use PICO-8 built-in cover art from .p8.png cartridge files
Mar 11, 2026
gantoine
reviewed
Mar 11, 2026
…h for safe path construction Co-authored-by: gantoine <[email protected]>
gantoine
approved these changes
Mar 11, 2026
Contributor
Contributor
Greptile SummaryThis PR enables RomM to use the embedded artwork from PICO-8 Key points:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant SC as scan.py (_identify_rom)
participant SH as scan_handler (scan_rom)
participant FS as FSRomsHandler.get_pico8_cover_url
participant VP as FSHandler.validate_path
participant RH as resources_handler._store_cover
SC->>SH: scan_rom(platform, rom, fs_rom, ...)
SH->>SH: Populate rom_attrs (fs_name, fs_path, ...)
SH->>SH: Fetch metadata from all sources
SH->>SH: Apply UPDATE/UNMATCHED cover preservation block
alt no url_cover AND no path_cover_s in rom_attrs
SH->>FS: get_pico8_cover_url(platform.slug, fs_name, fs_path)
alt platform == "pico" AND fs_name.lower().endswith(".p8.png")
FS->>VP: validate_path("{fs_path}/{fs_name}")
VP-->>FS: resolved Path (or raises ValueError)
FS-->>SH: "file:///library/.../game.p8.png"
else
FS-->>SH: None
end
SH->>SH: rom_attrs["url_cover"] = pico8_url
end
SH-->>SC: Rom (with url_cover set)
SC->>RH: _store_cover(rom, url_cover, SMALL/LARGE)
RH->>RH: Strip "file://", AnyioPath.exists()
RH->>RH: copy_file(rom_path → resources/cover/s.png)
RH->>RH: PIL resize for SMALL cover
Last reviewed commit: 744d92d |
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PICO-8
.p8.pngcartridges are valid PNG files where the image itself is the cartridge label. RomM was ignoring this and leaving PICO-8 games with no cover art unless manually set or matched from an external source.Changes
handler/filesystem/roms_handler.py— Addedget_pico8_cover_url()as a method onFSRomsHandler. It returns afile://URL pointing to the ROM file itself whenplatform_slug == UPS.PICOand the filename ends with.p8.png. Path construction usesself.validate_path()fromFSHandler(infilesystem/base_handler) to safely resolve the absolute path and prevent directory traversal. Called fromscan_rom()viafs_rom_handlerafter all metadata sources are resolved, only when nourl_coverorpath_cover_salready exists (manual/metadata-sourced covers are preserved).The existing
file://URL handling inresources_handler._store_cover()already copies local files into the resources directory — no changes needed there.tests/endpoints/sockets/test_scan.py— AddedTestGetPico8CoverUrlcovering:.p8.pngon PICO platform (positive), plain.p8text cartridge (no image), wrong platform, unrelated extension.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.