-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeorig.py
More file actions
55 lines (43 loc) · 1.58 KB
/
deorig.py
File metadata and controls
55 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Sims 4 Python File Decompiler Automation Script
Requires unpyc3
Type "import de" then "de.domagic()" in the Python console (with this file in your Python directory) and it will do its magic!
Don't forget to set the folder names (they're in all caps because I like the Caps Lock key)!!111!
by Miguel Leiva-Gomez
"""
import os
import subprocess
from unpyc3 import decompile
SIMS4_FOLDER = "C:\\Program Files (x86)\\Electronic Arts\\The Sims 4"
TEMPDIR = "C:\\Temp"
ZIPPROGRAM = "C:\\Program Files\\7-Zip\\7z.exe"
CurrentFolder = None
def extract_sims_archive(name):
#subprocess.call(ZIPPROGRAM + " x \"" + SIMS4_FOLDER + "\\Data\\Simulation\\Gameplay\\" + name + ".zip\" -o" + "\"" + TEMPDIR + "\\" + name + "\"")
print("DEV")
def domagic():
#extract_sims_archive("base")
#extract_sims_archive("core")
#extract_sims_archive("simulation")
rundecompile()
def outputwhatever():
print(ZIPPROGRAM + " x \"" + SIMS4_FOLDER + "\\Data\\Simulation\\Gameplay\\" + "base" + ".zip\" -o" + TEMPDIR)
def rundecompile():
for root, dirs, files in os.walk(TEMPDIR):
for name in files:
if ".pyo" in name:
dodecompile(name, root)
def dodecompile(name, currentfolder):
try:
fullpath = currentfolder + "\\" + name
print("Decompiling " + fullpath)
decompiledstring = str(decompile(fullpath))
newfilename = name.replace(".pyo", ".py")
newpath = currentfolder + "\\" + newfilename
file = open(newpath, "w")
file.write(decompiledstring)
file.close()
os.remove(os.path.join(currentfolder, name))
except Exception as exc:
print("Excepted: "+str(exc))
pass