mirror of
https://github.com/a2x/cs2-dumper.git
synced 2025-10-14 08:50:02 +08:00
Initial commit
This commit is contained in:
22
include/base/safe_handle.hpp
Normal file
22
include/base/safe_handle.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#define _AMD64_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <handleapi.h>
|
||||
|
||||
namespace base {
|
||||
namespace detail {
|
||||
struct HandleDisposer {
|
||||
using pointer = HANDLE;
|
||||
|
||||
void operator()(const HANDLE handle) const noexcept {
|
||||
if (handle != nullptr && handle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(handle);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
using SafeHandle = std::unique_ptr<HANDLE, detail::HandleDisposer>;
|
||||
}
|
34
include/process.hpp
Normal file
34
include/process.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
namespace process {
|
||||
bool attach(std::string_view process_name);
|
||||
|
||||
[[nodiscard]] std::optional<std::uintptr_t> find_pattern(std::string_view module_name, std::string_view pattern) noexcept;
|
||||
|
||||
[[nodiscard]] std::optional<std::uintptr_t> get_module_base(std::string_view module_name) 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;
|
||||
|
||||
bool write_memory(std::uintptr_t address, const void* buffer, std::size_t size) noexcept;
|
||||
|
||||
std::string read_string(std::uintptr_t address, std::size_t length) noexcept;
|
||||
|
||||
template <typename T>
|
||||
T read_memory(const std::uintptr_t address) noexcept {
|
||||
T buffer = {};
|
||||
|
||||
read_memory(address, &buffer, sizeof(T));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool write_memory(const std::uintptr_t address, const T& buffer) noexcept {
|
||||
return write_memory(address, &buffer, sizeof(T));
|
||||
}
|
||||
}
|
10
include/sdk/c_schema_class_field_data.hpp
Normal file
10
include/sdk/c_schema_class_field_data.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace sdk {
|
||||
class SchemaClassFieldData_t {
|
||||
public:
|
||||
[[nodiscard]] std::string get_name() const noexcept;
|
||||
|
||||
[[nodiscard]] std::uint16_t get_offset() const noexcept;
|
||||
};
|
||||
}
|
12
include/sdk/c_schema_class_info.hpp
Normal file
12
include/sdk/c_schema_class_info.hpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace sdk {
|
||||
class SchemaClassFieldData_t;
|
||||
|
||||
class CSchemaClassInfo {
|
||||
public:
|
||||
[[nodiscard]] std::uint16_t get_fields_count() const noexcept;
|
||||
|
||||
[[nodiscard]] std::vector<SchemaClassFieldData_t*> get_fields() const noexcept;
|
||||
};
|
||||
}
|
14
include/sdk/c_schema_system.hpp
Normal file
14
include/sdk/c_schema_system.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace sdk {
|
||||
class CSchemaSystemTypeScope;
|
||||
|
||||
class CSchemaSystem {
|
||||
public:
|
||||
static CSchemaSystem* get() noexcept;
|
||||
|
||||
[[nodiscard]] std::vector<CSchemaSystemTypeScope*> get_type_scopes() const noexcept;
|
||||
};
|
||||
}
|
15
include/sdk/c_schema_system_type_scope.hpp
Normal file
15
include/sdk/c_schema_system_type_scope.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
namespace sdk {
|
||||
class CSchemaClassInfo;
|
||||
class CSchemaType_DeclaredClass;
|
||||
|
||||
class CSchemaSystemTypeScope {
|
||||
public:
|
||||
[[nodiscard]] CSchemaClassInfo* find_declared_class(std::string_view class_name) const noexcept;
|
||||
|
||||
[[nodiscard]] std::vector<CSchemaType_DeclaredClass*> get_declared_classes() const noexcept;
|
||||
|
||||
[[nodiscard]] std::string get_module_name() const noexcept;
|
||||
};
|
||||
}
|
8
include/sdk/c_schema_type_declared_class.hpp
Normal file
8
include/sdk/c_schema_type_declared_class.hpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace sdk {
|
||||
class CSchemaType_DeclaredClass {
|
||||
public:
|
||||
[[nodiscard]] std::string get_class_name() const noexcept;
|
||||
};
|
||||
}
|
13
include/sdk/sdk.hpp
Normal file
13
include/sdk/sdk.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "process.hpp"
|
||||
|
||||
#include "c_schema_class_field_data.hpp"
|
||||
#include "c_schema_class_info.hpp"
|
||||
#include "c_schema_system.hpp"
|
||||
#include "c_schema_system_type_scope.hpp"
|
||||
#include "c_schema_type_declared_class.hpp"
|
7
include/utility/murmur_hash.hpp
Normal file
7
include/utility/murmur_hash.hpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace utility {
|
||||
std::uint32_t murmur_hash2(const void* key, std::uint32_t length, std::uint32_t seed);
|
||||
}
|
Reference in New Issue
Block a user