Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Leave the engine to upstream: the launch settings and the split's progress go to seedds

v0lumehi2439f573a896
diff --git a/dm/games/README.md b/dm/games/README.md
index 417655e8..06d20c31 100644
--- a/dm/games/README.md
+++ b/dm/games/README.md
@@ -30,7 +30,7 @@ None of them has a default game: without one they stop and list the profiles. To
- `python3 dm/games/game.py list` lists the profiles.
- `python3 dm/games/game.py <id> <key>` prints one key.
-**Launcher settings.** `settings.tsv` lists the player-facing settings once (the environment variable each sets, its kind, default, the condition under which a game offers it and its section on the single settings screen, **Game**, **Controls** or **Performance**; Reset to tested defaults forgets all launcher choices so the profile's defaults apply again; its header describes the columns). A profile key a setting defaults to (`DM_GAME_<NAME>`) is the value the game was tested with, which the player page [docs/settings.md](../../docs/settings.md#tested-defaults) explains. `build_ipa.sh` runs `settings.py <id> <rewritten modules> <control.nacp> <out.json>`, which keeps the rows that hold for the game: a profile macro (`DM_GAME_FPS_TARGET!=0`), a key in `main`'s rewriter table (`RENDER_SCALE`, written by `patch_nso.py` for the builds with a render-scale stub), the game's languages. It writes them into the app as `dm/launcher.json`, from which the iOS launcher (`dm/ios/Sources/Launcher.swift`) draws its screen; the NSP script packs the Mac app's copy (`SETTINGS_PLATFORM=mac`, without the rows marked `platform:ios`) for the Mac front end's launch options ([frontend/README.md](../../frontend/README.md#launch-options)). A new player setting is one row; diagnostic switches stay environment-only.
+**Launcher settings.** `settings.tsv` lists the player-facing settings once (the environment variable each sets, its kind, default, the condition under which a game offers it and its section on the single settings screen, **Game**, **Controls** or **Performance**; Reset to tested defaults forgets all launcher choices so the profile's defaults apply again; its header describes the columns). A profile key a setting defaults to (`DM_GAME_<NAME>`) is the value the game was tested with, which the player page [docs/settings.md](../../docs/settings.md#tested-defaults) explains. `build_ipa.sh` runs `settings.py <id> <rewritten modules> <control.nacp> <out.json>`, which keeps the rows that hold for the game: a profile macro (`DM_GAME_FPS_TARGET!=0`), a key in `main`'s rewriter table (`RENDER_SCALE`, written by `patch_nso.py` for the builds with a render-scale stub), the game's languages. It writes them into the app as `dm/launcher.json`, from which the iOS launcher (`dm/ios/Sources/Launcher.swift`) draws its screen. A new player setting is one row; diagnostic switches stay environment-only.
## Games
diff --git a/dm/games/settings.py b/dm/games/settings.py
index f576c288..e8382c98 100644
--- a/dm/games/settings.py
+++ b/dm/games/settings.py
@@ -1,8 +1,7 @@
#!/usr/bin/env python3
# The iOS launcher's settings for one game, from settings.tsv (its header describes the columns): the rows whose condition holds for the game, with the game's defaults, as JSON.
# build_ipa.sh writes it into the app as dm/launcher.json; Launcher.swift draws the screen from it (an app without the file starts the game at once).
-# Usage: settings.py <game id> <rewritten modules dir> <control.nacp> <out.json> (DM_GAMES_DIR finds provisional profiles, as in game.py; build:<VAR> defaults come from the environment;
-# GFXAPI is the packer's graphics API, SETTINGS_PLATFORM the app's platform: ios (default) or mac, whose launcher is the Mac front end)
+# Usage: settings.py <game id> <rewritten modules dir> <control.nacp> <out.json> (DM_GAMES_DIR finds provisional profiles, as in game.py; build:<VAR> defaults come from the environment)
import json, os, re, sys
from pathlib import Path
@@ -42,7 +41,6 @@ def build(gid, patched, control):
if cond == 'languages>1': return len(langs) > 1
if cond.startswith('fixups:'): return cond[7:] in keys
if cond.startswith('gfxapi:'): return os.environ.get('GFXAPI', '') == cond[7:]
- if cond.startswith('platform:'): return (os.environ.get('SETTINGS_PLATFORM') or 'ios') == cond[9:]
m = re.fullmatch(r'(DM_GAME_\w+)(!=|==)(.*)', cond)
if m: return (macro(m[1], n) == m[3]) == (m[2] == '==')
sys.exit(f'settings.tsv:{n}: unknown condition {cond}')
diff --git a/dm/games/settings.tsv b/dm/games/settings.tsv
index 823802d7..6e522533 100644
--- a/dm/games/settings.tsv
+++ b/dm/games/settings.tsv
@@ -1,13 +1,12 @@
-# Player-facing settings: the iOS launcher (dm/ios/Sources/Launcher.swift) shows them before the game starts, the Mac front end (frontend/) before it starts a Mac app.
-# dm/games/settings.py writes one game's list into its app (dm/launcher.json; build_ipa.sh, and dm/mac/pack_app.py through the NSP script): the rows whose condition holds for that game, with its defaults. Each sets an environment variable the host reads when the game starts; one an env file sets
+# Player-facing settings: the iOS launcher (dm/ios/Sources/Launcher.swift) shows them before the game starts. dm/games/settings.py writes one game's list into its app (dm/launcher.json,
+# build_ipa.sh): the rows whose condition holds for that game, with its defaults. Each sets an environment variable the host reads when the game starts; one an env file sets
# (Documents/env.txt, the bundle's dm/env.txt) is shown but kept. Diagnostic switches stay environment-only, so they are not listed here. The player's page is docs/settings.md.
# Columns, separated by tabs:
# variable the environment variable the setting sets
# kind choice: values value=label,... (languages: the game's own, from its control data); range: values low:high:step, shown as a percentage;
# toggle: values - (on sets 1, off 0) or <on>/<off>, the two values the variable takes (on/off)
# default a value (a toggle's: 1 on, 0 off); DM_GAME_<NAME>: the host's own default from the game profile (game_profile.h, game.py); build:<VAR>: the IPA build's setting (build_ipa.sh)
-# shown always; DM_GAME_<NAME>!=<value> or ==<value>; fixups:<KEY>: main's rewriter table has that key (a stub in the game's build, patch_nso.py); languages>1; gfxapi:<API>: the packer's GFXAPI;
-# platform:<ios | mac>: the app's platform (SETTINGS_PLATFORM, ios when unset), for a switch only that platform's front end reads
+# shown always; DM_GAME_<NAME>!=<value> or ==<value>; fixups:<KEY>: main's rewriter table has that key (a stub in the game's build, patch_nso.py); languages>1; gfxapi:<API>: the packer's GFXAPI
# section Game, Controls or Performance: a heading on the single settings screen. Rows appear in table order within each section
# Reset to tested defaults clears all launcher choices; values fixed by an env file stay
# label, note the setting's name and the line under it (may be empty; only for a setting with a cost: latency, memory, heat)
@@ -16,8 +15,8 @@ DM_RENDER_SCALE range 0.5:1.0:0.05 1.0 fixups:RENDER_SCALE Game Render scale
DM_OPMODE choice 1=Docked,0=Handheld DM_GAME_OPMODE always Game Console mode
DM_PRESENT_UPSCALE choice off=Standard,metalfx=MetalFX off always Game Upscaling Uses more GPU time and can increase heat.
DM_LANG choice languages build:DM_LANG languages>1 Game Game language
-DM_SHOW_FPS toggle - build:DM_SHOW_FPS platform:ios Game Frame-rate counter
-DM_TOUCH_HAPTICS toggle - 1 platform:ios Controls Touch feedback
+DM_SHOW_FPS toggle - build:DM_SHOW_FPS always Game Frame-rate counter
+DM_TOUCH_HAPTICS toggle - 1 always Controls Touch feedback
DM_RUMBLE toggle - 1 always Controls Game rumble
DM_RUMBLE_GAIN range 0:3:0.1 1.0 always Controls Rumble strength
DM_PRESENT_SNAP toggle - DM_GAME_PRESENT_SNAP gfxapi:nvn Performance Frame buffering Up to one frame more display latency.
diff --git a/dm/gfx/tools/shader_split.py b/dm/gfx/tools/shader_split.py
index 03b2a756..96c7757d 100644
--- a/dm/gfx/tools/shader_split.py
+++ b/dm/gfx/tools/shader_split.py
@@ -48,7 +48,7 @@
# With an update: give RomFS and main as comma-separated lists (base game first, e.g. data/v0/RomFS,data/v327680/RomFS); the output is the union of both versions (see main())
# Unity type trees need Unity's common string table, which is taken from the first main
# Pair table: (vertex key, pixel key) of every BNSH variation (every Unity program); dmsh_build uses it to give vertex shaders the outputs their pixel shaders read but they do not write (see dmsh_build.py vs_pad)
-import collections, concurrent.futures as cf, hashlib, json, os, re, struct, subprocess, sys, time
+import collections, concurrent.futures as cf, hashlib, json, os, re, struct, subprocess, sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../games')); import game as _game
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))); import uepak
GAME = _game.load() # the current game profile (DM_GAME, required): source group rules and the table header note
@@ -1903,23 +1903,6 @@ def nso_image(path):
img[mo:mo + sz] = lz4.block.decompress(raw, uncompressed_size=sz) if flags >> i & 1 else raw
return bytes(img)
-def scan_batch(jobs): # scan_file over a batch of jobs, in a pool worker
- return [scan_file(j) for j in jobs]
-
-
-def pooled(ex, jobs, total, start=0, chunk=1):
- """scan_file over jobs in the pool, the results in job order, with a 'progress: <done>/<total>' line at most twice a second (the NSP script shows it as
- the stage's count). The count is of the jobs finished in any order: counted in order it would stall behind one slow archive range while the others finish"""
- batches = [jobs[i:i + chunk] for i in range(0, len(jobs), chunk)]
- futures = {ex.submit(scan_batch, b): len(b) for b in batches}
- done, pending, shown = start, set(futures), 0.0
- while pending:
- finished, pending = cf.wait(pending, timeout=0.5)
- done += sum(futures[f] for f in finished)
- if not pending or time.monotonic() - shown >= 0.5: print(f'progress: {done}/{total}', flush=True); shown = time.monotonic()
- return [r for f in futures for r in f.result()]
-
-
def main():
romfs_l, main_l, pkg, mapout, factsout = sys.argv[1:6]
pairsout = sys.argv[6] if len(sys.argv) > 6 else None
@@ -1971,8 +1954,7 @@ def main():
big += pak_jobs + tr_jobs + ue_jobs + bd_jobs + arc_jobs + pz_jobs + ck_jobs + zp_jobs
files = [(p, r) for p, r in files if not linkdata_jobs(p, r) and p not in paks and p not in trp and p not in uep and p not in bdts and p not in arcs and p not in pkzs and p not in cpks and p not in zips]
with cf.ProcessPoolExecutor(J, initializer=_pool_init, initargs=(common, {}, zdicts)) as ex:
- n = len(big) + len(files)
- results += pooled(ex, big, n) + pooled(ex, files, n, len(big), chunk=16)
+ results += list(ex.map(scan_file, big)) + list(ex.map(scan_file, files, chunksize=16))
trees, defer = {}, []
for rel, uniq, pr, extra in results:
if extra == 'defer': defer.append(rel)
diff --git a/dm/mac/pack_app.py b/dm/mac/pack_app.py
index df739330..d08d4987 100644
--- a/dm/mac/pack_app.py
+++ b/dm/mac/pack_app.py
@@ -2,8 +2,7 @@
# Pack a self-contained, double-clickable Mac app of a game (the NSP script's --platform mac-app): the launcher (dm/mac/launcher.c, compiled here) as CFBundleExecutable, the Mac host beside it,
# and in Contents/Resources what the IPA carries (dm/ios/tools/build_ipa.sh): romfs/ (the RomFS), msl/<b-chain | vk | gl>/ (the Mac shader libraries, the folder named as in the IPA),
# aoc/<index>/ (DLC), pso/ (an NVN game's pipeline archive made offline for this Mac's GPU, dm/gfx/tools/pso_offline.py: the launcher hands it to the host as DM_PSO_BUNDLE),
-# and dm/ (the rewritten modules and their rewriter tables, nro.tsv, the profile's shader_map.tsv / pso_manifest.tsv / c1_full.tsv / cb_extent.tsv / shader_pairs.tsv / pso_pairs.tsv, font/, env.txt,
-# launcher.json: the game's launcher settings, dm/games/settings.py, which the Mac front end shows and passes to the app as its environment),
+# and dm/ (the rewritten modules and their rewriter tables, nro.tsv, the profile's shader_map.tsv / pso_manifest.tsv / c1_full.tsv / cb_extent.tsv / shader_pairs.tsv / pso_pairs.tsv, font/, env.txt),
# plus AppIcon.icns from the game's icon (sips, iconutil) and the Info.plist keys the launcher reads (DMTitleID, DMRomfsMarker, DMLanguage).
# The large folders are APFS clones (cp -c) when the app is on the same APFS volume as the build, so they take no space; plain copies otherwise.
# Signing: the inner host first, then the bundle (codesign --force --sign <identity>; '-' = ad-hoc), without the hardened runtime: the host maps the game's code executable, which the hardened
@@ -148,7 +147,7 @@ def selected_inputs(a):
pairs = Path(a.pso_pairs) if a.pso_pairs and not any(p.name == 'pso_pairs.tsv' for p in tables) else None
fonts = sorted(Path(a.font).glob('*.ttf'))
files = [Path(a.host)] + mods + msls + pso + tables + fonts + ([pairs] if pairs else [])
- files += [Path(p) for p in (a.env_file, a.settings, a.icon) if p]
+ files += [Path(p) for p in (a.env_file, a.icon) if p]
for p in files:
if not p.is_file(): raise SystemExit(f'no input file at {p}')
return mods, msls, pso, tables, pairs, fonts, files
@@ -175,7 +174,7 @@ def pack(a):
except (OSError, ValueError): previous = None
try:
a = argparse.Namespace(**vars(a))
- for name in ('out', 'host', 'patched', 'romfs', 'msl', 'tables', 'font', 'aoc', 'pso', 'pso_pairs', 'env_file', 'settings', 'icon'):
+ for name in ('out', 'host', 'patched', 'romfs', 'msl', 'tables', 'font', 'aoc', 'pso', 'pso_pairs', 'env_file', 'icon'):
if getattr(a, name): setattr(a, name, str(Path(getattr(a, name)).resolve()))
mods, msls, pso, tables, pairs, fonts, files = selected_inputs(a)
clang = Path(run(['xcrun', '--find', 'clang']).strip()).resolve()
@@ -217,7 +216,6 @@ def pack(a):
if pairs: shutil.copyfile(pairs, dm / 'pso_pairs.tsv') # the split's copy, for a profile without the table
if fonts: copy(fonts, dm / 'font', False)
if a.env_file: shutil.copyfile(a.env_file, dm / 'env.txt')
- if a.settings: shutil.copyfile(a.settings, dm / 'launcher.json')
step('shader libraries'); msl_dst = res / 'msl' / (a.msl_name or msl.name); msl_dst.mkdir(parents=True); copy(msls, msl_dst, clone)
if aoc: step('add-on content'); copy([aoc], res / 'aoc', clone)
if pso: step('pipeline archive'); (res / 'pso').mkdir(); copy(pso, res / 'pso', pso_clone)
@@ -259,7 +257,6 @@ def parse(argv):
ap.add_argument('--pso', help='the pipeline archive made offline for this Mac (pso_offline.py --platform macos output: <arch>.mtl4a, prebuilt.tsv)')
ap.add_argument('--pso-pairs', help='pso_pairs.tsv for a profile that has none (the shader split\'s copy)')
ap.add_argument('--env-file', help='environment switches baked in (Resources/dm/env.txt)')
- ap.add_argument('--settings', help='the game\'s launcher settings (dm/games/settings.py output; Resources/dm/launcher.json, which the Mac front end reads)')
ap.add_argument('--title-id', required=True); ap.add_argument('--name', required=True)
ap.add_argument('--version'); ap.add_argument('--bundle-id'); ap.add_argument('--category'); ap.add_argument('--lang'); ap.add_argument('--marker', help='the profile\'s romfs_marker')
ap.add_argument('--icon', help='the game icon (icon.jpg from the control data)')
diff --git a/dm/tools/tests/test_launcher_settings.py b/dm/tools/tests/test_launcher_settings.py
index 71b1b5b2..e2ce418a 100644
--- a/dm/tools/tests/test_launcher_settings.py
+++ b/dm/tools/tests/test_launcher_settings.py
@@ -15,10 +15,8 @@ BOTW, WONDER = '01007EF00011E000', '010015100B514000'
PERFORMANCE_NVN = ['DM_PRESENT_SNAP', 'DM_PSO_MTL4', 'DM_PSO_PREBUILD', 'DM_NVN_ENC_THREAD', 'DM_FPS_HOLD', 'DM_METAL_HUD']
-def build(gid, api, platform=None):
- env = {'GFXAPI': api, **({'SETTINGS_PLATFORM': platform} if platform else {})}
- with tempfile.TemporaryDirectory() as tmp, patch.object(settings.nacp, 'languages', return_value=['en-US']), patch.dict(os.environ, env):
- if not platform: os.environ.pop('SETTINGS_PLATFORM', None)
+def build(gid, api):
+ with tempfile.TemporaryDirectory() as tmp, patch.object(settings.nacp, 'languages', return_value=['en-US']), patch.dict(os.environ, {'GFXAPI': api}):
return {s['env']: s for s in settings.build(gid, tmp, Path(tmp) / 'control.nacp')['settings']}
@@ -56,12 +54,6 @@ class LauncherSettingsTests(unittest.TestCase):
s = build(BOTW, 'nvn')['DM_SHOW_FPS']
self.assertEqual((s['on'], s['off']), ('1', '0'))
- def test_iphone_switches_only_on_the_iphone(self): # the frame-rate counter and touch feedback are the iOS front end's (front_ios.m, DmGamepad.m)
- ios, mac = build(BOTW, 'nvn'), build(BOTW, 'nvn', 'mac')
- self.assertEqual(build(BOTW, 'nvn', 'ios').keys(), ios.keys()) # ios when unset
- self.assertEqual(set(ios) - set(mac), {'DM_SHOW_FPS', 'DM_TOUCH_HAPTICS'})
- self.assertIn('DM_RUMBLE', mac); self.assertIn('DM_METAL_HUD', mac)
-
def test_table_format_is_strict(self):
good = 'DM_X\ttoggle\t-\t0\talways\tGame\tX\n'
for bad, why in [('DM_X\ttoggle\t-\t0\talways\tX\n', 'columns'), ('DM_X\ttoggle\t-\t0\talways\tsecret\tX\n', 'section'),
diff --git a/dm/tools/tests/test_nsp_incremental.py b/dm/tools/tests/test_nsp_incremental.py
index 35c83ed5..8797d9c7 100644
--- a/dm/tools/tests/test_nsp_incremental.py
+++ b/dm/tools/tests/test_nsp_incremental.py
@@ -374,7 +374,6 @@ class MacApp(Base):
def test_packer_reports_reuse_and_first_pack_steps(self):
t = self.tmp; out = t / 'Game.app'; packs = []
def pack(cmd, log, env=None, on_line=None):
- if not on_line: return # the launcher settings (dm/games/settings.py)
packs.append(cmd)
(out / 'Contents/MacOS').mkdir(parents=True, exist_ok=True)
(out / 'Contents/MacOS/dmhost').write_bytes(b'host')
diff --git a/dm/tools/tests/test_nsp_mac_app.py b/dm/tools/tests/test_nsp_mac_app.py
index f77c3d0d..bbc3375f 100644
--- a/dm/tools/tests/test_nsp_mac_app.py
+++ b/dm/tools/tests/test_nsp_mac_app.py
@@ -339,7 +339,6 @@ class App(unittest.TestCase):
(t / 'aoc/1/x').write_bytes(b'dlc')
(t / 'pso').mkdir(); (t / 'pso/applegpu_g14s.mtl4a').write_bytes(b'arch'); (t / 'pso/prebuilt.tsv').write_text('chain\t0123456789ab\n'); (t / 'pso/key.x').write_text('not for the app')
(t / 'env.txt').write_text('# baked in\nDM_BAKED=1\nDM_BOTH=bundle\n')
- (t / 'launcher.json').write_text('{"game": "x", "settings": []}\n')
subprocess.run(['sips', '-s', 'format', 'jpeg', '-z', '256', '256', '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns',
'--out', t / 'icon.jpg'], check=True, capture_output=True)
(t / 'bin/osascript').write_text('#!/bin/sh\necho "$@" > "$HOME/alert.txt"\nprintf "%s\\0" "$@" > "$HOME/alert.args"\n'
@@ -347,7 +346,7 @@ class App(unittest.TestCase):
(t / 'bin/osascript').chmod(0o755)
cls.app = t / 'Game - Test.app'
cls.args = pack_app.parse([str(cls.app), '--host', str(t / 'dmhost'), '--patched', str(t / 'patched'), '--romfs', str(t / 'romfs'), '--msl', str(t / 'cache/b-0123456789ab'),
- '--tables', str(t / 'profile'), '--font', str(t / 'font'), '--aoc', str(t / 'aoc'), '--pso', str(t / 'pso'), '--env-file', str(t / 'env.txt'), '--settings', str(t / 'launcher.json'), '--title-id', TID.lower(),
+ '--tables', str(t / 'profile'), '--font', str(t / 'font'), '--aoc', str(t / 'aoc'), '--pso', str(t / 'pso'), '--env-file', str(t / 'env.txt'), '--title-id', TID.lower(),
'--name', 'Game: Test', '--version', '1.0.1', '--lang', 'fr', '--marker', 'region_common/audio/edward.bfsar', '--icon', str(t / 'icon.jpg'),
'--category', 'public.app-category.games'])
with contextlib.redirect_stdout(io.StringIO()): pack_app.pack(cls.args)
@@ -372,7 +371,7 @@ class App(unittest.TestCase):
self.assertFalse(self.app.with_name(self.app.name + '.partial').exists())
self.assertEqual(sorted(p.name for p in (c / 'MacOS').iterdir()), ['dmhost', 'nxnative'])
self.assertEqual(sorted(p.name for p in (c / 'Resources/dm').iterdir()),
- ['c1_full.tsv', 'env.txt', 'font', 'launcher.json', 'main.cuts.tsv', 'main.fixups.tsv', 'main.gates.tsv', 'main.obs.tsv', 'main.patched.bin', 'pso_manifest.tsv', 'pso_pairs.tsv',
+ ['c1_full.tsv', 'env.txt', 'font', 'main.cuts.tsv', 'main.fixups.tsv', 'main.gates.tsv', 'main.obs.tsv', 'main.patched.bin', 'pso_manifest.tsv', 'pso_pairs.tsv',
'shader_map.tsv', 'shader_pairs.tsv']) # the shader pairs: the pipeline prebuild's, without which hybrid draws have no stand-in
self.assertEqual([p.name for p in (c / 'Resources/msl').iterdir()], ['b-0123456789ab']) # the libraries only, not the compile cache
self.assertEqual(sorted(p.name for p in (c / 'Resources/msl/b-0123456789ab').iterdir()), ['inputs.tsv', 'k_b.json', 'k_b.metallib'])
@@ -540,8 +539,6 @@ class Script(unittest.TestCase):
out = tmp / 'G.app'; shutil.rmtree(out, ignore_errors=True)
def fake_run(cmd, log, env=None, cwd=None, on_line=None):
ran.append([str(c) for c in cmd])
- if str(cmd[1]).endswith('dm/games/settings.py'): # the launcher settings, before the packer
- self.settings_env = env; Path(cmd[-1]).write_text('{}'); return
if not on_line: # pso_offline.py: its archive, or none when every eligible pair has function constants
o = Path(cmd[cmd.index('--out') + 1]); o.mkdir(parents=True, exist_ok=True)
if not kw.get('no_bases'): (o / f'{cmd[cmd.index("--gpu") + 1]}.mtl4a').write_bytes(b'arch')
@@ -555,8 +552,7 @@ class Script(unittest.TestCase):
mock.patch.object(nsp, 'mac_gpu_arch', lambda *a: 'applegpu_g14s'), mock.patch.object(nsp, 'say', self.said.append):
nsp.mac_app(sys.executable, REPO, out, 0x01008CF01BAAC000, tmp, tmp / 'ex', tmp / 'patched', tmp / 'dmhost', tmp / 'font', tmp / 'shader/cache' if gfx == 'nvn' else tmp / 'shader',
kw.get('aoc'), gfx, 'en-US', g, 'Game', '1.0.0', 'org.nxnative.01008cf01baac000', None, kw.get('sign', ''), {}, tmp, gpus=kw.get('gpus', ''))
- self.pso_cmd = next((c for c in ran if c[1].endswith('pso_offline.py')), None) # before the packer
- self.settings_cmd = next(c for c in ran if c[1].endswith('dm/games/settings.py'))
+ self.pso_cmd = ran[0] if len(ran) > 1 else None # pso_offline.py, before the packer
c = ran[-1]; return {c[i]: c[i + 1] for i in range(3, len(c) - 1) if c[i].startswith('--')}, tmp
def test_pack_command(self):
@@ -570,9 +566,6 @@ class Script(unittest.TestCase):
(str(tmp / 'shader/cache/b-0123456789ab'), str(tmp / 'ex/RomFS'), str(tmp / 'profile'), TID, '-', 'a/b'))
self.assertNotIn('--aoc', o); self.assertNotIn('--icon', o)
self.assertNotIn('--pso', o) # no shader pairs: no pipeline archive
- self.assertEqual(o['--settings'], str(tmp / 'app/launcher.json')) # the launcher settings the Mac front end reads, without the iPhone's own switches
- self.assertEqual(self.settings_cmd[2:], ['01008CF01BAAC000', str(tmp / 'patched'), str(tmp / 'ex/control.nacp'), str(tmp / 'app/launcher.json')])
- self.assertEqual((self.settings_env['SETTINGS_PLATFORM'], self.settings_env['GFXAPI'], self.settings_env['DM_LANG']), ('mac', 'nvn', 'en-US'))
o, tmp = self.pack_cmd('vulkan', aoc=Path('/x/aoc'), sign='Developer ID Application: X (T)')
self.assertEqual((o['--msl'], o['--aoc'], o['--sign']), (str(tmp / 'shader/vk'), '/x/aoc', 'Developer ID Application: X (T)'))
diff --git a/docs/settings.md b/docs/settings.md
index 1d3efe4f..4156fe51 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -14,8 +14,6 @@ Each game comes with the settings it was tested with: its profile in this reposi
When you change a setting and tap **Play**, the app keeps your choice, also when a later build of the app ships other defaults. A setting you leave at its default is not stored: it follows the defaults of the build you have, so a newer build's tested settings reach you without doing anything. **Reset to tested defaults** at the bottom forgets all launcher choices, so the game's defaults apply again. For testing, a line in `Documents/env.txt` overrides any setting ([Settings in a file](#settings-in-a-file)).
-On the Mac the same settings are under **Launch options** beside **Play** in the [Mac front end](../frontend/README.md#launch-options), without the iPhone's own Frame-rate counter and Touch feedback; they apply when the game is started from there.
-
## Game
### Frame rate
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py
index 85224da6..5e9a3c9b 100644
--- a/frontend-qt/nspb_qt/localization.py
+++ b/frontend-qt/nspb_qt/localization.py
@@ -47,7 +47,7 @@ TABLE: dict[str, tuple[str, str]] = {
'launch.reset': ('恢复测试默认值', 'Reset to tested defaults'),
'launch.done': ('完成', 'Done'),
'launch.applied': ('下次从这里开始游戏时生效。', 'Applied the next time you press Play here.'),
- 'launch.none': ('这个版本没有启动选项。重新构建游戏后即可设置。', 'This build has no launch options yet. Build the game again to set them.'),
+ 'launch.none': ('这个版本没有附带启动选项列表。', 'This build carries no list of launch options.'),
'launch.section.Game': ('游戏', 'Game'),
'launch.section.Controls': ('控制', 'Controls'),
'launch.section.Performance': ('性能', 'Performance'),
diff --git a/frontend/README.md b/frontend/README.md
index 430eeec0..4b748f21 100644
--- a/frontend/README.md
+++ b/frontend/README.md
@@ -49,13 +49,14 @@ library manifest is stored at
## Launch options
The button beside **Play** opens the game's launch options: the settings the iPhone
-launcher shows before a game starts ([docs/settings.md](../docs/settings.md)), as the
-NSP script packed them into the Mac app (`Contents/Resources/dm/launcher.json`, from
-`dm/games/settings.tsv`), without the iPhone's own frame-rate counter and touch
-feedback. **Play** starts the app with every setting in its environment. Only a
-choice that differs from the game's tested default is kept, in the library manifest;
-**Reset to tested defaults** forgets them. An app packed before the settings were has
-none to show: build it again. Starting the app from Finder uses its defaults.
+launcher shows before a game starts ([docs/settings.md](../docs/settings.md)), read
+from the list the engine packs into the Mac app (`Contents/Resources/dm/launcher.json`,
+written by `dm/games/settings.py` from `dm/games/settings.tsv`; the engine change that
+packs it is [seedds/nxnative#352](https://github.com/seedds/nxnative/pull/352), so a
+sync from upstream brings it). **Play** starts the app with every setting in its
+environment. Only a choice that differs from the game's tested default is kept, in the
+library manifest; **Reset to tested defaults** forgets them. An app without the list
+shows none. Starting the app from Finder uses its defaults.
## Artwork
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index b55e0278..a19bb4e4 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -61,7 +61,7 @@ enum L10n {
"launch.reset": ("\u{6062}\u{590d}\u{6d4b}\u{8bd5}\u{9ed8}\u{8ba4}\u{503c}", "Reset to tested defaults"),
"launch.done": ("\u{5b8c}\u{6210}", "Done"),
"launch.applied": ("\u{4e0b}\u{6b21}\u{4ece}\u{8fd9}\u{91cc}\u{5f00}\u{59cb}\u{6e38}\u{620f}\u{65f6}\u{751f}\u{6548}\u{3002}", "Applied the next time you press Play here."),
- "launch.none": ("\u{8fd9}\u{4e2a}\u{7248}\u{672c}\u{6ca1}\u{6709}\u{542f}\u{52a8}\u{9009}\u{9879}\u{3002}\u{91cd}\u{65b0}\u{6784}\u{5efa}\u{6e38}\u{620f}\u{540e}\u{5373}\u{53ef}\u{8bbe}\u{7f6e}\u{3002}", "This build has no launch options yet. Build the game again to set them."),
+ "launch.none": ("\u{8fd9}\u{4e2a}\u{7248}\u{672c}\u{6ca1}\u{6709}\u{9644}\u{5e26}\u{542f}\u{52a8}\u{9009}\u{9879}\u{5217}\u{8868}\u{3002}", "This build carries no list of launch options."),
"launch.section.Game": ("\u{6e38}\u{620f}", "Game"),
"launch.section.Controls": ("\u{63a7}\u{5236}", "Controls"),
"launch.section.Performance": ("\u{6027}\u{80fd}", "Performance"),
diff --git a/scripts/build_ipa_from_nsp.py b/scripts/build_ipa_from_nsp.py
index 39652997..3d49d419 100755
--- a/scripts/build_ipa_from_nsp.py
+++ b/scripts/build_ipa_from_nsp.py
@@ -1358,7 +1358,7 @@ def split_shaders(py, repo, roms, mains, pkg, env, logs, g, provisional=False, o
again because a reader of another engine changed writes the same package, and the iOS shaders stay reused.
oodle: for decoder-backed packs, builds or reuses the Mac host and returns DM_OODLE_HOST / DM_OODLE_MODULES; their current files are split inputs too"""
names = ('shader_map.tsv', 'shader_facts.tsv', 'shader_pairs.tsv')
- PROG.stage('shader split', step='checking the inputs') # then the count of files and archive ranges scanned (shader_split.py's progress lines); the package and tables come at the end
+ PROG.stage('shader split', step='checking the inputs') # then a spinner: shader_split.py writes the package and the tables only at the end
kf = pkg.with_name(pkg.name + '.key')
inputs = [('files', tool_files(repo)), bool(provisional)] + [x for r, m in zip(roms, mains) for x in
(('files', [m]), ('stat' if provisional else 'tree', r),
@@ -1372,10 +1372,8 @@ def split_shaders(py, repo, roms, mains, pkg, env, logs, g, provisional=False, o
PROG.end(f'{note}, reused (inputs unchanged)'); return package_key(pkg)
PROG.set(step='splitting')
tmp = pkg.with_name(pkg.name + '.partial'); rmtree(tmp); (tmp / 'tables').mkdir(parents=True)
- def counted(ln): # shader_split.py's 'progress: <done>/<total>'
- if m := re.fullmatch(r'progress: (\d+)/(\d+)', ln): PROG.set(done=int(m[1]), total=int(m[2]), unit='files')
run([py, repo / 'dm/gfx/tools/shader_split.py', ','.join(map(str, roms)), ','.join(map(str, mains)), tmp / 'pkg'] + [tmp / 'tables' / n for n in names + ('pso_pairs.tsv',)],
- logs / 'shader_split.log', env=env, on_line=counted)
+ logs / 'shader_split.log', env=env)
m = re.search(r'shaders: (\d+) \(', (logs / 'shader_split.log').read_text(errors='replace'))
if m and m.group(1) == '0': # dmsh_build.py would make no library, and the iOS shader step stop with no word of why
raise BuildError('the shader split found no shaders in main or the RomFS: the game keeps them in a form shader_split.py does not read; locate them (docs/agents) and add a reader')
@@ -1716,20 +1714,17 @@ def mac_app_name(name): # the app's file name: the game name with the characte
def mac_app(py, repo, out, app, work, game, patched, host, font, msl, aoc, gfx, lang, g, name, version, bundle_id, icon, sign, env, logs, env_file='', gpus=''):
"""The last stage of PLATFORM 'mac-app': pack the Mac app (dm/mac/pack_app.py) from what a Mac-only build made: the Mac host and font (mac_host), the packed version's RomFS and rewritten
modules, the Mac shader libraries (msl: <shader>/cache, whose b-<chain> goes in, or a Vulkan or GL game's <shader>, whose vk / gl goes in), the DLC, the profile's tables (with the shader pairs
- the pipeline prebuild reads), the pipeline archive made offline for this Mac (mac_pso; gpus: --gpu / PSO_GPUS), the launcher settings and an environment file.
+ the pipeline prebuild reads), the pipeline archive made offline for this Mac (mac_pso; gpus: --gpu / PSO_GPUS) and an environment file.
The save and the log go to the player's Library, keyed by the folder's title ID (app); a new app replaces the old one only when it is complete"""
lib = msl / (f'b-{chain_of(repo)}' if gfx == 'nvn' else 'vk' if gfx == 'vulkan' else 'gl')
pso = mac_pso(py, repo, work, lib, g, gpus, env, logs) if gfx == 'nvn' and g.table('shader_pairs.tsv').is_file() else None # a stage of its own, before the app's
PROG.stage('Mac app', step='starting')
- # The launcher settings the IPA carries (dm/games/settings.py), without the iPhone's own switches: the Mac front end shows them and starts the app with them
- settings = work / 'app/launcher.json'; settings.parent.mkdir(parents=True, exist_ok=True)
- run([py, repo / 'dm/games/settings.py', g.id, patched, game / 'control.nacp', settings], logs / 'mac_settings.log', env=dict(env, GFXAPI=gfx, SETTINGS_PLATFORM='mac', DM_LANG=lang))
cmd = [py, repo / 'dm/mac/pack_app.py', out, '--host', host, '--patched', patched, '--romfs', game / 'RomFS', '--msl', lib, '--tables', g.table('shader_map.tsv').parent,
'--font', font, '--title-id', f'{app:016X}', '--name', name, '--bundle-id', bundle_id, '--lang', lang, '--sign', sign or '-']
split_pairs = work / 'shader/pso_pairs.tsv' # the split's copy of pso_pairs.tsv, for a profile without the table (as mac_run's DM_PSO_PAIRS)
for opt, v in (('--version', version), ('--category', g.get('app_category')), ('--marker', g.get('romfs_marker')), ('--aoc', aoc), ('--icon', icon),
('--pso', pso), ('--pso-pairs', split_pairs if gfx == 'nvn' and not g.table('pso_pairs.tsv').is_file() and split_pairs.is_file() else None),
- ('--env-file', Path(os.path.expanduser(env_file)).resolve() if env_file else None), ('--settings', settings)):
+ ('--env-file', Path(os.path.expanduser(env_file)).resolve() if env_file else None)):
if v: cmd += [opt, v]
unchanged = False
def line(ln):