エージング用branchのr363をマージ

Copydirectoryに渡すバッファはAES_BLOCK_SIZE * 2に
ヒープのサイズ取得じにアラインメントを考慮するように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@364 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2011-07-07 05:08:38 +00:00
parent f8de4cefaf
commit eb286d34bc
3 changed files with 24 additions and 19 deletions

View File

@ -154,6 +154,7 @@ nn::Result DeleteTrash(std::wstring currentDirectory)
nn::Result WriteTwlTitleList(std::vector<std::wstring>& programIdList)
{
nn::Result result;
COMMON_LOGGER("Export TwlTitle List.\n");
size_t heapSize = common::GetAllocatableSize();
@ -169,10 +170,14 @@ nn::Result WriteTwlTitleList(std::vector<std::wstring>& programIdList)
NN_LOG("%ls\n", it->c_str());
writeSize += it->size() + sizeof('\n');
}
}
nn::Result result = s_SdWriter.WriteBufWithCmac(common::TWL_TITLELIST_PATHNAME, titleListBuf, writeSize);
return result;
return s_SdWriter.WriteBufWithCmac(common::TWL_TITLELIST_PATHNAME, titleListBuf, writeSize);
}
else
{
return nn::Result(nn::Result::LEVEL_FATAL, nn::Result::SUMMARY_OUT_OF_RESOURCE, nn::Result::MODULE_COMMON,
nn::Result::DESCRIPTION_OUT_OF_MEMORY);
}
}
@ -468,9 +473,6 @@ void WriteTwlData(enum common::TWL_PATH_INDEX path)
result = common::SdMountManager::Mount();
COMMON_LOGGER_RETURN_VOID_SET_BOOL_IF_FAILED(result, s_IsExportSucceeded);
size_t bufSize = common::GetAllocatableSize();
NN_LOG("AllocatableSize = %d\n", bufSize);
u32 fileNum = 0;
s64 fileSize = 0;
result = common::CalculateFileNum(::std::wstring(common::NAND_TWL_ROOT_PATHNAME_WITH_SLASH_TABLE[path]), fileNum, fileSize);
@ -484,7 +486,10 @@ void WriteTwlData(enum common::TWL_PATH_INDEX path)
// 進捗表示用
common::InitializeTransferProgress(fileSize);
common::HeapManager writeHeap(bufSize, AES_BLOCK_SIZE);
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
NN_LOG("AllocatableSize = %d\n", bufSize);
common::HeapManager writeHeap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = writeHeap.GetAddr();
if (buf != NULL)
{
@ -605,10 +610,10 @@ void WriteTwlSaveData()
result = common::SdMountManager::Mount();
COMMON_LOGGER_RETURN_VOID_SET_BOOL_IF_FAILED(result, s_IsExportSucceeded);
size_t bufSize = common::GetAllocatableSize();
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
NN_LOG("AllocatableSize = %d\n", bufSize);
common::HeapManager writeHeap(bufSize, AES_BLOCK_SIZE);
common::HeapManager writeHeap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = writeHeap.GetAddr();
if (buf != NULL)
{
@ -751,10 +756,10 @@ void ExportThreadFunc()
result = common::SdMountManager::Mount();
size_t bufSize = common::GetAllocatableSize();
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
NN_LOG("AllocatableSize = %d\n", bufSize);
common::HeapManager writeHeap(bufSize, AES_BLOCK_SIZE);
common::HeapManager writeHeap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = writeHeap.GetAddr();
if (buf != NULL)
{

View File

@ -706,10 +706,10 @@ void ImportThreadFunc()
result = common::SdMountManager::Mount();
COMMON_LOGGER_RETURN_VOID_SET_BOOL_IF_FAILED(result, s_IsImportSucceeded);
size_t bufSize = common::GetAllocatableSize();
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
NN_LOG("AllocatableSize = %d\n", bufSize);
common::HeapManager heap(bufSize);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = heap.GetAddr();
if (buf != NULL)
{
@ -1481,13 +1481,13 @@ void ImportTwlData(enum common::TWL_PATH_INDEX path, s64 fileSize)
result = common::SdMountManager::Mount();
COMMON_LOGGER_RETURN_VOID_SET_BOOL_IF_FAILED(result, s_IsImportSucceeded);
size_t bufSize = common::GetAllocatableSize();
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
NN_LOG("AllocatableSize = %d\n", bufSize);
// ファイルサイズ設定
common::InitializeTransferProgress(fileSize);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = heap.GetAddr();
if (buf != NULL)
{
@ -1522,13 +1522,13 @@ void ImportTwlTitleSaveData(s64 fileSize)
result = common::SdMountManager::Mount();
COMMON_LOGGER_RETURN_VOID_SET_BOOL_IF_FAILED(result, s_IsImportSucceeded);
size_t bufSize = common::GetAllocatableSize();
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
NN_LOG("AllocatableSize = %d\n", bufSize);
// ファイルサイズ設定
common::InitializeTransferProgress(fileSize);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = heap.GetAddr();
if (buf != NULL)
{

View File

@ -362,9 +362,9 @@ void VerifyThreadFunc()
result = common::SdMountManager::Mount();
size_t bufSize = common::GetAllocatableSize();
size_t bufSize = common::GetAllocatableSize(AES_BLOCK_SIZE * 2);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE);
common::HeapManager heap(bufSize, AES_BLOCK_SIZE * 2);
void* buf = heap.GetAddr();
if (buf != NULL)
{