Some fixes for the new GLRenderer (#930)
* Some fixes for the new GLRenderer Changelog: - Fix transparency of the window on some games on Windows. - Fix escape key not being able to exit emulation. - Fix inverted logic in fullscreen event handling. - Fix a race condition when stoping emulation causing a hang. - Fix a memory leak of the OpenGL context when stoping emulation (saving ~200MB of RAM when stoping emulation). - Simplify and document behaviours when exiting the emulator while the emulation is running. * Make sure to clear alpha channel when presenting Texture This fix once and for all the transparency issue on Windows. * Enforce footer bar size to avoid gl widget to get resized to 1280x724 * Fix full screen inversion in MainWindow and make sure _listStatusBox don't come back when not needed * Remove previous transparency clear attempt that is useless now * Remove an extra line return
This commit is contained in:
parent
8d83878f67
commit
416ddd0f6e
4 changed files with 97 additions and 72 deletions
|
@ -31,7 +31,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
private static GLRenderer _gLWidget;
|
||||
|
||||
private static AutoResetEvent _screenExitStatus = new AutoResetEvent(false);
|
||||
private static AutoResetEvent _deviceExitStatus = new AutoResetEvent(false);
|
||||
|
||||
private static ListStore _tableStore;
|
||||
|
||||
|
@ -356,7 +356,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
_emulationContext = device;
|
||||
|
||||
_screenExitStatus.Reset();
|
||||
_deviceExitStatus.Reset();
|
||||
|
||||
#if MACOS_BUILD
|
||||
CreateGameWindow(device);
|
||||
|
@ -391,8 +391,6 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
device.Hid.InitializePrimaryController(ConfigurationState.Instance.Hid.ControllerType);
|
||||
|
||||
_gLWidget?.Exit();
|
||||
_gLWidget?.Dispose();
|
||||
_gLWidget = new GLRenderer(_emulationContext);
|
||||
|
||||
Application.Invoke(delegate
|
||||
|
@ -402,13 +400,17 @@ namespace Ryujinx.Ui
|
|||
_viewBox.Child = _gLWidget;
|
||||
|
||||
_gLWidget.ShowAll();
|
||||
_listStatusBox.Hide();
|
||||
ClearFooterForGameRender();
|
||||
});
|
||||
|
||||
_gLWidget.WaitEvent.WaitOne();
|
||||
|
||||
_gLWidget.Start();
|
||||
|
||||
device.Dispose();
|
||||
_deviceExitStatus.Set();
|
||||
|
||||
// NOTE: Everything that is here will not be executed when you close the UI.
|
||||
Application.Invoke(delegate
|
||||
{
|
||||
_viewBox.Remove(_gLWidget);
|
||||
|
@ -419,36 +421,41 @@ namespace Ryujinx.Ui
|
|||
_gLWidget.Window.Dispose();
|
||||
}
|
||||
|
||||
_gLWidget.Dispose();
|
||||
|
||||
_viewBox.Add(_gameTableWindow);
|
||||
|
||||
_gameTableWindow.Expand = true;
|
||||
|
||||
this.Window.Title = "Ryujinx";
|
||||
|
||||
_listStatusBox.ShowAll();
|
||||
_emulationContext = null;
|
||||
_gameLoaded = false;
|
||||
_gLWidget = null;
|
||||
|
||||
DiscordIntegrationModule.SwitchToMainMenu();
|
||||
|
||||
RecreateFooterForMenu();
|
||||
|
||||
UpdateColumns();
|
||||
UpdateGameTable();
|
||||
|
||||
Task.Run(RefreshFirmwareLabel);
|
||||
});
|
||||
|
||||
device.Dispose();
|
||||
|
||||
_emulationContext = null;
|
||||
_gameLoaded = false;
|
||||
_gLWidget = null;
|
||||
|
||||
DiscordIntegrationModule.SwitchToMainMenu();
|
||||
|
||||
Application.Invoke(delegate
|
||||
{
|
||||
_stopEmulation.Sensitive = false;
|
||||
_firmwareInstallFile.Sensitive = true;
|
||||
_firmwareInstallDirectory.Sensitive = true;
|
||||
});
|
||||
}
|
||||
|
||||
_screenExitStatus.Set();
|
||||
private void RecreateFooterForMenu()
|
||||
{
|
||||
_footerBox.Add(_listStatusBox);
|
||||
}
|
||||
|
||||
private void ClearFooterForGameRender()
|
||||
{
|
||||
_footerBox.Remove(_listStatusBox);
|
||||
}
|
||||
|
||||
public void ToggleExtraWidgets(bool show)
|
||||
|
@ -469,7 +476,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
bool fullScreenToggled = this.Window.State.HasFlag(Gdk.WindowState.Fullscreen);
|
||||
|
||||
_fullScreen.Label = !fullScreenToggled ? "Exit Fullscreen" : "Enter Fullscreen";
|
||||
_fullScreen.Label = fullScreenToggled ? "Exit Fullscreen" : "Enter Fullscreen";
|
||||
}
|
||||
|
||||
private static void UpdateGameMetadata(string titleId)
|
||||
|
@ -506,8 +513,11 @@ namespace Ryujinx.Ui
|
|||
|
||||
if (_gLWidget != null)
|
||||
{
|
||||
// We tell the widget that we are exiting
|
||||
_gLWidget.Exit();
|
||||
_screenExitStatus.WaitOne();
|
||||
|
||||
// Wait for the other thread to dispose the HLE context before exiting.
|
||||
_deviceExitStatus.WaitOne();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -874,16 +884,12 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
Fullscreen();
|
||||
|
||||
_fullScreen.Label = "Exit Fullscreen";
|
||||
|
||||
ToggleExtraWidgets(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Unfullscreen();
|
||||
|
||||
_fullScreen.Label = "Enter Fullscreen";
|
||||
|
||||
ToggleExtraWidgets(true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue