-
Автор темы
- #1
credits:
I spent a little time and made a parser of all schemes, it in "wok-csgo" style, but you can edit it.
schemes.hpp
schemes.cpp
example:
// init
// use
Пожалуйста, авторизуйтесь для просмотра ссылки.
&
Пожалуйста, авторизуйтесь для просмотра ссылки.
&
Пожалуйста, авторизуйтесь для просмотра ссылки.
I spent a little time and made a parser of all schemes, it in "wok-csgo" style, but you can edit it.
Пожалуйста, авторизуйтесь для просмотра ссылки.
Пожалуйста, авторизуйтесь для просмотра ссылки.
schemes.hpp
C++:
#pragma once
namespace fw {
namespace sdk {
class c_schemes {
public:
c_schemes();
template <typename t> t get(std::uint32_t hash) {
return m_data.m_list[hash];
}
private:
struct {
std::unordered_map<std::uint32_t, std::int16_t> m_list;
} m_data;
};
inline std::unique_ptr<c_schemes> schemes;
} // namespace sdk
} // namespace fw
#define SCHEMA(type, func, name) \
ALWAYS_INLINE type &func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return *reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset); \
}
#define ASCHEMA(type, size, func, name) \
ALWAYS_INLINE std::array<type, size> &func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return *reinterpret_cast<std::array<type, size> *>( \
reinterpret_cast<std::uintptr_t>(this) + offset); \
}
#define PSCHEMA(type, func, name) \
ALWAYS_INLINE type *func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset); \
}
#define SCHEMA_OFFSET(type, func, name, add) \
ALWAYS_INLINE type &func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return *reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset + add); \
}
#define ASCHEMA_OFFSET(type, size, func, name, add) \
ALWAYS_INLINE std::array<type, size> &func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return *reinterpret_cast<std::array<type, size> *>( \
reinterpret_cast<std::uintptr_t>(this) + offset + add); \
}
#define PSCHEMA_OFFSET(type, func, name, add) \
ALWAYS_INLINE type *func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset + add); \
}
#define MSCHEMA(type, func, name, modifier) \
ALWAYS_INLINE type &func { \
static const auto offset = \
fw::sdk::schemes->get<std::ptrdiff_t>(FNV1A(name)); \
return reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset * modifier); \
}
#define OFFSET(type, func, offset) \
ALWAYS_INLINE type &func { \
return *reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset); \
}
#define POFFSET(type, func, offset) \
ALWAYS_INLINE type *func { \
return reinterpret_cast<type *>(reinterpret_cast<std::uintptr_t>(this) + \
offset); \
}
#define PPOFFSET(type, func, offset) \
ALWAYS_INLINE type &func { \
return **reinterpret_cast<type **>( \
reinterpret_cast<std::uintptr_t>(this) + offset); \
}
#define MOFFSET(type, func, offset, modifier) \
ALWAYS_INLINE type &func { \
return **reinterpret_cast<type **>( \
reinterpret_cast<std::uintptr_t>(this) + offset * modifier); \
}
C++:
#include "../../../framework.hpp"
namespace fw {
namespace sdk {
c_schemes::c_schemes() {
// Get schema modules
const auto type_scopes = interfaces::m_schema_system->get_type_scopes();
// Iterate through modules
for (auto i = 0; i < type_scopes.Count(); ++i) {
// Get current module
const auto current = type_scopes.m_pElements[i];
// Current module invalid(?) or it's server module, so we skip.
if (!current || current->get_scope_name() == "server.dll")
continue;
// iterate through schema module classes
for (const auto schema_class_binding :
current->get_classes().GetElements()) {
// Get current class information
const auto class_info =
current->find_declared_class(schema_class_binding->m_binary_name);
// Class info invalid(?), so we skip.
if (!class_info)
continue;
// Iterate through class fields
for (int i = 0; i < class_info->m_align; ++i) {
// Get current class field
const auto ¤t_field = class_info->m_fields[i];
// Build schema name (class name + field name)
std::string schema_name = schema_class_binding->m_binary_name;
schema_name.append("->");
schema_name.append(current_field.m_name);
// Add schema to list
m_data.m_list[FNV1A_RT(schema_name.c_str())] =
current_field.m_single_inheritance_offset;
}
}
}
}
} // namespace sdk
} // namespace fw
// init
fw::sdk::schemes = std::make_unique<fw::sdk::c_schemes>();
// use
SCHEMA(std::uint8_t, m_iTeamNum(), "C_BaseEntity->m_iTeamNum");
Последнее редактирование: