nstool/lib/libhac/source/MiscFlagsEntry.cpp

69 lines
1.4 KiB
C++
Raw Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/MiscFlagsEntry.h>
2018-08-07 07:17:51 +00:00
nn::hac::MiscFlagsEntry::MiscFlagsEntry() :
mCap(kCapId),
mFlags(0)
{}
2018-08-07 07:17:51 +00:00
nn::hac::MiscFlagsEntry::MiscFlagsEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId),
mFlags(0)
{
setKernelCapability(kernel_cap);
}
2018-08-07 07:17:51 +00:00
nn::hac::MiscFlagsEntry::MiscFlagsEntry(uint32_t flags) :
mCap(kCapId),
mFlags(0)
{
setFlags(flags);
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscFlagsEntry::operator=(const MiscFlagsEntry& other)
{
mFlags = other.mFlags;
updateCapField();
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscFlagsEntry::operator==(const MiscFlagsEntry& other) const
{
return (mFlags == other.mFlags);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscFlagsEntry::operator!=(const MiscFlagsEntry& other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
const nn::hac::KernelCapabilityEntry & nn::hac::MiscFlagsEntry::getKernelCapability() const
{
return mCap;
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscFlagsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{
if (kernel_cap.getType() != kCapId)
{
throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'MiscFlags'");
}
mCap = kernel_cap;
processCapField();
}
2018-08-07 07:17:51 +00:00
uint32_t nn::hac::MiscFlagsEntry::getFlags() const
{
return mFlags;
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscFlagsEntry::setFlags(uint32_t flags)
{
if ((flags & ~kMaxVal) != 0)
{
throw fnd::Exception(kModuleName, "Illegal MiscFlag bits set. (settable bits: 0-14 inclusive)");
}
mFlags = flags;
updateCapField();
}