-
Автор темы
- #1
Я буду рад любой помощи от вас
Сбой происходит сразу после вызова sdk::interfaces::key_values_t* key_values = sdk::interfaces::key_values_t::set_type(); в bool visuals::c_models::init().
bool visuals::c_models::init() вызывается в DllMain сразу после инициализации всех интерфейсов и схем, а тауже адрессов.
crash:
call stack:
Все что связано с интерфейсом и структурами кивалуе
Инит часмса
/адреса и их скан
Может кто то сталкивался ну или понимает хотяб в какую сторону мне капать.
Сбой происходит сразу после вызова sdk::interfaces::key_values_t* key_values = sdk::interfaces::key_values_t::set_type(); в bool visuals::c_models::init().
bool visuals::c_models::init() вызывается в DllMain сразу после инициализации всех интерфейсов и схем, а тауже адрессов.
crash:
Пожалуйста, авторизуйтесь для просмотра ссылки.
call stack:
Пожалуйста, авторизуйтесь для просмотра ссылки.
Все что связано с интерфейсом и структурами кивалуе
C++:
namespace sdk {
namespace interfaces {
struct material_t {
public:
virtual const char* get_name() = 0;
virtual const char* get_share_name() = 0;
};
struct kv_id_t {
public:
const char* m_name{};
std::uint64_t m_key0{}, m_key1{};
};
struct key_values_t {
private:
[[ maybe_unused ]] char pad0[0x100u]{};
public:
std::uint64_t m_key{};
void* m_value{};
private:
[[ maybe_unused ]] char pad1[0x8u]{};
public:
always_inline static key_values_t* set_type() {
using fn_t = key_values_t * (__fastcall*)(key_values_t*, unsigned int, unsigned int);
fn_t fn = g_shema->offsets().m_set_type.as<fn_t>();
if (fn == nullptr) {
return {};
}
key_values_t* key_values = new key_values_t[0x10u];
fn(key_values, 1u, 2u);
}
always_inline void load_from_buffer(const char* buffer) {
utl_buffer_t utl_buffer(0, (std::strlen(buffer) + 10u), 1u); {
utl_buffer.put_string(buffer);
load_key_values(&utl_buffer);
}
}
private:
always_inline bool load_key_values(utl_buffer_t* buffer) {
kv_id_t kv_id = kv_id_t("generic", 0x41B818518343427E, 0xB5F447C23C0CDF8C);
using fn_t = bool(__fastcall*)(key_values_t*, void*, utl_buffer_t*, kv_id_t*, void*, void*, void*, void*, const char*);
fn_t fn = g_shema->offsets().m_load_key_values.as<fn_t>();
if (fn == nullptr) {
return false;
}
fn(this, nullptr, buffer, &kv_id, nullptr, nullptr, nullptr, nullptr, nullptr);
}
};
inline bool(__fastcall* key_values)(key_values_t*, void*, const char*, const kv_id_t*, const char*);
struct material_key_var_t {
public:
std::uint64_t m_key;
const char* m_name;
public:
material_key_var_t(std::uint64_t key, const char* name) :
m_key(key), m_name(name) { }
material_key_var_t(const char* name, bool shold_find_key = false) :
m_name(name)
{
m_key = shold_find_key ? find_key(name) : 0x0;
}
public:
always_inline std::uint64_t find_key(const char* name) {
using fn_t = std::uint64_t(__fastcall*)(const char*, unsigned int, int);
fn_t fn = g_shema->offsets().m_find_key_var.as<fn_t>();
if (fn == nullptr) {
return {};
}
key_values_t* key_values = new key_values_t[0x10u];
fn(name, 0x12, 0x31415926);
}
};
struct resource_array_t {
public:
uint64_t m_count{};
material_t*** m_resources{};
private:
[[maybe_unused]] char pad0[3u]{};
};
struct material_record_t {
private:
std::uint64_t m_a1{};
std::uint32_t m_a2{};
public:
std::uint32_t m_index{};
};
struct object_info_t {
private:
[[ maybe_unused ]] char pad0[0xb0u]{};
public:
int m_id{};
};
struct scene_animatable_object_t {
private:
[[ maybe_unused ]] char pad0[0xb8u]{};
public:
ent_handle_t m_owner_handle{};
};
struct material_data_t {
private:
[[ maybe_unused]] char pad0[0x18u]{};
public:
scene_animatable_object_t* m_scene_animatable_object{};
material_t* m_material{};
private:
[[ maybe_unused ]] char pad1[0x18u]{};
public:
std::array< byte, 4u > m_clr{};
private:
[[ maybe_unused ]] char pad2[0x4]{};
public:
object_info_t* m_object_info{};
public:
always_inline void set_shader_type(const char* shader_name) {
using fn_t = void(__fastcall*)(void*, material_key_var_t, const char*, int);
fn_t fn = g_shema->offsets().m_set_shader_type.as<fn_t>();
if (fn == nullptr) {
return;
}
material_key_var_t shader_var(0x162C1777, "shader");
fn(this, shader_var, shader_name, 0x18);
}
always_inline void set_material_function(const char* function_name, int value) {
using fn_t = void(__fastcall*)(void*, material_key_var_t, int, int);
fn_t fn = g_shema->offsets().m_set_material_function.as<fn_t>();
if (fn == nullptr) {
return;
}
material_key_var_t function_var(function_name, true);
fn(this, function_var, value, 0x18);
}
};
struct i_material_system_t {
public:
vfunc(material_t*** (__thiscall*)(decltype(this), material_t***, const char*),
find_material(material_t*** out_material, const char* name), 14u, out_material, name
);
vfunc(material_t** (__thiscall*)(decltype(this), material_t***, const char*, material_data_t*, int, int, int, int, int, int),
create_material(material_t*** out_material, const char* name, material_data_t* data), 29u, out_material, name, data,
0, 0, 0, 0, 0, 1
);
vfunc(void(__thiscall*)(decltype(this), void*, material_t***),
set_create_sata_material(void* data, material_t*** material), 37u, data, material
);
} inline* i_material_system{};
}
}
C++:
static constexpr char szVMatBufferWhiteVisible[] =
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_unlitgeneric.vfx"
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_BLEND_MODE = 1
g_vColorTint = [1, 1, 1, 1]
TextureAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tTintMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
})";
static constexpr char szVMatBufferWhiteInvisible[] =
R"(<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
shader = "csgo_unlitgeneric.vfx"
F_PAINT_VERTEX_COLORS = 1
F_TRANSLUCENT = 1
F_BLEND_MODE = 1
F_DISABLE_Z_BUFFERING = 1
g_vColorTint = [1, 1, 1, 1]
TextureAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tAmbientOcclusion = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tColor = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tNormal = resource:"materials/default/default_mask_tga_fde710a5.vtex"
g_tTintMask = resource:"materials/default/default_mask_tga_fde710a5.vtex"
})";
bool visuals::c_models::init() {
if (m_inited)
return m_inited;
materials[0u] = data_t{
.m_vis_material = create_material("materials/dev/primary_white.vmat", szVMatBufferWhiteVisible),
.m_invis_material = create_material("pmaterials/dev/primary_white.vmat", szVMatBufferWhiteInvisible)
};
m_inited = true;
for (auto& [vis_material, invis_material] : materials) {
if (!vis_material || !invis_material)
m_inited = false;
}
return m_inited;
}
void visuals::c_models::undo() {
//todo
}
sdk::strong_handle_t<sdk::interfaces::material_t> visuals::c_models::create_material(const char* m_aterial_name, const char vmat_buffer[]) {
sdk::interfaces::key_values_t* key_values = sdk::interfaces::key_values_t::set_type();
key_values->load_from_buffer(vmat_buffer);
sdk::strong_handle_t<sdk::interfaces::material_t> custom_material = {};
return custom_material;
}
C++:
// tier0.dll
{ const dependencie::c_memory_system::code_section_t tier0_dll{ modules.at(obfuscation->hash_str("tier0.dll")) };
m_offsets.m_load_key_values = byte_wrapper("E8 ? ? ? ? EB 36 8B 43 10").search(
tier0_dll.m_start, tier0_dll.m_end
);
}
// particles.dll
{ const dependencie::c_memory_system::code_section_t particles_dll{ modules.at(obfuscation->hash_str("particles.dll")) };
m_offsets.m_find_key_var = byte_wrapper("48 89 5C 24 ? 57 48 81 EC ? ? ? ? 33 C0 8B DA").search(
particles_dll.m_start, particles_dll.m_end
);
m_offsets.m_set_shader_type = byte_wrapper("48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 83 EC ? 0F B6 01 45 0F B6 F9 8B 2A 4D 8B E0 4C 8B 72 ? 48 8B F9 C0 E8 ? 24 ? 3C ? 74 ? 41 B0 ? B2 ? E8 ? ? ? ? 0F B6 07 33 DB C0 E8 ? 24 ? 3C ? 75 ? 48 8B 77 ? EB ? 48 8B F3 4C 8D 44 24 ? C7 44 24 ? ? ? ? ? 48 8D 54 24 ? 89 6C 24 ? 48 8B CE 4C 89 74 24 ? E8 ? ? ? ? 8B D0 83 F8 ? 75 ? 45 33 C9 89 6C 24 ? 4C 8D 44 24 ? 4C 89 74 24 ? 48 8B D7 48 8B CE E8 ? ? ? ? 8B D0 0F B6 0F C0 E9 ? 80 E1 ? 80 F9 ? 75 ? 48 8B 4F ? EB ? 48 8B CB 8B 41 ? 85 C0 74 ? 48 8D 59 ? 83 F8 ? 76 ? 48 8B 1B 48 63 C2 4D 85 E4").search(
particles_dll.m_start, particles_dll.m_end
);
m_offsets.m_set_material_function = byte_wrapper("48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 54 41 56 41 57 48 83 EC ? 0F B6 01 45 0F B6 F9 8B 2A 48 8B F9").search(
particles_dll.m_start, particles_dll.m_end
);
}
{ const dependencie::c_memory_system::code_section_t client_dll{ modules.at(obfuscation->hash_str("client.dll")) };
m_offsets.m_set_type = byte_wrapper("40 53 48 83 EC 20 48 8B 01 48 8B D9 44").search(
client_dll.m_start, client_dll.m_end
);
}