mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
Added applying of IPS and IPS32 patches
This commit is contained in:
@@ -142,6 +142,24 @@ namespace hex {
|
||||
this->saveToFile(this->m_fileBrowser.selected_path, this->m_dataToSave);
|
||||
}
|
||||
|
||||
if (this->m_fileBrowser.showFileDialog("Apply IPS Patch", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN)) {
|
||||
auto patchData = hex::readFile(this->m_fileBrowser.selected_path);
|
||||
auto patch = hex::loadIPSPatch(patchData);
|
||||
|
||||
for (auto &[address, value] : patch) {
|
||||
this->m_dataProvider->write(address, &value, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_fileBrowser.showFileDialog("Apply IPS32 Patch", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN)) {
|
||||
auto patchData = hex::readFile(this->m_fileBrowser.selected_path);
|
||||
auto patch = hex::loadIPS32Patch(patchData);
|
||||
|
||||
for (auto &[address, value] : patch) {
|
||||
this->m_dataProvider->write(address, &value, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_fileBrowser.showFileDialog("Save As", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE)) {
|
||||
FILE *file = fopen(this->m_fileBrowser.selected_path.c_str(), "wb");
|
||||
|
||||
@@ -187,6 +205,18 @@ namespace hex {
|
||||
View::doLater([]{ ImGui::OpenPopup("Open Base64 File"); });
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("IPS Patch")) {
|
||||
this->getWindowOpenState() = true;
|
||||
View::doLater([]{ ImGui::OpenPopup("Apply IPS Patch"); });
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem("IPS32 Patch")) {
|
||||
this->getWindowOpenState() = true;
|
||||
View::doLater([]{ ImGui::OpenPopup("Apply IPS32 Patch"); });
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user