nstool/lib/libhac/source/MiscParamsEntry.cpp

69 lines
1.4 KiB
C++
Raw Permalink Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/MiscParamsEntry.h>
2018-08-07 07:17:51 +00:00
nn::hac::MiscParamsEntry::MiscParamsEntry() :
mCap(kCapId),
mProgramType(0)
{}
2018-08-07 07:17:51 +00:00
nn::hac::MiscParamsEntry::MiscParamsEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId),
mProgramType(0)
{
setKernelCapability(kernel_cap);
}
2018-08-07 07:17:51 +00:00
nn::hac::MiscParamsEntry::MiscParamsEntry(uint8_t program_type) :
mCap(kCapId),
mProgramType(0)
{
setProgramType(program_type);
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsEntry::operator=(const MiscParamsEntry& other)
{
mProgramType = other.mProgramType;
updateCapField();
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscParamsEntry::operator==(const MiscParamsEntry& other) const
{
return (mProgramType == other.mProgramType);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscParamsEntry::operator!=(const MiscParamsEntry& other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
const nn::hac::KernelCapabilityEntry & nn::hac::MiscParamsEntry::getKernelCapability() const
{
return mCap;
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{
if (kernel_cap.getType() != kCapId)
{
throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'ThreadInfo'");
}
mCap = kernel_cap;
processCapField();
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::MiscParamsEntry::getProgramType() const
{
return mProgramType;
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsEntry::setProgramType(uint8_t type)
{
if (type > kMaxProgramType)
{
throw fnd::Exception(kModuleName, "Illegal ProgramType. (range: 0-7 inclusive)");
}
mProgramType = type;
updateCapField();
}