Move update_sprites as --update_sprites to LttPAdjuster
This commit is contained in:
parent
65df153947
commit
73ed18c11d
2
Gui.py
2
Gui.py
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# module is planned to be removed
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import json
|
import json
|
||||||
|
@ -1909,6 +1910,7 @@ def get_image_for_sprite(sprite, gif_only: bool = False):
|
||||||
|
|
||||||
return image.zoom(2)
|
return image.zoom(2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
if "update_sprites" in sys.argv:
|
if "update_sprites" in sys.argv:
|
||||||
|
|
|
@ -5,6 +5,10 @@ import logging
|
||||||
import textwrap
|
import textwrap
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from tkinter import Tk
|
||||||
|
|
||||||
|
from Gui import update_sprites
|
||||||
|
from GuiUtils import BackgroundTaskProgress
|
||||||
|
|
||||||
from worlds.alttp.Rom import Sprite, LocalRom, apply_rom_settings
|
from worlds.alttp.Rom import Sprite, LocalRom, apply_rom_settings
|
||||||
from Utils import output_path
|
from Utils import output_path
|
||||||
|
@ -16,46 +20,67 @@ class AdjusterWorld(object):
|
||||||
self.sprite_pool = {1: sprite_pool}
|
self.sprite_pool = {1: sprite_pool}
|
||||||
self.rom_seeds = {1: random}
|
self.rom_seeds = {1: random}
|
||||||
|
|
||||||
|
|
||||||
class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter):
|
class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter):
|
||||||
|
|
||||||
def _get_help_string(self, action):
|
def _get_help_string(self, action):
|
||||||
return textwrap.dedent(action.help)
|
return textwrap.dedent(action.help)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument('--rom', default='ER_base.sfc', help='Path to an ALttP rom to adjust.')
|
parser.add_argument('--rom', default='ER_base.sfc', help='Path to an ALttP rom to adjust.')
|
||||||
parser.add_argument('--baserom', default='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc',
|
parser.add_argument('--baserom', default='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc',
|
||||||
help='Path to an ALttP JAP(1.0) rom to use as a base.')
|
help='Path to an ALttP JAP(1.0) rom to use as a base.')
|
||||||
parser.add_argument('--loglevel', default='info', const='info', nargs='?', choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.')
|
parser.add_argument('--loglevel', default='info', const='info', nargs='?',
|
||||||
parser.add_argument('--fastmenu', default='normal', const='normal', nargs='?', choices=['normal', 'instant', 'double', 'triple', 'quadruple', 'half'],
|
choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.')
|
||||||
|
parser.add_argument('--fastmenu', default='normal', const='normal', nargs='?',
|
||||||
|
choices=['normal', 'instant', 'double', 'triple', 'quadruple', 'half'],
|
||||||
help='''\
|
help='''\
|
||||||
Select the rate at which the menu opens and closes.
|
Select the rate at which the menu opens and closes.
|
||||||
(default: %(default)s)
|
(default: %(default)s)
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
||||||
parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
|
parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
|
||||||
parser.add_argument('--triforcehud', default='hide_goal', const='hide_goal', nargs='?', choices=['normal', 'hide_goal', 'hide_required', 'hide_both'],
|
parser.add_argument('--triforcehud', default='hide_goal', const='hide_goal', nargs='?',
|
||||||
|
choices=['normal', 'hide_goal', 'hide_required', 'hide_both'],
|
||||||
help='''\
|
help='''\
|
||||||
Hide the triforce hud in certain circumstances.
|
Hide the triforce hud in certain circumstances.
|
||||||
hide_goal will hide the hud until finding a triforce piece, hide_required will hide the total amount needed to win
|
hide_goal will hide the hud until finding a triforce piece, hide_required will hide the total amount needed to win
|
||||||
(Both can be revealed when speaking to Murahalda)
|
(Both can be revealed when speaking to Murahalda)
|
||||||
(default: %(default)s)
|
(default: %(default)s)
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--enableflashing', help='Reenable flashing animations (unfriendly to epilepsy, always disabled in race roms)', action='store_false', dest="reduceflashing")
|
parser.add_argument('--enableflashing',
|
||||||
parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['double', 'normal', 'half', 'quarter', 'off'],
|
help='Reenable flashing animations (unfriendly to epilepsy, always disabled in race roms)',
|
||||||
|
action='store_false', dest="reduceflashing")
|
||||||
|
parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?',
|
||||||
|
choices=['double', 'normal', 'half', 'quarter', 'off'],
|
||||||
help='''\
|
help='''\
|
||||||
Select the rate at which the heart beep sound is played at
|
Select the rate at which the heart beep sound is played at
|
||||||
low health. (default: %(default)s)
|
low health. (default: %(default)s)
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--heartcolor', default='red', const='red', nargs='?', choices=['red', 'blue', 'green', 'yellow', 'random'],
|
parser.add_argument('--heartcolor', default='red', const='red', nargs='?',
|
||||||
|
choices=['red', 'blue', 'green', 'yellow', 'random'],
|
||||||
help='Select the color of Link\'s heart meter. (default: %(default)s)')
|
help='Select the color of Link\'s heart meter. (default: %(default)s)')
|
||||||
parser.add_argument('--ow_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
|
parser.add_argument('--ow_palettes', default='default',
|
||||||
parser.add_argument('--link_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
|
choices=['default', 'random', 'blackout', 'puke', 'classic', 'grayscale', 'negative', 'dizzy',
|
||||||
parser.add_argument('--shield_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
|
'sick'])
|
||||||
parser.add_argument('--sword_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
|
parser.add_argument('--link_palettes', default='default',
|
||||||
parser.add_argument('--hud_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
|
choices=['default', 'random', 'blackout', 'puke', 'classic', 'grayscale', 'negative', 'dizzy',
|
||||||
parser.add_argument('--uw_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
|
'sick'])
|
||||||
|
parser.add_argument('--shield_palettes', default='default',
|
||||||
|
choices=['default', 'random', 'blackout', 'puke', 'classic', 'grayscale', 'negative', 'dizzy',
|
||||||
|
'sick'])
|
||||||
|
parser.add_argument('--sword_palettes', default='default',
|
||||||
|
choices=['default', 'random', 'blackout', 'puke', 'classic', 'grayscale', 'negative', 'dizzy',
|
||||||
|
'sick'])
|
||||||
|
parser.add_argument('--hud_palettes', default='default',
|
||||||
|
choices=['default', 'random', 'blackout', 'puke', 'classic', 'grayscale', 'negative', 'dizzy',
|
||||||
|
'sick'])
|
||||||
|
parser.add_argument('--uw_palettes', default='default',
|
||||||
|
choices=['default', 'random', 'blackout', 'puke', 'classic', 'grayscale', 'negative', 'dizzy',
|
||||||
|
'sick'])
|
||||||
parser.add_argument('--sprite', help='''\
|
parser.add_argument('--sprite', help='''\
|
||||||
Path to a sprite sheet to use for Link. Needs to be in
|
Path to a sprite sheet to use for Link. Needs to be in
|
||||||
binary format and have a length of 0x7000 (28672) bytes,
|
binary format and have a length of 0x7000 (28672) bytes,
|
||||||
|
@ -64,8 +89,11 @@ def main():
|
||||||
sprite that will be extracted.
|
sprite that will be extracted.
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--names', default='', type=str)
|
parser.add_argument('--names', default='', type=str)
|
||||||
|
parser.add_argument('--update_sprites', action='store_true', help='Update Sprite Database, then exit.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
if args.update_sprites:
|
||||||
|
run_sprite_update()
|
||||||
|
sys.exit()
|
||||||
# set up logger
|
# set up logger
|
||||||
loglevel = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}[
|
loglevel = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}[
|
||||||
args.loglevel]
|
args.loglevel]
|
||||||
|
@ -123,6 +151,7 @@ def adjust(args):
|
||||||
|
|
||||||
return args, path
|
return args, path
|
||||||
|
|
||||||
|
|
||||||
def adjustGUI():
|
def adjustGUI():
|
||||||
from tkinter import Checkbutton, OptionMenu, Toplevel, LabelFrame, PhotoImage, Tk, LEFT, RIGHT, BOTTOM, TOP, \
|
from tkinter import Checkbutton, OptionMenu, Toplevel, LabelFrame, PhotoImage, Tk, LEFT, RIGHT, BOTTOM, TOP, \
|
||||||
StringVar, IntVar, Frame, Label, W, E, X, BOTH, Entry, Spinbox, Button, filedialog, messagebox, ttk
|
StringVar, IntVar, Frame, Label, W, E, X, BOTH, Entry, Spinbox, Button, filedialog, messagebox, ttk
|
||||||
|
@ -148,6 +177,7 @@ def adjustGUI():
|
||||||
def RomSelect2():
|
def RomSelect2():
|
||||||
rom = filedialog.askopenfilename(filetypes=[("Rom Files", (".sfc", ".smc", ".apbp")), ("All Files", "*")])
|
rom = filedialog.askopenfilename(filetypes=[("Rom Files", (".sfc", ".smc", ".apbp")), ("All Files", "*")])
|
||||||
romVar2.set(rom)
|
romVar2.set(rom)
|
||||||
|
|
||||||
romSelectButton2 = Button(romDialogFrame, text='Select Rom', command=RomSelect2)
|
romSelectButton2 = Button(romDialogFrame, text='Select Rom', command=RomSelect2)
|
||||||
romDialogFrame.pack(side=TOP, expand=True, fill=X)
|
romDialogFrame.pack(side=TOP, expand=True, fill=X)
|
||||||
baseRomLabel2.pack(side=LEFT)
|
baseRomLabel2.pack(side=LEFT)
|
||||||
|
@ -198,5 +228,16 @@ def adjustGUI():
|
||||||
adjustWindow.mainloop()
|
adjustWindow.mainloop()
|
||||||
|
|
||||||
|
|
||||||
|
def run_sprite_update():
|
||||||
|
import threading
|
||||||
|
done = threading.Event()
|
||||||
|
top = Tk()
|
||||||
|
top.withdraw()
|
||||||
|
BackgroundTaskProgress(top, update_sprites, "Updating Sprites", lambda succesful, resultmessage: done.set())
|
||||||
|
while not done.isSet():
|
||||||
|
top.update()
|
||||||
|
print("Done updating sprites")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
|
@ -52,7 +52,7 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks:
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..."
|
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..."
|
||||||
Filename: "{app}\ArchipelagoLttPCreator"; Parameters: "update_sprites"; StatusMsg: "Updating Sprite Library..."
|
Filename: "{app}\ArchipelagoLttPAdjuster"; Parameters: "--update_sprites"; StatusMsg: "Updating Sprite Library..."
|
||||||
|
|
||||||
[UninstallDelete]
|
[UninstallDelete]
|
||||||
Type: dirifempty; Name: "{app}"
|
Type: dirifempty; Name: "{app}"
|
||||||
|
|
|
@ -52,7 +52,7 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks:
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..."
|
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..."
|
||||||
Filename: "{app}\ArchipelagoLttPCreator"; Parameters: "update_sprites"; StatusMsg: "Updating Sprite Library..."
|
Filename: "{app}\ArchipelagoLttPAdjuster"; Parameters: "--update_sprites"; StatusMsg: "Updating Sprite Library..."
|
||||||
|
|
||||||
[UninstallDelete]
|
[UninstallDelete]
|
||||||
Type: dirifempty; Name: "{app}"
|
Type: dirifempty; Name: "{app}"
|
||||||
|
|
Loading…
Reference in New Issue