summaryrefslogtreecommitdiff
path: root/setgen.py
blob: e62706641415f1ac5073653a7dc72ea4dfaca5de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import struct

names = {}
names['PATH'] = '/Maps/forest/pathdata.bin'
names['3D00'] = '/Maps/forest/base.brres'

header = struct.pack('>4sI', b'MSet', len(names))
entrydata = b''
stringtable = b''
currentoffset = 8 + (8 * len(names))

for key,path in names.items():
	entrydata += struct.pack('>4sI', key.encode('Shift-JIS'), currentoffset)

	encpath = path.encode('Shift-JIS')
	stringtable += encpath
	stringtable += b'\0'
	currentoffset += len(encpath) + 0


open('SMGoldwood.fileset', 'wb').write(header + entrydata + stringtable)