Keep the GUI alive when closing a game (#888)

* Keep the GUI alive when closing a game

Make HLE.Switch init when starting a game and dispose it when closing
the GlScreen.

This also make HLE in charge of disposing the audio and gpu backend.

* Address Ac_k's comments

* Make sure to dispose the Discord module and use GTK quit method

Also update Discord Precense when closing a game.

* Make sure to dispose MainWindow

* Address gdk's comments
This commit is contained in:
Thog 2020-01-21 23:23:11 +01:00 committed by Ac_K
parent b4b2b8b162
commit d6b9babe1d
16 changed files with 284 additions and 215 deletions

View file

@ -45,14 +45,20 @@ namespace Ryujinx.Ui
private ProfileWindowManager _profileWindow;
#endif
public GlScreen(Switch device, Renderer renderer)
public GlScreen(Switch device)
: base(1280, 720,
new GraphicsMode(), "Ryujinx", 0,
DisplayDevice.Default, 3, 3,
GraphicsContextFlags.ForwardCompatible)
{
_device = device;
_renderer = renderer;
_device = device;
if (!(device.Gpu.Renderer is Renderer))
{
throw new NotSupportedException($"GPU renderer must be an OpenGL renderer when using GlScreen!");
}
_renderer = (Renderer)device.Gpu.Renderer;
_primaryController = new Input.NpadController(ConfigurationState.Instance.Hid.JoystickControls);
@ -108,7 +114,6 @@ namespace Ryujinx.Ui
}
_device.DisposeGpu();
_renderer.Dispose();
}
public void MainLoop()