Added initial notes and save parser code
This commit is contained in:
1 parent
d76c6e8ba9
commit
95bca9799a
5 files changed
+94
-1
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import struct
|
||||
|
||||
|
||||
def load_save(save_file_name):
|
||||
try:
|
||||
with open(save_file_name, "rb") as f:
|
||||
data = f.read()
|
||||
return data
|
||||
except Exception as e:
|
||||
print(f"Failed to read save file: {e}")
|
||||
|
||||
|
||||
def verify_save(save):
|
||||
try:
|
||||
struct.pack("bbbb", *save[:4]) == b"GVAS"
|
||||
# This I think just means we have an unreal engine save but for now it should suffice
|
||||
return True
|
||||
except struct.error:
|
||||
return False
|
||||
|
||||
|
||||
def read_token_at_offset(save, offset):
|
||||
# Load the first 16 bytes from the offset
|
||||
try:
|
||||
data = struct.pack("b" * 9, *save[offset : offset + 9])
|
||||
if data[-1] == 0x00:
|
||||
return str(data.split(b"\x00")[0].decode())
|
||||
else:
|
||||
data = struct.pack("b" * 16, *save[offset : offset + 16])
|
||||
if data[-1] == 0x00:
|
||||
return str(data.split(b"\x00")[0].decode())
|
||||
else:
|
||||
return None
|
||||
except struct.error as e:
|
||||
print(f"Failed to parse data: {e}")
|
||||
|
||||
|
||||
save = load_save("./test.sav")
|
||||
|
||||
if verify_save(save):
|
||||
print("Save appears to be a save file of some kind")
|
||||
else:
|
||||
print("The fuck is this shit mate")
|
||||
|
||||
|
||||
# Should be fine to do shit here
|
||||
# print(read_token_at_offset(save, 0x12DB)) # Keys
|
||||
# print(read_token_at_offset(save, 0x12AD)) # AccountLevel
|
||||
print(read_token_at_offset(save, 0x1329)) # AccountLevel
|
||||
Whitespace-only changes.
Reference in new issue
Block a user