[libhac] Misc.

This commit is contained in:
jakcron 2018-11-05 14:58:10 +08:00
parent 696cd481e3
commit 735ace1749
2 changed files with 6 additions and 5 deletions

View file

@ -84,12 +84,12 @@ void nn::hac::KernelCapabilityControl::fromBytes(const byte_t * data, size_t len
fnd::List<KernelCapabilityEntry> handleTableSizeCaps;
fnd::List<KernelCapabilityEntry> miscFlagsCaps;
const uint32_t* raw_caps = (const uint32_t*)mRawBinary.data();
const le_uint32_t* raw_caps = (const le_uint32_t*)mRawBinary.data();
size_t cap_num = mRawBinary.size() / sizeof(uint32_t);
KernelCapabilityEntry cap;
for (size_t i = 0; i < cap_num; i++)
{
cap.setCap(le_word(raw_caps[i]));
cap.setCap(raw_caps[i].get());
switch (cap.getType())
{
case (kc::KC_THREAD_INFO) :

View file

@ -74,11 +74,12 @@ void nn::hac::KernelInitialProcessHeader::toBytes()
throw fnd::Exception(kModuleName, "Too many kernel capabilities");
}
memcpy(hdr->capabilities, mKernelCapabilities.getBytes().data(), mKernelCapabilities.getBytes().size());
// stub remaining entries
if (mKernelCapabilities.getBytes().size() < kip::kKernCapabilitySize)
{
}
memset(hdr->capabilities + mKernelCapabilities.getBytes().size(), 0xff, kip::kKernCapabilitySize - mKernelCapabilities.getBytes().size());
memset(hdr->capabilities + mKernelCapabilities.getBytes().size(), 0xff, kip::kKernCapabilitySize - mKernelCapabilities.getBytes().size());
}
// flags
for (size_t i = 0; i < mFlagList.size(); i++)