[hac] Add IdConverter.

This commit is contained in:
jakcron 2018-09-10 16:52:47 +08:00
parent b6a451442e
commit c6847808a8
4 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#pragma once
#include <fnd/types.h>
namespace nn
{
namespace hac
{
class IdConverter
{
public:
static uint64_t convertToAocBaseId(uint64_t application_id);
static uint64_t convertToDeltaId(uint64_t application_id);
static uint64_t convertToPatchId(uint64_t application_id);
private:
static const uint64_t kAocBaseId = 0x1000;
static const uint64_t kDeltaId = 0xc00;
static const uint64_t kPatchId = 0x800;
};
}
}

View file

@ -39,6 +39,7 @@
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h" />
<ClInclude Include="include\nn\hac\hierarchicalsha256.h" />
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h" />
<ClInclude Include="include\nn\hac\IdConverter.h" />
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h" />
<ClInclude Include="include\nn\hac\InteruptEntry.h" />
<ClInclude Include="include\nn\hac\InteruptHandler.h" />
@ -90,6 +91,7 @@
<ClCompile Include="source\HandleTableSizeHandler.cpp" />
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp" />
<ClCompile Include="source\HierarchicalSha256Header.cpp" />
<ClCompile Include="source\IdConverter.cpp" />
<ClCompile Include="source\InteruptEntry.cpp" />
<ClCompile Include="source\InteruptHandler.cpp" />
<ClCompile Include="source\KernelCapabilityBinary.cpp" />

View file

@ -183,6 +183,9 @@
<ClInclude Include="include\nn\hac\XciUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\IdConverter.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\AccessControlInfoBinary.cpp">
@ -296,5 +299,8 @@
<ClCompile Include="source\XciUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\IdConverter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,16 @@
#include <nn/hac/IdConverter.h>
uint64_t nn::hac::IdConverter::convertToAocBaseId(uint64_t application_id)
{
return application_id + kAocBaseId;
}
uint64_t nn::hac::IdConverter::convertToDeltaId(uint64_t application_id)
{
return application_id + kDeltaId;
}
uint64_t nn::hac::IdConverter::convertToPatchId(uint64_t application_id)
{
return application_id + kPatchId;
}