private void End() { if (_ending) { return; } _ending = true; if (_emulationContext != null) { UpdateGameMetadata(_emulationContext.Application.TitleIdText); if (GlRendererWidget != null) { // We tell the widget that we are exiting. GlRendererWidget.Exit(); // Wait for the other thread to dispose the HLE context before exiting. _deviceExitStatus.WaitOne(); GlRendererWidget.Dispose(); } } Dispose(); Program.Exit(); Application.Quit(); }
private void CreateGameWindow(HLE.Switch device) { device.Hid.Npads.AddControllers(ConfigurationState.Instance.Hid.InputConfig.Value.Select(inputConfig => new HLE.HOS.Services.Hid.ControllerConfig { Player = (PlayerIndex)inputConfig.PlayerIndex, Type = (ControllerType)inputConfig.ControllerType } ).ToArray()); _glWidget = new GlRenderer(_emulationContext, ConfigurationState.Instance.Logger.GraphicsDebugLevel); Application.Invoke(delegate { _viewBox.Remove(_gameTableWindow); _glWidget.Expand = true; _viewBox.Child = _glWidget; _glWidget.ShowAll(); EditFooterForGameRender(); if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen)) { ToggleExtraWidgets(false); } }); _glWidget.WaitEvent.WaitOne(); _glWidget.Start(); Ptc.Close(); PtcProfiler.Stop(); device.Dispose(); _deviceExitStatus.Set(); // NOTE: Everything that is here will not be executed when you close the UI. Application.Invoke(delegate { if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen)) { ToggleExtraWidgets(true); } _viewBox.Remove(_glWidget); _glWidget.Exit(); if (_glWidget.Window != this.Window && _glWidget.Window != null) { _glWidget.Window.Dispose(); } _glWidget.Dispose(); _viewBox.Add(_gameTableWindow); _gameTableWindow.Expand = true; this.Window.Title = $"Ryujinx {Program.Version}"; _emulationContext = null; _gameLoaded = false; _glWidget = null; DiscordIntegrationModule.SwitchToMainMenu(); RecreateFooterForMenu(); UpdateColumns(); UpdateGameTable(); Task.Run(RefreshFirmwareLabel); _stopEmulation.Sensitive = false; _firmwareInstallFile.Sensitive = true; _firmwareInstallDirectory.Sensitive = true; }); }
private void CreateGameWindow() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { _windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1); } DisplaySleep.Prevent(); GlRendererWidget = new GlRenderer(_emulationContext, ConfigurationState.Instance.Logger.GraphicsDebugLevel); Application.Invoke(delegate { _viewBox.Remove(_gameTableWindow); GlRendererWidget.Expand = true; _viewBox.Child = GlRendererWidget; GlRendererWidget.ShowAll(); EditFooterForGameRenderer(); if (Window.State.HasFlag(Gdk.WindowState.Fullscreen)) { ToggleExtraWidgets(false); } else if (ConfigurationState.Instance.Ui.StartFullscreen.Value) { FullScreen_Toggled(null, null); } }); GlRendererWidget.WaitEvent.WaitOne(); GlRendererWidget.Start(); Ptc.Close(); PtcProfiler.Stop(); _emulationContext.Dispose(); _deviceExitStatus.Set(); // NOTE: Everything that is here will not be executed when you close the UI. Application.Invoke(delegate { if (Window.State.HasFlag(Gdk.WindowState.Fullscreen)) { ToggleExtraWidgets(true); } GlRendererWidget.Exit(); if (GlRendererWidget.Window != Window && GlRendererWidget.Window != null) { GlRendererWidget.Window.Dispose(); } GlRendererWidget.Dispose(); _windowsMultimediaTimerResolution?.Dispose(); _windowsMultimediaTimerResolution = null; DisplaySleep.Restore(); _viewBox.Remove(GlRendererWidget); _viewBox.Add(_gameTableWindow); _gameTableWindow.Expand = true; Window.Title = $"Ryujinx {Program.Version}"; _emulationContext = null; _gameLoaded = false; GlRendererWidget = null; DiscordIntegrationModule.SwitchToMainMenu(); RecreateFooterForMenu(); UpdateColumns(); UpdateGameTable(); Task.Run(RefreshFirmwareLabel); Task.Run(HandleRelaunch); _stopEmulation.Sensitive = false; _simulateWakeUpMessage.Sensitive = false; _firmwareInstallFile.Sensitive = true; _firmwareInstallDirectory.Sensitive = true; }); }
private void CreateGameWindow(HLE.Switch device) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { _windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1); } _glWidget = new GlRenderer(_emulationContext, ConfigurationState.Instance.Logger.GraphicsDebugLevel); Application.Invoke(delegate { _viewBox.Remove(_gameTableWindow); _glWidget.Expand = true; _viewBox.Child = _glWidget; _glWidget.ShowAll(); EditFooterForGameRender(); if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen)) { ToggleExtraWidgets(false); } }); _glWidget.WaitEvent.WaitOne(); _glWidget.Start(); Ptc.Close(); PtcProfiler.Stop(); device.Dispose(); _deviceExitStatus.Set(); // NOTE: Everything that is here will not be executed when you close the UI. Application.Invoke(delegate { if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen)) { ToggleExtraWidgets(true); } _viewBox.Remove(_glWidget); _glWidget.Exit(); if (_glWidget.Window != this.Window && _glWidget.Window != null) { _glWidget.Window.Dispose(); } _glWidget.Dispose(); _windowsMultimediaTimerResolution?.Dispose(); _windowsMultimediaTimerResolution = null; _viewBox.Add(_gameTableWindow); _gameTableWindow.Expand = true; this.Window.Title = $"Ryujinx {Program.Version}"; _emulationContext = null; _gameLoaded = false; _glWidget = null; DiscordIntegrationModule.SwitchToMainMenu(); RecreateFooterForMenu(); UpdateColumns(); UpdateGameTable(); Task.Run(RefreshFirmwareLabel); _stopEmulation.Sensitive = false; _firmwareInstallFile.Sensitive = true; _firmwareInstallDirectory.Sensitive = true; }); }