Created
March 18, 2021 08:15
-
-
Save elmoiv/a62436046e07ec75249a5353a2c657c2 to your computer and use it in GitHub Desktop.
Read Dead Redemption 2 Snapmatics Convertor
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
import os | |
OFFSET = 300 | |
# Chnage this according to your SaveGame location | |
RDR2_DIR = 'Path\\to\\SaveGame' | |
RDR2_SAVE = os.path.expanduser('~') + '\\Desktop\\RDR2_SNAPMATICS' | |
J = os.path.join | |
B = os.path.basename | |
def convert(snapmatic): | |
""" | |
Converts RDR2 Snapmatics to JPEG files | |
""" | |
raw = open(snapmatic, 'rb').read()[OFFSET:] | |
json_offset = raw.find(b'JSON') | |
raw = raw[:json_offset].rstrip(b'\x00') | |
open(J(RDR2_SAVE, B(snapmatic) + '.jpg'), 'wb').write(raw) | |
os.makedirs(RDR2_SAVE, exist_ok=True) | |
for d, _, fs in os.walk(RDR2_DIR): | |
for f in fs: | |
path = J(d, f) | |
if B(path).startswith('PRDR'): | |
convert(path) | |
print('Converted:', B(path), 'at', path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment