Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

di fs devices

Layle8f9a212413f0
diff --git a/crates/gecko/src/hollywood/ipc.rs b/crates/gecko/src/hollywood/ipc.rs
index 9e5ce59..c7b4686 100644
--- a/crates/gecko/src/hollywood/ipc.rs
+++ b/crates/gecko/src/hollywood/ipc.rs
@@ -1,3 +1,5 @@
+pub mod di;
+pub mod fs;
pub mod stm;
use crate::hollywood::regs::{ArmCtrl, ArmMsg, PpcCtrl, PpcMsg};
@@ -22,31 +24,49 @@ pub trait IosDevice: Send {
0
}
- fn read(&mut self, _ctx: &mut DeviceContext<'_>, _buf: u32, _len: u32) -> i32 {
+ fn read(&mut self, _ctx: &mut DeviceContext<'_>, buf: u32, len: u32) -> i32 {
+ tracing::warn!(buf = format!("{buf:#010X}"), len, "IOS_Read: unimplemented");
IPC_EINVAL
}
- fn write(&mut self, _ctx: &mut DeviceContext<'_>, _buf: u32, _len: u32) -> i32 {
+ fn write(&mut self, _ctx: &mut DeviceContext<'_>, buf: u32, len: u32) -> i32 {
+ tracing::warn!(buf = format!("{buf:#010X}"), len, "IOS_Write: unimplemented");
IPC_EINVAL
}
- fn seek(&mut self, _ctx: &mut DeviceContext<'_>, _where_: i32, _whence: i32) -> i32 {
+ fn seek(&mut self, _ctx: &mut DeviceContext<'_>, where_: i32, whence: i32) -> i32 {
+ tracing::warn!(where_ = where_, whence = whence, "IOS_Seek: unimplemented");
0
}
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 = in_len,
+ out_buf = format!("{out_buf:#010X}"),
+ out_len = out_len,
+ "IOS_Ioctl: unimplemented"
+ );
IPC_EINVAL
}
- fn ioctlv(&mut self, _ctx: &mut DeviceContext<'_>, _cmd: u32, _argcin: u32, _argcio: u32, _vec: u32) -> i32 {
+ fn ioctlv(&mut self, _ctx: &mut DeviceContext<'_>, cmd: u32, argcin: u32, argcio: u32, vec: u32) -> i32 {
+ tracing::warn!(
+ cmd = format!("{cmd:#010X}"),
+ argcin = argcin,
+ argcio = argcio,
+ vec = format!("{vec:#010X}"),
+ "IOS_Ioctlv: unimplemented"
+ );
IPC_EINVAL
}
}
diff --git a/crates/gecko/src/hollywood/ipc/di.rs b/crates/gecko/src/hollywood/ipc/di.rs
new file mode 100644
index 0000000..796441a
--- /dev/null
+++ b/crates/gecko/src/hollywood/ipc/di.rs
@@ -0,0 +1,5 @@
+use crate::hollywood::ipc::{DeviceContext, IosDevice};
+
+pub struct DiskInterface;
+
+impl IosDevice for DiskInterface {}
diff --git a/crates/gecko/src/hollywood/ipc/fs.rs b/crates/gecko/src/hollywood/ipc/fs.rs
new file mode 100644
index 0000000..ace5551
--- /dev/null
+++ b/crates/gecko/src/hollywood/ipc/fs.rs
@@ -0,0 +1,5 @@
+use crate::hollywood::ipc::{DeviceContext, IosDevice};
+
+pub struct FileSystem;
+
+impl IosDevice for FileSystem {}
diff --git a/crates/gecko/src/hollywood/ipc/stm/immediate.rs b/crates/gecko/src/hollywood/ipc/stm/immediate.rs
index 5d6aa24..2f3783c 100644
--- a/crates/gecko/src/hollywood/ipc/stm/immediate.rs
+++ b/crates/gecko/src/hollywood/ipc/stm/immediate.rs
@@ -2,17 +2,4 @@ use crate::hollywood::ipc::{DeviceContext, IPC_EINVAL, IosDevice};
pub struct Immediate;
-impl IosDevice for Immediate {
- fn ioctl(
- &mut self,
- _ctx: &mut DeviceContext<'_>,
- cmd: u32,
- in_buf: u32,
- in_len: u32,
- out_buf: u32,
- out_len: u32,
- ) -> i32 {
- tracing::error!(cmd, in_buf, in_len, out_buf, out_len, "IOS_Ioctl: unimplemented");
- IPC_EINVAL
- }
-}
+impl IosDevice for Immediate {}
diff --git a/crates/gecko/src/starlet.rs b/crates/gecko/src/starlet.rs
index 7068f2d..7a9bae4 100644
--- a/crates/gecko/src/starlet.rs
+++ b/crates/gecko/src/starlet.rs
@@ -61,10 +61,12 @@ impl Starlet {
impl System<{ crate::WII }> {
pub fn initialize_starlet_devices(&mut self) {
- use crate::hollywood::ipc::stm;
+ use crate::hollywood::ipc::{self, stm};
self.starlet.register("/dev/stm/immediate", Box::new(stm::Immediate));
self.starlet.register("/dev/stm/eventhook", Box::new(stm::EventHook));
+ self.starlet.register("/dev/fs", Box::new(ipc::fs::FileSystem));
+ self.starlet.register("/dev/di", Box::new(ipc::di::DiskInterface));
}
pub fn create_device_context(&mut self) -> (&mut Starlet, DeviceContext<'_>) {