nstool/lib/libhac/include/nn/hac/MiscFlagsEntry.h

50 lines
1.1 KiB
C
Raw Permalink Normal View History

#pragma once
#include <string>
#include <fnd/types.h>
2018-08-07 07:17:51 +00:00
#include <nn/hac/KernelCapabilityEntry.h>
2018-08-07 07:17:51 +00:00
namespace nn
{
namespace hac
{
class MiscFlagsEntry
{
public:
MiscFlagsEntry();
MiscFlagsEntry(const KernelCapabilityEntry& kernel_cap);
2018-03-22 05:26:22 +00:00
MiscFlagsEntry(uint32_t flags);
void operator=(const MiscFlagsEntry& other);
bool operator==(const MiscFlagsEntry& other) const;
bool operator!=(const MiscFlagsEntry& other) const;
// kernel capability
const KernelCapabilityEntry& getKernelCapability() const;
void setKernelCapability(const KernelCapabilityEntry& kernel_cap);
// variables
2018-03-22 05:26:22 +00:00
uint32_t getFlags() const;
void setFlags(uint32_t flags);
private:
const std::string kModuleName = "MISC_FLAG_ENTRY";
static const kc::KernelCapId kCapId = kc::KC_MISC_FLAGS;
2018-03-22 05:26:22 +00:00
static const uint32_t kValueBits = 15;
static const uint32_t kMaxVal = BIT(kValueBits)-1;
KernelCapabilityEntry mCap;
2018-03-22 05:26:22 +00:00
uint32_t mFlags;
inline void updateCapField()
{
2018-03-22 05:26:22 +00:00
uint32_t field = mFlags & kMaxVal;
mCap.setField(field);
}
inline void processCapField()
{
2018-03-22 05:26:22 +00:00
uint32_t field = mCap.getField();
mFlags = field & kMaxVal;
}
};
}
2018-08-07 07:17:51 +00:00
}