Browse Source

fix

lizzie/ios-port-sud
lizzie 2 months ago
parent
commit
41ff70345b
  1. 4
      src/ios/EmulationGame.swift
  2. 1
      src/ios/EmulationView.swift
  3. 2
      src/ios/GameListView.swift
  4. 6
      src/ios/JoystickView.swift
  5. 16
      src/ios/KeyboardHostingController.swift
  6. 24
      src/ios/LibraryView.swift

4
src/ios/EmulationGame.swift

@ -21,11 +21,11 @@ struct EmulationGame : Comparable, Hashable, Identifiable {
hasher.combine(title) hasher.combine(title)
} }
static func < (lhs: EmulationGame, rhs: Yuzu) -> Bool {
static func < (lhs: EmulationGame, rhs: EmulationGame) -> Bool {
lhs.title < rhs.title lhs.title < rhs.title
} }
static func == (lhs: EmulationGame, rhs: Yuzu) -> Bool {
static func == (lhs: EmulationGame, rhs: EmulationGame) -> Bool {
lhs.title == rhs.title lhs.title == rhs.title
} }
} }

1
src/ios/EmulationView.swift

@ -153,7 +153,6 @@ struct ControllerView: View {
motion.valueChangedHandler = { motion in motion.valueChangedHandler = { motion in
// Get current time // Get current time
let currentTimestamp = Date().timeIntervalSince1970 let currentTimestamp = Date().timeIntervalSince1970
let deltaTimestamp = Int32((currentTimestamp - lastTimestamp) * 1000) // Difference in milliseconds
// Update last timestamp // Update last timestamp
lastTimestamp = currentTimestamp lastTimestamp = currentTimestamp

2
src/ios/GameListView.swift

@ -52,7 +52,7 @@ struct GameListView: View {
var body: some View { var body: some View {
let filteredGames = core.games.filter { game in let filteredGames = core.games.filter { game in
guard let EmulationGame = game as? PoYuzume else { return false }
guard let EmulationGame = game as? EmulationGame else { return false }
return searchText.isEmpty || EmulationGame.title.localizedCaseInsensitiveContains(searchText) return searchText.isEmpty || EmulationGame.title.localizedCaseInsensitiveContains(searchText)
} }
ScrollView { ScrollView {

6
src/ios/JoystickView.swift

@ -18,13 +18,13 @@ public struct Joystick: View {
let appui = AppUI.shared let appui = AppUI.shared
@ObservedObject public var joystickMonitor = SwiftUIJoystick.JoystickMonitor()
@ObservedObject public var joystickMonitor = JoystickMonitor()
private let dragDiameter: CGFloat = 160 private let dragDiameter: CGFloat = 160
private let shape: SwiftUIJoystick.JoystickShape = .circle
private let shape: JoystickShape = .circle
public var body: some View { public var body: some View {
VStack{ VStack{
SwiftUIJoystick.JoystickBuilder(
JoystickBuilder(
monitor: self.joystickMonitor, monitor: self.joystickMonitor,
width: self.dragDiameter, width: self.dragDiameter,
shape: .circle, shape: .circle,

16
src/ios/KeyboardHostingController.swift

@ -18,10 +18,10 @@ class KeyboardHostingController<Content: View>: UIHostingController<Content> {
override var keyCommands: [UIKeyCommand]? { override var keyCommands: [UIKeyCommand]? {
return [ return [
UIKeyCommand(input: UIKeyCommand.inputUpArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyCommand.inputDownArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyCommand.inputLeftArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyCommand.inputRightArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyInputUpArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyInputDownArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyInputLeftArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: UIKeyInputRightArrow, modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: "w", modifierFlags: [], action: #selector(handleKeyCommand)), UIKeyCommand(input: "w", modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: "s", modifierFlags: [], action: #selector(handleKeyCommand)), UIKeyCommand(input: "s", modifierFlags: [], action: #selector(handleKeyCommand)),
UIKeyCommand(input: "a", modifierFlags: [], action: #selector(handleKeyCommand)), UIKeyCommand(input: "a", modifierFlags: [], action: #selector(handleKeyCommand)),
@ -32,13 +32,13 @@ class KeyboardHostingController<Content: View>: UIHostingController<Content> {
@objc func handleKeyCommand(_ sender: UIKeyCommand) { @objc func handleKeyCommand(_ sender: UIKeyCommand) {
if let input = sender.input { if let input = sender.input {
switch input { switch input {
case UIKeyCommand.inputUpArrow:
case UIKeyInputUpArrow:
print("Up Arrow Pressed") print("Up Arrow Pressed")
case UIKeyCommand.inputDownArrow:
case UIKeyInputDownArrow:
print("Down Arrow Pressed") print("Down Arrow Pressed")
case UIKeyCommand.inputLeftArrow:
case UIKeyInputLeftArrow:
print("Left Arrow Pressed") print("Left Arrow Pressed")
case UIKeyCommand.inputRightArrow:
case UIKeyInputRightArrow:
print("Right Arrow Pressed") print("Right Arrow Pressed")
case "w": case "w":
print("W Key Pressed") print("W Key Pressed")

24
src/ios/LibraryView.swift

@ -32,7 +32,7 @@ struct LibraryView: View {
if doesitexist.0, doesitexist.1 { if doesitexist.0, doesitexist.1 {
HomeView(core: core) HomeView(core: core)
} else { } else {
let (doesKeyExist, doesProdExist) = doeskeysexist()
let (doesKeyExist, doesProdExist) = doesKeysExist()
ScrollView { ScrollView {
Text("You Are Missing These Files:") Text("You Are Missing These Files:")
.font(.headline) .font(.headline)
@ -73,7 +73,7 @@ struct LibraryView: View {
} }
} }
.refreshable { .refreshable {
doesitexist = doeskeysexist()
doesitexist = doesKeysExist()
} }
@ -116,7 +116,7 @@ struct LibraryView: View {
} }
}) })
.onAppear() { .onAppear() {
doesitexist = doeskeysexist()
doesitexist = doesKeysExist()
} }
.navigationBarTitle("Library", displayMode: .inline) .navigationBarTitle("Library", displayMode: .inline)
.toolbar { .toolbar {
@ -155,36 +155,30 @@ struct LibraryView: View {
} }
} }
func doeskeysexist() -> (Bool, Bool) {
func doesKeysExist() -> (Bool, Bool) {
var doesprodexist = false var doesprodexist = false
var doestitleexist = false var doestitleexist = false
let title = core.root.appendingPathComponent("keys").appendingPathComponent("title.keys") let title = core.root.appendingPathComponent("keys").appendingPathComponent("title.keys")
let prod = core.root.appendingPathComponent("keys").appendingPathComponent("prod.keys") let prod = core.root.appendingPathComponent("keys").appendingPathComponent("prod.keys")
let fileManager = FileManager.default let fileManager = FileManager.default
let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
if fileManager.fileExists(atPath: prod.path) { if fileManager.fileExists(atPath: prod.path) {
doesprodexist = true doesprodexist = true
} else { } else {
print("File does not exist") print("File does not exist")
} }
if fileManager.fileExists(atPath: title.path) { if fileManager.fileExists(atPath: title.path) {
doestitleexist = true doestitleexist = true
} else { } else {
print("File does not exist") print("File does not exist")
} }
return (doestitleexist, doesprodexist) return (doestitleexist, doesprodexist)
} }
} }
func getDeveloperNames() -> String { func getDeveloperNames() -> String {
guard let s = infoDictionary?["CFBundleIdentifier"] as? String else {
return "Unknown"
}
return s
// guard let s = infoDictionary?["CFBundleIdentifier"] as? String else {
// return "Unknown"
// }
// return s
return "what"
} }
Loading…
Cancel
Save