Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for UE 5.4 #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/game_engine/unreal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,20 @@ impl Module {
};

let g_world = {
const GWORLD: &[(Signature<22>, u8)] = &[(
Signature::new("48 8B 05 ?? ?? ?? ?? 48 3B ?? 48 0F 44 ?? 48 89 05 ?? ?? ?? ?? E8"),
3,
)];
const GWORLD: &[(Signature<22>, u8)] = &[
(
Signature::new(
"80 7C 24 ?? 00 ?? ?? 48 8B 3D ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? ??",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing masks seem pointless to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are needed for having a Signature<22>, which in turn is needed because I'm looping the sigscan over an array

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you can't just make it a Signature<15>...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Signature<22> and Sifgnature<15> are different types, so you can't make an array of them,
And the second signature needs to be 22.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like incredibly flawed design.

Copy link
Collaborator

@CryZe CryZe Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do something like this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5215e39801e621c2c1fb432363276152

Instead of storing signatures in the array, you store function pointers.

),
10,
),
(
Signature::new(
"48 8B 05 ?? ?? ?? ?? 48 3B ?? 48 0F 44 ?? 48 89 05 ?? ?? ?? ?? E8",
),
3,
),
];

let addr = GWORLD.iter().find_map(|(sig, offset)| {
Some(sig.scan_process_range(process, module_range)? + *offset)
Expand Down Expand Up @@ -491,7 +501,7 @@ impl Offsets {
uproperty_property_link_next: 0x58,
},
// Tested on Unreal Physics
Version::V5_3 => &Self {
Version::V5_3 | Version::V5_4 => &Self {
uobject_fname: 0x18,
uobject_class: 0x10,
uclass_super_field: 0x40,
Expand Down Expand Up @@ -520,4 +530,5 @@ pub enum Version {
V5_1,
V5_2,
V5_3,
V5_4,
}