rusteal-ffi 0.8.0

FFI types and API table definitions for rusteal
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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
use std::ffi::c_void;

use crate::error::RustealErrorCode;
use crate::handles::*;
use crate::reify_types::RustealReifyPropExtra;

pub use crate::handles::FWeakObjectHandle;

#[repr(C)]
pub struct RustealApiTable {
    pub version: u32,

    pub core: *const RustealCoreApi,
    pub property: *const RustealPropertyApi,
    pub reflection: *const RustealReflectionApi,
    pub container: *const RustealContainerApi,
    pub delegate: *const RustealDelegateApi,
    pub lifecycle: *const RustealLifecycleApi,
    pub reify: *const RustealReifyApi,
    pub world: *const RustealWorldApi,
    pub logging: *const RustealLoggingApi,
    pub widget: *const RustealWidgetApi,
    pub input: *const RustealInputApi,
    pub console: *const RustealConsoleApi,

    pub func_table: *const *const c_void,
    pub func_count: u32,
}

unsafe impl Send for RustealApiTable {}
unsafe impl Sync for RustealApiTable {}

#[repr(C)]
pub struct RustealCoreApi {
    pub is_valid: unsafe extern "C" fn(obj: UObjectHandle) -> bool,

    pub get_name: unsafe extern "C" fn(
        obj: UObjectHandle,
        buf: *mut u8,
        buf_len: u32,
        out_len: *mut u32,
    ) -> RustealErrorCode,

    pub get_class: unsafe extern "C" fn(obj: UObjectHandle) -> UClassHandle,

    pub is_a: unsafe extern "C" fn(obj: UObjectHandle, target_class: UClassHandle) -> bool,

    pub get_outer: unsafe extern "C" fn(obj: UObjectHandle) -> UObjectHandle,

    pub make_fname: unsafe extern "C" fn(name_utf8: *const u8, name_len: u32) -> FNameHandle,

    pub fname_to_string: unsafe extern "C" fn(
        handle: FNameHandle,
        buf: *mut u8,
        buf_len: u32,
        out_len: *mut u32,
    ) -> RustealErrorCode,

    pub make_weak: unsafe extern "C" fn(obj: UObjectHandle) -> FWeakObjectHandle,

    pub resolve_weak: unsafe extern "C" fn(weak: FWeakObjectHandle) -> UObjectHandle,

    pub is_weak_valid: unsafe extern "C" fn(weak: FWeakObjectHandle) -> bool,

    pub take_error_message: unsafe extern "C" fn(
        code: RustealErrorCode,
        buf: *mut u8,
        buf_len: u32,
        out_len: *mut u32,
    ) -> bool,

    pub is_child_of: unsafe extern "C" fn(class: UClassHandle, parent: UClassHandle) -> bool,
}

#[repr(C)]
pub struct RustealLoggingApi {
    pub log: unsafe extern "C" fn(level: u8, msg: *const u8, msg_len: u32),

    pub report: unsafe extern "C" fn(report: *const RustealErrorReport),
}

#[repr(C)]
pub struct RustealErrorReport {
    pub level: u8,
    pub script_error: bool,
    pub summary: *const u8,
    pub summary_len: u32,
    pub details: *const u8,
    pub details_len: u32,
    pub object: FWeakObjectHandle,
    pub file: *const u8,
    pub file_len: u32,
    pub line: u32,
    pub column: u32,
}

#[repr(C)]
pub struct RustealLifecycleApi {
    pub add_gc_root: unsafe extern "C" fn(obj: UObjectHandle),
    pub remove_gc_root: unsafe extern "C" fn(obj: UObjectHandle),
    pub register_pinned: unsafe extern "C" fn(obj: UObjectHandle),
    pub unregister_pinned: unsafe extern "C" fn(obj: UObjectHandle),
}

#[repr(C)]
pub struct RustealPropertyApi {
    pub get_bool: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut bool,
    ) -> RustealErrorCode,
    pub set_bool: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: bool,
    ) -> RustealErrorCode,

    pub get_i32: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut i32,
    ) -> RustealErrorCode,
    pub set_i32: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: i32,
    ) -> RustealErrorCode,
    pub get_i64: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut i64,
    ) -> RustealErrorCode,
    pub set_i64: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: i64,
    ) -> RustealErrorCode,
    pub get_u8: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut u8,
    ) -> RustealErrorCode,
    pub set_u8: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: u8,
    ) -> RustealErrorCode,

    pub get_f32: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut f32,
    ) -> RustealErrorCode,
    pub set_f32: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: f32,
    ) -> RustealErrorCode,
    pub get_f64: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut f64,
    ) -> RustealErrorCode,
    pub set_f64: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: f64,
    ) -> RustealErrorCode,

    pub get_string: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        buf: *mut u8,
        buf_len: u32,
        out_len: *mut u32,
    ) -> RustealErrorCode,
    pub set_string: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        buf: *const u8,
        len: u32,
    ) -> RustealErrorCode,

    pub get_fname: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut FNameHandle,
    ) -> RustealErrorCode,
    pub set_fname: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: FNameHandle,
    ) -> RustealErrorCode,

    pub get_object: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut UObjectHandle,
    ) -> RustealErrorCode,
    pub set_object: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: UObjectHandle,
    ) -> RustealErrorCode,

    pub get_enum: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out: *mut i64,
    ) -> RustealErrorCode,
    pub set_enum: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        val: i64,
    ) -> RustealErrorCode,

    pub get_struct: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out_buf: *mut u8,
        buf_size: u32,
    ) -> RustealErrorCode,
    pub set_struct: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        in_buf: *const u8,
        buf_size: u32,
    ) -> RustealErrorCode,

    pub get_property_at: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        index: u32,
        out_buf: *mut u8,
        buf_size: u32,
    ) -> RustealErrorCode,
    pub set_property_at: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        index: u32,
        in_buf: *const u8,
        buf_size: u32,
    ) -> RustealErrorCode,

    pub get_soft_object_path: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        buf: *mut u8,
        buf_len: u32,
        out_len: *mut u32,
    ) -> RustealErrorCode,
    pub set_soft_object_path: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        buf: *const u8,
        len: u32,
    ) -> RustealErrorCode,
}

#[repr(C)]
pub struct RustealReflectionApi {
    pub find_class: unsafe extern "C" fn(name: *const u8, name_len: u32) -> UClassHandle,

    pub find_property: unsafe extern "C" fn(
        class: UClassHandle,
        name: *const u8,
        name_len: u32,
    ) -> FPropertyHandle,

    pub get_static_class: unsafe extern "C" fn(name: *const u8, name_len: u32) -> UClassHandle,

    pub get_property_size: unsafe extern "C" fn(prop: FPropertyHandle) -> u32,

    pub find_struct: unsafe extern "C" fn(name: *const u8, name_len: u32) -> UStructHandle,

    pub find_struct_property: unsafe extern "C" fn(
        ustruct: UStructHandle,
        name: *const u8,
        name_len: u32,
    ) -> FPropertyHandle,

    pub find_function:
        unsafe extern "C" fn(obj: UObjectHandle, name: *const u8, name_len: u32) -> UFunctionHandle,

    pub alloc_params: unsafe extern "C" fn(func: UFunctionHandle) -> *mut u8,

    pub free_params: unsafe extern "C" fn(func: UFunctionHandle, params: *mut u8),

    pub call_function: unsafe extern "C" fn(
        obj: UObjectHandle,
        func: UFunctionHandle,
        params: *mut u8,
    ) -> RustealErrorCode,

    pub get_function_param: unsafe extern "C" fn(
        func: UFunctionHandle,
        name: *const u8,
        name_len: u32,
    ) -> FPropertyHandle,

    pub get_property_offset: unsafe extern "C" fn(prop: FPropertyHandle) -> u32,

    pub find_function_by_class:
        unsafe extern "C" fn(cls: UClassHandle, name: *const u8, name_len: u32) -> UFunctionHandle,

    pub get_element_size: unsafe extern "C" fn(prop: FPropertyHandle) -> u32,

    pub get_struct_size: unsafe extern "C" fn(ustruct: UStructHandle) -> u32,

