From 0769bb83c656f807fe240b0431b43c5774187630 Mon Sep 17 00:00:00 2001 From: N2614 Date: Thu, 3 Mar 2011 00:23:54 +0000 Subject: [PATCH] =?UTF-8?q?NUP=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=82=92=E6=AD=A3=E3=81=97=E3=81=8F=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@99 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../common/VersionDetect.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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); } }