Skip to content

Commit

Permalink
Allow getting args from kismet that don't impl Default
Browse files Browse the repository at this point in the history
  • Loading branch information
trumank committed Jun 7, 2024
1 parent ab00454 commit 3e05bd8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions hook/src/ue/kismet.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::mem::MaybeUninit;

use super::*;

#[derive(Debug)]
Expand All @@ -19,19 +21,18 @@ pub struct FFrame {
}

impl FFrame {
pub fn arg<T: Sized + Default>(self: &mut FFrame) -> T {
let mut ret: T = Default::default();
unsafe {
let ptr = &mut ret as *mut T as *mut _;
pub unsafe fn arg<T: Sized>(self: &mut FFrame) -> T {
let mut value: MaybeUninit<T> = MaybeUninit::zeroed();
let ptr = value.as_mut_ptr() as *mut _;

if self.code.is_null() {
let cur = self.property_chain_for_compiled_in;
self.property_chain_for_compiled_in = (*cur).next;
(globals().fframe_step_explicit_property())(self, ptr, cur as *const FProperty);
} else {
(globals().fframe_step())(self, self.object, ptr);
}
if self.code.is_null() {
let cur = self.property_chain_for_compiled_in;
self.property_chain_for_compiled_in = (*cur).next;
(globals().fframe_step_explicit_property())(self, ptr, cur as *const FProperty);
} else {
(globals().fframe_step())(self, self.object, ptr);
}
ret

value.assume_init()
}
}

0 comments on commit 3e05bd8

Please sign in to comment.