MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / importIPSPatch

Function importIPSPatch

src/gui2/imhex_overrides/main_menu_items.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 namespace {
88
89 void importIPSPatch() {
90 fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
91 TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
92 auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
93 auto patch = Patches::fromIPSPatch(patchData);
94 if (!patch.has_value()) {
95 handleIPSError(patch.error());
96 return;
97 }
98
99 task.setMaxValue(patch->get().size());
100
101 auto provider = ImHexApi::Provider::get();
102
103 for (auto &[address, value] : patch->get()) {
104 provider->write(address, &value, sizeof(value));
105 task.increment();
106 }
107
108 provider->getUndoStack().groupOperations(patch->get().size(), "hex.builtin.undo_operation.patches");
109 });
110 });
111 }
112
113 void importIPS32Patch() {
114 fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {

Callers

nothing calls this directly

Calls 5

handleIPSErrorFunction · 0.85
FileClass · 0.50
sizeMethod · 0.45
getMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected