mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
アカウントサルベージ時のcfgフラグ設定の判定部分を追加
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@781 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
21d6a5a1a0
commit
0d8e6478a0
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: AgeChecker.cpp
|
||||
|
||||
Copyright (C)2014 Nintendo Co., Ltd. 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 "AgeChecker.h"
|
||||
|
||||
using namespace nn::cfg::CTR;
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
AgeChecker::AgeChecker()
|
||||
{
|
||||
// TODO 自動生成されたコンストラクター・スタブ
|
||||
|
||||
}
|
||||
|
||||
AgeChecker::~AgeChecker()
|
||||
{
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
bool AgeChecker::IsPinRestrictionRequired(u32 age, CfgRegionCode region, CfgCountryCode country)
|
||||
{
|
||||
if (region == CFG_REGION_EUROPE)
|
||||
{
|
||||
switch (country)
|
||||
{
|
||||
case CFG_COUNTRY_AUSTRALIA:
|
||||
case CFG_COUNTRY_NEW_ZEALAND:
|
||||
return age < 18;
|
||||
default:
|
||||
return age < 13;
|
||||
}
|
||||
}
|
||||
else if (region == CFG_REGION_AMERICA && (country == CFG_COUNTRY_UNITED_STATES || country == CFG_COUNTRY_CANADA))
|
||||
{
|
||||
return age < 13;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AgeChecker::IsCoppaRequired(u32 age, nn::cfg::CTR::CfgRegionCode region, nn::cfg::CTR::CfgCountryCode country)
|
||||
{
|
||||
if (region == CFG_REGION_AMERICA && country == CFG_COUNTRY_UNITED_STATES && age < 13)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace ConsoleRestore */
|
||||
@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: AgeChecker.h
|
||||
|
||||
Copyright (C)2014 Nintendo Co., Ltd. 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 AGECHECKER_H_
|
||||
#define AGECHECKER_H_
|
||||
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#include <nn.h>
|
||||
#include <nn/cfg.h>
|
||||
#else
|
||||
#include "test_common.h"
|
||||
#endif
|
||||
#include <nn/cfg/CTR/cfg_CountryCode.h>
|
||||
#include <nn/cfg/CTR/cfg_RegionCode.h>
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
class AgeChecker
|
||||
{
|
||||
|
||||
public:
|
||||
AgeChecker();
|
||||
virtual ~AgeChecker();
|
||||
bool IsPinRestrictionRequired(u32 age, nn::cfg::CTR::CfgRegionCode region, nn::cfg::CTR::CfgCountryCode country);
|
||||
bool IsCoppaRequired(u32 age, nn::cfg::CTR::CfgRegionCode region, nn::cfg::CTR::CfgCountryCode country);
|
||||
};
|
||||
|
||||
} /* namespace ConsoleRestore */
|
||||
#endif /* AGECHECKER_H_ */
|
||||
@ -0,0 +1,23 @@
|
||||
INCLUDES[] +=
|
||||
./
|
||||
../common
|
||||
../../../ConsoleRestore
|
||||
$(HORIZON_ROOT)/include
|
||||
|
||||
TARGET = testAgeChecker
|
||||
TEST_TARGET = AgeChecker
|
||||
|
||||
SRC_FILES[] =
|
||||
testAgeChecker
|
||||
AgeChecker
|
||||
|
||||
# テスト独自のスタブを使用する場合に定義する
|
||||
#CXXFLAGS += -DPCTEST_USE_STUB
|
||||
|
||||
# テストディレクトリ外にあるので独自ルールでビルド
|
||||
$(TEST_TARGET)$(EXT_OBJ): ../../../ConsoleRestore/$(TEST_TARGET).cpp
|
||||
$(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $<
|
||||
|
||||
.DEFAULT: $(TEST_TARGET)$(EXT_OBJ) $(TARGET)$(EXE)
|
||||
|
||||
include $(COMMON_BUILD)
|
||||
@ -0,0 +1,59 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "AgeChecker.h"
|
||||
|
||||
TEST(testPin, A)
|
||||
{
|
||||
ConsoleRestore::AgeChecker ac;
|
||||
|
||||
// A-1
|
||||
ASSERT_TRUE(ac.IsPinRestrictionRequired(12, nn::cfg::CTR::CFG_REGION_AMERICA, nn::cfg::CTR::CFG_COUNTRY_UNITED_STATES));
|
||||
// A-2
|
||||
ASSERT_TRUE(ac.IsPinRestrictionRequired(12, nn::cfg::CTR::CFG_REGION_AMERICA, nn::cfg::CTR::CFG_COUNTRY_CANADA));
|
||||
// A-3
|
||||
ASSERT_TRUE(ac.IsPinRestrictionRequired(12, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_UNITED_KINGDOM));
|
||||
// A-4
|
||||
ASSERT_TRUE(ac.IsPinRestrictionRequired(17, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_AUSTRALIA));
|
||||
ASSERT_TRUE(ac.IsPinRestrictionRequired(17, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_NEW_ZEALAND));
|
||||
}
|
||||
|
||||
TEST(testPin, B)
|
||||
{
|
||||
ConsoleRestore::AgeChecker ac;
|
||||
|
||||
// B-1
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_AMERICA, nn::cfg::CTR::CFG_COUNTRY_UNITED_STATES));
|
||||
// B-2
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_AMERICA, nn::cfg::CTR::CFG_COUNTRY_CANADA));
|
||||
// B-3
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_UNITED_KINGDOM));
|
||||
// B-4
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(18, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_AUSTRALIA));
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(18, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_NEW_ZEALAND));
|
||||
}
|
||||
|
||||
TEST(testPin, C)
|
||||
{
|
||||
ConsoleRestore::AgeChecker ac;
|
||||
|
||||
// C-1
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(12, nn::cfg::CTR::CFG_REGION_JAPAN, nn::cfg::CTR::CFG_COUNTRY_JAPAN));
|
||||
// C-2
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_JAPAN, nn::cfg::CTR::CFG_COUNTRY_JAPAN));
|
||||
// C-3
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(17, nn::cfg::CTR::CFG_REGION_JAPAN, nn::cfg::CTR::CFG_COUNTRY_JAPAN));
|
||||
// C-4
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(18, nn::cfg::CTR::CFG_REGION_JAPAN, nn::cfg::CTR::CFG_COUNTRY_JAPAN));
|
||||
}
|
||||
|
||||
TEST(testCoppa, all)
|
||||
{
|
||||
ConsoleRestore::AgeChecker ac;
|
||||
// A-1
|
||||
ASSERT_TRUE(ac.IsPinRestrictionRequired(12, nn::cfg::CTR::CFG_REGION_AMERICA, nn::cfg::CTR::CFG_COUNTRY_UNITED_STATES));
|
||||
// その他
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_AMERICA, nn::cfg::CTR::CFG_COUNTRY_UNITED_STATES));
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_EUROPE, nn::cfg::CTR::CFG_COUNTRY_UNITED_KINGDOM));
|
||||
ASSERT_FALSE(ac.IsPinRestrictionRequired(13, nn::cfg::CTR::CFG_REGION_JAPAN, nn::cfg::CTR::CFG_COUNTRY_JAPAN));
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user