Skip to content

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

Add RomM client and import provider.

5auru5874c0577bca2
diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
index 87a739ed..8d69dc6c 100644
--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
@@ -359,6 +359,8 @@
579093BB303C7D9100A53656 /* ASListPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5796DAEF2FE413C70051F661 /* ASListPage.swift */; };
579093BC303C7D9100A53656 /* GamesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 577006822D438E2A00762E8F /* GamesViewController.swift */; };
579093BD303C7D9100A53656 /* WebDavServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F632AC2D6FEC25007270E8 /* WebDavServiceProvider.swift */; };
+ 68A011012026091500000002 /* RommClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A011012026091500000001 /* RommClient.swift */; };
+ 68A011012026091500000004 /* RommServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A011012026091500000003 /* RommServiceProvider.swift */; };
579093BE303C7D9100A53656 /* ThemeColorCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 570F590F2DC5BAF4007BFD92 /* ThemeColorCollectionViewCell.swift */; };
579093BF303C7D9100A53656 /* CheatTypeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B6ECCC2D798419002E619C /* CheatTypeExtensions.swift */; };
579093C0303C7D9100A53656 /* ARMaxDecrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B6ECD02D7984A0002E619C /* ARMaxDecrypt.swift */; };
@@ -1051,6 +1053,8 @@
57CDCDA92FD5CBD3005BA4C8 /* TransparentHoleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 579076EF2D8AAC2800ED90FB /* TransparentHoleView.swift */; };
57CDCDAA2FD5CBD3005BA4C8 /* GamesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 577006822D438E2A00762E8F /* GamesViewController.swift */; };
57CDCDAC2FD5CBD3005BA4C8 /* WebDavServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F632AC2D6FEC25007270E8 /* WebDavServiceProvider.swift */; };
+ 68A011012026091500000005 /* RommClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A011012026091500000001 /* RommClient.swift */; };
+ 68A011012026091500000006 /* RommServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A011012026091500000003 /* RommServiceProvider.swift */; };
57CDCDAD2FD5CBD3005BA4C8 /* ThemeColorCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 570F590F2DC5BAF4007BFD92 /* ThemeColorCollectionViewCell.swift */; };
57CDCDAE2FD5CBD3005BA4C8 /* CheatTypeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B6ECCC2D798419002E619C /* CheatTypeExtensions.swift */; };
57CDCDAF2FD5CBD3005BA4C8 /* OnlinePlaySettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5754D88A2E274AB9001EA5ED /* OnlinePlaySettingView.swift */; };
@@ -1544,6 +1548,8 @@
57F632A32D6F17AB007270E8 /* SMBClient in Frameworks */ = {isa = PBXBuildFile; productRef = 57F632A22D6F17AB007270E8 /* SMBClient */; };
57F632AB2D6FEC0F007270E8 /* SMBServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F632AA2D6FEBE7007270E8 /* SMBServiceProvider.swift */; };
57F632AD2D6FEC32007270E8 /* WebDavServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F632AC2D6FEC25007270E8 /* WebDavServiceProvider.swift */; };
+ 68A011012026091500000007 /* RommClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A011012026091500000001 /* RommClient.swift */; };
+ 68A011012026091500000008 /* RommServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68A011012026091500000003 /* RommServiceProvider.swift */; };
57F632E32D714E46007270E8 /* WebDavKit in Frameworks */ = {isa = PBXBuildFile; productRef = 57F632E22D714E46007270E8 /* WebDavKit */; };
57F632FE2D718236007270E8 /* SettingsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F632FD2D71822A007270E8 /* SettingsListView.swift */; };
57F633002D718366007270E8 /* SettingItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F632FF2D718360007270E8 /* SettingItem.swift */; };
@@ -6695,6 +6701,8 @@
57F6328A2D6EB837007270E8 /* DownloadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadManager.swift; sourceTree = "<group>"; };
57F632AA2D6FEBE7007270E8 /* SMBServiceProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SMBServiceProvider.swift; sourceTree = "<group>"; };
57F632AC2D6FEC25007270E8 /* WebDavServiceProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebDavServiceProvider.swift; sourceTree = "<group>"; };
+ 68A011012026091500000001 /* RommClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RommClient.swift; sourceTree = "<group>"; };
+ 68A011012026091500000003 /* RommServiceProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RommServiceProvider.swift; sourceTree = "<group>"; };
57F632FD2D71822A007270E8 /* SettingsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsListView.swift; sourceTree = "<group>"; };
57F632FF2D718360007270E8 /* SettingItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingItem.swift; sourceTree = "<group>"; };
57F633032D718C45007270E8 /* LocaleExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocaleExtensions.swift; sourceTree = "<group>"; };
@@ -12722,6 +12730,8 @@
children = (
57F632AC2D6FEC25007270E8 /* WebDavServiceProvider.swift */,
57F632AA2D6FEBE7007270E8 /* SMBServiceProvider.swift */,
+ 68A011012026091500000001 /* RommClient.swift */,
+ 68A011012026091500000003 /* RommServiceProvider.swift */,
577005B82D3E71B200762E8F /* ImportService.swift */,
);
path = Models;
@@ -13803,6 +13813,8 @@
579093BB303C7D9100A53656 /* ASListPage.swift in Sources */,
579093BC303C7D9100A53656 /* GamesViewController.swift in Sources */,
579093BD303C7D9100A53656 /* WebDavServiceProvider.swift in Sources */,
+ 68A011012026091500000002 /* RommClient.swift in Sources */,
+ 68A011012026091500000004 /* RommServiceProvider.swift in Sources */,
579093BE303C7D9100A53656 /* ThemeColorCollectionViewCell.swift in Sources */,
579093BF303C7D9100A53656 /* CheatTypeExtensions.swift in Sources */,
579093C0303C7D9100A53656 /* ARMaxDecrypt.swift in Sources */,
@@ -14270,6 +14282,8 @@
5796DAF32FE413DE0051F661 /* ASListPage.swift in Sources */,
57CDCDAA2FD5CBD3005BA4C8 /* GamesViewController.swift in Sources */,
57CDCDAC2FD5CBD3005BA4C8 /* WebDavServiceProvider.swift in Sources */,
+ 68A011012026091500000005 /* RommClient.swift in Sources */,
+ 68A011012026091500000006 /* RommServiceProvider.swift in Sources */,
57CDCDAD2FD5CBD3005BA4C8 /* ThemeColorCollectionViewCell.swift in Sources */,
57CDCDAE2FD5CBD3005BA4C8 /* CheatTypeExtensions.swift in Sources */,
57B6ECD22D7984A0002E619C /* ARMaxDecrypt.swift in Sources */,
@@ -14719,6 +14733,8 @@
5796DAF42FE413DE0051F661 /* ASListPage.swift in Sources */,
577006832D438E2A00762E8F /* GamesViewController.swift in Sources */,
57F632AD2D6FEC32007270E8 /* WebDavServiceProvider.swift in Sources */,
+ 68A011012026091500000007 /* RommClient.swift in Sources */,
+ 68A011012026091500000008 /* RommServiceProvider.swift in Sources */,
570F59102DC5BB03007BFD92 /* ThemeColorCollectionViewCell.swift in Sources */,
57B6ECCD2D798425002E619C /* CheatTypeExtensions.swift in Sources */,
57B6ECD12D7984A0002E619C /* ARMaxDecrypt.swift in Sources */,
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/import_romm.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/import_romm.imageset/Contents.json
new file mode 100644
index 00000000..32a04516
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/import_romm.imageset/Contents.json
@@ -0,0 +1,15 @@
+{
+ "images" : [
+ {
+ "filename" : "import_romm.svg",
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "properties" : {
+ "preserves-vector-representation" : true
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/import_romm.imageset/import_romm.svg b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/import_romm.imageset/import_romm.svg
new file mode 100644
index 00000000..bc212d66
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/import_romm.imageset/import_romm.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 2000 2000"><defs><style>.cls-2{fill:#e1a38e}.cls-6{fill:#e5c7a7}</style></defs><path d="M1597.27 197.75 1508 287.03c-3.04-5.52-5.98-10.79-8.72-15.56-2.72-4.77-5.24-9.04-7.39-12.57-3.13-5.12-9.74-13.08-15.95-18.95-14.17-13.39-58.39-37.02-101.14-57.15a1815 1815 0 0 0-10.4-4.85c-1.15-.53-2.3-1.06-3.44-1.58-.05-.02-.11-.05-.17-.07a5 5 0 0 0-.4-.18c-.38-.17-.86-.39-1.45-.63-.48-.22-1.03-.45-1.64-.71-.04-.01-.08-.03-.13-.05-.4-.17-.83-.35-1.28-.54-.01 0-.01-.01-.01-.01q-.675-.285-1.44-.6c-.01 0-.01-.01-.01-.01-.51-.21-1.04-.44-1.6-.67-.57-.23-1.15-.48-1.77-.73-.08-.03-.16-.06-.25-.1-.76-.32-1.57-.65-2.41-1h-.01q-.825-.33-1.68-.69c-1.14-.47-2.36-.97-3.63-1.48-.64-.26-1.28-.52-1.95-.79-.11-.03-.21-.07-.31-.12-1.04-.42-2.12-.86-3.23-1.3q-1.68-.675-3.45-1.38c-.78-.32-1.59-.64-2.4-.96-.41-.16-.83-.32-1.24-.49-6.24-2.48-13.3-5.23-21.06-8.2-1.04-.4-2.08-.8-3.14-1.2-.53-.2-1.07-.4-1.6-.61-1.07-.41-2.16-.82-3.25-1.23-1.65-.63-3.31-1.25-5.01-1.89-3.39-1.27-6.88-2.57-10.46-3.9l-1.8-.66c-1.22-.45-2.45-.9-3.69-1.36-.93-.34-1.87-.68-2.81-1.03-1.88-.69-3.79-1.38-5.72-2.08-.97-.34-1.94-.7-2.92-1.05-1.04-.37-2.09-.75-3.14-1.13-.92-.33-1.84-.67-2.77-.99-.93-.33-1.86-.67-2.8-1-1.34-.48-2.69-.96-4.06-1.44-2.18-.76-4.37-1.53-6.59-2.31-4.43-1.55-8.95-3.11-13.53-4.68-2.3-.78-4.61-1.57-6.94-2.35-1.16-.39-2.33-.79-3.5-1.18-1.18-.39-2.35-.79-3.54-1.18-1.18-.39-2.36-.79-3.55-1.18-1.62-.53-3.25-1.07-4.88-1.61-8.16-2.68-16.49-5.35-24.94-7.98h-.01c-1.27-.4-2.53-.79-3.8-1.18-1.27-.4-2.55-.79-3.83-1.18-2.55-.79-5.12-1.57-7.69-2.34h-.01c-1.28-.39-2.57-.78-3.86-1.16s-2.58-.76-3.88-1.15c-2.58-.77-5.18-1.53-7.78-2.28h-.01c-3.46-1.01-6.94-2-10.42-2.98h-.01c-5.23-1.48-10.47-2.92-15.72-4.33-4.88-1.31-9.56-2.55-14.05-3.71l-4.43-1.15c-.77-.2-1.53-.39-2.28-.59-2.3-.59-4.56-1.17-6.77-1.72-.74-.18-1.47-.37-2.2-.55l-1.8-.45c-.87-.21-1.73-.43-2.58-.64q-2.565-.63-5.04-1.23c-1.65-.4-3.28-.79-4.88-1.17-1.2-.29-2.39-.57-3.56-.84s-2.33-.55-3.48-.81c-1.14-.27-2.28-.53-3.4-.78-1.12-.26-2.23-.5-3.33-.75q-1.665-.375-3.27-.72c-1.08-.24-2.15-.48-3.2-.7h-.01c-1.06-.23-2.1-.45-3.14-.68-1.03-.22-2.06-.43-3.08-.65a882 882 0 0 0-24.1-4.65c-.92-.17-1.84-.33-2.76-.49-3.06-.53-6.1-1.05-9.13-1.55l-3.65-.6c-1.22-.19-2.43-.39-3.65-.59l-5.52-.87c-1.55-.24-3.1-.48-4.66-.72-2.19-.34-4.4-.68-6.64-1.02-2.56-.39-5.17-.79-7.83-1.19a1972 1972 0 0 1-25.5-4.02c-8.31-1.37-15.12-2.55-18.31-3.21-28.58-5.86-65.11-.34-93.45 12.51-28.95 13.13-101.76 94.36-172.24 172.42-1.01 1.12-2.02 2.24-3.03 3.35-3.03 3.36-6.05 6.7-9.06 10.03l-6.01 6.64c-1.5 1.66-3 3.3-4.49 4.95s-2.99 3.29-4.47 4.92c-4.96 5.45-9.87 10.84-14.72 16.13-.96 1.06-1.93 2.11-2.9 3.16-3.16 3.45-6.31 6.87-9.42 10.23-1.6 1.73-3.19 3.45-4.77 5.15l-2.89 3.1c-1.38 1.49-2.76 2.97-4.14 4.43-1.36 1.47-2.73 2.93-4.09 4.37-.92.98-1.84 1.96-2.76 2.93-2.7 2.86-5.38 5.68-8.01 8.43-.87.92-1.75 1.83-2.62 2.73-1.68 1.75-3.35 3.48-4.99 5.18-.05.05-.1.11-.16.16-.85.88-1.69 1.75-2.54 2.61-1.26 1.29-2.51 2.57-3.75 3.83-.41.42-.82.84-1.23 1.25-.4.42-.81.83-1.23 1.24q-1.83 1.86-3.63 3.66c-1.4 1.4-2.78 2.77-4.15 4.12-.97.96-1.94 1.91-2.9 2.85-.77.75-1.53 1.49-2.28 2.21-.76.73-1.51 1.46-2.25 2.17-.74.72-1.48 1.42-2.21 2.11-.37.35-.73.7-1.09 1.03-.72.69-1.44 1.36-2.15 2.02-.71.67-1.42 1.32-2.12 1.97-.35.33-.7.65-1.04.96-.34.32-.69.63-1.03.94-.69.63-1.37 1.24-2.04 1.85q-.585.54-1.17 1.05c-.61.55-1.21 1.08-1.81 1.6l-.97.85c-.64.56-1.28 1.11-1.91 1.65s-1.25 1.07-1.87 1.59c-.53.44-1.05.87-1.56 1.3-.02.02-.04.03-.06.05-.15.12-.3.24-.44.36-.52.44-1.04.85-1.54 1.26-.07.06-.15.12-.22.18-.51.41-1.02.81-1.52 1.2-.57.44-1.13.88-1.69 1.31-.55.42-1.1.83-1.64 1.23-.53.4-1.04.78-1.55 1.14-1.87 1.34-3.63 2.53-5.28 3.53-.05.03-.1.06-.15.1-.39.24-.77.47-1.15.68-.67.39-1.32.75-1.95 1.07-.21.11-.42.22-.63.32l-.3.15q-.465.225-.9.42c-15.52 6.95-24.09 9.97-66.56 11.15-8.2.23-17.66.39-28.67.49-16.13.16-35.59.2-59.31.17-2.31 0-4.65 0-7.04-.01-7.16-.01-14.69-.03-22.61-.05l-112.21-.29-41.67-.11c165-224.88 421.76-378.24 715.12-404.9h183.38c188.48 17.13 361.85 86.56 505.48 193.65" style="fill:#ede4f1"/><path d="M2000.09 989.22v21.56c-1.67 158.62-40.27 308.38-107.61 441.1-3.04-18.75-6.49-39.7-7.96-47.82-12.96-73-34.53-143.68-55.58-214.46-13.99-53.78-28.38-104.29-40.06-143.1-18.7-62.46-37.51-124.73-59.4-186.14-1.69-3.28-30.04-82.76-43.16-120.99-15.39-44.44-32.41-88.02-47.96-132.62-32.73-87.2-64.69-174.62-100.54-260.6-1.94-6.69-16.46-34.87-29.82-59.12l89.27-89.28c241.85 180.32 399.4 467.42 402.82 791.47m-699.93 965.03c-94.72 29.76-195.51 45.8-300.06 45.8-327.04 0-617.41-156.98-799.87-399.7l270.67-.24c243.84-.22 342.85 1.36 376.05 6.19 20.33 2.95 55.66 12.92 73.34 20.69 16.69 7.34 21.39 9.63 26.04 12.32 2.71 1.56 29.66 17.25 44.85 29.14 7.59 5.94 22.69 17.76 33.57 26.26 106.73 83.41 213.94 195.63 275.41 259.54" style="fill:#bda5cf"/><path d="M1884.52 1404.06c-12.96-73-34.53-143.68-55.58-214.46-13.99-53.78-28.38-104.29-40.06-143.1-18.7-62.46-37.51-124.73-59.4-186.14-1.69-3.28-30.04-82.76-43.16-120.99-15.39-44.44-32.41-88.02-47.96-132.62-32.73-87.2-64.69-174.62-100.54-260.6-1.94-6.69-16.46-34.87-29.82-59.12L197.85 1597.18c.79 1.06 1.58 2.12 2.38 3.17l270.67-.24c243.84-.22 342.85 1.36 376.05 6.19 20.33 2.95 55.66 12.92 73.34 20.69 16.69 7.34 21.39 9.63 26.04 12.32 2.71 1.56 29.66 17.25 44.85 29.14 7.59 5.94 22.69 17.76 33.57 26.26 106.73 83.41 213.94 195.63 275.41 259.54 258.37-81.16 471.56-264.36 592.32-502.37-3.04-18.75-6.49-39.7-7.96-47.82m-811.85-325.87c-68.03 0-123.18-55.15-123.18-123.19s55.15-123.18 123.18-123.18 123.19 55.15 123.19 123.18-55.15 123.19-123.19 123.19m235.05-237.14c-68.04 0-123.19-55.15-123.19-123.18s55.15-123.19 123.19-123.19 123.18 55.15 123.18 123.19-55.15 123.18-123.18 123.18" style="fill:#38286a"/><path d="M1499.28 271.47c-2.72-4.77-5.24-9.04-7.39-12.57-3.13-5.12-9.74-13.08-15.95-18.95-14.17-13.39-58.39-37.02-101.14-57.15a1815 1815 0 0 0-10.4-4.85c-1.15-.53-2.3-1.05-3.44-1.57-.05-.02-.11-.05-.17-.08-.12-.05-.25-.11-.4-.18-.39-.16-.87-.37-1.45-.63-.48-.21-1.02-.44-1.64-.71-.04-.01-.08-.03-.13-.05-.4-.17-.83-.35-1.28-.54-.01 0-.01-.01-.01-.01q-.69-.285-1.44-.6c-.01 0-.01-.01-.01-.01-.51-.21-1.04-.43-1.6-.67-.57-.23-1.15-.48-1.77-.73-.08-.03-.16-.06-.25-.1-.76-.31-1.57-.64-2.41-1h-.01q-.825-.33-1.68-.69c-1.15-.47-2.36-.96-3.63-1.48-.64-.26-1.28-.52-1.95-.79-.11-.03-.21-.07-.31-.12-1.04-.42-2.12-.86-3.23-1.3q-1.68-.675-3.45-1.38c-.78-.31-1.59-.63-2.4-.96-.41-.16-.83-.32-1.24-.49-6.25-2.47-13.3-5.22-21.06-8.2-1.04-.39-2.09-.79-3.14-1.2-.53-.2-1.07-.4-1.6-.61-1.07-.4-2.16-.82-3.25-1.23-1.65-.62-3.31-1.25-5.01-1.89-3.39-1.27-6.88-2.57-10.46-3.9l-1.8-.66c-1.22-.45-2.45-.9-3.69-1.36-.93-.34-1.87-.68-2.81-1.03-1.89-.68-3.79-1.37-5.72-2.08-.97-.34-1.94-.7-2.92-1.05-1.04-.37-2.09-.75-3.14-1.13-.92-.33-1.84-.66-2.77-.99s-1.86-.67-2.8-1c-1.34-.47-2.7-.95-4.06-1.44-2.18-.76-4.37-1.53-6.59-2.31-4.43-1.55-8.95-3.11-13.53-4.68-2.3-.78-4.61-1.56-6.94-2.35-1.16-.39-2.33-.79-3.5-1.18-1.18-.39-2.35-.79-3.54-1.18-1.18-.39-2.36-.79-3.55-1.18-1.62-.53-3.25-1.07-4.88-1.61-8.16-2.67-16.49-5.34-24.94-7.98h-.01c-1.27-.4-2.53-.79-3.8-1.18-1.27-.4-2.55-.79-3.83-1.18-2.56-.78-5.12-1.56-7.69-2.34h-.01c-1.28-.39-2.57-.78-3.86-1.16s-2.58-.76-3.88-1.15c-2.58-.77-5.18-1.53-7.78-2.28h-.01c-3.46-1-6.94-1.99-10.42-2.98h-.01c-5.23-1.47-10.48-2.91-15.73-4.32-4.87-1.31-9.55-2.54-14.04-3.72l-4.43-1.15c-.77-.2-1.53-.39-2.28-.59-2.31-.59-4.56-1.16-6.77-1.72-.74-.18-1.47-.37-2.2-.55l-1.8-.45c-.87-.21-1.73-.43-2.58-.64q-2.565-.63-5.04-1.23c-1.65-.4-3.28-.79-4.88-1.17-1.2-.29-2.39-.57-3.56-.84s-2.33-.55-3.48-.81-2.28-.52-3.4-.78-2.23-.5-3.33-.75-2.19-.49-3.27-.72c-1.08-.24-2.14-.47-3.2-.7h-.01c-1.06-.23-2.1-.45-3.14-.68-1.03-.22-2.06-.43-3.08-.65a882 882 0 0 0-24.1-4.65c-.92-.17-1.84-.33-2.76-.49-3.06-.53-6.1-1.05-9.13-1.55l-3.65-.6c-1.22-.19-2.43-.39-3.65-.59l-5.52-.87c-1.55-.24-3.1-.48-4.66-.72-2.19-.33-4.4-.67-6.64-1.02-2.57-.38-5.18-.78-7.84-1.18-4.33-.65-8.76-1.34-13.08-2.03-4.32-.68-8.53-1.36-12.41-2-8.31-1.37-15.12-2.55-18.31-3.21-28.58-5.86-65.11-.34-93.45 12.51-28.95 13.13-101.76 94.36-172.24 172.42-1.01 1.12-2.02 2.24-3.03 3.35-3.03 3.36-6.05 6.7-9.06 10.03l-6.01 6.64c-1.5 1.66-3 3.3-4.49 4.95s-2.99 3.29-4.47 4.92c-4.96 5.45-9.87 10.84-14.72 16.13-.96 1.06-1.93 2.11-2.9 3.16-3.16 3.45-6.31 6.87-9.42 10.23-1.6 1.73-3.19 3.45-4.77 5.15l-2.89 3.1a897 897 0 0 1-4.14 4.43c-1.36 1.47-2.73 2.93-4.09 4.37-.92.98-1.84 1.96-2.76 2.93-2.7 2.86-5.38 5.68-8.01 8.43-.87.92-1.75 1.83-2.62 2.73-1.67 1.75-3.34 3.48-4.99 5.18-.05.05-.1.11-.16.16-.85.88-1.69 1.75-2.54 2.61-1.25 1.3-2.5 2.57-3.75 3.83-.41.42-.82.84-1.23 1.25-.4.42-.81.83-1.23 1.24q-1.83 1.86-3.63 3.66c-1.4 1.4-2.78 2.77-4.15 4.12-.97.97-1.94 1.92-2.9 2.85-.77.75-1.53 1.49-2.28 2.21-.76.74-1.51 1.46-2.25 2.17-.74.72-1.48 1.42-2.21 2.11-.37.35-.73.7-1.09 1.03-.72.7-1.44 1.37-2.15 2.02-.71.68-1.42 1.33-2.12 1.97-.35.33-.7.65-1.04.96-.34.32-.69.63-1.03.94-.69.63-1.37 1.25-2.04 1.85q-.585.54-1.17 1.05c-.61.55-1.21 1.08-1.81 1.6l-.97.85c-.64.57-1.28 1.12-1.91 1.65-.63.55-1.26 1.08-1.87 1.59-.53.45-1.05.89-1.56 1.3-.02.02-.04.03-.06.05-.15.12-.3.24-.44.36-.52.44-1.04.85-1.54 1.26-.07.06-.15.12-.22.18-.51.41-1.02.81-1.52 1.2-.57.45-1.13.89-1.69 1.31-.55.43-1.1.83-1.64 1.23-.53.4-1.04.78-1.55 1.14-1.87 1.34-3.63 2.53-5.28 3.53-.05.03-.1.06-.15.1-.39.24-.77.47-1.15.68-.67.39-1.32.75-1.95 1.07-.21.11-.42.22-.63.32l-.3.15q-.465.225-.9.42c-15.52 6.95-24.09 9.97-66.56 11.15-8.2.23-17.66.39-28.67.49-16.13.16-35.59.2-59.31.17-2.31 0-4.65 0-7.04-.01-7.16 0-14.69-.02-22.61-.04l-112.21-.3-41.67-.11C73.97 571.6 2.63 771.6.12 988.14v23.8c2.56 219.26 75.69 421.56 197.73 585.24L1508 287.03c-3.04-5.52-5.98-10.79-8.72-15.56M842.65 845.33c-68.04 0-123.19-55.15-123.19-123.18s55.15-123.18 123.19-123.18 123.18 55.15 123.18 123.18-55.15 123.18-123.18 123.18m230.38-228.68c-68.03 0-123.18-55.15-123.18-123.18s55.15-123.18 123.18-123.18 123.18 55.15 123.18 123.18-55.15 123.18-123.18 123.18" style="fill:#553f99"/><circle cx="1073.03" cy="493.47" r="123.18" class="cls-6"/><circle cx="842.65" cy="722.15" r="123.18" class="cls-6"/><circle cx="1307.72" cy="717.86" r="123.18" class="cls-2" transform="rotate(-45 1307.71 717.868)"/><circle cx="1072.67" cy="955" r="123.18" class="cls-2"/></svg>
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Models/ImportService.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Models/ImportService.swift
index e32003fa..711684eb 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Models/ImportService.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Models/ImportService.swift
@@ -14,7 +14,7 @@ import IceCream
extension ImportService: CKRecordConvertible & CKRecordRecoverable { }
enum ImportServiceType: Int, PersistableEnum {
- case files, wifi, paste, googledrive, dropbox, onedrive, baiduyun, aliyun, samba, webdav, multiDisc, romPatcher
+ case files, wifi, paste, googledrive, dropbox, onedrive, baiduyun, aliyun, samba, webdav, multiDisc, romPatcher, romm
}
class ImportService: Object, ObjectUpdatable {
@@ -102,6 +102,8 @@ class ImportService: Object, ObjectUpdatable {
R.string.localizable.multiDiscBuilder()
case .romPatcher:
"RomPatcher"
+ case .romm:
+ "RomM"
}
}
@@ -131,12 +133,14 @@ class ImportService: Object, ObjectUpdatable {
R.image.import_multi_disc_icon()!
case .romPatcher:
R.image.import_rom_patcher()!
+ case .romm:
+ R.image.import_romm()!
}
}()
var iconCornerRadius: Double {
switch type {
- case .files, .wifi, .paste, .googledrive, .dropbox, .onedrive, .baiduyun, .aliyun, .multiDisc, .romPatcher:
+ case .files, .wifi, .paste, .googledrive, .dropbox, .onedrive, .baiduyun, .aliyun, .multiDisc, .romPatcher, .romm:
R.Size.CornerRadiusSmall
case .samba, .webdav:
0
@@ -155,6 +159,8 @@ class ImportService: Object, ObjectUpdatable {
R.Color.Pink.withAlphaComponent(0.1)
case .romPatcher:
R.Color.Cyan.withAlphaComponent(0.1)
+ case .romm:
+ R.Color.BackgroundSecondary
case .googledrive, .dropbox, .onedrive, .baiduyun, .aliyun:
R.Color.BackgroundSecondary
case .samba, .webdav:
@@ -164,7 +170,7 @@ class ImportService: Object, ObjectUpdatable {
var iconBorderColor: UIColor {
switch type {
- case .files, .wifi, .paste, .googledrive, .dropbox, .onedrive, .baiduyun, .aliyun, .multiDisc, .romPatcher:
+ case .files, .wifi, .paste, .googledrive, .dropbox, .onedrive, .baiduyun, .aliyun, .multiDisc, .romPatcher, .romm:
R.Color.Border
case .samba, .webdav:
UIColor.clear
@@ -202,6 +208,8 @@ class ImportService: Object, ObjectUpdatable {
provider = SMBServiceProvider(service: self)
case .webdav:
provider = WebDavServiceProvider(service: self)
+ case .romm:
+ provider = RommServiceProvider(service: self)
default:
return nil
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift
new file mode 100644
index 00000000..ddc45d29
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift
@@ -0,0 +1,398 @@
+//
+// RommClient.swift
+// ManicEmu
+//
+// Created by Chris Habibi on 6/29/26.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import Foundation
+
+struct RommPage<T: Decodable>: Decodable {
+ let items: [T]
+ let total: Int?
+}
+
+struct RommPlatform: Decodable {
+ let id: Int
+ let name: String
+ let rom_count: Int?
+}
+
+struct RommMetadatum: Decodable {
+ let genres: [String]?
+ let franchises: [String]?
+ let companies: [String]?
+ let age_ratings: [String]?
+ let first_release_date: Int64?
+}
+
+struct RommUser: Decodable {
+ let last_played: Date?
+}
+
+struct RommRom: Decodable {
+ let id: Int
+ let name: String?
+ let fs_name: String
+ let fs_size_bytes: Int64?
+ let summary: String?
+ let path_cover_small: String?
+ let path_cover_large: String?
+ let url_cover: String?
+ let platform_display_name: String?
+ let metadatum: RommMetadatum?
+ let rom_user: RommUser?
+
+ var preferredCoverPath: String? {
+ if let path = path_cover_large, !path.isEmpty { return path }
+ if let path = path_cover_small, !path.isEmpty { return path }
+ return nil
+ }
+}
+
+struct RommScreenshot: Decodable {
+ let id: Int
+ let download_path: String
+}
+
+struct RommSave: Decodable {
+ let id: Int
+ let rom_id: Int
+ let file_name: String
+ let file_size_bytes: Int64?
+ let download_path: String
+ let emulator: String?
+ let updated_at: Date?
+ let screenshot: RommScreenshot?
+}
+
+struct RommState: Decodable {
+ let id: Int
+ let rom_id: Int
+ let file_name: String
+ let file_size_bytes: Int64?
+ let download_path: String
+ let emulator: String?
+ let updated_at: Date?
+ let screenshot: RommScreenshot?
+}
+
+struct RommPlaySession: Decodable {
+ let id: Int
+ let rom_id: Int?
+ let duration_ms: Int
+ let start_time: Date?
+ let end_time: Date?
+}
+
+final class RommClient {
+ private let baseURL: URL
+ private let session: URLSession
+ private let authHeader: String
+
+ private let PlatformApiStub = "/api/platforms"
+ private let RomApiStub = "/api/roms"
+ private let SaveApiStub = "/api/saves"
+ private let StateApiStub = "/api/states"
+ private let PlaySessionApiStub = "/api/play-sessions"
+
+ var PaginationLimit: Int { 250 }
+
+ init?(scheme: String, host: String, port: Int?, user: String?, password: String?) {
+ var components = URLComponents()
+ components.scheme = scheme
+ components.host = host
+ components.port = port
+ guard let url = components.url else { return nil }
+ self.baseURL = url
+ self.authHeader = Self.makeAuthHeader(user: user, password: password)
+ self.session = .shared
+ }
+
+ /// Bearer for Client API tokens (`rmm_…`); otherwise HTTP Basic.
+ private static func makeAuthHeader(user: String?, password: String?) -> String {
+ let trimmedUser = user?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
+ let trimmedPassword = password?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
+ if trimmedPassword.hasPrefix("rmm_") || (trimmedUser.isEmpty && !trimmedPassword.isEmpty) {
+ return "Bearer \(trimmedPassword)"
+ }
+ let raw = "\(trimmedUser):\(trimmedPassword)"
+ let token = raw.data(using: .utf8)?.base64EncodedString() ?? ""
+ return "Basic \(token)"
+ }
+
+ func request(path: String, query: [URLQueryItem] = []) -> URLRequest? {
+ guard var components = URLComponents(url: baseURL.appendingPathComponent(path),
+ resolvingAgainstBaseURL: false) else { return nil }
+ if !query.isEmpty { components.queryItems = query }
+ guard let url = components.url else { return nil }
+ var req = URLRequest(url: url)
+ req.setValue(authHeader, forHTTPHeaderField: "Authorization")
+ return req
+ }
+
+ /// JSON decoder that understands RomM's UTC ISO-8601 timestamps
+ private static let jsonDecoder: JSONDecoder = {
+ let withFraction = ISO8601DateFormatter()
+ withFraction.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
+ let plain = ISO8601DateFormatter()
+ plain.formatOptions = [.withInternetDateTime]
+
+ let decoder = JSONDecoder()
+ decoder.dateDecodingStrategy = .custom { decoder in
+ let container = try decoder.singleValueContainer()
+ let raw = try container.decode(String.self)
+ if let date = withFraction.date(from: raw) ?? plain.date(from: raw) {
+ return date
+ }
+ throw DecodingError.dataCorruptedError(in: container,
+ debugDescription: "Unrecognised RomM date: \(raw)")
+ }
+ return decoder
+ }()
+
+ private static let isoFormatter: ISO8601DateFormatter = {
+ let formatter = ISO8601DateFormatter()
+ formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
+ return formatter
+ }()
+
+ private func get<T: Decodable>(_ path: String, query: [URLQueryItem] = []) async throws -> T {
+ guard let req = request(path: path, query: query) else {
+ throw URLError(.badURL)
+ }
+ return try Self.jsonDecoder.decode(T.self, from: await data(for: req))
+ }
+
+ func data(for request: URLRequest) async throws -> Data {
+ let (data, response) = try await session.data(for: request)
+ guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ throw URLError(.userAuthenticationRequired)
+ }
+ return data
+ }
+
+ func platforms() async throws -> [RommPlatform] {
+ try await get(PlatformApiStub)
+ }
+
+ func roms(platformID: Int) async throws -> [RommRom] {
+ // platform_ids and platform_id is kept for backward compatibilty with old RomM versions
+ try await fetchAllRoms(baseQuery: [.init(name: "platform_ids", value: "\(platformID)"),
+ .init(name: "platform_id", value: "\(platformID)")])
+ }
+
+ func rom(id: Int) async throws -> RommRom {
+ try await get("\(RomApiStub)/\(id)")
+ }
+
+ func searchRoms(term: String) async throws -> [RommRom] {
+ try await fetchAllRoms(baseQuery: [.init(name: "search_term", value: term)])
+ }
+
+ private func fetchAllRoms(baseQuery: [URLQueryItem]) async throws -> [RommRom] {
+ var all: [RommRom] = []
+ var seen = Set<Int>()
+ var offset = 0
+ while true {
+ var query = baseQuery
+ query.append(.init(name: "limit", value: String(PaginationLimit)))
+ query.append(.init(name: "offset", value: String(offset)))
+ let page: RommPage<RommRom> = try await get(RomApiStub, query: query)
+ let fresh = page.items.filter { seen.insert($0.id).inserted }
+ all.append(contentsOf: fresh)
+
+ if page.items.count < PaginationLimit { break }
+ if fresh.isEmpty { break }
+ if let total = page.total, all.count >= total { break }
+ offset += PaginationLimit
+ }
+ return all
+ }
+
+ func saves(romID: Int) async throws -> [RommSave] {
+ try await get(SaveApiStub, query: [.init(name: "rom_id", value: "\(romID)")])
+ }
+
+ func states(romID: Int) async throws -> [RommState] {
+ try await get(StateApiStub, query: [.init(name: "rom_id", value: "\(romID)")])
+ }
+
+ func playSessions(romID: Int) async throws -> [RommPlaySession] {
+ try await get(PlaySessionApiStub, query: [.init(name: "rom_id", value: "\(romID)")])
+ }
+
+ func saveContentRequest(saveID: Int) -> URLRequest? {
+ request(path: "\(SaveApiStub)/\(saveID)/content")
+ }
+
+ func stateContentRequest(stateID: Int) -> URLRequest? {
+ request(path: "\(StateApiStub)/\(stateID)/content")
+ }
+
+ func assetDownloadRequest(downloadPath: String) -> URLRequest? {
+ let rawPath = String(downloadPath.split(separator: "?", maxSplits: 1, omittingEmptySubsequences: false)[0])
+ var components = URLComponents()
+ components.scheme = baseURL.scheme
+ components.host = baseURL.host
+ components.port = baseURL.port
+ components.percentEncodedPath = rawPath.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? rawPath
+ guard let url = components.url else { return nil }
+ var req = URLRequest(url: url)
+ req.setValue(authHeader, forHTTPHeaderField: "Authorization")
+ return req
+ }
+
+ @discardableResult
+ func uploadSave(romID: Int,
+ emulator: String?,
+ fileName: String,
+ fileData: Data,
+ screenshot: (fileName: String, data: Data)? = nil) async throws -> RommSave {
+ try await upload(stub: SaveApiStub,
+ fileField: "saveFile",
+ romID: romID,
+ emulator: emulator,
+ fileName: fileName,
+ fileData: fileData,
+ screenshot: screenshot)
+ }
+
+ @discardableResult
+ func uploadState(romID: Int,
+ emulator: String?,
+ fileName: String,
+ fileData: Data,
+ screenshot: (fileName: String, data: Data)? = nil) async throws -> RommState {
+ try await upload(stub: StateApiStub,
+ fileField: "stateFile",
+ romID: romID,
+ emulator: emulator,
+ fileName: fileName,
+ fileData: fileData,
+ screenshot: screenshot)
+ }
+
+ func updateLastPlayed(romID: Int) async throws {
+ guard var req = request(path: "\(RomApiStub)/\(romID)/props",
+ query: [.init(name: "update_last_played", value: "true")]) else {
+ throw URLError(.badURL)
+ }
+ req.httpMethod = "PUT"
+ req.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ req.httpBody = Data("{}".utf8)
+ _ = try await data(for: req)
+ }
+
+ func ingestPlaySession(romID: Int, durationMs: Int, endedAt: Date = Date()) async throws {
+ guard durationMs > 0 else { return }
+ guard var req = request(path: PlaySessionApiStub) else { throw URLError(.badURL) }
+ req.httpMethod = "POST"
+ req.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ let startedAt = endedAt.addingTimeInterval(-Double(durationMs) / 1000)
+ let body: [String: Any] = [
+ "sessions": [[
+ "rom_id": romID,
+ "start_time": Self.isoFormatter.string(from: startedAt),
+ "end_time": Self.isoFormatter.string(from: endedAt),
+ "duration_ms": durationMs
+ ]]
+ ]
+ req.httpBody = try JSONSerialization.data(withJSONObject: body)
+ _ = try await data(for: req)
+ }
+
+ func updateRom(romID: Int,
+ name: String?,
+ summary: String?,
+ artwork: (fileName: String, data: Data)?) async throws {
+ guard var req = request(path: "\(RomApiStub)/\(romID)") else { throw URLError(.badURL) }
+ let boundary = "ManicEmuBoundary-rom-\(romID)"
+ req.httpMethod = "PUT"
+ req.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
+ var body = Data()
+ if let name, !name.isEmpty {
+ body.appendFormField(boundary: boundary, name: "name", value: name)
+ }
+ if let summary {
+ body.appendFormField(boundary: boundary, name: "summary", value: summary)
+ }
+ if let artwork {
+ body.appendFormFile(boundary: boundary,
+ name: "artwork",
+ fileName: artwork.fileName,
+ mime: "image/jpeg",
+ data: artwork.data)
+ }
+ body.append("--\(boundary)--\r\n")
+ let (data, response) = try await session.upload(for: req, from: body)
+ guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ throw URLError(.userAuthenticationRequired)
+ }
+ _ = data
+ }
+
+ private func upload<T: Decodable>(stub: String,
+ fileField: String,
+ romID: Int,
+ emulator: String?,
+ fileName: String,
+ fileData: Data,
+ screenshot: (fileName: String, data: Data)?) async throws -> T {
+ var query = [URLQueryItem(name: "rom_id", value: "\(romID)"),
+ URLQueryItem(name: "overwrite", value: "true")]
+ if let emulator, !emulator.isEmpty {
+ query.append(.init(name: "emulator", value: emulator))
+ }
+ guard var req = request(path: stub, query: query) else { throw URLError(.badURL) }
+
+ let boundary = "ManicEmuBoundary-\(romID)-\(fileName.count)-\(fileData.count)"
+
+ var parts: [(name: String, fileName: String, mime: String, data: Data)] = [
+ (fileField, fileName, "application/octet-stream", fileData)
+ ]
+ if let screenshot {
+ parts.append(("screenshotFile", screenshot.fileName, "image/png", screenshot.data))
+ }
+
+ req.httpMethod = "POST"
+ req.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
+ var body = Data()
+ for part in parts {
+ body.appendFormFile(boundary: boundary,
+ name: part.name,
+ fileName: part.fileName,
+ mime: part.mime,
+ data: part.data)
+ }
+ body.append("--\(boundary)--\r\n")
+
+ let (data, response) = try await session.upload(for: req, from: body)
+ guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ throw URLError(.userAuthenticationRequired)
+ }
+ return try Self.jsonDecoder.decode(T.self, from: data)
+ }
+}
+
+private extension Data {
+ mutating func append(_ string: String) {
+ append(Data(string.utf8))
+ }
+
+ mutating func appendFormField(boundary: String, name: String, value: String) {
+ append("--\(boundary)\r\n")
+ append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n")
+ append("\(value)\r\n")
+ }
+
+ mutating func appendFormFile(boundary: String, name: String, fileName: String, mime: String, data: Data) {
+ append("--\(boundary)\r\n")
+ append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n")
+ append("Content-Type: \(mime)\r\n\r\n")
+ append(data)
+ append("\r\n")
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommServiceProvider.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommServiceProvider.swift
new file mode 100644
index 00000000..47dcfd09
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommServiceProvider.swift
@@ -0,0 +1,110 @@
+//
+// RommServiceProvider.swift
+// ManicEmu
+//
+// Created by Chris Habibi on 6/29/26.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import Foundation
+import CloudServiceKit
+
+class RommServiceProvider: CloudServiceProvider {
+ var delegate: (any CloudServiceKit.CloudServiceProviderDelegate)?
+ var refreshAccessTokenHandler: CloudServiceKit.CloudRefreshAccessTokenHandler?
+ var credential: URLCredential?
+ var name: String { "RomM" }
+
+ private let client: RommClient?
+
+ let serviceId: String
+
+ private let romContentPathTemplate = "/api/roms/{romID}/content/{fileName}"
+
+ private func romContentPath(romID: Int, fileName: String) -> String {
+ romContentPathTemplate
+ .replacingOccurrences(of: "{romID}", with: "\(romID)")
+ .replacingOccurrences(of: "{fileName}", with: fileName)
+ }
+
+ var rootItem: CloudServiceKit.CloudItem {
+ CloudItem(id: name, name: name, path: "/", isDirectory: true)
+ }
+
+ required init(credential: URLCredential?) {
+ fatalError("Use init(service:)")
+ }
+
+ init(service: ImportService) {
+ self.serviceId = "\(service.id)"
+ self.client = RommClient(scheme: service.scheme ?? "http",
+ host: service.host ?? "",
+ port: service.port,
+ user: service.user,
+ password: service.password)
+ }
+
+ func contentsOfDirectory(_ directory: CloudServiceKit.CloudItem,
+ completion: @escaping (Result<[CloudServiceKit.CloudItem], Error>) -> Void) {
+ guard let client else {
+ completion(.failure(ImportError.lanServiceInitFailed(serviceName: name)))
+ return
+ }
+ Task {
+ do {
+ let items: [CloudItem]
+ if directory.path == "/" {
+ items = try await client.platforms().map { platform in
+ CloudItem(id: "\(platform.id)",
+ name: platform.name,
+ path: "/\(platform.id)",
+ isDirectory: true)
+ }
+ } else {
+ let platformID = Int(directory.id) ?? 0
+ items = try await client.roms(platformID: platformID).map { rom in
+ let item = CloudItem(id: "\(rom.id)/\(rom.fs_name)",
+ name: rom.fs_name,
+ path: romContentPath(romID: rom.id, fileName: rom.fs_name),
+ isDirectory: false)
+ item.size = rom.fs_size_bytes ?? 0
+ return item
+ }
+ }
+ await MainActor.run { completion(.success(items)) }
+ } catch {
+ await MainActor.run { completion(.failure(error)) }
+ }
+ }
+ }
+
+ func downloadableRequest(of item: CloudItem) -> URLRequest? {
+ guard !item.isDirectory else { return nil }
+ return client?.request(path: item.path)
+ }
+
+ func attributesOfItem(_ item: CloudServiceKit.CloudItem, completion: @escaping (Result<CloudServiceKit.CloudItem, Error>) -> Void) {}
+
+ func copyItem(_ item: CloudServiceKit.CloudItem, to directory: CloudServiceKit.CloudItem, completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ func createFolder(_ folderName: String, at directory: CloudServiceKit.CloudItem, completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ func getCloudSpaceInformation(completion: @escaping (Result<CloudServiceKit.CloudSpaceInformation, Error>) -> Void) {}
+
+ func getCurrentUserInfo(completion: @escaping (Result<CloudServiceKit.CloudUser, Error>) -> Void) {}
+
+ func moveItem(_ item: CloudServiceKit.CloudItem, to directory: CloudServiceKit.CloudItem, completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ func removeItem(_ item: CloudServiceKit.CloudItem, completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ func renameItem(_ item: CloudServiceKit.CloudItem, newName: String, completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ func searchFiles(keyword: String, completion: @escaping (Result<[CloudServiceKit.CloudItem], Error>) -> Void) {}
+
+ func uploadData(_ data: Data, filename: String, to directory: CloudServiceKit.CloudItem, progressHandler: @escaping ((Progress) -> Void), completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ func uploadFile(_ fileURL: URL, to directory: CloudServiceKit.CloudItem, progressHandler: @escaping ((Progress) -> Void), completion: @escaping CloudServiceKit.CloudCompletionHandler) {}
+
+ static func cloudItemFromJSON(_ json: [String : Any]) -> CloudItem? { nil }
+}