machinery_api/plugins/
simulation.rs

1#[repr(C)]
2#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub struct __BindgenBitfieldUnit<Storage> {
4    storage: Storage,
5}
6impl<Storage> __BindgenBitfieldUnit<Storage> {
7    #[inline]
8    pub const fn new(storage: Storage) -> Self {
9        Self { storage }
10    }
11}
12impl<Storage> __BindgenBitfieldUnit<Storage>
13where
14    Storage: AsRef<[u8]> + AsMut<[u8]>,
15{
16    #[inline]
17    pub fn get_bit(&self, index: usize) -> bool {
18        debug_assert!(index / 8 < self.storage.as_ref().len());
19        let byte_index = index / 8;
20        let byte = self.storage.as_ref()[byte_index];
21        let bit_index = if cfg!(target_endian = "big") {
22            7 - (index % 8)
23        } else {
24            index % 8
25        };
26        let mask = 1 << bit_index;
27        byte & mask == mask
28    }
29    #[inline]
30    pub fn set_bit(&mut self, index: usize, val: bool) {
31        debug_assert!(index / 8 < self.storage.as_ref().len());
32        let byte_index = index / 8;
33        let byte = &mut self.storage.as_mut()[byte_index];
34        let bit_index = if cfg!(target_endian = "big") {
35            7 - (index % 8)
36        } else {
37            index % 8
38        };
39        let mask = 1 << bit_index;
40        if val {
41            *byte |= mask;
42        } else {
43            *byte &= !mask;
44        }
45    }
46    #[inline]
47    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
48        debug_assert!(bit_width <= 64);
49        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
50        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
51        let mut val = 0;
52        for i in 0..(bit_width as usize) {
53            if self.get_bit(i + bit_offset) {
54                let index = if cfg!(target_endian = "big") {
55                    bit_width as usize - 1 - i
56                } else {
57                    i
58                };
59                val |= 1 << index;
60            }
61        }
62        val
63    }
64    #[inline]
65    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
66        debug_assert!(bit_width <= 64);
67        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
68        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
69        for i in 0..(bit_width as usize) {
70            let mask = 1 << i;
71            let val_bit_is_set = val & mask == mask;
72            let index = if cfg!(target_endian = "big") {
73                bit_width as usize - 1 - i
74            } else {
75                i
76            };
77            self.set_bit(index + bit_offset, val_bit_is_set);
78        }
79    }
80}
81pub const __SAL_H_VERSION: u32 = 180000000;
82pub const __bool_true_false_are_defined: u32 = 1;
83pub const TM_TT_TYPE__RUNNER_SETTINGS: &'static [u8; 19usize] = b"tm_runner_settings\0";
84pub const TM_TT_TYPE__SIMULATION_ENTRY_SETTINGS: &'static [u8; 29usize] =
85    b"tm_simulation_entry_settings\0";
86pub const TM_TT_TYPE__SIMULATION_ENTRY_COMPONENT: &'static [u8; 30usize] =
87    b"tm_simulation_entry_component\0";
88extern "C" {
89    pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
90}
91pub type __vcrt_bool = bool;
92extern "C" {
93    pub fn __security_init_cookie();
94}
95extern "C" {
96    pub fn __security_check_cookie(_StackCookie: usize);
97}
98extern "C" {
99    pub fn __report_gsfailure(_StackCookie: usize);
100}
101extern "C" {
102    pub static mut __security_cookie: usize;
103}
104#[repr(C)]
105#[derive(Copy, Clone)]
106pub union TtIdTBindgenTy1 {
107    pub u64_: u64,
108    pub __bindgen_anon_1: TtIdTBindgenTy1BindgenTy1,
109}
110#[repr(C)]
111#[repr(align(8))]
112#[derive(Default, Copy, Clone)]
113pub struct TtIdTBindgenTy1BindgenTy1 {
114    pub _bitfield_align_1: [u32; 0],
115    pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize]>,
116}
117impl TtIdTBindgenTy1BindgenTy1 {
118    #[inline]
119    pub fn type_(&self) -> u64 {
120        unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 10u8) as u64) }
121    }
122    #[inline]
123    pub fn set_type(&mut self, val: u64) {
124        unsafe {
125            let val: u64 = ::std::mem::transmute(val);
126            self._bitfield_1.set(0usize, 10u8, val as u64)
127        }
128    }
129    #[inline]
130    pub fn generation(&self) -> u64 {
131        unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 22u8) as u64) }
132    }
133    #[inline]
134    pub fn set_generation(&mut self, val: u64) {
135        unsafe {
136            let val: u64 = ::std::mem::transmute(val);
137            self._bitfield_1.set(10usize, 22u8, val as u64)
138        }
139    }
140    #[inline]
141    pub fn index(&self) -> u64 {
142        unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 32u8) as u64) }
143    }
144    #[inline]
145    pub fn set_index(&mut self, val: u64) {
146        unsafe {
147            let val: u64 = ::std::mem::transmute(val);
148            self._bitfield_1.set(32usize, 32u8, val as u64)
149        }
150    }
151    #[inline]
152    pub fn new_bitfield_1(
153        type_: u64,
154        generation: u64,
155        index: u64,
156    ) -> __BindgenBitfieldUnit<[u8; 8usize]> {
157        let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> = Default::default();
158        __bindgen_bitfield_unit.set(0usize, 10u8, {
159            let type_: u64 = unsafe { ::std::mem::transmute(type_) };
160            type_ as u64
161        });
162        __bindgen_bitfield_unit.set(10usize, 22u8, {
163            let generation: u64 = unsafe { ::std::mem::transmute(generation) };
164            generation as u64
165        });
166        __bindgen_bitfield_unit.set(32usize, 32u8, {
167            let index: u64 = unsafe { ::std::mem::transmute(index) };
168            index as u64
169        });
170        __bindgen_bitfield_unit
171    }
172}
173impl Default for TtIdTBindgenTy1 {
174    fn default() -> Self {
175        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
176        unsafe {
177            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
178            s.assume_init()
179        }
180    }
181}
182pub const TM_TT_PROP__RUNNER_SETTINGS__PROJECT: ::std::os::raw::c_int = 0;
183pub const TM_TT_PROP__RUNNER_SETTINGS__WORLD_ENTITY: ::std::os::raw::c_int = 1;
184pub const TM_TT_PROP__RUNNER_SETTINGS__SHADERS_DIR: ::std::os::raw::c_int = 2;
185pub const TM_TT_PROP__RUNNER_SETTINGS__PLUGINS_DIR: ::std::os::raw::c_int = 3;
186pub const TM_TT_PROP__RUNNER_SETTINGS__WINDOW_TITLE: ::std::os::raw::c_int = 4;
187pub const TM_TT_PROP__RUNNER_SETTINGS__RESOLUTION: ::std::os::raw::c_int = 5;
188pub const TM_TT_PROP__RUNNER_SETTINGS__FULLSCREEN: ::std::os::raw::c_int = 6;
189pub type _bindgen_ty_1 = ::std::os::raw::c_int;
190#[repr(C)]
191#[derive(Default, Copy, Clone)]
192pub struct RunnerSettingsApi {
193    pub create_truth_types: ::std::option::Option<unsafe extern "C" fn(tt: *mut TheTruthO)>,
194}
195#[repr(C)]
196#[derive(Copy, Clone)]
197pub union EntityT {
198    pub __bindgen_anon_1: EntityTBindgenTy1,
199    pub u64_: u64,
200}
201#[repr(C)]
202#[derive(Default, Copy, Clone)]
203pub struct EntityTBindgenTy1 {
204    pub index: u32,
205    pub generation: u32,
206}
207impl Default for EntityT {
208    fn default() -> Self {
209        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
210        unsafe {
211            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
212            s.assume_init()
213        }
214    }
215}
216#[repr(C)]
217#[derive(Copy, Clone)]
218pub struct NetworkNode {
219    _unused: [u8; 0],
220}
221#[repr(C)]
222#[derive(Copy, Clone)]
223pub struct MixerO {
224    _unused: [u8; 0],
225}
226#[repr(C)]
227#[derive(Copy, Clone)]
228pub struct PhysxSceneSettingsT {
229    _unused: [u8; 0],
230}
231#[repr(C)]
232#[derive(Copy, Clone)]
233pub struct SimulationO {
234    _unused: [u8; 0],
235}
236#[repr(C)]
237#[derive(Default, Copy, Clone)]
238pub struct SimulationUpdateParamsT {
239    pub update_when_hidden: bool,
240    pub enable_ecs_editor_components: bool,
241    pub enable_ecs_editor_engines: bool,
242    pub passive_gamestate: bool,
243    pub running_in_editor: bool,
244    pub _padding_34: [::std::os::raw::c_char; 3usize],
245}
246#[repr(C)]
247#[derive(Copy, Clone)]
248pub struct SimulationNetworkParamsT {
249    pub node_type_name: *const ::std::os::raw::c_char,
250    pub port: u16,
251    pub _padding_44: [::std::os::raw::c_char; 6usize],
252}
253impl Default for SimulationNetworkParamsT {
254    fn default() -> Self {
255        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
256        unsafe {
257            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
258            s.assume_init()
259        }
260    }
261}
262#[repr(C)]
263#[derive(Copy, Clone)]
264pub struct SimulationPhysxParamsT {
265    pub editor_mode: bool,
266    pub _padding_53: [::std::os::raw::c_char; 7usize],
267    pub settings: *mut PhysxSceneSettingsT,
268}
269impl Default for SimulationPhysxParamsT {
270    fn default() -> Self {
271        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
272        unsafe {
273            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
274            s.assume_init()
275        }
276    }
277}
278#[repr(C)]
279#[derive(Copy, Clone)]
280pub struct SimulationParamsT {
281    pub update: SimulationUpdateParamsT,
282    pub network: SimulationNetworkParamsT,
283    pub physx: SimulationPhysxParamsT,
284}
285impl Default for SimulationParamsT {
286    fn default() -> Self {
287        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
288        unsafe {
289            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
290            s.assume_init()
291        }
292    }
293}
294#[repr(C)]
295pub struct SimulationRenderingParamsT {
296    pub ui: *mut UiO,
297    pub display_scale_factor: f32,
298    pub custom_ui_scale_factor: f32,
299    pub content_rect: RectT,
300    pub native_resolution: bool,
301    pub _padding_72: [::std::os::raw::c_char; 7usize],
302}
303impl Default for SimulationRenderingParamsT {
304    fn default() -> Self {
305        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
306        unsafe {
307            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
308            s.assume_init()
309        }
310    }
311}
312#[repr(C)]
313#[derive(Copy, Clone)]
314pub struct SimulationStateT {
315    pub data: *mut u8,
316    pub size: u32,
317    pub _padding_81: [::std::os::raw::c_char; 4usize],
318}
319impl Default for SimulationStateT {
320    fn default() -> Self {
321        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
322        unsafe {
323            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
324            s.assume_init()
325        }
326    }
327}
328#[repr(C)]
329#[derive(Default, Copy, Clone)]
330pub struct SimulationApi {
331    pub all_simulations:
332        ::std::option::Option<unsafe extern "C" fn(count: *mut u32) -> *mut *mut SimulationO>,
333    pub single_simulation: ::std::option::Option<unsafe extern "C" fn() -> *mut SimulationO>,
334    pub create: ::std::option::Option<
335        unsafe extern "C" fn(
336            parent_allocator: *mut AllocatorI,
337            network: *mut NetworkO,
338            mixer: *mut MixerO,
339        ) -> *mut SimulationO,
340    >,
341    pub destroy: ::std::option::Option<unsafe extern "C" fn(simulate_ctx: *mut SimulationO)>,
342    pub setup: ::std::option::Option<
343        unsafe extern "C" fn(
344            sim: *mut SimulationO,
345            tt: *mut TheTruthO,
346            asset_root: TtIdT,
347            params: SimulationParamsT,
348        ),
349    >,
350    pub setup_with_root_entity: ::std::option::Option<
351        unsafe extern "C" fn(
352            sim: *mut SimulationO,
353            tt: *mut TheTruthO,
354            asset_root: TtIdT,
355            root_entity: TtIdT,
356            params: SimulationParamsT,
357        ),
358    >,
359    pub create_root_entity_from_asset: ::std::option::Option<
360        unsafe extern "C" fn(sim: *mut SimulationO, entity_asset: TtIdT) -> EntityT,
361    >,
362    pub tick: ::std::option::Option<
363        unsafe extern "C" fn(
364            sim: *mut SimulationO,
365            rendering_params: *mut SimulationRenderingParamsT,
366            dt: f64,
367        ),
368    >,
369    pub render_args: ::std::option::Option<
370        unsafe extern "C" fn(sim: *mut SimulationO, render_args: *mut ViewerRenderArgsT),
371    >,
372    pub force_initialize: ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO)>,
373    pub set_camera: ::std::option::Option<
374        unsafe extern "C" fn(simulate_sim: *mut SimulationO, camera: EntityT),
375    >,
376    pub camera: ::std::option::Option<unsafe extern "C" fn(sim: *const SimulationO) -> EntityT>,
377    pub default_camera:
378        ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO) -> EntityT>,
379    pub reset_default_camera:
380        ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO) -> EntityT>,
381    pub entity_ctx:
382        ::std::option::Option<unsafe extern "C" fn(sim: *const SimulationO) -> *mut EntityContextO>,
383    pub network_node:
384        ::std::option::Option<unsafe extern "C" fn(sim: *const SimulationO) -> *mut NetworkNodeO>,
385    pub pause: ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO)>,
386    pub unpause: ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO)>,
387    pub is_paused: ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO) -> bool>,
388    pub params:
389        ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO) -> SimulationParamsT>,
390    pub save_state: ::std::option::Option<
391        unsafe extern "C" fn(sim: *mut SimulationO, allocator: *mut AllocatorI) -> SimulationStateT,
392    >,
393    pub load_state:
394        ::std::option::Option<unsafe extern "C" fn(sim: *mut SimulationO, state: SimulationStateT)>,
395}
396#[repr(C)]
397#[derive(Copy, Clone)]
398pub struct PhysxSceneO {
399    _unused: [u8; 0],
400}
401#[repr(C)]
402pub struct SimulationFrameArgsT {
403    pub commands: *mut EntityCommandsO,
404    pub dt: f32,
405    pub dt_unscaled: f32,
406    pub time: f64,
407    pub time_unscaled: f64,
408    pub running_in_editor: bool,
409    pub _padding_56: [::std::os::raw::c_char; 7usize],
410    pub ui: *mut UiO,
411    pub uistyle: *mut UiStyleT,
412    pub rect: RectT,
413    pub physx_scene: *mut PhysxSceneO,
414}
415impl Default for SimulationFrameArgsT {
416    fn default() -> Self {
417        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
418        unsafe {
419            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
420            s.assume_init()
421        }
422    }
423}
424#[repr(C)]
425pub struct SimulationStartArgsT {
426    pub allocator: *mut AllocatorI,
427    pub tt: *mut TheTruthO,
428    pub entity_ctx: *mut EntityContextO,
429    pub simulation_ctx: *mut SimulationO,
430    pub asset_root: TtIdT,
431    pub settings_id: TtIdT,
432    pub commands: *mut EntityCommandsO,
433    pub running_in_editor: bool,
434    pub _padding_102: [::std::os::raw::c_char; 7usize],
435}
436impl Default for SimulationStartArgsT {
437    fn default() -> Self {
438        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
439        unsafe {
440            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
441            s.assume_init()
442        }
443    }
444}
445#[repr(C)]
446#[derive(Copy, Clone)]
447pub struct SimulationStateO {
448    _unused: [u8; 0],
449}
450pub const TM_MAX_DEPENDENCIES_FOR_SIMULATION_ENTRY: ::std::os::raw::c_int = 16;
451pub type _bindgen_ty_2 = ::std::os::raw::c_int;
452#[repr(C)]
453pub struct SimulationEntryI {
454    pub id: StrhashT,
455    pub display_name: *const ::std::os::raw::c_char,
456    pub settings_type_hash: StrhashT,
457    pub start: ::std::option::Option<
458        unsafe extern "C" fn(args: *mut SimulationStartArgsT) -> *mut SimulationStateO,
459    >,
460    pub stop: ::std::option::Option<
461        unsafe extern "C" fn(state: *mut SimulationStateO, commands: *mut EntityCommandsO),
462    >,
463    pub tick: ::std::option::Option<
464        unsafe extern "C" fn(state: *mut SimulationStateO, args: *mut SimulationFrameArgsT),
465    >,
466    pub hot_reload: ::std::option::Option<
467        unsafe extern "C" fn(state: *mut SimulationStateO, commands: *mut EntityCommandsO),
468    >,
469    pub before_me: [StrhashT; 16usize],
470    pub after_me: [StrhashT; 16usize],
471    pub phase: StrhashT,
472}
473impl Default for SimulationEntryI {
474    fn default() -> Self {
475        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
476        unsafe {
477            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
478            s.assume_init()
479        }
480    }
481}
482pub const TM_TT_PROP__SIMULATION_ENTRY_SETTINGS__SETTING: ::std::os::raw::c_int = 0;
483pub type _bindgen_ty_3 = ::std::os::raw::c_int;
484pub const TM_TT_PROP__SIMULATION_ENTRY_COMPONENT__IDS: ::std::os::raw::c_int = 0;
485pub const TM_TT_PROP__SIMULATION_ENTRY_COMPONENT__SETTINGS: ::std::os::raw::c_int = 1;
486pub type _bindgen_ty_4 = ::std::os::raw::c_int;
487#[repr(C)]
488#[derive(Default, Copy, Clone)]
489pub struct NetworkNodeO {
490    pub _address: u8,
491}
492
493// Extensions generated by machinery-generator
494
495use const_cstr::{const_cstr, ConstCStr};
496
497use crate::foundation::VersionT;
498
499use crate::foundation::*;
500use crate::plugins::entity::*;
501use crate::plugins::ui::*;
502
503impl RunnerSettingsApi {
504    pub unsafe fn create_truth_types(&self, tt: *mut TheTruthO) {
505        self.create_truth_types.unwrap()(tt)
506    }
507}
508
509impl crate::Api for RunnerSettingsApi {
510    const NAME: ConstCStr = const_cstr!("tm_runner_settings_api");
511    const VERSION: VersionT = VersionT {
512        major: 1u32,
513        minor: 0u32,
514        patch: 0u32,
515    };
516}
517
518impl SimulationApi {
519    pub unsafe fn all_simulations(&self, count: *mut u32) -> *mut *mut SimulationO {
520        self.all_simulations.unwrap()(count)
521    }
522
523    pub unsafe fn single_simulation(&self) -> *mut SimulationO {
524        self.single_simulation.unwrap()()
525    }
526
527    pub unsafe fn create(
528        &self,
529        parent_allocator: *mut AllocatorI,
530        network: *mut NetworkO,
531        mixer: *mut MixerO,
532    ) -> *mut SimulationO {
533        self.create.unwrap()(parent_allocator, network, mixer)
534    }
535
536    pub unsafe fn destroy(&self, simulate_ctx: *mut SimulationO) {
537        self.destroy.unwrap()(simulate_ctx)
538    }
539
540    pub unsafe fn setup(
541        &self,
542        sim: *mut SimulationO,
543        tt: *mut TheTruthO,
544        asset_root: TtIdT,
545        params: SimulationParamsT,
546    ) {
547        self.setup.unwrap()(sim, tt, asset_root, params)
548    }
549
550    pub unsafe fn setup_with_root_entity(
551        &self,
552        sim: *mut SimulationO,
553        tt: *mut TheTruthO,
554        asset_root: TtIdT,
555        root_entity: TtIdT,
556        params: SimulationParamsT,
557    ) {
558        self.setup_with_root_entity.unwrap()(sim, tt, asset_root, root_entity, params)
559    }
560
561    pub unsafe fn create_root_entity_from_asset(
562        &self,
563        sim: *mut SimulationO,
564        entity_asset: TtIdT,
565    ) -> EntityT {
566        self.create_root_entity_from_asset.unwrap()(sim, entity_asset)
567    }
568
569    pub unsafe fn tick(
570        &self,
571        sim: *mut SimulationO,
572        rendering_params: *mut SimulationRenderingParamsT,
573        dt: f64,
574    ) {
575        self.tick.unwrap()(sim, rendering_params, dt)
576    }
577
578    pub unsafe fn render_args(&self, sim: *mut SimulationO, render_args: *mut ViewerRenderArgsT) {
579        self.render_args.unwrap()(sim, render_args)
580    }
581
582    pub unsafe fn force_initialize(&self, sim: *mut SimulationO) {
583        self.force_initialize.unwrap()(sim)
584    }
585
586    pub unsafe fn set_camera(&self, simulate_sim: *mut SimulationO, camera: EntityT) {
587        self.set_camera.unwrap()(simulate_sim, camera)
588    }
589
590    pub unsafe fn camera(&self, sim: *const SimulationO) -> EntityT {
591        self.camera.unwrap()(sim)
592    }
593
594    pub unsafe fn default_camera(&self, sim: *mut SimulationO) -> EntityT {
595        self.default_camera.unwrap()(sim)
596    }
597
598    pub unsafe fn reset_default_camera(&self, sim: *mut SimulationO) -> EntityT {
599        self.reset_default_camera.unwrap()(sim)
600    }
601
602    pub unsafe fn entity_ctx(&self, sim: *const SimulationO) -> *mut EntityContextO {
603        self.entity_ctx.unwrap()(sim)
604    }
605
606    pub unsafe fn network_node(&self, sim: *const SimulationO) -> *mut NetworkNodeO {
607        self.network_node.unwrap()(sim)
608    }
609
610    pub unsafe fn pause(&self, sim: *mut SimulationO) {
611        self.pause.unwrap()(sim)
612    }
613
614    pub unsafe fn unpause(&self, sim: *mut SimulationO) {
615        self.unpause.unwrap()(sim)
616    }
617
618    pub unsafe fn is_paused(&self, sim: *mut SimulationO) -> bool {
619        self.is_paused.unwrap()(sim)
620    }
621
622    pub unsafe fn params(&self, sim: *mut SimulationO) -> SimulationParamsT {
623        self.params.unwrap()(sim)
624    }
625
626    pub unsafe fn save_state(
627        &self,
628        sim: *mut SimulationO,
629        allocator: *mut AllocatorI,
630    ) -> SimulationStateT {
631        self.save_state.unwrap()(sim, allocator)
632    }
633
634    pub unsafe fn load_state(&self, sim: *mut SimulationO, state: SimulationStateT) {
635        self.load_state.unwrap()(sim, state)
636    }
637}
638
639impl crate::Api for SimulationApi {
640    const NAME: ConstCStr = const_cstr!("tm_simulation_api");
641    const VERSION: VersionT = VersionT {
642        major: 1u32,
643        minor: 0u32,
644        patch: 0u32,
645    };
646}
647
648pub const TM_TT_TYPE_HASH__RUNNER_SETTINGS: StrhashT = StrhashT {
649    u64_: 13458645607848451798u64,
650};
651pub const TM_ENTITY_BB__SIMULATION: StrhashT = StrhashT {
652    u64_: 13615359465719222455u64,
653};
654pub const TM_ENTITY_BB__SIMULATION_LOADING_FROM_GAMESTATE: StrhashT = StrhashT {
655    u64_: 14379022613120087788u64,
656};
657pub const TM_TT_TYPE_HASH__SIMULATION_ENTRY_SETTINGS: StrhashT = StrhashT {
658    u64_: 7106079933671888072u64,
659};
660pub const TM_TT_TYPE_HASH__SIMULATION_ENTRY_COMPONENT: StrhashT = StrhashT {
661    u64_: 10769537077919379344u64,
662};
663pub const TM_RUNNER_SETTINGS_API_VERSION: VersionT = VersionT {
664    major: 1u32,
665    minor: 0u32,
666    patch: 0u32,
667};
668pub const TM_SIMULATION_ENTRY_I_VERSION: VersionT = VersionT {
669    major: 1u32,
670    minor: 0u32,
671    patch: 0u32,
672};
673pub const TM_SIMULATION_API_VERSION: VersionT = VersionT {
674    major: 1u32,
675    minor: 0u32,
676    patch: 0u32,
677};