rubellyte / starcheat

Starbound player save editor and Python library
http://starcheat.org/
MIT License
10 stars 5 forks source link

New asset format in Cheerful #2

Closed rubellyte closed 8 years ago

rubellyte commented 8 years ago

The asset format was changed from SBBF03 to SBAsset4. It appears that the structure was changed, not just the header. Maybe fallback on extracted assets as a temporary solution?

rubellyte commented 8 years ago

Info on SBAsset4:

At the beginning of the file, magic bytes "SBAsset4" 8 bytes immediately following, offset of file index Following that, apparently unmodified files At offset specified in beginning of file (end of files), magic bytes "INDEX" 32 mystery bytes after INDEX (empty in undigested modpaks) 1 byte with length of pak name Name of pak (ex. "Main Game Assets - 04 Jul 2016") Variable number of mystery bytes (related to number of files, usually 1 to 4 bytes) File index format: Byte with length of path Complete file path 8 bytes containing offset of file 8 bytes containing length of file File ends without any sort of marker

Digested pak files are binary identical to undigested paks, except for the 32 bytes after INDEX.

rubellyte commented 8 years ago

They updated to SBAsset6, main changes appear to be in the INDEX area. Changes (WIP): Name of pak bytes removed Digest bytes removed Byte after INDEX indicating number of metadata entries. Metadata entry: byte containing length of key name key name Byte that probably indicates value type (0x02 for float, 0x04 for signed int, 0x05 for string, 0x06 for list, 0x07 for dict) Length of value value After metadata, file count and file index format as previously specified.

The file count bytes still don't seem to correspond with the actual file count in large files. In my smaller paks, I got correct numbers, but the main assets pak gives a count of a massive count of 0x82DF4E (8,576,846!) with the actual file count being 45,007 (0xAFCF in hex).

rubellyte commented 8 years ago

Raw data for file count bytes 7F = 127 81 00 = 128 81 23 = 163 81 4E = 206 81 72 = 242 81 7A = 250 82 16 = 278 83 4B = 459 84 1A = 538 84 27 = 551 84 4A = 586 85 62 = 738 86 18 = 792 88 72 = 1138 8C 7C = 1660 94 0B = 2571 94 4E = 2638 98 58 = 3160 9B 46 = 3526 9D 22 = 3746 B3 6F = 6639 E0 14 = 12308 EA 2C = 13612 FF 7F = 16383 81 80 00 = 16384 81 80 05 = 16389 81 87 4E = 17359 81 9C 1C = 19996 81 B0 27 = 22567 81 C8 7F = 25727 81 FC 7F = 32384 81 FF 7F = 32767 82 DD 11 = 44679

rubellyte commented 8 years ago

Commit de34bd7 introduces SBAsset library, must interface with starcheat.

rubellyte commented 8 years ago

Starcheat can now use the SBAsset library.