Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 17th Sep 2018 at 3:26 AM Last edited by nixylvarie : 17th Sep 2018 at 4:06 AM.
Resource Types and XML
I apologize for inundating the forum with questions. This (might) be the last one. Or the second-to-last one. I hope.

So. I'm having a problem where I only want to extract specific types of files (XML tuning and STBL, specifically), and I can leave the rest alone. AFAI can tell, there is only one resource type for string tables, but there are a multitude for xml files. Like, lots and lots.

What did I do to solve this? I iterated through every single game package, pulling out the indexes and extracting every unique resource type. Several of the packages didn't read properly (still working on version 2 of my unpackager, now with less ugly code ) but the ones that did got me a MASSIVE list of over 19000 resource types. IDLE froze up for like half a minute printing it out for me.

There can't possibly be a need for that many different types of resources, so I assumed that part of the resource type DWORD is storing binary flags for some other purpose.

Or maybe the resource type isn't what I need to look at at all.

Secondarily, are there multiple types of XML files? I know there's the object tuning format, but are there any other types someone might use in a mod? And what XML files can I safely ignore?

TL;DR: How do I efficiently figure out if a file is XML (either from the resource type or group or some other method)? I could decompress and analyze every file using an XML library, check if it throws an exception, and then cross-reference the results with the resource type to see what types correspond to XML files, but that's...really inefficient. Like wow, I'll probably be here all night inefficient. (And I don't sleep, so yeah.)

EDIT: Worked through all relevant XML tuning files (extracted with S4S), converted the resource types into numbers, and bitwise ORed them all together. The result? 0xFFFFFFFF. There are most likely no flags in the resource type. I'm baffled.
Advertisement
Deceased
#2 Old 17th Sep 2018 at 6:06 AM
The vast majority of the XML types are listed in the Types class in sims4.resources, the lines all look like
Code:
TUNING = _add_inst_tuning('tuning', type_name_plural='tuning', file_extension='tun', resource_type=62078431, manager_name='module_tuning_manager')

The resource_type is in decimal, but those are the values you'd see inside a mod package. There are some other XML resource types, not referenced by the Python code and although those are fairly rare to see inside a mod it's not unheard of. I don't believe those use any out of the ordinary compression in a mod package.

This page from the S4PE GitHub used to be a fairly comprehensive resource as well; however, it looks to have not been updated in years, so I have no idea if it's still accurate or even the latest version.

Getting the XML and Jazz resources from the game's installed packages is a whole other kettle of dingo patties, those are stored in quite a complex manner. Luckily you shouldn't have to deal with that for what you're wanting to do! But you can take a look at my XML Extractor sources (available from the download page for that) if you're interested in how that's accomplished.
Test Subject
Original Poster
#3 Old 17th Sep 2018 at 7:59 PM
Quote: Originally posted by scumbumbo
The vast majority of the XML types are listed in the Types class in sims4.resources, the lines all look like
Code:
TUNING = _add_inst_tuning('tuning', type_name_plural='tuning', file_extension='tun', resource_type=62078431, manager_name='module_tuning_manager')

The resource_type is in decimal, but those are the values you'd see inside a mod package. There are some other XML resource types, not referenced by the Python code and although those are fairly rare to see inside a mod it's not unheard of. I don't believe those use any out of the ordinary compression in a mod package.

This page from the S4PE GitHub used to be a fairly comprehensive resource as well; however, it looks to have not been updated in years, so I have no idea if it's still accurate or even the latest version.

Getting the XML and Jazz resources from the game's installed packages is a whole other kettle of dingo patties, those are stored in quite a complex manner. Luckily you shouldn't have to deal with that for what you're wanting to do! But you can take a look at my XML Extractor sources (available from the download page for that) if you're interested in how that's accomplished.


I got a decompiler up and running and am currently looking at resources.py but I've never used two versions of Python at once - how would I configure them so that I can run certain scripts with 3.3.5 and keep 3.7 for other things?
Deceased
#4 Old 18th Sep 2018 at 3:40 AM
Wow, no clue on that. Quick Google search turned up this though, check the third post - looks like it should work.

https://stackoverflow.com/questions...he-same-machine
Back to top