rrplug 4.2.1

framework for R2Northstar plugins
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

use super::squirreldatatypes::*;

#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum SQRESULT {
    SQRESULT_ERROR = -1,
    SQRESULT_NULL = 0,
    SQRESULT_NOTNULL = 1,
}
pub type SQFunction =
    ::std::option::Option<unsafe extern "C" fn(sqvm: *mut HSquirrelVM) -> SQRESULT>;
#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum eSQReturnType {
    Float = 1,
    Vector = 3,
    Integer = 5,
    Boolean = 6,
    Entity = 13,
    String = 33,
    Default = 32,
    Arrays = 37,
    Asset = 40,
    Table = 38,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CompileBufferState {
    pub buffer: *const SQChar,
    pub bufferPlusLength: *const SQChar,
    pub bufferAgain: *const SQChar,
}
#[test]
fn bindgen_test_layout_CompileBufferState() {
    const UNINIT: ::std::mem::MaybeUninit<CompileBufferState> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<CompileBufferState>(),
        24usize,
        concat!("Size of: ", stringify!(CompileBufferState))
    );
    assert_eq!(
        ::std::mem::align_of::<CompileBufferState>(),
        8usize,
        concat!("Alignment of ", stringify!(CompileBufferState))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(CompileBufferState),
            "::",
            stringify!(buffer)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).bufferPlusLength) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(CompileBufferState),
            "::",
            stringify!(bufferPlusLength)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).bufferAgain) as usize - ptr as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(CompileBufferState),
            "::",
            stringify!(bufferAgain)
        )
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SQFuncRegistration {
    pub squirrelFuncName: *const ::std::os::raw::c_char,
    pub cppFuncName: *const ::std::os::raw::c_char,
    pub helpText: *const ::std::os::raw::c_char,
    pub returnTypeString: *const ::std::os::raw::c_char,
    pub argTypes: *const ::std::os::raw::c_char,
    pub unknown1: u32,
    pub devLevel: u32,
    pub shortNameMaybe: *const ::std::os::raw::c_char,
    pub unknown2: u32,
    pub returnType: eSQReturnType,
    pub externalBufferPointer: *mut u32,
    pub externalBufferSize: u64,
    pub unknown3: u64,
    pub unknown4: u64,
    pub funcPtr: SQFunction,
}
#[test]
fn bindgen_test_layout_SQFuncRegistration() {
    const UNINIT: ::std::mem::MaybeUninit<SQFuncRegistration> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<SQFuncRegistration>(),
        104usize,
        concat!("Size of: ", stringify!(SQFuncRegistration))
    );
    assert_eq!(
        ::std::mem::align_of::<SQFuncRegistration>(),
        8usize,
        concat!("Alignment of ", stringify!(SQFuncRegistration))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).squirrelFuncName) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(squirrelFuncName)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).cppFuncName) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(cppFuncName)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).helpText) as usize - ptr as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(helpText)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).returnTypeString) as usize - ptr as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(returnTypeString)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).argTypes) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(argTypes)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).unknown1) as usize - ptr as usize },
        40usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(unknown1)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).devLevel) as usize - ptr as usize },
        44usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(devLevel)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).shortNameMaybe) as usize - ptr as usize },
        48usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(shortNameMaybe)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).unknown2) as usize - ptr as usize },
        56usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(unknown2)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).returnType) as usize - ptr as usize },
        60usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(returnType)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).externalBufferPointer) as usize - ptr as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(externalBufferPointer)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).externalBufferSize) as usize - ptr as usize },
        72usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(externalBufferSize)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).unknown3) as usize - ptr as usize },
        80usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(unknown3)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).unknown4) as usize - ptr as usize },
        88usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(unknown4)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).funcPtr) as usize - ptr as usize },
        96usize,
        concat!(
            "Offset of field: ",
            stringify!(SQFuncRegistration),
            "::",
            stringify!(funcPtr)
        )
    );
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum ScriptContext {
    SERVER = 0,
    CLIENT = 1,
    UI = 2,
}
impl TryFrom<i32> for ScriptContext {
    type Error = i32;

    fn try_from(value: i32) -> Result<Self, Self::Error> {
        if value <= Self::UI as i32 && value >= Self::SERVER as i32 {
            Ok(unsafe { std::mem::transmute::<i32, ScriptContext>(value) })
        } else {
            Err(value)
        }
    }
}
impl std::fmt::Display for ScriptContext {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            ScriptContext::SERVER => f.write_str("SERVER"),
            ScriptContext::CLIENT => f.write_str("CLIENT"),
            ScriptContext::UI => f.write_str("UI"),
        }
    }
}
pub type RegisterSquirrelFuncType = unsafe extern "C" fn(
    sqvm: *mut CSquirrelVM,
    funcReg: *mut SQFuncRegistration,
    unknown: ::std::os::raw::c_char,
) -> i64;
pub type sq_defconstType =
    unsafe extern "C" fn(sqvm: *mut CSquirrelVM, name: *const SQChar, value: ::std::os::raw::c_int);
