pub struct Apt(/* private fields */);
Expand description
Handle to the Applet service.
Implementations§
source§impl Apt
impl Apt
sourcepub fn main_loop(&self) -> bool
pub fn main_loop(&self) -> bool
Returns true
if the application is running in the foreground as normal.
§Notes
This function is called as such since it automatically handles all checks for Home Menu switching, Sleep mode and other events that could take away control from the application. For this reason, its main use is as the condition of a while loop that controls the main logic for your program.
§Example
use std::error::Error;
use ctru::services::apt::Apt;
// In a simple `main` function, the structure should be the following.
fn main() -> Result<(), Box<dyn Error>> {
let apt = Apt::new()?;
while apt.main_loop() {
// Main program logic should be written here.
}
// Optional clean-ups after running the application should be written after the main loop.
sourcepub fn set_app_cpu_time_limit(&mut self, percent: u32) -> Result<()>
pub fn set_app_cpu_time_limit(&mut self, percent: u32) -> Result<()>
Set (in percentage) the amount of time to lend to the application thread spawned on the syscore (core #1).
§Notes
It is necessary to set a time limit before spawning threads on the syscore. The percentage value must be withing 5% and 89%, though it is suggested to use lower values (around 30-45%) to avoid slowing down the OS processes.
sourcepub fn set_sleep_allowed(&mut self, allowed: bool)
pub fn set_sleep_allowed(&mut self, allowed: bool)
Set if the console is allowed to enter sleep mode.
You can check whether the console is allowed to sleep with Apt::is_sleep_allowed.
sourcepub fn is_sleep_allowed(&self) -> bool
pub fn is_sleep_allowed(&self) -> bool
Check if the console is allowed to enter sleep mode.
You can set whether the console is allowed to sleep with Apt::set_sleep_allowed.
sourcepub fn set_home_allowed(&mut self, allowed: bool)
pub fn set_home_allowed(&mut self, allowed: bool)
Set if the console is allowed to enter the home menu.
You can check whether the console is allowed to enter the home menu with Apt::is_home_allowed.
sourcepub fn is_home_allowed(&self) -> bool
pub fn is_home_allowed(&self) -> bool
Check if the console is allowed to enter the home menu.
You can set whether the console is allowed to enter the home menu with Apt::set_home_allowed.
Immediately jumps to the home menu.