mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-24 06:01:02 +00:00
added more callbacks (#141)
This commit is contained in:
@@ -95,6 +95,7 @@ mapped_module* module_manager::map_local_module(const std::filesystem::path& fil
|
||||
|
||||
const auto image_base = mod.image_base;
|
||||
const auto entry = this->modules_.try_emplace(image_base, std::move(mod));
|
||||
this->on_module_load(entry.first->second);
|
||||
return &entry.first->second;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
@@ -146,6 +147,7 @@ bool module_manager::unmap(const uint64_t address, const logger& logger)
|
||||
|
||||
logger.log("Unmapping %s (0x%" PRIx64 ")\n", mod->second.path.generic_string().c_str(), mod->second.image_base);
|
||||
|
||||
this->on_module_unload(mod->second);
|
||||
unmap_module(*this->memory_, mod->second);
|
||||
this->modules_.erase(mod);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "mapped_module.hpp"
|
||||
#include "../file_system.hpp"
|
||||
#include <utils/function.hpp>
|
||||
|
||||
class logger;
|
||||
|
||||
@@ -10,6 +11,9 @@ class module_manager
|
||||
{
|
||||
public:
|
||||
using module_map = std::map<uint64_t, mapped_module>;
|
||||
utils::optional_function<void(mapped_module& mod)> on_module_load{};
|
||||
utils::optional_function<void(mapped_module& mod)> on_module_unload{};
|
||||
|
||||
module_manager(memory_manager& memory, file_system& file_sys);
|
||||
|
||||
void map_main_modules(const windows_path& executable_path, const windows_path& ntdll_path,
|
||||
|
||||
Reference in New Issue
Block a user