mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
NX2navi-Setup.exe installs the launcher into %LOCALAPPDATA%\Programs\NX2navi without administrator rights, with shortcuts and an Apps entry. The launcher finds the player's .nup, downloads the build tools itself (the MSYS2 UCRT64 packages toolchain.lock.json pins, checked by sha256 and unpacked without pacman, and zbic from PyPI) and runs tools/make_game.py, whose steps it shows with their progress. Its window follows the game's options menu: colours sampled from it, the menu's filigree, the white glowing cursor, the Triforce in the title band and as the programs' icon, and all text in the game's Cetra Display, decoded from the player's own dump. Mouse, keyboard and an XInput pad drive it. Updates come from GitHub releases (NX2navi-update.json): the new version is downloaded, checked and staged beside the running one, the stub restarts into it and falls back to the previous version when it fails to start, and the game is rebuilt without the dump. make_game.py now keys its exefs and romfs steps on the game files alone, has --rebuild and --events, compiles only the files whose source, headers, flags or compiler changed, and replaces ocarina.exe only once the new one links. tools/make_launcher.py builds the release on Windows or Linux. Tested: tests/launcher_test.py (19 tests), the real toolchain download and install, and under Wine 11 the setup, the stub, the window on the bundled Windows Python, an update from a local feed by clicking Updates, the rollback of a version that fails to start, and the downloaded clang compiling and linking a program against the game's libraries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Merged onto the current port: make_game.py keeps the launcher's step keys, cached link and in-place swap, and its own runtime manifest (windres), AMD's FidelityFX library and the shader preparation, which becomes a step of its own ("shaders") that the launcher shows in its install, rebuild and update jobs. make_launcher.py ships the shader tools and, with --ffx, AMD's library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
2.0 KiB
Python
44 lines
2.0 KiB
Python
"""data/launcher.json: the player's choices and what the launcher remembers between runs."""
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
DEFAULTS = {
|
|
'game_dir': '', # the built game; empty until the first install picks one
|
|
'dump': '', # the .nup (or the folder with exefs/ and romfs/) the game was built from
|
|
'auto_check': True, # look for a new version when the launcher opens
|
|
'channel': 'stable', # 'stable' or 'preview' (GitHub pre-releases)
|
|
'hide_while_playing': True, # hide the window while the game runs, show it again when it exits
|
|
'keep_cache': True, # keep build-cache/ (the lift and objects) so an update recompiles only changes
|
|
'desktop_shortcut': True,
|
|
'feed_repo': '', # owner/name overriding feed.json, for testing a fork's releases
|
|
'github_token': '', # only for a private release repository; stored as plain text
|
|
'last_check': 0.0,
|
|
'last_seen': '', # the newest version the player was told about
|
|
}
|
|
|
|
|
|
class Settings(dict):
|
|
def __init__(self, path):
|
|
super().__init__(DEFAULTS)
|
|
self.path = Path(path)
|
|
try:
|
|
data = json.loads(self.path.read_text(encoding='utf-8'))
|
|
if isinstance(data, dict):
|
|
self.update({k: v for k, v in data.items() if k in DEFAULTS and type(v) is type(DEFAULTS[k])})
|
|
except (OSError, ValueError):
|
|
pass
|
|
|
|
def save(self):
|
|
self.path.parent.mkdir(parents=True, exist_ok=True)
|
|
tmp = self.path.with_name(self.path.name + '.tmp')
|
|
tmp.write_text(json.dumps(dict(self), indent=1), encoding='utf-8')
|
|
os.replace(tmp, self.path)
|
|
|
|
def reset(self):
|
|
"""Default Settings: the choices go back to their defaults; the game folder, dump and history stay."""
|
|
keep = {k: self[k] for k in ('game_dir', 'dump', 'last_check', 'last_seen', 'feed_repo', 'github_token')}
|
|
self.clear()
|
|
self.update(DEFAULTS)
|
|
self.update(keep)
|