Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

fake open lid to bypass early bs2 dvd state machine

Layle5962532a50b1
diff --git a/crates/gekko/src/flipper/di.rs b/crates/gekko/src/flipper/di.rs
index ad1d130..98ad330 100644
--- a/crates/gekko/src/flipper/di.rs
+++ b/crates/gekko/src/flipper/di.rs
@@ -73,4 +73,10 @@ impl crate::gekko::Gekko {
self.pi.clear_interrupt(crate::flipper::pi::InterruptFlag::Di);
}
}
+
+ pub fn open_cover(&mut self) {
+ tracing::debug!("DVD drive cover opened");
+ self.di.cover = self.di.cover.with_cover_interrupt(true).with_cover_status(true);
+ self.check_di_interrupts();
+ }
}
diff --git a/crates/gekko/src/gekko.rs b/crates/gekko/src/gekko.rs
index 1942723..f09a73b 100644
--- a/crates/gekko/src/gekko.rs
+++ b/crates/gekko/src/gekko.rs
@@ -112,6 +112,9 @@ impl Gekko {
ExiMacronix::DEVICE,
Box::new(ExiMacronix::new(ipl.to_vec())),
);
+ // TODO: this makes 0x8130107C (NTSC BS2) exit the DVD state machine
+ // as it forces it to enter "state 19"
+ gekko.open_cover();
gekko
}
@@ -142,9 +145,13 @@ impl Gekko {
}
// TODO: hack IPL state machine
- if self.cpu.pc == 0x81301284 {
- self.cpu.pc += 4;
- }
+ // if self.cpu.pc == 0x81301284 {
+ // self.cpu.pc += 4;
+ // }
+
+ // if self.cpu.pc == 0x81300BD8 {
+ // self.cpu.pc += 4;
+ // }
// Fetch and execute next instruction
self.cpu.cia = self.cpu.pc;
diff --git a/crates/tinyapp/src/main.rs b/crates/tinyapp/src/main.rs
index d1acbe0..6b06994 100644
--- a/crates/tinyapp/src/main.rs
+++ b/crates/tinyapp/src/main.rs
@@ -475,14 +475,6 @@ impl ApplicationHandler for App {
}
fn main() {
- tracing_subscriber::fmt()
- .without_time()
- .with_env_filter(
- tracing_subscriber::EnvFilter::try_from_default_env()
- .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn")),
- )
- .init();
-
let args: Vec<String> = env::args().collect();
let present_mode = std::env::args()
@@ -498,6 +490,17 @@ fn main() {
.map(|i| &args[i + 1])
.or_else(|| args.get(1).filter(|a| !a.starts_with("--")));
+ let no_ansi = std::env::args().any(|arg| arg == "--no-ansi");
+
+ tracing_subscriber::fmt()
+ .without_time()
+ .with_ansi(!no_ansi)
+ .with_env_filter(
+ tracing_subscriber::EnvFilter::try_from_default_env()
+ .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn")),
+ )
+ .init();
+
let mut emulator = if let Some(ipl) = ipl_path {
let ipl_data = std::fs::read(ipl).expect("failed to read IPL");
Gekko::with_ipl(&ipl_data, idle_skip)
diff --git a/crates/tinyemu/src/main.rs b/crates/tinyemu/src/main.rs
index 35c732b..e7a10e7 100644
--- a/crates/tinyemu/src/main.rs
+++ b/crates/tinyemu/src/main.rs
@@ -38,6 +38,10 @@ struct Args {
/// Skip idle loops to speed up emulation
#[arg(long)]
idle_skip: bool,
+
+ /// Disable ANSI escape codes
+ #[arg(long)]
+ no_ansi: bool,
}
fn parse_hex_addr(s: &str) -> Result<u32, String> {
@@ -49,6 +53,7 @@ fn main() {
tracing_subscriber::fmt()
.without_time()
+ .with_ansi(!args.no_ansi)
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn")),