mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 23:19:57 -04:00
Let Rebuild the Game compile the game's code for this processor's level, and updates keep the compiled level.
make_game.py --rebuild keeps the level the objects were compiled for (lifted_level), so an update compiles only what changed; --retune compiles for this processor's level. RebuildJob passes it, ContinueUpdateJob does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,8 +36,10 @@ def install_args(layout, dump, game_dir):
|
|||||||
return [*src, '--out', str(game_dir), '--msys', str(layout.msys)]
|
return [*src, '--out', str(game_dir), '--msys', str(layout.msys)]
|
||||||
|
|
||||||
|
|
||||||
def rebuild_args(layout, game_dir):
|
def rebuild_args(layout, game_dir, retune=False):
|
||||||
return ['--rebuild', '--out', str(game_dir), '--msys', str(layout.msys)]
|
"""retune: Rebuild the Game, which compiles the game's code for this processor's level; an update keeps the level
|
||||||
|
its objects were compiled for, so that it compiles only what changed (tools/make_game.py lifted_level)."""
|
||||||
|
return ['--rebuild', *(['--retune'] if retune else []), '--out', str(game_dir), '--msys', str(layout.msys)]
|
||||||
|
|
||||||
|
|
||||||
def check_args(dump):
|
def check_args(dump):
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ class InstallJob(Job):
|
|||||||
class RebuildJob(Job):
|
class RebuildJob(Job):
|
||||||
kind = 'rebuild'
|
kind = 'rebuild'
|
||||||
title = 'Rebuilding'
|
title = 'Rebuilding'
|
||||||
|
retune = True # Rebuild the Game: the game's code for this processor's level (build.rebuild_args)
|
||||||
|
|
||||||
def __init__(self, ctx, game_dir, dump=''):
|
def __init__(self, ctx, game_dir, dump=''):
|
||||||
super().__init__(ctx, ['tools_update', 'lift', 'compile_changed', 'swap', 'shaders', *prompt_rows(ctx)])
|
super().__init__(ctx, ['tools_update', 'lift', 'compile_changed', 'swap', 'shaders', *prompt_rows(ctx)])
|
||||||
@@ -327,7 +328,7 @@ class RebuildJob(Job):
|
|||||||
if build.game_running(self.game_dir):
|
if build.game_running(self.game_dir):
|
||||||
raise build.BuildError('the game is running: close it and try again')
|
raise build.BuildError('the game is running: close it and try again')
|
||||||
if build.can_rebuild(self.game_dir):
|
if build.can_rebuild(self.game_dir):
|
||||||
args = build.rebuild_args(layout, self.game_dir)
|
args = build.rebuild_args(layout, self.game_dir, self.retune)
|
||||||
elif self.dump:
|
elif self.dump:
|
||||||
args = build.install_args(layout, self.dump, self.game_dir)
|
args = build.install_args(layout, self.dump, self.game_dir)
|
||||||
else:
|
else:
|
||||||
@@ -372,6 +373,7 @@ class UpdateDownloadJob(Job):
|
|||||||
|
|
||||||
class ContinueUpdateJob(RebuildJob):
|
class ContinueUpdateJob(RebuildJob):
|
||||||
"""After the restart, in the new version: bring the tools to its lock and rebuild the game."""
|
"""After the restart, in the new version: bring the tools to its lock and rebuild the game."""
|
||||||
|
retune = False # an update keeps the compiled game's level, so it compiles only what changed
|
||||||
kind = 'update'
|
kind = 'update'
|
||||||
|
|
||||||
def __init__(self, ctx, game_dir, old, dump=''):
|
def __init__(self, ctx, game_dir, old, dump=''):
|
||||||
|
|||||||
@@ -301,6 +301,17 @@ class GameIniTest(Tmp):
|
|||||||
self.assertTrue((self.tmp / 'nx2navi.ini').is_dir())
|
self.assertTrue((self.tmp / 'nx2navi.ini').is_dir())
|
||||||
|
|
||||||
|
|
||||||
|
class RebuildArgsTest(Tmp):
|
||||||
|
"""Rebuild the Game compiles the game's code for this processor's level (--retune); an update keeps the level its
|
||||||
|
objects were compiled for, so that it compiles only what changed (tools/make_game.py lifted_level)."""
|
||||||
|
|
||||||
|
def test_retune_only_for_rebuild_the_game(self):
|
||||||
|
self.assertIn('--retune', build.rebuild_args(self.layout, 'G:/game', True))
|
||||||
|
self.assertNotIn('--retune', build.rebuild_args(self.layout, 'G:/game'))
|
||||||
|
self.assertTrue(jobs.RebuildJob.retune)
|
||||||
|
self.assertFalse(jobs.ContinueUpdateJob.retune)
|
||||||
|
|
||||||
|
|
||||||
class SettingsTest(Tmp):
|
class SettingsTest(Tmp):
|
||||||
def test_roundtrip_and_reset(self):
|
def test_roundtrip_and_reset(self):
|
||||||
s = settings.Settings(self.layout.settings)
|
s = settings.Settings(self.layout.settings)
|
||||||
|
|||||||
Reference in New Issue
Block a user