Backupでは通信系のプロセスを起動しないように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@371 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-07-08 04:24:47 +00:00
parent f0c49b9bc3
commit 887c9f869e
10 changed files with 88 additions and 62 deletions

View File

@ -68,6 +68,10 @@ common::Util s_HwUtility;
} // namespace <unnamed>
extern "C" void nninitSetupDaemons(void)
{
}
namespace ConsoleBackup{
@ -88,14 +92,6 @@ extern "C" void nnMain(void)
result = nn::hid::Initialize();
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
// ndmの初期化
result = nn::ndm::Initialize();
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
// 全デーモンの自律動作をacの自動接続も含めて止める
result = nn::ndm::SuspendScheduler();
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
// cfg の初期化
nn::cfg::CTR::init::Initialize();
nn::cfg::CTR::system::Initialize();
@ -142,7 +138,7 @@ extern "C" void nnMain(void)
nn::hid::PadStatus padStatus;
// データの準備
s_HwUtility.Initialize();
s_HwUtility.InitializeForBackup();
common::HardwareStateManager manager(s_HwUtility);
// 情報出力
@ -156,11 +152,6 @@ extern "C" void nnMain(void)
COMMON_LOGGER("Serial Number %s\n", s_HwUtility.GetSerialNumber());
COMMON_LOGGER("Device ID %llu\n", s_HwUtility.GetInfraDeviceId());
COMMON_LOGGER("MAC Address %s\n", s_HwUtility.GetMacAddress());
COMMON_LOGGER("Friend Code %04u-%04u-%04u\n",
static_cast<u32>(s_HwUtility.GetFriendcode() / 100000000ULL % 10000ULL),
static_cast<u32>(s_HwUtility.GetFriendcode() / 10000ULL % 10000ULL),
static_cast<u32>(s_HwUtility.GetFriendcode() % 10000ULL) );
bool flip = false;
bool continueBackup = false;
@ -251,7 +242,8 @@ extern "C" void nnMain(void)
s_HwUtility.GetMacAddress(),
operationMessage,
s_HwUtility.GetRegion(),
s_HwUtility.GetSerialNumber()
s_HwUtility.GetSerialNumber(),
s_HwUtility.HasReadFriendCode()
);
renderSystem.SwapBuffers();

View File

@ -13,20 +13,10 @@ SystemControlInfo:
AppType : Application
StackSize : 0x4000
Dependency :
- gpio
- pdn
- spi
- i2c
- mcu
- ptm
- codec
- cfg
- hid
- gsp
- friends
- nim
- ac
- ndm
- nwm
AccessControlInfo:
Priority : 16

View File

@ -66,7 +66,7 @@ demo::RenderSystemDrawing s_RenderSystem;
namespace ConsoleRestore{
void FinalizeAll(common::HardwareStateManager& manager)
void FinalizeAll()
{
common::Logger::GetLoggerInstance()->Finalize();
// アンマウント
@ -74,7 +74,7 @@ void FinalizeAll(common::HardwareStateManager& manager)
nn::fs::Unmount("sdmc:");
s_RenderSystem.Finalize();
manager.Finalize();
s_HwUtility.FinalizeForRestore();
nn::ps::Finalize();
nn::ptm::CTR::FinalizeForSystemMenu();
nn::cfg::CTR::system::Finalize();
@ -160,7 +160,7 @@ extern "C" void nnMain(void)
nn::hid::PadStatus padStatus;
// データの準備
s_HwUtility.Initialize();
s_HwUtility.InitializeForRestore();
common::HardwareStateManager manager(s_HwUtility);
// 情報出力
@ -289,7 +289,8 @@ extern "C" void nnMain(void)
s_HwUtility.GetMacAddress(),
operationMessage,
s_HwUtility.GetRegion(),
s_HwUtility.GetSerialNumber()
s_HwUtility.GetSerialNumber(),
s_HwUtility.HasReadFriendCode()
);
if (GetRestoreMode() != RESTORE_MODE_RESTORE)
@ -346,7 +347,7 @@ extern "C" void nnMain(void)
// 電源長押しで終了
if ( nn::applet::IsExpectedToCloseApplication())
{
FinalizeAll(manager);
FinalizeAll();
}
}
}

View File

@ -13,14 +13,7 @@ SystemControlInfo:
AppType : Application
StackSize : 0x4000
Dependency :
- gpio
- pdn
- spi
- i2c
- mcu
- ptm
- codec
- cfg
- hid
- gsp
- friends

View File

