diff --git a/mobile/ios/LOVE_VERSION b/mobile/ios/LOVE_VERSION index 8204473e..d7213f31 100644 --- a/mobile/ios/LOVE_VERSION +++ b/mobile/ios/LOVE_VERSION @@ -1 +1 @@ -11.5 +12.0 diff --git a/mobile/ios/README.md b/mobile/ios/README.md index 25a0f0b6..e1a9f48a 100644 --- a/mobile/ios/README.md +++ b/mobile/ios/README.md @@ -1,4 +1,4 @@ -# iOS build (LÖVE 11.5) +# iOS build (LÖVE 12.0) > **Native ROM/mod/save import.** The iOS build ships a Swift > document-picker bridge (`native/GRPickerBridge.swift` + `GRBootstrap.m`) @@ -20,20 +20,17 @@ > The note below about a missing "UIDocumentPicker handoff" is > resolved by this bridge. -macOS + Xcode only. Pins the official **LÖVE 11.5** iOS Xcode tree -(`love-11.5-ios-source.zip` from [love2d/love releases](https://github.com/love2d/love/releases/tag/11.5)), -matching `conf.lua`'s `t.version = "11.5"`. +macOS + Xcode only. Fetches the **LÖVE 12.0** source tree and matching Apple +dependencies from the official [LÖVE source](https://github.com/love2d/love) +and [Apple dependencies](https://github.com/love2d/love-apple-dependencies) +repositories. `conf.lua` declares LÖVE 12.0 on iOS and 11.5 elsewhere. -There is no separate `love2d/love-ios` GitHub repo for 11.5; the release zip -**is** the vendored iOS project (Xcode project under -`love-src/platform/xcode/love.xcodeproj`, target `love-ios`). - -Pin file: [`LOVE_VERSION`](./LOVE_VERSION) → `11.5`. +Pin file: [`LOVE_VERSION`](./LOVE_VERSION) → `12.0`. ## Quick start (simulator) ```bash -# Fetch LÖVE 11.5 iOS sources (once) + build for Simulator +# Fetch LÖVE 12.0 iOS sources and dependencies (once) + build for Simulator scripts/build_ios.sh --fetch ``` @@ -80,10 +77,10 @@ Manual out-of-band steps: | Path | Role | |------|------| -| `LOVE_VERSION` | Engine pin (`11.5`) | +| `LOVE_VERSION` | Engine pin (`12.0`) | | `overlays/love-ios.plist` | Portrait-only Info.plist + display name **Pokemon Red** (copied over the upstream plist every build) | -| `love-src/` | Downloaded `love-11.5-ios-source` tree (**gitignored**, do not commit) | -| `cache/` | Downloaded zips (**gitignored**) | +| `love-src/` | Downloaded LÖVE 12.0 source tree (**gitignored**, do not commit) | +| `cache/` | Temporary source and dependency checkout data (**gitignored**) | | `build/` | `xcodebuild` derived data (**gitignored**) | Game payload lands at: @@ -94,28 +91,10 @@ and is fused into the built `.app` (LÖVE auto-runs any bundled `*.love`). ## Apple libraries dependency -The official `love-11.5-ios-source.zip` already ships prebuilt iOS -xcframeworks under `platform/xcode/ios/libraries/` (SDL2, LuaJIT, freetype, -ogg, vorbis, theora, modplug). - -If that folder is missing or incomplete (e.g. you cloned sources without -libs), download the matching prebuilts and install them: - -```bash -curl -fL -o mobile/ios/cache/love-11.5-apple-libraries.zip \ - https://github.com/love2d/love/releases/download/11.5/love-11.5-apple-libraries.zip -unzip -q mobile/ios/cache/love-11.5-apple-libraries.zip -d mobile/ios/cache -rm -rf mobile/ios/love-src/platform/xcode/ios/libraries -cp -R mobile/ios/cache/love-apple-dependencies/iOS/libraries \ - mobile/ios/love-src/platform/xcode/ios/libraries -``` - -`scripts/build_ios.sh` checks for `libraries/SDL2.xcframework` and fails with -these instructions if it is absent. - -Upstream also documents -[love-apple-dependencies](https://github.com/love2d/love-apple-dependencies) -as an alternate source of the same libraries. +`scripts/build_ios.sh --fetch` retrieves the matching iOS libraries and the +SDL3 framework from +[love-apple-dependencies](https://github.com/love2d/love-apple-dependencies). +Re-run it if either dependency directory is absent. ## App identity @@ -134,7 +113,7 @@ so refreshing `love-src/` does not lose branding. | Flag | Meaning | |------|---------| | *(default)* | Simulator, Debug, no signing | -| `--fetch` | Download/extract `love-11.5-ios-source.zip` if `love-src/` is missing | +| `--fetch` | Fetch the LÖVE 12.0 source tree and Apple dependencies if `love-src/` is missing | | `--device` | Build against `iphoneos` instead of `iphonesimulator` | | `--release` | `Release` configuration instead of `Debug` | | `--package-only` | Zip `game.love` + apply plist overlay; skip `xcodebuild` | @@ -147,5 +126,5 @@ Also: `scripts/build.sh ios` delegates here (`--release` is forwarded). - iOS platform installed in Xcode (Settings → Platforms). `xcodebuild -showsdks` should list `iphonesimulator` / `iphoneos`. A partial install can fail IB/xib compiles with `iOS … Platform Not Installed` even when the SDK name appears. -- `love-src/` present (`--fetch` or manual unzip of `love-11.5-ios-source.zip`) -- iOS libraries under `love-src/platform/xcode/ios/libraries/` (see above) +- `love-src/` present (`--fetch`) +- iOS libraries under `love-src/platform/xcode/ios/libraries/` and SDL3 under `love-src/platform/xcode/shared/Frameworks/` diff --git a/mobile/ios/patch_love_src.py b/mobile/ios/patch_love_src.py index 6ea38c83..e3b87fe2 100644 --- a/mobile/ios/patch_love_src.py +++ b/mobile/ios/patch_love_src.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Applies gen1recomp's iOS native-bridge patches to the fetched LÖVE 11.5 +"""Applies gen1recomp's iOS native-bridge patches to the fetched LÖVE 12.0 source tree (mobile/ios/love-src/). Idempotent AND re-appliable: the first run stashes a pristine `.orig` copy of every file it rewrites, and later runs always start over from that copy — so editing the patch content here diff --git a/scripts/build_ios.sh b/scripts/build_ios.sh index 70311d34..7011df0e 100755 --- a/scripts/build_ios.sh +++ b/scripts/build_ios.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Packages the LÖVE2D Pokémon Red port into an iOS app via LÖVE 11.5's -# official iOS Xcode project (love-11.5-ios-source.zip). +# Packages the LÖVE2D Pokémon Red port into an iOS app via LÖVE 12.0's +# iOS Xcode project. # # Usage: scripts/build_ios.sh [--fetch] [--device] [--release] [--install] # [--version X.Y.Z] [--package-only] @@ -12,13 +12,12 @@ # first connected iPhone/iPad (unlock it first) # --release Release configuration # --version X.Y.Z stamp MARKETING_VERSION / CURRENT_PROJECT_VERSION -# --fetch Download love-11.5-ios-source.zip into mobile/ios/love-src/ +# --fetch Fetch LÖVE 12.0 sources and Apple dependencies into mobile/ios/love-src/ # --package-only Zip game.love + apply plist overlay; skip xcodebuild # # Prerequisites: # - macOS + Xcode (xcodebuild) # - mobile/ios/love-src/ (see --fetch / mobile/ios/README.md) -# - prebuilt iOS libraries under love-src/platform/xcode/ios/libraries/ # # Output: dist/ios/-/gen1recomp.app (convenience copy) # dist/ios/gen1recomp.ipa (device builds only) @@ -54,11 +53,11 @@ 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 -LOVE_VERSION="$(tr -d '[:space:]' < "$IOS_DIR/LOVE_VERSION" 2>/dev/null || echo 11.5)" -IOS_SOURCE_ZIP="love-${LOVE_VERSION}-ios-source.zip" -APPLE_LIBS_ZIP="love-${LOVE_VERSION}-apple-libraries.zip" -IOS_SOURCE_URL="https://github.com/love2d/love/releases/download/${LOVE_VERSION}/${IOS_SOURCE_ZIP}" -APPLE_LIBS_URL="https://github.com/love2d/love/releases/download/${LOVE_VERSION}/${APPLE_LIBS_ZIP}" +LOVE_VERSION="$(tr -d '[:space:]' < "$IOS_DIR/LOVE_VERSION" 2>/dev/null || echo 12.0)" +LOVE_SOURCE_REF="${LOVE_SOURCE_REF:-main}" +APPLE_DEPENDENCIES_REF="${APPLE_DEPENDENCIES_REF:-main}" +LOVE_SOURCE_REPO="https://github.com/love2d/love.git" +APPLE_DEPENDENCIES_REPO="https://github.com/love2d/love-apple-dependencies.git" FETCH=false DEVICE=false @@ -160,25 +159,19 @@ fi # --------------------------------------------------------------- fetch love-src fetch_love_ios() { mkdir -p "$CACHE" - local zip_path="$CACHE/$IOS_SOURCE_ZIP" - if [ ! -f "$zip_path" ]; then - say "downloading $IOS_SOURCE_ZIP (LÖVE $LOVE_VERSION iOS sources)" - curl -fL --progress-bar "$IOS_SOURCE_URL" -o "$zip_path" \ - || fail "download failed: $IOS_SOURCE_URL" - else - say "using cached $zip_path" - fi - - say "extracting into $LOVE_SRC" - rm -rf "$LOVE_SRC" local tmp tmp="$(mktemp -d "$CACHE/extract.XXXXXX")" - unzip -q "$zip_path" -d "$tmp" - # Zip root is love--ios-source/ - local extracted - extracted="$(find "$tmp" -maxdepth 1 -mindepth 1 -type d ! -name '__MACOSX' | head -1)" - [ -n "$extracted" ] || fail "unexpected layout inside $IOS_SOURCE_ZIP" - mv "$extracted" "$LOVE_SRC" + say "fetching LÖVE $LOVE_VERSION sources ($LOVE_SOURCE_REF)" + git clone --depth 1 --branch "$LOVE_SOURCE_REF" "$LOVE_SOURCE_REPO" "$tmp/love" \ + || fail "failed to fetch LÖVE sources from $LOVE_SOURCE_REPO" + say "fetching Apple dependencies ($APPLE_DEPENDENCIES_REF)" + git clone --depth 1 --branch "$APPLE_DEPENDENCIES_REF" "$APPLE_DEPENDENCIES_REPO" "$tmp/dependencies" \ + || fail "failed to fetch Apple dependencies from $APPLE_DEPENDENCIES_REPO" + rm -rf "$LOVE_SRC" + mv "$tmp/love" "$LOVE_SRC" + mkdir -p "$LIBS_DIR" "$XCODE_DIR/shared" + cp -R "$tmp/dependencies/iOS/libraries/." "$LIBS_DIR" + cp -R "$tmp/dependencies/shared/." "$XCODE_DIR/shared" rm -rf "$tmp" say "love-src ready (LÖVE $LOVE_VERSION)" } @@ -188,18 +181,12 @@ if [ ! -d "$XCODE_DIR/love.xcodeproj" ]; then fetch_love_ios else fail "LÖVE $LOVE_VERSION iOS sources not found at mobile/ios/love-src/. - Fetch them (documented download of love-${LOVE_VERSION}-ios-source.zip): + Fetch them: scripts/build_ios.sh --fetch - Or manually: - mkdir -p mobile/ios/cache - curl -fL -o mobile/ios/cache/$IOS_SOURCE_ZIP \\ - $IOS_SOURCE_URL - unzip -q mobile/ios/cache/$IOS_SOURCE_ZIP -d mobile/ios/cache - mv mobile/ios/cache/love-${LOVE_VERSION}-ios-source mobile/ios/love-src See mobile/ios/README.md." fi elif $FETCH; then - say "love-src already present; skipping download (delete mobile/ios/love-src to refresh)" + say "love-src already present; skipping fetch (delete mobile/ios/love-src to refresh)" fi [ -d "$XCODE_DIR/love.xcodeproj" ] \ @@ -207,25 +194,16 @@ fi # --------------------------------------------------------------- apple libraries require_ios_libraries() { - if [ -d "$LIBS_DIR/SDL2.xcframework" ]; then + if [ -d "$LIBS_DIR/SDL2.xcframework" ] && [ -d "$XCODE_DIR/shared/Frameworks/SDL3.xcframework" ]; then return 0 fi fail "prebuilt iOS libraries missing at: $LIBS_DIR - love-ios expects SDL2.xcframework (and friends) there. + and shared/Frameworks. - The official love-${LOVE_VERSION}-ios-source.zip normally includes them. - If they are absent, install love-${LOVE_VERSION}-apple-libraries.zip: + Re-fetch the LÖVE $LOVE_VERSION source tree and its Apple dependencies: - mkdir -p mobile/ios/cache - curl -fL -o mobile/ios/cache/$APPLE_LIBS_ZIP \\ - $APPLE_LIBS_URL - unzip -q mobile/ios/cache/$APPLE_LIBS_ZIP -d mobile/ios/cache - rm -rf mobile/ios/love-src/platform/xcode/ios/libraries - cp -R mobile/ios/cache/love-apple-dependencies/iOS/libraries \\ - mobile/ios/love-src/platform/xcode/ios/libraries - - See mobile/ios/README.md (Apple libraries dependency)." + scripts/build_ios.sh --fetch" } require_ios_libraries diff --git a/src/render/Renderer.lua b/src/render/Renderer.lua index 48d2fa5b..bc0650b9 100644 --- a/src/render/Renderer.lua +++ b/src/render/Renderer.lua @@ -602,7 +602,8 @@ function Renderer:endFrame(zones, worldZones) -- runs, so dialogs, menus and the HUD sit on top as usual. love.graphics.setColor(1, 1, 1, 1) love.graphics.setScissor(0, 0, ww, wh) - if love.system and love.system.getOS and love.system.getOS() == "iOS" then + local loveMajor = love.getVersion() + if love.system and love.system.getOS and love.system.getOS() == "iOS" and loveMajor >= 12 then love.graphics.draw(self.worldOverride, 0, wh, 0, 1 / dpiX, -1 / dpiY) else love.graphics.draw(self.worldOverride, 0, 0, 0, 1 / dpiX, 1 / dpiY)