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

Redesign the default skin for GB/GG; adjust global UI details; add a game manual for difficult challenges; add game library background settings.

Daiunoce7aebfc3e81
diff --git a/Cores/Libretro/ui/drivers/LibretroCore.m b/Cores/Libretro/ui/drivers/LibretroCore.m
index 9490f9e4..5f4b27c3 100644
--- a/Cores/Libretro/ui/drivers/LibretroCore.m
+++ b/Cores/Libretro/ui/drivers/LibretroCore.m
@@ -124,7 +124,14 @@ NSString * const DidDisconnectFromWFCNotification = @"DidDisconnectFromWFCNotifi
}
- (void)snapshot:(void(^ _Nullable)(UIImage *_Nullable image))completion {
- return [[self getRetroArch] snapshot:completion];
+#if !TARGET_IPHONE_SIMULATOR
+ [[self getRetroArch] snapshot:completion];
+#else
+ if (completion) {
+ completion(nil);
+ }
+#endif
+
}
- (BOOL)saveState:(void(^ _Nullable)(NSString *_Nullable path))completion {
diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
index de99e5b8..4ecd34d6 100644
--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
@@ -767,6 +767,8 @@
A392D5652E96682C00F920E7 /* DisabledTapSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = A392D5632E96682600F920E7 /* DisabledTapSwitch.swift */; };
A392D5B32E9796B900F920E7 /* ServiceIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A392D5B22E9796B800F920E7 /* ServiceIconView.swift */; };
A3A043802E9BF57A006442C2 /* UIScrollViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A0437F2E9BF57A006442C2 /* UIScrollViewExtensions.swift */; };
+ A3A043BA2E9CF350006442C2 /* GameplayManualsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A043B82E9CF33B006442C2 /* GameplayManualsView.swift */; };
+ A3A043C42E9D3956006442C2 /* GameplayManualsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A043C32E9D3954006442C2 /* GameplayManualsViewController.swift */; };
A519A38A256FCA50008AD6CE /* StringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A519A389256FCA50008AD6CE /* StringExtensions.swift */; };
A52C1D86257F91550029B15B /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52C1D85257F91550029B15B /* BaseViewController.swift */; };
A52C1D89257F96C90029B15B /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A52C1D88257F96C90029B15B /* UIViewControllerExtensions.swift */; };
@@ -1786,6 +1788,8 @@
A392D5632E96682600F920E7 /* DisabledTapSwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisabledTapSwitch.swift; sourceTree = "<group>"; };
A392D5B22E9796B800F920E7 /* ServiceIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceIconView.swift; sourceTree = "<group>"; };
A3A0437F2E9BF57A006442C2 /* UIScrollViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIScrollViewExtensions.swift; sourceTree = "<group>"; };
+ A3A043B82E9CF33B006442C2 /* GameplayManualsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameplayManualsView.swift; sourceTree = "<group>"; };
+ A3A043C32E9D3954006442C2 /* GameplayManualsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameplayManualsViewController.swift; sourceTree = "<group>"; };
A519A389256FCA50008AD6CE /* StringExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtensions.swift; sourceTree = "<group>"; };
A52C1D85257F91550029B15B /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
A52C1D88257F96C90029B15B /* UIViewControllerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtensions.swift; sourceTree = "<group>"; };
@@ -2115,6 +2119,7 @@
57605FF82D20F24700A98B0C /* ViewControllers */ = {
isa = PBXGroup;
children = (
+ A3A043C32E9D3954006442C2 /* GameplayManualsViewController.swift */,
577006822D438E2A00762E8F /* GamesViewController.swift */,
);
path = ViewControllers;
@@ -2123,6 +2128,7 @@
57605FFF2D222CF600A98B0C /* Views */ = {
isa = PBXGroup;
children = (
+ A3A043B82E9CF33B006442C2 /* GameplayManualsView.swift */,
570F591F2DC7AC9E007BFD92 /* GameCoverView.swift */,
57EC6AA52D801F4D002920F0 /* GamesListBlankSlateView.swift */,
5770069D2D44C01800762E8F /* GamesCollectionReusableView.swift */,
@@ -5259,6 +5265,8 @@
57EC6AC82D8119D9002920F0 /* SyncManager.swift in Sources */,
57655C1B2DF6AD04003E4A6E /* MD.swift in Sources */,
57E9632A2D6B01450022914C /* ImportFileCollectionViewCell.swift in Sources */,
+ A3A043BA2E9CF350006442C2 /* GameplayManualsView.swift in Sources */,
+ A3A043C42E9D3956006442C2 /* GameplayManualsViewController.swift in Sources */,
579213532D95314800E88819 /* BaseNavigationController.swift in Sources */,
57E0CC532D8EACC70027FB8C /* ResourcesKit.swift in Sources */,
5770069A2D44B9B500762E8F /* GamesNavigationView.swift in Sources */,
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/3@2x 1.png b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/3@2x 1.png
new file mode 100644
index 00000000..f5f055e4
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/3@2x 1.png differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/3@3x 1.png b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/3@3x 1.png
new file mode 100644
index 00000000..3795f1ce
Binary files /dev/null and b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/3@3x 1.png differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/Contents.json b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/Contents.json
index 4b6967fd..12f3dcc1 100644
--- a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/Contents.json
+++ b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/Contents.json
@@ -26,7 +26,7 @@
"value" : "dark"
}
],
- "filename" : "[email protected]",
+ "filename" : "3@2x 1.png",
"idiom" : "universal",
"scale" : "2x"
},
@@ -42,7 +42,7 @@
"value" : "dark"
}
],
- "filename" : "[email protected]",
+ "filename" : "3@3x 1.png",
"idiom" : "universal",
"scale" : "3x"
}
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/[email protected]
deleted file mode 100644
index 9358800e..00000000
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/[email protected] and /dev/null differ
diff --git a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/[email protected] b/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/[email protected]
deleted file mode 100644
index ec6c47a8..00000000
Binary files a/ManicEmu/ManicEmu/Resources/Assets.xcassets/Images/place_holder.imageset/[email protected] and /dev/null differ
diff --git a/ManicEmu/ManicEmu/Resources/Info.plist b/ManicEmu/ManicEmu/Resources/Info.plist
index 0fb8b11f..7d8ce398 100644
--- a/ManicEmu/ManicEmu/Resources/Info.plist
+++ b/ManicEmu/ManicEmu/Resources/Info.plist
@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>LSSupportsGameMode</key>
+ <true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
@@ -840,6 +842,7 @@
<dict>
<key>public.filename-extension</key>
<array>
+ <string>ss</string>
<string>ccd</string>
<string>iso</string>
<string>chd</string>
diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
index 60fa5a9c..64ec6e29 100644
--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
@@ -729,4 +729,14 @@ Press the controller button to complete mapping...";
"Appearance" = "Appearance";
"AppearanceLight" = "Light Mode";
"AppearanceDark" = "Dark Mode";
-"AppearanceAuto" = "Follow the system";
+"AppearanceAuto" = "Follow System";
+"GameListBackground" = "Background Image";
+"GameListBackgroundUpload" = "Upload";
+"GameplayManuals" = "Game Manuals";
+"GameplayManualsNoExists" = "No manual available for this game.";
+"GameplayManualsDesc" = "To add a manual, place your PDF file in the Manic EMU app. To remove it, go to Files > Manic EMU > Manuals and delete the file.";
+"CleanUnsupportSkins" = "Clean Unsupported Skins";
+"NotFoundUnsupportSkins" = "No unsupported skins found.";
+"UnsupportSkinsDesc" = "The following skins are not supported on this device:\n%@Note: Removing them will also delete these skins from other devices synced via iCloud.";
+"UnsupportSkinsRemoveSuccess" = "Unsupported skins removed successfully";
+"ForbitPKSM" = "To ensure a fair RetroAchievements experience, PKSM cannot be used while Global RetroAchievements is enabled.";
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
index 13d268e0..c6559ab3 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
@@ -719,4 +719,19 @@
"Microphone" = "麦克风";
"MicrophoneTips" = "启用麦克风将请求权限并在游戏期间保持活动,可能会中断其他应用的背景音乐播放";
"Texture" = "纹理";
-"TextureReplacement" = "纹理替换";
\ No newline at end of file
+"TextureReplacement" = "纹理替换";
+
+"Appearance" = "外观";
+"AppearanceLight" = "浅色模式";
+"AppearanceDark" = "深色模式";
+"AppearanceAuto" = "跟随系统";
+"GameListBackground" = "背景图片";
+"GameListBackgroundUpload" = "上传";
+"GameplayManuals" = "游戏手册";
+"GameplayManualsNoExists" = "当前游戏暂无手册。";
+"GameplayManualsDesc" = "要添加游戏手册,请将PDF文件放入Manic EMU应用中。若需移除,请前往“文件”App > Manic EMU > Manuals目录删除对应文件。";
+"CleanUnsupportSkins" = "清理不受支持的皮肤";
+"NotFoundUnsupportSkins" = "未发现不受支持的皮肤。";
+"UnsupportSkinsDesc" = "检测到以下皮肤在当前设备上不受支持:\n%@注意:如果选择移除,这些皮肤也会从通过iCloud同步的其他设备中一并删除。";
+"UnsupportSkinsRemoveSuccess" = "不受支持的皮肤已成功移除";
+"ForbitPKSM" = "为确保RetroAchievements体验的公平性,在启用全局RetroAchievements时无法使用PKSM。";
diff --git a/ManicEmu/ManicEmu/Sources/Base/Constants.swift b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
index a907a310..a34e48e7 100644
--- a/ManicEmu/ManicEmu/Sources/Base/Constants.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
@@ -93,6 +93,7 @@ struct Constants {
case .psp: return 0.57
case .ss: return 0.638
case .n64: return 1.369
+ case .mcd: return (Locale.prefersUS ? 0.5864 : 1.1)
default: return 1.0
}
case .style2:
@@ -244,9 +245,8 @@ struct Constants {
static let OneDriveSecrectKey = ""
static let AliYunAppId = ""
static let AliYunSecrectKey = ""
- static let UMAppKey = "6"._7.d.b._7.c._6.c._4._8.a.c._1.b._4.f._8._7.f._0._8.e._9.a
- static let CLoudflareAPIToken = ""
- static let UnzipKey = "123456"
+ static let UMAppKey = ""
+ static let ManicKey = ""
static let DeepSeek = ""
static let RetroAPI = ""
}
@@ -306,6 +306,17 @@ struct Constants {
static let bsnes = Document.appendingPathComponent(LibretroCore.Cores.bsnes.name)
static let LibretroSavePath = Document
static let GamesDB = Resource.appendingPathComponent("Games.db")
+ static let Assets = Document.appendingPathComponent("Assets")
+ static var GameListBackground: String = {
+ var backgroundImageName = ""
+ if UIDevice.isPhone {
+ backgroundImageName = "iphone"
+ } else if UIDevice.isPad {
+ backgroundImageName = "ipad"
+ }
+ return Assets.appendingPathComponent(backgroundImageName + "_background.png")
+ }()
+ static let GameplayManuals = Document.appendingPathComponent("Manuals")
}
struct DefaultKey {
@@ -438,6 +449,8 @@ struct Constants {
static let ThemeColorMaxCount = 5
static let ThreeDSHomeMenuIdentifiers: [UInt64] = [1126106065306114, 1126106065309442, 1126106065311746, 1126106065314050, 1126106065316098, 1126106065318146]
+
+ static let PKSMIdentifier: UInt64 = 1125900154372096
}
struct NotificationName {
@@ -479,6 +492,8 @@ struct Constants {
static let GameSortChange = NSNotification.Name(rawValue: "GameSortChange")
///成就解锁进度常驻关闭
static let TurnOffAlwaysShowProgress = NSNotification.Name(rawValue: "TurnOffAlwaysShowProgress")
+ //游戏库背景变更
+ static let GameListBackgroundChange = NSNotification.Name(rawValue: "GameListBackgroundChange")
}
struct URLs {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
index af0c8f56..ff983bef 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Models/ExtraKey.swift
@@ -32,4 +32,6 @@ enum ExtraKey: String {
case globalHardcore
case microphone
case pspTexture
+ case manualPage
+ case manualFileName
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
index c0b1ccce..b0af80e2 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoDetailReusableView.swift
@@ -131,6 +131,38 @@ class GameInfoDetailReusableView: UICollectionReusableView {
return view
}()
+ private lazy var manualButton: SymbolButton = {
+ let view = SymbolButton(symbol: .textBookClosed, title: R.string.localizable.gameplayManuals())
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ if let game = self.game {
+ if game.isManualsExists {
+ topViewController()?.present(GameplayManualsViewController(game: game), animated: true)
+ } else {
+ UIView.makeAlert(title: R.string.localizable.gameplayManualsNoExists(),
+ detail: R.string.localizable.gameplayManualsDesc(),
+ confirmTitle: R.string.localizable.gameListBackgroundUpload(),
+ confirmAction: {
+ FilesImporter.shared.presentImportController(supportedTypes: [UTType.pdf],
+ allowsMultipleSelection: false,
+ manualHandle: { [weak self] urls in
+ guard let self else { return }
+ if let pdfUrl = urls.first {
+ do {
+ let pdfName = pdfUrl.lastPathComponent
+ try FileManager.safeCopyItem(at: pdfUrl, to: URL(fileURLWithPath: Constants.Path.GameplayManuals.appendingPathComponent(pdfName)), shouldReplace: true)
+ game.updateExtra(key: ExtraKey.manualFileName.rawValue, value: pdfName)
+ topViewController()?.present(GameplayManualsViewController(game: game), animated: true)
+ } catch {}
+ }
+ }, appControllerPresent: true)
+ })
+ }
+ }
+ }
+ return view
+ }()
+
private lazy var threeDSAdvancedModeButton: SymbolButton = {
let title = Settings.defalut.threeDSAdvancedSettingMode ? R.string.localizable.threeDSBasicSettingMode() : R.string.localizable.threeDSAdvanceSettingMode()
let view = SymbolButton(symbol: .sliderHorizontal3, title: title, horizontalContian: true)
@@ -1029,6 +1061,39 @@ class GameInfoDetailReusableView: UICollectionReusableView {
} else if game.gameType == .snes {
updateSNESFunctionButton()
}
+
+ //添加游戏手册按钮
+ manualButton.removeFromSuperview()
+ let subviews = functionButtonContainerView.subviews.filter({ $0 is SymbolButton })
+ functionButtonContainerView.addSubview(manualButton)
+ if subviews.count == 0 {
+ manualButton.snp.makeConstraints { make in
+ make.leading.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ }
+ } else if subviews.count == 1 {
+ manualButton.snp.makeConstraints { make in
+ make.leading.equalTo(subviews[0].snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ make.trailing.equalToSuperview()
+ }
+ } else {
+ let lastTwoViews = subviews.suffix(2)
+ let lastTwoView = Array(lastTwoViews)[0]
+ let lastView = Array(lastTwoViews)[1]
+ lastView.snp.remakeConstraints { make in
+ make.leading.equalTo(lastTwoView.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ }
+ manualButton.snp.makeConstraints { make in
+ make.leading.equalTo(lastView.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.IconSizeHuge)
+ make.trailing.equalToSuperview()
+ }
+ }
}
}
}
@@ -1109,6 +1174,7 @@ class GameInfoDetailReusableView: UICollectionReusableView {
functionButtonContainerView.addSubview(skinButton)
skinButton.snp.makeConstraints { make in
make.leading.equalTo(retroButton.snp.trailing).offset(Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
make.size.equalTo(Constants.Size.IconSizeHuge)
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GameplayManualsViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GameplayManualsViewController.swift
new file mode 100644
index 00000000..f277b1ef
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GameplayManualsViewController.swift
@@ -0,0 +1,38 @@
+//
+// GameplayManualsViewController.swift
+// ManicEmu
+//
+// Created by Aoshuang on 2025/10/13.
+// Copyright © 2025 Manic EMU. All rights reserved.
+//
+
+class GameplayManualsViewController: BaseViewController {
+
+ private lazy var gameplayManualsView: GameplayManualsView = {
+ let view = GameplayManualsView(game: game)
+ view.didTapClose = { [weak self] in
+ self?.dismiss(animated: true)
+ }
+ return view
+ }()
+
+ private let game: Game
+
+ init(game: Game) {
+ self.game = game
+ super.init(nibName: nil, bundle: nil)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ view.addSubview(gameplayManualsView)
+ gameplayManualsView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift
index d88317c1..09f53321 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/ViewControllers/GamesViewController.swift
@@ -98,17 +98,20 @@ class GamesViewController: BaseViewController {
}
}
view.didUpdateToolView = { [weak self] show, showCorner in
+ guard let self = self else { return }
if show {
UIView.normalAnimate {
- self?.gamesToolView.alpha = 1
+ self.gamesToolView.alpha = 1
}
} else {
UIView.springAnimate {
- self?.gamesToolView.alpha = 0
+ self.gamesToolView.alpha = 0
}
}
UIView.springAnimate {
- self?.gamesToolView.backgroundGradientView.isHidden = !showCorner
+ if !self.enableBackground {
+ self.gamesToolView.backgroundGradientView.isHidden = !showCorner
+ }
}
}
@@ -183,12 +186,31 @@ class GamesViewController: BaseViewController {
return view
}()
+ private var enableBackground: Bool = false
+ private var backgroundChangeNotification: Any? = nil
+ private lazy var backgroundImageView: UIImageView = {
+ let view = UIImageView()
+ if FileManager.default.fileExists(atPath: Constants.Path.GameListBackground),
+ let image = UIImage(contentsOfFile: Constants.Path.GameListBackground) {
+ self.enableBackground = true
+ view.image = image
+ }
+ view.contentMode = .scaleAspectFill
+ return view
+ }()
+
var setHomeTabBar: ((_ show: Bool)->Void)?
private weak var sideMenu: UIViewController?
private let GameEditToolBarHeightMax = 205.0
private let GameEditToolBarHeightMin = 116.0
+
+ deinit {
+ if let backgroundChangeNotification {
+ NotificationCenter.default.removeObserver(backgroundChangeNotification)
+ }
+ }
override func viewDidLoad() {
super.viewDidLoad()
@@ -201,6 +223,26 @@ class GamesViewController: BaseViewController {
PlayViewController.startGame(game: game)
}
}
+
+ //背景变更
+ backgroundChangeNotification = NotificationCenter.default.addObserver(forName: Constants.NotificationName.GameListBackgroundChange, object: nil, queue: .main) { [weak self] notification in
+ guard let self = self else { return }
+ if FileManager.default.fileExists(atPath: Constants.Path.GameListBackground),
+ let image = UIImage(contentsOfFile: Constants.Path.GameListBackground) {
+ self.backgroundImageView.image = image
+ self.enableBackground = true
+ self.topBlurView.setBlurVisble(false)
+ self.gamesListView.enableBackground = self.enableBackground
+ self.gamesToolView.enableBackground = self.enableBackground
+ } else {
+ //移除了背景
+ self.backgroundImageView.image = nil
+ self.enableBackground = false
+ self.topBlurView.setBlurVisble(true)
+ self.gamesListView.enableBackground = self.enableBackground
+ self.gamesToolView.enableBackground = self.enableBackground
+ }
+ }
}
@discardableResult
@@ -233,6 +275,8 @@ class GamesViewController: BaseViewController {
}
private func setupViews() {
+ view.addSubview(backgroundImageView)
+
if UIDevice.isPhone {
//iPhone布局
view.addSubview(gamesListView)
@@ -275,8 +319,6 @@ class GamesViewController: BaseViewController {
} else {
//iPad布局
- view.backgroundColor = UIColor(.dm, light: .white, dark: .black)
-
view.addSubview(gamesListView)
gamesListView.snp.makeConstraints { make in
if UIDevice.isLandscape {
@@ -361,6 +403,19 @@ class GamesViewController: BaseViewController {
cornerMaskViewForiPad.isHidden = true
}
}
+
+ backgroundImageView.snp.makeConstraints { make in
+ if UIDevice.isPad {
+ make.edges.equalTo(gamesListView)
+ } else {
+ make.top.bottom.equalTo(gamesListView)
+ make.leading.trailing.equalTo(gamesListView).inset(-59)
+ }
+
+ }
+ topBlurView.setBlurVisble(!enableBackground)
+ gamesListView.enableBackground = enableBackground
+ gamesToolView.enableBackground = enableBackground
}
private func setEditToolBar(show: Bool, singleSelect: Bool = true) {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
index deb15abb..0316ab9b 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameCoverView.swift
@@ -16,7 +16,7 @@ class GameCoverView: UIView {
var imageView: UIImageView = {
let view = UIImageView()
view.contentMode = .scaleAspectFill
- view.backgroundColor = Constants.Color.Background
+ view.backgroundColor = Constants.Color.BackgroundPrimary
return view
}()
@@ -41,7 +41,7 @@ class GameCoverView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
- backgroundColor = Constants.Color.Background
+ backgroundColor = Constants.Color.BackgroundPrimary
addSubview(imageView)
imageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
@@ -112,7 +112,7 @@ class GameCoverView: UIView {
}
platformView.isHidden = true
barShadowView.isHidden = true
- backgroundColor = Constants.Color.Background
+ backgroundColor = Constants.Color.BackgroundPrimary
case .style2:
imageView.snp.remakeConstraints { make in
make.top.trailing.bottom.equalToSuperview()
@@ -127,7 +127,7 @@ class GameCoverView: UIView {
}
platformView.isHidden = false
barShadowView.isHidden = false
- backgroundColor = Constants.Color.Background
+ backgroundColor = Constants.Color.BackgroundPrimary
case .style3:
imageView.snp.remakeConstraints { make in
make.leading.top.trailing.equalToSuperview().inset(6)
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
index b4f2c3fe..033fea42 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListView.swift
@@ -20,7 +20,7 @@ import KeyboardKit
class GameListView: BaseView {
lazy var collectionView: BlankSlateCollectionView = {
let view = BlankSlateCollectionView(frame: .zero, collectionViewLayout: createLayout())
- view.backgroundColor = Constants.Color.Background
+ view.backgroundColor = .clear
view.contentInsetAdjustmentBehavior = .never
view.register(cellWithClass: GameCollectionViewCell.self)
view.register(supplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withClass: GamesCollectionReusableView.self)
@@ -161,6 +161,15 @@ class GameListView: BaseView {
private var stopPlayGameNotification: Any? = nil
private var gameSortChangeNotification: Any? = nil
+ var hasReloadCollectionView = false
+ var enableBackground: Bool = false {
+ didSet {
+ if hasReloadCollectionView {
+ collectionView.reloadData()
+ }
+ }
+ }
+
override init(frame: CGRect) {
super.init(frame: frame)
Log.debug("\(String(describing: Self.self)) init")
@@ -239,19 +248,19 @@ class GameListView: BaseView {
deinit {
Log.debug("\(String(describing: Self.self)) deinit")
- if let gameCoverChangeNotification = gameCoverChangeNotification {
+ if let gameCoverChangeNotification {
NotificationCenter.default.removeObserver(gameCoverChangeNotification)
}
- if let platformOrderChangeNotification = platformOrderChangeNotification {
+ if let platformOrderChangeNotification {
NotificationCenter.default.removeObserver(platformOrderChangeNotification)
}
- if let platformSelectionNotification = platformSelectionNotification {
+ if let platformSelectionNotification {
NotificationCenter.default.removeObserver(platformSelectionNotification)
}
- if let gameListStyleChangeNotification = gameListStyleChangeNotification {
+ if let gameListStyleChangeNotification {
NotificationCenter.default.removeObserver(gameListStyleChangeNotification)
}
if let keyboardDidConnectNotification {
@@ -305,7 +314,9 @@ class GameListView: BaseView {
updateDatas()
if games.count > 0 {
//更新视图
- collectionView.reloadData()
+ collectionView.reloadData { [weak self] in
+ self?.hasReloadCollectionView = true
+ }
//更新索引视图
reloadIndexView()
}
@@ -405,7 +416,7 @@ class GameListView: BaseView {
let itemEstimatedHeight = min(env.container.contentSize.height, env.container.contentSize.width) - Constants.Size.ItemHeightMid - Constants.Size.ItemHeightMin - 106
self.landscapePhonePagingHeight = Constants.Size.ItemHeightMid + Constants.Size.ContentSpaceUltraTiny + itemEstimatedHeight + Constants.Size.ContentSpaceHuge*2
let coverHeight = itemEstimatedHeight - Constants.Size.GamesListSelectionEdge - (self.isSearchMode || !Constants.Size.GamesHideTitle ? Constants.Size.ContentSpaceMin + Constants.Font.body().lineHeight : 0) - Constants.Size.GamesListSelectionEdge
- let coverWidth = coverHeight
+ let coverWidth = coverHeight*Constants.Size.GameCoverRatio(gameType: gameType)
let itemEstimatedWidth = coverWidth + Constants.Size.GamesListSelectionEdge*2
let coverSize = CGSize(width: coverWidth, height: coverHeight)
if let size = self.coverSizes[gameType] {
@@ -433,7 +444,7 @@ class GameListView: BaseView {
let totleSpacing = (Constants.Size.ContentSpaceHuge-Constants.Size.GamesListSelectionEdge)*2 + itemSpacing*(column-1)//横向间距总和
let itemEstimatedWidth = (env.container.contentSize.width - totleSpacing)/column //一个item的宽
let coverWidth = itemEstimatedWidth-Constants.Size.GamesListSelectionEdge*2
- let coverHeight = coverWidth/Constants.Size.GameCoverRatio(gameType: gameType) //书籍封面的高度
+ let coverHeight = coverWidth/Constants.Size.GameCoverRatio(gameType: gameType) //封面的高度
//一个item的高度 = 间距 + 封面高度 + 间距 + title高度 + 间距
let itemEstimatedHeight = Constants.Size.GamesListSelectionEdge + coverHeight + (self.isSearchMode || !Constants.Size.GamesHideTitle ? Constants.Size.ContentSpaceMin + Constants.Font.body().lineHeight : 0) + Constants.Size.GamesListSelectionEdge
let coverSize = CGSize(width: coverWidth, height: coverHeight)
@@ -793,7 +804,7 @@ extension GameListView: UICollectionViewDataSource {
//header
let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withClass: GamesCollectionReusableView.self, for: indexPath)
let gameType = sortDatasKeys()[indexPath.section]
- header.setData(gameType: gameType, highlightString: searchString, contentInsets: UIDevice.isPhone && UIDevice.isLandscape ? .init(top: 0, left: Constants.Size.SafeAera.left, bottom: 0, right: Constants.Size.SafeAera.right) : .zero)
+ header.setData(gameType: gameType, highlightString: searchString, contentInsets: UIDevice.isPhone && UIDevice.isLandscape ? .init(top: 0, left: Constants.Size.SafeAera.left, bottom: 0, right: Constants.Size.SafeAera.right) : .zero, forceHideBlur: enableBackground)
if gameType == .unknown {
header.skinButton.isHidden = true
} else {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift
new file mode 100644
index 00000000..e7e8569e
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameplayManualsView.swift
@@ -0,0 +1,123 @@
+//
+// GameplayManualsView.swift
+// ManicEmu
+//
+// Created by Aoshuang on 2025/10/13.
+// Copyright © 2025 Manic EMU. All rights reserved.
+//
+import PDFKit
+import ProHUD
+
+class GameplayManualsView: UIView {
+ var didTapClose: (()->Void)? = nil
+ private var game: Game
+
+ private var navigationBlurView: UIView = {
+ let view = UIView()
+ view.makeBlur()
+ return view
+ }()
+
+ private var pdfView: PDFView = {
+ let view = PDFView()
+ view.backgroundColor = Constants.Color.Background
+ view.autoScales = true
+ return view
+ }()
+
+ private lazy var closeButton: SymbolButton = {
+ let view = SymbolButton(image: UIImage(symbol: .xmark, font: Constants.Font.body(weight: .bold)), enableGlass: true)
+ view.enableRoundCorner = true
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ self.didTapClose?()
+ // 记录当前阅读的页数
+ if let currentPage = pdfView.currentPage, let document = pdfView.document {
+ let pageIndex = document.index(for: currentPage)
+ game.updateExtra(key: ExtraKey.manualPage.rawValue, value: pageIndex)
+ }
+ }
+ return view
+ }()
+
+ init(game: Game) {
+ self.game = game
+ super.init(frame: .zero)
+ backgroundColor = Constants.Color.Background
+
+ addSubview(navigationBlurView)
+ navigationBlurView.snp.makeConstraints { make in
+ make.leading.top.trailing.equalToSuperview()
+ make.height.equalTo(Constants.Size.ItemHeightMid)
+ }
+
+ navigationBlurView.addSubview(closeButton)
+ closeButton.snp.makeConstraints { make in
+ make.trailing.equalToSuperview().offset(-Constants.Size.ContentSpaceMax)
+ make.centerY.equalToSuperview()
+ make.size.equalTo(Constants.Size.ItemHeightUltraTiny)
+ }
+
+ addSubview(pdfView)
+ pdfView.snp.makeConstraints { make in
+ make.top.equalTo(navigationBlurView.snp.bottom)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalToSuperview().offset(-Constants.Size.ContentInsetBottom)
+ }
+
+ if let manualsPath = game.manualsPath {
+ pdfView.document = PDFDocument(url: URL(fileURLWithPath: manualsPath))
+ }
+
+ // 加载到上一次读取的位置
+ if let lastReadPage = game.getExtraInt(key: ExtraKey.manualPage.rawValue),
+ let document = pdfView.document,
+ lastReadPage < document.pageCount,
+ let page = document.page(at: lastReadPage) {
+ DispatchQueue.main.asyncAfter(delay: 1, execute: { [weak self] in
+ guard let self else { return }
+ self.pdfView.go(to: page)
+ })
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+}
+
+extension GameplayManualsView {
+ static var isShow: Bool {
+ Sheet.find(identifier: String(describing: GameplayManualsView.self)).count > 0 ? true : false
+ }
+
+ static func show(game: Game, gameViewRect: CGRect, menuInsets: UIEdgeInsets? = nil, hideCompletion: (()->Void)? = nil) {
+ Sheet { sheet in
+ sheet.configGamePlayingStyle(gameViewRect: gameViewRect, menuInsets: menuInsets, hideCompletion: hideCompletion)
+
+ let view = UIView()
+ let containerView = RoundAndBorderView(roundCorner: (UIDevice.isPad || UIDevice.isLandscape || menuInsets != nil) ? .allCorners : [.topLeft, .topRight])
+ containerView.backgroundColor = Constants.Color.Background
+ view.addSubview(containerView)
+ containerView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ if let maxHeight = sheet.config.cardMaxHeight {
+ make.height.equalTo(maxHeight)
+ }
+ }
+
+ let manualView = GameplayManualsView(game: game)
+ manualView.didTapClose = { [weak sheet] in
+ sheet?.pop()
+ }
+ containerView.addSubview(manualView)
+ manualView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+
+ sheet.set(customView: view).snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ }
+ }
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
index b70fe0b7..7ceaead2 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesCollectionReusableView.swift
@@ -75,7 +75,7 @@ class GamesCollectionReusableView: UICollectionReusableView {
}
}
- func setData(gameType: GameType, highlightString: String? = nil, contentInsets: UIEdgeInsets = .zero) {
+ func setData(gameType: GameType, highlightString: String? = nil, contentInsets: UIEdgeInsets = .zero, forceHideBlur: Bool = false) {
if Constants.Size.GamesGroupTitleStyle == .brand && gameType != .unknown {
titleLabel.isHidden = true
brandImageView.isHidden = false
@@ -95,14 +95,22 @@ class GamesCollectionReusableView: UICollectionReusableView {
}
skinButton.setTitleColor(Constants.Color.LabelSecondary, for: .normal)
self.highlightString = highlightString
- if UIDevice.isPhone, UIDevice.isLandscape {
+ if (UIDevice.isPhone && UIDevice.isLandscape) || forceHideBlur {
//隐藏模糊
- if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
- blurView.isHidden = true
+ if UIDevice.isPhone {
+ if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
+ blurView.isHidden = true
+ }
+ } else {
+ backgroundColor = .clear
}
} else {
- if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
- blurView.isHidden = false
+ if UIDevice.isPhone {
+ if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
+ blurView.isHidden = false
+ }
+ } else {
+ backgroundColor = Constants.Color.Background.withAlphaComponent(0.965)
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesToolView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesToolView.swift
index ea23550d..5e3911d8 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesToolView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GamesToolView.swift
@@ -23,6 +23,16 @@ class GamesToolView: UIView {
///选则状态
var isSelectAll = false
+ var enableBackground: Bool = false {
+ didSet {
+ if enableBackground {
+ backgroundGradientView.isHidden = true
+ } else {
+ backgroundGradientView.isHidden = false
+ }
+ }
+ }
+
var backgroundGradientView: UIView = {
let view = GradientView()
view.setupGradient(colors: [Constants.Color.BackgroundPrimary, Constants.Color.Background], locations: [0.0, 1.0], direction: .topToBottom)
@@ -256,7 +266,7 @@ class GamesToolIconView: UIView {
super.init(frame: .zero)
self.toolView = toolView
self.selectedSymbol = selectedSymbol
- backgroundColor = Constants.Color.Background
+ makeBlur()
enableInteractive = true
delayInteractiveTouchEnd = true
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
index f0b1b637..c0a43e1c 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/Game.swift
@@ -528,6 +528,20 @@ class Game: Object, ObjectUpdatable {
}
}
+ var manualsPath: String? {
+ if let fileName = getExtraString(key: ExtraKey.manualFileName.rawValue) {
+ return Constants.Path.GameplayManuals.appendingPathComponent(fileName)
+ }
+ return nil
+ }
+
+ var isManualsExists: Bool {
+ if let manualsPath {
+ return FileManager.default.fileExists(atPath: manualsPath)
+ }
+ return false
+ }
+
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
index 0b388ffe..9c2882f9 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Models/GameSetting.swift
@@ -484,7 +484,7 @@ struct GameSetting: SettingCellItem {
enum ItemType: Int, CaseIterable {
//位置很重要 新增内容一定要接到最后面
- case saveState, quickLoadState, volume, fastForward, stateList, cheatCode, skins, filter, screenShot, haptic, airplay, controllerSetting, orientation, functionSort, reload, quit, swapScreen, resolution, consoleHome, amiibo, toggleFullscreen, simBlowing, palette, swapDisk, retro, airPlayScaling, airPlayLayout, toggleAnalog
+ case saveState, quickLoadState, volume, fastForward, stateList, cheatCode, skins, filter, screenShot, haptic, airplay, controllerSetting, orientation, functionSort, reload, quit, swapScreen, resolution, consoleHome, amiibo, toggleFullscreen, simBlowing, palette, swapDisk, retro, airPlayScaling, airPlayLayout, toggleAnalog, gameplayManuals
}
var type: ItemType
@@ -564,6 +564,8 @@ struct GameSetting: SettingCellItem {
UIImage(symbol: .sliderHorizontalBelowSquareFilledAndSquare)
case .toggleAnalog:
UIImage(symbol: .gamecontroller)
+ case .gameplayManuals:
+ UIImage(symbol: .textBookClosed)
}
}
@@ -629,6 +631,8 @@ struct GameSetting: SettingCellItem {
R.string.localizable.airPlayLayout()
case .toggleAnalog:
R.string.localizable.toggleAnolog()
+ case .gameplayManuals:
+ R.string.localizable.gameplayManuals()
}
}
@@ -768,6 +772,8 @@ struct GameSetting: SettingCellItem {
return "airPlayLayout"
case .toggleAnalog:
return "toggleAnalog"
+ case .gameplayManuals:
+ return "gameplayManuals"
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index f63e6670..66a69d8e 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@ -237,6 +237,12 @@ class PlayViewController: GameViewController {
UserDefaults.standard.set(true, forKey: Constants.DefaultKey.HasShowPS1PlayAlert)
launchGameByDismissOtherVC()
});
+ } else if game.gameType == ._3ds, game.identifierFor3DS == Constants.Numbers.PKSMIdentifier {
+ if Settings.defalut.getExtraBool(key: ExtraKey.globalAchievements.rawValue) ?? false {
+ UIView.makeAlert(title: R.string.localizable.retroAchievements(), detail: R.string.localizable.forbitPKSM(), cancelTitle: R.string.localizable.confirmTitle())
+ } else {
+ launchGameByDismissOtherVC()
+ }
} else {
launchGameByDismissOtherVC()
}
@@ -968,6 +974,8 @@ class PlayViewController: GameViewController {
handleMenuGameSetting(GameSetting(type: .retro, airPlayScaling: Settings.defalut.airPlayScaling.next), nil)
} else if input.stringValue == "airPlayLayout" {
handleMenuGameSetting(GameSetting(type: .retro, airPlayLayout: Settings.defalut.airPlayLayout.next), nil)
+ } else if input.stringValue == "gameplayManuals" {
+ handleMenuGameSetting(GameSetting(type: .gameplayManuals), nil)
}
}
@@ -1699,6 +1707,47 @@ extension PlayViewController {
case .toggleAnalog:
//MARK: handleMenuGameSetting.toggleAnalog
updateAnalogMode(toastAllow: true, toggle: true);
+ case .gameplayManuals:
+ //MARK: handleMenuGameSetting.gameplayManuals
+ if menuSheet == nil {
+ pauseEmulation()
+ }
+
+ func showManualsView() {
+ GameplayManualsView.show(game: manicGame, gameViewRect: gameView.frame, menuInsets: getMenuInsets(), hideCompletion: { [weak self] in
+ if menuSheet == nil {
+ self?.resumeEmulationAndHandleAudio()
+ }
+ })
+ }
+
+ if manicGame.isManualsExists {
+ showManualsView()
+ } else {
+ UIView.makeAlert(title: R.string.localizable.gameplayManualsNoExists(),
+ detail: R.string.localizable.gameplayManualsDesc(),
+ confirmTitle: R.string.localizable.gameListBackgroundUpload(),
+ cancelAction: { [weak self] in
+ if menuSheet == nil {
+ self?.resumeEmulationAndHandleAudio()
+ }
+ }, confirmAction: {
+ DispatchQueue.main.asyncAfter(delay: 0.35) {
+ FilesImporter.shared.presentImportController(supportedTypes: [UTType.pdf], allowsMultipleSelection: false) { [weak self] urls in
+ guard let self else { return }
+ if let pdfUrl = urls.first {
+ do {
+ let pdfName = pdfUrl.lastPathComponent
+ try FileManager.safeCopyItem(at: pdfUrl, to: URL(fileURLWithPath: Constants.Path.GameplayManuals.appendingPathComponent(pdfName)), shouldReplace: true)
+ self.manicGame.updateExtra(key: ExtraKey.manualFileName.rawValue, value: pdfName)
+ showManualsView()
+ } catch {}
+ }
+ }
+ }
+ })
+ }
+ return false
}
//默认关闭菜单
return true
@@ -2987,7 +3036,7 @@ extension PlayViewController: GameViewControllerDelegate {
if SheetProvider.find(identifier: Constants.Strings.PlayPurchaseAlertIdentifier).count > 0 {
return false
}
- return (GameSettingView.isShow || GameInfoView.isShow || CheatCodeListView.isShow || SkinSettingsView.isShow || FilterSelectionView.isShow || ControllersSettingView.isShow || GameSettingView.isEditingShow || WebViewController.isShow || FlexSkinSettingViewController.isShow || RetroAchievementsListViewController.isShow || CheevosPopupView.isShow) ? false : true
+ return (GameSettingView.isShow || GameInfoView.isShow || CheatCodeListView.isShow || SkinSettingsView.isShow || FilterSelectionView.isShow || ControllersSettingView.isShow || GameSettingView.isEditingShow || WebViewController.isShow || FlexSkinSettingViewController.isShow || RetroAchievementsListViewController.isShow || CheevosPopupView.isShow || GameplayManualsView.isShow) ? false : true
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/CoverStyleCollectionViewCell.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/CoverStyleCollectionViewCell.swift
index 5a2f21b2..e0191bbf 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/CoverStyleCollectionViewCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/CoverStyleCollectionViewCell.swift
@@ -42,6 +42,8 @@ class CoverStyleCollectionViewCell: UICollectionViewCell {
private var coverView: GameCoverView = {
let view = GameCoverView()
+ view.imageView.backgroundColor = Constants.Color.Background
+ view.backgroundColor = Constants.Color.Background
return view
}()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GameListStyleCollectionViewCell.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GameListStyleCollectionViewCell.swift
index 86799b20..2b1e2adf 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GameListStyleCollectionViewCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/GameListStyleCollectionViewCell.swift
@@ -149,6 +149,102 @@ class GameListStyleCollectionViewCell: UICollectionViewCell {
return view
}()
+ private lazy var backgroundImageView: UIImageView = {
+ let image: UIImage?
+ var contentMode: UIView.ContentMode = .center
+ if FileManager.default.fileExists(atPath: Constants.Path.GameListBackground),
+ let i = UIImage(contentsOfFile: Constants.Path.GameListBackground) {
+ image = i
+ contentMode = .scaleAspectFill
+ } else {
+ image = R.image.brand_icon()
+ }
+ let view = UIImageView(image: image)
+ view.contentMode = contentMode
+ view.backgroundColor = Constants.Color.Background
+ view.layerCornerRadius = Constants.Size.CornerRadiusMin
+ return view
+ }()
+
+ private lazy var addBackgroundImageMenuButton: ContextMenuButton = {
+ var titles = [R.string.localizable.readyEditCoverTakePhoto(),
+ R.string.localizable.readyEditCoverAlbum(),
+ R.string.localizable.readyEditCoverFile()]
+
+ var symbols: [SFSymbol] = [.camera, .photoOnRectangleAngled, .folder]
+
+ var actions: [UIMenuElement] = []
+
+ func saveImage(_ image: UIImage?) {
+ if let image, let data = image.pngData() {
+ do {
+ if !FileManager.default.fileExists(atPath: Constants.Path.Assets) {
+ try FileManager.default.createDirectory(atPath: Constants.Path.Assets, withIntermediateDirectories: true)
+ }
+ try data.write(to: URL(fileURLWithPath: Constants.Path.GameListBackground))
+ self.backgroundImageView.image = image
+ self.backgroundImageView.contentMode = .scaleAspectFill
+ NotificationCenter.default.post(name: Constants.NotificationName.GameListBackgroundChange, object: nil)
+ } catch {
+
+ }
+ }
+ }
+
+ for (index, title) in titles.enumerated() {
+ actions.append((UIAction(title: title, image: .symbolImage(symbols[index])) { [weak self] _ in
+ guard let self = self else { return }
+ if index == 0 {
+ //拍摄
+ ImageFetcher.capture { image in
+ saveImage(image)
+ }
+ } else if index == 1 {
+ //相册
+ ImageFetcher.pick { image in
+ saveImage(image)
+ }
+ } else if index == 2 {
+ //文件
+ ImageFetcher.file{ image in
+ saveImage(image)
+ }
+ }
+ }))
+ }
+ let view = ContextMenuButton(image: nil, menu: UIMenu(children: actions))
+ return view
+ }()
+
+ private lazy var addBackgroundImageButton: SymbolButton = {
+ var title: String = R.string.localizable.gameListBackgroundUpload()
+ let view = SymbolButton(image: nil, title: title, titleFont: Constants.Font.body(), horizontalContian: true, titlePosition: .left)
+ view.backgroundColor = Constants.Color.BackgroundPrimary
+ view.layerCornerRadius = Constants.Size.CornerRadiusMin
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ self.addBackgroundImageMenuButton.triggerTapGesture()
+ }
+ return view
+ }()
+
+ private lazy var removeBackgroundImageButton: SymbolButton = {
+ var title: String = R.string.localizable.removeTitle()
+ let view = SymbolButton(image: nil, title: title, titleFont: Constants.Font.body(), titleColor: Constants.Color.Red, horizontalContian: true, titlePosition: .left)
+ view.backgroundColor = Constants.Color.BackgroundPrimary
+ view.layerCornerRadius = Constants.Size.CornerRadiusMin
+ view.addTapGesture { [weak self] gesture in
+ guard let self = self else { return }
+ if FileManager.default.fileExists(atPath: Constants.Path.GameListBackground) {
+ try? FileManager.default.removeItem(atPath: Constants.Path.GameListBackground)
+ self.backgroundImageView.image = R.image.brand_icon()
+ self.backgroundImageView.contentMode = .center
+ NotificationCenter.default.post(name: Constants.NotificationName.GameListBackgroundChange, object: nil)
+ }
+ }
+ return view
+ }()
+
private var mainColorChangeNotification: Any? = nil
deinit {
@@ -354,6 +450,48 @@ class GameListStyleCollectionViewCell: UICollectionViewCell {
make.edges.equalTo(gameSortOrderButton)
}
+ //背景
+ let backgroundImageLabel = UILabel()
+ backgroundImageLabel.font = Constants.Font.body(size: .l)
+ backgroundImageLabel.textColor = Constants.Color.LabelPrimary
+ backgroundImageLabel.text = R.string.localizable.gameListBackground()
+ addSubview(backgroundImageLabel)
+ backgroundImageLabel.snp.makeConstraints { make in
+ make.leading.equalToSuperview().offset(Constants.Size.ContentSpaceMax)
+ make.top.equalTo(gameSortContainer.snp.bottom).offset(Constants.Size.ContentSpaceMax)
+ }
+
+ addSubview(backgroundImageView)
+ backgroundImageView.snp.makeConstraints { make in
+ make.size.equalTo(154)
+ make.centerX.equalToSuperview()
+ make.top.equalTo(backgroundImageLabel.snp.bottom).offset(Constants.Size.ContentSpaceMax)
+ }
+
+ let backgroundImageContainer = UIView()
+ backgroundImageContainer.backgroundColor = Constants.Color.Background
+ backgroundImageContainer.layerCornerRadius = Constants.Size.CornerRadiusMid
+ addSubview(backgroundImageContainer)
+ backgroundImageContainer.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceMid)
+ make.top.equalTo(backgroundImageView.snp.bottom).offset(Constants.Size.ContentSpaceMax)
+ make.height.equalTo(Constants.Size.ItemHeightMax)
+ }
+
+ backgroundImageContainer.addSubviews([addBackgroundImageMenuButton, addBackgroundImageButton, removeBackgroundImageButton])
+ addBackgroundImageButton.snp.makeConstraints { make in
+ make.leading.top.bottom.equalToSuperview().inset(Constants.Size.ContentSpaceTiny)
+ }
+ addBackgroundImageMenuButton.snp.makeConstraints { make in
+ make.edges.equalTo(addBackgroundImageButton)
+ }
+
+ removeBackgroundImageButton.snp.makeConstraints { make in
+ make.leading.equalTo(addBackgroundImageButton.snp.trailing).offset(Constants.Size.ContentSpaceMid)
+ make.top.bottom.trailing.equalToSuperview().inset(Constants.Size.ContentSpaceTiny)
+ make.width.equalTo(addBackgroundImageButton)
+ }
+
mainColorChangeNotification = NotificationCenter.default.addObserver(forName: Constants.NotificationName.MainColorChange, object: nil, queue: .main) { [weak self] notification in
guard let self = self else { return }
self.hideScrollIndicatorIconView.backgroundColor = Constants.Color.Main
diff --git a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift
index 0ce2d7b1..42112a0e 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Settings/Views/ThemeSettingView.swift
@@ -138,7 +138,7 @@ class ThemeSettingView: BaseView {
} else if sectionIndex == SectionIndex.coverStyle.rawValue {
itemHeight = 370 + 76
} else if sectionIndex == SectionIndex.gameList.rawValue {
- itemHeight = 205 + 76 + 220
+ itemHeight = 205 + 76 + 220 + 292
} else if sectionIndex == SectionIndex.platformOrder.rawValue {
itemHeight = 50
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift b/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift
index 9dbe5ed8..ca177876 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Skin/Views/SkinSettingsView.swift
@@ -98,6 +98,11 @@ class SkinSettingsView: BaseView {
//重置当前平台皮肤
self.resetSkin(gameType: self.gameType)
})
+ actions.append(UIAction(title: R.string.localizable.cleanUnsupportSkins()) { [weak self] _ in
+ guard let self = self else { return }
+ //清理不可用皮肤
+ self.cleanUnsupportSkins()
+ })
actions.append((UIAction(title: R.string.localizable.skinDebug()) { [weak self] _ in
guard let self = self else { return }
UIView.makeToast(message: "Coming Soon...")
@@ -449,6 +454,45 @@ class SkinSettingsView: BaseView {
}
}
}
+
+ private func cleanUnsupportSkins() {
+ let realm = Database.realm
+ let skins = realm.objects(Skin.self).where({ $0.skinType == .import })
+ var unsupportSkins: [Skin] = []
+ var unsupportSkinNames: String = ""
+ for skin in skins {
+ if let controllerSkin = ControllerSkin(fileURL: skin.fileURL) {
+ if !controllerSkin.supports(landscapeTraits) &&
+ !controllerSkin.supports(portraitTraits) {
+ //获取不支持当前设备的皮肤
+ unsupportSkins.append(skin)
+ unsupportSkinNames.append(controllerSkin.name + "\n")
+ }
+ }
+ }
+
+ if unsupportSkins.count == 0 {
+ UIView.makeToast(message: R.string.localizable.notFoundUnsupportSkins())
+ return
+ }
+
+ UIView.makeAlert(title: R.string.localizable.skinDelete(),
+ detail: R.string.localizable.unsupportSkinsDesc(unsupportSkinNames),
+ confirmTitle: R.string.localizable.confirmDelte(),
+ confirmAction: {
+ for skin in unsupportSkins {
+ Skin.change { realm in
+ skin.skinData?.deleteAndClean(realm: realm)
+ if Settings.defalut.iCloudSyncEnable {
+ skin.isDeleted = true
+ } else {
+ realm.delete(skin)
+ }
+ }
+ }
+ UIView.makeToast(message: R.string.localizable.unsupportSkinsRemoveSuccess())
+ })
+ }
}
extension SkinSettingsView: UICollectionViewDataSource {
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift
index 70d70140..44adadba 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/GameTypeExtensions.swift
@@ -70,7 +70,7 @@ extension GameType {
self = .gg
} else if ["ms", "sms", "bms", "bin"].contains(ext) {
self = .ms
- } else if ["iso", "chd", "ccd", "cue", "m3u"].contains(ext) {
+ } else if ["iso", "chd", "ccd", "cue", "m3u", "ss"].contains(ext) {
self = .ss
} else if ["n64", "v64", "z64"].contains(ext) {
self = .n64
@@ -262,10 +262,8 @@ extension GameType {
func reuseGameType() -> GameType {
if self == .mcd || self == ._32x {
return .md
- } else if self == .sg1000 || self == .gg {
+ } else if self == .sg1000 {
return .ms
- } else if self == .gb {
- return .gbc
}
return self
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/LocaleExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/LocaleExtensions.swift
index 5cbc5ef5..04fb5c29 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/LocaleExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/LocaleExtensions.swift
@@ -116,8 +116,8 @@ extension Locale {
///是否更倾向于美国
static var prefersUS: Bool {
- // 1. 判断用户是否偏好中文
- let prefersChinese: Bool = {
+ // 1. 判断用户是否偏好英文
+ let prefersEnglish: Bool = {
Locale.preferredLanguages.contains { lang in
lang.lowercased().hasPrefix("en")
}
@@ -127,7 +127,7 @@ extension Locale {
let regionCode = Locale.current.regionCode?.uppercased() ?? ""
// 3. 核心判断逻辑
- if prefersChinese && regionCode == "US" {
+ if prefersEnglish && regionCode == "US" {
return true
} else {
return false
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift
index 88eb7ab7..c9e90e2f 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIViewExtensions.swift
@@ -17,9 +17,7 @@ import Schedule
extension UIView {
@discardableResult
func makeBlur(blurRadius: CGFloat = 12.5, blurColor: UIColor = Constants.Color.Background, blurAlpha: CGFloat = 0.9, cornerRadius: CGFloat? = nil) -> VisualEffectView {
- if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
- blurView.removeFromSuperview()
- }
+ removeBlur()
backgroundColor = .clear
let blur = VisualEffectView()
insertSubview(blur, at: 0)
@@ -35,6 +33,18 @@ extension UIView {
return blur
}
+ func removeBlur() {
+ if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
+ blurView.removeFromSuperview()
+ }
+ }
+
+ func setBlurVisble(_ visble: Bool) {
+ if let blurView = subviews.first(where: { $0 is VisualEffectView }) as? VisualEffectView {
+ blurView.isHidden = !visble
+ }
+ }
+
func makeShadow(ofColor: UIColor = Constants.Color.Shadow, radius: CGFloat = 10) {
self.addShadow(ofColor: ofColor, radius: radius)
}
@@ -195,20 +205,20 @@ extension UIView {
alert.config.cardMinWidth = size
alert.config.cardMaxHeight = size
alert.config.cardMinHeight = size
- alert.contentView.layerBorderColor = Constants.Color.Border
+ alert.contentView.layerBorderColor = UIDevice.isDarkMode ? Constants.Color.Border.forceStyle(.dark) : Constants.Color.Border.forceStyle(.light)
alert.contentView.layerBorderWidth = 1
alert.config.cardCornerRadius = Constants.Size.CornerRadiusMid
alert.config.contentViewMask { mask in }
let blur = VisualEffectView()
blur.blurRadius = 12.5
- blur.colorTint = Constants.Color.BackgroundPrimary
+ blur.colorTint = UIDevice.isDarkMode ? Constants.Color.BackgroundPrimary.forceStyle(.dark) : Constants.Color.BackgroundPrimary.forceStyle(.light)
blur.colorTintAlpha = 0.925
alert.contentMaskView = blur
alert.config.backgroundViewMask { mask in
mask.backgroundColor = .black.withAlphaComponent(0.2)
}
let pacman = UIView()
- let activity = NVActivityIndicatorView(frame: .zero, type: .pacman, color: Constants.Color.LabelPrimary, padding: nil)
+ let activity = NVActivityIndicatorView(frame: .zero, type: .pacman, color: UIDevice.isDarkMode ? Constants.Color.LabelPrimary.forceStyle(.dark) : Constants.Color.LabelPrimary.forceStyle(.light), padding: nil)
pacman.addSubview(activity)
activity.snp.makeConstraints { make in
make.centerY.equalToSuperview()
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIimageExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIimageExtensions.swift
index 56d41f8b..499e0d24 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIimageExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIimageExtensions.swift
@@ -83,11 +83,12 @@ extension UIImage {
/// - Parameter preferenceSize: 调整大小
/// - Returns: 图片
static func placeHolder(preferenceSize: CGSize? = nil) -> UIImage {
- let image = R.image.place_holder()!
+ let lightImage = R.image.place_holder(compatibleWith: UITraitCollection(userInterfaceStyle: .light))!
+ let darkImage = R.image.place_holder(compatibleWith: UITraitCollection(userInterfaceStyle: .dark))!
if let preferenceSize = preferenceSize {
- return image.scaled(toSize: preferenceSize) ?? image
+ return UIImage(.dm, light: lightImage.scaled(toSize: preferenceSize) ?? lightImage, dark: darkImage.scaled(toSize: preferenceSize) ?? darkImage)
}
- return image
+ return R.image.place_holder()!
}
/// 根据尺寸缩放图片 如果传入的尺寸比例和原图不一致还会进行居中裁剪
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
index 73b699a1..de3579ad 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
@@ -27,7 +27,7 @@ class FilesImporter: NSObject {
func presentImportController(supportedTypes: [UTType] = UTType.allTypes, allowsMultipleSelection: Bool = true, manualHandle: (([URL])->Void)? = nil, appControllerPresent: Bool = false) {
let documentPickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: supportedTypes, asCopy: true)
documentPickerViewController.delegate = self
- documentPickerViewController.overrideUserInterfaceStyle = .dark
+ documentPickerViewController.overrideUserInterfaceStyle = UIDevice.isDarkMode ? .dark : .light
documentPickerViewController.allowsMultipleSelection = allowsMultipleSelection
documentPickerViewController.modalPresentationStyle = .formSheet
documentPickerViewController.sheetPresentationController?.preferredCornerRadius = Constants.Size.CornerRadiusMax
@@ -992,14 +992,39 @@ extension FilesImporter {
fileprivate static func extractGdiFilenames(from content: String) -> [String] {
var filenames: [String] = []
- let lines = content.split(separator: "\n").map { $0.trimmingCharacters(in: .whitespaces) }
+ // 使用 .newlines 字符集来处理不同系统的换行符(\n, \r\n, \r)
+ let lines = content.components(separatedBy: .newlines)
+ .map { $0.trimmingCharacters(in: .whitespaces) }
+ .filter { !$0.isEmpty }
- // 第一行是文件总数,跳过
+ // GDI 文件格式:
+ // 第一行:轨道总数
+ // 后续行:轨道编号 LBA 类型 扇区大小 文件名 偏移量
+ // 例如:1 0 4 2352 track01.bin 0
+
+ guard lines.count > 1 else {
+ return filenames
+ }
+
+ // 跳过第一行(文件总数)
for line in lines.dropFirst() {
- let components = line.split(separator: " ")
- if components.count >= 2 {
- let filename = components[components.count - 2] // 倒数第二列才是文件名
- filenames.append(String(filename))
+ // 检查行是否为空或者是注释
+ if line.isEmpty || line.hasPrefix("#") {
+ continue
+ }
+
+ let components = line.split(separator: " ", omittingEmptySubsequences: true)
+
+ // GDI 标准格式应该有 6 个字段
+ // 如果少于 5 个字段,说明格式可能有问题
+ if components.count >= 5 {
+ // 文件名在倒数第二列(第5列,索引为4)
+ let filename = String(components[components.count - 2])
+ .trimmingCharacters(in: CharacterSet(charactersIn: "\"")) // 移除可能的引号
+
+ if !filename.isEmpty {
+ filenames.append(filename)
+ }
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/ImageFetcher.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/ImageFetcher.swift
index dfee28e1..ae19e575 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/ImageFetcher.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/ImageFetcher.swift
@@ -96,7 +96,7 @@ fileprivate class ImageFileFetcher: NSObject {
self.completion = completion
let documentPickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.image], asCopy: true)
documentPickerViewController.delegate = self
- documentPickerViewController.overrideUserInterfaceStyle = .dark
+ documentPickerViewController.overrideUserInterfaceStyle = UIDevice.isDarkMode ? .dark : .light
documentPickerViewController.allowsMultipleSelection = false
topViewController()?.present(documentPickerViewController, animated: true)
}
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/MobyGamesKit.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/MobyGamesKit.swift
index 62f39626..7dd0ee58 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/MobyGamesKit.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/MobyGamesKit.swift
@@ -22,7 +22,7 @@ struct MobyGamesKit {
DispatchQueue.global().async {
do {
let db = try Connection(Constants.Path.GamesDB)
- try db.key(Constants.Cipher.UnzipKey)
+ try db.key(Constants.Cipher.ManicKey)
let table = Table(gameTypeName)
// let id = SQLite.Expression<Int>("id")
let url = SQLite.Expression<String>("url")
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/ResourcesKit.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/ResourcesKit.swift
index 1e8e4201..b3a39a07 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/ResourcesKit.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/ResourcesKit.swift
@@ -65,7 +65,7 @@ struct ResourcesKit {
let resourceUrl = Bundle.main.url(forResource: "System", withExtension: "core")!
Log.debug("开始解压资源:\(Date.now.timeIntervalSince1970ms)")
- SSZipArchive.unzipFile(atPath: resourceUrl.path, toDestination: Constants.Path.Resource, overwrite: true, password: Constants.Cipher.UnzipKey, progressHandler: nil) { _, isSuccess, error in
+ SSZipArchive.unzipFile(atPath: resourceUrl.path, toDestination: Constants.Path.Resource, overwrite: true, password: nil, progressHandler: nil) { _, isSuccess, error in
//处理复用皮肤
let reuseCores = System.allCores.filter({ $0.gameType.reuseGameType() != $0.gameType })
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/ThemeManager.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/ThemeManager.swift
index 50e2532f..5d95a9b3 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/ThemeManager.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/ThemeManager.swift
@@ -9,6 +9,7 @@
import RealmSwift
import FluentDarkModeKit
+import ProHUD
class ThemeManager {
static let shared = ThemeManager()
@@ -89,9 +90,9 @@ class ThemeManager {
//刷新整个系统的外观 会驱使traitCollectionDidChange方法进行调用
if let userInterfaceStyle = ApplicationSceneDelegate.applicationWindow?.traitCollection.userInterfaceStyle {
if userInterfaceStyle == .dark {
- ApplicationSceneDelegate.applicationWindow?.overrideUserInterfaceStyle = .light
+ ThemeManager.updateUserInterfaceStyle(.light)
} else {
- ApplicationSceneDelegate.applicationWindow?.overrideUserInterfaceStyle = .dark
+ ThemeManager.updateUserInterfaceStyle(.dark)
}
}
self.updateAppearance()
@@ -134,11 +135,20 @@ class ThemeManager {
func updateAppearance() {
switch Settings.appearance {
case .auto:
- ApplicationSceneDelegate.applicationWindow?.overrideUserInterfaceStyle = .unspecified
+ ThemeManager.updateUserInterfaceStyle(.unspecified)
case .light:
- ApplicationSceneDelegate.applicationWindow?.overrideUserInterfaceStyle = .light
+ ThemeManager.updateUserInterfaceStyle(.light)
case .dark:
- ApplicationSceneDelegate.applicationWindow?.overrideUserInterfaceStyle = .dark
+ ThemeManager.updateUserInterfaceStyle(.dark)
}
}
+
+ static func updateUserInterfaceStyle(_ style: UIUserInterfaceStyle) {
+ UIApplication.shared.connectedWindowScenes.forEach { windowScene in
+ windowScene.windows.forEach { window in
+ window.overrideUserInterfaceStyle = style
+ }
+ }
+ AppContext.overrideUserInterfaceStyle = style
+ }
}
diff --git a/ManicSupport/Resources/System.core b/ManicSupport/Resources/System.core
index 0bb2d523..a505ea2e 100644
--- a/ManicSupport/Resources/System.core
+++ b/ManicSupport/Resources/System.core
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:18655763a0f1fb46e940fb85fbce8c826a3bc5915d2d77e9643f0a214f35bc88
-size 59484950
+oid sha256:f641b1e15cb96b0aff5dd5f027a7f26547c0aae11c7ac512f4155b91349111c2
+size 66405348
diff --git a/ProHUD/Sources/ProHUD/Core/Utils/AppContext.swift b/ProHUD/Sources/ProHUD/Core/Utils/AppContext.swift
index ffa5c8c4..cc3ec336 100644
--- a/ProHUD/Sources/ProHUD/Core/Utils/AppContext.swift
+++ b/ProHUD/Sources/ProHUD/Core/Utils/AppContext.swift
@@ -95,6 +95,9 @@ extension AppContext {
})
}
+ ///设置外观
+ public static var overrideUserInterfaceStyle: UIUserInterfaceStyle = .dark
+
/// 外部窗口信息(由外部设置)
private static var externalWindowInfo: (window: UIWindow, isActive: Bool)?
diff --git a/ProHUD/Sources/ProHUD/Core/Views/Window.swift b/ProHUD/Sources/ProHUD/Core/Views/Window.swift
index b072e362..75d401c8 100644
--- a/ProHUD/Sources/ProHUD/Core/Views/Window.swift
+++ b/ProHUD/Sources/ProHUD/Core/Views/Window.swift
@@ -32,6 +32,10 @@ class Window: UIWindow {
makeKeyAndVisible()
resignKey()
backgroundColor = .clear
+
+ //设置外观
+ overrideUserInterfaceStyle = AppContext.overrideUserInterfaceStyle
+
if usingBackground {
insertSubview(backgroundView, at: 0)
backgroundView.snp.remakeConstraints { make in
diff --git a/ProHUD/Sources/ProHUD/Sheet/SheetConfiguration.swift b/ProHUD/Sources/ProHUD/Sheet/SheetConfiguration.swift
index 979c815b..3b71e24e 100644
--- a/ProHUD/Sources/ProHUD/Sheet/SheetConfiguration.swift
+++ b/ProHUD/Sources/ProHUD/Sheet/SheetConfiguration.swift
@@ -66,6 +66,6 @@ public class SheetConfiguration: CommonConfiguration {
animateDurationForBuildOut ?? 0.24
}
- override var cardCornerRadiusByDefault: CGFloat { cardCornerRadius ?? 32 }
+ override var cardCornerRadiusByDefault: CGFloat { cardCornerRadius ?? 0 }
}