commonlibsse_ng\skse\impls/
stab.rs1#![allow(improper_ctypes)]
3#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5#![allow(non_upper_case_globals)]
6
7use core::ffi::{c_char, c_void};
8
9#[repr(transparent)]
13#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
14pub struct PluginHandle(pub u32);
15
16pub const INVALID_PLUGIN_HANDLE: PluginHandle = PluginHandle(u32::MAX);
18
19#[repr(C)]
21#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
22pub struct PluginInfo {
23 pub infoVersion: u32,
25 pub name: *const c_char,
27 pub version: u32,
29}
30
31impl PluginInfo {
32 pub const VERSION: u32 = 1;
34}
35
36impl Default for PluginInfo {
37 fn default() -> Self {
39 Self { infoVersion: 0, name: c"".as_ptr(), version: 0 }
40 }
41}
42
43#[repr(C)]
45#[derive(Debug)]
46pub struct SKSEInterface {
47 pub(crate) skseVersion: u32,
49 pub(crate) runtimeVersion: u32,
51 pub(crate) editorVersion: u32,
53 pub(crate) isEditor: u32,
55 pub(crate) QueryInterface: unsafe extern "C" fn(u32) -> *mut c_void,
57 pub(crate) GetPluginHandle: unsafe extern "C" fn() -> PluginHandle,
59 pub(crate) GetReleaseIndex: unsafe extern "C" fn() -> u32,
61 pub(crate) GetPluginInfo: unsafe extern "C" fn(*const c_char) -> *const PluginInfo,
63}
64
65#[repr(u32)]
67#[derive(Debug)]
68pub enum InterfaceKind {
69 Invalid = 0,
70 ScaleForm,
71 Papyrus,
72 Serialization,
73 Task,
74 Messaging,
75 Object,
76 Trampoline,
77 Total,
79}
80
81#[repr(C)]
83#[derive(Debug)]
84pub struct SKSEMessagingInterface {
85 pub interfaceVersion: u32,
87 pub RegisterListener: unsafe extern "C" fn(PluginHandle, *const c_char, *mut c_void) -> bool,
89 pub Dispatch: unsafe extern "C" fn(PluginHandle, u32, *mut c_void, u32, *const c_char) -> bool,
91 pub GetEventDispatcher: unsafe extern "C" fn(u32) -> *mut c_void,
93}
94
95#[repr(C)]
97#[derive(Debug)]
98pub struct SKSEObjectInterface {
99 pub interfaceVersion: u32,
101 pub GetDelayFunctorManager: unsafe extern "C" fn() -> *mut SKSEDelayFunctorManager,
103 pub GetObjectRegistry: unsafe extern "C" fn() -> *mut SKSEObjectRegistry,
105 pub GetPersistentObjectStorage: unsafe extern "C" fn() -> *mut SKSEPersistentObjectStorage,
107}
108
109#[repr(C)]
111#[derive(Debug)]
112pub struct SKSEPapyrusInterface {
113 pub interfaceVersion: u32,
115 pub Register: unsafe extern "C" fn(*mut c_void) -> bool,
117}
118
119#[repr(C)]
121#[derive(Debug)]
122pub struct SKSEScaleformInterface {
123 pub interfaceVersion: u32,
125 pub Register: unsafe extern "C" fn(*const c_char, *mut c_void) -> bool,
127 pub RegisterForInventory: unsafe extern "C" fn(*mut c_void),
129}
130
131#[repr(C)]
133#[derive(Debug)]
134pub struct SKSESerializationInterface {
135 pub version: u32,
137 pub SetUniqueId: unsafe extern "C" fn(PluginHandle, u32),
139 pub SetRevertCallback: unsafe extern "C" fn(PluginHandle, *mut c_void),
141 pub SetSaveCallback: unsafe extern "C" fn(PluginHandle, *mut c_void),
143 pub SetLoadCallback: unsafe extern "C" fn(PluginHandle, *mut c_void),
145 pub SetFormDeleteCallback: unsafe extern "C" fn(PluginHandle, *mut c_void),
147 pub WriteRecord: unsafe extern "C" fn(u32, u32, *const c_void, u32) -> bool,
149 pub OpenRecord: unsafe extern "C" fn(u32, u32) -> bool,
151 pub WriteRecordData: unsafe extern "C" fn(*const c_void, u32) -> bool,
153 pub GetNextRecordInfo: unsafe extern "C" fn(*mut u32, *mut u32, *mut u32) -> bool,
155 pub ReadRecordData: unsafe extern "C" fn(*mut c_void, u32) -> u32,
157 pub ResolveHandle: unsafe extern "C" fn(u64, *mut u64) -> bool,
159 pub ResolveFormId: unsafe extern "C" fn(u32, *mut u32) -> bool,
161}
162
163#[repr(C)]
165#[derive(Debug)]
166pub struct SKSETaskInterface {
167 pub interfaceVersion: u32,
169 pub AddTask: unsafe extern "C" fn(*mut c_void),
171 pub AddUiTask: unsafe extern "C" fn(*mut c_void),
173}
174
175#[repr(C)]
177#[derive(Debug)]
178pub struct SKSETrampolineInterface {
179 pub interfaceVersion: u32,
181 pub AllocateFromBranchPool: unsafe extern "C" fn(PluginHandle, usize) -> *mut c_void,
183 pub AllocateFromLocalPool: unsafe extern "C" fn(PluginHandle, usize) -> *mut c_void,
185}
186
187#[repr(C)]
189#[derive(Debug)]
190pub struct SKSEDelayFunctorManager;
191
192#[repr(C)]
194#[derive(Debug)]
195pub struct SKSEObjectRegistry;
196
197#[repr(C)]
199#[derive(Debug)]
200pub struct SKSEPersistentObjectStorage;
201
202#[repr(C)]
204#[derive(Debug)]
205pub struct TaskDelegate {
206 pub vtbl: *const TaskDelegateVirtualTable,
207}
208
209#[repr(C)]
211#[derive(Debug)]
212pub struct UiDelegateV1 {
213 pub vtbl: *const UiDelegateV1VirtualTable,
214}
215
216#[repr(C)]
218pub struct TaskDelegateVirtualTable {
219 pub Run: unsafe extern "C" fn(this: *const c_void),
221 pub Dispose: fn(this: *const c_void),
223}
224
225#[repr(C)]
227pub struct UiDelegateV1VirtualTable {
228 pub Run: fn(this: *const c_void),
230 pub Dispose: fn(this: *const c_void),
232}