From 1df04aa18deb4da21209d4a9149b226fa39a950c Mon Sep 17 00:00:00 2001
From: Adrian Castro <22133246+castdrian@users.noreply.github.com>
Date: Sat, 1 Aug 2026 12:23:11 +0200
Subject: [PATCH] fix(ios): route native picker results
---
mobile/ios/overlays/love-ios.plist | 6 +-----
scripts/build.sh | 5 +++++
scripts/build_ios.sh | 33 +++++++++++++++++++++++++++++-
src/import/RomImporter.lua | 13 +++++++++---
tests/rom_importer_cursor_test.lua | 9 ++++++++
5 files changed, 57 insertions(+), 9 deletions(-)
diff --git a/mobile/ios/overlays/love-ios.plist b/mobile/ios/overlays/love-ios.plist
index d4c9c52d..0d8e0f02 100644
--- a/mobile/ios/overlays/love-ios.plist
+++ b/mobile/ios/overlays/love-ios.plist
@@ -5,7 +5,7 @@
CFBundleDevelopmentRegion
en
CFBundleDisplayName
- Pokemon Red
+ gen1recomp
CFBundleDocumentTypes
@@ -49,10 +49,6 @@
UILaunchStoryboardName
Launch Screen
- UIRequiredDeviceCapabilities
-
- opengles-2
-
UIStatusBarHidden
UIViewControllerBasedStatusBarAppearance
diff --git a/scripts/build.sh b/scripts/build.sh
index eb719f8b..409eebe6 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -35,6 +35,7 @@ TARGET="all"
NOTARY_PROFILE="notary-profile"
NOTARIZE=true
IOS_RELEASE=false
+IOS_IPA=false
say() { printf '\033[1;32m==>\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33mwarn:\033[0m %s\n' "$*" >&2; }
@@ -48,6 +49,7 @@ while [ $# -gt 0 ]; do
--notary-profile) NOTARY_PROFILE="$2"; shift ;;
--no-notarize) NOTARIZE=false ;;
--release) IOS_RELEASE=true ;;
+ --ipa) IOS_IPA=true ;;
*) fail "unknown argument: $1" ;;
esac
shift
@@ -298,6 +300,9 @@ build_android() {
if [ "$VERSION_EXPLICIT" = true ]; then
args+=(--version "$VERSION")
fi
+ if [ "$IOS_IPA" = true ]; then
+ args+=(--ipa)
+ fi
"$ROOT/scripts/build_android.sh" ${args[@]+"${args[@]}"}
}
diff --git a/scripts/build_ios.sh b/scripts/build_ios.sh
index 869287d1..11b81a62 100755
--- a/scripts/build_ios.sh
+++ b/scripts/build_ios.sh
@@ -50,7 +50,7 @@ DISPLAY_NAME="gen1recomp"
# capabilities like HealthKit are involved), so a per-team default
# lets anyone build without colliding with someone else's app
# 4. simulator: the project default (no App ID registration involved)
-BUNDLE_ID="${GEN1_BUNDLE_ID:-}"
+BUNDLE_ID="${GEN1_BUNDLE_ID:-com.theboisclub.gen1recomp}"
if [ -z "$BUNDLE_ID" ] && [ -f "$IOS_DIR/bundle_id.local" ]; then
BUNDLE_ID="$(tr -d '[:space:]' < "$IOS_DIR/bundle_id.local")"
fi
@@ -65,6 +65,7 @@ DEVICE=false
RELEASE=false
PACKAGE_ONLY=false
INSTALL=false
+CREATE_IPA=false
# Last resort for an incomplete source export, mirroring build_android.sh.
MANIFEST_BASE_URL="${MANIFEST_BASE_URL:-https://raw.githubusercontent.com/bryanthaboi/gen1recomp/main}"
MANIFESTS=""
@@ -82,6 +83,7 @@ while [ $# -gt 0 ]; do
--release) RELEASE=true ;;
--package-only) PACKAGE_ONLY=true ;;
--install) INSTALL=true ;;
+ --ipa) CREATE_IPA=true ;;
--version) VERSION="$2"; shift ;;
-h|--help)
sed -n '2,24p' "$0"
@@ -92,6 +94,10 @@ while [ $# -gt 0 ]; do
shift
done
+if $CREATE_IPA; then
+ DEVICE=true
+fi
+
VERSION_CODE=""
if [ -n "$VERSION" ]; then
if ! printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
@@ -232,6 +238,30 @@ apply_ios_branding() {
cp "$OVERLAY_PLIST" "$dest"
}
+apply_ios_icon() {
+ local source="$ROOT/assets/logo/logo.png"
+ local target="$XCODE_DIR/Images.xcassets/iOS AppIcon.appiconset"
+ [ -f "$source" ] || fail "missing iOS icon source: $source"
+ [ -d "$target" ] || fail "missing iOS app icon set: $target"
+ local entry name size
+ while IFS=: read -r name size; do
+ sips -z "$size" "$size" "$source" --out "$target/$name" >/dev/null
+ done <<'EOF'
+icon-1024pt@1x.png:1024
+icon-29pt@1x.png:29
+icon-29pt@2x.png:58
+icon-29pt@3x.png:87
+icon-40pt@1x.png:40
+icon-40pt@2x.png:80
+icon-40pt@3x.png:120
+icon-60pt@2x.png:120
+icon-60pt@3x.png:180
+icon-76pt@1x.png:76
+icon-76pt@2x.png:152
+icon-83.5pt@2x.png:167
+EOF
+}
+
# --------------------------------------------------------------- game.love
# Every version's import manifest has to ship or that game's ROM import fails in
# the built app: decodeManifest (src/import/RomImporter.lua) errors outright when
@@ -640,6 +670,7 @@ install_to_device() {
# --------------------------------------------------------------- main
apply_ios_branding
+apply_ios_icon
say "applying iOS native bridge patches (picker/Files support)"
python3 "$IOS_DIR/patch_love_src.py" || fail "patch_love_src.py failed"
ensure_manifests
diff --git a/src/import/RomImporter.lua b/src/import/RomImporter.lua
index 51d83c71..46a14a2f 100644
--- a/src/import/RomImporter.lua
+++ b/src/import/RomImporter.lua
@@ -818,7 +818,11 @@ local function resetPointerCursor(self)
if not (love.mouse.isCursorSupported and love.mouse.isCursorSupported()) then
return
end
- self.arrowCursor = self.arrowCursor or love.mouse.getSystemCursor("arrow")
+ if not self.arrowCursor then
+ local ok, cursor = pcall(love.mouse.getSystemCursor, "arrow")
+ if not ok then return end
+ self.arrowCursor = cursor
+ end
love.mouse.setCursor(self.arrowCursor)
end
@@ -2512,8 +2516,11 @@ function RomImporter:draw()
if self._hoverEnabled and not self._padCursorActive
and love.mouse.isCursorSupported and love.mouse.isCursorSupported() then
if self._anyHover then
- self.handCursor = self.handCursor or love.mouse.getSystemCursor("hand")
- love.mouse.setCursor(self.handCursor)
+ if not self.handCursor then
+ local ok, cursor = pcall(love.mouse.getSystemCursor, "hand")
+ if ok then self.handCursor = cursor end
+ end
+ if self.handCursor then love.mouse.setCursor(self.handCursor) end
else
resetPointerCursor(self)
end
diff --git a/tests/rom_importer_cursor_test.lua b/tests/rom_importer_cursor_test.lua
index 21e8ad13..2f8a41f3 100644
--- a/tests/rom_importer_cursor_test.lua
+++ b/tests/rom_importer_cursor_test.lua
@@ -36,4 +36,13 @@ ri:play("red")
eq(booted, "red", "android play still boots")
eq(currentCursor, "hand", "android play leaves the cursor alone")
+booted = nil
+currentCursor = "hand"
+ri.android = false
+ri.arrowCursor = nil
+love.mouse.getSystemCursor = function() error("CreateSystemCursor is not currently supported") end
+ri:play("red")
+eq(booted, "red", "unsupported system cursors still allow boot")
+eq(currentCursor, "hand", "unsupported system cursors leave the existing cursor alone")
+
S.finish()