mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-04-05 00:25:36 +08:00
Fetch view angles offset
This commit is contained in:
parent
24d56461ff
commit
b6b8ee2fde
@ -1,5 +1,6 @@
|
||||
public static class client.dll {
|
||||
public static class client_dll {
|
||||
public const ulong entity_list = 0x1623bb8;
|
||||
public const ulong local_player_controller = 0x1714290;
|
||||
public const ulong view_angles = 0x1773ab0;
|
||||
public const ulong view_matrix = 0x1714d00;
|
||||
}
|
@ -2,8 +2,9 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace client.dll {
|
||||
namespace client_dll {
|
||||
constexpr std::ptrdiff_t entity_list = 0x1623bb8;
|
||||
constexpr std::ptrdiff_t local_player_controller = 0x1714290;
|
||||
constexpr std::ptrdiff_t view_angles = 0x1773ab0;
|
||||
constexpr std::ptrdiff_t view_matrix = 0x1714d00;
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
{
|
||||
"client.dll": {
|
||||
"client_dll": {
|
||||
"entity_list": 23215032,
|
||||
"local_player_controller": 24199824,
|
||||
"view_angles": 24591024,
|
||||
"view_matrix": 24202496
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#[allow(non_snake_case, non_upper_case_globals)]
|
||||
pub mod client.dll {
|
||||
pub mod client_dll {
|
||||
pub const entity_list: usize = 0x1623bb8;
|
||||
pub const local_player_controller: usize = 0x1714290;
|
||||
pub const view_angles: usize = 0x1773ab0;
|
||||
pub const view_matrix: usize = 0x1714d00;
|
||||
}
|
@ -11,6 +11,8 @@ namespace process {
|
||||
|
||||
[[nodiscard]] std::optional<std::uintptr_t> get_module_base(std::string_view module_name) noexcept;
|
||||
|
||||
[[nodiscard]] std::optional<std::uintptr_t> resolve_jmp(std::uintptr_t address) noexcept;
|
||||
|
||||
[[nodiscard]] std::optional<std::uintptr_t> resolve_rip_relative_address(std::uintptr_t address) noexcept;
|
||||
|
||||
bool read_memory(std::uintptr_t address, void* buffer, std::size_t size) noexcept;
|
||||
|
41
src/main.cpp
41
src/main.cpp
@ -88,34 +88,48 @@ void generate_files_for_type_scope(const sdk::CSchemaSystemTypeScope* type_scope
|
||||
}
|
||||
}
|
||||
|
||||
std::uint64_t get_entity_list() noexcept {
|
||||
std::optional<std::uint64_t> get_entity_list() noexcept {
|
||||
const std::optional<std::uint64_t> address = process::find_pattern("client.dll", "48 8B 0D ? ? ? ? 48 89 7C 24 ? 8B FA C1 EB");
|
||||
|
||||
if (!address.has_value())
|
||||
return 0;
|
||||
return std::nullopt;
|
||||
|
||||
return process::resolve_rip_relative_address(address.value()).value_or(0);
|
||||
}
|
||||
|
||||
std::uint64_t get_local_player() noexcept {
|
||||
std::optional<std::uint64_t> get_local_player() noexcept {
|
||||
std::optional<std::uint64_t> address = process::find_pattern("client.dll", "48 8B 0D ? ? ? ? F2 0F 11 44 24 ? F2 41 0F 10 00");
|
||||
|
||||
if (!address.has_value())
|
||||
return 0;
|
||||
return std::nullopt;
|
||||
|
||||
address = process::resolve_rip_relative_address(address.value());
|
||||
|
||||
if (!address.has_value())
|
||||
return 0;
|
||||
return std::nullopt;
|
||||
|
||||
return process::read_memory<std::uint64_t>(address.value()) + 0x50;
|
||||
}
|
||||
|
||||
std::uint64_t get_view_matrix() noexcept {
|
||||
std::optional<std::uint64_t> get_view_angles() noexcept {
|
||||
std::optional<std::uint64_t> address = process::find_pattern("client.dll", "48 8B 0D ? ? ? ? 48 8B 01 48 FF 60 30");
|
||||
|
||||
if (!address.has_value())
|
||||
return std::nullopt;
|
||||
|
||||
address = process::resolve_rip_relative_address(address.value());
|
||||
|
||||
if (!address.has_value())
|
||||
return std::nullopt;
|
||||
|
||||
return process::read_memory<std::uint64_t>(address.value()) + 0x4510;
|
||||
}
|
||||
|
||||
std::optional<std::uint64_t> get_view_matrix() noexcept {
|
||||
const std::optional<std::uint64_t> address = process::find_pattern("client.dll", "48 8D 0D ? ? ? ? 48 C1 E0 06");
|
||||
|
||||
if (!address.has_value())
|
||||
return 0;
|
||||
return std::nullopt;
|
||||
|
||||
return process::resolve_rip_relative_address(address.value()).value_or(0);
|
||||
}
|
||||
@ -129,18 +143,25 @@ void fetch_offsets() noexcept {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::uint64_t entity_list_rva = get_entity_list() - client_base.value();
|
||||
const std::uint64_t local_player_controller_rva = get_local_player() - client_base.value();
|
||||
const std::uint64_t view_matrix_rva = get_view_matrix() - client_base.value();
|
||||
const auto get_client_rva = [&client_base](const std::uint64_t address) -> std::uint64_t {
|
||||
return address - client_base.value();
|
||||
};
|
||||
|
||||
const std::uint64_t entity_list_rva = get_client_rva(get_entity_list().value_or(0));
|
||||
const std::uint64_t local_player_controller_rva = get_client_rva(get_local_player().value_or(0));
|
||||
const std::uint64_t view_angles_rva = get_client_rva(get_view_angles().value_or(0));
|
||||
const std::uint64_t view_matrix_rva = get_client_rva(get_view_matrix().value_or(0));
|
||||
|
||||
spdlog::info("entity list: {:#x}", entity_list_rva);
|
||||
spdlog::info("local player controller: {:#x}", local_player_controller_rva);
|
||||
spdlog::info("view angles: {:#x}", view_angles_rva);
|
||||
spdlog::info("view matrix: {:#x}", view_matrix_rva);
|
||||
|
||||
const Entries entries = {
|
||||
{ "client_dll", {
|
||||
{ "entity_list", entity_list_rva },
|
||||
{ "local_player_controller", local_player_controller_rva },
|
||||
{ "view_angles", view_angles_rva },
|
||||
{ "view_matrix", view_matrix_rva }
|
||||
} }
|
||||
};
|
||||
|
@ -136,6 +136,12 @@ namespace process {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<std::uintptr_t> resolve_jmp(const std::uintptr_t address) noexcept {
|
||||
const auto displacement = read_memory<std::int32_t>(address + 0x1);
|
||||
|
||||
return address + displacement + 0x5;
|
||||
}
|
||||
|
||||
std::optional<std::uintptr_t> resolve_rip_relative_address(const std::uintptr_t address) noexcept {
|
||||
const auto displacement = read_memory<std::int32_t>(address + 0x3);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user