nstool/lib/libhac/source/MiscParamsHandler.cpp

68 lines
1.4 KiB
C++
Raw Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/MiscParamsHandler.h>
2018-08-07 07:17:51 +00:00
nn::hac::MiscParamsHandler::MiscParamsHandler() :
mIsSet(false),
mEntry(0)
{}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsHandler::operator=(const MiscParamsHandler & other)
{
mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscParamsHandler::operator==(const MiscParamsHandler & other) const
{
return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscParamsHandler::operator!=(const MiscParamsHandler & other) const
{
return !(*this == other);
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{
if (caps.size() > kMaxKernelCapNum)
{
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
}
if (caps.size() == 0)
return;
mEntry.setKernelCapability(caps[0]);
mIsSet = true;
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{
if (isSet() == false)
return;
caps.addElement(mEntry.getKernelCapability());
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsHandler::clear()
{
mIsSet = false;
mEntry.setProgramType(0);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::MiscParamsHandler::isSet() const
{
return mIsSet;
}
2018-08-07 07:17:51 +00:00
uint8_t nn::hac::MiscParamsHandler::getProgramType() const
{
return mEntry.getProgramType();
}
2018-08-07 07:17:51 +00:00
void nn::hac::MiscParamsHandler::setProgramType(uint8_t type)
{
mEntry.setProgramType(type);
mIsSet = true;
}