diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-10-21 17:08:06 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-10-21 17:08:06 +0200 |
| commit | 3cfacacf75ba79037a1e86310cf4df7a2b0d5347 (patch) | |
| tree | e7cc726908e76b4c52cf62564a87d26c5b5dfc9a /crates | |
| parent | 51f8583447a97fbd913ef961bf85a22a925395cc (diff) | |
| download | tools.nes-3cfacacf75ba79037a1e86310cf4df7a2b0d5347.tar.gz tools.nes-3cfacacf75ba79037a1e86310cf4df7a2b0d5347.zip | |
readrom: assume a default value for --mmc on MMC3
If we detect the MMC3 chip and no --mmc flag was provided, pull default
values for it, as this guess is often better than no guess at all. In
the future we might consider throwing a warning to the user, but for now
the noise is not worth the effort.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/readrom/src/main.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/crates/readrom/src/main.rs b/crates/readrom/src/main.rs index 81b7e09..5b88d68 100644 --- a/crates/readrom/src/main.rs +++ b/crates/readrom/src/main.rs @@ -661,12 +661,28 @@ fn main() { // memory mapper chip configuration. If that's the case, then 'bytes' might // need to be re-constructed with the given mapper configuration. Otherwise, // we remove the header part from the ROM, as it's no longer needed. - bytes = match &args.mmc { - Some(MemoryMapperChip::Mmc3(m)) => match reconstruct_from_mmc3(&header, m, &bytes) { - Ok(b) => b, - Err(e) => die(e), - }, - None => bytes.get(0x10..).unwrap_or(&[]).to_vec(), + bytes = match header.mapper { + header::Mapper::Mmc3Acc + | header::Mapper::Mmc3Nec + | header::Mapper::Mmc3Sharp + | header::Mapper::Mmc3T9552 + | header::Mapper::Mmc3c => { + // If the --mmc option was provided, use it. Otherwise assume a + // default configuration. + let mmc = match args.mmc { + Some(MemoryMapperChip::Mmc3(ref m)) => m, + None => &Mmc3 { + prg_rom_mode: false, + r6: 0, + r7: 0, + }, + }; + match reconstruct_from_mmc3(&header, mmc, &bytes) { + Ok(b) => b, + Err(e) => die(e), + } + } + _ => bytes.get(0x10..).unwrap_or(&[]).to_vec(), }; // Check whether the user wanted to disassemble something. |
