Skip to content

Commit

Permalink
Finish support for v1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed May 24, 2023
1 parent b531fd3 commit 3b705f0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 26 deletions.
47 changes: 44 additions & 3 deletions d2fps/src/hooks/v111.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::hooks::{
draw_game, draw_game_paused, game_loop_sleep_hook, update_menu_char_frame, ModulePatches,
PatchSets,
draw_game, draw_game_paused, entity_iso_xpos, entity_iso_ypos, entity_linear_xpos,
entity_linear_ypos, game_loop_sleep_hook, intercept_teleport, update_menu_char_frame,
ModulePatches, PatchSets,
};
use bin_patch::{patch_source, Patch};
use core::arch::global_asm;
Expand Down Expand Up @@ -104,7 +105,31 @@ pub(super) const PATCHES: PatchSets = PatchSets {
"), draw_game::<Entity>),
],
)],
game_smoothing: &[],
game_smoothing: &[
ModulePatches::new(
d2::Module::Client,
&[
// Course entity mouse detection
Patch::call_std1(0x27274, patch_source!("e89d4efeff"), entity_iso_xpos::<Entity>),
Patch::call_std1(0x2727c, patch_source!("e8bf4efeff"), entity_iso_ypos::<Entity>),
// Animated entity mouse detection refinement
Patch::call_std1(0x2700e, patch_source!("e80351feff"), entity_iso_xpos::<Entity>),
Patch::call_std1(0x27033, patch_source!("e80851feff"), entity_iso_ypos::<Entity>),
// Npc mouse over perspective
Patch::call_std1(0xc3934, patch_source!("e89b87f4ff"), entity_linear_xpos::<Entity>),
Patch::call_std1(0xc392d, patch_source!("e86288f4ff"), entity_linear_ypos::<Entity>),
// Npc mouse over
Patch::call_std1(0xc398f, patch_source!("e88287f4ff"), entity_iso_xpos::<Entity>),
Patch::call_std1(0xc39a4, patch_source!("e89787f4ff"), entity_iso_ypos::<Entity>),
],
),
ModulePatches::new(
d2::Module::Common,
&[
Patch::call_c(0x11797, patch_source!("e874f8ffff"), intercept_teleport_111_asm_stub),
],
),
],
};

global_asm! {
Expand All @@ -121,3 +146,19 @@ global_asm! {
extern "C" {
pub fn update_menu_char_frame_111_asm_stub();
}

global_asm! {
".global _intercept_teleport_111_asm_stub",
"_intercept_teleport_111_asm_stub:",
"push ecx",
"push eax",
"mov ecx, [esi+0x30]",
"mov edx, [ecx+0xc]",
"mov ecx, [ecx]",
"call {}",
"jmp eax",
sym intercept_teleport,
}
extern "C" {
pub fn intercept_teleport_111_asm_stub();
}
21 changes: 2 additions & 19 deletions d2fps/src/hooks/v112.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::hooks::{
draw_game, draw_game_paused, entity_iso_xpos, entity_iso_ypos, entity_linear_xpos,
entity_linear_ypos, game_loop_sleep_hook, intercept_teleport, ModulePatches, PatchSets,
entity_linear_ypos, game_loop_sleep_hook, ModulePatches, PatchSets,
};
use bin_patch::{patch_source, Patch};
use core::arch::global_asm;
use d2interface::{self as d2, v112::Entity};

#[rustfmt::skip]
Expand Down Expand Up @@ -124,23 +123,7 @@ pub(super) const PATCHES: PatchSets = PatchSets {
),
ModulePatches::new(
d2::Module::Common,
&[Patch::call_c(0x4b467, patch_source!("e8 94faffff"), intercept_teleport_112_asm_stub)],
&[Patch::call_c(0x4b467, patch_source!("e8 94faffff"), super::v111::intercept_teleport_111_asm_stub)],
),
],
};

global_asm! {
".global _intercept_teleport_112_asm_stub",
"_intercept_teleport_112_asm_stub:",
"push ecx",
"push eax",
"mov ecx, [esi+0x30]",
"mov edx, [ecx+0xc]",
"mov ecx, [ecx]",
"call {}",
"jmp eax",
sym intercept_teleport,
}
extern "C" {
pub fn intercept_teleport_112_asm_stub();
}
2 changes: 1 addition & 1 deletion d2fps/src/hooks/v113c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub(super) const PATCHES: PatchSets = PatchSets {
),
ModulePatches::new(
d2::Module::Common,
&[Patch::call_c(0xe0b7, patch_source!("e8 84f9ffff"), super::v112::intercept_teleport_112_asm_stub)],
&[Patch::call_c(0xe0b7, patch_source!("e8 84f9ffff"), super::v111::intercept_teleport_111_asm_stub)],
),
],
};
2 changes: 1 addition & 1 deletion d2fps/src/hooks/v113d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub(super) const PATCHES: PatchSets = PatchSets {
),
ModulePatches::new(
d2::Module::Common,
&[Patch::call_c(0x6f367, patch_source!("e8 94faffff"), super::v112::intercept_teleport_112_asm_stub)],
&[Patch::call_c(0x6f367, patch_source!("e8 94faffff"), super::v111::intercept_teleport_111_asm_stub)],
),
],
};
4 changes: 2 additions & 2 deletions d2interface/src/v111.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ pub const ADDRESSES: Addresses = Addresses {
env_bubbles: 0x11c344,
client_updates: 0xfb398,
game_type: 0x11bfbc,
active_entities: 0,
active_entities: 0x10b290,
draw_game_fn: 0xfb384,
client_fps_frames: 0xfb3ac,
client_total_frames: 0xfb394,
// Signature: `__stdcall(DyPos* @ esi, FixedU16, FixedU16, Room*)`
apply_pos_change: 0,
apply_pos_change: 0x11010,
in_perspective: Ordinal(10060),
hwnd: Ordinal(10075),
server_update_time: 0x111c04,
Expand Down

0 comments on commit 3b705f0

Please sign in to comment.