Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

do not reply to stm eventhook

Layle7a0c3a2e40c7
diff --git a/crates/gecko/src/hollywood/ipc.rs b/crates/gecko/src/hollywood/ipc.rs
index 53afce7..a2e80a2 100644
--- a/crates/gecko/src/hollywood/ipc.rs
+++ b/crates/gecko/src/hollywood/ipc.rs
@@ -16,6 +16,8 @@ use crate::system::{System, SystemId, WII};
pub const IPC_EINVAL: i32 = -4;
pub const IPC_ENOENT: i32 = -6;
+pub const IPC_HUNG: i32 = i32::MIN;
+
pub struct DeviceContext<'a> {
pub mmio: &'a mut Mmio<{ WII }>,
pub scheduler: &'a mut Scheduler<{ WII }>,
@@ -155,3 +157,9 @@ pub fn deliver_response<const SYSTEM: SystemId>(sys: &mut System<SYSTEM>, cmd_pa
);
crate::hollywood::irq::assert_ipc(sys);
}
+
+pub fn deliver_ack<const SYSTEM: SystemId>(sys: &mut System<SYSTEM>) {
+ sys.hollywood.ipc.ppcctrl = sys.hollywood.ipc.ppcctrl.with_arm_post_ack(true);
+ tracing::debug!("deliver_ack: relaunch without reply");
+ crate::hollywood::irq::assert_ipc(sys);
+}
diff --git a/crates/gecko/src/hollywood/ipc/stm/eventhook.rs b/crates/gecko/src/hollywood/ipc/stm/eventhook.rs
index 4f9a436..7bc99e0 100644
--- a/crates/gecko/src/hollywood/ipc/stm/eventhook.rs
+++ b/crates/gecko/src/hollywood/ipc/stm/eventhook.rs
@@ -1,4 +1,4 @@
-use crate::hollywood::ipc::{DeviceContext, IosDevice};
+use crate::hollywood::ipc::{DeviceContext, IPC_HUNG, IosDevice};
pub struct EventHook;
@@ -6,20 +6,13 @@ impl IosDevice for EventHook {
fn ioctl(
&mut self,
_ctx: &mut DeviceContext<'_>,
- cmd: u32,
- in_buf: u32,
- in_len: u32,
- out_buf: u32,
- out_len: u32,
+ _cmd: u32,
+ _in_buf: u32,
+ _in_len: u32,
+ _out_buf: u32,
+ _out_len: u32,
) -> i32 {
- tracing::warn!(
- cmd = format!("{cmd:#010X}"),
- in_buf = format!("{in_buf:#010X}"),
- in_len,
- out_buf = format!("{out_buf:#010X}"),
- out_len,
- "STM_EventHook fucked up"
- );
- 0
+ tracing::warn!("STM_EventHook fucky fucky");
+ IPC_HUNG
}
}
diff --git a/crates/gecko/src/starlet.rs b/crates/gecko/src/starlet.rs
index a353d5e..9de667e 100644
--- a/crates/gecko/src/starlet.rs
+++ b/crates/gecko/src/starlet.rs
@@ -191,6 +191,10 @@ impl System<{ crate::WII }> {
pub fn dispatch_command<const SYSTEM: SystemId>(sys: &mut System<SYSTEM>, cmd_paddr: u32) {
let result = self::process_command(sys, cmd_paddr);
+ if result == crate::hollywood::ipc::IPC_HUNG {
+ crate::hollywood::ipc::deliver_ack(sys);
+ return;
+ }
sys.starlet.pending.push_back(PendingResponse { cmd_paddr, result });
self::ensure_delivery_scheduled::<SYSTEM>(sys, FINALIZE_DELAY_US);
}