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
Support adding games via link
Daiuno310dfeadd097
diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxprojindex 24abd8e7..d666dbc6 100644--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj@@ -32,6 +32,7 @@3DD4E96091F64806BA370918 /* CollectionViewPagingLayout in Frameworks */ = {isa = PBXBuildFile; productRef = 578E209D2FD1B8CB00A2749A /* CollectionViewPagingLayout */; };3E00CA4429104FD6937382A8 /* SwiftCloudDrive in Frameworks */ = {isa = PBXBuildFile; productRef = 57F0D84A2DE2E7A600760F57 /* SwiftCloudDrive */; };478A7D3ED65840479AA36B1F /* Libretro.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57BFBE172DD32F7700AABF98 /* Libretro.framework */; };+ 54CDF4E1512F4F639EE3CDC2 /* WSC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B86ECC930242969A108735 /* WSC.swift */; };568CCBBFAD4A4409BB9E3CCB /* ColorfulX in Frameworks */ = {isa = PBXBuildFile; productRef = 5726FF452D741F5C00041AD5 /* ColorfulX */; };57047A0A2D85217C00C62FF6 /* PurchaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57047A092D85217400C62FF6 /* PurchaseView.swift */; };57047A0C2D852E7F00C62FF6 /* FeaturesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57047A0B2D852E7200C62FF6 /* FeaturesView.swift */; };@@ -964,6 +965,9 @@57BFBE772DD336E000AABF98 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57BFBE762DD336DD00AABF98 /* main.swift */; };57BFBE792DD336FC00AABF98 /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57BFBE782DD336F100AABF98 /* Application.swift */; };57BFBE902DD435C900AABF98 /* PSP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57BFBE8F2DD435C700AABF98 /* PSP.swift */; };+ 57C447183057D7E00099C15F /* AddUrlGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C447133057D7CB0099C15F /* AddUrlGameView.swift */; };+ 57C447193057D7E00099C15F /* AddUrlGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C447133057D7CB0099C15F /* AddUrlGameView.swift */; };+ 57C4471A3057D7E00099C15F /* AddUrlGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C447133057D7CB0099C15F /* AddUrlGameView.swift */; };57C65AE32FD6B2D200BB73E0 /* ASListPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C65ADF2FD6B2BA00BB73E0 /* ASListPageView.swift */; };57C65AE42FD6B2D200BB73E0 /* ASListPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C65ADF2FD6B2BA00BB73E0 /* ASListPageView.swift */; };57C65AEB2FD6B2E300BB73E0 /* ASListItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C65AE62FD6B2D600BB73E0 /* ASListItemView.swift */; };@@ -1550,6 +1554,7 @@57FD14143011C73D007F211A /* ShaderPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57FD140F3011C71E007F211A /* ShaderPreviewView.swift */; };57J2ME02F23397000EA24F1 /* J2ME.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57J2ME01F23397000EA24F1 /* J2ME.swift */; };5832261697984FE3A7919D8A /* ProHUD in Frameworks */ = {isa = PBXBuildFile; productRef = 578E20A92FD1C40700A2749A /* ProHUD */; };+ 58D0423D007B462DB353AA16 /* WSC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B86ECC930242969A108735 /* WSC.swift */; };5A74D5E598F44663BCC2F1EE /* Citra.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57C75AB02FD5575D0093A2B3 /* Citra.framework */; };5F5353532F884986BF3BA407 /* ObjcExceptionBridging in Frameworks */ = {isa = PBXBuildFile; productRef = 5713306B2D91AFE00043C28A /* ObjcExceptionBridging */; };5F74DFC689D94836B20159EB /* mednafen.ngp.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4C56A0D131A148448EA9816B /* mednafen.ngp.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };@@ -1585,6 +1590,7 @@A672B510CD9141B18392D564 /* NGP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78D4867970474EB9B27D4D8D /* NGP.swift */; };A8D9BF2608324215AB272D58 /* BlankSlate in Frameworks */ = {isa = PBXBuildFile; productRef = 578E23A42FD2AA0600A2749A /* BlankSlate */; };AA122ED56C3140C1864D4EC8 /* mednafen.pce.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9408D7BF872544CFABE4D652 /* mednafen.pce.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };+ AD7D0110DD684A0DA5505F08 /* WSC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B86ECC930242969A108735 /* WSC.swift */; };ADE1A2C2A17E4D50AE2EB564 /* PLzmaSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 570A27FF2DCF03CF001249C6 /* PLzmaSDK */; };AE5A3FEEB61B4A0B9DB6C05A /* JXBanner in Frameworks */ = {isa = PBXBuildFile; productRef = 578E23B62FD2B7D400A2749A /* JXBanner */; };B2383F512A2733DF000563E6 /* UIFontExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2383F502A2733DF000563E6 /* UIFontExtensions.swift */; };@@ -1642,9 +1648,6 @@F9A3C32228B84AD391F34585 /* NVActivityIndicatorView in Frameworks */ = {isa = PBXBuildFile; productRef = 578E26D32FD41D9300A2749A /* NVActivityIndicatorView */; };FDD0064DAC7645118F826ED7 /* Closures in Frameworks */ = {isa = PBXBuildFile; productRef = 578E231F2FD288C600A2749A /* Closures */; };FFD8F5F4CE02425E8BA80296 /* mednafen.pce.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9408D7BF872544CFABE4D652 /* mednafen.pce.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };- 58D0423D007B462DB353AA16 /* WSC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B86ECC930242969A108735 /* WSC.swift */; };- 54CDF4E1512F4F639EE3CDC2 /* WSC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B86ECC930242969A108735 /* WSC.swift */; };- AD7D0110DD684A0DA5505F08 /* WSC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B86ECC930242969A108735 /* WSC.swift */; };/* End PBXBuildFile section *//* Begin PBXContainerItemProxy section */@@ -1883,6 +1886,7 @@/* Begin PBXFileReference section */03741E2E8CB24E5790E97476 /* puae.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = puae.libretro.framework; path = ../Cores/puae.libretro.framework; sourceTree = SOURCE_ROOT; };0A2DDA01B1DB4E15B8F0C5C6 /* Wii.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wii.swift; sourceTree = "<group>"; };+ 16B86ECC930242969A108735 /* WSC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSC.swift; sourceTree = "<group>"; };2068D6E791D56FF6148997EA /* DOOM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DOOM.swift; sourceTree = "<group>"; };20B6A88FB41ED3142FD4FD9E /* prboom.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = prboom.libretro.framework; path = ../Cores/prboom.libretro.framework; sourceTree = SOURCE_ROOT; };25F38CF54CA347238295BE77 /* eka2l1.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = eka2l1.libretro.framework; path = ../Cores/eka2l1.libretro.framework; sourceTree = SOURCE_ROOT; };@@ -6497,6 +6501,7 @@57BFBE762DD336DD00AABF98 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };57BFBE782DD336F100AABF98 /* Application.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = "<group>"; };57BFBE8F2DD435C700AABF98 /* PSP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PSP.swift; sourceTree = "<group>"; };+ 57C447133057D7CB0099C15F /* AddUrlGameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddUrlGameView.swift; sourceTree = "<group>"; };57C65ADF2FD6B2BA00BB73E0 /* ASListPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ASListPageView.swift; sourceTree = "<group>"; };57C65AE62FD6B2D600BB73E0 /* ASListItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ASListItemView.swift; sourceTree = "<group>"; };57C7595C2FD451130093A2B3 /* System.core */ = {isa = PBXFileReference; lastKnownFileType = file; path = System.core; sourceTree = "<group>"; };@@ -6732,7 +6737,6 @@F0C500000000000000000106 /* FocusCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusCollectionView.swift; sourceTree = "<group>"; };F0C500000000000000000107 /* FocusSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusSystem.swift; sourceTree = "<group>"; };F0C500000000000000000108 /* FocusSystem+UIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FocusSystem+UIViewController.swift"; sourceTree = "<group>"; };- 16B86ECC930242969A108735 /* WSC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSC.swift; sourceTree = "<group>"; };/* End PBXFileReference section *//* Begin PBXFrameworksBuildPhase section */@@ -7211,6 +7215,7 @@577005B12D3E6E9F00762E8F /* Views */ = {isa = PBXGroup;children = (+ 57C447133057D7CB0099C15F /* AddUrlGameView.swift */,57CC357F2DC0683700DF7418 /* DownloadManageView.swift */,57B6EBDA2D7587FE002E619C /* GamesSelectionView.swift */,57E9632B2D6B06090022914C /* ImportFooterCollectionReusableView.swift */,@@ -13725,6 +13730,7 @@57909387303C7D9100A53656 /* NGP.swift in Sources */,57909388303C7D9100A53656 /* PCE.swift in Sources */,57909389303C7D9100A53656 /* Wii.swift in Sources */,+ 57C4471A3057D7E00099C15F /* AddUrlGameView.swift in Sources */,5790938A303C7D9100A53656 /* NGC.swift in Sources */,5790938B303C7D9100A53656 /* Symbian.swift in Sources */,5790938C303C7D9100A53656 /* FocusTypes.swift in Sources */,@@ -14188,6 +14194,7 @@A672B510CD9141B18392D564 /* NGP.swift in Sources */,1CAAD3DB49C34DAD998DD033 /* PCE.swift in Sources */,0E964747C5B24B348A8665E0 /* Wii.swift in Sources */,+ 57C447193057D7E00099C15F /* AddUrlGameView.swift in Sources */,3008E79240634E729DB35FEB /* NGC.swift in Sources */,75A984D24586436BA6AF31C9 /* Symbian.swift in Sources */,F0C500000000000000000201 /* FocusTypes.swift in Sources */,@@ -15034,6 +15041,7 @@57D481FE3014A2480030A771 /* ShaderLIstView.swift in Sources */,5796DB3D2FE41A0A0051F661 /* ASRadio.swift in Sources */,570F59C02DC91FF5007BFD92 /* ColorPickerView.swift in Sources */,+ 57C447183057D7E00099C15F /* AddUrlGameView.swift in Sources */,57BF5EE22FDB09BC0073D318 /* ASRadioView.swift in Sources */,57B6ECBD2D7953EC002E619C /* CheatCodeListView.swift in Sources */,5760A3A63029E813002CCF6B /* ShaderToy.swift in Sources */,diff --git a/ManicEmu/ManicEmu/Resources/Info.plist b/ManicEmu/ManicEmu/Resources/Info.plistindex 11574e46..c44a32ae 100644--- a/ManicEmu/ManicEmu/Resources/Info.plist+++ b/ManicEmu/ManicEmu/Resources/Info.plist@@ -618,6 +618,14 @@<string>armsx2</string><string>armsx2-ios</string><string>armsx2ios</string>+ <string>delta</string>+ <string>retroarch</string>+ <string>ppsspp</string>+ <string>provenance</string>+ <string>gamma</string>+ <string>gba4ios</string>+ <string>consolesapp</string>+ <string>melocafe</string></array><key>LSRequiresIPhoneOS</key><true/>diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.stringsindex e2b16432..1b26681b 100644--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings@@ -1156,3 +1156,18 @@ Press the controller button to complete mapping...";"ResetTipsSuccess" = "Tips reset successfully";"EnableCarouselStyle" = "Enable Carousel Style";++"AddGameLink" = "Add Game Link";+"FetchGamesFromOtherEmulators" = "Import from Other Emulators";+"AddUrlGameName" = "Game Name";+"AddUrlGameNamePlaceholder" = "Enter a name";+"AddUrlGameUrl" = "URL Scheme";+"AddUrlGamePlatform" = "Platform";+"AddUrlGameAdd" = "Add";+"AddUrlGameInvalidUrl" = "Please enter a valid URL scheme, such as delta://game/...";+"AddUrlGameUnsupportedScheme" = "This URL scheme is not supported.";+"AddUrlGameAlreadyExists" = "This game link already exists.";+"AddUrlGameSuccess" = "Game link added";+"EditLink" = "Edit Link";+"AddUrlGameUpdated" = "Game link saved";+"AddGameLinkDesc" = "Supported emulators: %@";diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.stringsindex bdb7658a..a1318d8e 100644--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings@@ -1151,3 +1151,18 @@"ResetTipsSuccess" = "提示重置成功";"EnableCarouselStyle" = "启用轮播样式";++"AddGameLink" = "添加游戏链接";+"FetchGamesFromOtherEmulators" = "从其他模拟器导入";+"AddUrlGameName" = "游戏名称";+"AddUrlGameNamePlaceholder" = "请输入名称";+"AddUrlGameUrl" = "URL 方案";+"AddUrlGamePlatform" = "平台";+"AddUrlGameAdd" = "添加";+"AddUrlGameInvalidUrl" = "请输入有效的 URL 方案,例如 delta://game/...";+"AddUrlGameUnsupportedScheme" = "不支持此 URL 方案。";+"AddUrlGameAlreadyExists" = "该游戏链接已存在。";+"AddUrlGameSuccess" = "游戏链接添加成功";+"EditLink" = "编辑链接";+"AddUrlGameUpdated" = "游戏链接保存成功";+"AddGameLinkDesc" = "支持的模拟器:%@";diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swiftindex 466579b2..f332f9a9 100644--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift@@ -94,4 +94,8 @@ enum ExtraKey: String {case wswanRotationcase wswanPalettecase arcadeType//naomi=1 atomiswave=2 segasp=3+ /// Game that launches a third-party emulator via a custom URL scheme.+ case isUrlGame+ /// Launch URL for `isUrlGame`. Game.id is an MD5 of this string so CreamAsset filenames stay valid.+ case urlGameURL}diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ChevronSheetView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ChevronSheetView.swiftindex f39c8271..9c9cc202 100644--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ChevronSheetView.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ChevronSheetView.swift@@ -81,4 +81,67 @@ class ChevronSheetView: BaseView {}})}++ /// Chevron sheet with named sections. `completion` receives the tapped `IndexPath`.+ static func show(icon: ASIcon = .symbolImage(R.image.ellipsis_iconSymbols()),+ title: String = R.string.localizable.moreSettingTitle(),+ detail: String? = nil,+ sections: [(header: String?, cells: [ASListPage.Cell])],+ cancelEnable: Bool = true,+ dismissOnTap: Bool = true,+ completion: ((_ indexPath: IndexPath?) -> Void)? = nil) {+ let validSections = sections.filter({ !$0.cells.isEmpty })+ guard validSections.count > 0 else {+ completion?(nil)+ return+ }++ var navigation = ASListPage.Navigation.defaultNavigation(title: title, titleIcon: icon)+ navigation.enableClose = cancelEnable++ let listSections: [ASListPage.Section] = validSections.enumerated().map { index, section in+ var header: ASListPage.Supplementary? = nil+ if let headerTitle = section.header, !headerTitle.isEmpty {+ header = .defaultHeader(title: headerTitle)+ }+ if index == 0, let detail, !detail.isEmpty {+ var texts = [ASText.smallText(detail, numberOfLines: 0)]+ if let headerTitle = section.header, !headerTitle.isEmpty {+ texts.append(.init(attributes: .init(text: headerTitle,+ color: R.Color.LabelSecondary,+ font: R.Font.Subheadline(emphasis: true))))+ }+ header = .texts(texts, pin: false)+ }+ return .init(cells: section.cells, header: header)+ }++ let listPage = ASListPage(navigation: navigation,+ sections: listSections,+ backgroundColor: .clear)+ var didComplete = false+ ASSheetView.show(.init(style: .listPage(listPage)), action: { sheetAction, _ in+ if let indexPath = sheetAction.listPageValue?.normalItemValue?.indexPath {+ if dismissOnTap {+ didComplete = true+ return .dismiss {+ completion?(indexPath)+ }+ } else {+ completion?(indexPath)+ return .none+ }+ } else if let isTapClose = sheetAction.listPageValue?.navigationValue?.isTapClose, isTapClose {+ didComplete = true+ return .dismiss {+ completion?(nil)+ }+ }+ return .none+ }, dismiss: {+ if !didComplete {+ completion?(nil)+ }+ })+ }}diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOption.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOption.swiftindex 4a5fcc44..beee8e90 100644--- a/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOption.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOption.swift@@ -83,7 +83,8 @@ enum GameOption: Int, CaseIterable {coverScraping,dolphinCpuCore,slowMotion,- ndsLidToggle+ ndsLidToggle,+ editLink//When adding a new option, make sure to add it at the end; otherwise, it might affect the existing Prefference configurations@@ -109,7 +110,7 @@ enum GameOption: Int, CaseIterable {.symbolImage(R.image.category_iconSymbols())case .genHomeMenu:.symbolImage(R.image.home_iconSymbols())- case .copyLink:+ case .copyLink, .editLink:.symbolImage(R.image.link_iconSymbols())case .shareRom:.symbolImage(R.image.shareRa_iconSymbols())@@ -262,6 +263,8 @@ enum GameOption: Int, CaseIterable {R.string.localizable.generateHomeMenu()case .copyLink:R.string.localizable.copyLaunchLinkTitle()+ case .editLink:+ R.string.localizable.editLink()case .retroAchievements:"RetroAchievements"case .cheatCode:@@ -440,6 +443,7 @@ enum GameOption: Int, CaseIterable {private static let disableOptionsForMultiGames: [Self] = [.rename,.cover,+ .editLink,.stateList,.importSave,.copyLink,@@ -466,6 +470,7 @@ enum GameOption: Int, CaseIterable {[.rename,.cover,+ .editLink,.coverScraping,.skins],@@ -984,6 +989,7 @@ enum GameOption: Int, CaseIterable {case .rename,.cover,+ .editLink,.skins,.stateList,.importSave,@@ -1095,6 +1101,10 @@ enum GameOption: Int, CaseIterable {return options}+ if game.isUrlGame {+ return [.cover, .editLink, .delete]+ }+if game.gameType.externalType {return [.rename, .cover, .delete]}@@ -1108,6 +1118,7 @@ enum GameOption: Int, CaseIterable {}var allOptions = Set(GameOption.allCases)+ allOptions.remove(.editLink)if GameType.gameTypes(multiPlatformFileExtension: game.fileExtension).count == 0 {allOptions.remove(.platformChange)diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOptionPerform.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOptionPerform.swiftindex 7f68015d..6ef4b43b 100644--- a/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOptionPerform.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Models/GameOptionPerform.swift@@ -26,6 +26,9 @@ extension GameOption {case .cover:GameCoverModifyView.show(game: firstGame)+ case .editLink:+ AddUrlGameView.show(game: firstGame)+case .stateList:pauseEmulationIfNeed()SaveStateListView.show(game: firstGame, hideCompletion: { savestate in@@ -122,7 +125,7 @@ extension GameOption {if !game.ngageRelativeFiles.isEmpty {game.uninstallFromSymbianStorage()}- } else if game.isRomExtsts {+ } else if !game.isUrlGame, game.isRomExtsts {if game.gameType == ._3ds, game.fileExtension.lowercased() == "app", let range = game.romUrl.path.range(of: "/content/") {let gamePath = String(game.romUrl.path[...range.lowerBound])try FileManager.safeRemoveItem(at: URL(fileURLWithPath: gamePath))diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddUrlGameView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddUrlGameView.swiftnew file mode 100644index 00000000..638c8c8c--- /dev/null+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddUrlGameView.swift@@ -0,0 +1,508 @@+//+// AddUrlGameView.swift+// ManicEmu+//+// Created by Daiuno on 2026/9/14.+// Copyright © 2026 Manic EMU. All rights reserved.+//++import UIKit+import RealmSwift+import IceCream++class AddUrlGameView: BaseView {++ private enum FormSection: Int {+ case name = 0+ case platform+ case url+ }++ private let selectableGameTypes = System.allGameTypes+ private var selectedGameType: GameType+ private var nameText = ""+ private var urlText = ""+ private let editingGame: Game?+ private var coverRemoved = false++ private let draftGame: Game = {+ let game = Game()+ game.id = UUID().uuidString+ game.fileExtension = Game.urlGameFileExtension+ game.gameType = .gba+ return game+ }()++ private lazy var coverHost: UrlGameCoverSlotView = {+ let view = UrlGameCoverSlotView()+ view.didTapEdit = { [weak self] in+ self?.pickCover()+ }+ view.apply(gameType: selectedGameType, image: nil)+ return view+ }()++ private lazy var listPageView: ASListPageView = {+ let view = ASListPageView(makeListPage())+ view.didActionOccurred = { [weak self] action in+ self?.handleAction(action)+ }+ return view+ }()++ required init?(parameters: Any...) {+ let unpacked: [Any]+ if let nested = parameters.first as? [Any], parameters.count == 1 {+ unpacked = nested+ } else {+ unpacked = Array(parameters)+ }+ let game = unpacked.compactMap({ $0 as? Game }).first+ self.editingGame = game+ if let game {+ self.nameText = game.displayName+ self.urlText = game.urlGameLaunchURL+ self.selectedGameType = game.gameType+ } else {+ self.selectedGameType = System.allGameTypes.first ?? ._3ds+ }+ super.init(frame: .zero)++ draftGame.name = nameText+ draftGame.gameType = selectedGameType+ if let game {+ draftGame.id = game.id+ }++ addSubview(listPageView)+ listPageView.snp.makeConstraints { make in+ make.edges.equalToSuperview()+ }++ if let game {+ if let data = game.gameCover?.storedData(), let image = UIImage(data: data) {+ coverHost.apply(gameType: selectedGameType, image: image)+ } else {+ coverHost.apply(gameType: selectedGameType, image: nil, previewGame: game)+ }+ }+ }++ @MainActor required init?(coder: NSCoder) {+ fatalError("init(coder:) has not been implemented")+ }++ private func coverSize(for gameType: GameType) -> CGSize {+ let size = CGSize(UIDevice.isPhone ? 180 : 160)+ let ratio = R.Size.GameCoverRatio(gameType: gameType)+ if ratio == 1 {+ return size+ } else if ratio < 1 {+ return CGSize(width: size.height * ratio, height: size.height)+ }+ return CGSize(width: size.width, height: size.width / max(ratio, 0.01))+ }++ private func coverHostHeight(for gameType: GameType) -> CGFloat {+ coverSize(for: gameType).height + R.Size.ContentSpaceLarge * 2+ }++ private func makeNameInput() -> ASInput {+ var input = ASInput.large(text: nameText,+ placeholder: R.string.localizable.addUrlGameNamePlaceholder())+ input.returnKeyType = .next+ input.autocapitalizationType = .words+ return input+ }++ private func makeURLInput() -> ASInput {+ var input = ASInput.large(text: urlText,+ placeholder: "delta://game/...")+ input.keyboardType = .URL+ input.returnKeyType = .done+ input.autocapitalizationType = .none+ input.autocorrectionType = .no+ return input+ }++ private func gameTypeTitle(_ gameType: GameType) -> String {+ R.Style.GamesGroupTitleStyle == .fullName ? gameType.localizedName : gameType.localizedShortName+ }++ private func gameTypeBrandIcon(_ gameType: GameType) -> (ASIcon, ASListPage.Cell.Style.IconSize) {+ if let image = gameType.brandImage {+ return (.image(image), .fixHeight(gameType == .lynx ? 16 : 20))+ }+ return (.symbolImage(R.image.category_iconSymbols()), .fixSize(CGSize(R.Size.ButtonExtraExtraSmall)))+ }++ private func gameTypeContentStyles(_ gameType: GameType) -> [ASListPage.Cell.Style] {+ if R.Style.GamesGroupTitleStyle == .brand {+ let (icon, iconSize) = gameTypeBrandIcon(gameType)+ return [.icon(icon, iconSize: iconSize)]+ }+ return [.title(.largeText(gameTypeTitle(gameType)))]+ }++ private func makePlatformCell() -> ASListPage.Cell {+ var styles = gameTypeContentStyles(selectedGameType)+ styles.append(.chevron(.init()))+ return .normal(styles)+ }++ private func makeListPage() -> ASListPage {+ ASListPage(navigation: .defaultNavigation(title: editingGame == nil+ ? R.string.localizable.addGameLink()+ : R.string.localizable.editLink(),+ titleIcon: .symbolImage(R.image.link_iconSymbols()),+ tools: [.symbolImage(R.image.faq_iconSymbols())]),+ top: (coverHost, .fixedHeight(coverHostHeight(for: selectedGameType)), false),+ sections: [+ .init(cells: [.input(makeNameInput())],+ header: .defaultHeader(title: R.string.localizable.addUrlGameName()),+ decoration: .init(style: .primary)),+ .init(cells: [makePlatformCell()],+ header: .defaultHeader(title: R.string.localizable.addUrlGamePlatform()),+ decoration: .init(style: .primary)),+ .init(cells: [.input(makeURLInput())],+ header: .defaultHeader(title: R.string.localizable.addUrlGameUrl()),+ decoration: .init(style: .primary))+ ],+ bottom: makeBottom(isValid: isFormFilled),+ backgroundColor: .clear,+ pageInsets: .insets(top: R.Size.SheetGrabberTopInset))+ }++ private var isFormFilled: Bool {+ !nameText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ && !urlText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ }++ private func makeBottom(isValid: Bool) -> ASButton {+ var button = ASButton.large(title: editingGame == nil+ ? R.string.localizable.addUrlGameAdd()+ : R.string.localizable.saveTitle(),+ titleColor: R.Color.LabelPrimary.forceStyle(.dark),+ titleAlignment: .center,+ background: R.Color.Main)+ var disableAttributes = button.allAttributes[.normal]!+ disableAttributes.background = R.Color.BackgroundSecondary+ disableAttributes.title?.attributes?.color = R.Color.LabelTertiary+ button.allAttributes[.disabled] = disableAttributes+ button.state = isValid ? .normal : .disabled+ return button+ }++ private func handleAction(_ action: ASListPage.Action) {+ if let inputValue = action.inputValue {+ switch inputValue.action {+ case .textChange(let text):+ if inputValue.indexPath.section == FormSection.name.rawValue {+ nameText = text ?? ""+ draftGame.name = nameText+ } else if inputValue.indexPath.section == FormSection.url.rawValue {+ urlText = text ?? ""+ }+ listPageView.bottom = makeBottom(isValid: isFormFilled)++ case .tapReturn(_):+ let isLast = inputValue.indexPath.section == FormSection.url.rawValue+ if isLast {+ listPageView.collectionView.endEditing(true)+ } else if let cell = listPageView.collectionView.cellForItem(at: IndexPath(row: 0, section: FormSection.url.rawValue)) as? ASListInputCollectionCell {+ cell.becomeFirstResponder()+ }++ default:+ break+ }+ return+ }++ if let indexPath = action.normalItemValue?.indexPath,+ indexPath.section == FormSection.platform.rawValue {+ showPlatformPicker()+ return+ }++ if action.isBottom {+ listPageView.collectionView.endEditing(true)+ addGame()+ return+ }++ if action.navigationValue?.isTapClose == true {+ hide()+ return+ }++ if action.navigationValue?.tapToolsValue != nil {+ let desc = EmulatorInteractionKit.supportedLaunchers.reduce("") { result, launcher in+ result + (result.isEmpty ? "" : " ") + "\(launcher.name)(\(launcher.scheme))"+ }+ UIView.makeAlert(detail: R.string.localizable.addGameLinkDesc(desc),+ cancelTitle: R.string.localizable.gotIt())+ }+ }++ private func showPlatformPicker() {+ let cells = selectableGameTypes.map { gameType -> ASListPage.Cell in+ var styles = gameTypeContentStyles(gameType)+ styles.append(.radio(.init(isSelected: gameType == selectedGameType)))+ return .normal(styles)+ }+ ASSheetView.show(.init(style: .simpleList(icon: .symbolImage(R.image.category_iconSymbols()),+ title: R.string.localizable.changeGameType(),+ options: [cells])),+ action: { [weak self] sheetAction, _ in+ guard let self else { return .dismiss() }+ if let indexPath = sheetAction.listPageValue?.normalItemValue?.indexPath,+ self.selectableGameTypes.indices.contains(indexPath.row) {+ return .dismiss {+ self.applySelectedGameType(self.selectableGameTypes[indexPath.row])+ }+ }+ return .dismiss()+ })+ }++ private func applySelectedGameType(_ gameType: GameType) {+ guard gameType != selectedGameType else { return }+ selectedGameType = gameType+ draftGame.gameType = gameType+ coverHost.apply(gameType: gameType,+ image: coverHost.pickedImage,+ previewGame: (coverHost.pickedImage == nil && !coverRemoved) ? editingGame : nil)+ listPageView.top = (coverHost, .fixedHeight(coverHostHeight(for: gameType)), false)+ listPageView.updateCellData(makePlatformCell(),+ indexPath: IndexPath(row: 0, section: FormSection.platform.rawValue))+ }++ private func pickCover() {+ draftGame.name = nameText+ draftGame.gameType = selectedGameType++ var sources: [ImageFetcher.Source] = [.capture, .library, .file]+ let trimmedName = nameText.trimmingCharacters(in: .whitespacesAndNewlines)+ if !trimmedName.isEmpty {+ sources.append(.libretro(draftGame))+ sources.append(.steamGridDB(draftGame, preferredAssetType: .grids))+ }+ if canDeleteCover {+ sources.append(.delete)+ }++ ImageFetcher.showCommonFetcher(sources: sources) { [weak self] image, source in+ guard let self else { return }+ if case .delete = source {+ self.coverRemoved = true+ self.coverHost.apply(gameType: self.selectedGameType, image: nil)+ return+ }+ guard let image else { return }+ self.coverRemoved = false+ self.coverHost.apply(gameType: self.selectedGameType, image: image)+ }+ }++ private var canDeleteCover: Bool {+ if coverRemoved { return false }+ if coverHost.pickedImage != nil { return true }+ if let game = editingGame, game.gameCover != nil || game.onlineCoverUrl != nil {+ return true+ }+ return false+ }++ private func addGame() {+ let name = nameText.trimmingCharacters(in: .whitespacesAndNewlines)+ guard !name.isEmpty else {+ UIView.makeToast(message: R.string.localizable.addUrlGameNamePlaceholder())+ return+ }++ switch EmulatorInteractionKit.validateLaunchURL(urlText) {+ case .invalid:+ UIView.makeToast(message: R.string.localizable.addUrlGameInvalidUrl())+ return+ case .unsupportedScheme:+ UIView.makeToast(message: R.string.localizable.addUrlGameUnsupportedScheme())+ return+ case .ok(let url):+ guard UIApplication.shared.canOpenURL(url) else {+ UIView.makeToast(message: R.string.localizable.notInstall(url.scheme ?? ""))+ return+ }+ let urlString = url.absoluteString+ let gameID = Game.urlGamePrimaryKey(for: urlString)+ let realm = Database.realm+ // Hash id is the current key; URL-as-id is only for rows created before this change.+ if let existing = realm.object(ofType: Game.self, forPrimaryKey: gameID)+ ?? realm.object(ofType: Game.self, forPrimaryKey: urlString) {+ if existing.id == editingGame?.id {+ persist(name: name, urlString: urlString, existing: existing)+ } else if existing.isDeleted, editingGame == nil {+ persist(name: name, urlString: urlString, existing: existing)+ } else {+ UIView.makeToast(message: R.string.localizable.addUrlGameAlreadyExists())+ }+ return+ }+ persist(name: name, urlString: urlString, existing: editingGame)+ }+ }++ private func creamAssetObjectID(for gameID: String) -> String {+ gameID.contains("://") ? Game.urlGamePrimaryKey(for: gameID) : gameID+ }++ private func persist(name: String, urlString: String, existing: Game?) {+ let coverData = coverHost.pickedImage?.jpegData(compressionQuality: 0.7)+ ?? coverHost.pickedImage?.pngData()+ let gameType = selectedGameType+ let extras = [+ ExtraKey.isUrlGame.rawValue: true,+ ExtraKey.urlGameURL.rawValue: urlString+ ].jsonData()+ let isLiveEdit = existing.map { !$0.isDeleted } ?? false+ let gameID = existing?.id ?? Game.urlGamePrimaryKey(for: urlString)+ let assetID = creamAssetObjectID(for: gameID)++ Game.change { realm in+ let game: Game+ if let existing {+ game = existing+ game.isDeleted = false+ } else {+ game = Game()+ game.id = gameID+ realm.add(game)+ }+ game.name = name+ game.aliasName = nil+ game.fileExtension = Game.urlGameFileExtension+ game.gameType = gameType+ if !isLiveEdit {+ game.importDate = Date()+ }+ game.extras = extras+ if coverRemoved {+ game.gameCover?.deleteAndClean(realm: realm)+ game.gameCover = nil+ game.onlineCoverUrl = nil+ game.hasCoverMatch = true+ } else if let coverData {+ game.gameCover?.deleteAndClean(realm: realm)+ game.gameCover = CreamAsset.create(objectID: assetID, propName: "gameCover", data: coverData)+ game.onlineCoverUrl = nil+ game.hasCoverMatch = true+ } else if !isLiveEdit {+ game.hasCoverMatch = false+ }+ }++ let saved = existing ?? Database.realm.object(ofType: Game.self, forPrimaryKey: gameID)+ if let saved, saved.gameCover == nil, !coverRemoved {+ OnlineCoverManager.shared.addCoverMatch(.init(game: saved))+ }+ NotificationCenter.default.post(name: R.NotificationName.GameCoverChange, object: nil)++ UIDevice.generateHaptic()+ hide()+ UIView.makeToast(message: isLiveEdit+ ? R.string.localizable.addUrlGameUpdated()+ : R.string.localizable.addUrlGameSuccess())+ }+}++extension AddUrlGameView: ShowableView {+ static func show(game: Game) {+ self.show(parameters: game)+ }+}++private final class UrlGameCoverSlotView: BaseView {+ var pickedImage: UIImage?+ var didTapEdit: (() -> Void)?++ private let coverContainerView: UIView = {+ let view = UIView()+ view.layer.cornerRadius = R.Size.CornerRadiusLarge+ view.makeShadow(ofColor: R.Color.BackgroundPrimary.forceStyle(.dark), radius: 30)+ return view+ }()++ private let coverView = GameCoverView()++ private lazy var cameraButton: ASButtonView = {+ let view = ASButtonView(.smallIconButton(icon: .symbolImage(R.image.camera_iconSymbols(), colors: [R.Color.Main]),+ background: R.Color.BackgroundTertiary).enableGlass(true))+ view.didTapButton = { [weak self] in+ self?.didTapEdit?()+ }+ return view+ }()++ override init(frame: CGRect) {+ super.init(frame: frame)++ addSubview(coverContainerView)+ coverContainerView.addSubview(coverView)+ coverView.snp.makeConstraints { make in+ make.edges.equalToSuperview()+ }++ addSubview(cameraButton)++ coverContainerView.isUserInteractionEnabled = true+ coverContainerView.addTapGesture { [weak self] _ in+ self?.didTapEdit?()+ }+ }++ @MainActor required init?(coder: NSCoder) {+ fatalError("init(coder:) has not been implemented")+ }++ func apply(gameType: GameType, image: UIImage?, previewGame: Game? = nil) {+ pickedImage = image+ let size = coverSize(for: gameType)+ coverContainerView.snp.remakeConstraints { make in+ make.center.equalToSuperview()+ make.size.equalTo(size)+ }+ cameraButton.snp.remakeConstraints { make in+ make.top.trailing.equalTo(coverContainerView).inset(R.Size.ContentSpaceExtraSmall)+ }++ let displayGame: Game+ if let previewGame, image == nil {+ displayGame = previewGame+ } else {+ let placeholderGame = Game()+ placeholderGame.gameType = gameType+ placeholderGame.fileExtension = Game.urlGameFileExtension+ displayGame = placeholderGame+ }+ coverView.setData(game: displayGame,+ coverSize: size,+ style: R.Style.GameCoverStyle,+ scalePlatform: false)+ if let image {+ coverView.imageView.image = image+ coverView.imageView.contentMode = .scaleAspectFill+ }+ coverView.layoutSubviews()+ }++ private func coverSize(for gameType: GameType) -> CGSize {+ let size = CGSize(UIDevice.isPhone ? 180 : 160)+ let ratio = R.Size.GameCoverRatio(gameType: gameType)+ if ratio == 1 {+ return size+ } else if ratio < 1 {+ return CGSize(width: size.height * ratio, height: size.height)+ }+ return CGSize(width: size.width, height: size.width / max(ratio, 0.01))+ }+}diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swiftindex d5064aef..5784cbaa 100644--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift@@ -31,27 +31,26 @@ class ImportServiceListView: BaseView {ASWebView.show(url: R.URLs.GameImportGuide)} else if index == 2 {//More- ChevronSheetView.show(stringOptions: [- R.string.localizable.fetchGamesFromMeloNX(),- R.string.localizable.fetchGamesFromXeniOS(),- R.string.localizable.fetchGamesFromDukeX(),- R.string.localizable.fetchGamesFromARMSX2(),- ], completion: { [weak self] index in- guard let self else { return }- if let index {- var type: EmulatorInteractionKit.EmulatorType? = nil- if index == 0 {- type = .meloNX- } else if index == 1 {- type = .xeniOS- } else if index == 2 {- type = .dukeX- } else if index == 3 {- type = .armsx2- }- if let type {- EmulatorInteractionKit.fetchGames(type: type)- }+ ChevronSheetView.show(sections: [+ (header: R.string.localizable.addGameLink(),+ cells: [.iconTitleChevronCell(icon: .symbolImage(R.image.link_iconSymbols()),+ title: R.string.localizable.addGameLink())]),+ (header: R.string.localizable.fetchGamesFromOtherEmulators(),+ cells: [+ .iconTitleChevronCell(title: R.string.localizable.fetchGamesFromMeloNX()),+ .iconTitleChevronCell(title: R.string.localizable.fetchGamesFromXeniOS()),+ .iconTitleChevronCell(title: R.string.localizable.fetchGamesFromDukeX()),+ .iconTitleChevronCell(title: R.string.localizable.fetchGamesFromARMSX2())+ ])+ ], completion: { indexPath in+ guard let indexPath else { return }+ if indexPath.section == 0 {+ AddUrlGameView.show()+ return+ }+ let types: [EmulatorInteractionKit.EmulatorType] = [.meloNX, .xeniOS, .dukeX, .armsx2]+ if types.indices.contains(indexPath.row) {+ EmulatorInteractionKit.fetchGames(type: types[indexPath.row])}})}diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swiftindex 447b8f97..29447e6c 100644--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift@@ -112,13 +112,31 @@ class Game: Object, ObjectUpdatable {static let DsiHomeMenuPrimaryKey = "Home Menu (DSi)"static let DOSHomeMenuPrimaryKey = "Home Menu (DOSBox)"static let SymbianHomePrimary = "Home Menu (Symbian)"+ /// Marker used by shortcut games that launch via a third-party URL scheme.+ static let urlGameFileExtension = "url"- ///安全模式+ /// CreamAsset filenames cannot contain URL `:`/`/`, so the Realm primary key is an MD5 of the launch URL.+ static func urlGamePrimaryKey(for urlString: String) -> String {+ urlString.data(using: .utf8)?.md5String ?? urlString+ }++ /// Safe modevar safeMode = false- ///文件是否存在+ /// Shortcut game stored as a URL scheme. Uses limited options, like `GameType.externalType`.+ var isUrlGame: Bool {+ getExtraBool(key: ExtraKey.isUrlGame.rawValue) == true+ || fileExtension.lowercased() == Self.urlGameFileExtension+ }++ /// Deep link used to open the third-party emulator. Falls back to `id` for older URL-as-primary-key rows.+ var urlGameLaunchURL: String {+ getExtraString(key: ExtraKey.urlGameURL.rawValue) ?? id+ }++ /// ROM file exists locally. URL games have no ROM file but still count as present.var isRomExtsts: Bool {- if isAzaharArticBase || gameType == .symbian {+ if isUrlGame || isAzaharArticBase || gameType == .symbian {return true}return FileManager.default.fileExists(atPath: romUrl.path)@@ -1157,6 +1175,7 @@ class Game: Object, ObjectUpdatable {gameType == .pm ||isJGenesisCore ||gameType.externalType ||+ isUrlGame ||isAtari ||(gameType == .ss && defaultCore == 0) ||gameType == .dc ||@@ -1269,6 +1288,7 @@ class Game: Object, ObjectUpdatable {gameType == .j2me ||(gameType == .n64 && !isN64ParaLLEl) ||gameType.externalType ||+ isUrlGame ||gameType == .symbian {return false}@@ -1397,8 +1417,8 @@ class Game: Object, ObjectUpdatable {/// Whether rewind is available. Requires savestate_features of serialized or higher.var supportRewind: Bool {- // Non-libretro and external types do not support rewind.- guard isLibretroType, !gameType.externalType else { return false }+ // Non-libretro, external platforms, and URL shortcuts do not support rewind.+ guard isLibretroType, !gameType.externalType, !isUrlGame else { return false }// Jaguar has savestate = false. DOOM, 3DS, DC, Symbian, NGC, and Wii are basic-only.if gameType == .jaguar ||gameType == .doom ||@@ -1609,7 +1629,7 @@ class Game: Object, ObjectUpdatable {let biosCompletion = gameType.isNDSBiosComplete()if (id == Game.DsHomeMenuPrimaryKey && !biosCompletion.isDSComplete) ||(id == Game.DsiHomeMenuPrimaryKey && !biosCompletion.isDsiComplete) {- //弹出bios导入页面+ // Prompt BIOS import when Home Menu BIOS files are missing.BIOSSelectionView.show(gameType: gameType)} else {PlayViewController.startGame(game: self, saveState: saveState)@@ -1617,7 +1637,11 @@ class Game: Object, ObjectUpdatable {} else if isSymbianHomeMenu {SymbianFirmwareView.show()} else if Settings.defalut.quickGame || forceQuick {- PlayViewController.startGame(game: self, saveState: saveState)+ if isUrlGame {+ EmulatorInteractionKit.openExternalGameURL(urlGameLaunchURL)+ } else {+ PlayViewController.startGame(game: self, saveState: saveState)+ }} else {if gameType == .unknown {PlatformSelectionView.show(games: [self])diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swiftindex 14ebb54d..c7c360cf 100644--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift@@ -150,6 +150,10 @@ class PlayViewController: GameViewController {private var skinSwitchBindDatas = [String: Bool]()static func startGame(game: Game, saveState: GameSaveState? = nil) {+ if game.isUrlGame {+ game.handleTapAction(forceQuick: true)+ return+ }if game.gameType == .ns {EmulatorInteractionKit.startGame(type: .meloNX, id: game.id)returndiff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swiftindex e9f2ec2f..353c94f5 100644--- a/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift@@ -21,6 +21,75 @@ struct EmulatorInteractionKit {case meloNX, xeniOS, dukeX, armsx2}+ /// Display name plus the public URL scheme. Extra ARMSX2 aliases stay in `supportedLaunchSchemes`.+ static let supportedLaunchers: [(name: String, scheme: String)] = [+ ("Delta", "delta"),+ ("RetroArch", "retroarch"),+ ("PPSSPP", "ppsspp"),+ ("Provenance", "provenance"),+ ("Gamma", "gamma"),+ ("GBA4iOS", "gba4ios"),+ ("MeloNX", "atariemulator"),+ ("XeniOS", "xenios"),+ ("DukeX", "dukex"),+ ("ARMSX2", "armsx2"),+ ("Consoles", "consolesapp"),+ ("MeloCafe", "melocafe")+ ]++ /// Schemes that must also be listed in `LSApplicationQueriesSchemes`.+ static let supportedLaunchSchemes: Set<String> = Set(supportedLaunchers.map(\.scheme)).union([+ "armsx2-ios",+ "armsx2ios"+ ])++ enum LaunchURLValidation {+ case ok(URL)+ case invalid+ case unsupportedScheme+ }++ /// Parse a pasted emulator deep link. Rejects http(s)/file and unknown schemes.+ static func validateLaunchURL(_ string: String) -> LaunchURLValidation {+ let trimmed = string.trimmingCharacters(in: .whitespacesAndNewlines)+ guard !trimmed.isEmpty else { return .invalid }+ guard let components = URLComponents(string: trimmed),+ let scheme = components.scheme?.lowercased(),+ !scheme.isEmpty else {+ return .invalid+ }+ if scheme == "http" || scheme == "https" || scheme == "file" || scheme == "ftp" {+ return .unsupportedScheme+ }+ guard supportedLaunchSchemes.contains(scheme) else {+ return .unsupportedScheme+ }+ if let url = components.url {+ return .ok(url)+ }+ if let url = URL(string: trimmed) {+ return .ok(url)+ }+ return .invalid+ }++ static func openExternalGameURL(_ string: String) {+ let trimmed = string.trimmingCharacters(in: .whitespacesAndNewlines)+ guard let url = URL(string: trimmed) ?? URLComponents(string: trimmed)?.url else {+ UIView.makeToast(message: R.string.localizable.addUrlGameInvalidUrl())+ return+ }+ UIApplication.shared.open(url, options: [:]) { success in+ guard !success else { return }+ DispatchQueue.main.async {+ let scheme = url.scheme ?? ""+ UIView.makeToast(message: scheme.isEmpty+ ? R.string.localizable.addUrlGameInvalidUrl()+ : R.string.localizable.notInstall(scheme))+ }+ }+ }+static func isInstalled(type: EmulatorType) -> Bool {switch type {case .meloNX:diff --git a/ManicEmu/ManicEmu/Sources/Tools/Sync/FilesSyncPolicy.swift b/ManicEmu/ManicEmu/Sources/Tools/Sync/FilesSyncPolicy.swiftindex 39897053..c7db99fd 100644--- a/ManicEmu/ManicEmu/Sources/Tools/Sync/FilesSyncPolicy.swift+++ b/ManicEmu/ManicEmu/Sources/Tools/Sync/FilesSyncPolicy.swift@@ -160,6 +160,7 @@ enum FilesSyncPolicy {return false#elseif game.gameType == .unknown || game.gameType == .notSupport { return false }+ if game.isUrlGame { return false }if game.gameType == .symbian { return true }if game.isAzaharArticBase { return false }if let explicit = explicitROMSyncFlag(game) {@@ -230,7 +231,7 @@ enum FilesSyncPolicy {extension Game {/// Local ROM files/directories that belong to this game for iCloud Drive include/exclude.var iCloudROMFileURLs: [URL] {- if isAzaharArticBase || gameType == .symbian {+ if isUrlGame || isAzaharArticBase || gameType == .symbian {return []}let url = romUrl