Initial Framerate limit implementation

This commit is contained in:
emmaus 2018-08-15 20:12:23 +00:00
parent 3227218114
commit e4292a5cdc
3 changed files with 20 additions and 1 deletions

View file

@ -166,6 +166,13 @@ namespace Ryujinx.HLE.HOS.Services.Android
{
Context.Device.Statistics.RecordGameFrameTime();
if (Context.Ns.EnableVsync)
{
Context.Ns.Os.VsyncEvent.WaitEvent.WaitOne();
Context.Ns.Os.VsyncEvent.WaitEvent.Reset();
}
//TODO: Errors.
int Slot = ParcelReader.ReadInt32();
int Unknown4 = ParcelReader.ReadInt32();

View file

@ -27,6 +27,12 @@ namespace Ryujinx.HLE
public Hid Hid { get; private set; }
public bool LimitSpeed { get; set; }
public bool EnableVsync { get; set; }
public event EventHandler Finish;
public Switch(IGalRenderer Renderer, IAalOutput AudioOut)
{
if (Renderer == null)

View file

@ -82,6 +82,8 @@ namespace Ryujinx
if (Ticks >= TicksPerFrame)
{
Ns.Os.SignalVsync();
RenderFrame();
//Queue max. 1 vsync
@ -258,7 +260,8 @@ namespace Ryujinx
double HostFps = Device.Statistics.GetSystemFrameRate();
double GameFps = Device.Statistics.GetGameFrameRate();
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | Game Vsync: " +
(Ns.EnableVsync ? "On" : "Off");
TitleEvent = true;
@ -310,6 +313,9 @@ namespace Ryujinx
protected override void OnKeyUp(KeyboardKeyEventArgs e)
{
Keyboard = e.Keyboard;
if (e.Key == Key.Tab)
Ns.EnableVsync = !Ns.EnableVsync;
}
protected override void OnMouseDown(MouseButtonEventArgs e)