Skip to content

Commit b7dbf75

Browse files
authored
Update main.py
1 parent f90ed6f commit b7dbf75

File tree

1 file changed

+56
-36
lines changed

1 file changed

+56
-36
lines changed

main.py

+56-36
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
"""
88

99

10+
1011
import contextlib
1112
import sys
1213
import zipfile
1314
import os
1415
import shutil
1516
import win32file
1617
import requests
18+
import json
1719
from rich.console import Console
1820

1921
console = Console()
@@ -27,11 +29,12 @@
2729
games_in_cur_dir = [
2830
file
2931
for file in files
30-
if file.endswith(".exe") and os.path.exists(file.replace(".exe", "") + "_Data")
32+
if file.endswith(".exe")
33+
and os.path.exists(file.replace(".exe", "") + "_Data")
3134
]
3235
match len(games_in_cur_dir):
3336
case 0:
34-
console.print("You have to specify the games exe file.",
37+
console.print("Automatic Detection could not find any Game in the current Directory",
3538
style="red on black")
3639
input("Press Enter to continue...")
3740
sys.exit(0)
@@ -49,18 +52,35 @@
4952
input("Press Enter to continue...")
5053
sys.exit(0)
5154

52-
BEPINEXIL2CPP64 = "https://builds.bepinex.dev/projects/bepinex_be/577/BepInEx_UnityIL2CPP_x64_ec79ad0_6.0.0-be.577.zip"
53-
BEPINEXIL2CPP86 = "https://builds.bepinex.dev/projects/bepinex_be/577/BepInEx_UnityIL2CPP_x86_ec79ad0_6.0.0-be.577.zip"
54-
BEPINEX64 = "https://github.com/BepInEx/BepInEx/releases/download/v5.4.21/BepInEx_x64_5.4.21.0.zip"
55-
BEPINEX86 = "https://github.com/BepInEx/BepInEx/releases/download/v5.4.21/BepInEx_x86_5.4.21.0.zip"
56-
BEPINEX6IL2CPP64 = "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityIL2CPP_x64_6.0.0-pre.1.zip"
57-
BEPINEX6IL2CPP86 = "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityIL2CPP_x86_6.0.0-pre.1.zip"
58-
BEPINEX664 = "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityMono_x64_6.0.0-pre.1.zip"
59-
BEPINEX686 = "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityMono_x86_6.0.0-pre.1.zip"
60-
BEPINEXBEBUILD64 = "https://builds.bepinex.dev/projects/bepinex_be/668/BepInEx-Unity.Mono-win-x64-6.0.0-be.668%2B46e297f.zip"
61-
BEPINEXBEBUILD86 = "https://builds.bepinex.dev/projects/bepinex_be/668/BepInEx-Unity.Mono-win-x86-6.0.0-be.668%2B46e297f.zip"
62-
BEPINEXBEBUILDIL2CPP64 = "https://builds.bepinex.dev/projects/bepinex_be/668/BepInEx-Unity.IL2CPP-win-x64-6.0.0-be.668%2B46e297f.zip"
63-
BEPINEXBEBUILDIL2CPP86 = "https://builds.bepinex.dev/projects/bepinex_be/668/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.668%2B46e297f.zip"
55+
if os.path.isfile("AutoInstaller-config.json"):
56+
with open("AutoInstaller-config.json", "r") as Config:
57+
links = json.load(Config)
58+
else:
59+
links = {
60+
"BEPINEXIL2CPP64": "https://builds.bepinex.dev/projects/bepinex_be/577/BepInEx_UnityIL2CPP_x64_ec79ad0_6.0.0-be.577.zip",
61+
"BEPINEXIL2CPP86": "https://builds.bepinex.dev/projects/bepinex_be/577/BepInEx_UnityIL2CPP_x86_ec79ad0_6.0.0-be.577.zip",
62+
"BEPINEX64": "https://github.com/BepInEx/BepInEx/releases/download/v5.4.21/BepInEx_x64_5.4.21.0.zip",
63+
"BEPINEX86": "https://github.com/BepInEx/BepInEx/releases/download/v5.4.21/BepInEx_x86_5.4.21.0.zip",
64+
"BEPINEX6IL2CPP64": "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityIL2CPP_x64_6.0.0-pre.1.zip",
65+
"BEPINEX6IL2CPP86": "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityIL2CPP_x86_6.0.0-pre.1.zip",
66+
"BEPINEX664": "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityMono_x64_6.0.0-pre.1.zip",
67+
"BEPINEX686": "https://github.com/BepInEx/BepInEx/releases/download/v6.0.0-pre.1/BepInEx_UnityMono_x86_6.0.0-pre.1.zip",
68+
"BEPINEXBEBUILD64": "https://builds.bepinex.dev/projects/bepinex_be/670/BepInEx-Unity.Mono-win-x64-6.0.0-be.670%2B42a6727.zip",
69+
"BEPINEXBEBUILD86": "https://builds.bepinex.dev/projects/bepinex_be/670/BepInEx-Unity.Mono-win-x86-6.0.0-be.670%2B42a6727.zip",
70+
"BEPINEXBEBUILDIL2CPP64": "https://builds.bepinex.dev/projects/bepinex_be/670/BepInEx-Unity.IL2CPP-win-x64-6.0.0-be.670%2B42a6727.zip",
71+
"BEPINEXBEBUILDIL2CPP86": "https://builds.bepinex.dev/projects/bepinex_be/670/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.670%2B42a6727.zip",
72+
"UNIVERSALUNITYDEMOSAIC": "https://github.com/ManlyMarco/UniversalUnityDemosaics/releases/download/v1.5/UniversalUnityDemosaics_BepInEx5_v1.5.zip",
73+
"UNIVERSALUNITYDEMOSAICIL2CPP": "https://github.com/ManlyMarco/UniversalUnityDemosaics/releases/download/v1.5/UniversalUnityDemosaics_BepInEx6_IL2CPP_v1.5.zip",
74+
"AUTOTRANSLATOR": "https://github.com/bbepis/XUnity.AutoTranslator/releases/download/v5.0.0/XUnity.AutoTranslator-BepInEx-5.0.0.zip",
75+
"AUTOTRANSLATORIL2CPP": "https://github.com/bbepis/XUnity.AutoTranslator/releases/download/v5.0.0/XUnity.AutoTranslator-BepInEx-IL2CPP-5.0.0.zip",
76+
"UNITYEXPLORERBE5": "https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx5.Mono.zip",
77+
"UNITYEXPLORERBE5IL2CPP": "https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx.Il2Cpp.zip",
78+
"UNITYEXPLORERBE6": "https://github.com/sinai-dev/UnityExplorer/releases/download/4.9.0/UnityExplorer.BepInEx6.Mono.zip",
79+
"UNITYEXPLORERBE6IL2CPP": "https://github.com/sinai-dev/UnityExplorer/releases/download/4.9.0/UnityExplorer.BepInEx.IL2CPP.zip",
80+
"TEXTUREREPLACER": "https://attachments.f95zone.to/2023/06/2692158_Texture_Replacer_plugin_v1.0.5.1.zip"
81+
}
82+
with open("AutoInstaller-config.json", "w") as Config:
83+
json.dump(links, Config)
6484

6585
def determine_arch() -> str:
6686
il2cpp = bool(os.path.isfile("GameAssembly.dll"))
@@ -95,7 +115,7 @@ def download_universaldemosaic():
95115
os.mkdir("Bepinex/plugins")
96116
if arch in ["mono_64", "mono_86"]:
97117
install_universaldemosaic_9(
98-
"https://github.com/ManlyMarco/UniversalUnityDemosaics/releases/download/v1.5/UniversalUnityDemosaics_BepInEx5_v1.5.zip",
118+
links["UNIVERSALUNITYDEMOSAIC"],
99119
"DumbRendererDemosaic.dll",
100120
)
101121
os.system("del DumbTypeDemosaic.dll")
@@ -104,7 +124,7 @@ def download_universaldemosaic():
104124
os.system("del CombinedMeshDemosaic.dll")
105125
elif arch in ["il2cpp_64", "il2cpp_86"]:
106126
install_universaldemosaic_9(
107-
"https://github.com/ManlyMarco/UniversalUnityDemosaics/releases/download/v1.5/UniversalUnityDemosaics_BepInEx6_IL2CPP_v1.5.zip",
127+
links["UNIVERSALUNITYDEMOSAICIL2CPP"],
108128
"DumbRendererDemosaicIl2Cpp.dll",
109129
)
110130
else:
@@ -126,19 +146,19 @@ def download_bepinex6():
126146
style="yellow on black")
127147
return
128148
if arch == "il2cpp_64":
129-
download_url(BEPINEX6IL2CPP64, "Bepinex.zip")
149+
download_url(links["BEPINEX6IL2CPP64"], "Bepinex.zip")
130150
unzip("Bepinex.zip")
131151
os.system("del Bepinex.zip")
132152
elif arch == "il2cpp_86":
133-
download_url(BEPINEX6IL2CPP86, "Bepinex.zip")
153+
download_url(links["BEPINEX6IL2CPP86"], "Bepinex.zip")
134154
unzip("Bepinex.zip")
135155
os.system("del Bepinex.zip")
136156
elif arch == "mono_64":
137-
download_url(BEPINEX664, "Bepinex.zip")
157+
download_url(links["BEPINEX664"], "Bepinex.zip")
138158
unzip("Bepinex.zip")
139159
os.system("del Bepinex.zip")
140160
elif arch == "mono_86":
141-
download_url(BEPINEX686, "Bepinex.zip")
161+
download_url(links["BEPINEX686"], "Bepinex.zip")
142162
unzip("Bepinex.zip")
143163
os.system("del Bepinex.zip")
144164
else:
@@ -152,19 +172,19 @@ def download_bepinex():
152172
style="yellow on black")
153173
return
154174
if arch == "mono_64":
155-
download_url(BEPINEX64, "Bepinex.zip")
175+
download_url(links["BEPINEX64"], "Bepinex.zip")
156176
unzip("Bepinex.zip")
157177
os.system("del Bepinex.zip")
158178
elif arch == "mono_86":
159-
download_url(BEPINEX86, "Bepinex.zip")
179+
download_url(links["BEPINEX86"], "Bepinex.zip")
160180
unzip("Bepinex.zip")
161181
os.system("del Bepinex.zip")
162182
elif arch == "il2cpp_64":
163-
download_url(BEPINEXIL2CPP64, "Bepinex.zip")
183+
download_url(links["BEPINEXIL2CPP64"], "Bepinex.zip")
164184
unzip("Bepinex.zip")
165185
os.system("del Bepinex.zip")
166186
elif arch == "il2cpp_86":
167-
download_url(BEPINEXIL2CPP86, "Bepinex.zip")
187+
download_url(links["BEPINEXIL2CPP86"], "Bepinex.zip")
168188
unzip("Bepinex.zip")
169189
os.system("del Bepinex.zip")
170190
else:
@@ -184,11 +204,11 @@ def download_autotranslator():
184204
return
185205
if arch in ["mono_64", "mono_86"]:
186206
install_autotranslator_7(
187-
"https://github.com/bbepis/XUnity.AutoTranslator/releases/download/v5.0.0/XUnity.AutoTranslator-BepInEx-5.0.0.zip"
207+
links["AUTOTRANSLATOR"]
188208
)
189209
elif arch in ["il2cpp_64", "il2cpp_86"]:
190210
install_autotranslator_7(
191-
"https://github.com/bbepis/XUnity.AutoTranslator/releases/download/v5.0.0/XUnity.AutoTranslator-BepInEx-IL2CPP-5.0.0.zip"
211+
links["AUTOTRANSLATORIL2CPP"]
192212
)
193213
else:
194214
sys.exit("Something went wrong***")
@@ -208,13 +228,13 @@ def download_unityexplorer():
208228
try:
209229
if arch in ["mono_64", "mono_86"]:
210230
install_unityexplorer_8(
211-
"https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx5.Mono.zip",
231+
links["UNITYEXPLORERBE5"],
212232
"plugins/sinai-dev-UnityExplorer/",
213233
"plugins",
214234
)
215235
elif arch in ["il2cpp_64", "il2cpp_86"]:
216236
install_unityexplorer_8(
217-
"https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.BepInEx.Il2Cpp.zip",
237+
links["UNITYEXPLORERBE5IL2CPP"],
218238
"UnityExplorer.BepInEx.IL2CPP/plugins/sinai-dev-UnityExplorer/",
219239
"UnityExplorer.BepInEx.IL2CPP",
220240
)
@@ -240,19 +260,19 @@ def install_BEBuild6():
240260
console.print("Bepinex is already installed!", style="yellow on black")
241261
return
242262
if arch == "mono_64":
243-
download_url(BEPINEXBEBUILD64, "Bepinex.zip")
263+
download_url(links["BEPINEXBEBUILD64"], "Bepinex.zip")
244264
unzip("Bepinex.zip")
245265
os.system("del Bepinex.zip")
246266
elif arch == "mono_86":
247-
download_url(BEPINEXBEBUILD86, "Bepinex.zip")
267+
download_url(links["BEPINEXBEBUILD86"], "Bepinex.zip")
248268
unzip("Bepinex.zip")
249269
os.system("del Bepinex.zip")
250270
elif arch == "il2cpp_64":
251-
download_url(BEPINEXBEBUILDIL2CPP64, "Bepinex.zip")
271+
download_url(links["BEPINEXBEBUILDIL2CPP64"], "Bepinex.zip")
252272
unzip("Bepinex.zip")
253273
os.system("del Bepinex.zip")
254274
elif arch == "il2cpp_86":
255-
download_url(BEPINEXBEBUILDIL2CPP86, "Bepinex.zip")
275+
download_url(links["BEPINEXBEBUILDIL2CPP86"], "Bepinex.zip")
256276
unzip("Bepinex.zip")
257277
os.system("del Bepinex.zip")
258278
else:
@@ -265,13 +285,13 @@ def install_UnityExplorer6():
265285
style="yellow on black")
266286
return
267287
if arch in ["mono_64", "mono_86"]:
268-
download_url("https://github.com/sinai-dev/UnityExplorer/releases/download/4.9.0/UnityExplorer.BepInEx6.Mono.zip", "UnityExplorer.zip")
288+
download_url(links["UNITYEXPLORERBE6"], "UnityExplorer.zip")
269289
unzip("UnityExplorer.zip")
270290
os.system("del UnityExplorer.zip")
271291
shutil.move("plugins/sinai-dev-UnityExplorer", "BepInEx/plugins")
272292
os.rmdir("plugins")
273293
elif arch in ["il2cpp_64", "il2cpp_86"]:
274-
download_url("https://github.com/sinai-dev/UnityExplorer/releases/download/4.9.0/UnityExplorer.BepInEx.IL2CPP.zip", "UnityExplorer.zip")
294+
download_url(links["UNITYEXPLORERBE6IL2CPP"], "UnityExplorer.zip")
275295
unzip("UnityExplorer.zip")
276296
os.system("del UnityExplorer.zip")
277297
shutil.move("UnityExplorer.BepInEx.IL2CPP/plugins/sinai-dev-UnityExplorer", "BepInEx/plugins")
@@ -287,15 +307,15 @@ def install_TextureReplacer():
287307
style="yellow on black")
288308
return
289309
if arch in ["mono_64", "mono_86"]:
290-
download_url("https://attachments.f95zone.to/2023/01/2332348_Texture_Replacer_v1.0.4.1.zip", "Texture_Replacer.zip")
310+
download_url(links["TEXTUREREPLACER"], "Texture_Replacer.zip")
291311
unzip("Texture_Replacer.zip")
292312
os.system("del Texture_Replacer.zip")
293313
with contextlib.suppress(FileExistsError):
294314
os.mkdir("BepInEx/plugins")
295315
shutil.move("Texture_Replacer.dll", "BepInEx/plugins")
296316
os.system("del Texture_Replacer_il2cpp.dll")
297317
elif arch in ["il2cpp_64", "il2cpp_86"]:
298-
download_url("https://attachments.f95zone.to/2023/01/2332348_Texture_Replacer_v1.0.4.1.zip", "Texture_Replacer.zip")
318+
download_url(links["TEXTUREREPLACER"], "Texture_Replacer.zip")
299319
unzip("Texture_Replacer.zip")
300320
os.system("del Texture_Replacer.zip")
301321
with contextlib.suppress(FileExistsError):

0 commit comments

Comments
 (0)