Small fixes and additions

This commit is contained in:
momo5502
2024-11-23 16:44:49 +01:00
parent 2c421df771
commit 84a0aed1d9
4 changed files with 28 additions and 17 deletions

View File

@@ -5,22 +5,23 @@
// TODO: Replace with pointer handling structure for future 32 bit support
using emulator_pointer = uint64_t;
class x64_emulator_wrapper
template<typename T>
class object_wrapper
{
x64_emulator* emu_;
T* obj_;
public:
x64_emulator_wrapper(x64_emulator& emu)
: emu_(&emu)
object_wrapper(T& obj)
: obj_(&obj)
{
}
x64_emulator& get() const
T& get() const
{
return *this->emu_;
return *this->obj_;
}
operator x64_emulator&() const
operator T&() const
{
return this->get();
}
@@ -34,6 +35,11 @@ public:
}
};
class windows_emulator;
using x64_emulator_wrapper = object_wrapper<x64_emulator>;
using windows_emulator_wrapper = object_wrapper<windows_emulator>;
template <typename T>
class emulator_object
{

View File

@@ -41,7 +41,7 @@ void syscall_dispatcher::add_handlers()
{
std::map<std::string, syscall_handler> handler_mapping{};
this->add_handlers(handler_mapping);
syscall_dispatcher::add_handlers(handler_mapping);
for (auto& entry : this->handlers_)
{

View File

@@ -1051,6 +1051,11 @@ void windows_emulator::deserialize(utils::buffer_deserializer& buffer)
return x64_emulator_wrapper{this->emu()};
});
buffer.register_factory<windows_emulator_wrapper>([this]
{
return windows_emulator_wrapper{*this};
});
buffer.read(this->use_relative_time_);
this->emu().deserialize(buffer);