mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 08:36:16 +00:00
Refactor emulator_object (#673)
This PR refactors `emulator_object` to make future support easier.
This commit is contained in:
@@ -66,8 +66,6 @@ class emulator_object
|
|||||||
public:
|
public:
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
|
||||||
emulator_object() = default;
|
|
||||||
|
|
||||||
emulator_object(const x64_emulator_wrapper& wrapper, const uint64_t address = 0)
|
emulator_object(const x64_emulator_wrapper& wrapper, const uint64_t address = 0)
|
||||||
: emulator_object(wrapper.get(), address)
|
: emulator_object(wrapper.get(), address)
|
||||||
{
|
{
|
||||||
@@ -84,6 +82,11 @@ class emulator_object
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emulator_object(utils::buffer_deserializer& buffer)
|
||||||
|
: emulator_object(buffer.read<memory_manager_wrapper>().get())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t value() const
|
uint64_t value() const
|
||||||
{
|
{
|
||||||
return this->address_;
|
return this->address_;
|
||||||
@@ -175,11 +178,6 @@ class emulator_object
|
|||||||
this->address_ = address;
|
this->address_ = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_memory_interface(memory_interface& memory)
|
|
||||||
{
|
|
||||||
this->memory_ = &memory;
|
|
||||||
}
|
|
||||||
|
|
||||||
emulator_object<T> shift(const int64_t offset) const
|
emulator_object<T> shift(const int64_t offset) const
|
||||||
{
|
{
|
||||||
return emulator_object<T>(*this->memory_, this->address_ + offset);
|
return emulator_object<T>(*this->memory_, this->address_ + offset);
|
||||||
|
|||||||
@@ -453,15 +453,6 @@ void process_context::deserialize(utils::buffer_deserializer& buffer)
|
|||||||
buffer.read_optional(this->process_params32);
|
buffer.read_optional(this->process_params32);
|
||||||
buffer.read(this->kusd);
|
buffer.read(this->kusd);
|
||||||
|
|
||||||
if (this->peb32.has_value())
|
|
||||||
{
|
|
||||||
this->peb32->set_memory_interface(*this->peb64.get_memory_interface());
|
|
||||||
}
|
|
||||||
if (this->process_params32.has_value())
|
|
||||||
{
|
|
||||||
this->process_params32->set_memory_interface(*this->peb64.get_memory_interface());
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer.read(this->is_wow64_process);
|
buffer.read(this->is_wow64_process);
|
||||||
buffer.read(this->ntdll_image_base);
|
buffer.read(this->ntdll_image_base);
|
||||||
buffer.read(this->ldr_initialize_thunk);
|
buffer.read(this->ldr_initialize_thunk);
|
||||||
|
|||||||
Reference in New Issue
Block a user