diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-05-11 23:05:06 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-05-11 23:05:06 -0300 |
| commit | 3603497a137d14f2d65c5450133f2486a9f9620c (patch) | |
| tree | 9c46a8238eec48cd7386f7bdeb3a662c26e61c5c | |
| parent | 0381a092274488277670b6b2b9033cefd2b33718 (diff) | |
Allow using self thread id on some svcs (fixes #117)
| -rw-r--r-- | Ryujinx.Core/OsHle/Kernel/SvcHandler.cs | 5 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Kernel/SvcThread.cs | 18 |
2 files changed, 12 insertions, 11 deletions
diff --git a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs index 1874360b..be394c4b 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs @@ -28,7 +28,8 @@ namespace Ryujinx.Core.OsHle.Kernel private ulong CurrentHeapSize; - private const uint SelfHandle = 0xffff8001; + private const uint SelfThreadHandle = 0xffff8000; + private const uint SelfProcessHandle = 0xffff8001; private static Random Rng; @@ -111,7 +112,7 @@ namespace Ryujinx.Core.OsHle.Kernel private KThread GetThread(long Tpidr, int Handle) { - if ((uint)Handle == SelfHandle) + if ((uint)Handle == SelfThreadHandle) { return Process.GetThread(Tpidr); } diff --git a/Ryujinx.Core/OsHle/Kernel/SvcThread.cs b/Ryujinx.Core/OsHle/Kernel/SvcThread.cs index 0d5f2f4f..ee45c02c 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcThread.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcThread.cs @@ -87,12 +87,12 @@ namespace Ryujinx.Core.OsHle.Kernel { int Handle = (int)ThreadState.X1; - KThread CurrThread = Process.HandleTable.GetData<KThread>(Handle); + KThread Thread = GetThread(ThreadState.Tpidr, Handle); - if (CurrThread != null) + if (Thread != null) { ThreadState.X0 = 0; - ThreadState.X1 = (ulong)CurrThread.ActualPriority; + ThreadState.X1 = (ulong)Thread.ActualPriority; } else { @@ -107,11 +107,11 @@ namespace Ryujinx.Core.OsHle.Kernel int Handle = (int)ThreadState.X0; int Priority = (int)ThreadState.X1; - KThread CurrThread = Process.HandleTable.GetData<KThread>(Handle); + KThread Thread = GetThread(ThreadState.Tpidr, Handle); - if (CurrThread != null) + if (Thread != null) { - CurrThread.SetPriority(Priority); + Thread.SetPriority(Priority); ThreadState.X0 = 0; } @@ -139,12 +139,12 @@ namespace Ryujinx.Core.OsHle.Kernel { int Handle = (int)ThreadState.X1; - KThread CurrThread = Process.HandleTable.GetData<KThread>(Handle); + KThread Thread = GetThread(ThreadState.Tpidr, Handle); - if (CurrThread != null) + if (Thread != null) { ThreadState.X0 = 0; - ThreadState.X1 = (ulong)CurrThread.ThreadId; + ThreadState.X1 = (ulong)Thread.ThreadId; } else { |
