1use core::ffi::CStr;
2
3use alloc::string::{String, ToString};
4
5#[allow(unused_imports)]
6use self::super::root;
7pub type FocusHandlingMode = i32;
8pub type PerformanceMode = u32;
9#[repr(C)]
10#[derive(Debug, Copy, Clone)]
11pub struct DisplayVersion {
12 pub name: [u8; 16usize],
13}
14
15extern "C" {
16 #[link_name = "\u{1}_ZN2nn2oe10InitializeEv"]
17 pub fn Initialize();
18}
19extern "C" {
20 #[link_name = "\u{1}_ZN2nn2oe27SetPerformanceConfigurationENS0_15PerformanceModeEi"]
21 pub fn SetPerformanceConfiguration(arg1: root::nn::oe::PerformanceMode, arg2: u32);
22}
23extern "C" {
24 #[link_name = "\u{1}_ZN2nn2oe27GetPerformanceConfigurationENS0_15PerformanceModeE"]
25 pub fn GetPerformanceConfiguration(arg1: root::nn::oe::PerformanceMode) -> u32;
26}
27extern "C" {
28 #[link_name = "\u{1}_ZN2nn2oe16GetOperationModeEv"]
29 pub fn GetOperationMode() -> root::s32;
30}
31extern "C" {
32 #[link_name = "\u{1}_ZN2nn2oe18GetPerformanceModeEv"]
33 pub fn GetPerformanceMode() -> PerformanceMode;
34}
35extern "C" {
36 #[link_name = "\u{1}_ZN2nn2oe28SetResumeNotificationEnabledEb"]
37 pub fn SetResumeNotificationEnabled(arg1: bool);
38}
39extern "C" {
40 #[link_name = "\u{1}_ZN2nn2oe42SetOperationModeChangedNotificationEnabledEb"]
41 pub fn SetOperationModeChangedNotificationEnabled(arg1: bool);
42}
43extern "C" {
44 #[link_name = "\u{1}_ZN2nn2oe44SetPerformanceModeChangedNotificationEnabledEb"]
45 pub fn SetPerformanceModeChangedNotificationEnabled(arg1: bool);
46}
47extern "C" {
48 #[link_name = "\u{1}_ZN2nn2oe20SetFocusHandlingModeEi"]
49 pub fn SetFocusHandlingMode(arg1: root::nn::oe::FocusHandlingMode);
50}
51extern "C" {
52 #[link_name = "\u{1}_ZN2nn2oe25TryPopNotificationMessageEPj"]
53 pub fn TryPopNotificationMessage(arg1: *mut u32) -> bool;
54}
55extern "C" {
56 #[link_name = "\u{1}_ZN2nn2oe20GetCurrentFocusStateEv"]
57 pub fn GetCurrentFocusState() -> root::s32;
58}
59extern "C" {
60 #[link_name = "\u{1}_ZN2nn2oe23EnableGamePlayRecordingEPvm"]
61 pub fn EnableGamePlayRecording(arg1: *mut u8, arg2: u64);
62}
63extern "C" {
64 #[link_name = "\u{1}_ZN2nn2oe37IsUserInactivityDetectionTimeExtendedEv"]
65 pub fn IsUserInactivityDetectionTimeExtended() -> bool;
66}
67
68pub fn is_user_inactivity_detection_time_extended() -> bool {
69 let result = unsafe { IsUserInactivityDetectionTimeExtended() };
70
71 result
72}
73extern "C" {
74 #[link_name = "\u{1}_ZN2nn2oe38SetUserInactivityDetectionTimeExtendedEb"]
75 pub fn SetUserInactivityDetectionTimeExtended(arg1: bool);
76}
77
78pub fn set_user_inactivity_detection_time_extended(do_extend: bool) {
79 unsafe { SetUserInactivityDetectionTimeExtended(do_extend); }
80}
81
82extern "C" {
83 #[link_name = "\u{1}_ZN2nn2oe17FinishStartupLogoEv"]
84 pub fn FinishStartupLogo();
85}
86
87pub fn finish_startup_logo() {
88 unsafe { FinishStartupLogo(); }
89}
90extern "C" {
91 #[link_name = "\u{1}_ZN2nn2oe18ReportUserIsActiveEv"]
92 pub fn ReportUserIsActive();
93}
94extern "C" {
95 #[link_name = "\u{1}_ZN2nn2oe18GetDesiredLanguageEv"]
96 pub fn GetDesiredLanguage() -> root::nn::settings::LanguageCode;
97}
98
99pub fn get_desired_language() -> String {
100 let mut result = "";
101
102 let lang_code = unsafe { GetDesiredLanguage() };
103
104 result = core::str::from_utf8(&lang_code.code).unwrap();
105
106 return result.to_string();
107}
108
109extern "C" {
110 #[link_name = "\u{1}_ZN2nn2oe17GetDisplayVersionEPNS0_14DisplayVersionE"]
111 pub fn GetDisplayVersion(arg1: *mut root::nn::oe::DisplayVersion);
112}
113extern "C" {
114 #[link_name = "\u{1}_ZN2nn2oe21IsCpuOverclockEnabledEv"]
115 pub fn IsCpuOverclockEnabled() -> bool;
116}
117extern "C" {
118 #[link_name = "\u{1}_ZN2nn2oe22SetCpuOverclockEnabledEb"]
119 pub fn SetCpuOverclockEnabled(enabled: bool);
120}
121
122pub fn get_display_version() -> String {
123 let mut ver = DisplayVersion { name: [0; 16] };
124
125 unsafe {
126 GetDisplayVersion(&mut ver);
127 }
128 let string = CStr::from_bytes_until_nul(&ver.name).unwrap();
129
130 return string.to_str().unwrap().to_string();
131}
132
133#[repr(C)]
134#[derive(Debug, Copy, Clone)]
135pub enum CpuBoostMode {
136 Disabled = 0,
137 Boost = 1,
138}
139extern "C" {
140 #[link_name = "\u{1}_ZN2nn2oe15SetCpuBoostModeENS0_12CpuBoostModeE"]
141 pub fn SetCpuBoostMode(mode: CpuBoostMode);
142}
143
144pub fn set_cpu_boost_mode(mode: CpuBoostMode) {
145 unsafe {
146 SetCpuBoostMode(mode);
147 }
148}
149
150extern "C" {
151 #[link_name = "_ZN2nn2oe14RestartProgramEPKvm"]
152 pub fn RestartProgram(argv: *const u8, argc: u32) -> !;
153}
154
155#[deprecated = "This will be removed in the next major release, please switch to restart_program_no_args()"]
156pub fn RestartProgramNoArgs() -> ! {
157 unsafe { RestartProgram("".as_ptr() as _, 0) }
158}
159
160pub fn restart_program_no_args() -> ! {
161 unsafe { RestartProgram("".as_ptr() as _, 0) }
162}
163extern "C" {
164 #[link_name = "\u{1}_ZN2nn2oe28RequestToRelaunchApplicationEv"]
165 pub fn RequestToRelaunchApplication() -> !;
166}
167
168pub fn request_to_relaunch_application() -> ! {
169 unsafe { RequestToRelaunchApplication(); }
170}
171extern "C" {
172 #[link_name = "\u{1}_ZN2nn2oe15ExitApplicationEv"]
173 pub fn ExitApplication() -> !;
174}
175pub fn exit_application() -> ! {
176 unsafe { ExitApplication(); }
177}