    pub initialize_struct:
        unsafe extern "C" fn(ustruct: UStructHandle, data: *mut u8) -> RustealErrorCode,

    pub destroy_struct:
        unsafe extern "C" fn(ustruct: UStructHandle, data: *mut u8) -> RustealErrorCode,

    pub copy_struct: unsafe extern "C" fn(
        ustruct: UStructHandle,
        dest: *mut u8,
        src: *const u8,
    ) -> RustealErrorCode,

    pub find_enum: unsafe extern "C" fn(name: *const u8, name_len: u32) -> UClassHandle,

    pub get_delegate_signature: unsafe extern "C" fn(prop: FPropertyHandle) -> UFunctionHandle,
}

#[repr(C)]
pub struct RustealContainerApi {
    pub array_len: unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> i32,
    pub array_get: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        index: i32,
        out_buf: *mut u8,
        buf_size: u32,
        out_written: *mut u32,
    ) -> RustealErrorCode,
    pub array_set: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        index: i32,
        in_buf: *const u8,
        buf_size: u32,
    ) -> RustealErrorCode,
    pub array_add: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        in_buf: *const u8,
        buf_size: u32,
    ) -> RustealErrorCode,
    pub array_remove: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        index: i32,
    ) -> RustealErrorCode,
    pub array_clear:
        unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> RustealErrorCode,
    pub array_element_size: unsafe extern "C" fn(prop: FPropertyHandle) -> u32,

    pub map_len: unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> i32,
    pub map_find: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        key_buf: *const u8,
        key_size: u32,
        out_val_buf: *mut u8,
        val_size: u32,
        out_written: *mut u32,
    ) -> RustealErrorCode,
    pub map_add: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        key_buf: *const u8,
        key_size: u32,
        val_buf: *const u8,
        val_size: u32,
    ) -> RustealErrorCode,
    pub map_remove: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        key_buf: *const u8,
        key_size: u32,
    ) -> RustealErrorCode,
    pub map_clear:
        unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> RustealErrorCode,
    pub map_get_pair: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        logical_index: i32,
        out_key_buf: *mut u8,
        key_buf_size: u32,
        out_key_written: *mut u32,
        out_val_buf: *mut u8,
        val_buf_size: u32,
        out_val_written: *mut u32,
    ) -> RustealErrorCode,

    pub set_len: unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> i32,
    pub set_contains: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        elem_buf: *const u8,
        elem_size: u32,
    ) -> bool,
    pub set_add: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        elem_buf: *const u8,
        elem_size: u32,
    ) -> RustealErrorCode,
    pub set_remove: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        elem_buf: *const u8,
        elem_size: u32,
    ) -> RustealErrorCode,
    pub set_clear:
        unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> RustealErrorCode,
    pub set_get_element: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        logical_index: i32,
        out_buf: *mut u8,
        buf_size: u32,
        out_written: *mut u32,
    ) -> RustealErrorCode,

    pub alloc_temp: unsafe extern "C" fn(prop: FPropertyHandle) -> *mut u8,

    pub free_temp: unsafe extern "C" fn(prop: FPropertyHandle, base: *mut u8),

    pub array_copy_all: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out_buf: *mut u8,
        buf_size: u32,
        out_total_written: *mut u32,
        out_count: *mut i32,
    ) -> RustealErrorCode,

    pub array_set_all: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        in_buf: *const u8,
        buf_size: u32,
        count: i32,
    ) -> RustealErrorCode,

    pub map_copy_all: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out_buf: *mut u8,
        buf_size: u32,
        out_total_written: *mut u32,
        out_count: *mut i32,
    ) -> RustealErrorCode,

    pub set_copy_all: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        out_buf: *mut u8,
        buf_size: u32,
        out_total_written: *mut u32,
        out_count: *mut i32,
    ) -> RustealErrorCode,
}

