mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-08 21:21:48 +00:00
Put handle in its own file & fix it
This commit is contained in:
parent
6166262b5c
commit
672204c993
5 changed files with 34 additions and 18 deletions
29
mesosphere/include/mesosphere/core/Handle.hpp
Normal file
29
mesosphere/include/mesosphere/core/Handle.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <mesosphere/core/types.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
class Handle final {
|
||||
public:
|
||||
constexpr bool IsAliasOrFree() const { return isAlias || id < 0; }
|
||||
|
||||
constexpr bool operator==(const Handle &other) const
|
||||
{
|
||||
return index == other.index && id == other.id && isAlias == other.isAlias;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const Handle &other) const { return !(*this == other); }
|
||||
|
||||
constexpr Handle() : index{0}, id{0}, isAlias{false} {}
|
||||
|
||||
private:
|
||||
friend class KHandleTable;
|
||||
constexpr Handle(u16 index, s16 id, bool isAlias = false) : index{index}, id{id}, isAlias{isAlias} {}
|
||||
u32 index : 15;
|
||||
s32 id : 16;
|
||||
u32 isAlias : 1;
|
||||
};
|
||||
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
namespace mesosphere
|
||||
{
|
||||
|
||||
class Result {
|
||||
class Result final {
|
||||
public:
|
||||
enum class Module : uint {
|
||||
None = 0,
|
||||
|
@ -59,8 +59,8 @@ class Result {
|
|||
NotDebugged = 520,
|
||||
};
|
||||
|
||||
Result() : module{(uint)Module::None}, description{(uint)Description::None} {}
|
||||
Result(Description description, Module module = Module::Kernel) : module{(uint)module}, description{(uint)description} {}
|
||||
constexpr Result() : module{(uint)Module::None}, description{(uint)Description::None} {}
|
||||
constexpr Result(Description description, Module module = Module::Kernel) : module{(uint)module}, description{(uint)description} {}
|
||||
|
||||
constexpr bool IsSuccess() const { return module == (uint)Module::None && description == (uint)Description::None; }
|
||||
constexpr bool operator==(const Result &other) const { return module == other.module && description == other.description; }
|
||||
|
|
|
@ -42,19 +42,4 @@ using vs64 = volatile int64_t;
|
|||
template <typename T>
|
||||
using SharedPtr = boost::intrusive_ptr<T>;
|
||||
|
||||
struct Handle {
|
||||
u16 index : 15;
|
||||
s16 id : 16;
|
||||
bool isAlias : 1;
|
||||
|
||||
constexpr bool IsAliasOrFree() const { return isAlias || id < 0; }
|
||||
|
||||
constexpr bool operator==(const Handle &other) const
|
||||
{
|
||||
return index == other.index && id == other.id && isAlias == other.isAlias;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const Handle &other) const { return !(*this == other); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <mesosphere/core/util.hpp>
|
||||
#include <mesosphere/core/Handle.hpp>
|
||||
#include <mesosphere/kresources/KAutoObject.hpp>
|
||||
#include <mesosphere/arch/KSpinLock.hpp>
|
||||
#include <array>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <atomic>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <mesosphere/core/util.hpp>
|
||||
#include <mesosphere/core/Handle.hpp>
|
||||
#include <mesosphere/core/Result.hpp>
|
||||
#include <mesosphere/processes/KProcess.hpp>
|
||||
#include <mesosphere/interfaces/IAlarmable.hpp>
|
||||
|
|
Loading…
Reference in a new issue