mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 21:39:58 -04:00
Redraw the in-game menu with the game's own interface textures, and bring in the launcher's save import and faster builds.
In-game menu: the settings window, its tabs, rows, buttons and cursor, the performance overlay and the Preparing shaders box are drawn with the game's interface textures where the RomFS holds them (runtime/ui/menu_skin.cpp, perf_panel.cpp; plain shapes until they are decoded). Restart joins Continue and Quit, each behind a confirmation; VSync is an on/off switch; DLSS is listed only on NVIDIA GPUs; the menu sounds are quieter; Picture shape is gone and the setting descriptions are shorter; edge cases of input, layout and fonts are fixed. tools/menu_preview.py draws the menu without the game. Launcher: Import Saves takes a save from the game folder's saves/ folder or one the player picks; downloads fall back to Windows' own certificate check when Python's refuses a server; updates are faster; the title bar is drawn in the window and Navi is every icon. tools/make_game.py builds with CLANG64's clang where the launcher installed it, packs the RomFS beside the lift and the compile, takes a prebuilt runtime, and compiles the game's resources without cmd.exe, so a user folder with a space in its name builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,10 @@ toolchain.lock.json (make_lock, written by tools/make_launcher.py), so every pla
|
||||
release was tested with; the repository keeps old package files. A checkout without a lock resolves the newest
|
||||
packages instead.
|
||||
|
||||
Beside it goes the clang of MSYS2's CLANG64 environment (toolchain/msys64/clang64), the same LLVM release built with
|
||||
profile-guided optimisation: it compiles the lifted code about a fifth faster into the same objects, reading UCRT64's
|
||||
headers (tools/make_game.py fast_clang). Only clang.exe, the DLLs it loads and its own headers are unpacked.
|
||||
|
||||
zbic (GPL-2.0) unpacks the game's compressed program files. The release does not carry it: the launcher downloads the
|
||||
wheel for its own Python from PyPI and unpacks it into pydeps/, as `pip install zbic` would.
|
||||
"""
|
||||
@@ -28,11 +32,17 @@ from . import net
|
||||
REPO = 'https://repo.msys2.org/mingw/ucrt64/'
|
||||
MIRRORS = (REPO, 'https://mirror.msys2.org/mingw/ucrt64/')
|
||||
PREFIX = 'mingw-w64-ucrt-x86_64-'
|
||||
ROOTS = ('clang', 'gcc', 'sdl3', 'opus', 'libvpx', 'dav1d', 'zstd', 'vulkan-headers', 'vulkan-loader',
|
||||
'vulkan-memory-allocator')
|
||||
ROOTS = ('clang', 'gcc', 'lld', 'sdl3', 'opus', 'libvpx', 'dav1d', 'zstd', 'vulkan-headers', 'vulkan-loader',
|
||||
'vulkan-memory-allocator') # lld: the game links several times faster than with GNU ld
|
||||
REQUIRED = ('bin/clang.exe', 'bin/clang++.exe', 'bin/SDL3.dll', 'lib/libSDL3.dll.a', 'include/vma')
|
||||
SKIP_SHARE = ('ucrt64/share/doc/', 'ucrt64/share/man/', 'ucrt64/share/info/', 'ucrt64/share/locale/',
|
||||
'ucrt64/share/gtk-doc/', 'ucrt64/share/licenses/')
|
||||
# CLANG64's clang: exactly the packages clang.exe loads DLLs from (not the dependency closure, which adds the linker,
|
||||
# the LLVM tools and the CLANG64 C runtime the lifted code does not use).
|
||||
FAST_REPO = 'https://repo.msys2.org/mingw/clang64/'
|
||||
FAST_MIRRORS = (FAST_REPO, 'https://mirror.msys2.org/mingw/clang64/')
|
||||
FAST_PREFIX = 'mingw-w64-clang-x86_64-'
|
||||
FAST_PACKAGES = ('clang', 'clang-libs', 'llvm-libs', 'libc++', 'libffi', 'zlib', 'zstd', 'libxml2', 'libiconv')
|
||||
ZBIC = ('zbic', '1.0.1.post1')
|
||||
LOCK_FORMAT = 1
|
||||
|
||||
@@ -101,19 +111,37 @@ def resolve(db, roots=ROOTS):
|
||||
seen.add(n)
|
||||
order.append(n)
|
||||
todo += db[n].get('DEPENDS', [])
|
||||
pkgs = []
|
||||
for n in order:
|
||||
d = db[n]
|
||||
pkgs.append({'name': n, 'version': d['VERSION'][0], 'filename': d['FILENAME'][0],
|
||||
'sha256': d['SHA256SUM'][0], 'csize': int(d['CSIZE'][0]), 'isize': int(d.get('ISIZE', ['0'])[0])})
|
||||
return pkgs
|
||||
return [_pkg(db, n) for n in order]
|
||||
|
||||
|
||||
def make_lock(repo=REPO, roots=ROOTS, version='dev'):
|
||||
"""The lock a release ships: the resolved package files of the repository's current database."""
|
||||
def make_lock(repo=REPO, roots=ROOTS, version='dev', fast_repo=None):
|
||||
"""The lock a release ships: the resolved package files of the repository's current database. With fast_repo
|
||||
(FAST_REPO), also CLANG64's clang, when that repository has the same clang version as UCRT64's."""
|
||||
db = parse_db(net.get_bytes(repo + 'ucrt64.db', version=version))
|
||||
return {'format': LOCK_FORMAT, 'repo': repo, 'roots': list(roots), 'packages': resolve(db, roots),
|
||||
pkgs = resolve(db, roots)
|
||||
lock = {'format': LOCK_FORMAT, 'repo': repo, 'roots': list(roots), 'packages': pkgs,
|
||||
'zbic': {'name': ZBIC[0], 'version': ZBIC[1]}, 'made': time.strftime('%Y-%m-%d')}
|
||||
if fast_repo:
|
||||
fdb = parse_db(net.get_bytes(fast_repo + 'clang64.db', version=version))
|
||||
fast = [_pkg(fdb, FAST_PREFIX + n, env='clang64') for n in FAST_PACKAGES]
|
||||
mine = next(p['version'] for p in pkgs if p['name'] == PREFIX + 'clang')
|
||||
if fast[0]['version'] == mine:
|
||||
lock['packages'] = pkgs + fast
|
||||
lock['fast_repo'] = fast_repo
|
||||
else:
|
||||
lock['fast_skipped'] = f'CLANG64 has clang {fast[0]["version"]}, UCRT64 {mine}'
|
||||
return lock
|
||||
|
||||
|
||||
def _pkg(db, name, env=None):
|
||||
if name not in db:
|
||||
raise ToolchainError(f'the package database has no {name}')
|
||||
d = db[name]
|
||||
p = {'name': name, 'version': d['VERSION'][0], 'filename': d['FILENAME'][0], 'sha256': d['SHA256SUM'][0],
|
||||
'csize': int(d['CSIZE'][0]), 'isize': int(d.get('ISIZE', ['0'])[0])}
|
||||
if env:
|
||||
p['env'] = env
|
||||
return p
|
||||
|
||||
|
||||
def lock_digest(lock):
|
||||
@@ -150,9 +178,18 @@ def is_current(layout, lock):
|
||||
return bool(inst) and inst.get('digest') == lock_digest(lock) and not missing_files(layout.msys)
|
||||
|
||||
|
||||
def _extract_package(path, dest):
|
||||
"""Unpack one .pkg.tar.zst into dest (the msys64 folder): only its ucrt64/ files, without the documentation.
|
||||
The archive is read as a stream, member by member, so a 350 MB package never sits in memory whole."""
|
||||
def _wanted(name, env):
|
||||
"""Whether a package member is unpacked: UCRT64's files without the documentation; of CLANG64's, clang.exe, the
|
||||
DLLs and clang's own headers."""
|
||||
if env == 'clang64':
|
||||
return (name == 'clang64/bin/clang.exe' or (name.startswith('clang64/bin/') and name.endswith('.dll'))
|
||||
or name.startswith('clang64/lib/clang/'))
|
||||
return name.startswith('ucrt64/') and not name.startswith(SKIP_SHARE)
|
||||
|
||||
|
||||
def _members(path):
|
||||
"""The members of a .pkg.tar.zst (or plain tar), read as a stream, member by member, so a 350 MB package never
|
||||
sits in memory whole. Yields (tarfile, member)."""
|
||||
with open(path, 'rb') as raw:
|
||||
zst = raw.read(4) == b'\x28\xb5\x2f\xfd'
|
||||
raw.seek(0)
|
||||
@@ -167,9 +204,22 @@ def _extract_package(path, dest):
|
||||
fileobj = raw
|
||||
with tarfile.open(fileobj=fileobj, mode='r|*') as t:
|
||||
for m in t:
|
||||
name = m.name.lstrip('./')
|
||||
if name.startswith('ucrt64/') and not name.startswith(SKIP_SHARE):
|
||||
t.extract(m, dest, filter='data')
|
||||
yield t, m
|
||||
|
||||
|
||||
def _extract_package(path, dest, env=None):
|
||||
"""Unpack one package into dest (the msys64 folder): the members _wanted keeps. A wanted hard link needs its
|
||||
target on disk, and a stream cannot go back for it: a selective unpack (env) first reads the headers for the
|
||||
targets of the wanted links (CLANG64's clang.exe is one) and unpacks them too."""
|
||||
want = set()
|
||||
if env:
|
||||
for _, m in _members(path):
|
||||
if m.islnk() and _wanted(m.name.lstrip('./'), env):
|
||||
want.add(m.linkname.lstrip('./'))
|
||||
for t, m in _members(path):
|
||||
name = m.name.lstrip('./')
|
||||
if name in want or _wanted(name, env):
|
||||
t.extract(m, dest, filter='data')
|
||||
|
||||
|
||||
def install(layout, lock, progress=None, cancel=None, log=print, version='dev'):
|
||||
@@ -185,7 +235,9 @@ def install(layout, lock, progress=None, cancel=None, log=print, version='dev'):
|
||||
for p in need:
|
||||
dest = layout.pkgs / p['filename']
|
||||
last_error = None
|
||||
for mirror in [lock.get('repo', REPO)] + [m for m in MIRRORS if m != lock.get('repo', REPO)]:
|
||||
first, others = ((lock.get('fast_repo', FAST_REPO), FAST_MIRRORS) if p.get('env') == 'clang64'
|
||||
else (lock.get('repo', REPO), MIRRORS))
|
||||
for mirror in [first] + [m for m in others if m != first]:
|
||||
try:
|
||||
net.download(mirror + p['filename'], dest, sha256=p['sha256'], size=p['csize'], cancel=cancel,
|
||||
progress=(lambda d, t, base=done_before: progress and progress('download', base + d, total)),
|
||||
@@ -210,7 +262,7 @@ def install(layout, lock, progress=None, cancel=None, log=print, version='dev'):
|
||||
raise net.Cancelled()
|
||||
if progress:
|
||||
progress('unpack', i, len(pkgs))
|
||||
_extract_package(layout.pkgs / p['filename'], staging)
|
||||
_extract_package(layout.pkgs / p['filename'], staging, p.get('env'))
|
||||
if progress:
|
||||
progress('unpack', len(pkgs), len(pkgs))
|
||||
missing = missing_files(staging / 'ucrt64')
|
||||
|
||||
Reference in New Issue
Block a user