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

Optimized the landscape cover swipe experience; added external game import for DukeX;

Daiunodb3b558cbee5
diff --git a/ManicEmu/ManicEmu/Resources/Base.lproj/LaunchScreen.storyboard b/ManicEmu/ManicEmu/Resources/Base.lproj/LaunchScreen.storyboard
index 464194ce..945914bc 100644
--- a/ManicEmu/ManicEmu/Resources/Base.lproj/LaunchScreen.storyboard
+++ b/ManicEmu/ManicEmu/Resources/Base.lproj/LaunchScreen.storyboard
@@ -22,7 +22,7 @@
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch_bg" translatesAutoresizingMaskIntoConstraints="NO" id="dGb-Sc-2GC">
<rect key="frame" x="0.0" y="0.0" width="440" height="956"/>
</imageView>
- <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_corner" translatesAutoresizingMaskIntoConstraints="NO" id="X4q-0E-ySM">
+ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_corner" translatesAutoresizingMaskIntoConstraints="NO" id="X4q-0E-ySM">
<rect key="frame" x="180" y="358" width="80" height="80"/>
<constraints>
<constraint firstAttribute="height" constant="80" id="CfA-Vj-G08"/>
@@ -35,7 +35,7 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
</imageView>
- <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="app_title_light" translatesAutoresizingMaskIntoConstraints="NO" id="yFS-J3-ZEP">
+ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="app_title_light" translatesAutoresizingMaskIntoConstraints="NO" id="yFS-J3-ZEP">
<rect key="frame" x="150.66666666666666" y="472" width="138.99999999999997" height="12"/>
</imageView>
</subviews>
diff --git a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
index 52bc0cb9..b41ea7a6 100644
--- a/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/ApplicationSceneDelegate.swift
@@ -92,7 +92,9 @@ class ApplicationSceneDelegate: UIResponder, UIWindowSceneDelegate {
if let host = url.host, host == R.Strings.MeloNXScheme {
EmulatorInteractionKit.processGames(type: .meloNX, callbackUrl: url)
} else if let host = url.host, host == R.Strings.XeniOSScheme {
- EmulatorInteractionKit.processGames(type: .xeniOS,callbackUrl: url)
+ EmulatorInteractionKit.processGames(type: .xeniOS, callbackUrl: url)
+ } else if let host = url.host, host == R.Strings.DukeXScheme {
+ EmulatorInteractionKit.processGames(type: .dukeX, callbackUrl: url)
} else {
Self.launchGameID = url.lastPathComponent
}
diff --git a/ManicEmu/ManicEmu/Sources/Base/Constants.swift b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
index a16e997d..5e9cf429 100644
--- a/ManicEmu/ManicEmu/Sources/Base/Constants.swift
+++ b/ManicEmu/ManicEmu/Sources/Base/Constants.swift
@@ -239,7 +239,7 @@ extension _R {
let height = WindowHeight * 0.9
return CGSize(width: height*9/16, height: height)
} else {
- let width = WindowWidth*0.5
+ let width = WindowWidth*(UIDevice.isPadMini ? 0.65 : 0.5)
return CGSize(width: width, height: width*16/9)
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Protocols/ViewTransition.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Protocols/ViewTransition.swift
index 99cd41be..9e204951 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Protocols/ViewTransition.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Protocols/ViewTransition.swift
@@ -10,6 +10,8 @@
protocol ViewTransition where Self: UIView {
///About to start rotating.
///The device's orientation is correct, but the window size is still using old data.
+ ///belove iOS 16 orientation is not correct too!!!
+ ///So for iOS 16 and below, this method is simulated using viewAlongsideTransition.
func viewWillTransition()
///Rotation in progress, with implicit animation supported.
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift
index 1652b666..bba8d967 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/ASListPageView.swift
@@ -506,6 +506,9 @@ extension ASListPageView {
if enableSafeAreaBottomInsets {
contentInset.bottom += R.Size.SafeArea.bottom
+ if UIDevice.isSmallScreenPhone {
+ contentInset.bottom += R.Size.ContentInsetBottom
+ }
}
collectionView.contentInset = contentInset
@@ -731,6 +734,9 @@ extension ASListPageView {
if listPage.enableSafeAreaBottomInsets {
height += R.Size.SafeArea.bottom
+ if UIDevice.isSmallScreenPhone {
+ height += R.Size.ContentInsetBottom
+ }
}
return height
diff --git a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift
index dbfca6fe..36536c0f 100644
--- a/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/GameInfo/VIews/GameInfoView.swift
@@ -142,7 +142,7 @@ class GameInfoView: BaseView {
addSubviews([gameCoverView, gameOptionView, navigationView, gameInfoDetailView])
updateViewsConstraints()
- gameUpdateToken = game.observe(keyPaths: [\Game.gameCover, \Game.icon], { [weak self] changes in
+ gameUpdateToken = game.observe(keyPaths: [\Game.gameCover, \Game.icon, \Game.onlineCoverUrl], { [weak self] changes in
guard let self else { return }
switch changes {
case .change:
@@ -156,6 +156,14 @@ class GameInfoView: BaseView {
if let image {
self.gameCoverView.updateImage(image)
self.navigationView.gameCover.image = image.scaled(toSize: CGSize(R.Size.ItemHeightLarge - R.Size.ContentSpaceSmall*2))
+ } else if let onlineCoverUrl = self.game.onlineCoverUrl {
+ self.game.getCoverImage(completion: { [weak self] image in
+ guard let self else { return }
+ if let image {
+ self.gameCoverView.updateImage(image)
+ self.navigationView.gameCover.image = image.scaled(toSize: CGSize(R.Size.ItemHeightLarge - R.Size.ContentSpaceSmall*2))
+ }
+ })
}
default:
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift
index 5aadabeb..6b435905 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameLandscapeCarouselCell.swift
@@ -47,7 +47,10 @@ enum LandscapeCarouselStyle: Int, CaseIterable {
}
}
- //MARK: Layout选择持久化(每种样式族各自记住上次选中的Layout)
+ /// Snapshot slices are captured per page and tear if a flick lands mid-transform.
+ var usesSystemPaging: Bool { self == .snapshot }
+
+ //MARK: Layout selection (each style remembers its last preset)
static var currentScaleLayout: ScaleTransformViewOptions.Layout {
get {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift
index d163ec3f..3e15354e 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Games/Views/GameListLandscapeView.swift
@@ -108,7 +108,7 @@ class GameListLandscapeView: BaseView {
//MARK: - content区(轮播)
private lazy var carouselLayout: CollectionViewPagingLayout = {
let layout = CollectionViewPagingLayout()
- layout.numberOfVisibleItems = 10
+ layout.numberOfVisibleItems = 20
layout.scrollDirection = .horizontal
layout.delegate = self
return layout
@@ -117,7 +117,7 @@ class GameListLandscapeView: BaseView {
private lazy var carouselView: UICollectionView = {
let view = UICollectionView(frame: .zero, collectionViewLayout: carouselLayout)
view.backgroundColor = .clear
- view.isPagingEnabled = true
+ view.isPagingEnabled = LandscapeCarouselStyle.current.usesSystemPaging
view.showsHorizontalScrollIndicator = false
view.clipsToBounds = false
view.contentInsetAdjustmentBehavior = .never
@@ -224,11 +224,18 @@ class GameListLandscapeView: BaseView {
}
private var lastLayoutSize: CGSize = .zero
- ///信息面板最近一次的定位 避免重复更新约束
+ /// Last info-panel anchor; skip constraint updates when unchanged.
private var lastPanelAnchor: CGPoint = .zero
+ /// Scale/Stack flick in progress; focus info waits until the snap finishes.
+ private var isCarouselUserScrolling = false
+ private var isCarouselSnapping = false
private var notificationTokens = [Any]()
+ private var usesSystemCarouselPaging: Bool {
+ LandscapeCarouselStyle.current.usesSystemPaging
+ }
+
//MARK: - 生命周期
override init(frame: CGRect) {
super.init(frame: frame)
@@ -317,13 +324,15 @@ class GameListLandscapeView: BaseView {
}
updateTipsButton()
- //聚焦信息面板 位置跟随聚焦cell 由updateInfoPanelPosition动态更新偏移
+ // Info panel tracks the focused cover; offsets are updated in updateInfoPanelPosition.
addSubview(infoPanelView)
infoPanelView.snp.makeConstraints { make in
make.centerX.equalTo(self.snp.leading).offset(0)
make.top.equalTo(self.snp.top).offset(0)
make.width.lessThanOrEqualToSuperview().offset(-R.Size.ContentSpaceLarge*2)
}
+
+ applyCarouselPagingMode()
}
private func setupDatas() {
@@ -529,6 +538,7 @@ class GameListLandscapeView: BaseView {
private func reloadAll(keepFocus: Bool) {
let focusId = keepFocus ? focusedGame?.id : nil
rebuildDatas()
+ applyCarouselPagingMode()
carouselLayout.invalidateLayoutInBatchUpdate()
carouselView.reloadData()
@@ -538,7 +548,7 @@ class GameListLandscapeView: BaseView {
carouselLayout.setCurrentPage(0, animated: false)
}
updateFocusedGameInfo()
- //cell布局完成后再校准信息面板位置
+ // Cell frames are ready on the next cycle; snap the info panel then.
DispatchQueue.main.async { [weak self] in
self?.updateInfoPanelPosition()
self?.syncCarouselFocusTargets()
@@ -1019,16 +1029,108 @@ class GameListLandscapeView: BaseView {
}
}
- //MARK: - 聚焦信息面板位置
+ //MARK: - Carousel paging & info panel
+
+ /// Snapshot keeps system paging. Scale/Stack allow inertial flicks that snap onto a card.
+ private func applyCarouselPagingMode() {
+ let paging = usesSystemCarouselPaging
+ carouselView.isPagingEnabled = paging
+ isCarouselUserScrolling = false
+ isCarouselSnapping = false
+ infoPanelView.alpha = 1
+ infoPanelView.isUserInteractionEnabled = true
+ }
+
+ /// Maps pan velocity (pt/ms) to pages.
+ /// Light/normal → 1 page; a mid skip sits between that and a firm flick; hardest → first/last.
+ private func carouselFlickSpeed(_ velocityX: CGFloat) -> CGFloat {
+ var speed = abs(velocityX)
+ // Documented as pt/ms; if a build reports pt/s the values are hundreds+.
+ if speed > 20 {
+ speed /= 1000
+ }
+ return speed
+ }
+
+ private func carouselPagesForVelocity(_ velocityX: CGFloat, pageCount: Int) -> Int {
+ let speed = carouselFlickSpeed(velocityX)
+ if speed < 0.50 {
+ return 0
+ }
+ if speed < 2.5 {
+ return 1
+ }
+ if speed < 3.0 {
+ return 2
+ }
+ if speed < 3.5 {
+ let t = (speed - 3.0) / 0.40
+ return min(1 + Int((2.0 * t).rounded()), pageCount)
+ }
+ if speed < 4.0 {
+ let t = (speed - 3.5) / 0.50
+ return min(2 + Int((4.0 * t).rounded()), pageCount)
+ }
+ if speed < 4.50 {
+ let t = (speed - 4.0) / 0.60
+ return min(4 + Int((8.0 * t).rounded()), pageCount)
+ }
+ if speed < 5.0 {
+ let t = (speed - 4.50) / 0.70
+ return min(8 + Int((20.0 * t).rounded()), pageCount)
+ }
+ return pageCount
+ }
+
+ private func carouselTargetPage(offset: CGFloat,
+ proposedOffset: CGFloat,
+ velocityX: CGFloat,
+ pageWidth: CGFloat,
+ pageCount: Int) -> Int {
+ guard pageCount > 0, pageWidth > 0 else { return 0 }
+ let fractional = offset / pageWidth
+ let pages = carouselPagesForVelocity(velocityX, pageCount: pageCount)
+ let direction: Int
+ if pages == 0 {
+ direction = 0
+ } else if abs(proposedOffset - offset) > 0.5 {
+ direction = proposedOffset > offset ? 1 : -1
+ } else {
+ // Full-width pages often project ~0; pan-right decreases contentOffset.
+ direction = velocityX > 0 ? -1 : 1
+ }
+
+ let raw: Int
+ if direction == 0 {
+ raw = Int(fractional.rounded())
+ } else if direction > 0 {
+ raw = Int(floor(fractional)) + pages
+ } else {
+ raw = Int(ceil(fractional)) - pages
+ }
+ return min(max(raw, 0), pageCount - 1)
+ }
- ///信息面板跟随聚焦cell的封面底部 并相对封面居中(部分样式的聚焦cell不居中)
+ private func settleCarouselAfterUserScroll() {
+ guard isCarouselUserScrolling || isCarouselSnapping else { return }
+ isCarouselUserScrolling = false
+ isCarouselSnapping = false
+ infoPanelView.alpha = 1
+ infoPanelView.isUserInteractionEnabled = true
+ updateFocusedGameInfo()
+ updateInfoPanelPosition()
+ syncCarouselFocusTargets()
+ transferCarouselCardFocusIfNeeded()
+ }
+
+ /// Info panel follows the focused cover's bottom edge and stays centered under it.
private func updateInfoPanelPosition() {
let index = carouselLayout.currentPage
guard index >= 0, index < displayGames.count,
let cell = carouselView.cellForItem(at: IndexPath(item: index, section: 0)) as? GameLandscapeCarouselCell,
let cardSuperview = cell.cardView.superview else { return }
- //cardView.frame包含transform后的包围盒 聚焦cell transform接近identity
+ // cardView.frame is the post-transform bounds; the focused card is near identity.
let cardFrame = convert(cell.cardView.frame, from: cardSuperview)
guard cardFrame.width > 0, cardFrame.height > 0 else { return }
@@ -1173,7 +1275,7 @@ extension GameListLandscapeView: UICollectionViewDelegate {
NotificationCenter.default.post(name: R.NotificationName.HomeSelectionChange, object: HomeTabBar.BarSelection.imports)
return
}
- //轮播:点击非聚焦cell滚动聚焦 点击聚焦cell等同开始游戏
+ // Tap a side card to focus it; tap the focused card to start the game.
if indexPath.row != carouselLayout.currentPage {
carouselLayout.setCurrentPage(indexPath.row)
} else if let game = focusedGame {
@@ -1182,9 +1284,63 @@ extension GameListLandscapeView: UICollectionViewDelegate {
}
}
+ func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+ guard scrollView === carouselView, !usesSystemCarouselPaging else { return }
+ isCarouselUserScrolling = true
+ }
+
+ func scrollViewWillEndDragging(_ scrollView: UIScrollView,
+ withVelocity velocity: CGPoint,
+ targetContentOffset: UnsafeMutablePointer<CGPoint>) {
+ guard scrollView === carouselView, !usesSystemCarouselPaging, !showsEmptyCard else { return }
+ let pageWidth = scrollView.bounds.width
+ let pageCount = carouselView.numberOfItems(inSection: 0)
+ guard pageWidth > 0, pageCount > 0 else { return }
+
+ let targetPage = carouselTargetPage(offset: scrollView.contentOffset.x,
+ proposedOffset: targetContentOffset.pointee.x,
+ velocityX: velocity.x,
+ pageWidth: pageWidth,
+ pageCount: pageCount)
+ let targetX = CGFloat(targetPage) * pageWidth
+ let distancePages = abs(scrollView.contentOffset.x - targetX) / pageWidth
+
+ // Same settle path as tapping a card: system setContentOffset animation.
+ targetContentOffset.pointee = scrollView.contentOffset
+
+ if distancePages < 0.002 {
+ carouselLayout.setCurrentPage(targetPage, animated: false)
+ settleCarouselAfterUserScroll()
+ return
+ }
+
+ isCarouselSnapping = true
+ carouselLayout.setCurrentPage(targetPage, animated: true) { [weak self] in
+ self?.settleCarouselAfterUserScroll()
+ }
+ }
+
+ func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
+ guard scrollView === carouselView, !usesSystemCarouselPaging else { return }
+ if !decelerate && !isCarouselSnapping {
+ settleCarouselAfterUserScroll()
+ }
+ }
+
+ func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
+ guard scrollView === carouselView, !usesSystemCarouselPaging else { return }
+ if !isCarouselSnapping {
+ settleCarouselAfterUserScroll()
+ }
+ }
+
+ func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
+ guard scrollView === carouselView, !usesSystemCarouselPaging else { return }
+ settleCarouselAfterUserScroll()
+ }
+
func scrollViewDidScroll(_ scrollView: UIScrollView) {
guard scrollView === carouselView else { return }
- //滚动过程中信息面板实时跟随聚焦cell
updateInfoPanelPosition()
}
}
@@ -1192,6 +1348,9 @@ extension GameListLandscapeView: UICollectionViewDelegate {
//MARK: - CollectionViewPagingLayoutDelegate
extension GameListLandscapeView: CollectionViewPagingLayoutDelegate {
func onCurrentPageChanged(layout: CollectionViewPagingLayout, currentPage: Int) {
+ if isCarouselUserScrolling || isCarouselSnapping {
+ return
+ }
updateFocusedGameInfo()
updateInfoPanelPosition()
syncCarouselFocusTargets()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift
index 209ce122..bd64ac26 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Home/ViewControllers/HomeViewController.swift
@@ -189,7 +189,9 @@ class HomeViewController: BaseViewController {
override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
- NotificationCenter.default.post(name: R.NotificationName.ViewWillTransition, object: nil)
+ if !UIDevice.isIOS15 {
+ NotificationCenter.default.post(name: R.NotificationName.ViewWillTransition, object: nil)
+ }
homeTabBarBlurView.isHidden = UIDevice.isLandscape
coordinator.animate(alongsideTransition: { [weak self] _ in
guard let self else { return }
@@ -201,6 +203,9 @@ class HomeViewController: BaseViewController {
}
}
self.updateLandscapeBackgroundVisible()
+ if UIDevice.isIOS15 {
+ NotificationCenter.default.post(name: R.NotificationName.ViewWillTransition, object: nil)
+ }
NotificationCenter.default.post(name: R.NotificationName.ViewAlongsideTransition, object: nil)
self.homeTabBar.isHidden = UIDevice.isPhone && UIDevice.isLandscape
}, completion: { _ in
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index a8c3bff8..e2502ef1 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@ -2353,7 +2353,7 @@ extension PlayViewController {
/// 按照配置开始强制旋转屏幕
private func startOrientation() {
- if #available(iOS 16.0, *) {
+ if #available(iOS 16.0, tvOS 16.0, *) {
self.setNeedsUpdateOfSupportedInterfaceOrientations()
if let scene = ApplicationSceneDelegate.applicationScene {
if manicGame.orientation == .landscape {
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift
index c4dd3e02..613845ac 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Extensions/UIDeviceExtensions.swift
@@ -175,7 +175,7 @@ extension UIDevice {
}
static var isIOS15: Bool {
- if #available(iOS 16, *) {
+ if #available(iOS 16.0, tvOS 16.0, *) {
return false
} else {
return true
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/Database.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/Database.swift
index b5f26403..cc312782 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/Database.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/Database.swift
@@ -427,29 +427,20 @@ struct Database {
}
private static func generateDefaultSkins() -> [Skin] {
- //添加默认皮肤
+ //Add default skin
var defaultSkins = [Skin]()
System.allCores.forEach { core in
let gameType = core.gameType
if let controllerSkin = ControllerSkin.standardControllerSkin(for: gameType),
let hash = FileHashUtil.truncatedHash(url: controllerSkin.fileURL) {
- if let skin = realm.object(ofType: Skin.self, forPrimaryKey: hash) {
- //这种情况 可能Settings被删除了
- Log.error("Settings被误删除了! ")
- try? realm.write {
- realm.delete(skin)
- }
- defaultSkins.append(skin)
- } else {
- let skin = Skin()
- skin.id = hash
- skin.identifier = controllerSkin.identifier
- skin.name = controllerSkin.name
- skin.fileName = controllerSkin.fileURL.lastPathComponent
- skin.gameType = controllerSkin.gameType
- skin.skinType = .default
- defaultSkins.append(skin)
- }
+ let skin = Skin()
+ skin.id = hash
+ skin.identifier = controllerSkin.identifier
+ skin.name = controllerSkin.name
+ skin.fileName = controllerSkin.fileURL.lastPathComponent
+ skin.gameType = controllerSkin.gameType
+ skin.skinType = .default
+ defaultSkins.append(skin)
}
}
return defaultSkins
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift
index 31bed35f..5e95aca7 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/EmulatorInteractionKit.swift
@@ -146,8 +146,8 @@ struct GameScheme: Codable, Identifiable, Equatable, Hashable, Sendable {
static func pullFromURL(_ url: URL) -> [GameScheme] {
if let components = URLComponents(url: url, resolvingAgainstBaseURL: true) {
- if let text = components.queryItems?.first(where: { $0.name == "games" })?.value, let data = GameScheme.base64URLDecode(text) {
-
+ if let text = components.queryItems?.first(where: { $0.name == "games" })?.value,
+ let data = GameScheme.base64URLDecode(text) {
if let decoded = try? JSONDecoder().decode([GameScheme].self, from: data) {
return decoded
}