diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h index d2fb008c..73d3cc67 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h @@ -26,7 +26,10 @@ extern "C" { #include +#define WRAP_DATA_FILE_PATH_IN_NAND "nand:/shared2/launcher/wrap.bin" + BOOL kamiCopyFile(char* srcPath, char* dstPath); +BOOL kamiWriteWrapData(void); /*===========================================================================*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf index 42b3e030..abb5c445 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf @@ -223,7 +223,7 @@ RomSpec HostRoot ../data Root /data File HNAA.tad HNBA.tad HNCA.tad HNHA.tad HNLA.tad \ - menu_launcher.nand TWLFontTable.dat + menu_launcher.nand TWLFontTable.dat cert.sys HostRoot $(PRIVKEY_PATH) Root /key File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c index c9365276..899f3a56 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c @@ -71,10 +71,10 @@ BOOL kamiCopyFile(char* srcPath, char* dstPath) FS_CloseFile(&file); // 一旦対象データを削除する - (void)FS_DeleteFile(dstPath); +// (void)FS_DeleteFile(dstPath); // ターゲットファイル作成 - if (!FS_CreateFile(dstPath, FS_PERMIT_R | FS_PERMIT_W)) + if (!FS_CreateFileAuto(dstPath, FS_PERMIT_R | FS_PERMIT_W)) { kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath); result = FALSE; @@ -89,7 +89,7 @@ BOOL kamiCopyFile(char* srcPath, char* dstPath) kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath); result = FALSE; } - // nand:sys/TWLFontTable.dat書き込み + // ターゲットファイルへ書き込み else if (FS_WriteFile(&file, pTempBuf, (s32)file_size) == -1) { kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_WritFile() failed.\n"); @@ -103,3 +103,33 @@ BOOL kamiCopyFile(char* srcPath, char* dstPath) return result; } +// ダミーのDSメニューラッピング用ファイル作成(UIGランチャーが作っているもの) +BOOL kamiWriteWrapData(void) +{ + FSFile file; + BOOL open_is_ok; + const int FATFS_CLUSTER_SIZE = 16 * 1024; + + // 既に存在するなら何もしない + FS_InitFile(&file); + open_is_ok = FS_OpenFile(&file, WRAP_DATA_FILE_PATH_IN_NAND); + if (open_is_ok) + { + FS_CloseFile(&file); + OS_Printf("%s is already exist.\n", WRAP_DATA_FILE_PATH_IN_NAND); + return TRUE; + } + + if( FS_CreateFileAuto( WRAP_DATA_FILE_PATH_IN_NAND, FS_PERMIT_R | FS_PERMIT_W ) ) + { + FSFile file; + if( FS_OpenFileEx( &file, WRAP_DATA_FILE_PATH_IN_NAND, FS_FILEMODE_RW ) ) + { + (void)FS_SetFileLength( &file, FATFS_CLUSTER_SIZE ); + FS_CloseFile( &file ); + return TRUE; + } + } + + return FALSE; +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c index ad5fedec..3b49c5cc 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c @@ -80,7 +80,8 @@ static const char* ImportTadFileList[] = static const CopyFileList sCopyFileList[] = { - { "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" } + { "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" }, + { "rom:/data/cert.sys", "nand:/sys/cert.sys" } }; /*---------------------------------------------------------------------------* @@ -402,6 +403,9 @@ TwlMain() } } + // ダミーのラッピングデータ書き込み + result &= kamiWriteWrapData(); + // TADのインポート開始 tadNum = sizeof(ImportTadFileList)/sizeof(ImportTadFileList[0]); diff --git a/build/systemMenu_tools/SystemUpdater/data/cert.sys b/build/systemMenu_tools/SystemUpdater/data/cert.sys new file mode 100644 index 00000000..3d40f56a Binary files /dev/null and b/build/systemMenu_tools/SystemUpdater/data/cert.sys differ