Render Profiler in GUI (#854)

* move profiler output to gui

* addressed commits, rebased

* removed whitespaces
This commit is contained in:
emmauss 2020-02-06 11:25:47 +00:00 committed by GitHub
parent db9f8f999f
commit f2b9a9c2b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 1358 additions and 1639 deletions

View file

@ -5,8 +5,6 @@ using Ryujinx.Configuration;
using Ryujinx.Graphics.OpenGL;
using Ryujinx.HLE;
using Ryujinx.HLE.Input;
using Ryujinx.Profiler.UI;
using Ryujinx.Ui;
using System;
using System.Threading;
@ -41,10 +39,6 @@ namespace Ryujinx.Ui
private string _newTitle;
#if USE_PROFILING
private ProfileWindowManager _profileWindow;
#endif
public GlScreen(Switch device)
: base(1280, 720,
new GraphicsMode(), "Ryujinx", 0,
@ -65,11 +59,6 @@ namespace Ryujinx.Ui
Location = new Point(
(DisplayDevice.Default.Width / 2) - (Width / 2),
(DisplayDevice.Default.Height / 2) - (Height / 2));
#if USE_PROFILING
// Start profile window, it will handle itself from there
_profileWindow = new ProfileWindowManager();
#endif
}
private void RenderLoop()
@ -171,11 +160,6 @@ namespace Ryujinx.Ui
{
KeyboardState keyboard = _keyboard.Value;
#if USE_PROFILING
// Profiler input, lets the profiler get access to the main windows keyboard state
_profileWindow.UpdateKeyInput(keyboard);
#endif
// Normal Input
currentHotkeyButtons = KeyboardControls.GetHotkeyButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
currentButton = KeyboardControls.GetButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
@ -330,10 +314,6 @@ namespace Ryujinx.Ui
protected override void OnUnload(EventArgs e)
{
#if USE_PROFILING
_profileWindow.Close();
#endif
_renderThread.Join();
base.OnUnload(e);

View file

@ -3,11 +3,12 @@ using JsonPrettyPrinterPlus;
using Ryujinx.Audio;
using Ryujinx.Common.Logging;
using Ryujinx.Configuration;
using Ryujinx.Debugger.Profiler;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.OpenGL;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.Profiler;
using Ryujinx.HLE.FileSystem;
using System;
using System.Diagnostics;
using System.IO;
@ -36,9 +37,12 @@ namespace Ryujinx.Ui
private static bool _updatingGameTable;
private static bool _gameLoaded;
private static bool _ending;
private static bool _debuggerOpened;
private static TreeView _treeView;
private static Debugger.Debugger _debugger;
#pragma warning disable CS0649
#pragma warning disable IDE0044
[GUI] Window _mainWin;
@ -61,6 +65,8 @@ namespace Ryujinx.Ui
[GUI] Label _progressLabel;
[GUI] Label _firmwareVersionLabel;
[GUI] LevelBar _progressBar;
[GUI] MenuItem _openDebugger;
[GUI] MenuItem _toolsMenu;
#pragma warning restore CS0649
#pragma warning restore IDE0044
@ -118,6 +124,13 @@ namespace Ryujinx.Ui
if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn) _fileSizeToggle.Active = true;
if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn) _pathToggle.Active = true;
#if USE_DEBUGGING
_debugger = new Debugger.Debugger();
_openDebugger.Activated += _openDebugger_Opened;
#else
_openDebugger.Visible = false;
#endif
_gameTable.Model = _tableStore = new ListStore(
typeof(bool),
typeof(Gdk.Pixbuf),
@ -141,6 +154,36 @@ namespace Ryujinx.Ui
Task.Run(RefreshFirmwareLabel);
}
#if USE_DEBUGGING
private void _openDebugger_Opened(object sender, EventArgs e)
{
if (_debuggerOpened)
{
return;
}
Window debugWindow = new Window("Debugger");
debugWindow.SetSizeRequest(1280, 640);
debugWindow.Child = _debugger.Widget;
debugWindow.DeleteEvent += DebugWindow_DeleteEvent;
debugWindow.ShowAll();
_debugger.Enable();
_debuggerOpened = true;
}
private void DebugWindow_DeleteEvent(object o, DeleteEventArgs args)
{
_debuggerOpened = false;
_debugger.Disable();
(_debugger.Widget.Parent as Window)?.Remove(_debugger.Widget);
}
#endif
internal static void ApplyTheme()
{
if (!ConfigurationState.Instance.Ui.EnableCustomTheme)
@ -307,7 +350,15 @@ namespace Ryujinx.Ui
#if MACOS_BUILD
CreateGameWindow(device);
#else
new Thread(() => CreateGameWindow(device)).Start();
var windowThread = new Thread(() =>
{
CreateGameWindow(device);
})
{
Name = "GUI.WindowThread"
};
windowThread.Start();
#endif
_gameLoaded = true;
@ -366,6 +417,11 @@ namespace Ryujinx.Ui
private void End(HLE.Switch device)
{
#if USE_DEBUGGING
_debugger.Dispose();
#endif
if (_ending)
{
return;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.21.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkApplicationWindow" id="_mainWin">
@ -8,6 +8,9 @@
<property name="window_position">center</property>
<property name="default_width">1280</property>
<property name="default_height">750</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkBox" id="_box">
<property name="visible">True</property>
@ -255,7 +258,7 @@
</object>
</child>
<child>
<object class="GtkMenuItem" id="ToolsMenu">
<object class="GtkMenuItem" id="_toolsMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tools</property>
@ -296,6 +299,14 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="_openDebugger">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Open Debugger</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</child>
</object>
@ -499,8 +510,5 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>