2018-02-04 23:08:20 +00:00
|
|
|
using OpenTK;
|
|
|
|
using OpenTK.Graphics;
|
2018-03-03 01:49:17 +00:00
|
|
|
using OpenTK.Input;
|
2018-02-20 20:09:23 +00:00
|
|
|
using Ryujinx.Graphics.Gal;
|
2018-06-11 00:46:42 +00:00
|
|
|
using Ryujinx.HLE;
|
|
|
|
using Ryujinx.HLE.Input;
|
2018-02-04 23:08:20 +00:00
|
|
|
using System;
|
2018-07-12 17:03:52 +00:00
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
using Stopwatch = System.Diagnostics.Stopwatch;
|
2018-02-04 23:08:20 +00:00
|
|
|
|
|
|
|
namespace Ryujinx
|
|
|
|
{
|
|
|
|
public class GLScreen : GameWindow
|
|
|
|
{
|
2018-03-03 01:49:17 +00:00
|
|
|
private const int TouchScreenWidth = 1280;
|
|
|
|
private const int TouchScreenHeight = 720;
|
|
|
|
|
|
|
|
private const float TouchScreenRatioX = (float)TouchScreenWidth / TouchScreenHeight;
|
|
|
|
private const float TouchScreenRatioY = (float)TouchScreenHeight / TouchScreenWidth;
|
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
private const int TargetFPS = 60;
|
|
|
|
|
2018-02-04 23:08:20 +00:00
|
|
|
private Switch Ns;
|
|
|
|
|
|
|
|
private IGalRenderer Renderer;
|
|
|
|
|
2018-06-21 21:10:19 +00:00
|
|
|
private KeyboardState? Keyboard = null;
|
|
|
|
|
|
|
|
private MouseState? Mouse = null;
|
2018-06-24 00:39:25 +00:00
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
private Thread RenderThread;
|
|
|
|
|
|
|
|
private bool ResizeEvent;
|
|
|
|
|
|
|
|
private bool TitleEvent;
|
|
|
|
|
|
|
|
private string NewTitle;
|
|
|
|
|
2018-02-04 23:08:20 +00:00
|
|
|
public GLScreen(Switch Ns, IGalRenderer Renderer)
|
|
|
|
: base(1280, 720,
|
|
|
|
new GraphicsMode(), "Ryujinx", 0,
|
|
|
|
DisplayDevice.Default, 3, 3,
|
|
|
|
GraphicsContextFlags.ForwardCompatible)
|
|
|
|
{
|
2018-02-23 21:48:27 +00:00
|
|
|
this.Ns = Ns;
|
2018-02-04 23:08:20 +00:00
|
|
|
this.Renderer = Renderer;
|
2018-03-04 23:32:18 +00:00
|
|
|
|
|
|
|
Location = new Point(
|
|
|
|
(DisplayDevice.Default.Width / 2) - (Width / 2),
|
|
|
|
(DisplayDevice.Default.Height / 2) - (Height / 2));
|
2018-07-12 17:03:52 +00:00
|
|
|
|
|
|
|
ResizeEvent = false;
|
|
|
|
|
|
|
|
TitleEvent = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void RenderLoop()
|
|
|
|
{
|
|
|
|
MakeCurrent();
|
|
|
|
|
|
|
|
Stopwatch Chrono = new Stopwatch();
|
|
|
|
|
|
|
|
Chrono.Start();
|
|
|
|
|
|
|
|
long TicksPerFrame = Stopwatch.Frequency / TargetFPS;
|
|
|
|
|
|
|
|
long Ticks = 0;
|
|
|
|
|
|
|
|
while (Exists && !IsExiting)
|
|
|
|
{
|
|
|
|
if (Ns.WaitFifo())
|
|
|
|
{
|
|
|
|
Ns.ProcessFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
Renderer.RunActions();
|
|
|
|
|
|
|
|
if (ResizeEvent)
|
|
|
|
{
|
|
|
|
ResizeEvent = false;
|
|
|
|
|
|
|
|
Renderer.FrameBuffer.SetWindowSize(Width, Height);
|
|
|
|
}
|
|
|
|
|
|
|
|
Ticks += Chrono.ElapsedTicks;
|
|
|
|
|
|
|
|
Chrono.Restart();
|
|
|
|
|
|
|
|
if (Ticks >= TicksPerFrame)
|
|
|
|
{
|
|
|
|
RenderFrame();
|
|
|
|
|
|
|
|
//Queue max. 1 vsync
|
|
|
|
Ticks = Math.Min(Ticks - TicksPerFrame, TicksPerFrame);
|
|
|
|
}
|
|
|
|
}
|
2018-02-04 23:08:20 +00:00
|
|
|
}
|
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
public void MainLoop()
|
2018-02-04 23:08:20 +00:00
|
|
|
{
|
2018-07-12 17:03:52 +00:00
|
|
|
VSync = VSyncMode.Off;
|
|
|
|
|
|
|
|
Visible = true;
|
2018-04-14 04:31:27 +00:00
|
|
|
|
2018-06-24 00:39:25 +00:00
|
|
|
Renderer.FrameBuffer.SetWindowSize(Width, Height);
|
2018-07-12 17:03:52 +00:00
|
|
|
|
|
|
|
Context.MakeCurrent(null);
|
|
|
|
|
|
|
|
//OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created
|
|
|
|
RenderThread = new Thread(RenderLoop);
|
|
|
|
|
|
|
|
RenderThread.Start();
|
|
|
|
|
|
|
|
while (Exists && !IsExiting)
|
|
|
|
{
|
|
|
|
ProcessEvents();
|
|
|
|
|
|
|
|
if (!IsExiting)
|
|
|
|
{
|
|
|
|
UpdateFrame();
|
|
|
|
|
|
|
|
if (TitleEvent)
|
|
|
|
{
|
|
|
|
TitleEvent = false;
|
|
|
|
|
|
|
|
Title = NewTitle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-04 23:08:20 +00:00
|
|
|
}
|
2018-07-02 22:08:54 +00:00
|
|
|
|
|
|
|
private bool IsGamePadButtonPressedFromString(GamePadState GamePad, string Button)
|
|
|
|
{
|
|
|
|
if (Button.ToUpper() == "LTRIGGER" || Button.ToUpper() == "RTRIGGER")
|
|
|
|
{
|
|
|
|
return GetGamePadTriggerFromString(GamePad, Button) >= Config.GamePadTriggerThreshold;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return (GetGamePadButtonFromString(GamePad, Button) == ButtonState.Pressed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private ButtonState GetGamePadButtonFromString(GamePadState GamePad, string Button)
|
|
|
|
{
|
|
|
|
switch (Button.ToUpper())
|
|
|
|
{
|
|
|
|
case "A": return GamePad.Buttons.A;
|
|
|
|
case "B": return GamePad.Buttons.B;
|
|
|
|
case "X": return GamePad.Buttons.X;
|
|
|
|
case "Y": return GamePad.Buttons.Y;
|
|
|
|
case "LSTICK": return GamePad.Buttons.LeftStick;
|
|
|
|
case "RSTICK": return GamePad.Buttons.RightStick;
|
|
|
|
case "LSHOULDER": return GamePad.Buttons.LeftShoulder;
|
|
|
|
case "RSHOULDER": return GamePad.Buttons.RightShoulder;
|
|
|
|
case "DPADUP": return GamePad.DPad.Up;
|
|
|
|
case "DPADDOWN": return GamePad.DPad.Down;
|
|
|
|
case "DPADLEFT": return GamePad.DPad.Left;
|
|
|
|
case "DPADRIGHT": return GamePad.DPad.Right;
|
|
|
|
case "START": return GamePad.Buttons.Start;
|
|
|
|
case "BACK": return GamePad.Buttons.Back;
|
|
|
|
default: throw new ArgumentException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private float GetGamePadTriggerFromString(GamePadState GamePad, string Trigger)
|
|
|
|
{
|
|
|
|
switch (Trigger.ToUpper())
|
|
|
|
{
|
|
|
|
case "LTRIGGER": return GamePad.Triggers.Left;
|
|
|
|
case "RTRIGGER": return GamePad.Triggers.Right;
|
|
|
|
default: throw new ArgumentException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Vector2 GetJoystickAxisFromString(GamePadState GamePad, string Joystick)
|
|
|
|
{
|
|
|
|
switch (Joystick.ToUpper())
|
|
|
|
{
|
|
|
|
case "LJOYSTICK": return GamePad.ThumbSticks.Left;
|
|
|
|
case "RJOYSTICK": return new Vector2(-GamePad.ThumbSticks.Right.Y, -GamePad.ThumbSticks.Right.X);
|
|
|
|
default: throw new ArgumentException();
|
|
|
|
}
|
|
|
|
}
|
2018-02-04 23:08:20 +00:00
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
private new void UpdateFrame()
|
2018-02-04 23:08:20 +00:00
|
|
|
{
|
2018-03-03 01:49:17 +00:00
|
|
|
HidControllerButtons CurrentButton = 0;
|
2018-07-02 22:08:54 +00:00
|
|
|
HidJoystickPosition LeftJoystick;
|
|
|
|
HidJoystickPosition RightJoystick;
|
2018-02-22 13:28:27 +00:00
|
|
|
|
2018-07-02 22:08:54 +00:00
|
|
|
int LeftJoystickDX = 0;
|
|
|
|
int LeftJoystickDY = 0;
|
|
|
|
int RightJoystickDX = 0;
|
|
|
|
int RightJoystickDY = 0;
|
|
|
|
float AnalogStickDeadzone = Config.GamePadDeadzone;
|
2018-06-24 00:39:25 +00:00
|
|
|
|
2018-07-02 22:08:54 +00:00
|
|
|
//Keyboard Input
|
2018-06-21 21:10:19 +00:00
|
|
|
if (Keyboard.HasValue)
|
|
|
|
{
|
|
|
|
KeyboardState Keyboard = this.Keyboard.Value;
|
|
|
|
|
|
|
|
if (Keyboard[Key.Escape]) this.Exit();
|
|
|
|
|
2018-07-02 22:08:54 +00:00
|
|
|
//LeftJoystick
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickUp]) LeftJoystickDY = short.MaxValue;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickDown]) LeftJoystickDY = -short.MaxValue;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickLeft]) LeftJoystickDX = -short.MaxValue;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickRight]) LeftJoystickDX = short.MaxValue;
|
2018-06-21 21:10:19 +00:00
|
|
|
|
|
|
|
//LeftButtons
|
2018-07-02 22:08:54 +00:00
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickButton]) CurrentButton |= HidControllerButtons.KEY_LSTICK;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadUp]) CurrentButton |= HidControllerButtons.KEY_DUP;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadDown]) CurrentButton |= HidControllerButtons.KEY_DDOWN;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadLeft]) CurrentButton |= HidControllerButtons.KEY_DLEFT;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadRight]) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonMinus]) CurrentButton |= HidControllerButtons.KEY_MINUS;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonL]) CurrentButton |= HidControllerButtons.KEY_L;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonZL]) CurrentButton |= HidControllerButtons.KEY_ZL;
|
2018-06-21 21:10:19 +00:00
|
|
|
|
|
|
|
//RightJoystick
|
2018-07-02 22:08:54 +00:00
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickUp]) RightJoystickDY = short.MaxValue;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickDown]) RightJoystickDY = -short.MaxValue;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickLeft]) RightJoystickDX = -short.MaxValue;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickRight]) RightJoystickDX = short.MaxValue;
|
2018-06-24 00:39:25 +00:00
|
|
|
|
2018-06-21 21:10:19 +00:00
|
|
|
//RightButtons
|
2018-07-02 22:08:54 +00:00
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickButton]) CurrentButton |= HidControllerButtons.KEY_RSTICK;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonA]) CurrentButton |= HidControllerButtons.KEY_A;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonB]) CurrentButton |= HidControllerButtons.KEY_B;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonX]) CurrentButton |= HidControllerButtons.KEY_X;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonY]) CurrentButton |= HidControllerButtons.KEY_Y;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonPlus]) CurrentButton |= HidControllerButtons.KEY_PLUS;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonR]) CurrentButton |= HidControllerButtons.KEY_R;
|
|
|
|
if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Controller Input
|
|
|
|
if (Config.GamePadEnable)
|
|
|
|
{
|
|
|
|
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
|
|
|
//LeftButtons
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.StickButton)) CurrentButton |= HidControllerButtons.KEY_LSTICK;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.ButtonMinus)) CurrentButton |= HidControllerButtons.KEY_MINUS;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.ButtonL)) CurrentButton |= HidControllerButtons.KEY_L;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Left.ButtonZL)) CurrentButton |= HidControllerButtons.KEY_ZL;
|
|
|
|
|
|
|
|
//RightButtons
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonA)) CurrentButton |= HidControllerButtons.KEY_A;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonB)) CurrentButton |= HidControllerButtons.KEY_B;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonX)) CurrentButton |= HidControllerButtons.KEY_X;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonY)) CurrentButton |= HidControllerButtons.KEY_Y;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.StickButton)) CurrentButton |= HidControllerButtons.KEY_RSTICK;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonPlus)) CurrentButton |= HidControllerButtons.KEY_PLUS;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonR)) CurrentButton |= HidControllerButtons.KEY_R;
|
|
|
|
if (IsGamePadButtonPressedFromString(GamePad, Config.JoyConController.Right.ButtonZR)) CurrentButton |= HidControllerButtons.KEY_ZR;
|
|
|
|
|
|
|
|
//LeftJoystick
|
|
|
|
if (GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).X >= AnalogStickDeadzone
|
|
|
|
|| GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).X <= -AnalogStickDeadzone)
|
|
|
|
LeftJoystickDX = (int)(GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).X * short.MaxValue);
|
|
|
|
|
|
|
|
if (GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).Y >= AnalogStickDeadzone
|
|
|
|
|| GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).Y <= -AnalogStickDeadzone)
|
|
|
|
LeftJoystickDY = (int)(GetJoystickAxisFromString(GamePad, Config.JoyConController.Left.Stick).Y * short.MaxValue);
|
|
|
|
|
|
|
|
//RightJoystick
|
|
|
|
if (GetJoystickAxisFromString(GamePad, Config.JoyConController.Right.Stick).X >= AnalogStickDeadzone
|
|
|
|
|| GetJoystickAxisFromString(GamePad, Config.JoyConController.Right.Stick).X <= -AnalogStickDeadzone)
|
|
|
|
RightJoystickDX = (int)(GetJoystickAxisFromString(GamePad, Config.JoyConController.Right.Stick).X * short.MaxValue);
|
|
|
|
|
|
|
|
if (GetJoystickAxisFromString(GamePad, Config.JoyConController.Right.Stick).Y >= AnalogStickDeadzone
|
|
|
|
|| GetJoystickAxisFromString(GamePad, Config.JoyConController.Right.Stick).Y <= -AnalogStickDeadzone)
|
|
|
|
RightJoystickDY = (int)(GetJoystickAxisFromString(GamePad, Config.JoyConController.Right.Stick).Y * short.MaxValue);
|
2018-06-21 21:10:19 +00:00
|
|
|
}
|
2018-03-03 01:49:17 +00:00
|
|
|
|
|
|
|
LeftJoystick = new HidJoystickPosition
|
2018-02-04 23:08:20 +00:00
|
|
|
{
|
2018-02-17 23:54:19 +00:00
|
|
|
DX = LeftJoystickDX,
|
|
|
|
DY = LeftJoystickDY
|
|
|
|
};
|
2018-02-04 23:08:20 +00:00
|
|
|
|
2018-03-03 01:49:17 +00:00
|
|
|
RightJoystick = new HidJoystickPosition
|
2018-02-04 23:08:20 +00:00
|
|
|
{
|
2018-02-17 23:54:19 +00:00
|
|
|
DX = RightJoystickDX,
|
|
|
|
DY = RightJoystickDY
|
|
|
|
};
|
|
|
|
|
2018-03-03 01:49:17 +00:00
|
|
|
bool HasTouch = false;
|
|
|
|
|
2018-02-22 13:28:27 +00:00
|
|
|
//Get screen touch position from left mouse click
|
2018-03-03 01:49:17 +00:00
|
|
|
//OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
2018-06-21 21:10:19 +00:00
|
|
|
if (Focused && Mouse?.LeftButton == ButtonState.Pressed)
|
2018-03-03 01:49:17 +00:00
|
|
|
{
|
2018-06-21 21:10:19 +00:00
|
|
|
MouseState Mouse = this.Mouse.Value;
|
|
|
|
|
2018-03-03 01:49:17 +00:00
|
|
|
int ScrnWidth = Width;
|
|
|
|
int ScrnHeight = Height;
|
|
|
|
|
|
|
|
if (Width > Height * TouchScreenRatioX)
|
2018-02-22 13:28:27 +00:00
|
|
|
{
|
2018-03-03 01:49:17 +00:00
|
|
|
ScrnWidth = (int)(Height * TouchScreenRatioX);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScrnHeight = (int)(Width * TouchScreenRatioY);
|
|
|
|
}
|
|
|
|
|
|
|
|
int StartX = (Width - ScrnWidth) >> 1;
|
|
|
|
int StartY = (Height - ScrnHeight) >> 1;
|
|
|
|
|
|
|
|
int EndX = StartX + ScrnWidth;
|
|
|
|
int EndY = StartY + ScrnHeight;
|
|
|
|
|
|
|
|
if (Mouse.X >= StartX &&
|
|
|
|
Mouse.Y >= StartY &&
|
|
|
|
Mouse.X < EndX &&
|
|
|
|
Mouse.Y < EndY)
|
|
|
|
{
|
|
|
|
int ScrnMouseX = Mouse.X - StartX;
|
|
|
|
int ScrnMouseY = Mouse.Y - StartY;
|
|
|
|
|
|
|
|
int MX = (int)(((float)ScrnMouseX / ScrnWidth) * TouchScreenWidth);
|
|
|
|
int MY = (int)(((float)ScrnMouseY / ScrnHeight) * TouchScreenHeight);
|
|
|
|
|
|
|
|
HidTouchPoint CurrentPoint = new HidTouchPoint
|
2018-02-22 13:28:27 +00:00
|
|
|
{
|
2018-03-03 01:49:17 +00:00
|
|
|
X = MX,
|
|
|
|
Y = MY,
|
2018-02-22 13:28:27 +00:00
|
|
|
|
|
|
|
//Placeholder values till more data is acquired
|
|
|
|
DiameterX = 10,
|
|
|
|
DiameterY = 10,
|
2018-03-03 01:49:17 +00:00
|
|
|
Angle = 90
|
2018-02-22 13:28:27 +00:00
|
|
|
};
|
2018-03-03 01:49:17 +00:00
|
|
|
|
|
|
|
HasTouch = true;
|
|
|
|
|
|
|
|
Ns.Hid.SetTouchPoints(CurrentPoint);
|
2018-02-22 13:28:27 +00:00
|
|
|
}
|
2018-03-03 01:49:17 +00:00
|
|
|
}
|
2018-02-22 13:28:27 +00:00
|
|
|
|
2018-03-03 01:49:17 +00:00
|
|
|
if (!HasTouch)
|
|
|
|
{
|
|
|
|
Ns.Hid.SetTouchPoints();
|
|
|
|
}
|
|
|
|
|
2018-04-13 20:39:45 +00:00
|
|
|
Ns.Hid.SetJoyconButton(
|
|
|
|
HidControllerId.CONTROLLER_HANDHELD,
|
|
|
|
HidControllerLayouts.Handheld_Joined,
|
|
|
|
CurrentButton,
|
|
|
|
LeftJoystick,
|
|
|
|
RightJoystick);
|
|
|
|
|
2018-03-03 01:49:17 +00:00
|
|
|
Ns.Hid.SetJoyconButton(
|
|
|
|
HidControllerId.CONTROLLER_HANDHELD,
|
|
|
|
HidControllerLayouts.Main,
|
|
|
|
CurrentButton,
|
|
|
|
LeftJoystick,
|
|
|
|
RightJoystick);
|
2018-02-04 23:08:20 +00:00
|
|
|
}
|
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
private new void RenderFrame()
|
2018-02-04 23:08:20 +00:00
|
|
|
{
|
2018-06-24 00:39:25 +00:00
|
|
|
Renderer.FrameBuffer.Render();
|
2018-03-06 20:18:49 +00:00
|
|
|
|
2018-06-24 00:39:25 +00:00
|
|
|
Ns.Statistics.RecordSystemFrameTime();
|
2018-02-09 00:43:22 +00:00
|
|
|
|
2018-06-24 00:39:25 +00:00
|
|
|
double HostFps = Ns.Statistics.GetSystemFrameRate();
|
|
|
|
double GameFps = Ns.Statistics.GetGameFrameRate();
|
2018-02-04 23:08:20 +00:00
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
|
|
|
|
|
|
|
|
TitleEvent = true;
|
2018-03-06 20:18:49 +00:00
|
|
|
|
2018-06-24 00:39:25 +00:00
|
|
|
SwapBuffers();
|
2018-03-19 18:58:46 +00:00
|
|
|
|
|
|
|
Ns.Os.SignalVsync();
|
2018-02-04 23:08:20 +00:00
|
|
|
}
|
|
|
|
|
2018-07-12 17:03:52 +00:00
|
|
|
protected override void OnUnload(EventArgs e)
|
|
|
|
{
|
|
|
|
RenderThread.Join();
|
|
|
|
|
|
|
|
base.OnUnload(e);
|
|
|
|
}
|
|
|
|
|
2018-02-20 10:52:35 +00:00
|
|
|
protected override void OnResize(EventArgs e)
|
|
|
|
{
|
2018-07-12 17:03:52 +00:00
|
|
|
ResizeEvent = true;
|
2018-02-04 23:08:20 +00:00
|
|
|
}
|
2018-06-21 21:10:19 +00:00
|
|
|
|
|
|
|
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
|
|
|
{
|
|
|
|
Keyboard = e.Keyboard;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnKeyUp(KeyboardKeyEventArgs e)
|
|
|
|
{
|
|
|
|
Keyboard = e.Keyboard;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnMouseDown(MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
Mouse = e.Mouse;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnMouseUp(MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
Mouse = e.Mouse;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnMouseMove(MouseMoveEventArgs e)
|
|
|
|
{
|
|
|
|
Mouse = e.Mouse;
|
|
|
|
}
|
2018-02-04 23:08:20 +00:00
|
|
|
}
|
|
|
|
}
|