A GameCube/Wii emulator and debugger written in Rust.
merge changes from old stash, advanced polling loop detection and VI raster counters
Laylefeebefbf657f
diff --git a/crates/debugger/src/main.rs b/crates/debugger/src/main.rsindex a59367d..082eb55 100644--- a/crates/debugger/src/main.rs+++ b/crates/debugger/src/main.rs@@ -73,7 +73,10 @@ fn main() {let idle_skip = args.iter().any(|a| a == "--idle-skip");let ipl_path = args.iter().position(|a| a == "--ipl").map(|i| &args[i + 1]);- let rom_path = args.iter().position(|a| a == "--rom").map(|i| &args[i + 1])+ let rom_path = args+ .iter()+ .position(|a| a == "--rom")+ .map(|i| &args[i + 1]).or_else(|| args.get(1).filter(|a| !a.starts_with("--")));let emulator = if let Some(ipl) = ipl_path {@@ -84,7 +87,10 @@ fn main() {let dol = Dol::parse(rom_data);Gekko::with_image(&dol, idle_skip)} else {- eprintln!("usage: {} <path/to/game.dol> | --ipl <path> | --rom <path> [--immediate] [--idle-skip]", args[0]);+ eprintln!(+ "usage: {} <path/to/game.dol> | --ipl <path> | --rom <path> [--immediate] [--idle-skip]",+ args[0]+ );std::process::exit(1);};diff --git a/crates/gekko/src/flipper/vi.rs b/crates/gekko/src/flipper/vi.rsindex b5e786d..425dd02 100644--- a/crates/gekko/src/flipper/vi.rs+++ b/crates/gekko/src/flipper/vi.rs@@ -3,11 +3,18 @@ pub mod regs;mod tests;use crate::{+ flipper::pi::InterruptFlag,gekko::Gekko,- mmio::constants::VI_BASE,- mmio::traits::{MmioAccess, MmioRegister},+ mmio::{+ constants::VI_BASE,+ traits::{MmioAccess, MmioRegister},+ },+ scheduler::EventKind,};+const CPU_CORE_CLOCK: u64 = 486_000_000;+const CLOCK_FREQUENCIES: [u64; 2] = [27_000_000, 54_000_000];+pub struct Vi {pub vtr: regs::VerticalTiming,pub htr0: regs::HorizontalTiming0,@@ -42,6 +49,11 @@ pub struct Vi {pub visel: regs::ViDtvStatus,pub border_hbe: regs::BorderHbe,pub border_hbs: regs::BorderHbs,++ // VI timing state+ pub half_line_count: u32,+ pub ticks_last_line_start: u64,+ pub half_line_scheduled: bool,}impl Vi {@@ -80,6 +92,9 @@ impl Vi {visel: regs::ViDtvStatus::from_raw(0),border_hbe: regs::BorderHbe::from_raw(0),border_hbs: regs::BorderHbs::from_raw(0),+ half_line_count: 0,+ ticks_last_line_start: 0,+ half_line_scheduled: false,}}@@ -119,6 +134,100 @@ impl Vi {regs::BorderHbs,);+ pub fn ticks_per_sample(&self) -> u64 {+ let clock_idx = self.viclk.clock_select() as usize & 1;+ 2 * CPU_CORE_CLOCK / CLOCK_FREQUENCIES[clock_idx]+ }++ pub fn ticks_per_half_line(&self) -> u64 {+ self.ticks_per_sample() * self.htr0.halfline_width() as u64+ }++ fn half_lines_per_even_field(&self) -> u32 {+ let equ = self.vtr.equalization_pulse() as u32;+ let acv = self.vtr.active_video() as u32;+ let pre_blank = self.vte.pre_blanking_in_half_lines() as u32;+ let post_blank = self.vte.post_blanking_in_half_lines() as u32;+ 3 * equ + pre_blank + 2 * acv + post_blank+ }++ fn half_lines_per_odd_field(&self) -> u32 {+ let equ = self.vtr.equalization_pulse() as u32;+ let acv = self.vtr.active_video() as u32;+ let pre_blank = self.vto.pre_blanking_in_half_lines() as u32;+ let post_blank = self.vto.post_blanking_in_half_lines() as u32;+ 3 * equ + pre_blank + 2 * acv + post_blank+ }++ fn total_half_lines(&self) -> u32 {+ self.half_lines_per_even_field() + self.half_lines_per_odd_field()+ }++ /// Returns true if any DI register has both IR_INT and IR_MASK set.+ pub fn vi_interrupt_active(&self) -> bool {+ (self.di0.interrupt() && self.di0.enable())+ || (self.di1.interrupt() && self.di1.enable())+ || (self.di2.interrupt() && self.di2.enable())+ || (self.di3.interrupt() && self.di3.enable())+ }++ /// Compute the current DPH value from the cycle count.+ pub fn dph_value(&self, cycles: u64) -> u16 {+ let hl_width = self.htr0.halfline_width() as u64;+ let ticks_per_hl = self.ticks_per_half_line();+ if ticks_per_hl == 0 || hl_width == 0 {+ return 1;+ }++ let elapsed = cycles.saturating_sub(self.ticks_last_line_start);+ let raw = 1 + hl_width * elapsed / ticks_per_hl;+ raw.clamp(1, hl_width * 2) as u16+ }++ /// Called once per half-line from the scheduler event.+ /// Advances the half-line counter, updates DPV, and checks DI interrupts.+ pub fn on_half_line(&mut self, cycles: u64) {+ let total_hl = self.total_half_lines();+ if total_hl == 0 {+ return;+ }++ self.half_line_count += 1;+ if self.half_line_count >= total_hl {+ self.half_line_count = 0;+ }++ if (self.half_line_count & 1) == 0 {+ self.ticks_last_line_start = cycles;+ }++ self.dpv.set_vertical_count((1 + self.half_line_count / 2) as u16);++ let hl_width = self.htr0.halfline_width() as u32;+ let current_vct = 1 + self.half_line_count / 2;+ let current_parity = self.half_line_count & 1;++ macro_rules! check_di {+ ($di:expr) => {+ if $di.enable() {+ let target_parity = if $di.horizontal_count() as u32 > hl_width {+ 1+ } else {+ 0+ };+ if current_vct == $di.vertical_count() as u32 && current_parity == target_parity {+ $di.set_interrupt(true);+ }+ }+ };+ }++ check_di!(self.di0);+ check_di!(self.di1);+ check_di!(self.di2);+ check_di!(self.di3);+ }+pub fn xfb_addr(&self) -> u32 {if self.tfbl.page_offset() {self.tfbl.xfb_addr() << 5@@ -168,6 +277,25 @@ impl Vi {}impl Gekko {+ pub fn maybe_schedule_vi_half_line(&mut self) {+ if !self.vi.half_line_scheduled {+ let ticks_per_hl = self.vi.ticks_per_half_line();+ if ticks_per_hl > 0 {+ self.vi.half_line_scheduled = true;+ let next = self.scheduler.cycles + ticks_per_hl;+ self.scheduler.schedule_at(next, EventKind::ViHalfLine);+ }+ }+ }++ pub fn check_vi_interrupts(&mut self) {+ if self.vi.vi_interrupt_active() {+ self.pi.assert_interrupt(InterruptFlag::Vi);+ } else {+ self.pi.clear_interrupt(InterruptFlag::Vi);+ }+ }+#[rustfmt::skip]pub fn render_xfb(&self) -> Vec<u32> {let video_format = self.vi.dcr.video_format();diff --git a/crates/gekko/src/gekko.rs b/crates/gekko/src/gekko.rsindex 491e82e..c5c2644 100644--- a/crates/gekko/src/gekko.rs+++ b/crates/gekko/src/gekko.rs@@ -7,9 +7,9 @@ use crate::{pi::{InterruptFlag, Pi},vi::Vi,},+ idle::{IDLE_LOOP_MAX_INSTRS, IdleCheck, IdleDetector},mmio::Mmio,scheduler::{CYCLES_PER_VSYNC, EventKind, Scheduler},- idle::IdleDetector,};use image::Executable;@@ -117,6 +117,12 @@ impl Gekko {let next = self.scheduler.cycles + CYCLES_PER_VSYNC;self.scheduler.schedule_at(next, EventKind::VSync);}+ EventKind::ViHalfLine => {+ self.vi.on_half_line(self.scheduler.cycles);+ self.vi.half_line_scheduled = false;+ self.maybe_schedule_vi_half_line();+ self.check_vi_interrupts();+ }}}@@ -134,10 +140,22 @@ impl Gekko {cpu::lut::dispatch(self, instr);self.scheduler.cycles += 1;- if self.idle.check(self.cpu.cia, self.cpu.nia) {- if let Some(deadline) = self.scheduler.next_event_deadline() {- self.scheduler.cycles = deadline;+ match self.idle.check(self.cpu.cia, self.cpu.nia) {+ IdleCheck::Skip => {+ if let Some(deadline) = self.scheduler.next_event_deadline() {+ self.scheduler.cycles = deadline;+ }+ }+ IdleCheck::Validate { start, end } => {+ let safe = self.is_polling_loop(start, end);+ self.idle.set_validated(safe);+ if safe {+ if let Some(deadline) = self.scheduler.next_event_deadline() {+ self.scheduler.cycles = deadline;+ }+ }}+ IdleCheck::Continue => {}}self.cpu.pc = self.cpu.nia;@@ -150,6 +168,17 @@ impl Gekko {}}+ /// Read the instructions in `[start, end]` and check whether the loop is a+ /// side effect free MMIO polling loop that can safely be skipped.+ fn is_polling_loop(&self, start: u32, end: u32) -> bool {+ let count = ((end - start) / 4 + 1) as usize;+ let mut buf = [0u32; IDLE_LOOP_MAX_INSTRS];+ for i in 0..count.min(buf.len()) {+ buf[i] = self.mmio.virt_read_u32(start + (i as u32) * 4);+ }+ crate::idle::validate_polling_loop(&buf[..count.min(buf.len())], &self.cpu.gprs)+ }+pub fn frame_size(&self) -> (usize, usize) {let fmt = self.vi.dcr.video_format();(fmt.columns(), fmt.lines())diff --git a/crates/gekko/src/idle.rs b/crates/gekko/src/idle.rsindex d89830c..124b1f2 100644--- a/crates/gekko/src/idle.rs+++ b/crates/gekko/src/idle.rs@@ -1,13 +1,38 @@-/// Maximum backward branch distance (in bytes) considered a potential polling loop-const IDLE_LOOP_MAX_SIZE: u32 = 10 * 4;-/// Number of consecutive loop iterations before we skip to the next event+/// Maximum backward branch distance (in bytes) considered a potential polling loop.+pub const IDLE_LOOP_MAX_SIZE: u32 = 10 * 4;+pub const IDLE_LOOP_MAX_INSTRS: usize = (IDLE_LOOP_MAX_SIZE / 4 + 1) as usize;+/// Number of consecutive loop iterations before we attempt to skip.const IDLE_LOOP_THRESHOLD: u32 = 10;+const MMIO_VIRT_START: u32 = 0xCC00_0000;+const MMIO_VIRT_END: u32 = 0xCC00_FFFF;++pub enum IdleCheck {+ /// Nothing special, keep executing normally.+ Continue,+ /// Branch-to-self detected, always safe to skip to the next event.+ Skip,+ /// A backward-branch loop hit the threshold, caller must validate the loop+ /// body and call [`IdleDetector::set_validated`] with the result.+ Validate { start: u32, end: u32 },+}+pub struct IdleDetector {enabled: bool,loop_pc: Option<u32>,loop_end: u32,loop_count: u32,+ validated: LoopStatus,+}++#[derive(Clone, Copy, PartialEq, Eq)]+enum LoopStatus {+ /// Not yet checked.+ Unknown,+ /// Safe polling loop, skip allowed.+ Safe,+ /// Has side-effects, never skip.+ Unsafe,}impl IdleDetector {@@ -17,46 +42,58 @@ impl IdleDetector {loop_pc: None,loop_end: 0,loop_count: 0,+ validated: LoopStatus::Unknown,}}#[inline]- pub fn check(&mut self, cia: u32, nia: u32) -> bool {+ pub fn check(&mut self, cia: u32, nia: u32) -> IdleCheck {if !self.enabled {- return false;+ return IdleCheck::Continue;}+ // Branching to current is always a safe idle loopif nia == cia {- // Skip branch to self- tracing::debug!("detected branch to self at {:08X}", cia);- return true;+ return IdleCheck::Skip;}+ // Short backward branch, potential polling loopif nia < cia && cia.wrapping_sub(nia) <= IDLE_LOOP_MAX_SIZE {- // Potential polling loopreturn self.track_backward_branch(nia, cia);}- // We moved outside of the tracked loop, resetself.try_reset(cia);- false+ IdleCheck::Continue+ }++ /// Record that the current loop was validated (or not) as a safe polling+ /// loop. The result is cached until the loop changes.+ pub fn set_validated(&mut self, safe: bool) {+ self.validated = if safe { LoopStatus::Safe } else { LoopStatus::Unsafe };}- fn track_backward_branch(&mut self, target: u32, branch_pc: u32) -> bool {+ fn track_backward_branch(&mut self, target: u32, branch_pc: u32) -> IdleCheck {if self.loop_pc == Some(target) {self.loop_count += 1;if self.loop_count >= IDLE_LOOP_THRESHOLD {self.loop_count = 0;- tracing::debug!("detected idle loop at {:08X} (branched from {:08X})", target, branch_pc);- return true;+ return match self.validated {+ LoopStatus::Safe => IdleCheck::Skip,+ LoopStatus::Unsafe => IdleCheck::Continue,+ LoopStatus::Unknown => IdleCheck::Validate {+ start: target,+ end: branch_pc,+ },+ };}} else {+ // New loopself.loop_pc = Some(target);self.loop_end = branch_pc;self.loop_count = 1;+ self.validated = LoopStatus::Unknown;}-- false+ IdleCheck::Continue}fn try_reset(&mut self, cia: u32) {@@ -64,7 +101,120 @@ impl IdleDetector {if cia < start || cia > self.loop_end {self.loop_pc = None;self.loop_count = 0;+ self.validated = LoopStatus::Unknown;}}}}++/// Analyse a small backward-branch loop and decide whether it is a pure+/// MMIO-polling loop that is safe to skip.+///+/// Requirements:+/// * Every instruction is side effect free (no stores, no calls, no+/// supervisor stuff).+/// * At least one load targets the hardware register address range+/// (`0xCC00_0000 ..= 0xCC00_FFFF`).+pub fn validate_polling_loop(instrs: &[u32], gprs: &[u32; 32]) -> bool {+ let mut has_mmio_load = false;++ for &raw in instrs {+ let opcode = raw >> 26;+ match opcode {+ // D-form integer loads+ // lwz, lwzu, lbz, lbzu, lhz, lhzu, lha, lhau+ 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 => {+ has_mmio_load |= d_form_targets_mmio(raw, gprs);+ }+ // D-form FP loads (lfs, lfsu, lfd, lfdu)+ 48 | 49 | 50 | 51 => {}+ // Load multiple word+ 46 => {}+ // ALU immediate / compares+ // mulli, subfic, cmpli, cmpi, addic, addic., addi, addis+ 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 => {}+ // ori, oris, xori, xoris, andi., andis.+ 24 | 25 | 26 | 27 | 28 | 29 => {}+ // rlwimi, rlwinm, rlwnm+ 20 | 21 | 23 => {}+ // FP arith (single / double)+ 59 | 63 => {}+ // Branches (without link)+ 16 | 18 => {+ if raw & 1 != 0 {+ return false; // bl / bcl = function call+ }+ }+ // Extended integer ops (opcode 31)+ 31 => {+ let xo = (raw >> 1) & 0x3FF;+ if is_unsafe_xo_31(xo) {+ return false;+ }+ if is_indexed_load_xo(xo) {+ has_mmio_load |= x_form_targets_mmio(raw, gprs);+ }+ }+ // Rest+ _ => return false,+ }+ }++ has_mmio_load+}++/// Check the effective address of a D-form load (rA + sign-ext d).+fn d_form_targets_mmio(raw: u32, gprs: &[u32; 32]) -> bool {+ let ra = ((raw >> 16) & 0x1F) as usize;+ let d = (raw & 0xFFFF) as i16 as i32;+ let base = if ra == 0 { 0u32 } else { gprs[ra] };+ let ea = (base as i32).wrapping_add(d) as u32;+ (MMIO_VIRT_START..=MMIO_VIRT_END).contains(&ea)+}++/// Check the effective address of an X-form indexed load (rA + rB).+fn x_form_targets_mmio(raw: u32, gprs: &[u32; 32]) -> bool {+ let ra = ((raw >> 16) & 0x1F) as usize;+ let rb = ((raw >> 11) & 0x1F) as usize;+ let base = if ra == 0 { 0u32 } else { gprs[ra] };+ let ea = base.wrapping_add(gprs[rb]);+ (MMIO_VIRT_START..=MMIO_VIRT_END).contains(&ea)+}++/// Opcode-31 extended ops that have side-effects (stores, supervisor writes,+/// I/O writes, cache-invalidate).+fn is_unsafe_xo_31(xo: u32) -> bool {+ matches!(+ xo,+ // Integer stores+ 150 | 151 | 183 | 215 | 247 | 407 | 439 | 661 | 662 | 725 | 918+ // FP stores+ | 663 | 695 | 727 | 759 | 983+ // dcbz+ | 1014+ // Supervisor / SPR writes+ | 146 // mtmsr+ | 210 // mtsr+ | 242 // mtsrin+ | 467 // mtspr+ // I/O write+ | 438 // ecowx+ )+}++/// Opcode-31 X-form indexed loads.+fn is_indexed_load_xo(xo: u32) -> bool {+ matches!(+ xo,+ 23 // lwzx+ | 55 // lwzux+ | 87 // lbzx+ | 119 // lbzux+ | 279 // lhzx+ | 311 // lhzux+ | 343 // lhax+ | 375 // lhaux+ | 534 // lwbrx+ | 790 // lhbrx+ )+}diff --git a/crates/gekko/src/lib.rs b/crates/gekko/src/lib.rsindex 367aa12..4f82402 100644--- a/crates/gekko/src/lib.rs+++ b/crates/gekko/src/lib.rs@@ -2,6 +2,6 @@ pub mod cpu;pub mod exi;pub mod flipper;pub mod gekko;+pub mod idle;pub mod mmio;pub mod scheduler;-pub mod idle;diff --git a/crates/gekko/src/mmio/bus.rs b/crates/gekko/src/mmio/bus.rsindex 378f098..32d4940 100644--- a/crates/gekko/src/mmio/bus.rs+++ b/crates/gekko/src/mmio/bus.rs@@ -3,7 +3,8 @@ use crate::{mmio::{Mmio,constants::{- DSP_BASE, DSP_END, EXI_BASE, EXI_END, GX_FIFO_BASE, GX_FIFO_END, IPL_BASE, IPL_END, PI_BASE, PI_END, VI_BASE, VI_END+ DSP_BASE, DSP_END, EXI_BASE, EXI_END, GX_FIFO_BASE, GX_FIFO_END, IPL_BASE, IPL_END, PI_BASE, PI_END,+ VI_BASE, VI_END,},},};@@ -36,7 +37,15 @@ impl Gekko {pub fn read_u8(&mut self, addr: u32) -> u8 {let (target, offset) = route(Mmio::virt_to_phys(addr));match target {- BusTarget::Vi => self.vi.mmio_read_u8(offset),+ BusTarget::Vi => {+ if offset == 0x2E {+ return (self.vi.dph_value(self.scheduler.cycles) >> 8) as u8;+ }+ if offset == 0x2F {+ return self.vi.dph_value(self.scheduler.cycles) as u8;+ }+ self.vi.mmio_read_u8(offset)+ }BusTarget::Pi => self.pi.mmio_read_u8(offset),BusTarget::Dsp => self.dsp.mmio_read_u8(offset),BusTarget::Exi => self.exi.mmio_read_u8(offset),@@ -53,7 +62,12 @@ impl Gekko {pub fn read_u16(&mut self, addr: u32) -> u16 {let (target, offset) = route(Mmio::virt_to_phys(addr));match target {- BusTarget::Vi => self.vi.mmio_read_u16(offset),+ BusTarget::Vi => {+ if offset == 0x2E {+ return self.vi.dph_value(self.scheduler.cycles);+ }+ self.vi.mmio_read_u16(offset)+ }BusTarget::Pi => self.pi.mmio_read_u16(offset),BusTarget::Dsp => self.dsp.mmio_read_u16(offset),BusTarget::Exi => self.exi.mmio_read_u16(offset),@@ -70,7 +84,14 @@ impl Gekko {pub fn read_u32(&mut self, addr: u32) -> u32 {let (target, offset) = route(Mmio::virt_to_phys(addr));match target {- BusTarget::Vi => self.vi.mmio_read_u32(offset),+ BusTarget::Vi => {+ if offset == 0x2C {+ let dpv = self.vi.mmio_read_u16(0x2C) as u32;+ let dph = self.vi.dph_value(self.scheduler.cycles) as u32;+ return (dpv << 16) | dph;+ }+ self.vi.mmio_read_u32(offset)+ }BusTarget::Pi => self.pi.mmio_read_u32(offset),BusTarget::Dsp => self.dsp.mmio_read_u32(offset),BusTarget::Exi => self.exi.mmio_read_u32(offset),@@ -87,7 +108,13 @@ impl Gekko {pub fn write_u8(&mut self, addr: u32, val: u8) {let (target, offset) = route(Mmio::virt_to_phys(addr));match target {- BusTarget::Vi => self.vi.mmio_write_u8(offset, val),+ BusTarget::Vi => {+ self.vi.mmio_write_u8(offset, val);+ self.maybe_schedule_vi_half_line();+ if (0x30..=0x3F).contains(&offset) {+ self.check_vi_interrupts();+ }+ }BusTarget::Pi => self.pi.mmio_write_u8(offset, val),BusTarget::Dsp => {self.dsp.mmio_write_u8(offset, val);@@ -116,7 +143,13 @@ impl Gekko {pub fn write_u16(&mut self, addr: u32, val: u16) {let (target, offset) = route(Mmio::virt_to_phys(addr));match target {- BusTarget::Vi => self.vi.mmio_write_u16(offset, val),+ BusTarget::Vi => {+ self.vi.mmio_write_u16(offset, val);+ self.maybe_schedule_vi_half_line();+ if (0x30..=0x3F).contains(&offset) {+ self.check_vi_interrupts();+ }+ }BusTarget::Pi => self.pi.mmio_write_u16(offset, val),BusTarget::Dsp => {self.dsp.mmio_write_u16(offset, val);@@ -146,7 +179,13 @@ impl Gekko {pub fn write_u32(&mut self, addr: u32, val: u32) {let (target, offset) = route(Mmio::virt_to_phys(addr));match target {- BusTarget::Vi => self.vi.mmio_write_u32(offset, val),+ BusTarget::Vi => {+ self.vi.mmio_write_u32(offset, val);+ self.maybe_schedule_vi_half_line();+ if (0x30..=0x3F).contains(&offset) {+ self.check_vi_interrupts();+ }+ }BusTarget::Pi => self.pi.mmio_write_u32(offset, val),BusTarget::Dsp => {self.dsp.mmio_write_u32(offset, val);diff --git a/crates/gekko/src/scheduler.rs b/crates/gekko/src/scheduler.rsindex df3545b..ac82b52 100644--- a/crates/gekko/src/scheduler.rs+++ b/crates/gekko/src/scheduler.rs@@ -6,6 +6,7 @@ pub const CYCLES_PER_VSYNC: u64 = 486_000_000 / 60; // TODO: fix#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]pub enum EventKind {VSync,+ ViHalfLine,}pub struct Scheduler {diff --git a/crates/tinyapp/src/main.rs b/crates/tinyapp/src/main.rsindex b29ef9d..d910e5d 100644--- a/crates/tinyapp/src/main.rs+++ b/crates/tinyapp/src/main.rs@@ -476,7 +476,10 @@ fn main() {let idle_skip = std::env::args().any(|arg| arg == "--idle-skip");let ipl_path = args.iter().position(|a| a == "--ipl").map(|i| &args[i + 1]);- let rom_path = args.iter().position(|a| a == "--rom").map(|i| &args[i + 1])+ let rom_path = args+ .iter()+ .position(|a| a == "--rom")+ .map(|i| &args[i + 1]).or_else(|| args.get(1).filter(|a| !a.starts_with("--")));let emulator = if let Some(ipl) = ipl_path {@@ -487,7 +490,10 @@ fn main() {let dol = Dol::parse(rom_data);Gekko::with_image(&dol, idle_skip)} else {- eprintln!("usage: {} <path/to/game.dol> | --ipl <path> | --rom <path> [--immediate] [--idle-skip]", args[0]);+ eprintln!(+ "usage: {} <path/to/game.dol> | --ipl <path> | --rom <path> [--immediate] [--idle-skip]",+ args[0]+ );std::process::exit(1);};