mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2025-01-05 11:58:00 +00:00
Add static assers to token generation
This commit is contained in:
parent
6d898acc98
commit
2949d08eb2
3 changed files with 5 additions and 3 deletions
|
@ -95,7 +95,7 @@ class KAutoObject {
|
||||||
SessionRequest,
|
SessionRequest,
|
||||||
CodeMemory, // JIT
|
CodeMemory, // JIT
|
||||||
|
|
||||||
FinalClassesMax = CodeMemory,
|
Max = CodeMemory + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -119,8 +119,10 @@ class KAutoObject {
|
||||||
if constexpr (std::is_same_v<T, KAutoObject>) {
|
if constexpr (std::is_same_v<T, KAutoObject>) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if constexpr (!std::is_final_v<T>) {
|
} else if constexpr (!std::is_final_v<T>) {
|
||||||
|
static_assert(T::typeId >= TypeId::SynchronizationObject && T::typeId < TypeId::FinalClassesMin, "Invalid type ID!");
|
||||||
return (1 << ((ushort)T::typeId - 1)) | GenerateClassToken<typename T::BaseClass>();
|
return (1 << ((ushort)T::typeId - 1)) | GenerateClassToken<typename T::BaseClass>();
|
||||||
} else {
|
} else {
|
||||||
|
static_assert(T::typeId >= TypeId::FinalClassesMin && T::typeId < TypeId::Max, "Invalid type ID!");
|
||||||
ushort off = (ushort)T::typeId - (ushort)TypeId::FinalClassesMin;
|
ushort off = (ushort)T::typeId - (ushort)TypeId::FinalClassesMin;
|
||||||
return ((ushort)detail::A038444(off) << 9) | 0x100u | GenerateClassToken<typename T::BaseClass>();
|
return ((ushort)detail::A038444(off) << 9) | 0x100u | GenerateClassToken<typename T::BaseClass>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class KResourceLimit;
|
||||||
namespace mesosphere
|
namespace mesosphere
|
||||||
{
|
{
|
||||||
|
|
||||||
class KProcess : public KAutoObject {
|
class KProcess final : public KAutoObject {
|
||||||
public:
|
public:
|
||||||
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Process);
|
MESOSPHERE_AUTO_OBJECT_TRAITS(AutoObject, Process);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue