From 27290b0227dd10c9840c34c4c55d6ac2b6b1a4e6 Mon Sep 17 00:00:00 2001 From: N2614 Date: Thu, 10 Feb 2011 10:27:07 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E8=A8=AD=E5=AE=9A=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=8C=E3=81=AA=E3=81=84=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AF=E3=83=AA=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=AB?= =?UTF-8?q?=E5=90=88=E3=82=8F=E3=81=9B=E3=81=9F=E3=83=87=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=88=E5=9B=BD=E3=81=A7=E5=8B=95=E4=BD=9C=E3=81=99?= =?UTF-8?q?=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@46 385bec56-5757-e545-9c3a-d8741f4650f1 --- .../ConsoleRestore/Importer.cpp | 84 +++++++++++++++---- .../common/FileChecker.cpp | 4 + .../ConsoleDataMigration/common/FileChecker.h | 5 +- 3 files changed, 78 insertions(+), 15 deletions(-) diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp index fc0647d..2b68dcb 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Importer.cpp @@ -45,6 +45,7 @@ #include "Aes_define.h" #include "configLoader.h" #include "PlayHistoryManager.h" +#include "FileChecker.h" #include #include @@ -323,26 +324,81 @@ void ImportCountryLanguageData() { nn::Result result; - size_t bufSize = common::HeapManager::GetHeap()->GetAllocatableSize(); - void* buf = common::HeapManager::GetHeap()->Allocate(bufSize); - if (buf != NULL) + if (common::ExistsCountryLanguageFile()) { - common::SdReaderWriter sdReader; - - size_t readSize; - result = sdReader.ReadBuf(common::COUNTRY_SETTING_PATHNAME, buf, bufSize, &readSize); - if(result.IsSuccess()) + size_t bufSize = common::HeapManager::GetHeap()->GetAllocatableSize(); + void* buf = common::HeapManager::GetHeap()->Allocate(bufSize); + if (buf != NULL) { - // SDから読み出し成功 - SetCountry(reinterpret_cast(buf)->country); + common::SdReaderWriter sdReader; - SetLanguage(reinterpret_cast(buf)->language); + size_t readSize; + result = sdReader.ReadBuf(common::COUNTRY_SETTING_PATHNAME, buf, bufSize, &readSize); + if (result.IsSuccess()) + { + // SDから読み出し成功 + SetCountry(reinterpret_cast (buf)->country); + + SetLanguage(reinterpret_cast (buf)->language); + } + else + { + COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); + } + common::HeapManager::GetHeap()->Free(buf); } - else + } + else + { + // リージョンから適当な国を指定する + nn::cfg::CTR::CfgRegionCode region; + region = nn::cfg::CTR::GetRegion(); + NN_LOG("Country Setting does not exist. Use Default Setting\n"); + switch(region) { - COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result); + case nn::cfg::CTR::CFG_REGION_JAPAN: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_JAPAN); + } + break; + + case nn::cfg::CTR::CFG_REGION_AMERICA: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_UNITED_STATES); + } + break; + + case nn::cfg::CTR::CFG_REGION_EUROPE: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_FRANCE); + } + break; + + case nn::cfg::CTR::CFG_REGION_AUSTRALIA: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_AUSTRALIA); + } + break; + + case nn::cfg::CTR::CFG_REGION_CHINA: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_CHINA); + } + break; + + case nn::cfg::CTR::CFG_REGION_KOREA: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_SOUTH_KOREA); + } + break; + + case nn::cfg::CTR::CFG_REGION_TAIWAN: + { + SetCountry(nn::cfg::CTR::CFG_COUNTRY_TAIWAN); + } + break; } - common::HeapManager::GetHeap()->Free(buf); + } } diff --git a/trunk/ConsoleDataMigration/common/FileChecker.cpp b/trunk/ConsoleDataMigration/common/FileChecker.cpp index 037df01..91b590f 100644 --- a/trunk/ConsoleDataMigration/common/FileChecker.cpp +++ b/trunk/ConsoleDataMigration/common/FileChecker.cpp @@ -100,6 +100,10 @@ bool ExistsRtcSyncFinishedFile() return ExistsFile(EXISTS_RTC_SYNC_FINISHED); } +bool ExistsCountryLanguageFile() +{ + return ExistsFile(EXISTS_COUNTRY_LANGUAGE); +} void InitializeFileCheck() { diff --git a/trunk/ConsoleDataMigration/common/FileChecker.h b/trunk/ConsoleDataMigration/common/FileChecker.h index 9c9928a..e0b4939 100644 --- a/trunk/ConsoleDataMigration/common/FileChecker.h +++ b/trunk/ConsoleDataMigration/common/FileChecker.h @@ -30,6 +30,7 @@ typedef enum FILE_EXISTS_CHECK EXISTS_WRITE_FINISHED, EXISTS_AP_SETTING, EXISTS_RTC_SYNC_FINISHED, + EXISTS_COUNTRY_LANGUAGE, EXISTS_MAX } FileExistsCheck; @@ -41,7 +42,8 @@ const wchar_t* const FILENAME_TABLE[EXISTS_MAX] = common::INITIALIZED_CHECK_PATHNAME, common::WRITE_FINISHED_CHECK_PATHNAME, common::AP_SETTING_PATHNAME, - common::RTC_SYNC_CHECK_PATHNAME + common::RTC_SYNC_CHECK_PATHNAME, + common::COUNTRY_SETTING_PATHNAME }; @@ -52,6 +54,7 @@ bool ExistsConsoleInitializedFile(); bool ExistsWriteFinishedFile(); bool ExistsAPSetting(); bool ExistsRtcSyncFinishedFile(); +bool ExistsCountryLanguageFile(); void InitializeFileCheck();