mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-27 23:11:02 +00:00
Ignore certain function calls
This commit is contained in:
@@ -22,6 +22,7 @@ namespace
|
||||
std::string registry_path{"./registry"};
|
||||
std::string emulation_root{};
|
||||
std::set<std::string, std::less<>> modules{};
|
||||
std::set<std::string, std::less<>> ignored_functions{};
|
||||
std::unordered_map<windows_path, std::filesystem::path> path_mappings{};
|
||||
};
|
||||
|
||||
@@ -172,6 +173,7 @@ namespace
|
||||
.silent_until_main = options.concise_logging,
|
||||
.path_mappings = options.path_mappings,
|
||||
.modules = options.modules,
|
||||
.ignored_functions = options.ignored_functions,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -353,6 +355,15 @@ namespace
|
||||
arg_it = args.erase(arg_it);
|
||||
options.dump = args[0];
|
||||
}
|
||||
else if (arg == "-i")
|
||||
{
|
||||
if (args.size() < 2)
|
||||
{
|
||||
throw std::runtime_error("No ignored function provided after -i");
|
||||
}
|
||||
arg_it = args.erase(arg_it);
|
||||
options.ignored_functions.emplace(args[0]);
|
||||
}
|
||||
else if (arg == "-p")
|
||||
{
|
||||
if (args.size() < 3)
|
||||
|
||||
@@ -241,7 +241,9 @@ windows_emulator::windows_emulator(const emulator_settings& settings, emulator_c
|
||||
memory(*this->emu_),
|
||||
registry(emulation_root.empty() ? settings.registry_directory : emulation_root / "registry"),
|
||||
mod_manager(memory, file_sys, this->callbacks),
|
||||
process(*this->emu_, memory, *this->clock_, this->callbacks)
|
||||
process(*this->emu_, memory, *this->clock_, this->callbacks),
|
||||
modules_(settings.modules),
|
||||
ignored_functions_(settings.ignored_functions)
|
||||
{
|
||||
#ifndef OS_WINDOWS
|
||||
if (this->emulation_root.empty())
|
||||
@@ -264,7 +266,6 @@ windows_emulator::windows_emulator(const emulator_settings& settings, emulator_c
|
||||
this->silent_until_main_ = settings.silent_until_main && !settings.disable_logging;
|
||||
this->use_relative_time_ = settings.use_relative_time;
|
||||
this->log.disable_output(settings.disable_logging || this->silent_until_main_);
|
||||
this->modules_ = settings.modules;
|
||||
|
||||
this->setup_hooks();
|
||||
}
|
||||
@@ -393,7 +394,7 @@ void windows_emulator::on_instruction_execution(const uint64_t address)
|
||||
if (binary)
|
||||
{
|
||||
const auto export_entry = binary->address_names.find(address);
|
||||
if (export_entry != binary->address_names.end())
|
||||
if (export_entry != binary->address_names.end() && !this->ignored_functions_.contains(export_entry->second))
|
||||
{
|
||||
const auto rsp = this->emu().read_stack_pointer();
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ struct emulator_settings
|
||||
std::unordered_map<uint16_t, uint16_t> port_mappings{};
|
||||
std::unordered_map<windows_path, std::filesystem::path> path_mappings{};
|
||||
std::set<std::string, std::less<>> modules{};
|
||||
std::set<std::string, std::less<>> ignored_functions{};
|
||||
};
|
||||
|
||||
struct emulator_interfaces
|
||||
@@ -194,6 +195,7 @@ class windows_emulator
|
||||
std::unordered_map<uint16_t, uint16_t> port_mappings_{};
|
||||
|
||||
std::set<std::string, std::less<>> modules_{};
|
||||
std::set<std::string, std::less<>> ignored_functions_{};
|
||||
std::vector<std::byte> process_snapshot_{};
|
||||
// std::optional<process_context> process_snapshot_{};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user