From d315ebd10cf90e28387f1b1c040c14ad7c924950 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sat, 8 Jul 2023 14:13:41 +0200 Subject: [PATCH] doc(alias) everywhere --- ctru-rs/src/applets/mii_selector.rs | 9 ++++++ ctru-rs/src/applets/swkbd.rs | 11 +++++++ ctru-rs/src/console.rs | 5 ++++ ctru-rs/src/linear.rs | 3 ++ ctru-rs/src/mii.rs | 1 + ctru-rs/src/services/cam.rs | 46 +++++++++++++++++++++++++++++ ctru-rs/src/services/cfgu.rs | 10 +++++++ ctru-rs/src/services/fs.rs | 18 +++++++++++ ctru-rs/src/services/gfx.rs | 17 +++++++++-- ctru-rs/src/services/gspgpu.rs | 3 ++ ctru-rs/src/services/hid.rs | 8 +++++ ctru-rs/src/services/ndsp/mod.rs | 27 +++++++++++++++++ ctru-rs/src/services/ps.rs | 7 +++++ ctru-rs/src/services/romfs.rs | 6 ++++ ctru-rs/src/services/soc.rs | 5 ++++ ctru-rs/src/services/sslc.rs | 2 ++ 16 files changed, 176 insertions(+), 2 deletions(-) diff --git a/ctru-rs/src/applets/mii_selector.rs b/ctru-rs/src/applets/mii_selector.rs index bd0eac2..eada7e3 100644 --- a/ctru-rs/src/applets/mii_selector.rs +++ b/ctru-rs/src/applets/mii_selector.rs @@ -46,6 +46,7 @@ bitflags! { /// /// let result = mii_selector.launch().unwrap(); /// ``` +#[doc(alias = "MiiSelectorConf")] #[derive(Clone, Debug)] pub struct MiiSelector { config: Box, @@ -70,6 +71,7 @@ pub enum LaunchError { impl MiiSelector { /// Initializes a Mii Selector + #[doc(alias = "miiSelectorInit")] pub fn new() -> Self { let mut config = Box::::default(); unsafe { @@ -81,6 +83,7 @@ impl MiiSelector { /// Set the title of the Mii Selector. /// /// This function would panic if the given ``&str`` contains NUL bytes. + #[doc(alias = "miiSelectorSetTitle")] pub fn set_title(&mut self, text: &str) { // This can only fail if the text contains NUL bytes in the string... which seems // unlikely and is documented @@ -91,11 +94,13 @@ impl MiiSelector { } /// Set the options of the Mii Selector + #[doc(alias = "miiSelectorSetOptions")] pub fn set_options(&mut self, options: Options) { unsafe { ctru_sys::miiSelectorSetOptions(self.config.as_mut(), options.bits) } } /// Whitelist a guest Mii + #[doc(alias = "miiSelectorWhitelistGuestMii")] pub fn whitelist_guest_mii(&mut self, mii_index: Index) { let index = match mii_index { Index::Index(i) => i, @@ -106,6 +111,7 @@ impl MiiSelector { } /// Blacklist a guest Mii + #[doc(alias = "miiSelectorBlacklistGuestMii")] pub fn blacklist_guest_mii(&mut self, mii_index: Index) { let index = match mii_index { Index::Index(i) => i, @@ -116,6 +122,7 @@ impl MiiSelector { } /// Whitelist a user Mii + #[doc(alias = "miiSelectorWhitelistUserMii")] pub fn whitelist_user_mii(&mut self, mii_index: Index) { let index = match mii_index { Index::Index(i) => i, @@ -126,6 +133,7 @@ impl MiiSelector { } /// Blacklist a user Mii + #[doc(alias = "miiSelectorBlacklistUserMii")] pub fn blacklist_user_mii(&mut self, mii_index: Index) { let index = match mii_index { Index::Index(i) => i, @@ -145,6 +153,7 @@ impl MiiSelector { /// Launch the Mii Selector. /// Returns an error when the checksum of the Mii is invalid. + #[doc(alias = "miiSelectorLaunch")] pub fn launch(&mut self) -> Result { let mut return_val = Box::::default(); unsafe { ctru_sys::miiSelectorLaunch(self.config.as_mut(), return_val.as_mut()) } diff --git a/ctru-rs/src/applets/swkbd.rs b/ctru-rs/src/applets/swkbd.rs index 8f4aab6..49a4103 100644 --- a/ctru-rs/src/applets/swkbd.rs +++ b/ctru-rs/src/applets/swkbd.rs @@ -7,6 +7,7 @@ use std::iter::once; use std::str; /// An instance of the software keyboard. +#[doc(alias = "SwkbdState")] #[derive(Clone)] pub struct Swkbd { state: Box, @@ -19,6 +20,7 @@ pub struct Swkbd { /// Numpad is a number pad. /// Western is a text keyboard without japanese symbols (only applies to JPN systems). For other /// systems it's the same as a Normal keyboard. +#[doc(alias = "SwkbdType")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Kind { @@ -29,6 +31,7 @@ pub enum Kind { } /// Represents which button the user pressed to close the software keyboard. +#[doc(alias = "SwkbdButton")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Button { @@ -38,6 +41,7 @@ pub enum Button { } /// Error type for the software keyboard. +#[doc(alias = "SwkbdResult")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(i32)] pub enum Error { @@ -52,6 +56,7 @@ pub enum Error { } /// Restrictions on keyboard input +#[doc(alias = "SwkbdValidInput")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ValidInput { @@ -90,6 +95,7 @@ bitflags! { impl Swkbd { /// Initializes a software keyboard of the specified type and the chosen number of buttons /// (from 1-3). + #[doc(alias = "swkbdInit")] pub fn new(keyboard_type: Kind, num_buttons: i32) -> Self { unsafe { let mut state = Box::::default(); @@ -101,6 +107,7 @@ impl Swkbd { /// Gets input from this keyboard and appends it to the provided string. /// /// The text received from the keyboard will be truncated if it is longer than `max_bytes`. + #[doc(alias = "swkbdInputText")] pub fn get_string(&mut self, max_bytes: usize) -> Result<(String, Button), Error> { // Unfortunately the libctru API doesn't really provide a way to get the exact length // of the string that it receieves from the software keyboard. Instead it expects you @@ -125,6 +132,7 @@ impl Swkbd { /// /// If the buffer is too small to contain the entire sequence received from the keyboard, /// the output will be truncated but should still be well-formed UTF-8. + #[doc(alias = "swkbdInputText")] pub fn write_exact(&mut self, buf: &mut [u8]) -> Result { unsafe { match swkbdInputText(self.state.as_mut(), buf.as_mut_ptr(), buf.len()) { @@ -138,6 +146,7 @@ impl Swkbd { } /// Sets special features for this keyboard + #[doc(alias = "swkbdSetFeatures")] pub fn set_features(&mut self, features: Features) { unsafe { swkbdSetFeatures(self.state.as_mut(), features.bits) } } @@ -156,6 +165,7 @@ impl Swkbd { /// Sets the hint text for this software keyboard (that is, the help text that is displayed /// when the textbox is empty) + #[doc(alias = "swkbdSetHintText")] pub fn set_hint_text(&mut self, text: &str) { unsafe { let nul_terminated: String = text.chars().chain(once('\0')).collect(); @@ -169,6 +179,7 @@ impl Swkbd { /// `text` configures the display text for the button /// `submit` configures whether pressing the button will accept the keyboard's input or /// discard it. + #[doc(alias = "swkbdSetButton")] pub fn configure_button(&mut self, button: Button, text: &str, submit: bool) { unsafe { let nul_terminated: String = text.chars().chain(once('\0')).collect(); diff --git a/ctru-rs/src/console.rs b/ctru-rs/src/console.rs index bad114e..cd6b51f 100644 --- a/ctru-rs/src/console.rs +++ b/ctru-rs/src/console.rs @@ -7,6 +7,7 @@ use crate::services::gfx::Screen; static mut EMPTY_CONSOLE: PrintConsole = unsafe { const_zero::const_zero!(PrintConsole) }; +#[doc(alias = "PrintConsole")] pub struct Console<'screen> { context: Box, _screen: RefMut<'screen, dyn Screen>, @@ -20,6 +21,7 @@ impl<'screen> Console<'screen> { /// # Notes /// /// [`Console`] automatically takes care of flushing and swapping buffers for its screen when printing. + #[doc(alias = "consoleInit")] pub fn new(screen: RefMut<'screen, dyn Screen>) -> Self { let mut context = Box::::default(); @@ -45,6 +47,7 @@ impl<'screen> Console<'screen> { } /// Select this console as the current target for stdout + #[doc(alias = "consoleSelect")] pub fn select(&self) { unsafe { consoleSelect(self.context.as_ref() as *const _ as *mut _); @@ -52,6 +55,7 @@ impl<'screen> Console<'screen> { } /// Clears all text from the console + #[doc(alias = "consoleClear")] pub fn clear(&self) { unsafe { consoleClear() } } @@ -64,6 +68,7 @@ impl<'screen> Console<'screen> { /// # Safety /// This function is unsafe because it does not validate that the input will produce /// a console that actually fits on the screen + #[doc(alias = "consoleSetWindow")] pub unsafe fn set_window(&mut self, x: i32, y: i32, width: i32, height: i32) { consoleSetWindow(self.context.as_mut(), x, y, width, height); } diff --git a/ctru-rs/src/linear.rs b/ctru-rs/src/linear.rs index 718e975..d0164c0 100644 --- a/ctru-rs/src/linear.rs +++ b/ctru-rs/src/linear.rs @@ -22,12 +22,14 @@ pub struct LinearAllocator; impl LinearAllocator { /// Returns the amount of free space left in the LINEAR sector + #[doc(alias = "linearSpaceFree")] pub fn free_space() -> u32 { unsafe { ctru_sys::linearSpaceFree() } } } unsafe impl Allocator for LinearAllocator { + #[doc(alias = "linearAlloc", alias = "linearMemAlign")] fn allocate(&self, layout: Layout) -> Result, AllocError> { let pointer = unsafe { ctru_sys::linearMemAlign(layout.size(), layout.align()) }; @@ -36,6 +38,7 @@ unsafe impl Allocator for LinearAllocator { .ok_or(AllocError) } + #[doc(alias = "linearFree")] unsafe fn deallocate(&self, ptr: NonNull, _layout: Layout) { ctru_sys::linearFree(ptr.as_ptr().cast()); } diff --git a/ctru-rs/src/mii.rs b/ctru-rs/src/mii.rs index a992a2a..120eee1 100644 --- a/ctru-rs/src/mii.rs +++ b/ctru-rs/src/mii.rs @@ -177,6 +177,7 @@ pub struct MoleDetails { /// /// /// This struct is returned by the [`MiiSelector`](crate::applets::mii_selector::MiiSelector) +#[doc(alias = "MiiData")] #[derive(Clone, Debug)] pub struct MiiData { pub options: MiiDataOptions, diff --git a/ctru-rs/src/services/cam.rs b/ctru-rs/src/services/cam.rs index 6ddb37f..0d18d89 100644 --- a/ctru-rs/src/services/cam.rs +++ b/ctru-rs/src/services/cam.rs @@ -21,6 +21,7 @@ pub struct Cam { } /// Flag to pass to [`Camera::flip_image`] +#[doc(alias = "CAMU_Flip")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum FlipMode { @@ -31,6 +32,7 @@ pub enum FlipMode { } /// Flag to pass to [`Camera::set_view_size`] +#[doc(alias = "CAMU_Size")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ViewSize { @@ -48,6 +50,7 @@ pub enum ViewSize { } /// Flag to pass to [`Camera::set_frame_rate`] +#[doc(alias = "CAMU_FramRate")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum FrameRate { @@ -68,6 +71,7 @@ pub enum FrameRate { /// Flag to pass to [`Camera::set_white_balance`] or /// [`Camera::set_white_balance_without_base_up`] +#[doc(alias = "CAMU_WhiteBalance")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum WhiteBalance { @@ -86,6 +90,7 @@ pub enum WhiteBalance { } /// Flag to pass to [`Camera::set_photo_mode`] +#[doc(alias = "CAMU_PhotoMode")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum PhotoMode { @@ -97,6 +102,7 @@ pub enum PhotoMode { } /// Flag to pass to [`Camera::set_effect`] +#[doc(alias = "CAMU_Effect")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Effect { @@ -109,6 +115,7 @@ pub enum Effect { } /// Flag to pass to [`Camera::set_contrast`] +#[doc(alias = "CAMU_Contrast")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Contrast { @@ -121,6 +128,7 @@ pub enum Contrast { } /// Flag to pass to [`Camera::set_lens_correction`] +#[doc(alias = "CAMU_LensCorrection")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum LensCorrection { @@ -130,6 +138,7 @@ pub enum LensCorrection { } /// Flag to pass to [`Camera::set_output_format`] +#[doc(alias = "CAMU_OutputFormat")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum OutputFormat { @@ -138,6 +147,7 @@ pub enum OutputFormat { } /// Flag to pass to [`Cam::play_shutter_sound`] +#[doc(alias = "CAMU_ShutterSoundType")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ShutterSound { @@ -194,10 +204,12 @@ impl TrimmingParams { } /// Represents data used by the camera to calibrate image quality +#[doc(alias = "CAMU_ImageQualityCalibrationData")] #[derive(Default, Clone, Copy, Debug)] pub struct ImageQualityCalibrationData(pub ctru_sys::CAMU_ImageQualityCalibrationData); /// Represents data used by the camera to calibrate image quality when using both outward cameras +#[doc(alias = "CAMU_StereoCameraCalibrationData")] #[derive(Default, Clone, Copy, Debug)] pub struct StereoCameraCalibrationData(pub ctru_sys::CAMU_StereoCameraCalibrationData); @@ -240,6 +252,7 @@ pub struct BothOutwardCam; impl BothOutwardCam { /// Sets whether to enable or disable synchronization /// of brightness for both left and right cameras + #[doc(alias = "CAMU_SetBrightnessSynchronization")] pub fn set_brightness_synchronization( &mut self, brightness_synchronization: bool, @@ -274,6 +287,7 @@ pub trait Camera { } /// Returns true if the camera is busy (receiving data) + #[doc(alias = "CAMU_IsBusy")] fn is_busy(&self) -> crate::Result { unsafe { let mut is_busy = false; @@ -284,6 +298,7 @@ pub trait Camera { /// Returns the maximum amount of transfer bytes based on the view size, trimming, and other /// modifications set to the camera + #[doc(alias = "CAMU_GetTransferBytes")] fn transfer_byte_count(&self) -> crate::Result { unsafe { let mut transfer_bytes = 0; @@ -297,6 +312,7 @@ pub trait Camera { /// Sets whether or not the camera should trim the image based on parameters set by /// [`Camera::set_trimming_params`] + #[doc(alias = "CAMU_SetTrimming")] fn set_trimming(&mut self, enabled: bool) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetTrimming(self.port_as_raw(), enabled))?; @@ -305,6 +321,7 @@ pub trait Camera { } /// Returns whether or not trimming is currently enabled for the camera + #[doc(alias = "CAMU_IsTrimming")] fn is_trimming_enabled(&self) -> crate::Result { unsafe { let mut trimming = false; @@ -314,6 +331,7 @@ pub trait Camera { } /// Sets trimming parameters based on coordinates specified inside a [`TrimmingParams`] + #[doc(alias = "CAMU_SetTrimmingParams")] fn set_trimming_params(&mut self, params: TrimmingParams) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetTrimmingParams( @@ -328,6 +346,7 @@ pub trait Camera { } /// Returns the [`TrimmingParams`] set + #[doc(alias = "CAMU_GetTrimmingParams")] fn trimming_params(&self) -> crate::Result { unsafe { let mut x_start = 0; @@ -354,6 +373,7 @@ pub trait Camera { /// Sets the trimming parameters revolving around the center of the image. /// The new width will be `trim_width / 2` to the left and right of the center. /// The new height will be `trim_height / 2` above and below the center. + #[doc(alias = "CAMU_SetTrimmingParamsCenter")] fn set_trimming_params_center( &mut self, trim_width: i16, @@ -374,6 +394,7 @@ pub trait Camera { } /// Sets the exposure level of the camera + #[doc(alias = "CAMU_SetExposure")] fn set_exposure(&mut self, exposure: i8) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetExposure(self.camera_as_raw(), exposure))?; @@ -382,6 +403,7 @@ pub trait Camera { } /// Sets the white balance mod of the camera based on the passed [`WhiteBalance`] argument + #[doc(alias = "CAMU_SetWhiteBalance")] fn set_white_balance(&mut self, white_balance: WhiteBalance) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetWhiteBalance( @@ -394,6 +416,7 @@ pub trait Camera { /// Sets the white balance mode of the camera based on the passed [`WhiteBalance`] argument // TODO: Explain base up + #[doc(alias = "CAMU_SetWhiteBalanceWithoutBaseUp")] fn set_white_balance_without_base_up( &mut self, white_balance: WhiteBalance, @@ -408,6 +431,7 @@ pub trait Camera { } /// Sets the sharpness of the camera + #[doc(alias = "CAMU_SetSharpness")] fn set_sharpness(&mut self, sharpness: i8) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetSharpness(self.camera_as_raw(), sharpness))?; @@ -416,6 +440,7 @@ pub trait Camera { } /// Sets whether auto exposure is enabled or disabled for the camera + #[doc(alias = "CAMU_SetAutoExposure")] fn set_auto_exposure(&mut self, enabled: bool) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetAutoExposure( @@ -427,6 +452,7 @@ pub trait Camera { } /// Returns true if auto exposure is enabled for the camera + #[doc(alias = "CAMU_IsAutoExposure")] fn is_auto_exposure_enabled(&self) -> crate::Result { unsafe { let mut enabled = false; @@ -439,6 +465,7 @@ pub trait Camera { } /// Sets whether auto white balance is enabled or disabled for the camera + #[doc(alias = "CAMU_SetAutoWhiteBalance")] fn set_auto_white_balance(&mut self, enabled: bool) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetAutoWhiteBalance( @@ -450,6 +477,7 @@ pub trait Camera { } /// Returns true if auto white balance is enabled for the camera + #[doc(alias = "CAMU_IsAutoWhiteBalance")] fn is_auto_white_balance_enabled(&self) -> crate::Result { unsafe { let mut enabled = false; @@ -462,6 +490,7 @@ pub trait Camera { } /// Sets the flip direction of the camera's image based on the passed [`FlipMode`] argument + #[doc(alias = "CAMU_FlipImage")] fn flip_image(&mut self, flip: FlipMode) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_FlipImage( @@ -485,6 +514,7 @@ pub trait Camera { /// * `height` - height of the image /// * `crop_0` - The first crop point in which the image will be trimmed /// * `crop_0` - The second crop point in which the image will be trimmed + #[doc(alias = "CAMU_SetDetailSize")] fn set_detail_size( &mut self, width: i16, @@ -508,6 +538,7 @@ pub trait Camera { } /// Sets the view size of the camera based on the passed [`ViewSize`] argument. + #[doc(alias = "CAMU_SetSize")] fn set_view_size(&mut self, size: ViewSize) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetSize( @@ -520,6 +551,7 @@ pub trait Camera { } /// Sets the frame rate of the camera based on the passed [`FrameRate`] argument. + #[doc(alias = "CAMU_SetFrameRate")] fn set_frame_rate(&mut self, frame_rate: FrameRate) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetFrameRate( @@ -531,6 +563,7 @@ pub trait Camera { } /// Sets the photo mode of the camera based on the passed [`PhotoMode`] argument. + #[doc(alias = "CAMU_SetPhotoMode")] fn set_photo_mode(&mut self, photo_mode: PhotoMode) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetPhotoMode( @@ -544,6 +577,7 @@ pub trait Camera { /// Sets the effect of the camera based on the passed [`Effect`] argument. /// /// Multiple effects can be set at once by combining the bitflags of [`Effect`] + #[doc(alias = "CAMU_SetEffect")] fn set_effect(&mut self, effect: Effect) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetEffect( @@ -556,6 +590,7 @@ pub trait Camera { } /// Sets the contrast of the camera based on the passed [`Contrast`] argument. + #[doc(alias = "CAMU_SetContrast")] fn set_contrast(&mut self, contrast: Contrast) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetContrast( @@ -567,6 +602,7 @@ pub trait Camera { } /// Sets the lens correction of the camera based on the passed [`LensCorrection`] argument. + #[doc(alias = "CAMU_SetLensCorrection")] fn set_lens_correction(&mut self, lens_correction: LensCorrection) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetLensCorrection( @@ -578,6 +614,7 @@ pub trait Camera { } /// Sets the output format of the camera based on the passed [`OutputFormat`] argument. + #[doc(alias = "CAMU_SetOutputFormat")] fn set_output_format(&mut self, format: OutputFormat) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetOutputFormat( @@ -597,6 +634,7 @@ pub trait Camera { /// * `y` - Starting y coordinate of the window /// * `width` - Width of the window /// * `height` - Height of the window + #[doc(alias = "CAMU_SetAutoExposureWindow")] fn set_auto_exposure_window( &mut self, x: i16, @@ -624,6 +662,7 @@ pub trait Camera { /// * `y` - Starting y coordinate of the window /// * `width` - Width of the window /// * `height` - Height of the window + #[doc(alias = "CAMU_SetAutoWhiteBalanceWindow")] fn set_auto_white_balance_window( &mut self, x: i16, @@ -644,6 +683,7 @@ pub trait Camera { } /// Sets whether the noise filter should be enabled or disabled for the camera + #[doc(alias = "CAMU_SetNoiseFilter")] fn set_noise_filter(&mut self, enabled: bool) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetNoiseFilter(self.camera_as_raw(), enabled))?; @@ -653,6 +693,7 @@ pub trait Camera { /// Sets the image quality calibration data for the camera based on the passed in /// [`ImageQualityCalibrationData`] argument + #[doc(alias = "CAMU_SetImageQualityCalibrationData")] fn set_image_quality_calibration_data( &mut self, data: ImageQualityCalibrationData, @@ -664,6 +705,7 @@ pub trait Camera { } /// Returns the current [`ImageQualityCalibrationData`] for the camera + #[doc(alias = "CAMU_GetImageQualityCalibrationData")] fn image_quality_calibration_data(&self) -> crate::Result { unsafe { let mut data = ImageQualityCalibrationData::default(); @@ -674,6 +716,7 @@ pub trait Camera { /// Sets the camera as the current sleep camera // TODO: Explain sleep camera + #[doc(alias = "CAMU_SetSleepCamera")] fn set_sleep_camera(&mut self) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_SetSleepCamera(self.camera_as_raw()))?; @@ -771,6 +814,7 @@ impl Cam { /// This function will return an error if the service was unable to be initialized. /// Since this service requires no special or elevated permissions, errors are /// rare in practice. + #[doc(alias = "camInit")] pub fn new() -> crate::Result { unsafe { ResultCode(ctru_sys::camInit())?; @@ -784,6 +828,7 @@ impl Cam { } /// Plays the specified sound based on the [`ShutterSound`] argument + #[doc(alias = "CAMU_PlayShutterSound")] pub fn play_shutter_sound(&self, sound: ShutterSound) -> crate::Result<()> { unsafe { ResultCode(ctru_sys::CAMU_PlayShutterSound(sound.into()))?; @@ -793,6 +838,7 @@ impl Cam { } impl Drop for Cam { + #[doc(alias = "camExit")] fn drop(&mut self) { unsafe { ctru_sys::camExit() }; } diff --git a/ctru-rs/src/services/cfgu.rs b/ctru-rs/src/services/cfgu.rs index a9cc411..661fdf9 100644 --- a/ctru-rs/src/services/cfgu.rs +++ b/ctru-rs/src/services/cfgu.rs @@ -4,6 +4,7 @@ use crate::error::ResultCode; +#[doc(alias = "CFG_Region")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Region { @@ -16,6 +17,7 @@ pub enum Region { Taiwan = ctru_sys::CFG_REGION_TWN, } +#[doc(alias = "CFG_Language")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Language { @@ -33,6 +35,7 @@ pub enum Language { TraditionalChinese = ctru_sys::CFG_LANGUAGE_TW, } +#[doc(alias = "CFG_SystemModel")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum SystemModel { @@ -61,12 +64,14 @@ impl Cfgu { /// ctrulib services are reference counted, so this function may be called /// as many times as desired and the service will not exit until all /// instances of Cfgu drop out of scope. + #[doc(alias = "cfguInit")] pub fn new() -> crate::Result { ResultCode(unsafe { ctru_sys::cfguInit() })?; Ok(Cfgu(())) } /// Gets system region from secure info + #[doc(alias = "CFGU_SecureInfoGetRegion")] pub fn region(&self) -> crate::Result { let mut region: u8 = 0; @@ -75,6 +80,7 @@ impl Cfgu { } /// Gets system's model + #[doc(alias = "CFGU_GetSystemModel")] pub fn model(&self) -> crate::Result { let mut model: u8 = 0; @@ -83,6 +89,7 @@ impl Cfgu { } /// Gets system's language + #[doc(alias = "CFGU_GetSystemLanguage")] pub fn language(&self) -> crate::Result { let mut language: u8 = 0; @@ -91,6 +98,7 @@ impl Cfgu { } /// Checks if NFC is supported by the console + #[doc(alias = "CFGU_IsNFCSupported")] pub fn is_nfc_supported(&self) -> crate::Result { let mut supported: bool = false; @@ -99,6 +107,7 @@ impl Cfgu { } /// Check if the console is from the 2DS family (2DS, New2DS, New2DSXL) + #[doc(alias = "CFGU_GetModelNintendo2DS")] pub fn is_2ds_family(&self) -> crate::Result { let mut is_2ds_family: u8 = 0; @@ -108,6 +117,7 @@ impl Cfgu { } impl Drop for Cfgu { + #[doc(alias = "cfguExit")] fn drop(&mut self) { unsafe { ctru_sys::cfguExit(); diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index faa03e3..b498ee9 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -39,6 +39,7 @@ bitflags! { } } +#[doc(alias = "FS_MediaType")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum FsMediaType { @@ -47,6 +48,7 @@ pub enum FsMediaType { GameCard = ctru_sys::MEDIATYPE_GAME_CARD, } +#[doc(alias = "FS_PathType")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum PathType { @@ -57,6 +59,7 @@ pub enum PathType { UTF16 = ctru_sys::PATH_UTF16, } +#[doc(alias = "FS_ArchiveID")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ArchiveID { @@ -391,6 +394,7 @@ impl File { /// # Errors /// /// This function will return an error if the file is not opened for writing. + #[doc(alias = "FSFILE_SetSize")] pub fn set_len(&mut self, size: u64) -> IoResult<()> { unsafe { let r = ctru_sys::FSFILE_SetSize(self.handle, size); @@ -426,6 +430,7 @@ impl File { } } + #[doc(alias = "FSFILE_Read")] fn read(&mut self, buf: &mut [u8]) -> IoResult { unsafe { let mut n_read = 0; @@ -449,6 +454,7 @@ impl File { unsafe { read_to_end_uninitialized(self, buf) } } + #[doc(alias = "FSFILE_Write")] fn write(&mut self, buf: &[u8]) -> IoResult { unsafe { let mut n_written = 0; @@ -576,6 +582,7 @@ impl OpenOptions { /// to the `archive` method. /// * Filesystem-level errors (full disk, etc). /// * Invalid combinations of open options. + #[doc(alias = "FSUSER_OpenFile")] pub fn open>(&mut self, path: P) -> IoResult { self._open(path.as_ref(), self.open_flags()) } @@ -694,6 +701,7 @@ impl<'a> DirEntry<'a> { /// but is not limited to just these cases: /// /// * User lacks permissions to create directory at `path` +#[doc(alias = "FSUSER_CreateDirectory")] pub fn create_dir>(arch: &mut Archive, path: P) -> IoResult<()> { unsafe { let path = to_utf16(path.as_ref()); @@ -720,6 +728,7 @@ pub fn create_dir>(arch: &mut Archive, path: P) -> IoResult<()> { /// /// * If any directory in the path specified by `path` does not already exist /// and it could not be created otherwise. +#[doc(alias = "FSUSER_CreateDirectory")] pub fn create_dir_all>(arch: &mut Archive, path: P) -> IoResult<()> { let path = path.as_ref(); let mut dir = PathBuf::new(); @@ -756,6 +765,7 @@ pub fn metadata>(arch: &Archive, path: P) -> IoResult { /// /// * The user lacks permissions to remove the directory at the provided path. /// * The directory isn't empty. +#[doc(alias = "FSUSER_DeleteDirectory")] pub fn remove_dir>(arch: &mut Archive, path: P) -> IoResult<()> { unsafe { let path = to_utf16(path.as_ref()); @@ -774,6 +784,7 @@ pub fn remove_dir>(arch: &mut Archive, path: P) -> IoResult<()> { /// # Errors /// /// see `file::remove_file` and `fs::remove_dir` +#[doc(alias = "FSUSER_DeleteDirectoryRecursively")] pub fn remove_dir_all>(arch: &mut Archive, path: P) -> IoResult<()> { unsafe { let path = to_utf16(path.as_ref()); @@ -798,6 +809,7 @@ pub fn remove_dir_all>(arch: &mut Archive, path: P) -> IoResult<( /// * The provided path doesn't exist. /// * The process lacks permissions to view the contents. /// * The path points at a non-directory file. +#[doc(alias = "FSUSER_OpenDirectory")] pub fn read_dir>(arch: &Archive, path: P) -> IoResult { unsafe { let mut handle = 0; @@ -826,6 +838,7 @@ pub fn read_dir>(arch: &Archive, path: P) -> IoResult { /// /// * path points to a directory. /// * The user lacks permissions to remove the file. +#[doc(alias = "FSUSER_DeleteFile")] pub fn remove_file>(arch: &mut Archive, path: P) -> IoResult<()> { unsafe { let path = to_utf16(path.as_ref()); @@ -849,6 +862,7 @@ pub fn remove_file>(arch: &mut Archive, path: P) -> IoResult<()> /// /// * from does not exist. /// * The user lacks permissions to view contents. +#[doc(alias = "FSUSER_RenameFile", alias = "FSUSER_RenameDirectory")] pub fn rename(arch: &mut Archive, from: P, to: Q) -> IoResult<()> where P: AsRef, @@ -972,6 +986,7 @@ impl Seek for File { } impl Drop for Fs { + #[doc(alias = "fsExit")] fn drop(&mut self) { unsafe { ctru_sys::fsExit(); @@ -980,6 +995,7 @@ impl Drop for Fs { } impl Drop for Archive { + #[doc(alias = "FSUSER_CloseArchive")] fn drop(&mut self) { unsafe { let _ = ctru_sys::FSUSER_CloseArchive(self.handle); @@ -988,6 +1004,7 @@ impl Drop for Archive { } impl Drop for File { + #[doc(alias = "FSFILE_Close")] fn drop(&mut self) { unsafe { let _ = ctru_sys::FSFILE_Close(self.handle); @@ -996,6 +1013,7 @@ impl Drop for File { } impl Drop for Dir { + #[doc(alias = "FSDIR_Close")] fn drop(&mut self) { unsafe { let _ = ctru_sys::FSDIR_Close(self.0); diff --git a/ctru-rs/src/services/gfx.rs b/ctru-rs/src/services/gfx.rs index dd6fbff..5629cf6 100644 --- a/ctru-rs/src/services/gfx.rs +++ b/ctru-rs/src/services/gfx.rs @@ -23,6 +23,7 @@ mod private { /// This trait is implemented by the screen structs for working with frame buffers and /// drawing to the screens. Graphics-related code can be made generic over this /// trait to work with any of the given screens. +#[doc(alias = "gfxScreen_t")] pub trait Screen: private::Sealed { /// Returns the `libctru` value for the Screen kind. fn as_raw(&self) -> ctru_sys::gfxScreen_t; @@ -34,6 +35,7 @@ pub trait Screen: private::Sealed { /// /// Note that the pointer of the framebuffer returned by this function can /// change after each call to this function if double buffering is enabled. + #[doc(alias = "gfxGetFramebuffer")] fn raw_framebuffer(&mut self) -> RawFrameBuffer { let mut width: u16 = 0; let mut height: u16 = 0; @@ -52,11 +54,13 @@ pub trait Screen: private::Sealed { /// /// [`Swap::swap_buffers`] must be called after this function for the configuration /// change to take effect. + #[doc(alias = "gfxSetDoubleBuffering")] fn set_double_buffering(&mut self, enabled: bool) { unsafe { ctru_sys::gfxSetDoubleBuffering(self.as_raw(), enabled) } } /// Gets the framebuffer format. + #[doc(alias = "gfxGetScreenFormat")] fn framebuffer_format(&self) -> FramebufferFormat { unsafe { ctru_sys::gfxGetScreenFormat(self.as_raw()) }.into() } @@ -65,6 +69,7 @@ pub trait Screen: private::Sealed { /// /// [`Swap::swap_buffers`] must be called after this method for the configuration /// change to take effect. + #[doc(alias = "gfxSetScreenFormat")] fn set_framebuffer_format(&mut self, fmt: FramebufferFormat) { unsafe { ctru_sys::gfxSetScreenFormat(self.as_raw(), fmt.into()) } } @@ -94,6 +99,7 @@ pub trait Swap: private::Sealed { /// [`Screen::set_framebuffer_format`], [`Screen::set_double_buffering`]). /// /// This should be called once per frame at most. + #[doc(alias = "gfxScreenSwapBuffers")] fn swap_buffers(&mut self); } @@ -126,6 +132,7 @@ impl Swap for BottomScreen { pub trait Flush: private::Sealed { /// Flushes the video buffer(s) for this screen. Note that you must still call /// [`Swap::swap_buffers`] after this method for the buffer contents to be displayed. + #[doc(alias = "gfxFlushBuffers")] fn flush_buffers(&mut self); } @@ -184,11 +191,12 @@ pub struct RawFrameBuffer<'screen> { screen: PhantomData<&'screen mut dyn Screen>, } -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -#[repr(u32)] /// Side of top screen framebuffer /// /// The top screen of the 3DS can have two separate sets of framebuffers to support its 3D functionality +#[doc(alias = "gfx3dSide_t")] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[repr(u32)] pub enum Side { /// The left framebuffer. This framebuffer is also the one used when 3D is disabled Left = ctru_sys::GFX_LEFT, @@ -215,6 +223,7 @@ impl Gfx { /// ``` /// Gfx::with_formats(FramebufferFormat::Bgr8, FramebufferFormat::Bgr8, false) /// ``` + #[doc(alias = "gfxInit")] pub fn new() -> Result { Gfx::with_formats(FramebufferFormat::Bgr8, FramebufferFormat::Bgr8, false) } @@ -223,6 +232,7 @@ impl Gfx { /// screens /// /// Use `Gfx::new()` instead of this function to initialize the module with default parameters + #[doc(alias = "gfxInit")] pub fn with_formats( top_fb_fmt: FramebufferFormat, bottom_fb_fmt: FramebufferFormat, @@ -269,6 +279,7 @@ impl TopScreen3D<'_> { } impl<'screen> From<&'screen RefCell> for TopScreen3D<'screen> { + #[doc(alias = "gfxSet3D")] fn from(top_screen: &'screen RefCell) -> Self { unsafe { ctru_sys::gfxSet3D(true); @@ -298,6 +309,7 @@ impl TopScreen { /// /// [`Swap::swap_buffers`] must be called after this method for the configuration /// to take effect. + #[doc(alias = "gfxSetWide")] pub fn set_wide_mode(&mut self, enable: bool) { unsafe { ctru_sys::gfxSetWide(enable); @@ -305,6 +317,7 @@ impl TopScreen { } /// Returns whether or not wide mode is enabled on the top screen. + #[doc(alias = "gfxIsWide")] pub fn is_wide(&self) -> bool { unsafe { ctru_sys::gfxIsWide() } } diff --git a/ctru-rs/src/services/gspgpu.rs b/ctru-rs/src/services/gspgpu.rs index 9f9219c..1510b29 100644 --- a/ctru-rs/src/services/gspgpu.rs +++ b/ctru-rs/src/services/gspgpu.rs @@ -1,5 +1,6 @@ //! GSPGPU service +#[doc(alias = "GSPGPU_Event")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Event { @@ -12,6 +13,7 @@ pub enum Event { DMA = ctru_sys::GSPGPU_EVENT_DMA, } +#[doc(alias = "GSPGPU_FramebufferFormat")] /// Framebuffer formats supported by the 3DS #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] @@ -45,6 +47,7 @@ impl FramebufferFormat { /// Waits for a GSPGPU event to occur. /// /// `discard_current` determines whether to discard the current event and wait for the next event +#[doc(alias = "gspWaitForEvent")] pub fn wait_for_event(ev: Event, discard_current: bool) { unsafe { ctru_sys::gspWaitForEvent(ev.into(), discard_current); diff --git a/ctru-rs/src/services/hid.rs b/ctru-rs/src/services/hid.rs index fa91657..8de66a1 100644 --- a/ctru-rs/src/services/hid.rs +++ b/ctru-rs/src/services/hid.rs @@ -54,6 +54,7 @@ pub struct Hid(()); /// Since this service requires no special or elevated permissions, errors are /// rare in practice. impl Hid { + #[doc(alias = "hidInit")] pub fn new() -> crate::Result { unsafe { ResultCode(ctru_sys::hidInit())?; @@ -64,12 +65,14 @@ impl Hid { /// Scans the HID service for all user input occurring on the current /// frame. This function should be called on every frame when polling /// for user input. + #[doc(alias = "hidScanInput")] pub fn scan_input(&mut self) { unsafe { ctru_sys::hidScanInput() }; } /// Returns a bitflag struct representing which buttons have just been pressed /// on the current frame (and were not pressed on the previous frame). + #[doc(alias = "hidKeysDown")] pub fn keys_down(&self) -> KeyPad { unsafe { let keys = ctru_sys::hidKeysDown(); @@ -79,6 +82,7 @@ impl Hid { /// Returns a bitflag struct representing which buttons have been held down /// during the current frame. + #[doc(alias = "hidKeysHeld")] pub fn keys_held(&self) -> KeyPad { unsafe { let keys = ctru_sys::hidKeysHeld(); @@ -88,6 +92,7 @@ impl Hid { /// Returns a bitflag struct representing which buttons have just been released on /// the current frame. + #[doc(alias = "hidKeysUp")] pub fn keys_up(&self) -> KeyPad { unsafe { let keys = ctru_sys::hidKeysUp(); @@ -100,6 +105,7 @@ impl Hid { /// # Notes /// /// (0, 0) represents the top left corner of the screen. + #[doc(alias = "hidTouchRead")] pub fn touch_position(&mut self) -> (u16, u16) { let mut res = ctru_sys::touchPosition { px: 0, py: 0 }; @@ -114,6 +120,7 @@ impl Hid { /// # Notes /// /// (0, 0) represents the center of the circle pad. + #[doc(alias = "hidCircleRead")] pub fn circlepad_position(&mut self) -> (i16, i16) { let mut res = ctru_sys::circlePosition { dx: 0, dy: 0 }; @@ -125,6 +132,7 @@ impl Hid { } impl Drop for Hid { + #[doc(alias = "hidExit")] fn drop(&mut self) { unsafe { ctru_sys::hidExit() }; } diff --git a/ctru-rs/src/services/ndsp/mod.rs b/ctru-rs/src/services/ndsp/mod.rs index 72e2413..7867048 100644 --- a/ctru-rs/src/services/ndsp/mod.rs +++ b/ctru-rs/src/services/ndsp/mod.rs @@ -14,6 +14,7 @@ use std::sync::Mutex; const NUMBER_OF_CHANNELS: u8 = 24; +#[doc(alias = "ndspOutputMode")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum OutputMode { @@ -37,6 +38,7 @@ pub struct AudioMix { raw: [f32; 12], } +#[doc(alias = "ndspInterpType")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum InterpolationType { @@ -80,6 +82,7 @@ impl Ndsp { /// /// This function will return an error if an instance of the `Ndsp` struct already exists /// or if there are any issues during initialization. + #[doc(alias = "ndspInit")] pub fn new() -> crate::Result { let _service_handler = ServiceReference::new( &NDSP_ACTIVE, @@ -121,6 +124,7 @@ impl Ndsp { } /// Set the audio output mode. Defaults to `OutputMode::Stereo`. + #[doc(alias = "ndspSetOutputMode")] pub fn set_output_mode(&mut self, mode: OutputMode) { unsafe { ctru_sys::ndspSetOutputMode(mode.into()) }; } @@ -128,21 +132,25 @@ impl Ndsp { impl Channel<'_> { /// Reset the channel + #[doc(alias = "ndspChnReset")] pub fn reset(&mut self) { unsafe { ctru_sys::ndspChnReset(self.id.into()) }; } /// Initialize the channel's parameters + #[doc(alias = "ndspChnInitParams")] pub fn init_parameters(&self) { unsafe { ctru_sys::ndspChnInitParams(self.id.into()) }; } /// Returns whether the channel is playing any audio. + #[doc(alias = "ndspChnIsPlaying")] pub fn is_playing(&self) -> bool { unsafe { ctru_sys::ndspChnIsPlaying(self.id.into()) } } /// Returns whether the channel's playback is currently paused. + #[doc(alias = "ndspChnIsPaused")] pub fn is_paused(&self) -> bool { unsafe { ctru_sys::ndspChnIsPaused(self.id.into()) } } @@ -155,37 +163,44 @@ impl Channel<'_> { /// Returns the index of the currently played sample. /// /// Because of how fast this value changes, it should only be used as a rough estimate of the current progress. + #[doc(alias = "ndspChnGetSamplePos")] pub fn sample_position(&self) -> usize { (unsafe { ctru_sys::ndspChnGetSamplePos(self.id.into()) }) as usize } /// Returns the channel's current wave sequence's id. + #[doc(alias = "ndspChnGetWaveBufSeq")] pub fn wave_sequence_id(&self) -> u16 { unsafe { ctru_sys::ndspChnGetWaveBufSeq(self.id.into()) } } /// Pause or un-pause the channel's playback. + #[doc(alias = "ndspChnSetPaused")] pub fn set_paused(&mut self, state: bool) { unsafe { ctru_sys::ndspChnSetPaused(self.id.into(), state) }; } /// Set the channel's output format. /// Change this setting based on the used sample's format. + #[doc(alias = "ndspChnSetFormat")] pub fn set_format(&mut self, format: AudioFormat) { unsafe { ctru_sys::ndspChnSetFormat(self.id.into(), format.into()) }; } /// Set the channel's interpolation mode. + #[doc(alias = "ndspChnSetInterp")] pub fn set_interpolation(&mut self, interp_type: InterpolationType) { unsafe { ctru_sys::ndspChnSetInterp(self.id.into(), interp_type.into()) }; } /// Set the channel's volume mix. + #[doc(alias = "ndspChnSetMix")] pub fn set_mix(&mut self, mix: &AudioMix) { unsafe { ctru_sys::ndspChnSetMix(self.id.into(), mix.as_raw().as_ptr().cast_mut()) } } /// Set the channel's rate of sampling. + #[doc(alias = "ndspChnSetRate")] pub fn set_sample_rate(&mut self, rate: f32) { unsafe { ctru_sys::ndspChnSetRate(self.id.into(), rate) }; } @@ -195,6 +210,7 @@ impl Channel<'_> { // We suggest using other wave formats when developing homebrew applications. /// Clear the wave buffer queue and stop playback. + #[doc(alias = "ndspChnWaveBufClear")] pub fn clear_queue(&mut self) { unsafe { ctru_sys::ndspChnWaveBufClear(self.id.into()) }; } @@ -206,6 +222,7 @@ impl Channel<'_> { /// /// `libctru` expects the user to manually keep the info data (in this case [`Wave`]) alive during playback. /// To ensure safety, checks within [`Wave`] will clear the whole channel queue if any queued [`Wave`] is dropped prematurely. + #[doc(alias = "ndspChnWaveBufAdd")] pub fn queue_wave(&mut self, wave: &mut Wave) -> std::result::Result<(), NdspError> { match wave.status() { WaveStatus::Playing | WaveStatus::Queued => return Err(NdspError::WaveBusy(self.id)), @@ -225,6 +242,7 @@ impl Channel<'_> { /// Refer to [`libctru`](https://libctru.devkitpro.org/channel_8h.html#a1da3b363c2edfd318c92276b527daae6) for more info. impl Channel<'_> { /// Enables/disables monopole filters. + #[doc(alias = "ndspChnIirMonoSetEnable")] pub fn iir_mono_set_enabled(&mut self, enable: bool) { unsafe { ctru_sys::ndspChnIirMonoSetEnable(self.id.into(), enable) }; } @@ -234,6 +252,7 @@ impl Channel<'_> { /// # Notes /// /// This is a lower quality filter than the Biquad alternative. + #[doc(alias = "ndspChnIirMonoSetParamsHighPassFilter")] pub fn iir_mono_set_params_high_pass_filter(&mut self, cut_off_freq: f32) { unsafe { ctru_sys::ndspChnIirMonoSetParamsHighPassFilter(self.id.into(), cut_off_freq) }; } @@ -243,16 +262,19 @@ impl Channel<'_> { /// # Notes /// /// This is a lower quality filter than the Biquad alternative. + #[doc(alias = "ndspChnIirMonoSetParamsLowPassFilter")] pub fn iir_mono_set_params_low_pass_filter(&mut self, cut_off_freq: f32) { unsafe { ctru_sys::ndspChnIirMonoSetParamsLowPassFilter(self.id.into(), cut_off_freq) }; } /// Enables/disables biquad filters. + #[doc(alias = "ndspChnIirBiquadSetEnable")] pub fn iir_biquad_set_enabled(&mut self, enable: bool) { unsafe { ctru_sys::ndspChnIirBiquadSetEnable(self.id.into(), enable) }; } /// Sets the biquad to be a high pass filter. + #[doc(alias = "ndspChnIirBiquadSetParamsHighPassFilter")] pub fn iir_biquad_set_params_high_pass_filter(&mut self, cut_off_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsHighPassFilter(self.id.into(), cut_off_freq, quality) @@ -260,6 +282,7 @@ impl Channel<'_> { } /// Sets the biquad to be a low pass filter. + #[doc(alias = "ndspChnIirBiquadSetParamsLowPassFilter")] pub fn iir_biquad_set_params_low_pass_filter(&mut self, cut_off_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsLowPassFilter(self.id.into(), cut_off_freq, quality) @@ -267,6 +290,7 @@ impl Channel<'_> { } /// Sets the biquad to be a notch filter. + #[doc(alias = "ndspChnIirBiquadSetParamsNotchFilter")] pub fn iir_biquad_set_params_notch_filter(&mut self, notch_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsNotchFilter(self.id.into(), notch_freq, quality) @@ -274,6 +298,7 @@ impl Channel<'_> { } /// Sets the biquad to be a band pass filter. + #[doc(alias = "ndspChnIirBiquadSetParamsBandPassFilter")] pub fn iir_biquad_set_params_band_pass_filter(&mut self, mid_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsBandPassFilter(self.id.into(), mid_freq, quality) @@ -281,6 +306,7 @@ impl Channel<'_> { } /// Sets the biquad to be a peaking equalizer. + #[doc(alias = "ndspChnIirBiquadSetParamsPeakingEqualizer")] pub fn iir_biquad_set_params_peaking_equalizer( &mut self, central_freq: f32, @@ -448,6 +474,7 @@ impl fmt::Display for NdspError { impl error::Error for NdspError {} impl Drop for Ndsp { + #[doc(alias = "ndspExit")] fn drop(&mut self) { for i in 0..NUMBER_OF_CHANNELS { self.channel(i).unwrap().reset(); diff --git a/ctru-rs/src/services/ps.rs b/ctru-rs/src/services/ps.rs index 1d5bd69..ee96216 100644 --- a/ctru-rs/src/services/ps.rs +++ b/ctru-rs/src/services/ps.rs @@ -6,6 +6,7 @@ use crate::error::ResultCode; use crate::Result; +#[doc(alias = "PS_AESAlgorithm")] #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum AESAlgorithm { @@ -17,6 +18,7 @@ pub enum AESAlgorithm { CcmDec = ctru_sys::PS_ALGORITHM_CCM_DEC, } +#[doc(alias = "PS_AESKeyType")] #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum AESKeyType { @@ -35,6 +37,7 @@ pub enum AESKeyType { pub struct Ps(()); impl Ps { + #[doc(alias = "psInit")] pub fn new() -> Result { unsafe { ResultCode(ctru_sys::psInit())?; @@ -42,6 +45,7 @@ impl Ps { } } + #[doc(alias = "PS_GetLocalFriendCodeSeed")] pub fn local_friend_code_seed(&self) -> crate::Result { let mut seed: u64 = 0; @@ -49,6 +53,7 @@ impl Ps { Ok(seed) } + #[doc(alias = "PS_GetDeviceId")] pub fn device_id(&self) -> crate::Result { let mut id: u32 = 0; @@ -56,6 +61,7 @@ impl Ps { Ok(id) } + #[doc(alias = "PS_GenerateRandomBytes")] pub fn generate_random_bytes(&self, out: &mut [u8]) -> crate::Result<()> { ResultCode(unsafe { ctru_sys::PS_GenerateRandomBytes(out.as_mut_ptr().cast(), out.len()) @@ -65,6 +71,7 @@ impl Ps { } impl Drop for Ps { + #[doc(alias = "psExit")] fn drop(&mut self) { unsafe { ctru_sys::psExit(); diff --git a/ctru-rs/src/services/romfs.rs b/ctru-rs/src/services/romfs.rs index c87b884..3c5afa8 100644 --- a/ctru-rs/src/services/romfs.rs +++ b/ctru-rs/src/services/romfs.rs @@ -25,6 +25,7 @@ pub struct RomFS { static ROMFS_ACTIVE: Mutex = Mutex::new(0); impl RomFS { + #[doc(alias = "romfsMountSelf")] pub fn new() -> crate::Result { let _service_handler = ServiceReference::new( &ROMFS_ACTIVE, @@ -44,6 +45,11 @@ impl RomFS { } } +impl Drop for RomFS { + #[doc(alias = "romfsUnmount")] + fn drop(&mut self) {} +} + #[cfg(test)] mod tests { use super::*; diff --git a/ctru-rs/src/services/soc.rs b/ctru-rs/src/services/soc.rs index 5b9c696..2bbfe50 100644 --- a/ctru-rs/src/services/soc.rs +++ b/ctru-rs/src/services/soc.rs @@ -25,6 +25,7 @@ impl Soc { /// # Errors /// /// This function will return an error if the `Soc` service is already initialized + #[doc(alias = "socInit")] pub fn new() -> crate::Result { Self::init_with_buffer_size(0x100000) } @@ -35,6 +36,7 @@ impl Soc { /// # Errors /// /// This function will return an error if the `Soc` service is already initialized + #[doc(alias = "socInit")] pub fn init_with_buffer_size(num_bytes: usize) -> crate::Result { let _service_handler = ServiceReference::new( &SOC_ACTIVE, @@ -61,6 +63,7 @@ impl Soc { } /// IP Address of the Nintendo 3DS system. + #[doc(alias = "gethostid")] pub fn host_address(&self) -> Ipv4Addr { let raw_id = unsafe { libc::gethostid() }; Ipv4Addr::from(raw_id.to_ne_bytes()) @@ -73,6 +76,7 @@ impl Soc { /// /// Returns an error if a connection cannot be established to the server, or /// output was already previously redirected. + #[doc(alias = "link3dsConnectToHost")] pub fn redirect_to_3dslink(&mut self, stdout: bool, stderr: bool) -> crate::Result<()> { if self.sock_3dslink >= 0 { return Err(Error::OutputAlreadyRedirected); @@ -92,6 +96,7 @@ impl Soc { } impl Drop for Soc { + #[doc(alias = "socExit")] fn drop(&mut self) { if self.sock_3dslink >= 0 { unsafe { diff --git a/ctru-rs/src/services/sslc.rs b/ctru-rs/src/services/sslc.rs index 341155f..d248f0e 100644 --- a/ctru-rs/src/services/sslc.rs +++ b/ctru-rs/src/services/sslc.rs @@ -8,6 +8,7 @@ pub struct SslC(()); impl SslC { /// Initialize the service + #[doc(alias = "sslcInit")] pub fn new() -> crate::Result { unsafe { ResultCode(ctru_sys::sslcInit(0))?; @@ -17,6 +18,7 @@ impl SslC { } impl Drop for SslC { + #[doc(alias = "sslcExit")] fn drop(&mut self) { unsafe { ctru_sys::sslcExit() }; }