use seperate event for limiter

This commit is contained in:
emmaus 2018-08-16 16:10:09 +00:00
parent e4292a5cdc
commit a26e1bc0a9
3 changed files with 12 additions and 9 deletions

View file

@ -166,11 +166,9 @@ namespace Ryujinx.HLE.HOS.Services.Android
{
Context.Device.Statistics.RecordGameFrameTime();
if (Context.Ns.EnableVsync)
if (Context.Device.EnableVsync)
{
Context.Ns.Os.VsyncEvent.WaitEvent.WaitOne();
Context.Ns.Os.VsyncEvent.WaitEvent.Reset();
Context.Device.VsyncEvent.WaitOne();
}
//TODO: Errors.

View file

@ -6,6 +6,7 @@ using Ryujinx.HLE.Input;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.Memory;
using System;
using System.Threading;
namespace Ryujinx.HLE
{
@ -27,9 +28,9 @@ namespace Ryujinx.HLE
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;
@ -60,6 +61,8 @@ namespace Ryujinx.HLE
Statistics = new PerformanceStatistics();
Hid = new Hid(this, System.HidSharedMem.PA);
VsyncEvent = new AutoResetEvent(true);
}
public void LoadCart(string ExeFsDir, string RomFsFile = null)
@ -114,6 +117,8 @@ namespace Ryujinx.HLE
if (Disposing)
{
System.Dispose();
VsyncEvent.Dispose();
}
}
}

View file

@ -82,7 +82,7 @@ namespace Ryujinx
if (Ticks >= TicksPerFrame)
{
Ns.Os.SignalVsync();
Device.VsyncEvent.Set();
RenderFrame();
@ -261,7 +261,7 @@ namespace Ryujinx
double GameFps = Device.Statistics.GetGameFrameRate();
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | Game Vsync: " +
(Ns.EnableVsync ? "On" : "Off");
(Device.EnableVsync ? "On" : "Off");
TitleEvent = true;
@ -315,7 +315,7 @@ namespace Ryujinx
Keyboard = e.Keyboard;
if (e.Key == Key.Tab)
Ns.EnableVsync = !Ns.EnableVsync;
Device.EnableVsync = !Device.EnableVsync;
}
protected override void OnMouseDown(MouseButtonEventArgs e)