PDA

View Full Version : Decompiling python files


NegativeIQ
7th Jan 2019, 10:14 PM
Since it took me few hours of googling and looking at code to get these partially working im posting these in case it helps someone else. I will try to keep these thread up to date, if you find something wrong or have suggestion to change/add something please let me know bellow or PM me.

First of all according to these post (https://forums.thesims.com/en_US/discussion/949019/python-upgrade-coming-soon) around October 2018 The Sims 4 patch upgraded python version from 3.3.x to 3.7.x and tutorials on these forums do not mention that and tools i found are not updated. These "guide" is meant for versions after update, before update follow these guide (http://modthesims.info/showthread.php?t=533907)

On a side note, as far as i know changes are only related to python version and file extension ( .pyo files have been renamed to .pyc)

You will need TheHologramMan’s decompiler batch file (fixed version will be attached in these post, original can be found here (http://modthesims.info/showthread.php?p=4503727#post4503727) ) and Python 3.6+ (I recommend 3.7.x since it is newer and more similar to one as TS4 engine uses)

Steps to decompile .pyc files:

Download script attached bellow
Extract it from zip anywhere you want (For example on desktop)
Right click and edit (or open with your favorite file editor like Sublime or VS Code)
Find @set SIMS4DIR= and edit path to fit your The Sims 4 root folder
After that save and run batch file as administrator (in case pip needs to install package in program files folder)
You will need to "Press any key" several times during the process until it finishes

As a note, not every script will be decompiled successfully, and process might hang on some of them (in that case press CTRL+C and when asked to terminate batch file, input N and press Enter)

After running decompile.bat your decompiled The Sims 4 python files should be located in C:\Temp

Edit: cant seem to attach file (even thru it is in attachments) - moderators, please help (i dont want to upload anywhere on external site)

Bombbery
16th Jan 2019, 11:02 PM
Going to put this here for anyone that reads this and may be confused and/or stumped due to issues.

A wonderful user named scumbumbo has a modding tool that simplifies this entire nightmarish process and makes it much easier to access Python files. http://www.modthesims.info/showthread.php?t=620210

I don't mean for this to come off in a bad way, Negative - Your tutorial isn't in any way bad.