From 3cfacacf75ba79037a1e86310cf4df7a2b0d5347 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 21 Oct 2026 17:08:06 +0200 Subject: readrom: assume a default value for --mmc on MMC3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- crates/readrom/src/main.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'crates/readrom') 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. -- cgit v1.2.3