📦 Game Update 13938

This commit is contained in:
a2x
2023-09-14 11:13:53 +10:00
parent 2e7cc79b06
commit 913252320e
31 changed files with 8620 additions and 8675 deletions

View File

@@ -60,40 +60,6 @@ void generate_file(const std::string_view file_name, const Entries& entries, IFi
}
}
void generate_files_for_type_scope(const sdk::CSchemaSystemTypeScope* type_scope) {
if (type_scope == nullptr)
return;
const std::string module_name = type_scope->get_module_name();
spdlog::info("generating files for {}...", module_name);
Entries entries;
for (const sdk::CSchemaType_DeclaredClass* declared_class : type_scope->get_declared_classes()) {
if (declared_class == nullptr)
continue;
const sdk::CSchemaClassInfo* class_info = type_scope->find_declared_class(declared_class->get_class_name());
if (class_info == nullptr)
continue;
for (const sdk::SchemaClassFieldData_t* field : class_info->get_fields()) {
if (field == nullptr)
continue;
entries[declared_class->get_class_name()].emplace_back(field->get_name(), field->get_offset());
}
}
for (const auto& [extension, builder] : builders) {
generate_file(module_name, entries, *builder);
spdlog::info(" > generated {}.{}!", module_name, extension);
}
}
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");
@@ -154,6 +120,52 @@ std::optional<std::uint64_t> get_view_matrix() noexcept {
return process::resolve_rip_relative_address(address.value()).value_or(0);
}
void dump_schema_classes() {
const auto schema_system = sdk::CSchemaSystem::get();
if (schema_system == nullptr) {
spdlog::error("failed to get schema system.");
return;
}
spdlog::info("schema system: {:#x}", reinterpret_cast<std::uint64_t>(schema_system));
for (const sdk::CSchemaSystemTypeScope* type_scope : schema_system->get_type_scopes()) {
if (type_scope == nullptr)
continue;
const std::string module_name = type_scope->get_module_name();
spdlog::info("generating files for {}...", module_name);
Entries entries;
for (const sdk::CSchemaType_DeclaredClass* declared_class : type_scope->get_declared_classes()) {
if (declared_class == nullptr)
continue;
const sdk::CSchemaClassInfo* class_info = type_scope->find_declared_class(declared_class->get_class_name());
if (class_info == nullptr)
continue;
for (const sdk::SchemaClassFieldData_t* field : class_info->get_fields()) {
if (field == nullptr)
continue;
entries[declared_class->get_class_name()].emplace_back(field->get_name(), field->get_offset());
}
}
for (const auto& [extension, builder] : builders) {
generate_file(module_name, entries, *builder);
spdlog::info(" > generated {}.{}!", module_name, extension);
}
}
}
void dump_interfaces() noexcept {
const std::optional<std::vector<std::string>> loaded_modules = process::get_loaded_modules();
@@ -263,18 +275,7 @@ int main() {
spdlog::info("attached to process!");
const auto schema_system = sdk::CSchemaSystem::get();
if (schema_system == nullptr) {
spdlog::error("failed to get schema system.");
return 1;
}
spdlog::info("schema system: {:#x}", reinterpret_cast<std::uint64_t>(schema_system));
for (const sdk::CSchemaSystemTypeScope* type_scope : schema_system->get_type_scopes())
generate_files_for_type_scope(type_scope);
dump_schema_classes();
dump_interfaces();

View File

@@ -119,17 +119,17 @@ namespace process {
}
std::optional<std::uintptr_t> get_export(const std::uintptr_t module_base, const std::string_view function_name) noexcept {
const auto buffer = std::make_unique<std::uint8_t[]>(0x1000);
const auto headers = std::make_unique<std::uint8_t[]>(0x1000);
if (!read_memory(module_base, buffer.get(), 0x1000))
if (!read_memory(module_base, headers.get(), 0x1000))
return std::nullopt;
const auto dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(buffer.get());
const auto dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(headers.get());
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
return std::nullopt;
const auto nt_headers = reinterpret_cast<PIMAGE_NT_HEADERS>(buffer.get() + dos_header->e_lfanew);
const auto nt_headers = reinterpret_cast<PIMAGE_NT_HEADERS>(headers.get() + dos_header->e_lfanew);
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
return std::nullopt;

View File

@@ -13,7 +13,7 @@ namespace sdk {
const std::int32_t hash_transform4 = (hash_transform2 ^ (hash_transform2 >> 0x10)) ^ (static_cast<std::uint16_t>(hash_transform2 ^ (hash_part >> 0x10)) >> 0x8);
const auto get_class_info = [&](const std::uint64_t address) -> CSchemaClassInfo* {
const std::uint64_t class_info_address = address + 0x558 + static_cast<std::uint64_t>(0x28) * static_cast<std::uint8_t>(hash_transform4);
const std::uint64_t class_info_address = address + 0x588 + static_cast<std::uint64_t>(0x28) * static_cast<std::uint8_t>(hash_transform4);
const auto initial_address = process::read_memory<std::uint64_t>(class_info_address + 0x58);
@@ -69,7 +69,7 @@ namespace sdk {
std::vector<CSchemaType_DeclaredClass*> CSchemaSystemTypeScope::get_declared_classes() const noexcept {
std::vector<CSchemaType_DeclaredClass*> classes;
const std::uint64_t base = reinterpret_cast<std::uint64_t>(this) + 0x558;
const std::uint64_t base = reinterpret_cast<std::uint64_t>(this) + 0x588;
const auto block_size = process::read_memory<std::uint32_t>(base + 0x4);
const auto count = process::read_memory<std::uint32_t>(base + 0x10);