Merge branch 'dev' of https://github.com/miketrethewey/ALttPDoorRandomizer into miketrethewey-dev

This commit is contained in:
aerinon
2020-04-09 15:55:27 -06:00
27 changed files with 257 additions and 79 deletions

View File

@@ -220,6 +220,7 @@ jobs:
body: ${{ steps.release_notes.outputs.body }}
draft: true
prerelease: true
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
# upload linux archive asset
- name: Upload Linux Archive Asset
id: upload-linux-asset
@@ -231,6 +232,7 @@ jobs:
asset_path: ../deploy/linux/ALttPDoorRandomizer.tar.gz
asset_name: ALttPDoorRandomizer-${{ steps.debug_info.outputs.github_tag }}-linux-bionic.tar.gz
asset_content_type: application/gzip
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
# upload macos archive asset
- name: Upload MacOS Archive Asset
id: upload-macos-asset
@@ -242,6 +244,7 @@ jobs:
asset_path: ../deploy/macos/ALttPDoorRandomizer.tar.gz
asset_name: ALttPDoorRandomizer-${{ steps.debug_info.outputs.github_tag }}-osx.tar.gz
asset_content_type: application/gzip
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
# upload windows archive asset
- name: Upload Windows Archive Asset
id: upload-windows-asset
@@ -253,3 +256,4 @@ jobs:
asset_path: ../deploy/windows/ALttPDoorRandomizer.zip
asset_name: ALttPDoorRandomizer-${{ steps.debug_info.outputs.github_tag }}-windows.zip
asset_content_type: application/zip
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')

6
.gitignore vendored
View File

