mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-08-03 15:47:34 -04:00
Add iOS Port (#566)
* ✨ feat: add ios support * ⚗️ chore: trying some experiments to make ci working * ⚗️ chore: is it really ci version problem? * 💚 fix: it really is just a ci version issue * 🩹 fix: go as low as possible * 🩹 fix: support ipad
This commit is contained in:
parent
4446aaaf53
commit
9d8cb64a19
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -41,6 +41,7 @@ jobs:
|
||||
- { name: 'msys2 mingw32', os: 'windows-latest', generator: 'Ninja', dx5: false, config: false, mingw: true, werror: true, clang-tidy: true, msystem: 'mingw32', msys-env: 'mingw-w64-i686', shell: 'msys2 {0}' }
|
||||
- { name: 'msys2 mingw64', os: 'windows-latest', generator: 'Ninja', dx5: false, config: true, mingw: true, werror: true, clang-tidy: true, msystem: 'mingw64', msys-env: 'mingw-w64-x86_64', shell: 'msys2 {0}' }
|
||||
- { name: 'macOS', os: 'macos-latest', generator: 'Ninja', dx5: false, config: true, brew: true, werror: true, clang-tidy: false }
|
||||
- { name: 'iOS', os: 'macos-15', generator: 'Xcode', dx5: false, config: false, brew: true, werror: true, clang-tidy: false, cmake-args: '-DCMAKE_SYSTEM_NAME=iOS' }
|
||||
- { name: 'Emscripten', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' }
|
||||
- { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' }
|
||||
- { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true}
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR)
|
||||
|
||||
project(isle LANGUAGES CXX C VERSION 0.1)
|
||||
|
||||
if (IOS)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
|
||||
add_compile_definitions(IOS)
|
||||
endif()
|
||||
|
||||
if (WINDOWS_STORE)
|
||||
add_compile_definitions(WINDOWS_STORE)
|
||||
endif()
|
||||
@ -551,6 +557,11 @@ if (ISLE_BUILD_APP)
|
||||
ISLE/xbox_one_series/config.cpp
|
||||
)
|
||||
endif()
|
||||
if (IOS)
|
||||
target_sources(isle PRIVATE
|
||||
ISLE/ios/config.cpp
|
||||
)
|
||||
endif()
|
||||
if(Python3_FOUND)
|
||||
if(NOT DEFINED PYTHON_PIL_AVAILABLE)
|
||||
execute_process(
|
||||
@ -803,8 +814,12 @@ if(WINDOWS_STORE)
|
||||
PATTERN "*/*.msix"
|
||||
PATTERN "*/*.msixbundle")
|
||||
endif()
|
||||
if(MSVC)
|
||||
if(MSVC OR IOS)
|
||||
set(CPACK_GENERATOR ZIP)
|
||||
if(IOS)
|
||||
set(CPACK_ARCHIVE_FILE_EXTENSION ".ipa")
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
||||
endif()
|
||||
elseif(APPLE AND NOT IOS)
|
||||
set(CPACK_GENERATOR DragNDrop)
|
||||
else()
|
||||
|
25
ISLE/ios/config.cpp
Normal file
25
ISLE/ios/config.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
|
||||
void IOS_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for iOS");
|
||||
|
||||
// Use DevelopmentFiles path for disk and cd paths
|
||||
// It's good to use that path since user can easily
|
||||
// connect through SMB and copy the files
|
||||
const char* documentFolder = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS);
|
||||
char* diskPath = new char[strlen(documentFolder) + strlen("isle") + 1]();
|
||||
strcpy(diskPath, documentFolder);
|
||||
strcat(diskPath, "isle");
|
||||
|
||||
if (!SDL_GetPathInfo(diskPath, NULL)) {
|
||||
SDL_CreateDirectory(diskPath);
|
||||
}
|
||||
|
||||
iniparser_set(p_dictionary, "isle:diskpath", diskPath);
|
||||
iniparser_set(p_dictionary, "isle:cdpath", diskPath);
|
||||
}
|
8
ISLE/ios/config.h
Normal file
8
ISLE/ios/config.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef IOS_CONFIG_H
|
||||
#define IOS_CONFIG_H
|
||||
|
||||
#include "dictionary.h"
|
||||
|
||||
void IOS_SetupDefaultConfigOverrides(dictionary* p_dictionary);
|
||||
|
||||
#endif // IOS_CONFIG_H
|
@ -63,6 +63,10 @@
|
||||
#include "xbox_one_series/config.h"
|
||||
#endif
|
||||
|
||||
#ifdef IOS
|
||||
#include "ios/config.h"
|
||||
#endif
|
||||
|
||||
DECOMP_SIZE_ASSERT(IsleApp, 0x8c)
|
||||
|
||||
// GLOBAL: ISLE 0x410030
|
||||
@ -917,7 +921,11 @@ MxResult IsleApp::SetupWindow()
|
||||
// FUNCTION: ISLE 0x4028d0
|
||||
bool IsleApp::LoadConfig()
|
||||
{
|
||||
#ifdef IOS
|
||||
const char* prefPath = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS);
|
||||
#else
|
||||
char* prefPath = SDL_GetPrefPath("isledecomp", "isle");
|
||||
#endif
|
||||
char* iniConfig;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
@ -1000,6 +1008,9 @@ bool IsleApp::LoadConfig()
|
||||
#endif
|
||||
#ifdef WINDOWS_STORE
|
||||
XBONE_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
#ifdef IOS
|
||||
IOS_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
iniparser_dump_ini(dict, iniFP);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "New config written at '%s'", iniConfig);
|
||||
@ -1071,7 +1082,9 @@ bool IsleApp::LoadConfig()
|
||||
|
||||
iniparser_freedict(dict);
|
||||
delete[] iniConfig;
|
||||
#ifndef IOS
|
||||
SDL_free(prefPath);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -28,3 +28,7 @@ endif()
|
||||
if(APPLE AND NOT IOS)
|
||||
add_subdirectory(macos)
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
add_subdirectory(ios)
|
||||
endif()
|
||||
|
52
packaging/ios/CMakeLists.txt
Normal file
52
packaging/ios/CMakeLists.txt
Normal file
@ -0,0 +1,52 @@
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${APP_ID})
|
||||
set(MACOSX_BUNDLE_COPYRIGHT ${APP_SPDX})
|
||||
set(ISLE_TARGET_NAME isle)
|
||||
set(MACOSX_ISLE_BUNDLE_NAME ${APP_NAME}) # Do note that it can be up to 15 characters long
|
||||
set(MACOSX_ISLE_BUNDLE_DISPLAY_NAME ${APP_NAME})
|
||||
set(MACOSX_BUNDLE_INFO_STRING ${PROJECT_VERSION})
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
|
||||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
|
||||
set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${PROJECT_VERSION}")
|
||||
set(MACOSX_BUNDLE_REQUIRED_PLATFORM IPhoneOS)
|
||||
|
||||
if(ISLE_BUILD_APP)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/isle/Info.plist.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/isle/Info.plist"
|
||||
@ONLY
|
||||
)
|
||||
set(RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/isle/LaunchScreen.storyboard" "${CMAKE_CURRENT_SOURCE_DIR}/isle/Assets.xcassets")
|
||||
target_sources(${ISLE_TARGET_NAME} PRIVATE ${RESOURCE_FILES})
|
||||
set_source_files_properties(${RESOURCE_FILES}
|
||||
TARGET_DIRECTORY isle
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set_target_properties(${ISLE_TARGET_NAME} PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/isle/Info.plist"
|
||||
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
|
||||
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
|
||||
install(TARGETS ${ISLE_TARGET_NAME} DESTINATION ./)
|
||||
install(CODE "
|
||||
file(COPY
|
||||
\"\$<TARGET_FILE:SDL3::SDL3>\"
|
||||
\"\$<TARGET_FILE:lego1>\"
|
||||
DESTINATION \"\$\{CMAKE_INSTALL_PREFIX\}/${ISLE_TARGET_NAME}.app/Frameworks\")
|
||||
execute_process(COMMAND /usr/bin/install_name_tool
|
||||
-add_rpath @executable_path/Frameworks
|
||||
\"\$\{CMAKE_INSTALL_PREFIX\}/${ISLE_TARGET_NAME}.app/${ISLE_TARGET_NAME}\"
|
||||
)
|
||||
file(MAKE_DIRECTORY
|
||||
\"\$\{CMAKE_INSTALL_PREFIX\}/Payload\")
|
||||
file(RENAME
|
||||
\"\$\{CMAKE_INSTALL_PREFIX\}/${ISLE_TARGET_NAME}.app\"
|
||||
\"\$\{CMAKE_INSTALL_PREFIX\}/Payload/${ISLE_TARGET_NAME}.app\")
|
||||
")
|
||||
endif()
|
||||
|
||||
install(CODE "
|
||||
if(IS_DIRECTORY \"\$\{CMAKE_INSTALL_PREFIX\}/bin\" OR IS_DIRECTORY \"\$\{CMAKE_INSTALL_PREFIX\}/lib\" OR EXISTS \"\$\{CMAKE_INSTALL_PREFIX\}/AppIcon.icns\")
|
||||
execute_process(COMMAND /bin/rm
|
||||
-rf \"\$\{CMAKE_INSTALL_PREFIX\}/bin\" \"\$\{CMAKE_INSTALL_PREFIX\}/lib\" \"\$\{CMAKE_INSTALL_PREFIX\}/AppIcon.icns\"
|
||||
)
|
||||
endif()
|
||||
")
|
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,36 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "AppIcon.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
6
packaging/ios/isle/Assets.xcassets/Contents.json
Normal file
6
packaging/ios/isle/Assets.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
86
packaging/ios/isle/Info.plist.in
Normal file
86
packaging/ios/isle/Info.plist.in
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>@MACOSX_BUNDLE_INFO_STRING@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>@MACOSX_BUNDLE_GUI_IDENTIFIER@</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>@MACOSX_BUNDLE_LONG_VERSION_STRING@</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>@MACOSX_ISLE_BUNDLE_NAME@</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>@MACOSX_ISLE_BUNDLE_DISPLAY_NAME@</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@MACOSX_BUNDLE_SHORT_VERSION_STRING@</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@MACOSX_BUNDLE_BUNDLE_VERSION@</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequires@MACOSX_BUNDLE_REQUIRED_PLATFORM@</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>@MACOSX_BUNDLE_COPYRIGHT@</string>
|
||||
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
|
||||
<string>resource</string>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<true/>
|
||||
<key>UIFileSharingEnabled</key>
|
||||
<true/>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>iphoneos</string>
|
||||
<key>UIFileSharingEnabled</key>
|
||||
<true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
48
packaging/ios/isle/LaunchScreen.storyboard
Normal file
48
packaging/ios/isle/LaunchScreen.storyboard
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24093.7" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24053.1"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
|
||||
<rect key="frame" x="0.0" y="832" width="393" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
|
||||
<rect key="frame" x="0.0" y="285" width="393" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
|
||||
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
|
||||
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="SfN-ll-jLj"/>
|
||||
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
Loading…
x
Reference in New Issue
Block a user