Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

asd

Layle679dbe192522
diff --git a/crates/gecko/src/cpu/spr.rs b/crates/gecko/src/cpu/spr.rs
index 701e1ed..5b41c71 100644
--- a/crates/gecko/src/cpu/spr.rs
+++ b/crates/gecko/src/cpu/spr.rs
@@ -202,22 +202,28 @@ impl Spr {
284 => self.tbl = value,
285 => self.tbu = value,
287 => self.pvr = value,
- 528 => self.ibat0u = value,
- 529 => self.ibat0l = value,
- 530 => self.ibat1u = value,
- 531 => self.ibat1l = value,
- 532 => self.ibat2u = value,
- 533 => self.ibat2l = value,
- 534 => self.ibat3u = value,
- 535 => self.ibat3l = value,
- 536 => self.dbat0u = value,
- 537 => self.dbat0l = value,
- 538 => self.dbat1u = value,
- 539 => self.dbat1l = value,
- 540 => self.dbat2u = value,
- 541 => self.dbat2l = value,
- 542 => self.dbat3u = value,
- 543 => self.dbat3l = value,
+ 528..=543 => {
+ tracing::warn!(spr_num, value = format!("{value:08X}"), "BAT register changed");
+ match spr_num {
+ 528 => self.ibat0u = value,
+ 529 => self.ibat0l = value,
+ 530 => self.ibat1u = value,
+ 531 => self.ibat1l = value,
+ 532 => self.ibat2u = value,
+ 533 => self.ibat2l = value,
+ 534 => self.ibat3u = value,
+ 535 => self.ibat3l = value,
+ 536 => self.dbat0u = value,
+ 537 => self.dbat0l = value,
+ 538 => self.dbat1u = value,
+ 539 => self.dbat1l = value,
+ 540 => self.dbat2u = value,
+ 541 => self.dbat2l = value,
+ 542 => self.dbat3u = value,
+ 543 => self.dbat3l = value,
+ _ => unreachable!(),
+ }
+ }
912 => self.gqr0 = value,
913 => self.gqr1 = value,
914 => self.gqr2 = value,
diff --git a/crates/gecko/src/flipper/dsp.rs b/crates/gecko/src/flipper/dsp.rs
index f5f5fcd..2241c22 100644
--- a/crates/gecko/src/flipper/dsp.rs
+++ b/crates/gecko/src/flipper/dsp.rs
@@ -124,6 +124,14 @@ impl Dsp {
"ARAM DMA"
);
+ if aram_addr + count > self.aram.len() {
+ // TODO: should we raise interrupt anyways?
+ // This happens during apploader and the console supports
+ // expanded memory shit, so maybe it detects a DEV unit?
+ tracing::error!("ARAM DMA out of bounds, ignored");
+ return;
+ }
+
if self.aram_dma_control.direction() == regs::DmaDirection::AramToRam {
let src = &self.aram[aram_addr..aram_addr + count];
let dst = mmio.virt_slice_mut(ram_addr as u32, count);