#[repr(C)]
pub struct RustealDelegateApi {
    pub bind_delegate: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        callback_id: u64,
    ) -> RustealErrorCode,
    pub unbind_delegate:
        unsafe extern "C" fn(obj: UObjectHandle, prop: FPropertyHandle) -> RustealErrorCode,
    pub add_multicast: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        callback_id: u64,
    ) -> RustealErrorCode,
    pub remove_multicast: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        callback_id: u64,
    ) -> RustealErrorCode,
    pub broadcast_multicast: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        params: *mut u8,
    ) -> RustealErrorCode,

    pub read_param: unsafe extern "C" fn(
        prop: FPropertyHandle,
        params_buf: *mut c_void,
        offset: u32,
        out_buf: *mut u8,
        out_buf_size: u32,
        out_written: *mut u32,
    ) -> RustealErrorCode,

    pub add_function: unsafe extern "C" fn(
        obj: UObjectHandle,
        prop: FPropertyHandle,
        target: UObjectHandle,
        name: *const u8,
        name_len: u32,
    ) -> RustealErrorCode,
}

#[repr(C)]
pub struct RustealReifyApi {
    pub create_class: unsafe extern "C" fn(
        name: *const u8,
        name_len: u32,
        parent: UClassHandle,
        rust_type_id: u64,
        shape: u64,
    ) -> UClassHandle,

    pub add_property: unsafe extern "C" fn(
        cls: UClassHandle,
        name: *const u8,
        name_len: u32,
        prop_type: u32,
        prop_flags: u64,
        extra: *const RustealReifyPropExtra,
    ) -> FPropertyHandle,

    pub add_function: unsafe extern "C" fn(
        cls: UClassHandle,
        name: *const u8,
        name_len: u32,
        callback_id: u64,
        func_flags: u32,
    ) -> UFunctionHandle,

    pub add_function_param: unsafe extern "C" fn(
        func: UFunctionHandle,
        name: *const u8,
        name_len: u32,
        prop_type: u32,
        param_flags: u64,
        extra: *const RustealReifyPropExtra,
    ) -> RustealErrorCode,

    pub finalize_class: unsafe extern "C" fn(cls: UClassHandle) -> RustealErrorCode,

    pub get_cdo: unsafe extern "C" fn(cls: UClassHandle) -> UObjectHandle,

    pub add_default_subobject: unsafe extern "C" fn(
        cls: UClassHandle,
        name: *const u8,
        name_len: u32,
        property: *const u8,
        property_len: u32,
        component_class: UClassHandle,
        flags: u32,
        attach_parent: *const u8,
        attach_len: u32,
        attach_socket: *const u8,
        socket_len: u32,
    ) -> RustealErrorCode,

    pub find_default_subobject:
        unsafe extern "C" fn(owner: UObjectHandle, name: *const u8, name_len: u32) -> UObjectHandle,

    pub set_property_metadata: unsafe extern "C" fn(
        prop: FPropertyHandle,
        key: *const u8,
        key_len: u32,
        value: *const u8,
        value_len: u32,
    ) -> RustealErrorCode,

    pub create_struct:
        unsafe extern "C" fn(name: *const u8, name_len: u32, shape: u64) -> UStructHandle,

    pub finalize_struct: unsafe extern "C" fn(strukt: UStructHandle) -> RustealErrorCode,

    pub add_delegate: unsafe extern "C" fn(
        cls: UClassHandle,
        name: *const u8,
        name_len: u32,
        prop_flags: u64,
    ) -> UFunctionHandle,

    pub add_interface:
        unsafe extern "C" fn(cls: UClassHandle, path: *const u8, path_len: u32) -> RustealErrorCode,

    pub set_class_config: unsafe extern "C" fn(
        cls: UClassHandle,
        config_name: *const u8,
        config_name_len: u32,
    ) -> RustealErrorCode,

    pub create_enum: unsafe extern "C" fn(
        name: *const u8,
        name_len: u32,
        entries: *const u8,
        entries_len: u32,
        values: *const i64,
        count: u32,
    ) -> UClassHandle,

    pub create_interface:
        unsafe extern "C" fn(name: *const u8, name_len: u32, shape: u64) -> UClassHandle,

    pub finalize_interface: unsafe extern "C" fn(interface: UClassHandle) -> RustealErrorCode,

    pub add_interface_class:
        unsafe extern "C" fn(cls: UClassHandle, interface: UClassHandle) -> RustealErrorCode,
}

