Skip to content

Commit

Permalink
Fix copying original bytes in dynamic patches
Browse files Browse the repository at this point in the history
  • Loading branch information
aixxe authored and mon committed Apr 29, 2024
1 parent 8d0278c commit 6c701e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/dllpatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ class DynamicPatch {
replace(file, offset,
new TextEncoder().encode(featureOn? patch.on : patch.off));
} else {
patch.on = patch.on.map((patch, idx) => patch === 'XX' ? file[offset + idx] : patch);
patch.off = patch.off.map((patch, idx) => patch === 'XX' ? file[offset + idx] : patch);
patch.on = patch.on.map((byte, idx) => byte === 'XX' ? file[offset + idx] : byte);
patch.off = patch.off.map((byte, idx) => byte === 'XX' ? file[offset + idx] : byte);
replace(file, offset,
featureOn? patch.on : patch.off);
}
Expand All @@ -221,8 +221,8 @@ class DynamicPatch {
replace(file, patch.offset,
new TextEncoder().encode(featureOn? patch.on : patch.off));
} else {
patch.on = patch.on.map((patch, idx) => patch === 'XX' ? file[patch.offset + idx] : patch);
patch.off = patch.off.map((patch, idx) => patch === 'XX' ? file[patch.offset + idx] : patch);
patch.on = patch.on.map((byte, idx) => byte === 'XX' ? file[patch.offset + idx] : byte);
patch.off = patch.off.map((byte, idx) => byte === 'XX' ? file[patch.offset + idx] : byte);
replace(file, patch.offset,
featureOn? patch.on : patch.off);
}
Expand Down

0 comments on commit 6c701e8

Please sign in to comment.