@ -38,6 +38,7 @@ u8 s_BatteryRemain;
std::string s_AdapterState;
u8 s_Progress;
::std::vector<std::string>* s_OperationMessage;
bool s_ReadFriendCode;
}
@ -69,9 +70,12 @@ void SetTextWriterCore()
GetTextWriter()->Printf("Serial No. %s\n", s_SerialNo);
GetTextWriter()->Printf("Device ID %llu\n", s_DeviceId);
GetTextWriter()->Printf("MAC Address %s\n", s_MacAddress);
GetTextWriter()->Printf("Friend Code %04u-%04u-%04u\n", static_cast<u32> (s_FriendCode
/ 100000000ULL % 10000ULL), static_cast<u32> (s_FriendCode / 10000ULL % 10000ULL),
static_cast<u32> (s_FriendCode % 10000ULL));
if (s_ReadFriendCode)
{
GetTextWriter()->Printf("Friend Code %04u-%04u-%04u\n",
static_cast<u32>(s_FriendCode / 100000000ULL % 10000ULL), static_cast<u32> (s_FriendCode / 10000ULL % 10000ULL),
static_cast<u32> (s_FriendCode % 10000ULL));
}
GetTextWriter()->Printf("Battery %d%%\n", s_BatteryRemain);
GetTextWriter()->Printf("AC Adapter %s\n", s_AdapterState.c_str());
@ -108,7 +112,9 @@ void DrawSystemState
char8* macAddress,
::std::vector<std::string>& operationMessage,
nn::cfg::CTR::CfgRegionCode region,
u8* serialNo
u8* serialNo,
bool readFriendCode
)
{
// パラメータ保存
@ -126,6 +132,7 @@ void DrawSystemState
std::memcpy(s_SerialNo, serialNo, sizeof(s_SerialNo));
s_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN] = '\0';
s_OperationMessage = &operationMessage;
s_ReadFriendCode = readFriendCode;
// デフォルトで上画面に描画するもの
@ -166,7 +173,15 @@ void DrawSystemState
// プログレスバー
fontwidth = 8;
fontheight = 14;
line += 9;
if(readFriendCode)
{
line += 9;
}
else
{
line += 8;
}
const u8 offset = 19;
const u8 diff = 4;
renderSystem.SetColor(0.f, 0.2f, 0.f);

View File

@ -71,7 +71,8 @@ void DrawSystemState
char8* macAddress,
::std::vector<std::string>& operationMessage,
nn::cfg::CTR::CfgRegionCode region,
u8* s_SerialNo
u8* s_SerialNo,
bool readFriendCode
);
}

View File

@ -28,11 +28,6 @@ HardwareStateManager::~HardwareStateManager()
}
void HardwareStateManager::Finalize()
{
m_pUtil->Finalize();
}
bool HardwareStateManager::CanReadIvs()
{
return m_pUtil->CanReadIVS();

View File

@ -29,8 +29,6 @@ public:
explicit HardwareStateManager(Util& hwUtility);
virtual ~HardwareStateManager();
void Finalize();
bool CanReadIvs();
bool CanReadSerialNumber();
bool IsBatteryLower();

View File

@ -38,10 +38,9 @@ namespace common
{
Util::Util() :
m_BatteryRemain(100), m_CanReadSerialNumber(false), m_CanReadIvs(false)
m_FriendCode(0), m_BatteryRemain(100), m_CanReadSerialNumber(false), m_CanReadIvs(false), m_HasReadFriendCode(false)
{
}
Util::~Util()
@ -49,11 +48,31 @@ Util::~Util()
}
void Util::Initialize()
void Util::InitializeForBackup()
{
Initialize();
}
void Util::InitializeForRestore()
{
Initialize();
// friendsの初期化
nn::Result result = nn::friends::detail::Initialize();
// フレンドコードの取得
nn::friends::CTR::FriendKey friendKey;
result = nn::friends::CTR::GetMyFriendKey(&friendKey);
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
m_FriendCode = nn::friends::CTR::FriendKeyToFriendCode(friendKey);
m_HasReadFriendCode = true;
}
void Util::Initialize()
{
nn::Result result;
// mcuの初期化
nn::mcu::CTR::InitializeHwCheck(&m_McuSession);
mp_Mcu = new nn::mcu::CTR::HwCheck(m_McuSession);
@ -118,18 +137,21 @@ void Util::Initialize()
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
mac.GetString(m_MacAddress);
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
}
// フレンドコードの取得
nn::friends::CTR::FriendKey friendKey;
result = nn::friends::CTR::GetMyFriendKey(&friendKey);
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
m_FriendCode = nn::friends::CTR::FriendKeyToFriendCode(friendKey);
void Util::FinalizeForBackup()
{
Finalize();
}
void Util::FinalizeForRestore()
{
nn::friends::detail::Finalize();
}
void Util::Finalize()
{
nn::mcu::CTR::FinalizeHwCheck(&m_McuSession);
nn::friends::detail::Finalize();
}
// NULL終端されたシリアルナンバーを受け取る
@ -330,4 +352,9 @@ void Util::GetVersionData(common::VerDef* version)
*version = m_VerData;
}
bool Util::HasReadFriendCode()
{
return m_HasReadFriendCode;
}
}

View File

@ -33,8 +33,11 @@ public:
Util();
virtual ~Util();
void Initialize();
void Finalize();
void InitializeForBackup();
void InitializeForRestore();
void FinalizeForBackup();
void FinalizeForRestore();
// シリアルナンバーにモジュラス10 ウェイト3・1M10W31でチェックデジットを付加する
static void AddCheckDigit(char* serial);
@ -102,8 +105,13 @@ public:
// バージョン情報を取得する
void GetVersionData(common::VerDef* version);
// フレンドコードを取得済みかどうか
bool HasReadFriendCode();
private:
void Initialize();
void Finalize();
NN_PADDING4;
// フレンドコード
u64 m_FriendCode;
@ -145,6 +153,12 @@ private:
// MACアドレス
char8 m_MacAddress[nn::nwm::Mac::MAC_STRING_SIZE];
NN_PADDING3;
// FriendCodeを読んだかどうか
bool m_HasReadFriendCode;
NN_PADDING3;
NN_PADDING4;
};
}