Set title from main thread
This commit is contained in:
parent
5859a134a8
commit
b44ad9feba
1 changed files with 16 additions and 7 deletions
|
@ -33,7 +33,9 @@ namespace Ryujinx
|
||||||
|
|
||||||
private bool ResizeEvent;
|
private bool ResizeEvent;
|
||||||
|
|
||||||
private bool Quit;
|
private bool TitleEvent;
|
||||||
|
|
||||||
|
private string NewTitle;
|
||||||
|
|
||||||
public GLScreen(Switch Ns, IGalRenderer Renderer)
|
public GLScreen(Switch Ns, IGalRenderer Renderer)
|
||||||
: base(1280, 720,
|
: base(1280, 720,
|
||||||
|
@ -50,7 +52,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
ResizeEvent = false;
|
ResizeEvent = false;
|
||||||
|
|
||||||
Quit = false;
|
TitleEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RenderLoop()
|
private void RenderLoop()
|
||||||
|
@ -65,7 +67,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
long Ticks = 0;
|
long Ticks = 0;
|
||||||
|
|
||||||
while (!Quit && Exists && !IsExiting)
|
while (Exists && !IsExiting)
|
||||||
{
|
{
|
||||||
if (Ns.WaitFifo())
|
if (Ns.WaitFifo())
|
||||||
{
|
{
|
||||||
|
@ -104,7 +106,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
Context.MakeCurrent(null);
|
Context.MakeCurrent(null);
|
||||||
|
|
||||||
//OpenTK doesn't like sleeps in its thread, to avoid these a renderer thread is created
|
//OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created
|
||||||
RenderThread = new Thread(RenderLoop);
|
RenderThread = new Thread(RenderLoop);
|
||||||
|
|
||||||
RenderThread.Start();
|
RenderThread.Start();
|
||||||
|
@ -116,6 +118,13 @@ namespace Ryujinx
|
||||||
if (!IsExiting)
|
if (!IsExiting)
|
||||||
{
|
{
|
||||||
UpdateFrame();
|
UpdateFrame();
|
||||||
|
|
||||||
|
if (TitleEvent)
|
||||||
|
{
|
||||||
|
TitleEvent = false;
|
||||||
|
|
||||||
|
Title = NewTitle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +373,9 @@ namespace Ryujinx
|
||||||
double HostFps = Ns.Statistics.GetSystemFrameRate();
|
double HostFps = Ns.Statistics.GetSystemFrameRate();
|
||||||
double GameFps = Ns.Statistics.GetGameFrameRate();
|
double GameFps = Ns.Statistics.GetGameFrameRate();
|
||||||
|
|
||||||
Title = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
|
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
|
||||||
|
|
||||||
|
TitleEvent = true;
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
|
@ -373,8 +384,6 @@ namespace Ryujinx
|
||||||
|
|
||||||
protected override void OnUnload(EventArgs e)
|
protected override void OnUnload(EventArgs e)
|
||||||
{
|
{
|
||||||
Quit = true;
|
|
||||||
|
|
||||||
RenderThread.Join();
|
RenderThread.Join();
|
||||||
|
|
||||||
base.OnUnload(e);
|
base.OnUnload(e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue