Fix Mario Kart 8 and other Changes

This commit is contained in:
stossy11 2024-10-01 10:55:21 +10:00
parent 3d4ae27132
commit 5865027b0a
18 changed files with 296 additions and 208 deletions

View File

@ -17,8 +17,6 @@
38020F462C43754700029E9A /* utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 38020F3E2C43754700029E9A /* utils.m */; };
38020F562C43A02100029E9A /* BootOSView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38020F552C43A01D00029E9A /* BootOSView.swift */; };
38020F5A2C43AFFA00029E9A /* CoreSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38020F592C43AFF300029E9A /* CoreSettingsView.swift */; };
383C55EE2C5D136900A89F85 /* JoyStickView in Frameworks */ = {isa = PBXBuildFile; productRef = 383C55ED2C5D136900A89F85 /* JoyStickView */; };
383FC44B2C5B3C8C00A37694 /* JoystickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 383FC44A2C5B3C8C00A37694 /* JoystickViewController.swift */; };
3841946A2C4E4D2B00396613 /* MetalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 384194652C4E4D2B00396613 /* MetalView.swift */; };
3841946B2C4E4D2B00396613 /* SudachiEmulationScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 384194632C4E4D2B00396613 /* SudachiEmulationScreenView.swift */; };
3841946C2C4E4D2B00396613 /* ControllerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 384194612C4E4D2B00396613 /* ControllerView.swift */; };
@ -85,6 +83,8 @@
4E4AF12F2C927E8E00BBF2DE /* libdynarmic.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 38C846BB2C1DCE8900331706 /* libdynarmic.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4E4AF1302C92867F00BBF2DE /* libteakra.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 38C846C82C1DCE8900331706 /* libteakra.xcframework */; };
4E4AF1312C92867F00BBF2DE /* libteakra.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 38C846C82C1DCE8900331706 /* libteakra.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4EC662B02CAA1229000DBC5F /* SwiftUIJoystick in Frameworks */ = {isa = PBXBuildFile; productRef = 4EC662AF2CAA1229000DBC5F /* SwiftUIJoystick */; };
4EC662B42CAA1257000DBC5F /* JoystickView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EC662B32CAA1254000DBC5F /* JoystickView.swift */; };
4EE593FF2C5FA1D1000939C4 /* AppIconProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE593FE2C5FA1D1000939C4 /* AppIconProvider.swift */; };
4EEA0CFA2CA376AB0029A55D /* Zip in Frameworks */ = {isa = PBXBuildFile; productRef = 4EEA0CF92CA376AB0029A55D /* Zip */; };
/* End PBXBuildFile section */
@ -135,7 +135,6 @@
38020F3F2C43754700029E9A /* JITEnabler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JITEnabler.m; sourceTree = "<group>"; };
38020F552C43A01D00029E9A /* BootOSView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BootOSView.swift; sourceTree = "<group>"; };
38020F592C43AFF300029E9A /* CoreSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreSettingsView.swift; sourceTree = "<group>"; };
383FC44A2C5B3C8C00A37694 /* JoystickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoystickViewController.swift; sourceTree = "<group>"; };
384194612C4E4D2B00396613 /* ControllerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControllerView.swift; sourceTree = "<group>"; };
384194632C4E4D2B00396613 /* SudachiEmulationScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SudachiEmulationScreenView.swift; sourceTree = "<group>"; };
384194652C4E4D2B00396613 /* MetalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalView.swift; sourceTree = "<group>"; };
@ -193,6 +192,7 @@
4E4AF11A2C919C0F00BBF2DE /* Haptics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Haptics.swift; sourceTree = "<group>"; };
4E4AF12C2C926BBD00BBF2DE /* FolderMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderMonitor.swift; sourceTree = "<group>"; };
4E7E03662C9667D200C10AFD /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
4EC662B32CAA1254000DBC5F /* JoystickView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoystickView.swift; sourceTree = "<group>"; };
4EE593FE2C5FA1D1000939C4 /* AppIconProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconProvider.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -207,6 +207,7 @@
4E4AF1302C92867F00BBF2DE /* libteakra.xcframework in Frameworks */,
38C846CE2C1DCE8900331706 /* libMachineIndependent.xcframework in Frameworks */,
38C50D242C1DD54B0007A953 /* libenet.xcframework in Frameworks */,
4EC662B02CAA1229000DBC5F /* SwiftUIJoystick in Frameworks */,
38C50D2C2C1DD5590007A953 /* libglslang.xcframework in Frameworks */,
38C50D182C1DD5370007A953 /* boost_context.xcframework in Frameworks */,
38C50D3C2C1DD5780007A953 /* libSoundTouch.xcframework in Frameworks */,
@ -215,7 +216,6 @@
4E0E35EA2C7AB5CB001D24EE /* libSPIRV.xcframework in Frameworks */,
4EEA0CFA2CA376AB0029A55D /* Zip in Frameworks */,
38C50D122C1DCF690007A953 /* SwiftSyntaxMacros in Frameworks */,
383C55EE2C5D136900A89F85 /* JoyStickView in Frameworks */,
38C50D092C1DCF3E0007A953 /* libswresample.xcframework in Frameworks */,
38C50D0B2C1DCF420007A953 /* libswscale.xcframework in Frameworks */,
4E4AF12E2C927E8E00BBF2DE /* libdynarmic.xcframework in Frameworks */,
@ -307,20 +307,12 @@
path = CoreSettings;
sourceTree = "<group>";
};
383FC4492C5B3C7700A37694 /* JoystickViewController */ = {
isa = PBXGroup;
children = (
383FC44A2C5B3C8C00A37694 /* JoystickViewController.swift */,
);
path = JoystickViewController;
sourceTree = "<group>";
};
384194622C4E4D2B00396613 /* ControllerView */ = {
isa = PBXGroup;
children = (
4E4AF1182C919C0700BBF2DE /* Haptics */,
384194612C4E4D2B00396613 /* ControllerView.swift */,
383FC4492C5B3C7700A37694 /* JoystickViewController */,
4EC662B12CAA1245000DBC5F /* Joystick */,
);
path = ControllerView;
sourceTree = "<group>";
@ -579,6 +571,14 @@
path = FolderMonitor;
sourceTree = "<group>";
};
4EC662B12CAA1245000DBC5F /* Joystick */ = {
isa = PBXGroup;
children = (
4EC662B32CAA1254000DBC5F /* JoystickView.swift */,
);
path = Joystick;
sourceTree = "<group>";
};
4EE593FD2C5FA1C4000939C4 /* AppIcon */ = {
isa = PBXGroup;
children = (
@ -610,8 +610,8 @@
38C50D0F2C1DCF5F0007A953 /* SwiftSyntax */,
38C50D112C1DCF690007A953 /* SwiftSyntaxMacros */,
3841947E2C4E5D2E00396613 /* SwiftUIIntrospect */,
383C55ED2C5D136900A89F85 /* JoyStickView */,
4EEA0CF92CA376AB0029A55D /* Zip */,
4EC662AF2CAA1229000DBC5F /* SwiftUIJoystick */,
);
productName = Pomelo;
productReference = 384F188A2C1DCB4F0073375C /* Pomelo.app */;
@ -647,8 +647,8 @@
38C846572C1DCC8400331706 /* XCRemoteSwiftPackageReference "OpenSSL" */,
38C8465A2C1DCCA100331706 /* XCRemoteSwiftPackageReference "swift-syntax" */,
3841947D2C4E5D2E00396613 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */,
383C55EC2C5D136900A89F85 /* XCRemoteSwiftPackageReference "Joystick" */,
4EEA0CF82CA376AB0029A55D /* XCRemoteSwiftPackageReference "Zip" */,
4EC662AE2CAA1229000DBC5F /* XCRemoteSwiftPackageReference "SwiftUIJoystick" */,
);
productRefGroup = 384F188B2C1DCB4F0073375C /* Products */;
projectDirPath = "";
@ -700,8 +700,8 @@
38020F302C43568500029E9A /* AdvancedSettingsView.swift in Sources */,
386F6EE52C42E0B900C62EBE /* GameButtonView.swift in Sources */,
386F6F302C42E64000C62EBE /* SettingsView.swift in Sources */,
4EC662B42CAA1257000DBC5F /* JoystickView.swift in Sources */,
386F6EE62C42E0B900C62EBE /* ContentView.swift in Sources */,
383FC44B2C5B3C8C00A37694 /* JoystickViewController.swift in Sources */,
499A5E0C2C74A1B200EC0925 /* GameListView.swift in Sources */,
4E4AF11B2C919C0F00BBF2DE /* Haptics.swift in Sources */,
386F6EE82C42E0B900C62EBE /* LibraryView.swift in Sources */,
@ -856,7 +856,7 @@
CODE_SIGN_ENTITLEMENTS = Pomelo/PomeloDebug.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 95J8WZ4TN8;
ENABLE_HARDENED_RUNTIME = YES;
@ -892,7 +892,7 @@
"$(PROJECT_DIR)/Pomelo/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/Pomelo/Dependencies/Dynamic\\ Libraries",
);
MARKETING_VERSION = 1.5;
MARKETING_VERSION = 1.8;
OTHER_LDFLAGS = "-lSudachi";
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.Pomelo;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -922,7 +922,7 @@
CODE_SIGN_ENTITLEMENTS = Pomelo/Pomelo.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 95J8WZ4TN8;
ENABLE_HARDENED_RUNTIME = YES;
@ -958,7 +958,7 @@
"$(PROJECT_DIR)/Pomelo/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/Pomelo/Dependencies/Dynamic\\ Libraries",
);
MARKETING_VERSION = 1.5;
MARKETING_VERSION = 1.8;
OTHER_LDFLAGS = "-lSudachi";
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.Pomelo;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1002,14 +1002,6 @@
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
383C55EC2C5D136900A89F85 /* XCRemoteSwiftPackageReference "Joystick" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/bradhowes/Joystick";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 3.2.0;
};
};
3841947D2C4E5D2E00396613 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect";
@ -1042,6 +1034,14 @@
minimumVersion = 510.0.2;
};
};
4EC662AE2CAA1229000DBC5F /* XCRemoteSwiftPackageReference "SwiftUIJoystick" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/michael94ellis/SwiftUIJoystick";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.5.0;
};
};
4EEA0CF82CA376AB0029A55D /* XCRemoteSwiftPackageReference "Zip" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/marmelroy/Zip";
@ -1053,11 +1053,6 @@
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
383C55ED2C5D136900A89F85 /* JoyStickView */ = {
isa = XCSwiftPackageProductDependency;
package = 383C55EC2C5D136900A89F85 /* XCRemoteSwiftPackageReference "Joystick" */;
productName = JoyStickView;
};
3841947E2C4E5D2E00396613 /* SwiftUIIntrospect */ = {
isa = XCSwiftPackageProductDependency;
package = 3841947D2C4E5D2E00396613 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
@ -1083,6 +1078,11 @@
package = 38C846572C1DCC8400331706 /* XCRemoteSwiftPackageReference "OpenSSL" */;
productName = OpenSSL;
};
4EC662AF2CAA1229000DBC5F /* SwiftUIJoystick */ = {
isa = XCSwiftPackageProductDependency;
package = 4EC662AE2CAA1229000DBC5F /* XCRemoteSwiftPackageReference "SwiftUIJoystick" */;
productName = SwiftUIJoystick;
};
4EEA0CF92CA376AB0029A55D /* Zip */ = {
isa = XCSwiftPackageProductDependency;
package = 4EEA0CF82CA376AB0029A55D /* XCRemoteSwiftPackageReference "Zip" */;

View File

@ -1,15 +1,6 @@
{
"originHash" : "fca29c9ce42f9bb658054c8b20b968ea3e917b49f2be689036b2308c2087ab65",
"originHash" : "3d5119aa304f53b6ed9bb3456c2565203c5cb8a7bcd287329bb337e593638269",
"pins" : [
{
"identity" : "joystick",
"kind" : "remoteSourceControl",
"location" : "https://github.com/bradhowes/Joystick",
"state" : {
"revision" : "c37e9596dc7756fae3d6720ab09e090a30b6179c",
"version" : "3.2.0"
}
},
{
"identity" : "lz4-spm",
"kind" : "remoteSourceControl",
@ -55,6 +46,15 @@
"version" : "1.3.0"
}
},
{
"identity" : "swiftuijoystick",
"kind" : "remoteSourceControl",
"location" : "https://github.com/michael94ellis/SwiftUIJoystick",
"state" : {
"revision" : "5bd303cdafb369a70a45c902538b42dd3c5f4d65",
"version" : "1.5.0"
}
},
{
"identity" : "zip",
"kind" : "remoteSourceControl",

View File

@ -8,6 +8,7 @@
import SwiftUI
import GameController
import Sudachi
import SwiftUIJoystick
struct ControllerView: View {
@ -75,78 +76,141 @@ struct ControllerView: View {
guard let controllerId = controllerIDs[controller] else { return }
let extendedGamepad = controller.extendedGamepad!
if let extendedGamepad = controller.extendedGamepad {
extendedGamepad.dpad.up.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadUp, controllerId: controllerId) : self.touchUpInside(.directionalPadUp, controllerId: controllerId)
}
extendedGamepad.dpad.down.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadDown, controllerId: controllerId) : self.touchUpInside(.directionalPadDown, controllerId: controllerId)
}
extendedGamepad.dpad.left.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadLeft, controllerId: controllerId) : self.touchUpInside(.directionalPadLeft, controllerId: controllerId)
}
extendedGamepad.dpad.right.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadRight, controllerId: controllerId) : self.touchUpInside(.directionalPadRight, controllerId: controllerId)
}
extendedGamepad.buttonOptions?.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.minus, controllerId: controllerId) : self.touchUpInside(.minus, controllerId: controllerId)
}
extendedGamepad.buttonMenu.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.plus, controllerId: controllerId) : self.touchUpInside(.plus, controllerId: controllerId)
}
extendedGamepad.buttonA.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.A, controllerId: controllerId) : self.touchUpInside(.A, controllerId: controllerId)
}
extendedGamepad.buttonB.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.B, controllerId: controllerId) : self.touchUpInside(.B, controllerId: controllerId)
}
extendedGamepad.buttonX.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.X, controllerId: controllerId) : self.touchUpInside(.X, controllerId: controllerId)
}
extendedGamepad.buttonY.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.Y, controllerId: controllerId) : self.touchUpInside(.Y, controllerId: controllerId)
}
extendedGamepad.leftShoulder.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerL, controllerId: controllerId) : self.touchUpInside(.L, controllerId: controllerId)
}
extendedGamepad.leftTrigger.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerZL, controllerId: controllerId) : self.touchUpInside(.triggerZL, controllerId: controllerId)
}
extendedGamepad.rightShoulder.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerR, controllerId: controllerId) : self.touchUpInside(.triggerR, controllerId: controllerId)
}
extendedGamepad.rightTrigger.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerZR, controllerId: controllerId) : self.touchUpInside(.triggerZR, controllerId: controllerId)
}
extendedGamepad.buttonHome?.pressedChangedHandler = { button, value, pressed in
if pressed {
sudachi.exit()
presentationMode.wrappedValue.dismiss()
// Handle extended gamepad
extendedGamepad.dpad.up.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadUp, controllerId: controllerId) : self.touchUpInside(.directionalPadUp, controllerId: controllerId)
}
}
extendedGamepad.leftThumbstick.valueChangedHandler = { dpad, x, y in
self.sudachi.thumbstickMoved(analog: .left, x: x, y: y, controllerid: controllerId)
}
extendedGamepad.dpad.down.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadDown, controllerId: controllerId) : self.touchUpInside(.directionalPadDown, controllerId: controllerId)
}
extendedGamepad.rightThumbstick.valueChangedHandler = { dpad, x, y in
self.sudachi.thumbstickMoved(analog: .right, x: x, y: y, controllerid: controllerId)
extendedGamepad.dpad.left.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadLeft, controllerId: controllerId) : self.touchUpInside(.directionalPadLeft, controllerId: controllerId)
}
extendedGamepad.dpad.right.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadRight, controllerId: controllerId) : self.touchUpInside(.directionalPadRight, controllerId: controllerId)
}
extendedGamepad.buttonOptions?.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.minus, controllerId: controllerId) : self.touchUpInside(.minus, controllerId: controllerId)
}
extendedGamepad.buttonMenu.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.plus, controllerId: controllerId) : self.touchUpInside(.plus, controllerId: controllerId)
}
extendedGamepad.buttonA.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.A, controllerId: controllerId) : self.touchUpInside(.A, controllerId: controllerId)
}
extendedGamepad.buttonB.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.B, controllerId: controllerId) : self.touchUpInside(.B, controllerId: controllerId)
}
extendedGamepad.buttonX.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.X, controllerId: controllerId) : self.touchUpInside(.X, controllerId: controllerId)
}
extendedGamepad.buttonY.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.Y, controllerId: controllerId) : self.touchUpInside(.Y, controllerId: controllerId)
}
extendedGamepad.leftShoulder.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerL, controllerId: controllerId) : self.touchUpInside(.L, controllerId: controllerId)
}
extendedGamepad.leftTrigger.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerZL, controllerId: controllerId) : self.touchUpInside(.triggerZL, controllerId: controllerId)
}
extendedGamepad.rightShoulder.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerR, controllerId: controllerId) : self.touchUpInside(.triggerR, controllerId: controllerId)
}
extendedGamepad.leftThumbstickButton?.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.L, controllerId: controllerId) : self.touchUpInside(.triggerR, controllerId: controllerId)
}
extendedGamepad.rightThumbstickButton?.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.R, controllerId: controllerId) : self.touchUpInside(.triggerR, controllerId: controllerId)
}
extendedGamepad.rightTrigger.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.triggerZR, controllerId: controllerId) : self.touchUpInside(.triggerZR, controllerId: controllerId)
}
extendedGamepad.buttonHome?.pressedChangedHandler = { button, value, pressed in
if pressed {
sudachi.exit()
presentationMode.wrappedValue.dismiss()
}
}
extendedGamepad.leftThumbstick.valueChangedHandler = { dpad, x, y in
self.sudachi.thumbstickMoved(analog: .left, x: x, y: y, controllerid: controllerId)
}
extendedGamepad.rightThumbstick.valueChangedHandler = { dpad, x, y in
self.sudachi.thumbstickMoved(analog: .right, x: x, y: y, controllerid: controllerId)
}
if let motion = controller.motion {
var lastTimestamp = Date().timeIntervalSince1970 // Initialize timestamp when motion starts
motion.valueChangedHandler = { motion in
// Get current time
let currentTimestamp = Date().timeIntervalSince1970
let deltaTimestamp = Int32((currentTimestamp - lastTimestamp) * 1000) // Difference in milliseconds
// Update last timestamp
lastTimestamp = currentTimestamp
// Get gyroscope data
let gyroX = motion.rotationRate.x
let gyroY = motion.rotationRate.y
let gyroZ = motion.rotationRate.z
// Get accelerometer data
let accelX = motion.gravity.x + motion.userAcceleration.x
let accelY = motion.gravity.y + motion.userAcceleration.y
let accelZ = motion.gravity.z + motion.userAcceleration.z
print("\(gyroX), \(gyroY), \(gyroZ), \(accelX), \(accelY), \(accelZ)")
// Call your gyroMoved function with the motion data
sudachi.gyroMoved(x: Float(gyroX), y: Float(gyroY), z: Float(gyroZ), accelX: Float(accelX), accelY: Float(accelY), accelZ: Float(accelZ), controllerId: Int32(controllerId), deltaTimestamp: Int32(lastTimestamp))
}
}
} else if let microGamepad = controller.microGamepad {
// Handle micro gamepad
microGamepad.dpad.up.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadUp, controllerId: controllerId) : self.touchUpInside(.directionalPadUp, controllerId: controllerId)
}
microGamepad.dpad.down.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadDown, controllerId: controllerId) : self.touchUpInside(.directionalPadDown, controllerId: controllerId)
}
microGamepad.dpad.left.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadLeft, controllerId: controllerId) : self.touchUpInside(.directionalPadLeft, controllerId: controllerId)
}
microGamepad.dpad.right.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.directionalPadRight, controllerId: controllerId) : self.touchUpInside(.directionalPadRight, controllerId: controllerId)
}
microGamepad.buttonA.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.A, controllerId: controllerId) : self.touchUpInside(.A, controllerId: controllerId)
}
microGamepad.buttonX.pressedChangedHandler = { button, value, pressed in
pressed ? self.touchDown(.X, controllerId: controllerId) : self.touchUpInside(.X, controllerId: controllerId)
}
}
}
@ -170,17 +234,19 @@ struct OnScreenController: View {
VStack {
ShoulderButtonsViewLeft()
ZStack {
JoystickViewSwiftUI()
Joystick()
DPadView()
}
}
.padding()
VStack {
ShoulderButtonsViewRight()
ZStack {
JoystickViewSwiftUI(iscool: true) // hope this works
Joystick(iscool: true) // hope this works
ABXYView()
}
}
.padding()
}
HStack {
@ -190,7 +256,7 @@ struct OnScreenController: View {
.padding(.horizontal, 40)
}
}
.padding(.bottom, geometry.size.height / 4.2) // very broken
.padding(.bottom, geometry.size.height / 3.2) // very broken
}
} else {
// could be landscape
@ -208,7 +274,7 @@ struct OnScreenController: View {
VStack {
ShoulderButtonsViewLeft()
ZStack {
JoystickViewSwiftUI()
Joystick()
DPadView()
}
}
@ -227,7 +293,7 @@ struct OnScreenController: View {
VStack {
ShoulderButtonsViewRight()
ZStack {
JoystickViewSwiftUI(iscool: true) // hope this work s
Joystick(iscool: true) // hope this work s
ABXYView()
}
}

View File

@ -0,0 +1,58 @@
//
// JoystickView.swift
// Pomelo
//
// Created by Stossy11 on 30/9/2024.
// Copyright © 2024 Stossy11. All rights reserved.
//
import SwiftUI
import SwiftUIJoystick
import Sudachi
public struct Joystick: View {
@State var iscool: Bool? = nil
var id: Int {
if onscreenjoy {
return 8
}
return 0
}
@AppStorage("onscreenhandheld") var onscreenjoy: Bool = false
let sudachi = Sudachi.shared
@ObservedObject public var joystickMonitor = JoystickMonitor()
private let dragDiameter: CGFloat = 160
private let shape: JoystickShape = .circle
public var body: some View {
VStack{
JoystickBuilder(
monitor: self.joystickMonitor,
width: self.dragDiameter,
shape: .circle,
background: {
// Example Background
RoundedRectangle(cornerRadius: 8).fill(Color.gray.opacity(0))
},
foreground: {
// Example Thumb
Circle().fill(Color.gray)
},
locksInPlace: false)
.onChange(of: self.joystickMonitor.xyPoint) { newValue in
let scaledX = Float(newValue.x)
let scaledY = Float(-newValue.y) // my dumbass broke this by having -y instead of y :/ (well it appears that with the new joystick code, its supposed to be -y)
joystickMonitor.objectWillChange
print("Joystick Position: (\(scaledX), \(scaledY))")
if iscool != nil {
sudachi.thumbstickMoved(analog: .right, x: scaledX, y: scaledY, controllerid: id)
} else {
sudachi.thumbstickMoved(analog: .left, x: scaledX, y: scaledY, controllerid: id)
}
}
}
}
}

View File

@ -1,75 +0,0 @@
//
// JoystickUIView.swift
// Pomelo
//
// Created by Stossy11 on 1/8/2024.
//
import SwiftUI
import UIKit
import JoyStickView
import Sudachi
struct JoyStickViewRepresentable: UIViewRepresentable {
@Binding var x: CGFloat
@Binding var y: CGFloat
func makeUIView(context: Context) -> JoyStickView {
let joystickView = JoyStickView()
joystickView.monitor = .xy { report in
x = report.x
y = report.y
}
// didnt expect this to work actually
joystickView.baseAlpha = -1
// peepee poopoo
joystickView.handleSizeRatio = 0.2
return joystickView
}
func updateUIView(_ uiView: JoyStickView, context: Context) {
// no need for this bitchesssss /j
}
}
struct JoystickViewSwiftUI: View {
@State var x: CGFloat = 0.0 // accedentially made it so both x and y went to the same var for both the right and left joystick :\
@State var y: CGFloat = 0.0
@State var iscool: Any?
var sudachi = Sudachi.shared
var id: Int {
if onscreenjoy {
return 8
}
return 0
}
@AppStorage("onscreenhandheld") var onscreenjoy: Bool = false
var body: some View {
VStack {
JoyStickViewRepresentable(x: $x, y: $y) // very representable
.onChange(of: x) { newX in
updateThumbstick()
}
.onChange(of: y) { newY in
updateThumbstick()
}
.frame(width: 160, height: 160) // im wondering if i even need this anymore
}
.padding()
}
private func updateThumbstick() {
let scaledX = Float(x)
let scaledY = Float(y) // my dumbass broke this by having -y instead of y :/
print("Joystick Position: (\(scaledX), \(scaledY))")
if iscool != nil {
sudachi.thumbstickMoved(analog: .right, x: scaledX, y: scaledY, controllerid: id)
} else {
sudachi.thumbstickMoved(analog: .left, x: scaledX, y: scaledY, controllerid: id)
}
}
}

View File

@ -47,7 +47,9 @@ struct SudachiEmulationView: View {
}
.edgesIgnoringSafeArea(.all)
.onRotate { size in
viewModel.handleOrientationChange()
if !isairplay {
viewModel.handleOrientationChange()
}
}
}

View File

@ -87,9 +87,7 @@ struct LibraryView: View {
.fileImporter(isPresented: $isimportingfirm, allowedContentTypes: [.zip], onCompletion: { result in
switch result {
case .success(let elements):
DispatchQueue.main.async {
core.AddFirmware(at: elements)
}
core.AddFirmware(at: elements)
case .failure(let error):
print(error.localizedDescription)

View File

@ -7,6 +7,7 @@
import SwiftUI
import Foundation
import Sudachi
struct CoreSettingsView: View {
@State private var text: String = ""
@ -39,6 +40,7 @@ struct CoreSettingsView: View {
print("\(error.localizedDescription)")
}
Sudachi.shared.settingsSaved()
} label: {
Text("Reset File")
@ -79,6 +81,7 @@ struct CoreSettingsView: View {
do {
try text.write(to: fileURL, atomically: true, encoding: .utf8)
Sudachi.shared.settingsSaved()
print("File saved successfully!")
} catch {
print("Error saving file: \(error)")

View File

@ -1134,7 +1134,7 @@ public:
}
void PushDescriptorSetWithTemplateKHR(VkDescriptorUpdateTemplate update_template,
VkPipelineLayout layout, u32 set,
VkPipelineLayout layout, uint8_t set,
const void* data) const noexcept {
dld->vkCmdPushDescriptorSetWithTemplateKHR(handle, update_template, layout, set, data);
}

View File

@ -139,7 +139,7 @@ struct FormatTuple {
{VK_FORMAT_R16G16B16A16_SINT, Attachable | Storage}, // R16G16B16A16_SINT
{VK_FORMAT_R16G16B16A16_UINT, Attachable | Storage}, // R16G16B16A16_UINT
{VK_FORMAT_B10G11R11_UFLOAT_PACK32, Attachable | Storage}, // B10G11R11_FLOAT
{VK_FORMAT_R32G32B32A32_UINT, Attachable | Storage}, // R32G32B32A32_UINT
{VK_FORMAT_R32G32B32A32_SFLOAT, Attachable | Storage}, // R32G32B32A32_UINT
{VK_FORMAT_BC1_RGBA_UNORM_BLOCK}, // BC1_RGBA_UNORM
{VK_FORMAT_BC2_UNORM_BLOCK}, // BC2_UNORM
{VK_FORMAT_BC3_UNORM_BLOCK}, // BC3_UNORM
@ -517,7 +517,7 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Size::Size_R32_G32_B32:
return VK_FORMAT_R32G32B32_UINT;
case Maxwell::VertexAttribute::Size::Size_R32_G32_B32_A32:
return VK_FORMAT_R32G32B32A32_UINT;
return VK_FORMAT_R32G32B32A32_SFLOAT;
case Maxwell::VertexAttribute::Size::Size_A2_B10_G10_R10:
return VK_FORMAT_A2B10G10R10_UINT_PACK32;
default:

View File

@ -694,7 +694,7 @@ struct RangedBarrierRange {
case Shader::ImageFormat::R32G32_UINT:
return VK_FORMAT_R32G32_UINT;
case Shader::ImageFormat::R32G32B32A32_UINT:
return VK_FORMAT_R32G32B32A32_UINT;
return VK_FORMAT_R32G32B32A32_SFLOAT;
}
ASSERT_MSG(false, "Invalid image format={}", format);
return VK_FORMAT_R32_UINT;

View File

@ -250,7 +250,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::Physica
VK_FORMAT_R16_USCALED,
VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_R32G32B32A32_SINT,
VK_FORMAT_R32G32B32A32_UINT,
VK_FORMAT_R32G32B32A32_SFLOAT,
VK_FORMAT_R32G32B32_SFLOAT,
VK_FORMAT_R32G32B32_SINT,
VK_FORMAT_R32G32B32_UINT,

View File

@ -79,6 +79,19 @@ public struct Sudachi {
sudachiObjC.touchMoved(at: point, for: index)
}
public func gyroMoved(x: Float, y: Float, z: Float, accelX: Float, accelY: Float, accelZ: Float, controllerId: Int32, deltaTimestamp: Int32) {
// Calling the Objective-C function with both gyroscope and accelerometer data
sudachiObjC.virtualControllerGyro(controllerId,
deltaTimestamp: deltaTimestamp,
gyroX: x,
gyroY: y,
gyroZ: z,
accelX: accelX,
accelY: accelY,
accelZ: accelZ)
}
public func thumbstickMoved(analog: VirtualControllerAnalogType, x: Float, y: Float, controllerid: Int) {
sudachiObjC.thumbstickMoved(analog, x: CGFloat(x), y: CGFloat(y), controllerId: Int32(controllerid))
}

View File

@ -422,8 +422,8 @@ gamecard_path =
[System]
# Whether the system is docked
# 1 (default): Yes, 0: No
use_docked_mode = 0
# 1: Yes, 0 (default): No
use_docked_mode =
# Sets the seed for the RNG generator built into the switch
# rng_seed will be ignored and randomly generated if rng_seed_enabled is false

View File

@ -152,7 +152,7 @@ void Config::ReadValues() {
YuzuSettings::values.current_user = std::clamp<int>(YuzuSettings::values.current_user.GetValue(), 0,
Service::Account::MAX_USERS - 1);
// Disable docked mode by default on Android
// Enable docked mode by default on iOS
YuzuSettings::values.use_docked_mode.SetValue(config->GetBoolean("System", "use_docked_mode", false)
? YuzuSettings::ConsoleMode::Docked
: YuzuSettings::ConsoleMode::Handheld);
@ -242,7 +242,7 @@ void Config::ReadValues() {
YuzuSettings::values.max_anisotropy =
static_cast<YuzuSettings::AnisotropyMode>(config->GetInteger("Renderer", "max_anisotropy", 1));
// Disable ASTC compute by default on Android
// Disable ASTC compute by default on iOS
YuzuSettings::values.accelerate_astc.SetValue(
config->GetBoolean("Renderer", "accelerate_astc", false) ? YuzuSettings::AstcDecodeMode::Gpu
: YuzuSettings::AstcDecodeMode::Cpu);

View File

@ -69,6 +69,15 @@ typedef NS_ENUM(NSUInteger, VirtualControllerButtonType) {
y:(CGFloat)y
controllerId:(int)controllerId;
-(void) virtualControllerGyro:(int)controllerId
deltaTimestamp:(int)delta_timestamp
gyroX:(float)gyro_x
gyroY:(float)gyro_y
gyroZ:(float)gyro_z
accelX:(float)accel_x
accelY:(float)accel_y
accelZ:(float)accel_z;
-(void) virtualControllerButtonDown:(VirtualControllerButtonType)button
controllerId:(int)controllerId;

View File

@ -224,6 +224,20 @@
EmulationSession::GetInstance().Window().OnGamepadButtonEvent(controllerId, [[NSNumber numberWithUnsignedInteger:button] intValue], true);
}
-(void) virtualControllerGyro:(int)controllerId
deltaTimestamp:(int)delta_timestamp
gyroX:(float)gyro_x
gyroY:(float)gyro_y
gyroZ:(float)gyro_z
accelX:(float)accel_x
accelY:(float)accel_y
accelZ:(float)accel_z
{
EmulationSession::GetInstance().OnGamepadConnectEvent(controllerId);
EmulationSession::GetInstance().Window().OnGamepadMotionEvent(controllerId, delta_timestamp, gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z);
}
-(void) virtualControllerButtonUp:(VirtualControllerButtonType)button
controllerId:(int)controllerId {
EmulationSession::GetInstance().OnGamepadConnectEvent(controllerId);