diff --git a/src/MeloNX/MeloNX.xcodeproj/project.pbxproj b/src/MeloNX/MeloNX.xcodeproj/project.pbxproj index 018cfb3c3..b9cdd4b14 100644 --- a/src/MeloNX/MeloNX.xcodeproj/project.pbxproj +++ b/src/MeloNX/MeloNX.xcodeproj/project.pbxproj @@ -640,6 +640,7 @@ "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", + "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", ); GCC_OPTIMIZATION_LEVEL = fast; GENERATE_INFOPLIST_FILE = YES; @@ -652,8 +653,7 @@ INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UIRequiresFullScreen = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; INFOPLIST_KEY_UISupportsDocumentBrowser = YES; IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -727,6 +727,7 @@ "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", + "$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries", ); GCC_OPTIMIZATION_LEVEL = fast; GENERATE_INFOPLIST_FILE = YES; @@ -739,8 +740,7 @@ INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UIRequiresFullScreen = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; INFOPLIST_KEY_UISupportsDocumentBrowser = YES; IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/src/MeloNX/MeloNX.xcodeproj/project.xcworkspace/xcuserdata/stossy11.xcuserdatad/UserInterfaceState.xcuserstate b/src/MeloNX/MeloNX.xcodeproj/project.xcworkspace/xcuserdata/stossy11.xcuserdatad/UserInterfaceState.xcuserstate index 7a136333a..650e96872 100644 Binary files a/src/MeloNX/MeloNX.xcodeproj/project.xcworkspace/xcuserdata/stossy11.xcuserdatad/UserInterfaceState.xcuserstate and b/src/MeloNX/MeloNX.xcodeproj/project.xcworkspace/xcuserdata/stossy11.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/MeloNX/MeloNX/App/Core/Ryujinx/Display/DisplayVisible.swift b/src/MeloNX/MeloNX/App/Core/Ryujinx/Display/DisplayVisible.swift index 2ff930610..ec463cae8 100644 --- a/src/MeloNX/MeloNX/App/Core/Ryujinx/Display/DisplayVisible.swift +++ b/src/MeloNX/MeloNX/App/Core/Ryujinx/Display/DisplayVisible.swift @@ -8,6 +8,7 @@ import Foundation import GameController import UIKit +import SwiftUI @@ -16,12 +17,77 @@ extension UIWindow { // Makes the SDLWindow use the current WindowScene instead of making its own window. // Also waits for the window to append the on-screen controller @objc func wdb_makeKeyAndVisible() { - if #available(iOS 13.0, *) { - // self.windowScene = (UIApplication.shared.connectedScenes.first! as! UIWindowScene) + if #unavailable(iOS 17.0) { + self.windowScene = (UIApplication.shared.connectedScenes.first! as! UIWindowScene) } + self.wdb_makeKeyAndVisible() theWindow = self - Ryujinx.shared.repeatuntilfindLayer() + + if #available(iOS 17, *) { + Ryujinx.shared.repeatuntilfindLayer() + } else { + waitForController() + } + } +} + +// MARK: - iOS 16 and below Only + +var hostingController: UIHostingController? +func waitForController() { + guard let window = theWindow else { return } + + // Function to search for an existing UIHostingController with ControllerView + func findGCControllerView(in view: UIView) -> UIHostingController? { + if let hostingVC = view.next as? UIHostingController { + return hostingVC + } + + for subview in view.subviews { + if let found = findGCControllerView(in: subview) { + return found + } + } + + return nil + } + + let controllerView = ControllerView() + let newHostingController = UIHostingController(rootView: controllerView) + + hostingController = newHostingController + + let containerView = newHostingController.view! + containerView.backgroundColor = .clear + containerView.frame = window.bounds + containerView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + + // Timer for controller + Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in + if findGCControllerView(in: window) == nil { + // Adds Virtual Controller Subview + window.addSubview(containerView) + window.bringSubviewToFront(containerView) + + if let sdlWindow = SDL_GetWindowFromID(1) { + SDL_SetWindowPosition(sdlWindow, 0, 0) + } + + timer.invalidate() + } + } +} + + +class TransparentHostingContainerView: UIView { + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + // Check if the point is within the subviews of this container + let view = super.hitTest(point, with: event) + print(view) + + // Return nil if the touch is outside visible content (passes through to views below) + return view === self ? nil : view } } diff --git a/src/MeloNX/MeloNX/App/Core/Ryujinx/Ryujinx.swift b/src/MeloNX/MeloNX/App/Core/Ryujinx/Ryujinx.swift index 2083e9e82..ce788b114 100644 --- a/src/MeloNX/MeloNX/App/Core/Ryujinx/Ryujinx.swift +++ b/src/MeloNX/MeloNX/App/Core/Ryujinx/Ryujinx.swift @@ -528,4 +528,3 @@ class Ryujinx { } - diff --git a/src/MeloNX/MeloNX/App/Views/ContentView.swift b/src/MeloNX/MeloNX/App/Views/ContentView.swift index 7ae91f806..4f8c8f339 100644 --- a/src/MeloNX/MeloNX/App/Views/ContentView.swift +++ b/src/MeloNX/MeloNX/App/Views/ContentView.swift @@ -86,38 +86,45 @@ struct ContentView: View { Air.play(AnyView(emulationView)) } } else { - - emulationView - .onAppear() { - // This is fro the old exiting game feature that didn't work properly. will look into it and figure out a better alternative - /* - Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in - timer.invalidate() - quits = quit - - if quits { - quit = false - timer.invalidate() - } - } - */ - } + ZStack { + emulationView + .onAppear() { + // This is fro the old exiting game feature that didn't work properly. will look into it and figure out a better alternative + /* + Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in + timer.invalidate() + quits = quit + + if quits { + quit = false + timer.invalidate() + } + } + */ + } + } } } else { // This is when the game starts to stop the animation - EmulationView() - .onAppear() { - isAnimating = false + if #available(iOS 16, *) { + EmulationView() + .persistentSystemOverlays(.hidden) + .onAppear() { + isAnimating = false + } + } else { + VStack { + } + + } } } else { // This is the main menu view that includes the Settings and the Game Selector mainMenuView .onAppear() { quits = false - - - + initControllerObservers() // This initializes the Controller Observers that refreshes the controller list when a new controller connecvts. } .onOpenURL() { url in @@ -216,6 +223,7 @@ struct ContentView: View { withAnimation { isLoading = false } + isAnimating = false timer.invalidate() } diff --git a/src/MeloNX/MeloNX/Dependencies/Dynamic Libraries/libMoltenVK.dylib b/src/MeloNX/MeloNX/Dependencies/Dynamic Libraries/libMoltenVK.dylib index ddf960dc7..b64e5535f 100755 Binary files a/src/MeloNX/MeloNX/Dependencies/Dynamic Libraries/libMoltenVK.dylib and b/src/MeloNX/MeloNX/Dependencies/Dynamic Libraries/libMoltenVK.dylib differ diff --git a/src/MeloNX/MeloNX/Dependencies/XCFrameworks/MoltenVK.xcframework/ios-arm64/MoltenVK.framework/MoltenVK b/src/MeloNX/MeloNX/Dependencies/XCFrameworks/MoltenVK.xcframework/ios-arm64/MoltenVK.framework/MoltenVK index ddf960dc7..b64e5535f 100755 Binary files a/src/MeloNX/MeloNX/Dependencies/XCFrameworks/MoltenVK.xcframework/ios-arm64/MoltenVK.framework/MoltenVK and b/src/MeloNX/MeloNX/Dependencies/XCFrameworks/MoltenVK.xcframework/ios-arm64/MoltenVK.framework/MoltenVK differ diff --git a/src/MeloNX/MeloNX/MeloNX.entitlements b/src/MeloNX/MeloNX/MeloNX.entitlements index aff1d9915..99f471672 100644 --- a/src/MeloNX/MeloNX/MeloNX.entitlements +++ b/src/MeloNX/MeloNX/MeloNX.entitlements @@ -2,10 +2,6 @@ - com.apple.developer.kernel.extended-virtual-addressing - - com.apple.developer.kernel.increased-debugging-memory-limit - com.apple.developer.kernel.increased-memory-limit diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 28d05a526..2300a440d 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -1255,7 +1255,7 @@ namespace Ryujinx.Graphics.Vulkan int vbSize = vertexBuffer.Buffer.Size; - if (Gd.Vendor == Vendor.Amd && !Gd.IsMoltenVk && vertexBuffer.Stride > 0) + if ((Gd.Vendor == Vendor.Amd || !OperatingSystem.IsIOSVersionAtLeast(17)) && !Gd.IsMoltenVk && vertexBuffer.Stride > 0) { // AMD has a bug where if offset + stride * count is greater than // the size, then the last attribute will have the wrong value.