feat: add archive support for ZIP, 7z, and RAR formats#3
Merged
wizzomafizzo merged 2 commits intomainfrom Dec 10, 2025
Merged
Conversation
Add support for identifying games inside ZIP, 7z, and RAR archives using MiSTer-style paths (e.g., /path/to/archive.zip/folder/game.gba) and auto-detection when given just an archive path. New archive package: - archive.go: Core Archive interface and factory function - zip.go: ZIP implementation using stdlib archive/zip - sevenzip.go: 7z implementation using bodgit/sevenzip - rar.go: RAR implementation using nwaples/rardecode/v2 - path.go: MiSTer-style path parsing - detect.go: Game file detection by extension - errors.go: Error types (FormatError, FileNotFoundError, etc.) Features: - Explicit internal paths: /games/roms.zip/gba/game.gba - Auto-detect game file: /games/roms.zip (finds first game by extension) - Supports cartridge-based games only (GB, GBC, GBA, NES, SNES, N64, Genesis) - Disc-based games in archives return DiscNotSupportedError Dependencies added: - github.com/bodgit/sevenzip (BSD-3-Clause) - github.com/nwaples/rardecode/v2 (BSD-2-Clause)
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Add comprehensive tests to improve patch coverage: - TestSevenZipAndRAR_Operations: Consolidated table-driven tests for 7z and RAR archive operations (List, Open, OpenReaderAt, case-insensitive matching) - TestDetectConsoleFromExtension: Full coverage for extension-based console detection including ambiguous extensions, .gz suffix handling, and edge cases - TestIdentifyFromArchive_*: Tests for archive identification including direct calls, disc console errors, unsupported consoles, and non-existent files - TestDetectConsoleFromCue_*: Tests for CUE sheet console detection including Saturn and SegaCD magic headers, empty CUE files, and missing BIN files - TestByteReaderAt edge cases: Fixed errorlint issues using errors.Is() Coverage improvements: - DetectConsoleFromExtension: 44.4% -> 100% - detectConsoleFromCue: 0% -> 69.6% - IdentifyFromArchive: 0% -> 88.2% - archive/sevenzip.go: 0% -> covered - archive/rar.go: 0% -> covered
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.
Summary
/path/to/archive.zip/folder/game.gba)New
archivePackagearchive.go: CoreArchiveinterface and factory functionzip.go: ZIP implementation (stdlibarchive/zip)sevenzip.go: 7z implementation (bodgit/sevenzip)rar.go: RAR implementation (nwaples/rardecode/v2)path.go: MiSTer-style path parsingdetect.go: Game file detection by extensionerrors.go: Custom error typesFeatures
/games/roms.zip/gba/game.gba/games/roms.zipfinds first game file by extensionDiscNotSupportedErrorDependencies
github.com/bodgit/sevenzip(BSD-3-Clause)github.com/nwaples/rardecode/v2(BSD-2-Clause)Test plan
make checkpasses