Restoreも同一本体下記戻しの場合エージングできるように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@368 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-07-07 06:31:05 +00:00
parent c238fa7459
commit 34407ba9a2
2 changed files with 38 additions and 36 deletions

View File

@ -339,7 +339,18 @@ void CheckAccountTransfered(common::HardwareStateManager& manager, ::std::vector
}
else
{
s_RestoreState = WAIT_START_TRANSFER_ACCOUNT;
// エージングのため同一本体下記書き戻しの場合は本体初期化からはじめる
if(EqualsDeviceIdFileandDeviceId(manager).IsSuccess())
{
CreateTransferAccountFinishedFile();
CreateDownloadIvsFinishedFile();
CheckWriteFinished(manager, message, goNextStep);
}
else
{
s_RestoreState = WAIT_START_TRANSFER_ACCOUNT;
}
}
}
@ -838,10 +849,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
s_PlayedStartCursor = true;
}
if (nextStep)
{
s_RestoreState = READ_FILELIST;
}
s_RestoreState = READ_FILELIST;
}
break;
@ -912,10 +920,7 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
PlaySound(SOUND_ANNOTATION);
}
if (nextStep)
{
s_RestoreState = READ_FILELIST;
}
s_RestoreState = READ_FILELIST;
}
break;
@ -1313,10 +1318,10 @@ void ControlState(common::HardwareStateManager& manager, ::std::vector<std::stri
s_PlayedRebootCursor = true;
}
if (nextStep)
{
s_RestoreState = REBOOTING;
}
// リストア状態チェックファイルをすべて削除
DeleteAllCheckFiles();
s_RestoreState = REBOOTING;
}
break;

View File

@ -129,30 +129,27 @@ void Util::Initialize()
// エージング回数の変更
SdMountManager::Mount();
size_t bufSize = GetAllocatableSize();
common::HeapManager heap(bufSize);
void* buf = heap.GetAddr();
if (buf != NULL)
const size_t BUF_SIZE = 1024;
u8* buf[BUF_SIZE];
common::SdReaderWriter sdReaderWriter;
size_t readSize;
result = sdReaderWriter.ReadBufWithCmac(common::AGING_COUNTER_PATHNAME, buf, BUF_SIZE, &readSize);
if (result.IsSuccess())
{
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);
}
// 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();