pub type sq_compilebufferType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    compileBuffer: *mut CompileBufferState,
    file: *const ::std::os::raw::c_char,
    a1: ::std::os::raw::c_int,
    bShouldThrowError: SQBool,
) -> SQRESULT;
pub type sq_callType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    iArgs: SQInteger,
    bShouldReturn: SQBool,
    bThrowError: SQBool,
) -> SQRESULT;
pub type sq_raiseerrorType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, pError: *const SQChar) -> SQInteger;
pub type sq_compilefileType = unsafe extern "C" fn(
    sqvm: *mut CSquirrelVM,
    path: *const ::std::os::raw::c_char,
    name: *const ::std::os::raw::c_char,
    a4: ::std::os::raw::c_int,
) -> bool;
pub type sq_newarrayType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger);
pub type sq_arrayappendType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger) -> SQRESULT;
pub type sq_newtableType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM) -> SQRESULT;
pub type sq_newslotType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, idx: SQInteger, bStatic: SQBool) -> SQRESULT;
pub type sq_pushroottableType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM);
pub type sq_pushstringType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, pStr: *const SQChar, iLength: SQInteger);
pub type sq_pushintegerType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM, i: SQInteger);
pub type sq_pushfloatType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM, f: SQFloat);
pub type sq_pushboolType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM, b: SQBool);
pub type sq_pushassetType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, str_: *const SQChar, iLength: SQInteger);
pub type sq_pushvectorType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM, pVec: *const SQFloat);
pub type sq_pushobjectType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM, pVec: *mut SQObject);
pub type sq_pushnullType = unsafe extern "C" fn(sqvm: *mut HSquirrelVM);
pub type sq_getstringType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger) -> *const SQChar;
pub type sq_getintegerType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger) -> SQInteger;
pub type sq_getfloatType =
    unsafe extern "C" fn(arg1: *mut HSquirrelVM, iStackpos: SQInteger) -> SQFloat;
pub type sq_getboolType =
    unsafe extern "C" fn(arg1: *mut HSquirrelVM, iStackpos: SQInteger) -> SQBool;
pub type sq_getType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger) -> SQRESULT;
pub type sq_getassetType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    iStackpos: SQInteger,
    pResult: *mut *const ::std::os::raw::c_char,
) -> SQRESULT;
pub type sq_getuserdataType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    iStackpos: SQInteger,
    pData: *mut *mut ::std::os::raw::c_void,
    pTypeId: *mut u64,
) -> SQRESULT;
pub type sq_getvectorType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger) -> *mut SQFloat;
pub type sq_getthisentityType = unsafe extern "C" fn(
    arg1: *mut HSquirrelVM,
    ppEntity: *mut *mut ::std::os::raw::c_void,
) -> SQBool;
pub type sq_getobjectType =
    unsafe extern "C" fn(arg1: *mut HSquirrelVM, iStackPos: SQInteger, pOutObj: *mut SQObject);
pub type sq_stackinfosType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    iLevel: ::std::os::raw::c_int,
    pOutObj: *mut SQStackInfos,
    iCallStackSize: ::std::os::raw::c_int,
) -> ::std::os::raw::c_longlong;
pub type sq_createuserdataType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iSize: SQInteger) -> *mut ::std::os::raw::c_void;
pub type sq_setuserdatatypeidType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, iStackpos: SQInteger, iTypeId: u64) -> SQRESULT;
pub type sq_setreleasehookType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    iStackpos: SQInteger,
    releaseHook: unsafe extern "C" fn(val: *const ::std::os::raw::c_void, size: SQInteger),
) -> SQRESULT;
pub type sq_getentityfrominstanceType =
    unsafe extern "C" fn(
        sqvm: *mut CSquirrelVM,
        pInstance: *mut SQObject,
        ppEntityConstant: *mut *mut ::std::os::raw::c_char,
    ) -> *mut super::class_types::cplayer::CPlayer;
pub type sq_GetEntityConstantType = unsafe extern "C" fn() -> *mut *mut ::std::os::raw::c_char;
pub type sq_getfunctionType = unsafe extern "C" fn(
    sqvm: *mut HSquirrelVM,
    name: *const ::std::os::raw::c_char,
    returnObj: *mut SQObject,
    signature: *const ::std::os::raw::c_char,
) -> ::std::os::raw::c_int;
pub type sq_pushnewstructinstanceType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, fieldCount: ::std::os::raw::c_int) -> SQRESULT;
pub type sq_sealstructslotType =
    unsafe extern "C" fn(sqvm: *mut HSquirrelVM, slotIndex: ::std::os::raw::c_int) -> SQRESULT;
pub type RegisterSquirrelFuncType_External = unsafe extern "C" fn(
    context: ScriptContext,
    funcReg: *mut SQFuncRegistration,
    unknown: ::std::os::raw::c_char,
) -> i64;
pub type sq_createscriptinstanceType =
    unsafe extern "C" fn(ent: *mut ::std::os::raw::c_void) -> *mut SQObject;
pub type sq_suspendthreadType = unsafe extern "C" fn(
    thread_sqvm: *mut HSquirrelVM,
    *const *mut HSquirrelVM,
    usize,
    *mut HSquirrelVM,
) -> SQRESULT;
pub type sq_threadwakeupType = unsafe extern "C" fn(
    thread_sqvm: *mut HSquirrelVM,
    i32,
    *const ::std::os::raw::c_void,
    *mut HSquirrelVM,
) -> SQRESULT;