From 8dcffe6a5103920ab63e46f93029b27e311335f3 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 4 Mar 2018 00:06:44 -0300 Subject: [PATCH] Fix hid touch screen timestamp, add more log info --- Ryujinx.Core/Hid/Hid.cs | 14 ++++++++++++-- Ryujinx.Core/OsHle/Process.cs | 14 +++++++++++++- Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs | 1 - Ryujinx.Core/OsHle/Services/Hid/ServiceHid.cs | 6 ++++++ Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs | 4 +++- Ryujinx/Ui/GLScreen.cs | 4 ++-- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Ryujinx.Core/Hid/Hid.cs b/Ryujinx.Core/Hid/Hid.cs index 4dbac40cb..c76782cff 100644 --- a/Ryujinx.Core/Hid/Hid.cs +++ b/Ryujinx.Core/Hid/Hid.cs @@ -164,6 +164,8 @@ namespace Ryujinx.Core.Input public void SetTouchPoints(params HidTouchPoint[] Points) { + Logging.Debug("hid touch"); + long LastEntry = ReadInt64(HidTouchScreenOffset + 0x10); long CurrEntry = (LastEntry + 1) % HidEntryCount; @@ -178,9 +180,13 @@ namespace Ryujinx.Core.Input long TouchEntryOffset = HidTouchScreenOffset + HidTouchHeaderSize; - TouchEntryOffset += CurrEntry * HidTouchEntrySize; + long LastEntryOffset = TouchEntryOffset + LastEntry * HidTouchEntrySize; - WriteInt64(TouchEntryOffset + 0x0, Timestamp); + long LastTimestamp = ReadInt64(LastEntryOffset); + + TouchEntryOffset += CurrEntry * HidTouchEntrySize; + + WriteInt64(TouchEntryOffset + 0x0, LastTimestamp + 1); WriteInt64(TouchEntryOffset + 0x8, Points.Length); TouchEntryOffset += HidTouchEntryHeaderSize; @@ -220,6 +226,8 @@ namespace Ryujinx.Core.Input if ((ulong)Position + 4 > AMemoryMgr.AddrSize) return; + Logging.Debug($"hid wr32 {Position:x8} {Value:x8}"); + *((int*)((byte*)Ns.Ram + Position)) = Value; } @@ -229,6 +237,8 @@ namespace Ryujinx.Core.Input if ((ulong)Position + 8 > AMemoryMgr.AddrSize) return; + Logging.Debug($"hid wr64 {Position:x8} {Value:x16}"); + *((long*)((byte*)Ns.Ram + Position)) = Value; } } diff --git a/Ryujinx.Core/OsHle/Process.cs b/Ryujinx.Core/OsHle/Process.cs index 84a21a8c1..f549b0279 100644 --- a/Ryujinx.Core/OsHle/Process.cs +++ b/Ryujinx.Core/OsHle/Process.cs @@ -239,7 +239,19 @@ namespace Ryujinx.Core.OsHle private void CpuTraceHandler(object sender, ACpuTraceEventArgs e) { - Logging.Trace($"Executing at 0x{e.Position:x16} {e.SubName}"); + string NsoName = string.Empty; + + for (int Index = Executables.Count - 1; Index >= 0; Index--) + { + if (e.Position >= Executables[Index].ImageBase) + { + NsoName = $"{(e.Position - Executables[Index].ImageBase):x16}"; + + break; + } + } + + Logging.Trace($"Executing at 0x{e.Position:x16} {e.SubName} {NsoName}"); } public void EnableCpuTracing() diff --git a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs index 3593bafbb..569a7dd6b 100644 --- a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs +++ b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs @@ -1,4 +1,3 @@ -using ChocolArm64.Memory; using Ryujinx.Core.OsHle.Ipc; using System; using System.Collections.Generic; diff --git a/Ryujinx.Core/OsHle/Services/Hid/ServiceHid.cs b/Ryujinx.Core/OsHle/Services/Hid/ServiceHid.cs index b0e5f44e2..cc30a771e 100644 --- a/Ryujinx.Core/OsHle/Services/Hid/ServiceHid.cs +++ b/Ryujinx.Core/OsHle/Services/Hid/ServiceHid.cs @@ -26,6 +26,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Hid { 121, GetNpadJoyHoldType }, { 200, GetVibrationDeviceInfo }, { 203, CreateActiveVibrationDeviceList }, + { 206, SendVibrationValues } }; } @@ -104,5 +105,10 @@ namespace Ryujinx.Core.OsHle.IpcServices.Hid return 0; } + + public long SendVibrationValues(ServiceCtx Context) + { + return 0; + } } } \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs b/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs index 1de0ab706..2f2238914 100644 --- a/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs +++ b/Ryujinx.Core/OsHle/Services/Nv/ServiceNvDrv.cs @@ -532,6 +532,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.NvServices Context.Memory.WriteInt32(Position + 4, Handle); + Logging.Info($"NvMap {Id} created with size {Size:x8}!"); + return 0; } @@ -580,7 +582,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.NvServices NvMap.Kind = Kind; } - Logging.Debug($"NvMapIocAlloc at {NvMap.Address:x16}"); + Logging.Debug($"{NvMap.Address:x16}"); return 0; } diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index be49d1fc9..1e48b2805 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -44,7 +44,7 @@ namespace Ryujinx HidJoystickPosition LeftJoystick; HidJoystickPosition RightJoystick; - if (Keyboard[OpenTK.Input.Key.Escape]) this.Exit(); + if (Keyboard[Key.Escape]) this.Exit(); int LeftJoystickDX = 0; int LeftJoystickDY = 0; @@ -99,7 +99,7 @@ namespace Ryujinx //Get screen touch position from left mouse click //OpenTK always captures mouse events, even if out of focus, so check if window is focused. - if (Focused && Mouse?.GetState().LeftButton == OpenTK.Input.ButtonState.Pressed) + if (Focused && Mouse?.GetState().LeftButton == ButtonState.Pressed) { int ScrnWidth = Width; int ScrnHeight = Height;