Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

MTS Movie Night #3 - posted on Yesterday at 10:54 PM
Quick Reply
Search this Thread
Replies: 36 (Who?), Viewed: 38472 times.
Page 1 of 2
Test Subject
Original Poster
#1 Old 3rd Sep 2014 at 4:10 AM Last edited by darkkitten30 : 6th Jun 2017 at 4:05 PM. Reason: Updated Version + Forgot something
Default Python decompiler batch file
Old Information:


I've completely cleaned up the script, removed the unpyc3.py requirement, added a check for Python if you don't have the right python version installed the script will tell you and stop working.

You will need 7zip still and a copy of Python 3.6.1
It will download everything else you need by itself once those are set up properly

Please download v7.3.

I've also removed the straight through the whole thing version, you will have to press enter between zip files.

v7.3 was delayed slightly due to some technical difficulties with uncompyle6 and my batch coding skills, thank the stars for coffee and google.

TODO:



HowTo:

Edit the bat file changing the Directories, Where your Sims4 is, your preferred zip program, and where you want to save the Temp files
It's pretty straight forward. I recommend 7zip since the compression commands for the saved zip files were made using 7zip.
Example


Changes:
Download - please read all instructions before downloading any files!
File Type: 7z Decompilev2.7z (2.1 KB, 68 downloads) - View custom content
Description: Fixed a small bug where it didn't delete all the temp files.
File Type: 7z Decompilev3.7z (2.1 KB, 39 downloads) - View custom content
Description: Fixed another delete temp file bug. *Sighs*
File Type: 7z Decompilev4.7z (2.4 KB, 38 downloads) - View custom content
Description: Last bug fix, hopefully *crosses fingers* Forgot to set %TEMPDIR% properly in the @del's
File Type: 7z Decompilev5.7z (2.4 KB, 107 downloads) - View custom content
Description: Fixed spelling errors, Added function to only decompile .pyo files instead of every file in the directory.
File Type: 7z Decompilev6.7z (3.4 KB, 2410 downloads) - View custom content
Description: Added folders I missed, also added a Decompiler version without all the pauses.
File Type: 7z Decompilev7.7z (3.0 KB, 9 downloads) - View custom content
File Type: 7z Decompile7.1.7z (3.0 KB, 6 downloads) - View custom content
Description: Fixed a bug with the Simulation file zip system
File Type: 7z Decompile7.2.7z (3.0 KB, 7 downloads) - View custom content
Description: Fixed the bug I tried to fix in 7.1 do not edit .bat files at 4am
File Type: 7z Decompile7.3.7z (3.1 KB, 450 downloads) - View custom content
Description: This is the real working 7.3 Please redownload.
10 users say thanks for this. (Who?)
Advertisement
Test Subject
#2 Old 3rd Sep 2014 at 11:25 AM
Just a heads up.
My Sims installation and my tempdir is located at D:
So I needed to add @D: before the fun stuff happened, just so my command prompt changed working drive. Works fine after I added that just after setdirs.
The problem was with the extraction process, and I guess later with decompiling as my cmd was still at c:
Don't know if all cmd prompts works like that, I'm on Windows 7.

Thanks for great work anyway!!

Edit: Removed the pauses to, felt a bit to much manual work with me pressing a key every now and then. :p
Test Subject
#3 Old 5th Sep 2014 at 2:09 PM
Awesome! But I think ur bat missed decompile some files under the subfolders, like /interaction/social etc.
Test Subject
Original Poster
#4 Old 6th Sep 2014 at 1:23 AM
Quote:
Originally Posted by kikiwalu
Awesome! But I think ur bat missed decompile some files under the subfolders, like /interaction/social etc.


