diff --git a/installer/layout.py b/installer/layout.py index 3ff47139..662e2886 100644 --- a/installer/layout.py +++ b/installer/layout.py @@ -73,6 +73,7 @@ class Layout: """Paths the steps need that do not exist.""" need = [self.python, self.tools / 'extract.py', self.tools / 'build_game.py', self.tools / 'prepare_shaders.py', self.tools / 'pack_shader_cache.py', self.tools / 'make_romfs_patches.py', self.tools / 'ultrawide_layout.py', + self.tools / 'button_icons.py', self.recomp / 'gen.py', self.clang, self.deps / 'include', self.deps / 'lib', self.runtime, self.runtime_lib, self.ninja, self.hactool, diff --git a/installer/steps.py b/installer/steps.py index 6cab2d4e..5fc49de6 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -6,8 +6,8 @@ tools/prepare_shaders.py, whose output goes to /logs/-.log and here: the host check is a small C program built with the bundled clang (hostcheck.c). Install folder: exefs/, romfs/ (romfs.bin, index.json), profile/, totk.exe and its DLLs, romfs-index.bin, -romfs-patches/, romfs-patches-xbox/, totk_xlate.exe, the shader state of totk.exe --prepare-shaders, totk.ini, -totk-install.json. +romfs-patches/, romfs-patches-xbox/, romfs-patches-xbox-label/, totk_xlate.exe, the shader state of totk.exe +--prepare-shaders, totk.ini, totk-install.json. Temp folder (/-): check/ (ExeFS of both inputs, the host check), gen/ (C), build/ (objects), logs/ (kept by the cleanup). """ @@ -593,7 +593,7 @@ class Prepare(Step): layout = ctx.layout xlate_id = layout.xlate.with_suffix('.id') tools = [layout.tools / n for n in ('prepare_shaders.py', 'shader_census.py', 'make_romfs_patches.py', - 'pack_shader_cache.py', 'ultrawide_layout.py')] + 'pack_shader_cache.py', 'ultrawide_layout.py', 'button_icons.py')] return fingerprint('prepare-1', ctx.keys['compile'], layout.xlate, xlate_id, shader_list_text(layout), *tools) def current(self, ctx, record): @@ -635,16 +635,23 @@ class Prepare(Step): dest / f'romfs-patches-{size}', '--aspect', size]) if code: raise InstallError('prepare.romfs_patches_failed', code=code, log=str(log)) - # romfs-patches-xbox: the same with the A/B and X/Y prompts swapped, for pad_layout = xbox_prompts (written on - # every install, so the menu choice works without another run of the setup). Optional: when it fails, the game - # keeps the Switch prompts and the menu says the files are missing, so the setup warns and goes on. - remove(dest / 'romfs-patches-xbox') - code, log = run_tool(ctx, 'prepare-xbox', layout.tools / 'make_romfs_patches.py', - ['--version', version_tag(game_version(ctx)), '--romfs', dest / 'romfs', '--out', - dest / 'romfs-patches-xbox', '--xbox-prompts']) - if code: - remove(dest / 'romfs-patches-xbox') - rep.warning('warn.xbox_prompts_failed', code=code, log=str(log)) + # The same with Xbox button icons in the prompts, for prompts = xbox (make_romfs_patches.py --prompts): + # romfs-patches-xbox for the Nintendo pad layout, romfs-patches-xbox-label for xbox and auto (runtime/input_map.c + # input_prompts_folder). Both are written on every install, so the menu choices work without another run of + # the setup. Optional: when one fails, the game keeps the Switch prompts with that layout and the menu says the + # files are missing, so the setup warns once and goes on. + failed = None + for style in ('xbox', 'xbox-label'): + out = dest / f'romfs-patches-{style}' + remove(out) + code, log = run_tool(ctx, f'prepare-{style}', layout.tools / 'make_romfs_patches.py', + ['--version', version_tag(game_version(ctx)), '--romfs', dest / 'romfs', '--out', out, + '--prompts', style]) + if code: + remove(out) + failed = failed or (code, log) + if failed: + rep.warning('warn.xbox_prompts_failed', code=failed[0], log=str(failed[1])) shader_list = layout.shader_list if not shader_list: diff --git a/tools/build_game.py b/tools/build_game.py index fd825ed1..5c348d7e 100644 --- a/tools/build_game.py +++ b/tools/build_game.py @@ -174,9 +174,10 @@ def write_if_changed(path, text): def copy_romfs_patches(version, out): """totk.exe loads romfs-patches beside romfs-index.bin (runtime/romfs.c overlay_init). tools/make_romfs_patches.py writes them into build/ only, so a build in another directory ran without the 60 fps overlay (the quick - menus' captured background turned black). Copies them when their manifest differs; romfs-patches-xbox (the same with - the A/B and X/Y prompts swapped, pad_layout = xbox_prompts) the same way when it was made.""" - for name in ('romfs-patches', 'romfs-patches-xbox'): + menus' captured background turned black). Copies them when their manifest differs; romfs-patches-xbox and + romfs-patches-xbox-label (the same with Xbox button prompts, make_romfs_patches.py --prompts) the same way when they + were made.""" + for name in ('romfs-patches', 'romfs-patches-xbox', 'romfs-patches-xbox-label'): src = ROOT / 'build' / version / name dst = out / name if src.resolve() == dst.resolve() or not (src / 'manifest.tsv').is_file(): diff --git a/tools/make_release.py b/tools/make_release.py index 067c2b34..e62388c2 100644 --- a/tools/make_release.py +++ b/tools/make_release.py @@ -97,9 +97,9 @@ LLVM_SKIP_DIRS = {'aarch64-w64-mingw32', 'armv7-w64-mingw32', 'i686-w64-mingw32' LLVM_SKIP_SUFFIXES = {'.idl', '.tlb'} # tools/ files the installer steps run (and what they import), copied from the repo. -TOOLS_FILES = ['build_game.py', 'build_shaders.py', 'check_content.py', 'extract.py', 'hostmem.py', 'make_romfs_patches.py', - 'pack_shader_cache.py', 'prepare_shaders.py', 'romfs_index.py', 'shader_census.py', 'shader_list.py', - 'ultrawide_layout.py'] +TOOLS_FILES = ['build_game.py', 'build_shaders.py', 'button_icons.py', 'check_content.py', 'extract.py', 'hostmem.py', + 'make_romfs_patches.py', 'pack_shader_cache.py', 'prepare_shaders.py', 'romfs_index.py', 'shader_census.py', + 'shader_list.py', 'ultrawide_layout.py'] TOOLS_DIRS = ['vendor/macnativegames', 'data'] # data/: expected hashes RUNTIME_SUFFIXES = {'.h', '.inc', '.ico'} # .ico: the installer window icon @@ -236,7 +236,7 @@ def build_python(out): copy_tree(tk / 'Lib' / 'tkinter', py / 'tkinter', lambda r: r.startswith('__pycache__')) copy_tree(tk / 'tcl', py / 'tcl', lambda r: r.endswith(('.lib', '.sh')) or r.startswith('nmake')) check = subprocess.run([str(py / 'python.exe'), '-I', '-c', - 'import tkinter, numpy, lz4.block, cryptography, cffi, pycparser; ' + 'import tkinter, numpy, lz4.block, cryptography, cffi, pycparser, fontTools.ttLib; ' 'print("python ok: Tcl", tkinter.Tcl().eval("info patchlevel"), "numpy", numpy.__version__)'], env=clean_env(py), capture_output=True, text=True) if check.returncode: diff --git a/tools/package_build.py b/tools/package_build.py index c2071ba0..e83aa514 100644 --- a/tools/package_build.py +++ b/tools/package_build.py @@ -91,8 +91,9 @@ def main(): else: print(f'package_build: {f} not in {build}, skipped') n = copy_tree(build / 'romfs-patches', out / 'romfs-patches') - if (build / 'romfs-patches-xbox').is_dir(): # pad_layout = xbox_prompts (make_romfs_patches.py --xbox-prompts) - n += copy_tree(build / 'romfs-patches-xbox', out / 'romfs-patches-xbox') + for name in ('romfs-patches-xbox', 'romfs-patches-xbox-label'): # prompts = xbox (make_romfs_patches.py --prompts) + if (build / name).is_dir(): + n += copy_tree(build / name, out / name) n += copy_tree(exefs, out / 'exefs') n += copy_tree(fonts, out / 'shared-fonts') if not a.no_shader_cache and (build / 'shader-cache').is_dir():