@@ -1,6 +1,9 @@
.idea
.vscode
*_Spoiler.txt
*.bmbp
*.log
*_Spoiler.json
*.pyc
*.sfc
*.srm
@@ -18,6 +21,9 @@ EnemizerCLI/
RaceRom.py
upx/
weights/
/MultiMystery/
/Players/
/QUsb2Snes/
resources/user/*
!resources/user/.gitkeep

10
CLI.py
View File

@@ -123,6 +123,7 @@ def parse_settings():
"accessibility": "items",
"algorithm": "balanced",
# Shuffle Ganon defaults to TRUE
"openpyramid": False,
"shuffleganon": True,
"shuffle": "vanilla",
@@ -146,7 +147,9 @@ def parse_settings():
"multi": 1,
"names": "",
# Hints default to TRUE
"hints": True,
"no_hints": False,
"disablemusic": False,
"quickswap": False,
"heartcolor": "red",
@@ -156,10 +159,11 @@ def parse_settings():
"ow_palettes": "default",
"uw_palettes": "default",
# Spoiler defaults to FALSE
# Playthrough defaults to TRUE
# ROM defaults to TRUE
"create_spoiler": False,
"skip_playthrough": False,
"calc_playthrough": True,
"suppress_rom": False,
"create_rom": True,
"usestartinventory": False,
"custom": False,
@@ -309,9 +313,9 @@ def get_args_priority(settings_args, gui_args, cli_args):
else:
newArgs[key] = args[key]
newArgs[key] = update_deprecated_args(newArgs[key])
else:
newArgs[key] = args[key]
newArgs[key] = update_deprecated_args(newArgs[key])
args = newArgs

View File

@@ -9,9 +9,10 @@ import shlex
import sys
from source.classes.BabelFish import BabelFish
import source.classes.diags as diagnostics
from CLI import parse_cli, get_args_priority
from Main import main, EnemizerError
from Main import main, EnemizerError, __version__
from Rom import get_sprite_from_name
from Utils import is_bundled, close_console
from Fill import FillError
@@ -19,6 +20,13 @@ from Fill import FillError
def start():
args = parse_cli(None)
# print diagnostics
# usage: py DungeonRandomizer.py --diags
if args.diags:
diags = diagnostics.output(__version__)
print("\n".join(diags))
sys.exit(0)
if is_bundled() and len(sys.argv) == 1:
# for the bundled builds, if we have no arguments, the user
# probably wants the gui. Users of the bundled build who want the command line

View File

@@ -5,6 +5,8 @@ import sys
block_cipher = None
console = True
BINARY_SLUG = "DungeonRandomizer"
def recurse_for_py_files(names_so_far):
returnvalue = []
for name in os.listdir(os.path.join(*names_so_far)):
@@ -28,7 +30,7 @@ binaries = []
#if sys.platform.find("windows"):
# binaries.append(("ucrtbase.dll","."))
a = Analysis(['DungeonRandomizer.py'],
a = Analysis([f"./{BINARY_SLUG}.py"],
pathex=[],
binaries=binaries,
datas=[],
@@ -56,7 +58,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='DungeonRandomizer',
name=BINARY_SLUG,
debug=False,
bootloader_ignore_signals=False,
strip=False,

View File

@@ -7,6 +7,7 @@ console = True
if sys.platform.find("mac") or sys.platform.find("osx"):
console = False
BINARY_SLUG = "Gui"
def recurse_for_py_files(names_so_far):
returnvalue = []
@@ -31,7 +32,7 @@ binaries = []
#if sys.platform.find("windows"):
# binaries.append(("ucrtbase.dll","."))
a = Analysis(['DungeonRandomizer.py'],
a = Analysis([f"./{BINARY_SLUG}.py"],
pathex=[],
binaries=binaries,
datas=[],
@@ -59,7 +60,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='Gui',
name=BINARY_SLUG,
debug=False,
bootloader_ignore_signals=False,
strip=False,

View File

@@ -1,13 +1,14 @@
import queue
import os
import threading
import tkinter as tk
from Utils import local_path
def set_icon(window):
er16 = tk.PhotoImage(file=local_path('data/ER16.gif'))
er32 = tk.PhotoImage(file=local_path('data/ER32.gif'))
er48 = tk.PhotoImage(file=local_path('data/ER32.gif'))
er16 = tk.PhotoImage(file=local_path(os.path.join("data","ER16.gif")))
er32 = tk.PhotoImage(file=local_path(os.path.join("data","ER32.gif")))
er48 = tk.PhotoImage(file=local_path(os.path.join("data","ER48.gif")))
window.tk.call('wm', 'iconphoto', window._w, er16, er32, er48) # pylint: disable=protected-access
# Although tkinter is intended to be thread safe, there are many reports of issues

50
Main.py
View File

@@ -188,12 +188,12 @@ def main(args, seed=None, fish=None):
rom_names = []
jsonout = {}
enemized = False
if not args.suppress_rom:
logger.info(world.fish.translate("cli","cli","patching.rom"))
for team in range(world.teams):
for player in range(1, world.players + 1):
sprite_random_on_hit = type(args.sprite[player]) is str and args.sprite[player].lower() == 'randomonhit'
enemized = False
use_enemizer = (world.boss_shuffle[player] != 'none' or world.enemy_shuffle[player] != 'none'
or world.enemy_health[player] != 'default' or world.enemy_damage[player] != 'default'
or args.shufflepots[player] or sprite_random_on_hit)
@@ -242,13 +242,44 @@ def main(args, seed=None, fish=None):
outfilepname += f'_P{player}'
if world.players > 1 or world.teams > 1:
outfilepname += f"_{world.player_names[player][team].replace(' ', '_')}" if world.player_names[player][team] != 'Player %d' % player else ''
outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player], world.difficulty_adjustments[player],
world.mode[player], world.goal[player],
"" if world.timer in ['none', 'display'] else "-" + world.timer,
world.shuffle[player], world.doorShuffle[player], world.algorithm, mcsb_name,
"-retro" if world.retro[player] else "",
"-prog_" + world.progressive if world.progressive in ['off', 'random'] else "",
"-nohints" if not world.hints[player] else "")) if not args.outputname else ''
outfilestuffs = {
"logic": world.logic[player], # 0
"difficulty": world.difficulty[player], # 1
"difficulty_adjustments": world.difficulty_adjustments[player], # 2
"mode": world.mode[player], # 3
"goal": world.goal[player], # 4
"timer": str(world.timer), # 5
"shuffle": world.shuffle[player], # 6
"doorShuffle": world.doorShuffle[player], # 7
"algorithm": world.algorithm, # 8
"mscb": mcsb_name, # 9
"retro": world.retro[player], # A
"progressive": world.progressive, # B
"hints": str(world.hints[player]) # C
}
# 0 1 2 3 4 5 6 7 8 9 A B C
outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s_%s-%s%s%s%s%s' % (
# 0 1 2 3 4 5 6 7 8 9 A B C
# _noglitches_normal-normal-open-ganon-ohko_simple_basic-balanced-keysanity-retro-prog_swords-nohints
# _noglitches_normal-normal-open-ganon _simple_basic-balanced-keysanity-retro
# _noglitches_normal-normal-open-ganon _simple_basic-balanced-keysanity -prog_swords
# _noglitches_normal-normal-open-ganon _simple_basic-balanced-keysanity -nohints
outfilestuffs["logic"], # 0
outfilestuffs["difficulty"], # 1
outfilestuffs["difficulty_adjustments"], # 2
outfilestuffs["mode"], # 3
outfilestuffs["goal"], # 4
"" if outfilestuffs["timer"] in ['False', 'none', 'display'] else "-" + outfilestuffs["timer"], # 5
outfilestuffs["shuffle"], # 6
outfilestuffs["doorShuffle"], # 7
outfilestuffs["algorithm"], # 8
outfilestuffs["mscb"], # 9
"-retro" if outfilestuffs["retro"] == "True" else "", # A
"-prog_" + outfilestuffs["progressive"] if outfilestuffs["progressive"] in ['off', 'random'] else "", # B
"-nohints" if not outfilestuffs["hints"] == "True" else "")) if not args.outputname else '' # C
rom.write_to_file(output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc'))
if world.players > 1:
@@ -273,6 +304,8 @@ def main(args, seed=None, fish=None):
elif args.create_spoiler:
logger.info(world.fish.translate("cli","cli","patching.spoiler"))
world.spoiler.to_file(output_path('%s_Spoiler.txt' % outfilebase))
with open(output_path('%s_Spoiler.json' % outfilebase), 'w') as outfile:
outfile.write(world.spoiler.to_json())
YES = world.fish.translate("cli","cli","yes")
NO = world.fish.translate("cli","cli","no")
@@ -282,6 +315,7 @@ def main(args, seed=None, fish=None):
logger.info(world.fish.translate("cli","cli","made.rom") % (YES if (args.create_rom) else NO))
logger.info(world.fish.translate("cli","cli","made.playthrough") % (YES if (args.calc_playthrough) else NO))
logger.info(world.fish.translate("cli","cli","made.spoiler") % (YES if (not args.jsonout and args.create_spoiler) else NO))
logger.info(world.fish.translate("cli","cli","used.enemizer") % (YES if enemized else NO))
logger.info(world.fish.translate("cli","cli","seed") + ": %d", world.seed)
logger.info(world.fish.translate("cli","cli","total.time"), time.perf_counter() - start)

4
Rom.py
View File

@@ -162,7 +162,7 @@ def read_rom(stream):
def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, random_sprite_on_hit):
baserom_path = os.path.abspath(baserom_path)
basepatch_path = os.path.abspath(local_path('data/base2current.json'))
basepatch_path = os.path.abspath(local_path(os.path.join("data","base2current.json")))
enemizer_basepatch_path = os.path.join(os.path.dirname(enemizercli), "enemizerBasePatch.json")
randopatch_path = os.path.abspath(output_path('enemizer_randopatch.json'))
options_path = os.path.abspath(output_path('enemizer_options.json'))
@@ -305,7 +305,7 @@ def patch_enemizer(world, player, rom, baserom_path, enemizercli, shufflepots, r
_sprite_table = {}
def _populate_sprite_table():
if not _sprite_table:
for dir in [local_path('data/sprites/official'), local_path('data/sprites/unofficial')]:
for dir in [local_path(os.path.join("data","sprites","official")), local_path(os.path.join("data","sprites","unofficial"))]:
for file in os.listdir(dir):
filepath = os.path.join(dir, file)
if not os.path.isfile(filepath):

View File

@@ -249,34 +249,72 @@ def print_wiki_doors_by_region(d_regions, world, player):
f.write(toprint)
def update_deprecated_args(args):
argVars = vars(args)
truthy = [ 1, True, "True", "true" ]
# Don't do: Yes
# Do: No
if "suppress_rom" in argVars:
args.create_rom = args.suppress_rom not in truthy
# Don't do: No
# Do: Yes
if "create_rom" in argVars:
args.suppress_rom = not args.create_rom in truthy
if args:
argVars = vars(args)
truthy = [ 1, True, "True", "true" ]
# Hints default to TRUE
# Don't do: Yes
# Do: No
if "no_hints" in argVars:
src = "no_hints"
if isinstance(argVars["hints"],dict):
tmp = {}
for idx in range(1,len(argVars["hints"]) + 1):
tmp[idx] = not argVars[src] in truthy # tmp = !src
args.hints = tmp # dest = tmp
else:
args.hints = not args.no_hints in truthy # dest = !src
# Don't do: No
# Do: Yes
if "hints" in argVars:
src = "hints"
if isinstance(argVars["hints"],dict):
tmp = {}
for idx in range(1,len(argVars["hints"]) + 1):
tmp[idx] = not argVars[src] in truthy # tmp = !src
args.no_hints = tmp # dest = tmp
else:
args.no_hints = not args.hints in truthy # dest = !src
# Don't do: Yes
# Do: No
if "no_shuffleganon" in argVars:
args.shuffleganon = not args.no_shuffleganon in truthy
# Don't do: No
# Do: Yes
if "shuffleganon" in argVars:
args.no_shuffleganon = not args.shuffleganon in truthy
# Spoiler defaults to FALSE
# Don't do: No
# Do: Yes
if "create_spoiler" in argVars:
args.suppress_spoiler = not args.create_spoiler in truthy
# Don't do: Yes
# Do: No
if "suppress_spoiler" in argVars:
args.create_spoiler = not args.suppress_spoiler in truthy
# Don't do: Yes
# Do: No
if "skip_playthrough" in argVars:
args.calc_playthrough = not args.skip_playthrough in truthy
# Don't do: No
# Do: Yes
if "calc_playthrough" in argVars:
args.skip_playthrough = not args.calc_playthrough in truthy
# ROM defaults to TRUE
# Don't do: Yes
# Do: No
if "suppress_rom" in argVars:
args.create_rom = not args.suppress_rom in truthy
# Don't do: No
# Do: Yes
if "create_rom" in argVars:
args.suppress_rom = not args.create_rom in truthy
# Shuffle Ganon defaults to TRUE
# Don't do: Yes
# Do: No
if "no_shuffleganon" in argVars:
args.shuffleganon = not args.no_shuffleganon in truthy
# Don't do: No
# Do: Yes
if "shuffleganon" in argVars:
args.no_shuffleganon = not args.shuffleganon in truthy
# Playthrough defaults to TRUE
# Don't do: Yes
# Do: No
if "skip_playthrough" in argVars:
args.calc_playthrough = not args.skip_playthrough in truthy
# Don't do: No
# Do: Yes
if "calc_playthrough" in argVars:
args.skip_playthrough = not args.calc_playthrough in truthy
return args

View File

@@ -3,6 +3,9 @@ import os
import shutil
import sys
# Spec file
SPEC_FILE = os.path.join("DungeonRandomizer.spec")
# Destination is current dir
DEST_DIRECTORY = '.'
@@ -16,7 +19,7 @@ if os.path.isdir("build") and not sys.platform.find("mac") and not sys.platform.
shutil.rmtree("build")
# Run pyinstaller for DungeonRandomizer
subprocess.run(" ".join(["pyinstaller DungeonRandomizer.spec ",
subprocess.run(" ".join([f"pyinstaller {SPEC_FILE} ",
upx_string,
"-y ",
"--onefile ",

View File

@@ -3,6 +3,9 @@ import os
import shutil
import sys
# Spec file
SPEC_FILE = os.path.join("Gui.spec")
# Destination is current dir
DEST_DIRECTORY = '.'
@@ -16,7 +19,7 @@ if os.path.isdir("build") and not sys.platform.find("mac") and not sys.platform.
shutil.rmtree("build")
# Run pyinstaller for Gui
subprocess.run(" ".join(["pyinstaller Gui.spec ",
subprocess.run(" ".join([f"pyinstaller {SPEC_FILE} ",
upx_string,
"-y ",
"--onefile ",

Binary file not shown.

View File

@@ -1,3 +0,0 @@
aioconsole==0.1.15
colorama==0.4.3
websockets==8.1

View File

@@ -1,9 +1,18 @@
{
"lang": {},
"diags": {
"action": "store_true",
"type": "bool"
},
"create_spoiler": {
"action": "store_true",
"type": "bool"
},
"suppress_spoiler": {
"action": "store_false",
"dest": "create_spoiler",
"help": "suppress"
},
"logic": {
"choices": [
"noglitches",
@@ -195,9 +204,14 @@
]
},
"hints": {
"action": "store_true",
"action": "store_false",
"type": "bool"
},
"no_hints": {
"action": "store_true",
"dest": "hints",
"help": "suppress"
},
"heartbeep": {
"choices": [
"normal",

View File

@@ -40,6 +40,7 @@
"made.rom": "Patched ROM: %s",
"made.playthrough": "Printed Playthrough: %s",
"made.spoiler": "Printed Spoiler: %s",
"used.enemizer": "Enemized: %s",
"done": "Done. Enjoy.",
"total.time": "Total Time: %s",
"finished.run": "Finished run",

View File

@@ -154,7 +154,7 @@
"randomizer.gameoptions.sprite.unchanged": "(unchanged)",
"randomizer.generation.spoiler": "Create Spoiler Log",
"randomizer.generation.createspoiler": "Create Spoiler Log",
"randomizer.generation.createrom": "Create Patched ROM",
"randomizer.generation.calcplaythrough": "Calculate Playthrough",
"randomizer.generation.usestartinventory": "Use Starting Inventory",

View File

@@ -1,6 +1,6 @@
{
"checkboxes": {
"spoiler": { "type": "checkbox" },
"createspoiler": { "type": "checkbox" },
"createrom": { "type": "checkbox" },
"calcplaythrough": { "type": "checkbox" },
"usestartinventory": { "type": "checkbox" },

View File

@@ -23,7 +23,7 @@ def prepare_env():
# get app version
APP_VERSION = ""
APP_VERSION_FILE = "./resources/app/meta/manifests/app_version.txt"
APP_VERSION_FILE = os.path.join(".","resources","app","meta","manifests","app_version.txt")
if os.path.isfile(APP_VERSION_FILE):
with open(APP_VERSION_FILE,"r") as f:
APP_VERSION = f.readlines()[0].strip()

View File

@@ -6,7 +6,7 @@ from shutil import unpack_archive
# only do stuff if we don't have a UPX folder
if not os.path.isdir("./upx"):
if not os.path.isdir(os.path.join(".","upx")):
# get env vars
env = common.prepare_env()
# set up download url
@@ -25,7 +25,7 @@ if not os.path.isdir("./upx"):
print("Getting UPX: " + UPX_FILE)
with open("./" + UPX_FILE,"wb") as upx:
with open(os.path.join(".",UPX_FILE),"wb") as upx:
UPX_REQ = urllib.request.Request(
UPX_URL,
data=None
@@ -34,9 +34,9 @@ if not os.path.isdir("./upx"):
UPX_DATA = UPX_REQ.read()
upx.write(UPX_DATA)
unpack_archive(UPX_FILE,"./")
unpack_archive(UPX_FILE,os.path.join("."))
os.rename("./" + UPX_SLUG,"./upx")
os.remove("./" + UPX_FILE)
os.rename(os.path.join(".",UPX_SLUG),os.path.join(".","upx"))
os.remove(os.path.join(".",UPX_FILE))
print("UPX should " + ("not " if not os.path.isdir("./upx") else "") + "be available.")
print("UPX should " + ("not " if not os.path.isdir(os.path.join(".","upx")) else "") + "be available.")

View File

@@ -1,19 +1,28 @@
import subprocess # do stuff at the shell level
import os
def git_clean():
def git_clean(clean_ignored=True, clean_user=False):
excludes = [
".vscode", # vscode IDE files
".idea", # idea IDE files
"*.json", # keep JSON files for that one time I just nuked all that I was working on, oops
"*app*version.*" # keep appversion files
"*app*version.*", # keep appversion files
"EnemizerCLI" # keep EnemizerCLI files
]
if not clean_user:
excludes.append(os.path.join("resources","user*")) # keep user resources
excludes = ['--exclude={0}'.format(exclude) for exclude in excludes]
# d: directories, f: files, x: ignored files
switches = "df" + ("x" if clean_ignored else "")
# clean the git slate
subprocess.check_call([
"git", # run a git command
"clean", # clean command
"-dfx", # d: directories, f: files, x: ignored files
"-" + switches,
*excludes])
if __name__ == "__main__":

View File

@@ -0,0 +1,3 @@
from git_clean import git_clean
git_clean(clean_user=True)

View File

@@ -32,12 +32,13 @@ class SpriteSelector(object):
webbrowser.open("http://alttpr.com/sprite_preview")
def open_unofficial_sprite_dir(_evt):
if not os.path.isdir(self.unofficial_sprite_dir):
os.makedirs(self.unofficial_sprite_dir)
open_file(self.unofficial_sprite_dir)
# Open SpriteSomething directory for Link sprites
def open_spritesomething_listing(_evt):
webbrowser.open("https://artheau.github.io/SpriteSomething/?mode=zelda3/link")
# webbrowser.open("https://artheau.github.io/SpriteSomething/resources/app/snes/zelda3/link/sprites.html")
webbrowser.open("https://artheau.github.io/SpriteSomething/resources/app/snes/zelda3/link/sprites.html")
official_frametitle = Frame(self.window)
official_title_text = Label(official_frametitle, text="Official Sprites")
@@ -57,8 +58,8 @@ class SpriteSelector(object):
spritesomething_title_link.pack(side=LEFT)
spritesomething_title_link.bind("<Button-1>", open_spritesomething_listing)
self.icon_section(official_frametitle, self.official_sprite_dir+'/*', 'Official sprites not found. Click "Update official sprites" to download them.')
self.icon_section(unofficial_frametitle, self.unofficial_sprite_dir+'/*', 'Put sprites in the unofficial sprites folder (see open link above) to have them appear here.')
self.icon_section(official_frametitle, os.path.join(self.official_sprite_dir,"*"), 'Official sprites not found. Click "Update official sprites" to download them.')
self.icon_section(unofficial_frametitle, os.path.join(self.unofficial_sprite_dir,"*"), 'Put sprites in the unofficial sprites folder (see open link above) to have them appear here.')
frame = Frame(self.window)
frame.pack(side=BOTTOM, fill=X, pady=5)
@@ -150,10 +151,10 @@ class SpriteSelector(object):
try:
task.update_status("Determining needed sprites")
current_sprites = [os.path.basename(file) for file in glob(self.official_sprite_dir+'/*')]
current_sprites = [os.path.basename(file) for file in glob(os.path.join(self.official_sprite_dir,"*"))]
official_sprites = [(sprite['file'], os.path.basename(urlparse(sprite['file']).path)) for sprite in sprites_arr]
needed_sprites = [(sprite_url, filename) for (sprite_url, filename) in official_sprites if filename not in current_sprites]
bundled_sprites = [os.path.basename(file) for file in glob(self.local_official_sprite_dir+'/*')]
bundled_sprites = [os.path.basename(file) for file in glob(os.path.join(self.unofficial_sprite_dir,"*"))]
# todo: eventually use the above list to avoid downloading any sprites that we already have cached in the bundle.
official_filenames = [filename for (_, filename) in official_sprites]
@@ -230,23 +231,23 @@ class SpriteSelector(object):
@property
def official_sprite_dir(self):
if is_bundled():
return output_path("sprites/official")
# if is_bundled():
# return output_path(os.path.join("sprites","official"))
return self.local_official_sprite_dir
@property
def local_official_sprite_dir(self):
return local_path("data/sprites/official")
return local_path(os.path.join("data","sprites","official"))
@property
def unofficial_sprite_dir(self):
if is_bundled():
return output_path("sprites/unofficial")
# if is_bundled():
# return output_path(os.path.join("sprites","unofficial"))
return self.local_unofficial_sprite_dir
@property
def local_unofficial_sprite_dir(self):
return local_path("data/sprites/unofficial")
return local_path(os.path.join("data","sprites","unofficial"))
def get_image_for_sprite(sprite):

View File

@@ -101,7 +101,7 @@ SETTINGSTOPROCESS = {
"uwpalettes": "uw_palettes"
},
"generation": {
"spoiler": "create_spoiler",
"createspoiler": "create_spoiler",
"createrom": "create_rom",
"calcplaythrough": "calc_playthrough",
"usestartinventory": "usestartinventory",

47
source/classes/diags.py Normal file
View File

@@ -0,0 +1,47 @@
import platform, sys, os, subprocess
import pkg_resources
from datetime import datetime
def diagpad(str):
return str.ljust(len("ALttP Door Randomizer Version") + 5,'.')
def output(APP_VERSION):
lines = [
"ALttP Door Randomizer Diagnostics",
"=================================",
diagpad("UTC Time") + str(datetime.utcnow())[:19],
diagpad("ALttP Door Randomizer Version") + APP_VERSION,
diagpad("Python Version") + platform.python_version()
]
lines.append(diagpad("OS Version") + "%s %s" % (platform.system(), platform.release()))
if hasattr(sys, "executable"):
lines.append(diagpad("Executable") + sys.executable)
lines.append(diagpad("Build Date") + platform.python_build()[1])
lines.append(diagpad("Compiler") + platform.python_compiler())
if hasattr(sys, "api_version"):
lines.append(diagpad("Python API") + str(sys.api_version))
if hasattr(os, "sep"):
lines.append(diagpad("Filepath Separator") + os.sep)
if hasattr(os, "pathsep"):
lines.append(diagpad("Path Env Separator") + os.pathsep)
lines.append("")
lines.append("Packages")
lines.append("--------")
'''
#this breaks when run from the .exe
reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
installed_packages = [r.decode() for r in reqs.split()]
for pkg in installed_packages:
pkg = pkg.split("==")
lines.append(diagpad(pkg[0]) + pkg[1])
'''
installed_packages = [str(d) for d in pkg_resources.working_set] #this doesn't work from the .exe either, but it doesn't crash the program
installed_packages.sort()
for pkg in installed_packages:
pkg = pkg.split(' ')
lines.append(diagpad(pkg[0]) + pkg[1])
return lines
if __name__ == "__main__":
raise AssertionError(f"Called main() on utility library {__file__}")

View File

@@ -104,7 +104,7 @@ def adjust_page(top, parent, settings):
arg = options[option]
setattr(guiargs, arg, self.widgets[option].storageVar.get())
guiargs.rom = self.romVar2.get()
guiargs.baserom = top.pages["randomizer"].pages["generation"].romVar.get()
guiargs.baserom = top.pages["randomizer"].pages["generation"].widgets["rom"].storageVar.get()
guiargs.sprite = self.sprite
try:
adjust(args=guiargs)

View File

@@ -115,6 +115,7 @@ def bottom_frame(self, parent, args=None):
made = {}
for k in [ "rom", "playthrough", "spoiler" ]:
made[k] = parent.fish.translate("cli","cli","made." + k)
made["enemizer"] = parent.fish.translate("cli","cli","used.enemizer")
for k in made:
v = made[k]
pattern = "([\w]+)(:)([\s]+)(.*)"
@@ -123,6 +124,7 @@ def bottom_frame(self, parent, args=None):
successMsg += (made["rom"] % (YES if (guiargs.create_rom) else NO)) + "\n"
successMsg += (made["playthrough"] % (YES if (guiargs.calc_playthrough) else NO)) + "\n"
successMsg += (made["spoiler"] % (YES if (not guiargs.jsonout and guiargs.create_spoiler) else NO)) + "\n"
successMsg += (made["enemizer"] % (YES if needEnemizer else NO)) + "\n"
# FIXME: English
successMsg += ("Seed%s: %s" % ('s' if len(seeds) > 1 else "", ','.join(str(x) for x in seeds)))