Created
May 19, 2022 18:16
-
-
Save apocalyptech/7254e26a4931589fd68266509a5b7460 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# vim: set expandtab tabstop=4 shiftwidth=4: | |
import os | |
import io | |
import subprocess | |
# Generate the v2 protobufs | |
subprocess.run(['./protodec', '/home/pez/bl3_steam_root/OakGame/Binaries/Win64/Borderlands3.exe']) | |
for filename in sorted(os.listdir('.')): | |
if filename.startswith('Oak') and filename.endswith('.proto'): | |
print('Post-processing {}'.format(filename)) | |
# Grab the v2 protobuf | |
with open(filename) as df: | |
contents = io.StringIO(df.read()) | |
contents.seek(0) | |
# Now convert to v3 | |
with open(filename, 'w') as df: | |
print('syntax = "proto3";', file=df) | |
for line in contents: | |
line = line.replace('optional ', '') | |
line = line.replace('.OakSave.', '') | |
line = line.replace('.OakProfile.', '') | |
line = line.replace('.OakShared.', '') | |
line = line.replace('Profile.', '') | |
line = line.replace('MissionStatusPlayerSaveGameData.', '') | |
line = line.replace('Character.', '') | |
df.write(line.replace("\t", ' ')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment