1
0
mirror of synced 2025-02-21 12:29:47 +01:00

sys: Remove patched bytes when their value is the same as the original

This commit is contained in:
WerWolv 2022-01-30 11:58:32 +01:00
parent 66a13266e6
commit 4bc074fa84

View File

@ -154,8 +154,16 @@ namespace hex::prv {
if (createUndo) if (createUndo)
createUndoPoint(); createUndoPoint();
for (u64 i = 0; i < size; i++) for (u64 i = 0; i < size; i++) {
getPatches()[offset + i] = reinterpret_cast<const u8 *>(buffer)[i]; u8 patch = reinterpret_cast<const u8 *>(buffer)[i];
u8 originalValue = 0x00;
this->readRaw(offset + i, &originalValue, sizeof(u8));
if (patch == originalValue)
getPatches().erase(offset + i);
else
getPatches()[offset + i] = patch;
}
} }
void Provider::createUndoPoint() { void Provider::createUndoPoint() {