mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-21 14:29:58 -04:00
Show what the check of the game files found.
The check printed its counts into the build's lines only, so a player whose build ended with "4 damaged, 3 given a stand-in, 1 left as they are" saw nothing of it. A job now reads romfs-check.json after the build: the count goes into the step's row, and when the check ran in that job, a sentence goes onto the home screen and into launcher.log. The same four files are flagged on every copy of the game, and three of them get a stand-in. For those the sentence says so and that nothing needs doing; other files are counted and romfs-check.json is named. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,36 @@ WEIGHTS = {'tools': 12, 'tools_update': 4, 'check': 1, 'exefs': 2, 'romfs': 14,
|
||||
'compile_changed': 55, 'shaders': 18, 'prompts': 4, 'scan': 5, 'ready': 0, 'download': 8, 'verify': 1, 'swap': 6}
|
||||
|
||||
|
||||
# The game files tools/romfs_check.py reports as damaged on every copy of the game looked at so far: they are that
|
||||
# way in the game's own data, not through a player's dump, so a new dump does not change them. The three textures
|
||||
# get a stand-in; the game does without the fourth file.
|
||||
SCAN_EXPECTED = frozenset((
|
||||
'Tex/CmnTex_Map_Soil_FairyFountain_Floor_D_Nrm.bntx.zs',
|
||||
'Tex/RBake_Scene_GanonStage_G_2_1_d0_t0.bntx.zs',
|
||||
'Tex/Rock_WaterTemple_Gate_M_01_Nrm.bntx.zs',
|
||||
'gsys/EnvObjSetMgrParam/Artwork.gsys__EnvObjSetMgrParam.bgyml',
|
||||
))
|
||||
|
||||
|
||||
def scan_summary(damaged, stood_in):
|
||||
"""(the scan row's value, a sentence for the home screen) for what the check of the game files found
|
||||
(build.scan_report); ('', '') when nothing is damaged. The files of SCAN_EXPECTED are told as what they are, the
|
||||
same ones as on every copy: the player learns what the check did and that nothing needs doing. Other files are
|
||||
counted and pointed to, without advice the check cannot back."""
|
||||
n = len(damaged)
|
||||
if not n:
|
||||
return '', ''
|
||||
files = '1 game file' if n == 1 else f'{n} game files'
|
||||
stand = ('none got a stand-in' if not stood_in else '1 texture got a stand-in' if stood_in == 1 else
|
||||
f'{stood_in} textures got a stand-in')
|
||||
value = f'{n} Flagged, {stood_in} Stand-In' + ('' if stood_in == 1 else 's')
|
||||
if set(damaged) <= SCAN_EXPECTED:
|
||||
return value, (f'The file check flagged {files}, the same as in every copy of the game: {stand}, and nothing '
|
||||
'needs doing.')
|
||||
return value, (f'The file check flagged {files} as damaged: {stand}, so what uses them still loads. '
|
||||
'romfs-check.json in the game folder lists them.')
|
||||
|
||||
|
||||
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 []
|
||||
@@ -75,6 +105,7 @@ class Job:
|
||||
self.started = time.time()
|
||||
self.finished = None
|
||||
self.after = None # what the window does next ('restart', ...)
|
||||
self.note = '' # a sentence for the home screen after the job (note_scan)
|
||||
self._lock = threading.Lock()
|
||||
|
||||
# ---- state the window reads
|
||||
@@ -212,6 +243,26 @@ class Job:
|
||||
raise NotImplementedError
|
||||
|
||||
# ---- shared pieces
|
||||
def note_scan(self, game_dir):
|
||||
"""After a build: what the check of the game files found goes into its row, and when the check ran in this
|
||||
job, into the note the home screen shows and into the log. The check itself only printed its counts into
|
||||
the build's lines, which scroll away, so a player never learned that files were flagged or that stand-ins
|
||||
are in use. A check kept from an earlier build shows its count in the row only."""
|
||||
s = self.step('scan')
|
||||
found = build.scan_report(game_dir)
|
||||
if not s or s.state not in (DONE, SKIPPED) or not found:
|
||||
return
|
||||
value, note = scan_summary(*found)
|
||||
if not value:
|
||||
return
|
||||
if s.state == DONE:
|
||||
s.value = value
|
||||
self.note = note
|
||||
self.ctx.log(f'file check: {note}')
|
||||
elif s.value == 'Unchanged':
|
||||
s.value = f'Unchanged · {value}'
|
||||
self._touch()
|
||||
|
||||
def ensure_tools(self, sid):
|
||||
layout = self.ctx.layout
|
||||
self.begin(sid)
|
||||
@@ -317,6 +368,7 @@ class InstallJob(Job):
|
||||
for sid in ('shaders', 'prompts', 'scan'):
|
||||
if self.step(sid) and self.step(sid).state == PENDING:
|
||||
self.skip(sid)
|
||||
self.note_scan(self.game_dir)
|
||||
self.finish('ready', 'Ready')
|
||||
try:
|
||||
gamefiles.extract_fonts(self.ctx.layout, self.game_dir)
|
||||
@@ -349,6 +401,7 @@ class RebuildJob(Job):
|
||||
for sid in ('lift', 'compile_changed', 'swap', 'shaders', 'prompts', 'scan'):
|
||||
if self.step(sid) and self.step(sid).state == PENDING:
|
||||
self.skip(sid)
|
||||
self.note_scan(self.game_dir)
|
||||
|
||||
|
||||
class UpdateDownloadJob(Job):
|
||||
|
||||
Reference in New Issue
Block a user