Archived
1
0
Fork 0
forked from Mirror/Ryujinx
This repository has been archived on 2024-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
jinx/Ryujinx.HLE/HOS/Kernel/KAutoObject.cs

42 lines
997 B
C#
Raw Normal View History

namespace Ryujinx.HLE.HOS.Kernel
{
class KAutoObject
{
protected Horizon System;
public KAutoObject(Horizon System)
{
this.System = System;
}
public virtual KernelResult SetName(string Name)
{
if (!System.AutoObjectNames.TryAdd(Name, this))
{
return KernelResult.InvalidState;
}
return KernelResult.Success;
}
public static KernelResult RemoveName(Horizon System, string Name)
{
if (!System.AutoObjectNames.TryRemove(Name, out _))
{
return KernelResult.NotFound;
}
return KernelResult.Success;
}
public static KAutoObject FindNamedObject(Horizon System, string Name)
{
if (System.AutoObjectNames.TryGetValue(Name, out KAutoObject Obj))
{
return Obj;
}
return null;
}
}
}