Skip to content

Commit

Permalink
iOS: More fixes to enable running on iOS 12 (#16978)
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored Sep 8, 2024
1 parent 8562c16 commit d228c9d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 46 deletions.
3 changes: 2 additions & 1 deletion input/drivers/cocoa_input.m
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,8 @@ static void cocoa_input_grab_mouse(void *data, bool state)

apple->mouse_grabbed = state;

[[CocoaView get] setNeedsUpdateOfPrefersPointerLocked];
if (@available(iOS 14, *))
[[CocoaView get] setNeedsUpdateOfPrefersPointerLocked];
}
#endif

Expand Down
8 changes: 4 additions & 4 deletions pkg/apple/MouseEmulation/CocoaView+MouseSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ extension CocoaView {
}

open override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
mouseHandler.touchesBegan(touches: touches, event: event)
mouseHandler?.touchesBegan(touches: touches, event: event)
}

open override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
mouseHandler.touchesMoved(touches: touches)
mouseHandler?.touchesMoved(touches: touches)
}

open override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
mouseHandler.touchesCancelled(touches: touches, event: event)
mouseHandler?.touchesCancelled(touches: touches, event: event)
}

open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
mouseHandler.touchesEnded(touches: touches, event: event)
mouseHandler?.touchesEnded(touches: touches, event: event)
}

}
36 changes: 2 additions & 34 deletions pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@
0753AD1A2C86144200874A42 /* BaseConfig.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 0753AD182C86144200874A42 /* BaseConfig.xcconfig */; };
076CA50D2B695C2C00840EA5 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 076CA50C2B695C2C00840EA5 /* libz.tbd */; };
0789FC302A07847E00D042B7 /* AltKit in Frameworks */ = {isa = PBXBuildFile; productRef = 0789FC2F2A07847E00D042B7 /* AltKit */; };
077D61D42C8CCF7400E492B4 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9292D6E428F549D000E47A75 /* SwiftUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
07B7872D29E8FE8F0088B74F /* filters in Resources */ = {isa = PBXBuildFile; fileRef = 07B7872C29E8FE8F0088B74F /* filters */; };
07F7FB022A2DA8B800037C04 /* filters in Resources */ = {isa = PBXBuildFile; fileRef = 07F7FB012A2DA8B800037C04 /* filters */; };
07FA26C82BD8B2FB00E1AF91 /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07FA26C62BD8B2EA00E1AF91 /* MoltenVK.xcframework */; };
07FA26C92BD8B2FB00E1AF91 /* MoltenVK.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 07FA26C62BD8B2EA00E1AF91 /* MoltenVK.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
07FA26CA2BD8B74900E1AF91 /* MoltenVK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07FA26C62BD8B2EA00E1AF91 /* MoltenVK.xcframework */; };
07FA26CB2BD8B74900E1AF91 /* MoltenVK.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 07FA26C62BD8B2EA00E1AF91 /* MoltenVK.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9204BE0D1D319EF300BD49DB /* griffin_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 50521A431AA23BF500185CC9 /* griffin_objc.m */; };
9204BE101D319EF300BD49DB /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = 501232C9192E5FC40063A359 /* griffin.c */; settings = {COMPILER_FLAGS = "-include $(DERIVED_FILE_DIR)/git_version.h"; }; };
9204BE121D319EF300BD49DB /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5040F04F1AE47ED4006F6972 /* libz.dylib */; };
Expand Down Expand Up @@ -161,28 +158,6 @@
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
07FA26C52BD8B01400E1AF91 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
07FA26C92BD8B2FB00E1AF91 /* MoltenVK.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
07FA26CC2BD8B74900E1AF91 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
07FA26CB2BD8B74900E1AF91 /* MoltenVK.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
9292D6F528F549D500E47A75 /* Embed Foundation Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -211,9 +186,7 @@
077AB2C82BFB0E28002BBE2F /* AppStore.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = AppStore.xcconfig; path = iOS/AppStore.xcconfig; sourceTree = "<group>"; };
0789FC2E2A07845300D042B7 /* AltKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = AltKit; path = Frameworks/AltKit; sourceTree = "<group>"; };
07B7872C29E8FE8F0088B74F /* filters */ = {isa = PBXFileReference; lastKnownFileType = folder; path = filters; sourceTree = "<group>"; };
07BC17D12BD2ACAE0005A0F2 /* MoltenVK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MoltenVK.framework; path = tvOS/Frameworks/MoltenVK.framework; sourceTree = "<group>"; };
07F7FB012A2DA8B800037C04 /* filters */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = filters; path = iOS/filters; sourceTree = SOURCE_ROOT; };
07FA26C62BD8B2EA00E1AF91 /* MoltenVK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MoltenVK.xcframework; path = Frameworks/MoltenVK.xcframework; sourceTree = "<group>"; };
501232C9192E5FC40063A359 /* griffin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = griffin.c; path = ../../griffin/griffin.c; sourceTree = SOURCE_ROOT; };
501881EB184BAD6D006F665D /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
501881ED184BB54C006F665D /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -517,12 +490,12 @@
92CC05C521FEDC9F00FF79F0 /* CFNetwork.framework in Frameworks */,
9204BE121D319EF300BD49DB /* libz.dylib in Frameworks */,
9204BE131D319EF300BD49DB /* QuartzCore.framework in Frameworks */,
077D61D42C8CCF7400E492B4 /* SwiftUI.framework in Frameworks */,
9204BE141D319EF300BD49DB /* GameController.framework in Frameworks */,
9204BE151D319EF300BD49DB /* CoreText.framework in Frameworks */,
9204BE161D319EF300BD49DB /* CoreLocation.framework in Frameworks */,
9204BE171D319EF300BD49DB /* CoreMedia.framework in Frameworks */,
9204BE181D319EF300BD49DB /* AVFoundation.framework in Frameworks */,
07FA26C82BD8B2FB00E1AF91 /* MoltenVK.xcframework in Frameworks */,
9204BE191D319EF300BD49DB /* CoreVideo.framework in Frameworks */,
070A88432A4E7AA9003161C0 /* OpenAL.framework in Frameworks */,
9204BE1A1D319EF300BD49DB /* AudioToolbox.framework in Frameworks */,
Expand All @@ -543,7 +516,6 @@
076CA50D2B695C2C00840EA5 /* libz.tbd in Frameworks */,
926C77F121FD26E800103EDE /* GameController.framework in Frameworks */,
926C77EF21FD263800103EDE /* AudioToolbox.framework in Frameworks */,
07FA26CA2BD8B74900E1AF91 /* MoltenVK.xcframework in Frameworks */,
073734A62A093ACA00BF7397 /* AltKit in Frameworks */,
0718BC632ABBAFB6001F2CBE /* Network.framework in Frameworks */,
);
Expand Down Expand Up @@ -1256,12 +1228,10 @@
96AFAE2816C1D4EA009DE44C /* Frameworks */ = {
isa = PBXGroup;
children = (
07FA26C62BD8B2EA00E1AF91 /* MoltenVK.xcframework */,
076CA50C2B695C2C00840EA5 /* libz.tbd */,
0718BC5F2ABBA807001F2CBE /* Network.framework */,
070A88422A4E7AA9003161C0 /* OpenAL.framework */,
9210C2F124B3A19100E6FE7C /* Metal.framework */,
07BC17D12BD2ACAE0005A0F2 /* MoltenVK.framework */,
9210C2F024B3A19100E6FE7C /* MetalKit.framework */,
92CC05C621FEDD0B00FF79F0 /* MobileCoreServices.framework */,
92CC05C421FEDC9F00FF79F0 /* CFNetwork.framework */,
Expand Down Expand Up @@ -1348,7 +1318,6 @@
9204BE271D319EF300BD49DB /* ShellScript */,
9204BE211D319EF300BD49DB /* Resources */,
9292D6F528F549D500E47A75 /* Embed Foundation Extensions */,
07FA26C52BD8B01400E1AF91 /* Embed Frameworks */,
);
buildRules = (
);
Expand All @@ -1373,7 +1342,6 @@
92CC057521FE2D4900FF79F0 /* ShellScript */,
926C77D521FD1E6500103EDE /* Resources */,
0712A77B2B807AE400C9765F /* Embed Foundation Extensions */,
07FA26CC2BD8B74900E1AF91 /* Embed Frameworks */,
);
buildRules = (
);
Expand Down
26 changes: 23 additions & 3 deletions pkg/apple/make-frameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ fi
echo "Identity:"
echo "${CODE_SIGN_IDENTITY_FOR_ITEMS}"

