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

Compatible with iPhone Duo

Daiunob5b0a1be0e32
diff --git a/Dependencies/CollectionViewPagingLayout b/Dependencies/CollectionViewPagingLayout
index cf3caa6a..9887f578 160000
--- a/Dependencies/CollectionViewPagingLayout
+++ b/Dependencies/CollectionViewPagingLayout
@@ -1 +1 @@
-Subproject commit cf3caa6a3c953c3f8350f28e3048b434dc6adf16
+Subproject commit 9887f57890e96cf11f31a768bdd5390b1a0a2d9a
diff --git a/Dependencies/DeltaCore b/Dependencies/DeltaCore
index 339082e0..c232600f 160000
--- a/Dependencies/DeltaCore
+++ b/Dependencies/DeltaCore
@@ -1 +1 @@
-Subproject commit 339082e079fcf020de9bb6653dd1aac7f2cbbd3c
+Subproject commit c232600f76c3ed15a526e37d93dc714a126d37f0
diff --git a/Dependencies/Libretro b/Dependencies/Libretro
index 00689c83..b3af6035 160000
--- a/Dependencies/Libretro
+++ b/Dependencies/Libretro
@@ -1 +1 @@
-Subproject commit 00689c83f4d458e061d5fd7b52a181b8d240fe65
+Subproject commit b3af60359f3b180a9cad88366221fa55d04bb49a
diff --git a/Dependencies/ProHUD b/Dependencies/ProHUD
index 40669542..453f20a7 160000
--- a/Dependencies/ProHUD
+++ b/Dependencies/ProHUD
@@ -1 +1 @@
-Subproject commit 40669542554dd928ad69652a925a1c591f4e8264
+Subproject commit 453f20a71255da2c8f143882888305908d869278
diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
index 55dd7ea7..07048447 100644
--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
@@ -2081,6 +2081,10 @@
57F1D4FF2FFF58C700FC5B2A /* FocusKeyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F1D4FB2FFF58B400FC5B2A /* FocusKeyObserver.swift */; };
57F1D5002FFF58C700FC5B2A /* FocusKeyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F1D4FB2FFF58B400FC5B2A /* FocusKeyObserver.swift */; };
57F1D52C2FFFCCC700FC5B2A /* DeltaCore in Frameworks */ = {isa = PBXBuildFile; productRef = 57F1D52B2FFFCCC700FC5B2A /* DeltaCore */; };
+ 57F2A8022F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F2A8012F8E100100C62FF6 /* PurchaseBackgroundView.swift */; };
+ 57F2A8032F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F2A8012F8E100100C62FF6 /* PurchaseBackgroundView.swift */; };
+ 57F2A8042F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F2A8012F8E100100C62FF6 /* PurchaseBackgroundView.swift */; };
+ 57F2A8052F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F2A8012F8E100100C62FF6 /* PurchaseBackgroundView.swift */; };
57F30CD82EC048880035327C /* ManufacturerCategoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F30CD62EC048780035327C /* ManufacturerCategoryView.swift */; };
57F30CDF2EC44F390035327C /* Manufacturer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F30CDD2EC44F340035327C /* Manufacturer.swift */; };
57F3BAEC2F6541C900ABF4B3 /* J2MESettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F3BAEA2F6541AB00ABF4B3 /* J2MESettingView.swift */; };
@@ -2189,10 +2193,42 @@
E520DED8306E9606003F83BE /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E520DED7306E95FC003F83BE /* UIViewControllerExtensions.swift */; };
E520DED9306E9606003F83BE /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E520DED7306E95FC003F83BE /* UIViewControllerExtensions.swift */; };
E520DEDA306E9606003F83BE /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E520DED7306E95FC003F83BE /* UIViewControllerExtensions.swift */; };
+ E524FA5530879B06009885DA /* DuoTabletopControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA4F30879AB6009885DA /* DuoTabletopControlView.swift */; };
+ E524FA5630879B06009885DA /* DuoTabletopControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA4F30879AB6009885DA /* DuoTabletopControlView.swift */; };
+ E524FA5730879B06009885DA /* DuoTabletopControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA4F30879AB6009885DA /* DuoTabletopControlView.swift */; };
+ E524FA5830879B06009885DA /* DuoTabletopControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA4F30879AB6009885DA /* DuoTabletopControlView.swift */; };
+ E524FA8E30886485009885DA /* DuoTabletopControlWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA8D30886483009885DA /* DuoTabletopControlWindow.swift */; };
+ E524FA8F30886485009885DA /* DuoTabletopControlWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA8D30886483009885DA /* DuoTabletopControlWindow.swift */; };
+ E524FA9030886485009885DA /* DuoTabletopControlWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA8D30886483009885DA /* DuoTabletopControlWindow.swift */; };
+ E524FA9130886485009885DA /* DuoTabletopControlWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA8D30886483009885DA /* DuoTabletopControlWindow.swift */; };
+ E524FA993088649A009885DA /* DuoTabletopControlController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA9830886499009885DA /* DuoTabletopControlController.swift */; };
+ E524FA9A3088649A009885DA /* DuoTabletopControlController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA9830886499009885DA /* DuoTabletopControlController.swift */; };
+ E524FA9B3088649A009885DA /* DuoTabletopControlController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA9830886499009885DA /* DuoTabletopControlController.swift */; };
+ E524FA9C3088649A009885DA /* DuoTabletopControlController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FA9830886499009885DA /* DuoTabletopControlController.swift */; };
+ E524FAA4308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAA3308864B3009885DA /* TabletopSizeTransitionCoordinator.swift */; };
+ E524FAA5308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAA3308864B3009885DA /* TabletopSizeTransitionCoordinator.swift */; };
+ E524FAA6308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAA3308864B3009885DA /* TabletopSizeTransitionCoordinator.swift */; };
+ E524FAA7308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAA3308864B3009885DA /* TabletopSizeTransitionCoordinator.swift */; };
+ E524FAAF30886523009885DA /* DuoTabletopKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAAE30886516009885DA /* DuoTabletopKit.swift */; };
+ E524FAB030886523009885DA /* DuoTabletopKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAAE30886516009885DA /* DuoTabletopKit.swift */; };
+ E524FAB130886523009885DA /* DuoTabletopKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAAE30886516009885DA /* DuoTabletopKit.swift */; };
+ E524FAB230886523009885DA /* DuoTabletopKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FAAE30886516009885DA /* DuoTabletopKit.swift */; };
+ E524FABB308866D6009885DA /* DuoHingeKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FABA308866D4009885DA /* DuoHingeKit.swift */; };
+ E524FABC308866D6009885DA /* DuoHingeKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FABA308866D4009885DA /* DuoHingeKit.swift */; };
+ E524FABD308866D6009885DA /* DuoHingeKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FABA308866D4009885DA /* DuoHingeKit.swift */; };
+ E524FABE308866D6009885DA /* DuoHingeKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FABA308866D4009885DA /* DuoHingeKit.swift */; };
+ E524FB063088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FB053088C9BB009885DA /* ShortcutButtonContainerView.swift */; };
+ E524FB073088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FB053088C9BB009885DA /* ShortcutButtonContainerView.swift */; };
+ E524FB083088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FB053088C9BB009885DA /* ShortcutButtonContainerView.swift */; };
+ E524FB093088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E524FB053088C9BB009885DA /* ShortcutButtonContainerView.swift */; };
E5385955E04D43598CAC5694 /* vice.x64sc.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6A6021052A14459DA6F729AB /* vice.x64sc.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
E5A00BB23080B2CC00E99223 /* ProHUDExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A00BB13080B2C200E99223 /* ProHUDExtensions.swift */; };
E5A00BB33080B2CC00E99223 /* ProHUDExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A00BB13080B2C200E99223 /* ProHUDExtensions.swift */; };
E5A00BB43080B2CC00E99223 /* ProHUDExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A00BB13080B2C200E99223 /* ProHUDExtensions.swift */; };
+ E5D10A010000000000000011 /* DuoLayoutKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5D10A010000000000000001 /* DuoLayoutKit.swift */; };
+ E5D10A010000000000000012 /* DuoLayoutKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5D10A010000000000000001 /* DuoLayoutKit.swift */; };
+ E5D10A010000000000000013 /* DuoLayoutKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5D10A010000000000000001 /* DuoLayoutKit.swift */; };
+ E5D10A010000000000000014 /* DuoLayoutKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5D10A010000000000000001 /* DuoLayoutKit.swift */; };
E977CAA1F3C34827833FAF30 /* XCGLogger in Frameworks */ = {isa = PBXBuildFile; productRef = 5713306D2D91AFE00043C28A /* XCGLogger */; };
EAE31C39F6FF42DE8F5BA497 /* Schedule in Frameworks */ = {isa = PBXBuildFile; productRef = 57C759192FD42D030093A2B3 /* Schedule */; };
EE7572E891E3420A86A7E33F /* CollectionViewPagingLayout in Frameworks */ = {isa = PBXBuildFile; productRef = 578E20902FD16DA500A2749A /* CollectionViewPagingLayout */; };
@@ -7393,6 +7429,7 @@
57F1D4A42FF630BF00FC5B2A /* GameOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameOptionsView.swift; sourceTree = "<group>"; };
57F1D4D02FFE10CC00FC5B2A /* GameInfoDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameInfoDetailView.swift; sourceTree = "<group>"; };
57F1D4FB2FFF58B400FC5B2A /* FocusKeyObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusKeyObserver.swift; sourceTree = "<group>"; };
+ 57F2A8012F8E100100C62FF6 /* PurchaseBackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchaseBackgroundView.swift; sourceTree = "<group>"; };
57F30CD62EC048780035327C /* ManufacturerCategoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManufacturerCategoryView.swift; sourceTree = "<group>"; };
57F30CDD2EC44F340035327C /* Manufacturer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Manufacturer.swift; sourceTree = "<group>"; };
57F3BAEA2F6541AB00ABF4B3 /* J2MESettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = J2MESettingView.swift; sourceTree = "<group>"; };
@@ -7451,7 +7488,15 @@
B2F4B7B12A147226003B0E07 /* UIViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewExtensions.swift; sourceTree = "<group>"; };
B93489E15EFD47F2AE825436 /* Amiga.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Amiga.swift; sourceTree = "<group>"; };
E520DED7306E95FC003F83BE /* UIViewControllerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtensions.swift; sourceTree = "<group>"; };
+ E524FA4F30879AB6009885DA /* DuoTabletopControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuoTabletopControlView.swift; sourceTree = "<group>"; };
+ E524FA8D30886483009885DA /* DuoTabletopControlWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuoTabletopControlWindow.swift; sourceTree = "<group>"; };
+ E524FA9830886499009885DA /* DuoTabletopControlController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuoTabletopControlController.swift; sourceTree = "<group>"; };
+ E524FAA3308864B3009885DA /* TabletopSizeTransitionCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabletopSizeTransitionCoordinator.swift; sourceTree = "<group>"; };
+ E524FAAE30886516009885DA /* DuoTabletopKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuoTabletopKit.swift; sourceTree = "<group>"; };
+ E524FABA308866D4009885DA /* DuoHingeKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuoHingeKit.swift; sourceTree = "<group>"; };
+ E524FB053088C9BB009885DA /* ShortcutButtonContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutButtonContainerView.swift; sourceTree = "<group>"; };
E5A00BB13080B2C200E99223 /* ProHUDExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProHUDExtensions.swift; sourceTree = "<group>"; };
+ E5D10A010000000000000001 /* DuoLayoutKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuoLayoutKit.swift; sourceTree = "<group>"; };
F0C500000000000000000101 /* FocusTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusTypes.swift; sourceTree = "<group>"; };
F0C500000000000000000102 /* Focusable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Focusable.swift; sourceTree = "<group>"; };
F0C500000000000000000103 /* FocusContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusContainer.swift; sourceTree = "<group>"; };
@@ -7798,6 +7843,7 @@
57047A132D856DB000C62FF6 /* PriceView.swift */,
57047A0B2D852E7200C62FF6 /* FeaturesView.swift */,
57047A092D85217400C62FF6 /* PurchaseView.swift */,
+ 57F2A8012F8E100100C62FF6 /* PurchaseBackgroundView.swift */,
);
path = Views;
sourceTree = "<group>";
@@ -8241,6 +8287,7 @@
57A480E62E740301001D4598 /* CheevosChallengeView.swift */,
5771C2092E6569B60062EDE0 /* LeaderboardView.swift */,
5720CACB2DB5558B0090C0F6 /* ThreeDSKeyboardView.swift */,
+ E524FB053088C9BB009885DA /* ShortcutButtonContainerView.swift */,
);
path = Views;
sourceTree = "<group>";
@@ -13849,6 +13896,7 @@
57E48D922D8D7395008000A3 /* CheersView.swift */,
57FD13F0301109D5007F211A /* LandscapeBackgroundView.swift */,
57D48250301702B20030A771 /* FileBrowserView.swift */,
+ E524FA4F30879AB6009885DA /* DuoTabletopControlView.swift */,
);
path = Views;
sourceTree = "<group>";
@@ -13901,6 +13949,7 @@
57F0D8402DE2CD7500760F57 /* Cores */,
F0C5000000000000000000FF /* FocusKit */,
57E8A110304A4A1100000014 /* JIT */,
+ E524FA843088644C009885DA /* DuoTabletop */,
A5A69BA9256E56FF00D51C09 /* Others */,
A5DE1F73256BDE140099425B /* Extensions */,
);
@@ -14005,6 +14054,8 @@
57B6ECD32D7984B0002E619C /* DolphinGameID.swift */,
57B6ECD62D7984B0002E619C /* DolphinCheatINI.swift */,
57BA59B42E3F13C900110849 /* EmulationCore.swift */,
+ E5D10A010000000000000001 /* DuoLayoutKit.swift */,
+ E524FABA308866D4009885DA /* DuoHingeKit.swift */,
);
path = Others;
sourceTree = "<group>";
@@ -14108,6 +14159,17 @@
name = Frameworks;
sourceTree = "<group>";
};
+ E524FA843088644C009885DA /* DuoTabletop */ = {
+ isa = PBXGroup;
+ children = (
+ E524FAAE30886516009885DA /* DuoTabletopKit.swift */,
+ E524FAA3308864B3009885DA /* TabletopSizeTransitionCoordinator.swift */,
+ E524FA9830886499009885DA /* DuoTabletopControlController.swift */,
+ E524FA8D30886483009885DA /* DuoTabletopControlWindow.swift */,
+ );
+ path = DuoTabletop;
+ sourceTree = "<group>";
+ };
F0C5000000000000000000FF /* FocusKit */ = {
isa = PBXGroup;
children = (
@@ -14690,7 +14752,9 @@
00000000000051A100000083 /* CGSizeExtenstions.swift in Sources */,
00000000000051A100000084 /* GameInfoNavigationView.swift in Sources */,
00000000000051A100000085 /* DC.swift in Sources */,
+ E524FABE308866D6009885DA /* DuoHingeKit.swift in Sources */,
00000000000051A100000086 /* UIDeviceExtensions.swift in Sources */,
+ E5D10A010000000000000011 /* DuoLayoutKit.swift in Sources */,
00000000000051A100000087 /* ThreeDSKeyboardView.swift in Sources */,
00000000000051A100000088 /* PriceItemCollectionCell.swift in Sources */,
00000000000051A100000089 /* CategorySelectionView.swift in Sources */,
@@ -14799,6 +14863,7 @@
00000000000051A1000000F0 /* ASCornerStyle.swift in Sources */,
00000000000051A1000000F1 /* FileBrowserView.swift in Sources */,
00000000000051A1000000F2 /* PSXSBICollectionCell.swift in Sources */,
+ E524FAA7308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */,
00000000000051A1000000F3 /* SkinCollectionViewCell.swift in Sources */,
00000000000051A1000000F4 /* Shaders.metal in Sources */,
00000000000051A1000000F5 /* PersistedKit.swift in Sources */,
@@ -14913,6 +14978,7 @@
00000000000051A100000162 /* TriggerButton.swift in Sources */,
00000000000051A100000163 /* FilesSyncManager.swift in Sources */,
00000000000051A100000164 /* FilesSyncPolicy.swift in Sources */,
+ E524FAB230886523009885DA /* DuoTabletopKit.swift in Sources */,
00000000000051A100000165 /* FilesSyncIndex.swift in Sources */,
00000000000051A100000166 /* FilesSyncEngine.swift in Sources */,
00000000000051A100000167 /* FilesSyncIO.swift in Sources */,
@@ -14953,13 +15019,16 @@
00000000000051A10000018A /* SettingsBottomView.swift in Sources */,
00000000000051A10000018B /* GameInfoDetailView.swift in Sources */,
00000000000051A10000018C /* FileManagerExtensions.swift in Sources */,
+ E524FA9B3088649A009885DA /* DuoTabletopControlController.swift in Sources */,
00000000000051A10000018D /* GameMetadataKit.swift in Sources */,
00000000000051A10000018E /* CheevosProgressView.swift in Sources */,
00000000000051A10000018F /* PurchaseView.swift in Sources */,
+ 57F2A8052F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */,
00000000000051A100000190 /* PlayHistoryBlankSlateView.swift in Sources */,
00000000000051A100000191 /* AddTriggerActionHoldView.swift in Sources */,
00000000000051A100000192 /* PSPNetworkingView.swift in Sources */,
00000000000051A100000193 /* AddTriggerMappingListView.swift in Sources */,
+ E524FA5730879B06009885DA /* DuoTabletopControlView.swift in Sources */,
00000000000051A100000194 /* JGenesisView.swift in Sources */,
00000000000051A100000195 /* GradientView.swift in Sources */,
00000000000051A100000196 /* SyncManager.swift in Sources */,
@@ -14984,11 +15053,13 @@
00000000000051A1000001A9 /* LandscapeStatusView.swift in Sources */,
00000000000051A1000001AA /* GameLandscapeCarouselCell.swift in Sources */,
00000000000051A1000001AB /* ShaderLIstView.swift in Sources */,
+ E524FB063088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */,
00000000000051A1000001AC /* ASRadio.swift in Sources */,
00000000000051A1000001AD /* ColorPickerView.swift in Sources */,
00000000000051A1000001AE /* ASRadioView.swift in Sources */,
00000000000051A1000001AF /* CheatCodeListView.swift in Sources */,
00000000000051A1000001B0 /* ShaderToy.swift in Sources */,
+ E524FA9130886485009885DA /* DuoTabletopControlWindow.swift in Sources */,
00000000000051A1000001B1 /* ZipHandlerView.swift in Sources */,
00000000000051A1000001B2 /* SettingsTopView.swift in Sources */,
00000000000051A1000001B3 /* Bimap.swift in Sources */,
@@ -15125,7 +15196,9 @@
579093EF303C7D9100A53656 /* CGSizeExtenstions.swift in Sources */,
579093F0303C7D9100A53656 /* GameInfoNavigationView.swift in Sources */,
579093F1303C7D9100A53656 /* DC.swift in Sources */,
+ E524FABB308866D6009885DA /* DuoHingeKit.swift in Sources */,
579093F2303C7D9100A53656 /* UIDeviceExtensions.swift in Sources */,
+ E5D10A010000000000000012 /* DuoLayoutKit.swift in Sources */,
579093F3303C7D9100A53656 /* ThreeDSKeyboardView.swift in Sources */,
579093F4303C7D9100A53656 /* PriceItemCollectionCell.swift in Sources */,
579093F5303C7D9100A53656 /* CategorySelectionView.swift in Sources */,
@@ -15234,6 +15307,7 @@
57909459303C7D9100A53656 /* ASCornerStyle.swift in Sources */,
5790945A303C7D9100A53656 /* FileBrowserView.swift in Sources */,
5790945B303C7D9100A53656 /* PSXSBICollectionCell.swift in Sources */,
+ E524FAA6308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */,
5790945C303C7D9100A53656 /* SkinCollectionViewCell.swift in Sources */,
5790945D303C7D9100A53656 /* Shaders.metal in Sources */,
5790945E303C7D9100A53656 /* PersistedKit.swift in Sources */,
@@ -15348,6 +15422,7 @@
579094CB303C7D9100A53656 /* TriggerButton.swift in Sources */,
57EBA5533052D8AA0017A6C3 /* FilesSyncManager.swift in Sources */,
57EBA5613052D8AA0017A6C3 /* FilesSyncPolicy.swift in Sources */,
+ E524FAB030886523009885DA /* DuoTabletopKit.swift in Sources */,
57EBA5653052D8AA0017A6C3 /* FilesSyncIndex.swift in Sources */,
57EBA5693052D8AA0017A6C3 /* FilesSyncEngine.swift in Sources */,
57EBA56D3052D8AA0017A6C3 /* FilesSyncIO.swift in Sources */,
@@ -15388,13 +15463,16 @@
579094EC303C7D9100A53656 /* SettingsBottomView.swift in Sources */,
579094ED303C7D9100A53656 /* GameInfoDetailView.swift in Sources */,
579094EE303C7D9100A53656 /* FileManagerExtensions.swift in Sources */,
+ E524FA993088649A009885DA /* DuoTabletopControlController.swift in Sources */,
579094EF303C7D9100A53656 /* GameMetadataKit.swift in Sources */,
579094F0303C7D9100A53656 /* CheevosProgressView.swift in Sources */,
579094F1303C7D9100A53656 /* PurchaseView.swift in Sources */,
+ 57F2A8032F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */,
579094F2303C7D9100A53656 /* PlayHistoryBlankSlateView.swift in Sources */,
579094F3303C7D9100A53656 /* AddTriggerActionHoldView.swift in Sources */,
579094F4303C7D9100A53656 /* PSPNetworkingView.swift in Sources */,
579094F5303C7D9100A53656 /* AddTriggerMappingListView.swift in Sources */,
+ E524FA5830879B06009885DA /* DuoTabletopControlView.swift in Sources */,
579094F6303C7D9100A53656 /* JGenesisView.swift in Sources */,
579094F7303C7D9100A53656 /* GradientView.swift in Sources */,
579094F8303C7D9100A53656 /* SyncManager.swift in Sources */,
@@ -15419,11 +15497,13 @@
5790950A303C7D9100A53656 /* LandscapeStatusView.swift in Sources */,
5790950B303C7D9100A53656 /* GameLandscapeCarouselCell.swift in Sources */,
5790950C303C7D9100A53656 /* ShaderLIstView.swift in Sources */,
+ E524FB083088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */,
5790950D303C7D9100A53656 /* ASRadio.swift in Sources */,
5790950E303C7D9100A53656 /* ColorPickerView.swift in Sources */,
5790950F303C7D9100A53656 /* ASRadioView.swift in Sources */,
57909510303C7D9100A53656 /* CheatCodeListView.swift in Sources */,
57909511303C7D9100A53656 /* ShaderToy.swift in Sources */,
+ E524FA8F30886485009885DA /* DuoTabletopControlWindow.swift in Sources */,
57909512303C7D9100A53656 /* ZipHandlerView.swift in Sources */,
57909513303C7D9100A53656 /* SettingsTopView.swift in Sources */,
57909514303C7D9100A53656 /* Bimap.swift in Sources */,
@@ -15597,7 +15677,9 @@
57CDCDD62FD5CBD3005BA4C8 /* CGSizeExtenstions.swift in Sources */,
57F1D42D2FF381FB00FC5B2A /* GameInfoNavigationView.swift in Sources */,
57CDCDD72FD5CBD3005BA4C8 /* DC.swift in Sources */,
+ E524FABD308866D6009885DA /* DuoHingeKit.swift in Sources */,
57CDCDD92FD5CBD3005BA4C8 /* UIDeviceExtensions.swift in Sources */,
+ E5D10A010000000000000013 /* DuoLayoutKit.swift in Sources */,
57CDCDDB2FD5CBD3005BA4C8 /* ThreeDSKeyboardView.swift in Sources */,
57CDCDDC2FD5CBD3005BA4C8 /* PriceItemCollectionCell.swift in Sources */,
57F1D4052FF2160600FC5B2A /* CategorySelectionView.swift in Sources */,
@@ -15706,6 +15788,7 @@
5796DB122FE417E80051F661 /* ASCornerStyle.swift in Sources */,
57D48251301702BA0030A771 /* FileBrowserView.swift in Sources */,
57CDCE3F2FD5CBD3005BA4C8 /* PSXSBICollectionCell.swift in Sources */,
+ E524FAA4308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */,
57CDCE402FD5CBD3005BA4C8 /* SkinCollectionViewCell.swift in Sources */,
57CDCE412FD5CBD3005BA4C8 /* Shaders.metal in Sources */,
57CDCE422FD5CBD3005BA4C8 /* PersistedKit.swift in Sources */,
@@ -15820,6 +15903,7 @@
57CDCEB42FD5CBD3005BA4C8 /* TriggerButton.swift in Sources */,
57EBA5543052D8AA0017A6C3 /* FilesSyncManager.swift in Sources */,
57EBA5623052D8AA0017A6C3 /* FilesSyncPolicy.swift in Sources */,
+ E524FAB130886523009885DA /* DuoTabletopKit.swift in Sources */,
57EBA5663052D8AA0017A6C3 /* FilesSyncIndex.swift in Sources */,
57EBA56A3052D8AA0017A6C3 /* FilesSyncEngine.swift in Sources */,
57EBA56E3052D8AA0017A6C3 /* FilesSyncIO.swift in Sources */,
@@ -15860,13 +15944,16 @@
57ABFBDD2FED227B001C1425 /* SettingsBottomView.swift in Sources */,
57F1D4D12FFE10D300FC5B2A /* GameInfoDetailView.swift in Sources */,
57CDCED72FD5CBD3005BA4C8 /* FileManagerExtensions.swift in Sources */,
+ E524FA9A3088649A009885DA /* DuoTabletopControlController.swift in Sources */,
5721F1A63027177100CAC638 /* GameMetadataKit.swift in Sources */,
57CDCED82FD5CBD3005BA4C8 /* CheevosProgressView.swift in Sources */,
57CDCED92FD5CBD3005BA4C8 /* PurchaseView.swift in Sources */,
+ 57F2A8042F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */,
57CDCEDA2FD5CBD3005BA4C8 /* PlayHistoryBlankSlateView.swift in Sources */,
57D48421302311D00030A771 /* AddTriggerActionHoldView.swift in Sources */,
57CDCEDB2FD5CBD3005BA4C8 /* PSPNetworkingView.swift in Sources */,
57D483CE3021D6D30030A771 /* AddTriggerMappingListView.swift in Sources */,
+ E524FA5530879B06009885DA /* DuoTabletopControlView.swift in Sources */,
57CDCEDC2FD5CBD3005BA4C8 /* JGenesisView.swift in Sources */,
57CDCEDD2FD5CBD3005BA4C8 /* GradientView.swift in Sources */,
57CDCEDE2FD5CBD3005BA4C8 /* SyncManager.swift in Sources */,
@@ -15891,11 +15978,13 @@
5721F1E3302833FE00CAC638 /* LandscapeStatusView.swift in Sources */,
5721F1E6302833FE00CAC638 /* GameLandscapeCarouselCell.swift in Sources */,
57D481FF3014A2480030A771 /* ShaderLIstView.swift in Sources */,
+ E524FB093088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */,
5796DB3C2FE41A0A0051F661 /* ASRadio.swift in Sources */,
57CDCF042FD5CBD3005BA4C8 /* ColorPickerView.swift in Sources */,
57BF5EE12FDB09BC0073D318 /* ASRadioView.swift in Sources */,
57CDCF052FD5CBD3005BA4C8 /* CheatCodeListView.swift in Sources */,
5760A3A73029E813002CCF6B /* ShaderToy.swift in Sources */,
+ E524FA9030886485009885DA /* DuoTabletopControlWindow.swift in Sources */,
57CDCF062FD5CBD3005BA4C8 /* ZipHandlerView.swift in Sources */,
57ABFBD62FED20D1001C1425 /* SettingsTopView.swift in Sources */,
57D942CD302F1EC000C06208 /* Bimap.swift in Sources */,
@@ -16053,6 +16142,7 @@
57F1D42C2FF381FB00FC5B2A /* GameInfoNavigationView.swift in Sources */,
5771C28B2E6986C00062EDE0 /* DC.swift in Sources */,
A58C3F4F248E44AF0099E068 /* UIDeviceExtensions.swift in Sources */,
+ E5D10A010000000000000014 /* DuoLayoutKit.swift in Sources */,
5720CACC2DB555990090C0F6 /* ThreeDSKeyboardView.swift in Sources */,
57047A162D8571D600C62FF6 /* PriceItemCollectionCell.swift in Sources */,
57F1D4062FF2160600FC5B2A /* CategorySelectionView.swift in Sources */,
@@ -16088,6 +16178,7 @@
576C46312E16D9090008D087 /* MultiDiscDescCollectionCell.swift in Sources */,
57399AC52E40ACE100AB73DD /* PSXSBIImportView.swift in Sources */,
57BF60722FE278B80073D318 /* ASViewEffects.swift in Sources */,
+ E524FA5630879B06009885DA /* DuoTabletopControlView.swift in Sources */,
570F59152DC5BB48007BFD92 /* PlatformSortCollectionViewCell.swift in Sources */,
B2C97B4E2A09F3B900053A4C /* UIColorExtensions.swift in Sources */,
57B6ECF52D79F1EA002E619C /* SkinSettingsView.swift in Sources */,
@@ -16113,6 +16204,7 @@
57A480E72E74030E001D4598 /* CheevosChallengeView.swift in Sources */,
57B5E3142ECC625E00DE17E9 /* Arcade.swift in Sources */,
5720E7AA2E541F2000EC0DA5 /* RadialGradientView.swift in Sources */,
+ E524FB073088C9BD009885DA /* ShortcutButtonContainerView.swift in Sources */,
573CEE0E2F20D05800EA24F1 /* RomPatcherView.swift in Sources */,
5713300F2D90FF820043C28A /* BaseView.swift in Sources */,
57655C262DF6BCF3003E4A6E /* PlatformSelectionView.swift in Sources */,
@@ -16129,6 +16221,7 @@
5781F4992EEE71B500916D8B /* ShaderOrderView.swift in Sources */,
57FD13F530110A34007F211A /* LandscapeBackgroundView.swift in Sources */,
577005612D3CD3AC00762E8F /* UTTypeExtensions.swift in Sources */,
+ E524FAA5308864B4009885DA /* TabletopSizeTransitionCoordinator.swift in Sources */,
57D7CF952EA8E7EE00F41540 /* TriggerProView.swift in Sources */,
5706B0372DFBEC1E0066122E /* SG1000.swift in Sources */,
57BF5EDA2FDB09A80073D318 /* ASCheckView.swift in Sources */,
@@ -16223,6 +16316,7 @@
574ABE992E6021550045F76E /* GBC.swift in Sources */,
576F0E0C2D880DE600D2A1BA /* GradientImageView.swift in Sources */,
571BB8072DA4357D00830134 /* ThreeDS.swift in Sources */,
+ E524FA8E30886485009885DA /* DuoTabletopControlWindow.swift in Sources */,
576060222D24E07500A98B0C /* AnimatedGradientView.swift in Sources */,
570F59132DC5BB1D007BFD92 /* CoverStyleCollectionViewCell.swift in Sources */,
5771C20A2E6569BE0062EDE0 /* LeaderboardView.swift in Sources */,
@@ -16242,6 +16336,7 @@
57B5E3242ECCCD0800DE17E9 /* MAMEKit.swift in Sources */,
5796DB4A2FE41A630051F661 /* ASProgress.swift in Sources */,
57ABFB622FEBC335001C1425 /* SettingsMembershipView.swift in Sources */,
+ E524FABC308866D6009885DA /* DuoHingeKit.swift in Sources */,
573CEE912F23396400EA24F1 /* Jaguar.swift in Sources */,
57DA89322D8328510074052A /* CKAccountStatusExtensions.swift in Sources */,
5720E7652E540F7200EC0DA5 /* RetroAchievementsLoginView.swift in Sources */,
@@ -16283,6 +16378,7 @@
5781F47E2EEE572A00916D8B /* ShaderInfoView.swift in Sources */,
57C65AEB2FD6B2E300BB73E0 /* ASListItemView.swift in Sources */,
572D02722F87E45B000BD6F4 /* PretendoNetworkingConfig.swift in Sources */,
+ E524FA9C3088649A009885DA /* DuoTabletopControlController.swift in Sources */,
5796DB442FE41A300051F661 /* ASChevron.swift in Sources */,
57F632FE2D718236007270E8 /* SettingsListView.swift in Sources */,
578E4BA52F8A9B230027E6D0 /* TitleSortCollectionCell.swift in Sources */,
@@ -16292,6 +16388,7 @@
57CC35802DC0684500DF7418 /* DownloadManageView.swift in Sources */,
57913AF52D5D89CF004D51AA /* TouchController.swift in Sources */,
57CC33BE2DBCDF3400DF7418 /* CGRectExtensions.swift in Sources */,
+ E524FAAF30886523009885DA /* DuoTabletopKit.swift in Sources */,
57399B192E42EDEA00AB73DD /* DeadZoneControl.swift in Sources */,
A392D5652E96682C00F920E7 /* DisabledTapSwitch.swift in Sources */,
57F632852D6EB485007270E8 /* UIScreenExtensions.swift in Sources */,
@@ -16318,6 +16415,7 @@
5721F1A73027177100CAC638 /* GameMetadataKit.swift in Sources */,
57D029192E6C9C5200BF1F9D /* CheevosProgressView.swift in Sources */,
57047A0A2D85217C00C62FF6 /* PurchaseView.swift in Sources */,
+ 57F2A8022F8E100100C62FF6 /* PurchaseBackgroundView.swift in Sources */,
57EC6AB82D803810002920F0 /* PlayHistoryBlankSlateView.swift in Sources */,
57D48422302311D00030A771 /* AddTriggerActionHoldView.swift in Sources */,
578F28972F37856B00D2D998 /* PSPNetworkingView.swift in Sources */,
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/Contents.json
new file mode 100644
index 00000000..8188a9d4
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/Contents.json
@@ -0,0 +1,54 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected]
new file mode 100644
index 00000000..422dfd24
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected]
new file mode 100644
index 00000000..c77e8f46
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected]
new file mode 100644
index 00000000..d9474fde
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected]
new file mode 100644
index 00000000..0a2f058d
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_a.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/Contents.json
new file mode 100644
index 00000000..afff411c
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/Contents.json
@@ -0,0 +1,54 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected]
new file mode 100644
index 00000000..c7b9f270
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected]
new file mode 100644
index 00000000..460a8519
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected]
new file mode 100644
index 00000000..02bf0368
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected]
new file mode 100644
index 00000000..09f9dafe
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_b.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/Contents.json
new file mode 100644
index 00000000..481cb871
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/Contents.json
@@ -0,0 +1,54 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected]
new file mode 100644
index 00000000..93a72ba2
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected]
new file mode 100644
index 00000000..f5a9349c
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected]
new file mode 100644
index 00000000..644482b8
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected]
new file mode 100644
index 00000000..9a9badf8
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_bg.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/Contents.json
new file mode 100644
index 00000000..0d9fc1de
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/Contents.json
@@ -0,0 +1,54 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected]
new file mode 100644
index 00000000..a87d36b3
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected]
new file mode 100644
index 00000000..cf305fb0
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected]
new file mode 100644
index 00000000..f95c6be6
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected]
new file mode 100644
index 00000000..11ea419b
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_dpad.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/Contents.json
new file mode 100644
index 00000000..9778ea2d
--- /dev/null
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/Contents.json
@@ -0,0 +1,54 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "filename" : "[email protected]",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected]
new file mode 100644
index 00000000..cd26c441
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected]
new file mode 100644
index 00000000..3eefd167
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected]
new file mode 100644
index 00000000..7ecfa2ba
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected]
new file mode 100644
index 00000000..76c33ac1
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Common/TabletopMode_select.imageset/[email protected] differ
diff --git a/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig b/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig
index 7dc78b65..354b145e 100644
--- a/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig
+++ b/ManicEmu/ManicEmu/Resources/Config-Base.xcconfig
@@ -11,8 +11,8 @@
// https://help.apple.com/xcode/#/dev745c5c974
APP_BUNDLE_IDENTIFIER = com.aoshuang.manicemu
-APP_BUILD_VERSION = 12
-APP_VERSION = 2.0.1
+APP_BUILD_VERSION = 1
+APP_VERSION = 2.0.2
// Prebuilt cores under ProjectManicEMU/Cores (Citra.framework, *.libretro.framework, …)
FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)/../Cores
diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
index 42920058..e9f06b46 100644
--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
@@ -1198,3 +1198,5 @@ Press the controller button to complete mapping...";
"ScrollToLastGame" = "Scroll to Last Game";
"ScrollToFirstGame" = "Scroll to First Game";
"WhatsNew" = "What’s New in v%@";
+
+"TabletopModeDetected" = "Fold the device and rotate to portrait to enter Tabletop Mode.";
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
index d5e9b99d..302c2be8 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
@@ -1193,3 +1193,5 @@
"ICloudROMSizeLimitUnlimited" = "不限制";
"ICloudROMSizeLimitDesc" = "超过此大小的 ROM 只会保留在本机,避免单个大型光盘镜像占满 iCloud 云盘。游戏存档、即时存档、皮肤和设置不受影响。";
"ICloudROMTransferLimitDesc" = "这两项限制仅作用于 ROM 文件。游戏存档、即时存档、皮肤和设置会在任意网络、任意大小下继续同步。打开游戏时始终会下载对应 ROM,即使限制本会阻止同步。";
+
+"TabletopModeDetected" = "折叠并将屏幕转为竖屏,即可进入 Tabletop 模式。";
diff --git a/ManicEmu/ManicEmu/Sources/Base/AppDelegate.swift b/ManicEmu/ManicEmu/Sources/Base/AppDelegate.swift
index c28597e6..add72b52 100644
--- a/ManicEmu/ManicEmu/Sources/Base/AppDelegate.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/AppDelegate.swift
@@ -40,17 +40,32 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Allowed interface orientations. Rotation follows this mask, not overlay windows.
static var orientation: UIInterfaceOrientationMask = R.Config.DefaultOrientation {
didSet {
- if !OrientationLockPin.isPinned {
+ // Assignment re-reads the lock. During Tabletop, do not also follow the device.
+ let tabletop: Bool = {
+ guard #available(iOS 27.1, *) else { return false }
+ return DuoTabletopKit.isTabletopActive
+ }()
+ if !tabletop, !OrientationLockPin.isPinned {
UIViewController.attemptRotationToDeviceOrientation()
}
if #available(iOS 16.0, *) {
- var vc = UIWindow.applicationWindow?.rootViewController
- while let current = vc {
- current.setNeedsUpdateOfSupportedInterfaceOrientations()
- if #available(iOS 26.0, *) {
- current.setNeedsUpdateOfPrefersInterfaceOrientationLocked()
+ let roots: [UIViewController]
+ if tabletop {
+ roots = (ApplicationSceneDelegate.applicationScene?.windows ?? []).compactMap(\.rootViewController)
+ } else if let root = UIWindow.applicationWindow?.rootViewController {
+ roots = [root]
+ } else {
+ roots = []
+ }
+ for root in roots {
+ var vc: UIViewController? = root
+ while let current = vc {
+ current.setNeedsUpdateOfSupportedInterfaceOrientations()
+ if #available(iOS 26.0, *) {
+ current.setNeedsUpdateOfPrefersInterfaceOrientationLocked()
+ }
+ vc = current.presentedViewController
}
- vc = current.presentedViewController
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Base/Application.swift b/ManicEmu/ManicEmu/Sources/Base/Application.swift
index 329afd89..b126f5a1 100644
--- a/ManicEmu/ManicEmu/Sources/Base/Application.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/Application.swift
@@ -18,7 +18,17 @@ class ManicApplication: UIApplication {
if event.type == .touches,
let touches = event.allTouches,
touches.contains(where: { $0.phase == .began }) {
- FocusSystem.shared.userDidTouchScreen()
+ // sendEvent runs before the control's keyDown. Clearing focus here makes the
+ // following direction key only restore the remembered item, so a tap never moves.
+ // A held direction still repeats after this, which is why a long press navigates.
+ let began = touches.filter { $0.phase == .began }
+ let tabletopControl: Bool = {
+ guard #available(iOS 27.1, *) else { return false }
+ return !began.isEmpty && began.allSatisfy(DuoTabletopKit.isTabletopControlTouch)
+ }()
+ if !tabletopControl {
+ FocusSystem.shared.userDidTouchScreen()
+ }
}
super.sendEvent(event)
}
diff --git a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
index 0a929b63..8e35c666 100644
--- a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
@@ -9,12 +9,14 @@ import UIKit
import GameController
import OAuthSwift
import UniformTypeIdentifiers
+import ProHUD
class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
static weak var applicationScene: UIWindowScene?
static weak var applicationWindow: UIWindow?
var window: UIWindow?
static var launchGameID: String? = nil
+ private var hingeChangeNotification: Any? = nil
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
@@ -23,6 +25,26 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
ApplicationSceneDelegate.applicationWindow = window
window?.tintColor = R.Color.Main
installGamepadEventInteraction(on: window)
+ //setup ProHUD
+ AppContext.supportedInterfaceOrientations = {
+ OrientationLockPin.resolvedMask(for: nil)
+ }
+ if #available(iOS 26.0, *) {
+ AppContext.prefersInterfaceOrientationLocked = {
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopActive {
+ return DuoTabletopKit.isTabletopOrientationLocked
+ }
+ return OrientationLockPin.prefersLocked
+ }
+ }
+ OrientationLockPin.onForcedLandscapeGeometry = {
+ AppContext.alignOverlayWindowsWithScene()
+ }
+ AppContext.prefersStatusBarHidden = { [weak self] presentedViewController in
+ guard let self else { return nil }
+ return UIViewController.shouldStatusBarHidden(window: self.window,
+ presentedViewController: presentedViewController)
+ }
let loadThenPresentHome = {
ResourcesKit.loadResources { isSuccess in
Database.setup {
@@ -61,12 +83,12 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
})
#if SIDE_LOAD
- StikJITHostCoordinator.shared.enableOnLaunchIfNeeded()
+ StikJITHostCoordinator.shared.enableOnLaunchIfNeeded()
#endif
-
}
}
}
+
// Same unzip conditions as ResourcesKit; keep this read-only so the original extract path is unchanged.
if Self.needsResourceExtract() {
window?.rootViewController = LaunchPlaceholderViewController()
@@ -76,8 +98,50 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
} else {
loadThenPresentHome()
}
+
let dropInteraction = UIDropInteraction(delegate: self)
window?.addInteraction(dropInteraction)
+
+ if #available(iOS 27.1, *), UIDevice.isPhoneDuo {
+ //Monitor changes to the hinge
+ window?.addInteraction(UIHingeInteraction(updateHandler: { interaction, update in
+ DuoHingeKit.didHingeUpdate(interaction: interaction, update: update)
+ DispatchQueue.once {
+ /// try enter iPhone Duo Tabletop Mode
+ if !PlayViewController.isGaming,
+ UIDevice.isPhoneDuoInner,
+ let hinge = DuoHingeKit.currentStatusHinge,
+ hinge.status == .partiallyOpen {
+ if UIDevice.isLandscape && !DuoTabletopKit.isTabletopMode {
+ UIView.makeToast(message: R.string.localizable.tabletopModeDetected())
+ } else {
+ DuoTabletopKit.startTabletopMode()
+ }
+ }
+ }
+ }))
+ hingeChangeNotification = NotificationCenter.default.addObserver(forName: R.NotificationName.DuoHingeChange, object: nil, queue: .main) { notification in
+ guard !PlayViewController.isGaming else { return }
+ if let transition = DuoHingeKit.transition(from: notification) {
+ if transition.to.status == .partiallyOpen {
+ if UIDevice.isLandscape && !DuoTabletopKit.isTabletopMode {
+ UIView.makeToast(message: R.string.localizable.tabletopModeDetected())
+ return
+ } else {
+ DuoTabletopKit.startTabletopMode()
+ }
+ } else if DuoTabletopKit.isTabletopMode {
+ DuoTabletopKit.stopTabletopMode()
+ }
+ }
+ }
+ }
+ }
+ }
+
+ func sceneDidDisconnect(_ scene: UIScene) {
+ if let hingeChangeNotification {
+ NotificationCenter.default.removeObserver(hingeChangeNotification)
}
}
@@ -121,6 +185,9 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneDidBecomeActive(_ scene: UIScene) {
FilesSyncManager.shared.handleDidBecomeActive()
+ if #available(iOS 27.1, *) {
+ DuoTabletopKit.resumeTabletopOnBecomeActiveIfNeeded()
+ }
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
@@ -203,7 +270,27 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
@available(iOS 26.0, tvOS 26.0, *)
func windowScene(_ windowScene: UIWindowScene, didUpdateEffectiveGeometry previousEffectiveGeometry: UIWindowScene.Geometry) {
- //Use this method to handle the following geometry changes above iOS26.
+ if #available(iOS 27.1, *),
+ UIDevice.isPhoneDuoInnerFullScreen,
+ UIDevice.isPortrait,
+ let hinge = DuoHingeKit.currentStatusHinge,
+ hinge.status == .partiallyOpen,
+ !DuoTabletopKit.isTabletopMode,
+ let window = windowScene.keyWindow,
+ windowScene.screen.bounds.equalTo(window.bounds) {
+ DuoTabletopKit.startTabletopMode()
+ } else if #available(iOS 27.1, *),
+ DuoTabletopKit.isTabletopMode,
+ let hinge = DuoHingeKit.currentStatusHinge,
+ hinge.status == .closed {
+ DuoTabletopKit.stopTabletopMode()
+ }
+
+ guard #available(iOS 27.1, *), DuoTabletopKit.isTabletopActive else { return }
+ if windowScene.effectiveGeometry.interfaceOrientation == DuoTabletopKit.tabletopPendingOrientation {
+ DuoTabletopKit.finishTabletopOrientationFlip()
+ }
+ DuoTabletopKit.relayoutTabletopPanesIfNeeded()
}
@available(iOS 27.0, tvOS 27.0, *)
diff --git a/ManicEmu/ManicEmu/Sources/Base/Constants.swift b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
index e1418dee..e0c0e93c 100644
--- a/ManicEmu/ManicEmu/Sources/Base/Constants.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
@@ -38,10 +38,11 @@ extension _R {
///HomeTabBarSize 300x60
static let HomeTabBarSize = CGSize(width: 300, height: ItemHeightLarge)
+ static let HomeTabBarSizeVertical = CGSize(width: ItemHeightLarge, height: 240)
static func SideMenuWidth(window: UIWindow?) -> CGFloat {
let windowSize = (window ?? UIWindow.applicationWindow)?.size ?? R.Size.ApplicationWindowSize
- return UIDevice.isPhone ? windowSize.minDimension * 0.874 : 300
+ return (UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen) ? windowSize.minDimension * 0.874 : 300
}
/// 游戏封面宽高比 默认1:1
static func GameCoverRatio(gameType: GameType, ignoreForceSquare: Bool = false) -> CGFloat {
@@ -103,20 +104,39 @@ extension _R {
///CollectionView的top缩进
static func ContentInsetTop(window: UIWindow?) -> CGFloat {
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopMode {
+ return R.Size.ContentSpaceMedium
+ }
+ if UIDevice.isPhoneDuoInnerFullScreen {
+ return R.Size.ContentSpaceLarge
+ }
let safeAreaTop = (window ?? UIWindow.applicationWindow)?.safeAreaInsets.top ?? 0
- if UIDevice.isPhoneDuoOuter {
- return 0
- } else {
- return safeAreaTop > 0 ? safeAreaTop : R.Size.ContentSpaceLarge
+ if UIDevice.isPhoneDuo {
+ if UIDevice.isPhoneDuoOuter && (UIDevice.currentOrientation == .portrait || UIDevice.currentOrientation == .landscapeRight) {
+ return 0
+ } else if UIDevice.isPhoneDuoSplitView {
+ return 0
+ }
}
+ return safeAreaTop > 0 ? safeAreaTop : R.Size.ContentSpaceLarge
}
///CollectionView的bottom缩进
static func ContentInsetBottom(window: UIWindow?) -> CGFloat {
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopMode {
+ return R.Size.ContentSpaceMedium
+ }
let safeAreaBottom = (window ?? UIWindow.applicationWindow)?.safeAreaInsets.bottom ?? 0
return safeAreaBottom > 0 ? safeAreaBottom : R.Size.ContentSpaceLarge
}
+ static func ContentInsetBottomForSettingPage(showAsDetail: Bool) -> CGFloat {
+ if showAsDetail {
+ return R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium
+ }
+ return 0
+ }
+
///苹果图标默认尺寸
static func AppleIconCornerRadius(height: CGFloat) -> CGFloat {
return 10/57 * height
@@ -242,21 +262,22 @@ extension _R {
static var SheetWindowMaxSize: CGSize {
let window = proHUDWindow()
let windowSize = window?.size ?? R.Size.ApplicationWindowSize
- if UIDevice.isPhone {
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen {
if windowSize.IsRelativelyWideRectangle {
- return CGSize(width: windowSize.height, height: windowSize.height - (window?.safeAreaInsets.vertical ?? 0))
+ return CGSize(width: UIDevice.isPhoneDuo ? 375 : windowSize.height, height: windowSize.height - (window?.safeAreaInsets.vertical ?? 0))
} else {
return CGSize(width: windowSize.width, height: windowSize.height - PresentationTop)
}
- } else if UIDevice.isPad {
+ } else if UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen {
if windowSize.IsRelativelyWideRectangle {
let height = windowSize.height * 0.9
let width = min(max(height*9/16, 375), windowSize.width * 0.9)
return CGSize(width: width, height: height)
} else {
+ let scale = UIDevice.isPhoneDuoInnerFullScreen ? 1.2 : 1.0
let width = max(windowSize.width*(UIDevice.isPadMini ? 0.65 : 0.5), 375)
let height = min(width*16/9, windowSize.height*0.9)
- return CGSize(width: width, height: height)
+ return CGSize(width: width*scale, height: height*scale)
}
}
return R.Size.ApplicationWindowSize
@@ -268,9 +289,10 @@ extension _R {
}
static var SheetFullScreenForIpadLandscape: CGSize {
+ let scale = UIDevice.isPhoneDuoInnerFullScreen ? 1.1 : 1.0
let windowSize = proHUDWindow()?.size ?? R.Size.ApplicationWindowSize
let width = windowSize.width*(UIDevice.isLandscape ? 0.8 : 0.9)
- return CGSize(width: width, height: width*9/16)
+ return CGSize(width: width*scale, height: width*9/16*scale)
}
///12.0
@@ -321,6 +343,13 @@ extension _R {
}
return sheetSize
}
+
+ ///iPhone Duo outer screen camera distance from the edge
+ static let iPhoneDuoOuterCameraEdge = 29.33
+ ///iPhone Duo outer screen camera size
+ static let iPhoneDuoOuterCameraSize = CGSize(37)
+ ///iPhone Duo Safearea
+ static let iPhoneDuoSafeAreaSize = 84.0
}
struct _Color {
@@ -1073,7 +1102,7 @@ extension _R {
}
static var PlatformOrder: [String]? = nil
static var DefaultOrientation: UIInterfaceOrientationMask {
- UIDevice.isPad ? .all : .allButUpsideDown
+ (UIDevice.isPad || UIDevice.isPhoneDuoInner) ? .all : .allButUpsideDown
}
}
@@ -1185,6 +1214,11 @@ extension _R {
static let GameMetadataChange = NSNotification.Name(rawValue: "GameMetadataChange")
//show filter view for landscape mode
static let ShowFilterForLandscapeMode = NSNotification.Name(rawValue: "ShowFilterForLandscapeMode")
+ ///iPhone Duo Hinge Change
+ /// Posted after a settled status change, once the window is already on the matching display.
+ /// `userInfo` contains `fromStatusKey` and `toStatusKey` (`NSNumber` raw values).
+ /// A fast closed → fully open drops the intermediate partially-open notice.
+ static let DuoHingeChange = NSNotification.Name(rawValue: "DuoHingeChange")
}
struct _URLs {
diff --git a/ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeContentCell.swift b/ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeContentCell.swift
index b5a91b96..13a032ac 100644
--- a/ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeContentCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/CheatCode/Views/AddCheatCodeContentCell.swift
@@ -64,6 +64,11 @@ class AddCheatCodeContentCell: UICollectionViewCell {
view.font = R.Font.Body()
view.returnKeyType = .default
view.delegate = self
+ view.isFocusable = true
+ view.onFocusConfirm = { [weak self] in
+ self?.editTextView.becomeFirstResponder()
+ return true
+ }
return view
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ASListPage.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ASListPage.swift
index efb7702a..65b12233 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ASListPage.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ASListPage.swift
@@ -618,6 +618,7 @@ extension ASListPage {
var enableTitleInteractive: Bool = false
var toolsBackground: UIColor = R.Color.BackgroundSecondary
var closeBackground: UIColor = R.Color.BackgroundSecondary
+ var enableIPhoneDuolayoutOptimization: Bool = false
static func defaultNavigation(title: String? = nil,
titleLineBreakMode: NSLineBreakMode = .byTruncatingTail,
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/ViewControllers/BaseViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Common/ViewControllers/BaseViewController.swift
index 57111142..35bd5b4d 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/ViewControllers/BaseViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/ViewControllers/BaseViewController.swift
@@ -152,20 +152,23 @@ class BaseViewController: UIViewController {
self?.backgroundMaskView?.snp.updateConstraints { make in
make.height.equalTo(R.Size.PageBackgroundMaskHeight(window: self?.hostingWindow))
}
+ }, completion: { _ in
+ if #available(iOS 27.1, *) {
+ DuoTabletopKit.relayoutTabletopPanesIfNeeded()
+ }
})
}
override var prefersStatusBarHidden: Bool {
- if UIDevice.isPad {
- return view.prefferedLayoutStyle == .landscape
- } else if UIDevice.isPhoneDuoOuter || UIDevice.isPhoneDuoSplitView {
- return true
+ if let shouldHidden = UIViewController.shouldStatusBarHidden(window: hostingWindow,
+ presentedViewController: presentedViewController) {
+ return shouldHidden
}
return super.prefersStatusBarHidden
}
fileprivate func setPreferredContentSize() {
- if UIDevice.isPad {
+ if UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen {
if let _ = self.presentingViewController { //如果自己是被present出来的话 就执行
let size = R.Size.PreferredContentSize
if self.preferredContentSize != size {
@@ -198,9 +201,16 @@ class BaseViewController: UIViewController {
return [.left, .right]
}
+ override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
+ OrientationLockPin.resolvedMask(for: hostingWindow)
+ }
+
@available(iOS 26.0, *)
override var prefersInterfaceOrientationLocked: Bool {
- OrientationLockPin.prefersLocked
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopActive {
+ return DuoTabletopKit.isTabletopOrientationLocked
+ }
+ return OrientationLockPin.prefersLocked
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift
index 5ca65446..b3bb55fe 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift
@@ -144,6 +144,9 @@ class ASListPageView: BaseView {
view.delegate = self
view.contentInset = listInsets
view.isFocusable = true
+ if UIDevice.isPhoneDuo {
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
private var toolView: ASListToolView? = nil
@@ -196,12 +199,20 @@ class ASListPageView: BaseView {
} else {
super.init(frame: .zero)
}
- updateViews()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
+
+ private var hasInit = false
+
+ override func didMoveToWindow() {
+ super.didMoveToWindow()
+ guard !hasInit else { return }
+ updateViews()
+ hasInit = true
+ }
}
//MARK: - UI-related Functions
@@ -217,7 +228,9 @@ extension ASListPageView {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { [weak self] sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { [weak self] sectionIndex, env in
guard let self else { return nil }
//sectionData
@@ -341,9 +354,8 @@ extension ASListPageView {
leading: Self.sectionHorizontalInsets,
bottom: hasFooter ? Self.sectionBottomInsetsWithFooter : 0,
trailing: Self.sectionHorizontalInsets)
-
return section
- }
+ }, configuration: configuration)
layout.register(ASListDecorationPrimaryView.self,
forDecorationViewOfKind: String(describing: ASListDecorationPrimaryView.self))
@@ -517,10 +529,7 @@ extension ASListPageView {
}
if enableSafeAreaBottomInsets {
- contentInset.bottom += hostingWindow?.safeAreaInsets.bottom ?? 0
- if UIDevice.isSmallScreenPhone {
- contentInset.bottom += R.Size.ContentInsetBottom(window: hostingWindow)
- }
+ contentInset.bottom += R.Size.ContentInsetBottom(window: hostingWindow)
}
collectionView.contentInset = contentInset
@@ -587,7 +596,7 @@ extension ASListPageView {
}
view.snp.remakeConstraints { make in
- if UIDevice.isPad || (UIDevice.isPhone && self.prefferedLayoutStyle == .landscape) {
+ if UIDevice.isPad || (UIDevice.isPhone && self.preferredLayoutStyle == .landscape) {
make.width.equalTo(R.Size.ButtonMaxWidth)
make.centerX.equalToSuperview()
} else {
@@ -748,12 +757,8 @@ extension ASListPageView {
height += window.safeAreaInsets.top
}
- if listPage.enableSafeAreaBottomInsets,
- let window = containerWindow {
- height += window.safeAreaInsets.bottom
- if UIDevice.isSmallScreenPhone {
- height += R.Size.ContentInsetBottom(window: containerWindow)
- }
+ if listPage.enableSafeAreaBottomInsets {
+ height += R.Size.ContentInsetBottom(window: containerWindow)
}
return height
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSegmentView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSegmentView.swift
index e63a3e04..7d093680 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSegmentView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSegmentView.swift
@@ -41,7 +41,7 @@ class ASSegmentView: BaseView {
clipsToBounds = true
applySegmentAppearance()
- indicatorView.clipsToBounds = true
+ indicatorView.masksToBounds = true
addSubview(indicatorView)
containerView.axis = .horizontal
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSheetView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSheetView.swift
index 28026263..9fb4a9cf 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSheetView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASSheetView.swift
@@ -62,7 +62,7 @@ class ASSheetView: BaseView {
let containerView = UIView()
var roundCorner: UIRectCorner {
- (UIDevice.isPad || getLayoutStyle() == .landscape || PlayViewController.menuInsets != nil) ? .allCorners : [.topLeft, .topRight]
+ (UIDevice.isPad || getLayoutStyle() == .landscape || PlayViewController.menuInsets != nil || UIDevice.isPhoneDuoInnerFullScreen) ? .allCorners : [.topLeft, .topRight]
}
let contentView = RoundAndBorderView(roundCorner: roundCorner, borderWidth: 1.5)
contentView.backgroundColor = R.Color.BackgroundPrimary
@@ -175,7 +175,7 @@ class ASSheetView: BaseView {
//Other style configurations for the sheet
func updateCardSize(config: SheetConfiguration) {
if sheetData.fullScreenForLandscape, getLayoutStyle() == .landscape {
- if UIDevice.isPhone {
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen {
config.cardMaxWidth = proHUDWindow()?.width
config.cardMaxHeight = proHUDWindow()?.height
} else {
@@ -217,7 +217,7 @@ class ASSheetView: BaseView {
var didNotifyCovering = false
func isCoveringLandscapeBackground() -> Bool {
- sheetData.fullScreenForLandscape && UIDevice.isPhone && getLayoutStyle() == .landscape
+ sheetData.fullScreenForLandscape && UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen && getLayoutStyle() == .landscape
}
func syncLandscapeBackgroundCovering() {
let covering = isCoveringLandscapeBackground()
@@ -258,7 +258,7 @@ class ASSheetView: BaseView {
if sheetData.fullScreenForLandscape, getLayoutStyle() == .landscape {
contentView.snp.remakeConstraints { make in
make.edges.equalToSuperview()
- if UIDevice.isPhone {
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen {
let windowHeight = (proHUDWindow()?.height) ?? R.Size.ApplicationWindowSize.height
make.height.equalTo(windowHeight)
} else {
@@ -295,7 +295,7 @@ class ASSheetView: BaseView {
guard let sheetView, let cardMaxHeight = sheetView.config.cardMaxHeight else { return }
let heightWillSet: CGFloat
if sheetData.fullScreenForLandscape, getLayoutStyle() == .landscape {
- if UIDevice.isPhone {
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen {
heightWillSet = (proHUDWindow()?.height) ?? R.Size.ApplicationWindowSize.height
} else {
heightWillSet = R.Size.SheetFullScreenForIpadLandscape.height
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASWebView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASWebView.swift
index 47784930..9b2b3d90 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASWebView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASWebView.swift
@@ -66,6 +66,10 @@ class ASWebView: BaseView {
view.backgroundColor = R.Color.BackgroundPrimary
view.scrollView.backgroundColor = R.Color.BackgroundPrimary
view.scrollView.contentInset = .insets(bottom: R.Size.ContentInsetBottom(window: hostingWindow))
+ if UIDevice.isPhoneDuo {
+ view.scrollView.insetsLayoutMarginsFromSafeArea = false
+ view.scrollView.contentInsetAdjustmentBehavior = .never
+ }
return view
}()
@@ -103,11 +107,7 @@ class ASWebView: BaseView {
super.init(frame: .zero)
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.leading.trailing.equalTo(safeAreaLayoutGuide)
- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
- make.height.equalTo(R.Size.NavigationHeight)
- }
+ updateNavigationViewConstraints()
addSubview(webView)
webView.snp.makeConstraints { make in
@@ -145,6 +145,36 @@ class ASWebView: BaseView {
fatalError("init(coder:) has not been implemented")
}
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(safeAreaLayoutGuide)
+ }
+ make.top.equalToSuperview().offset(showAsSheet ? R.Size.SheetGrabberTopInset : R.Size.ContentSpaceLarge)
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
+
private func isValidURL(_ string: String) -> Bool {
let types: NSTextCheckingResult.CheckingType = .link
guard let detector = try? NSDataDetector(types: types.rawValue) else { return false }
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/DuoTabletopControlView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/DuoTabletopControlView.swift
new file mode 100644
index 00000000..5ae301f0
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/DuoTabletopControlView.swift
@@ -0,0 +1,301 @@
+//
+// DuoTabletopControlView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/20.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+import UIKit
+
+/// Bottom pane of iPhone Duo Tabletop. Frames match the `Dark` artboard (669×951), shifted into the pane that starts at y = 476.
+@available(iOS 27.1, *)
+class DuoTabletopControlView: BaseView {
+ private enum Design {
+ static let pane = CGSize(width: 669, height: 475.5)
+ static let dpad = CGRect(x: 70, y: 150, width: 150, height: 150)
+ static let buttonA = CGRect(x: 522, y: 163, width: 64, height: 64)
+ static let buttonB = CGRect(x: 462, y: 223, width: 64, height: 64)
+ static let select = CGRect(x: 319, y: 261, width: 30, height: 30)
+ }
+
+ private let backgroundView = UIImageView(image: UIImage(named: "TabletopMode_bg"))
+ private let dpadView = TabletopDpadControl(imageName: "TabletopMode_dpad")
+ private let aButton = TabletopKeyControl(imageName: "TabletopMode_a", key: .a)
+ private let bButton = TabletopKeyControl(imageName: "TabletopMode_b", key: .b)
+ private let selectButton = TabletopKeyControl(imageName: "TabletopMode_select", key: .select)
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+ backgroundColor = R.Color.BackgroundPrimary
+ backgroundView.contentMode = .scaleAspectFill
+ backgroundView.clipsToBounds = true
+ isMultipleTouchEnabled = true
+ addSubview(backgroundView)
+ addSubview(dpadView)
+ addSubview(aButton)
+ addSubview(bButton)
+ addSubview(selectButton)
+ }
+
+ @MainActor required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ backgroundView.frame = bounds
+ guard Design.pane.width > 0 else { return }
+ // One scale from the pane width. The window is half a point shorter than the artboard, and stretching Y would move the controls.
+ let scale = bounds.width / Design.pane.width
+ func place(_ view: UIView, _ design: CGRect) {
+ view.frame = CGRect(x: design.minX * scale,
+ y: design.minY * scale,
+ width: design.width * scale,
+ height: design.height * scale)
+ }
+ place(dpadView, Design.dpad)
+ place(aButton, Design.buttonA)
+ place(bButton, Design.buttonB)
+ place(selectButton, Design.select)
+ }
+}
+
+/// Spring press used by skin buttons in `DynamicEffectView`.
+@available(iOS 27.1, *)
+private final class TabletopPressAnimator {
+ private var animator: UIViewPropertyAnimator?
+ private var generation = 0
+ private var pressedAt = Date()
+
+ func press(_ animations: @escaping () -> Void) {
+ generation += 1
+ pressedAt = Date()
+ run(animations)
+ }
+
+ /// Matches `ButtonsDynamicEffectView.deactivateButtonEffect`: a tap shorter than 0.06s still shows the press.
+ func release(_ animations: @escaping () -> Void) {
+ generation += 1
+ let token = generation
+ let elapsed = Date().timeIntervalSince(pressedAt)
+ let runRelease = { [weak self] in
+ guard let self, token == self.generation else { return }
+ self.run(animations)
+ }
+ if elapsed < 0.06 {
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: runRelease)
+ } else {
+ runRelease()
+ }
+ }
+
+ private func run(_ animations: @escaping () -> Void) {
+ animator?.stopAnimation(true)
+ let timing = UISpringTimingParameters(dampingRatio: 1.0, initialVelocity: CGVector(dx: 0.2, dy: 0.2))
+ let animator = UIViewPropertyAnimator(duration: 0.65, timingParameters: timing)
+ animator.addAnimations(animations)
+ animator.isInterruptible = true
+ animator.startAnimation()
+ self.animator = animator
+ }
+}
+
+@available(iOS 27.1, *)
+private final class TabletopKeyControl: UIView {
+ private let key: FocusKey
+ private let imageView = UIImageView()
+ private let effect = TabletopPressAnimator()
+ private var touchInputs: [UITouch: Bool] = [:]
+ private var isDown = false
+
+ init(imageName: String, key: FocusKey) {
+ self.key = key
+ super.init(frame: .zero)
+ isMultipleTouchEnabled = true
+ imageView.image = UIImage(named: imageName)
+ imageView.contentMode = .scaleToFill
+ imageView.isUserInteractionEnabled = false
+ addSubview(imageView)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ deinit {
+ if isDown {
+ FocusSystem.shared.keyUp(key)
+ }
+ }
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ imageView.frame = bounds
+ }
+
+ override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
+ for touch in touches {
+ touchInputs[touch] = false
+ }
+ updateInputs(for: touches, ended: [])
+ }
+
+ override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
+ updateInputs(for: touches, ended: [])
+ }
+
+ override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
+ updateInputs(for: touches, ended: touches)
+ }
+
+ override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
+ touchesEnded(touches, with: event)
+ }
+
+ /// Same diff as `ButtonsInputView`: update the held set, then keyDown new presses and keyUp releases.
+ private func updateInputs(for touches: Set<UITouch>, ended: Set<UITouch>) {
+ for touch in ended {
+ touchInputs[touch] = nil
+ }
+ for touch in touches where touchInputs[touch] != nil {
+ let point = touch.location(in: self)
+ touchInputs[touch] = bounds.contains(point)
+ }
+ let down = touchInputs.values.contains(true)
+ guard down != isDown else { return }
+ isDown = down
+ if down {
+ FocusSystem.shared.keyDown(key)
+ UIDevice.generateHaptic()
+ effect.press { [weak self] in
+ self?.imageView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
+ }
+ } else {
+ FocusSystem.shared.keyUp(key)
+ effect.release { [weak self] in
+ self?.imageView.transform = .identity
+ }
+ }
+ }
+}
+
+@available(iOS 27.1, *)
+private final class TabletopDpadControl: UIView {
+ private let imageView = UIImageView()
+ private let effect = TabletopPressAnimator()
+ private var touchDirections: [UITouch: Set<FocusKey>] = [:]
+ private var activeDirections = Set<FocusKey>()
+
+ init(imageName: String) {
+ super.init(frame: .zero)
+ isMultipleTouchEnabled = true
+ imageView.image = UIImage(named: imageName)
+ imageView.contentMode = .scaleToFill
+ imageView.isUserInteractionEnabled = false
+ addSubview(imageView)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ deinit {
+ for key in activeDirections {
+ FocusSystem.shared.keyUp(key)
+ }
+ }
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ imageView.frame = bounds
+ }
+
+ override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
+ for touch in touches {
+ touchDirections[touch] = []
+ }
+ updateInputs(for: touches, ended: [])
+ }
+
+ override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
+ updateInputs(for: touches, ended: [])
+ }
+
+ override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
+ updateInputs(for: touches, ended: touches)
+ }
+
+ override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
+ touchesEnded(touches, with: event)
+ }
+
+ /// Thirds of the d-pad, same split as `ButtonsInputView` for `.directional`.
+ /// Corners belong to two directions; the center nub belongs to none.
+ private func directions(at point: CGPoint) -> Set<FocusKey> {
+ guard bounds.width > 0, bounds.height > 0, bounds.contains(point) else { return [] }
+ let thirdWidth = bounds.width / 3
+ let thirdHeight = bounds.height / 3
+ let top = CGRect(x: 0, y: 0, width: bounds.width, height: thirdHeight)
+ let bottom = CGRect(x: 0, y: bounds.height - thirdHeight, width: bounds.width, height: thirdHeight)
+ let left = CGRect(x: 0, y: 0, width: thirdWidth, height: bounds.height)
+ let right = CGRect(x: bounds.width - thirdWidth, y: 0, width: thirdWidth, height: bounds.height)
+ var directions = Set<FocusKey>()
+ if top.contains(point) { directions.insert(.up) }
+ if bottom.contains(point) { directions.insert(.down) }
+ if left.contains(point) { directions.insert(.left) }
+ if right.contains(point) { directions.insert(.right) }
+ return directions
+ }
+
+ private func updateInputs(for touches: Set<UITouch>, ended: Set<UITouch>) {
+ for touch in ended {
+ touchDirections[touch] = nil
+ }
+ for touch in touches where touchDirections[touch] != nil {
+ touchDirections[touch] = directions(at: touch.location(in: self))
+ }
+ let now = touchDirections.values.reduce(into: Set<FocusKey>()) { $0.formUnion($1) }
+ let activated = now.subtracting(activeDirections)
+ let deactivated = activeDirections.subtracting(now)
+ activeDirections = now
+ for key in deactivated {
+ FocusSystem.shared.keyUp(key)
+ }
+ if !activated.isEmpty {
+ for key in activated {
+ FocusSystem.shared.keyDown(key)
+ }
+ UIDevice.generateHaptic()
+ }
+ let transform = Self.tilt(for: now)
+ if now.isEmpty {
+ effect.release { [weak self] in
+ self?.imageView.transform3D = CATransform3DIdentity
+ }
+ } else if !activated.isEmpty || !deactivated.isEmpty {
+ effect.press { [weak self] in
+ self?.imageView.transform3D = transform
+ }
+ }
+ }
+
+ /// Per-direction tilt from `DynamicEffectView.pressEffect`. Diagonals combine the two arms.
+ private static func tilt(for directions: Set<FocusKey>) -> CATransform3D {
+ var transform = CATransform3DIdentity
+ transform.m34 = -1.0 / 500.0
+ if directions.contains(.up) {
+ transform = CATransform3DScale(CATransform3DTranslate(CATransform3DRotate(transform, .pi / 10, 1, 0, 0), 0, -1.75, 0), 0.95, 1, 1)
+ }
+ if directions.contains(.down) {
+ transform = CATransform3DScale(CATransform3DTranslate(CATransform3DRotate(transform, -.pi / 10, 1, 0, 0), 0, 1.75, 0), 0.95, 1, 1)
+ }
+ if directions.contains(.left) {
+ transform = CATransform3DScale(CATransform3DTranslate(CATransform3DRotate(transform, -.pi / 10, 0, 1, 0), -1.75, 0, 0), 1, 0.95, 1)
+ }
+ if directions.contains(.right) {
+ transform = CATransform3DScale(CATransform3DTranslate(CATransform3DRotate(transform, .pi / 10, 0, 1, 0), 1.75, 0, 0), 1, 0.95, 1)
+ }
+ return transform
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/LimitedTextInputView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/LimitedTextInputView.swift
index 1017dfee..cc961f17 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/LimitedTextInputView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/LimitedTextInputView.swift
@@ -219,16 +219,18 @@ struct LimitedTextInputView {
}
alert.set(customView: containerView).snp.makeConstraints { make in
- var width = 0.0
- if UIDevice.isPad {
- width = 375
- } else {
- width = R.Size.SheetWindowMinSize.width
- if proHUDLayoutStyle() == .portrait {
- width -= R.Size.ContentSpaceHuge*2
+ if !UIDevice.isPhoneDuoCompactWidth {
+ var width = 0.0
+ if UIDevice.isPad {
+ width = 375
+ } else {
+ width = R.Size.SheetWindowMinSize.width
+ if proHUDLayoutStyle() == .portrait {
+ width -= R.Size.ContentSpaceHuge*2
+ }
}
+ make.width.equalTo(width)
}
- make.width.equalTo(width)
make.edges.equalToSuperview()
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Controllers/ViewControllers/ControllerMappingViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Controllers/ViewControllers/ControllerMappingViewController.swift
index 6bc59f34..ce486538 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Controllers/ViewControllers/ControllerMappingViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Controllers/ViewControllers/ControllerMappingViewController.swift
@@ -78,4 +78,11 @@ class ControllerMappingViewController: BaseViewController {
PlayViewController.refreshExternalInputSink()
AppDelegate.orientation = R.Config.DefaultOrientation
}
+
+ override var prefersStatusBarHidden: Bool {
+ if UIDevice.isPhoneDuo {
+ return true
+ }
+ return super.prefersStatusBarHidden
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllerMappingView.swift b/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllerMappingView.swift
index 65800903..4f734bf2 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllerMappingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllerMappingView.swift
@@ -263,6 +263,14 @@ class ControllerMappingView: BaseView {
make.width.equalTo(frames.mainGameViewFrame.width - R.Size.ContentSpaceMedium*2)
make.centerX.equalToSuperview()
}
+
+ if UIDevice.isPhoneDuoOuter {
+ navigationView.snp.remakeConstraints { make in
+ make.top.equalTo(safeAreaLayoutGuide)
+ make.leading.trailing.equalTo(tipsView)
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllersSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllersSettingView.swift
index e941fc6f..dde69f44 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllersSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Controllers/Views/ControllersSettingView.swift
@@ -211,8 +211,8 @@ class ControllersSettingView: BaseView {
sections: getSections(),
backgroundColor: .clear,
pageInsets: .insets(top: asSideMenu ? R.Size.ContentInsetTop(window: hostingWindow) : R.Size.SheetGrabberTopInset),
- enableSafeAreaLeftInsets: true,
- enableSafeAreaRightInsets: true)
+ enableSafeAreaLeftInsets: UIDevice.isPhoneDuo ? false : true,
+ enableSafeAreaRightInsets: UIDevice.isPhoneDuo ? false : true)
}
private func getSections() -> [ASListPage.Section] {
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameCoverScrapingView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameCoverScrapingView.swift
index 9f4f755d..db27c146 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameCoverScrapingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameCoverScrapingView.swift
@@ -87,14 +87,12 @@ class GameCoverScrapingView: BaseView {
)
navigation.enableClose = showClose
- let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0
-
return ASListPage(
navigation: navigation,
sections: getSections(),
bottom: getBottom(),
backgroundColor: .clear,
- listInsets: .insets(bottom: listInsetBottom),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop(window: hostingWindow))
)
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoCoverView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoCoverView.swift
index 462c3794..fda4dc61 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoCoverView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoCoverView.swift
@@ -110,7 +110,7 @@ class GameInfoCoverView: BaseView {
}
extension GameInfoCoverView: ViewTransition {
- func viewWillTransition() {
+ func viewAlongsideTransition() {
if UIDevice.isPhone {
updateCoverContainerViewConstraints()
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoNavigationView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoNavigationView.swift
index e66f8d1c..61b1da1c 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoNavigationView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoNavigationView.swift
@@ -38,7 +38,11 @@ class GameInfoNavigationView: BaseView {
addSubviews([closeButton, gameCover, toolsView])
closeButton.snp.makeConstraints { make in
- make.trailing.equalTo(safeAreaLayoutGuide).inset(R.Size.ContentSpaceLarge)
+ if UIDevice.isPhoneDuo {
+ make.trailing.equalToSuperview().inset(R.Size.ContentSpaceLarge)
+ } else {
+ make.trailing.equalTo(safeAreaLayoutGuide).inset(R.Size.ContentSpaceLarge)
+ }
make.centerY.equalToSuperview()
}
@@ -54,6 +58,25 @@ class GameInfoNavigationView: BaseView {
}
}
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo {
+ toolsView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width)
+ }
+ } else {
+ make.leading.equalTo(safeAreaLayoutGuide).offset(R.Size.ContentSpaceLarge)
+ }
+ make.centerY.equalToSuperview()
+ make.height.equalTo(R.Size.ButtonSmall)
+ }
+ }
+ }
+
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift
index 3f5bdc8a..e524f7df 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift
@@ -70,7 +70,7 @@ class GameInfoView: BaseView {
}
view.didScroll = { [weak self] scrollView in
guard let self else { return }
- guard self.prefferedLayoutStyle == .portrait else { return }
+ guard self.preferredLayoutStyle == .portrait else { return }
let contentOffsetY = scrollView.contentOffset.y + scrollView.adjustedContentInset.top
//Make the gameInfoDetailView pin to the top of the gameOptionView content.
if contentOffsetY >= scrollView.adjustedContentInset.top - self.gameInfoDetailHeight + R.Size.ContentSpaceSmall {
@@ -110,8 +110,7 @@ class GameInfoView: BaseView {
private let gameInfoDetailMaxY = 292.0
private let gameInfoDetailHeight = 162.0
private var gameOptionViewInsets: UIEdgeInsets {
- .insets(top: proHUDLayoutStyle() == .landscape ? 0 : R.Size.GameInfoGameOptionsTopInsets,
- bottom: R.Size.ContentSpaceLarge)
+ .insets(top: proHUDLayoutStyle() == .landscape ? 0 : R.Size.GameInfoGameOptionsTopInsets)
}
private var gameMetadataChange: Any? = nil
@@ -233,6 +232,9 @@ class GameInfoView: BaseView {
super.layoutSubviews()
guard width > 0 else { return }
guard let window = hostingWindow else { return }
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
if window.size.IsRelativelyWideRectangle {
gameInfoDetailView.frame = CGRect(origin: CGPoint(x: 0, y: height - gameInfoDetailHeight),
size: CGSize(width: width/2, height: gameInfoDetailHeight))
@@ -250,7 +252,12 @@ class GameInfoView: BaseView {
}
gameOptionView.snp.remakeConstraints { make in
- make.bottom.top.trailing.equalToSuperview()
+ if UIDevice.isPhone && !UIDevice.isPhoneDuo {
+ make.bottom.top.trailing.equalToSuperview()
+ make.trailing.equalTo(self.safeAreaLayoutGuide)
+ } else {
+ make.bottom.top.trailing.equalToSuperview()
+ }
make.leading.equalTo(gameCoverView.snp.trailing)
}
@@ -266,9 +273,20 @@ class GameInfoView: BaseView {
}
}
-
+ updateNavigationViewConstraints()
+ }
+
+ private func updateNavigationViewConstraints() {
navigationView.snp.remakeConstraints { make in
- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ } else {
+ make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
+ }
make.leading.trailing.equalToSuperview()
make.height.equalTo(R.Size.NavigationHeight)
}
@@ -293,7 +311,7 @@ extension GameInfoView: ShowableView {
}
extension GameInfoView: ViewTransition {
- func viewWillTransition() {
+ func viewAlongsideTransition() {
gameOptionView.listPageView.listInsets = gameOptionViewInsets
gameOptionView.listPageView.collectionView.scrollToTop(animated: false)
updateViewsConstraints()
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift
index 2a5de429..75467490 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/J2MESettingView.swift
@@ -94,6 +94,11 @@ class J2MEScreenSizeCell: UICollectionViewCell {
guard let self else { return }
self.updateSize(width: self.widthTextField.text?.int ?? self.currentSize.width, height: self.heightTextField.text?.int ?? self.currentSize.height)
}
+ textField.isFocusable = true
+ textField.onFocusConfirm = { [weak self] in
+ self?.widthTextField.becomeFirstResponder()
+ return true
+ }
return textField
}()
@@ -127,6 +132,11 @@ class J2MEScreenSizeCell: UICollectionViewCell {
guard let self else { return }
self.updateSize(width: self.widthTextField.text?.int ?? self.currentSize.width, height: self.heightTextField.text?.int ?? self.currentSize.height)
}
+ textField.isFocusable = true
+ textField.onFocusConfirm = { [weak self] in
+ self?.heightTextField.becomeFirstResponder()
+ return true
+ }
return textField
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/SteamGridDBContentsView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/SteamGridDBContentsView.swift
index 6ac84455..fc1ad756 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/SteamGridDBContentsView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/SteamGridDBContentsView.swift
@@ -248,7 +248,6 @@ class SteamGridDBContentsView: BaseView {
sections: contentSections(),
blankSlate: .init(detail: R.string.localizable.noGameCoverResult()),
backgroundColor: .clear,
- listInsets: .insets(bottom: R.Size.ContentInsetBottom(window: hostingWindow)),
pageInsets: .insets(top: R.Size.SheetGrabberTopInset)
)
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Models/MappingOption.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Models/MappingOption.swift
index 2492b9df..0c93658e 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Models/MappingOption.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Models/MappingOption.swift
@@ -153,6 +153,9 @@ enum MappingOption: String, CaseIterable {
case .rewind:
return GameOption.rewind.icon
+ case .slowMotion:
+ return GameOption.slowMotion.icon
+
default:
return .symbol(.questionmark)
}
@@ -179,6 +182,8 @@ enum MappingOption: String, CaseIterable {
return "Right Difficulty"
case .rewind:
return GameOption.rewind.title
+ case .slowMotion:
+ return GameOption.slowMotion.title
default:
return ""
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift
index e82a6513..27ef947d 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift
@@ -27,7 +27,7 @@ class GamesViewController: BaseViewController {
view.scrollToTopView.addTapGesture { [weak self] gesture in
guard let self else { return }
- if UIDevice.isPhone && self.view.prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone && self.view.preferredLayoutStyle == .landscape {
self.gamesListView?.scrollToTop()
}
}
@@ -95,7 +95,7 @@ class GamesViewController: BaseViewController {
view.needsUpdateToolViewVisible = { [weak self] show in
guard let self = self,
UIDevice.isPhone,
- self.view.prefferedLayoutStyle == .portrait,
+ self.view.preferredLayoutStyle == .portrait,
self.gamesToolView.isHidden != !show else { return }
self.gamesListView?.snp.updateConstraints { make in
@@ -121,7 +121,7 @@ class GamesViewController: BaseViewController {
if empty {
self.gamesToolView.stopSearch()
}
- if UIDevice.isPhone && self.view.prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone && self.view.preferredLayoutStyle == .landscape {
self.gamesToolView.isHidden = true
} else {
self.gamesToolView.isHidden = empty
@@ -155,7 +155,7 @@ class GamesViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
- self.updateViews(isLandscape: view.prefferedLayoutStyle == .landscape)
+ self.updateViews(isLandscape: view.preferredLayoutStyle == .landscape)
//处理Launch Link
if let launchGameID = ApplicationSceneDelegate.launchGameID {
ApplicationSceneDelegate.launchGameID = nil
@@ -205,7 +205,7 @@ class GamesViewController: BaseViewController {
}
override func handleScreenPanGesture(edges: UIRectEdge, gesture: UIScreenEdgePanGestureRecognizer) {
- if view.prefferedLayoutStyle == .portrait {
+ if view.preferredLayoutStyle == .portrait {
if edges == .left {
showSideMenu(leftSide: true)
} else if edges == .right {
@@ -345,6 +345,7 @@ class GamesViewController: BaseViewController {
make.bottom.equalTo(portraitListView.snp.top).offset(5)
make.height.equalTo(10)
}
+ gamesSeperatorView.isHidden = false
if gameListLandscapeView != nil {
view.layoutIfNeeded()
}
@@ -372,12 +373,12 @@ class GamesViewController: BaseViewController {
}
func updateLandscapeBackgroundIfNeed() {
- guard view.prefferedLayoutStyle == .landscape else { return }
+ guard view.preferredLayoutStyle == .landscape else { return }
gameListLandscapeView?.updateFocusedGameInfo()
}
func scrollToLastGame() {
- if view.prefferedLayoutStyle == .landscape {
+ if view.preferredLayoutStyle == .landscape {
gameListLandscapeView?.scrollToLastGame()
} else {
gamesListView?.scrollToLastGame()
@@ -385,7 +386,7 @@ class GamesViewController: BaseViewController {
}
func scrollToFirstGame() {
- if view.prefferedLayoutStyle == .landscape {
+ if view.preferredLayoutStyle == .landscape {
gameListLandscapeView?.scrollToFirstGame()
} else {
gamesListView?.scrollToFirstGame()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift
index 7c87611e..9a99ece9 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift
@@ -196,7 +196,7 @@ class GameLandscapeCarouselCell: UICollectionViewCell {
cardView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
//封面整体上移 底部留给聚焦信息面板
- make.centerY.equalToSuperview().offset(-Self.infoPanelReserve/2)
+ make.centerY.equalToSuperview().offset(-Self.infoPanelReserve/2 - (UIDevice.isPhoneDuoOuter ? R.Size.ContentSpaceMedium : 0))
make.size.equalTo(100)
}
@@ -234,7 +234,11 @@ class GameLandscapeCarouselCell: UICollectionViewCell {
emptyContentStack.isHidden = true
coverView.isHidden = false
cardView.snp.updateConstraints { make in
- make.centerY.equalToSuperview().offset(-Self.infoPanelReserve/2)
+ var centerYOffset = -Self.infoPanelReserve/2 - (UIDevice.isPhoneDuoOuter ? R.Size.ContentSpaceMedium : 0)
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopMode {
+ centerYOffset -= R.Size.ContentSpaceMedium
+ }
+ make.centerY.equalToSuperview().offset(centerYOffset)
make.size.equalTo(cardSize.height)
}
coverView.setData(game: game, coverSize: cardSize, style: R.Style.GameCoverStyle)
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift
index 76c36d33..bd3ec20e 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift
@@ -15,6 +15,8 @@ import IceCream
///布局从上到下分为两个部分:navigation(筛选器/功能菜单/状态信息)、content(游戏轮播+聚焦信息)
class GameListLandscapeView: BaseView {
+ private let navigationView = UIView()
+
//MARK: - navigation区
///筛选器 两级筛选:厂商→GameType
private lazy var filterButton: LandscapeFilterView = {
@@ -30,6 +32,8 @@ class GameListLandscapeView: BaseView {
return view
}()
+ private let functionStack = UIStackView()
+
private lazy var historyButton: ASButtonView = {
let view = ASButtonView(.iconOnlyWithSmallSize(icon: .symbolImage(R.image.history_iconSymbols())).enableGlass(true))
view.didTapButton = { [weak self] in
@@ -126,7 +130,7 @@ class GameListLandscapeView: BaseView {
view.delegate = self
view.alwaysBounceVertical = true
view.isFocusable = true
- let bottom = UIDevice.isPhone ? R.Size.ContentSpaceLarge : R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge
+ let bottom = (UIDevice.isPhone && !UIDevice.isPhoneDuo) ? R.Size.ContentSpaceLarge : R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge
view.contentInset = .insets(bottom: bottom)
view.isHidden = LandscapeCarouselStyle.isCarouselEnabled
view.addLongPressGesture(handler: { [weak self] gesture in
@@ -138,6 +142,10 @@ class GameListLandscapeView: BaseView {
UIDevice.generateHaptic(style: .heavy)
self.showListGameEditSheet(game: game)
}).delegate = self
+ if UIDevice.isPhoneDuo {
+ view.contentInsetAdjustmentBehavior = .never
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -285,7 +293,21 @@ class GameListLandscapeView: BaseView {
override func layoutSubviews() {
super.layoutSubviews()
- guard window != nil, superview != nil else { return }
+ guard hostingWindow != nil, superview != nil else { return }
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ if UIDevice.isPhoneDuoOuter, UIDevice.currentOrientation == .landscapeRight {
+ functionStack.spacing = R.Size.ContentSpaceExtraSmall
+ functionStack.snp.updateConstraints { make in
+ make.leading.equalTo(filterButton.snp.trailing).offset(R.Size.ContentSpaceExtraExtraSmall)
+ }
+ } else {
+ functionStack.spacing = R.Size.ContentSpaceSmall
+ functionStack.snp.updateConstraints { make in
+ make.leading.equalTo(filterButton.snp.trailing).offset(R.Size.ContentSpaceLarge)
+ }
+ }
+ }
if bounds.size != lastLayoutSize, bounds.size != .zero {
lastLayoutSize = bounds.size
if isCarouselEnabled {
@@ -307,13 +329,8 @@ class GameListLandscapeView: BaseView {
backgroundColor = .clear
//navigation区
- let navigationView = UIView()
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.leading.trailing.equalToSuperview()
- make.height.equalTo(R.Size.NavigationHeight)
- make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
- }
+ updateNavigationViewConstraints()
navigationView.addSubview(filterButton)
filterButton.snp.makeConstraints { make in
@@ -322,7 +339,8 @@ class GameListLandscapeView: BaseView {
make.height.equalTo(R.Size.ButtonSmall)
}
- let functionStack = UIStackView(arrangedSubviews: [historyButton, themeButton, importButton, settingsButton])
+
+ functionStack.addArrangedSubviews([historyButton, themeButton, importButton, settingsButton])
functionStack.axis = .horizontal
functionStack.spacing = R.Size.ContentSpaceSmall
navigationView.addSubview(functionStack)
@@ -708,6 +726,29 @@ class GameListLandscapeView: BaseView {
}
}
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(safeAreaLayoutGuide)
+ }
+ make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
+
//MARK: - Focused info and background
private enum AppliedCarouselBackground: Equatable {
@@ -1345,7 +1386,9 @@ class GameListLandscapeView: BaseView {
/// Match GameListView cover math; one horizontally scrolling row per platform.
private func createListLayout() -> UICollectionViewLayout {
- UICollectionViewCompositionalLayout { [weak self] sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ return UICollectionViewCompositionalLayout(sectionProvider: { [weak self] sectionIndex, env in
guard let self, self.displaySections.indices.contains(sectionIndex) else { return nil }
let gameType = self.displaySections[sectionIndex].gameType
let itemSpacing = R.Size.ContentSpaceMedium - R.Size.GamesListSelectionEdge * 2
@@ -1357,7 +1400,7 @@ class GameListLandscapeView: BaseView {
if UIDevice.isPad {
column = UIDevice.isPadMini ? 5 : 6
} else {
- column = UIDevice.isSmallScreenPhone ? 4 : 5
+ column = UIDevice.isStandardPhone ? 4 : 5
}
let totleSpacing = (R.Size.ContentSpaceMedium - R.Size.GamesListSelectionEdge) * 2 + itemSpacing * (column - 1)
@@ -1389,7 +1432,7 @@ class GameListLandscapeView: BaseView {
alignment: .top)
section.boundarySupplementaryItems = [headerItem]
return section
- }
+ }, configuration: configuration)
}
/// Avoid `=== listView` / `=== carouselView` in data source — those lazy vars re-enter during init.
@@ -1659,9 +1702,12 @@ class GameListLandscapeView: BaseView {
extension GameListLandscapeView: UICollectionViewDataSource {
///轮播cell的封面尺寸 底部为聚焦信息面板预留空间
private var carouselCoverHeight: CGFloat {
- if UIDevice.isPhone {
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopMode {
+ return 152
+ }
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen {
let carouselHeight = carouselView.bounds.height > 0 ? carouselView.bounds.height : 300
- return max(carouselHeight - GameLandscapeCarouselCell.infoPanelReserve - R.Size.ContentSpaceLarge, 100)
+ return max(carouselHeight - GameLandscapeCarouselCell.infoPanelReserve - R.Size.ContentSpaceLarge, 100) * (UIDevice.isPhoneDuoOuter ? 0.8 : 1.0)
} else {
return R.Size.ApplicationWindowSize.height/3
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
index 8bfe4852..38a173b8 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
@@ -218,6 +218,13 @@ class GameListView: BaseView {
}
}
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo {
+ collectionView.reloadData()
+ }
+ }
+
private var gamesUpdateToken: NotificationToken? = nil
private var games: Results<Game> = {
//查询数据库
@@ -584,7 +591,7 @@ class GameListView: BaseView {
//group布局
let group: NSCollectionLayoutGroup
var column = R.Style.GamesPerRow
- if UIDevice.isPad {
+ if UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen {
if let w = self.hostingWindow {
column = min(max((w.width/120).rounded(numberOfDecimalPlaces: -1, rule: .toNearestOrEven), 2), 5)
} else {
@@ -724,7 +731,12 @@ class GameListView: BaseView {
}
indexView.reloadData()
indexView.deselectCurrentItem()
- indexView.selectItem(at: 0)
+ var willSelectedSection = indexView.selectedSection
+ while willSelectedSection != 0,
+ willSelectedSection > collectionView.numberOfSections {
+ willSelectedSection -= 1
+ }
+ indexView.selectItem(at: willSelectedSection)
indexView.isHidden = R.Style.GamesHideScrollIndicator
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameMetadataView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameMetadataView.swift
index b9add8d5..7dc58465 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameMetadataView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameMetadataView.swift
@@ -5,6 +5,7 @@
// Created by Daiuno on 2026/8/12.
// Copyright © 2026 Manic EMU. All rights reserved.
//
+import ProHUD
class GameMetadataView: BaseView {
private static let overviewMaxHeight: CGFloat = 90
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift
index bd9538cd..12c07f1b 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift
@@ -80,11 +80,7 @@ class GameplayManualsView: BaseView {
backgroundColor = R.Color.BackgroundPrimary
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
- make.leading.trailing.equalTo(self.safeAreaLayoutGuide)
- make.height.equalTo(R.Size.NavigationHeight)
- }
+ updateNavigationViewConstraints()
let lastScaleFactor = game.getExtraDouble(key: ExtraKey.manualScaleFactor.rawValue)
@@ -132,6 +128,36 @@ class GameplayManualsView: BaseView {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(safeAreaLayoutGuide)
+ }
+ make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
}
extension GameplayManualsView: ShowableView {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
index 4d9749d1..acab9a38 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
@@ -123,7 +123,7 @@ class GamesCollectionReusableView: UICollectionReusableView {
gamesCountButton.setTitleString("\(gamesCount) \(R.string.localizable.tabbarTitleGames())")
gamesCountButton.isUserInteractionEnabled = allowsFold
- if !allowsFold || (UIDevice.isPhone && self.prefferedLayoutStyle == .landscape) {
+ if !allowsFold || (UIDevice.isPhone && self.preferredLayoutStyle == .landscape) {
gamesCountButton.setIcon(nil)
} else {
gamesCountButton.setIcon(.symbol(isFolded ? .chevronDown : .chevronUp, colors: [R.Color.LabelSecondary]))
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/LandscapeFilterView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/LandscapeFilterView.swift
index a9063898..e0bc960c 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/LandscapeFilterView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/LandscapeFilterView.swift
@@ -23,8 +23,8 @@ class LandscapeFilterView: UIVisualEffectView {
let iconView = ASIconView(.symbolImage(R.image.app_title()))
view.addSubview(iconView)
iconView.snp.makeConstraints { make in
- make.leading.equalTo(logoView.snp.trailing).offset(R.Size.ContentSpaceSmall)
- make.trailing.equalToSuperview().inset(R.Size.ContentSpaceSmall)
+ make.leading.equalTo(logoView.snp.trailing).offset(R.Size.ContentSpaceExtraExtraSmall)
+ make.trailing.equalToSuperview().inset(R.Size.ContentSpaceExtraExtraSmall)
make.height.equalTo(10)
make.centerY.equalToSuperview()
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/SectionIndexView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/SectionIndexView.swift
index 1344f6a4..e09c89f8 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/SectionIndexView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/SectionIndexView.swift
@@ -80,6 +80,7 @@ class SectionIndexView: BaseView {
@objc public var itemIndicatorHorizontalOffset: CGFloat = 60
@objc public private(set) var selectedItem: SectionIndexViewItem?
+ var selectedSection: Int = 0
@objc public private(set) var isTouching = false
@objc public var hideSearch = false
@@ -134,6 +135,7 @@ class SectionIndexView: BaseView {
guard let item = item(at: section) else { return }
item.isSelected = true
selectedItem = item
+ selectedSection = section
}
@objc public func deselectCurrentItem() {
@@ -230,6 +232,7 @@ class SectionIndexView: BaseView {
let section = rawSection - 1
guard let item = item(at: section), !(self.selectedItem?.isEqual(item) ?? false) else { return }
delegate?.sectionIndexView(self, didSelect: section)
+ selectedSection = section
NotificationCenter.default.post(name: SectionIndexView.touchesEndedNotification, object: self, userInfo: ["section": section])
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/History/Views/PlayHistoryView.swift b/ManicEmu/ManicEmu/Sources/Business/History/Views/PlayHistoryView.swift
index d778c21d..5d15d92a 100644
--- a/ManicEmu/ManicEmu/Sources/Business/History/Views/PlayHistoryView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/History/Views/PlayHistoryView.swift
@@ -52,6 +52,9 @@ class PlayHistoryView: BaseView {
}
}
})
+ if UIDevice.isPhoneDuoSplitView && !UIDevice.isPhoneDuoSplitViewRight {
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -69,7 +72,11 @@ class PlayHistoryView: BaseView {
addSubview(navigationView)
navigationView.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide).offset(R.Size.SheetGrabberTopInset)
- make.leading.trailing.equalTo(self.safeAreaLayoutGuide)
+ if UIDevice.isPhoneDuoSplitView && !UIDevice.isPhoneDuoSplitViewRight {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(self.safeAreaLayoutGuide)
+ }
make.height.equalTo(R.Size.NavigationHeight)
}
@@ -91,7 +98,9 @@ class PlayHistoryView: BaseView {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = (UIDevice.isPhoneDuoSplitView && !UIDevice.isPhoneDuoSplitViewRight) ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { sectionIndex, env in
let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1)))
//group布局
@@ -108,7 +117,7 @@ class PlayHistoryView: BaseView {
trailing: 0)
return section
- }
+ }, configuration: configuration)
return layout
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift
index 40f38c2e..732bffb0 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift
@@ -52,7 +52,7 @@ class HomeViewController: BaseViewController {
}()
lazy var homeTabBar: HomeTabBar = {
- let view = HomeTabBar()
+ let view = HomeTabBar(orientation: UIDevice.isPhoneDuoCompactWidth ? .portrait : .landscape)
view.selectionChange = { [weak self] selection in
guard let self else { return }
var selection = selection
@@ -67,13 +67,13 @@ class HomeViewController: BaseViewController {
switch selection {
case .games:
Log.debug("切换到游戏")
- if UIDevice.isPhone, self.view.prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, self.view.preferredLayoutStyle == .landscape {
self.gamesViewController.view.masksToBounds = false
}
case .imports:
Log.debug("切换到导入")
- if UIDevice.isPhone, self.view.prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, self.view.preferredLayoutStyle == .landscape {
self.gamesViewController.view.masksToBounds = true
}
@@ -83,7 +83,7 @@ class HomeViewController: BaseViewController {
self.updateLandscapeBackgroundVisible()
self.activateCurrentTabFocusContext()
}
- view.isHidden = UIDevice.isPhone && self.view.prefferedLayoutStyle == .landscape
+ view.isHidden = UIDevice.isPhone && !UIDevice.isPhoneDuo && self.view.preferredLayoutStyle == .landscape
return view
}()
@@ -93,7 +93,7 @@ class HomeViewController: BaseViewController {
view.maximumBlurRadius = 1
view.dimmingAlpha = .interfaceStyle(lightModeAlpha: 0.05, darkModeAlpha: 0.05)
view.dimmingTintColor = R.Color.BackgroundPrimary
- view.isHidden = self.view.prefferedLayoutStyle == .landscape
+ view.isHidden = self.view.preferredLayoutStyle == .landscape || UIDevice.isPhoneDuoCompactWidth
return view
}()
@@ -112,6 +112,9 @@ class HomeViewController: BaseViewController {
/// D-pad ran off a tab edge; the following selection change should restore focus in the new tab.
private var shouldHandoffTabFocus = false
+ /// Last compact-width tab bar frame. Avoids rebuilding constraints every layout pass.
+ private var appliedPhoneDuoTabBarFrame: CGRect?
+
private var currentChildViewController: BaseViewController {
switch homeTabBar.currentSelection {
case .games:
@@ -124,10 +127,10 @@ class HomeViewController: BaseViewController {
}
deinit {
- if let homeSelectionChangeNotification = homeSelectionChangeNotification {
+ if let homeSelectionChangeNotification {
NotificationCenter.default.removeObserver(homeSelectionChangeNotification)
}
- if let landscapeBackgroundNotification = landscapeBackgroundNotification {
+ if let landscapeBackgroundNotification {
NotificationCenter.default.removeObserver(landscapeBackgroundNotification)
}
}
@@ -183,6 +186,22 @@ class HomeViewController: BaseViewController {
landscapeBackgroundView.setHomeVisible(false)
}
+ override func viewDidLayoutSubviews() {
+ super.viewDidLayoutSubviews()
+ if UIDevice.isPhoneDuo {
+ refreshPhoneDuoTabBarPlacementIfNeeded()
+ }
+ }
+
+ override func viewSafeAreaInsetsDidChange() {
+ super.viewSafeAreaInsetsDidChange()
+ appliedPhoneDuoTabBarFrame = nil
+ if UIDevice.isPhoneDuo {
+ refreshPhoneDuoTabBarPlacementIfNeeded()
+ homeTabBarBlurView.isHidden = self.view.preferredLayoutStyle == .landscape || UIDevice.isPhoneDuoCompactWidth
+ }
+ }
+
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
self.resignFirstResponder()
@@ -198,12 +217,12 @@ class HomeViewController: BaseViewController {
if !UIDevice.isIOS15 {
NotificationCenter.default.post(name: R.NotificationName.ViewWillTransition, object: nil)
}
- homeTabBarBlurView.isHidden = view.prefferedLayoutStyle == .landscape
if currentChildViewController is GamesViewController {
updateGamesFocusCommands(focusContext: currentChildViewController.focusContext)
}
coordinator.animate(alongsideTransition: { [weak self] _ in
guard let self else { return }
+ self.homeTabBarBlurView.isHidden = self.view.preferredLayoutStyle == .landscape || UIDevice.isPhoneDuoCompactWidth
if UIDevice.isPhone {
if let pageBackgroundMaskView = self.pageViewManager.contentView.subviews.first(where: { $0.isKind(of: PageBackgroundMaskView.self) }) {
pageBackgroundMaskView.snp.updateConstraints { make in
@@ -216,7 +235,10 @@ class HomeViewController: BaseViewController {
NotificationCenter.default.post(name: R.NotificationName.ViewWillTransition, object: nil)
}
NotificationCenter.default.post(name: R.NotificationName.ViewAlongsideTransition, object: nil)
- self.homeTabBar.isHidden = UIDevice.isPhone && self.view.prefferedLayoutStyle == .landscape
+ self.homeTabBar.isHidden = UIDevice.isPhone && !UIDevice.isPhoneDuo && self.view.preferredLayoutStyle == .landscape
+ if UIDevice.isPhoneDuo {
+ self.updateHomeTabBarConstraints()
+ }
}, completion: { _ in
NotificationCenter.default.post(name: R.NotificationName.ViewDidTransition, object: nil)
})
@@ -255,20 +277,12 @@ class HomeViewController: BaseViewController {
make.top.equalTo(homeTabBar).offset(-R.Size.ContentSpaceLarge)
}
- homeTabBar.snp.makeConstraints { make in
- make.size.equalTo(R.Size.HomeTabBarSize)
- make.centerX.equalTo(self.view)
- if self.view.safeAreaInsets.bottom == 0 {
- make.bottom.equalToSuperview().inset(R.Size.ContentInsetBottom(window: hostingWindow))
- } else {
- make.bottom.equalTo(view.safeAreaLayoutGuide)
- }
- }
+ updateHomeTabBarConstraints()
}
///根据横竖屏更新动态背景显隐 横屏时透明化分页容器与子页面使背景透出
private func updateLandscapeBackgroundVisible() {
- let landscape = view.prefferedLayoutStyle == .landscape
+ let landscape = view.preferredLayoutStyle == .landscape
if landscape {
if UIDevice.isPhone {
if landscapeBackgroundView.isHidden {
@@ -317,6 +331,63 @@ class HomeViewController: BaseViewController {
}
}
+ private func updateHomeTabBarConstraints() {
+ if !UIDevice.isPhoneDuoCompactWidth {
+ appliedPhoneDuoTabBarFrame = nil
+ }
+ let duoFrame = UIDevice.isPhoneDuoCompactWidth ? (appliedPhoneDuoTabBarFrame ?? phoneDuoTabBarFrame()) : nil
+ homeTabBar.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.size.equalTo(R.Size.HomeTabBarSizeVertical)
+ if let duoFrame {
+ make.leading.equalToSuperview().offset(duoFrame.minX)
+ make.top.equalToSuperview().offset(duoFrame.minY)
+ } else {
+ make.centerY.equalToSuperview()
+ make.trailing.equalToSuperview()
+ }
+ } else {
+ make.size.equalTo(R.Size.HomeTabBarSize)
+ make.centerX.equalTo(self.view)
+ if self.view.safeAreaInsets.bottom == 0 && !UIDevice.isPhoneDuo {
+ make.bottom.equalToSuperview().inset(R.Size.ContentInsetBottom(window: hostingWindow))
+ } else if UIDevice.isPhoneDuo {
+ make.bottom.equalToSuperview().inset(R.Size.ContentSpaceLarge)
+ } else {
+ make.bottom.equalTo(view.safeAreaLayoutGuide)
+ }
+ }
+ }
+ homeTabBar.orientation = UIDevice.isPhoneDuoCompactWidth ? .portrait : .landscape
+ }
+
+ /// Keeps the vertical tab bar centered in the side strip, shifting down only when that frame hits an occlusion.
+ private func refreshPhoneDuoTabBarPlacementIfNeeded() {
+ guard UIDevice.isPhoneDuoCompactWidth || UIDevice.isPhoneDuoSplitView, view.bounds.width > 1, view.bounds.height > 1 else { return }
+ let frame = phoneDuoTabBarFrame()
+ func framesDiffer(_ lhs: CGRect?, _ rhs: CGRect?) -> Bool {
+ switch (lhs, rhs) {
+ case (nil, nil):
+ return false
+ case let (lhs?, rhs?):
+ return abs(lhs.minX - rhs.minX) > 0.5
+ || abs(lhs.minY - rhs.minY) > 0.5
+ || abs(lhs.width - rhs.width) > 0.5
+ || abs(lhs.height - rhs.height) > 0.5
+ default:
+ return true
+ }
+ }
+ guard framesDiffer(appliedPhoneDuoTabBarFrame, frame) else { return }
+ appliedPhoneDuoTabBarFrame = frame
+ updateHomeTabBarConstraints()
+ }
+
+ /// `nil` until the side strip can be measured. Centering with no occlusion is the strip helper's own default.
+ private func phoneDuoTabBarFrame() -> CGRect? {
+ DuoLayoutKit.sideStrip(in: view)?.frame(fitting: R.Size.HomeTabBarSizeVertical)
+ }
+
// MARK: - Tab FocusKit
/// Make the selected child VC the focus root so search stays inside that tab.
@@ -347,7 +418,7 @@ class HomeViewController: BaseViewController {
])
if self.homeTabBar.currentSelection == .games {
- var commands = [FocusCommand(key: FocusKey("l1"), title: R.string.localizable.scrollToFirstGame(), action: { [weak self] in
+ let commands = [FocusCommand(key: FocusKey("l1"), title: R.string.localizable.scrollToFirstGame(), action: { [weak self] in
self?.gamesViewController.scrollToFirstGame()
}),
FocusCommand(key: FocusKey("r1"), title: R.string.localizable.scrollToLastGame(), action: { [weak self] in
@@ -387,7 +458,7 @@ class HomeViewController: BaseViewController {
private func updateGamesFocusCommands(focusContext: FocusContext) {
guard currentChildViewController is GamesViewController else { return }
- if view.prefferedLayoutStyle == .landscape {
+ if view.preferredLayoutStyle == .landscape {
focusContext.addCommand(FocusCommand(key: FocusKey("l3"), title: R.string.localizable.filterTitle(), action: {
NotificationCenter.default.post(name: R.NotificationName.ShowFilterForLandscapeMode, object: nil)
}))
diff --git a/ManicEmu/ManicEmu/Sources/Business/Home/Views/HomeTabBar.swift b/ManicEmu/ManicEmu/Sources/Business/Home/Views/HomeTabBar.swift
index e106684d..bd145d59 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Home/Views/HomeTabBar.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Home/Views/HomeTabBar.swift
@@ -11,6 +11,11 @@ import UIKit
///主页面的tabbar
class HomeTabBar: BaseView {
+ enum Orientation {
+ case landscape
+ case portrait
+ }
+
/// 实现一个视图 拥有点击和非点击状态
private class BarView: BaseView {
var isSelected: Bool {
@@ -31,6 +36,7 @@ class HomeTabBar: BaseView {
private let titleLabel = ASLabelView()
private let normalSymbol: ASIcon
private let selectedSymbol: ASIcon
+ private var orientation: Orientation = .landscape
init(frame: CGRect, isSelected: Bool = false, normalSymbol: ASIcon, selectedSymbol: ASIcon, title: String) {
self.isSelected = isSelected
@@ -64,8 +70,30 @@ class HomeTabBar: BaseView {
fatalError("init(coder:) has not been implemented")
}
+ /// Portrait hides the title. Landscape keeps the selected title visible.
+ func apply(orientation: Orientation) {
+ self.orientation = orientation
+ titleLabel.isHidden = orientation == .portrait
+ if orientation == .landscape, isSelected {
+ UIView.normalAnimate { [weak self] in
+ self?.titleLabel.alpha = 1
+ }
+ } else {
+ titleLabel.alpha = 0
+ }
+ titleLabel.snp.remakeConstraints { make in
+ if orientation == .portrait {
+ make.center.equalToSuperview()
+ make.size.equalTo(CGSize.zero)
+ } else {
+ make.trailing.centerY.equalToSuperview()
+ }
+ }
+ symbolView.snp.remakeConstraints { makeSymbolViewConstraints(make: $0, isSelected: isSelected) }
+ }
+
private func updateViews(isSelected: Bool) {
- if isSelected {
+ if orientation == .landscape, isSelected {
UIView.normalAnimate { [weak self] in
self?.titleLabel.alpha = 1
}
@@ -81,8 +109,12 @@ class HomeTabBar: BaseView {
}
private func makeSymbolViewConstraints(make: ConstraintMaker, isSelected: Bool) {
- make.leading.centerY.equalToSuperview()
make.size.equalTo(R.Size.IconSizeMedium)
+ if orientation == .portrait {
+ make.edges.equalToSuperview()
+ return
+ }
+ make.leading.centerY.equalToSuperview()
if isSelected {
make.trailing.equalTo(titleLabel.snp.leading).offset(-R.Size.ContentSpaceTiny)
} else {
@@ -202,8 +234,20 @@ class HomeTabBar: BaseView {
}
}
- override init(frame: CGRect) {
- super.init(frame: frame)
+ /// Rebuilt from the current selection, so assigning the same or opposite value stays consistent.
+ var orientation: Orientation {
+ didSet {
+ guard oldValue != orientation else { return }
+ applyOrientation()
+ }
+ }
+
+ /// False after a portrait rebuild, so the next landscape pass installs fresh constraints.
+ private var usesLandscapeConstraints = false
+
+ init(orientation: Orientation = .landscape) {
+ self.orientation = orientation
+ super.init(frame: .zero)
self.backgroundColor = .clear
self.layer.cornerRadius = R.Size.HomeTabBarSize.height/2
if #available(iOS 26.0, tvOS 26.0, *) {
@@ -230,6 +274,11 @@ class HomeTabBar: BaseView {
}
addSubviews([indicatorView, gamesBar, importBar, settingsBar])
+ if orientation == .portrait {
+ gamesBar.apply(orientation: .portrait)
+ importBar.apply(orientation: .portrait)
+ settingsBar.apply(orientation: .portrait)
+ }
updateViewsConstraints(isInit: true)
gamesBar.addTapGesture { [weak self] gesture in
self?.currentSelection = .games
@@ -273,7 +322,61 @@ class HomeTabBar: BaseView {
super.layoutSubviews()
}
+ private func applyOrientation() {
+ gamesBar.apply(orientation: orientation)
+ importBar.apply(orientation: orientation)
+ settingsBar.apply(orientation: orientation)
+ updateViewsConstraints()
+ UIView.springAnimate { [weak self] in
+ self?.layoutIfNeeded()
+ }
+ }
+
private func updateViewsConstraints(isInit: Bool = false) {
+ if orientation == .portrait {
+ usesLandscapeConstraints = false
+ updatePortraitConstraints()
+ return
+ }
+ if isInit || !usesLandscapeConstraints {
+ installLandscapeConstraints()
+ usesLandscapeConstraints = true
+ // Initial install matches the games-selected spacing. Re-apply when another tab is selected.
+ if !isInit {
+ updateLandscapeConstraints()
+ }
+ return
+ }
+ updateLandscapeConstraints()
+ }
+
+ private func updatePortraitConstraints() {
+ let bars = [gamesBar, importBar, settingsBar]
+ let spacing = R.Size.ContentSpaceSmall
+ for (index, bar) in bars.enumerated() {
+ bar.snp.remakeConstraints { make in
+ make.leading.equalToSuperview().offset(spacing)
+ make.trailing.equalToSuperview().offset(-spacing)
+ if index == 0 {
+ make.top.equalToSuperview().offset(spacing)
+ } else {
+ make.top.equalTo(bars[index - 1].snp.bottom).offset(spacing)
+ make.height.equalTo(bars[0])
+ }
+ if index == bars.count - 1 {
+ make.bottom.equalToSuperview().offset(-spacing)
+ }
+ }
+ }
+ indicatorView.layerCornerRadius = R.Size.ItemHeightTiny / 2
+ indicatorView.snp.remakeConstraints { make in
+ guard let selected = bars.first(where: \.isSelected) else { return }
+ make.center.equalTo(selected)
+ make.width.height.equalTo(R.Size.ItemHeightTiny)
+ }
+ }
+
+ private func installLandscapeConstraints() {
let contentWidth = R.Size.HomeTabBarSize.width - 3*R.Size.ContentSpaceSmall
let selectedBarConstraintsWidth = contentWidth * 1/2
let unselectedBarConstraintsWidth = contentWidth * 1/4
@@ -282,36 +385,44 @@ class HomeTabBar: BaseView {
make.width.equalTo(bar.isSelected ? selectedBarConstraintsWidth : unselectedBarConstraintsWidth)
}
- if isInit {
- let temp = [gamesBar, importBar, settingsBar]
- for (index, view) in temp.enumerated() {
- view.snp.makeConstraints { make in
- if index == 0 {
- make.leading.equalToSuperview().offset(R.Size.ContentSpaceSmall)
- } else {
- make.leading.equalTo(temp[index-1].snp.trailing).offset(index == 1 ? R.Size.ContentSpaceSmall*1.5 : 0)
- }
- make.top.bottom.equalToSuperview()
- if index == temp.count - 1 {
- make.trailing.equalToSuperview().offset(-R.Size.ContentSpaceSmall*0.5)
- } else {
- makeWidthConstraints(make, view)
- }
+ let temp = [gamesBar, importBar, settingsBar]
+ for (index, view) in temp.enumerated() {
+ view.snp.remakeConstraints { make in
+ if index == 0 {
+ make.leading.equalToSuperview().offset(R.Size.ContentSpaceSmall)
+ } else {
+ make.leading.equalTo(temp[index-1].snp.trailing).offset(index == 1 ? R.Size.ContentSpaceSmall*1.5 : 0)
}
- }
-
- indicatorView.snp.makeConstraints { make in
- make.centerY.equalToSuperview()
- make.height.equalTo(R.Size.ItemHeightTiny)
- if let view = [gamesBar, importBar, settingsBar].filter({ $0.isSelected }).first {
- make.centerX.equalTo(view)
- make.width.equalTo(view)
+ make.top.bottom.equalToSuperview()
+ if index == temp.count - 1 {
+ make.trailing.equalToSuperview().offset(-R.Size.ContentSpaceSmall*0.5)
+ } else {
+ makeWidthConstraints(make, view)
}
-
}
-
- } else {
- if gamesBar.isSelected {
+ }
+
+ indicatorView.layerCornerRadius = R.Size.ItemHeightTiny / 2
+ indicatorView.snp.remakeConstraints { make in
+ make.centerY.equalToSuperview()
+ make.height.equalTo(R.Size.ItemHeightTiny)
+ if let view = [gamesBar, importBar, settingsBar].filter({ $0.isSelected }).first {
+ make.centerX.equalTo(view)
+ make.width.equalTo(view)
+ }
+ }
+ }
+
+ private func updateLandscapeConstraints() {
+ let contentWidth = R.Size.HomeTabBarSize.width - 3*R.Size.ContentSpaceSmall
+ let selectedBarConstraintsWidth = contentWidth * 1/2
+ let unselectedBarConstraintsWidth = contentWidth * 1/4
+
+ func makeWidthConstraints(_ make: ConstraintMaker, _ bar: BarView) {
+ make.width.equalTo(bar.isSelected ? selectedBarConstraintsWidth : unselectedBarConstraintsWidth)
+ }
+
+ if gamesBar.isSelected {
gamesBar.snp.updateConstraints { make in
make.leading.equalToSuperview().offset(R.Size.ContentSpaceSmall)
}
@@ -360,7 +471,6 @@ class HomeTabBar: BaseView {
}
}
- }
}
func nextSelection() {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/ViewControllers/ImportViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Import/ViewControllers/ImportViewController.swift
index 9b08490d..c2469237 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/ViewControllers/ImportViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/ViewControllers/ImportViewController.swift
@@ -43,8 +43,20 @@ class ImportViewController: BaseViewController {
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
- if UIDevice.isPad, hostingWindow != nil {
- updateViewsForIpad()
+ if (UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen), hostingWindow != nil {
+ updateViewsForLargeScreen()
+ } else if UIDevice.isPhoneDuo {
+ addImportServiceView.removeFromSuperview()
+ cornerMaskViewForiPad.removeFromSuperview()
+
+ importServiceListView.snp.remakeConstraints { make in
+ make.top.bottom.equalToSuperview()
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.leading.trailing.equalTo(view.safeAreaLayoutGuide)
+ } else {
+ make.leading.trailing.equalToSuperview()
+ }
+ }
}
}
@@ -72,11 +84,11 @@ class ImportViewController: BaseViewController {
}
}
- private func updateViewsForIpad() {
- guard UIDevice.isPad else { return }
+ private func updateViewsForLargeScreen() {
+ guard UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen else { return }
guard let hostingWindow else { return }
- if view.isWindowHasEnoughSpaceforIpadMultiColumnLayout {
- let sideMenuWidth = R.Size.SideMenuWidth(window: hostingWindow)*1.2
+ if view.isWindowHasEnoughSpaceforIpadMultiColumnLayout || UIDevice.isPhoneDuoInnerFullScreen {
+ let sideMenuWidth = R.Size.SideMenuWidth(window: hostingWindow)*(UIDevice.isPhoneDuoInnerFullScreen ? 1.0 : 1.2)
importServiceListView.snp.remakeConstraints { make in
make.top.bottom.trailing.equalToSuperview()
if sideMenuWidth <= hostingWindow.width/2 {
@@ -94,10 +106,12 @@ class ImportViewController: BaseViewController {
make.trailing.equalTo(importServiceListView.snp.leading)
}
- cornerMaskViewForiPad.removeFromSuperview()
- view.addSubview(cornerMaskViewForiPad)
- cornerMaskViewForiPad.snp.remakeConstraints { make in
- make.edges.equalTo(importServiceListView)
+ if UIDevice.isPad {
+ cornerMaskViewForiPad.removeFromSuperview()
+ view.addSubview(cornerMaskViewForiPad)
+ cornerMaskViewForiPad.snp.remakeConstraints { make in
+ make.edges.equalTo(importServiceListView)
+ }
}
} else {
importServiceListView.snp.remakeConstraints { make in
@@ -110,7 +124,7 @@ class ImportViewController: BaseViewController {
}
override func handleScreenPanGesture(edges: UIRectEdge, gesture: UIScreenEdgePanGestureRecognizer) {
- if UIDevice.isPhone || (UIDevice.isPad && view.prefferedLayoutStyle == .portrait) {
+ if (UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen) || (UIDevice.isPad && view.preferredLayoutStyle == .portrait && !view.isWindowHasEnoughSpaceforIpadMultiColumnLayout) {
if edges == .left {
showSideMenu()
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddImportServiceView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddImportServiceView.swift
index 5bebfc8e..066beb01 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddImportServiceView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/AddImportServiceView.swift
@@ -30,8 +30,8 @@ class AddImportServiceView: BaseView {
sections: sections,
backgroundColor: .clear,
pageInsets: .insets(top: R.Size.ContentInsetTop(window: hostingWindow)),
- enableSafeAreaLeftInsets: true,
- enableSafeAreaRightInsets: true))
+ enableSafeAreaLeftInsets: UIDevice.isPhoneDuo ? false : true,
+ enableSafeAreaRightInsets: UIDevice.isPhoneDuo ? false : true))
view.didActionOccurred = { [weak self] action in
guard let self else { return }
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportMottoCollectionViewCell.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportMottoCollectionViewCell.swift
index fd7f4554..7a097561 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportMottoCollectionViewCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportMottoCollectionViewCell.swift
@@ -29,11 +29,6 @@ class ImportMottoCollectionViewCell: UICollectionViewCell {
addSubviews([keepCellHeightView, backgroundGradientView, imageView, labelView])
- keepCellHeightView.snp.makeConstraints { make in
- make.edges.equalToSuperview()
- make.height.equalTo(220).priority(.high)
- }
-
let bg = R.Color.BackgroundPrimary
let bgDark = R.Color.BackgroundPrimary.forceStyle(.dark)
let bgLight = R.Color.BackgroundPrimary.forceStyle(.light)
@@ -49,13 +44,21 @@ class ImportMottoCollectionViewCell: UICollectionViewCell {
make.leading.trailing.bottom.equalToSuperview()
make.height.equalTo(R.Size.ItemHeightSmall)
}
- updateViews(isLandscape: false)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
+ private var hasInit = false
+
+ override func didMoveToWindow() {
+ super.didMoveToWindow()
+ guard !hasInit else { return }
+ updateViews(isLandscape: preferredLayoutStyle == .landscape)
+ hasInit = true
+ }
+
override func layoutSubviews() {
super.layoutSubviews()
let ovalLayer = CAShapeLayer()
@@ -64,7 +67,7 @@ class ImportMottoCollectionViewCell: UICollectionViewCell {
height: backgroundGradientView.height*2))).cgPath
backgroundGradientView.layer.mask = ovalLayer
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, preferredLayoutStyle == .landscape {
keepCellHeightView.backgroundColor = R.Color.BackgroundSecondary
backgroundGradientView.isHidden = true
} else {
@@ -86,7 +89,8 @@ class ImportMottoCollectionViewCell: UICollectionViewCell {
make.centerY.equalToSuperview()
}
- keepCellHeightView.snp.updateConstraints { make in
+ keepCellHeightView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
make.height.equalTo(100).priority(.high)
}
} else {
@@ -102,7 +106,8 @@ class ImportMottoCollectionViewCell: UICollectionViewCell {
make.bottom.greaterThanOrEqualToSuperview().inset(R.Size.ContentSpaceSmall)
}
- keepCellHeightView.snp.updateConstraints { make in
+ keepCellHeightView.snp.remakeConstraints { make in
+ make.edges.equalToSuperview()
make.height.equalTo(220).priority(.high)
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportNavigationView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportNavigationView.swift
index 5b9cb489..59bec0e6 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportNavigationView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportNavigationView.swift
@@ -45,10 +45,6 @@ class ImportNavigationView: BaseView {
make.centerY.equalToSuperview()
}
- if UIDevice.isPad {
- addServiceButton.isHidden = true
- }
-
toolsView.snp.makeConstraints { make in
make.trailing.equalToSuperview().offset(-R.Size.ContentSpaceLarge)
make.centerY.equalToSuperview()
@@ -70,6 +66,11 @@ class ImportNavigationView: BaseView {
fatalError("init(coder:) has not been implemented")
}
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ addServiceButton.isHidden = UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen
+ }
+
private func updateToolsView() {
toolsView.icons = getTools()
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift
index 99060f63..f95f8fb4 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift
@@ -72,6 +72,9 @@ class ImportServiceListView: BaseView {
view.delegate = self
view.contentInset = getCollectionViewContentInset()
view.isFocusable = true
+ if UIDevice.isPhoneDuo {
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -120,10 +123,25 @@ class ImportServiceListView: BaseView {
}
addSubview(importNavigationView)
- importNavigationView.snp.makeConstraints { make in
- make.leading.trailing.equalToSuperview()
+ updateNavigationViewConstraints()
+ }
+
+ private func updateNavigationViewConstraints() {
+ importNavigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalToSuperview()
+ make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
+ }
make.height.equalTo(R.Size.NavigationHeight)
- make.top.equalToSuperview().offset(UIDevice.isPhone ? 0 : R.Size.ContentInsetTop(window: hostingWindow))
}
}
@@ -131,9 +149,12 @@ class ImportServiceListView: BaseView {
super.layoutSubviews()
if UIDevice.isPhone {
importNavigationView.snp.updateConstraints { make in
- make.top.equalToSuperview().offset(UIDevice.isPhone && isLandscapeLayout ? 0 : R.Size.ContentInsetTop(window: hostingWindow))
+ make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
}
}
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
}
required init?(coder: NSCoder) {
@@ -141,7 +162,7 @@ class ImportServiceListView: BaseView {
}
private var isLandscapeLayout: Bool {
- var isLandscape = prefferedLayoutStyle == .landscape
+ var isLandscape = preferredLayoutStyle == .landscape
if isLandscape, UIDevice.isPad, isWindowHasEnoughSpaceforIpadMultiColumnLayout {
isLandscape = false
}
@@ -149,7 +170,9 @@ class ImportServiceListView: BaseView {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { [weak self] sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { [weak self] sectionIndex, env in
guard let self else { return nil }
let isLandscape = self.isLandscapeLayout
let widthDimension: NSCollectionLayoutDimension
@@ -203,7 +226,7 @@ class ImportServiceListView: BaseView {
}
return section
- }
+ }, configuration: configuration)
return layout
}
@@ -218,26 +241,28 @@ class ImportServiceListView: BaseView {
if isLandscapeLayout {
top += (R.Size.NavigationHeight + R.Size.ContentSpaceLarge)
}
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ top += R.Size.ContentSpaceLarge
+ }
let bottom = R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge
return .insets(top: top, bottom: bottom)
}
}
extension ImportServiceListView: ViewTransition {
- func viewWillTransition() {
+ func viewAlongsideTransition() {
if let cell = collectionView.cellForItem(at: IndexPath(row: 0, section: 0)) as? ImportMottoCollectionViewCell {
cell.updateViews(isLandscape: isLandscapeLayout)
}
- }
-
- func viewAlongsideTransition() {
if UIDevice.isPhone {
importNavigationView.snp.updateConstraints { make in
make.top.equalToSuperview().offset(UIDevice.isPhone && isLandscapeLayout ? 0 : R.Size.ContentInsetTop(window: hostingWindow))
}
- } else if UIDevice.isPad, isLandscapeLayout {
- collectionView.contentInset = getCollectionViewContentInset()
}
+ collectionView.contentInset = getCollectionViewContentInset()
+ collectionView.reloadData({ [weak self] in
+ self?.collectionView.scrollToTop()
+ })
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/ArticBaseCollectionCell.swift b/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/ArticBaseCollectionCell.swift
index e42d9f26..1c2f4abc 100644
--- a/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/ArticBaseCollectionCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/ArticBaseCollectionCell.swift
@@ -80,6 +80,11 @@ class ArticBaseCollectionCell: UICollectionViewCell {
UIView.makeToast(message: R.string.localizable.badIpAddress())
}
}
+ textField.isFocusable = true
+ textField.onFocusConfirm = { [weak self] in
+ self?.ipAddressTitleTextField.becomeFirstResponder()
+ return true
+ }
return textField
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/PSPNetworkingConfigOnlineView.swift b/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/PSPNetworkingConfigOnlineView.swift
index a9745099..63b2045f 100644
--- a/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/PSPNetworkingConfigOnlineView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/OnlinePlay/Views/PSPNetworkingConfigOnlineView.swift
@@ -27,6 +27,11 @@ class PSPNetworkingConfigOnlineView: BaseView {
guard let self else { return }
self.didConnectedHostChange?(self.ipAddressTitleTextField.text)
}
+ textField.isFocusable = true
+ textField.onFocusConfirm = { [weak self] in
+ self?.ipAddressTitleTextField.becomeFirstResponder()
+ return true
+ }
return textField
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
index 5fb3bdf5..f70ef35a 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
@@ -397,6 +397,9 @@ class Game: Object, ObjectUpdatable {
}
func isBIOSMissing(required: Bool = true) -> Bool {
+#if SIMULATOR
+ return false
+#endif
let requireBIOS: [BIOSItem]
if gameType == .mcd {
if defaultCore == 2 {
@@ -1503,7 +1506,7 @@ class Game: Object, ObjectUpdatable {
storeValue: skinId)
}
- let prefferedEdgeSkin = SymbianOS.getOS(by: device).rawValue > SymbianOS.S60v3.rawValue
+ let preferredEdgeSkin = SymbianOS.getOS(by: device).rawValue > SymbianOS.S60v3.rawValue
let realm = Database.realm
var hadSetLandscapeSkin = false
var hadSetPortraitSkin = false
@@ -1515,16 +1518,16 @@ class Game: Object, ObjectUpdatable {
//设置过横屏
hadSetLandscapeSkin = true
- if !prefferedEdgeSkin && skin.identifier == R.Strings.SymbianEdgeSkinIdentifier {
+ if !preferredEdgeSkin && skin.identifier == R.Strings.SymbianEdgeSkinIdentifier {
//要换成标准横屏
changeSkin(isLandScape: true, isFlex: false, isEdge: false)
- } else if !prefferedEdgeSkin && skin.identifier == R.Strings.SymbianEdgeFlexSkinIdentifier {
+ } else if !preferredEdgeSkin && skin.identifier == R.Strings.SymbianEdgeFlexSkinIdentifier {
//切换到flex标准横屏
changeSkin(isLandScape: true, isFlex: true, isEdge: false)
- } else if prefferedEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
+ } else if preferredEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
//切换Edge横屏
changeSkin(isLandScape: true, isFlex: false, isEdge: true)
- } else if prefferedEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
+ } else if preferredEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
//切换Edge Flex横屏
changeSkin(isLandScape: true, isFlex: true, isEdge: true)
}
@@ -1536,16 +1539,16 @@ class Game: Object, ObjectUpdatable {
let skin = realm.object(ofType: Skin.self, forPrimaryKey: skinId) {
//设置过竖屏
hadSetPortraitSkin = true
- if !prefferedEdgeSkin && skin.identifier == R.Strings.SymbianEdgeSkinIdentifier {
+ if !preferredEdgeSkin && skin.identifier == R.Strings.SymbianEdgeSkinIdentifier {
//要换成标准竖屏
changeSkin(isLandScape: false, isFlex: false, isEdge: false)
- } else if !prefferedEdgeSkin && skin.identifier == R.Strings.SymbianEdgeFlexSkinIdentifier {
+ } else if !preferredEdgeSkin && skin.identifier == R.Strings.SymbianEdgeFlexSkinIdentifier {
//切换到flex标准竖屏
changeSkin(isLandScape: false, isFlex: true, isEdge: false)
- } else if prefferedEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
+ } else if preferredEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
//切换Edge竖屏
changeSkin(isLandScape: false, isFlex: false, isEdge: true)
- } else if prefferedEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
+ } else if preferredEdgeSkin && skin.identifier == R.Strings.SymbianSkinIdentifier {
//切换Edge Flex竖屏
changeSkin(isLandScape: false, isFlex: true, isEdge: true)
}
@@ -1553,7 +1556,7 @@ class Game: Object, ObjectUpdatable {
if !hadSetLandscapeSkin {
//需要设置横屏
- if prefferedEdgeSkin {
+ if preferredEdgeSkin {
//切换Edge横屏
changeSkin(isLandScape: true, isFlex: false, isEdge: true)
} else {
@@ -1564,7 +1567,7 @@ class Game: Object, ObjectUpdatable {
if !hadSetPortraitSkin {
//需要设置竖屏
- if prefferedEdgeSkin {
+ if preferredEdgeSkin {
//切换Edge竖屏
changeSkin(isLandScape: false, isFlex: false, isEdge: true)
} else {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Skin.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Skin.swift
index 5a312877..e030780f 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Skin.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Skin.swift
@@ -105,6 +105,9 @@ class Skin: Object, ObjectUpdatable {
skinType == .default || isKeyboardSkin || identifier == R.Strings.WiimoteSkinIdentifier
}
+ var previewPortraitTraits: ControllerSkin.Traits? = nil
+ var previewLandscapeTraits: ControllerSkin.Traits? = nil
+
/// Drop stale `.buildIn` rows iCloud restored after a bundle skin file (hash PK) changed.
/// Default / PlayCase are local-only (`isSyncable`); imported skins are user data. Runs once per app version.
static func polishSkinsAfterRealmSync() {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index 053c7cea..4af831a5 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@ -65,20 +65,7 @@ class PlayViewController: GameViewController {
//游戏控制器,如果游戏在运行中则有值,没有进行游戏的时候则为nil
static weak var currentPlayViewController: PlayViewController? = nil
//屏幕上的功能按钮容器
- class ShortcutButtonContainerView: UIView {
- override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
- // Iterate through all subviews and check whether the click is on a subview
- for subview in subviews.reversed() {
- let convertedPoint = subview.convert(point, from: self)
- if subview.bounds.contains(convertedPoint) {
- return super.hitTest(point, with: event)
- }
- }
- // Click not on any subview, return nil to let the click pass through.
- return nil
- }
- }
- private var shortcutsButtonContainer = ShortcutButtonContainerView()
+ private var shortcutsButtonContainer: ShortcutButtonContainerView
//渲染视图
private var gameMetalView: UIView? = nil
//3DS核心
@@ -156,21 +143,40 @@ class PlayViewController: GameViewController {
private var skinSwitchBindDatas = [String: Bool]()
static func startGame(game: Game, saveState: GameSaveState? = nil, in scene: UIWindowScene?) {
+ var tabletopPaused = false
+ var holdTabletopPause = false
+ if #available(iOS 27.1, *) {
+ tabletopPaused = DuoTabletopKit.pauseTabletopForPlay()
+ }
+ // In-app paths that never present the game resume Tabletop when this function returns.
+ // A real launch, or an external emulator, sets `holdTabletopPause` so the defer leaves it paused.
+ func releaseTabletopIfNotPlaying() {
+ guard tabletopPaused, !holdTabletopPause else { return }
+ tabletopPaused = false
+ if #available(iOS 27.1, *) {
+ DuoTabletopKit.resumeTabletopIfStillPartiallyOpen()
+ }
+ }
+ defer { releaseTabletopIfNotPlaying() }
+
if game.isUrlGame {
game.handleTapAction(forceQuick: true, in: scene)
return
}
- if game.gameType == .ns {
- EmulatorInteractionKit.startGame(type: .meloNX, id: game.id)
- return
- } else if game.gameType == .xbox360 {
- EmulatorInteractionKit.startGame(type: .xeniOS, id: game.id)
- return
- } else if game.gameType == .xbox {
- EmulatorInteractionKit.startGame(type: .dukeX, id: game.id)
- return
- } else if game.gameType == .ps2 {
- EmulatorInteractionKit.startGame(type: .armsx2, id: game.id)
+ if game.gameType == .ns || game.gameType == .xbox360 || game.gameType == .xbox || game.gameType == .ps2 {
+ holdTabletopPause = true
+ if #available(iOS 27.1, *) {
+ DuoTabletopKit.markTabletopResumeWhenActive()
+ }
+ if game.gameType == .ns {
+ EmulatorInteractionKit.startGame(type: .meloNX, id: game.id)
+ } else if game.gameType == .xbox360 {
+ EmulatorInteractionKit.startGame(type: .xeniOS, id: game.id)
+ } else if game.gameType == .xbox {
+ EmulatorInteractionKit.startGame(type: .dukeX, id: game.id)
+ } else {
+ EmulatorInteractionKit.startGame(type: .armsx2, id: game.id)
+ }
return
}
@@ -187,6 +193,10 @@ class PlayViewController: GameViewController {
return
}
func launchGameByDismissOtherVC() {
+ holdTabletopPause = true
+ if #available(iOS 27.1, *) {
+ DuoTabletopKit.pauseTabletopForPlay()
+ }
//Clear the image memory cache before starting the game.
KingfisherManager.shared.cache.clearMemoryCache()
@@ -317,6 +327,7 @@ class PlayViewController: GameViewController {
private init(game: Game, saveState: GameSaveState? = nil) {
manicGame = game
+ shortcutsButtonContainer = ShortcutButtonContainerView(game: game)
super.init()
Log.debug("⚠️ \(ObjectIdentifier(self)) init")
loadSaveState = saveState
@@ -714,7 +725,7 @@ class PlayViewController: GameViewController {
notificationTokens.append(center.addObserver(forName: R.NotificationName.ShortcutsChange, object: nil, queue: .main, using: { [weak self] notification in
//快捷键变更
guard let self else { return }
- self.updateShortcutsButton()
+ self.updateShortcuts()
}))
notificationTokens.append(center.addObserver(forName: Notification.Name(rawValue: "FirmwareNoSupportNotification"), object: nil, queue: .main) { [weak self] notification in
guard let self else { return }
@@ -763,46 +774,46 @@ class PlayViewController: GameViewController {
//添加功能按钮容器按钮
shortcutsButtonContainer.isHidden = true
view.addSubview(shortcutsButtonContainer)
- shortcutsButtonContainer.snp.makeConstraints { make in
- if manicGame.gameType == .n64 && UIDevice.isPad {
- make.top.equalTo(gameView.snp.bottom).offset(-9)
- } else if manicGame.gameType == .j2me ||
- manicGame.gameType == .gba || manicGame.gameType == .wsc {
- make.top.equalTo(gameView.snp.bottom).offset(3)
- } else if manicGame.gameType.usesDOSSkinLayout {
- if UIDevice.isSmallScreenPhone {
- make.top.equalTo(gameView.snp.bottom).offset(17)
- } else if UIDevice.isProMaxPhone {
- make.top.equalTo(gameView.snp.bottom).offset(22)
- } else {
- make.top.equalTo(gameView.snp.bottom).offset(19)
- }
- } else if manicGame.gameType == .symbian, UIDevice.isPhone {
- make.top.equalTo(gameView.snp.bottom).offset(4)
- } else if manicGame.isDolphinCore || manicGame.gameType == .flash {
- make.top.equalTo(gameView.snp.bottom).offset(5)
- } else if manicGame.gameType == .pce {
- make.top.equalTo(gameView.snp.bottom).offset(R.Size.ContentSpaceMedium)
- } else {
- make.top.equalTo(gameView.snp.bottom)
- }
-
- make.leading.trailing.equalTo(gameView)
-
- if manicGame.gameType == .j2me ||
- manicGame.gameType.usesDOSSkinLayout ||
- (manicGame.gameType == .symbian && UIDevice.isPhone) ||
- manicGame.gameType == .pce ||
- manicGame.gameType == .gba ||
- manicGame.gameType == .wsc {
- make.height.equalTo(R.Size.ItemHeightMicro)
- } else if manicGame.gameType == .ngp {
- make.height.equalTo(R.Size.ItemHeightTiny)
- } else {
- make.height.equalTo(R.Size.ItemHeightMedium)
- }
-
- }
+// shortcutsButtonContainer.snp.makeConstraints { make in
+// if manicGame.gameType == .n64 && UIDevice.isPad {
+// make.top.equalTo(gameView.snp.bottom).offset(-9)
+// } else if manicGame.gameType == .j2me ||
+// manicGame.gameType == .gba || manicGame.gameType == .wsc {
+// make.top.equalTo(gameView.snp.bottom).offset(3)
+// } else if manicGame.gameType.usesDOSSkinLayout {
+// if UIDevice.isStandardPhone {
+// make.top.equalTo(gameView.snp.bottom).offset(17)
+// } else if UIDevice.isProMaxPhone {
+// make.top.equalTo(gameView.snp.bottom).offset(22)
+// } else {
+// make.top.equalTo(gameView.snp.bottom).offset(19)
+// }
+// } else if manicGame.gameType == .symbian, UIDevice.isPhone {
+// make.top.equalTo(gameView.snp.bottom).offset(4)
+// } else if manicGame.isDolphinCore || manicGame.gameType == .flash {
+// make.top.equalTo(gameView.snp.bottom).offset(5)
+// } else if manicGame.gameType == .pce {
+// make.top.equalTo(gameView.snp.bottom).offset(R.Size.ContentSpaceMedium)
+// } else {
+// make.top.equalTo(gameView.snp.bottom)
+// }
+//
+// make.leading.trailing.equalTo(gameView)
+//
+// if manicGame.gameType == .j2me ||
+// manicGame.gameType.usesDOSSkinLayout ||
+// (manicGame.gameType == .symbian && UIDevice.isPhone) ||
+// manicGame.gameType == .pce ||
+// manicGame.gameType == .gba ||
+// manicGame.gameType == .wsc {
+// make.height.equalTo(R.Size.ItemHeightMicro)
+// } else if manicGame.gameType == .ngp {
+// make.height.equalTo(R.Size.ItemHeightTiny)
+// } else {
+// make.height.equalTo(R.Size.ItemHeightMedium)
+// }
+//
+// }
//设置外设控制器
updateExternalGameController()
// Load default core config after JIT is ready (sideload waits for CS_DEBUGGED first).
@@ -890,6 +901,11 @@ class PlayViewController: GameViewController {
removeExternalGameControllerReceivers()
PlayViewController.currentPlayViewController = nil
PlayViewController.refreshExternalInputSink()
+ if isBeingDismissed || isMovingFromParent {
+ if #available(iOS 27.1, *) {
+ DuoTabletopKit.resumeTabletopAfterPlayIfNeeded()
+ }
+ }
//发送结束游戏通知
NotificationCenter.default.post(name: R.NotificationName.StopPlayGame, object: nil)
@@ -953,6 +969,9 @@ class PlayViewController: GameViewController {
}
override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
+ if manicGame.isLibretroType, !LibretroCore.sharedInstance().isCoreRunning() {
+ return
+ }
OrientationLockPin.resistPortraitTransitionIfNeeded(to: size)
let fromSize = R.Size.ApplicationWindowSize
let toSize = size
@@ -1241,12 +1260,12 @@ extension PlayViewController {
}
} else {
pauseEmulationIfNeed()
- if UIDevice.isPhone && view.prefferedLayoutStyle == .portrait {
- var prefferedMenuHeight = view.height - gameView.frame.maxY
- if prefferedMenuHeight < R.Size.ApplicationWindowSize.height/3 {
- prefferedMenuHeight = R.Size.SheetWindowMaxSize.height/2
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen && view.preferredLayoutStyle == .portrait {
+ var preferredMenuHeight = view.height - gameView.frame.maxY
+ if preferredMenuHeight < R.Size.ApplicationWindowSize.height/3 {
+ preferredMenuHeight = R.Size.SheetWindowMaxSize.height/2
}
- GameOptionsView.MaxHeightForGaming = max(prefferedMenuHeight, R.Size.SheetWindowMinSize.height)
+ GameOptionsView.MaxHeightForGaming = max(preferredMenuHeight, R.Size.SheetWindowMinSize.height)
}
GameOptionsView.show(scene: .gaming, games: [manicGame], hideCompletion: { [weak self] option in
guard let self else { return }
@@ -2458,7 +2477,7 @@ extension PlayViewController {
}
if let result = Prefference.defalut.getPrefference(kind: .skin,
- storeKey: .orientationKey(gameId: manicGame.id, isLandScape: view.prefferedLayoutStyle == .landscape),
+ storeKey: .orientationKey(gameId: manicGame.id, isLandScape: view.preferredLayoutStyle == .landscape),
bestEfforts: true),
let skinId = result.skinValue?.skinId,
let skin = Database.realm.object(ofType: Skin.self, forPrimaryKey: skinId),
@@ -2527,10 +2546,7 @@ extension PlayViewController {
//尝试加载滤镜
updateFilter()
//尝试添加屏幕按钮
- updateShortcutsButton()
- if manicGame.gameType == .ds || (manicGame.gameType == ._3ds && !manicGame.isAzaharArticBase) || (manicGame.gameType.usesDOSSkinLayout && UIDevice.isPad) {
- updateShortcutButtonContainer()
- }
+ updateShortcuts()
//更新3DS画面视图
updateCitra3DSViews()
//更新JGenesis画面
@@ -2700,172 +2716,188 @@ extension PlayViewController {
}
}
- private func updateShortcutsButton() {
- shortcutsButtonContainer.subviews.forEach { $0.removeFromSuperview() }
- if (manicGame.gameType == ._3ds && UIDevice.isPad) || manicGame.isAzaharArticBase {
- return
- }
- if let hostingWindow, UIDevice.isWindowAppIPad(window: hostingWindow) {
- return
- }
- if let controllerSkin = controllerView.controllerSkin {
- if let skin = Database.realm.objects(Skin.self).first(where: { $0.identifier == controllerSkin.identifier }) {
- if skin.supportShortcut {
- //当前使用的是默认皮肤 则添加功能按钮
- var shortcuts = Prefference.defalut.getPrefference(kind: .gameShortcut,
- storeKey: .game(gameId: manicGame.id),
- bestEfforts: true)?.gameShortcutValue ?? GameOption.defaultShortcutOptions(for: manicGame)
- let availableOptions = Set(GameOption.availableOptions(game: manicGame, scene: .gaming))
- shortcuts = shortcuts.filter({ availableOptions.contains($0) })
-
-
- guard shortcuts.count > 0 else { return }
- let functionButtonCount = shortcuts.count
- for (index, shortcut) in shortcuts.enumerated() {
- var iconColor = UIColor.white.withAlphaComponent(0.25)
- if (manicGame.gameType == .ds && UIDevice.isPad) ||
- manicGame.gameType == .wii ||
- manicGame.gameType == .ngc ||
- (manicGame.gameType == .pce && view.prefferedLayoutStyle == .portrait) ||
- manicGame.gameType.usesDOSSkinLayout ||
- manicGame.gameType == .wsc {
- iconColor = .black.withAlphaComponent(0.25)
- }
- let buttonContainerView = UIView()
- let button = ASButtonView(.iconOnlyWithSmallSize(icon: shortcut.icon.updateColorsIfNeed(colors: [iconColor], forceUpdate: true),
- background: .clear))
- button.didTapButton = { [weak self] in
- guard let self, shortcut != .rewind else { return }
- shortcut.showSecondPromptIfNeed(continued: {
- shortcut.performAction(with: [self.manicGame],
- in: self.hostingWindowScene,
- performImmediately: true)
- })
- }
- button.didLongPressButton = { [weak self] state in
- guard let self else { return }
- var mapping: MappingOption? = nil
- if shortcut == .fastForward {
- mapping = .fastForward2x
- } else if shortcut == .rewind {
- mapping = .rewind
- } else {
- mapping = MappingOption.GameOptionMappings.key(forValue: shortcut)
- }
- guard let mapping else { return }
- let input = AnyInput(stringValue: mapping.rawValue,
- intValue: 1,
- type: .controller(.controllerSkin))
- if state == .began {
- self.gameController(self.controllerView,
- didActivate:input,
- value: 1)
- } else if state == .cancelled || state == .ended {
- self.gameController(self.controllerView,
- didDeactivate: input)
- }
- }
- buttonContainerView.addSubview(button)
- button.snp.makeConstraints { make in
- make.center.equalToSuperview()
- }
- shortcutsButtonContainer.addSubview(buttonContainerView)
- buttonContainerView.snp.makeConstraints { make in
- if manicGame.gameType == .ds || manicGame.gameType == ._3ds {
- if UIDevice.isPhone {
- make.width.equalTo(31)
- make.height.equalToSuperview().dividedBy(2)
- if index == 0 {
- make.leading.equalToSuperview()
- make.top.equalToSuperview()
- } else if index == 1 {
- make.leading.equalToSuperview()
- make.top.equalTo(shortcutsButtonContainer.subviews[index - 1].snp.bottom)
- } else if index == 2 {
- make.trailing.equalToSuperview()
- make.top.equalToSuperview()
- } else if index == 3 {
- make.trailing.equalToSuperview()
- make.top.equalTo(shortcutsButtonContainer.subviews[index - 1].snp.bottom)
- }
- } else {
- make.width.equalTo(50)
- make.top.bottom.equalToSuperview()
- if index == 0 {
- make.leading.equalToSuperview()
- } else if index == 1 {
- make.leading.equalTo(shortcutsButtonContainer.subviews[index-1].snp.trailing)
- } else if index == 2 {
- make.trailing.equalToSuperview().inset(50)
- } else if index == 3 {
- make.trailing.equalToSuperview()
- }
- }
- } else {
- if index == 0 {
- make.leading.equalToSuperview()
- } else {
- make.leading.equalTo(shortcutsButtonContainer.subviews[index-1].snp.trailing)
- }
- make.top.bottom.equalToSuperview()
- if index == functionButtonCount-1 && functionButtonCount == R.Numbers.GameFunctionButtonCount {
- make.trailing.equalToSuperview()
- }
- make.width.equalToSuperview().dividedBy(R.Numbers.GameFunctionButtonCount)
- }
- }
-
- }
- }
- }
+ private func updateShortcuts() {
+ if let controllerSkin = controllerView.controllerSkin as? ControllerSkin {
+ shortcutsButtonContainer.updateControllerSkin(controllerSkin,
+ beginLongPress: { [weak self] input in
+ guard let self else { return }
+ self.gameController(self.controllerView,
+ didActivate:input,
+ value: 1)
+ }, endLongPress: { [weak self] input in
+ guard let self else { return }
+ self.gameController(self.controllerView,
+ didDeactivate: input)
+ })
}
}
- private func updateShortcutButtonContainer() {
- if (manicGame.gameType == .ds || (UIDevice.isPhone && manicGame.gameType == ._3ds)) && UIDevice.isPhone {
- shortcutsButtonContainer.snp.remakeConstraints { make in
- if gameViews.count > 1 {
- //iPhone ds布局比较特殊
- if view.prefferedLayoutStyle == .landscape {
- make.leading.equalTo(gameViews[0]).inset(-33)
- make.trailing.equalTo(gameViews[1]).inset(-33)
- make.top.equalToSuperview()
- } else {
- make.leading.trailing.equalTo(gameViews[1]).inset(-33)
- make.top.equalTo(gameViews[1])
- }
-
- if manicGame.gameType == ._3ds {
- if let displayType = controllerView.controllerSkinTraits?.displayType, displayType == .standard {
- //小屏幕
- make.height.equalTo(80)
- } else {
- //大屏幕
- make.height.equalTo(96)
- }
- } else {
- if let displayType = controllerView.controllerSkinTraits?.displayType, displayType == .standard, view.prefferedLayoutStyle == .portrait {
- make.height.equalTo(87)
- } else {
- make.height.equalTo(113)
- }
- }
- }
- }
- } else if manicGame.gameType.usesDOSSkinLayout, UIDevice.isPad {
- shortcutsButtonContainer.snp.updateConstraints { make in
- make.top.equalTo(gameView.snp.bottom).offset(view.prefferedLayoutStyle == .landscape ? 30 : 40)
- }
- } else if manicGame.gameType == .ds, UIDevice.isPad {
- shortcutsButtonContainer.snp.updateConstraints { make in
- make.top.equalTo(gameView.snp.bottom).offset(view.prefferedLayoutStyle == .landscape ? 25 : 40)
- }
- } else if manicGame.gameType == .pm && view.prefferedLayoutStyle == .portrait {
- shortcutsButtonContainer.snp.updateConstraints { make in
- make.leading.trailing.equalTo(gameView).inset(50)
- }
- }
- }
+// private func updateShortcutsButton() {
+// shortcutsButtonContainer.subviews.forEach { $0.removeFromSuperview() }
+// if (manicGame.gameType == ._3ds && UIDevice.isPad) || manicGame.isAzaharArticBase {
+// return
+// }
+// if let hostingWindow, UIDevice.isWindowAppIPad(window: hostingWindow) {
+// return
+// }
+// if let controllerSkin = controllerView.controllerSkin {
+// if let skin = Database.realm.objects(Skin.self).first(where: { $0.identifier == controllerSkin.identifier }) {
+// if skin.supportShortcut {
+// //当前使用的是默认皮肤 则添加功能按钮
+// var shortcuts = Prefference.defalut.getPrefference(kind: .gameShortcut,
+// storeKey: .game(gameId: manicGame.id),
+// bestEfforts: true)?.gameShortcutValue ?? GameOption.defaultShortcutOptions(for: manicGame)
+// let availableOptions = Set(GameOption.availableOptions(game: manicGame, scene: .gaming))
+// shortcuts = shortcuts.filter({ availableOptions.contains($0) })
+//
+//
+// guard shortcuts.count > 0 else { return }
+// let functionButtonCount = shortcuts.count
+// for (index, shortcut) in shortcuts.enumerated() {
+// var iconColor = UIColor.white.withAlphaComponent(0.25)
+// if (manicGame.gameType == .ds && UIDevice.isPad) ||
+// manicGame.gameType == .wii ||
+// manicGame.gameType == .ngc ||
+// (manicGame.gameType == .pce && view.preferredLayoutStyle == .portrait) ||
+// manicGame.gameType.usesDOSSkinLayout ||
+// manicGame.gameType == .wsc {
+// iconColor = .black.withAlphaComponent(0.25)
+// }
+// let buttonContainerView = UIView()
+// let button = ASButtonView(.iconOnlyWithSmallSize(icon: shortcut.icon.updateColorsIfNeed(colors: [iconColor], forceUpdate: true),
+// background: .clear))
+// button.didTapButton = { [weak self] in
+// guard let self, shortcut != .rewind else { return }
+// shortcut.showSecondPromptIfNeed(continued: {
+// shortcut.performAction(with: [self.manicGame],
+// in: self.hostingWindowScene,
+// performImmediately: true)
+// })
+// }
+// button.didLongPressButton = { [weak self] state in
+// guard let self else { return }
+// var mapping: MappingOption? = nil
+// if shortcut == .fastForward {
+// mapping = .fastForward2x
+// } else if shortcut == .rewind {
+// mapping = .rewind
+// } else {
+// mapping = MappingOption.GameOptionMappings.key(forValue: shortcut)
+// }
+// guard let mapping else { return }
+// let input = AnyInput(stringValue: mapping.rawValue,
+// intValue: 1,
+// type: .controller(.controllerSkin))
+// if state == .began {
+// self.gameController(self.controllerView,
+// didActivate:input,
+// value: 1)
+// } else if state == .cancelled || state == .ended {
+// self.gameController(self.controllerView,
+// didDeactivate: input)
+// }
+// }
+// buttonContainerView.addSubview(button)
+// button.snp.makeConstraints { make in
+// make.center.equalToSuperview()
+// }
+// shortcutsButtonContainer.addSubview(buttonContainerView)
+// buttonContainerView.snp.makeConstraints { make in
+// if manicGame.gameType == .ds || manicGame.gameType == ._3ds {
+// if UIDevice.isPhone {
+// make.width.equalTo(31)
+// make.height.equalToSuperview().dividedBy(2)
+// if index == 0 {
+// make.leading.equalToSuperview()
+// make.top.equalToSuperview()
+// } else if index == 1 {
+// make.leading.equalToSuperview()
+// make.top.equalTo(shortcutsButtonContainer.subviews[index - 1].snp.bottom)
+// } else if index == 2 {
+// make.trailing.equalToSuperview()
+// make.top.equalToSuperview()
+// } else if index == 3 {
+// make.trailing.equalToSuperview()
+// make.top.equalTo(shortcutsButtonContainer.subviews[index - 1].snp.bottom)
+// }
+// } else {
+// make.width.equalTo(50)
+// make.top.bottom.equalToSuperview()
+// if index == 0 {
+// make.leading.equalToSuperview()
+// } else if index == 1 {
+// make.leading.equalTo(shortcutsButtonContainer.subviews[index-1].snp.trailing)
+// } else if index == 2 {
+// make.trailing.equalToSuperview().inset(50)
+// } else if index == 3 {
+// make.trailing.equalToSuperview()
+// }
+// }
+// } else {
+// if index == 0 {
+// make.leading.equalToSuperview()
+// } else {
+// make.leading.equalTo(shortcutsButtonContainer.subviews[index-1].snp.trailing)
+// }
+// make.top.bottom.equalToSuperview()
+// if index == functionButtonCount-1 && functionButtonCount == R.Numbers.GameFunctionButtonCount {
+// make.trailing.equalToSuperview()
+// }
+// make.width.equalToSuperview().dividedBy(R.Numbers.GameFunctionButtonCount)
+// }
+// }
+//
+// }
+// }
+// }
+// }
+// }
+
+// private func updateShortcutButtonContainer() {
+// if (manicGame.gameType == .ds || (UIDevice.isPhone && manicGame.gameType == ._3ds)) && UIDevice.isPhone {
+// shortcutsButtonContainer.snp.remakeConstraints { make in
+// if gameViews.count > 1 {
+// //iPhone ds布局比较特殊
+// if view.preferredLayoutStyle == .landscape {
+// make.leading.equalTo(gameViews[0]).inset(-33)
+// make.trailing.equalTo(gameViews[1]).inset(-33)
+// make.top.equalToSuperview()
+// } else {
+// make.leading.trailing.equalTo(gameViews[1]).inset(-33)
+// make.top.equalTo(gameViews[1])
+// }
+//
+// if manicGame.gameType == ._3ds {
+// if let displayType = controllerView.controllerSkinTraits?.displayType, displayType == .standard {
+// //小屏幕
+// make.height.equalTo(80)
+// } else {
+// //大屏幕
+// make.height.equalTo(96)
+// }
+// } else {
+// if let displayType = controllerView.controllerSkinTraits?.displayType, displayType == .standard, view.preferredLayoutStyle == .portrait {
+// make.height.equalTo(87)
+// } else {
+// make.height.equalTo(113)
+// }
+// }
+// }
+// }
+// } else if manicGame.gameType.usesDOSSkinLayout, UIDevice.isPad {
+// shortcutsButtonContainer.snp.updateConstraints { make in
+// make.top.equalTo(gameView.snp.bottom).offset(view.preferredLayoutStyle == .landscape ? 30 : 40)
+// }
+// } else if manicGame.gameType == .ds, UIDevice.isPad {
+// shortcutsButtonContainer.snp.updateConstraints { make in
+// make.top.equalTo(gameView.snp.bottom).offset(view.preferredLayoutStyle == .landscape ? 25 : 40)
+// }
+// } else if manicGame.gameType == .pm && view.preferredLayoutStyle == .portrait {
+// shortcutsButtonContainer.snp.updateConstraints { make in
+// make.leading.trailing.equalTo(gameView).inset(50)
+// }
+// }
+// }
private func updateCitra3DSViews() {
#if !SIMULATOR
@@ -3401,7 +3433,7 @@ extension PlayViewController {
let scaleTopFrame = topFrame.applying(scaleTransform)
let scaleBottomFrame = bottomFrame.applying(scaleTransform)
- if !isOriginalShader, manicGame.gameType == ._3ds, view.prefferedLayoutStyle == .landscape {
+ if !isOriginalShader, manicGame.gameType == ._3ds, view.preferredLayoutStyle == .landscape {
//fix 3DS Scale
let fixScale = hostingWindow.screen.scale-scale
layout = "\(scaleTopFrame.minX.rounded1()),\(scaleTopFrame.minY.rounded1()),\(scaleTopFrame.width.rounded1()),\((scaleTopFrame.height*fixScale).rounded1()),\((scaleBottomFrame.minX).rounded1()),\(scaleBottomFrame.minY.rounded1()),\(scaleBottomFrame.width.rounded1()),\((scaleBottomFrame.height*fixScale).rounded1()),\(bufferframe.width.rounded1()),\((bufferframe.height*fixScale).rounded1())"
@@ -4286,7 +4318,7 @@ extension PlayViewController {
}
if let result = Prefference.defalut.getPrefference(kind: .flexBackground,
- storeKey: .orientationKey(gameId: manicGame.id, isLandScape: view.prefferedLayoutStyle == .landscape),
+ storeKey: .orientationKey(gameId: manicGame.id, isLandScape: view.preferredLayoutStyle == .landscape),
bestEfforts: true),
case let .flexBackground(bg) = result {
backgroundImageView?.image = bg.image
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/ShortcutButtonContainerView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/ShortcutButtonContainerView.swift
new file mode 100644
index 00000000..9f0dbd6d
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/ShortcutButtonContainerView.swift
@@ -0,0 +1,282 @@
+//
+// ShortcutButtonContainerView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+import DeltaCore
+
+class ShortcutButtonContainerView: UIView {
+ struct InterfaceStyle {
+
+ let gameType: GameType
+ let isLandscape: Bool
+
+ var offsetY: CGFloat {
+ switch gameType {
+ case .snes:
+ return 11
+ case .dos, .amiga, .c64, .doom:
+ return UIDevice.isPhone || (UIDevice.isPad && isLandscape) ? 17 : 25
+ case .flash, .ngc, .wii:
+ return 8
+ case .symbian, .arcade:
+ return 2
+ case .pce:
+ return isLandscape ? 16 : 14
+ case .wsc:
+ return 2
+ case ._3ds:
+ if UIDevice.isPad {
+ return isLandscape ? 4 : 16
+ } else if UIDevice.isPhoneDuo {
+ return isLandscape ? 4 : 24
+ }
+ return 0
+ case .ds:
+ if UIDevice.isPad {
+ return isLandscape ? 20 : 31
+ } else if UIDevice.isPhoneDuo {
+ return isLandscape ? 20 : 17
+ }
+ return 0
+ default:
+ return 0
+ }
+ }
+
+ var offsetX: CGFloat {
+ switch gameType {
+ case .pm:
+ return isLandscape ? 0 : 20
+ case ._3ds:
+ return UIDevice.isPad ? 40 : (UIDevice.isPhoneDuo ? (isLandscape ? 40 : 121) : 0)
+ default:
+ return 0
+ }
+ }
+
+ var dimension: CGFloat {
+ switch gameType {
+ case .nes, .jaguar, .lynx, .a7800, .a5200, .a2600, .dc, .ps1, .vb, .n64, .ss, .gg, .sg1000, ._32x, .mcd, .md, .psp, .fds:
+ return dimensionValue(isLandscape ? 40 : 50, 40, 40)
+ case .flash, .pm, .gbc, .gb, ._3ds, .ds:
+ return 40
+ case .ngp, .pce, .symbian, .gba, .snes, .dos, .amiga, .c64, .doom:
+ return 30
+ case .wsc, .ws:
+ return 28
+ case .arcade:
+ return 38
+ case .ngc, .wii:
+ return dimensionValue(40, 30, 30)
+ case .ms:
+ return dimensionValue(50, 50, 40)
+ case .snes:
+ return 24
+ default:
+ return 30
+ }
+ }
+
+ private func dimensionValue(_ edgeToEdgePhoneValue: CGFloat,
+ _ standardPhoneValue: CGFloat,
+ _ PadValue: CGFloat) -> CGFloat {
+ if UIDevice.isEdgeToEdgePhone {
+ return edgeToEdgePhoneValue
+ } else if UIDevice.isPad || UIDevice.isPhoneDuo {
+ return PadValue
+ } else {
+ return standardPhoneValue
+ }
+ }
+
+ var color: UIColor {
+ if (gameType == .ds && (UIDevice.isPad || UIDevice.isPhoneDuo)) ||
+ gameType == .wii ||
+ gameType == .ngc ||
+ (gameType == .pce && !isLandscape) ||
+ gameType.usesDOSSkinLayout ||
+ gameType == .wsc ||
+ gameType == .snes {
+ return .black.withAlphaComponent(0.25)
+ } else if gameType == ._3ds && (UIDevice.isPad || UIDevice.isPhoneDuo) {
+ return UIColor(hexString: "#222222")!
+ } else {
+ return .white.withAlphaComponent(0.25)
+ }
+ }
+
+ var dualScreenSize: CGSize {
+ if UIDevice.isStandardPhone || UIDevice.isEdgeToEdgePhone {
+ if gameType == .ds {
+ return CGSize(width: 35, height: isLandscape ? 110 : 113)
+ } else if gameType == ._3ds {
+ return CGSize(width: isLandscape ? 31 : 32, height: isLandscape ? 90 : 92)
+ }
+ }
+ return .zero
+ }
+ }
+
+ private var game: Game
+
+ init(game: Game) {
+ self.game = game
+ super.init(frame: .zero)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
+ // Iterate through all subviews and check whether the click is on a subview
+ for subview in subviews.reversed() {
+ let convertedPoint = subview.convert(point, from: self)
+ if subview.bounds.contains(convertedPoint) {
+ return super.hitTest(point, with: event)
+ }
+ }
+ // Click not on any subview, return nil to let the click pass through.
+ return nil
+ }
+
+ func updateControllerSkin(_ controllerSkin: ControllerSkin,
+ beginLongPress: ((AnyInput) -> Void)? = nil,
+ endLongPress: ((AnyInput) -> Void)? = nil) {
+
+ subviews.forEach({ $0.removeFromSuperview() })
+
+ if game.isAzaharArticBase {
+ return
+ }
+
+ if let skin = Database.realm.objects(Skin.self).first(where: { $0.identifier == controllerSkin.identifier }),
+ !skin.supportShortcut {
+ return
+ }
+
+ guard let hostingWindow else { return }
+ guard let skinFrames = controllerSkin.getFrames(window: hostingWindow) else { return }
+ let skinFrame = skinFrames.skinFrame
+ let gameViewFrame = CGRect(origin: CGPoint(x: skinFrame.minX + skinFrames.mainGameViewFrame.minX, y: skinFrame.minY + skinFrames.mainGameViewFrame.minY), size: skinFrames.mainGameViewFrame.size)
+ let traits = ControllerSkin.Traits.defaults(for: hostingWindow)
+ let skinAspectRatio = controllerSkin.aspectRatio(for: traits) ?? hostingWindow.bounds.size
+ let scaleRatio = CGSize(width: skinFrame.width/skinAspectRatio.width, height: skinFrame.height/skinAspectRatio.height)
+ let interfaceStyle = InterfaceStyle(gameType: game.gameType, isLandscape: traits.orientation == .landscape)
+ let isSpecialConstraintsForDualScreen = (game.gameType == .ds || game.gameType == ._3ds) && (UIDevice.isStandardPhone || UIDevice.isEdgeToEdgePhone)
+ let commonWidth = gameViewFrame.width - interfaceStyle.offsetX*scaleRatio.width*2
+ self.snp.remakeConstraints { make in
+ if isSpecialConstraintsForDualScreen {
+ var touchscreenFrame = skinFrames.touchGameViewFrame ?? gameViewFrame
+ touchscreenFrame = CGRect(origin: CGPoint(x: skinFrame.minX + touchscreenFrame.minX, y: skinFrame.minY + touchscreenFrame.minY), size: touchscreenFrame.size)
+ if traits.orientation == .landscape {
+ make.top.equalToSuperview().offset(gameViewFrame.minY)
+ make.leading.equalToSuperview().offset(gameViewFrame.minX - interfaceStyle.dualScreenSize.width*scaleRatio.width)
+ make.width.equalTo(touchscreenFrame.maxX - gameViewFrame.minX + interfaceStyle.dualScreenSize.width*scaleRatio.width*2)
+ } else {
+ make.top.equalToSuperview().offset(gameViewFrame.maxY)
+ make.leading.equalToSuperview().offset(touchscreenFrame.minX - interfaceStyle.dualScreenSize.width*scaleRatio.width)
+ make.width.equalTo(touchscreenFrame.width + interfaceStyle.dualScreenSize.width*scaleRatio.width*2)
+ }
+ make.height.equalTo(interfaceStyle.dualScreenSize.height*scaleRatio.height)
+ } else {
+ make.top.equalToSuperview().offset((interfaceStyle.offsetY * scaleRatio.height) + gameViewFrame.maxY)
+ make.leading.equalToSuperview().offset(gameViewFrame.minX + interfaceStyle.offsetX*scaleRatio.width)
+ make.width.equalTo(commonWidth)
+ make.height.equalTo(interfaceStyle.dimension*scaleRatio.height)
+ }
+ }
+
+ var shortcuts = Prefference.defalut.getPrefference(kind: .gameShortcut,
+ storeKey: .game(gameId: game.id),
+ bestEfforts: true)?.gameShortcutValue ?? GameOption.defaultShortcutOptions(for: game)
+ let availableOptions = Set(GameOption.availableOptions(game: game, scene: .gaming))
+ shortcuts = shortcuts.filter({ availableOptions.contains($0) })
+
+ guard shortcuts.count > 0 else { return }
+ let functionButtonCount = shortcuts.count
+ for (index, shortcut) in shortcuts.enumerated() {
+ let buttonContainerView = UIView()
+ let button = ASButtonView(.iconOnlyWithSmallSize(icon: shortcut.icon.updateColorsIfNeed(colors: [interfaceStyle.color], forceUpdate: true),
+ background: .clear))
+ button.didTapButton = { [weak self] in
+ guard let self, shortcut != .rewind else { return }
+ shortcut.showSecondPromptIfNeed(continued: {
+ shortcut.performAction(with: [self.game],
+ in: self.hostingWindowScene,
+ performImmediately: true)
+ })
+ }
+ button.didLongPressButton = { state in
+ var mapping: MappingOption? = nil
+ if shortcut == .fastForward {
+ mapping = .fastForward2x
+ } else if shortcut == .rewind {
+ mapping = .rewind
+ } else {
+ mapping = MappingOption.GameOptionMappings.key(forValue: shortcut)
+ }
+ guard let mapping else { return }
+ let input = AnyInput(stringValue: mapping.rawValue,
+ intValue: 1,
+ type: .controller(.controllerSkin))
+ if state == .began {
+ beginLongPress?(input)
+ } else if state == .cancelled || state == .ended {
+ endLongPress?(input)
+ }
+ }
+ buttonContainerView.addSubview(button)
+ button.snp.makeConstraints { make in
+ make.center.equalToSuperview()
+ }
+ addSubview(buttonContainerView)
+ buttonContainerView.snp.makeConstraints { make in
+ if isSpecialConstraintsForDualScreen {
+ let width = game.gameType == .ds ? 35 : 32
+ make.width.equalTo(width)
+ make.height.equalToSuperview().dividedBy(2)
+ if index == 0 {
+ make.leading.equalToSuperview()
+ make.top.equalToSuperview()
+ } else if index == 1 {
+ make.leading.equalToSuperview()
+ make.top.equalTo(subviews[index - 1].snp.bottom)
+ } else if index == 2 {
+ make.trailing.equalToSuperview()
+ make.top.equalToSuperview()
+ } else if index == 3 {
+ make.trailing.equalToSuperview()
+ make.top.equalTo(subviews[index - 1].snp.bottom)
+ }
+ } else if (game.gameType == ._3ds || game.gameType == .ds) && (UIDevice.isPad || (UIDevice.isPhoneDuo && traits.orientation == .landscape )) {
+ let centerSpacing = 150 * scaleRatio.width
+ if index == 0 {
+ make.leading.equalToSuperview()
+ } else {
+ make.leading.equalTo(subviews[index-1].snp.trailing).offset(index == 2 ? centerSpacing : 0)
+ }
+ make.top.bottom.equalToSuperview()
+ if index == functionButtonCount-1 && functionButtonCount == R.Numbers.GameFunctionButtonCount {
+ make.trailing.equalToSuperview()
+ }
+ make.width.equalTo((commonWidth - centerSpacing)/CGFloat(R.Numbers.GameFunctionButtonCount))
+ } else {
+ if index == 0 {
+ make.leading.equalToSuperview()
+ } else {
+ make.leading.equalTo(subviews[index-1].snp.trailing)
+ }
+ make.top.bottom.equalToSuperview()
+ if index == functionButtonCount-1 && functionButtonCount == R.Numbers.GameFunctionButtonCount {
+ make.trailing.equalToSuperview()
+ }
+ make.width.equalToSuperview().dividedBy(R.Numbers.GameFunctionButtonCount)
+ }
+ }
+ }
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/ThreeDSKeyboardView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/ThreeDSKeyboardView.swift
index 52c3a3d8..11173bed 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Views/ThreeDSKeyboardView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/ThreeDSKeyboardView.swift
@@ -127,6 +127,12 @@ struct ThreeDSKeyboardView {
}
textView.becomeFirstResponder()
inputText = { textView.text }
+ textView.isFocusable = true
+ textView.onFocusConfirm = { [weak textView] in
+ textView?.becomeFirstResponder()
+ return true
+ }
+
} else {
let textField = UITextField()
@@ -157,6 +163,11 @@ struct ThreeDSKeyboardView {
submit()
}
}
+ textField.isFocusable = true
+ textField.onFocusConfirm = { [weak textField] in
+ textField?.becomeFirstResponder()
+ return true
+ }
}
let line = UIView()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Purchase/ViewControllers/PurchaseViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Purchase/ViewControllers/PurchaseViewController.swift
index dccccba9..bed43714 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Purchase/ViewControllers/PurchaseViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Purchase/ViewControllers/PurchaseViewController.swift
@@ -21,10 +21,16 @@ class PurchaseViewController: BaseViewController {
init(featuresType: FeaturesType = .advance) {
self.featuresType = featuresType
- super.init(nibName: nil, bundle: nil)
+ if UIDevice.isPhoneDuoOuter || UIDevice.isPhoneDuoSplitView {
+ super.init(fullScreen: true)
+ } else {
+ super.init(nibName: nil, bundle: nil)
+ }
//禁止下滑关闭控制器
isModalInPresentation = true
+
+
}
@MainActor required init?(coder: NSCoder) {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesCell.swift b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesCell.swift
index 35c1c727..3e9c46e3 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesCell.swift
@@ -64,14 +64,14 @@ class FeaturesCell: UICollectionViewCell {
override func layoutSubviews() {
super.layoutSubviews()
- if Device.size().rawValue < Size.screen5_8Inch.rawValue {
- if prefferedLayoutStyle == .landscape {
+ if Device.size().rawValue < Size.screen5_8Inch.rawValue || UIDevice.isPhoneDuoSplitView {
+ if preferredLayoutStyle == .landscape {
iconImageView.transform = CGAffineTransform(scaleX: 1, y: 1)
} else {
iconImageView.transform = CGAffineTransform(scaleX: 0.6, y: 0.6)
}
} else if UIDevice.isPad {
- if prefferedLayoutStyle == .landscape {
+ if preferredLayoutStyle == .landscape {
iconImageView.transform = CGAffineTransform(scaleX: 0.65, y: 0.65)
} else {
iconImageView.transform = CGAffineTransform(scaleX: 1, y: 1)
@@ -224,9 +224,9 @@ class FeaturesCell: UICollectionViewCell {
let animation = CABasicAnimation(keyPath: "position.x")
let windowSize = hostingWindow?.size ?? R.Size.ApplicationWindowSize
if UIDevice.isPad {
- offset = (prefferedLayoutStyle == .landscape ? windowSize.height * 0.9 * 9 / 16 : windowSize.width * 0.6) - iconImageView.width
+ offset = (preferredLayoutStyle == .landscape ? windowSize.height * 0.9 * 9 / 16 : windowSize.width * 0.6) - iconImageView.width
} else {
- if prefferedLayoutStyle == .landscape {
+ if preferredLayoutStyle == .landscape {
offset = windowSize.width/2 - iconImageView.width
} else {
offset = windowSize.width - iconImageView.width
diff --git a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesView.swift b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesView.swift
index 286b0c48..db9830fc 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/FeaturesView.swift
@@ -76,6 +76,11 @@ class FeaturesView: BaseView {
}
self.featuresType = nil
}
+ banner.reloadView()
+ if let collectionView = banner.subviews.first(where: { $0 is UICollectionView }) as? UICollectionView, UIDevice.isPhoneDuo {
+ collectionView.contentInsetAdjustmentBehavior = .never
+ collectionView.insetsLayoutMarginsFromSafeArea = false
+ }
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PriceView.swift b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PriceView.swift
index 7bbe7fb8..21e3fff0 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PriceView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PriceView.swift
@@ -22,6 +22,9 @@ class PriceView: BaseView {
view.isFocusable = true
view.contentInset = .insets(top: R.Size.ContentSpaceHuge,
bottom: R.Size.ContentInsetBottom(window: hostingWindow))
+ if UIDevice.isPhoneDuo {
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -73,7 +76,9 @@ class PriceView: BaseView {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { sectionIndex, env in
//item布局
let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
@@ -92,7 +97,7 @@ class PriceView: BaseView {
section.boundarySupplementaryItems.append(footerItem)
return section
- }
+ }, configuration: configuration)
return layout
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseBackgroundView.swift b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseBackgroundView.swift
new file mode 100644
index 00000000..eb2aba2b
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseBackgroundView.swift
@@ -0,0 +1,46 @@
+//
+// PurchaseBackgroundView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/17.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+/// Purchase backdrop: animated gradient with the cover image sized to this view's bounds.
+class PurchaseBackgroundView: BaseView {
+
+ private let imageLayer = CALayer()
+ private let gradientView = AnimatedGradientView(notifiedUpadate: true, alphaComponent: 0.9)
+ /// Last size the cover was rasterized for. Layout can run again without a size change.
+ private var renderedSize: CGSize = .zero
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+ gradientView.layer.insertSublayer(imageLayer, at: 0)
+ addSubview(gradientView)
+ gradientView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ guard size != .zero else { return }
+ guard bounds.width > 0, bounds.height > 0, bounds.size != renderedSize else { return }
+ renderedSize = bounds.size
+ imageLayer.frame = CGRect(origin: .zero, size: bounds.size)
+ imageLayer.contents = R.image.game_cover_bg()?.scaled(toWidth: bounds.width)?.cropped(to: bounds).cgImage
+ if UIDevice.isPhoneDuo {
+ if UIDevice.isPhoneDuoCompactWidth {
+ self.roundCorners([.topLeft, .topRight], radius: R.Size.CornerRadiusMedium)
+ } else {
+ self.roundCorners([.topLeft, .topRight], radius: 0)
+ }
+ }
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseView.swift b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseView.swift
index 1bdaebd6..a4b6111d 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Purchase/Views/PurchaseView.swift
@@ -7,7 +7,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
-class PurchaseView: BaseView {
+class PurchaseView: BaseView, ViewTransition {
///点击关闭按钮回调
var didTapClose: (()->Void)? = nil
@@ -89,12 +89,10 @@ class PurchaseView: BaseView {
return view
}()
- private let imageLayer: CALayer = CALayer()
- private lazy var backgroundGradientView: AnimatedGradientView = {
- let view = AnimatedGradientView(notifiedUpadate: true, alphaComponent: 0.9)
- view.layer.insertSublayer(imageLayer, at: 0)
- return view
- }()
+ private let backgroundGradientView = PurchaseBackgroundView()
+
+ /// Constraint set last installed. `remakeConstraints` inside `updateConstraints` always dirties constraints, so this skips unchanged passes.
+ private var appliedLayoutMode: LayoutMode?
private var featureView = FeaturesView()
@@ -110,60 +108,138 @@ class PurchaseView: BaseView {
super.init(frame: .zero)
addSubview(backgroundGradientView)
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.leading.trailing.equalTo(safeAreaLayoutGuide)
- make.top.equalToSuperview()
- make.height.equalTo(R.Size.ItemHeightMedium)
- }
+ updateNavigationViewConstraints()
addSubview(featureView)
featureView.featuresType = featuresType
addSubview(priceView)
+ setNeedsUpdateConstraints()
}
-
- override func layoutSubviews() {
- super.layoutSubviews()
- updateViewsConstraits()
- imageLayer.contents = R.image.game_cover_bg()?.scaled(toWidth: backgroundGradientView.width)?.cropped(to: backgroundGradientView.bounds).cgImage
- imageLayer.frame = CGRect(origin: .zero, size: backgroundGradientView.size)
- }
-
+
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
-
+
+ /// Window size is current here, so the following layout pass can solve the new constraints.
+ func viewAlongsideTransition() {
+ setNeedsUpdateConstraints()
+ }
+
+ override func didMoveToWindow() {
+ super.didMoveToWindow()
+ guard window != nil else { return }
+ setNeedsUpdateConstraints()
+ }
+
+ override func safeAreaInsetsDidChange() {
+ super.safeAreaInsetsDidChange()
+ setNeedsUpdateConstraints()
+ }
+
+ /// Runs before this pass solves frames, so `PurchaseBackgroundView` lays out with its final bounds.
+ override func updateConstraints() {
+ let mode = layoutMode
+ if mode != appliedLayoutMode {
+ appliedLayoutMode = mode
+ updateViewsConstraits()
+ }
+ super.updateConstraints()
+ }
+
+ private var layoutMode: LayoutMode {
+ if UIDevice.isPhone, preferredLayoutStyle == .landscape {
+ return .phoneLandscape
+ }
+ if UIDevice.isPhoneDuoCompactWidth {
+ return .duoCompact
+ }
+ return .regular
+ }
+
private func updateViewsConstraits() {
backgroundGradientView.snp.remakeConstraints { make in
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, preferredLayoutStyle == .landscape {
make.top.equalToSuperview()
make.leading.bottom.trailing.equalTo(featureView)
} else {
- make.leading.top.trailing.equalToSuperview()
- make.bottom.equalTo(featureView.snp.bottom)
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.leading.trailing.equalTo(featureView)
+ make.top.equalToSuperview()
+ } else {
+ make.leading.top.trailing.equalToSuperview()
+ }
+ make.bottom.equalTo(featureView)
}
}
featureView.snp.remakeConstraints { make in
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, preferredLayoutStyle == .landscape {
make.top.equalToSuperview().offset(R.Size.NavigationHeight)
make.leading.bottom.equalToSuperview()
make.width.equalToSuperview().dividedBy(2)
} else {
- make.leading.trailing.equalToSuperview()
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.leading.trailing.equalTo(self.safeAreaLayoutGuide)
+ } else {
+ make.leading.trailing.equalToSuperview()
+ }
make.top.equalTo(navigationView.snp.bottom)
}
}
priceView.snp.remakeConstraints { make in
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, preferredLayoutStyle == .landscape {
make.top.equalToSuperview().offset(R.Size.NavigationHeight)
- make.bottom.trailing.equalToSuperview()
+ make.bottom.equalToSuperview()
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.trailing.equalTo(safeAreaLayoutGuide)
+ } else {
+ make.trailing.equalToSuperview()
+ }
make.leading.equalTo(featureView.snp.trailing)
} else {
- make.leading.bottom.trailing.equalToSuperview()
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.trailing.equalTo(safeAreaLayoutGuide)
+ } else {
+ make.trailing.equalToSuperview()
+ }
+ make.leading.bottom.equalToSuperview()
make.top.equalTo(featureView.snp.bottom)
make.height.equalTo(447)
}
}
}
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ make.trailing.equalTo(safeAreaLayoutGuide)
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.leading.equalTo(safeAreaLayoutGuide).offset(-R.Size.ContentSpaceLarge)
+ } else {
+ make.top.equalToSuperview()
+ make.leading.equalTo(safeAreaLayoutGuide)
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
+}
+
+private extension PurchaseView {
+ enum LayoutMode: Equatable {
+ case phoneLandscape
+ case duoCompact
+ case regular
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementListView.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementListView.swift
index ee214ab6..2ab5eb43 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementListView.swift
@@ -26,7 +26,10 @@ class RetroAchievementListView: BaseView {
let blankView = BlankSlateEmptyView(image: .symbolImage(.gamecontrollerFill).applySymbolConfig(size: 70, color: R.Color.LabelSecondary), title: R.string.localizable.achievementsNotSupport(game.displayName))
blankView.label.isHidden = true
view.blankSlateView = blankView
-
+ if UIDevice.isPhoneDuo {
+ view.contentInsetAdjustmentBehavior = .never
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -67,11 +70,7 @@ class RetroAchievementListView: BaseView {
}
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
- make.leading.trailing.equalTo(safeAreaLayoutGuide)
- make.height.equalTo(R.Size.ItemHeightMedium)
- }
+ updateNavigationViewConstraints()
let gamePath = game.romUrl.path
let didShowLoading: Bool
@@ -143,7 +142,9 @@ class RetroAchievementListView: BaseView {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { sectionIndex, env in
let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1)))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(1098)), subitems: [item])
@@ -152,9 +153,39 @@ class RetroAchievementListView: BaseView {
section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
return section
- }
+ }, configuration: configuration)
return layout
}
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(safeAreaLayoutGuide)
+ }
+ make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
}
extension RetroAchievementListView: UICollectionViewDataSource {
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift
index 44eb0bf6..423c8e14 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift
@@ -245,7 +245,12 @@ class RetroAchievementsDetailView: BaseView {
addSubview(shareButton)
shareButton.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide).offset(R.Size.SheetGrabberTopInset + R.Size.ContentSpaceExtraSmall)
- make.trailing.equalTo(safeAreaLayoutGuide).offset(-R.Size.ContentSpaceMedium)
+ if UIDevice.isPhoneDuo {
+ make.trailing.equalToSuperview().offset(-R.Size.ContentSpaceMedium)
+ } else {
+ make.trailing.equalTo(safeAreaLayoutGuide).offset(-R.Size.ContentSpaceMedium)
+ }
+
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLaunchView.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLaunchView.swift
index e158061b..c08001d8 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLaunchView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLaunchView.swift
@@ -124,15 +124,7 @@ class RetroAchievementsLaunchView: BaseView {
if showClose {
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- if showClose {
- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
- } else {
- make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
- }
- make.leading.trailing.equalTo(safeAreaLayoutGuide)
- make.height.equalTo(R.Size.ItemHeightMedium)
- }
+ updateNavigationViewConstraints()
}
}
@@ -143,6 +135,40 @@ class RetroAchievementsLaunchView: BaseView {
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
+
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ if UIDevice.isPhoneDuo, showClose {
+ updateNavigationViewConstraints()
+ }
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(safeAreaLayoutGuide)
+ }
+ if showClose {
+ make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
+ } else {
+ make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
+ }
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
}
extension RetroAchievementsLaunchView: ShowableView {
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsListCell.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsListCell.swift
index af07f04b..dd34eaa3 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsListCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsListCell.swift
@@ -164,6 +164,10 @@ class RetroAchievementsListCell: UICollectionViewCell {
view.dataSource = self
view.delegate = self
view.isFocusable = true
+ if UIDevice.isPhoneDuo {
+ view.contentInsetAdjustmentBehavior = .never
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -192,12 +196,14 @@ class RetroAchievementsListCell: UICollectionViewCell {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { [weak self] sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { [weak self] sectionIndex, env in
guard let self else { return nil }
var column = 4.0
- if UIDevice.isPhone && self.prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone && self.preferredLayoutStyle == .landscape {
column = 8.0
- } else if UIDevice.isPad && self.prefferedLayoutStyle == .landscape {
+ } else if UIDevice.isPad && self.preferredLayoutStyle == .landscape {
column = 6.0
}
let cellSize = (env.container.contentSize.width - R.Size.ContentSpaceHuge*2 - R.Size.ContentSpaceSmall*(column-1))/column
@@ -210,7 +216,7 @@ class RetroAchievementsListCell: UICollectionViewCell {
section.interGroupSpacing = R.Size.ContentSpaceSmall
section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 24, bottom: 24, trailing: 24)
return section
- }
+ }, configuration: configuration)
return layout
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLoginView.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLoginView.swift
index cfdb557f..34a5de8d 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLoginView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsLoginView.swift
@@ -81,6 +81,10 @@ class RetroAchievementsLoginView: BaseView {
view.isFocusable = true
view.contentInset = .insets(top: 90,
bottom: R.Size.ContentInsetBottom(window: hostingWindow))
+ if UIDevice.isPhoneDuo {
+ view.contentInsetAdjustmentBehavior = .never
+ view.insetsLayoutMarginsFromSafeArea = false
+ }
return view
}()
@@ -117,7 +121,9 @@ class RetroAchievementsLoginView: BaseView {
}
private func createLayout() -> UICollectionViewLayout {
- let layout = UICollectionViewCompositionalLayout { sectionIndex, env in
+ let configuration = UICollectionViewCompositionalLayoutConfiguration()
+ configuration.contentInsetsReference = UIDevice.isPhoneDuo ? .none : .safeArea
+ let layout = UICollectionViewCompositionalLayout(sectionProvider: { sectionIndex, env in
//item布局
let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1)))
@@ -139,7 +145,7 @@ class RetroAchievementsLoginView: BaseView {
section.boundarySupplementaryItems.append(footerItem)
return section
- }
+ }, configuration: configuration)
return layout
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsProfileView.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsProfileView.swift
index c0b14507..cdc73811 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsProfileView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsProfileView.swift
@@ -329,7 +329,7 @@ class RetroAchievementsProfileView: BaseView {
}
view.didLayoutChange = { [weak self] in
guard let self else { return false }
- return self.prefferedLandscapeStyle
+ return self.preferredLandscapeStyle
}
return view
}()
@@ -387,16 +387,16 @@ class RetroAchievementsProfileView: BaseView {
private var retroProfile = AchievementsProfile()
private var detailViewHeight: CGFloat {
- prefferedLandscapeStyle ? 327 : 496.7
+ preferredLandscapeStyle ? 327 : 496.7
}
var logoutSuccess: (()->Void)? = nil
private var showAsSheet: Bool
- private var prefferedLandscapeStyle: Bool {
+ private var preferredLandscapeStyle: Bool {
if showAsSheet {
- return prefferedLayoutStyle == .landscape
+ return preferredLayoutStyle == .landscape
} else {
return width > 600
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/ViewControllers/SettingsViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/ViewControllers/SettingsViewController.swift
index 2d720df9..5b9107be 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/ViewControllers/SettingsViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/ViewControllers/SettingsViewController.swift
@@ -32,7 +32,7 @@ class SettingsViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
- if UIDevice.isPhone {
+ if UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen {
view.addSubview(settingsListView)
settingsListView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
@@ -42,6 +42,29 @@ class SettingsViewController: BaseViewController {
view.addSubview(settingsListView)
view.backgroundColor = UIColor(.dm, light: .white, dark: .black)
settingsListView.backgroundColor = R.Color.BackgroundPrimary
+ setupDetailContent()
+ }
+ }
+
+ override func viewDidLayoutSubviews() {
+ super.viewDidLayoutSubviews()
+ if (UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen), hostingWindow != nil {
+ updateViewsForLargeScreen()
+ } else if UIDevice.isPhoneDuo {
+ removeMultiColumnViews()
+ settingsListView.snp.remakeConstraints { make in
+ make.top.bottom.equalToSuperview()
+ if UIDevice.isPhoneDuoCompactWidth {
+ make.leading.trailing.equalTo(view.safeAreaLayoutGuide)
+ } else {
+ make.leading.trailing.equalToSuperview()
+ }
+ }
+ }
+ }
+
+ private func setupDetailContent() {
+ if settingsListView.didTapDetailView == nil {
settingsListView.didTapDetailView = { [weak self] view in
guard let self = self else { return }
self.detailContentView.subviews.forEach { $0.removeFromSuperview() }
@@ -50,7 +73,9 @@ class SettingsViewController: BaseViewController {
make.edges.equalToSuperview()
}
}
-
+ }
+
+ if detailContentView.subviews.count == 0 {
let themeView = ThemeSettingView(showClose: false)
detailContentView.addSubview(themeView)
themeView.snp.makeConstraints { make in
@@ -59,17 +84,10 @@ class SettingsViewController: BaseViewController {
}
}
- override func viewDidLayoutSubviews() {
- super.viewDidLayoutSubviews()
- if UIDevice.isPad, hostingWindow != nil {
- updateViewsForIpad()
- }
- }
-
- private func updateViewsForIpad() {
- guard UIDevice.isPad else { return }
+ private func updateViewsForLargeScreen() {
+ guard UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen else { return }
guard let hostingWindow else { return }
- if view.isWindowHasEnoughSpaceforIpadMultiColumnLayout {
+ if view.isWindowHasEnoughSpaceforIpadMultiColumnLayout || UIDevice.isPhoneDuoInnerFullScreen {
let sideMenuWidth = R.Size.SideMenuWidth(window: hostingWindow)*1.2
settingsListView.snp.remakeConstraints { make in
make.leading.top.bottom.equalToSuperview()
@@ -80,10 +98,12 @@ class SettingsViewController: BaseViewController {
}
}
- cornerMaskViewForiPad.removeFromSuperview()
- view.addSubview(cornerMaskViewForiPad)
- cornerMaskViewForiPad.snp.remakeConstraints { make in
- make.edges.equalTo(settingsListView)
+ if UIDevice.isPad {
+ cornerMaskViewForiPad.removeFromSuperview()
+ view.addSubview(cornerMaskViewForiPad)
+ cornerMaskViewForiPad.snp.remakeConstraints { make in
+ make.edges.equalTo(settingsListView)
+ }
}
detailContentView.removeFromSuperview()
@@ -93,19 +113,34 @@ class SettingsViewController: BaseViewController {
make.leading.equalTo(settingsListView.snp.trailing).offset(R.Size.ContentSpaceMedium)
}
- detailMaskViewForiPad.removeFromSuperview()
- view.addSubview(detailMaskViewForiPad)
- detailMaskViewForiPad.snp.remakeConstraints { make in
- make.edges.equalTo(detailContentView)
+ if UIDevice.isPad {
+ detailMaskViewForiPad.removeFromSuperview()
+ view.addSubview(detailMaskViewForiPad)
+ detailMaskViewForiPad.snp.remakeConstraints { make in
+ make.edges.equalTo(detailContentView)
+ }
+ }
+
+ if UIDevice.isPhoneDuoInnerFullScreen {
+ detailContentView.backgroundColor = .clear
+ settingsListView.backgroundColor = .clear
+ setupDetailContent()
}
} else {
settingsListView.snp.remakeConstraints { make in
make.top.bottom.equalToSuperview()
make.leading.trailing.equalTo(view.safeAreaLayoutGuide)
}
- cornerMaskViewForiPad.removeFromSuperview()
- detailContentView.removeFromSuperview()
- detailMaskViewForiPad.removeFromSuperview()
+ removeMultiColumnViews()
}
}
+
+ private func removeMultiColumnViews() {
+ cornerMaskViewForiPad.removeFromSuperview()
+ detailContentView.removeFromSuperview()
+ detailMaskViewForiPad.removeFromSuperview()
+
+ detailContentView.backgroundColor = R.Color.BackgroundPrimary
+ settingsListView.backgroundColor = UIDevice.isPhoneDuo ? .clear : R.Color.BackgroundPrimary
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/BIOSSelectionView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/BIOSSelectionView.swift
index bdc42563..a9c76ed1 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/BIOSSelectionView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/BIOSSelectionView.swift
@@ -165,12 +165,10 @@ class BIOSSelectionView: BaseView {
titleIcon: .symbolImage(R.image.bios_iconSymbols()))
navigation.enableClose = showClose
- let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0
-
return ASListPage(navigation: navigation,
sections: sections,
backgroundColor: .clear,
- listInsets: .insets(bottom: listInsetBottom),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop(window: hostingWindow)))
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ColorPickerView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ColorPickerView.swift
index c4e12f7d..2a3af760 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ColorPickerView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ColorPickerView.swift
@@ -11,7 +11,7 @@ import ChromaColorPicker
class ColorPickerView: BaseView {
private var colorPickerSize: CGSize {
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if UIDevice.isPhone, preferredLayoutStyle == .landscape {
return CGSize(150)
}
return CGSize(290)
@@ -19,12 +19,17 @@ class ColorPickerView: BaseView {
private let colorPicker = ChromaColorPicker(frame: CGRect(origin: .zero, size: CGSize(290)))
private let brightnessSlider = ChromaBrightnessSlider()
private let colorView = ThemeColorCollectionViewCell.ColorView()
- private var textField: UITextField = {
+ private lazy var textField: UITextField = {
let view = UITextField()
view.textColor = R.Color.LabelPrimary
view.font = R.Font.Body()
view.clearButtonMode = .whileEditing
view.attributedPlaceholder = NSAttributedString(string: R.Color.Main.hexString, attributes: [.font: R.Font.Body(), .foregroundColor: R.Color.LabelSecondary])
+ view.isFocusable = true
+ view.onFocusConfirm = { [weak self] in
+ self?.textField.becomeFirstResponder()
+ return true
+ }
return view
}()
private var addButton: ASButtonView = {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GlobalCoreSwitchView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GlobalCoreSwitchView.swift
index 13c4b6dc..33341a3a 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GlobalCoreSwitchView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GlobalCoreSwitchView.swift
@@ -30,7 +30,7 @@ class GlobalCoreSwitchView: BaseView {
let view = ASListPageView(ASListPage(navigation: navigation,
sections: sections,
backgroundColor: .clear,
- listInsets: .insets(bottom: UIDevice.isPad ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge : R.Size.ContentInsetBottom(window: hostingWindow)),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop(window: hostingWindow))))
view.didActionOccurred = { [weak self] listAction in
guard let self else { return }
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift
index 2bf7209d..06589e64 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/JITSettingView.swift
@@ -268,12 +268,11 @@ class JITSettingView: BaseView {
]
#endif
- let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0
return ASListPage(
navigation: navigation,
sections: sections,
backgroundColor: .clear,
- listInsets: .insets(bottom: listInsetBottom),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop(window: hostingWindow)))
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift
index 17ab9b6c..7b835263 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsListView.swift
@@ -169,7 +169,7 @@ class SettingsListView: BaseView {
}
private func getNavigation() -> ASListPage.Navigation? {
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if (UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen), preferredLayoutStyle == .landscape {
return nil
}
var navigationText = ASText.extraLargeText(R.string.localizable.tabbarTitleSettings())
@@ -187,7 +187,7 @@ class SettingsListView: BaseView {
case .top:
sections.append(ASListPage.Section(cells: [.custom(topView)],
decoration: .init(enable: false),
- itemLayout: .fixedHeight((UIDevice.isPhone && prefferedLayoutStyle == .landscape) ? 165 : 301)))
+ itemLayout: .fixedHeight(((UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen) && preferredLayoutStyle == .landscape) ? 165 : 301)))
case .general, .advance, .support, .others:
var header: ASListPage.Supplementary? = nil
@@ -211,13 +211,12 @@ class SettingsListView: BaseView {
let listBottomInset = R.Size.ContentSpaceLarge + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge
let pageTopInset: CGFloat
- pageTopInset = UIDevice.isPhone && prefferedLayoutStyle == .landscape ? 0 : R.Size.ContentInsetTop(window: hostingWindow)
+ pageTopInset = (UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen) && preferredLayoutStyle == .landscape ? 0 : R.Size.ContentInsetTop(window: hostingWindow)
return ASListPage(navigation: getNavigation(),
sections: sections,
backgroundColor: .clear,
listInsets: .insets(bottom: listBottomInset),
- pageInsets: .insets(top: pageTopInset),
- enableSafeAreaBottomInsets: true)
+ pageInsets: .insets(top: pageTopInset))
}
private func showMemberShip(featuresType: FeaturesType = .advance) {
@@ -271,7 +270,7 @@ class SettingsListView: BaseView {
case .general, .advance, .support, .others:
if let item = items[sectionIndex]?[indexPath.row] {
- guard let hostingWindow else { return }
+ guard let _ = hostingWindow else { return }
switch item.type {
case .retro:
if isWindowHasEnoughSpaceforIpadMultiColumnLayout {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsTopView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsTopView.swift
index 0f63f156..5fc0ac73 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsTopView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/SettingsTopView.swift
@@ -21,7 +21,7 @@ class SettingsTopView: BaseView {
}
func updateViewsConstraints() {
- if UIDevice.isPhone, prefferedLayoutStyle == .landscape {
+ if (UIDevice.isPhone && !UIDevice.isPhoneDuoInnerFullScreen), preferredLayoutStyle == .landscape {
membershipView.snp.remakeConstraints { make in
make.leading.top.bottom.equalToSuperview()
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift
index 68868ab9..84c6279c 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift
@@ -67,7 +67,7 @@ class ThemeSettingView: BaseView {
view.dragDelegate = self
view.dropDelegate = self
view.contentInset = .insets(top: R.Size.ContentSpaceSmall,
- bottom: UIDevice.isPad ? (R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge) : R.Size.ContentInsetBottom(window: hostingWindow))
+ bottom: ((UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen) && !showClose) ? (R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceLarge) : R.Size.ContentInsetBottom(window: hostingWindow))
return view
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/iCloudSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/iCloudSettingView.swift
index f2c79226..e683faf4 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/iCloudSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/iCloudSettingView.swift
@@ -100,11 +100,10 @@ class ICloudSettingView: BaseView {
], footer: .texts([.smallText(R.string.localizable.iCloudRepairSyncDesc(), numberOfLines: 0)], pin: false)))
}
- let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0
return ASListPage(navigation: navigation,
sections: sections,
backgroundColor: .clear,
- listInsets: .insets(bottom: listInsetBottom),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop(window: hostingWindow)))
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderLIstView.swift b/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderLIstView.swift
index 59b568a5..caac93a6 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderLIstView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderLIstView.swift
@@ -307,15 +307,7 @@ class ShaderListView: BaseView {
}
addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- if showClose {
- make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
- } else {
- make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
- }
- make.leading.trailing.equalTo(safeAreaLayoutGuide)
- make.height.equalTo(R.Size.NavigationHeight)
- }
+ updateNavigationViewConstraints()
addSubview(listPageView)
@@ -355,6 +347,34 @@ class ShaderListView: BaseView {
override func layoutSubviews() {
super.layoutSubviews()
updateViewsContraits()
+ updateNavigationViewConstraints()
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.leading.trailing.equalTo(safeAreaLayoutGuide)
+ }
+ if showClose {
+ make.top.equalToSuperview().offset(R.Size.SheetGrabberTopInset)
+ } else {
+ make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
+ }
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
}
private func handleAction(_ action: ASListPage.Action) {
@@ -789,7 +809,7 @@ class ShaderListView: BaseView {
}
private func getTop() -> (UIView, ASViewLayout, Bool) {
- return (topView, .fixedHeight(prefferedLayoutStyle == .landscape && showClose ? 116 : 318), true)
+ return (topView, .fixedHeight(preferredLayoutStyle == .landscape && showClose ? 116 : 318), true)
}
private func getCell(shader: Shader, isSelected: Bool) -> ASListPage.Cell {
@@ -884,12 +904,10 @@ class ShaderListView: BaseView {
}
private func getListPage() -> ASListPage {
- let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0
-
return ASListPage(top: getTop(),
sections: getSections(),
blankSlate: getBlankSlate(),
- listInsets: .insets(bottom: listInsetBottom),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
enableLongPress: true)
}
@@ -972,12 +990,17 @@ class ShaderListView: BaseView {
private func updateViewsContraits() {
previewView.removeFromSuperview()
- if prefferedLayoutStyle == .landscape, showClose {
+ if preferredLayoutStyle == .landscape, showClose {
addSubview(previewView)
previewView.snp.remakeConstraints { make in
make.top.equalTo(navigationView.snp.bottom)
- make.leading.equalTo(navigationView)
- make.bottom.equalTo(safeAreaLayoutGuide)
+ make.leading.equalToSuperview().inset(R.Size.ContentSpaceMedium)
+ if UIDevice.isPhoneDuo {
+ make.bottom.equalToSuperview()
+ } else {
+ make.bottom.equalTo(safeAreaLayoutGuide)
+ }
+
}
listPageView.top = getTop()
@@ -985,7 +1008,11 @@ class ShaderListView: BaseView {
make.top.equalTo(navigationView.snp.bottom)
make.leading.equalTo(previewView.snp.trailing)
make.width.equalTo(previewView)
- make.trailing.equalTo(safeAreaLayoutGuide)
+ if UIDevice.isPhoneDuo {
+ make.trailing.equalToSuperview()
+ } else {
+ make.trailing.equalTo(safeAreaLayoutGuide)
+ }
make.bottom.equalToSuperview()
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderPreviewView.swift b/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderPreviewView.swift
index 49019ae1..c768aef4 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderPreviewView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Shaders/Views/ShaderPreviewView.swift
@@ -58,15 +58,6 @@ class ShaderPreviewView: RoundAndBorderView {
}
addSubview(imageView)
- imageView.snp.makeConstraints { make in
- make.center.equalToSuperview()
- make.width.equalTo(imageView.snp.height).multipliedBy(self.dimensions.width/self.dimensions.height)
- if self.dimensions.width >= self.dimensions.height {
- make.top.bottom.equalToSuperview().inset(R.Size.ContentSpaceMedium)
- } else {
- make.leading.trailing.equalToSuperview().inset(R.Size.ContentSpaceMedium)
- }
- }
addSubview(changeImageButton)
changeImageButton.snp.makeConstraints { make in
@@ -76,6 +67,19 @@ class ShaderPreviewView: RoundAndBorderView {
updatePreview()
}
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ imageView.snp.remakeConstraints { make in
+ make.center.equalToSuperview()
+ make.width.equalTo(imageView.snp.height).multipliedBy(self.dimensions.width/self.dimensions.height)
+ if size.IsRelativelyWideRectangle {
+ make.top.bottom.equalToSuperview().inset(R.Size.ContentSpaceMedium)
+ } else {
+ make.leading.trailing.equalToSuperview().inset(R.Size.ContentSpaceMedium)
+ }
+ }
+ }
+
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/FlexSkinSettingViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/FlexSkinSettingViewController.swift
index 22641bf9..2b55c006 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/FlexSkinSettingViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/FlexSkinSettingViewController.swift
@@ -168,58 +168,63 @@ class FlexSkinSettingViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .black
-
- view.addSubview(backgroundImageView)
- backgroundImageView.snp.makeConstraints { make in
- make.edges.equalToSuperview()
- }
-
- if let controllerSkin = controlView.controllerSkin as? ControllerSkin,
- let hostingWindow,
- let frames = controllerSkin.getFrames(window: hostingWindow) {
+ }
+
+ private var hasInit = false
+
+ override func viewDidLayoutSubviews() {
+ super.viewDidLayoutSubviews()
+ if !hasInit {
+ hasInit = true
+ view.addSubview(backgroundImageView)
+ backgroundImageView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
- if let screens = controllerSkin.screens(for: traits) {
- for (index, screen) in screens.enumerated() {
- if let outputFrame = screen.outputFrame {
- let scaledFrame = outputFrame.applying(.init(scaleX: frames.skinFrame.width, y: frames.skinFrame.height))
- let view = createInteractiveScreenView(frame: scaledFrame, image: index < images.count ? images[index] : nil)
- screensViews.append(view)
- initFrames.append(scaledFrame)
- initScreens.append(screen)
+ if let controllerSkin = controlView.controllerSkin as? ControllerSkin,
+ let hostingWindow,
+ let frames = controllerSkin.getFrames(window: hostingWindow) {
+
+ if let screens = controllerSkin.screens(for: traits) {
+ for (index, screen) in screens.enumerated() {
+ if let outputFrame = screen.outputFrame {
+ let scaledFrame = outputFrame.applying(.init(scaleX: frames.skinFrame.width, y: frames.skinFrame.height))
+ let view = createInteractiveScreenView(frame: scaledFrame, image: index < images.count ? images[index] : nil)
+ screensViews.append(view)
+ initFrames.append(scaledFrame)
+ initScreens.append(screen)
+ }
}
+
+ screensContainerView.frame = frames.skinFrame
+ view.addSubview(screensContainerView)
+ screensViews.forEach { screensContainerView.addSubview($0) }
+ }
+
+ view.addSubview(controlView)
+ controlView.snp.makeConstraints { make in
+ make.center.equalToSuperview()
+ make.size.equalTo(frames.skinFrame.size)
}
- screensContainerView.frame = frames.skinFrame
- view.addSubview(screensContainerView)
- screensViews.forEach { screensContainerView.addSubview($0) }
+ if let items = controllerSkin.items(for: traits) {
+ buttonsContainerView.frame = frames.skinFrame
+ buttonsContainerView.alpha = 0.2
+ buttonsContainerView.isUserInteractionEnabled = false
+ view.addSubview(buttonsContainerView)
+ setupItemViews(controllerSkin: controllerSkin, items: items)
+ }
}
- view.addSubview(controlView)
- controlView.snp.makeConstraints { make in
- make.center.equalToSuperview()
- make.size.equalTo(frames.skinFrame.size)
+ view.addSubview(crosshairGuideView)
+ crosshairGuideView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
}
- if let items = controllerSkin.items(for: traits) {
- buttonsContainerView.frame = frames.skinFrame
- buttonsContainerView.alpha = 0.2
- buttonsContainerView.isUserInteractionEnabled = false
- view.addSubview(buttonsContainerView)
- setupItemViews(controllerSkin: controllerSkin, items: items)
- }
- }
-
- view.addSubview(crosshairGuideView)
- crosshairGuideView.snp.makeConstraints { make in
- make.edges.equalToSuperview()
- }
-
- view.addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(R.Size.ContentSpaceMedium)
- make.top.equalTo(view.safeAreaLayoutGuide)
- make.height.equalTo(R.Size.NavigationHeight)
+ view.addSubview(navigationView)
+
}
+ updateNavigationViewConstraints()
}
override func viewDidDisappear(_ animated: Bool) {
@@ -228,6 +233,41 @@ class FlexSkinSettingViewController: BaseViewController {
didCompletion?(isModified)
}
+ override var prefersStatusBarHidden: Bool {
+ if UIDevice.isPhoneDuo {
+ return true
+ }
+ return super.prefersStatusBarHidden
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.trailing.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.trailing.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.trailing.equalToSuperview().inset(R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview()
+ } else {
+ if view.preferredLayoutStyle == .landscape {
+ make.centerX.equalToSuperview()
+ make.width.equalToSuperview().dividedBy(2)
+ } else {
+ make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(R.Size.ContentSpaceMedium)
+ }
+ make.top.equalTo(view.safeAreaLayoutGuide)
+ }
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
+
private func updatedTopViewVisual(toneDown: Bool) {
navigationView.alpha = toneDown ? 0.2 : 1.0
}
@@ -946,12 +986,15 @@ extension FlexSkinSettingViewController {
guard let handle = gesture.view,
let gameView = handle.superview else { return }
+ // Edge resize assigns frame. Bake a leftover pinch scale first so that write cannot inflate bounds.
+ bakeScreenTransform(into: gameView)
+
updatedTopViewVisual(toneDown: true)
let translation = gesture.translation(in: self.view)
var newFrame = gameView.frame
- // 根据手柄tag确定调整哪个边
+ // Which edge this handle adjusts.
switch handle.tag {
case 1: // top
let newHeight = newFrame.height - translation.y
@@ -989,12 +1032,19 @@ extension FlexSkinSettingViewController {
gesture.setTranslation(.zero, in: self.view)
if gesture.state == .ended {
- // 执行优化
optimizeScale(for: gameView)
updatedTopViewVisual(toneDown: false)
}
}
+ /// Folds the pinch scale into bounds and clears `transform` before a `frame` write, so fixed-size edge handles are not shrunk.
+ private func bakeScreenTransform(into view: UIView) {
+ guard view.transform != .identity else { return }
+ let bakedFrame = view.frame
+ view.transform = .identity
+ view.frame = bakedFrame
+ }
+
// MARK: - 优化缩放(限制最大尺寸不超出屏幕)
private func optimizeScale(for view: UIView) {
let currentFrame = view.frame
@@ -1009,7 +1059,10 @@ extension FlexSkinSettingViewController {
let edgeMinY = UIScreen.main.bounds.minY - screensContainerView.frame.minY
let edgeMaxY = UIScreen.main.bounds.height - screensContainerView.frame.maxY
- // 保证位置在屏幕范围内
+ // Bake before this frame write. Pinch and the fit animation below both leave the scale in `transform`.
+ bakeScreenTransform(into: view)
+
+ // Keep the view inside the screen.
var newFrame = view.frame
var newOrigin = newFrame.origin
@@ -1035,22 +1088,15 @@ extension FlexSkinSettingViewController {
let maxWidth = UIScreen.main.bounds.width
let maxHeight = UIScreen.main.bounds.height
- // 如果视图超出屏幕边界,需要缩小
+ // Shrink to fit the screen, using the smaller axis so neither side overflows.
if currentFrame.width > maxWidth || currentFrame.height > maxHeight {
- // 计算需要缩放到屏幕宽度和高度的比例
let widthScale = maxWidth / currentFrame.width
let heightScale = maxHeight / currentFrame.height
-
- // 取较小的比例,确保视图不会超出任何一边
let scale = min(widthScale, heightScale)
-
- // 计算目标尺寸
let targetSize = CGSize(
width: currentFrame.width * scale,
height: currentFrame.height * scale
)
-
- // 计算相对于当前frame的缩放比例
let scaleX = targetSize.width / currentFrame.width
let scaleY = targetSize.height / currentFrame.height
diff --git a/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/SkinPreviewViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/SkinPreviewViewController.swift
index d4a4208b..7e9757d0 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/SkinPreviewViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Skin/ViewControllers/SkinPreviewViewController.swift
@@ -36,12 +36,11 @@ class SkinPreviewViewController: BaseViewController {
view.addSubview(controlView)
var needToRotate = false
- let isLandscapeLayoutIPad = UIDevice.isPad && ((UIDevice.isFullScreenIPad(window: window) && UIDevice.isLandscape) || window.size.IsRelativelyWideRectangle)
if UIDevice.isPhone || UIDevice.isFullScreenIPad(window: window) {
- if traits.orientation == .portrait && UIDevice.isLandscape {
+ if traits.orientation == .portrait && window.size.IsRelativelyWideRectangle {
needToRotate = true
- } else if traits.orientation == .landscape && UIDevice.isPortrait {
+ } else if traits.orientation == .landscape && !window.size.IsRelativelyWideRectangle {
needToRotate = true
}
}
@@ -70,8 +69,17 @@ class SkinPreviewViewController: BaseViewController {
self?.dismiss(animated: true)
}
closeButtonView.snp.makeConstraints { make in
- make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
- make.trailing.equalToSuperview().offset(-R.Size.ContentSpaceLarge)
+ if UIDevice.isPhoneDuoOuter {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.ContentSpaceExtraSmall)/2)
+ } else {
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview().offset(-(UIDevice.isPortrait ? R.Size.iPhoneDuoSafeAreaSize : R.Size.iPhoneDuoOuterCameraEdge))
+ } else {
+ make.top.equalToSuperview().offset(UIDevice.isPhoneDuoSplitView ? R.Size.ContentSpaceLarge : R.Size.ContentInsetTop(window: hostingWindow))
+ make.trailing.equalToSuperview().offset(-R.Size.ContentSpaceLarge)
+ }
}
}
@@ -107,6 +115,13 @@ class SkinPreviewViewController: BaseViewController {
super.viewWillDisappear(animated)
AppDelegate.orientation = R.Config.DefaultOrientation
}
+
+ override var prefersStatusBarHidden: Bool {
+ if UIDevice.isPhoneDuo {
+ return true
+ }
+ return super.prefersStatusBarHidden
+ }
}
extension SkinPreviewViewController: GameControllerReceiver {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift b/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift
index 362f109f..ef877bb4 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift
@@ -53,16 +53,19 @@ class SkinSettingsView: BaseView {
private var isPortraitSkinPage: Bool {
segmentView.segment.index == 0
}
- private let defaultTraits: ControllerSkin.Traits = ControllerSkin.Traits.defaults(for: UIWindow.applicationWindow ?? UIWindow(frame: .init(origin: .zero, size: R.Size.ApplicationWindowSize)))
- private var currentTraits: ControllerSkin.Traits {
- isPortraitSkinPage ? portraitTraits : landscapeTraits
+ private let defaultTraits = ControllerSkin.Traits.defaults(for: UIWindow.applicationWindow ?? UIWindow(frame: .init(origin: .zero, size: R.Size.ApplicationWindowSize)))
+
+ private var defaultPortraitTraits: ControllerSkin.Traits {
+ var t = defaultTraits
+ t.orientation = .portrait
+ return t
+ }
+
+ private var defaultLandscapeTraits: ControllerSkin.Traits {
+ var t = defaultTraits
+ t.orientation = .landscape
+ return t
}
- private lazy var portraitTraits: ControllerSkin.Traits = {
- ControllerSkin.Traits(device: self.defaultTraits.device, displayType: self.defaultTraits.displayType, orientation: .portrait)
- }()
- private lazy var landscapeTraits: ControllerSkin.Traits = {
- ControllerSkin.Traits(device: self.defaultTraits.device, displayType: self.defaultTraits.displayType, orientation: .landscape)
- }()
private var skinsUpdateToken: NotificationToken? = nil
@@ -107,7 +110,7 @@ class SkinSettingsView: BaseView {
private var skinRenderGeneration = 0
private var collectionViewContentInsetBottom: CGFloat {
- R.Size.ContentInsetBottom(window: hostingWindow) + ((UIDevice.isPad && !showClose) ? R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0)
+ R.Size.ContentInsetBottom(window: hostingWindow) + (((UIDevice.isPad || UIDevice.isPhoneDuoInnerFullScreen) && !showClose) ? R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0)
}
private lazy var navigation: ASListPage.Navigation = {
@@ -365,7 +368,7 @@ class SkinSettingsView: BaseView {
flexSkin.isFlexSkin {
//flex edit
let vc = FlexSkinSettingViewController(skin: flexSkin,
- traits: self.currentTraits,
+ traits: self.currentTraits(for: flexSkin),
images: [],
gameId: self.currentGames.count == 1 ? self.currentGames.first!.id : nil,
gameType: self.gameType)
@@ -494,7 +497,7 @@ class SkinSettingsView: BaseView {
guard let self else { return nil }
var column: CGFloat = self.isPortraitSkinPage ? 2.0 : 1.0
- if UIDevice.isPad, self.prefferedLayoutStyle == .landscape {
+ if UIDevice.isPad, self.preferredLayoutStyle == .landscape {
column = self.isPortraitSkinPage ? 3.0 : 2.0
}
@@ -502,7 +505,11 @@ class SkinSettingsView: BaseView {
let screenRation: CGFloat
if let screen = self.hostingWindow?.screen {
- screenRation = screen.bounds.size.maxDimension/screen.bounds.size.minDimension
+ if UIDevice.isPhoneDuo {
+ screenRation = 4/3
+ } else {
+ screenRation = screen.bounds.size.maxDimension/screen.bounds.size.minDimension
+ }
} else {
screenRation = R.Size.ApplicationWindowSize.maxDimension/R.Size.ApplicationWindowSize.minDimension
}
@@ -589,12 +596,25 @@ class SkinSettingsView: BaseView {
if skin.skinType == .playcase {
controllerSkin.isPlayCase = true
skin.controllerSkin = controllerSkin
- }
- if controllerSkin.supports(portraitTraits) {
- portraitSkins.append(skin)
- }
- if controllerSkin.supports(landscapeTraits) {
- landscapeSkins.append(skin)
+ if controllerSkin.supports(defaultPortraitTraits) {
+ skin.previewPortraitTraits = defaultPortraitTraits
+ portraitSkins.append(skin)
+ }
+
+ if controllerSkin.supports(defaultLandscapeTraits) {
+ skin.previewLandscapeTraits = defaultLandscapeTraits
+ landscapeSkins.append(skin)
+ }
+ } else {
+ if let traits = controllerSkin.supportedTraits(for: defaultPortraitTraits) {
+ skin.previewPortraitTraits = traits
+ portraitSkins.append(skin)
+ }
+
+ if let traits = controllerSkin.supportedTraits(for: defaultLandscapeTraits) {
+ skin.previewLandscapeTraits = traits
+ landscapeSkins.append(skin)
+ }
}
}
}
@@ -683,8 +703,8 @@ class SkinSettingsView: BaseView {
var unsupportSkinNames: String = ""
for skin in skins {
if let controllerSkin = ControllerSkin(fileURL: skin.fileURL) {
- if !controllerSkin.supports(landscapeTraits) &&
- !controllerSkin.supports(portraitTraits) {
+ if controllerSkin.supportedTraits(for: defaultPortraitTraits) == nil &&
+ controllerSkin.supportedTraits(for: defaultLandscapeTraits) == nil {
//获取不支持当前设备的皮肤
unsupportSkins.append(skin)
unsupportSkinNames.append(controllerSkin.name + "\n")
@@ -750,6 +770,14 @@ class SkinSettingsView: BaseView {
}
return false
}
+
+ private func currentTraits(for skin: Skin) -> ControllerSkin.Traits {
+ if isPortraitSkinPage {
+ return skin.previewPortraitTraits ?? defaultPortraitTraits
+ } else {
+ return skin.previewLandscapeTraits ?? defaultLandscapeTraits
+ }
+ }
}
extension SkinSettingsView: UICollectionViewDataSource {
@@ -763,7 +791,7 @@ extension SkinSettingsView: UICollectionViewDataSource {
} else {
let cell = collectionView.dequeueReusableCell(withClass: SkinCollectionViewCell.self, for: indexPath)
let skin = currentSkins[indexPath.row]
- let traits = currentTraits
+ let traits = currentTraits(for: skin)
var isUsing: Bool = false
if let currentUsingIndex, currentUsingIndex == indexPath.row {
isUsing = true
diff --git a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/ViewControllers/TriggerProPreviewController.swift b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/ViewControllers/TriggerProPreviewController.swift
index a149a385..501dc078 100644
--- a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/ViewControllers/TriggerProPreviewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/ViewControllers/TriggerProPreviewController.swift
@@ -89,6 +89,7 @@ class TriggerProPreviewController: BaseViewController {
private lazy var addButton: UIView = {
let view = UIView()
view.enablePressEffect = true
+ view.enableFocusEffects = false
let iconContainerView = RoundAndBorderView(roundCorner: .allCorners, radius: R.Size.CornerRadiusMedium)
iconContainerView.backgroundColor = R.Color.BackgroundPrimary
view.addSubview(iconContainerView)
@@ -144,6 +145,11 @@ class TriggerProPreviewController: BaseViewController {
}
view.attributedPlaceholder = NSAttributedString(string: trigger.defaultName, attributes: [.font: R.Font.Body(), .foregroundColor: R.Color.LabelTertiary])
view .returnKeyType = .done
+ view.isFocusable = true
+ view.onFocusConfirm = { [weak self] in
+ self?.titleTextField.becomeFirstResponder()
+ return true
+ }
return view
}()
@@ -212,9 +218,9 @@ class TriggerProPreviewController: BaseViewController {
view.addSubview(controlView)
var needToRotate = false
- if traits.orientation == .portrait && (UIDevice.currentOrientation == .landscapeLeft || UIDevice.currentOrientation == .landscapeRight) {
+ if traits.orientation == .portrait && window.size.IsRelativelyWideRectangle {
needToRotate = true
- } else if traits.orientation == .landscape && (UIDevice.currentOrientation == .portrait || UIDevice.currentOrientation == .portraitUpsideDown) {
+ } else if traits.orientation == .landscape && !window.size.IsRelativelyWideRectangle {
needToRotate = true
}
@@ -238,11 +244,7 @@ class TriggerProPreviewController: BaseViewController {
}
view.addSubview(navigationView)
- navigationView.snp.makeConstraints { make in
- make.leading.trailing.equalTo(view.safeAreaLayoutGuide)
- make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
- make.height.equalTo(R.Size.NavigationHeight)
- }
+ updateNavigationViewConstraints()
if let skinFrames = skin.getFrames(window: window) {
controlView.addSubview(gameViewBackgroundView)
@@ -332,6 +334,50 @@ class TriggerProPreviewController: BaseViewController {
AppDelegate.orientation = R.Config.DefaultOrientation
}
+ override var prefersStatusBarHidden: Bool {
+ if UIDevice.isPhoneDuo {
+ return true
+ }
+ return super.prefersStatusBarHidden
+ }
+
+ override func viewDidLayoutSubviews() {
+ super.viewDidLayoutSubviews()
+ if UIDevice.isPhoneDuo {
+ updateNavigationViewConstraints()
+ }
+ }
+
+ private func updateNavigationViewConstraints() {
+ navigationView.snp.remakeConstraints { make in
+ if UIDevice.isPhoneDuoOuter && UIDevice.currentOrientation == .landscapeRight {
+ if let cameraArea = DuoLayoutKit.sideStrip()?.cameraArea() {
+ make.leading.equalToSuperview().inset(cameraArea.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset((cameraArea.height - R.Size.NavigationHeight)/2)
+ } else {
+ make.leading.equalToSuperview().inset(R.Size.iPhoneDuoOuterCameraEdge + R.Size.iPhoneDuoOuterCameraSize.width - R.Size.ContentSpaceMedium)
+ make.top.equalToSuperview().offset(R.Size.iPhoneDuoOuterCameraEdge)
+ }
+ make.trailing.equalToSuperview()
+ } else {
+ if UIDevice.isPhoneDuo {
+ make.leading.equalToSuperview()
+ if UIDevice.isPhoneDuoOuter {
+ make.top.equalToSuperview().offset(21.5)
+ make.trailing.equalToSuperview().inset(64)
+ } else {
+ make.trailing.equalToSuperview()
+ make.top.equalToSuperview().offset(UIDevice.isPhoneDuoSplitView ? R.Size.ContentSpaceLarge : R.Size.ContentInsetTop(window: hostingWindow))
+ }
+ } else {
+ make.leading.trailing.equalTo(view.safeAreaLayoutGuide)
+ make.top.equalToSuperview().offset(R.Size.ContentInsetTop(window: hostingWindow))
+ }
+ }
+ make.height.equalTo(R.Size.NavigationHeight)
+ }
+ }
+
private func getInputs() -> [String] {
if let inputs = defaultSkin.gameType.manicEmuCore?.allInputs {
return inputs.compactMap({ ($0.stringValue == "flex" || $0.stringValue.contains("touchScreen")) ? nil : $0.stringValue })
diff --git a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonStyleView.swift b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonStyleView.swift
index 5c2c4e75..182322e7 100644
--- a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonStyleView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonStyleView.swift
@@ -106,6 +106,11 @@ class AddTriggerButtonStyleView: BaseView {
guard let self, let textField else { return }
self.handleCommittedTextChange(textField)
}
+ textField.isFocusable = true
+ textField.onFocusConfirm = { [weak self] in
+ self?.titleTextField.becomeFirstResponder()
+ return true
+ }
return textField
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonView.swift b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonView.swift
index 375f8824..c327d8d3 100644
--- a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/AddTriggerButtonView.swift
@@ -53,6 +53,7 @@ class AddTriggerButtonView: BaseView {
titleIcon: .symbolImage(R.image.triggerpro_iconSymbols())),
sections: getSections(),
backgroundColor: .clear,
+ listInsets: .insets(bottom: R.Size.ContentInsetBottom(window: hostingWindow)),
pageInsets: .insets(top: R.Size.SheetGrabberTopInset)))
view.didActionOccurred = { [weak self] action in
diff --git a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/TriggerProManageView.swift b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/TriggerProManageView.swift
index fdf3dd7b..9688e686 100644
--- a/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/TriggerProManageView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/TriggerPro/Views/TriggerProManageView.swift
@@ -369,7 +369,6 @@ class TriggerProManageView: BaseView {
}
private func getListPage() -> ASListPage {
- let listInsetBottom = (UIDevice.isPad && !showClose) ? R.Size.ContentInsetBottom(window: hostingWindow) + R.Size.HomeTabBarSize.height + R.Size.ContentSpaceMedium : 0
return ASListPage(navigation: getNavigation(),
sections: getSections(),
@@ -379,7 +378,7 @@ class TriggerProManageView: BaseView {
background: R.Color.Main),
blankSlate: .init(),
backgroundColor: .clear,
- listInsets: .insets(bottom: listInsetBottom),
+ listInsets: .insets(bottom: R.Size.ContentInsetBottomForSettingPage(showAsDetail: (UIDevice.isPad && !showClose) || UIDevice.isPhoneDuoInnerFullScreen)),
pageInsets: .insets(top: showClose ? R.Size.SheetGrabberTopInset : R.Size.ContentInsetTop(window: hostingWindow)),
enableLongPress: true)
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopControlController.swift b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopControlController.swift
new file mode 100644
index 00000000..93d411c9
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopControlController.swift
@@ -0,0 +1,66 @@
+//
+// DuoTabletopControlController.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+import ProHUD
+
+@available(iOS 27.1, *)
+final class DuoTabletopControlController: UIViewController {
+ private let motion = CMMotionManager()
+
+ override func loadView() {
+ view = DuoTabletopControlView()
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+ startGravity()
+ }
+
+ override func viewWillDisappear(_ animated: Bool) {
+ super.viewWillDisappear(animated)
+ motion.stopDeviceMotionUpdates()
+ }
+
+ override var prefersInterfaceOrientationLocked: Bool {
+ DuoTabletopKit.isTabletopOrientationLocked
+ }
+
+ override var prefersStatusBarHidden: Bool {
+ if let action = AppContext.prefersStatusBarHidden, let result = action(presentedViewController) {
+ return result
+ }
+ return true
+ }
+
+ private func startGravity() {
+ guard motion.isDeviceMotionAvailable, !motion.isDeviceMotionActive else { return }
+ motion.deviceMotionUpdateInterval = 0.2
+ motion.startDeviceMotionUpdates(to: .main) { [weak self] data, _ in
+ guard let self, let gravity = data?.gravity else { return }
+ self.updateUpright(gravity)
+ }
+ }
+
+ /// y dominates for portrait and upside-down. A landscape tilt does not release the lock.
+ private func updateUpright(_ gravity: CMAcceleration) {
+ guard DuoTabletopKit.isTabletopOrientationLocked,
+ abs(gravity.y) > abs(gravity.x), abs(gravity.y) > 0.35 else { return }
+ let target: UIInterfaceOrientation = gravity.y < 0 ? .portrait : .portraitUpsideDown
+ guard let interface = view.window?.windowScene?.effectiveGeometry.interfaceOrientation
+ ?? ApplicationSceneDelegate.applicationScene?.effectiveGeometry.interfaceOrientation,
+ interface == .portrait || interface == .portraitUpsideDown,
+ interface != target else { return }
+ let mask: UIInterfaceOrientationMask = target == .portraitUpsideDown ? .portraitUpsideDown : .portrait
+ DuoTabletopKit.tabletopPendingOrientation = target
+ DuoTabletopKit.isTabletopOrientationLocked = false
+ AppDelegate.orientation = mask
+ ApplicationSceneDelegate.applicationScene?.requestGeometryUpdate(
+ UIWindowScene.GeometryPreferences.iOS(interfaceOrientations: mask)
+ )
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopControlWindow.swift b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopControlWindow.swift
new file mode 100644
index 00000000..b128feb4
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopControlWindow.swift
@@ -0,0 +1,13 @@
+//
+// DuoTabletopControlWindow.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+/// Receives the bottom-pane touches without becoming the key window.
+@available(iOS 27.1, *)
+final class DuoTabletopControlWindow: UIWindow {
+ override var canBecomeKey: Bool { false }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopKit.swift b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopKit.swift
new file mode 100644
index 00000000..1393b540
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/DuoTabletopKit.swift
@@ -0,0 +1,214 @@
+//
+// DuoTabletopKit.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+import ProHUD
+
+@available(iOS 27.1, *)
+struct DuoTabletopKit {
+
+ /// This parameter directly changes how UIDevice determines the device orientation and type.
+ static var isTabletopMode: Bool = false
+
+ /// True only while Tabletop is running on iPhone Duo. Other devices and platforms stay on their own path.
+ static var isTabletopActive: Bool {
+ isTabletopMode && UIDevice.isPhoneDuo
+ }
+
+ /// While true, Tabletop refuses further rotation. Cleared only for one portrait flip.
+ static var isTabletopOrientationLocked = false
+
+ /// Upright orientation the open lock is waiting to reach. Nil while locked.
+ static var tabletopPendingOrientation: UIInterfaceOrientation?
+
+ /// Tabletop buttons are D-pad input, not a touch that should dismiss FocusKit focus.
+ static func isTabletopControlTouch(_ touch: UITouch) -> Bool {
+ isTabletopActive && touch.window is DuoTabletopControlWindow
+ }
+
+ /// Inner-display Tabletop artboard (`Dark`, 669×951). The controller pane keeps its origin; the app window stretches down to meet it.
+ private enum TabletopMetrics {
+ static let screen = CGSize(width: 669, height: 951)
+ static let bottomOriginY: CGFloat = 476
+ }
+
+ private static var savedOrientation: UIInterfaceOrientationMask?
+
+ private static var controlWindow: UIWindow?
+
+ private static var resumeAfterPlay = false
+
+ private static var resumeOnActive = false
+ /// Prevents the transition completion from delivering a second size change for the same frame update.
+
+ private static var isDeliveringTabletopSizeTransition = false
+
+ /// Stops Tabletop because a game is starting. Returns whether it was active.
+ @discardableResult
+ static func pauseTabletopForPlay() -> Bool {
+ guard isTabletopActive else { return false }
+ resumeAfterPlay = true
+ resumeOnActive = false
+ stopTabletopMode()
+ return true
+ }
+
+ /// External emulator: restore when this scene becomes active again, if the hinge is still partially open.
+ static func markTabletopResumeWhenActive() {
+ guard resumeAfterPlay else { return }
+ resumeOnActive = true
+ }
+
+
+ static func resumeTabletopAfterPlayIfNeeded() {
+ // External emulators resume from sceneDidBecomeActive. Any other exit starts Tabletop if the hinge is still partial,
+ // including a fold that happened during play and was ignored because a game was running.
+ guard !resumeOnActive else { return }
+ resumeTabletopIfStillPartiallyOpen()
+ }
+
+
+ static func resumeTabletopOnBecomeActiveIfNeeded() {
+ guard resumeOnActive else { return }
+ resumeTabletopIfStillPartiallyOpen()
+ }
+
+
+ static func resumeTabletopIfStillPartiallyOpen() {
+ resumeAfterPlay = false
+ resumeOnActive = false
+ guard UIDevice.isPhoneDuoInnerFullScreen else { return }
+ guard let hinge = DuoHingeKit.currentStatusHinge, hinge.status == .partiallyOpen else { return }
+ startTabletopMode()
+ }
+
+
+ static func relayoutTabletopPanesIfNeeded() {
+ guard isTabletopActive else { return }
+ applyTabletopPanes()
+ }
+
+ /// Rotation finished. Lock again and assign so the system re-reads the lock.
+ static func finishTabletopOrientationFlip() {
+ guard isTabletopMode, tabletopPendingOrientation != nil else { return }
+ tabletopPendingOrientation = nil
+ isTabletopOrientationLocked = true
+ AppDelegate.orientation = [.portrait, .portraitUpsideDown]
+ }
+
+
+ static func startTabletopMode() {
+ guard UIDevice.isPhoneDuo else { return }
+ guard !PlayViewController.isGaming else { return }
+ // Already inside Tabletop, `isPhoneDuoInnerFullScreen` is false. Relayout before that guard.
+ if isTabletopMode {
+ applyTabletopPanes()
+ return
+ }
+ guard UIDevice.isPhoneDuoInnerFullScreen else { return }
+ guard ApplicationSceneDelegate.applicationScene != nil,
+ ApplicationSceneDelegate.applicationWindow != nil else { return }
+
+ savedOrientation = AppDelegate.orientation
+ isTabletopMode = true
+ isTabletopOrientationLocked = true
+ AppContext.isPhoneDuoTabletopMode = true
+ applyTabletopPanes()
+ // Assignment makes the system re-read prefersInterfaceOrientationLocked. The mask itself is ignored on Duo inner.
+ AppDelegate.orientation = [.portrait, .portraitUpsideDown]
+
+ AppContext.hideAllHUDs()
+ }
+
+
+ static func stopTabletopMode() {
+ guard isTabletopActive else { return }
+ isTabletopMode = false
+ isTabletopOrientationLocked = false
+ tabletopPendingOrientation = nil
+ controlWindow?.isHidden = true
+ controlWindow?.rootViewController = nil
+ controlWindow = nil
+ ApplicationSceneDelegate.applicationWindow?.makeKey()
+
+ let restored = savedOrientation ?? R.Config.DefaultOrientation
+ savedOrientation = nil
+ // Re-read the lock. requestGeometryUpdate cannot rotate Duo inner by itself.
+ AppDelegate.orientation = restored
+ restoreFullScreenFrame()
+
+ AppContext.isPhoneDuoTabletopMode = false
+ }
+
+
+ private static func sceneBounds() -> CGRect? {
+ guard let scene = ApplicationSceneDelegate.applicationScene else { return nil }
+ let bounds = scene.coordinateSpace.bounds
+ guard bounds.width > 1, bounds.height > 1 else { return nil }
+ return bounds
+ }
+
+
+ private static func applyTabletopPanes() {
+ guard isTabletopMode, let bounds = sceneBounds(),
+ let appWindow = ApplicationSceneDelegate.applicationWindow,
+ let scene = ApplicationSceneDelegate.applicationScene else { return }
+ let scale = max(appWindow.screen.scale, 1)
+ let scaleY = bounds.height / TabletopMetrics.screen.height
+ let bottomY = bounds.minY + ((TabletopMetrics.bottomOriginY * scaleY) * scale).rounded() / scale
+ let appFrame = CGRect(x: bounds.minX, y: bounds.minY, width: bounds.width, height: bottomY - bounds.minY)
+ let bottomFrame = CGRect(x: bounds.minX, y: bottomY, width: bounds.width, height: max(0, bounds.maxY - bottomY))
+ let window = controlWindow ?? {
+ let created = DuoTabletopControlWindow(windowScene: scene)
+ created.windowLevel = UIWindow.Level(rawValue: UIWindow.Level.normal.rawValue + 1)
+ created.backgroundColor = .clear
+ created.rootViewController = DuoTabletopControlController()
+ created.overrideUserInterfaceStyle = appWindow.overrideUserInterfaceStyle
+ controlWindow = created
+ return created
+ }()
+ window.frame = bottomFrame
+ window.isHidden = false
+ // Touches land here, but FocusKit reads the key window. Keep that on the app window.
+ if window.isKeyWindow {
+ appWindow.makeKey()
+ }
+ // Frame assignment is not a system size transition, so deliver viewWillTransition ourselves.
+ setAppWindowFrame(appFrame, of: appWindow)
+ }
+
+
+ private static func restoreFullScreenFrame() {
+ guard let bounds = sceneBounds(),
+ let appWindow = ApplicationSceneDelegate.applicationWindow else { return }
+ setAppWindowFrame(bounds, of: appWindow)
+ }
+
+ /// UIKit only sends `viewWillTransition` for a scene geometry change. A manual window frame does not.
+ /// Callbacks still see the old size; the frame changes before alongside and completion.
+
+ private static func setAppWindowFrame(_ frame: CGRect, of appWindow: UIWindow) {
+ guard !isDeliveringTabletopSizeTransition else { return }
+ defer { AppContext.syncTabletopOverlayWindows() }
+ guard !appWindow.frame.equalTo(frame) else { return }
+ guard let root = appWindow.rootViewController, root.isViewLoaded else {
+ appWindow.frame = frame
+ return
+ }
+ isDeliveringTabletopSizeTransition = true
+ defer { isDeliveringTabletopSizeTransition = false }
+ let coordinator = TabletopSizeTransitionCoordinator(viewController: root)
+ root.viewWillTransition(to: frame.size, with: coordinator)
+ appWindow.frame = frame
+ UIView.performWithoutAnimation {
+ root.view.layoutIfNeeded()
+ coordinator.performAlongside()
+ root.view.layoutIfNeeded()
+ }
+ coordinator.performCompletion()
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/TabletopSizeTransitionCoordinator.swift b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/TabletopSizeTransitionCoordinator.swift
new file mode 100644
index 00000000..972a109f
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/DuoTabletop/TabletopSizeTransitionCoordinator.swift
@@ -0,0 +1,96 @@
+//
+// TabletopSizeTransitionCoordinator.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+/// Runs `viewWillTransition` work for a window-frame change. Blocks are collected, then flushed after the will-phase returns.
+@available(iOS 27.1, *)
+final class TabletopSizeTransitionCoordinator: NSObject, UIViewControllerTransitionCoordinator {
+ let containerView: UIView
+ private weak var viewController: UIViewController?
+ private var animations: [(UIViewControllerTransitionCoordinatorContext) -> Void] = []
+ private var completions: [(UIViewControllerTransitionCoordinatorContext) -> Void] = []
+ private var interactionHandlers: [(UIViewControllerTransitionCoordinatorContext) -> Void] = []
+ private var didFinishAlongside = false
+
+ init(viewController: UIViewController) {
+ self.viewController = viewController
+ self.containerView = viewController.view
+ }
+
+ var isAnimated: Bool { false }
+ var presentationStyle: UIModalPresentationStyle { .none }
+ var initiallyInteractive: Bool { false }
+ var isInterruptible: Bool { false }
+ var isInteractive: Bool { false }
+ var isCancelled: Bool { false }
+ var transitionDuration: TimeInterval { 0 }
+ var percentComplete: CGFloat { didFinishAlongside ? 1 : 0 }
+ var completionVelocity: CGFloat { 1 }
+ var completionCurve: UIView.AnimationCurve { .linear }
+ var targetTransform: CGAffineTransform { .identity }
+
+ func viewController(forKey _: UITransitionContextViewControllerKey) -> UIViewController? {
+ viewController
+ }
+
+ func view(forKey _: UITransitionContextViewKey) -> UIView? {
+ viewController?.view
+ }
+
+ func animate(alongsideTransition animation: ((UIViewControllerTransitionCoordinatorContext) -> Void)?, completion: ((UIViewControllerTransitionCoordinatorContext) -> Void)? = nil) -> Bool {
+ enqueue(animation: animation, completion: completion)
+ }
+
+ func animateAlongsideTransition(in _: UIView?, animation: ((UIViewControllerTransitionCoordinatorContext) -> Void)?, completion: ((UIViewControllerTransitionCoordinatorContext) -> Void)? = nil) -> Bool {
+ enqueue(animation: animation, completion: completion)
+ }
+
+ func notifyWhenInteractionEnds(_ handler: @escaping (UIViewControllerTransitionCoordinatorContext) -> Void) {
+ notifyWhenInteractionChanges(handler)
+ }
+
+ func notifyWhenInteractionChanges(_ handler: @escaping (UIViewControllerTransitionCoordinatorContext) -> Void) {
+ if didFinishAlongside {
+ handler(self)
+ } else {
+ interactionHandlers.append(handler)
+ }
+ }
+
+ func performAlongside() {
+ guard !didFinishAlongside else { return }
+ didFinishAlongside = true
+ let pending = animations
+ animations.removeAll()
+ pending.forEach { $0(self) }
+ }
+
+ func performCompletion() {
+ performAlongside()
+ let pendingInteractions = interactionHandlers
+ interactionHandlers.removeAll()
+ pendingInteractions.forEach { $0(self) }
+ let pendingCompletions = completions
+ completions.removeAll()
+ pendingCompletions.forEach { $0(self) }
+ }
+
+ private func enqueue(animation: ((UIViewControllerTransitionCoordinatorContext) -> Void)?, completion: ((UIViewControllerTransitionCoordinatorContext) -> Void)?) -> Bool {
+ if didFinishAlongside {
+ animation?(self)
+ completion?(self)
+ return true
+ }
+ if let animation {
+ animations.append(animation)
+ }
+ if let completion {
+ completions.append(completion)
+ }
+ return animation != nil || completion != nil
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift
index e629e172..6ce5c77e 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift
@@ -63,7 +63,12 @@ extension UIDevice {
}
static var isLandscape: Bool {
- UIDevice.currentOrientation == .landscapeLeft || UIDevice.currentOrientation == .landscapeRight
+ if #available(iOS 27.1, *) {
+ if DuoTabletopKit.isTabletopMode {
+ return true
+ }
+ }
+ return UIDevice.currentOrientation == .landscapeLeft || UIDevice.currentOrientation == .landscapeRight
}
static var isPortrait: Bool {
@@ -88,8 +93,36 @@ extension UIDevice {
return false
}
- static var isSmallScreenPhone: Bool {
- return Device.size().rawValue < Size.screen5_8Inch.rawValue && !isPhoneDuo
+ static var isStandardPhone: Bool {
+ switch Device.version(detectSimulator: true) {
+ case .iPhone2G,
+ .iPhone3G,
+ .iPhone3GS,
+ .iPhone4,
+ .iPhone4S,
+ .iPhone5,
+ .iPhone5C,
+ .iPhone5S,
+ .iPhone6,
+ .iPhone6Plus,
+ .iPhone6S,
+ .iPhone6SPlus,
+ .iPhoneSE,
+ .iPhone7,
+ .iPhone7Plus,
+ .iPhone8,
+ .iPhone8Plus,
+ .iPhoneSE2,
+ .iPhoneSE3:
+ return true
+ default:
+ return false
+ }
+ }
+
+ static var isEdgeToEdgePhone: Bool {
+ guard isPhone else { return false }
+ return !isStandardPhone && !isPhoneDuo
}
static var isProMaxPhone: Bool {
@@ -107,7 +140,12 @@ extension UIDevice {
}
static var currentOrientation: UIInterfaceOrientation {
- UIWindow.applicationWindow?.windowScene?.interfaceOrientation ?? .portrait
+ if #available(iOS 27.1, *) {
+ if DuoTabletopKit.isTabletopMode {
+ return .landscapeLeft
+ }
+ }
+ return UIWindow.applicationWindow?.windowScene?.interfaceOrientation ?? .portrait
}
static var hasNotch: Bool {
switch Device.version(detectSimulator: true) {
@@ -171,12 +209,27 @@ extension UIDevice {
}
static var isPhoneDuoInner: Bool {
+ if #available(iOS 27.1, *) {
+ if DuoTabletopKit.isTabletopMode {
+ return false
+ }
+ }
guard isPhoneDuo else { return false }
// 669×951 pt, including partially folded. The scene stays on the inner display until closed.
return Device.size() == .screen7_6Inch
}
+ static var isPhoneDuoInnerFullScreen: Bool {
+ guard isPhoneDuoInner else { return false }
+ return !isPhoneDuoSplitView
+ }
+
static var isPhoneDuoOuter: Bool {
+ if #available(iOS 27.1, *) {
+ if DuoTabletopKit.isTabletopMode {
+ return true
+ }
+ }
guard isPhoneDuo else { return false }
// 466×678 pt. Only the closed pose uses the outer display.
return Device.size() == .screen5_4Inch_2
@@ -190,6 +243,18 @@ extension UIDevice {
return false
}
+ static var isPhoneDuoSplitViewRight: Bool {
+ guard isPhoneDuoSplitView else { return false }
+ if let appWindow = ApplicationSceneDelegate.applicationWindow {
+ return appWindow.safeAreaInsets.right > 0
+ }
+ return false
+ }
+
+ static var isPhoneDuoCompactWidth: Bool {
+ (isPhoneDuoOuter && isPortrait) || (isPhoneDuoSplitViewRight && isLandscape)
+ }
+
static var isPad: Bool {
if Device.isPad(detectSimulator: true) {
return true
@@ -294,9 +359,12 @@ extension Device {
/// orientation and must not use this path.
///
/// Unlocked: return the app mask and do not touch geometry.
-/// Control Center visible in landscape: omit portrait and prefer lock so a lock tap
-/// cannot snap to portrait.
+/// Control Center visible in landscape: omit portrait so a lock tap cannot snap to portrait.
/// Lock engaged in landscape: freeze until UIDevice reports landscape again (lock off).
+///
+/// A real turn reports portrait before the interface rotates. Pin only after gravity stays
+/// clearly horizontal through a short confirmation, and cancel that confirmation if the
+/// interface actually reaches portrait.
enum OrientationLockPin {
private enum PhysicalAttitude {
case landscape
@@ -306,14 +374,30 @@ enum OrientationLockPin {
}
private static let motion = CMMotionManager()
+ /// How long a portrait report must keep disagreeing with gravity before it is a lock.
+ private static let confirmationDelay: TimeInterval = 0.4
private static var started = false
+ private static var motionGeneration = 0
+ private static var latestGravity: CMAcceleration?
+ private static var confirmItem: DispatchWorkItem?
+ /// Bumped on cancel so a block that already left the queue cannot clear a newer confirmation.
+ private static var confirmToken = 0
+ private static var unlockItem: DispatchWorkItem?
+ private static var unlockToken = 0
+ private static var isReconciling = false
/// User turned on Control Center lock while the UI was landscape.
private static var lockedInLandscape = false
- /// Scene is inactive (Control Center / switcher) and the UI was landscape.
+ /// Omit portrait. Set while Control Center covers a landscape UI, and held through the
+ /// post-return confirmation so that window cannot snap to portrait.
private static var controlCenterOpenInLandscape = false
+ /// Landscape side at the moment Control Center opened. `.landscape` (both) is resolved
+ /// by the system to landscapeRight, which flips a landscapeLeft UI.
+ private static var lockedLandscapeSide: UIInterfaceOrientationMask?
static var isPinned: Bool { lockedInLandscape }
static var prefersLocked: Bool { lockedInLandscape || controlCenterOpenInLandscape }
+ /// iOS 26 overlay windows copy the scene bounds after a forced landscape update.
+ static var onForcedLandscapeGeometry: (() -> Void)?
static func handleSceneWillResignActive() {
beginControlCenterIfLandscape()
@@ -325,7 +409,7 @@ enum OrientationLockPin {
guard shouldHandle else { return }
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
- startAccelerometerIfNeeded()
+ startMotionIfNeeded()
let center = NotificationCenter.default
center.addObserver(forName: UIDevice.orientationDidChangeNotification, object: nil, queue: .main) { _ in
@@ -339,20 +423,21 @@ enum OrientationLockPin {
beginControlCenterIfLandscape()
}
center.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: .main) { _ in
- startAccelerometerIfNeeded()
handleDidBecomeActive()
}
center.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: .main) { _ in
- if motion.isAccelerometerActive {
- motion.stopAccelerometerUpdates()
- }
+ stopMotion()
+ cancelLockConfirmation()
}
center.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: .main) { _ in
- startAccelerometerIfNeeded()
+ startMotionIfNeeded()
}
}
static func resolvedMask(for window: UIWindow?) -> UIInterfaceOrientationMask {
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopActive {
+ return [.portrait, .portraitUpsideDown]
+ }
let allowed = AppDelegate.orientation
guard shouldHandle else { return allowed }
@@ -360,22 +445,27 @@ enum OrientationLockPin {
guard !landscapeAllowed.isEmpty else {
lockedInLandscape = false
controlCenterOpenInLandscape = false
+ lockedLandscapeSide = nil
+ cancelLockConfirmation()
return allowed
}
- if lockedInLandscape {
- let current = currentLandscapeMask()
- return allowed.contains(current) ? current : landscapeAllowed
- }
- if controlCenterOpenInLandscape {
- return landscapeAllowed
+ if lockedInLandscape || controlCenterOpenInLandscape {
+ return preferredLandscapeMask(allowed: allowed)
}
return allowed
}
static func resistPortraitTransitionIfNeeded(to size: CGSize) {
- guard shouldHandle, lockedInLandscape, size.height > size.width else { return }
- reassertLockedLandscape()
+ guard shouldHandle, size.height > size.width else { return }
+ if lockedInLandscape {
+ reassertLockedLandscape()
+ return
+ }
+ // Portrait geometry with no pin yet is a real turn. Control Center keeps its own mask.
+ if !controlCenterOpenInLandscape {
+ cancelLockConfirmation()
+ }
}
private static var shouldHandle: Bool {
@@ -384,51 +474,245 @@ enum OrientationLockPin {
private static func beginControlCenterIfLandscape() {
guard shouldHandle, isAppInterfaceLandscape() else { return }
+ // Drop a pending in-app sample. The mask covers the tap; become-active confirms it.
+ cancelLockConfirmation()
+ captureLandscapeSideIfNeeded()
+ let alreadySet = controlCenterOpenInLandscape
controlCenterOpenInLandscape = true
- notifyOrientationControllers()
+ if !alreadySet {
+ notifyOrientationControllers()
+ }
}
private static func handleDidBecomeActive() {
- controlCenterOpenInLandscape = false
- let before = lockedInLandscape
+ startMotionIfNeeded()
+ let device = UIDevice.current.orientation
if lockedInLandscape {
- if UIDevice.current.orientation.isLandscape {
- lockedInLandscape = false
+ cancelLockConfirmation()
+ if device.isLandscape || physicalAttitude() == .portrait {
+ // Lock off while the phone is portrait never posts a landscape device event.
+ releaseLandscapeLock()
+ } else {
+ controlCenterOpenInLandscape = false
+ notifyOrientationControllers()
}
- } else if isControlCenterPortraitLockAgainstLandscape() {
- lockedInLandscape = true
+ return
}
- if before != lockedInLandscape {
- applyLockChange()
+ guard controlCenterOpenInLandscape else { return }
+ if portraitSuppressionStillNeeded() {
+ scheduleLockConfirmation()
} else {
- notifyOrientationControllers()
+ endControlCenterSuppression()
}
}
private static func handleDeviceOrientationNotification() {
guard shouldHandle else { return }
let device = UIDevice.current.orientation
- let before = lockedInLandscape
-
- if lockedInLandscape, device.isLandscape {
- lockedInLandscape = false
- } else if !lockedInLandscape, isControlCenterPortraitLockAgainstLandscape() {
- lockedInLandscape = true
+ if lockedInLandscape {
+ if device.isLandscape {
+ releaseLandscapeLock()
+ } else if physicalAttitude() != .portrait && (device.isPortrait || device.isFlat) {
+ // Portrait gravity is handled by the motion sample, so a lock-on
+ // notification cannot unpin from one bad reading.
+ reassertLockedLandscape()
+ }
+ return
}
-
- if before != lockedInLandscape {
- applyLockChange()
- } else if lockedInLandscape, device.isPortrait || device.isFlat {
- reassertLockedLandscape()
+ // Control Center is up: portrait is already omitted. Decide after it closes.
+ if controlCenterOpenInLandscape, UIApplication.shared.applicationState != .active {
+ return
+ }
+ if isLandscapeHeldPortraitReport() {
+ scheduleLockConfirmation()
+ return
+ }
+ if controlCenterOpenInLandscape {
+ if !portraitSuppressionStillNeeded() {
+ endControlCenterSuppression()
+ }
+ return
+ }
+ // Unknown gravity is not a decision. Portrait, flat, or a landscape device is.
+ let attitude = physicalAttitude()
+ if !isAppInterfaceLandscape() || device.isLandscape || attitude == .portrait || attitude == .flat {
+ cancelLockConfirmation()
}
}
- /// Portrait lock reports portrait while the phone is still held landscape.
- private static func isControlCenterPortraitLockAgainstLandscape() -> Bool {
+ /// Device says portrait while gravity is still clearly landscape. Flat and unknown do not count.
+ private static func isLandscapeHeldPortraitReport() -> Bool {
+ guard isAppInterfaceLandscape() else { return false }
+ guard UIDevice.current.orientation.isPortrait else { return false }
+ return physicalAttitude() == .landscape
+ }
+
+ /// Lock engaged with the phone lying flat: device reports portrait, gravity has no screen axis.
+ private static func isFlatPortraitLockReport() -> Bool {
+ guard isAppInterfaceLandscape() else { return false }
+ guard UIDevice.current.orientation.isPortrait else { return false }
+ return physicalAttitude() == .flat
+ }
+
+ private static func isConfirmedPortraitLock() -> Bool {
+ if isLandscapeHeldPortraitReport() { return true }
+ // Flat-on-table only counts after Control Center; an in-app face-up pass must not pin.
+ return controlCenterOpenInLandscape && isFlatPortraitLockReport()
+ }
+
+ /// Keep omitting portrait while gravity is missing or still shows the lock signature.
+ private static func portraitSuppressionStillNeeded() -> Bool {
guard isAppInterfaceLandscape() else { return false }
let device = UIDevice.current.orientation
- guard device.isPortrait || device.isFlat else { return false }
- return physicalAttitude() != .portrait
+ if device.isLandscape { return false }
+ if device == .unknown { return true }
+ switch physicalAttitude() {
+ case .portrait:
+ return false
+ case .unknown:
+ return true
+ case .landscape, .flat:
+ return device.isPortrait
+ }
+ }
+
+ private static func scheduleLockConfirmation() {
+ guard confirmItem == nil else { return }
+ guard UIApplication.shared.applicationState == .active else { return }
+ confirmToken += 1
+ let token = confirmToken
+ let item = DispatchWorkItem {
+ guard confirmToken == token else { return }
+ confirmItem = nil
+ applyLockConfirmation()
+ }
+ confirmItem = item
+ DispatchQueue.main.asyncAfter(deadline: .now() + confirmationDelay, execute: item)
+ }
+
+ private static func cancelLockConfirmation() {
+ confirmToken += 1
+ confirmItem?.cancel()
+ confirmItem = nil
+ }
+
+ private static func applyLockConfirmation() {
+ guard UIApplication.shared.applicationState == .active else { return }
+ guard isConfirmedPortraitLock() else {
+ if controlCenterOpenInLandscape {
+ endControlCenterSuppression()
+ }
+ return
+ }
+ captureLandscapeSideIfNeeded()
+ lockedInLandscape = true
+ controlCenterOpenInLandscape = false
+ applyLockChange()
+ }
+
+ /// Phone is really portrait, or UIDevice caught up to landscape after the lock was turned off.
+ private static func releaseLandscapeLock() {
+ guard lockedInLandscape else { return }
+ lockedInLandscape = false
+ controlCenterOpenInLandscape = false
+ lockedLandscapeSide = nil
+ cancelLockConfirmation()
+ cancelPortraitUnlock()
+ applyLockChange()
+ }
+
+ /// Keep the first landscape side. A later snap to the other side must not replace it.
+ private static func captureLandscapeSideIfNeeded() {
+ guard case .none = lockedLandscapeSide else { return }
+ switch currentInterfaceOrientation() {
+ case .landscapeLeft:
+ lockedLandscapeSide = .landscapeLeft
+ case .landscapeRight:
+ lockedLandscapeSide = .landscapeRight
+ default:
+ break
+ }
+ }
+
+ private static func schedulePortraitUnlock() {
+ guard lockedInLandscape, unlockItem == nil else { return }
+ guard UIApplication.shared.applicationState == .active else { return }
+ unlockToken += 1
+ let token = unlockToken
+ let item = DispatchWorkItem {
+ guard unlockToken == token else { return }
+ unlockItem = nil
+ guard lockedInLandscape, physicalAttitude() == .portrait else { return }
+ releaseLandscapeLock()
+ }
+ unlockItem = item
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: item)
+ }
+
+ private static func cancelPortraitUnlock() {
+ unlockToken += 1
+ unlockItem?.cancel()
+ unlockItem = nil
+ }
+
+ /// One concrete landscape side. Both-sides `.landscape` is what snaps the UI to landscapeRight.
+ private static func preferredLandscapeMask(allowed: UIInterfaceOrientationMask) -> UIInterfaceOrientationMask {
+ let landscapeAllowed = allowed.intersection(.landscape)
+ if let side = lockedLandscapeSide, landscapeAllowed.contains(side) {
+ return side
+ }
+ switch currentInterfaceOrientation() {
+ case .landscapeLeft where landscapeAllowed.contains(.landscapeLeft):
+ return .landscapeLeft
+ case .landscapeRight where landscapeAllowed.contains(.landscapeRight):
+ return .landscapeRight
+ default:
+ return landscapeAllowed
+ }
+ }
+
+ /// Gravity updated before the deadline. Release early when the phone is clearly portrait.
+ /// Never engages the lock; only the confirmation block does that.
+ private static func reconcilePendingConfirmation() {
+ guard !isReconciling, confirmItem != nil else { return }
+ guard UIApplication.shared.applicationState == .active else { return }
+ isReconciling = true
+ defer { isReconciling = false }
+ if lockedInLandscape { return }
+ if controlCenterOpenInLandscape {
+ if !portraitSuppressionStillNeeded() {
+ endControlCenterSuppression()
+ }
+ return
+ }
+ if !isAppInterfaceLandscape() || UIDevice.current.orientation.isLandscape || physicalAttitude() == .portrait {
+ cancelLockConfirmation()
+ }
+ }
+
+ private static func endControlCenterSuppression() {
+ guard controlCenterOpenInLandscape else { return }
+ controlCenterOpenInLandscape = false
+ if !lockedInLandscape {
+ lockedLandscapeSide = nil
+ }
+ cancelLockConfirmation()
+ notifyOrientationControllers()
+ // Portrait-locked gameplay must not be spun just because Control Center closed.
+ guard allowsCurrentDeviceOrientation() else { return }
+ UIViewController.attemptRotationToDeviceOrientation()
+ }
+
+ private static func allowsCurrentDeviceOrientation() -> Bool {
+ let mask: UIInterfaceOrientationMask
+ switch UIDevice.current.orientation {
+ case .portrait: mask = .portrait
+ case .portraitUpsideDown: mask = .portraitUpsideDown
+ case .landscapeLeft: mask = .landscapeLeft
+ case .landscapeRight: mask = .landscapeRight
+ default: return false
+ }
+ return AppDelegate.orientation.contains(mask)
}
private static func applyLockChange() {
@@ -442,33 +726,79 @@ enum OrientationLockPin {
private static func reassertLockedLandscape() {
notifyOrientationControllers()
- let mask = currentLandscapeMask()
+ let mask = preferredLandscapeMask(allowed: AppDelegate.orientation)
if #available(iOS 16.0, *) {
ApplicationSceneDelegate.applicationScene?.requestGeometryUpdate(
UIWindowScene.GeometryPreferences.iOS(interfaceOrientations: mask)
)
+ if #available(iOS 26.0, *) {
+ onForcedLandscapeGeometry?()
+ DispatchQueue.main.async {
+ guard lockedInLandscape else { return }
+ onForcedLandscapeGeometry?()
+ }
+ }
} else {
- UIDevice.current.setValue(currentInterfaceOrientation().rawValue, forKey: "orientation")
+ UIDevice.current.setValue(interfaceOrientation(for: mask).rawValue, forKey: "orientation")
}
}
+ private static func interfaceOrientation(for mask: UIInterfaceOrientationMask) -> UIInterfaceOrientation {
+ if mask == .landscapeLeft { return .landscapeLeft }
+ if mask == .landscapeRight { return .landscapeRight }
+ return currentInterfaceOrientation().isLandscape ? currentInterfaceOrientation() : .landscapeRight
+ }
+
+ /// App window and ProHUD overlay windows. The sheet is often the window that actually rotates.
private static func notifyOrientationControllers() {
- var vc = UIWindow.applicationWindow?.rootViewController
- while let current = vc {
- if #available(iOS 16.0, *) {
- current.setNeedsUpdateOfSupportedInterfaceOrientations()
+ var roots: [UIViewController] = []
+ let windows = ApplicationSceneDelegate.applicationScene?.windows ?? []
+ for window in windows {
+ if let root = window.rootViewController {
+ roots.append(root)
}
- if #available(iOS 26.0, *) {
- current.setNeedsUpdateOfPrefersInterfaceOrientationLocked()
+ }
+ if roots.isEmpty, let root = UIWindow.applicationWindow?.rootViewController {
+ roots.append(root)
+ }
+ for root in roots {
+ var vc: UIViewController? = root
+ while let current = vc {
+ if #available(iOS 16.0, *) {
+ current.setNeedsUpdateOfSupportedInterfaceOrientations()
+ }
+ if #available(iOS 26.0, *) {
+ current.setNeedsUpdateOfPrefersInterfaceOrientationLocked()
+ }
+ vc = current.presentedViewController
}
- vc = current.presentedViewController
}
}
- private static func startAccelerometerIfNeeded() {
- guard shouldHandle, motion.isAccelerometerAvailable, !motion.isAccelerometerActive else { return }
- motion.accelerometerUpdateInterval = 0.2
- motion.startAccelerometerUpdates()
+ private static func startMotionIfNeeded() {
+ guard shouldHandle, motion.isDeviceMotionAvailable, !motion.isDeviceMotionActive else { return }
+ motion.deviceMotionUpdateInterval = 0.1
+ motionGeneration += 1
+ let generation = motionGeneration
+ motion.startDeviceMotionUpdates(to: .main) { data, _ in
+ guard generation == motionGeneration else { return }
+ latestGravity = data?.gravity
+ reconcilePendingConfirmation()
+ guard lockedInLandscape else { return }
+ if physicalAttitude() == .portrait {
+ schedulePortraitUnlock()
+ } else {
+ cancelPortraitUnlock()
+ }
+ }
+ }
+
+ private static func stopMotion() {
+ motionGeneration += 1
+ if motion.isDeviceMotionActive {
+ motion.stopDeviceMotionUpdates()
+ }
+ latestGravity = nil
}
private static func isAppInterfaceLandscape() -> Bool {
@@ -481,23 +811,20 @@ enum OrientationLockPin {
?? UIDevice.currentOrientation
}
- private static func currentLandscapeMask() -> UIInterfaceOrientationMask {
- switch currentInterfaceOrientation() {
- case .landscapeLeft: return .landscapeLeft
- case .landscapeRight: return .landscapeRight
- default: return .landscape
- }
- }
-
+ /// Fused gravity, not raw acceleration. The band around 45° stays `.unknown` so a real
+ /// turn that UIDevice already calls portrait cannot arm a pin.
private static func physicalAttitude() -> PhysicalAttitude {
- guard let acceleration = motion.accelerometerData?.acceleration else { return .unknown }
- let ax = abs(acceleration.x)
- let ay = abs(acceleration.y)
- let az = abs(acceleration.z)
+ guard let gravity = latestGravity else { return .unknown }
+ let ax = abs(gravity.x)
+ let ay = abs(gravity.y)
+ let az = abs(gravity.z)
if az > 0.85 && ax < 0.35 && ay < 0.35 {
return .flat
}
- return ax > ay ? .landscape : .portrait
+ let margin = 0.3
+ if ax > ay + margin && ax > 0.35 { return .landscape }
+ if ay > ax + margin && ay > 0.35 { return .portrait }
+ return .unknown
}
}
#endif
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewControllerExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewControllerExtensions.swift
index 47ca1425..c879be6f 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewControllerExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewControllerExtensions.swift
@@ -14,4 +14,23 @@ extension UIViewController {
var hostingWindowScene: UIWindowScene? {
hostingWindow?.windowScene
}
+
+ static func shouldStatusBarHidden(window: UIWindow?,
+ presentedViewController: UIViewController? = nil) -> Bool? {
+ if let presentedViewController {
+ if let nav = presentedViewController as? UINavigationController {
+ return (nav.topViewController ?? presentedViewController).prefersStatusBarHidden
+ } else if presentedViewController.isBeingPresented {
+ return presentedViewController.prefersStatusBarHidden
+ }
+ }
+ if UIDevice.isPad, let window {
+ return window.size.IsRelativelyWideRectangle
+ } else if UIDevice.isPhoneDuoInner && !UIDevice.isPhoneDuoSplitView {
+ return true
+ } else if #available(iOS 27.1, *), DuoTabletopKit.isTabletopMode {
+ return true
+ }
+ return nil
+ }
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift
index d6f650f5..7c8bdffa 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift
@@ -392,7 +392,7 @@ extension UIView {
case portrait
}
- var prefferedLayoutStyle: LayoutStyle {
+ var preferredLayoutStyle: LayoutStyle {
let w = hostingWindow ?? ApplicationSceneDelegate.applicationWindow
if let w, w.size != .zero {
if w.size.IsRelativelyWideRectangle {
@@ -406,6 +406,9 @@ extension UIView {
}
var isWindowHasEnoughSpaceforIpadMultiColumnLayout: Bool {
+ if UIDevice.isPhoneDuoInnerFullScreen {
+ return true
+ }
guard UIDevice.isPad else { return false }
if let w = hostingWindow {
return w.width > 600
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIWindowExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIWindowExtensions.swift
index 2b05ca78..b1c930fe 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIWindowExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIWindowExtensions.swift
@@ -9,7 +9,6 @@
import Foundation
import UIKit
-import ProHUD
extension UIWindow {
static var applicationWindow: UIWindow? {
diff --git a/ManicEmu/ManicEmu/Sources/Tools/FocusKit/Focusable.swift b/ManicEmu/ManicEmu/Sources/Tools/FocusKit/Focusable.swift
index 6ab4fd6a..8fd1ff22 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/FocusKit/Focusable.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/FocusKit/Focusable.swift
@@ -156,15 +156,19 @@ extension UIView {
let w = bounds.width
let h = bounds.height
guard w > 0.5, h > 0.5 else { return }
- let shortest = min(w, h)
- let longest = max(w, h)
- let aspectRatio = longest / shortest
- if aspectRatio > 1.1 {
- layerCornerRadius = shortest / 2.0
- } else if shortest / longest > 0.9 {
- layerCornerRadius = h / 2.0
+ if h > 150 {
+ layerCornerRadius = R.Size.CornerRadiusMedium
} else {
- layerCornerRadius = R.Size.AppleIconCornerRadius(height: h)
+ let shortest = min(w, h)
+ let longest = max(w, h)
+ let aspectRatio = longest / shortest
+ if aspectRatio > 1.1 {
+ layerCornerRadius = shortest / 2.0
+ } else if shortest / longest > 0.9 {
+ layerCornerRadius = h / 2.0
+ } else {
+ layerCornerRadius = R.Size.AppleIconCornerRadius(height: h)
+ }
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/DuoHingeKit.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/DuoHingeKit.swift
new file mode 100644
index 00000000..b1548705
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/DuoHingeKit.swift
@@ -0,0 +1,119 @@
+//
+// DuoHingeKit.swift
+// ManicEmu
+//
+// Created by Daiuno on 2026/10/21.
+// Copyright © 2026 Manic EMU. All rights reserved.
+//
+
+@available(iOS 27.1, *)
+struct DuoHingeKit {
+ static let fromStatusKey = "DuoHingeFromStatus"
+ static let toStatusKey = "DuoHingeToStatus"
+
+ /// Latest sample, including angle ticks. Layout should use `statusDidChange`, not this alone.
+ static var currentStatusHinge: UIHinge?
+
+ /// Status observers were last told about. Nil until the first real sample.
+ private static var deliveredHinge: UIHinge?
+ /// Start of the in-flight gesture. Stays put while intermediate statuses are replaced.
+ private static var pendingFrom: UIHinge?
+ private static var pendingTo: UIHinge?
+ private static var waitGeneration = 0
+ private static var settleWork: DispatchWorkItem?
+ /// Quiet period after the last hinge sample.
+ private static let settleDelay: TimeInterval = 0.35
+
+ static func didHingeUpdate(interaction: UIHingeInteraction,
+ update: UIHingeInteraction.Update) {
+ guard interaction.isEnabled, let hinge = update.hinge, hinge.status != .unknown else { return }
+ let status = hinge.status
+ currentStatusHinge = hinge
+ guard let deliveredHinge else {
+ self.deliveredHinge = hinge
+ return
+ }
+ if status == deliveredHinge.status {
+ cancelPending()
+ return
+ }
+ pendingFrom = pendingFrom ?? deliveredHinge
+ pendingTo = hinge
+ scheduleDelivery()
+ }
+
+ static func transition(from notification: Notification) -> (from: UIHinge, to: UIHinge)? {
+ guard let from = notification.userInfo?[fromStatusKey] as? UIHinge,
+ let to = notification.userInfo?[toStatusKey] as? UIHinge else { return nil }
+ return (from, to)
+ }
+
+ private static func cancelPending() {
+ pendingFrom = nil
+ pendingTo = nil
+ waitGeneration += 1
+ settleWork?.cancel()
+ settleWork = nil
+ }
+
+ /// Restarts the quiet wait. Angle ticks and intermediate statuses both postpone the notice.
+ private static func scheduleDelivery() {
+ waitGeneration += 1
+ let generation = waitGeneration
+ settleWork?.cancel()
+ let work = DispatchWorkItem {
+ attemptDelivery(generation: generation, remainingAttempts: 60)
+ }
+ settleWork = work
+ // Partially open often snaps back to closed. Wait longer only for that notice.
+ let delay = pendingTo?.status == .partiallyOpen ? settleDelay * 2 : settleDelay
+ DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: work)
+ }
+
+ /// Inner and outer displays are far apart in points (about 951 vs 678 on the long side).
+ private static func isInnerDisplay(_ window: UIWindow) -> Bool {
+ let screen = window.screen.bounds
+ let longSide = max(screen.width, screen.height)
+ return longSide > 800
+ }
+
+ private static func displayMatches(_ hinge: UIHinge, window: UIWindow) -> Bool {
+ let inner = isInnerDisplay(window)
+ switch hinge.status {
+ case .closed:
+ return !inner
+ case .partiallyOpen, .fullyOpen:
+ return inner
+ case .unknown:
+ return false
+ @unknown default:
+ return false
+ }
+ }
+
+ private static func attemptDelivery(generation: Int, remainingAttempts: Int) {
+ guard generation == waitGeneration,
+ let from = pendingFrom,
+ let to = pendingTo,
+ from != to,
+ let window = ApplicationSceneDelegate.applicationWindow else { return }
+ guard displayMatches(to, window: window) else {
+ guard remainingAttempts > 0 else { return }
+ DispatchQueue.main.async {
+ attemptDelivery(generation: generation, remainingAttempts: remainingAttempts - 1)
+ }
+ return
+ }
+ pendingFrom = nil
+ pendingTo = nil
+ deliveredHinge = to
+ NotificationCenter.default.post(
+ name: R.NotificationName.DuoHingeChange,
+ object: window,
+ userInfo: [
+ fromStatusKey: from,
+ toStatusKey: to
+ ]
+ )
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/DuoLayoutKit.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/DuoLayoutKit.swift
new file mode 100644
index 00000000..fb5d417e
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/DuoLayoutKit.swift
@@ -0,0 +1,139 @@
+//
+// DuoLayoutKit.swift
+// ManicEmu
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import UIKit
+
+/// The system side strip on iPhone Duo, in a view's current coordinates.
+///
+/// Inner portrait keeps bars on the top and bottom, so there is no side strip.
+/// Outer display, inner landscape, and Split View are not special-cased: the
+/// strip is whichever left or right edge currently holds the vertical chrome.
+/// Rotation is already reflected by that view's bounds, safe area, and occlusion frames.
+struct DuoSideStrip: Equatable {
+ enum Edge: Equatable {
+ case left
+ case right
+ }
+
+ var edge: Edge
+ /// Full strip, including the space behind the camera.
+ var frame: CGRect
+ /// Active occlusion frames that intersect the strip.
+ var occlusions: [CGRect]
+ /// Strip pieces that do not overlap an occlusion, from top to bottom.
+ var freeRects: [CGRect]
+
+ /// Centers `size` in the strip. Shifts it down only when that centered frame intersects an occlusion.
+ func frame(fitting size: CGSize) -> CGRect {
+ let originX = frame.minX + max(0, (frame.width - size.width) / 2)
+ var originY = frame.midY - size.height / 2
+ let blocked = DuoLayoutKit.mergedVerticalSpans(occlusions.map { ($0.minY, $0.maxY) })
+ for span in blocked where span.upper > span.lower {
+ let candidate = CGRect(x: originX, y: originY, width: size.width, height: size.height)
+ let spanRect = CGRect(x: frame.minX, y: span.lower, width: frame.width, height: span.upper - span.lower)
+ if candidate.intersects(spanRect) {
+ originY = span.upper
+ }
+ }
+ let minY = frame.minY
+ let maxY = max(minY, frame.maxY - size.height)
+ originY = min(max(minY, originY), maxY)
+ return CGRect(x: originX, y: originY, width: size.width, height: size.height)
+ }
+
+ func cameraArea() -> CGRect? {
+ if let rect = occlusions.first {
+ if UIDevice.currentOrientation == .landscapeLeft || UIDevice.currentOrientation == .portraitUpsideDown {
+ return CGRect(origin: frame.origin, size: CGSize(frame.width))
+ } else {
+ let height = rect.minY + rect.maxY
+ if height > 0 {
+ return CGRect(origin: frame.origin, size: CGSize(width: frame.width, height: height))
+ }
+ }
+ }
+ return nil
+ }
+}
+
+enum DuoLayoutKit {
+ /// Minimum horizontal inset that counts as the system side strip.
+ private static let minimumStripWidth: CGFloat = 44
+
+ /// Side strip of `view`, or of the application window when `view` is nil.
+ static func sideStrip(in view: UIView? = nil) -> DuoSideStrip? {
+ guard let view = view ?? ApplicationSceneDelegate.applicationWindow else { return nil }
+ let bounds = view.bounds
+ guard bounds.width > 1, bounds.height > 1 else { return nil }
+ let occlusions = occlusionFrames(in: view)
+ guard let edge = stripEdge(insets: view.safeAreaInsets, occlusions: occlusions, bounds: bounds) else {
+ return nil
+ }
+ let width = stripWidth(edge: edge, insets: view.safeAreaInsets, occlusions: occlusions, bounds: bounds)
+ let minX = edge == .right ? bounds.width - width : 0
+ let strip = CGRect(x: minX, y: 0, width: width, height: bounds.height)
+ let hittingStrip = occlusions.filter { $0.intersects(strip) }
+ return DuoSideStrip(
+ edge: edge,
+ frame: strip,
+ occlusions: hittingStrip,
+ freeRects: freeRects(in: strip, occlusions: hittingStrip)
+ )
+ }
+
+ private static func occlusionFrames(in view: UIView) -> [CGRect] {
+ guard #available(iOS 27.1, *) else { return [] }
+ return view.reservedRegions(kind: .occlusion).filter(\.isActive).map(\.frame)
+ }
+
+ private static func stripEdge(insets: UIEdgeInsets, occlusions: [CGRect], bounds: CGRect) -> DuoSideStrip.Edge? {
+ let right = max(insets.right, edgeWidth(.right, occlusions: occlusions, bounds: bounds))
+ let left = max(insets.left, edgeWidth(.left, occlusions: occlusions, bounds: bounds))
+ if right >= minimumStripWidth, right > left { return .right }
+ if left >= minimumStripWidth, left > right { return .left }
+ return nil
+ }
+
+ private static func stripWidth(edge: DuoSideStrip.Edge, insets: UIEdgeInsets, occlusions: [CGRect], bounds: CGRect) -> CGFloat {
+ let inset = edge == .right ? insets.right : insets.left
+ return max(inset, edgeWidth(edge, occlusions: occlusions, bounds: bounds))
+ }
+
+ private static func edgeWidth(_ edge: DuoSideStrip.Edge, occlusions: [CGRect], bounds: CGRect) -> CGFloat {
+ occlusions.filter { rect in
+ edge == .right ? abs(rect.maxX - bounds.width) <= 1 : abs(rect.minX) <= 1
+ }.map(\.width).max() ?? 0
+ }
+
+ private static func freeRects(in strip: CGRect, occlusions: [CGRect]) -> [CGRect] {
+ let spans = mergedVerticalSpans(occlusions.map { (max(strip.minY, $0.minY), min(strip.maxY, $0.maxY)) })
+ var rects: [CGRect] = []
+ var cursor = strip.minY
+ for span in spans where span.upper > span.lower {
+ if span.lower > cursor {
+ rects.append(CGRect(x: strip.minX, y: cursor, width: strip.width, height: span.lower - cursor))
+ }
+ cursor = max(cursor, span.upper)
+ }
+ if strip.maxY > cursor {
+ rects.append(CGRect(x: strip.minX, y: cursor, width: strip.width, height: strip.maxY - cursor))
+ }
+ return rects
+ }
+
+ fileprivate static func mergedVerticalSpans(_ input: [(CGFloat, CGFloat)]) -> [(lower: CGFloat, upper: CGFloat)] {
+ let sorted = input.filter { $0.1 > $0.0 }.sorted { $0.0 < $1.0 }
+ var result: [(lower: CGFloat, upper: CGFloat)] = []
+ for item in sorted {
+ if let last = result.last, item.0 <= last.upper {
+ result[result.count - 1].upper = max(last.upper, item.1)
+ } else {
+ result.append((item.0, item.1))
+ }
+ }
+ return result
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
index 260611bf..6bce0e34 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
@@ -36,7 +36,11 @@ class FilesImporter: NSObject {
documentPickerViewController.delegate = self
documentPickerViewController.overrideUserInterfaceStyle = UIDevice.isDarkMode ? .dark : .light
documentPickerViewController.allowsMultipleSelection = allowsMultipleSelection
- documentPickerViewController.modalPresentationStyle = .formSheet
+ if #available(iOS 27.1, *), DuoTabletopKit.isTabletopMode {
+ documentPickerViewController.modalPresentationStyle = .overFullScreen
+ } else {
+ documentPickerViewController.modalPresentationStyle = .formSheet
+ }
documentPickerViewController.sheetPresentationController?.preferredCornerRadius = R.Size.CornerRadiusLarge
if appControllerPresent {
topApplicationViewController()?.present(documentPickerViewController, animated: true)
diff --git a/System.core/3DS.manicskin b/System.core/3DS.manicskin
index e2ed339e..3937b396 100644
--- a/System.core/3DS.manicskin
+++ b/System.core/3DS.manicskin
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:03a27ae7bfaafc2750f5c897a7c4b1f1f9220d347e0021127febcea43c25752e
-size 1432984
+oid sha256:909ca57a74475dd87be318d906e242e3697674751619f2a661e4961692f53bee
+size 1610059
diff --git a/System.core/DS.manicskin b/System.core/DS.manicskin
index 7efe207b..848fa913 100644
--- a/System.core/DS.manicskin
+++ b/System.core/DS.manicskin
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:6ff544f2c1c896df5896387196e4a123b9a40c256bd3a8c0ec5b49ee83209fd1
-size 1082109
+oid sha256:0fd3f68f7223763a49add06ee1a7bafb89b33a7e923a4a9da0965d01db073648
+size 1294163
diff --git a/System.core/N64.manicskin b/System.core/N64.manicskin
index 906f6acd..f17fa0b0 100644
--- a/System.core/N64.manicskin
+++ b/System.core/N64.manicskin
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:1a7224cda22cf1f1f3514bcd44b04e5262e7a26631b3ce1bf03a065a9a1d6c4c
-size 1524085
+oid sha256:6770f23712d9b945a5fa45001c3854c6c03cab7fe4559ef66f8c729bcb9709ee
+size 1513971
diff --git a/System.core/SNES.manicskin b/System.core/SNES.manicskin
index 7075cda2..c4283e4f 100644
--- a/System.core/SNES.manicskin
+++ b/System.core/SNES.manicskin
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:f33732c8a3c26c4236d43c2cf2f09e32c6f23307b6091d3c1536a6909c39ffac
-size 995186
+oid sha256:bdd73ce0d6132cc8d3e2af842cc27b1727633aac0f241457603c7803ba413ca4
+size 1343858