Fix patches being applied multiple times redundantly (#3763)

This commit is contained in:
kalaposfos13
2025-11-01 12:47:38 +01:00
committed by GitHub
parent 8bbb3956a2
commit 8238ecf88a

View File

@@ -140,12 +140,6 @@ void ApplyPatchesFromXML(std::filesystem::path path) {
if (!versionMatches && type != "mask" && type != "mask_jump32") if (!versionMatches && type != "mask" && type != "mask_jump32")
continue; continue;
std::string currentPatchName = it->attribute("Name").value();
for (pugi::xml_node_iterator patchLineIt = patchList.children().begin();
patchLineIt != patchList.children().end(); ++patchLineIt) {
std::string type = patchLineIt->attribute("Type").value();
std::string address = patchLineIt->attribute("Address").value(); std::string address = patchLineIt->attribute("Address").value();
std::string patchValue = patchLineIt->attribute("Value").value(); std::string patchValue = patchLineIt->attribute("Value").value();
std::string maskOffsetStr = patchLineIt->attribute("Offset").value(); std::string maskOffsetStr = patchLineIt->attribute("Offset").value();
@@ -159,7 +153,6 @@ void ApplyPatchesFromXML(std::filesystem::path path) {
} }
bool littleEndian = false; bool littleEndian = false;
if (type == "bytes16" || type == "bytes32" || type == "bytes64") { if (type == "bytes16" || type == "bytes32" || type == "bytes64") {
littleEndian = true; littleEndian = true;
} }
@@ -173,15 +166,13 @@ void ApplyPatchesFromXML(std::filesystem::path path) {
if (type == "mask_jump32") if (type == "mask_jump32")
patchMask = MemoryPatcher::PatchMask::Mask_Jump32; patchMask = MemoryPatcher::PatchMask::Mask_Jump32;
if ((type == "mask" || type == "mask_jump32") && if ((type == "mask" || type == "mask_jump32") && !maskOffsetStr.empty()) {
!maskOffsetStr.empty()) {
maskOffsetValue = std::stoi(maskOffsetStr, 0, 10); maskOffsetValue = std::stoi(maskOffsetStr, 0, 10);
} }
MemoryPatcher::PatchMemory(currentPatchName, address, patchValue, MemoryPatcher::PatchMemory(currentPatchName, address, patchValue, targetStr,
targetStr, sizeStr, false, littleEndian, sizeStr, false, littleEndian, patchMask,
patchMask, maskOffsetValue); maskOffsetValue);
}
} }
} }
} }