This commit is contained in:
stossy11 2024-11-02 08:51:53 +11:00
parent d667178aa5
commit f632f16449
5 changed files with 42 additions and 35 deletions

View File

@ -370,7 +370,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportsDocumentBrowser = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -421,7 +421,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportsDocumentBrowser = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@ -16,10 +16,25 @@ struct ContentView: View {
@State var gameUrl: URL?
@State var showFileImporter: Bool = false
@State var emulationStarted: Bool = false
@State var mainThread: Bool = false
@State var mainThread: Bool = true
@State var debugmode: Int = 0
init() {
SDL_SetMainReady()
SDL_iPhoneSetEventPump(SDL_TRUE)
if SDL_Init(SDL_INIT_VIDEO) < 0 {
fatalError("Unable to initialize SDL: \(String(cString: SDL_GetError()))")
}
if SDL_Vulkan_LoadLibrary(nil) != 0 {
fatalError("Failed to load Vulkan library: \(String(cString: SDL_GetError()))")
}
}
var body: some View {
ZStack {
if let gameUrl, emulationStarted {
@ -30,11 +45,13 @@ struct ContentView: View {
inputPath: gameUrl.path,
mainThread: mainThread,
graphicsBackend: "Vulkan",
additionalArgs: ["--display-id", String(displayid)]
additionalArgs: [
"--display-id", String(displayid),
"--fullscreen", "true"
]
)
showVirtualController(url: gameUrl, ryuconfig: config)
}
}
@ -92,14 +109,6 @@ func startEmulation(game: URL, config: RyujinxEmulator.Configuration) {
let config = config
// patchMakeKeyAndVisible()
let window = SDL_CreateWindow("Ryujinx", Int32(SDL_WINDOWPOS_CENTERED_MASK), Int32(SDL_WINDOWPOS_CENTERED_MASK), 640, 480, SDL_WINDOW_SHOWN.rawValue | SDL_WINDOW_ALLOW_HIGHDPI.rawValue)
if window == nil {
print("Error creating SDL window: \(String(cString: SDL_GetError()))")
} else {
print("SDL Window created successfully!")
}
// SDL_Init(SDL_INIT_VIDEO)
let emulator = RyujinxEmulator()

View File

@ -42,25 +42,21 @@ class VulkanSDLView: UIView {
}
private func initializeSDL() {
SDL_SetMainReady()
SDL_iPhoneSetEventPump(SDL_TRUE)
// print(SDL_Init(SDL_INIT_VIDEO))
// Initialize SDL with video support
if SDL_Init(SDL_INIT_VIDEO) < 0 {
print("Unable to initialize SDL: \(String(cString: SDL_GetError()))")
return
}
// Create an SDL window with Metal support
DispatchQueue.main.async { [self] in
sdlWindow = SDL_CreateWindow(
"Ryujinx",
Int32(SDL_WINDOWPOS_CENTERED_MASK),
Int32(SDL_WINDOWPOS_CENTERED_MASK),
Int32(frame.width),
Int32(frame.height),
SDL_WINDOW_SHOWN.rawValue | SDL_WINDOW_ALLOW_HIGHDPI.rawValue | SDL_WINDOW_METAL.rawValue
SDL_WINDOW_SHOWN.rawValue | SDL_WINDOW_ALLOW_HIGHDPI.rawValue | SDL_WINDOW_VULKAN.rawValue
)
}
guard sdlWindow != nil else {
print("Error creating SDL window: \(String(cString: SDL_GetError()))")

View File

@ -186,6 +186,8 @@ namespace Ryujinx.Headless.SDL2
}
WindowHandle = SDL_GetWindowFromID(1);
Logger.Info?.Print(LogClass.Gpu, $"DisplayID: \"{WindowHandle}\"");
//SDL_CreateWindow($"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}", SDL_WINDOWPOS_CENTERED_DISPLAY(DisplayId), SDL_WINDOWPOS_CENTERED_DISPLAY(DisplayId), Width, Height, DefaultFlags | FullscreenFlag | GetWindowFlags());
if (WindowHandle == IntPtr.Zero)
@ -215,10 +217,10 @@ namespace Ryujinx.Headless.SDL2
// As we don't need this to fire in either case we can test for fullscreen.
if (!IsFullscreen && !IsExclusiveFullscreen)
{
Width = evnt.window.data1;
Height = evnt.window.data2;
Renderer?.Window.SetSize(Width, Height);
MouseDriver.SetClientSize(Width, Height);
// Width = evnt.window.data1;
// Height = evnt.window.data2;
// Renderer?.Window.SetSize(Width, Height);
// MouseDriver.SetClientSize(Width, Height);
// if (Renderer != null && Renderer.Window != null)
// {
// Renderer.Window.SetSize(Width, Height);