mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-22 18:15:11 +00:00
Allow using self thread id on some svcs (fixes #117)
This commit is contained in:
parent
0381a09227
commit
3603497a13
2 changed files with 12 additions and 11 deletions
|
@ -28,7 +28,8 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
|
|
||||||
private ulong CurrentHeapSize;
|
private ulong CurrentHeapSize;
|
||||||
|
|
||||||
private const uint SelfHandle = 0xffff8001;
|
private const uint SelfThreadHandle = 0xffff8000;
|
||||||
|
private const uint SelfProcessHandle = 0xffff8001;
|
||||||
|
|
||||||
private static Random Rng;
|
private static Random Rng;
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
|
|
||||||
private KThread GetThread(long Tpidr, int Handle)
|
private KThread GetThread(long Tpidr, int Handle)
|
||||||
{
|
{
|
||||||
if ((uint)Handle == SelfHandle)
|
if ((uint)Handle == SelfThreadHandle)
|
||||||
{
|
{
|
||||||
return Process.GetThread(Tpidr);
|
return Process.GetThread(Tpidr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,12 +87,12 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
{
|
{
|
||||||
int Handle = (int)ThreadState.X1;
|
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.X0 = 0;
|
||||||
ThreadState.X1 = (ulong)CurrThread.ActualPriority;
|
ThreadState.X1 = (ulong)Thread.ActualPriority;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -107,11 +107,11 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
int Handle = (int)ThreadState.X0;
|
int Handle = (int)ThreadState.X0;
|
||||||
int Priority = (int)ThreadState.X1;
|
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;
|
ThreadState.X0 = 0;
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,12 @@ namespace Ryujinx.Core.OsHle.Kernel
|
||||||
{
|
{
|
||||||
int Handle = (int)ThreadState.X1;
|
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.X0 = 0;
|
||||||
ThreadState.X1 = (ulong)CurrThread.ThreadId;
|
ThreadState.X1 = (ulong)Thread.ThreadId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue