pointer helper types that the sdk uses
This commit is contained in:
parent
a0d296053c
commit
3be8219eca
46
src/helper_types.rs
Normal file
46
src/helper_types.rs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
use crate::{fname::FName, tarray::FString};
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct TWeakObjectPtr<T> {
|
||||||
|
object_index: u32,
|
||||||
|
serial_number: u32,
|
||||||
|
phantom: PhantomData<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct TPersistentObjectPtr<T, P> {
|
||||||
|
weak: TWeakObjectPtr<T>,
|
||||||
|
tag_at_last_test: u32,
|
||||||
|
object_id: P,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type TLazyObjectPtr<T> = TPersistentObjectPtr<T, [u8; 0x10]>;
|
||||||
|
pub type TSoftObjectPtr<T> = TPersistentObjectPtr<T, FSoftObjectPath>;
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct FSoftObjectPath {
|
||||||
|
asset_path_name: FName,
|
||||||
|
sub_path_string: FString,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct TEnumAsByte<T> {
|
||||||
|
inner: u8,
|
||||||
|
phantom: PhantomData<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> TEnumAsByte<T> {
|
||||||
|
pub fn as_enum(&self) -> &T {
|
||||||
|
unsafe { &*core::mem::transmute::<_, *const T>(&self.inner as *const u8) }
|
||||||
|
}
|
||||||
|
pub fn as_mut_enum(&mut self) -> &mut T {
|
||||||
|
unsafe { &mut *core::mem::transmute::<_, *mut T>(&mut self.inner as *mut u8) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct FText([u8; 0x28]);
|
|
@ -9,6 +9,7 @@
|
||||||
// mod core_types;
|
// mod core_types;
|
||||||
pub mod fname;
|
pub mod fname;
|
||||||
pub mod global_tables;
|
pub mod global_tables;
|
||||||
|
pub mod helper_types;
|
||||||
pub mod tarray;
|
pub mod tarray;
|
||||||
// pub mod types;
|
// pub mod types;
|
||||||
pub mod v2_types;
|
pub mod v2_types;
|
||||||
|
|
Loading…
Reference in a new issue