Skip to content

Commit

Permalink
BL3: Pass all remaining args along
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Sep 14, 2023
1 parent 1d6ce93 commit 3c2c80a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BL3_find_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def encode_int(n):
def encode_str(s):
return encode_int(len(s) + 1) + s.encode("ascii") + b"\0"

def parse_savefile(fn, save=False):
def parse_savefile(fn, args):
with open(fn, "rb") as f: data = Consumable(f.read())
if data.get(4) != b"GVAS": raise SaveFileFormatError("Invalid magic number - corrupt file?")
header = data.get(18) # Version numbers, various. Probably irrelevant.
Expand Down Expand Up @@ -215,7 +215,7 @@ def parse_savefile(fn, save=False):
data = b"".join(data)
with open(fn, "rb") as f: origdata = f.read()
if data == origdata: print("SUCCESS")
if save:
if args.save:
with open(fn, "wb") as f: f.write(data)
print("Saved.")

Expand All @@ -226,6 +226,6 @@ def main(args=None):
# TODO: Know the standard directory and go looking there
args = parser.parse_args(args)
print(args)
if args.file: parse_savefile(args.file, save=args.save)
if args.file: parse_savefile(args.file, args)

if __name__ == "__main__": main()

0 comments on commit 3c2c80a

Please sign in to comment.