From b074d3c0d40e2babebb3f1e190944b263a6379f4 Mon Sep 17 00:00:00 2001 From: Earthnuker Date: Sun, 8 Oct 2017 01:09:09 +0000 Subject: [PATCH] Revert "Updated parse_save.py to use PascalString and PrefixedArray" This reverts commit 79889722ac533f31724a0ed88e013406a3229174 --- parse_save.py | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/parse_save.py b/parse_save.py index 61962f6..ebdc246 100644 --- a/parse_save.py +++ b/parse_save.py @@ -1,20 +1,18 @@ -from construct import * -from pprint import pprint -ScrapSaveVar = Struct( - 'name'/PascalString(Int32ul,encoding='utf-8'), - 'data'/PascalString(Int32ul,encoding='utf-8'), -) -ScrapSave = 'ScarpSaveGame'/Struct( - 'title'/PascalString(Int32ul,encoding='utf-8'), - 'id'/PascalString(Int32ul,encoding='utf-8'), - 'data'/PrefixedArray(Int32ul,ScrapSaveVar), - Terminated - ) -with open("Save0.sav", 'rb') as sav_file: - save = ScrapSave.parse_stream(sav_file) - print("ID:",save.id) - print("Title:",save.title) - for var in save.data: - print(" - {}: {}".format(var.name,var.data)) - #for block in save.data: - # print("{}: {}".format(block.v_name, block.v_data)) +from construct import * +from pprint import pprint +ScrapSaveVar = Struct( + 'name'/PascalString(Int32ul,encoding='utf-8'), + 'data'/PascalString(Int32ul,encoding='utf-8'), +) +ScrapSave = 'ScarpSaveGame'/Struct( + 'title'/PascalString(Int32ul,encoding='utf-8'), + 'id'/PascalString(Int32ul,encoding='utf-8'), + 'data'/PrefixedArray(Int32ul,ScrapSaveVar), + Terminated + ) +with open("Save0.sav", 'rb') as sav_file: + save = ScrapSave.parse_stream(sav_file) + print("ID:",save.id) + print("Title:",save.title) + for var in save.data: + print(" - {}: {}".format(var.name,var.data)) \ No newline at end of file