From c3021fe39d623ed12a0c02c61e6c8e0b6eb89ca5 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Sun, 24 Sep 2023 18:50:08 +0200 Subject: [PATCH] Translate impls to static inline --- ctru-rs/src/applets/mii_selector.rs | 4 +--- ctru-rs/src/services/hid.rs | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ctru-rs/src/applets/mii_selector.rs b/ctru-rs/src/applets/mii_selector.rs index bdf661b..2353d7d 100644 --- a/ctru-rs/src/applets/mii_selector.rs +++ b/ctru-rs/src/applets/mii_selector.rs @@ -247,9 +247,7 @@ impl MiiSelector { /// If there's no Mii at that index, the cursor will start at the Mii with the index 0. #[doc(alias = "miiSelectorSetInitialIndex")] pub fn set_initial_index(&mut self, index: usize) { - // This function is static inline in libctru - // https://github.com/devkitPro/libctru/blob/af5321c78ee5c72a55b526fd2ed0d95ca1c05af9/libctru/include/3ds/applets/miiselector.h#L155 - self.config.initial_index = index as u32; + unsafe { ctru_sys::miiSelectorSetInitialIndex(self.config.as_mut(), index as u32) }; } /// Launch the Mii Selector. diff --git a/ctru-rs/src/services/hid.rs b/ctru-rs/src/services/hid.rs index 5daabb1..808ff03 100644 --- a/ctru-rs/src/services/hid.rs +++ b/ctru-rs/src/services/hid.rs @@ -374,8 +374,7 @@ impl Hid { /// ``` #[doc(alias = "osGet3DSliderState")] pub fn slider_3d(&self) -> f32 { - // TODO: Replace with the static inline function `osGet3DSliderState`, which works the exact same way. - unsafe { (*(ctru_sys::OS_SHAREDCFG_VADDR as *mut ctru_sys::osSharedConfig_s)).slider_3d } + unsafe { ctru_sys::osGet3DSliderState() } } /// Activate/deactivate the console's acceleration sensor.