From c6847808a833978d34b8d88b722bdb88414b7e5b Mon Sep 17 00:00:00 2001 From: jakcron Date: Mon, 10 Sep 2018 16:52:47 +0800 Subject: [PATCH] [hac] Add IdConverter. --- lib/libhac/include/nn/hac/IdConverter.h | 21 +++++++++++++++++++++ lib/libhac/libhac.vcxproj | 2 ++ lib/libhac/libhac.vcxproj.filters | 6 ++++++ lib/libhac/source/IdConverter.cpp | 16 ++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 lib/libhac/include/nn/hac/IdConverter.h create mode 100644 lib/libhac/source/IdConverter.cpp diff --git a/lib/libhac/include/nn/hac/IdConverter.h b/lib/libhac/include/nn/hac/IdConverter.h new file mode 100644 index 0000000..40702ea --- /dev/null +++ b/lib/libhac/include/nn/hac/IdConverter.h @@ -0,0 +1,21 @@ +#pragma once +#include + +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; + }; +} +} \ No newline at end of file diff --git a/lib/libhac/libhac.vcxproj b/lib/libhac/libhac.vcxproj index 3ff63ae..067835b 100644 --- a/lib/libhac/libhac.vcxproj +++ b/lib/libhac/libhac.vcxproj @@ -39,6 +39,7 @@ + @@ -90,6 +91,7 @@ + diff --git a/lib/libhac/libhac.vcxproj.filters b/lib/libhac/libhac.vcxproj.filters index 3c44384..de979d9 100644 --- a/lib/libhac/libhac.vcxproj.filters +++ b/lib/libhac/libhac.vcxproj.filters @@ -183,6 +183,9 @@ Header Files + + Header Files + @@ -296,5 +299,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/lib/libhac/source/IdConverter.cpp b/lib/libhac/source/IdConverter.cpp new file mode 100644 index 0000000..5455263 --- /dev/null +++ b/lib/libhac/source/IdConverter.cpp @@ -0,0 +1,16 @@ +#include + +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; +} \ No newline at end of file