diff --git a/Memory/Memory.cpp b/Memory/Memory.cpp index aa06225..3fa73a5 100644 --- a/Memory/Memory.cpp +++ b/Memory/Memory.cpp @@ -19,6 +19,12 @@ const char* Memory::Float32ToHexBytes(float value) { return bytes; // pointeur vers les 4 octets bruts } +std::vector Memory::ReadBytes(const void* addr, std::size_t size) { + std::vector buffer(size); + std::memcpy(buffer.data(), addr, size); + return buffer; +} + void Memory::PatchBytes(void* address, const char* bytes, size_t len) { auto it = patches.find(address); diff --git a/Memory/Memory.hpp b/Memory/Memory.hpp index b93aca6..8fe9a2c 100644 --- a/Memory/Memory.hpp +++ b/Memory/Memory.hpp @@ -20,6 +20,15 @@ class Memory */ static const char* Float32ToHexBytes(float value); + /** + * Read x bytes in memory. + * + * @param address : The address to read. + * @param size : The size in bytes to read + * @std::vector : The bytes read. + */ + static std::vector ReadBytes(const void* addr, std::size_t size); + /** * Patch x bytes in memory. *