forked from ReScrap/ScrapHacks
Daniel Seiller
8d92f25b8c
- Started implementing new parser for chunked data - Started documenting data formats - Started dissector for network protocol - Added AI-Graph renderer (converts .pth files to python data you can import into Blender) - Added Script to convert savefile to JSON - Added (old) parser for chunked data format - Added basic parser for LFVF data section (Vertex Data) - Added script to analyze and filter read trace generated with frida script - Added various Frida scripts
27 lines
839 B
Python
27 lines
839 B
Python
import sys
|
|
import os
|
|
from construct import *
|
|
import json
|
|
|
|
save_data = {}
|
|
|
|
ScrapSaveVar = Struct(
|
|
"name" / PascalString(Int32ul, encoding="windows-1252"),
|
|
"data" / PascalString(Int32ul, encoding="windows-1252"),
|
|
)
|
|
ScrapSave = "ScarpSaveGame" / Struct(
|
|
"title" / PascalString(Int32ul, encoding="windows-1252"),
|
|
"id" / PascalString(Int32ul, encoding="windows-1252"),
|
|
"data" / PrefixedArray(Int32ul, ScrapSaveVar),
|
|
Terminated,
|
|
)
|
|
|
|
with open(sys.argv[1], "rb") as sav_file:
|
|
save = ScrapSave.parse_stream(sav_file)
|
|
save_data["id"] = save.id
|
|
save_data["title"] = save.title
|
|
save_data["data"] = {}
|
|
for var in save.data:
|
|
save_data["data"][var.name] = var.data
|
|
with open(os.path.basename(sys.argv[1]) + ".json", "w") as of:
|
|
json.dump(save_data, of, indent=4)
|