Naive limiter, VSync disabled

This commit is contained in:
ReinUsesLisp 2018-06-25 23:48:28 -03:00
parent c818093528
commit d0cb042ff4
2 changed files with 36 additions and 5 deletions

View file

@ -5,6 +5,7 @@ using Ryujinx.Graphics.Gal;
using Ryujinx.HLE; using Ryujinx.HLE;
using Ryujinx.HLE.Input; using Ryujinx.HLE.Input;
using System; using System;
using Stopwatch = System.Diagnostics.Stopwatch;
namespace Ryujinx namespace Ryujinx
{ {
@ -38,14 +39,44 @@ namespace Ryujinx
(DisplayDevice.Default.Height / 2) - (Height / 2)); (DisplayDevice.Default.Height / 2) - (Height / 2));
} }
protected override void OnLoad(EventArgs e) public void MainLoop()
{ {
VSync = VSyncMode.On; Load();
Visible = true;
Stopwatch Chrono = new Stopwatch();
Chrono.Start();
long TicksPerFrame = Stopwatch.Frequency / 60;
while (Exists && !IsExiting)
{
ProcessEvents();
if (!IsExiting)
{
if (Chrono.ElapsedTicks > TicksPerFrame)
{
UpdateFrame();
RenderFrame();
Chrono.Restart();
}
}
}
}
private new void Load()
{
//VSync = VSyncMode.On;
Renderer.FrameBuffer.SetWindowSize(Width, Height); Renderer.FrameBuffer.SetWindowSize(Width, Height);
} }
protected override void OnUpdateFrame(FrameEventArgs e) private new void UpdateFrame()
{ {
HidControllerButtons CurrentButton = 0; HidControllerButtons CurrentButton = 0;
HidJoystickPosition LeftJoystick; HidJoystickPosition LeftJoystick;
@ -185,7 +216,7 @@ namespace Ryujinx
Renderer.RunActions(); Renderer.RunActions();
} }
protected override void OnRenderFrame(FrameEventArgs e) private new void RenderFrame()
{ {
Renderer.FrameBuffer.Render(); Renderer.FrameBuffer.Render();

View file

@ -67,7 +67,7 @@ namespace Ryujinx
Screen.Exit(); Screen.Exit();
}; };
Screen.Run(0.0, 60.0); Screen.MainLoop();
} }
Environment.Exit(0); Environment.Exit(0);