-
-
Save bbayles/19dbd537d1f912847a52daf6701edd09 to your computer and use it in GitHub Desktop.
Compare memory snapshots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
all_befores = [ | |
'C:/Games/Mednafen/before_1.bin', | |
'C:/Games/Mednafen/before_2.bin', | |
# ... | |
] | |
all_afters = [ | |
'C:/Games/Mednafen/after_1.bin', | |
'C:/Games/Mednafen/after_2.bin', | |
# ... | |
] | |
before_data = [Path(x).read_bytes() for x in all_befores] | |
after_data = [Path(x).read_bytes() for x in all_afters] | |
size = len(before_data[0]) | |
for i in range(size): | |
before_byte = before_data[0][i] | |
after_byte = after_data[0][i] | |
if before_byte == after_byte: | |
continue | |
if not all(data[i] == before_byte for data in before_data): | |
continue | |
if not all(data[i] == after_byte for data in after_data): | |
continue | |
print( | |
format(i, '08x'), | |
format(before_byte, '02x'), | |
format(after_byte, '02x'), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment