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

Function importIPS32Patch

src/gui2/imhex_overrides/main_menu_items.cpp:113–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 }
112
113 void importIPS32Patch() {
114 fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
115 TaskManager::createTask("hex.ui.common.processing", TaskManager::NoProgress, [path](auto &task) {
116 auto patchData = wolv::io::File(path, wolv::io::File::Mode::Read).readVector();
117 auto patch = Patches::fromIPS32Patch(patchData);
118 if (!patch.has_value()) {
119 handleIPSError(patch.error());
120 return;
121 }
122
123 task.setMaxValue(patch->get().size());
124
125 auto provider = ImHexApi::Provider::get();
126
127 for (auto &[address, value] : patch->get()) {
128 provider->write(address, &value, sizeof(value));
129 task.increment();
130 }
131
132 provider->getUndoStack().groupOperations(patch->get().size(), "hex.builtin.undo_operation.patches");
133 });
134 });
135 }
136
137 void importModifiedFile() {
138 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