mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-30 00:01:02 +00:00
Separate application and emulator settings
This commit is contained in:
@@ -38,7 +38,30 @@ namespace test
|
||||
return env;
|
||||
}
|
||||
|
||||
inline windows_emulator create_sample_emulator(emulator_settings settings, const bool reproducible = false,
|
||||
struct sample_configuration
|
||||
{
|
||||
bool reproducible{false};
|
||||
bool print_time{false};
|
||||
};
|
||||
|
||||
inline application_settings get_sample_app_settings(const sample_configuration& config)
|
||||
{
|
||||
application_settings settings{.application = "C:\\test-sample.exe"};
|
||||
|
||||
if (config.print_time)
|
||||
{
|
||||
settings.arguments.emplace_back(u"-time");
|
||||
}
|
||||
|
||||
if (config.reproducible)
|
||||
{
|
||||
settings.arguments.emplace_back(u"-reproducible");
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
inline windows_emulator create_sample_emulator(emulator_settings settings, const sample_configuration& config = {},
|
||||
emulator_callbacks callbacks = {})
|
||||
{
|
||||
const auto is_verbose = enable_verbose_logging();
|
||||
@@ -49,29 +72,27 @@ namespace test
|
||||
// settings.verbose_calls = true;
|
||||
}
|
||||
|
||||
if (reproducible)
|
||||
{
|
||||
settings.arguments = {u"-reproducible"};
|
||||
}
|
||||
|
||||
settings.application = "c:/test-sample.exe";
|
||||
settings.emulation_root = get_emulator_root();
|
||||
|
||||
settings.port_mappings[28970] = static_cast<uint16_t>(getpid());
|
||||
settings.path_mappings["C:\\a.txt"] =
|
||||
std::filesystem::temp_directory_path() / ("emulator-test-file-" + std::to_string(getpid()) + ".txt");
|
||||
|
||||
return windows_emulator{std::move(settings), std::move(callbacks)};
|
||||
return windows_emulator{
|
||||
get_sample_app_settings(config),
|
||||
settings,
|
||||
std::move(callbacks),
|
||||
};
|
||||
}
|
||||
|
||||
inline windows_emulator create_sample_emulator(const bool reproducible = false)
|
||||
inline windows_emulator create_sample_emulator(const sample_configuration& config = {})
|
||||
{
|
||||
emulator_settings settings{
|
||||
.disable_logging = true,
|
||||
.use_relative_time = true,
|
||||
};
|
||||
|
||||
return create_sample_emulator(std::move(settings), reproducible);
|
||||
return create_sample_emulator(std::move(settings), config);
|
||||
}
|
||||
|
||||
inline void bisect_emulation(windows_emulator& emu)
|
||||
|
||||
Reference in New Issue
Block a user