forked from MeloNX/MeloNX
Add Exit Emulation (broken)
This commit is contained in:
parent
438c1a896f
commit
2e6e4eb2a0
Binary file not shown.
@ -31,6 +31,8 @@ void install_firmware(const char* inputPtr);
|
||||
|
||||
char* installed_firmware_version();
|
||||
|
||||
void stop_emulation();
|
||||
|
||||
int main_ryujinx_sdl(int argc, char **argv);
|
||||
|
||||
void initialize();
|
||||
|
@ -33,6 +33,10 @@ struct ContentView: View {
|
||||
@State var onscreencontroller: Controller = Controller(id: "", name: "")
|
||||
@AppStorage("JIT") var isJITEnabled: Bool = false
|
||||
|
||||
@AppStorage("quit") var quit: Bool = false
|
||||
|
||||
@State var quits: Bool = false
|
||||
|
||||
// MARK: - Initialization
|
||||
init() {
|
||||
let defaultConfig = loadSettings() ?? Ryujinx.Configuration(gamepath: "")
|
||||
@ -52,10 +56,25 @@ struct ContentView: View {
|
||||
|
||||
// MARK: - Body
|
||||
var body: some View {
|
||||
if let game {
|
||||
if let game, quits == false {
|
||||
emulationView
|
||||
.onAppear() {
|
||||
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
|
||||
print(quit)
|
||||
|
||||
quits = quit
|
||||
|
||||
if quits {
|
||||
quit = false
|
||||
timer.invalidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mainMenuView
|
||||
.onAppear() {
|
||||
quits = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,24 @@ import SwiftUIJoystick
|
||||
import CoreMotion
|
||||
|
||||
struct ControllerView: View {
|
||||
@AppStorage("quit") var quit: Bool = false
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
if geometry.size.height > geometry.size.width && UIDevice.current.userInterfaceIdiom != .pad {
|
||||
VStack {
|
||||
/*
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button("Stop emulation") {
|
||||
DispatchQueue.main.async {
|
||||
stop_emulation()
|
||||
quit = true
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Spacer()
|
||||
VStack {
|
||||
HStack {
|
||||
@ -48,6 +62,19 @@ struct ControllerView: View {
|
||||
} else {
|
||||
// could be landscape
|
||||
VStack {
|
||||
/*
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button("Stop emulation") {
|
||||
DispatchQueue.main.async {
|
||||
stop_emulation()
|
||||
quit = true
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Spacer()
|
||||
VStack {
|
||||
HStack {
|
||||
|
@ -93,6 +93,7 @@ using Silk.NET.Vulkan;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using SDL2;
|
||||
|
||||
public class GamepadInfo
|
||||
{
|
||||
@ -288,6 +289,21 @@ namespace Ryujinx.Headless.SDL2
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(EntryPoint = "stop_emulation")]
|
||||
public static void StopEmulation()
|
||||
{
|
||||
|
||||
if (_window != null)
|
||||
{
|
||||
|
||||
_window.Exit();
|
||||
_emulationContext.Dispose();
|
||||
_emulationContext = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[UnmanagedCallersOnly(EntryPoint = "get_game_controllers")]
|
||||
public static unsafe IntPtr GetGamepadList()
|
||||
|
@ -45,14 +45,14 @@ namespace Ryujinx.Headless.SDL2
|
||||
_mainThreadActions.Enqueue(action);
|
||||
}
|
||||
|
||||
public NpadManager NpadManager { get; }
|
||||
public TouchScreenManager TouchScreenManager { get; }
|
||||
public Switch Device { get; private set; }
|
||||
public IRenderer Renderer { get; private set; }
|
||||
public NpadManager NpadManager;
|
||||
public TouchScreenManager TouchScreenManager;
|
||||
public Switch Device;
|
||||
public IRenderer Renderer;
|
||||
|
||||
public event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
|
||||
|
||||
protected IntPtr WindowHandle { get; set; }
|
||||
public IntPtr WindowHandle;
|
||||
|
||||
public IHostUiTheme HostUiTheme { get; }
|
||||
public int Width { get; private set; }
|
||||
@ -66,18 +66,18 @@ namespace Ryujinx.Headless.SDL2
|
||||
public ScalingFilter ScalingFilter { get; set; }
|
||||
public int ScalingFilterLevel { get; set; }
|
||||
|
||||
protected SDL2MouseDriver MouseDriver;
|
||||
public SDL2MouseDriver MouseDriver;
|
||||
private readonly InputManager _inputManager;
|
||||
private readonly IKeyboard _keyboardInterface;
|
||||
private readonly GraphicsDebugLevel _glLogLevel;
|
||||
private readonly Stopwatch _chrono;
|
||||
private readonly long _ticksPerFrame;
|
||||
private readonly CancellationTokenSource _gpuCancellationTokenSource;
|
||||
private readonly ManualResetEvent _exitEvent;
|
||||
private readonly ManualResetEvent _gpuDoneEvent;
|
||||
public ManualResetEvent _exitEvent;
|
||||
public ManualResetEvent _gpuDoneEvent;
|
||||
|
||||
private long _ticks;
|
||||
private bool _isActive;
|
||||
public bool _isActive;
|
||||
private bool _isStopped;
|
||||
private uint _windowId;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user