mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
エージング回数をカウントできるように
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@367 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
8df0e30666
commit
c238fa7459
@ -251,7 +251,8 @@ extern "C" void nnMain(void)
|
|||||||
s_HwUtility.GetMacAddress(),
|
s_HwUtility.GetMacAddress(),
|
||||||
operationMessage,
|
operationMessage,
|
||||||
s_HwUtility.GetRegion(),
|
s_HwUtility.GetRegion(),
|
||||||
s_HwUtility.GetSerialNumber()
|
s_HwUtility.GetSerialNumber(),
|
||||||
|
s_HwUtility.GetAgingCounter()
|
||||||
);
|
);
|
||||||
|
|
||||||
renderSystem.SwapBuffers();
|
renderSystem.SwapBuffers();
|
||||||
|
|||||||
@ -118,7 +118,9 @@ nn::Result DeleteTrash(std::wstring currentDirectory)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (std::wcscmp(entryIndex->entryName, common::AP_SETTING_FILENAME) != 0
|
if (std::wcscmp(entryIndex->entryName, common::AP_SETTING_FILENAME) != 0
|
||||||
&& std::wcscmp(entryIndex->entryName, common::LOG_FILENAME) != 0)
|
&& std::wcscmp(entryIndex->entryName, common::LOG_FILENAME) != 0
|
||||||
|
&& std::wcscmp(entryIndex->entryName, common::AGING_COUNTER_FILENAME) != 0
|
||||||
|
)
|
||||||
{
|
{
|
||||||
NN_LOG("Try Delete %ls%ls\n", currentDirectory.c_str(), entryIndex->entryName);
|
NN_LOG("Try Delete %ls%ls\n", currentDirectory.c_str(), entryIndex->entryName);
|
||||||
result = nn::fs::TryDeleteFile(
|
result = nn::fs::TryDeleteFile(
|
||||||
|
|||||||
@ -289,7 +289,8 @@ extern "C" void nnMain(void)
|
|||||||
s_HwUtility.GetMacAddress(),
|
s_HwUtility.GetMacAddress(),
|
||||||
operationMessage,
|
operationMessage,
|
||||||
s_HwUtility.GetRegion(),
|
s_HwUtility.GetRegion(),
|
||||||
s_HwUtility.GetSerialNumber()
|
s_HwUtility.GetSerialNumber(),
|
||||||
|
s_HwUtility.GetAgingCounter()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (GetRestoreMode() != RESTORE_MODE_RESTORE)
|
if (GetRestoreMode() != RESTORE_MODE_RESTORE)
|
||||||
|
|||||||
@ -38,6 +38,7 @@ u8 s_BatteryRemain;
|
|||||||
std::string s_AdapterState;
|
std::string s_AdapterState;
|
||||||
u8 s_Progress;
|
u8 s_Progress;
|
||||||
::std::vector<std::string>* s_OperationMessage;
|
::std::vector<std::string>* s_OperationMessage;
|
||||||
|
u32 s_Counter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ void SetTextWriterCore()
|
|||||||
GetTextWriter()->Printf("Battery %d%%\n", s_BatteryRemain);
|
GetTextWriter()->Printf("Battery %d%%\n", s_BatteryRemain);
|
||||||
GetTextWriter()->Printf("AC Adapter %s\n", s_AdapterState.c_str());
|
GetTextWriter()->Printf("AC Adapter %s\n", s_AdapterState.c_str());
|
||||||
GetTextWriter()->Printf("Progress %02d%%\n", s_Progress);
|
GetTextWriter()->Printf("Progress %02d%%\n", s_Progress);
|
||||||
|
GetTextWriter()->Printf("Counter %d\n", s_Counter);
|
||||||
GetTextWriter()->Print("\n");
|
GetTextWriter()->Print("\n");
|
||||||
|
|
||||||
::std::vector<std::string>::iterator it;
|
::std::vector<std::string>::iterator it;
|
||||||
@ -108,7 +110,8 @@ void DrawSystemState
|
|||||||
char8* macAddress,
|
char8* macAddress,
|
||||||
::std::vector<std::string>& operationMessage,
|
::std::vector<std::string>& operationMessage,
|
||||||
nn::cfg::CTR::CfgRegionCode region,
|
nn::cfg::CTR::CfgRegionCode region,
|
||||||
u8* serialNo
|
u8* serialNo,
|
||||||
|
u32 counter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// パラメータ保存
|
// パラメータ保存
|
||||||
@ -126,6 +129,7 @@ void DrawSystemState
|
|||||||
std::memcpy(s_SerialNo, serialNo, sizeof(s_SerialNo));
|
std::memcpy(s_SerialNo, serialNo, sizeof(s_SerialNo));
|
||||||
s_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN] = '\0';
|
s_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN] = '\0';
|
||||||
s_OperationMessage = &operationMessage;
|
s_OperationMessage = &operationMessage;
|
||||||
|
s_Counter = counter;
|
||||||
|
|
||||||
|
|
||||||
// デフォルトで上画面に描画するもの
|
// デフォルトで上画面に描画するもの
|
||||||
|
|||||||
@ -71,7 +71,8 @@ void DrawSystemState
|
|||||||
char8* macAddress,
|
char8* macAddress,
|
||||||
::std::vector<std::string>& operationMessage,
|
::std::vector<std::string>& operationMessage,
|
||||||
nn::cfg::CTR::CfgRegionCode region,
|
nn::cfg::CTR::CfgRegionCode region,
|
||||||
u8* s_SerialNo
|
u8* s_SerialNo,
|
||||||
|
u32 counter
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,6 +65,10 @@ const wchar_t* const FILE_LIST_PATHNAME = L"sdmc:/CTR_Console_Repair/FileList.tx
|
|||||||
const wchar_t* const TWL_TITLELIST_PATHNAME = L"sdmc:/CTR_Console_Repair/TwlTitleList.txt";
|
const wchar_t* const TWL_TITLELIST_PATHNAME = L"sdmc:/CTR_Console_Repair/TwlTitleList.txt";
|
||||||
const wchar_t* const SD_NINTENDO_3DS_ROOT_PATH = L"sdmc:/Nintendo 3DS/";
|
const wchar_t* const SD_NINTENDO_3DS_ROOT_PATH = L"sdmc:/Nintendo 3DS/";
|
||||||
|
|
||||||
|
const wchar_t* const AGING_COUNTER_PATHNAME = L"sdmc:/CTR_Console_Repair/counter.bin";
|
||||||
|
const wchar_t* const AGING_COUNTER_FILENAME = L"counter.bin";
|
||||||
|
|
||||||
|
|
||||||
enum TWL_PATH_INDEX
|
enum TWL_PATH_INDEX
|
||||||
{
|
{
|
||||||
TWL_PHOTO = 0,
|
TWL_PHOTO = 0,
|
||||||
|
|||||||
@ -78,4 +78,9 @@ void HardwareStateManager::GetVersionData(common::VerDef* version)
|
|||||||
return m_pUtil->GetVersionData(version);
|
return m_pUtil->GetVersionData(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 HardwareStateManager::GetAgingCounter()
|
||||||
|
{
|
||||||
|
return m_pUtil->GetAgingCounter();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,7 @@ public:
|
|||||||
nn::Handle GetMcuHandle();
|
nn::Handle GetMcuHandle();
|
||||||
void GetSerialNumber(u8** serial, size_t* size);
|
void GetSerialNumber(u8** serial, size_t* size);
|
||||||
void GetVersionData(common::VerDef* version);
|
void GetVersionData(common::VerDef* version);
|
||||||
|
u32 GetAgingCounter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NN_PADDING4;
|
NN_PADDING4;
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
#include "FileName.h"
|
#include "FileName.h"
|
||||||
#include "CommonLogger.h"
|
#include "CommonLogger.h"
|
||||||
#include "HeapManager.h"
|
#include "HeapManager.h"
|
||||||
|
#include "SdMountManager.h"
|
||||||
|
#include "SdReaderWriter.h"
|
||||||
|
|
||||||
|
|
||||||
namespace common
|
namespace common
|
||||||
@ -124,6 +126,36 @@ void Util::Initialize()
|
|||||||
result = nn::friends::CTR::GetMyFriendKey(&friendKey);
|
result = nn::friends::CTR::GetMyFriendKey(&friendKey);
|
||||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||||
m_FriendCode = nn::friends::CTR::FriendKeyToFriendCode(friendKey);
|
m_FriendCode = nn::friends::CTR::FriendKeyToFriendCode(friendKey);
|
||||||
|
|
||||||
|
// エージング回数の変更
|
||||||
|
SdMountManager::Mount();
|
||||||
|
size_t bufSize = GetAllocatableSize();
|
||||||
|
common::HeapManager heap(bufSize);
|
||||||
|
void* buf = heap.GetAddr();
|
||||||
|
if (buf != NULL)
|
||||||
|
{
|
||||||
|
common::SdReaderWriter sdReaderWriter;
|
||||||
|
|
||||||
|
size_t readSize;
|
||||||
|
result = sdReaderWriter.ReadBufWithCmac(common::AGING_COUNTER_PATHNAME, buf, bufSize, &readSize);
|
||||||
|
if(result.IsSuccess())
|
||||||
|
{
|
||||||
|
// SDから読み出し成功
|
||||||
|
std::memcpy(&m_AgingCounter, buf, readSize);
|
||||||
|
m_AgingCounter++;
|
||||||
|
result = sdReaderWriter.WriteBufWithCmac(common::AGING_COUNTER_PATHNAME, &m_AgingCounter, sizeof(m_AgingCounter));
|
||||||
|
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 初期値
|
||||||
|
m_AgingCounter = 1;
|
||||||
|
result = sdReaderWriter.WriteBufWithCmac(common::AGING_COUNTER_PATHNAME, &m_AgingCounter, sizeof(m_AgingCounter));
|
||||||
|
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SdMountManager::Unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Util::Finalize()
|
void Util::Finalize()
|
||||||
@ -330,4 +362,9 @@ void Util::GetVersionData(common::VerDef* version)
|
|||||||
*version = m_VerData;
|
*version = m_VerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 Util::GetAgingCounter()
|
||||||
|
{
|
||||||
|
return m_AgingCounter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,6 +102,9 @@ public:
|
|||||||
// バージョン情報を取得する
|
// バージョン情報を取得する
|
||||||
void GetVersionData(common::VerDef* version);
|
void GetVersionData(common::VerDef* version);
|
||||||
|
|
||||||
|
// エージング回数を取得する
|
||||||
|
u32 GetAgingCounter();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NN_PADDING4;
|
NN_PADDING4;
|
||||||
@ -145,6 +148,10 @@ private:
|
|||||||
// MACアドレス
|
// MACアドレス
|
||||||
char8 m_MacAddress[nn::nwm::Mac::MAC_STRING_SIZE];
|
char8 m_MacAddress[nn::nwm::Mac::MAC_STRING_SIZE];
|
||||||
NN_PADDING3;
|
NN_PADDING3;
|
||||||
|
|
||||||
|
NN_PADDING4;
|
||||||
|
// エージング回数
|
||||||
|
u32 m_AgingCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user