rust3ds / ctru-rs

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

Implement low hanging apt sleep/homemenu functions and chainloader #161

Closed adryzz closed 7 months ago

adryzz commented 7 months ago

Saw that these weren't added yet, although they're very simple.

TLDR, Implemented

adryzz commented 7 months ago

oh, looks like i made my PR on the wrong branch

edit: fixed

Meziu commented 7 months ago

Saw that these weren't added yet, although they're very simple.

It’s a pretty straightforward addition. Just one question, what does “sleep allowed” actually do? Can the app stop the system to sleep even if the shell is closed?

All the chainloader stuff is still not implemented, as that probably requires a big abstraction layer to list apps and other things.

Chainloader and applist stuff could be implemented with the already existing AM API (perhaps?).

adryzz commented 7 months ago

It’s a pretty straightforward addition. Just one question, what does “sleep allowed” actually do? Can the app stop the system to sleep even if the shell is closed?

It's used in online multiplayer games and stuff like that. i've seen the no-sleep/no-home combo for example in Steel Diver: Sub Wars when playing online.

essentially, if you close the shell (or use the toggle switch on the O2DS), the displays turn off, but the console does not go to sleep. you can see this because the blue LED does not oscillate in brightness when it's not sleeping.

I should probably write better documentation, since it wasn't clear at first glance what it did.

Chainloader and applist stuff could be implemented with the already existing AM API (perhaps?).

edit: turns out i didn't know the existing AM API provided that, i have made a chainloader prototype, although i don't really like it as-is

adryzz commented 7 months ago

Alright, implemented a chainloader API, the problem is that the bindings are missing a function.

https://github.com/devkitPro/libctru/blob/d0936b879bd2088cae61b69707fe70cb66ede651/libctru/source/services/apt.c#L111

FenrirWolf commented 7 months ago

static functions like that one aren't exported outside of their compilation unit. In other words, they're private to libctru and you have to reimplement them if you want to use them. Fortunately the impl is pretty simple for that function and the other ones like it, so hopefully that won't be too much of a problem.