@@ -323,6 +323,9 @@ def get_save_paths(
323
323
# It seems that the "BETHESDAPFH" file is a header which is padded to the next 16 byte boundary with the string "padding\0", where \0 is NUL.
324
324
# The other files ("PnP", where n is a number starting from 0) are then concatenated into the SFS file, also with padding.
325
325
326
+ # As of at least Starfield version 1.9.51.0, the containers contain "toc" and one or more "BlobDataN" files (where N is a number starting from 0).
327
+ # The new format seems to already include the padding.
328
+
326
329
temp_folder = Path (temp_dir .name ) / "Starfield"
327
330
temp_folder .mkdir ()
328
331
@@ -335,14 +338,23 @@ def get_save_paths(
335
338
continue
336
339
# Strip out the parent folder name
337
340
sfs_name = path .name
338
- # Arrange the files: header as index 0, P0P as 1, P1P as 2, etc.
341
+ # Arrange the files: header as index 0, P0P as 1, P1P as 2, etc. (or BlobData0, ... for the new format)
339
342
parts = {}
343
+
344
+ is_new_format = "toc" in [f ["name" ] for f in container ["files" ]]
345
+
340
346
for file in container ["files" ]:
341
- if file ["name" ] == "BETHESDAPFH" :
342
- parts [0 ] = file ["path" ]
347
+ if file ["name" ] == "toc" :
348
+ continue
349
+ if is_new_format :
350
+ idx = int (file ["name" ].removeprefix ("BlobData" ))
343
351
else :
344
- idx = int (file ["name" ].strip ("P" )) + 1
345
- parts [idx ] = file ["path" ]
352
+ if file ["name" ] == "BETHESDAPFH" :
353
+ idx = 0
354
+ else :
355
+ idx = int (file ["name" ].strip ("P" )) + 1
356
+ parts [idx ] = file ["path" ]
357
+
346
358
# Construct the SFS file
347
359
sfs_path = temp_folder / sfs_name
348
360
with sfs_path .open ("wb" ) as sfs_f :
0 commit comments