mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 02:53:04 +00:00
fix log page, added logpage to main window
This commit is contained in:
parent
c4c0ad5837
commit
c24f4b03a1
11 changed files with 132 additions and 119 deletions
|
@ -12,7 +12,8 @@ namespace Ryujinx.Core
|
|||
private Thread EmulationThread;
|
||||
private Switch Ns;
|
||||
private IGalRenderer Renderer;
|
||||
private bool IsPaused = false;
|
||||
private bool IsPaused = false;
|
||||
private bool IsShutDown = false;
|
||||
|
||||
public EmutionController(Switch Ns, IGalRenderer Renderer)
|
||||
{
|
||||
|
@ -33,6 +34,7 @@ namespace Ryujinx.Core
|
|||
|
||||
Screen.Closed += (Sender, Args) =>
|
||||
{
|
||||
if(!IsShutDown)
|
||||
Stop();
|
||||
};
|
||||
|
||||
|
@ -46,6 +48,7 @@ namespace Ryujinx.Core
|
|||
public void Stop()
|
||||
{
|
||||
IsPaused = false;
|
||||
IsShutDown = true;
|
||||
Ns.Os.ShutDown();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using Gtk;
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
using Ryujinx;
|
||||
using Ryujinx.Audio;
|
||||
using Ryujinx.Audio.OpenAL;
|
||||
using Ryujinx.Core;
|
||||
|
@ -17,16 +18,18 @@ namespace Ryujinx.UI
|
|||
class MainWindow : Window
|
||||
{
|
||||
//UI Controls
|
||||
[GUI] Box MainBox;
|
||||
[GUI] MenuItem LoadFileMenuItem;
|
||||
[GUI] MenuItem LoadFolderMenuItem;
|
||||
[GUI] MenuItem ExitMenuItem;
|
||||
[GUI] MenuItem OptionMenuItem;
|
||||
[GUI] MenuItem ShowDebugMenuItem;
|
||||
[GUI] MenuItem ContinueMenuItem;
|
||||
[GUI] MenuItem PauseMenuItem;
|
||||
[GUI] MenuItem StopMenuItem;
|
||||
[GUI] MenuItem AboutMenuItem;
|
||||
|
||||
UI.Debugging.LogPage LogPage;
|
||||
|
||||
bool DebugWindowActive = false;
|
||||
|
||||
Core.Switch Ns;
|
||||
|
@ -48,9 +51,7 @@ namespace Ryujinx.UI
|
|||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
Icon = new Gdk.Pixbuf(stream);
|
||||
}
|
||||
|
||||
InitializeSwitch();
|
||||
}
|
||||
|
||||
//Register Events
|
||||
DeleteEvent += Window_DeleteEvent;
|
||||
|
@ -58,7 +59,6 @@ namespace Ryujinx.UI
|
|||
LoadFolderMenuItem.Activated += LoadFolderMenuItem_Activated;
|
||||
ExitMenuItem.Activated += ExitMenuItem_Activated;
|
||||
OptionMenuItem.Activated += OptionMenuItem_Activated;
|
||||
ShowDebugMenuItem.Activated += ShowDebugMenuItem_Activated;
|
||||
ContinueMenuItem.Activated += ContinueMenuItem_Activated;
|
||||
PauseMenuItem.Activated += PauseMenuItem_Activated;
|
||||
StopMenuItem.Activated += StopMenuItem_Activated;
|
||||
|
@ -70,6 +70,12 @@ namespace Ryujinx.UI
|
|||
|
||||
//Initialize Ryujinx
|
||||
Console.Title = "Ryujinx Console";
|
||||
|
||||
LogPage = new UI.Debugging.LogPage();
|
||||
MainBox.Add(LogPage.Widget);
|
||||
MainBox.SetChildPacking(LogPage.Widget, false, false, 0, PackType.End);
|
||||
|
||||
InitializeSwitch();
|
||||
}
|
||||
|
||||
private void AboutMenuItem_Activated(object sender, EventArgs e)
|
||||
|
@ -131,6 +137,9 @@ namespace Ryujinx.UI
|
|||
|
||||
void InitializeSwitch()
|
||||
{
|
||||
if(Ns!=null)
|
||||
Ns.Log.Updated -= UI.Debugging.LogPage.LogWriter.WriteLog;
|
||||
|
||||
Renderer = new OpenGLRenderer();
|
||||
|
||||
IAalOutput AudioOut = new OpenALAudioOut();
|
||||
|
@ -138,6 +147,10 @@ namespace Ryujinx.UI
|
|||
Ns = new Core.Switch(Renderer, AudioOut);
|
||||
|
||||
Settings.Read(Ns.Log);
|
||||
|
||||
LogPage.UpdateSettings(Ns.Log);
|
||||
|
||||
Ns.Log.Updated += UI.Debugging.LogPage.LogWriter.WriteLog;
|
||||
}
|
||||
|
||||
private void StopMenuItem_Activated(object sender, EventArgs e)
|
||||
|
@ -165,14 +178,6 @@ namespace Ryujinx.UI
|
|||
StopMenuItem.Sensitive = true;
|
||||
}
|
||||
|
||||
private void ShowDebugMenuItem_Activated(object sender, EventArgs e)
|
||||
{
|
||||
UI.Debugging.Debugger debugger = new UI.Debugging.Debugger();
|
||||
debugger.DeleteEvent += Debugger_DeleteEvent;
|
||||
DebugWindowActive = true;
|
||||
debugger.Show();
|
||||
}
|
||||
|
||||
private void Debugger_DeleteEvent(object o, DeleteEventArgs args)
|
||||
{
|
||||
DebugWindowActive = false;
|
||||
|
@ -227,8 +232,11 @@ namespace Ryujinx.UI
|
|||
|
||||
void Start()
|
||||
{
|
||||
EmulationController?.Stop();
|
||||
|
||||
EmulationController = new EmutionController(Ns, Renderer);
|
||||
EmulationController.Start();
|
||||
|
||||
PauseMenuItem.Sensitive = true;
|
||||
ContinueMenuItem.Sensitive = false;
|
||||
StopMenuItem.Sensitive = true;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Ryujinx.UI
|
|||
|
||||
Configuration.LoggingFilteredClasses = Configuration.LoggingFilteredClasses != null ?
|
||||
Configuration.LoggingFilteredClasses : string.Empty;
|
||||
string[] FilteredLogClasses = Configuration.LoggingFilteredClasses.Split('\n');
|
||||
string[] FilteredLogClasses = Configuration.LoggingFilteredClasses.Trim().Split('\n',StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
//When the classes are specified on the list, we only
|
||||
//enable the classes that are on the list.
|
||||
|
@ -68,6 +68,8 @@ namespace Ryujinx.UI
|
|||
|
||||
public static void Write(Logger Logger)
|
||||
{
|
||||
if (Logger == null)
|
||||
Logger = new Logger();
|
||||
Configuration Configuration = new Configuration
|
||||
{
|
||||
EmulatedJoyCon = Config.FakeJoyCon,
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Ryujinx.UI.UI
|
|||
OptionNotebook.AppendPage(GeneralPage.GetWidget(), GeneralLabel);
|
||||
Label InputLabel = new Label("Input");
|
||||
InputPage InputPage = new InputPage();
|
||||
OptionNotebook.AppendPage(InputPage.GetWidget(), InputLabel);
|
||||
OptionNotebook.AppendPage(InputPage.Widget, InputLabel);
|
||||
|
||||
//Register Events
|
||||
OptionAcceptButton.Clicked += OptionAcceptButton_Clicked;
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
using Gtk;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
|
||||
|
||||
namespace Ryujinx.UI.UI.Debugging
|
||||
{
|
||||
public class Debugger : Gtk.Window
|
||||
{
|
||||
[GUI] Notebook DebuggerNotebook;
|
||||
|
||||
public Debugger() : this(new Builder("Debugger.glade")) { }
|
||||
|
||||
public Debugger(Builder builder) : base(builder.GetObject("Debugger").Handle)
|
||||
{
|
||||
builder.Autoconnect(this);
|
||||
|
||||
//Add Pages
|
||||
Label LogLabel = new Label("Log");
|
||||
LogPage LogPage = new LogPage();
|
||||
DebuggerNotebook.AppendPage(LogPage.Widget, LogLabel);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.21.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="Debugger">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Debugger</property>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="DebuggerNotebook">
|
||||
<property name="height_request">500</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Ryujinx.Core.Logging;
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
namespace Ryujinx.UI.UI.Debugging
|
||||
|
@ -43,6 +44,7 @@ namespace Ryujinx.UI.UI.Debugging
|
|||
|
||||
//Style the log text box
|
||||
LogTextView.StyleContext.AddProvider(provider,1000);
|
||||
Widget.StyleContext.AddClass("border");
|
||||
|
||||
//Register Events
|
||||
InfoLogEnable.Toggled += InfoLogEnable_Toggled;
|
||||
|
@ -161,6 +163,7 @@ namespace Ryujinx.UI.UI.Debugging
|
|||
public override Encoding Encoding => Encoding.UTF8;
|
||||
public TextBuffer LogBuffer { get; private set; }
|
||||
private TextIter EndIter;
|
||||
private static object LogLock = new object();
|
||||
|
||||
public LogWriter()
|
||||
{
|
||||
|
@ -177,22 +180,42 @@ namespace Ryujinx.UI.UI.Debugging
|
|||
LogBuffer.TagTable.Add(new TextTag("DarkGray") { Foreground = "darkgray" });
|
||||
}
|
||||
|
||||
public override void Write(string value)
|
||||
public void WriteLog(object sender, LogEventArgs e)
|
||||
{
|
||||
string consoleColor = Console.ForegroundColor.ToString();
|
||||
Gtk.Application.Invoke(delegate
|
||||
lock (LogLock)
|
||||
{
|
||||
LogBuffer.InsertWithTagsByName(ref EndIter, value, consoleColor);
|
||||
});
|
||||
}
|
||||
string FormattedTime = e.Time.ToString(@"hh\:mm\:ss\.fff");
|
||||
|
||||
string CurrentThread = Thread.CurrentThread.ManagedThreadId.ToString("d4");
|
||||
|
||||
string Message = FormattedTime + " | " + CurrentThread + " " + e.Message;
|
||||
|
||||
string ColorTag = "White";
|
||||
|
||||
switch (e.Level)
|
||||
{
|
||||
case LogLevel.Debug:
|
||||
ColorTag = "Gray";
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
ColorTag = "Red";
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
ColorTag = "White";
|
||||
break;
|
||||
case LogLevel.Stub:
|
||||
ColorTag = "DarkGray";
|
||||
break;
|
||||
case LogLevel.Warning:
|
||||
ColorTag = "Yellow";
|
||||
break;
|
||||
}
|
||||
Gtk.Application.Invoke(delegate
|
||||
{
|
||||
LogBuffer.InsertWithTagsByName(ref EndIter, Message + Environment.NewLine, ColorTag);
|
||||
});
|
||||
}
|
||||
|
||||
public override void WriteLine(string value)
|
||||
{
|
||||
string consoleColor = Console.ForegroundColor.ToString();
|
||||
Gtk.Application.Invoke(delegate
|
||||
{
|
||||
LogBuffer.InsertWithTagsByName(ref EndIter, value + Environment.NewLine, consoleColor);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkBox" id="MainBox">
|
||||
<property name="height_request">300</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
|
@ -15,6 +16,9 @@
|
|||
<property name="margin_top">10</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="min_content_width">0</property>
|
||||
<property name="min_content_height">350</property>
|
||||
<property name="max_content_height">350</property>
|
||||
<property name="propagate_natural_width">True</property>
|
||||
<property name="propagate_natural_height">True</property>
|
||||
<child>
|
||||
|
@ -22,6 +26,9 @@
|
|||
<property name="width_request">400</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="hscroll_policy">natural</property>
|
||||
<property name="vscroll_policy">natural</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="wrap_mode">word</property>
|
||||
<style>
|
||||
|
@ -38,11 +45,12 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="width_request">200</property>
|
||||
<property name="width_request">-1</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
|
@ -107,34 +115,6 @@
|
|||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="TraceLogEnable">
|
||||
<property name="label" translatable="yes">Trace</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="FatalLogEnable">
|
||||
<property name="label" translatable="yes">Fatal</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="StubLogEnable">
|
||||
<property name="label" translatable="yes">Stub</property>
|
||||
|
@ -181,6 +161,20 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
|
@ -192,6 +186,7 @@
|
|||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
|
@ -225,12 +220,12 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="SaveButton">
|
||||
<property name="label" translatable="yes">button</property>
|
||||
<property name="label" translatable="yes">Save</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
|
@ -240,14 +235,14 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Ryujinx.UI.UI
|
|||
{
|
||||
public class InputPage : Notebook
|
||||
{
|
||||
public Widget Widget => Notebook;
|
||||
|
||||
Notebook Notebook;
|
||||
//Buttons
|
||||
[GUI] Button LeftAnalogUp;
|
||||
|
@ -487,9 +489,6 @@ namespace Ryujinx.UI.UI
|
|||
IsPressed = false;
|
||||
}
|
||||
|
||||
public Widget GetWidget()
|
||||
{
|
||||
return Notebook;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="baseline_position">bottom</property>
|
||||
<child>
|
||||
<object class="GtkMenuBar" id="MainMenu">
|
||||
<property name="visible">True</property>
|
||||
|
@ -143,14 +144,6 @@
|
|||
<object class="GtkMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="ShowDebugMenuItem">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Show Debug Window</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -184,6 +177,35 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
|
|
@ -2,4 +2,9 @@
|
|||
{
|
||||
background-color:black;
|
||||
color:blue;
|
||||
}
|
||||
|
||||
* .border
|
||||
{
|
||||
background-color : lightgray;
|
||||
}
|
Loading…
Reference in a new issue