Skip to content

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

Sync upstream 062cd06e → 5d2bf73f (25 upstream commits)

LNPANDYa6dfcf83f6ad
diff --git a/patches/0001-runtime-profile.patch b/patches/0001-runtime-profile.patch
index d9c88342..cb0f8f65 100644
--- a/patches/0001-runtime-profile.patch
+++ b/patches/0001-runtime-profile.patch
@@ -793,7 +793,7 @@ diff --git a/dm/ios/Sources/DmGamepad.m b/dm/ios/Sources/DmGamepad.m
index 19670a4a..234648b6 100644
--- a/dm/ios/Sources/DmGamepad.m
+++ b/dm/ios/Sources/DmGamepad.m
-@@ -185,7 +185,7 @@ static BOOL fullOnly(int b) { return b == B_LS || b == B_RS || b >= B_LEFT; }
+@@ -185,7 +185,7 @@ - (instancetype)initWithFrame:(CGRect)f {
}
_swap = shape(_controls); _swapLabel = label(_swap, @"");
NSNumber *saved = [NSUserDefaults.standardUserDefaults objectForKey:k_layout_key];
diff --git a/patches/0003-ios-game-data-folder.patch b/patches/0003-ios-game-data-folder.patch
index 3e7401c7..4927cd8d 100644
--- a/patches/0003-ios-game-data-folder.patch
+++ b/patches/0003-ios-game-data-folder.patch
@@ -265,7 +265,7 @@ diff --git a/dm/ios/Sources/front_ios.m b/dm/ios/Sources/front_ios.m
index db2e49ea..80def564 100644
--- a/dm/ios/Sources/front_ios.m
+++ b/dm/ios/Sources/front_ios.m
-@@ -17,6 +17,7 @@ void front_ios_boot(void);
+@@ -17,6 +17,7 @@
int front_ios_boot_ok(void);
const char *front_ios_boot_message(void); // main.m: why a build that keeps the game files off the IPA found none usable (NULL = the generic hint)
bool dm_show_launcher(void *view_controller, void (*done)(void)); // Launcher.swift: false = no launcher (no dm/launcher.json, or DM_LAUNCHER=0)
@@ -273,7 +273,7 @@ index db2e49ea..80def564 100644
static CAMetalLayer *g_layer;
static void front_ios_power_watch(void);
-@@ -48,6 +49,7 @@ static UILabel *front_ios_fps_label(void);
+@@ -48,6 +49,7 @@ @interface DmRootVC : UIViewController
@property (nonatomic, strong) UIView *pad;
@property (nonatomic, strong) UILabel *fps;
@property (nonatomic) BOOL launched;
@@ -281,7 +281,7 @@ index db2e49ea..80def564 100644
- (void)startGame;
@end
static DmRootVC *g_root;
-@@ -70,6 +72,14 @@ static void launcher_done(void) { [g_root startGame]; }
+@@ -70,6 +72,14 @@ - (void)viewDidLoad {
// The game view, the pad and the frame-rate counter are made once the launcher has set the switches they read (DM_SHOW_FPS, DM_METAL_HUD); the host's loading began at app launch (main.m)
- (void)startGame {
if (self.game) return;
@@ -296,7 +296,7 @@ index db2e49ea..80def564 100644
front_hud_env(); // before the game view makes its device (an env file's DM_METAL_HUD sets it in main.m already)
self.game = [[DmGameView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.game];
-@@ -105,7 +115,8 @@ static void launcher_done(void) { [g_root startGame]; }
+@@ -105,7 +115,8 @@ - (void)viewDidAppear:(BOOL)a {
}
if (self.launched || !front_ios_boot_ok()) return;
self.launched = YES; g_root = self;
@@ -382,7 +382,7 @@ index fb37046e..5afddbb6 100644
NSString *img = [doc stringByAppendingPathComponent:@"romfs.img"];
if (romfs_image_complete(img) && romfs_identity_accepts(img)) {
// A folder copy from before images is now dead weight of up to many GB (often cut off partway). Deleting its 300,000 files here took longer than iOS allows an app to start
-@@ -58,13 +109,48 @@ static NSString *romfs_locate(void) {
+@@ -58,13 +109,48 @@ static int romfs_identity_accepts(NSString *img) {
}
NSString *bundledImage = [NSBundle.mainBundle.resourcePath stringByAppendingPathComponent:@"romfs.img"];
NSString *documentFolder = [doc stringByAppendingPathComponent:@"romfs"];
diff --git a/patches/0008-bc-cpu-decode.patch b/patches/0008-bc-cpu-decode.patch
index ca183706..01a01927 100644
--- a/patches/0008-bc-cpu-decode.patch
+++ b/patches/0008-bc-cpu-decode.patch
@@ -75,7 +75,7 @@ index 4fd67122..65a16379 100644
#include "../tex/nvn_deswizzle.h"
#include "../tex/nvn_deswizzle_gpu.h"
#include "nvn_builtin.h"
-@@ -79,6 +80,8 @@ static int g_warm_started;
+@@ -79,6 +80,8 @@ static inline uint64_t tex_slot_h(const uint64_t *tex, const uint64_t *img, unsi
static void warm_claim(void);
static id<MTLDevice> g_dev;
@@ -108,7 +108,7 @@ index 4fd67122..65a16379 100644
// Metal's limits: 16384 in 2D, 2048 in 3D, 2048 array layers; beyond them Metal aborts the process on an assertion, so they are caught here with a red line
if (t->d.width > 16384 || t->d.height > 16384 || t->d.depth > 2048) { RED_ONCE(71, "texture size exceeds Metal limits: %u×%u×%u levels %u format %#x target %d (first case ser=%llu)", t->d.width, t->d.height, t->d.depth, t->d.levels, t->d.format, t->d.target, (unsigned long long)t->serial); return nil; }
MTLTextureDescriptor *d = [MTLTextureDescriptor new];
-@@ -2221,15 +2232,43 @@ static id<MTLTexture> pkg_upload_(const tex_t *t, uint64_t *stamp, id<MTLTexture
+@@ -2221,15 +2232,43 @@ static void zb_report(const tex_t *t, unsigned base, const char *why) {
if (!(part = malloc(t->L.size ? t->L.size : 1))) MDIE("sparse texture copy of %llu bytes failed", (unsigned long long)t->L.size);
nvn_sparse_copy(t->pool, part, (uint64_t)(uintptr_t)t->mem, t->L.size); src = part;
}
@@ -153,7 +153,7 @@ index 4fd67122..65a16379 100644
if (nvn_deswizzle(&t->d, l, y, src, (uint8_t *)stg.contents + off, pitch)) { RED_ONCE(9, "deswizzle failed format %#x target %d", t->d.format, t->d.target); break; }
if (zb && l < 16) { const uint64_t *q = (const uint64_t *)((const uint8_t *)stg.contents + off); size_t nb = pitch * rows * z / 16;
for (size_t i = 0; i < nb; i++) g_zb[l] += !(q[2 * i] | q[2 * i + 1]);
-@@ -2238,6 +2277,7 @@ static id<MTLTexture> pkg_upload_(const tex_t *t, uint64_t *stamp, id<MTLTexture
+@@ -2238,6 +2277,7 @@ static void zb_report(const tex_t *t, unsigned base, const char *why) {
off += pitch * rows * z;
}
}
diff --git a/patches/0009-mac-keymap.patch b/patches/0009-mac-keymap.patch
index 68cc5062..114bc71a 100644
--- a/patches/0009-mac-keymap.patch
+++ b/patches/0009-mac-keymap.patch
@@ -106,7 +106,7 @@ index eb833d10..3df6394d 100644
dm_pad_set_player(p, m, pad_axis(g.leftThumbstick.xAxis.value), pad_axis(g.leftThumbstick.yAxis.value), pad_axis(g.rightThumbstick.xAxis.value), pad_axis(g.rightThumbstick.yAxis.value));
}
// Home and Capture: without this macOS takes them as system gestures (Home opens the Games app); the host gives them no function
-@@ -186,7 +182,7 @@ static int g_mouse_down; // the mouse holds the touch (DmGameView)
+@@ -186,7 +182,7 @@ static void pads_changed(GCController *gone) {
static void input_release(void) {
g_input_on = 0;
dm_motion_pro_active(0);