mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 11:48:22 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
d0f3b201cf
2 changed files with 21 additions and 20 deletions
|
@ -58,9 +58,9 @@ class NoGui:
|
||||||
def get(self):
|
def get(self):
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
def progress(self, *args, **kwargs): print(args, kwargs)
|
def progress(*args, **kwargs): print(args, kwargs)
|
||||||
def translate(self, *args, **kwargs): return ""
|
def translate(*args, **kwargs): return ""
|
||||||
def log_error(self, *args, **kwargs): print(args, kwargs)
|
def log_error(*args, **kwargs): print(args, kwargs)
|
||||||
|
|
||||||
is_dev_version = False
|
is_dev_version = False
|
||||||
button_install_mod = NoButton()
|
button_install_mod = NoButton()
|
||||||
|
@ -148,7 +148,9 @@ class Game:
|
||||||
self.region = region_id_to_name[self.region_ID] if self.region_ID in region_id_to_name else self.region
|
self.region = region_id_to_name[self.region_ID] if self.region_ID in region_id_to_name else self.region
|
||||||
|
|
||||||
@in_thread
|
@in_thread
|
||||||
def install_mod(self):
|
def install_mod(self): self.nothread_install_mod()
|
||||||
|
|
||||||
|
def nothread_install_mod(self):
|
||||||
"""
|
"""
|
||||||
Patch the game to install the mod
|
Patch the game to install the mod
|
||||||
"""
|
"""
|
||||||
|
@ -348,7 +350,9 @@ class Game:
|
||||||
finalise(f"./file/Common_R{bmglang}.txt", rbmgcommon)
|
finalise(f"./file/Common_R{bmglang}.txt", rbmgcommon)
|
||||||
|
|
||||||
@in_thread
|
@in_thread
|
||||||
def patch_file(self):
|
def patch_file(self): self.nothread_patch_file()
|
||||||
|
|
||||||
|
def nothread_patch_file(self):
|
||||||
"""
|
"""
|
||||||
Prepare all files to install the mod (track, bmg text, descriptive image, ...)
|
Prepare all files to install the mod (track, bmg text, descriptive image, ...)
|
||||||
"""
|
"""
|
||||||
|
@ -373,7 +377,7 @@ class Game:
|
||||||
for file in glob.glob(self.path + "/files/Scene/UI/MenuSingle_?.szs"): self.patch_bmg(file)
|
for file in glob.glob(self.path + "/files/Scene/UI/MenuSingle_?.szs"): self.patch_bmg(file)
|
||||||
# MenuSingle could be any other file, Common and Menu are all the same in all other files.
|
# MenuSingle could be any other file, Common and Menu are all the same in all other files.
|
||||||
self.patch_autoadd()
|
self.patch_autoadd()
|
||||||
if self.patch_tracks() != 0: return
|
self.patch_tracks()
|
||||||
|
|
||||||
self.gui.button_install_mod.grid(row=2, column=1, columnspan=2, sticky="NEWS")
|
self.gui.button_install_mod.grid(row=2, column=1, columnspan=2, sticky="NEWS")
|
||||||
self.gui.button_install_mod.config(
|
self.gui.button_install_mod.config(
|
||||||
|
@ -419,11 +423,9 @@ class Game:
|
||||||
new_4_3.paste(img_lang_4_3, (0, 0), img_lang_4_3)
|
new_4_3.paste(img_lang_4_3, (0, 0), img_lang_4_3)
|
||||||
new_4_3.save(dest_dir + f"/strapA_608x456{get_filename(get_nodir(file_lang))}.png")
|
new_4_3.save(dest_dir + f"/strapA_608x456{get_filename(get_nodir(file_lang))}.png")
|
||||||
|
|
||||||
|
def patch_tracks(self) -> None:
|
||||||
def patch_tracks(self) -> int:
|
|
||||||
"""
|
"""
|
||||||
Download track's wu8 file and convert them to szs
|
Download track's wu8 file and convert them to szs
|
||||||
:return: 0 if no error occured
|
|
||||||
"""
|
"""
|
||||||
max_process = self.gui.intvar_process_track.get()
|
max_process = self.gui.intvar_process_track.get()
|
||||||
thread_list = {}
|
thread_list = {}
|
||||||
|
@ -496,5 +498,3 @@ class Game:
|
||||||
clean_process()
|
clean_process()
|
||||||
|
|
||||||
while clean_process() != 1: pass # End the process if all process ended
|
while clean_process() != 1: pass # End the process if all process ended
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
|
@ -108,7 +108,9 @@ class Gui:
|
||||||
self.frame_game_path_action.columnconfigure(1, weight=1)
|
self.frame_game_path_action.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
@in_thread
|
@in_thread
|
||||||
def use_path():
|
def use_path(): nothread_use_path()
|
||||||
|
|
||||||
|
def nothread_use_path():
|
||||||
self.frame_action.grid_forget()
|
self.frame_action.grid_forget()
|
||||||
try:
|
try:
|
||||||
self.game.set_path(entry_game_path.get())
|
self.game.set_path(entry_game_path.get())
|
||||||
|
@ -117,12 +119,16 @@ class Gui:
|
||||||
self.frame_action.grid(row=3, column=1, sticky="NEWS")
|
self.frame_action.grid(row=3, column=1, sticky="NEWS")
|
||||||
except RomAlreadyPatched:
|
except RomAlreadyPatched:
|
||||||
messagebox.showerror(self.translate("Error"), self.translate("This game is already modded"))
|
messagebox.showerror(self.translate("Error"), self.translate("This game is already modded"))
|
||||||
|
raise RomAlreadyPatched
|
||||||
except InvalidGamePath:
|
except InvalidGamePath:
|
||||||
messagebox.showerror(self.translate("Error"), self.translate("The file path in invalid"))
|
messagebox.showerror(self.translate("Error"), self.translate("The file path in invalid"))
|
||||||
|
raise InvalidGamePath
|
||||||
except InvalidFormat:
|
except InvalidFormat:
|
||||||
messagebox.showerror(self.translate("Error"), self.translate("This game's format is invalid"))
|
messagebox.showerror(self.translate("Error"), self.translate("This game's format is invalid"))
|
||||||
|
raise InvalidFormat
|
||||||
except:
|
except:
|
||||||
self.log_error()
|
self.log_error()
|
||||||
|
raise Exception
|
||||||
finally:
|
finally:
|
||||||
self.progress(show=False)
|
self.progress(show=False)
|
||||||
|
|
||||||
|
@ -132,14 +138,9 @@ class Gui:
|
||||||
|
|
||||||
@in_thread
|
@in_thread
|
||||||
def do_everything():
|
def do_everything():
|
||||||
use_path().join()
|
nothread_use_path()
|
||||||
self.game.patch_file().join()
|
self.game.nothread_patch_file()
|
||||||
self.game.install_mod().join()
|
self.game.nothread_install_mod()
|
||||||
|
|
||||||
if messagebox.askyesno(self.translate("Experimental functionality"),
|
|
||||||
self.translate("This will extract the selected ROM, prepare files and install mod. "
|
|
||||||
"Do you wish to continue ?")):
|
|
||||||
do_everything()
|
|
||||||
|
|
||||||
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Do everything"), relief=RIDGE, command=do_everything)
|
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Do everything"), relief=RIDGE, command=do_everything)
|
||||||
self.button_do_everything.grid(row=1, column=2, sticky="NEWS")
|
self.button_do_everything.grid(row=1, column=2, sticky="NEWS")
|
||||||
|
|
Loading…
Reference in a new issue