|
2 | 2 | #![feature(stmt_expr_attributes)] |
3 | 3 | #![feature(unsafe_cell_from_mut)] |
4 | 4 |
|
| 5 | +use std::cell::RefCell; |
5 | 6 | use engage::{ |
6 | 7 | gamedata::{Gamedata, GodData}, |
7 | 8 | godpool::god_pool_try_get_gid, |
8 | 9 | proc::{ProcInst, ProcInstFields}, |
9 | 10 | }; |
| 11 | +use engage::proc::desc::ProcDesc; |
10 | 12 | use unity::prelude::*; |
11 | 13 |
|
12 | 14 | pub mod api; |
@@ -56,6 +58,33 @@ pub fn procinst_jump(this: &'static ProcInst, label: &i32, method_info: Optional |
56 | 58 |
|
57 | 59 | call_original!(this, label, method_info) |
58 | 60 | } |
| 61 | +#[skyline::from_offset(0x0281e4d0)] |
| 62 | +pub fn proc_inst_create_internal( |
| 63 | + this: &ProcInst, |
| 64 | + parent: Option<&ProcInst>, |
| 65 | + desc: &Il2CppArray<&ProcDesc>, |
| 66 | + name: Option<&Il2CppString>, |
| 67 | + is_bind: bool, |
| 68 | + method_info: OptionalMethod) -> &'static ProcInst; |
| 69 | + |
| 70 | +#[skyline::hook(offset=0x280a6b0)] |
| 71 | +pub fn proc_inst_create_bind( |
| 72 | + this: &'static mut ProcInst, |
| 73 | + parent: Option<&'static mut ProcInst>, |
| 74 | + desc: &'static Il2CppArray<&'static ProcDesc>, |
| 75 | + name: Option<&Il2CppString>, |
| 76 | + method_info: OptionalMethod) -> &'static ProcInst |
| 77 | +{ |
| 78 | + let proc = |
| 79 | + unsafe { |
| 80 | + proc_inst_create_internal(this, parent.as_deref(), desc, name, true, method_info) |
| 81 | + }; |
| 82 | + crate::api::events::publish_system_event(api::events::SystemEvent::ProcInstBind { |
| 83 | + proc: RefCell::new(this), |
| 84 | + parent: RefCell::new(parent) |
| 85 | + }); |
| 86 | + proc |
| 87 | +} |
59 | 88 |
|
60 | 89 | #[skyline::from_offset(0x429cc8)] |
61 | 90 | pub fn value_to_int(value: &i32) -> &i32; |
|
0 commit comments