mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 16:46:16 +00:00
Fix tests and compilation
This commit is contained in:
@@ -9,9 +9,6 @@
|
||||
#include <functional>
|
||||
#include <typeindex>
|
||||
|
||||
void serialize();
|
||||
void deserialize();
|
||||
|
||||
namespace utils
|
||||
{
|
||||
class buffer_serializer;
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
#pragma once
|
||||
#include "memory_utils.hpp"
|
||||
#include <x64_emulator.hpp>
|
||||
|
||||
// TODO: Replace with pointer handling structure for future 32 bit support
|
||||
using emulator_pointer = uint64_t;
|
||||
|
||||
struct emulator_wrapper
|
||||
class x64_emulator_wrapper
|
||||
{
|
||||
emulator* emu;
|
||||
x64_emulator* emu_;
|
||||
|
||||
emulator& get() const
|
||||
public:
|
||||
x64_emulator_wrapper(x64_emulator& emu)
|
||||
: emu_(&emu)
|
||||
{
|
||||
return *this->emu;
|
||||
}
|
||||
|
||||
operator emulator&() const
|
||||
x64_emulator& get() const
|
||||
{
|
||||
return *this->emu_;
|
||||
}
|
||||
|
||||
operator x64_emulator&() const
|
||||
{
|
||||
return this->get();
|
||||
}
|
||||
@@ -33,8 +40,8 @@ class emulator_object
|
||||
public:
|
||||
using value_type = T;
|
||||
|
||||
emulator_object(const emulator_wrapper& wrapper, const uint64_t address = 0)
|
||||
: emulator_object(wrapper.emu, address)
|
||||
emulator_object(const x64_emulator_wrapper& wrapper, const uint64_t address = 0)
|
||||
: emulator_object(wrapper.get(), address)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ struct io_device_context
|
||||
|
||||
static io_device_context construct(utils::buffer_deserializer& buffer)
|
||||
{
|
||||
const auto wrapper = buffer.read<emulator_wrapper>();
|
||||
const auto wrapper = buffer.read<x64_emulator_wrapper>();
|
||||
return io_device_context{
|
||||
.io_status_block = wrapper.get(),
|
||||
};
|
||||
|
||||
@@ -202,6 +202,12 @@ public:
|
||||
this->release();
|
||||
}
|
||||
|
||||
static emulator_thread construct(utils::buffer_deserializer& buffer)
|
||||
{
|
||||
const auto wrapper = buffer.read<x64_emulator_wrapper>();
|
||||
return {wrapper.get()};
|
||||
}
|
||||
|
||||
moved_marker marker{};
|
||||
|
||||
x64_emulator* emu_ptr{};
|
||||
|
||||
@@ -1046,19 +1046,11 @@ void windows_emulator::serialize(utils::buffer_serializer& buffer) const
|
||||
|
||||
void windows_emulator::deserialize(utils::buffer_deserializer& buffer)
|
||||
{
|
||||
buffer.register_factory<emulator_wrapper>([this]
|
||||
buffer.register_factory<x64_emulator_wrapper>([this]
|
||||
{
|
||||
return emulator_wrapper{
|
||||
.emu = &this->emu(),
|
||||
};
|
||||
return x64_emulator_wrapper{this->emu()};
|
||||
});
|
||||
|
||||
buffer.register_factory<emulator_thread>([this]
|
||||
{
|
||||
return emulator_thread(this->emu());
|
||||
});
|
||||
|
||||
|
||||
buffer.read(this->use_relative_time_);
|
||||
|
||||
this->emu().deserialize(buffer);
|
||||
|
||||
Reference in New Issue
Block a user