mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
ファームバージョンに変わりCUP、NUPバージョンを表示するように
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@26 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
46a0dea8a9
commit
c47f5a49d4
@ -30,6 +30,9 @@
|
||||
#include <nn/fs/fs_ApiSysSaveData.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiNor.h>
|
||||
#include <nn/os/os_SharedInfo.h>
|
||||
#include <nn/pl/CTR/pl_Version.h>
|
||||
#include <nn/fs/fs_ApiSharedExtSaveData.h>
|
||||
|
||||
#include "demo.h"
|
||||
|
||||
#include <vector>
|
||||
@ -45,6 +48,8 @@
|
||||
#include "SDMountManager.h"
|
||||
#include "HeapManager.h"
|
||||
#include "PlayHistoryManager.h"
|
||||
#include "common_Types.h"
|
||||
#include "VersionDetect.h"
|
||||
|
||||
// svnリビジョン埋め込み用
|
||||
#include "version.h"
|
||||
@ -205,6 +210,7 @@ extern "C" void nnMain(void)
|
||||
{
|
||||
s_CanReadIvs = true;
|
||||
}
|
||||
common::HeapManager::GetHeap()->Free(addr);
|
||||
}
|
||||
}
|
||||
fis.Finalize();
|
||||
@ -249,9 +255,14 @@ extern "C" void nnMain(void)
|
||||
// ReadOnlySharedInfoの取得
|
||||
const nn::os::ReadOnlySharedInfo& rosi = nn::os::GetReadOnlySharedInfo();
|
||||
|
||||
// バージョンの取得
|
||||
common::VerDef mVerData;
|
||||
common::GetSystemVersion(&mVerData, region);
|
||||
|
||||
// 情報出力
|
||||
COMMON_LOGGER("CTR Console Backup %s Rev.%s\n", __DATE__, BACKUP_VERSION_NUM);
|
||||
COMMON_LOGGER("System Ver. %d.%d (Rev.%d)\n", rosi.versionHi, rosi.versionLo, rosi.revision);
|
||||
COMMON_LOGGER("System Ver. %d.%d.%d-%d\n", mVerData.cup.majorVersion, mVerData.cup.minorVersion, mVerData.cup.microVersion,
|
||||
mVerData.nup.majorVersion);
|
||||
COMMON_LOGGER("System Region %s\n", nn::cfg::CTR::GetRegionCodeA3(region));
|
||||
COMMON_LOGGER("Serial Number %s\n", s_SerialNo);
|
||||
COMMON_LOGGER("Device ID %X\n", deviceId);
|
||||
@ -340,6 +351,7 @@ extern "C" void nnMain(void)
|
||||
flip,
|
||||
adapterState,
|
||||
BACKUP_VERSION_NUM,
|
||||
&mVerData,
|
||||
batteryRemain,
|
||||
deviceId,
|
||||
friendCode,
|
||||
|
||||
@ -41,6 +41,7 @@ SOURCES[] =
|
||||
../common/CommonLogger.cpp
|
||||
../common/SdMountManager.cpp
|
||||
../common/PlayHistoryManager.cpp
|
||||
../common/VersionDetect.cpp
|
||||
|
||||
CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
#include "CommonLogger.h"
|
||||
#include "SDMountManager.h"
|
||||
#include "HeapManager.h"
|
||||
#include "VersionDetect.h"
|
||||
|
||||
// svnリビジョン埋め込み用
|
||||
#include "version.h"
|
||||
@ -266,10 +267,14 @@ extern "C" void nnMain(void)
|
||||
// ReadOnlySharedInfoの取得
|
||||
const nn::os::ReadOnlySharedInfo& rosi = nn::os::GetReadOnlySharedInfo();
|
||||
|
||||
// バージョンの取得
|
||||
common::VerDef mVerData;
|
||||
common::GetSystemVersion(&mVerData, region);
|
||||
|
||||
// 情報出力
|
||||
COMMON_LOGGER("CTR Console Restore %s Rev.%s\n", __DATE__, RESTORE_VERSION_NUM);
|
||||
COMMON_LOGGER("System Ver. %d.%d (Rev.%d)\n", rosi.versionHi, rosi.versionLo, rosi.revision);
|
||||
COMMON_LOGGER("System Ver. %d.%d.%d-%d\n", mVerData.cup.majorVersion, mVerData.cup.minorVersion, mVerData.cup.microVersion,
|
||||
mVerData.nup.majorVersion);
|
||||
COMMON_LOGGER("System Region %s\n", nn::cfg::CTR::GetRegionCodeA3(region));
|
||||
COMMON_LOGGER("Serial Number %s\n", s_SerialNo);
|
||||
COMMON_LOGGER("Device ID %X\n", deviceId);
|
||||
@ -358,6 +363,7 @@ extern "C" void nnMain(void)
|
||||
flip,
|
||||
adapterState,
|
||||
RESTORE_VERSION_NUM,
|
||||
&mVerData,
|
||||
batteryRemain,
|
||||
deviceId,
|
||||
friendCode,
|
||||
|
||||
@ -44,6 +44,7 @@ SOURCES[] =
|
||||
../common/SdMountManager.cpp
|
||||
../common/configLoader.cpp
|
||||
../common/PlayHistoryManager.cpp
|
||||
../common/VersionDetect.cpp
|
||||
|
||||
CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ void DrawSystemState
|
||||
bool flip,
|
||||
std::string& adapterState,
|
||||
const char* toolVersion,
|
||||
common::VerDef* mVerData,
|
||||
u8 batteryRemain,
|
||||
bit32 deviceId,
|
||||
u64 friendCode,
|
||||
@ -88,9 +89,8 @@ void DrawSystemState
|
||||
fontSize += 2;
|
||||
spaceSize = fontSize + 2;
|
||||
renderSystem.SetFontSize(fontSize);
|
||||
|
||||
renderSystem.DrawText(0, line++ * spaceSize, "System Ver. %d.%d (Rev.%d)", rosi.versionHi, rosi.versionLo,
|
||||
rosi.revision);
|
||||
renderSystem.DrawText(0, line++ * spaceSize, "System Ver. %d.%d.%d-%d", mVerData->cup.majorVersion, mVerData->cup.minorVersion, mVerData->cup.microVersion,
|
||||
mVerData->nup.majorVersion);
|
||||
renderSystem.DrawText(0, line++ * spaceSize, "System Region %s", nn::cfg::CTR::GetRegionCodeA3(region));
|
||||
renderSystem.DrawText(0, line++ * spaceSize, "Serial No. %s", s_SerialNo);
|
||||
renderSystem.DrawText(0, line++ * spaceSize, "Device ID %X", deviceId);
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common_Types.h"
|
||||
|
||||
// 描画色の定義
|
||||
#define WHITE_COLOR 1.f, 1.f, 1.f, 1.f
|
||||
#define GRAY_COLOR 0.5, 0.5, 0.5, 1.f
|
||||
@ -50,6 +52,7 @@ void DrawSystemState
|
||||
bool flip,
|
||||
std::string& adapterState,
|
||||
const char* toolVersion,
|
||||
common::VerDef* mVerData,
|
||||
u8 batteryRemain,
|
||||
bit32 deviceId,
|
||||
u64 friendCode,
|
||||
|
||||
113
trunk/ConsoleDataMigration/common/VersionDetect.cpp
Normal file
113
trunk/ConsoleDataMigration/common/VersionDetect.cpp
Normal file
@ -0,0 +1,113 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: VersionDetect.cpp
|
||||
|
||||
Copyright 2009 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/fs.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
||||
|
||||
#include "VersionDetect.h"
|
||||
#include "HeapManager.h"
|
||||
|
||||
namespace common
|
||||
{
|
||||
|
||||
void GetCupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region)
|
||||
{
|
||||
nn::Result result;
|
||||
const size_t BUF_SIZE = 1024;
|
||||
u8 buf[BUF_SIZE];
|
||||
// CUPバージョン
|
||||
{
|
||||
result = nn::fs::MountContent("cver:", nn::fs::MEDIA_TYPE_NAND, common::cCupVerId[region], 0, 1, 1, buf,
|
||||
BUF_SIZE);
|
||||
|
||||
nn::fs::FileInputStream fis;
|
||||
|
||||
result = fis.TryInitialize(L"cver:/version.bin");
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
s64 fileSize = fis.GetSize();
|
||||
NN_LOG("version.bin size = %lld\n", fileSize);
|
||||
s32 ret;
|
||||
void* addr = NULL;
|
||||
addr = common::HeapManager::GetHeap()->Allocate(fileSize);
|
||||
if (addr != NULL)
|
||||
{
|
||||
result = fis.TryRead(&ret, addr, fileSize);
|
||||
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));
|
||||
}
|
||||
common::HeapManager::GetHeap()->Free(addr);
|
||||
}
|
||||
}
|
||||
fis.Finalize();
|
||||
|
||||
nn::fs::Unmount("cver:");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GetNupVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region)
|
||||
{
|
||||
nn::Result result;
|
||||
const size_t BUF_SIZE = 1024;
|
||||
u8 buf[BUF_SIZE];
|
||||
|
||||
// NUPバージョン
|
||||
{
|
||||
result = nn::fs::MountContent("nver:", nn::fs::MEDIA_TYPE_NAND, common::cCupVerId[region], 0, 1, 1, buf,
|
||||
BUF_SIZE);
|
||||
|
||||
nn::fs::FileInputStream fis;
|
||||
|
||||
result = fis.TryInitialize(L"nver:/version.bin");
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
s64 fileSize = fis.GetSize();
|
||||
NN_LOG("version.bin size = %lld\n", fileSize);
|
||||
s32 ret;
|
||||
void* addr = NULL;
|
||||
addr = common::HeapManager::GetHeap()->Allocate(fileSize);
|
||||
if (addr != NULL)
|
||||
{
|
||||
result = fis.TryRead(&ret, addr, fileSize);
|
||||
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));
|
||||
}
|
||||
common::HeapManager::GetHeap()->Free(addr);
|
||||
}
|
||||
}
|
||||
|
||||
fis.Finalize();
|
||||
nn::fs::Unmount("nver:");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GetSystemVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region)
|
||||
{
|
||||
GetNupVersion(mVerData, region);
|
||||
GetCupVersion(mVerData, region);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
30
trunk/ConsoleDataMigration/common/VersionDetect.h
Normal file
30
trunk/ConsoleDataMigration/common/VersionDetect.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: VersionDetect.h
|
||||
|
||||
Copyright 2009 Nintendo. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef VERSIONDETECT_H_
|
||||
#define VERSIONDETECT_H_
|
||||
|
||||
#include <nn/cfg/CTR/cfg_RegionCode.h>
|
||||
#include "common_Types.h"
|
||||
|
||||
namespace common
|
||||
{
|
||||
|
||||
void GetSystemVersion(common::VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* VERSIONDETECT_H_ */
|
||||
@ -19,6 +19,8 @@
|
||||
#include <nn/cfg/CTR/cfg_NtrSettings.h>
|
||||
#include <nn/cfg/CTR/cfg_CountryCode.h>
|
||||
#include <nn/cfg/CTR/cfg_LanguageCode.h>
|
||||
#include <nn/pl/CTR/pl_SharedDataTitleId.h>
|
||||
#include <nn/pl/CTR/pl_Version.h>
|
||||
|
||||
namespace common
|
||||
{
|
||||
@ -42,6 +44,25 @@ struct CfgCountryLanguage
|
||||
NN_PADDING1;
|
||||
};
|
||||
|
||||
struct VerDef
|
||||
{
|
||||
nn::pl::CTR::CardUpdateVersion cup;
|
||||
nn::pl::CTR::NetworkUpdateVersion nup;
|
||||
};
|
||||
|
||||
const nn::ProgramId cCupVerId[] =
|
||||
{
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_JP,
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_US,
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_EU,
|
||||
};
|
||||
|
||||
const nn::ProgramId cNupVerId[] =
|
||||
{
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_JP,
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_US,
|
||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_EU,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user