Skip to content

Commit

Permalink
Add support for v1.08
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed May 24, 2023
1 parent 83af3c0 commit 75e008d
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 1 deletion.
9 changes: 8 additions & 1 deletion d2fps/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod v105;
mod v106;
mod v106b;
mod v107;
mod v108;
mod v109d;
mod v110;
mod v111;
Expand Down Expand Up @@ -236,7 +237,13 @@ impl HookSet {
base_addresses: d2::v107::BASE_ADDRESSES,
load_modules: load_split_modules,
},
// (0x0001_0000, 0x0008_001c) => "1.08",
(0x0001_0000, 0x0008_001c) => &HookSet {
version: "1.08",
patch_sets: v108::PATCHES,
addresses: d2::v108::ADDRESSES,
base_addresses: d2::v108::BASE_ADDRESSES,
load_modules: load_split_modules,
},
// (0x0001_0000, 0x0009_0013) => "1.09",
// (0x0001_0000, 0x0009_0014) => "1.09b",
(0x0001_0000, 0x0009_0016) => &HookSet {
Expand Down
123 changes: 123 additions & 0 deletions d2fps/src/hooks/v108.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
use crate::hooks::{
draw_game, draw_game_paused, entity_iso_xpos, entity_iso_ypos, entity_linear_xpos,
entity_linear_ypos, game_loop_sleep_hook, ModulePatches, PatchSets,
};
use bin_patch::{patch_source, Patch};
use d2interface::{self as d2, v108::Entity};

#[rustfmt::skip]
pub(super) const PATCHES: PatchSets = PatchSets {
menu_fps: &[ModulePatches::new(
d2::Module::Win,
&[
// Draw menu framerate
Patch::call_c(0xe9f4, patch_source!("
8d4c2414
51
ff15 $c8d1916f
8d54241c
52
ff15 $80d1916f
8b742414
8b7c2418
8bc6
8bcf
2bc3
6a00
1bcd
6a19
51
50
e83b610000
3b542420
7c27
7f06
3b44241c
761f
8b442444
8bde
85c0
8bef
740e
8b542410
8bca
42
51
89542414
ffd0
e84e060000
"), super::v100::draw_menu_100_asm_stub),
// Menu char frame rate
Patch::call_c(0x1b6a, patch_source!("
8b4e10
8b4608
8b560c
03c1
894608
"), super::v100::update_menu_char_frame_100_asm_stub),
],
)],
game_fps: &[ModulePatches::new(
d2::Module::Client,
&[
// Game loop sleep patch
Patch::call_c(0x257c, patch_source!("
a1 $5047ba6f
85c0
7508
6a00
ff15 $a4bfb96f
"), game_loop_sleep_hook),
// Draw paused game framerate
Patch::call_c(0x9398, patch_source!("ff15 $c4ebbd6f"), draw_game_paused),
// Draw game framerate & entity sync
Patch::call_c(0x9abf, patch_source!("
392d $50eebd6f
752b
e884470800
85c0
742e
33c9
ff15 $c4ebbd6f
8b0d $d4ebbd6f
a1 $ecebbd6f
41
40
890d $d4ebbd6f
a3 $ecebbd6f
eb0c
396c2414
7406
ff05 $f4ebbd6f
"), draw_game::<Entity>),
],
)],
game_smoothing: &[
ModulePatches::new(
d2::Module::Client,
&[
// Course entity mouse detection
Patch::call_std1(0x8da3c, patch_source!("e8990e0300"), entity_iso_xpos::<Entity>),
Patch::call_std1(0x8da44, patch_source!("e88b0e0300"), entity_iso_ypos::<Entity>),
// Animated entity mouse detection refinement
Patch::call_std1(0x8dee6, patch_source!("e8ef090300"), entity_iso_xpos::<Entity>),
Patch::call_std1(0x8df0d, patch_source!("e8c2090300"), entity_iso_ypos::<Entity>),
// Npc mouse over perspective
Patch::call_std1(0xbde57, patch_source!("e80c0a0000"), entity_linear_xpos::<Entity>),
Patch::call_std1(0xbde50, patch_source!("e80d0a0000"), entity_linear_ypos::<Entity>),
// Npc mouse over
Patch::call_std1(0xbdea4, patch_source!("e8310a0000"), entity_iso_xpos::<Entity>),
Patch::call_std1(0xbdeb7, patch_source!("e8180a0000"), entity_iso_ypos::<Entity>),
],
),
ModulePatches::new(
d2::Module::Common,
&[
Patch::call_c(0x5f3b7, patch_source!("
893e
8d442414
"), super::v100::intercept_teleport_100_asm_stub),
],
),
],
};
1 change: 1 addition & 0 deletions d2interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub mod v105;
pub mod v106;
pub mod v106b;
pub mod v107;
pub mod v108;
pub mod v109d;
pub mod v110;
pub mod v111;
Expand Down
23 changes: 23 additions & 0 deletions d2interface/src/v108.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use crate::{module::Ordinal::Ordinal, Addresses};

pub use crate::v107::{
DyPos, Entity, EntityPos, EntityTable, EntityTables, Room, StaticPos, BASE_ADDRESSES,
};

pub const ADDRESSES: Addresses = Addresses {
player: 0x1245e0,
env_splashes: 0x10eb6c,
env_bubbles: 0x10eb70,
client_updates: 0x10ebd8,
game_type: 0x10edd0,
active_entities: 0x122de0,
draw_game_fn: 0x10ebc4,
client_fps_frames: 0x10ebec,
client_total_frames: 0x10ebd4,
// Doesn't exist in this version
apply_pos_change: 0,
in_perspective: Ordinal(10010),
hwnd: Ordinal(10027),
server_update_time: 0xee68c,
draw_menu: Ordinal(10019),
};

0 comments on commit 75e008d

Please sign in to comment.