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
//! `ICustomModelsComponent` — generated by `cargo xtask gen-omp` from `Server/Components/CustomModels/custommodels.hpp`.
//! Implemented by `CustomModelsComponent` in the server's `CustomModels`.
//!
//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
//! regenerate. Slots are clang's layout of the header for each ABI, checked
//! against the official binaries by `cargo xtask check-abi --generated`.
#![allow(unused_imports)]
use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
use crate::omp::types::{
Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
UID, Vector2, Vector3, Vector4, WorldTimePoint,
};
use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
use crate::omp::*;
opaque! {
/// Opaque handle for `ICustomModelsComponent*`.
pub ICustomModelsComponent;
}
/// `ModelsComponent_UID` in `Server/Components/CustomModels/custommodels.hpp`.
pub const CUSTOM_MODELS_COMPONENT_UID: UID = 0x15e3cb1e7c77ffff;
impl ComponentInterface for ICustomModelsComponent {
const UID: UID = CUSTOM_MODELS_COMPONENT_UID;
}
slots! {
/// `bool ICustomModelsComponent::addCustomModel(ModelType, int32_t, int32_t, StringView, StringView, int32_t, uint8_t, uint8_t)`
SLOT_ADD_CUSTOM_MODEL: usize = 18, 16;
/// `bool ICustomModelsComponent::getBaseModel(uint32_t &, uint32_t &)`
SLOT_GET_BASE_MODEL: usize = 19, 17;
/// `IEventDispatcher<PlayerModelsEventHandler> & ICustomModelsComponent::getEventDispatcher()`
SLOT_GET_EVENT_DISPATCHER: usize = 20, 18;
/// `StringView ICustomModelsComponent::getModelNameFromChecksum(uint32_t)`
SLOT_GET_MODEL_NAME_FROM_CHECKSUM: usize = 21, 19;
/// `bool ICustomModelsComponent::isValidCustomModel(int32_t)`
SLOT_IS_VALID_CUSTOM_MODEL: usize = 22, 20;
/// `bool ICustomModelsComponent::getCustomModelPath(int32_t, StringView &, StringView &)`
SLOT_GET_CUSTOM_MODEL_PATH: usize = 23, 21;
}
virtual_fns! {
/// `bool ICustomModelsComponent::addCustomModel(ModelType, int32_t, int32_t, StringView, StringView, int32_t, uint8_t, uint8_t)`.
///
/// # Safety
/// `component` must be a live `ICustomModelsComponent`.
#[must_use]
pub fn custom_models_add_custom_model(
component: ICustomModelsComponent,
type_value: u8,
id: i32,
base_id: i32,
dff_name: StringView,
txd_name: StringView,
virtual_world: i32,
time_on: u8,
time_off: u8,
) -> bool = [0, SLOT_ADD_CUSTOM_MODEL] or false;
/// `bool ICustomModelsComponent::getBaseModel(uint32_t &, uint32_t &)`.
///
/// # Safety
/// `component` must be a live `ICustomModelsComponent`.
#[must_use]
pub fn custom_models_base_model(
component: ICustomModelsComponent,
base_model_id_or_input: &mut u32,
custom_model: &mut u32,
) -> bool = [0, SLOT_GET_BASE_MODEL] or false;
/// `IEventDispatcher<PlayerModelsEventHandler> & ICustomModelsComponent::getEventDispatcher()`.
///
/// # Safety
/// `component` must be a live `ICustomModelsComponent`.
#[must_use]
pub fn custom_models_event_dispatcher(
component: ICustomModelsComponent,
) -> *mut EventDispatcher<PlayerModelsHandler> = [0, SLOT_GET_EVENT_DISPATCHER] or std::ptr::null_mut();
/// `bool ICustomModelsComponent::isValidCustomModel(int32_t)`.
///
/// # Safety
/// `component` must be a live `ICustomModelsComponent`.
#[must_use]
pub fn custom_models_is_valid_custom_model(
component: ICustomModelsComponent,
model_id: i32,
) -> bool = [0, SLOT_IS_VALID_CUSTOM_MODEL] or false;
/// `bool ICustomModelsComponent::getCustomModelPath(int32_t, StringView &, StringView &)`.
///
/// # Safety
/// `component` must be a live `ICustomModelsComponent`.
#[must_use]
pub fn custom_models_custom_model_path(
component: ICustomModelsComponent,
model_id: i32,
dff_path: &mut StringView,
txd_path: &mut StringView,
) -> bool = [0, SLOT_GET_CUSTOM_MODEL_PATH] or false;
}
/// `StringView ICustomModelsComponent::getModelNameFromChecksum(uint32_t)`.
///
/// # Safety
/// `component` must be a live `ICustomModelsComponent`.
#[must_use]
pub unsafe fn custom_models_model_name_from_checksum(
component: *mut ICustomModelsComponent,
checksum: u32,
) -> Option<String> {
let view = call_vtable_small_struct!(
component.cast::<u8>(),
0,
SLOT_GET_MODEL_NAME_FROM_CHECKSUM,
StringView,
StringView::EMPTY,
(u32)(checksum)
)?;
unsafe { view.to_owned_string() }
}