A GameCube/Wii emulator and debugger written in Rust.
dsp replacements from dolphin
Layle1c3a482c7e02
diff --git a/.github/workflows/deploy-wasm.yml b/.github/workflows/deploy-wasm.ymlindex fd8aede..0a25fca 100644--- a/.github/workflows/deploy-wasm.yml+++ b/.github/workflows/deploy-wasm.yml@@ -24,6 +24,7 @@ jobs:run: |git submodule update --init --depth 1 --recursive submodules/chipi-specgit submodule update --init --depth 1 --recursive submodules/solstice+ git submodule update --init --depth 1 submodules/dolphin- uses: dtolnay/[email protected]with:diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.ymlindex 85fbc48..360dd60 100644--- a/.github/workflows/nightly.yml+++ b/.github/workflows/nightly.yml@@ -70,7 +70,9 @@ jobs:ref: dev- name: Init submodules- run: git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ run: |+ git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ git submodule update --init --depth 1 submodules/dolphin- uses: dtolnay/rust-toolchain@stablewith:@@ -148,7 +150,9 @@ jobs:ref: dev- name: Init submodules- run: git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ run: |+ git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ git submodule update --init --depth 1 submodules/dolphin- uses: dtolnay/rust-toolchain@stablewith:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 299137e..57255c4 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -38,7 +38,9 @@ jobs:- uses: actions/checkout@v4- name: Init submodules- run: git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ run: |+ git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ git submodule update --init --depth 1 submodules/dolphin- uses: dtolnay/rust-toolchain@stablewith:@@ -108,7 +110,9 @@ jobs:- uses: actions/checkout@v4- name: Init submodules- run: git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ run: |+ git submodule update --init --depth 1 --recursive submodules/chipi-spec submodules/solstice+ git submodule update --init --depth 1 submodules/dolphin- uses: dtolnay/rust-toolchain@stablewith:diff --git a/.gitmodules b/.gitmodulesindex 3561593..a249ff5 100644--- a/.gitmodules+++ b/.gitmodules@@ -7,3 +7,7 @@[submodule "submodules/beanwii"]path = submodules/beanwiiurl = https://github.com/zaydlang/beanwii+[submodule "submodules/dolphin"]+ path = submodules/dolphin+ url = https://github.com/dolphin-emu/dolphin+ shallow = truediff --git a/README.md b/README.mdindex fa17e0e..822396e 100644--- a/README.md+++ b/README.md@@ -71,30 +71,19 @@ Gecko is developed with homebrew development and reverse engineering in mind, bu- [incl. debugging capabilities](https://gecko.layle.dev/dbg)## Usage-Prebuilt releases (including debug builds) can be downloaded [here](https://github.com/ioncodes/gecko/releases). GameCube and Wii require system files to use the emulator, please refer to the ["Required Files"](https://github.com/ioncodes/gecko#required-files) chapter. Minimal commands to launch a game:+Prebuilt releases (including debug builds) can be downloaded [here](https://github.com/ioncodes/gecko/releases). Gecko boots most games without any system files, using Dolphin's DSP ROM and an IPL HLE. Real dumps can still be used and are more accurate, please refer to the ["Required Files"](https://github.com/ioncodes/gecko#required-files) chapter.-```sh-# Launch a GameCube game with the built-in IPL HLE-./tinyapp --dsp dsp_rom.bin --coef dsp_coef.bin --dvd YourGame.rvz--# Launch a GameCube game with a real IPL (skip the boot animation)-./tinyapp --ipl IPL.decoded.bin --dsp dsp_rom.bin --coef dsp_coef.bin --skip-ipl --dvd YourGame.rvz--# Launch a Wii game-./tinyapp --dsp dsp_rom.bin --coef dsp_coef.bin --dvd YourGame.rvz-```--A more modern and friendly experience is provided via `gecko` ([short preview on YouTube](https://www.youtube.com/watch?v=aCQSc70FV4k)):+A modern and friendly experience is provided via `gecko` ([short preview on YouTube](https://www.youtube.com/watch?v=aCQSc70FV4k)):-On first launch, a guided setup popup asks for your DSP ROM (`dsp_rom.bin`), DSP coefficient ROM (`dsp_coef.bin`), optional GameCube IPL and game folders. It validates and copies the system files with the correct names, automatically decodes an encoded IPL, saves your settings and scans your games. You can skip setup for now or reopen it from **Settings -> Guided Setup**.+On first launch, a guided setup popup asks for an optional DSP ROM (`dsp_rom.bin`), DSP coefficient ROM (`dsp_coef.bin`), GameCube IPL and your game folders. It validates and copies the system files with the correct names, automatically decodes an encoded IPL, saves your settings and scans your games. You can skip setup for now or reopen it from **Settings -> Guided Setup**.-Enable **Settings -> Boot -> IPL HLE (GameCube)** to boot GameCube discs using [Hazel's](https://codeberg.org/hazelwiss) built-in IPL replacement, even if a real IPL is installed. The setting is saved as `ipl_hle = true` in `config.toml` and applies the next time you launch a game. Guided setup enables HLE automatically if you leave the IPL file empty. Disable HLE to use your real IPL. **Skip IPL (GameCube)** then controls whether its boot animation is skipped. DSP ROMs are still required with either boot method.+Enable **Settings -> Boot -> IPL HLE (GameCube)** to boot GameCube discs using [Hazel's](https://codeberg.org/hazelwiss) built-in IPL replacement, even if a real IPL is installed. The setting is saved as `ipl_hle = true` in `config.toml` and applies the next time you launch a game. Guided setup enables HLE automatically if you leave the IPL file empty. Disable HLE to use your real IPL. **Skip IPL (GameCube)** then controls whether its boot animation is skipped. Either boot method uses Dolphin's DSP ROM unless real DSP dumps are configured.You can also import an optional Wii NAND folder containing `title/` and `shared2/`. The wizard copies it into `fs/` (or `GECKO_FS_ROOT`) only if that destination does not already exist, preserving existing saves. Otherwise, leave NAND unselected to keep existing storage or generate it on first boot.-The launcher scans the configured GameCube and Wii folders for `.iso`, `.rvz` and `.zip` files. Double-clicking on a row opens a dedicated player window for that game. For manual setup, place the DSP files and, if using real IPL boot, a decoded GameCube IPL inside `system` using the names below. Data paths are relative to the working directory or `GECKO_DATA_DIR` when set:+The launcher scans the configured GameCube and Wii folders for `.iso`, `.rvz` and `.zip` files. Double-clicking on a row opens a dedicated player window for that game. For manual setup, place optional DSP dumps and, if using real IPL boot, a decoded GameCube IPL inside `system` using the names below. Data paths are relative to the working directory or `GECKO_DATA_DIR` when set:```sh<gecko data dir>/@@ -104,11 +93,24 @@ The launcher scans the configured GameCube and Wii folders for `.iso`, `.rvz` aninternal/ # contains SRAM and memory cards, auto-generatedsystem/ # system files, copied by guided setupIPL.bin # GameCube real IPL boot only (must be decoded! see multitool)- dsp_rom.bin # GameCube and Wii- dsp_coef.bin # GameCube and Wii+ dsp_rom.bin # optional, GameCube and Wii+ dsp_coef.bin # optional, GameCube and Wiifs/ # Wii NAND, auto-generated if missing (or drop in a Dolphin/real dump)```+If you're a developer you may want to use `tinyapp` or `debugger` instead, the quickest way to boot up a game is:++```sh+# Launch a GameCube game with the built-in IPL HLE and Dolphin's DSP ROM+./tinyapp --dvd YourGame.rvz++# Launch a GameCube game with a real IPL (skip the boot animation)+./tinyapp --ipl IPL.decoded.bin --dsp dsp_rom.bin --coef dsp_coef.bin --skip-ipl --dvd YourGame.rvz++# Launch a Wii game with real DSP dumps (optional)+./tinyapp --dsp dsp_rom.bin --coef dsp_coef.bin --dvd YourGame.rvz+```+### ControlsGamepads are supported on all frontends through SDL3. Xbox, DualSense (PS5) and anything else SDL recognizes works out of the box. Keyboard and mouse stay active.@@ -273,6 +275,9 @@ The panel also provides a speed slider and `Reset view` button. Game input is suGecko does not ship original console ROMs. A built-in IPL HLE replacement is available for GameCube disc boot.+> [!NOTE]+> Gecko embeds Dolphin's DSP ROM replacement (`dsp_rom.bin` and `dsp_coef.bin` from [`Data/Sys/GC`](https://github.com/dolphin-emu/dolphin/tree/master/Data/Sys/GC), source in [`docs/DSP/free_dsp_rom`](https://github.com/dolphin-emu/dolphin/tree/master/docs/DSP/free_dsp_rom)) and uses it whenever no DSP dump is provided. It is written by the Dolphin team, not dumped from hardware. It covers the common AX and Zelda audio ucodes, however, it may still cause issues. If anything misbehaves, try real dumps.+Reference SHA-256 hashes (these are the files the project is developed against):| File | SHA-256 |@@ -286,8 +291,8 @@ Reference SHA-256 hashes (these are the files the project is developed against):### GameCube- IPL for real IPL boot only (NTSC and PAL tested); not required with IPL HLE-- DSP IROM-- DSP coefficient ROM+- DSP IROM (optional, Dolphin's is used by default)+- DSP coefficient ROM (optional, Dolphin's is used by default)For IPL HLE in `tinyapp`, pass `--dvd` without `--ipl`. In the `gecko` app, enable **Settings -> Boot -> IPL HLE (GameCube)**.@@ -316,7 +321,7 @@ multitool setting --action decode fs/title/00000001/00000002/data/setting.txt semultitool setting --action encode setting.decoded fs/title/00000001/00000002/data/setting.txtmultitool dvd --extract game.rvz-tinyapp --dol homebrew.dol # may also require a DSP depending on the DOL+tinyapp --dol homebrew.doltinyapp --dvd game.iso --ipl ipl.decoded.bin --dsp dsp_rom.bin --coef dsp_coef.bin --skip-ipldebugger --dvd game.rvz --ipl ipl.decoded.bin --dsp dsp_rom.bin --coef dsp_coef.bin --script example.luadiff --git a/crates/app/src/player/state.rs b/crates/app/src/player/state.rsindex 478ee5c..f12e6c7 100644--- a/crates/app/src/player/state.rs+++ b/crates/app/src/player/state.rs@@ -89,15 +89,7 @@ impl PlayerState {} else {Config::resolve_in_dir(&config.ipl, &system_dir, IPL_FILE)};- let boot_error = self::validate(- game.platform,- game.format,- &dsp,- &coef,- &ipl,- config.ipl_hle,- &system_dir,- );+ let boot_error = self::validate(game.platform, game.format, &ipl, config.ipl_hle, &system_dir);Arc::new(Self {boot: Mutex::new(Some(BootParams {@@ -462,42 +454,18 @@ fn set_initialized(state: &Arc<PlayerState>, renderer: Renderer, audio: Option<cfn validate(platform: Platform,format: Format,- dsp: &Option<PathBuf>,- coef: &Option<PathBuf>,ipl: &Option<PathBuf>,ipl_hle: bool,system_dir: &Path,) -> Option<String> {- let mut missing: Vec<&'static str> = Vec::new();- if dsp.is_none() {- missing.push(DSP_ROM_FILE);- }- if coef.is_none() {- missing.push(DSP_COEF_FILE);- }- if platform == Platform::Gcn && format != Format::Dol && !ipl_hle && ipl.is_none() {- missing.push(IPL_FILE);- }-- if missing.is_empty() {+ if platform != Platform::Gcn || format == Format::Dol || ipl_hle || ipl.is_some() {return None;}- let needed = if format == Format::Dol {- "DOL executables require dsp_rom.bin and dsp_coef.bin"- } else {- match platform {- Platform::Gcn if !ipl_hle => {- "GameCube games require IPL.bin, dsp_rom.bin and dsp_coef.bin. Enable Settings > Boot > IPL HLE (GameCube) to boot without IPL.bin"- }- Platform::Gcn => "GameCube games require dsp_rom.bin and dsp_coef.bin with IPL HLE",- Platform::Wii => "Wii games require dsp_rom.bin and dsp_coef.bin",- }- };-Some(format!(- "{needed}.\n\nMissing: {}\n\nPlace them under {} or set explicit paths in config.toml.",- missing.join(", "),+ "GameCube games require {IPL_FILE}. Enable Settings > Boot > IPL HLE (GameCube) to boot without it.++Place it under {} or set an explicit path in config.toml.",system_dir.display(),))}diff --git a/crates/app/src/setup.rs b/crates/app/src/setup.rsindex 22f4751..ea4f8f0 100644--- a/crates/app/src/setup.rs+++ b/crates/app/src/setup.rs@@ -24,8 +24,8 @@ pub enum Field {impl Field {fn info(self) -> (&'static str, &'static str) {match self {- Self::Dsp => ("DSP ROM", "Required"),- Self::Coef => ("DSP coefficients", "Required"),+ Self::Dsp => ("DSP ROM", "Optional"),+ Self::Coef => ("DSP coefficients", "Optional"),Self::Ipl => ("GameCube IPL", "Optional"),Self::GameCube => ("GameCube games", "Optional"),Self::Wii => ("Wii games", "Optional"),@@ -130,10 +130,7 @@ impl Setup {pub fn needed(&self, cfg: &Config, config_exists: bool) -> bool {!cfg.setup_completed- && (!config_exists- || self.sources.dsp.is_none()- || self.sources.coef.is_none()- || (cfg.gcn_library.is_some() && !cfg.ipl_hle && self.sources.ipl.is_none()))+ && (!config_exists || (cfg.gcn_library.is_some() && !cfg.ipl_hle && self.sources.ipl.is_none()))}pub fn view(&self, palette: &Palette, cfg: &Config) -> Element<'static, Message> {@@ -171,7 +168,7 @@ impl Setup {let fields_and_note = match self.step {Step::System => Some(([Field::Dsp, Field::Coef, Field::Ipl],- "Leave IPL empty to use IPL HLE for GameCube. Encoded IPLs are decoded automatically.",+ "Leave DSP files empty to use Dolphin's DSP ROM. Leave IPL empty to use IPL HLE for GameCube. Encoded IPLs are decoded automatically.",)),Step::Folders => Some(([Field::GameCube, Field::Wii, Field::Nand],@@ -190,10 +187,18 @@ impl Setup {}content = content.push(rows).push(self::note(note, palette));} else {- let names = if self.sources.ipl.is_some() {- format!("{DSP_ROM_FILE} · {DSP_COEF_FILE} · {IPL_FILE}")+ let names = [+ (self.sources.dsp.is_some(), DSP_ROM_FILE),+ (self.sources.coef.is_some(), DSP_COEF_FILE),+ (self.sources.ipl.is_some(), IPL_FILE),+ ]+ .into_iter()+ .filter_map(|(selected, name)| selected.then_some(name))+ .collect::<Vec<_>>();+ let names = if names.is_empty() {+ "None, using Dolphin's DSP ROM and IPL HLE".to_string()} else {- format!("{DSP_ROM_FILE} · {DSP_COEF_FILE}")+ names.join(" · ")};content = content.push(self::summary_row("System files", &cfg.system_dir_resolved(), palette))@@ -440,19 +445,13 @@ fn read_rom(path: &Path, size: usize) -> anyhow::Result<Vec<u8>> {}fn system_files(sources: &Sources) -> anyhow::Result<Vec<(&'static str, Vec<u8>)>> {- let dsp = sources- .dsp- .as_deref()- .context("Choose the DSP ROM before continuing.")?;- let coef = sources- .coef- .as_deref()- .context("Choose the DSP coefficient ROM before continuing.")?;-- let mut files = vec![- (DSP_ROM_FILE, self::read_rom(dsp, 8192)?),- (DSP_COEF_FILE, self::read_rom(coef, 4096)?),- ];+ let mut files = Vec::new();+ if let Some(path) = &sources.dsp {+ files.push((DSP_ROM_FILE, self::read_rom(path, 8192)?));+ }+ if let Some(path) = &sources.coef {+ files.push((DSP_COEF_FILE, self::read_rom(path, 4096)?));+ }if let Some(path) = &sources.ipl {let mut data = self::read_rom(path, image::ipl::IPL_ROM_SIZE)?;@@ -569,8 +568,12 @@ pub fn install(sources: Sources, mut cfg: Config, config_path: &Path, nand_dest:fs::rename(stage.path().join("nand"), nand_dest).context("Cannot install Wii NAND")?;}- cfg.dsp_rom = Some(system.join(DSP_ROM_FILE));- cfg.dsp_coef = Some(system.join(DSP_COEF_FILE));+ if sources.dsp.is_some() {+ cfg.dsp_rom = Some(system.join(DSP_ROM_FILE));+ }+ if sources.coef.is_some() {+ cfg.dsp_coef = Some(system.join(DSP_COEF_FILE));+ }if sources.ipl.is_some() {cfg.ipl = Some(system.join(IPL_FILE));} else {diff --git a/crates/debugger/src/main.rs b/crates/debugger/src/main.rsindex 3737032..4bfcb24 100644--- a/crates/debugger/src/main.rs+++ b/crates/debugger/src/main.rs@@ -417,11 +417,11 @@ struct Args {#[arg(long)]immediate: bool,- /// Path to a DSP IROM binary+ /// Path to a DSP IROM binary (defaults to Dolphin's DSP ROM)#[arg(long)]dsp: Option<String>,- /// Path to a DSP coefficient ROM binary+ /// Path to a DSP coefficient ROM binary (defaults to Dolphin's DSP ROM)#[arg(long)]coef: Option<String>,diff --git a/crates/gecko/src/flipper/dsp.rs b/crates/gecko/src/flipper/dsp.rsindex f8725a2..6221964 100644--- a/crates/gecko/src/flipper/dsp.rs+++ b/crates/gecko/src/flipper/dsp.rs@@ -9,6 +9,11 @@ pub mod interpreter;pub mod jit;pub mod regs;+// Dolphin's DSP IROM/coefficient replacement, used until a real dump is loaded+// (see submodules/dolphin/docs/DSP/free_dsp_rom).+pub static FREE_IROM: &[u8] = include_bytes!("../../../../submodules/dolphin/Data/Sys/GC/dsp_rom.bin");+pub static FREE_COEF: &[u8] = include_bytes!("../../../../submodules/dolphin/Data/Sys/GC/dsp_coef.bin");+#[allow(dead_code, unused_variables, non_upper_case_globals, clippy::all)]pub mod lut {include!(concat!(env!("OUT_DIR"), "/dsp_lut.rs"));@@ -114,12 +119,14 @@ impl Dsp {pub fn new() -> Self {let aram = unsafe { Box::<[u8; 16 * 1024 * 1024]>::new_zeroed().assume_init() };let iram = unsafe { Box::<[u8; 0x2000]>::new_zeroed().assume_init() };- let irom = unsafe { Box::<[u8; 0x2000]>::new_zeroed().assume_init() };+ let mut irom = unsafe { Box::<[u8; 0x2000]>::new_zeroed().assume_init() };+ irom[..FREE_IROM.len()].copy_from_slice(FREE_IROM);let dram = unsafe { Box::<[u8; 0x2000]>::new_zeroed().assume_init() };- let coef = unsafe { Box::<[u8; 0x2000]>::new_zeroed().assume_init() };+ let mut coef = unsafe { Box::<[u8; 0x2000]>::new_zeroed().assume_init() };+ coef[..FREE_COEF.len()].copy_from_slice(FREE_COEF);let ifx = unsafe { Box::<[u8; 0x200]>::new_zeroed().assume_init() };- Dsp {+ let mut dsp = Dsp {registers: core::Registers::default(),iram,irom,@@ -156,7 +163,9 @@ impl Dsp {wait_table: vec![WaitCondition::None; 0x10000].into_boxed_slice(),scheduler_suspended: false,pending_exceptions: 0,- }+ };+ dsp.rebuild_wait_table();+ dsp}#[inline(always)]diff --git a/crates/mcp/src/boot.rs b/crates/mcp/src/boot.rsindex a0d8e01..9038945 100644--- a/crates/mcp/src/boot.rs+++ b/crates/mcp/src/boot.rs@@ -30,17 +30,25 @@ fn make_sink(})}-fn finalize_wii(mut emu: Wii, dsp_rom: &[u8], coef_rom: &[u8], sink: Box<McpSink>) -> Wii {- emu.dsp.load_irom(dsp_rom);- emu.dsp.load_coef(coef_rom);+fn finalize_wii(mut emu: Wii, dsp_rom: Option<&[u8]>, coef_rom: Option<&[u8]>, sink: Box<McpSink>) -> Wii {+ if let Some(rom) = dsp_rom {+ emu.dsp.load_irom(rom);+ }+ if let Some(rom) = coef_rom {+ emu.dsp.load_coef(rom);+ }emu.render_sink = sink;emu.apply_host_input(&HostInput::wii_neutral());emu}-fn finalize_gc(mut emu: GameCube, dsp_rom: &[u8], coef_rom: &[u8], sink: Box<McpSink>) -> GameCube {- emu.dsp.load_irom(dsp_rom);- emu.dsp.load_coef(coef_rom);+fn finalize_gc(mut emu: GameCube, dsp_rom: Option<&[u8]>, coef_rom: Option<&[u8]>, sink: Box<McpSink>) -> GameCube {+ if let Some(rom) = dsp_rom {+ emu.dsp.load_irom(rom);+ }+ if let Some(rom) = coef_rom {+ emu.dsp.load_coef(rom);+ }emu.render_sink = sink;emu.apply_host_input(&HostInput::gc_connected());emu@@ -48,9 +56,9 @@ fn finalize_gc(mut emu: GameCube, dsp_rom: &[u8], coef_rom: &[u8], sink: Box<Mcppub fn boot(disc_bytes: Vec<u8>,- ipl: &[u8],- dsp_rom: &[u8],- coef_rom: &[u8],+ ipl: Option<&[u8]>,+ dsp_rom: Option<&[u8]>,+ coef_rom: Option<&[u8]>,gx: Arc<Mutex<GxRenderer>>,device: wgpu::Device,queue: wgpu::Queue,@@ -70,9 +78,15 @@ pub fn boot(let backend = if dvd.header().is_wii() {Backend::Wii(finalize_wii(Wii::apploader_hle(dvd).build(), dsp_rom, coef_rom, sink))} else {- let mut emu = finalize_gc(GameCube::with_ipl(ipl, true), dsp_rom, coef_rom, sink);- emu.insert_dvd(dvd);- Backend::Gc(emu)+ let emu = match ipl {+ Some(ipl) => {+ let mut emu = GameCube::with_ipl(ipl, true);+ emu.insert_dvd(dvd);+ emu+ }+ None => GameCube::with_ipl_hle(dvd),+ };+ Backend::Gc(finalize_gc(emu, dsp_rom, coef_rom, sink))};BootResult {@@ -85,8 +99,8 @@ pub fn boot(pub fn boot_dol(dol_bytes: Vec<u8>,wii: bool,- dsp_rom: &[u8],- coef_rom: &[u8],+ dsp_rom: Option<&[u8]>,+ coef_rom: Option<&[u8]>,gx: Arc<Mutex<GxRenderer>>,device: wgpu::Device,queue: wgpu::Queue,diff --git a/crates/mcp/src/main.rs b/crates/mcp/src/main.rsindex 223e79d..1bebd54 100644--- a/crates/mcp/src/main.rs+++ b/crates/mcp/src/main.rs@@ -34,23 +34,23 @@ struct Cli {)]wii: bool,- #[arg(long, value_name = "PATH", help = "Override the embedded GameCube IPL")]+ #[arg(+ long,+ value_name = "PATH",+ help = "Decoded GameCube IPL to boot discs with instead of IPL HLE"+ )]ipl: Option<PathBuf>,- #[arg(long, value_name = "PATH", help = "Override the embedded DSP IROM")]+ #[arg(long, value_name = "PATH", help = "DSP IROM to use instead of Dolphin's DSP ROM")]dsp: Option<PathBuf>,- #[arg(long, value_name = "PATH", help = "Override the embedded DSP COEF ROM")]+ #[arg(long, value_name = "PATH", help = "DSP COEF ROM to use instead of Dolphin's DSP ROM")]coef: Option<PathBuf>,#[arg(long, help = "Resume the emulator immediately after loading the disc")]resume: bool,}-const DEFAULT_IPL: &[u8] = include_bytes!("../../../private/IPL.decoded.bin");-const DEFAULT_DSP_ROM: &[u8] = include_bytes!("../../../private/dsp_rom.bin");-const DEFAULT_COEF_ROM: &[u8] = include_bytes!("../../../private/dsp_coef.bin");-fn main() -> Result<()> {tracing_subscriber::fmt().with_env_filter(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")))@@ -60,20 +60,20 @@ fn main() -> Result<()> {let cli = Cli::parse();- let ipl = match cli.ipl {- Some(p) => std::fs::read(&p).with_context(|| format!("read IPL {p:?}"))?,- None => DEFAULT_IPL.to_vec(),- };+ let ipl = cli+ .ipl+ .map(|p| std::fs::read(&p).with_context(|| format!("read IPL {p:?}")))+ .transpose()?;- let dsp_rom = match cli.dsp {- Some(p) => std::fs::read(&p).with_context(|| format!("read DSP IROM {p:?}"))?,- None => DEFAULT_DSP_ROM.to_vec(),- };+ let dsp_rom = cli+ .dsp+ .map(|p| std::fs::read(&p).with_context(|| format!("read DSP IROM {p:?}")))+ .transpose()?;- let coef_rom = match cli.coef {- Some(p) => std::fs::read(&p).with_context(|| format!("read DSP COEF ROM {p:?}"))?,- None => DEFAULT_COEF_ROM.to_vec(),- };+ let coef_rom = cli+ .coef+ .map(|p| std::fs::read(&p).with_context(|| format!("read DSP COEF ROM {p:?}")))+ .transpose()?;let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {backends: wgpu::Backends::all(),@@ -109,8 +109,8 @@ fn main() -> Result<()> {Some(boot::boot_dol(bytes,cli.wii,- &shared.dsp_rom,- &shared.coef_rom,+ shared.dsp_rom.as_deref(),+ shared.coef_rom.as_deref(),shared.gx.clone(),shared.device.clone(),shared.queue.clone(),@@ -120,9 +120,9 @@ fn main() -> Result<()> {let bytes = std::fs::read(dvd_path).with_context(|| format!("read DVD {dvd_path:?}"))?;Some(boot::boot(bytes,- &shared.ipl,- &shared.dsp_rom,- &shared.coef_rom,+ shared.ipl.as_deref(),+ shared.dsp_rom.as_deref(),+ shared.coef_rom.as_deref(),shared.gx.clone(),shared.device.clone(),shared.queue.clone(),diff --git a/crates/mcp/src/server.rs b/crates/mcp/src/server.rsindex 7a8369a..38d7ba0 100644--- a/crates/mcp/src/server.rs+++ b/crates/mcp/src/server.rs@@ -249,9 +249,9 @@ impl McpServer {let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {boot::boot(bytes,- &self.shared.ipl,- &self.shared.dsp_rom,- &self.shared.coef_rom,+ self.shared.ipl.as_deref(),+ self.shared.dsp_rom.as_deref(),+ self.shared.coef_rom.as_deref(),self.shared.gx.clone(),self.shared.device.clone(),self.shared.queue.clone(),diff --git a/crates/mcp/src/state.rs b/crates/mcp/src/state.rsindex 1a4296a..3cbb091 100644--- a/crates/mcp/src/state.rs+++ b/crates/mcp/src/state.rs@@ -94,9 +94,9 @@ pub struct Shared {pub device: wgpu::Device,pub queue: wgpu::Queue,pub introspect: Arc<Mutex<Introspection>>,- pub ipl: Vec<u8>,- pub dsp_rom: Vec<u8>,- pub coef_rom: Vec<u8>,+ pub ipl: Option<Vec<u8>>,+ pub dsp_rom: Option<Vec<u8>>,+ pub coef_rom: Option<Vec<u8>>,}impl Shared {diff --git a/crates/screenshotter/src/bin/screenshotter-worker.rs b/crates/screenshotter/src/bin/screenshotter-worker.rsindex aaf0d98..96548d8 100644--- a/crates/screenshotter/src/bin/screenshotter-worker.rs+++ b/crates/screenshotter/src/bin/screenshotter-worker.rs@@ -10,10 +10,6 @@ use gecko::wii::Wii;use std::path::PathBuf;use std::sync::{Arc, Mutex};-const IPL: &[u8] = include_bytes!("../../../../private/IPL.decoded.bin");-const DSP: &[u8] = include_bytes!("../../../../private/dsp_rom.bin");-const COEF: &[u8] = include_bytes!("../../../../private/dsp_coef.bin");-fn take_screenshot(device: &wgpu::Device, queue: &wgpu::Queue, gx: &GxRenderer, code: &str, frame: u32, is_wii: bool) {let _ = device.poll(wgpu::PollType::Wait {submission_index: None,@@ -86,8 +82,6 @@ fn run_one(device: &wgpu::Device, queue: &wgpu::Queue, surface_format: wgpu::Texif is_wii {let mut wii = Wii::apploader_hle(image).build();- wii.dsp.load_irom(DSP);- wii.dsp.load_coef(COEF);wii.render_sink = Box::new(sink);drive(&mut wii,@@ -99,11 +93,8 @@ fn run_one(device: &wgpu::Device, queue: &wgpu::Queue, surface_format: wgpu::Texupdate_wii_input,);} else {- let mut gamecube = GameCube::with_ipl(IPL, true);- gamecube.dsp.load_irom(DSP);- gamecube.dsp.load_coef(COEF);+ let mut gamecube = GameCube::with_ipl_hle(image);gamecube.render_sink = Box::new(sink);- gamecube.insert_dvd(image);drive(&mut gamecube,device,diff --git a/crates/tinyapp/src/main.rs b/crates/tinyapp/src/main.rsindex d4022e7..6a0189f 100644--- a/crates/tinyapp/src/main.rs+++ b/crates/tinyapp/src/main.rs@@ -100,11 +100,11 @@ struct Args {#[arg(long)]no_ansi: bool,- /// Path to a DSP IROM binary+ /// Path to a DSP IROM binary (defaults to Dolphin's DSP ROM)#[arg(long)]dsp: Option<String>,- /// Path to a DSP coefficient ROM binary+ /// Path to a DSP coefficient ROM binary (defaults to Dolphin's DSP ROM)#[arg(long)]coef: Option<String>,diff --git a/crates/tinybench/src/main.rs b/crates/tinybench/src/main.rsindex 9a12ce5..17ccd0b 100644--- a/crates/tinybench/src/main.rs+++ b/crates/tinybench/src/main.rs@@ -14,7 +14,7 @@ struct Args {#[arg(long)]ipl_hle: bool,- /// Path to DSP IROM binary+ /// Path to DSP IROM binary (defaults to Dolphin's DSP ROM)#[arg(long)]dsp: Option<String>,diff --git a/crates/tinytracer/src/main.rs b/crates/tinytracer/src/main.rsindex 07294c5..f94fb6d 100644--- a/crates/tinytracer/src/main.rs+++ b/crates/tinytracer/src/main.rs@@ -68,7 +68,7 @@ struct Args {#[arg(long)]no_ansi: bool,- /// Path to a DSP IROM binary+ /// Path to a DSP IROM binary (defaults to Dolphin's DSP ROM)#[arg(long)]dsp: Option<String>,diff --git a/crates/web/index.html b/crates/web/index.htmlindex 5ff23d2..fb0d582 100644--- a/crates/web/index.html+++ b/crates/web/index.html@@ -126,12 +126,12 @@</div><div class="file-row">- <label class="file-label">DSP IROM:</label>+ <label class="file-label">DSP IROM (optional):</label><label class="file-picker"><span>Choose file</span><input type="file" id="input-dsp" accept=".bin"></label>- <span class="name" id="dsp-name">none</span>+ <span class="name" id="dsp-name">Dolphin's DSP ROM</span></div><button id="start" disabled>Start</button>diff --git a/other/example.conf b/other/example.confindex c5a5d20..289b9c9 100644--- a/other/example.conf+++ b/other/example.conf@@ -1,8 +1,8 @@gcn_library = "/path/to/gamecube/games"wii_library = "/path/to/wii/games"system_dir = "/path/to/system"-dsp_rom = "/path/to/dsp_rom.bin"-dsp_coef = "/path/to/dsp_coef.bin"+dsp_rom = "/path/to/dsp_rom.bin" # optional, defaults to Dolphin's DSP ROM+dsp_coef = "/path/to/dsp_coef.bin" # optional, defaults to Dolphin's DSP ROMipl = "/path/to/IPL.bin"cpu_mode = "jit" # jit | interpreterdiff --git a/submodules/dolphin b/submodules/dolphinnew file mode 160000index 0000000..8d2ad1a--- /dev/null+++ b/submodules/dolphin@@ -0,0 +1 @@+Subproject commit 8d2ad1a662472955497e5bb79d7b9ec6999e1f0d