diff --git a/trunk/ConsoleDataMigration/common/VersionDetect.cpp b/trunk/ConsoleDataMigration/common/VersionDetect.cpp index e29271e..f028569 100644 --- a/trunk/ConsoleDataMigration/common/VersionDetect.cpp +++ b/trunk/ConsoleDataMigration/common/VersionDetect.cpp @@ -19,11 +19,12 @@ #include "VersionDetect.h" #include "HeapManager.h" +#include "CommonLogger.h" namespace common { -void GetCupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) +void GetCupVersion(nn::pl::CTR::CardUpdateVersion* cup, nn::cfg::CTR::CfgRegionCode region) { nn::Result result; const size_t BUF_SIZE = 1024; @@ -32,10 +33,12 @@ void GetCupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) { result = nn::fs::MountContent("cver:", nn::fs::MEDIA_TYPE_NAND, common::cCupVerId[region], 0, 1, 1, buf, BUF_SIZE); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); nn::fs::FileInputStream fis; result = fis.TryInitialize(L"cver:/version.bin"); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); if (result.IsSuccess()) { s64 fileSize = fis.GetSize(); @@ -46,11 +49,12 @@ void GetCupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) if (addr != NULL) { result = fis.TryRead(&ret, addr, fileSize); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); if (result.IsSuccess()) { nn::pl::CTR::CardUpdateVersion* ver_buf = reinterpret_cast (addr); - std::memcpy(&mVerData->cup, ver_buf, sizeof(nn::pl::CTR::CardUpdateVersion)); + std::memcpy(cup, ver_buf, sizeof(nn::pl::CTR::CardUpdateVersion)); } common::HeapManager::GetHeap()->Free(addr); } @@ -62,7 +66,7 @@ void GetCupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) } -void GetNupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) +void GetNupVersion(nn::pl::CTR::NetworkUpdateVersion* nup, nn::cfg::CTR::CfgRegionCode region) { nn::Result result; const size_t BUF_SIZE = 1024; @@ -70,12 +74,14 @@ void GetNupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) // NUPバージョン { - result = nn::fs::MountContent("nver:", nn::fs::MEDIA_TYPE_NAND, common::cCupVerId[region], 0, 1, 1, buf, + result = nn::fs::MountContent("nver:", nn::fs::MEDIA_TYPE_NAND, common::cNupVerId[region], 0, 1, 1, buf, BUF_SIZE); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); nn::fs::FileInputStream fis; result = fis.TryInitialize(L"nver:/version.bin"); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); if (result.IsSuccess()) { s64 fileSize = fis.GetSize(); @@ -86,12 +92,13 @@ void GetNupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) if (addr != NULL) { result = fis.TryRead(&ret, addr, fileSize); + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); if (result.IsSuccess()) { nn::pl::CTR::NetworkUpdateVersion* ver_buf = reinterpret_cast (addr); - std::memcpy(&mVerData->cup, ver_buf, sizeof(nn::pl::CTR::NetworkUpdateVersion)); + std::memcpy(nup, ver_buf, sizeof(nn::pl::CTR::NetworkUpdateVersion)); } common::HeapManager::GetHeap()->Free(addr); } @@ -105,8 +112,8 @@ void GetNupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) void GetSystemVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region) { - GetNupVersion(mVerData, region); - GetCupVersion(mVerData, region); + GetCupVersion(&mVerData->cup, region); + GetNupVersion(&mVerData->nup, region); } }