mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-20 20:50:21 +02:00
902f0d73d4
Makes the iOS build a first-class citizen: ROM/mod/save import through
the system document picker (the README's missing "UIDocumentPicker
handoff"), Files-app drop-in support, and an opt-in Apple Health
step-sync seam consumed by a new gallery mod (Pokewalker).
Native layer (mobile/ios/native/, wired by mobile/ios/patch_love_src.py
on every build, so the fetched love-src tree stays pristine + re-patchable):
- GRPickerBridge.swift: love.system.pickFile("rom"|"mod"|"sav") and
love.system.createFile on iOS with the same contract as love-android's
SAF picker (picked_rom.gb / picked_mod.zip / picked_save.sav /
export_done.flag in the save dir). Reached from wrap_System.cpp via the
ObjC runtime, so liblove needs no Swift interop.
- GRBootstrap.m: sweeps .gb/.gbc/.zip/.sav dropped in Documents (Files
app / Finder sharing) into the save dir on every activation;
UIFileSharingEnabled + LSSupportsOpeningDocumentsInPlace in the plist
overlay. Drop a ROM, open the app, it imports with zero taps.
- GRHealthBridge.swift: love.system.syncHealthSteps() -> read-only
HealthKit step query anchored to the last sync, delivered as
steps_pending.json (merge-not-overwrite). HealthKit entitlement +
usage description included.
Lua:
- RomImporter: iOS rides the Android mobile flows; a 0.5s poll consumes
picker deliveries (iOS pickers are in-process modals, so the Android
refocus rescan never fires); failed pick copies surface as an
on-screen notice via pick_error.txt.
- main.lua: on iOS, stop forwarding touchpressed to the Importer - LOVE
already synthesizes a mousepressed for the primary touch, and the
resulting same-frame double-present made the document picker
auto-dismiss with zero documents (silent import failure).
- mods/pokewalker: opt-in Pokewalker mod (manifest v2, MECHANIC,
permissions declared, mod.card, CHANGELOG, headless test suite 9/9,
modkit validate --base imported + lint clean). Fused into iOS
game.love only; loads dormant anywhere without the bridge.
Build (scripts/build_ios.sh):
- Fix Xcode 26: the global PRODUCT_NAME override also renamed liblove.a
and broke the app link; the app bundle is renamed after the build
instead.
- Fix nondeterministic pack failures: grep -q + pipefail races SIGPIPE
on the game.love content checks.
- Simulator builds sign ad-hoc so entitlements embed (HealthKit works in
the simulator).
- Device builds: signing team auto-detected from the keychain,
CODE_SIGN_STYLE=Automatic + -allowProvisioningUpdates for CLI-only
provisioning, per-team derived bundle ID (explicit App IDs are
globally unique, so third parties can't sign the project default),
gitignored mobile/ios/bundle_id.local pin, and --install to push to a
connected iPhone.
- docs/ios-install.md: a zero-knowledge walkthrough from bare Mac to
playing on an iPhone.
Backward compatibility: no behavior change on desktop or Android. The
new love.system functions exist only under LOVE_IOS; RomImporter's
mobile flag simply includes iOS alongside Android; the main.lua change
is iOS-gated; the Pokewalker mod is packed only by the iOS build script
and its option defaults off.
Verified on an iPhone 17 Pro simulator and an iPhone 16 Pro device:
scripted ROM import to title screen, Files-drop zero-tap import,
picker-driven mod install and save import/export, HealthKit permission
sheet + step credit (4000 steps -> +200 EXP at the default rate through
the engine growth curve).
93 lines
3.4 KiB
Markdown
93 lines
3.4 KiB
Markdown
# Pokéwalker (Apple Health) — a Gen1Recomp mod
|
|
|
|
Your real-world steps become EXP for your Pokémon party — the HeartGold/
|
|
SoulSilver Pokéwalker, except it's the iPhone already in your pocket.
|
|
|
|
A mod for [gen1recomp](https://github.com/bryanthaboi/gen1recomp)
|
|
(the Gen 1 Recompilation Project). Opt-in, data-safe, and dormant on any
|
|
platform that doesn't provide the native step source (see
|
|
[Requirements](#requirements)).
|
|
|
|
## Install
|
|
|
|
Grab `pokewalker-<version>.modpkg` from
|
|
[Releases](https://github.com/mresnick67/Gen1ReComp-Pokewalker/releases)
|
|
(or use GitHub's *Code → Download ZIP* — the importer handles both), then:
|
|
|
|
- **In the launcher:** MODS tab → **Import mod .zip** → pick the file, or
|
|
drag it onto the window on desktop.
|
|
- **iOS:** you can also drop the zip into the app's folder in the Files
|
|
app; it installs on next launch.
|
|
|
|
Then, in the **mod manager → POKEWALKER → options**, turn on **SYNC
|
|
STEPS**. iOS asks for read-only access to your step count the first time.
|
|
|
|
## Options
|
|
|
|
| Option | Values | Default |
|
|
|---|---|---|
|
|
| SYNC STEPS | on / off | **off** |
|
|
| STEPS PER EXP | 10 / 20 / 50 | 20 |
|
|
| GIVE EXP TO | lead mon / whole party (split) | lead mon |
|
|
|
|
## Mechanics & guardrails
|
|
|
|
- EXP applies through the engine's own growth curves and rare-candy stat
|
|
math, so levels, stats, and HP top-ups are exact.
|
|
- Steps are anchored to the last sync — the same walk is never credited
|
|
twice — and any single sync is clamped to 50,000 steps.
|
|
- The engine `levelCap` constant is respected.
|
|
- Credits land at quiet moments (save load, map change, battle end) with a
|
|
walk-report textbox.
|
|
|
|
## Requirements
|
|
|
|
The Lua mod is platform-neutral, but it feeds on a **native step bridge**
|
|
that currently ships in an iOS build of gen1recomp. Without the bridge the
|
|
mod loads and stays dormant — safe to install anywhere.
|
|
|
|
### The bridge contract (for porters)
|
|
|
|
Any platform can light this mod up by providing:
|
|
|
|
- `love.system.syncHealthSteps()` → `boolean` — kick off an async step
|
|
query (requesting OS permission on first use). On completion, write
|
|
**`steps_pending.json`** to the LÖVE save directory:
|
|
|
|
```json
|
|
{ "steps": 4312, "from": "2026-07-30T08:00:00Z", "to": "2026-07-30T17:00:00Z" }
|
|
```
|
|
|
|
Count steps from a persisted anchor (last successful sync) so a walk is
|
|
never delivered twice, and **merge** with an unconsumed pending file
|
|
rather than overwriting it. The mod consumes and deletes the file.
|
|
|
|
The reference iOS implementation is a small Swift class (HealthKit
|
|
`HKStatisticsQuery` over `stepCount`) exposed to Lua through a one-line
|
|
`wrap_System.cpp` addition. Open an issue here if you're porting the
|
|
bridge (Android: Health Connect / Google Fit would slot straight in).
|
|
|
|
## Known limitations (v1)
|
|
|
|
- Level-ups granted while walking don't prompt for new moves, and level
|
|
evolutions wait for the next in-battle level — same behavior as
|
|
over-leveling with rare candies.
|
|
- Steps sync on launch/activation; no background delivery yet.
|
|
|
|
## Developing
|
|
|
|
From a gen1recomp checkout with this mod at `mods/pokewalker` and an
|
|
imported data cache:
|
|
|
|
```sh
|
|
luajit mods/pokewalker/tests/pokewalker_test.lua
|
|
python3 tools/modkit.py validate mods/pokewalker --base imported
|
|
python3 tools/modkit.py pack mods/pokewalker
|
|
```
|
|
|
|
## License
|
|
|
|
MIT — see [LICENSE](LICENSE). Not affiliated with Nintendo, Game Freak,
|
|
or The Pokémon Company. This mod contains no ROM-derived content
|
|
(`modkit lint` clean).
|