From 735ace17494e2cd80e6819b81be0c6db1b443f0d Mon Sep 17 00:00:00 2001 From: jakcron Date: Mon, 5 Nov 2018 14:58:10 +0800 Subject: [PATCH] [libhac] Misc. --- lib/libhac/source/KernelCapabilityControl.cpp | 4 ++-- lib/libhac/source/KernelInitialProcessHeader.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libhac/source/KernelCapabilityControl.cpp b/lib/libhac/source/KernelCapabilityControl.cpp index b3f198f..f20ef55 100644 --- a/lib/libhac/source/KernelCapabilityControl.cpp +++ b/lib/libhac/source/KernelCapabilityControl.cpp @@ -84,12 +84,12 @@ void nn::hac::KernelCapabilityControl::fromBytes(const byte_t * data, size_t len fnd::List handleTableSizeCaps; fnd::List 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) : diff --git a/lib/libhac/source/KernelInitialProcessHeader.cpp b/lib/libhac/source/KernelInitialProcessHeader.cpp index 81c23c9..aa504e2 100644 --- a/lib/libhac/source/KernelInitialProcessHeader.cpp +++ b/lib/libhac/source/KernelInitialProcessHeader.cpp @@ -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++)