pub struct OmpComponent {
pub uid: u64,
pub plugin_ptr: *mut (),
/* private fields */
}Expand description
Rust object with a layout compatible with Open Multiplayer’s IComponent*.
The layout differs between Linux (GCC i686) and Windows MSVC i686 because
FlatHashMap (robin_hood::unordered_flat_map) has a different sizeof on
each platform. The offset of uid_vtable (IUIDProvider subobject) is
hardcoded by the server and was confirmed via disasm:
- Linux/GCC i686:
uid_vtableat offset 40. - MSVC i686:
uid_vtableat offset 56 (server emitsadd ecx, 0x38when callinggetUID()onIComponent*).
Layout on i686 Linux (GCC / Itanium ABI):
offset 0: vtable* (primary IExtensible/IComponent)
offset 4: _misc_ext[36] (robin_hood::unordered_flat_map, zero-init = empty)
offset 40: uid_vtable* (secondary IUIDProvider)
offset 44: uid (UID = u64)
offset 52: plugin_ptr (*mut ())Layout on i686 Windows (MSVC ABI):
offset 0: vtable* (primary IExtensible/IComponent)
offset 4: _misc_ext[52] (padding + robin_hood + trailing pad, zero-init)
offset 56: uid_vtable* (secondary IUIDProvider)
offset 60: _uid_pad[4] (padding to align uid (u64) to 8 bytes)
offset 64: uid (UID = u64)
offset 72: plugin_ptr (*mut ())Fields§
§uid: u64Unique UID for this component.
plugin_ptr: *mut ()Pointer to the Rust plugin (SampPlugin).
Implementations§
Source§impl OmpComponent
impl OmpComponent
Sourcepub fn new(
vtable: *const IComponentVTable,
uid_vtable: *const IUIDProviderVTable,
uid: u64,
) -> OmpComponent
pub fn new( vtable: *const IComponentVTable, uid_vtable: *const IUIDProviderVTable, uid: u64, ) -> OmpComponent
Creates a new OmpComponent with a layout compatible with the platform ABI.
Trait Implementations§
impl Send for OmpComponent
impl Sync for OmpComponent
Auto Trait Implementations§
impl Freeze for OmpComponent
impl RefUnwindSafe for OmpComponent
impl Unpin for OmpComponent
impl UnsafeUnpin for OmpComponent
impl UnwindSafe for OmpComponent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more