commonlibsse_ng\re\u\UserEvents/
input_context_id.rs

1/// NOTE: Entire enum needs more REing
2#[commonlibsse_ng_derive_internal::ffi_enum]
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
4#[repr(u32)]
5#[non_exhaustive]
6pub enum INPUT_CONTEXT_ID_SE {
7    Gameplay = 0,
8    MenuMode,
9    Console,
10    ItemMenu,
11    Inventory,
12    DebugText,
13    Favorites,
14    Map,
15    Stats,
16    Cursor,
17    Book,
18    DebugOverlay,
19    Journal,
20    TFCMode,
21    MapDebug,
22    Lockpicking,
23    Favor,
24}
25const _: () = assert!(INPUT_CONTEXT_ID_SE_CEnum::count() == 17);
26
27/// NOTE: Entire enum needs more REing
28#[commonlibsse_ng_derive_internal::ffi_enum]
29#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
30#[repr(u32)]
31#[non_exhaustive]
32pub enum INPUT_CONTEXT_ID_AE {
33    Gameplay = 0,
34    MenuMode,
35    Console,
36    ItemMenu,
37    Inventory,
38    DebugText,
39    Favorites,
40    Map,
41    Stats,
42    Cursor,
43    Book,
44    DebugOverlay,
45    Journal,
46    TFCMode,
47    MapDebug,
48    Lockpicking,
49    Marketplace, // <- AE only
50    Favor,
51}
52const _: () = assert!(INPUT_CONTEXT_ID_AE_CEnum::count() == 18);
53
54/// NOTE: Entire enum needs more REing
55#[commonlibsse_ng_derive_internal::ffi_enum]
56#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
57#[repr(u32)]
58#[non_exhaustive]
59pub enum INPUT_CONTEXT_ID_VR {
60    Gameplay = 0,
61    MenuMode,
62    Console,
63    ItemMenu,
64    Inventory,
65    DebugText,
66    Favorites,
67    Map,
68    Stats,
69    Cursor,
70    Book,
71    DebugOverlay,
72    Journal,
73    TFCMode,
74    MapDebug,
75    Lockpicking,
76    Favor,
77    // None = 22, // More input contexts might be available, needs REing
78}
79const _: () = assert!(INPUT_CONTEXT_ID_VR_CEnum::count() == 17);
80
81/// `INPUT_CONTEXT_ID` to store the raw value.
82///
83/// This is a generic type that exists because the correct value varies depending on the SE, AE , VR environment.
84#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
85#[repr(transparent)]
86pub struct INPUT_CONTEXT_ID(pub u32);
87const _: () = assert!(core::mem::size_of::<INPUT_CONTEXT_ID>() == 0x4);
88
89impl INPUT_CONTEXT_ID {
90    /// Try to cast valid enum for SE, AE.
91    #[inline]
92    pub const fn as_se(&self) -> Option<INPUT_CONTEXT_ID_SE> {
93        INPUT_CONTEXT_ID_SE_CEnum(self.0).to_enum()
94    }
95
96    /// Try to cast valid enum for AE.
97    #[inline]
98    pub const fn as_ae(&self) -> Option<INPUT_CONTEXT_ID_AE> {
99        INPUT_CONTEXT_ID_AE_CEnum(self.0).to_enum()
100    }
101
102    /// Try to cast valid enum for VR.
103    #[inline]
104    pub const fn as_vr(&self) -> Option<INPUT_CONTEXT_ID_VR> {
105        INPUT_CONTEXT_ID_VR_CEnum(self.0).to_enum()
106    }
107}