Skip to content

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

Patches: carry the front ends' progress hook as 0041, forwarded as seedds/nxnative#742

v0lumehi95450c404bac
diff --git a/patches/0041-front-progress-hook.patch b/patches/0041-front-progress-hook.patch
new file mode 100644
index 00000000..f11ca793
--- /dev/null
+++ b/patches/0041-front-progress-hook.patch
@@ -0,0 +1,69 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: v0lumehi <[email protected]>
+Date: Fri, 30 Oct 2026 20:23:23 +0100
+Subject: [PATCH] Front ends: an app that hosts the game view can draw the
+ prepare step's progress itself
+
+front_progress_hook (front.h): set before the game starts, it gets every front_progress call's title, done and total on the front
+end's main thread, and the front end shows no progress screen of its own. NULL by default, so the Mac app and the iOS app keep
+their screens exactly as they are. A launcher that holds several games in one app draws the step in its own look.
+
+Upstream-Status: forwarded seedds/nxnative#742
+Reason: the route C shell draws the prepare step's progress in its own look (frontend-ios) until upstream has the hook
+Issue: LNPANDY/NX2Apple#144
+
+---
+ dm/host/front.h | 4 ++++
+ dm/host/front_mac.m | 3 +++
+ dm/ios/Sources/front_ios.m | 3 +++
+ 3 files changed, 10 insertions(+)
+
+diff --git a/dm/host/front.h b/dm/host/front.h
+index 9cbc4a4a..9a51d7ee 100644
+--- a/dm/host/front.h
++++ b/dm/host/front.h
+@@ -22,6 +22,10 @@ void front_screen_match(int fps);
+ // title and done of total shown over the game's view (a dark screen, the title, a bar and a count), updated on each call; title NULL hides it. Any thread; the front end switches to its main
+ // thread and does not block. Nothing is shown without a window
+ void front_progress(const char *title, long done, long total);
++// An app that hosts the game view and has a look of its own (a launcher holding several games) can draw that progress itself: set before the game starts, the hook
++// gets every front_progress call's values on the front end's main thread (title NULL when it ends, the title copied for the call) and the front end shows no screen of its own.
++// NULL (the default): the front end's screen above
++extern void (*front_progress_hook)(const char *title, long done, long total);
+ #include <stdint.h>
+ // Text input box (for the software keyboard swkbd): the main thread shows a native input box and the calling thread blocks until the user confirms / cancels.
+ // All text is UTF-8; max_chars is the maximum character count (0 = unlimited, only a hint for the front end; truncation is done uniformly by the caller hle_swkbd.c in UTF-16 units).
+diff --git a/dm/host/front_mac.m b/dm/host/front_mac.m
+index 99c18f7d..182e32df 100644
+--- a/dm/host/front_mac.m
++++ b/dm/host/front_mac.m
+@@ -1226,9 +1226,12 @@ void front_run(void (*guest)(void)) {
+ NSTextField *t = [NSTextField labelWithString:@""]; t.frame = r; t.alignment = NSTextAlignmentCenter; t.textColor = c;
+ t.font = [NSFont monospacedDigitSystemFontOfSize:size weight:w]; return t;
+ }
++void (*front_progress_hook)(const char *title, long done, long total);
+ void front_progress(const char *title, long done, long total) {
+ if (!g_layer) return;
+ NSString *tt = title ? @(title) : nil;
++ void (*hook)(const char *, long, long) = front_progress_hook;
++ if (hook) { dispatch_async(dispatch_get_main_queue(), ^{ hook(tt.UTF8String, done, total); }); return; } // the host app draws it (front.h)
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!tt) { [g_prog removeFromSuperview]; g_prog = nil; return; }
+ if (!g_prog) {
+diff --git a/dm/ios/Sources/front_ios.m b/dm/ios/Sources/front_ios.m
+index a6f188eb..ec3d5548 100644
+--- a/dm/ios/Sources/front_ios.m
++++ b/dm/ios/Sources/front_ios.m
+@@ -166,9 +166,12 @@ static void front_ios_power_watch(void) {
+
+ // Progress screen of the prepare step (front.h front_progress): a dark view over the game's view and the pad, the title, a bar and a count, centered; UIKit views, so it draws while the game's thread waits
+ static UIView *g_prog; static UILabel *g_prog_count; static UIProgressView *g_prog_bar; static UILabel *g_prog_title;
++void (*front_progress_hook)(const char *title, long done, long total);
+ void front_progress(const char *title, long done, long total) {
+ if (!g_layer) return;
+ NSString *tt = title ? @(title) : nil;
++ void (*hook)(const char *, long, long) = front_progress_hook;
++ if (hook) { dispatch_async(dispatch_get_main_queue(), ^{ hook(tt.UTF8String, done, total); }); return; } // the host app draws it (front.h)
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!tt) { [g_prog removeFromSuperview]; g_prog = nil; return; }
+ if (!g_prog) {
diff --git a/patches/series b/patches/series
index e236084e..88390f4d 100644
--- a/patches/series
+++ b/patches/series
@@ -33,3 +33,4 @@
0038-dm-framework-env-switch-row.patch
0039-route-c-shell.patch
0040-nsp-shell-framework.patch
+0041-front-progress-hook.patch