use seperate event for limiter
This commit is contained in:
parent
e4292a5cdc
commit
a26e1bc0a9
3 changed files with 12 additions and 9 deletions
|
@ -166,11 +166,9 @@ namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
{
|
{
|
||||||
Context.Device.Statistics.RecordGameFrameTime();
|
Context.Device.Statistics.RecordGameFrameTime();
|
||||||
|
|
||||||
if (Context.Ns.EnableVsync)
|
if (Context.Device.EnableVsync)
|
||||||
{
|
{
|
||||||
Context.Ns.Os.VsyncEvent.WaitEvent.WaitOne();
|
Context.Device.VsyncEvent.WaitOne();
|
||||||
|
|
||||||
Context.Ns.Os.VsyncEvent.WaitEvent.Reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Errors.
|
//TODO: Errors.
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Ryujinx.HLE.Input;
|
||||||
using Ryujinx.HLE.Logging;
|
using Ryujinx.HLE.Logging;
|
||||||
using Ryujinx.HLE.Memory;
|
using Ryujinx.HLE.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.HLE
|
namespace Ryujinx.HLE
|
||||||
{
|
{
|
||||||
|
@ -27,9 +28,9 @@ namespace Ryujinx.HLE
|
||||||
|
|
||||||
public Hid Hid { get; private set; }
|
public Hid Hid { get; private set; }
|
||||||
|
|
||||||
public bool LimitSpeed { get; set; }
|
public bool EnableVsync { get; set; } = true;
|
||||||
|
|
||||||
public bool EnableVsync { get; set; }
|
public AutoResetEvent VsyncEvent { get; private set; }
|
||||||
|
|
||||||
public event EventHandler Finish;
|
public event EventHandler Finish;
|
||||||
|
|
||||||
|
@ -60,6 +61,8 @@ namespace Ryujinx.HLE
|
||||||
Statistics = new PerformanceStatistics();
|
Statistics = new PerformanceStatistics();
|
||||||
|
|
||||||
Hid = new Hid(this, System.HidSharedMem.PA);
|
Hid = new Hid(this, System.HidSharedMem.PA);
|
||||||
|
|
||||||
|
VsyncEvent = new AutoResetEvent(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadCart(string ExeFsDir, string RomFsFile = null)
|
public void LoadCart(string ExeFsDir, string RomFsFile = null)
|
||||||
|
@ -114,6 +117,8 @@ namespace Ryujinx.HLE
|
||||||
if (Disposing)
|
if (Disposing)
|
||||||
{
|
{
|
||||||
System.Dispose();
|
System.Dispose();
|
||||||
|
|
||||||
|
VsyncEvent.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
if (Ticks >= TicksPerFrame)
|
if (Ticks >= TicksPerFrame)
|
||||||
{
|
{
|
||||||
Ns.Os.SignalVsync();
|
Device.VsyncEvent.Set();
|
||||||
|
|
||||||
RenderFrame();
|
RenderFrame();
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ namespace Ryujinx
|
||||||
double GameFps = Device.Statistics.GetGameFrameRate();
|
double GameFps = Device.Statistics.GetGameFrameRate();
|
||||||
|
|
||||||
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | Game Vsync: " +
|
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | Game Vsync: " +
|
||||||
(Ns.EnableVsync ? "On" : "Off");
|
(Device.EnableVsync ? "On" : "Off");
|
||||||
|
|
||||||
TitleEvent = true;
|
TitleEvent = true;
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ namespace Ryujinx
|
||||||
Keyboard = e.Keyboard;
|
Keyboard = e.Keyboard;
|
||||||
|
|
||||||
if (e.Key == Key.Tab)
|
if (e.Key == Key.Tab)
|
||||||
Ns.EnableVsync = !Ns.EnableVsync;
|
Device.EnableVsync = !Device.EnableVsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseButtonEventArgs e)
|
protected override void OnMouseDown(MouseButtonEventArgs e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue