mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-15 07:41:21 +02:00
Merge pull request #1204 from castdrian/ios-improvements
feat(ios): improve branding and fix haptic feedback
This commit is contained in:
@@ -7,7 +7,7 @@ an iOS app with LÖVE 12.0.
|
||||
|
||||
The app uses the public iOS Documents directory as its LÖVE save directory.
|
||||
There is no `pokemon-love2d` subdirectory and the app does not create a
|
||||
README file there. When browsing `On My iPhone > gen1recomp` in Files, the
|
||||
README file there. When browsing `On My iPhone > gen1recomp++` in Files, the
|
||||
directory contains the app's runtime data directly, including:
|
||||
|
||||
- installed mods and downloaded ROMs
|
||||
@@ -46,7 +46,7 @@ scripts/build_ios.sh --device --release --install
|
||||
Device builds require a paired, unlocked device and a valid Apple signing
|
||||
identity. Set `DEVELOPMENT_TEAM` or `CODE_SIGN_IDENTITY` when automatic
|
||||
signing cannot select the intended account. Add `--ipa` to create
|
||||
`dist/ios/gen1recomp.ipa`.
|
||||
`dist/ios/gen1recomp++.ipa`.
|
||||
|
||||
The script verifies the final app before packaging it:
|
||||
|
||||
@@ -76,10 +76,10 @@ option.
|
||||
Simulator and device app bundles are copied to:
|
||||
|
||||
```text
|
||||
dist/ios/Debug-iphonesimulator/gen1recomp.app
|
||||
dist/ios/Release-iphonesimulator/gen1recomp.app
|
||||
dist/ios/Debug-iphoneos/gen1recomp.app
|
||||
dist/ios/Release-iphoneos/gen1recomp.app
|
||||
dist/ios/Debug-iphonesimulator/gen1recomp++.app
|
||||
dist/ios/Release-iphonesimulator/gen1recomp++.app
|
||||
dist/ios/Debug-iphoneos/gen1recomp++.app
|
||||
dist/ios/Release-iphoneos/gen1recomp++.app
|
||||
```
|
||||
|
||||
The intermediate Xcode products are under `mobile/ios/build/`. Both locations
|
||||
@@ -94,9 +94,9 @@ saves; those are created at runtime in Documents.
|
||||
|
||||
| Field | Default |
|
||||
| --- | --- |
|
||||
| Display name | `gen1recomp` |
|
||||
| Product name | `gen1recomp` |
|
||||
| Bundle identifier | `com.theboisclub.gen1recomp` |
|
||||
| Display name | `gen1recomp++` |
|
||||
| Product name | `gen1recomp++` |
|
||||
| Bundle identifier | `com.theboisclub.gen1recompplusplus` |
|
||||
| Save directory | Public `Documents` root |
|
||||
| Orientation | Portrait |
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "gen1recomp App Repo",
|
||||
"identifier": "com.theboisclub.gen1recomp.repo",
|
||||
"name": "gen1recomp++ App Repo",
|
||||
"identifier": "com.theboisclub.gen1recompplusplus.repo",
|
||||
"iconURL": "https://raw.githubusercontent.com/bryanthaboi/gen1recomp/main/assets/logo/gen1recomp_cover.png",
|
||||
"apps": [
|
||||
{
|
||||
"name": "gen1recomp",
|
||||
"bundleIdentifier": "com.theboisclub.gen1recomp",
|
||||
"name": "gen1recomp++",
|
||||
"bundleIdentifier": "com.theboisclub.gen1recompplusplus",
|
||||
"developerName": "bryanthaboi",
|
||||
"iconURL": "https://raw.githubusercontent.com/bryanthaboi/gen1recomp/main/assets/logo/gen1recomp_cover.png",
|
||||
"localizedDescription": "Gen1Recomp - A native Lua / LÖVE2D recreation of Gen 1 Poke",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>gen1recomp</string>
|
||||
<string>gen1recomp++</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
@@ -32,7 +32,7 @@
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>gen1recomp</string>
|
||||
<string>gen1recomp++</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
|
||||
@@ -29,6 +29,9 @@ WRAP_SYSTEM = LOVE_SRC / "src" / "modules" / "system" / "wrap_System.cpp"
|
||||
PBXPROJ = LOVE_SRC / "platform" / "xcode" / "love.xcodeproj" / "project.pbxproj"
|
||||
APPLE_MM = LOVE_SRC / "src" / "common" / "apple.mm"
|
||||
FILESYSTEM_CPP = LOVE_SRC / "src" / "modules" / "filesystem" / "physfs" / "Filesystem.cpp"
|
||||
IOS_MM = LOVE_SRC / "src" / "common" / "ios.mm"
|
||||
IOS_H = LOVE_SRC / "src" / "common" / "ios.h"
|
||||
SYSTEM_CPP = LOVE_SRC / "src" / "modules" / "system" / "System.cpp"
|
||||
ENTITLEMENTS_SRC = IOS_DIR / "overlays" / "love-ios.entitlements"
|
||||
|
||||
NATIVE_FILES = ("GRPickerBridge.swift", "GRHealthBridge.swift", "GRBootstrap.m")
|
||||
@@ -120,7 +123,7 @@ int w_pickFileKinds(lua_State *L)
|
||||
typedef const char *(*GRUTF8)(id, SEL);
|
||||
const char *bytes = ((GRUTF8)objc_msgSend)(kinds,
|
||||
sel_registerName("UTF8String"));
|
||||
if (bytes == nullptr || bytes[0] == '\0')
|
||||
if (bytes == nullptr || bytes[0] == '\\0')
|
||||
{
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
@@ -358,6 +361,50 @@ def patch_public_documents():
|
||||
print("patch_love_src: iOS save directory routed to Documents root")
|
||||
|
||||
|
||||
def patch_ios_haptics():
|
||||
text = pristine(IOS_MM, ("UIImpactFeedbackGenerator",))
|
||||
original = """void vibrate()
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
}
|
||||
}
|
||||
"""
|
||||
replacement = """void vibrate(double seconds)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
UIImpactFeedbackStyle style = UIImpactFeedbackStyleLight;
|
||||
if (seconds >= 0.035)
|
||||
style = UIImpactFeedbackStyleHeavy;
|
||||
else if (seconds >= 0.02)
|
||||
style = UIImpactFeedbackStyleMedium;
|
||||
UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc]
|
||||
initWithStyle:style];
|
||||
[generator prepare];
|
||||
[generator impactOccurred];
|
||||
}
|
||||
}
|
||||
"""
|
||||
if original not in text:
|
||||
fail(f"iOS haptic anchor not found in {IOS_MM}")
|
||||
IOS_MM.write_text(text.replace(original, replacement, 1))
|
||||
|
||||
header = pristine(IOS_H, ("void vibrate(double seconds);",))
|
||||
header_original = "void vibrate();"
|
||||
if header_original not in header:
|
||||
fail(f"iOS haptic declaration not found in {IOS_H}")
|
||||
IOS_H.write_text(header.replace(header_original, "void vibrate(double seconds);", 1))
|
||||
|
||||
system = pristine(SYSTEM_CPP, ("love::ios::vibrate(seconds)",))
|
||||
system_original = "love::ios::vibrate();"
|
||||
if system_original not in system:
|
||||
fail(f"iOS haptic call site not found in {SYSTEM_CPP}")
|
||||
SYSTEM_CPP.write_text(system.replace(system_original, "love::ios::vibrate(seconds);", 1))
|
||||
print("patch_love_src: iOS haptics use Taptic Engine impact presets")
|
||||
|
||||
|
||||
def patch_pbxproj():
|
||||
text = pristine(PBXPROJ)
|
||||
|
||||
@@ -408,7 +455,9 @@ def patch_pbxproj():
|
||||
fail(f"build configuration {config_id} not found")
|
||||
settings = (
|
||||
"\t\t\t\tSWIFT_VERSION = 5.0;\n"
|
||||
"\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 14.0;\n"
|
||||
"\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.0;\n"
|
||||
"\t\t\t\tPRODUCT_NAME = \"gen1recomp++\";\n"
|
||||
"\t\t\t\tEXECUTABLE_NAME = \"gen1recomp++\";\n"
|
||||
'\t\t\t\tCODE_SIGN_ENTITLEMENTS = "ios/native/love-ios.entitlements";\n'
|
||||
)
|
||||
text = text[: m.end()] + settings + text[m.end():]
|
||||
@@ -422,6 +471,7 @@ def main():
|
||||
fail("love-src/ missing; run scripts/build_ios.sh --fetch first")
|
||||
copy_native_files()
|
||||
patch_public_documents()
|
||||
patch_ios_haptics()
|
||||
patch_wrap_system()
|
||||
patch_pbxproj()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user