//! The APT service handles integration with some higher level OS features such as Sleep mode, the Home Menu and application switching.
//!
//! It also handles running applets, small programs made available by the OS to streamline specific functionality. Those are implemented in the [`applets`](crate::applets) module.
usecrate::error::ResultCode;
usecrate::error::ResultCode;
/// Handle to the Applet service.
pubstructApt(());
pubstructApt(());
implApt{
implApt{
/// Initialize a new handle.
#[doc(alias = "aptInit")]
pubfnnew()-> crate::Result<Apt>{
pubfnnew()-> crate::Result<Apt>{
unsafe{
unsafe{
ResultCode(ctru_sys::aptInit())?;
ResultCode(ctru_sys::aptInit())?;
@ -10,10 +19,24 @@ impl Apt {
}
}
}
}
/// 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.
#[doc(alias = "aptMainLoop")]
pubfnmain_loop(&self)-> bool{
pubfnmain_loop(&self)-> bool{
unsafe{ctru_sys::aptMainLoop()}
unsafe{ctru_sys::aptMainLoop()}
}
}
/// Sets (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.
//! System services used to handle system-specific functionalities.
//! OS services used to handle system-specific functionality.
//!
//!
//! Most of the 3DS console's functionalities (when writing homebrew) are locked behind services,
//! Most of the 3DS console's functionalities (when writing user-land homebrew) are accessible via services,
//! which need to be initialized before accessing any particular feature.
//! which need to be initialized before accessing any particular feature.
//!
//!
//! Some include: button input, audio playback, graphics rendering, built-in cameras, etc.
//! To ensure safety measures when using the underlying services, `ctru` leverages Rust's lifetime model.
//! After initializing the handle for a specific service (e.g. [`Apt`](apt::Apt)) the service will be accessible as long as there is at least one handle "alive".
//! As such, handles should be dropped *after* the use of a specific service. This is particularly important for services which are necessary for functionality
//! "outside" their associated methods, such as [`RomFS`](romfs::RomFS), which creates an accessible virtual filesystem, or [`Soc`](soc::Soc),
//! which enables all network communications via sockets.
//!
//! In `ctru` some services only allow a single handle to be created at a time, to ensure a safe and controlled environment.