Replies: 1 (Who?), Viewed: 5425 times.
#1
19th Sep 2014 at 11:19 PM
Last edited by DarkWalker : 14th Aug 2015 at 4:05 AM.

Posts: 75
Thanks: 535 in 13 Posts

There are over 10k such files, though; manually creating a list would be one huge pain in the ass. So I created a small python script to output a CSV file with the labels and IDs I was looking for.
The script is just below; it's a quick hack, but it works well for files extracted by S4PE.
I've attached the resulting text file from running it on every type 0xc0db5ae7 file extracted from SimulationFullBuild0.package. My main use for it is to find the binary files of an object I already have the tunings for. Each line has the file ID in both hex and decimal (the decimal IDs are used in tuning files to create objects), the label of the object, and if there is a tuning reference the tuning label and its ID.
How to use: extract all type 0xc0db5ae7 files you want to generate the list from to a single folder, adjust the directory variable in the script below to point to the extracted files, change the path of the output file to something that will work for you (I doubt many of you keep a ramdrive at x: ), and run the script. Changing printall to 0 will skip files that don't reference a tuning. I've tested it under python 3.3.5, which is the same used for modding Sims 4 scripts.
Code:
import os, struct from pprint import pprint directory = 'C:/PathToFilesOfType0xc0db5ae7/' extension = '.bnry' out = open('x:/obj_list.txt', 'w') printall = 1 for file in os.listdir(directory): if file.endswith(extension): f = open(directory+file, 'rb') m1 = struct.unpack('H', f.read(2))[0] m2 = struct.unpack('I', f.read(4))[0] s1 = struct.unpack('I', f.read(4))[0] name1 = f.read(s1).decode('ascii') s2 = struct.unpack('I', f.read(4))[0] if s2 > 4: name2 = f.read(s2).decode('ascii') id = struct.unpack('I', f.read(4))[0] if printall or s2 > 4: out.write(file[21:21+16]+","+str(int(file[21:21+16],16))+","+name1) if s2 > 4: out.write(","+name2+","+str(id)) if printall or s2 > 4: out.write("\n") out.close()

Advertisement
#2
2nd Nov 2014 at 2:28 PM

Posts: 11,572
Thanks: 406299 in 1086 Posts
Moving to Resources.
Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.
In the kingdom of the blind, do as the Romans do.
Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.
In the kingdom of the blind, do as the Romans do.
Who Posted
|