Add multi-ROM base detection and EU1.1 bring-up infrastructure - #1
Merged
Conversation
Zection6V
marked this pull request as ready for review
August 17, 2026 06:00
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
Adds multi-ROM base detection and the first non-USA exact-content bring-up path for Europe revision 1 (
AMHP, revision 1), while separating runtime compatibility from exact ROM content identity.Also integrates the current upstream
mstan/MetroidPrimeHuntersRecompcodex/mph-online-first-runbranch through5abcfee6187d572e752985ede2364f165d62dd6a(4 commits beyond this PR's original upstream base), including:6c6a03bdcf99093f64555c4d05d16e522dc58634The upstream code is integrated without restoring its old US1.0 whole-ROM-SHA runtime assumptions.
Identity architecture
The architecture separates three identities:
Whole-ROM SHA-1 is not the runtime address selector.
Runtime detector
Runtime source of truth is melonPrimeDS
develop_hud:src/frontend/qt_sdl/MelonPrimeGameRomDetect.cppsrc/frontend/qt_sdl/MelonPrimeGameRomAddrTable.hsrc/NDSCart/CartCommon.cpp::Checksum()Detection is:
0x00..0x3F, then ARM9, then ARM7gameCode @0x0C + revision @0x1EfallbackRecomp tightens the fallback to the seven explicitly supported tuples. A header-only match identifies a candidate base profile but does not authorize host RAM/code writes.
The registry is live-cross-checked against the current melonPrimeDS detector and carries its current 17 executable checksums, including clean/encrypted variants plus EU1.1 Balanced, Balanced v1.2.11 and Russian variants.
Seven runtime layouts
US1_0AMHE0x020DA8180x020DE5260x020DE52EUS1_1AMHE0x020DB0980x020DEDA60x020DEDAEEU1_0AMHP0x020DB0B80x020DEDC60x020DEDCEEU1_1AMHP0x020DB1380x020DEE460x020DEE4EJP1_0AMHJ0x020DC6D80x020E03E60x020E03EEJP1_1AMHJ0x020DC6980x020E03A60x020E03AEKR1_0AMHK0x020D3EE40x020D7C0E0x020D7C16Adaptive Widescreen: all seven runtime profiles
Adaptive Widescreen is no longer hidden for EU1.1. The implementation uses melonPrimeDS
MelonPrimePatchAspectRatio.cpp/MelonPrimeGameRomAddrTable.h, cross-checked againstmphCodex/_Commons/Widescreen.md.US1_00x02110FFC0x0211C6380x02110820US1_10x02111ABC0x0211D1680x021112E0EU1_00x02111ADC0x0211D1140x02111300EU1_10x02111B5C0x0211D2080x02111380JP1_00x0211313C0x0211E7E80x02112960JP1_10x021130FC0x0211E7A80x02112920KR1_00x02109B640x021148380x021091A4The 21:9 patch verifies all three stock preimages before doing any write:
0xE59916640xE59A16640x1555Then applies melonPrimeDS's 21:9 values:
0xE3A0106D0x2555A known executable checksum may authorize these writes. A header-only fallback keeps the candidate base identity but forces the actual Adaptive Widescreen host patch off. Guest reset is handled by re-checking the guarded stock words so the patch can be reapplied when appropriate.
Whole-ROM SHA-1 and mod safety
Whole-ROM SHA-1 remains authoritative for exact build input identity, coverage, generated banks, checkpoints and FMV/runtime captures. Generated title banks remain keyed to the actual ROM SHA-1, so clean/MOD-A content cannot silently be reused for MOD-B.
Startup remains conservative:
Last Ravenis not currently in the audited melonPrimeDS checksum table and therefore remains fail-closed for host writes until explicitly validated.Content profiles
Registry schema 5 separates content profiles from runtime bases through
base_profileandknown_clean.A future exact mod profile can use a distinct key such as
US1_0_LAST_RAVEN, point tobase_profile: US1_0, and keep its own SHA-1, coverage, banks, checkpoints and FMV captures.Current exact build/capture profiles are:
US1_0clean retailEU1_1clean retailThe other five retail revisions still need exact ROM extraction/coverage/generated artifacts before being considered fully player-facing supported.
Upstream launcher / Wi-Fi / HD integration
launcher/recomp-ui/launcher_main.cppandlauncher/recomp-ui/tests/launcher_mod_provider_test.cppare kept byte-identical to upstream5abcfeeand CI verifies that property. The launcher therefore retains all three upstream gameplay features:The profile-generation CMake layer performs only the multi-ROM-specific transformations:
known_sha1_hex = nullptr,num_known_sha1 = 0)This lets modified ROMs reach the runner's stronger CRC/header/content detector instead of being rejected by recomp-ui first.
Upstream Wi-Fi persistence is also retained:
%APPDATA%\\MetroidPrimeHuntersRecompfirmware-generated.bin/firmware-retail.bin--firmware-state-pathpassed to the runnerprobe_mph_online_first_run.pyplus updated WFC/screen QA toolsThe pinned ndsrecomp revision is
6c6a03bdcf99093f64555c4d05d16e522dc58634. Its baseline still contains US1.0 exact-SHA/address assumptions; the local multi-ROM patch stack replaces those at build time.Validation
Current HEAD:
e3f0f9959f5d22b2547740689ed3a3c69c6cf1c8.MPH Multi-ROM Static Checksrun #78: PASS.Validated on the final HEAD:
5abcfeelauncher, launcher-test and QA-tool byte syncdevelop_huddetector/address-table cross-check6c6a03b...title_patches.cpp,frontend.cppandmain.cppRemaining real-ROM work
Static architecture is prepared, but full player-facing support still requires per-content validation:
Detailed procedures are in
docs/EU1_1_BRINGUP.md.