rust3ds / ctru-rs

Rust wrapper for libctru
https://rust3ds.github.io/ctru-rs/
Other
117 stars 17 forks source link

Create a safe SVC module #99

Closed Meziu closed 1 year ago

Meziu commented 1 year ago

svc is one of the most unsafe and dangerous interfaces of the 3DS' system. However, thanks to the current state of thing in the Rust ecosystem, we could do great things by implementing the svc wrapper to use Rust's async/awaitsyntax.

This has the potential become one of the strong points of our toolchain. Nontheless, development is impaired by the lack of threading support.

DeltaF1 commented 1 year ago

(I'm assuming the async/await stuff you're talking about would be wrapping over services/IPC. Sorry if this is the wrong place to ask about this)

I've been reading 3dbrew trying to learn about how IPC works, and looking at some example code online. It looks like getThreadCommandBuffer is necessary for constructing IPC commands but is not exposed in ctru-sys. How are things included/excluded from the bindings?

Meziu commented 1 year ago

(I'm assuming the async/await stuff you're talking about would be wrapping over services/IPC. Sorry if this is the wrong place to ask about this)

It is the wrong place (no worries though). I was talking specifically about the srv module.

I've been reading 3dbrew trying to learn about how IPC works, and looking at some example code online. It looks like getThreadCommandBuffer is necessary for constructing IPC commands but is not exposed in ctru-sys. How are things included/excluded from the bindings?

It seems the ctru-sys currently in master was built with a bindgen older than this PR, so static inline functions (like getThreadCommandBuffer) weren't included. We should update ctru-sys.

DeltaF1 commented 1 year ago

Could you elaborate more about your vision for this? I'm still confused about which parts of svc you're thinking of.

Meziu commented 1 year ago

After further research, this issue seems mostly impossible/out-of-scope/still to determine/unnecessary. If I find the right inspiration and ideas about something similar I'll open a more specific PR.