PDA

View Full Version : A (more) automated decompiler for *all* Sims 4 sources.


mgomez
5th Nov 2014, 7:49 PM
Tired of fiddling with a bunch of files and going through hell to decompile them every time there's an update? Well, ever since Sims 4 patched in pools, I said "to hell with it!" and wrote a script that does the job pretty damn well.

It requires TheHologramMan's "unpyc3 (https://raw.githubusercontent.com/figment/unpyc3/master/unpyc3.py)" decompiler (forum post here (http://modthesims.info/showthread.php?t=532279)) and 7-zip installed on your computer in order to work. Here's how to use it:

- Put "de.py" in the attached ZIP inside of your Python33 directory.
- Edit "de.py" in whatever editing program you want and change SIMS4_FOLDER to whatever folder Sims 4 is stored in. Set TEMPDIR to the location of a temporary directory you have created for the storage of Sims 4 decompiled files, and set ZIPPROGRAM to the directory (including the file name) for 7z.exe (7zip).
- Run Python.exe in your Python33 directory.
- Type "import de"
- Type "de.domagic()"

This script extracts the base, core, and simulation ZIP files into a temprary directory, then grabs each PYO file, decompiles it, stores the decompiled data into a PY file, then deletes the PYO file on success. NOTE: Some PYO files cannot be decompiled by unpyc3. In that case, I have programmed this script to just ignore it and move on.

Once everything is done, the next time Sims 4 comes out with an update, all you have to do is type "import de" and "de.domagic()" in your Python console and that's it!

plasticbox
6th Nov 2014, 3:00 AM
Hi there!

Is the unpyc3.py in your upload the same as the one by TheHologramMan? If so, can you please link to it instead of re-uploading? (Unless you talked to him already and he thinks this makes more sense -- I wouldn’t know, I just think duplicates are not really a good idea unless the author says otherwise)

If you have edited it, please also include a direct link to the original in your post (when people want to compare it in order to see what is changed / how you did it, that makes it easier for them to find it .. it is somewhere in this thread http://modthesims.info/showthread.php?t=532279 I think).

mgomez
12th Nov 2014, 5:11 PM
Hi there!

Is the unpyc3.py in your upload the same as the one by TheHologramMan? If so, can you please link to it instead of re-uploading? (Unless you talked to him already and he thinks this makes more sense -- I wouldn’t know, I just think duplicates are not really a good idea unless the author says otherwise)

If you have edited it, please also include a direct link to the original in your post (when people want to compare it in order to see what is changed / how you did it, that makes it easier for them to find it .. it is somewhere in this thread http://modthesims.info/showthread.php?t=532279 I think).

I have edited the post to reflect this request for revision. Attachment has also been edited so that unpyc3.py is removed, and the file is linked to along with the forum post where THM fixed it.

plasticbox
12th Nov 2014, 5:48 PM
Thank you!

DrChillgood
21st Dec 2014, 6:09 PM
I've made a few changes to support decompiling the Deployed and Generated archives. Sometimes, scripts won't compile because they need resources from those archives.

Add the following:


def extract_other_archive(name):
subprocess.call(ZIPPROGRAM + " x \"" + SIMS4_FOLDER + "\\Game\\Bin\\Python\\" + name + ".zip\" -o" + "\"" + TEMPDIR + "\\" + name + "\"")

def domagic():
extract_sims_archive("base")
extract_sims_archive("core")
extract_sims_archive("simulation")
extract_other_archive("deployed")
extract_other_archive("generated")
rundecompile()