-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathlib.rs
More file actions
63 lines (56 loc) 路 1.83 KB
/
Copy pathlib.rs
File metadata and controls
63 lines (56 loc) 路 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use std::time::Duration;
use eldenring::{
cs::{
CSTaskGroupIndex, CSTaskImp, CSWorldGeomMan, ChrInsExt, GeometrySpawnParameters,
WorldChrMan,
},
fd4::FD4TaskData,
util::input,
};
use fromsoftware_shared::{FromStatic, SharedTaskImpExt};
#[unsafe(no_mangle)]
/// # Safety
///
/// This is exposed this way such that windows LoadLibrary API can call it. Do not call this yourself.
pub unsafe extern "C" fn DllMain(_hmodule: usize, reason: u32) -> bool {
if reason != 1 {
return true;
}
// Kick off new thread.
std::thread::spawn(|| {
let cs_task = CSTaskImp::wait_for_instance(Duration::MAX).unwrap();
cs_task.run_recurring(
|_: &FD4TaskData| {
if !input::is_key_pressed(0x48) {
return;
}
let Some(player) = unsafe { WorldChrMan::instance() }
.ok()
.and_then(|w| w.main_player.as_ref())
else {
return;
};
let Some(block_geom_data) = unsafe { CSWorldGeomMan::instance_mut() }
.ok()
.and_then(|wgm| wgm.geom_block_data_by_id_mut(&player.chr_ins.block_id()))
else {
return;
};
block_geom_data.spawn_geometry(
"AEG099_831",
&GeometrySpawnParameters {
position: player.block_position,
rot_x: 0.0,
rot_y: 0.0,
rot_z: 0.0,
scale_x: 2.0,
scale_y: 2.0,
scale_z: 2.0,
},
);
},
CSTaskGroupIndex::ChrIns_PostPhysics,
);
});
true
}