NUPバージョンを正しく取得するように

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
This commit is contained in:
N2614 2011-03-03 00:23:54 +00:00
parent 02117009b8
commit 0769bb83c6

View File

@ -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<nn::pl::CTR::CardUpdateVersion*> (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<nn::pl::CTR::NetworkUpdateVersion*> (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);
}
}