arcdps/
callbacks.rs
1use crate::{
4 evtc::{Agent, Event},
5 imgui,
6 util::abi,
7};
8use std::os::raw::c_char;
9use windows::Win32::Foundation::{HWND, LPARAM, WPARAM};
10
11#[repr(C)]
13pub struct ArcDpsExport {
14 pub size: usize,
16
17 pub sig: u32,
21
22 pub imgui_version: u32,
26
27 pub out_name: *const c_char,
29
30 pub out_build: *const c_char,
32
33 pub wnd_nofilter: Option<RawWndProcCallback>,
37
38 pub combat: Option<RawCombatCallback>,
44
45 pub imgui: Option<RawImguiCallback>,
47
48 pub options_end: Option<RawOptionsCallback>,
52
53 pub combat_local: Option<RawCombatCallback>,
57
58 pub wnd_filter: Option<RawWndProcCallback>,
62
63 pub options_windows: Option<RawOptionsWindowsCallback>,
68}
69
70unsafe impl Sync for ArcDpsExport {}
71
72pub type InitFunc = fn() -> Result<(), String>;
73
74pub type ReleaseFunc = fn();
75
76pub type UpdateUrlFunc = fn() -> Option<String>;
77
78pub type WndProcCallback = fn(key: usize, key_down: bool, prev_key_down: bool) -> bool;
79
80pub type CombatCallback = fn(
81 event: Option<&Event>,
82 src: Option<&Agent>,
83 dst: Option<&Agent>,
84 skill_name: Option<&'static str>,
85 id: u64,
86 revision: u64,
87);
88
89pub type ImguiCallback = fn(ui: &imgui::Ui, not_character_select_or_loading: bool);
90
91pub type OptionsCallback = fn(ui: &imgui::Ui);
92
93pub type OptionsWindowsCallback = fn(ui: &imgui::Ui, window_name: Option<&str>) -> bool;
94
95abi! {
96 pub type RawWndProcCallback =
97 unsafe extern fn(h_wnd: HWND, u_msg: u32, w_param: WPARAM, l_param: LPARAM) -> u32;
98
99 pub type RawCombatCallback = unsafe extern fn(
100 event: *const Event,
101 src: *const Agent,
102 dst: *const Agent,
103 skill_name: *const c_char,
104 id: u64,
105 revision: u64,
106 );
107
108 pub type RawImguiCallback = unsafe extern fn(not_character_select_or_loading: u32);
109
110 pub type RawOptionsCallback = unsafe extern fn();
111
112 pub type RawOptionsWindowsCallback = unsafe extern fn(window_name: *const c_char) -> bool;
113}