Push changes (idk)

This commit is contained in:
stossy11 2024-10-31 01:30:35 +11:00
parent 5511d1885c
commit 56f47c4ede
7 changed files with 205 additions and 29 deletions

View File

@ -359,7 +359,7 @@
CODE_SIGN_ENTITLEMENTS = MeloNX/MeloNX.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"MeloNX/Preview Content\"";
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 95J8WZ4TN8;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
@ -368,9 +368,9 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportsDocumentBrowser = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -387,6 +387,8 @@
"$(PROJECT_DIR)/MeloNX/Dependencies",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;
@ -405,7 +407,7 @@
CODE_SIGN_ENTITLEMENTS = MeloNX/MeloNX.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"MeloNX/Preview Content\"";
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 95J8WZ4TN8;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
@ -414,9 +416,9 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportsDocumentBrowser = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -433,6 +435,8 @@
"$(PROJECT_DIR)/MeloNX/Dependencies",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4E87E28B2CCE2C1000F54325"
BuildableName = "MeloNX.app"
BlueprintName = "MeloNX"
ReferencedContainer = "container:MeloNX.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4E87E28B2CCE2C1000F54325"
BuildableName = "MeloNX.app"
BlueprintName = "MeloNX"
ReferencedContainer = "container:MeloNX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4E87E28B2CCE2C1000F54325"
BuildableName = "MeloNX.app"
BlueprintName = "MeloNX"
ReferencedContainer = "container:MeloNX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -3,4 +3,56 @@
uuid = "64A8AF27-6696-4D7A-8C62-06216A95ECF0"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "C2C839C6-26A1-468A-9479-A00FD57EA17C"
shouldBeEnabled = "Yes"
nameForDebugger = "ignore-sigusr1"
ignoreCount = "0"
continueAfterRunningActions = "Yes"
filePath = "MeloNX/Core/Ryujinx.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "117"
endingLineNumber = "117"
landmarkName = "startWithRunLoop(config:)"
landmarkType = "7">
<Actions>
<BreakpointActionProxy
ActionExtensionID = "Xcode.BreakpointAction.DebuggerCommand">
<ActionContent
consoleCommand = "process handle SIGUSR1 -n true -p true -s false">
</ActionContent>
</BreakpointActionProxy>
</Actions>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "5A4DEE32-2E63-4404-BFDE-AD7F1337DA66"
shouldBeEnabled = "Yes"
nameForDebugger = "ignore-sigusr1"
ignoreCount = "0"
continueAfterRunningActions = "Yes"
filePath = "MeloNX/Core/Ryujinx.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "126"
endingLineNumber = "126"
landmarkName = "startWithRunLoop(config:)"
landmarkType = "7">
<Actions>
<BreakpointActionProxy
ActionExtensionID = "Xcode.BreakpointAction.DebuggerCommand">
<ActionContent
consoleCommand = "process handle SIGUSR1 -n true -p true -s false">
</ActionContent>
</BreakpointActionProxy>
</Actions>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -10,5 +10,13 @@
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>4E87E28B2CCE2C1000F54325</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@ -16,12 +16,32 @@ struct ContentView: View {
@State var gameUrl: URL?
@State var showFileImporter: Bool = false
@State var emulationStarted: Bool = false
@State var mainThread: Bool = false
@State var debugmode: Int = 0
var body: some View {
ZStack {
VStack {
Text("NX iOS")
.font(.largeTitle)
.onTapGesture {
debugmode += 1
}
.padding()
if debugmode > 9 {
Text("Debug Mode:")
.font(.title)
Text("Is on Main Thread?: \(mainThread)")
.font(.title2)
Toggle(isOn: $mainThread) {
Text("Use Main Thread")
}
}
Button {
showFileImporter.toggle()
} label: {
@ -31,7 +51,14 @@ struct ContentView: View {
Button {
emulationStarted = true
gameUrl.startAccessingSecurityScopedResource()
showVirtualController(url: gameUrl)
let config = RyujinxEmulator.Configuration(
inputPath: gameUrl.path,
mainThread: mainThread,
graphicsBackend: "Vulkan"
)
showVirtualController(url: gameUrl, ryuconfig: config)
} label: {
Text("Go!")
}
@ -51,18 +78,14 @@ struct ContentView: View {
}
}
func startEmulation(game: URL) {
func startEmulation(game: URL, config: RyujinxEmulator.Configuration) {
setenv("DOTNET_EnableDiagnostics", "0", 1)
setenv("HOME", String(validatingUTF8: getenv("HOME"))! + "/Documents", 1)
setenv("MVK_CONFIG_LOG_LEVEL", "4", 1)
let config = RyujinxEmulator.Configuration(
inputPath: game.path,
enableKeyboard: false,
graphicsBackend: "Vulkan"
)
let config = config
patchMakeKeyAndVisible()
// patchMakeKeyAndVisible()
SDL_SetMainReady()
SDL_iPhoneSetEventPump(SDL_TRUE)
print(SDL_Init(SDL_INIT_VIDEO))
@ -105,7 +128,7 @@ extension UIWindow {
@available(iOS 15.0, *)
var g_gcVirtualController: GCVirtualController!
@available(iOS 15.0, *)
func showVirtualController(url: URL) {
func showVirtualController(url: URL, ryuconfig: RyujinxEmulator.Configuration) {
print("Showing virtual controller...")
let config = GCVirtualController.Configuration()
config.elements = [
@ -114,9 +137,7 @@ func showVirtualController(url: URL) {
g_gcVirtualController = GCVirtualController(configuration: config)
g_gcVirtualController.connect { err in
print("Controller connect: \(String(describing: err))")
DispatchQueue.main.async {
startEmulation(game: url)
}
startEmulation(game: url, config: ryuconfig)
}
}

View File

@ -25,20 +25,23 @@ class RyujinxEmulator {
private var isRunning = false
private var emulationThread: Thread?
struct Configuration {
let inputPath: String
let enableKeyboard: Bool // i don't know why i added this
let mainThread: Bool // i don't know why i added this
let graphicsBackend: String
var additionalArgs: [String]
init(
inputPath: String,
enableKeyboard: Bool = true,
mainThread: Bool = true,
graphicsBackend: String = "Vulkan",
additionalArgs: [String] = []
) {
self.inputPath = inputPath
self.enableKeyboard = enableKeyboard
self.mainThread = mainThread
self.graphicsBackend = graphicsBackend
self.additionalArgs = additionalArgs
}
@ -107,7 +110,9 @@ class RyujinxEmulator {
let port = Port()
runLoop.add(port, forMode: .default)
//DispatchQueue.main.async {
print(config.mainThread ? "Running on the main thread" : "Running on the background thread")
if config.mainThread {
DispatchQueue.main.async {
do {
try Self.start(with: config)
} catch {
@ -115,13 +120,21 @@ class RyujinxEmulator {
self.isRunning = false
return
}
// }
}
} else {
do {
try Self.start(with: config)
} catch {
Self.log("Emulation failed to start: \(error)")
self.isRunning = false
return
}
}
while self.isRunning && runLoop.run(mode: .default, before: .distantFuture) {
autoreleasepool {
}
autoreleasepool { }
}
@ -165,9 +178,9 @@ extension RyujinxEmulator.Configuration {
args.append(inputPath)
if enableKeyboard {
args.append("--enable-keyboard")
}
// if enableKeyboard {
// args.append("--enable-keyboard")
// }
args.append("--graphics-backend")
args.append(graphicsBackend)
@ -206,7 +219,7 @@ extension RyujinxEmulator.Configuration {
return RyujinxEmulator.Configuration(
inputPath: inputPath,
enableKeyboard: enableKeyboard,
mainThread: enableKeyboard,
graphicsBackend: graphicsBackend,
additionalArgs: additionalArgs
)