Skip to content

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

Carry the pointer hiding as patch 0032

v0lumehiaed3f708bad0
diff --git a/dm/fork_patches.txt b/dm/fork_patches.txt
index 9316e473..1d40b321 100644
--- a/dm/fork_patches.txt
+++ b/dm/fork_patches.txt
@@ -19,3 +19,4 @@ cheats-engine
cheats-mac-panel
front-mac-enter-fullscreen-once-the-app-is-activ
front-mac-dm-screen
+front-mac-hide-the-pointer-after-a-few-idle-seco
diff --git a/patches/0032-front-mac-hide-the-pointer-after-a-few-idle-seco.patch b/patches/0032-front-mac-hide-the-pointer-after-a-few-idle-seco.patch
new file mode 100644
index 00000000..a63d3a57
--- /dev/null
+++ b/patches/0032-front-mac-hide-the-pointer-after-a-few-idle-seco.patch
@@ -0,0 +1,76 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: v0lumehi <[email protected]>
+Date: Fri, 30 Oct 2026 22:25:32 +0100
+Subject: [PATCH] front_mac: hide the pointer after a few idle seconds over the
+ game
+
+The Mac host never hid the pointer, so it stayed on the picture of a game in a window and in fullscreen. It now hides after DM_CURSOR_HIDE seconds (3 by default) without movement over the game view and shows again on the next movement, click or scroll.
+
+Upstream-Status: pending
+Reason: The Mac host never hid the pointer over a game
+Issue: LNPANDY/NX2Apple#272
+
+---
+ dm/host/front_mac.m | 16 ++++++++++++++++
+ docs/env_switches.tsv | 1 +
+ docs/reference/frame-rate.md | 8 ++++++++
+ 3 files changed, 25 insertions(+)
+
+diff --git a/dm/host/front_mac.m b/dm/host/front_mac.m
+index 99c18f7d..e73472fb 100644
+--- a/dm/host/front_mac.m
++++ b/dm/host/front_mac.m
+@@ -1185,6 +1185,22 @@ void front_run(void (*guest)(void)) {
+ [NSNotificationCenter.defaultCenter addObserverForName:nm object:win queue:nil usingBlock:^(NSNotification *n) { (void)n; want = 0; }]; // the player's own toggle (ours already cleared it)
+ dispatch_async(dispatch_get_main_queue(), enter);
+ }
++ // The pointer hides after DM_CURSOR_HIDE seconds (3 by default, 0 keeps it) without movement over the game, and comes back with the next movement, click or scroll. macOS
++ // hides it only for a game that asks (a game window does not, and a pointer left over a fullscreen game stays on the picture); it is also shown whenever the window is
++ // not key or the pointer is outside the game view, so the title bar and other windows keep theirs
++ const char *ch = getenv("DM_CURSOR_HIDE"); double idle = ch && *ch ? atof(ch) : 3.0;
++ if (idle > 0) {
++ win.acceptsMouseMovedEvents = YES;
++ __block double last = CACurrentMediaTime(); __block int hidden = 0;
++ void (^show)(void) = ^{ if (hidden) { hidden = 0; [NSCursor unhide]; } };
++ [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskMouseMoved | NSEventMaskLeftMouseDragged | NSEventMaskRightMouseDragged | NSEventMaskOtherMouseDragged |
++ NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown | NSEventMaskOtherMouseDown | NSEventMaskScrollWheel handler:^NSEvent *(NSEvent *e) { last = CACurrentMediaTime(); show(); return e; }];
++ [NSTimer scheduledTimerWithTimeInterval:0.25 repeats:YES block:^(NSTimer *t) {
++ (void)t; NSView *cv = win.contentView;
++ int over = win.isKeyWindow && NSApp.isActive && NSPointInRect([cv convertPoint:win.mouseLocationOutsideOfEventStream fromView:nil], cv.bounds);
++ if (hidden && !over) show();
++ else if (!hidden && over && CACurrentMediaTime() - last >= idle) { hidden = 1; [NSCursor hide]; } }];
++ }
+ for (NSNotificationName nm in @[GCControllerDidConnectNotification, GCControllerDidDisconnectNotification])
+ [NSNotificationCenter.defaultCenter addObserverForName:nm object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *n) {
+ GCController *c = n.object; int conn = n.name == GCControllerDidConnectNotification;
+diff --git a/docs/env_switches.tsv b/docs/env_switches.tsv
+index 6993f8dc..c475d8ed 100644
+--- a/docs/env_switches.tsv
++++ b/docs/env_switches.tsv
+@@ -20,6 +20,7 @@ DM_CHEATS_WINDOW switch `1` opens the Mac Cheats panel beside the game from the
+ DM_COPY_GAME_RESOURCES switch `NO` skips the Xcode build phase that copies the game's resources into the app (`stage_resources.sh`, on by default); `build_ipa.sh` sets it for its unsigned build, which packs them itself
+ DM_COPY_ROMFS switch `NO` keeps the game files out of the app, in the Xcode build phase (`stage_resources.sh`) and in the unsigned IPA of `build_ipa.sh` (on by default): `main.m` takes the validated `Documents/romfs.img` copied by `scripts/push_romfs.sh`, then a `Documents/romfs` folder; the build writes the image's identity as `romfs.id` into the app, and `main.m` uses only a matching image (`--romfs separate` of the NSP script sets this)
+ DM_CTL diagnostic `=<file>` (Mac): the host polls the file every 100 ms and runs each appended line: button presses, `shot`, `passdump`, `texdump`, `env KEY=VALUE`, `peek`, `memdump`, `drag` and more
++DM_CURSOR_HIDE player `=<seconds>` hides the Mac pointer after that many seconds without movement over the game window (3 by default) and shows it again on the next movement, click or scroll; `0` keeps it
+ DM_DBG diagnostic When set, prints the guest's `svcOutputDebugString` text to stderr as `[guest]` lines
+ DM_DBG_AU_FRAMES diagnostic `=<frames>` asks the Mac's Core Audio output for that many frames per callback instead of about 5 ms (1024 reproduces the iOS default that caused crackling)
+ DM_DETCLOCK switch `=<step ns>`: from the first present on, the guest clock advances a fixed step per present instead of following the wall clock, and the random source becomes a fixed-seed stream (replay and test runs)
+diff --git a/docs/reference/frame-rate.md b/docs/reference/frame-rate.md
+index 19e21153..7a181245 100644
+--- a/docs/reference/frame-rate.md
++++ b/docs/reference/frame-rate.md
+@@ -210,6 +210,14 @@ Frame pacing: the host's frame step, engine frame limiters, present intervals an
+ - **Found on:** the NX2Apple launcher's console mode (LNPANDY/NX2Apple), no game in particular.
+ - **Not checked:** the refusal itself, and a game started through the real console mode.
+
++### The pointer stays on a Mac game
++
++- **Symptom:** the mouse pointer stayed on the picture of a Mac game, in a window and in fullscreen, until it was moved to a screen corner.
++- **Cause:** `front_run` never hid it. macOS hides the pointer only for an app that asks, and a game window is not one.
++- **Fix:** `front_mac.m` `front_run` hides it after `DM_CURSOR_HIDE` seconds (3 by default, `0` keeps it) without movement over the game view, and shows it on the next movement, click or scroll (a local event monitor and a 0.25 s timer). It is shown whenever the window is not key or the pointer is outside the game view, so the title bar and other windows keep theirs.
++- **Found on:** the NX2Apple launcher's issue #272, no game in particular.
++- **Not checked:** not yet run on a game here.
++
+ ### Frame latency 2 for the display link in fullscreen
+
+ - **Symptom:** on a ProMotion built-in screen, only in fullscreen, the frame step went 1 → 2 → 3 vsyncs on frames costing 0.1–0.6 vsyncs (`3 late frames; cost 0.32 vsyncs`) and the game presented 15 frames a second; a window, or the screen set to a fixed 60 Hz, did not do it. The `DM_NVN_TSV` rows show presents shown one 120 Hz refresh late (`@pres_at_ms` − `@link_target_ms` = 8.3 ms) with a skipped tick after each (`@link_gap_ms` 33 ms), and `@link_lead_ms` about 16 ms against about 50 ms in a window.
diff --git a/patches/series b/patches/series
index 7b3026a0..d5f0bc22 100644
--- a/patches/series
+++ b/patches/series
@@ -20,3 +20,4 @@
0029-cheats-mac-panel.patch
0030-front-mac-enter-fullscreen-once-the-app-is-activ.patch
0031-front-mac-dm-screen.patch
+0032-front-mac-hide-the-pointer-after-a-few-idle-seco.patch