mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
NNASとECIから国コードを取得できるように
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@843 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
344cd574a6
commit
1d7e693f9f
@ -41,6 +41,7 @@ nn::os::Event ActCompleter::s_EndEvent;
|
||||
u32 ActCompleter::s_ApprovalId;
|
||||
ActCompleter::CompleteMode ActCompleter::s_Mode;
|
||||
ActCompleter::SalvageCheck ActCompleter::s_SalvageCheck;
|
||||
nn::cfg::CTR::CfgCountryCode ActCompleter::s_CfgCountryCode;
|
||||
|
||||
|
||||
ActCompleter::ActCompleter()
|
||||
@ -70,6 +71,11 @@ void ActCompleter::Start(CompleteMode mode, SalvageCheck check)
|
||||
s_Thread.Start(Exec, s_ThreadStack);
|
||||
}
|
||||
|
||||
nn::cfg::CTR::CfgCountryCode ActCompleter::GetCountryCodeFromNna()
|
||||
{
|
||||
return s_CfgCountryCode;
|
||||
}
|
||||
|
||||
bool ActCompleter::IsFinished()
|
||||
{
|
||||
return s_Thread.IsValid() && !s_Thread.IsAlive();
|
||||
@ -149,10 +155,9 @@ nn::Result ActCompleter::ExecImpl()
|
||||
// COPPA判定とPIN判定の準備
|
||||
nn::cfg::CfgRegionCode region = nn::cfg::GetRegion();
|
||||
u8 age = nn::act::GetAgeAtSalvage();
|
||||
nn::cfg::CfgCountryCode country;
|
||||
|
||||
NN_UTIL_RETURN_IF_FAILED_2(
|
||||
nn::act::GetCountryCodeAtSalvage(reinterpret_cast<u32*>(&country)),
|
||||
nn::act::GetCountryCodeAtSalvage(reinterpret_cast<u32*>(&s_CfgCountryCode)),
|
||||
nn::act::FinalizeAdmin(),
|
||||
common::FinalizeNetwork());
|
||||
|
||||
@ -161,7 +166,7 @@ nn::Result ActCompleter::ExecImpl()
|
||||
if (region == nn::cfg::CFG_REGION_AMERICA)
|
||||
{
|
||||
|
||||
if (ageChecker.IsCoppaRequired(age, region, country))
|
||||
if (ageChecker.IsCoppaRequired(age, region, s_CfgCountryCode))
|
||||
{
|
||||
// COPPA対象の年齢なら復元する
|
||||
s_ApprovalId = nn::act::GetSalvagedApprovalId();
|
||||
@ -173,7 +178,7 @@ nn::Result ActCompleter::ExecImpl()
|
||||
}
|
||||
|
||||
// PIN必須ならフラグを立てる
|
||||
if (ageChecker.IsPinRestrictionRequired(age, region, country))
|
||||
if (ageChecker.IsPinRestrictionRequired(age, region, s_CfgCountryCode))
|
||||
{
|
||||
NN_UTIL_RETURN_IF_FAILED_2(
|
||||
nn::cfg::CTR::system::SetForceParentalControlFlag(true),
|
||||
|
||||
@ -40,6 +40,7 @@ public:
|
||||
static nn::Result GetResult();
|
||||
static void Start(CompleteMode mode, SalvageCheck check);
|
||||
static bool IsFinished();
|
||||
static nn::cfg::CTR::CfgCountryCode GetCountryCodeFromNna();
|
||||
static void Finish();
|
||||
|
||||
private:
|
||||
@ -59,6 +60,7 @@ private:
|
||||
static u32 s_ApprovalId;
|
||||
static CompleteMode s_Mode;
|
||||
static SalvageCheck s_SalvageCheck;
|
||||
static nn::cfg::CfgCountryCode s_CfgCountryCode;
|
||||
};
|
||||
|
||||
} /* namespace ConsoleRestore */
|
||||
|
||||
@ -60,6 +60,7 @@ nn::os::StackBuffer<SHOP_OPERATION_THREAD_STACK_SIZE> s_ShopOperationThreadSt
|
||||
const size_t EC_BUFFER_SIZE = 128 * 1024;
|
||||
u8 s_EcBufffer[EC_BUFFER_SIZE];
|
||||
bool s_IsNimShopInitialized = false;
|
||||
nn::cfg::CTR::CfgCountryCode s_CfgCountryCode = nn::cfg::CTR::CFG_COUNTRY_UNDEFINED;
|
||||
|
||||
struct ShopThreadParam
|
||||
{
|
||||
@ -245,6 +246,12 @@ nn::Result ShopOperationConnect(ECAccountInfo** pAccountInfo)
|
||||
|
||||
PrintECAccountInfo(**pAccountInfo);
|
||||
COMMON_LOGGER_DETAIL("\n");
|
||||
// 国コードを保持
|
||||
if((*pAccountInfo)->country)
|
||||
{
|
||||
COMMON_LOGGER_RETURN_RESULT_IF_FAILED(
|
||||
nn::cfg::ConvertIso3166a2ToCountryCode(&s_CfgCountryCode, (*pAccountInfo)->country));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -500,4 +507,8 @@ nn::Result GetShopOperationSingleResult()
|
||||
return s_ShopResult;
|
||||
}
|
||||
|
||||
nn::cfg::CTR::CfgCountryCode GetCountryCodeFromEci()
|
||||
{
|
||||
return s_CfgCountryCode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,11 @@ bool IsShopOperationSingleFinished();
|
||||
// ショップ操作のResultを取得する
|
||||
nn::Result GetShopOperationSingleResult();
|
||||
|
||||
// ECIから国コードを取得する
|
||||
// 元々ユーザのアカウントが無く修理工程のNUPによりアカウントが生成された場合、
|
||||
// ImportCountryLanguageData によりリージョンに応じた適当な国が設定されていることに注意
|
||||
nn::cfg::CTR::CfgCountryCode GetCountryCodeFromEci();
|
||||
|
||||
}
|
||||
|
||||
#endif /* SHOP_H_ */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user