Oh I'll look into it sorry
Test Subject
#5 Old 11th Sep 2014 at 8:04 PM Last edited by SpaceTimeDream : 12th Sep 2014 at 12:55 AM. Reason: recompiled --> decompiled
I followed the steps and I got the files but all of decompiled files are blanks 0kb in size. What am I doing wrong?
Test Subject
#6 Old 11th Sep 2014 at 10:24 PM
Quote:
Originally Posted by SpaceTimeDream
I followed the steps and I got the files but all of recompiled files are blanks 0kb in size. What am I doing wrong?
Same thing here.
Test Subject
#7 Old 12th Sep 2014 at 2:51 AM
I got the 0kb as well, but ran the batch with pauses and it doesn't know where the unpyc3.py file is.

I know that the instructions say, "Make sure you click Add Python to Path and then copy unpyc3.py to your Python root folder" but HOW do we do that?
Test Subject
#8 Old 12th Sep 2014 at 1:39 PM Last edited by pcgeekri : 12th Sep 2014 at 1:55 PM. Reason: Addition
Hopefully this will help you, read the instructions here:
http://www.modthesims.info/showthread.php?t=533907

If you left click on the "unpyc3.py" your browser will open it and you see text so instead right click on it and "Save Target As" and leave the filename as "unpyc3.py".

