mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-21 14:29:58 -04:00
Carry the button art in releases and draw the button prompts during the game build.
make_launcher.py and make_kit.py take --prompt-art (folders holding XGamepad, P5Gamepad and Keyboard_Mouse, or those folders) and copy only the pictures pad_prompts.py reads into the release's prompt-art folder; tools/prompt_art.py holds the art tables and that list, with no imaging packages. make_game.py's new last step, prompts, runs pad_prompts.py on that art into the game folder's romfs-patches-* folders. Its key names everything it reads (the RomFS, the art, the tools, the bind_ lines of nx2navi.ini, the folders being there), so it runs again only when one of those changed, and it makes no other step run. A kit without art skips it. The launcher's Python gets fonttools and pillow, and its jobs show a Draw the Button Prompts row when the version has art. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,13 +24,20 @@ STEPS = {
|
||||
'change are kept from the last build.'),
|
||||
'shaders': ('Prepare the Shaders', "Building the game's known shaders for your graphics card ahead of time, so "
|
||||
'play stops for them far less often.'),
|
||||
'prompts': ('Draw the Button Prompts', 'Drawing the Xbox, PlayStation and keyboard and mouse button prompts the '
|
||||
"game's Controls menu offers under Button prompts."),
|
||||
'ready': ('Ready to Play', 'The game is built.'),
|
||||
'download': ('Download {ver}', 'Downloading the new version of NX2navi.'),
|
||||
'verify': ('Verify the Download', 'Checking the download against its checksum.'),
|
||||
'swap': ('Swap In the New Build', 'Linking the new build. It replaces the old one only once it is complete.'),
|
||||
}
|
||||
WEIGHTS = {'tools': 12, 'tools_update': 4, 'check': 1, 'exefs': 2, 'romfs': 14, 'lift': 14, 'compile': 55,
|
||||
'compile_changed': 55, 'shaders': 18, 'ready': 0, 'download': 8, 'verify': 1, 'swap': 6}
|
||||
'compile_changed': 55, 'shaders': 18, 'prompts': 4, 'ready': 0, 'download': 8, 'verify': 1, 'swap': 6}
|
||||
|
||||
|
||||
def prompt_rows(ctx):
|
||||
"""The prompts row, for a version with button art (make_game.py draws the prompts after the shaders), or none."""
|
||||
return ['prompts'] if build.has_prompt_art(ctx.layout) else []
|
||||
|
||||
|
||||
def mmss(seconds):
|
||||
@@ -285,15 +292,17 @@ class InstallJob(Job):
|
||||
title = 'Installing'
|
||||
|
||||
def __init__(self, ctx, dump, game_dir):
|
||||
super().__init__(ctx, ['tools', 'check', 'exefs', 'romfs', 'lift', 'compile', 'shaders', 'ready'])
|
||||
super().__init__(ctx, ['tools', 'check', 'exefs', 'romfs', 'lift', 'compile', 'shaders', *prompt_rows(ctx),
|
||||
'ready'])
|
||||
self.dump, self.game_dir = str(dump), str(game_dir)
|
||||
|
||||
def run(self):
|
||||
self.ensure_tools('tools')
|
||||
self.make_game(build.install_args(self.ctx.layout, self.dump, self.game_dir),
|
||||
{s: s for s in ('check', 'exefs', 'romfs', 'lift', 'compile', 'shaders')})
|
||||
if self.step('shaders').state == PENDING:
|
||||
self.skip('shaders')
|
||||
{s: s for s in ('check', 'exefs', 'romfs', 'lift', 'compile', 'shaders', 'prompts')})
|
||||
for sid in ('shaders', 'prompts'):
|
||||
if self.step(sid) and self.step(sid).state == PENDING:
|
||||
self.skip(sid)
|
||||
self.finish('ready', 'Ready')
|
||||
try:
|
||||
gamefiles.extract_fonts(self.ctx.layout, self.game_dir)
|
||||
@@ -306,7 +315,7 @@ class RebuildJob(Job):
|
||||
title = 'Rebuilding'
|
||||
|
||||
def __init__(self, ctx, game_dir, dump=''):
|
||||
super().__init__(ctx, ['tools_update', 'lift', 'compile_changed', 'swap', 'shaders'])
|
||||
super().__init__(ctx, ['tools_update', 'lift', 'compile_changed', 'swap', 'shaders', *prompt_rows(ctx)])
|
||||
self.game_dir, self.dump = str(game_dir), dump
|
||||
|
||||
def run(self):
|
||||
@@ -320,9 +329,10 @@ class RebuildJob(Job):
|
||||
args = build.install_args(layout, self.dump, self.game_dir)
|
||||
else:
|
||||
raise build.BuildError('the game folder has no earlier build: install the game again')
|
||||
self.make_game(args, {'lift': 'lift', 'compile': 'compile_changed', 'shaders': 'shaders'}, link_step='swap')
|
||||
for sid in ('lift', 'compile_changed', 'swap', 'shaders'):
|
||||
if self.step(sid).state == PENDING:
|
||||
self.make_game(args, {'lift': 'lift', 'compile': 'compile_changed', 'shaders': 'shaders', 'prompts': 'prompts'},
|
||||
link_step='swap')
|
||||
for sid in ('lift', 'compile_changed', 'swap', 'shaders', 'prompts'):
|
||||
if self.step(sid) and self.step(sid).state == PENDING:
|
||||
self.skip(sid)
|
||||
|
||||
|
||||
@@ -362,8 +372,8 @@ class ContinueUpdateJob(RebuildJob):
|
||||
kind = 'update'
|
||||
|
||||
def __init__(self, ctx, game_dir, old, dump=''):
|
||||
Job.__init__(self, ctx, ['download', 'verify', 'tools_update', 'lift', 'compile_changed', 'swap', 'shaders'],
|
||||
ctx.layout.version)
|
||||
Job.__init__(self, ctx, ['download', 'verify', 'tools_update', 'lift', 'compile_changed', 'swap', 'shaders',
|
||||
*prompt_rows(ctx)], ctx.layout.version)
|
||||
self.game_dir, self.dump, self.old = str(game_dir), dump, old
|
||||
self.title = f'Updating to {versions.display(ctx.layout.version)}'
|
||||
for sid, value in (('download', 'Done'), ('verify', 'Checksum OK')):
|
||||
@@ -374,7 +384,7 @@ class ContinueUpdateJob(RebuildJob):
|
||||
RebuildJob.run(self)
|
||||
else:
|
||||
self.ensure_tools('tools_update')
|
||||
for sid in ('lift', 'compile_changed', 'swap', 'shaders'):
|
||||
for sid in ('lift', 'compile_changed', 'swap', 'shaders', 'prompts'):
|
||||
self.skip(sid, 'No game yet')
|
||||
updater.prune(self.ctx.layout)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user