2.4
This commit is contained in:
parent
94343b3f3b
commit
834b7e6b02
@ -18,6 +18,7 @@ struct ContentView: View {
|
||||
@AppStorage("useTrollStore") var useTrollStore: Bool = false
|
||||
@AppStorage("showMetalHUD") var showMetalHUD: Bool = false
|
||||
@AppStorage("canShowMetalHUD") var canShowMetalHUD: Bool = false
|
||||
@AppStorage("HideMenuButton") private var HideMenuButton: Bool = true
|
||||
@State var core = Core(games: [], root: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0])
|
||||
var body: some View {
|
||||
//NavView(core: $core) // pain and suffering
|
||||
|
@ -38,7 +38,10 @@ class SudachiEmulationViewModel: ObservableObject {
|
||||
|
||||
iscustom = ((sudachiGame?.fileURL.startAccessingSecurityScopedResource()) != nil)
|
||||
|
||||
DispatchQueue.global(qos: .userInitiated).async { [self] in
|
||||
print(sudachiGame)
|
||||
|
||||
print("is outside url? \(iscustom ? "Yes" : "no")")
|
||||
DispatchQueue.global(qos: .userInteractive).async { [self] in
|
||||
if let sudachiGame = self.sudachiGame {
|
||||
|
||||
if sudachiGame.fileURL == URL(string: "BootMii") {
|
||||
@ -61,12 +64,7 @@ class SudachiEmulationViewModel: ObservableObject {
|
||||
|
||||
private func step() {
|
||||
while true {
|
||||
if !isPaused {
|
||||
sudachi.step()
|
||||
} else {
|
||||
print("pased")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ struct SudachiEmulationView: View {
|
||||
@State private var timer: Timer?
|
||||
@Environment(\.scenePhase) var scenePhase
|
||||
@AppStorage("isairplay") private var isairplay: Bool = true
|
||||
@AppStorage("HideMenuButton") private var HideMenuButton: Bool = true
|
||||
let documentsDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
|
||||
@ -43,7 +44,7 @@ struct SudachiEmulationView: View {
|
||||
|
||||
|
||||
ControllerView()
|
||||
|
||||
if !HideMenuButton {
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
@ -109,6 +110,7 @@ struct SudachiEmulationView: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.overlay(
|
||||
// Loading screen overlay on top of MetalView
|
||||
Group {
|
||||
|
@ -12,11 +12,28 @@ import Sudachi
|
||||
struct BottomMenuView: View {
|
||||
@Binding var core: Core
|
||||
@State var isImporting: Bool = false
|
||||
@State var isSelecting: Bool = false
|
||||
|
||||
@State var urlgame: PomeloGame?
|
||||
|
||||
@State var startgame = false
|
||||
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 40) {
|
||||
|
||||
NavigationLink(
|
||||
destination: urlgame != nil ? AnyView(SudachiEmulationView(game: urlgame!)) : AnyView(EmptyView()),
|
||||
// destination: SudachiEmulationView(game: urlgame),
|
||||
isActive: $startgame,
|
||||
label: {
|
||||
EmptyView() // Keeps the link hidden
|
||||
}
|
||||
)
|
||||
.hidden()
|
||||
|
||||
Button {
|
||||
if let url = URL(string: "messages://") { // Replace appScheme with the actual URL scheme of the app
|
||||
if let url = URL(string: "messages://") {
|
||||
if UIApplication.shared.canOpenURL(url) {
|
||||
UIApplication.shared.open(url, options: [:]) { (success) in
|
||||
if success {
|
||||
@ -51,8 +68,19 @@ struct BottomMenuView: View {
|
||||
.foregroundColor(Color.init(uiColor: .darkGray))
|
||||
}
|
||||
|
||||
Menu {
|
||||
Button {
|
||||
isImporting = true
|
||||
} label: {
|
||||
Text("Import Files")
|
||||
}
|
||||
|
||||
Button {
|
||||
isSelecting = true
|
||||
isImporting.toggle()
|
||||
} label: {
|
||||
Text("Open Game (without importing)")
|
||||
}
|
||||
} label: {
|
||||
Circle()
|
||||
.overlay {
|
||||
@ -65,6 +93,7 @@ struct BottomMenuView: View {
|
||||
}
|
||||
|
||||
|
||||
|
||||
NavigationLink(destination: SettingsView(core: core)) {
|
||||
Circle()
|
||||
.overlay {
|
||||
@ -89,9 +118,47 @@ struct BottomMenuView: View {
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 20)
|
||||
|
||||
.fileImporter(isPresented: $isImporting, allowedContentTypes: [.zip, .item]) { result in
|
||||
switch result {
|
||||
case .success(let url):
|
||||
if isSelecting {
|
||||
startGame(url: url)
|
||||
isSelecting = false
|
||||
} else {
|
||||
addGame(url: url)
|
||||
}
|
||||
case .failure(let err):
|
||||
print(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func startGame(url: URL) {
|
||||
if core.supportedFileTypes.contains(url.pathExtension.lowercased()) {
|
||||
let bool = url.startAccessingSecurityScopedResource()
|
||||
|
||||
defer {
|
||||
if bool {
|
||||
url.stopAccessingSecurityScopedResource()
|
||||
|
||||
startgame = true
|
||||
}
|
||||
}
|
||||
let sudachi = Sudachi.shared
|
||||
|
||||
let info = sudachi.information(for: url)
|
||||
|
||||
let game = PomeloGame(programid: Int(info.programID), ishomebrew: info.isHomebrew, developer: info.developer, fileURL: url, imageData: info.iconData, title: info.title)
|
||||
|
||||
|
||||
urlgame = game
|
||||
print(game)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func addGame(url: URL) {
|
||||
let directory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
|
||||
if url.lastPathComponent.hasSuffix(".zip") {
|
||||
core.AddFirmware(at: url)
|
||||
@ -132,9 +199,5 @@ struct BottomMenuView: View {
|
||||
}
|
||||
|
||||
core.refreshcore(core: &core)
|
||||
case .failure(let err):
|
||||
print(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,7 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
</array>
|
||||
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.kernel.increased-debugging-memory-limit</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.kernel.increased-memory-limit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -2,21 +2,7 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
</array>
|
||||
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.kernel.increased-debugging-memory-limit</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.kernel.increased-memory-limit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -58,6 +58,7 @@ struct AdvancedSettingsView: View {
|
||||
.padding(.bottom)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
|
||||
if canShowMetalHUD {// (Int(UIDevice.current.systemVersion) ?? 0 >= 16) || canShowMetalHUD {
|
||||
Rectangle()
|
||||
.fill(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
|
@ -119,7 +119,7 @@ struct SettingsView: View {
|
||||
.frame(width: .infinity, height: 50) // Set the desired dimensions
|
||||
.overlay() {
|
||||
HStack {
|
||||
Text("Advanced Settings")
|
||||
Text("App Settings")
|
||||
.foregroundColor(.primary)
|
||||
.padding()
|
||||
Spacer()
|
||||
@ -128,31 +128,6 @@ struct SettingsView: View {
|
||||
|
||||
}
|
||||
.padding()
|
||||
if isshown {
|
||||
Rectangle()
|
||||
.fill(Color(uiColor: UIColor.secondarySystemBackground)) // Set the fill color (optional)
|
||||
.cornerRadius(10) // Apply rounded corners
|
||||
.frame(width: .infinity, height: 50) // Set the desired dimensions
|
||||
.overlay() {
|
||||
HStack(alignment: .center) {
|
||||
SignInApple()
|
||||
.frame(width: 200, height: 50)
|
||||
.foregroundColor(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
}
|
||||
.onAppear {
|
||||
ASAuthorizationAppleIDProvider().getCredentialState(forUserID: deviceOwnerID ?? "0") { state, error in
|
||||
if state != .authorized {
|
||||
isshown = true
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerName")
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerID")
|
||||
} else {
|
||||
isshown = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
|
||||
NavigationLink(destination: AppIconSwitcherView()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user