Darkkitten30 *hugz* above mentioned her (I'm guessing a her, oops) installs were on the "D" drive. Fortunately so are mine.
Probably a good idea to install Python on the same drive as "The Sims 4". Python was installed in the D:\Python33 folder. During the installation just changed the "C" to a "D". This is the folder where the unpyc3.py file was placed, in that same D:\Python33 folder with the Python executable.

The Batch File must be placed in the root directory of where your game resides. Fortunately Both Python and Sims 4 are both installed on the "D" drive so the batch file was placed in the root directory of my "D" drive or in D:\ . And ran or double-clicked at that location.

Hopefully this helps you.

PcGeek

omg, that avatar is still on my account? Haven't seen that in years! lmao Member since 2005, my how time flies.
Test Subject
Original Poster
#9 Old 13th Sep 2014 at 6:03 AM
Quote:
Originally Posted by pcgeekri
Hopefully this will help you, read the instructions here:
http://www.modthesims.info/showthread.php?t=533907

If you left click on the "unpyc3.py" your browser will open it and you see text so instead right click on it and "Save Target As" and leave the filename as "unpyc3.py".

Darkkitten30 *hugz* above mentioned her (I'm guessing a her, oops) installs were on the "D" drive. Fortunately so are mine.
Probably a good idea to install Python on the same drive as "The Sims 4". Python was installed in the D:\Python33 folder. During the installation just changed the "C" to a "D". This is the folder where the unpyc3.py file was placed, in that same D:\Python33 folder with the Python executable.

The Batch File must be placed in the root directory of where your game resides. Fortunately Both Python and Sims 4 are both installed on the "D" drive so the batch file was placed in the root directory of my "D" drive or in D:\ . And ran or double-clicked at that location.

Hopefully this helps you.

PcGeek

omg, that avatar is still on my account? Haven't seen that in years! lmao Member since 2005, my how time flies.


Yes her. Yeah, I do all my development work on my D: drive. it keeps things clean for me since my C: drive is a SSD and I use it mostly for windows only.
Thank you for helping
Scholar
#10 Old 13th Sep 2014 at 8:49 AM Last edited by Morphar : 13th Sep 2014 at 11:37 AM.
@rem Batch file created by Darkkitten on 9/2/2014 at 9pm PST

At line 26 I think you have a discrepancy. You have not created a lib directory yet

@echo Moving to %TEMPDIR%\lib
@cd %TEMPDIR%\lib

You have done a cd to %TEMPDIR% so you need to do this:

@mkdir lib
@echo Moving to %TEMPDIR%\lib
@cd %TEMPDIR%\lib


Edit:
Oh I see now. The lib directory is in the compressed file %SIMS4DIR%\Data\Simulation\Gameplay\base.zip and when you uncompress it lib will turn up..

Edit 2:

OK, now I got it right. I had problem with the pathes. Here is my settings for a "normal" installation of the game (in C:\).
@echo Setting Directories...
@set SIMS4DIR="C:\Program Files (x86)\Origin Games\The Sims 4"
@set TEMPDIR="C:\temp"
@set ZIPPROGRAM="C:\Program Files\7-Zip\7z.exe"

Emty .py files though.


Edit3

This does not work. It says unpyc3.py is not a command or program.
@for /f %%f in ('dir /b %TEMPDIR%\lib\collections\*.pyo') do unpyc3.py %%f > %%f.py
Test Subject
#11 Old 13th Sep 2014 at 9:04 AM
All the python files are empty for me. Why is this and how can I fix it?
Test Subject
Original Poster
#12 Old 13th Sep 2014 at 5:26 PM
You need to grab unpyc3.py, I've left a link for it in the main post. Your best bet is to save the file in your python directory where the python.exe is.
Lab Assistant
DELETED POST
16th Sep 2014 at 2:28 PM Last edited by jtravers88 : 16th Sep 2014 at 3:03 PM.
This message has been deleted by jtravers88.
Lab Assistant
#13 Old 16th Sep 2014 at 3:07 PM
Make sure you use the same drive for extraction as the drive you execute the bat file from, otherwise a simple cd %tempdir% doesn't work and everything fails after that command.

For instance, I have the bat file on e and my tempdir on e but I rightclicked the bat file to run it rather than run from a command prompt. So I'm on c, not e, and change dir commands don't work unless a drive change is made first.
Scholar
#14 Old 20th Sep 2014 at 7:12 AM Last edited by Morphar : 20th Sep 2014 at 7:27 AM.
Problem solved:
For us deadly people that have The Sims 4 installed on our only disc C:\ the script is not working.

I guess it is Microsoft that likes to protect us from evil things. Here is what I did:

1. The script could net create this:
@set TEMPDIR="C:\temp"
@mkdir %TEMPDIR%
Something is protecting C:\.

I manually created a map called TS4 and changed that line to:
@set TEMPDIR="C:\TS4\pytemp".
OK. Now the script copied all files to the pytemp directory.

2. The unpyc3.py did not execute. Reported that it was not an internal or external command.....
I opened the command tool and run unpyc3.py. Same problem. Typed the command set and discovered that the path to python33 was missing. I set it manually with the command:
set path=%path%;C:\python33.
Now I could run unpyc3.py
Tried the script again but still the same problem. Got frustrated and put this in the script after the copy line.:

@echo Set ENV-variable for Python
@set path=%path%;C:\python33

It worked!!!!!

I have now the files here:
C:\TS4\MTS_darkkitten30_1456480_Decompilev6\Decompile.bat
C:\Python33\unpyc3.py
C:\TS4\pytemp (The resulting .zip files)

Learn Python:
https://docs.python.org/3/tutorial/index.html
Scholar
#15 Old 20th Sep 2014 at 7:35 AM Last edited by Morphar : 20th Sep 2014 at 9:13 AM.
Sorry, little too early to report that it worked. I checked only the size of the -py files and it was not 0 kB now but all was 1 kB and contains this informatic text:

USAGE: C:\python33\unpyc3.py <filename.pyc>

I give up on this script for now. Tried this pyDecompile instead with success:

http://modthesims.info/showthread.php?t=534660

Unzip it anyware and move the zip files from:
C:\Program Files (x86)\Origin Games\The Sims 4\Data\Simulation\Gameplay
to that folder and start pyDecompileVer1.5.5 - firstRelease.py.

Lots of .py files in different sizes.
Test Subject
#16 Old 26th Jan 2015 at 1:01 AM
Quote:
Originally Posted by Morphar
@rem Batch file created by Darkkitten on 9/2/2014 at 9pm PST

At line 26 I think you have a discrepancy. You have not created a lib directory yet

@echo Moving to %TEMPDIR%\lib
@cd %TEMPDIR%\lib

You have done a cd to %TEMPDIR% so you need to do this:

@mkdir lib
@echo Moving to %TEMPDIR%\lib
@cd %TEMPDIR%\lib


Edit:
Oh I see now. The lib directory is in the compressed file %SIMS4DIR%\Data\Simulation\Gameplay\base.zip and when you uncompress it lib will turn up..

Edit 2:

OK, now I got it right. I had problem with the pathes. Here is my settings for a "normal" installation of the game (in C:\).
@echo Setting Directories...
@set SIMS4DIR="C:\Program Files (x86)\Origin Games\The Sims 4"
@set TEMPDIR="C:\temp"
@set ZIPPROGRAM="C:\Program Files\7-Zip\7z.exe"

Emty .py files though.


Edit3

This does not work. It says unpyc3.py is not a command or program.
@for /f %%f in ('dir /b %TEMPDIR%\lib\collections\*.pyo') do unpyc3.py %%f > %%f.py

I got this same error when i had me 7-zip dir set like yours. it should be C:\Program Files (x86)\7-Zip\7z.exe.
Test Subject
#17 Old 15th Apr 2015 at 5:22 PM
Quote:
Originally Posted by Morphar
Sorry, little too early to report that it worked. I checked only the size of the -py files and it was not 0 kB now but all was 1 kB and contains this informatic text:

USAGE: C:\python33\unpyc3.py <filename.pyc>

I give up on this script for now. Tried this pyDecompile instead with success:

http://modthesims.info/showthread.php?t=534660

Unzip it anyware and move the zip files from:
C:\Program Files (x86)\Origin Games\The Sims 4\Data\Simulation\Gameplay
to that folder and start pyDecompileVer1.5.5 - firstRelease.py.

Lots of .py files in different sizes.


Thanks! It helped in my case.
Top Secret Researcher
#18 Old 20th Apr 2015 at 8:09 AM
Has anyone been able to decompile the core\sims4\tuning\tunable.pyo script from the latest patches? I'm working on using a sim picker from a script and everything seems to be working well except for setting the maximum number of sims which can be selected on the picker. The parameters for that are stored in an ImmutableSlots class. There's a make_immutable_slots_class that I found, but the only place that seems to call it is tunable.pyo, so right now I'm kind of working in the dark trying to get that right.

If no one else can decompile it, I'll just have to keep plugging at it I guess - or I suppose worst case I can just ignore some sims if they pick more than the maximum, but that's hardly user friendly!

For what it's worth, here's the errors I get from unpyc3, not sure if anyone here is familiar with how it works internally or not...
Test Subject
#19 Old 21st Apr 2015 at 6:18 AM
Quote:
Originally Posted by scumbumbo
Has anyone been able to decompile the core\sims4\tuning\tunable.pyo script from the latest patches? I'm working on using a sim picker from a script and everything seems to be working well except for setting the maximum number of sims which can be selected on the picker. The parameters for that are stored in an ImmutableSlots class. There's a make_immutable_slots_class that I found, but the only place that seems to call it is tunable.pyo, so right now I'm kind of working in the dark trying to get that right.

If no one else can decompile it, I'll just have to keep plugging at it I guess - or I suppose worst case I can just ignore some sims if they pick more than the maximum, but that's hardly user friendly!

For what it's worth, here's the errors I get from unpyc3, not sure if anyone here is familiar with how it works internally or not...


I think I was able to extract most of it, except for the contents of one method (it's at line 1832). I wrapped the code for unpyc3's dec.run method in a try/except block so it skips over anything it can't parse. Better than nothing anyway.

I've attached a zip with the tunable.py and the updated unpyc3.py script.
Download - please read all instructions before downloading any files!
File Type: zip unpyc3_fix.zip (29.3 KB, 270 downloads) - View custom content
Top Secret Researcher
#20 Old 22nd Apr 2015 at 7:06 AM
Quote:
Originally Posted by Aren
Better than nothing anyway.

A far, far better thing than nothing in this case! Solved my problem with getting the simpicker working via pure scripting by putting some logging into the TunableTuple class's __init__ to figure out the ImmutableSlots issue. I'll add the info to my thread about doing dialogs from scripts and hopefully this will end up in the door locks code. One problem down, several hurdles to go I'm sure, but progress is progress!
Test Subject
#21 Old 7th May 2015 at 3:32 AM
First of all I wanted to thank darkkitten30 for his efforts thus far, however when I tried using this batch file I ran into ALL sorts of errors, especially considering it hasn't been updated to handle the content added by the new expansion.

So I made a new batch file that handles new subdirectories being added and a bunch of other things.

Plus it's only 31 lines long!

Use as follows:
Extract to any folder.
Change the GAMEDIR, and zip parameters on the first 2 lines to reflect your installation paths and desired output.
Run the .bat

base.zip, core.zip, and simulation.zip files are created in the directory the batch was run in
These zips will contain any every .py script that successfully decompiled as well as any .pyo script that did NOT decompile.

DO NOT Run this file as an administrator for the following reasons:

You should generally not run potentially system modifying files like this as an administrator as a less honorable person than myself might be up to ALL kinds of nonsense.
Running a batch file as administrator changes the 'current directory' of execution to C:\Windows\System32\, which means that's where your files are going to end up.

No part of this copying, unzipping, decompiling, zipping, process should require administrator privileges anyways.

As usual, you may use whatever unpyc3.py you wish as long as it is in the system path and can be found and executed from the command line.
In theory, leaving the unpyc3.py file in the directory with the .bat will also work if you're having trouble.

If you run into strange problems because your directories are all full of SPACES, Put the directory near the root of a drive and run it there.
Download - please read all instructions before downloading any files!
File Type: zip Decompile.zip (575 Bytes, 184 downloads) - View custom content
Description: Updated batch file
Lab Assistant
#22 Old 12th Jun 2015 at 3:42 AM Last edited by Vinathi : 12th Jun 2015 at 4:05 AM.
This didn't work for me for the most recent patch, even after I followed the instructions. The python decompiler tool extracts the .py files into folders, but when I open the .py files they're totally empty.

Would anyone be willing to upload a .zip of the game's .py files or help me figure out what I'm doing wrong?
Screenshots
Top Secret Researcher
#23 Old 12th Jun 2015 at 5:47 AM
Quote:
Originally Posted by Vinathi
This didn't work for me for the most recent patch, even after I followed the instructions. The python decompiler tool extracts the .py files into folders, but when I open the .py files they're totally empty.

I don't use the batch file as I don't have 7-zip and didn't feel like rewriting it for winrar, but also as I prefer to do just one folder at a time so I can see any issues that happen -- but, afaik this one should work. Do you have the unpyc3.py script installed? There's a good copy Aren uploaded just a few posts up.
Lab Assistant
#24 Old 13th Jun 2015 at 6:36 PM
Quote:
Originally Posted by scumbumbo
I don't use the batch file as I don't have 7-zip and didn't feel like rewriting it for winrar, but also as I prefer to do just one folder at a time so I can see any issues that happen -- but, afaik this one should work. Do you have the unpyc3.py script installed? There's a good copy Aren uploaded just a few posts up.


Using Aren's unpyc3 in the same folder as Kartha's Decompile batch file worked flawlessly. Thank you.
Lab Assistant
DELETED POST
27th Jun 2015 at 11:33 PM
This message has been deleted by simalary44.
Lab Assistant
#25 Old 5th Jul 2015 at 5:52 AM
I used Aren 's unpyc3 along with Kartha 's Decompile batch file , and it did not work , the files are empty
Page 1 of 2
Back to top