Manic EMU is an all-in-one retro game emulator for iOS. It packs powerful features while keeping a clean, sleek UI and delivering buttery-smooth gameplay.
Swift
Integrated StikJIT; Fixed the issue where PPSSPP's SoftGPU incorrectly took the JIT path;
Daiunob65ed1ed698e
diff --git a/.gitmodules b/.gitmodulesindex 946d723d..597188b9 100644--- a/.gitmodules+++ b/.gitmodules@@ -32,3 +32,7 @@url = https://github.com/Daiuno/ProHUD.gitbranch = mainignore = all+[submodule "StikJIT"]+ path = StikJIT+ url = https://github.com/StephenDev0/StikJIT.git+ ignore = alldiff --git a/Cores/azahar.libretro.framework/azahar.libretro b/Cores/azahar.libretro.framework/azahar.libretroindex bf6c67ef..2d118c00 100755--- a/Cores/azahar.libretro.framework/azahar.libretro+++ b/Cores/azahar.libretro.framework/azahar.libretro@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:e0c4c480359a7bb3a8fff3a1417432da218c91be1af00319e16324530449d81e-size 27800544+oid sha256:183159290d777d42a68c17f5f4d90d8b88f7aa0281e4788bad4e5954a6df940c+size 27797040diff --git a/Cores/ppsspp.libretro.framework/ppsspp.libretro b/Cores/ppsspp.libretro.framework/ppsspp.libretroindex 405d203f..64149b6d 100755--- a/Cores/ppsspp.libretro.framework/ppsspp.libretro+++ b/Cores/ppsspp.libretro.framework/ppsspp.libretro@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:43ce1598e2f8ec96b0e81f5eefd5ae7337e6ee0f3e54b61ea4db3f4093df7a63-size 15554112+oid sha256:1af95c96eb7cb00da49a6ed07660ab6d0348256ba68f039899d52d0442e14e1b+size 15554256diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxprojindex 68783586..0e92239f 100644--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj@@ -1424,6 +1424,39 @@57E38E9B2D8C74FC001616D3 /* PermissionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E38E9A2D8C74F9001616D3 /* PermissionKit.swift */; };57E48D912D8D736B008000A3 /* ConfettiSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 57E48D902D8D736B008000A3 /* ConfettiSwiftUI */; };57E48D932D8D73AD008000A3 /* CheersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E48D922D8D7395008000A3 /* CheersView.swift */; };+ 57E8A110304A4A110000000D /* JITEnabler.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000001 /* JITEnabler.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };+ 57E8A110304A4A110000005A /* BundledScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000003C /* BundledScript.swift */; };+ 57E8A110304A4A110000005B /* DDISession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000003D /* DDISession.swift */; };+ 57E8A110304A4A110000005C /* DeveloperDiskImageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000003E /* DeveloperDiskImageService.swift */; };+ 57E8A110304A4A110000005D /* EndpointProbe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000003F /* EndpointProbe.swift */; };+ 57E8A110304A4A110000005E /* IdeviceFFI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000040 /* IdeviceFFI.swift */; };+ 57E8A110304A4A110000005F /* JITSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000041 /* JITSession.swift */; };+ 57E8A110304A4A1100000060 /* ProcessInfo+TXM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000042 /* ProcessInfo+TXM.swift */; };+ 57E8A110304A4A1100000061 /* ScriptRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000043 /* ScriptRunner.swift */; };+ 57E8A110304A4A1100000062 /* StikJIT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000044 /* StikJIT.swift */; };+ 57E8A110304A4A1100000063 /* StikJITError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000045 /* StikJITError.swift */; };+ 57E8A110304A4A1100000064 /* SynchronousDDIDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000046 /* SynchronousDDIDownloader.swift */; };+ 57E8A110304A4A110000006E /* JITEnablerRequestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000001E /* JITEnablerRequestHandler.swift */; };+ 57E8A110304A4A110000006F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000001F /* main.m */; };+ 57E8A110304A4A1100000070 /* universal.js in Resources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000050 /* universal.js */; };+ 57E8A110304A4A1100000071 /* legacy.js in Resources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000051 /* legacy.js */; };+ 57E8A110304A4A1100000072 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000032 /* JavaScriptCore.framework */; };+ 57E8A110304A4A1100000073 /* Network.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000033 /* Network.framework */; };+ 57E8A110304A4A1100000074 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000034 /* Security.framework */; };+ 57E8A110304A4A1100000075 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000035 /* CFNetwork.framework */; };+ 57E8A110304A4A1100000076 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000036 /* SystemConfiguration.framework */; };+ 57E8A110304A4A1100000077 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000037 /* IOKit.framework */; };+ 57E8A110304A4A1100000082 /* StikJITXPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000028 /* StikJITXPC.swift */; };+ 57E8A110304A4A1100000083 /* EntitlementChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000029 /* EntitlementChecker.swift */; };+ 57E8A110304A4A1100000084 /* StikJITManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000002A /* StikJITManager.swift */; };+ 57E8A110304A4A1100000085 /* StikJITExtensionLauncher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000002B /* StikJITExtensionLauncher.swift */; };+ 57E8A110304A4A1100000086 /* StikJITHostCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000002C /* StikJITHostCoordinator.swift */; };+ 57E8A110304A4A110000008C /* StikJITXPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000028 /* StikJITXPC.swift */; };+ 57E8A110304A4A110000008D /* EntitlementChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000029 /* EntitlementChecker.swift */; };+ 57E8A110304A4A110000008E /* StikJITManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000002A /* StikJITManager.swift */; };+ 57E8A110304A4A110000008F /* StikJITExtensionLauncher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000002B /* StikJITExtensionLauncher.swift */; };+ 57E8A110304A4A1100000090 /* StikJITHostCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A110000002C /* StikJITHostCoordinator.swift */; };+ 57E8A110304A4A11000000A1 /* JITEnabler.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 57E8A110304A4A1100000001 /* JITEnabler.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };57E8B0822E1CDB8B00F93E60 /* GB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8B0812E1CDB8800F93E60 /* GB.swift */; };57E8B1022E2366DC00F93E60 /* BIOSItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8B1012E2366D800F93E60 /* BIOSItem.swift */; };57E8B18D2E2553CE00F93E60 /* HomeMenuImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E8B18A2E2553CC00F93E60 /* HomeMenuImage.swift */; };@@ -1609,6 +1642,20 @@remoteGlobalIDString = 57BFBE162DD32F7700AABF98;remoteInfo = Libretro;};+ 57E8A110304A4A1100000008 /* PBXContainerItemProxy */ = {+ isa = PBXContainerItemProxy;+ containerPortal = A5A001E724555A5F006E0F0E /* Project object */;+ proxyType = 1;+ remoteGlobalIDString = 57E8A110304A4A1100000003;+ remoteInfo = JITEnabler;+ };+ 57E8A110304A4A11000000A2 /* PBXContainerItemProxy */ = {+ isa = PBXContainerItemProxy;+ containerPortal = A5A001E724555A5F006E0F0E /* Project object */;+ proxyType = 1;+ remoteGlobalIDString = 57E8A110304A4A1100000003;+ remoteInfo = JITEnabler;+ };/* End PBXContainerItemProxy section *//* Begin PBXCopyFilesBuildPhase section */@@ -1618,6 +1665,7 @@dstPath = "";dstSubfolderSpec = 13;files = (+ 57E8A110304A4A110000000D /* JITEnabler.appex in Embed Foundation Extensions */,);name = "Embed Foundation Extensions";runOnlyForDeploymentPostprocessing = 0;@@ -1681,6 +1729,7 @@dstPath = "";dstSubfolderSpec = 13;files = (+ 57E8A110304A4A11000000A1 /* JITEnabler.appex in Embed Foundation Extensions */,);name = "Embed Foundation Extensions";runOnlyForDeploymentPostprocessing = 0;@@ -6524,6 +6573,37 @@57E0CCC62D9075110027FB8C /* file_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = file_icon.png; sourceTree = "<group>"; };57E38E9A2D8C74F9001616D3 /* PermissionKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionKit.swift; sourceTree = "<group>"; };57E48D922D8D7395008000A3 /* CheersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheersView.swift; sourceTree = "<group>"; };+ 57E8A110304A4A1100000001 /* JITEnabler.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = JITEnabler.appex; sourceTree = BUILT_PRODUCTS_DIR; };+ 57E8A110304A4A1100000002 /* JITEnablerExtension.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = JITEnablerExtension.xcconfig; sourceTree = "<group>"; };+ 57E8A110304A4A110000001E /* JITEnablerRequestHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JITEnablerRequestHandler.swift; sourceTree = "<group>"; };+ 57E8A110304A4A110000001F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };+ 57E8A110304A4A1100000020 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };+ 57E8A110304A4A1100000021 /* JITEnablerExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = JITEnablerExtension.entitlements; sourceTree = "<group>"; };+ 57E8A110304A4A1100000028 /* StikJITXPC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StikJITXPC.swift; sourceTree = "<group>"; };+ 57E8A110304A4A1100000029 /* EntitlementChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntitlementChecker.swift; sourceTree = "<group>"; };+ 57E8A110304A4A110000002A /* StikJITManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StikJITManager.swift; sourceTree = "<group>"; };+ 57E8A110304A4A110000002B /* StikJITExtensionLauncher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StikJITExtensionLauncher.swift; sourceTree = "<group>"; };+ 57E8A110304A4A110000002C /* StikJITHostCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StikJITHostCoordinator.swift; sourceTree = "<group>"; };+ 57E8A110304A4A1100000032 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };+ 57E8A110304A4A1100000033 /* Network.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Network.framework; path = System/Library/Frameworks/Network.framework; sourceTree = SDKROOT; };+ 57E8A110304A4A1100000034 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };+ 57E8A110304A4A1100000035 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };+ 57E8A110304A4A1100000036 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };+ 57E8A110304A4A1100000037 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };+ 57E8A110304A4A1100000038 /* libidevice_ffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libidevice_ffi.a; path = ../StikJIT/idevice/libidevice_ffi.a; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A110000003C /* BundledScript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BundledScript.swift; path = ../StikJIT/Sources/BundledScript.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A110000003D /* DDISession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DDISession.swift; path = ../StikJIT/Sources/DDISession.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A110000003E /* DeveloperDiskImageService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DeveloperDiskImageService.swift; path = ../StikJIT/Sources/DeveloperDiskImageService.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A110000003F /* EndpointProbe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EndpointProbe.swift; path = ../StikJIT/Sources/EndpointProbe.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000040 /* IdeviceFFI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = IdeviceFFI.swift; path = ../StikJIT/Sources/IdeviceFFI.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000041 /* JITSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = JITSession.swift; path = ../StikJIT/Sources/JITSession.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000042 /* ProcessInfo+TXM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "ProcessInfo+TXM.swift"; path = "../StikJIT/Sources/ProcessInfo+TXM.swift"; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000043 /* ScriptRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ScriptRunner.swift; path = ../StikJIT/Sources/ScriptRunner.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000044 /* StikJIT.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = StikJIT.swift; path = ../StikJIT/Sources/StikJIT.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000045 /* StikJITError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = StikJITError.swift; path = ../StikJIT/Sources/StikJITError.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000046 /* SynchronousDDIDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SynchronousDDIDownloader.swift; path = ../StikJIT/Sources/SynchronousDDIDownloader.swift; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000050 /* universal.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = universal.js; path = ../StikJIT/Resources/universal.js; sourceTree = SOURCE_ROOT; };+ 57E8A110304A4A1100000051 /* legacy.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = legacy.js; path = ../StikJIT/Resources/legacy.js; sourceTree = SOURCE_ROOT; };57E8B0812E1CDB8800F93E60 /* GB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GB.swift; sourceTree = "<group>"; };57E8B1012E2366D800F93E60 /* BIOSItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BIOSItem.swift; sourceTree = "<group>"; };57E8B18A2E2553CC00F93E60 /* HomeMenuImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeMenuImage.swift; sourceTree = "<group>"; };@@ -6777,6 +6857,19 @@);runOnlyForDeploymentPostprocessing = 0;};+ 57E8A110304A4A110000000B /* Frameworks */ = {+ isa = PBXFrameworksBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 57E8A110304A4A1100000072 /* JavaScriptCore.framework in Frameworks */,+ 57E8A110304A4A1100000073 /* Network.framework in Frameworks */,+ 57E8A110304A4A1100000074 /* Security.framework in Frameworks */,+ 57E8A110304A4A1100000075 /* CFNetwork.framework in Frameworks */,+ 57E8A110304A4A1100000076 /* SystemConfiguration.framework in Frameworks */,+ 57E8A110304A4A1100000077 /* IOKit.framework in Frameworks */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };A5A001EC24555A5F006E0F0E /* Frameworks */ = {isa = PBXFrameworksBuildPhase;buildActionMask = 2147483647;@@ -12639,6 +12732,60 @@path = CheatCode;sourceTree = "<group>";};+ 57E8A110304A4A1100000014 /* JIT */ = {+ isa = PBXGroup;+ children = (+ 57E8A110304A4A1100000028 /* StikJITXPC.swift */,+ 57E8A110304A4A1100000029 /* EntitlementChecker.swift */,+ 57E8A110304A4A110000002A /* StikJITManager.swift */,+ 57E8A110304A4A110000002B /* StikJITExtensionLauncher.swift */,+ 57E8A110304A4A110000002C /* StikJITHostCoordinator.swift */,+ 57E8A110304A4A1100000015 /* JITEnablerExtension */,+ 57E8A110304A4A1100000016 /* StikJIT Sources */,+ 57E8A110304A4A1100000017 /* StikJIT Resources */,+ );+ path = JIT;+ sourceTree = "<group>";+ };+ 57E8A110304A4A1100000015 /* JITEnablerExtension */ = {+ isa = PBXGroup;+ children = (+ 57E8A110304A4A110000001E /* JITEnablerRequestHandler.swift */,+ 57E8A110304A4A110000001F /* main.m */,+ 57E8A110304A4A1100000020 /* Info.plist */,+ 57E8A110304A4A1100000021 /* JITEnablerExtension.entitlements */,+ );+ path = JITEnablerExtension;+ sourceTree = "<group>";+ };+ 57E8A110304A4A1100000016 /* StikJIT Sources */ = {+ isa = PBXGroup;+ children = (+ 57E8A110304A4A110000003C /* BundledScript.swift */,+ 57E8A110304A4A110000003D /* DDISession.swift */,+ 57E8A110304A4A110000003E /* DeveloperDiskImageService.swift */,+ 57E8A110304A4A110000003F /* EndpointProbe.swift */,+ 57E8A110304A4A1100000040 /* IdeviceFFI.swift */,+ 57E8A110304A4A1100000041 /* JITSession.swift */,+ 57E8A110304A4A1100000042 /* ProcessInfo+TXM.swift */,+ 57E8A110304A4A1100000043 /* ScriptRunner.swift */,+ 57E8A110304A4A1100000044 /* StikJIT.swift */,+ 57E8A110304A4A1100000045 /* StikJITError.swift */,+ 57E8A110304A4A1100000046 /* SynchronousDDIDownloader.swift */,+ );+ name = "StikJIT Sources";+ sourceTree = "<group>";+ };+ 57E8A110304A4A1100000017 /* StikJIT Resources */ = {+ isa = PBXGroup;+ children = (+ 57E8A110304A4A1100000050 /* universal.js */,+ 57E8A110304A4A1100000051 /* legacy.js */,+ 57E8A110304A4A1100000038 /* libidevice_ffi.a */,+ );+ name = "StikJIT Resources";+ sourceTree = "<group>";+ };57E962ED2D69F4830022914C /* History */ = {isa = PBXGroup;children = (@@ -12897,6 +13044,7 @@children = (57F0D8402DE2CD7500760F57 /* Cores */,F0C5000000000000000000FF /* FocusKit */,+ 57E8A110304A4A1100000014 /* JIT */,A5A69BA9256E56FF00D51C09 /* Others */,A5DE1F73256BDE140099425B /* Extensions */,);@@ -12923,6 +13071,7 @@57B5917A2FD06468003C4235 /* ManicEmuTV.app */,57CDCF792FD5CBD3005BA4C8 /* ManicEmuDebug.app */,5790958B303C7D9100A53656 /* ManicEmuSideload.app */,+ 57E8A110304A4A1100000001 /* JITEnabler.appex */,);name = Products;sourceTree = "<group>";@@ -12950,6 +13099,7 @@57BA45C12D1B235400BCA5E1 /* Config-Base.xcconfig */,B2C97B572A0A423B00053A4C /* Config-Release.xcconfig */,575A3A422DCEE9F300B28FC2 /* Config-SideloadRelease.xcconfig */,+ 57E8A110304A4A1100000002 /* JITEnablerExtension.xcconfig */,57C7595C2FD451130093A2B3 /* System.core */,);path = Resources;@@ -13089,6 +13239,12 @@576F0DB52D86796100D2A1BA /* StoreKit.framework */,B28EB6C32A6E75B700086CDB /* WidgetKit.framework */,B28EB6C52A6E75B700086CDB /* SwiftUI.framework */,+ 57E8A110304A4A1100000032 /* JavaScriptCore.framework */,+ 57E8A110304A4A1100000033 /* Network.framework */,+ 57E8A110304A4A1100000034 /* Security.framework */,+ 57E8A110304A4A1100000035 /* CFNetwork.framework */,+ 57E8A110304A4A1100000036 /* SystemConfiguration.framework */,+ 57E8A110304A4A1100000037 /* IOKit.framework */,);name = Frameworks;sourceTree = "<group>";@@ -13143,9 +13299,10 @@dependencies = (57909381303C7D9100A53656 /* PBXTargetDependency */,57909382303C7D9100A53656 /* PBXTargetDependency */,+ 57E8A110304A4A1100000009 /* PBXTargetDependency */,);name = ManicEmuSideload;- productName = EmojiWorld;+ productName = ManicEMU;productReference = 5790958B303C7D9100A53656 /* ManicEmuSideload.app */;productType = "com.apple.product-type.application";};@@ -13208,12 +13365,30 @@dependencies = (57CDCD882FD5CBD3005BA4C8 /* PBXTargetDependency */,57CDCD892FD5CBD3005BA4C8 /* PBXTargetDependency */,+ 57E8A110304A4A11000000A3 /* PBXTargetDependency */,);name = ManicEmuDebug;- productName = EmojiWorld;+ productName = ManicEMU;productReference = 57CDCF792FD5CBD3005BA4C8 /* ManicEmuDebug.app */;productType = "com.apple.product-type.application";};+ 57E8A110304A4A1100000003 /* JITEnabler */ = {+ isa = PBXNativeTarget;+ buildConfigurationList = 57E8A110304A4A1100000004 /* Build configuration list for PBXNativeTarget "JITEnabler" */;+ buildPhases = (+ 57E8A110304A4A110000000A /* Sources */,+ 57E8A110304A4A110000000B /* Frameworks */,+ 57E8A110304A4A110000000C /* Resources */,+ );+ buildRules = (+ );+ dependencies = (+ );+ name = JITEnabler;+ productName = JITEnabler;+ productReference = 57E8A110304A4A1100000001 /* JITEnabler.appex */;+ productType = "com.apple.product-type.app-extension";+ };A5A001EE24555A5F006E0F0E /* ManicEmuRelease */ = {isa = PBXNativeTarget;buildConfigurationList = A5A0020324555A5F006E0F0E /* Build configuration list for PBXNativeTarget "ManicEmuRelease" */;@@ -13233,7 +13408,7 @@57BFBEB12DD489C700AABF98 /* PBXTargetDependency */,);name = ManicEmuRelease;- productName = EmojiWorld;+ productName = ManicEMU;productReference = A5A001EF24555A5F006E0F0E /* ManicEmu.app */;productType = "com.apple.product-type.application";};@@ -13254,6 +13429,9 @@57BFBE162DD32F7700AABF98 = {CreatedOnToolsVersion = 16.2;};+ 57E8A110304A4A1100000003 = {+ CreatedOnToolsVersion = 16.0;+ };A5A001EE24555A5F006E0F0E = {CreatedOnToolsVersion = 11.2.1;};@@ -13373,6 +13551,7 @@57909380303C7D9100A53656 /* ManicEmuSideload */,57B591792FD06468003C4235 /* ManicEmuTV */,57BFBE162DD32F7700AABF98 /* Libretro */,+ 57E8A110304A4A1100000003 /* JITEnabler */,);};/* End PBXProject section */@@ -13420,6 +13599,15 @@);runOnlyForDeploymentPostprocessing = 0;};+ 57E8A110304A4A110000000C /* Resources */ = {+ isa = PBXResourcesBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 57E8A110304A4A1100000070 /* universal.js in Resources */,+ 57E8A110304A4A1100000071 /* legacy.js in Resources */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };A5A001ED24555A5F006E0F0E /* Resources */ = {isa = PBXResourcesBuildPhase;buildActionMask = 2147483647;@@ -13887,6 +14075,11 @@57909514303C7D9100A53656 /* Bimap.swift in Sources */,57909515303C7D9100A53656 /* VB.swift in Sources */,57909516303C7D9100A53656 /* DOOM.swift in Sources */,+ 57E8A110304A4A1100000082 /* StikJITXPC.swift in Sources */,+ 57E8A110304A4A1100000083 /* EntitlementChecker.swift in Sources */,+ 57E8A110304A4A1100000084 /* StikJITManager.swift in Sources */,+ 57E8A110304A4A1100000085 /* StikJITExtensionLauncher.swift in Sources */,+ 57E8A110304A4A1100000086 /* StikJITHostCoordinator.swift in Sources */,);runOnlyForDeploymentPostprocessing = 0;};@@ -14337,6 +14530,31 @@57D942CD302F1EC000C06208 /* Bimap.swift in Sources */,57CDCF0A2FD5CBD3005BA4C8 /* VB.swift in Sources */,57CDCF0B2FD5CBD3005BA4C8 /* DOOM.swift in Sources */,+ 57E8A110304A4A110000008C /* StikJITXPC.swift in Sources */,+ 57E8A110304A4A110000008D /* EntitlementChecker.swift in Sources */,+ 57E8A110304A4A110000008E /* StikJITManager.swift in Sources */,+ 57E8A110304A4A110000008F /* StikJITExtensionLauncher.swift in Sources */,+ 57E8A110304A4A1100000090 /* StikJITHostCoordinator.swift in Sources */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+ 57E8A110304A4A110000000A /* Sources */ = {+ isa = PBXSourcesBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 57E8A110304A4A110000005A /* BundledScript.swift in Sources */,+ 57E8A110304A4A110000005B /* DDISession.swift in Sources */,+ 57E8A110304A4A110000005C /* DeveloperDiskImageService.swift in Sources */,+ 57E8A110304A4A110000005D /* EndpointProbe.swift in Sources */,+ 57E8A110304A4A110000005E /* IdeviceFFI.swift in Sources */,+ 57E8A110304A4A110000005F /* JITSession.swift in Sources */,+ 57E8A110304A4A1100000060 /* ProcessInfo+TXM.swift in Sources */,+ 57E8A110304A4A1100000061 /* ScriptRunner.swift in Sources */,+ 57E8A110304A4A1100000062 /* StikJIT.swift in Sources */,+ 57E8A110304A4A1100000063 /* StikJITError.swift in Sources */,+ 57E8A110304A4A1100000064 /* SynchronousDDIDownloader.swift in Sources */,+ 57E8A110304A4A110000006E /* JITEnablerRequestHandler.swift in Sources */,+ 57E8A110304A4A110000006F /* main.m in Sources */,);runOnlyForDeploymentPostprocessing = 0;};@@ -14787,6 +15005,16 @@target = 57BFBE162DD32F7700AABF98 /* Libretro */;targetProxy = 57CDCD8A2FD5CBD3005BA4C8 /* PBXContainerItemProxy */;};+ 57E8A110304A4A1100000009 /* PBXTargetDependency */ = {+ isa = PBXTargetDependency;+ target = 57E8A110304A4A1100000003 /* JITEnabler */;+ targetProxy = 57E8A110304A4A1100000008 /* PBXContainerItemProxy */;+ };+ 57E8A110304A4A11000000A3 /* PBXTargetDependency */ = {+ isa = PBXTargetDependency;+ target = 57E8A110304A4A1100000003 /* JITEnabler */;+ targetProxy = 57E8A110304A4A11000000A2 /* PBXContainerItemProxy */;+ };/* End PBXTargetDependency section *//* Begin PBXVariantGroup section */@@ -14962,8 +15190,9 @@};575A3A3F2DCEE98500B28FC2 /* SideloadRelease */ = {isa = XCBuildConfiguration;- baseConfigurationReference = 575A3A422DCEE9F300B28FC2 /* Config-SideloadRelease.xcconfig */;+ baseConfigurationReference = B2C97B572A0A423B00053A4C /* Config-Release.xcconfig */;buildSettings = {+ APP_BUILD_CONDITIONS = "";ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES = "AppIcon_Dark AppIcon_Retro AppIcon_Color AppIcon_Halloween AppIcon_Xmas AppIcon_Pixel32 AppIcon_ChineseNewYear AppIcon_Lily AppIcon_Rainbow1 AppIcon_Rainbow2 AppIcon_Rainbow3 AppIcon_Unity";ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;@@ -15049,7 +15278,7 @@SUPPORTS_MACCATALYST = NO;SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;- SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(APP_BUILD_CONDITIONS)";+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(APP_BUILD_CONDITIONS)";SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/ManicEmu/Sources/Base/Bridging-Header.h";SWIFT_VERSION = 5.0;TARGETED_DEVICE_FAMILY = "1,2";@@ -15463,6 +15692,7 @@isa = XCBuildConfiguration;baseConfigurationReference = B2C97B562A0A420E00053A4C /* Config-Debug.xcconfig */;buildSettings = {+ APP_BUILD_CONDITIONS = "DEBUG SIDE_LOAD";ASSETCATALOG_COMPILER_ALTERNATE_APPICON_NAMES = "AppIcon_Dark AppIcon_Retro AppIcon_Color AppIcon_Halloween AppIcon_Xmas AppIcon_Pixel32 AppIcon_ChineseNewYear AppIcon_Lily AppIcon_Rainbow1 AppIcon_Rainbow2 AppIcon_Rainbow3 AppIcon_Unity";ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;@@ -15602,6 +15832,81 @@};name = SideloadRelease;};+ 57E8A110304A4A1100000005 /* Debug */ = {+ isa = XCBuildConfiguration;+ baseConfigurationReference = 57E8A110304A4A1100000002 /* JITEnablerExtension.xcconfig */;+ buildSettings = {+ APPLICATION_EXTENSION_API_ONLY = YES;+ CODE_SIGN_IDENTITY = "Apple Development";+ CODE_SIGN_STYLE = Automatic;+ DEVELOPMENT_TEAM = UU52N52JLD;+ INFOPLIST_FILE = ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plist;+ IPHONEOS_DEPLOYMENT_TARGET = 17.4;+ LD_RUNPATH_SEARCH_PATHS = (+ "$(inherited)",+ "@executable_path/Frameworks",+ "@executable_path/../../Frameworks",+ );+ PRODUCT_BUNDLE_IDENTIFIER = com.aoshuang.manicemu.JITEnabler;+ PRODUCT_NAME = JITEnabler;+ PROVISIONING_PROFILE_SPECIFIER = "";+ SKIP_INSTALL = YES;+ SWIFT_EMIT_LOC_STRINGS = NO;+ SWIFT_VERSION = 5.0;+ TARGETED_DEVICE_FAMILY = "1,2";+ };+ name = Debug;+ };+ 57E8A110304A4A1100000006 /* Release */ = {+ isa = XCBuildConfiguration;+ baseConfigurationReference = 57E8A110304A4A1100000002 /* JITEnablerExtension.xcconfig */;+ buildSettings = {+ APPLICATION_EXTENSION_API_ONLY = YES;+ CODE_SIGN_IDENTITY = "Apple Development";+ CODE_SIGN_STYLE = Automatic;+ DEVELOPMENT_TEAM = UU52N52JLD;+ INFOPLIST_FILE = ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plist;+ IPHONEOS_DEPLOYMENT_TARGET = 17.4;+ LD_RUNPATH_SEARCH_PATHS = (+ "$(inherited)",+ "@executable_path/Frameworks",+ "@executable_path/../../Frameworks",+ );+ PRODUCT_BUNDLE_IDENTIFIER = com.aoshuang.manicemu.JITEnabler;+ PRODUCT_NAME = JITEnabler;+ PROVISIONING_PROFILE_SPECIFIER = "";+ SKIP_INSTALL = YES;+ SWIFT_EMIT_LOC_STRINGS = NO;+ SWIFT_VERSION = 5.0;+ TARGETED_DEVICE_FAMILY = "1,2";+ };+ name = Release;+ };+ 57E8A110304A4A1100000007 /* SideloadRelease */ = {+ isa = XCBuildConfiguration;+ baseConfigurationReference = 57E8A110304A4A1100000002 /* JITEnablerExtension.xcconfig */;+ buildSettings = {+ APPLICATION_EXTENSION_API_ONLY = YES;+ CODE_SIGN_IDENTITY = "Apple Development";+ CODE_SIGN_STYLE = Automatic;+ DEVELOPMENT_TEAM = UU52N52JLD;+ INFOPLIST_FILE = ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plist;+ IPHONEOS_DEPLOYMENT_TARGET = 17.4;+ LD_RUNPATH_SEARCH_PATHS = (+ "$(inherited)",+ "@executable_path/Frameworks",+ "@executable_path/../../Frameworks",+ );+ PRODUCT_BUNDLE_IDENTIFIER = com.aoshuang.manicemu.JITEnabler;+ PRODUCT_NAME = JITEnabler;+ PROVISIONING_PROFILE_SPECIFIER = "";+ SKIP_INSTALL = YES;+ SWIFT_EMIT_LOC_STRINGS = NO;+ SWIFT_VERSION = 5.0;+ TARGETED_DEVICE_FAMILY = "1,2";+ };+ name = SideloadRelease;+ };A5A0020124555A5F006E0F0E /* Debug */ = {isa = XCBuildConfiguration;buildSettings = {@@ -15869,6 +16174,16 @@defaultConfigurationIsVisible = 0;defaultConfigurationName = Release;};+ 57E8A110304A4A1100000004 /* Build configuration list for PBXNativeTarget "JITEnabler" */ = {+ isa = XCConfigurationList;+ buildConfigurations = (+ 57E8A110304A4A1100000005 /* Debug */,+ 57E8A110304A4A1100000006 /* Release */,+ 57E8A110304A4A1100000007 /* SideloadRelease */,+ );+ defaultConfigurationIsVisible = 0;+ defaultConfigurationName = Release;+ };A5A001EA24555A5F006E0F0E /* Build configuration list for PBXProject "ManicEmu" */ = {isa = XCConfigurationList;buildConfigurations = (diff --git a/ManicEmu/ManicEmu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ManicEmu/ManicEmu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolvedindex 07a4fe73..a04e2cc5 100644--- a/ManicEmu/ManicEmu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved+++ b/ManicEmu/ManicEmu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved@@ -1,5 +1,5 @@{- "originHash" : "f75ade9c50361fec160206aba998c9da3a1e21c9d4581c349ecda999dd4d551c",+ "originHash" : "61d86f378064e763dfc2be709f822f7c0843e1020a59ba89eceea25dcb46265e","pins" : [{"identity" : "attributedstring",diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/jit_method.symbols.symbolset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/jit_method.symbols.symbolset/Contents.jsonnew file mode 100644index 00000000..20776a05--- /dev/null+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/jit_method.symbols.symbolset/Contents.json@@ -0,0 +1,12 @@+{+ "info" : {+ "author" : "xcode",+ "version" : 1+ },+ "symbols" : [+ {+ "filename" : "jit_method.symbols.svg",+ "idiom" : "universal"+ }+ ]+}diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/jit_method.symbols.symbolset/jit_method.symbols.svg b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/jit_method.symbols.symbolset/jit_method.symbols.svgnew file mode 100644index 00000000..a8771e07--- /dev/null+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Symbols/jit_method.symbols.symbolset/jit_method.symbols.svg@@ -0,0 +1,115 @@+<?xml version="1.0" encoding="UTF-8"?>+<!--Generator: Apple Native CoreSVG 341-->+<!DOCTYPE svg+PUBLIC "-//W3C//DTD SVG 1.1//EN"+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 3300 2200">+ <!--glyph: "", point size: 100.0, font version: "21.1d1e1", template writer version: "138.0.0"-->+ <style>.defaults {-sfsymbols-variable-value-mode:color;-sfsymbols-draw-reverses-motion-groups:true}++.monochrome-0 {-sfsymbols-motion-group:1;-sfsymbols-layer-tags:-696b451662cdbac3 24a9e5ae335cc8c5 bolt.fill}+.monochrome-1 {opacity:0.0;-sfsymbols-clear-behind:true;-sfsymbols-motion-group:0;-sfsymbols-layer-tags:-696b451662cdbac3 _badge gearshape}+.monochrome-2 {-sfsymbols-motion-group:0;-sfsymbols-always-pulses:true;-sfsymbols-layer-tags:-696b451662cdbac3 _badge gearshape}++.multicolor-0:tintColor {-sfsymbols-motion-group:1;-sfsymbols-layer-tags:-696b451662cdbac3 24a9e5ae335cc8c5 bolt.fill}+.multicolor-1:tintColor {opacity:0.0;-sfsymbols-clear-behind:true;-sfsymbols-motion-group:0;-sfsymbols-layer-tags:-696b451662cdbac3 _badge gearshape}+.multicolor-2:tintColor {-sfsymbols-motion-group:0;-sfsymbols-always-pulses:true;-sfsymbols-layer-tags:-696b451662cdbac3 _badge gearshape}++.hierarchical-0:secondary {-sfsymbols-motion-group:1;-sfsymbols-layer-tags:-696b451662cdbac3 24a9e5ae335cc8c5 bolt.fill}+.hierarchical-1:primary {opacity:0.0;-sfsymbols-clear-behind:true;-sfsymbols-motion-group:0;-sfsymbols-layer-tags:-696b451662cdbac3 _badge gearshape}+.hierarchical-2:primary {-sfsymbols-motion-group:0;-sfsymbols-always-pulses:true;-sfsymbols-layer-tags:-696b451662cdbac3 _badge gearshape}++.SFSymbolsPreviewWireframe {fill:none;opacity:1.0;stroke:black;stroke-width:0.5}+</style>+ <g id="Notes">+ <rect height="2200" id="artboard" style="fill:white;opacity:1" width="3300" x="0" y="0"/>+ <line style="fill:none;stroke:black;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="292" y2="292"/>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 263 322)">Weight/Scale Variations</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 559.711 322)">Ultralight</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 856.422 322)">Thin</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 1153.13 322)">Light</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 1449.84 322)">Regular</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 1746.56 322)">Medium</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2043.27 322)">Semibold</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2339.98 322)">Bold</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2636.69 322)">Heavy</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:middle;" transform="matrix(1 0 0 1 2933.4 322)">Black</text>+ <line style="fill:none;stroke:black;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1903" y2="1903"/>+ <g transform="matrix(0.2 0 0 0.2 263 1933)">+ <path d="m46.2402 4.15039c21.7773 0 39.4531-17.627 39.4531-39.4043s-17.6758-39.4043-39.4531-39.4043c-21.7285 0-39.4043 17.627-39.4043 39.4043s17.6758 39.4043 39.4043 39.4043Zm0-7.42188c-17.6758 0-31.9336-14.3066-31.9336-31.9824s14.2578-31.9824 31.9336-31.9824 31.9824 14.3066 31.9824 31.9824-14.3066 31.9824-31.9824 31.9824Zm3.61328-17.7734v-28.4668c0-2.24609-1.46484-3.75977-3.71094-3.75977-2.14844 0-3.61328 1.51367-3.61328 3.75977v28.4668c0 2.19727 1.46484 3.71094 3.61328 3.71094 2.24609 0 3.71094-1.51367 3.71094-3.71094Zm-17.8223-10.5957h28.418c2.19727 0 3.71094-1.46484 3.71094-3.61328 0-2.19727-1.51367-3.71094-3.71094-3.71094h-28.418c-2.24609 0-3.75977 1.51367-3.75977 3.71094 0 2.14844 1.51367 3.61328 3.75977 3.61328Z"/>+ </g>+ <g transform="matrix(0.2 0 0 0.2 281.506 1933)">+ <path d="m58.5449 14.5508c27.4902 0 49.8047-22.3145 49.8047-49.8047s-22.3145-49.8047-49.8047-49.8047-49.8047 22.3145-49.8047 49.8047 22.3145 49.8047 49.8047 49.8047Zm0-8.30078c-22.9492 0-41.5039-18.5547-41.5039-41.5039s18.5547-41.5039 41.5039-41.5039 41.5039 18.5547 41.5039 41.5039-18.5547 41.5039-41.5039 41.5039Zm4.05273-23.0957v-36.9141c0-2.49023-1.70898-4.19922-4.15039-4.19922-2.39258 0-4.05273 1.70898-4.05273 4.19922v36.9141c0 2.44141 1.66016 4.15039 4.05273 4.15039 2.44141 0 4.15039-1.66016 4.15039-4.15039Zm-22.5586-14.4043h36.9629c2.44141 0 4.15039-1.61133 4.15039-4.00391 0-2.44141-1.70898-4.15039-4.15039-4.15039h-36.9629c-2.49023 0-4.15039 1.70898-4.15039 4.15039 0 2.39258 1.66016 4.00391 4.15039 4.00391Z"/>+ </g>+ <g transform="matrix(0.2 0 0 0.2 304.924 1933)">+ <path d="m74.8535 28.3203c35.1074 0 63.623-28.4668 63.623-63.5742s-28.5156-63.623-63.623-63.623-63.5742 28.5156-63.5742 63.623 28.4668 63.5742 63.5742 63.5742Zm0-9.08203c-30.127 0-54.4922-24.3652-54.4922-54.4922s24.3652-54.4922 54.4922-54.4922 54.4922 24.3652 54.4922 54.4922-24.3652 54.4922-54.4922 54.4922Zm4.44336-30.3223v-48.4863c0-2.73438-1.85547-4.63867-4.54102-4.63867-2.58789 0-4.44336 1.9043-4.44336 4.63867v48.4863c0 2.68555 1.85547 4.58984 4.44336 4.58984 2.68555 0 4.54102-1.85547 4.54102-4.58984Zm-28.7109-19.7754h48.4863c2.68555 0 4.58984-1.80664 4.58984-4.39453 0-2.73438-1.85547-4.58984-4.58984-4.58984h-48.4863c-2.73438 0-4.58984 1.85547-4.58984 4.58984 0 2.58789 1.85547 4.39453 4.58984 4.39453Z"/>+ </g>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 263 1953)">Design Variations</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1971)">Symbols are supported in up to nine weights and three scales.</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1989)">For optimal layout with text and other symbols, vertically align</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 2007)">symbols with the adjacent text.</text>+ <line style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="776" x2="776" y1="1919" y2="1933"/>+ <g transform="matrix(0.2 0 0 0.2 776 1933)">+ <path d="m16.5527 0.78125c2.58789 0 3.85742-0.976562 4.78516-3.71094l20.5566-57.5195h0.244141l20.6055 57.5195c0.927734 2.73438 2.19727 3.71094 4.73633 3.71094 2.58789 0 4.24805-1.5625 4.24805-4.00391 0-0.830078-0.146484-1.61133-0.537109-2.63672l-22.9004-60.9863c-1.12305-2.97852-3.125-4.49219-6.25-4.49219-3.02734 0-5.07812 1.46484-6.15234 4.44336l-22.9004 61.084c-0.390625 1.02539-0.537109 1.80664-0.537109 2.63672 0 2.44141 1.5625 3.95508 4.10156 3.95508Zm10.2051-20.9473h30.6641c2.00195 0 3.66211-1.66016 3.66211-3.66211 0-2.05078-1.66016-3.66211-3.66211-3.66211h-30.6641c-2.00195 0-3.66211 1.61133-3.66211 3.66211 0 2.00195 1.66016 3.66211 3.66211 3.66211Z"/>+ </g>+ <line style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="792.836" x2="792.836" y1="1919" y2="1933"/>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 776 1953)">Margins</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 1971)">Leading and trailing margins on the left and right side of each symbol</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 1989)">can be adjusted by modifying the x-location of the margin guidelines.</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 2007)">Modifications are automatically applied proportionally to all</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 776 2025)">scales and weights.</text>+ <g transform="matrix(0.2 0 0 0.2 1289 1933)">+ <path d="m14.209 13.1348 7.86133 7.86133c4.29688 4.39453 9.32617 4.10156 13.8672-1.02539l60.6934-68.2129-4.88281-4.88281-60.2539 67.6758c-1.80664 1.95312-3.4668 2.44141-5.81055 0.0976562l-5.17578-5.12695c-2.29492-2.29492-1.80664-3.95508 0.195312-5.81055l67.4805-62.1582-4.88281-4.83398-68.0664 62.5977c-4.98047 4.58984-5.32227 9.47266-1.02539 13.8184Zm44.873-97.4609c-2.05078 2.00195-2.24609 4.88281-1.07422 6.78711 1.12305 1.80664 3.4668 3.02734 6.5918 2.24609 5.85938-1.66016 12.5977-2.39258 18.8965 0.927734l-2.68555 7.12891c-1.61133 4.00391-0.732422 6.88477 1.70898 9.42383l10.2539 10.3027c2.34375 2.39258 4.54102 2.44141 7.08008 1.95312l4.44336-0.732422 2.58789 2.53906-0.195312 2.24609c-0.0976562 2.29492 0.537109 4.29688 2.7832 6.49414l3.36914 3.32031c2.29492 2.29492 5.51758 2.49023 7.8125 0.195312l12.9883-13.0371c2.29492-2.34375 2.14844-5.37109-0.195312-7.66602l-3.41797-3.41797c-2.19727-2.19727-4.05273-3.02734-6.34766-2.88086l-2.34375 0.244141-2.44141-2.44141 1.02539-4.6875c0.634766-2.73438-0.244141-4.98047-2.88086-7.61719l-11.2793-11.1816c-12.9395-12.8418-35.5957-11.0352-46.6797-0.146484Zm7.08008 2.05078c8.78906-6.39648 25.9766-5.66406 33.6914 1.95312l12.3047 12.207c1.02539 1.02539 1.2207 1.80664 0.927734 3.32031l-1.46484 6.64062 6.73828 6.68945 4.39453-0.244141c1.12305-0.0488281 1.51367 0.0488281 2.34375 0.878906l2.53906 2.49023-10.8398 10.8398-2.49023-2.49023c-0.830078-0.878906-0.976562-1.2207-0.927734-2.39258l0.292969-4.3457-6.68945-6.73828-6.83594 1.17188c-1.41602 0.292969-2.05078 0.195312-3.17383-0.878906l-8.93555-8.88672c-1.07422-1.02539-1.17188-1.70898-0.488281-3.36914l4.58984-11.4746c-6.10352-6.34766-17.041-7.51953-25.5859-4.58984-0.683594 0.244141-0.927734-0.390625-0.390625-0.78125Z"/>+ </g>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;font-weight:bold;" transform="matrix(1 0 0 1 1289 1953)">Exporting</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 1289 1971)">Symbols should be outlined when exporting to ensure the</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 1289 1989)">design is preserved when submitting to Xcode.</text>+ <text id="template-version" style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1933)">Template v.7.0</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1951)">Requires Xcode 26 or greater</text>+ <text id="descriptive-name" style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1969)">Generated from </text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;text-anchor:end;" transform="matrix(1 0 0 1 3036 1987)">Typeset at 100.0 points</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 726)">Small</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1156)">Medium</text>+ <text style="stroke:none;fill:black;font-family:sans-serif;font-size:13;" transform="matrix(1 0 0 1 263 1586)">Large</text>+ </g>+ <g id="Guides">+ <g id="H-reference" style="fill:#27AAE1;stroke:none;" transform="matrix(1 0 0 1 339 696)">+ <path d="M0.993654 0L3.63775 0L29.3281-67.1323L30.0303-67.1323L30.0303-70.459L28.1226-70.459ZM11.6885-24.4799L46.9815-24.4799L46.2315-26.7285L12.4385-26.7285ZM55.1196 0L57.7637 0L30.6382-70.459L29.4326-70.459L29.4326-67.1323Z"/>+ </g>+ <line id="Baseline-S" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="696" y2="696"/>+ <line id="Capline-S" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="625.541" y2="625.541"/>+ <g id="H-reference" style="fill:#27AAE1;stroke:none;" transform="matrix(1 0 0 1 339 1126)">+ <path d="M0.993654 0L3.63775 0L29.3281-67.1323L30.0303-67.1323L30.0303-70.459L28.1226-70.459ZM11.6885-24.4799L46.9815-24.4799L46.2315-26.7285L12.4385-26.7285ZM55.1196 0L57.7637 0L30.6382-70.459L29.4326-70.459L29.4326-67.1323Z"/>+ </g>+ <line id="Baseline-M" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1126" y2="1126"/>+ <line id="Capline-M" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1055.54" y2="1055.54"/>+ <g id="H-reference" style="fill:#27AAE1;stroke:none;" transform="matrix(1 0 0 1 339 1556)">+ <path d="M0.993654 0L3.63775 0L29.3281-67.1323L30.0303-67.1323L30.0303-70.459L28.1226-70.459ZM11.6885-24.4799L46.9815-24.4799L46.2315-26.7285L12.4385-26.7285ZM55.1196 0L57.7637 0L30.6382-70.459L29.4326-70.459L29.4326-67.1323Z"/>+ </g>+ <line id="Baseline-L" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1556" y2="1556"/>+ <line id="Capline-L" style="fill:none;stroke:#27AAE1;opacity:1;stroke-width:0.5;" x1="263" x2="3036" y1="1485.54" y2="1485.54"/>+ <line id="right-margin-Black-S" style="fill:none;stroke:#FF3B30;stroke-width:0.5;opacity:1.0;" x1="2975.34" x2="2975.34" y1="600.785" y2="720.121"/>+ <line id="left-margin-Black-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="2891.46" x2="2891.46" y1="600.785" y2="720.121"/>+ <line id="right-margin-Regular-S" style="fill:none;stroke:#FF3B30;stroke-width:0.5;opacity:1.0;" x1="1487.81" x2="1487.81" y1="600.785" y2="720.121"/>+ <line id="left-margin-Regular-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="1411.88" x2="1411.88" y1="600.785" y2="720.121"/>+ <line id="right-margin-Ultralight-S" style="fill:none;stroke:#FF3B30;stroke-width:0.5;opacity:1.0;" x1="596.176" x2="596.176" y1="600.785" y2="720.121"/>+ <line id="left-margin-Ultralight-S" style="fill:none;stroke:#00AEEF;stroke-width:0.5;opacity:1.0;" x1="523.246" x2="523.246" y1="600.785" y2="720.121"/>+ </g>+ <g id="Symbols">+ <g id="Black-S" transform="matrix(1 0 0 1 2891.46 696)">+ <path class="monochrome-0 multicolor-0:tintColor hierarchical-0:secondary SFSymbolsPreviewWireframe" d="M9.61914-30.2246C9.61914-28.125 11.2305-26.6602 13.3789-26.6602L38.3301-26.6602L25.4395 6.54297C23.3887 11.7676 28.8574 14.5508 32.4219 10.3516L72.998-37.6953C73.877-38.7207 74.2676-39.7461 74.2676-40.8691C74.2676-42.9688 72.6562-44.4336 70.5078-44.4336L45.5566-44.4336L58.4473-77.6367C60.498-82.8613 55.0293-85.6445 51.4648-81.4453L10.8887-33.3984C10.0098-32.373 9.61914-31.3477 9.61914-30.2246Z"/>+ <path class="monochrome-1 multicolor-1:tintColor hierarchical-1:primary SFSymbolsPreviewWireframe" d="M66.4431 13.3025C81.3848 13.3025 93.7378 0.900111 93.7378-14.0413C93.7378-28.9827 81.3848-41.2874 66.4431-41.2874C51.5017-41.2874 39.1482-28.9827 39.1482-14.0413C39.1482 0.900111 51.5017 13.3025 66.4431 13.3025Z"/>+ <path class="monochrome-2 multicolor-2:tintColor hierarchical-2:primary SFSymbolsPreviewWireframe" d="M64.6853 8.02901L68.1032 8.02901C69.9099 8.02901 71.3747 6.85721 71.7653 5.14821L72.5468 1.77901C72.7908 1.68141 72.9858 1.63251 73.1818 1.53491L76.0618 3.34151C77.5758 4.26931 79.4798 4.12281 80.7988 2.80441L83.1908 0.411811C84.4608-0.857689 84.5588-2.81079 83.6308-4.32449L81.8728-7.20529C81.9708-7.40069 82.0188-7.54709 82.1168-7.74249L85.4858-8.57249C87.2438-9.01199 88.4158-10.428 88.4158-12.2346L88.4158-15.6038C88.4158-17.4104 87.2438-18.9241 85.4858-19.3147L82.1658-20.096C82.1168-20.2425 82.0188-20.4866 81.9218-20.6331L83.7278-23.6116C84.6558-25.1253 84.5098-27.0784 83.1908-28.3479L80.7008-30.7405C79.5288-31.8635 77.7228-32.2053 76.2088-31.2776L73.1818-29.4221C72.9858-29.5198 72.7908-29.5686 72.5958-29.6663L71.7653-33.0842C71.3259-34.8421 69.9099-36.0139 68.1032-36.0139L64.6853-36.0139C62.8298-36.0139 61.4626-34.8421 61.0232-33.0354L60.1931-29.7151C59.9978-29.6663 59.7536-29.5198 59.5583-29.4221L56.531-31.2776C55.115-32.1565 53.2595-31.9124 52.0388-30.7405L49.5486-28.3479C48.2302-27.1272 48.1325-25.1741 49.0603-23.6116L50.8669-20.6331C50.7204-20.4866 50.6716-20.2425 50.5739-20.096L47.3025-19.3147C45.4958-18.8753 44.3728-17.4104 44.3728-15.6038L44.3728-12.2346C44.3728-10.428 45.5446-9.01199 47.3025-8.57249L50.6716-7.74249C50.7204-7.54709 50.8181-7.40069 50.8669-7.20529L49.1091-4.32449C48.1814-2.81079 48.279-0.857689 49.5486 0.411811L51.99 2.80441C53.2595 4.07401 55.1638 4.26931 56.6775 3.34151L59.6071 1.53491C59.7536 1.63251 59.9978 1.68141 60.1931 1.77901L61.0232 5.14821C61.4626 6.85721 62.8298 8.02901 64.6853 8.02901ZM66.3943-7.84009C63.0739-7.84009 60.2907-10.6233 60.2907-13.9925C60.2907-17.3128 63.0739-20.096 66.3943-20.096C69.7146-20.096 72.5468-17.3128 72.5468-13.9925C72.5468-10.6233 69.7146-7.84009 66.3943-7.84009Z"/>+ </g>+ <g id="Regular-S" transform="matrix(1 0 0 1 1411.88 696)">+ <path class="monochrome-0 multicolor-0:tintColor hierarchical-0:secondary SFSymbolsPreviewWireframe" d="M10.3516-30.8594C10.3516-29.1504 11.7188-27.8809 13.4766-27.8809L35.0098-27.8809L23.6816 2.88086C22.0703 7.32422 26.6602 9.7168 29.5898 6.10352L64.502-37.5C65.1855-38.4277 65.5762-39.2578 65.5762-40.2344C65.5762-41.9434 64.2578-43.2129 62.4512-43.2129L40.918-43.2129L52.2461-73.9746C53.9062-78.418 49.2676-80.8105 46.3379-77.1973L11.4258-33.5938C10.7422-32.666 10.3516-31.8359 10.3516-30.8594Z"/>+ <path class="monochrome-1 multicolor-1:tintColor hierarchical-1:primary SFSymbolsPreviewWireframe" d="M60.1457 11.3982C73.9643 11.3982 85.5363-0.174039 85.5363-13.9924C85.5363-27.9084 74.0613-39.383 60.1457-39.383C46.1808-39.383 34.7551-27.9084 34.7551-13.9924C34.7551-0.0275393 46.1808 11.3982 60.1457 11.3982Z"/>+ <path class="monochrome-2 multicolor-2:tintColor hierarchical-2:primary SFSymbolsPreviewWireframe" d="M58.4367 6.12476L61.8058 6.12476C62.9777 6.12476 63.9054 5.39236 64.1984 4.17166L65.1261 0.314161C65.6633 0.167761 66.298-0.0764393 66.8353-0.320539L70.2043 1.68136C71.2293 2.31616 72.3523 2.31616 73.2313 1.38846L75.5263-0.906539C76.3563-1.78544 76.4543-2.90844 75.7703-4.03154L73.7683-7.40064C74.1103-7.93774 74.2573-8.42604 74.4523-8.96314L78.3093-9.89084C79.5303-10.135 80.3113-11.0627 80.3113-12.2834L80.3113-15.6037C80.3113-16.7756 79.4813-17.6545 78.3093-17.9475L74.5013-18.8752C74.2573-19.5588 74.0133-19.9983 73.8173-20.4377L75.9173-23.9045C76.5523-24.9299 76.4543-26.1994 75.6243-26.9807L73.2313-29.2756C72.4013-30.1057 71.2293-30.301 70.2533-29.7151L66.8353-27.5666C66.2004-27.9084 65.6633-28.0549 65.1261-28.2502L64.1984-32.1076C63.9054-33.2795 62.9777-34.0608 61.8058-34.0608L58.4367-34.0608C57.216-34.0608 56.2394-33.2307 55.9953-32.1076L55.1164-28.299C54.4328-28.0549 53.8957-27.9084 53.3586-27.5666L49.9894-29.7151C49.0617-30.2522 47.841-30.1057 46.9621-29.2756L44.6672-26.9807C43.8859-26.1506 43.5929-24.9299 44.2277-23.9045L46.3761-20.4377C46.1808-19.9983 45.9367-19.4611 45.6925-18.8752L41.9328-17.9475C40.7609-17.6545 39.9797-16.7268 39.9797-15.6037L39.9797-12.2834C39.9797-11.0627 40.7609-10.135 41.9328-9.89084L45.7414-8.96314C45.9855-8.42604 46.1808-7.93774 46.425-7.40064L44.423-3.98264C43.7883-2.90844 43.8859-1.73654 44.716-0.906539L46.9621 1.38846C47.841 2.31616 49.0129 2.31616 50.0383 1.68136L53.4562-0.320539C54.0422-0.0275393 54.5793 0.167761 55.1164 0.314161L55.9953 4.17166C56.2394 5.34346 57.216 6.12476 58.4367 6.12476ZM60.1457-7.49834C56.4836-7.49834 53.6515-10.3303 53.6515-13.9436C53.6515-17.508 56.4836-20.3889 60.1457-20.4377C63.6125-20.4865 66.591-17.508 66.591-13.9436C66.591-10.3303 63.6125-7.49834 60.1457-7.49834Z"/>+ </g>+ <g id="Ultralight-S" transform="matrix(1 0 0 1 523.246 696)">+ <path class="monochrome-0 multicolor-0:tintColor hierarchical-0:secondary SFSymbolsPreviewWireframe" d="M12.4858-30.4507C12.4858-30.0586 12.6724-29.6518 13.4312-29.6518L35.5547-29.6518L23.6816 2.29053C22.9785 4.05471 24.6621 4.81254 25.7754 3.42434L59.8247-39.3618C60.1905-39.8354 60.4449-40.166 60.4449-40.6431C60.4449-41.0352 60.2163-41.4419 59.4995-41.4419L37.3306-41.4419L49.249-73.3843C49.9102-75.1485 48.2232-75.9063 47.1099-74.5181L13.1059-31.7319C12.7402-31.2583 12.4858-30.9277 12.4858-30.4507Z"/>+ <path class="monochrome-1 multicolor-1:tintColor hierarchical-1:primary SFSymbolsPreviewWireframe" d="M57.7918 7.35671C69.4304 7.35671 79.1414-2.26289 79.1414-13.9924C79.1414-25.7287 69.4824-35.3416 57.7918-35.3416C46.0974-35.3416 36.3972-25.6833 36.3972-13.9924C36.3972-2.25259 46.0974 7.35671 57.7918 7.35671Z"/>+ <path class="monochrome-2 multicolor-2:tintColor hierarchical-2:primary SFSymbolsPreviewWireframe" d="M56.2644 4.39921L59.2249 4.39921C60.3513 4.39921 61.1882 3.71221 61.4358 2.58231L62.2727-0.911789C62.7644-1.05829 63.3538-1.30249 63.8455-1.54659L66.9424 0.319111C67.8764 0.908511 68.9094 0.908511 69.7424 0.0716107L71.8554-2.08709C72.5954-2.87519 72.6924-3.86199 72.0544-4.89429L70.2344-7.99089C70.5304-8.48259 70.6774-8.92549 70.8724-9.41719L74.3664-10.2541C75.4964-10.4983 76.1864-11.3806 76.1864-12.4651L76.1864-15.5129C76.1864-16.594 75.4474-17.3366 74.3664-17.6296L70.9214-18.5119C70.6774-19.1047 70.4324-19.5442 70.2834-19.9836L72.2014-23.1325C72.7904-24.0671 72.6474-25.2004 71.9084-25.9363L69.7424-28.0041C68.9574-28.7888 67.8764-28.9387 66.9914-28.3982L63.8455-26.4314C63.2561-26.7278 62.7644-26.8742 62.2727-27.0696L61.4358-30.6091C61.1882-31.6902 60.3513-32.426 59.2249-32.426L56.2644-32.426C55.1799-32.426 54.2942-31.6413 54.0501-30.6091L53.262-27.1184C52.6238-26.8742 52.1321-26.7278 51.595-26.4314L48.4983-28.3982C47.6614-28.9353 46.5315-28.7888 45.7434-28.0041L43.6755-25.9363C42.9397-25.1516 42.6467-24.0671 43.2361-23.1325L45.2029-19.9836C45.053-19.5442 44.8088-19.0525 44.6101-18.5119L41.1228-17.6296C40.0417-17.3366 39.3513-16.5451 39.3513-15.5129L39.3513-12.4651C39.3513-11.3806 40.0417-10.4983 41.1228-10.2541L44.6135-9.41719C44.8577-8.92549 45.053-8.48259 45.2517-7.99089L43.4314-4.84539C42.842-3.86199 42.9397-2.82639 43.679-2.08709L45.7434 0.0716107C46.5315 0.908511 47.6126 0.863111 48.5471 0.319111L51.6926-1.54659C52.2786-1.25359 52.7703-1.05829 53.262-0.911789L54.0501 2.58231C54.2942 3.66341 55.1799 4.39921 56.2644 4.39921ZM57.7918-8.04319C54.4475-8.04319 51.8425-10.6936 51.8425-13.989C51.8425-17.2356 54.4475-19.9348 57.7918-19.9836C60.9407-20.0324 63.6922-17.2356 63.6922-13.989C63.6922-10.6936 60.9407-8.04319 57.7918-8.04319Z"/>+ </g>+ </g>+</svg>diff --git a/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig b/ManicEmu/ManicEmu/Resources/Config-Base.xcconfigindex cf3b7e8e..4b038075 100644--- a/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig+++ b/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig@@ -11,8 +11,8 @@// https://help.apple.com/xcode/#/dev745c5c974APP_BUNDLE_IDENTIFIER = com.aoshuang.manicemu-APP_BUILD_VERSION = 20-APP_VERSION = 2.0.0+APP_BUILD_VERSION = 0+APP_VERSION = 2.0.1// Prebuilt cores under ProjectManicEMU/Cores (Citra.framework, *.libretro.framework, …)FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/../Coresdiff --git a/ManicEmu/ManicEmu/Resources/Config-Debug.xcconfig b/ManicEmu/ManicEmu/Resources/Config-Debug.xcconfigindex ea454656..fc7efa21 100644--- a/ManicEmu/ManicEmu/Resources/Config-Debug.xcconfig+++ b/ManicEmu/ManicEmu/Resources/Config-Debug.xcconfig@@ -11,6 +11,6 @@// https://help.apple.com/xcode/#/dev745c5c974#include "ManicEmu/Resources/Config-Base.xcconfig"-APP_BUILD_CONDITIONS = DEBUG-//Debug Side Load Vers-//APP_BUILD_CONDITIONS = DEBUG SIDE_LOAD+APP_BUILD_CONDITIONS = DEBUG SIDE_LOAD+// SIDE_LOAD is set on ManicEmuDebug / ManicEmuSideload target settings only.+// Do not enable it here: ManicEmuRelease Debug also includes this file.diff --git a/ManicEmu/ManicEmu/Resources/Info.plist b/ManicEmu/ManicEmu/Resources/Info.plistindex 9316213a..0e25a13d 100644--- a/ManicEmu/ManicEmu/Resources/Info.plist+++ b/ManicEmu/ManicEmu/Resources/Info.plist@@ -601,6 +601,7 @@<string>atariemulator</string><string>xenios</string><string>stikjit</string>+ <string>stikdebug</string><string>dukex</string><string>armsx2</string><string>armsx2-ios</string>diff --git a/ManicEmu/ManicEmu/Resources/JITEnablerExtension.xcconfig b/ManicEmu/ManicEmu/Resources/JITEnablerExtension.xcconfignew file mode 100644index 00000000..2364f77e--- /dev/null+++ b/ManicEmu/ManicEmu/Resources/JITEnablerExtension.xcconfig@@ -0,0 +1,38 @@+//+// JITEnablerExtension.xcconfig+// ManicEmu+//+// SPDX-License-Identifier: AGPL-3.0-or-later++PRODUCT_NAME = JITEnabler+PRODUCT_BUNDLE_IDENTIFIER = com.aoshuang.manicemu.JITEnabler+PRODUCT_MODULE_NAME = JITEnabler+IPHONEOS_DEPLOYMENT_TARGET = 17.4+TARGETED_DEVICE_FAMILY = 1,2+SWIFT_VERSION = 5.0+SKIP_INSTALL = YES+CODE_SIGN_STYLE = Automatic+DEVELOPMENT_TEAM = UU52N52JLD+CODE_SIGN_IDENTITY = "Apple Development"+SUPPORTED_PLATFORMS = iphoneos+SUPPORTS_MACCATALYST = NO+ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO+APPLICATION_EXTENSION_API_ONLY = NO+CLANG_ENABLE_MODULES = YES+CLANG_ENABLE_OBJC_ARC = YES+GENERATE_INFOPLIST_FILE = NO+SWIFT_INSTALL_OBJC_HEADER = NO+CURRENT_PROJECT_VERSION = 1+MARKETING_VERSION = 1.0+ENABLE_USER_SCRIPT_SANDBOXING = NO+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1+SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) DEBUG++INFOPLIST_FILE = ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plist+CODE_SIGN_ENTITLEMENTS = ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerExtension.entitlements++LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/../StikJIT/idevice"+HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/../StikJIT/idevice" "$(SRCROOT)/../StikJIT/iokit"+SWIFT_INCLUDE_PATHS = $(inherited) "$(SRCROOT)/../StikJIT/idevice" "$(SRCROOT)/../StikJIT/iokit"+OTHER_LDFLAGS = $(inherited) -force_load "$(SRCROOT)/../StikJIT/idevice/libidevice_ffi.a"+LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @executable_path/../../Frameworksdiff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.stringsindex 27210b55..47bffef0 100644--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings@@ -861,6 +861,7 @@ Press the controller button to complete mapping...";"AllCoreSwitch" = "Apply to Existing Games";"AllCoreSwitchDesc" = "Set all imported %@ games to use the %@ core.";"EnableJIT" = "Enable JIT";+"EnableJITSuccess" = "JIT enabled successfully";"ReEnableJIT" = "Re-enable JIT";"HidePlatform" = "Hide %@";"ShowPlatform" = "Show %@";@@ -1088,3 +1089,38 @@ Press the controller button to complete mapping...";"CPUEmulationMethod" = "CPU Emulation Method";"DolphinCPUDesc" = "When JIT is unavailable, the core runs in interpreter mode.\nCached Interpreter: the official interpreter. It is more accurate, but more demanding on performance.\nManic Interpreter: Manic EMU's interpreter. Aggressive optimizations make it faster, but it may also produce more errors.";++"JitMethod" = "JIT Method";+"JitMethodExternalDebugger" = "External Debugger";+"JitMethodBuiltInDebugger" = "Built-in Debugger";+"JitActiveDebugger" = "Active Debugger";+"JitDebuggerNotAttached" = "Not Attached";+"JitExternalDebuggerAttached" = "An external debugger is already attached. Quit the external debugger first, then try the built-in debugger again.";+"JitMethodExternalInfo" = "Opens StikDebug to attach to this app. StikDebug then relaunches Manic EMU with JIT enabled.";+"JitMethodBuiltInInfo" = "Using the built-in debugger:\n1. Generate a remote pairing file with idevice_pair (lockdown files will fail) and import it.\n2. (Optional) On iOS 26.0 or later and iPhone 12 (A14) or newer, you also need LocalDevVPN for the debug network. Connect LocalDevVPN, then join a nearby Wi-Fi, or use Cellular → VPN → Airplane Mode.\n3. Enable JIT.\n\nTo reset the connection: create a new remote pairing file and import it again. If it still fails, restart the device.";+"JitPairingNotImported" = "Not Imported";+"JitImportPairingFile" = "Import Pairing File";+"JitPrepare" = "Prepare JIT";+"JitPrepareSuccess" = "JIT prepared successfully";+"JitPrepareNotChecked" = "Not Checked";+"JitTxmStatus" = "TXM / SPTM";+"JitTxmPresent" = "TXM Present";+"JitTxmNotPresent" = "SPTM / PPL";+"JitTxmUnknown" = "Unknown";+"JitPath" = "JIT Path";+"JitPathLegacy" = "Legacy JIT";+"JitPathPPL" = "PPL";+"JitPathTXM" = "TXM";+"JitResetDDI" = "Reset DDI Cache";+"JitResetDDISuccess" = "DDI cache reset successfully";+"JitRequiresiOS174" = "Built-in StikJIT requires iOS 17.4 or later.";+"JitLiveContainerUnavailable" = "Built-in StikJIT is unavailable in LiveContainer.";+"JitGetTaskAllowMissing" = "This build is missing get-task-allow, so a debugger cannot attach.";+"JitPairingRequired" = "Import a pairing file to use built-in StikJIT.";+"JitPrepareReady" = "Ready";+"JitPrepareUnreachable" = "Unreachable";+"JitPrepareNotReady" = "Not Ready";+"JitAcquireTimeout" = "Timed out waiting for JIT. The game will start with the interpreter, or you can try again.";+"JitAutoEnableOnLaunch" = "Enable JIT on Launch";+"JitAutoEnableOnLaunchDesc" = "Make sure the debug environment is ready before launching the app.";+"JitSupportedDesc" = "Cores that support JIT: %@";diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.stringsindex 3157b54a..f721c1fc 100644--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings@@ -1083,3 +1083,39 @@"CPUEmulationMethod" = "CPU 仿真方法";"DolphinCPUDesc" = "在无 JIT 的环境中,核心以解释器模式运行。\nCached Interpreter:官方解释器,准确度更高,但对性能要求也更高。\nManic Interpreter:Manic EMU 的解释器,采用更激进的优化,效率更高,但出错也可能更多。";++"EnableJITSuccess" = "JIT 开启成功";+"JitMethod" = "JIT 方式";+"JitMethodExternalDebugger" = "外部调试器";+"JitMethodBuiltInDebugger" = "内置调试器";+"JitActiveDebugger" = "当前调试器";+"JitDebuggerNotAttached" = "未附加";+"JitExternalDebuggerAttached" = "已有外部调试器附加。请先退出外部调试器,然后再尝试内置调试器。";+"JitMethodExternalInfo" = "打开 StikDebug 并附加到本应用。随后 StikDebug 会重新启动 Manic EMU 并开启 JIT。";+"JitMethodBuiltInInfo" = "使用内置调试器:\n1. 使用 idevice_pair 生成远程配对文件(lockdown 文件会失败)并导入。\n2. (可选)若系统为 iOS 26.0 或更高版本,且设备为 iPhone 12(A14)或更新机型,还需使用 LocalDevVPN 提供调试网络。连接 LocalDevVPN,然后连接附近的 Wi-Fi,或使用:蜂窝网络 → VPN → 飞行模式。\n3. 开启 JIT。\n\n连接重置:重新生成远程配对文件并再次导入。若仍然失败,请重启设备。";+"JitPairingNotImported" = "未导入";+"JitImportPairingFile" = "导入配对文件";+"JitPrepare" = "准备 JIT";+"JitPrepareSuccess" = "JIT 准备成功";+"JitPrepareNotChecked" = "未检查";+"JitTxmStatus" = "TXM / SPTM";+"JitTxmPresent" = "已检测到 TXM";+"JitTxmNotPresent" = "SPTM / PPL";+"JitTxmUnknown" = "未知";+"JitPath" = "JIT 路径";+"JitPathLegacy" = "传统 JIT";+"JitPathPPL" = "PPL";+"JitPathTXM" = "TXM";+"JitResetDDI" = "重置 DDI 缓存";+"JitResetDDISuccess" = "DDI 缓存重置成功";+"JitRequiresiOS174" = "内置 StikJIT 需要 iOS 17.4 或更高版本。";+"JitLiveContainerUnavailable" = "在 LiveContainer 中无法使用内置 StikJIT。";+"JitGetTaskAllowMissing" = "此构建缺少 get-task-allow,调试器无法附加。";+"JitPairingRequired" = "请导入配对文件以使用内置 StikJIT。";+"JitPrepareReady" = "已就绪";+"JitPrepareUnreachable" = "无法连接";+"JitPrepareNotReady" = "未就绪";+"JitAcquireTimeout" = "等待 JIT 超时。游戏将以解释器启动,你也可以再试一次。";+"JitAutoEnableOnLaunch" = "启动时开启 JIT";+"JitAutoEnableOnLaunchDesc" = "请确保启动应用前调试环境已就绪。";+"JitSupportedDesc" = "支持 JIT 的核心:%@";diff --git a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swiftindex 77a88228..71557606 100644--- a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift+++ b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift@@ -59,6 +59,11 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {}})++#if SIDE_LOAD+ StikJITHostCoordinator.shared.enableOnLaunchIfNeeded()+#endif+}}let dropInteraction = UIDropInteraction(delegate: self)diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swiftindex 6fe64f33..47b62a9a 100644--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift@@ -86,4 +86,5 @@ enum ExtraKey: String {case symbianPackagescase wiiControllercase dolphinManicInterpreter+ case autoEnableJITOnLaunch}diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swiftindex bba8d967..6b9f1f94 100644--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift@@ -209,6 +209,16 @@ class ASListPageView: BaseView {//MARK: - UI-related Functionsextension ASListPageView {+ /// Text width used by both supplementary items and decoration insets.+ /// Falls back when the collection view has not received a real bounds yet.+ private func supplementaryTextWidth(in env: NSCollectionLayoutEnvironment) -> CGFloat {+ let containerWidth = env.container.effectiveContentSize.width+ let fallbackWidth = max(collectionView.bounds.width, bounds.width)+ let width = containerWidth > 1 ? containerWidth : fallbackWidth+ let resolved = width > 1 ? width : R.Size.WindowWidth+ return max(resolved - Self.sectionHorizontalInsets * 2 - Self.supplementaryHorizontalInsets * 2, 1)+ }+private func createLayout() -> UICollectionViewLayout {let layout = UICollectionViewCompositionalLayout { [weak self] sectionIndex, env inguard let self else { return nil }@@ -239,6 +249,7 @@ extension ASListPageView {//sectionlet section = NSCollectionLayoutSection(group: group)+ let supplementaryTextWidth = self.supplementaryTextWidth(in: env)//gen header or footerfunc generateSupplementaryItem(supplementary: ASListPage.Supplementary, isHeader: Bool) -> NSCollectionLayoutBoundarySupplementaryItem {@@ -246,7 +257,12 @@ extension ASListPageView {var pinToVisibleBounds = falseswitch supplementary {case .texts(_, let pin):- heightDimension = .estimated(R.Size.SupplementaryItemHeight)+ // Absolute height must match decoration insets; estimated 44pt leaves a large+ // gap until the footer is self-sized after scrolling.+ let height = ASListSupplementaryView.calculateHeight(+ width: supplementaryTextWidth,+ supplementary: supplementary)+ heightDimension = .absolute(height)pinToVisibleBounds = pincase .buttons(_, let pin):heightDimension = .absolute(R.Size.SupplementaryItemHeight)@@ -299,12 +315,11 @@ extension ASListPageView {}- let calculateWidth = env.container.effectiveContentSize.width - Self.sectionHorizontalInsets*2 - Self.supplementaryHorizontalInsets*2+ let calculateWidth = supplementaryTextWidthvar insetsTop = 0.0if let header = sectionData.header {insetsTop = ASListSupplementaryView.calculateHeight(width: calculateWidth, supplementary: header)- insetsTop = max(insetsTop, R.Size.SupplementaryItemHeight)}var insetsBottom = 0.0diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/Models/SpecialCoreOption.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/Models/SpecialCoreOption.swiftindex 490e96b9..cbae4705 100644--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/Models/SpecialCoreOption.swift+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/Models/SpecialCoreOption.swift@@ -30,6 +30,8 @@ enum SpecialCoreOption: String {case ppsspp_cpu_corecase ppsspp_internal_resolutioncase ppsspp_cheats+ case ppsspp_software_rendering+ case ppsspp_software_rendering_jit//nes fdscase nestopia_palettecase nestopia_aspect@@ -545,6 +547,10 @@ enum SpecialCoreOption: String {bestEfforts: true)?.coreOptionsValue {resolvedCoreConfigs += storeCoreConfigs}+ // SoftGPU stays available; only its rasterizer JIT needs executable memory.+ if game.gameType == .psp, !LibretroCore.jitAvailable() || !game.jit {+ resolvedCoreConfigs[Self.ppsspp_software_rendering_jit.rawValue] = "disabled"+ }return resolvedCoreConfigs}diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swiftindex 7c235337..2710d1c2 100644--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift@@ -18,7 +18,9 @@ enum ThreeDSMode: Int, PersistableEnum {case compatibility, performance, quality}-extension Game: CKRecordConvertible & CKRecordRecoverable {}+extension Game: CKRecordConvertible & CKRecordRecoverable {+ var isSyncable: Bool { !isAzaharArticBase }+}class Game: Object, ObjectUpdatable {diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swiftindex e3f3c016..80402330 100644--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift@@ -767,16 +767,25 @@ class PlayViewController: GameViewController {}//设置外设控制器updateExternalGameController()- //如果需要加载默认配置+ // Load default core config after JIT is ready (sideload waits for CS_DEBUGGED first).LibretroCore.sharedInstance().forbitJIT = manicGame.safeMode+#if SIDE_LOAD+ StikJITHostCoordinator.shared.acquireIfNeeded(game: manicGame) { [weak self] in+ guard let self else { return }+ self.loadConfig()+ self.updateSkin()+ if !self.manicGame.safeMode {+ self.updateTriggerPro()+ }+ }+#elseloadConfig()- //更新皮肤updateSkin()- //更新TriggerProif !manicGame.safeMode {updateTriggerPro()}- //全屏模式的时候点击屏幕临时展示menu和flex按钮+#endif+ // In full-screen mode, tap the screen to temporarily show menu and flex buttons.view.addTapGesture(handler: { [weak self] _ inguard let self, self.isFullScreen else { return }self.showFlexButtonsTemporarily()@@ -858,12 +867,13 @@ class PlayViewController: GameViewController {//Libretro已经停止,不要在这里进行注销事项,应该在stop()函数中完成#if SIDE_LOAD- if #available(iOS 26.0, tvOS 26.0, *),- ((manicGame.gameType == .dos && ProcessInfo.processInfo.hasTXM) ||- manicGame.gameType == .symbian),- (LibretroCore.jitAvailable() && manicGame.jit) {- if UIApplication.shared.canOpenURL(R.URLs.EnableJITUrl) {- UIApplication.shared.open(R.URLs.EnableJITUrl)+ if LibretroCore.jitAvailable(), manicGame.supportJit, manicGame.jit, !manicGame.safeMode {+ if StikJITManager.shared.jitLaunchMode == .builtInDebugger, ProcessInfo.processInfo.hasTXM {+ StikJITHostCoordinator.shared.reacquireAfterDetach()+ } else {+ if #available(iOS 26.0, tvOS 26.0, *), ProcessInfo.processInfo.hasTXM {+ _ = StikJITHostCoordinator.shared.openExternalDebugger()+ }}}#endif@@ -1678,7 +1688,8 @@ extension PlayViewController {.ppsspp_texture_replacement: "disabled",.ppsspp_enable_wlan: "disabled",.ppsspp_internal_resolution: "480x272",- .ppsspp_cpu_core: "Interpreter"+ .ppsspp_cpu_core: "Interpreter",+ .ppsspp_software_rendering_jit: "disabled"], safeMode: true)} else if manicGame.gameType == .nes || manicGame.gameType == .fds {updateLibretroCoreConfigs(core: .Nestopia, configs: [@@ -1920,7 +1931,8 @@ extension PlayViewController {.ppsspp_language: languages[manicGame.region],.ppsspp_backend: backend,.ppsspp_texture_replacement: (manicGame.getExtraBool(key: ExtraKey.pspTexture.rawValue) ?? false) ? "enabled" : "disabled",- .ppsspp_cpu_core : enableJIT ? jitValue : "Interpreter"+ .ppsspp_cpu_core : enableJIT ? jitValue : "Interpreter",+ .ppsspp_software_rendering_jit: enableJIT ? "enabled" : "disabled"] + networkingConfigs)updatePSPResolution(manicGame.resolution, reload: false)diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swiftindex 052ad03c..c31339ed 100644--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift@@ -11,425 +11,380 @@ import UIKitimport Deviceclass JITSettingView: BaseView {-- class JITSettingViewCell: UICollectionViewCell {- private let jitView: UIView = {- let view = UIView()-- let container = UIView()- container.backgroundColor = R.Color.BackgroundSecondary- container.layerCornerRadius = R.Size.CornerRadiusMedium- view.addSubview(container)- container.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalToSuperview()- make.height.equalTo(R.Size.ItemHeightLarge)- }-- let iconView = IconView()- iconView.contentMode = .center- iconView.layerCornerRadius = 6- iconView.image = UIImage(symbol: .boltFill, font: R.Font.Footnote(emphasis: true), color: R.Color.LabelPrimary.forceStyle(.dark))- iconView.backgroundColor = R.Color.Indigo- container.addSubview(iconView)- iconView.snp.makeConstraints { make in- make.leading.equalToSuperview().offset(R.Size.ContentSpaceMedium)- make.size.equalTo(R.Size.IconSizeLarge)- make.centerY.equalToSuperview()- }-- let jitLabel = UILabel()- let jitEnable = LibretroCore.jitAvailable()- jitLabel.text = jitEnable ? R.string.localizable.jitAllow() : R.string.localizable.jitNotAllow()- jitLabel.textColor = jitEnable ? R.Color.Green : R.Color.Red- jitLabel.font = R.Font.Body(emphasis: true)- container.addSubview(jitLabel)- jitLabel.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.leading.equalTo(iconView.snp.trailing).offset(R.Size.ContentSpaceSmall)- }-- return view- }()-- private lazy var deviceView: UIView = {- let view = UIView()-- let titleContainerView = UIView()- view.addSubview(titleContainerView)- titleContainerView.snp.makeConstraints { make in- make.top.equalToSuperview().offset(R.Size.ContentSpaceTiny)- make.leading.trailing.equalToSuperview()- make.height.equalTo(R.Size.ItemHeightSmall)- }-- let titleLabel = UILabel()- titleLabel.text = R.string.localizable.device()- titleLabel.font = R.Font.Footnote(emphasis: true)- titleLabel.textColor = R.Color.LabelSecondary- titleContainerView.addSubview(titleLabel)- titleLabel.snp.makeConstraints { make in- make.edges.equalToSuperview()- }-- let storageContainer = UIView()- storageContainer.backgroundColor = R.Color.BackgroundSecondary- storageContainer.layerCornerRadius = R.Size.CornerRadiusMedium- view.addSubview(storageContainer)- storageContainer.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(titleContainerView.snp.bottom)- make.height.equalTo(240)- }-- func genItemView(symbol: SFSymbol, title: String, detail: String) -> UIView {- let containerView = UIView()-- let iconView = IconView()- iconView.contentMode = .center- iconView.layerCornerRadius = 6- iconView.image = UIImage(symbol: symbol, font: R.Font.Footnote(emphasis: true), color: R.Color.LabelPrimary.forceStyle(.dark))- iconView.backgroundColor = R.Color.LabelTertiary.forceStyle(.dark)- containerView.addSubview(iconView)- iconView.snp.makeConstraints { make in- make.leading.equalToSuperview().offset(R.Size.ContentSpaceMedium)- make.size.equalTo(R.Size.IconSizeLarge)- make.centerY.equalToSuperview()- }-- let titleLabel = UILabel()- titleLabel.text = title- titleLabel.textColor = R.Color.LabelPrimary- titleLabel.font = R.Font.Body(emphasis: true)- containerView.addSubview(titleLabel)- titleLabel.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.leading.equalTo(iconView.snp.trailing).offset(R.Size.ContentSpaceSmall)- }-- let detailLabel = UILabel()- detailLabel.text = detail- detailLabel.textColor = R.Color.LabelSecondary- detailLabel.font = R.Font.Caption()- containerView.addSubview(detailLabel)- detailLabel.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.trailing.equalToSuperview().inset(R.Size.ContentSpaceMedium)- }- return containerView- }-- //Install Source- var sourceDetail = ""- #if SIDE_LOAD- sourceDetail = "Sideload"- #else- sourceDetail = "AppStore"- #endif- let sourceView = genItemView(symbol: .appFill, title: R.string.localizable.installSource(), detail: sourceDetail)- storageContainer.addSubview(sourceView)- sourceView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalToSuperview()- make.height.equalTo(R.Size.ItemHeightLarge)- }--- //Device- let deviceView = genItemView(symbol: .iphone, title: R.string.localizable.device(), detail: Device.version().rawValue)- storageContainer.addSubview(deviceView)- deviceView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(sourceView.snp.bottom)- make.height.equalTo(R.Size.ItemHeightLarge)- }-- //System- let v = ProcessInfo.processInfo.operatingSystemVersion- let systemView = genItemView(symbol: .squareStack3dUpFill, title: R.string.localizable.system(), detail: "\(v.majorVersion).\(v.minorVersion).\(v.patchVersion)")- storageContainer.addSubview(systemView)- systemView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(deviceView.snp.bottom)- make.height.equalTo(R.Size.ItemHeightLarge)- }-- //Memory- let memoryBytes = ProcessInfo.processInfo.physicalMemory- let memoryView = genItemView(symbol: .memorychipFill, title: R.string.localizable.memory(), detail: FileType.humanReadableFileSize(memoryBytes, numeralSystem: 1000, decimalPlaces: 0) ?? "Unknown")- storageContainer.addSubview(memoryView)- memoryView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(systemView.snp.bottom)- make.height.equalTo(R.Size.ItemHeightLarge)- }-- return view- }()-+#if SIDE_LOAD- private let enableJITView: UIView = {- let view = UIView()- view.enablePressEffect = true- view.addTapGesture { gesture in- if UIApplication.shared.canOpenURL(R.URLs.EnableJITUrl) {- UIApplication.shared.open(R.URLs.EnableJITUrl)- } else {- UIView.makeToast(message: R.string.localizable.notInstall("StikDebug"))- }- }-- let container = UIView()- container.backgroundColor = R.Color.BackgroundSecondary- container.layerCornerRadius = R.Size.CornerRadiusMedium- view.addSubview(container)- container.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalToSuperview()- make.height.equalTo(R.Size.ItemHeightLarge)- }-- let iconView = IconView()- iconView.contentMode = .center- iconView.layerCornerRadius = 6- iconView.image = UIImage(symbol: .bolt,- font: R.Font.Footnote(emphasis: true),- color: R.Color.LabelPrimary.forceStyle(.dark))- iconView.backgroundColor = R.Color.BackgroundPrimary.forceStyle(.dark)- container.addSubview(iconView)- iconView.snp.makeConstraints { make in- make.leading.equalToSuperview().offset(R.Size.ContentSpaceMedium)- make.size.equalTo(R.Size.IconSizeLarge)- make.centerY.equalToSuperview()- }-- let label = UILabel()- label.text = LibretroCore.jitAvailable() ? R.string.localizable.reEnableJIT() : R.string.localizable.enableJIT()- label.textColor = R.Color.LabelPrimary- label.font = R.Font.Body(emphasis: true)- container.addSubview(label)- label.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.leading.equalTo(iconView.snp.trailing).offset(R.Size.ContentSpaceSmall)- }-- let chevronIconView = UIImageView(image: UIImage(symbol: .chevronRight, font: R.Font.Caption(emphasis: true), color: R.Color.LabelSecondary))- chevronIconView.contentMode = .center- container.addSubview(chevronIconView)- chevronIconView.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.trailing.equalToSuperview().inset(R.Size.ContentSpaceMedium)- }-- return view- }()+ private enum Row {+ case status+ case activeDebugger+ case source+ case device+ case system+ case memory+ case txm+ case jitPath+ case method+ case autoEnableOnLaunch+ case enable+ case pairing+ case prepare+ case resetDDI+ }#else- private let installSideloadView: UIView = {- let view = UIView()- view.enablePressEffect = true- view.addTapGesture { gesture in- if UIApplication.shared.canOpenURL(R.URLs.InstallSideload) {- UIApplication.shared.open(R.URLs.InstallSideload)- } else {- UIApplication.shared.open(R.URLs.SideStore)- }- }-- let container = UIView()- container.backgroundColor = R.Color.BackgroundSecondary- container.layerCornerRadius = R.Size.CornerRadiusMedium- view.addSubview(container)- container.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalToSuperview()- make.height.equalTo(R.Size.ItemHeightLarge)- }-- let iconView = UIImageView()- iconView.contentMode = .center- iconView.layerCornerRadius = 6- iconView.image = R.image.customArrowTriangleheadSwap()?.applySymbolConfig(font: R.Font.Footnote(emphasis: true), color: R.Color.LabelPrimary.forceStyle(.dark))- iconView.backgroundColor = R.Color.BackgroundPrimary.forceStyle(.dark)- container.addSubview(iconView)- iconView.snp.makeConstraints { make in- make.leading.equalToSuperview().offset(R.Size.ContentSpaceMedium)- make.size.equalTo(R.Size.IconSizeLarge)- make.centerY.equalToSuperview()- }-- let label = UILabel()- label.text = R.string.localizable.installSideloadVersion()- label.textColor = R.Color.LabelPrimary- label.font = R.Font.Body(emphasis: true)- container.addSubview(label)- label.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.leading.equalTo(iconView.snp.trailing).offset(R.Size.ContentSpaceSmall)- }-- let chevronIconView = UIImageView(image: UIImage(symbol: .chevronRight, font: R.Font.Caption(emphasis: true), color: R.Color.BackgroundTertiary))- chevronIconView.contentMode = .center- container.addSubview(chevronIconView)- chevronIconView.snp.makeConstraints { make in- make.centerY.equalTo(iconView)- make.trailing.equalToSuperview().inset(R.Size.ContentSpaceMedium)- }-- return view- }()+ private enum Row {+ case status+ case source+ case device+ case system+ case memory+ case installSideload+ }#endif- private let detailLabel: UILabel = {- let view = UILabel()- view.numberOfLines = 0- view.text = R.string.localizable.jitDesc()- view.font = R.Font.Caption()- view.textColor = R.Color.LabelSecondary- return view- }()-- override init(frame: CGRect) {- super.init(frame: frame)-- addSubview(jitView)- jitView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalToSuperview().offset(R.Size.ContentSpaceLarge)- make.height.equalTo(R.Size.ItemHeightLarge)- }-- addSubview(deviceView)- deviceView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(jitView.snp.bottom)- make.height.equalTo(288)- }+ private let showClose: Bool-#if SIDE_LOAD- addSubview(enableJITView)- enableJITView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(deviceView.snp.bottom).offset(R.Size.ContentSpaceLarge)- make.height.equalTo(R.Size.ItemHeightLarge)- }-#else- addSubview(installSideloadView)- installSideloadView.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(deviceView.snp.bottom).offset(R.Size.ContentSpaceLarge)- make.height.equalTo(R.Size.ItemHeightLarge)- }-#endif-- addSubview(detailLabel)- detailLabel.snp.makeConstraints { make in- make.leading.trailing.equalToSuperview()- make.top.equalTo(deviceView.snp.bottom).offset(92)- }-+ private lazy var listPageView: ASListPageView = {+ let view = ASListPageView(getListPage())+ view.didActionOccurred = { [weak self] action in+ self?.handleAction(action)}-- required init?(coder: NSCoder) {- fatalError("init(coder:) has not been implemented")- }- }-- private lazy var navigationView: ASNavigationView = {- var navigation = ASListPage.Navigation.defaultNavigation(title: "JIT",- titleIcon: .symbolImage(R.image.jit_iconSymbols()))- navigation.enableClose = showClose- let view = ASNavigationView(navigation)- view.didTapClose = { [weak self] in- guard let self = self else { return }- self.hide()- }- return view- }()-- private lazy var collectionView: UICollectionView = {- let view = UICollectionView(frame: .zero, collectionViewLayout: createLayout())- view.backgroundColor = .clear- view.contentInsetAdjustmentBehavior = .never- view.register(cellWithClass: JITSettingViewCell.self)- view.showsVerticalScrollIndicator = false- view.dataSource = self- view.delegate = self- view.isFocusable = true- view.contentInset = .insets(bottom: UIDevice.isPad ? (R.Size.ContentInsetBottom + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge) : R.Size.ContentInsetBottom)return view}()-- private let showClose: Boolrequired init?(parameters: Any...) {self.showClose = parameters.compactMap({ $0 as? Bool }).first ?? truesuper.init(frame: .zero)-- addSubview(navigationView)- navigationView.snp.makeConstraints { make in- if showClose {- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)- } else {- make.top.equalToSuperview().offset(R.Size.ContentInsetTop)- }- make.leading.trailing.equalTo(safeAreaLayoutGuide)- make.height.equalTo(R.Size.NavigationHeight)- }-- addSubview(collectionView)- collectionView.snp.makeConstraints { make in- make.top.equalTo(navigationView.snp.bottom)- make.leading.trailing.bottom.equalToSuperview()+ addSubview(listPageView)+ listPageView.snp.makeConstraints { make in+ make.edges.equalToSuperview()}}-+convenience init(showClose: Bool = true) {self.init(parameters: showClose)!}-+required init?(coder: NSCoder) {- fatalError("init(coder:) has not been implemented")+ fatalError("init(coder:) has been implemented")+ }++ private func reloadList() {+ listPageView.updatePage(getListPage())+ }++ private func visibleRows() -> [[Row]] {+#if SIDE_LOAD+ let info: [Row] = [.source, .device, .system, .memory, .txm, .jitPath]+ var actions: [Row] = []+ if StikJITManager.shared.showsMethodPicker {+ actions.append(.method)+ }+ if StikJITManager.shared.jitLaunchMode == .builtInDebugger {+ actions.append(.autoEnableOnLaunch)+ }+ actions.append(.enable)+ if StikJITManager.shared.jitLaunchMode == .builtInDebugger {+ actions += [.pairing, .prepare, .resetDDI]+ }+ return [[.status, .activeDebugger], info, actions]+#else+ return [[.status], [.source, .device, .system, .memory], [.installSideload]]+#endif}-- private func createLayout() -> UICollectionViewLayout {- let layout = UICollectionViewCompositionalLayout { sectionIndex, env in- //item布局- let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),- heightDimension: .fractionalHeight(1)))-- //group布局- let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .estimated(600)), subitems: [item])- group.contentInsets = NSDirectionalEdgeInsets(top: 0,- leading: R.Size.ContentSpaceMedium,- bottom: 0,- trailing: R.Size.ContentSpaceMedium)-- //section布局- let section = NSCollectionLayoutSection(group: group)- section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: R.Size.ContentSpaceSmall, trailing: 0)-- return section++ private func row(at indexPath: IndexPath) -> Row? {+ let rows = visibleRows()+ guard indexPath.section < rows.count, indexPath.row < rows[indexPath.section].count else {+ return nil}- return layout+ return rows[indexPath.section][indexPath.row]}-}-extension JITSettingView: UICollectionViewDataSource {-- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {- return 1+ private func handleAction(_ action: ASListPage.Action) {+ if let navigationValue = action.navigationValue {+ if navigationValue.isTapClose {+ hide()+ } else if let _ = navigationValue.tapToolsValue {+ let desc = EmulationCore.libretroCores.filter({ $0.supportJit }).reduce("", { result, core in+ var gameTypesString: String = ""+ if let gameTypes = core.gameTypes {+ gameTypesString = "(\(gameTypes.reduce("", { $0 + ($0.isEmpty ? "" : " ") + $1.localizedShortName })))"+ }+ return result + (result.isEmpty ? "" : " ") + core.name + gameTypesString+ })+ UIView.makeAlert(detail: R.string.localizable.jitSupportedDesc(desc), cancelTitle: R.string.localizable.gotIt())+ }+ return+ }+ guard let value = action.normalItemValue, let row = row(at: value.indexPath) else { return }+#if SIDE_LOAD+ switch row {+ case .method:+ showMethodPicker()+ case .autoEnableOnLaunch:+ guard let isOn = value.subActions?.extraValue as? Bool else { return }+ Settings.defalut.updateExtra(key: ExtraKey.autoEnableJITOnLaunch.rawValue, value: isOn)+ listPageView.updateCellData(value.cellData.updateNormalSwitch(state: isOn ? .on : .off),+ indexPath: value.indexPath,+ reloadView: false)+ case .enable:+ enableJITTapped()+ case .pairing:+ importPairingTapped()+ case .prepare:+ prepareTapped()+ case .resetDDI:+ resetDDITapped()+ default:+ break+ }+#else+ if row == .installSideload {+ if UIApplication.shared.canOpenURL(R.URLs.InstallSideload) {+ UIApplication.shared.open(R.URLs.InstallSideload)+ } else {+ UIApplication.shared.open(R.URLs.SideStore)+ }+ }+#endif}-- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {- let cell = collectionView.dequeueReusableCell(withClass: JITSettingViewCell.self, for: indexPath)- return cell++ private func getListPage() -> ASListPage {+ var navigation = ASListPage.Navigation.defaultNavigation(+ title: "JIT",+ titleIcon: .symbolImage(R.image.jit_iconSymbols()),+ tools: [.symbolImage(R.image.faq_iconSymbols())])+ navigation.enableClose = showClose++ let jitEnable = LibretroCore.jitAvailable()+ let statusCell = ASListPage.Cell.normal([+ .icon(.symbol(.boltFill, colors: [R.Color.LabelPrimary.forceStyle(.dark)]), iconSize: R.Size.IconSizeLarge.height),+ .title(.largeText(jitEnable ? R.string.localizable.jitAllow() : R.string.localizable.jitNotAllow(),+ color: jitEnable ? R.Color.Green : R.Color.Red))+ ], enablePressEffect: false)++ #if SIDE_LOAD+ let sourceDetail = "Sideload"+ #else+ let sourceDetail = "AppStore"+ #endif+ let version = ProcessInfo.processInfo.operatingSystemVersion+ let memoryBytes = ProcessInfo.processInfo.physicalMemory+ let memoryText = FileType.humanReadableFileSize(memoryBytes, numeralSystem: 1000, decimalPlaces: 0) ?? "Unknown"++ var infoCells: [ASListPage.Cell] = [+ .iconTitleDetailCell(icon: .symbol(.appFill), title: R.string.localizable.installSource(), detail: sourceDetail, enablePressEffect: false),+ .iconTitleDetailCell(icon: .symbol(.iphone), title: R.string.localizable.device(), detail: Device.version().rawValue, enablePressEffect: false),+ .iconTitleDetailCell(icon: .symbol(.squareStack3dUpFill), title: R.string.localizable.system(), detail: "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)", enablePressEffect: false),+ .iconTitleDetailCell(icon: .symbol(.memorychipFill), title: R.string.localizable.memory(), detail: memoryText, enablePressEffect: false)+ ]+#if SIDE_LOAD+ let txmDetail = ProcessInfo.processInfo.hasTXMSilicon+ ? R.string.localizable.jitTxmPresent()+ : R.string.localizable.jitTxmNotPresent()+ let pathDetail: String+ switch ProcessInfo.processInfo.jitMemoryPath {+ case .legacy:+ pathDetail = R.string.localizable.jitPathLegacy()+ case .ppl:+ pathDetail = R.string.localizable.jitPathPPL()+ case .txm:+ pathDetail = R.string.localizable.jitPathTXM()+ }+ infoCells.append(.iconTitleDetailCell(+ icon: .symbol(.cpu),+ title: R.string.localizable.jitTxmStatus(),+ detail: txmDetail,+ enablePressEffect: false))+ infoCells.append(.iconTitleDetailCell(+ icon: .symbol(.arrowLeftArrowRight),+ title: R.string.localizable.jitPath(),+ detail: pathDetail,+ enablePressEffect: false))+#endif+ let infoSection = ASListPage.Section(cells: infoCells)++ #if SIDE_LOAD+ let mode = StikJITManager.shared.jitLaunchMode+ let enableTitle = jitEnable ? R.string.localizable.reEnableJIT() : R.string.localizable.enableJIT()+ var actionCells: [ASListPage.Cell] = []+ if StikJITManager.shared.showsMethodPicker {+ actionCells.append(.iconTitleChevronCell(+ icon: .symbolImage(R.image.jit_methodSymbols()),+ title: R.string.localizable.jitMethod(),+ chevronTitle: StikJITManager.shared.title(for: mode)))+ }+ if mode == .builtInDebugger {+ let autoEnable = Settings.defalut.getExtraBool(key: ExtraKey.autoEnableJITOnLaunch.rawValue) ?? true+ actionCells.append(.iconTitleDetailSwitchCell(+ icon: .symbol(.power),+ title: R.string.localizable.jitAutoEnableOnLaunch(),+ detail: R.string.localizable.jitAutoEnableOnLaunchDesc(),+ state: autoEnable ? .on : .off,+ enablePressEffect: false))+ }+ actionCells.append(.iconTitleChevronCell(icon: .symbolImage(R.image.jit_typeSymbols()), title: enableTitle))+ if mode == .builtInDebugger {+ actionCells.append(.iconTitleChevronCell(+ icon: .symbol(.docFill),+ title: R.string.localizable.jitImportPairingFile(),+ chevronTitle: StikJITManager.shared.pairingFileDisplayName))+ actionCells.append(.iconTitleChevronCell(+ icon: .symbol(.hammerFill),+ title: R.string.localizable.jitPrepare(),+ chevronTitle: StikJITManager.shared.preparationStatus))+ actionCells.append(.iconTitleChevronCell(+ icon: .symbol(.trash),+ title: R.string.localizable.jitResetDDI()))+ }+ var statusSection = ASListPage.Section(cells: [+ statusCell,+ .iconTitleDetailCell(+ icon: .symbol(.dotRadiowavesLeftAndRight),+ title: R.string.localizable.jitActiveDebugger(),+ detail: StikJITHostCoordinator.shared.activeDebuggerDisplayName,+ enablePressEffect: false)+ ])+ statusSection.header = .texts([.smallText(R.string.localizable.jitDesc(), numberOfLines: 0)], pin: false)+ var actionSection = ASListPage.Section(cells: actionCells)+ if StikJITManager.shared.showsMethodPicker {+ actionSection.footer = .texts([.smallText(R.string.localizable.jitMethodBuiltInInfo(), numberOfLines: 0)], pin: false)+ }+ let sections = [+ statusSection,+ infoSection,+ actionSection+ ]+ #else+ var lastSection = ASListPage.Section(cells: [+ .iconTitleChevronCell(+ icon: .symbolImage(R.image.customArrowTriangleheadSwap() ?? UIImage()),+ title: R.string.localizable.installSideloadVersion())+ ])+ lastSection.footer = .texts([.smallText(R.string.localizable.jitDesc(), numberOfLines: 0)], pin: false)+ let sections = [+ ASListPage.Section(cells: [statusCell]),+ infoSection,+ lastSection+ ]+ #endif++ let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0+ return ASListPage(+ navigation: navigation,+ sections: sections,+ backgroundColor: .clear,+ listInsets: .insets(bottom: listInsetBottom),+ pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop))}-}-extension JITSettingView: UICollectionViewDelegate {-+#if SIDE_LOAD+ private func showMethodPicker() {+ let options = [+ R.string.localizable.jitMethodBuiltInDebugger(),+ R.string.localizable.jitMethodExternalDebugger()+ ]+ let selected = StikJITManager.shared.jitLaunchMode == .builtInDebugger ? 0 : 1+ OptionsSheetView.show(+ icon: .symbolImage(R.image.jit_iconSymbols()),+ title: R.string.localizable.jitMethod(),+ detail: StikJITManager.shared.info(for: StikJITManager.shared.jitLaunchMode),+ options: options,+ selectedIndex: selected+ ) { [weak self] index in+ guard let index else { return }+ let mode: JITLaunchMode = index == 0 ? .builtInDebugger : .externalDebugger+ if mode == .builtInDebugger {+ if StikJITManager.shared.isRunningInLiveContainer {+ UIView.makeToast(message: R.string.localizable.jitLiveContainerUnavailable())+ return+ }+ if !StikJITManager.shared.isBuiltInAvailable {+ UIView.makeToast(message: R.string.localizable.jitRequiresiOS174())+ return+ }+ }+ StikJITManager.shared.jitLaunchMode = mode+ self?.reloadList()+ }+ }++ private func enableJITTapped() {+ if StikJITManager.shared.jitLaunchMode == .externalDebugger {+ if !StikJITHostCoordinator.shared.openExternalDebugger() {+ UIView.makeToast(message: R.string.localizable.notInstall("StikDebug"))+ }+ return+ }+ UIView.makeLoading(timeout: R.Numbers.WebLoadingViewTimeout)+ StikJITHostCoordinator.shared.acquireNow { [weak self] ok, message in+ if ok {+ UIView.makeToast(message: R.string.localizable.enableJITSuccess() )+ } else {+ UIView.makeAlert(+ title: R.string.localizable.enableJIT(),+ detail: message ?? R.string.localizable.errorUnknown(),+ detailAlignment: .center,+ cancelTitle: R.string.localizable.gotIt())+ }+ DispatchQueue.main.asyncAfter(delay: 0.35, execute: {+ UIView.hideLoading()+ })+ self?.reloadList()+ }+ }++ private func importPairingTapped() {+ StikJITManager.shared.presentPairingFilePicker { [weak self] ok, error in+ if let error {+ UIView.makeToast(message: error)+ } else if ok, StikJITManager.shared.hasPairingFile, StikJITManager.shared.isBuiltInAvailable {+ StikJITManager.shared.jitLaunchMode = .builtInDebugger+ }+ self?.reloadList()+ }+ }++ private func prepareTapped() {+ UIView.makeLoadingToast(message: R.string.localizable.jitPrepare())+ StikJITHostCoordinator.shared.prepareDevice { stage in+ UIView.makeLoadingToast(message: stage)+ } completion: { [weak self] ok, error in+ if ok {+ UIView.makeToast(message: R.string.localizable.jitPrepareSuccess())+ } else {+ UIView.makeAlert(+ title: R.string.localizable.jitPrepare(),+ detail: error ?? R.string.localizable.errorUnknown(),+ detailAlignment: .center,+ cancelTitle: R.string.localizable.gotIt())+ }+ self?.reloadList()+ DispatchQueue.main.asyncAfter(delay: 0.35, execute: {+ UIView.hideLoadingToast(forceHide: true)+ })+ }+ }++ private func resetDDITapped() {+ UIView.makeLoading(timeout: R.Numbers.WebLoadingViewTimeout)+ StikJITHostCoordinator.shared.resetCachedDDI { [weak self] ok, error in+ if ok {+ UIView.makeToast(message: R.string.localizable.jitResetDDISuccess())+ } else {+ UIView.makeAlert(+ title: R.string.localizable.jitPrepare(),+ detail: error ?? R.string.localizable.errorUnknown(),+ detailAlignment: .center,+ cancelTitle: R.string.localizable.gotIt())+ }+ self?.reloadList()+ DispatchQueue.main.asyncAfter(delay: 0.35, execute: {+ UIView.hideLoading()+ })+ }+ }+#endif}extension JITSettingView: ShowableView {-}diff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/EntitlementChecker.swift b/ManicEmu/ManicEmu/Sources/Tools/JIT/EntitlementChecker.swiftnew file mode 100644index 00000000..4eeec57d--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/EntitlementChecker.swift@@ -0,0 +1,48 @@+//+// EntitlementChecker.swift+// ManicEmu+//+// SPDX-License-Identifier: AGPL-3.0-or-later++#if SIDE_LOAD+import Foundation+import Darwin+import Security++enum EntitlementChecker {+ /// Host process only. Checking from the helper inspects the wrong executable.+ static var hasGetTaskAllow: Bool {+ typealias CreateFn = @convention(c) (CFAllocator?) -> Unmanaged<AnyObject>?+ typealias CopyFn = @convention(c) (+ AnyObject,+ CFString,+ UnsafeMutablePointer<Unmanaged<CFError>?>?+ ) -> Unmanaged<CFTypeRef>?++ let defaultHandle = UnsafeMutableRawPointer(bitPattern: -2)+ guard let createSymbol = dlsym(defaultHandle, "SecTaskCreateFromSelf"),+ let copySymbol = dlsym(defaultHandle, "SecTaskCopyValueForEntitlement") else {+ return false+ }++ let create = unsafeBitCast(createSymbol, to: CreateFn.self)+ let copy = unsafeBitCast(copySymbol, to: CopyFn.self)+ guard let task = create(nil)?.takeRetainedValue() else {+ return false+ }+ guard let value = copy(task, "get-task-allow" as CFString, nil)?.takeRetainedValue() else {+ return false+ }+ return (value as? NSNumber)?.boolValue == true+ }++ /// Debugger is attached right now. `CS_DEBUGGED` can still be set after detach.+ /// This is only a boolean: Xcode, StikDebug, AltStore, and SideStore all attach via debugserver.+ static var isCurrentlyTraced: Bool {+ ManicProcessIsTraced() != 0+ }+}++@_silgen_name("ManicProcessIsTraced")+private func ManicProcessIsTraced() -> Int32+#endifdiff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plist b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plistnew file mode 100644index 00000000..7a555eb1--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/Info.plist@@ -0,0 +1,41 @@+<?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>$(DEVELOPMENT_LANGUAGE)</string>+ <key>CFBundleDisplayName</key>+ <string>JITEnabler</string>+ <key>CFBundleExecutable</key>+ <string>$(EXECUTABLE_NAME)</string>+ <key>CFBundleIdentifier</key>+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>+ <key>CFBundleInfoDictionaryVersion</key>+ <string>6.0</string>+ <key>CFBundleName</key>+ <string>$(PRODUCT_NAME)</string>+ <key>CFBundlePackageType</key>+ <string>XPC!</string>+ <key>CFBundleShortVersionString</key>+ <string>1.0</string>+ <key>CFBundleVersion</key>+ <string>1</string>+ <key>NSExtension</key>+ <dict>+ <key>NSExtensionAttributes</key>+ <dict>+ <key>NSExtensionActivationRule</key>+ <string>FALSEPREDICATE</string>+ </dict>+ <key>NSExtensionPointIdentifier</key>+ <string>com.apple.ar.viewer</string>+ <key>NSExtensionPrincipalClass</key>+ <string>$(PRODUCT_MODULE_NAME).JITEnablerRequestHandler</string>+ </dict>+ <key>XPCService</key>+ <dict>+ <key>ServiceType</key>+ <string>Application</string>+ </dict>+</dict>+</plist>diff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerExtension.entitlements b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerExtension.entitlementsnew file mode 100644index 00000000..42cfb9cd--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerExtension.entitlements@@ -0,0 +1,8 @@+<?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>get-task-allow</key>+ <true/>+</dict>+</plist>diff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerRequestHandler.swift b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerRequestHandler.swiftnew file mode 100644index 00000000..145f0c6c--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/JITEnablerRequestHandler.swift@@ -0,0 +1,181 @@+//+// JITEnablerRequestHandler.swift+// JITEnabler+//+// SPDX-License-Identifier: AGPL-3.0-or-later++import Foundation+import Darwin+import os.log++@objc(StikJITRunnerXPCProtocol)+protocol StikJITRunnerXPCProtocol {+ func prepareDevice(pairingData: Data)+ func resetCachedDDI()+ func enableJIT(forParentPID pid: Int32, pairingData: Data, forceScript: Bool)+}++@objc(StikJITHostXPCProtocol)+protocol StikJITHostXPCProtocol {+ func preparationProgress(_ stage: String, fraction: Double, detail: String?)+ func preparationFinished(_ readiness: String, reason: String?, txmPresent: NSNumber?)+ func ddiResetFinished(_ ok: Bool, error: String?)+ func jitLog(_ line: String)+ func jitFinished(_ ok: Bool, error: String?)+}++private let kListenerEndpointKey = "ManicStikJITListenerEndpoint"+private let backendSelectedScript: StikJIT.Script = .universal+private let stikJITOSLog = OSLog(subsystem: "com.aoshuang.manicemu.JITEnabler", category: "StikJIT")++private func jitLog(_ message: String) {+#if DEBUG+ os_log(.default, log: stikJITOSLog, "%{public}@", message)+#endif+}++@objc(JITEnablerRequestHandler)+final class JITEnablerRequestHandler: NSObject, NSExtensionRequestHandling, StikJITRunnerXPCProtocol {+ private let operationQueue = DispatchQueue(label: "com.aoshuang.manicemu.jitenabler.stikjit", qos: .userInitiated)+ private var connection: NSXPCConnection?+ private var host: StikJITHostXPCProtocol?++ private let paths: DDIPaths = {+ let library = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)[0]+ return DDIPaths.default(in: library.appendingPathComponent("StikJIT"))+ }()++ func beginRequest(with context: NSExtensionContext) {+ guard let item = context.inputItems.first as? NSExtensionItem,+ let endpoint = item.userInfo?[kListenerEndpointKey] as? NSXPCListenerEndpoint else {+ jitLog("beginRequest missing XPC endpoint")+ context.cancelRequest(withError: NSError(domain: "JITEnablerRequestHandler", code: 1))+ return+ }++ let connection = NSXPCConnection(listenerEndpoint: endpoint)+ connection.exportedInterface = NSXPCInterface(with: StikJITRunnerXPCProtocol.self)+ connection.exportedObject = self+ connection.remoteObjectInterface = NSXPCInterface(with: StikJITHostXPCProtocol.self)+ connection.resume()+ self.connection = connection+ self.host = connection.remoteObjectProxyWithErrorHandler { error in+ jitLog("host XPC error: \(error.localizedDescription)")+ } as? StikJITHostXPCProtocol+ jitLog("runner alive pid=\(getpid()) ddiImage=\(paths.imagePath)")+ host?.jitLog("StikJIT runner alive, pid \(getpid())")+ }++ func prepareDevice(pairingData: Data) {+ let host = self.host+ operationQueue.async { [paths] in+ jitLog("prepareDevice pairingBytes=\(pairingData.count)")+ do {+ try Self.withTemporaryPairingFile(pairingData) { pairingFile in+ jitLog("prepareDevice pairingTemp=\(pairingFile.path)")+ let readiness = StikJIT.prepareDevice(+ pairingFile: pairingFile,+ paths: paths,+ configuration: .default+ ) { stage in+ let update = Self.preparationUpdate(for: stage)+ jitLog("prepare stage=\(update.stage) fraction=\(update.fraction) detail=\(update.detail ?? "")")+ host?.preparationProgress(update.stage, fraction: update.fraction, detail: update.detail)+ }++ switch readiness {+ case .unreachable(let reason):+ jitLog("prepare unreachable: \(reason)")+ host?.preparationFinished("unreachable", reason: reason, txmPresent: nil)+ case .preparationFailed(let reason):+ jitLog("prepare failed: \(reason)")+ host?.preparationFinished("preparationFailed", reason: reason, txmPresent: nil)+ case .ready(let securityState):+ jitLog("prepare ready txm=\(String(describing: securityState.isTXMPresent))")+ host?.preparationFinished(+ "ready",+ reason: nil,+ txmPresent: securityState.isTXMPresent.map(NSNumber.init(value:)))+ }+ }+ } catch {+ jitLog("prepare exception: \(error.localizedDescription)")+ host?.preparationFinished("preparationFailed", reason: error.localizedDescription, txmPresent: nil)+ }+ }+ }++ func resetCachedDDI() {+ let host = self.host+ operationQueue.async { [paths] in+ jitLog("resetCachedDDI \(paths.imagePath)")+ do {+ try StikJIT.resetCachedDDI(at: paths)+ jitLog("resetCachedDDI ok")+ host?.ddiResetFinished(true, error: nil)+ } catch {+ jitLog("resetCachedDDI failed: \(error.localizedDescription)")+ host?.ddiResetFinished(false, error: error.localizedDescription)+ }+ }+ }++ func enableJIT(forParentPID pid: Int32, pairingData: Data, forceScript: Bool) {+ let host = self.host+ operationQueue.async { [paths] in+ jitLog("enableJIT pid=\(pid) forceScript=\(forceScript) pairingBytes=\(pairingData.count)")+ do {+ try Self.withTemporaryPairingFile(pairingData) { pairingFile in+ try StikJIT.enableJIT(+ targetPID: pid,+ pairingFile: pairingFile,+ ddiPaths: paths,+ script: backendSelectedScript,+ forceScript: forceScript,+ preparationProgress: { stage in+ let update = Self.preparationUpdate(for: stage)+ let line = update.detail ?? update.stage+ jitLog("enableJIT prepare \(line)")+ host?.jitLog(line)+ },+ progress: { line in+ jitLog("enableJIT \(line)")+ host?.jitLog(line)+ })+ }+ jitLog("enableJIT finished ok")+ host?.jitFinished(true, error: nil)+ } catch {+ jitLog("enableJIT failed: \(error.localizedDescription)")+ host?.jitLog("enableJIT failed: \(error.localizedDescription)")+ host?.jitFinished(false, error: error.localizedDescription)+ }+ }+ }++ private static func withTemporaryPairingFile<T>(_ data: Data, operation: (URL) throws -> T) throws -> T {+ let url = FileManager.default.temporaryDirectory+ .appendingPathComponent("jitenabler-pairing-\(UUID().uuidString).plist")+ try data.write(to: url, options: .atomic)+ defer { try? FileManager.default.removeItem(at: url) }+ return try operation(url)+ }++ private static func preparationUpdate(for stage: StikJIT.PreparationStage) ->+ (stage: String, fraction: Double, detail: String?) {+ switch stage {+ case .checkingReachability:+ return ("Checking Network", 0, nil)+ case .checkingDDI:+ return ("Checking DDI", 0, nil)+ case .downloadingDDI(let fraction, let status):+ return ("Downloading", fraction, status)+ case .mountingDDI(let fraction):+ return ("Mounting", fraction, nil)+ case .verifyingDDI:+ return ("Verifying", 1, nil)+ case .ready:+ return ("Ready", 1, nil)+ }+ }+}diff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/main.m b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/main.mnew file mode 100644index 00000000..dcfdaa23--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/JITEnablerExtension/main.m@@ -0,0 +1,34 @@+//+// main.m+// JITEnabler+//+// SPDX-License-Identifier: AGPL-3.0-or-later++#import <Foundation/Foundation.h>+#import <dlfcn.h>+#import <objc/runtime.h>+#import <os/log.h>+#import <unistd.h>++static void ManicStikJITAllowXPCClass(id self, SEL _cmd, id cls, id key, BOOL allowingInvocations) {}++__attribute__((used, visibility("default")))+int NSExtensionMain(int argc, char* argv[]) {+#if DEBUG+ os_log_t log = os_log_create("com.aoshuang.manicemu.JITEnabler", "StikJIT");+ os_log_with_type(log, OS_LOG_TYPE_DEFAULT, "JITEnabler main pid %{public}d", getpid());+#endif+#pragma clang diagnostic push+#pragma clang diagnostic ignored "-Wundeclared-selector"+ Method method = class_getInstanceMethod(+ NSClassFromString(@"NSXPCDecoder"),+ @selector(_validateAllowedClass:forKey:allowingInvocations:));+ if (method) {+ method_setImplementation(method, (IMP)ManicStikJITAllowXPCClass);+ }+#pragma clang diagnostic pop++ int (*originalNSExtensionMain)(int, char**) =+ (int (*)(int, char**))dlsym(RTLD_NEXT, "NSExtensionMain");+ return originalNSExtensionMain(argc, argv);+}diff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITExtensionLauncher.swift b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITExtensionLauncher.swiftnew file mode 100644index 00000000..a403d297--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITExtensionLauncher.swift@@ -0,0 +1,176 @@+//+// StikJITExtensionLauncher.swift+// ManicEmu+//+// SPDX-License-Identifier: AGPL-3.0-or-later++#if SIDE_LOAD+import Foundation+import ObjectiveC.runtime++/// Starts the JITEnabler appex via private NSExtension APIs and hands back an XPC runner.+final class StikJITExtensionLauncher: NSObject, NSXPCListenerDelegate {+ private weak var host: StikJITHostXPCProtocol?+ private var listener: NSXPCListener?+ private var connection: NSXPCConnection?+ private var extensionObject: NSObject?+ private var requestId: NSUUID?+ private var childPID: Int32 = -1+ private var completed = false+ private var launchCompletion: ((Int32, StikJITRunnerXPCProtocol?, Error?) -> Void)?++ init(host: StikJITHostXPCProtocol) {+ self.host = host+ super.init()+ }++ func launch(completion: @escaping (Int32, StikJITRunnerXPCProtocol?, Error?) -> Void) {+ launchCompletion = completion++ let listener = NSXPCListener.anonymous()+ listener.delegate = self+ listener.resume()+ self.listener = listener++ guard let identifier = childBundleIdentifier() else {+ finish(-1, runner: nil, error: launcherError(code: 1, "StikJIT runner .appex not found"))+ return+ }++ var createError: NSError?+ guard let ext = createExtension(identifier: identifier, error: &createError) else {+ let reason = createError?.localizedDescription ?? "NSExtension creation failed"+ finish(-1, runner: nil, error: createError ?? launcherError(code: 2, reason))+ return+ }+ extensionObject = ext++ let interruptSel = NSSelectorFromString("setRequestInterruptionBlock:")+ if ext.responds(to: interruptSel) {+ let block: @convention(block) (NSUUID?) -> Void = { [weak self] _ in+ self?.finish(-1, runner: nil, error: self?.launcherError(code: 3, "runner interrupted before bootstrap"))+ }+ typealias SetBlock = @convention(c) (AnyObject, Selector, @convention(block) (NSUUID?) -> Void) -> Void+ if let method = class_getInstanceMethod(type(of: ext), interruptSel) {+ unsafeBitCast(method_getImplementation(method), to: SetBlock.self)(ext, interruptSel, block)+ }+ }++ let input = NSExtensionItem()+ input.userInfo = [kManicStikJITListenerEndpointKey: listener.endpoint]++ var requestError: NSError?+ let beginSel = NSSelectorFromString("beginExtensionRequestWithInputItems:error:")+ if ext.responds(to: beginSel) {+ typealias BeginFn = @convention(c) (AnyObject, Selector, NSArray, AutoreleasingUnsafeMutablePointer<NSError?>) -> AnyObject?+ let impl = class_getInstanceMethod(type(of: ext), beginSel).map { method_getImplementation($0) }+ if let impl {+ var err: NSError?+ let fn = unsafeBitCast(impl, to: BeginFn.self)+ let req = fn(ext, beginSel, [input] as NSArray, &err)+ requestId = req as? NSUUID+ requestError = err+ }+ } else {+ let sel = NSSelectorFromString("beginRequestWithInputItems:")+ if ext.responds(to: sel) {+ if let result = ext.perform(sel, with: [input])?.takeUnretainedValue() as? NSUUID {+ requestId = result+ }+ }+ }++ guard requestId != nil else {+ let reason = requestError?.localizedDescription ?? "begin extension request failed"+ finish(-1, runner: nil, error: requestError ?? launcherError(code: 4, reason))+ return+ }++ // pidForRequestIdentifier: returns pid_t, not an object. NSObject.perform would+ // treat that integer as a pointer and crash in swift_unknownObjectRetain.+ let pidSel = NSSelectorFromString("pidForRequestIdentifier:")+ if ext.responds(to: pidSel), let requestId,+ let method = class_getInstanceMethod(type(of: ext), pidSel) {+ typealias PIDFn = @convention(c) (AnyObject, Selector, NSUUID) -> Int32+ childPID = unsafeBitCast(method_getImplementation(method), to: PIDFn.self)(ext, pidSel, requestId)+ }++ DispatchQueue.main.asyncAfter(deadline: .now() + 12) { [weak self] in+ self?.finish(-1, runner: nil, error: self?.launcherError(code: 5, "timed out waiting for runner"))+ }+ }++ func invalidate() {+ connection?.invalidate()+ connection = nil+ if let ext = extensionObject, ext.responds(to: NSSelectorFromString("_kill:")) {+ let sel = NSSelectorFromString("_kill:")+ if let method = class_getInstanceMethod(type(of: ext), sel) {+ typealias KillFn = @convention(c) (AnyObject, Selector, Int32) -> Void+ unsafeBitCast(method_getImplementation(method), to: KillFn.self)(ext, sel, 9)+ }+ }+ extensionObject = nil+ listener?.invalidate()+ listener = nil+ }++ func listener(_ listener: NSXPCListener, shouldAcceptNewConnection newConnection: NSXPCConnection) -> Bool {+ if connection != nil {+ newConnection.invalidate()+ return false+ }+ connection = newConnection+ newConnection.exportedInterface = NSXPCInterface(with: StikJITHostXPCProtocol.self)+ newConnection.exportedObject = host+ newConnection.remoteObjectInterface = NSXPCInterface(with: StikJITRunnerXPCProtocol.self)+ newConnection.resume()+ let runner = newConnection.remoteObjectProxyWithErrorHandler { _ in } as? StikJITRunnerXPCProtocol+ finish(childPID, runner: runner, error: nil)+ return true+ }++ private func finish(_ pid: Int32, runner: StikJITRunnerXPCProtocol?, error: Error?) {+ guard !completed else { return }+ completed = true+ launchCompletion?(pid, runner, error)+ launchCompletion = nil+ }++ private func childBundleIdentifier() -> String? {+ guard let plugins = Bundle.main.builtInPlugInsURL,+ let items = try? FileManager.default.contentsOfDirectory(+ at: plugins,+ includingPropertiesForKeys: nil,+ options: .skipsHiddenFiles) else {+ return nil+ }+ for url in items where url.pathExtension == "appex" {+ if let identifier = Bundle(url: url)?.bundleIdentifier,+ identifier.hasSuffix(".JITEnabler") {+ return identifier+ }+ }+ return items.compactMap { url -> String? in+ guard url.pathExtension == "appex" else { return nil }+ return Bundle(url: url)?.bundleIdentifier+ }.first+ }++ private func createExtension(identifier: String, error: inout NSError?) -> NSObject? {+ guard let cls = NSClassFromString("NSExtension") as? NSObject.Type else { return nil }+ let sel = NSSelectorFromString("extensionWithIdentifier:excludingDisabledExtensions:error:")+ guard let method = class_getClassMethod(cls, sel) else { return nil }+ typealias CreateFn = @convention(c) (AnyClass, Selector, NSString, Bool, AutoreleasingUnsafeMutablePointer<NSError?>) -> AnyObject?+ let fn = unsafeBitCast(method_getImplementation(method), to: CreateFn.self)+ var err: NSError?+ let ext = fn(cls, sel, identifier as NSString, false, &err)+ error = err+ return ext as? NSObject+ }++ private func launcherError(code: Int, _ message: String) -> NSError {+ NSError(domain: "StikJITLauncher", code: code, userInfo: [NSLocalizedDescriptionKey: message])+ }+}+#endifdiff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITHostCoordinator.swift b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITHostCoordinator.swiftnew file mode 100644index 00000000..9c7ac346--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITHostCoordinator.swift@@ -0,0 +1,590 @@+//+// StikJITHostCoordinator.swift+// ManicEmu+//+// SPDX-License-Identifier: AGPL-3.0-or-later++#if SIDE_LOAD+import UIKit+import Darwin++final class StikJITHostCoordinator {+ static let shared = StikJITHostCoordinator()+ private static let acquireToastID = "StikJITAcquire"++ private let readinessTimeout: TimeInterval = 60+ private let closeSessionTimeout: TimeInterval = 3+ private var activeLauncher: StikJITExtensionLauncher?+ private var activeHost: HostBridge?+ private var readinessPoll: Timer?+ private var attemptID = 0+ private var publishAcquireProgress = false+ /// `enableJIT` is in the universal.js `while (!detached)` loop (TXM), so brk still works.+ private var scriptSessionLive = false+ private var acquireBusy = false+ private var pendingAcquires: [(AcquireReason, (Bool, String?) -> Void)] = []+ private var activeRunner: StikJITRunnerXPCProtocol?+ /// NSExtension cannot be relaunched in the same turn as `_kill`.+ private var helperNeedsRelaunchDelay = false+ private var closingForRemount = false+ /// True after this process called Built-in `enableJIT`. StikDebug-only sessions+ /// must not remount JITEnabler when the core has already DETACH'd.+ private var builtInAttachedThisProcess = false+ private let helperRelaunchDelay: TimeInterval = 1.0+ private let untraceTimeout: TimeInterval = 2.0++ private init() {}++ /// Who is actually attached. `jitLaunchMode` is only the user's preferred method.+ enum ActiveDebugger {+ case none+ case builtIn+ case external+ }++ var isBuiltInSessionLive: Bool { scriptSessionLive }++ /// StikDebug (or another debugger) is attached, and it is not our helper.+ var isExternallyTraced: Bool {+ EntitlementChecker.isCurrentlyTraced && !scriptSessionLive+ }++ var activeDebugger: ActiveDebugger {+ if scriptSessionLive { return .builtIn }+ if EntitlementChecker.isCurrentlyTraced { return .external }+ return .none+ }++ var activeDebuggerDisplayName: String {+ switch activeDebugger {+ case .builtIn:+ return R.string.localizable.jitMethodBuiltInDebugger()+ case .external:+ return R.string.localizable.jitMethodExternalDebugger()+ case .none:+ return R.string.localizable.jitDebuggerNotAttached()+ }+ }++ /// Game start: remount a TXM listening debugger if needed.+ /// `jitAvailable()` is the JIT environment at this moment. `loadConfig` will not+ /// enable core JIT when this is false, so do not attach here to create one.+ /// Legacy/PPL only need `CS_DEBUGGED` (already implied by `jitOn`). TXM also+ /// needs a live script / `P_TRACED` to handle `brk`.+ func acquireIfNeeded(game: Game, completion: @escaping () -> Void) {+ let jitOn = LibretroCore.jitAvailable()+ guard jitOn, game.supportJit, game.jit, !game.safeMode else {+ completion()+ return+ }+ if !ProcessInfo.processInfo.hasTXM {+ completion()+ return+ }++ let finish: (Bool, String?) -> Void = { ok, message in+ self.publishAcquireProgress = false+ UIView.hideToast(identifier: Self.acquireToastID)+ if !ok, let message {+ UIView.makeToast(message: message)+ }+ completion()+ }++ let debuggerListening = scriptSessionLive || EntitlementChecker.isCurrentlyTraced+ if debuggerListening {+ completion()+ return+ }+ acquire(reason: .gameLaunch, completion: finish)+ }++ /// Settings "Enable JIT" — always close a live TXM script then remount.+ func acquireNow(completion: @escaping (Bool, String?) -> Void) {+ acquire(reason: .manual, completion: completion)+ }++ /// Cold start: attach built-in JIT when auto-enable is on (default on).+ /// Scene `connectionOptions` cannot tell icon tap from StikDebug `process_control`+ /// relaunch — both look like a normal launch. A debugger-started process is already+ /// `P_TRACED` and/or `CS_DEBUGGED` before our code runs (cannot tell StikDebug vs Xcode).+ func enableOnLaunchIfNeeded() {+ guard StikJITManager.shared.jitLaunchMode == .builtInDebugger else { return }+ guard Settings.defalut.getExtraBool(key: ExtraKey.autoEnableJITOnLaunch.rawValue) ?? true else { return }+ guard StikJITManager.shared.isBuiltInAvailable, StikJITManager.shared.hasPairingFile else { return }+ if isLaunchedUnderExternalDebugger { return }+ acquireNow { ok, message in+ if ok {+ UIView.makeToast(message: R.string.localizable.enableJITSuccess())+ } else if let message, !message.isEmpty {+ UIView.makeToast(message: message)+ }+ }+ }++ /// True when this process was started (or attached) by a debugger before launch code ran.+ private var isLaunchedUnderExternalDebugger: Bool {+ EntitlementChecker.isCurrentlyTraced || LibretroCore.jitAvailable()+ }++ /// Game exit / cores that send CMD_DETACH: close then remount so the next launch can brk.+ func reacquireAfterDetach() {+ acquire(reason: .reattach, completion: { _, _ in })+ }++ func prepareDevice(progress: @escaping (String) -> Void, completion: @escaping (Bool, String?) -> Void) {+ guard #available(iOS 17.4, *) else {+ completion(false, R.string.localizable.jitRequiresiOS174())+ return+ }+ guard !StikJITManager.shared.isRunningInLiveContainer else {+ completion(false, R.string.localizable.jitLiveContainerUnavailable())+ return+ }+ guard EntitlementChecker.hasGetTaskAllow else {+ completion(false, R.string.localizable.jitGetTaskAllowMissing())+ return+ }+ guard let pairingData = pairingData() else {+ completion(false, R.string.localizable.jitPairingRequired())+ return+ }++ startHelper { runner, finish in+ self.activeHost?.onPreparationProgress = { stage, _, detail in+ DispatchQueue.main.async {+ progress(detail ?? stage)+ }+ }+ self.activeHost?.onPreparationFinished = { readiness, reason, _ in+ DispatchQueue.main.async {+ let hinted = reason.map(Self.troubleshootingHint)+ switch readiness {+ case "ready":+ StikJITManager.shared.updateReadiness(status: R.string.localizable.jitPrepareReady(), reason: nil)+ finish()+ completion(true, nil)+ case "unreachable":+ StikJITManager.shared.updateReadiness(status: R.string.localizable.jitPrepareUnreachable(), reason: hinted)+ finish()+ completion(false, StikJITManager.shared.preparationFailureReason)+ default:+ StikJITManager.shared.updateReadiness(status: R.string.localizable.jitPrepareNotReady(), reason: hinted)+ finish()+ completion(false, StikJITManager.shared.preparationFailureReason)+ }+ }+ }+ runner.prepareDevice(pairingData: pairingData)+ } failure: { error in+ StikJITManager.shared.updateReadiness(status: R.string.localizable.jitPrepareNotReady(), reason: error)+ completion(false, error)+ }+ }++ func resetCachedDDI(completion: @escaping (Bool, String?) -> Void) {+ guard #available(iOS 17.4, *) else {+ completion(false, R.string.localizable.jitRequiresiOS174())+ return+ }+ startHelper { runner, finish in+ self.activeHost?.onResetFinished = { ok, error in+ DispatchQueue.main.async {+ if ok {+ StikJITManager.shared.invalidateReadiness()+ }+ finish()+ completion(ok, error)+ }+ }+ runner.resetCachedDDI()+ } failure: { error in+ completion(false, error)+ }+ }++ @discardableResult+ func openExternalDebugger() -> Bool {+ guard UIApplication.shared.canOpenURL(R.URLs.EnableJITUrl) else {+ return false+ }+ UIApplication.shared.open(R.URLs.EnableJITUrl)+ return true+ }++ // MARK: - Private++ private enum AcquireReason {+ case gameLaunch+ case manual+ case reattach+ }++ private func acquire(reason: AcquireReason, completion: @escaping (Bool, String?) -> Void) {+ pendingAcquires.append((reason, completion))+ startNextAcquire()+ }++ private func startNextAcquire() {+ guard !acquireBusy, let job = pendingAcquires.first else { return }+ pendingAcquires.removeFirst()+ acquireBusy = true+ performAcquire(reason: job.0) { [weak self] ok, message in+ job.1(ok, message)+ // Let a same-turn jitFinished/onFinished run first so it cannot kill the next helper.+ DispatchQueue.main.async {+ self?.acquireBusy = false+ self?.startNextAcquire()+ }+ }+ }++ private func performAcquire(reason: AcquireReason, completion: @escaping (Bool, String?) -> Void) {+ let mode = StikJITManager.shared.jitLaunchMode++ if mode == .externalDebugger {+ if reason != .manual, EntitlementChecker.isCurrentlyTraced {+ completion(true, nil)+ return+ }+ if openExternalDebugger() {+ return+ }+ completion(false, R.string.localizable.notInstall("StikDebug"))+ return+ }++ if reason == .gameLaunch, scriptSessionLive {+ completion(true, nil)+ return+ }++ // A second vAttach while debugserver is already attached makes universal.js+ // spin on `c` with no T-packet (Failed to extract registers forever).+ if isExternallyTraced {+ if reason == .manual {+ completion(false, R.string.localizable.jitExternalDebuggerAttached())+ } else {+ completion(true, nil)+ }+ return+ }++ if reason == .gameLaunch {+ publishAcquireProgress = true+ showAcquireToast(R.string.localizable.enableJIT())+ } else {+ publishAcquireProgress = false+ }++ guard EntitlementChecker.hasGetTaskAllow else {+ completion(false, R.string.localizable.jitGetTaskAllowMissing())+ return+ }++ closeLiveScriptSession { [weak self] in+ self?.startEnableJIT(completion: completion)+ }+ }++ /// If universal.js is still in `while (!detached)`, send CMD_DETACH first.+ /// On success keep the helper — killing it and relaunching immediately yields+ /// "Couldn't communicate with a helper application".+ private func closeLiveScriptSession(completion: @escaping () -> Void) {+ guard scriptSessionLive, activeLauncher != nil, ProcessInfo.processInfo.hasTXM else {+ invalidateHelper()+ completion()+ return+ }++ Log.debug("[StikJIT] sending CMD_DETACH before remount")+ closingForRemount = true+ var closed = false+ let finish = { [weak self] (keepHelper: Bool) in+ guard let self, !closed else { return }+ closed = true+ self.scriptSessionLive = false+ self.closingForRemount = false+ if keepHelper {+ self.waitUntilNotTraced(completion: completion)+ } else {+ Log.debug("[StikJIT] CMD_DETACH timed out, dropping helper")+ self.invalidateHelper()+ completion()+ }+ }++ activeHost?.onFinished = { _, _ in+ DispatchQueue.main.async { finish(true) }+ }+ DispatchQueue.global(qos: .userInitiated).async {+ JIT26Detach()+ }+ DispatchQueue.main.asyncAfter(deadline: .now() + closeSessionTimeout) {+ finish(false)+ }+ }++ private func waitUntilNotTraced(completion: @escaping () -> Void) {+ let deadline = Date().addingTimeInterval(untraceTimeout)+ func tick() {+ if !EntitlementChecker.isCurrentlyTraced || Date() >= deadline {+ completion()+ return+ }+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: tick)+ }+ tick()+ }++ private func startEnableJIT(completion: @escaping (Bool, String?) -> Void) {+ guard #available(iOS 17.4, *) else {+ completion(false, R.string.localizable.jitRequiresiOS174())+ return+ }+ guard !StikJITManager.shared.isRunningInLiveContainer else {+ completion(false, R.string.localizable.jitLiveContainerUnavailable())+ return+ }+ guard let pairingData = pairingData() else {+ completion(false, R.string.localizable.jitPairingRequired())+ return+ }+ if EntitlementChecker.isCurrentlyTraced {+ completion(false, R.string.localizable.jitExternalDebuggerAttached())+ return+ }++ attemptID += 1+ let thisAttempt = attemptID+ let targetPID = Int32(getpid())+ let forceScript = StikJITManager.shared.shouldForceScript+ let alreadyDebugged = LibretroCore.jitAvailable()+ var didComplete = false+ let completeOnce: (Bool, String?) -> Void = { [weak self] ok, message in+ guard let self, thisAttempt == self.attemptID, !didComplete else { return }+ didComplete = true+ self.readinessPoll?.invalidate()+ self.readinessPoll = nil+ completion(ok, message)+ if !ok {+ self.invalidateHelper()+ }+ }++ let run: (StikJITRunnerXPCProtocol) -> Void = { [weak self] runner in+ guard let self, thisAttempt == self.attemptID else { return }+ self.activeRunner = runner+ self.activeHost?.onLog = { [weak self] line in+ Log.debug("[StikJIT] \(line)")+ DispatchQueue.main.async {+ if line.contains("attach_response")+ || line.contains("JIT enabled (debugger attached") {+ completeOnce(true, nil)+ }+ guard let self, self.publishAcquireProgress else { return }+ self.showAcquireToast(line)+ }+ }+ self.activeHost?.onFinished = { ok, message in+ DispatchQueue.main.async {+ guard thisAttempt == self.attemptID else { return }+ self.scriptSessionLive = false+ if ok {+ if LibretroCore.jitAvailable() {+ completeOnce(true, nil)+ }+ // TXM: script exited on DETACH after we already completed; drop idle helper.+ if didComplete {+ self.invalidateHelper()+ }+ return+ }+ let detail = (message?.isEmpty == false)+ ? Self.troubleshootingHint(message!)+ : R.string.localizable.jitPrepareNotReady()+ completeOnce(false, detail)+ }+ }+ self.scriptSessionLive = true+ self.builtInAttachedThisProcess = true+ runner.enableJIT(forParentPID: targetPID, pairingData: pairingData, forceScript: forceScript)+ // Re-attach while CS_DEBUGGED is already set: do not treat that flag as "listening".+ if !(forceScript && alreadyDebugged) {+ self.waitForReadiness { ok, message in+ completeOnce(ok, message)+ }+ }+ }++ let launchHelper = { [weak self] in+ guard let self, thisAttempt == self.attemptID else { return }+ self.startHelper(keepUntilJITFinished: true) { runner, _ in+ run(runner)+ } failure: { error in+ completeOnce(false, Self.troubleshootingHint(error))+ }+ }++ if let runner = activeRunner, activeLauncher != nil {+ run(runner)+ } else if helperNeedsRelaunchDelay {+ helperNeedsRelaunchDelay = false+ DispatchQueue.main.asyncAfter(deadline: .now() + helperRelaunchDelay, execute: launchHelper)+ } else {+ launchHelper()+ }++ DispatchQueue.main.asyncAfter(deadline: .now() + readinessTimeout) { [weak self] in+ guard let self, thisAttempt == self.attemptID, !didComplete else { return }+ completeOnce(false, R.string.localizable.jitAcquireTimeout())+ self.invalidateHelper()+ }+ }++ private func waitForReadiness(completion: @escaping (Bool, String?) -> Void) {+ if LibretroCore.jitAvailable() {+ completion(true, nil)+ return+ }++ readinessPoll?.invalidate()+ let deadline = Date().addingTimeInterval(readinessTimeout)+ readinessPoll = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { [weak self] timer in+ if LibretroCore.jitAvailable() {+ timer.invalidate()+ self?.readinessPoll = nil+ completion(true, nil)+ } else if Date() > deadline {+ timer.invalidate()+ self?.readinessPoll = nil+ completion(false, R.string.localizable.jitAcquireTimeout())+ }+ }+ if let poll = readinessPoll {+ RunLoop.main.add(poll, forMode: .common)+ }+ }++ private func pairingData() -> Data? {+ guard let url = StikJITManager.shared.currentPairingFileURL() else { return nil }+ return try? Data(contentsOf: url)+ }++ private func startHelper(+ keepUntilJITFinished: Bool = false,+ request: @escaping (StikJITRunnerXPCProtocol, @escaping () -> Void) -> Void,+ failure: @escaping (String) -> Void+ ) {+ if !keepUntilJITFinished, activeLauncher != nil {+ failure("Another StikJIT operation is already in progress.")+ return+ }+ let killedExisting = activeLauncher != nil+ invalidateHelper()++ let create = { [weak self] in+ guard let self else { return }+ let host = HostBridge()+ let launcher = StikJITExtensionLauncher(host: host)+ self.activeHost = host+ self.activeLauncher = launcher++ let finish: () -> Void = { [weak self] in+ self?.invalidateHelper()+ }++ if keepUntilJITFinished {+ host.onLog = { [weak self] line in+ Log.debug("[StikJIT] \(line)")+ DispatchQueue.main.async {+ guard let self, self.publishAcquireProgress else { return }+ self.showAcquireToast(line)+ }+ }+ }++ launcher.launch { _, runner, error in+ DispatchQueue.main.async {+ if let error {+ finish()+ failure(Self.troubleshootingHint(error.localizedDescription))+ return+ }+ guard let runner else {+ finish()+ failure("Could not create the StikJIT runner proxy.")+ return+ }+ request(runner, finish)+ }+ }+ }++ if killedExisting || helperNeedsRelaunchDelay {+ helperNeedsRelaunchDelay = false+ DispatchQueue.main.asyncAfter(deadline: .now() + helperRelaunchDelay, execute: create)+ } else {+ create()+ }+ }++ private func showAcquireToast(_ message: String) {+ UIView.makeToast(message: message, isRemovable: false, identifier: Self.acquireToastID)+ }++ private func invalidateHelper() {+ if activeLauncher != nil {+ helperNeedsRelaunchDelay = true+ }+ scriptSessionLive = false+ activeRunner = nil+ readinessPoll?.invalidate()+ readinessPoll = nil+ activeLauncher?.invalidate()+ activeLauncher = nil+ activeHost = nil+ }++ private static func troubleshootingHint(_ message: String) -> String {+ if message.contains("NSExtension creation failed") {+ return "\(message) StikJIT currently will not work inside LiveContainer."+ }+ if message.contains("Timed out connecting to 10.7.0.1:49152") {+ return "\(message) Make sure LocalDevVPN is connected and either a Wi-Fi network is connected or Airplane Mode is enabled."+ }+ if message.contains("Connection refused") {+ return "\(message) Reboot your device, then try again."+ }+ return message+ }+}++private final class HostBridge: NSObject, StikJITHostXPCProtocol {+ var onPreparationProgress: ((String, Double, String?) -> Void)?+ var onPreparationFinished: ((String, String?, NSNumber?) -> Void)?+ var onResetFinished: ((Bool, String?) -> Void)?+ var onLog: ((String) -> Void)?+ var onFinished: ((Bool, String?) -> Void)?++ func preparationProgress(_ stage: String, fraction: Double, detail: String?) {+ onPreparationProgress?(stage, fraction, detail)+ }++ func preparationFinished(_ readiness: String, reason: String?, txmPresent: NSNumber?) {+ onPreparationFinished?(readiness, reason, txmPresent)+ }++ func ddiResetFinished(_ ok: Bool, error: String?) {+ onResetFinished?(ok, error)+ }++ func jitLog(_ line: String) {+ onLog?(line)+ }++ func jitFinished(_ ok: Bool, error: String?) {+ onFinished?(ok, error)+ }+}+#endifdiff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITManager.swift b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITManager.swiftnew file mode 100644index 00000000..433c7e91--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITManager.swift@@ -0,0 +1,194 @@+//+// StikJITManager.swift+// ManicEmu+//+// SPDX-License-Identifier: AGPL-3.0-or-later++#if SIDE_LOAD+import UIKit+import UniformTypeIdentifiers+import Darwin++enum JITLaunchMode: Int {+ /// Includes the former Wait for Debugger (0) and StikDebug (1) stored values.+ case externalDebugger = 1+ case builtInDebugger = 2+}++final class StikJITManager: NSObject {+ static let shared = StikJITManager()++ private let kJITLaunchModeDefaultsKey = "jit_launch_mode"+ private let kPairingFileDisplayNameDefaultsKey = "stikjit_pairing_file_display_name"+ private let pairingFolderURL: URL+ private let pairingFileURL: URL+ private var pairingPickerHandler: ((URL?) -> Void)?++ private(set) var preparationStatus = ""+ private(set) var preparationFailureReason = ""++ override init() {+ let library = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)[0]+ pairingFolderURL = library.appendingPathComponent("StikJIT")+ pairingFileURL = pairingFolderURL.appendingPathComponent("pairingFile.plist")+ super.init()+ Self.migratePairingFileIfNeeded(to: pairingFileURL)+ try? FileManager.default.createDirectory(at: pairingFolderURL, withIntermediateDirectories: true)+ preparationStatus = R.string.localizable.jitPrepareNotChecked()+ }++ var showsMethodPicker: Bool {+ if #available(iOS 17.4, tvOS 17.4, *) {+ return true+ }+ return false+ }++ var isBuiltInAvailable: Bool {+ if isRunningInLiveContainer {+ return false+ }+ return showsMethodPicker+ }++ var isRunningInLiveContainer: Bool {+ getenv("LC_HOME_PATH") != nil+ }++ var jitLaunchMode: JITLaunchMode {+ get {+ guard isBuiltInAvailable else { return .externalDebugger }+ let stored: JITLaunchMode+ if let value = UserDefaults.standard.object(forKey: kJITLaunchModeDefaultsKey) as? NSNumber {+ stored = Self.mode(fromStoredValue: value.intValue)+ } else {+ stored = .builtInDebugger+ }+ if stored == .builtInDebugger && !isBuiltInAvailable {+ return .externalDebugger+ }+ return stored+ }+ set {+ UserDefaults.standard.set(newValue.rawValue, forKey: kJITLaunchModeDefaultsKey)+ }+ }++ /// Old: 0 wait / 1 StikDebug / 2 built-in. 0 and 1 both map to external.+ private static func mode(fromStoredValue value: Int) -> JITLaunchMode {+ value == JITLaunchMode.builtInDebugger.rawValue ? .builtInDebugger : .externalDebugger+ }++ /// TXM needs universal.js; legacy JIT and PPL attach without a script.+ var shouldForceScript: Bool {+ ProcessInfo.processInfo.hasTXM+ }++ var hasPairingFile: Bool {+ FileManager.default.fileExists(atPath: pairingFileURL.path)+ }++ var pairingFileDisplayName: String {+ guard hasPairingFile else { return R.string.localizable.jitPairingNotImported() }+ return UserDefaults.standard.string(forKey: kPairingFileDisplayNameDefaultsKey)+ ?? pairingFileURL.lastPathComponent+ }++ func currentPairingFileURL() -> URL? {+ hasPairingFile ? pairingFileURL : nil+ }++ func importPairingFile(_ sourceURL: URL) throws {+ try FileManager.default.createDirectory(at: pairingFolderURL, withIntermediateDirectories: true)+ let data = try Data(contentsOf: sourceURL)+ try data.write(to: pairingFileURL, options: .atomic)+ UserDefaults.standard.set(sourceURL.lastPathComponent, forKey: kPairingFileDisplayNameDefaultsKey)+ invalidateReadiness()+ }++ /// Documents/StikJIT was visible in Files sharing; Library is the canonical store.+ private static func migratePairingFileIfNeeded(to destination: URL) {+ let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]+ let legacyFolder = documents.appendingPathComponent("StikJIT")+ let legacyFile = legacyFolder.appendingPathComponent("pairingFile.plist")+ let fm = FileManager.default+ if fm.fileExists(atPath: legacyFile.path) {+ try? fm.createDirectory(at: destination.deletingLastPathComponent(), withIntermediateDirectories: true)+ if fm.fileExists(atPath: destination.path) {+ try? fm.removeItem(at: legacyFile)+ } else {+ try? fm.moveItem(at: legacyFile, to: destination)+ }+ }+ if let contents = try? fm.contentsOfDirectory(atPath: legacyFolder.path), contents.isEmpty {+ try? fm.removeItem(at: legacyFolder)+ }+ }++ func presentPairingFilePicker(completion: @escaping (Bool, String?) -> Void) {+ let types: [UTType] = [.propertyList, UTType(filenameExtension: "plist")].compactMap { $0 }+ let picker = UIDocumentPickerViewController(forOpeningContentTypes: types, asCopy: true)+ picker.delegate = self+ picker.allowsMultipleSelection = false+ pairingPickerHandler = { [weak self] url in+ guard let self, let url else {+ completion(false, nil)+ return+ }+ let access = url.startAccessingSecurityScopedResource()+ defer {+ if access {+ url.stopAccessingSecurityScopedResource()+ }+ }+ do {+ try self.importPairingFile(url)+ completion(true, nil)+ } catch {+ completion(false, error.localizedDescription)+ }+ }+ topViewController()?.present(picker, animated: true)+ }++ func invalidateReadiness() {+ preparationStatus = R.string.localizable.jitPrepareNotChecked()+ preparationFailureReason = ""+ }++ func updateReadiness(status: String, reason: String?) {+ preparationStatus = status+ preparationFailureReason = reason ?? ""+ }++ func title(for mode: JITLaunchMode) -> String {+ switch mode {+ case .externalDebugger:+ return R.string.localizable.jitMethodExternalDebugger()+ case .builtInDebugger:+ return R.string.localizable.jitMethodBuiltInDebugger()+ }+ }++ func info(for mode: JITLaunchMode) -> String {+ switch mode {+ case .externalDebugger:+ return R.string.localizable.jitMethodExternalInfo()+ case .builtInDebugger:+ return R.string.localizable.jitMethodBuiltInInfo()+ }+ }+}++extension StikJITManager: UIDocumentPickerDelegate {+ func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {+ pairingPickerHandler?(urls.first)+ pairingPickerHandler = nil+ }++ func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {+ pairingPickerHandler?(nil)+ pairingPickerHandler = nil+ }+}+#endifdiff --git a/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITXPC.swift b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITXPC.swiftnew file mode 100644index 00000000..20a00ce3--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Tools/JIT/StikJITXPC.swift@@ -0,0 +1,27 @@+//+// StikJITXPC.swift+// ManicEmu+//+// SPDX-License-Identifier: AGPL-3.0-or-later++#if SIDE_LOAD+import Foundation++let kManicStikJITListenerEndpointKey = "ManicStikJITListenerEndpoint"++@objc(StikJITRunnerXPCProtocol)+protocol StikJITRunnerXPCProtocol {+ func prepareDevice(pairingData: Data)+ func resetCachedDDI()+ func enableJIT(forParentPID pid: Int32, pairingData: Data, forceScript: Bool)+}++@objc(StikJITHostXPCProtocol)+protocol StikJITHostXPCProtocol {+ func preparationProgress(_ stage: String, fraction: Double, detail: String?)+ func preparationFinished(_ readiness: String, reason: String?, txmPresent: NSNumber?)+ func ddiResetFinished(_ ok: Bool, error: String?)+ func jitLog(_ line: String)+ func jitFinished(_ ok: Bool, error: String?)+}+#endifdiff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/EmulationCore.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/EmulationCore.swiftindex c7ffedb4..ad040b01 100644--- a/ManicEmu/ManicEmu/Sources/Tools/Others/EmulationCore.swift+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/EmulationCore.swift@@ -50,7 +50,8 @@ enum EmulationCore: CaseIterable {VICEx64sc,PUAE,gpSP,- MesenS+ MesenS,+ Symbianvar name: String {switch self {@@ -140,6 +141,8 @@ enum EmulationCore: CaseIterable {"gpSP"case .MesenS:"Mesen-S"+ case .Symbian:+ "Symbian"}}@@ -223,11 +226,17 @@ enum EmulationCore: CaseIterable {return [.gba]case .MesenS:return [.snes, .gb, .gbc]+ case .Symbian:+ return [.symbian]}}var isLibretroCore: Bool {- if self == .Citra || self == .J2meJS || self == .JGenesis || self == .freej2me {+ if self == .Citra ||+ self == .J2meJS ||+ self == .JGenesis ||+ self == .freej2me ||+ self == .Symbian {return false}return true@@ -270,4 +279,22 @@ enum EmulationCore: CaseIterable {return false}}++ var supportJit: Bool {+ switch self {+ case .Citra,+ .Azahar,+ .PPSSPP,+ .melonDSDS,+ .Mupen64PlushNext,+ .BeetlePSXHW,+ .Flycast,+ .DOSBoxPure,+ .Symbian,+ .Dolphin:+ return true+ default:+ return false+ }+ }}diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.c b/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.cindex 607c5b94..44adcade 100644--- a/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.c+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.c@@ -8,6 +8,14 @@#include <stddef.h>#include <stdio.h>+#include <string.h>+#include <sys/sysctl.h>+#include <sys/types.h>+#include <unistd.h>++#ifndef P_TRACED+#define P_TRACED 0x00000800+#endif__attribute__((noinline,optnone,naked))void BreakSendJITScript(char* script, size_t len) {@@ -15,3 +23,24 @@ void BreakSendJITScript(char* script, size_t len) {"brk #0xf00d \n""ret");}++// CMD_DETACH for universal.js (x16 = 0). A live TXM script sends D and exits+// so the next enableJIT can vAttach again. Harmless without a debugger (SIGTRAP skips).+__attribute__((noinline,optnone,naked))+void JIT26Detach(void) {+ asm("mov x16, #0 \n"+ "brk #0xf00d \n"+ "ret");+}++// True while a debugger is attached (P_TRACED). CS_DEBUGGED can outlive detach.+int ManicProcessIsTraced(void) {+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };+ struct kinfo_proc info;+ size_t size = sizeof(info);+ memset(&info, 0, sizeof(info));+ if (sysctl(mib, 4, &info, &size, NULL, 0) != 0) {+ return 0;+ }+ return (info.kp_proc.p_flag & P_TRACED) != 0;+}diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.swiftindex 9012fa07..368d3ed4 100644--- a/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.swift+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/UniversalScript.swift@@ -37,14 +37,31 @@ private func hasTXMSilicon() -> Bool {return major >= 14}+enum JITMemoryPath {+ case legacy+ case ppl+ case txm+}+public extension ProcessInfo {+ /// A15+ / M2+ silicon. Independent of OS version.+ var hasTXMSilicon: Bool { ManicEmu.hasTXMSilicon() }++ /// Allocator path cores use: iOS < 26 is always legacy W^X.+ internal var jitMemoryPath: JITMemoryPath {+ if operatingSystemVersion.majorVersion < 26 {+ return .legacy+ }+ return ManicEmu.hasTXMSilicon() ? .txm : .ppl+ }+var hasTXM: Bool {let v = operatingSystemVersionif v.majorVersion < 26 {Log.debug("[JIT Env] Device: Legacy machine=\(hardwareIdentifier())")return false}- let result = hasTXMSilicon()+ let result = ManicEmu.hasTXMSilicon()Log.debug("[JIT Env] Device: \(result ? "TXM" : "PPL") machine=\(hardwareIdentifier())")return result}@@ -54,6 +71,9 @@ public extension ProcessInfo {@_silgen_name("BreakSendJITScript")func BreakSendJITScript(_ script: UnsafePointer<CChar>!, _ length: size_t)+@_silgen_name("JIT26Detach")+func JIT26Detach()+func handler(sig: Int32, info: UnsafeMutablePointer<siginfo_t>?, context: UnsafeMutableRawPointer?) {guard let context = context else { return }let uc = context.bindMemory(to: ucontext_t.self, capacity: 1)diff --git a/StikJIT b/StikJITnew file mode 160000index 00000000..3623e725--- /dev/null+++ b/StikJIT@@ -0,0 +1 @@+Subproject commit 3623e725876f76aecb0520582ad6194bacb15d39