samp_sdk/omp/generated/custom_models.rs
1//! `ICustomModelsComponent` — generated by `cargo xtask gen-omp` from `Server/Components/CustomModels/custommodels.hpp`.
2//! Implemented by `CustomModelsComponent` in the server's `CustomModels`.
3//!
4//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
5//! regenerate. Slots are clang's layout of the header for each ABI, checked
6//! against the official binaries by `cargo xtask check-abi --generated`.
7
8#![allow(unused_imports)]
9
10use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
11use crate::omp::types::{
12 Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
13 UID, Vector2, Vector3, Vector4, WorldTimePoint,
14};
15use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
16use crate::omp::*;
17
18opaque! {
19 /// Opaque handle for `ICustomModelsComponent*`.
20 pub ICustomModelsComponent;
21}
22
23/// `ModelsComponent_UID` in `Server/Components/CustomModels/custommodels.hpp`.
24pub const CUSTOM_MODELS_COMPONENT_UID: UID = 0x15e3cb1e7c77ffff;
25
26impl ComponentInterface for ICustomModelsComponent {
27 const UID: UID = CUSTOM_MODELS_COMPONENT_UID;
28}
29
30slots! {
31 /// `bool ICustomModelsComponent::addCustomModel(ModelType, int32_t, int32_t, StringView, StringView, int32_t, uint8_t, uint8_t)`
32 SLOT_ADD_CUSTOM_MODEL: usize = 18, 16;
33 /// `bool ICustomModelsComponent::getBaseModel(uint32_t &, uint32_t &)`
34 SLOT_GET_BASE_MODEL: usize = 19, 17;
35 /// `IEventDispatcher<PlayerModelsEventHandler> & ICustomModelsComponent::getEventDispatcher()`
36 SLOT_GET_EVENT_DISPATCHER: usize = 20, 18;
37 /// `StringView ICustomModelsComponent::getModelNameFromChecksum(uint32_t)`
38 SLOT_GET_MODEL_NAME_FROM_CHECKSUM: usize = 21, 19;
39 /// `bool ICustomModelsComponent::isValidCustomModel(int32_t)`
40 SLOT_IS_VALID_CUSTOM_MODEL: usize = 22, 20;
41 /// `bool ICustomModelsComponent::getCustomModelPath(int32_t, StringView &, StringView &)`
42 SLOT_GET_CUSTOM_MODEL_PATH: usize = 23, 21;
43}
44
45virtual_fns! {
46 /// `bool ICustomModelsComponent::addCustomModel(ModelType, int32_t, int32_t, StringView, StringView, int32_t, uint8_t, uint8_t)`.
47 ///
48 /// # Safety
49 /// `component` must be a live `ICustomModelsComponent`.
50 #[must_use]
51 pub fn custom_models_add_custom_model(
52 component: ICustomModelsComponent,
53 type_value: u8,
54 id: i32,
55 base_id: i32,
56 dff_name: StringView,
57 txd_name: StringView,
58 virtual_world: i32,
59 time_on: u8,
60 time_off: u8,
61 ) -> bool = [0, SLOT_ADD_CUSTOM_MODEL] or false;
62
63 /// `bool ICustomModelsComponent::getBaseModel(uint32_t &, uint32_t &)`.
64 ///
65 /// # Safety
66 /// `component` must be a live `ICustomModelsComponent`.
67 #[must_use]
68 pub fn custom_models_base_model(
69 component: ICustomModelsComponent,
70 base_model_id_or_input: &mut u32,
71 custom_model: &mut u32,
72 ) -> bool = [0, SLOT_GET_BASE_MODEL] or false;
73
74 /// `IEventDispatcher<PlayerModelsEventHandler> & ICustomModelsComponent::getEventDispatcher()`.
75 ///
76 /// # Safety
77 /// `component` must be a live `ICustomModelsComponent`.
78 #[must_use]
79 pub fn custom_models_event_dispatcher(
80 component: ICustomModelsComponent,
81 ) -> *mut EventDispatcher<PlayerModelsHandler> = [0, SLOT_GET_EVENT_DISPATCHER] or std::ptr::null_mut();
82
83 /// `bool ICustomModelsComponent::isValidCustomModel(int32_t)`.
84 ///
85 /// # Safety
86 /// `component` must be a live `ICustomModelsComponent`.
87 #[must_use]
88 pub fn custom_models_is_valid_custom_model(
89 component: ICustomModelsComponent,
90 model_id: i32,
91 ) -> bool = [0, SLOT_IS_VALID_CUSTOM_MODEL] or false;
92
93 /// `bool ICustomModelsComponent::getCustomModelPath(int32_t, StringView &, StringView &)`.
94 ///
95 /// # Safety
96 /// `component` must be a live `ICustomModelsComponent`.
97 #[must_use]
98 pub fn custom_models_custom_model_path(
99 component: ICustomModelsComponent,
100 model_id: i32,
101 dff_path: &mut StringView,
102 txd_path: &mut StringView,
103 ) -> bool = [0, SLOT_GET_CUSTOM_MODEL_PATH] or false;
104}
105
106/// `StringView ICustomModelsComponent::getModelNameFromChecksum(uint32_t)`.
107///
108/// # Safety
109/// `component` must be a live `ICustomModelsComponent`.
110#[must_use]
111pub unsafe fn custom_models_model_name_from_checksum(
112 component: *mut ICustomModelsComponent,
113 checksum: u32,
114) -> Option<String> {
115 let view = call_vtable_small_struct!(
116 component.cast::<u8>(),
117 0,
118 SLOT_GET_MODEL_NAME_FROM_CHECKSUM,
119 StringView,
120 StringView::EMPTY,
121 (u32)(checksum)
122 )?;
123 unsafe { view.to_owned_string() }
124}