Skip to content

Commit 35818d6

Browse files
authored
Update class.rs
1 parent cef7037 commit 35818d6

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

src/il2cpp/class.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct Il2CppClass1 {
2424
_1_end: [u8; 0x18],
2525
pub fields: *const FieldInfo,
2626
pub events: *const u8,
27-
pub properties: *const u8,
27+
pub properties: *const PropertyInfo,
2828
pub methods: *const &'static MethodInfo,
2929
pub nested_types: *const &'static Il2CppClass,
3030
implemented_interfaces: *const u8,
@@ -80,7 +80,6 @@ impl Debug for FieldInfo {
8080
}
8181

8282
impl FieldInfo {
83-
8483
pub fn is_instance(&self) -> bool {
8584
// TODO: Actually implement a bitfield
8685
(self.ty.bits >> 16) & 0x0010 == 0
@@ -95,6 +94,26 @@ impl FieldInfo {
9594
}
9695
}
9796

97+
#[repr(C)]
98+
pub struct PropertyInfo {
99+
pub class: &'static Il2CppClass,
100+
pub name: *const u8,
101+
pub get: &'static MethodInfo,
102+
pub set: &'static MethodInfo,
103+
pub attrs: i32,
104+
pub token: u32,
105+
}
106+
107+
impl PropertyInfo {
108+
pub fn get_name(&self) -> Option<String> {
109+
if self.name.is_null() {
110+
None
111+
} else {
112+
Some(unsafe { String::from_utf8_lossy(CStr::from_ptr(self.name as _).to_bytes()).to_string() })
113+
}
114+
}
115+
}
116+
98117
#[repr(C)]
99118
pub struct Il2CppRGCTXData {
100119
// dummy: *const u8,

0 commit comments

Comments
 (0)