mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
provider: Fixed applying of IPS patches. Handle applying asynchronously
This commit is contained in:
@@ -46,28 +46,41 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto& patches = provider->getPatches();
|
||||
u32 index = 0;
|
||||
for (const auto &[address, patch] : patches) {
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Selectable(("##patchLine" + std::to_string(index)).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
EventManager::post<RequestSelectionChange>(Region { address, 1 });
|
||||
ImGuiListClipper clipper(patches.size());
|
||||
|
||||
while (clipper.Step()) {
|
||||
auto iter = patches.begin();
|
||||
for (auto i = 0; i < clipper.DisplayStart; i++)
|
||||
iter++;
|
||||
|
||||
for (auto i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
const auto &[address, patch] = *iter;
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (ImGui::Selectable(("##patchLine" + std::to_string(index)).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
EventManager::post<RequestSelectionChange>(Region { address, 1 });
|
||||
}
|
||||
if (ImGui::IsMouseReleased(1) && ImGui::IsItemHovered()) {
|
||||
ImGui::OpenPopup("PatchContextMenu");
|
||||
this->m_selectedPatch = address;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("0x{0:08X}", address);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
u8 previousValue = 0x00;
|
||||
provider->readRaw(address, &previousValue, sizeof(u8));
|
||||
ImGui::TextFormatted("0x{0:02X}", previousValue);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{0:02X}", patch);
|
||||
index += 1;
|
||||
|
||||
iter++;
|
||||
}
|
||||
if (ImGui::IsMouseReleased(1) && ImGui::IsItemHovered()) {
|
||||
ImGui::OpenPopup("PatchContextMenu");
|
||||
this->m_selectedPatch = address;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("0x{0:08X}", address);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
u8 previousValue = 0x00;
|
||||
provider->readRaw(address, &previousValue, sizeof(u8));
|
||||
ImGui::TextFormatted("0x{0:02X}", previousValue);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("0x{0:02X}", patch);
|
||||
index += 1;
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopup("PatchContextMenu")) {
|
||||
|
||||
Reference in New Issue
Block a user