2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/MiscParamsEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
nx::MiscParamsEntry::MiscParamsEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mProgramType(0)
|
|
|
|
{}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
nx::MiscParamsEntry::MiscParamsEntry(const KernelCapabilityEntry & kernel_cap) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mProgramType(0)
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
nx::MiscParamsEntry::MiscParamsEntry(uint8_t program_type) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mProgramType(0)
|
|
|
|
{
|
|
|
|
setProgramType(program_type);
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::MiscParamsEntry::operator=(const MiscParamsEntry& other)
|
|
|
|
{
|
|
|
|
mProgramType = other.mProgramType;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::MiscParamsEntry::operator==(const MiscParamsEntry& other) const
|
|
|
|
{
|
|
|
|
return (mProgramType == other.mProgramType);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::MiscParamsEntry::operator!=(const MiscParamsEntry& other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
const nx::KernelCapabilityEntry & nx::MiscParamsEntry::getKernelCapability() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
void nx::MiscParamsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
2018-06-29 04:24:39 +00:00
|
|
|
throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'ThreadInfo'");
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint8_t nx::MiscParamsEntry::getProgramType() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mProgramType;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::MiscParamsEntry::setProgramType(uint8_t type)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (type > kMaxProgramType)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal ProgramType. (range: 0-7 inclusive)");
|
|
|
|
}
|
|
|
|
|
|
|
|
mProgramType = type;
|
|
|
|
updateCapField();
|
|
|
|
}
|