2020-11-17 21:40:19 +00:00
|
|
|
|
using ARMeilleure.Translation;
|
|
|
|
|
using ARMeilleure.Translation.PTC;
|
2020-05-03 02:00:53 +00:00
|
|
|
|
using Gdk;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
|
|
|
|
using OpenTK.Input;
|
|
|
|
|
using Ryujinx.Configuration;
|
2020-08-02 14:41:24 +00:00
|
|
|
|
using Ryujinx.Common.Configuration;
|
2020-05-03 02:00:53 +00:00
|
|
|
|
using Ryujinx.Common.Configuration.Hid;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
using Ryujinx.Graphics.OpenGL;
|
|
|
|
|
using Ryujinx.HLE;
|
2020-04-03 00:10:02 +00:00
|
|
|
|
using Ryujinx.HLE.HOS.Services.Hid;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
2020-09-29 21:32:42 +00:00
|
|
|
|
using Ryujinx.Motion;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Ui
|
|
|
|
|
{
|
2020-05-03 02:00:53 +00:00
|
|
|
|
public class GlRenderer : GLWidget
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 20:18:35 +00:00
|
|
|
|
static GlRenderer()
|
|
|
|
|
{
|
|
|
|
|
OpenTK.Graphics.GraphicsContext.ShareContexts = true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
private const int SwitchPanelWidth = 1280;
|
2020-02-18 11:34:57 +00:00
|
|
|
|
private const int SwitchPanelHeight = 720;
|
2020-05-03 02:00:53 +00:00
|
|
|
|
private const int TargetFps = 60;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
public ManualResetEvent WaitEvent { get; set; }
|
|
|
|
|
|
2020-03-07 02:40:06 +00:00
|
|
|
|
public static event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
private bool _isActive;
|
|
|
|
|
private bool _isStopped;
|
|
|
|
|
private bool _isFocused;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
private double _mouseX;
|
|
|
|
|
private double _mouseY;
|
2020-05-03 02:00:53 +00:00
|
|
|
|
private bool _mousePressed;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
private bool _toggleFullscreen;
|
2020-11-18 23:15:44 +00:00
|
|
|
|
private bool _toggleDockedMode;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
private readonly long _ticksPerFrame;
|
|
|
|
|
|
|
|
|
|
private long _ticks = 0;
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
private readonly System.Diagnostics.Stopwatch _chrono;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
private readonly Switch _device;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
private Renderer _renderer;
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
private HotkeyButtons _prevHotkeyButtons;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-09-29 21:32:42 +00:00
|
|
|
|
private Client _dsuClient;
|
|
|
|
|
|
2020-08-02 14:41:24 +00:00
|
|
|
|
private GraphicsDebugLevel _glLogLevel;
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
private readonly ManualResetEvent _exitEvent;
|
|
|
|
|
|
2020-08-02 14:41:24 +00:00
|
|
|
|
public GlRenderer(Switch device, GraphicsDebugLevel glLogLevel)
|
2020-03-14 21:36:56 +00:00
|
|
|
|
: base (GetGraphicsMode(),
|
2020-02-18 11:34:57 +00:00
|
|
|
|
3, 3,
|
2020-12-01 23:23:43 +00:00
|
|
|
|
glLogLevel == GraphicsDebugLevel.None
|
|
|
|
|
? GraphicsContextFlags.ForwardCompatible
|
2020-08-02 14:41:24 +00:00
|
|
|
|
: GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
WaitEvent = new ManualResetEvent(false);
|
|
|
|
|
|
|
|
|
|
_device = device;
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
this.Initialized += GLRenderer_Initialized;
|
|
|
|
|
this.Destroyed += GLRenderer_Destroyed;
|
2020-02-13 17:43:29 +00:00
|
|
|
|
this.ShuttingDown += GLRenderer_ShuttingDown;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
Initialize();
|
|
|
|
|
|
|
|
|
|
_chrono = new System.Diagnostics.Stopwatch();
|
|
|
|
|
|
|
|
|
|
_ticksPerFrame = System.Diagnostics.Stopwatch.Frequency / TargetFps;
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
AddEvents((int)(EventMask.ButtonPressMask
|
|
|
|
|
| EventMask.ButtonReleaseMask
|
|
|
|
|
| EventMask.PointerMotionMask
|
|
|
|
|
| EventMask.KeyPressMask
|
|
|
|
|
| EventMask.KeyReleaseMask));
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
this.Shown += Renderer_Shown;
|
2020-08-02 14:41:24 +00:00
|
|
|
|
|
2020-09-29 21:32:42 +00:00
|
|
|
|
_dsuClient = new Client();
|
|
|
|
|
|
2020-08-02 14:41:24 +00:00
|
|
|
|
_glLogLevel = glLogLevel;
|
2020-12-01 23:23:43 +00:00
|
|
|
|
|
|
|
|
|
_exitEvent = new ManualResetEvent(false);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-14 21:36:56 +00:00
|
|
|
|
private static GraphicsMode GetGraphicsMode()
|
|
|
|
|
{
|
2020-05-03 02:00:53 +00:00
|
|
|
|
return Environment.OSVersion.Platform == PlatformID.Unix ? new GraphicsMode(new ColorFormat(24)) : new GraphicsMode(new ColorFormat());
|
2020-03-14 21:36:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-13 17:43:29 +00:00
|
|
|
|
private void GLRenderer_ShuttingDown(object sender, EventArgs args)
|
|
|
|
|
{
|
2020-02-14 10:52:34 +00:00
|
|
|
|
_device.DisposeGpu();
|
2020-09-29 21:32:42 +00:00
|
|
|
|
_dsuClient?.Dispose();
|
2020-02-13 17:43:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-12 00:56:19 +00:00
|
|
|
|
private void Parent_FocusOutEvent(object o, Gtk.FocusOutEventArgs args)
|
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
_isFocused = false;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Parent_FocusInEvent(object o, Gtk.FocusInEventArgs args)
|
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
_isFocused = true;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GLRenderer_Destroyed(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-09-29 21:32:42 +00:00
|
|
|
|
_dsuClient?.Dispose();
|
2020-02-13 17:43:29 +00:00
|
|
|
|
Dispose();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Renderer_Shown(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
_isFocused = this.ParentWindow.State.HasFlag(Gdk.WindowState.Focused);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void HandleScreenState(KeyboardState keyboard)
|
|
|
|
|
{
|
2020-05-03 02:00:53 +00:00
|
|
|
|
bool toggleFullscreen = keyboard.IsKeyDown(OpenTK.Input.Key.F11)
|
2020-02-18 11:34:57 +00:00
|
|
|
|
|| ((keyboard.IsKeyDown(OpenTK.Input.Key.AltLeft)
|
|
|
|
|
|| keyboard.IsKeyDown(OpenTK.Input.Key.AltRight))
|
2020-02-13 17:43:29 +00:00
|
|
|
|
&& keyboard.IsKeyDown(OpenTK.Input.Key.Enter))
|
2020-05-03 02:00:53 +00:00
|
|
|
|
|| keyboard.IsKeyDown(OpenTK.Input.Key.Escape);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-02-13 17:43:29 +00:00
|
|
|
|
bool fullScreenToggled = ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-02-13 17:43:29 +00:00
|
|
|
|
if (toggleFullscreen != _toggleFullscreen)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-13 17:43:29 +00:00
|
|
|
|
if (toggleFullscreen)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-13 17:43:29 +00:00
|
|
|
|
if (fullScreenToggled)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-13 17:43:29 +00:00
|
|
|
|
ParentWindow.Unfullscreen();
|
|
|
|
|
(Toplevel as MainWindow)?.ToggleExtraWidgets(true);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
2020-02-13 17:43:29 +00:00
|
|
|
|
else
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-13 17:43:29 +00:00
|
|
|
|
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape))
|
|
|
|
|
{
|
2020-10-09 23:22:25 +00:00
|
|
|
|
if (GtkDialog.CreateExitDialog())
|
2020-03-29 12:47:37 +00:00
|
|
|
|
{
|
|
|
|
|
Exit();
|
|
|
|
|
}
|
2020-02-13 17:43:29 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ParentWindow.Fullscreen();
|
|
|
|
|
(Toplevel as MainWindow)?.ToggleExtraWidgets(false);
|
|
|
|
|
}
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-13 17:43:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_toggleFullscreen = toggleFullscreen;
|
2020-11-18 23:15:44 +00:00
|
|
|
|
|
|
|
|
|
bool toggleDockedMode = keyboard.IsKeyDown(OpenTK.Input.Key.F9);
|
|
|
|
|
|
|
|
|
|
if (toggleDockedMode != _toggleDockedMode)
|
|
|
|
|
{
|
|
|
|
|
if (toggleDockedMode)
|
|
|
|
|
{
|
|
|
|
|
ConfigurationState.Instance.System.EnableDockedMode.Value =
|
|
|
|
|
!ConfigurationState.Instance.System.EnableDockedMode.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_toggleDockedMode = toggleDockedMode;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GLRenderer_Initialized(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-02-14 10:52:34 +00:00
|
|
|
|
// Release the GL exclusivity that OpenTK gave us as we aren't going to use it in GTK Thread.
|
2020-02-12 00:56:19 +00:00
|
|
|
|
GraphicsContext.MakeCurrent(null);
|
|
|
|
|
|
|
|
|
|
WaitEvent.Set();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnConfigureEvent(EventConfigure evnt)
|
|
|
|
|
{
|
2020-05-03 02:00:53 +00:00
|
|
|
|
bool result = base.OnConfigureEvent(evnt);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-02-18 11:34:57 +00:00
|
|
|
|
Gdk.Monitor monitor = Display.GetMonitorAtWindow(Window);
|
|
|
|
|
|
|
|
|
|
_renderer.Window.SetSize(evnt.Width * monitor.ScaleFactor, evnt.Height * monitor.ScaleFactor);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
IsRenderHandler = true;
|
|
|
|
|
|
|
|
|
|
_chrono.Restart();
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
_isActive = true;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
Gtk.Window parent = this.Toplevel as Gtk.Window;
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
parent.FocusInEvent += Parent_FocusInEvent;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
parent.FocusOutEvent += Parent_FocusOutEvent;
|
|
|
|
|
|
|
|
|
|
Gtk.Application.Invoke(delegate
|
|
|
|
|
{
|
|
|
|
|
parent.Present();
|
2020-11-17 21:40:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string titleNameSection = string.IsNullOrWhiteSpace(_device.Application.TitleName) ? string.Empty
|
|
|
|
|
: $" - {_device.Application.TitleName}";
|
|
|
|
|
|
|
|
|
|
string titleVersionSection = string.IsNullOrWhiteSpace(_device.Application.DisplayVersion) ? string.Empty
|
|
|
|
|
: $" v{_device.Application.DisplayVersion}";
|
|
|
|
|
|
|
|
|
|
string titleIdSection = string.IsNullOrWhiteSpace(_device.Application.TitleIdText) ? string.Empty
|
|
|
|
|
: $" ({_device.Application.TitleIdText.ToUpper()})";
|
|
|
|
|
|
|
|
|
|
string titleArchSection = _device.Application.TitleIs64Bit ? " (64-bit)" : " (32-bit)";
|
|
|
|
|
|
|
|
|
|
parent.Title = $"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
|
2020-02-12 00:56:19 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Thread renderLoopThread = new Thread(Render)
|
|
|
|
|
{
|
|
|
|
|
Name = "GUI.RenderLoop"
|
|
|
|
|
};
|
|
|
|
|
renderLoopThread.Start();
|
|
|
|
|
|
|
|
|
|
MainLoop();
|
|
|
|
|
|
|
|
|
|
renderLoopThread.Join();
|
|
|
|
|
|
|
|
|
|
Exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnButtonPressEvent(EventButton evnt)
|
|
|
|
|
{
|
|
|
|
|
_mouseX = evnt.X;
|
|
|
|
|
_mouseY = evnt.Y;
|
|
|
|
|
|
|
|
|
|
if (evnt.Button == 1)
|
|
|
|
|
{
|
|
|
|
|
_mousePressed = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnButtonReleaseEvent(EventButton evnt)
|
|
|
|
|
{
|
|
|
|
|
if (evnt.Button == 1)
|
|
|
|
|
{
|
|
|
|
|
_mousePressed = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnMotionNotifyEvent(EventMotion evnt)
|
|
|
|
|
{
|
|
|
|
|
if (evnt.Device.InputSource == InputSource.Mouse)
|
|
|
|
|
{
|
|
|
|
|
_mouseX = evnt.X;
|
|
|
|
|
_mouseY = evnt.Y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-18 11:34:57 +00:00
|
|
|
|
protected override void OnGetPreferredHeight(out int minimumHeight, out int naturalHeight)
|
|
|
|
|
{
|
|
|
|
|
Gdk.Monitor monitor = Display.GetMonitorAtWindow(Window);
|
|
|
|
|
|
|
|
|
|
// If the monitor is at least 1080p, use the Switch panel size as minimal size.
|
|
|
|
|
if (monitor.Geometry.Height >= 1080)
|
|
|
|
|
{
|
|
|
|
|
minimumHeight = SwitchPanelHeight;
|
|
|
|
|
}
|
|
|
|
|
// Otherwise, we default minimal size to 480p 16:9.
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
minimumHeight = 480;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
naturalHeight = minimumHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnGetPreferredWidth(out int minimumWidth, out int naturalWidth)
|
|
|
|
|
{
|
|
|
|
|
Gdk.Monitor monitor = Display.GetMonitorAtWindow(Window);
|
|
|
|
|
|
|
|
|
|
// If the monitor is at least 1080p, use the Switch panel size as minimal size.
|
|
|
|
|
if (monitor.Geometry.Height >= 1080)
|
|
|
|
|
{
|
|
|
|
|
minimumWidth = SwitchPanelWidth;
|
|
|
|
|
}
|
|
|
|
|
// Otherwise, we default minimal size to 480p 16:9.
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
minimumWidth = 854;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
naturalWidth = minimumWidth;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-12 00:56:19 +00:00
|
|
|
|
public void Exit()
|
|
|
|
|
{
|
2020-09-29 21:32:42 +00:00
|
|
|
|
_dsuClient?.Dispose();
|
2020-12-01 23:23:43 +00:00
|
|
|
|
|
|
|
|
|
if (_isStopped)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
_isStopped = true;
|
|
|
|
|
_isActive = false;
|
|
|
|
|
|
|
|
|
|
_exitEvent.WaitOne();
|
|
|
|
|
_exitEvent.Dispose();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
|
|
|
|
if (!(_device.Gpu.Renderer is Renderer))
|
|
|
|
|
{
|
2020-11-12 23:15:34 +00:00
|
|
|
|
throw new NotSupportedException($"GPU renderer must be an OpenGL renderer when using {typeof(Renderer).Name}!");
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_renderer = (Renderer)_device.Gpu.Renderer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Render()
|
|
|
|
|
{
|
2020-02-14 10:52:34 +00:00
|
|
|
|
// First take exclusivity on the OpenGL context.
|
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 20:18:35 +00:00
|
|
|
|
_renderer.InitializeBackgroundContext(GraphicsContext);
|
|
|
|
|
Gtk.Window parent = Toplevel as Gtk.Window;
|
|
|
|
|
parent.Present();
|
2020-02-14 10:52:34 +00:00
|
|
|
|
GraphicsContext.MakeCurrent(WindowInfo);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-11-17 21:40:19 +00:00
|
|
|
|
_device.Gpu.Renderer.Initialize(_glLogLevel);
|
2020-02-14 10:52:34 +00:00
|
|
|
|
|
|
|
|
|
// Make sure the first frame is not transparent.
|
|
|
|
|
GL.ClearColor(OpenTK.Color.Black);
|
|
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
|
|
|
|
SwapBuffers();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-11-17 21:40:19 +00:00
|
|
|
|
_device.Gpu.InitializeShaderCache();
|
|
|
|
|
Translator.IsReadyForTranslation.Set();
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
while (_isActive)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if (_isStopped)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-14 10:52:34 +00:00
|
|
|
|
_ticks += _chrono.ElapsedTicks;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-02-14 10:52:34 +00:00
|
|
|
|
_chrono.Restart();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-02-14 10:52:34 +00:00
|
|
|
|
if (_device.WaitFifo())
|
|
|
|
|
{
|
2020-10-13 20:54:42 +00:00
|
|
|
|
_device.Statistics.RecordFifoStart();
|
2020-02-14 10:52:34 +00:00
|
|
|
|
_device.ProcessFrame();
|
2020-10-13 20:54:42 +00:00
|
|
|
|
_device.Statistics.RecordFifoEnd();
|
2020-02-14 10:52:34 +00:00
|
|
|
|
}
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-04 22:10:01 +00:00
|
|
|
|
string dockedMode = ConfigurationState.Instance.System.EnableDockedMode ? "Docked" : "Handheld";
|
2020-07-07 02:41:07 +00:00
|
|
|
|
float scale = Graphics.Gpu.GraphicsConfig.ResScale;
|
|
|
|
|
if (scale != 1)
|
|
|
|
|
{
|
|
|
|
|
dockedMode += $" ({scale}x)";
|
|
|
|
|
}
|
2020-05-04 22:10:01 +00:00
|
|
|
|
|
2020-02-14 10:52:34 +00:00
|
|
|
|
if (_ticks >= _ticksPerFrame)
|
|
|
|
|
{
|
|
|
|
|
_device.PresentFrame(SwapBuffers);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-03-07 02:40:06 +00:00
|
|
|
|
StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
|
2020-05-04 22:10:01 +00:00
|
|
|
|
_device.EnableDeviceVsync,
|
|
|
|
|
dockedMode,
|
2020-03-24 21:54:09 +00:00
|
|
|
|
$"Game: {_device.Statistics.GetGameFrameRate():00.00} FPS",
|
2020-10-13 20:54:42 +00:00
|
|
|
|
$"FIFO: {_device.Statistics.GetFifoPercent():0.00} %",
|
2020-05-03 02:00:53 +00:00
|
|
|
|
$"GPU: {_renderer.GpuVendor}"));
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-02-14 10:52:34 +00:00
|
|
|
|
_ticks = Math.Min(_ticks - _ticksPerFrame, _ticksPerFrame);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SwapBuffers()
|
|
|
|
|
{
|
|
|
|
|
OpenTK.Graphics.GraphicsContext.CurrentContext.SwapBuffers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void MainLoop()
|
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
while (_isActive)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-15 11:30:53 +00:00
|
|
|
|
UpdateFrame();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
// Polling becomes expensive if it's not slept
|
|
|
|
|
Thread.Sleep(1);
|
|
|
|
|
}
|
2020-12-01 23:23:43 +00:00
|
|
|
|
|
|
|
|
|
_exitEvent.Set();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool UpdateFrame()
|
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if (!_isActive)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if (_isStopped)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if (_isFocused)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-15 11:30:53 +00:00
|
|
|
|
Gtk.Application.Invoke(delegate
|
|
|
|
|
{
|
2020-06-16 18:28:02 +00:00
|
|
|
|
KeyboardState keyboard = OpenTK.Input.Keyboard.GetState();
|
|
|
|
|
|
|
|
|
|
HandleScreenState(keyboard);
|
|
|
|
|
|
|
|
|
|
if (keyboard.IsKeyDown(OpenTK.Input.Key.Delete))
|
|
|
|
|
{
|
|
|
|
|
if (!ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen))
|
|
|
|
|
{
|
|
|
|
|
Ptc.Continue();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-15 11:30:53 +00:00
|
|
|
|
});
|
2020-05-03 02:00:53 +00:00
|
|
|
|
}
|
2020-02-15 11:30:53 +00:00
|
|
|
|
|
2020-08-23 20:54:11 +00:00
|
|
|
|
List<GamepadInput> gamepadInputs = new List<GamepadInput>(NpadDevices.MaxControllers);
|
2020-09-29 21:32:42 +00:00
|
|
|
|
List<SixAxisInput> motionInputs = new List<SixAxisInput>(NpadDevices.MaxControllers);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-09-29 21:32:42 +00:00
|
|
|
|
MotionDevice motionDevice = new MotionDevice(_dsuClient);
|
2020-12-01 23:23:43 +00:00
|
|
|
|
|
2020-08-23 20:54:11 +00:00
|
|
|
|
foreach (InputConfig inputConfig in ConfigurationState.Instance.Hid.InputConfig.Value)
|
2020-05-03 02:00:53 +00:00
|
|
|
|
{
|
|
|
|
|
ControllerKeys currentButton = 0;
|
|
|
|
|
JoystickPosition leftJoystick = new JoystickPosition();
|
|
|
|
|
JoystickPosition rightJoystick = new JoystickPosition();
|
|
|
|
|
KeyboardInput? hidKeyboard = null;
|
|
|
|
|
|
|
|
|
|
int leftJoystickDx = 0;
|
|
|
|
|
int leftJoystickDy = 0;
|
|
|
|
|
int rightJoystickDx = 0;
|
|
|
|
|
int rightJoystickDy = 0;
|
|
|
|
|
|
2020-09-29 21:32:42 +00:00
|
|
|
|
if (inputConfig.EnableMotion)
|
|
|
|
|
{
|
|
|
|
|
motionDevice.RegisterController(inputConfig.PlayerIndex);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
if (inputConfig is KeyboardConfig keyboardConfig)
|
2020-02-15 11:30:53 +00:00
|
|
|
|
{
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if (_isFocused)
|
2020-05-03 02:00:53 +00:00
|
|
|
|
{
|
|
|
|
|
// Keyboard Input
|
|
|
|
|
KeyboardController keyboardController = new KeyboardController(keyboardConfig);
|
2020-02-15 11:30:53 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
currentButton = keyboardController.GetButtons();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
(leftJoystickDx, leftJoystickDy) = keyboardController.GetLeftStick();
|
|
|
|
|
(rightJoystickDx, rightJoystickDy) = keyboardController.GetRightStick();
|
|
|
|
|
|
|
|
|
|
leftJoystick = new JoystickPosition
|
|
|
|
|
{
|
|
|
|
|
Dx = leftJoystickDx,
|
|
|
|
|
Dy = leftJoystickDy
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rightJoystick = new JoystickPosition
|
|
|
|
|
{
|
|
|
|
|
Dx = rightJoystickDx,
|
|
|
|
|
Dy = rightJoystickDy
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (ConfigurationState.Instance.Hid.EnableKeyboard)
|
|
|
|
|
{
|
|
|
|
|
hidKeyboard = keyboardController.GetKeysDown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!hidKeyboard.HasValue)
|
|
|
|
|
{
|
|
|
|
|
hidKeyboard = new KeyboardInput
|
|
|
|
|
{
|
|
|
|
|
Modifier = 0,
|
|
|
|
|
Keys = new int[0x8]
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ConfigurationState.Instance.Hid.EnableKeyboard)
|
|
|
|
|
{
|
|
|
|
|
_device.Hid.Keyboard.Update(hidKeyboard.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (inputConfig is Common.Configuration.Hid.ControllerConfig controllerConfig)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-05-03 02:00:53 +00:00
|
|
|
|
// Controller Input
|
|
|
|
|
JoystickController joystickController = new JoystickController(controllerConfig);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
currentButton |= joystickController.GetButtons();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
(leftJoystickDx, leftJoystickDy) = joystickController.GetLeftStick();
|
|
|
|
|
(rightJoystickDx, rightJoystickDy) = joystickController.GetRightStick();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
leftJoystick = new JoystickPosition
|
|
|
|
|
{
|
|
|
|
|
Dx = controllerConfig.LeftJoycon.InvertStickX ? -leftJoystickDx : leftJoystickDx,
|
|
|
|
|
Dy = controllerConfig.LeftJoycon.InvertStickY ? -leftJoystickDy : leftJoystickDy
|
|
|
|
|
};
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
rightJoystick = new JoystickPosition
|
|
|
|
|
{
|
|
|
|
|
Dx = controllerConfig.RightJoycon.InvertStickX ? -rightJoystickDx : rightJoystickDx,
|
|
|
|
|
Dy = controllerConfig.RightJoycon.InvertStickY ? -rightJoystickDy : rightJoystickDy
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick);
|
|
|
|
|
|
2020-10-28 19:52:07 +00:00
|
|
|
|
motionDevice.Poll(inputConfig, inputConfig.Slot);
|
2020-09-29 21:32:42 +00:00
|
|
|
|
|
|
|
|
|
SixAxisInput sixAxisInput = new SixAxisInput()
|
|
|
|
|
{
|
|
|
|
|
PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex,
|
|
|
|
|
Accelerometer = motionDevice.Accelerometer,
|
|
|
|
|
Gyroscope = motionDevice.Gyroscope,
|
|
|
|
|
Rotation = motionDevice.Rotation,
|
|
|
|
|
Orientation = motionDevice.Orientation
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
motionInputs.Add(sixAxisInput);
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
gamepadInputs.Add(new GamepadInput
|
|
|
|
|
{
|
|
|
|
|
PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex,
|
|
|
|
|
Buttons = currentButton,
|
|
|
|
|
LStick = leftJoystick,
|
|
|
|
|
RStick = rightJoystick
|
|
|
|
|
});
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-09-29 21:32:42 +00:00
|
|
|
|
if (inputConfig.ControllerType == Common.Configuration.Hid.ControllerType.JoyconPair)
|
|
|
|
|
{
|
|
|
|
|
if (!inputConfig.MirrorInput)
|
|
|
|
|
{
|
2020-10-28 19:52:07 +00:00
|
|
|
|
motionDevice.Poll(inputConfig, inputConfig.AltSlot);
|
2020-09-29 21:32:42 +00:00
|
|
|
|
|
|
|
|
|
sixAxisInput = new SixAxisInput()
|
|
|
|
|
{
|
|
|
|
|
PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex,
|
|
|
|
|
Accelerometer = motionDevice.Accelerometer,
|
|
|
|
|
Gyroscope = motionDevice.Gyroscope,
|
|
|
|
|
Rotation = motionDevice.Rotation,
|
|
|
|
|
Orientation = motionDevice.Orientation
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
motionInputs.Add(sixAxisInput);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-01 23:23:43 +00:00
|
|
|
|
|
2020-08-23 20:54:11 +00:00
|
|
|
|
_device.Hid.Npads.Update(gamepadInputs);
|
2020-09-29 21:32:42 +00:00
|
|
|
|
_device.Hid.Npads.UpdateSixAxis(motionInputs);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if(_isFocused)
|
2020-06-26 10:30:16 +00:00
|
|
|
|
{
|
2020-08-23 20:54:11 +00:00
|
|
|
|
// Hotkeys
|
|
|
|
|
HotkeyButtons currentHotkeyButtons = KeyboardController.GetHotkeyButtons(OpenTK.Input.Keyboard.GetState());
|
|
|
|
|
|
|
|
|
|
if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) &&
|
|
|
|
|
!_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync))
|
|
|
|
|
{
|
|
|
|
|
_device.EnableDeviceVsync = !_device.EnableDeviceVsync;
|
|
|
|
|
}
|
2020-06-26 10:30:16 +00:00
|
|
|
|
|
2020-08-23 20:54:11 +00:00
|
|
|
|
_prevHotkeyButtons = currentHotkeyButtons;
|
|
|
|
|
}
|
2020-06-26 10:30:16 +00:00
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
//Touchscreen
|
2020-02-12 00:56:19 +00:00
|
|
|
|
bool hasTouch = false;
|
|
|
|
|
|
|
|
|
|
// Get screen touch position from left mouse click
|
|
|
|
|
// OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
2020-12-01 23:23:43 +00:00
|
|
|
|
if (_isFocused && _mousePressed)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-05-03 02:00:53 +00:00
|
|
|
|
int screenWidth = AllocatedWidth;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
int screenHeight = AllocatedHeight;
|
|
|
|
|
|
2020-02-18 11:34:57 +00:00
|
|
|
|
if (AllocatedWidth > (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight)
|
2020-02-12 00:56:19 +00:00
|
|
|
|
{
|
2020-02-18 11:34:57 +00:00
|
|
|
|
screenWidth = (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-02-18 11:34:57 +00:00
|
|
|
|
screenHeight = (AllocatedWidth * SwitchPanelHeight) / SwitchPanelWidth;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 02:00:53 +00:00
|
|
|
|
int startX = (AllocatedWidth - screenWidth) >> 1;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
int startY = (AllocatedHeight - screenHeight) >> 1;
|
|
|
|
|
|
|
|
|
|
int endX = startX + screenWidth;
|
|
|
|
|
int endY = startY + screenHeight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_mouseX >= startX &&
|
|
|
|
|
_mouseY >= startY &&
|
|
|
|
|
_mouseX < endX &&
|
|
|
|
|
_mouseY < endY)
|
|
|
|
|
{
|
|
|
|
|
int screenMouseX = (int)_mouseX - startX;
|
|
|
|
|
int screenMouseY = (int)_mouseY - startY;
|
|
|
|
|
|
2020-02-18 11:34:57 +00:00
|
|
|
|
int mX = (screenMouseX * SwitchPanelWidth) / screenWidth;
|
|
|
|
|
int mY = (screenMouseY * SwitchPanelHeight) / screenHeight;
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
TouchPoint currentPoint = new TouchPoint
|
|
|
|
|
{
|
2020-04-03 00:10:02 +00:00
|
|
|
|
X = (uint)mX,
|
|
|
|
|
Y = (uint)mY,
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
// Placeholder values till more data is acquired
|
|
|
|
|
DiameterX = 10,
|
|
|
|
|
DiameterY = 10,
|
2020-05-03 02:00:53 +00:00
|
|
|
|
Angle = 90
|
2020-02-12 00:56:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
hasTouch = true;
|
|
|
|
|
|
2020-04-03 00:10:02 +00:00
|
|
|
|
_device.Hid.Touchscreen.Update(currentPoint);
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!hasTouch)
|
|
|
|
|
{
|
2020-04-03 00:10:02 +00:00
|
|
|
|
_device.Hid.Touchscreen.Update();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-03 00:10:02 +00:00
|
|
|
|
_device.Hid.DebugPad.Update();
|
2020-02-12 00:56:19 +00:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|