if [ "$1" = "tvos" ] ; then
if [ "$PLATFORM_FAMILY_NAME" = "tvOS" ] ; then
BASE_DIR="tvOS"
SUFFIX="_tvos"
else
elif [ "$PLATFORM_FAMILY_NAME" = "iOS" ] ; then
BASE_DIR="iOS"
SUFFIX="_ios"
elif [ "$PLATFORM_FAMILY_NAME" = "macOS" ] ; then
BASE_DIR="OSX"
SUFFIX=
fi

if [ -n "$BUILT_PRODUCTS_DIR" -a -n "$FRAMEWORKS_FOLDER_PATH" ] ; then
Expand All @@ -29,7 +32,9 @@ mkdir -p "$OUTDIR"
for dylib in $(find "$BASE_DIR"/modules -maxdepth 1 -type f -regex '.*libretro.*\.dylib$') ; do
intermediate=$(basename "$dylib")
intermediate="${intermediate/%.dylib/}"
intermediate="${intermediate/%$SUFFIX/}"
if [ -n "$SUFFIX" ] ; then
intermediate="${intermediate/%$SUFFIX/}"
fi
fwName="${intermediate//_/.}"
echo Making framework $fwName from $dylib

Expand All @@ -40,3 +45,18 @@ for dylib in $(find "$BASE_DIR"/modules -maxdepth 1 -type f -regex '.*libretro.*
echo "signing $fwName"
codesign --force --verbose --sign "${CODE_SIGN_IDENTITY_FOR_ITEMS}" "$fwDir"
done

# Copy in MoltenVK as an embedded library manually instead of having
# Xcode do it. This makes it potentially easier to substitute out
# MoltenVK, have it provided outside the repo, or have different
# MoltenVK builds for different OS versions.

if [ -z "${MOLTENVK_XCFRAMEWORK}" ] ; then
MOLTENVK_XCFRAMEWORK="${SRCROOT}/Frameworks/MoltenVK.xcframework"
fi
MVK_PLATFORM_SUBDIR="${SWIFT_PLATFORM_TARGET_PREFIX}-$(echo $ARCHS_STANDARD_64_BIT | sed -e 's/ /_/g')${LLVM_TARGET_TRIPLE_SUFFIX}"
if [ -d "${MOLTENVK_XCFRAMEWORK}/${MVK_PLATFORM_SUBDIR}/MoltenVK.framework" ] ; then
echo copying moltenvk from "${MOLTENVK_XCFRAMEWORK}/${MVK_PLATFORM_SUBDIR}/MoltenVK.framework"
cp -r "${MOLTENVK_XCFRAMEWORK}/${MVK_PLATFORM_SUBDIR}/MoltenVK.framework" "${OUTDIR}"
codesign --force --verbose --sign "${CODE_SIGN_IDENTITY_FOR_ITEMS}" "${OUTDIR}/MoltenVK.framework"
fi
11 changes: 7 additions & 4 deletions ui/drivers/cocoa/cocoa_common.m
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,12 @@ -(void)viewDidLoad {
swipe.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:swipe];
#ifdef HAVE_IOS_TOUCHMOUSE
[self setupMouseSupport];
if (@available(iOS 13, *))
[self setupMouseSupport];
#endif
#ifdef HAVE_IOS_CUSTOMKEYBOARD
[self setupEmulatorKeyboard];
if (@available(iOS 13, *))
[self setupEmulatorKeyboard];
UISwipeGestureRecognizer *showKeyboardSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(toggleCustomKeyboardUsingSwipe:)];
showKeyboardSwipe.numberOfTouchesRequired = 3;
showKeyboardSwipe.direction = UISwipeGestureRecognizerDirectionUp;
Expand All @@ -650,8 +652,9 @@ -(void)viewDidLoad {
hideKeyboardSwipe.delegate = self;
[self.view addGestureRecognizer:hideKeyboardSwipe];
#endif
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
[self setupHelperBar];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13, *))
[self setupHelperBar];
#endif
#elif TARGET_OS_TV
UISwipeGestureRecognizer *siriSwipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSiriSwipe:)];
Expand Down

0 comments on commit d228c9d

Please sign in to comment.