pub const RUSTEAL_COMP_ROOT: u32 = 1;
pub const RUSTEAL_COMP_TRANSIENT: u32 = 2;

#[repr(C)]
pub struct RustealWidgetApi {
    pub create_widget: unsafe extern "C" fn(
        owning_object: UObjectHandle,
        widget_class: UClassHandle,
    ) -> UObjectHandle,

    pub set_root_widget: unsafe extern "C" fn(
        user_widget: UObjectHandle,
        root_widget: UObjectHandle,
    ) -> RustealErrorCode,

    pub get_widget_tree: unsafe extern "C" fn(user_widget: UObjectHandle) -> UObjectHandle,
}

#[repr(C)]
pub struct RustealInputApi {
    pub bind_action: unsafe extern "C" fn(
        actor: UObjectHandle,
        action: UObjectHandle,
        trigger_event: u8,
        function_name: *const u8,
        function_name_len: u32,
    ) -> RustealErrorCode,

    pub should_display_touch_interface: unsafe extern "C" fn() -> bool,
}

#[repr(C)]
pub struct RustealConsoleArgs {
    pub args: *const u8,
    pub args_len: u32,
    pub world: UObjectHandle,
}

#[repr(C)]
pub struct RustealConsoleApi {
    pub register_command: unsafe extern "C" fn(
        name: *const u8,
        name_len: u32,
        help: *const u8,
        help_len: u32,
        callback_id: u64,
    ) -> RustealErrorCode,

    pub register_variable: unsafe extern "C" fn(
        name: *const u8,
        name_len: u32,
        help: *const u8,
        help_len: u32,
        kind: u32,
        default_value: *const u8,
        default_len: u32,
    ) -> RustealErrorCode,

    pub unregister: unsafe extern "C" fn(name: *const u8, name_len: u32) -> RustealErrorCode,

    pub get_variable: unsafe extern "C" fn(
        name: *const u8,
        name_len: u32,
        buf: *mut u8,
        buf_len: u32,
        out_len: *mut u32,
    ) -> RustealErrorCode,

    pub set_variable: unsafe extern "C" fn(
        name: *const u8,
        name_len: u32,
        value: *const u8,
        value_len: u32,
    ) -> RustealErrorCode,
}

#[repr(C)]
pub struct RustealWorldApi {
    pub spawn_actor: unsafe extern "C" fn(
        world: UObjectHandle,
        class: UClassHandle,
        transform_buf: *const u8,
        transform_size: u32,
        owner: UObjectHandle,
    ) -> UObjectHandle,

    pub get_all_actors_of_class: unsafe extern "C" fn(
        world: UObjectHandle,
        class: UClassHandle,
        out_buf: *mut u8,
        buf_byte_size: u32,
        out_count: *mut u32,
    ) -> RustealErrorCode,

    pub find_object: unsafe extern "C" fn(
        class: UClassHandle,
        path_utf8: *const u8,
        path_len: u32,
    ) -> UObjectHandle,

    pub load_object: unsafe extern "C" fn(
        class: UClassHandle,
        path_utf8: *const u8,
        path_len: u32,
    ) -> UObjectHandle,

    pub get_world: unsafe extern "C" fn(object: UObjectHandle) -> UObjectHandle,

    pub new_object:
        unsafe extern "C" fn(outer: UObjectHandle, class: UClassHandle) -> UObjectHandle,

    pub spawn_actor_deferred: unsafe extern "C" fn(
        world: UObjectHandle,
        class: UClassHandle,
        transform_buf: *const u8,
        transform_size: u32,
        owner: UObjectHandle,
        instigator: UObjectHandle,
        collision_method: u8,
    ) -> UObjectHandle,

    pub finish_spawning: unsafe extern "C" fn(
        actor: UObjectHandle,
        transform_buf: *const u8,
        transform_size: u32,
    ) -> RustealErrorCode,

    pub channel_to_object_type: unsafe extern "C" fn(channel: u8) -> u8,

    pub find_data_table_row: unsafe extern "C" fn(
        table: UObjectHandle,
        row_name: FNameHandle,
        row_struct: UStructHandle,
    ) -> *mut u8,
}