Skip to content

Commit 693423a

Browse files
lorenzofellettisajattack
authored andcommitted
feat!: add PspUtilityDialogState enum
BREAKING CHANGE: `SceUtilityOskParams` state field type changed to `PspUtilityDialogState`
1 parent 73dc8d5 commit 693423a

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

psp/src/sys/utility.rs

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ pub enum UtilityDialogButtonAccept {
4848
Cross,
4949
}
5050

51+
#[repr(u32)]
52+
#[derive(Debug, Clone, Copy, TryFromPrimitive)]
53+
/// Return-values for the various `sceUtility***GetStatus()` functions, when they don't return an error.
54+
///
55+
/// # Example
56+
///
57+
/// ```no_run
58+
/// let status: PspUtilityDialogState = unsafe { sceUtilityOskGetStatus().try_into().unwrap() };
59+
/// ```
60+
pub enum PspUtilityDialogState {
61+
None,
62+
Init,
63+
Visible,
64+
Quit,
65+
Finished,
66+
}
67+
5168
#[repr(u32)]
5269
#[derive(Debug, Clone, Copy)]
5370
pub enum SceUtilityOskInputLanguage {
@@ -695,8 +712,8 @@ pub struct SceUtilityOskParams {
695712
pub datacount: i32,
696713
/// Pointer to the start of the data for the input fields
697714
pub data: *mut SceUtilityOskData,
698-
/// The local OSK state, one of `SceUtilityOskState`
699-
pub state: SceUtilityOskState,
715+
/// The local OSK state, one of [`PspUtilityDialogState`]
716+
pub state: PspUtilityDialogState,
700717
/// Unknown. Pass 0
701718
pub unk_60: i32,
702719
}
@@ -783,7 +800,7 @@ psp_extern! {
783800
///
784801
/// # Return Value
785802
///
786-
/// one of DialogState on success, < 0 on error
803+
/// one of [`PspUtilityDialogState`] on success, < 0 on error
787804
pub fn sceUtilityNetconfGetStatus() -> i32;
788805

789806
#[psp(0x5EEE6548)]
@@ -1033,9 +1050,23 @@ psp_extern! {
10331050
#[psp(0xF3F76017)]
10341051
/// Get the status of a on-screen keyboard currently active.
10351052
///
1053+
/// # Example
1054+
///
1055+
/// ```
1056+
/// unsafe {
1057+
/// let status: PspUtilityDialogState = sceUtilityOskGetStatus().try_into().unwrap();
1058+
/// match status {
1059+
/// PspUtilityDialogState::Visible => {
1060+
/// // do something
1061+
/// }
1062+
/// // ...
1063+
/// }
1064+
/// }
1065+
/// ```
1066+
///
10361067
/// # Return Value
10371068
///
1038-
/// the current status of the keyboard. See ::DialogState for details.
1069+
/// the current status of the keyboard. See [`PspUtilityDialogState`] for details.
10391070
pub fn sceUtilityOskGetStatus() -> i32;
10401071

10411072
#[psp(0x1579a159)]

0 commit comments

Comments
 (0)