- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Tools >
- Python decompiler batch file
- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Tools >
- Python decompiler batch file
#1
3rd Sep 2014 at 4:10 AM
Last edited by darkkitten30 : 22nd Feb 2019 at 1:12 PM.
Reason: Cleaned up the thread
Posts: 24
Thanks: 16 in 1 Posts
Python decompiler batch file
Been working on revamping this batch file, still got a lot of work to do on it.You will need 7zip still and a copy of Python 3.7.0
It will download everything else you need by itself once those are set up properly
Please download v8.1.
I've also removed the straight through the whole thing version, you will have to press enter between zip files.
v8.1 Removed the massive folder lists from each of the 3 zips, done the same for the @del lists, started to work on the download/install of Python, some more batch cleanup
TODO:
Make it only decompile .pyo files instead of every file in the directory.Found how on google.
Fix why it wont copy achivements and aspirations folders into the zip and delete them from the temp folder.Spelling errors suck huh?
- Add a Python download and install feature if it doesn't already exist. ToDO: Fix this!!!! its not working right..
Figure out how to make uncompyle6 uncompile all the files properly as it fails on a handful of pyo files.
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
Code:
@set SIMS4DIR="D:\Origin Games\The Sims 4" @set TEMPDIR="C:\temp" @set ZIPPROGRAM="C:\Program Files\7-Zip\7z.exe"
Changes:
Edit!
TheHologramMan's unpyc3.py is a work in progress be forewarned.
Edit
Bug fix, please download v2 and see attachement's description for what was fixed.
Edit
Bug fix, please download v3 and see attachement's decription for what was fixed. Sorry guys, Writing large Bat files you tend to forget things *Sighs*
Edit
Last bug fix, if it's broken *Sighs*
Please download v4 and see attachement's decription for what was fixed.
Edit
Please Download v5 and see attachement's decription for whats changed.
Edit
Please Download v6 and see attachment's description for what's changed.
Edit
v7.1 Fixes a small bug it seems in the compression of simulation-src.zip
Edit
v7.2 Fixes the fix in v7.1 becuase I broke it yet again lol never edit batch files at 4am.
Edit
v7.3 Fixed the broken stuff in v7.2 and readded removal of pyo files, I also cleaned the code up a bit more, added a couple folders I had forgotten, hopefully now I can get to my small todo list soon
Edit
v8.0 I've come out of hiding to do an update, fixed some broken folders, did some cleanup, added some new batch stuff, Updated the folders to match the latest patch.
Edit
v8.1 Removed the massive folder lists from each of the 3 zips, done the same for the @del lists, started to work on the download/install of Python, some more batch cleanup
Attached files:
Decompilev2.7z (2.1 KB, 337 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2014-09-03 00:20:23 ....A 21752 2066 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 21752 2066 1 files, 0 folders |
||
Description: Fixed a small bug where it didn't delete all the temp files. | ||
Decompilev3.7z (2.1 KB, 125 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2014-09-03 00:43:21 ....A 22402 2071 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 22402 2071 1 files, 0 folders |
||
Description: Fixed another delete temp file bug. *Sighs* | ||
Decompilev4.7z (2.4 KB, 93 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2014-09-03 00:55:30 ....A 22974 2309 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 22974 2309 1 files, 0 folders |
||
Description: Last bug fix, hopefully *crosses fingers* Forgot to set %TEMPDIR% properly in the @del's | ||
Decompilev5.7z (2.4 KB, 159 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2014-09-03 01:36:26 ....A 23346 2310 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 23346 2310 1 files, 0 folders |
||
Description: Fixed spelling errors, Added function to only decompile .pyo files instead of every file in the directory. | ||
Decompilev6.7z (3.4 KB, 2475 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2014-09-05 20:59:07 ....A 30798 3284 Decompile-WithoutPause.bat 2014-09-05 20:57:43 ....A 30972 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 61770 3284 2 files, 0 folders |
||
Description: Added folders I missed, also added a Decompiler version without all the pauses. | ||
Decompilev7.7z (3.0 KB, 67 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2017-06-05 07:39:42 ....A 19738 2917 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 19738 2917 1 files, 0 folders |
||
Decompile7.1.7z (3.0 KB, 62 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2017-06-06 05:31:44 ....A 19738 2921 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 19738 2921 1 files, 0 folders |
||
Description: Fixed a bug with the Simulation file zip system | ||
Decompile7.2.7z (3.0 KB, 64 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2017-06-06 05:46:58 ....A 19815 2940 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 19815 2940 1 files, 0 folders |
||
Description: Fixed the bug I tried to fix in 7.1 do not edit .bat files at 4am | ||
Decompile7.3.7z (3.1 KB, 1836 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2017-06-06 10:51:33 ....A 25627 2998 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 25627 2998 1 files, 0 folders |
||
Description: This is the real working 7.3 Please redownload. | ||
Decompile8.0.7z (3.9 KB, 52 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2019-02-22 06:20:35 ....A 35979 3864 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 35979 3864 1 files, 0 folders |
||
Decompile8.1.7z (2.3 KB, 1717 downloads) - View custom content | ||
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2019-02-22 08:09:09 ....A 6478 2216 Decompile.bat ------------------- ----- ------------ ------------ ------------------------ 6478 2216 1 files, 0 folders |
16 users say thanks for this.
(Who?)
Thanks
Advertisement
Test Subject
#2
3rd Sep 2014 at 11:25 AM
Posts: 1
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
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
5th Sep 2014 at 2:09 PM
Posts: 20
Thanks: 1849 in 22 Posts
Awesome! But I think ur bat missed decompile some files under the subfolders, like /interaction/social etc.
#4
6th Sep 2014 at 1:23 AM
Posts: 24
Thanks: 16 in 1 Posts
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
11th Sep 2014 at 8:04 PM
Last edited by SpaceTimeDream : 12th Sep 2014 at 12:55 AM.
Reason: recompiled --> decompiled
Posts: 2
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
11th Sep 2014 at 10:24 PM
Posts: 1
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? |
Test Subject
#7
12th Sep 2014 at 2:51 AM
Posts: 3
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?
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?
#8
12th Sep 2014 at 1:39 PM
Last edited by pcgeekri : 12th Sep 2014 at 1:55 PM.
Reason: Addition
Posts: 54
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.
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.
#9
13th Sep 2014 at 6:03 AM
Posts: 24
Thanks: 16 in 1 Posts
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
13th Sep 2014 at 8:49 AM
Last edited by Morphar : 13th Sep 2014 at 11:37 AM.
Posts: 1,466
@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
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
13th Sep 2014 at 9:04 AM
Posts: 1
All the python files are empty for me. Why is this and how can I fix it?
#12
13th Sep 2014 at 5:26 PM
Posts: 24
Thanks: 16 in 1 Posts
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
#13
16th Sep 2014 at 3:07 PM
Posts: 159
Thanks: 17 in 1 Posts
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.
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
20th Sep 2014 at 7:12 AM
Last edited by Morphar : 20th Sep 2014 at 7:27 AM.
Posts: 1,466
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
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
20th Sep 2014 at 7:35 AM
Last edited by Morphar : 20th Sep 2014 at 9:13 AM.
Posts: 1,466
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.
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
26th Jan 2015 at 1:01 AM
Posts: 2
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.
#17
15th Apr 2015 at 5:22 PM
Posts: 25
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.
#18
20th Apr 2015 at 8:09 AM
Posts: 2,671
Thanks: 62708 in 190 Posts
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...
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...
Code:
Proccessing tunable.pyo... #ERROR: jaddr is None Traceback (most recent call last): File "pyDecompileVer1.5.6.py", line 33, in <module> make_file.write(str(decompiled_data)) File "C:\Python33\unpyc3.py", line 1194, in __str__ self.display(istr) File "C:\Python33\unpyc3.py", line 1200, in display stmt.display(indent) File "C:\Python33\unpyc3.py", line 1043, in display self.display_undecorated(indent) File "C:\Python33\unpyc3.py", line 1173, in display_undecorated suite.display(indent + 1) File "C:\Python33\unpyc3.py", line 1200, in display stmt.display(indent) File "C:\Python33\unpyc3.py", line 1043, in display self.display_undecorated(indent) File "C:\Python33\unpyc3.py", line 1067, in display_undecorated self.code.get_suite().display(indent + 1) File "C:\Python33\unpyc3.py", line 301, in get_suite dec.run() File "C:\Python33\unpyc3.py", line 1259, in run new_addr = method(addr) File "C:\Python33\unpyc3.py", line 1469, in POP_TOP self.stack.pop().on_pop(self) AttributeError: 'Unpack' object has no attribute 'on_pop'
Test Subject
#19
21st Apr 2015 at 6:18 AM
Posts: 47
Thanks: 1429 in 46 Posts
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...
Code:
Proccessing tunable.pyo... #ERROR: jaddr is None Traceback (most recent call last): File "pyDecompileVer1.5.6.py", line 33, in <module> make_file.write(str(decompiled_data)) File "C:\Python33\unpyc3.py", line 1194, in __str__ self.display(istr) File "C:\Python33\unpyc3.py", line 1200, in display stmt.display(indent) File "C:\Python33\unpyc3.py", line 1043, in display self.display_undecorated(indent) File "C:\Python33\unpyc3.py", line 1173, in display_undecorated suite.display(indent + 1) File "C:\Python33\unpyc3.py", line 1200, in display stmt.display(indent) File "C:\Python33\unpyc3.py", line 1043, in display self.display_undecorated(indent) File "C:\Python33\unpyc3.py", line 1067, in display_undecorated self.code.get_suite().display(indent + 1) File "C:\Python33\unpyc3.py", line 301, in get_suite dec.run() File "C:\Python33\unpyc3.py", line 1259, in run new_addr = method(addr) File "C:\Python33\unpyc3.py", line 1469, in POP_TOP self.stack.pop().on_pop(self) AttributeError: 'Unpack' object has no attribute 'on_pop' |
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.
Attached files:
unpyc3_fix.zip (29.3 KB, 414 downloads) - View custom content | ||
169432 04-21-2015 00:14 tunable.py 64255 04-21-2015 00:14 unpyc3.py --------- ------- 233687 2 files |
#20
22nd Apr 2015 at 7:06 AM
Posts: 2,671
Thanks: 62708 in 190 Posts
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
7th May 2015 at 3:32 AM
Posts: 1
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.
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.
Attached files:
Decompile.zip (575 Bytes, 260 downloads) - View custom content | ||
2087 05-06-2015 19:27 Decompile.bat --------- ------- 2087 1 file |
||
Description: Updated batch file |
#22
12th Jun 2015 at 3:42 AM
Last edited by Vinathi : 12th Jun 2015 at 4:05 AM.
Posts: 146
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?
Would anyone be willing to upload a .zip of the game's .py files or help me figure out what I'm doing wrong?
#23
12th Jun 2015 at 5:47 AM
Posts: 2,671
Thanks: 62708 in 190 Posts
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.
#24
13th Jun 2015 at 6:36 PM
Posts: 146
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
#25
5th Jul 2015 at 5:52 AM
Posts: 123
Thanks: 2254 in 12 Posts
I used Aren 's unpyc3 along with Kartha 's Decompile batch file , and it did not work , the files are empty
Who Posted
|