From 0a2c8de06317c1160ba8754373dbeb353bc0f42d Mon Sep 17 00:00:00 2001 From: kamikawa Date: Fri, 1 Feb 2008 03:49:51 +0000 Subject: [PATCH] =?UTF-8?q?TAD=E3=82=A4=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=AE=E9=80=B2=E6=8D=97=E8=A1=A8=E7=A4=BA=E3=82=B9?= =?UTF-8?q?=E3=83=AC=E3=83=83=E3=83=89=E3=81=8C=E8=A7=A3=E6=94=BE=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=AA=E3=81=84=E4=B8=8D=E5=85=B7=E5=90=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@557 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../ARM9.TWL/src/process_hw_info.c | 22 +++++------ .../ARM9.TWL/src/process_import.c | 39 +++++++++++++------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c index 5bc5dee8..8711c2a5 100644 --- a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_hw_info.c @@ -323,7 +323,7 @@ void HWInfoWriterInit( void ) ReadPrivateKey(); ReadHWInfoFile(); // VerifyHWInfo(); - OS_TPrintf( "region = %d\n", LCFG_THW_GetRegion() ); + OS_Printf("region = %d\n", LCFG_THW_GetRegion() ); // s_csr = 0; // DrawMenu( s_csr, &s_writerParam ); @@ -410,7 +410,7 @@ static void ReadPrivateKey( void ) FS_InitFile( &file ); if( !FS_OpenFileEx( &file, "rom:key/private_HWInfo.der", FS_FILEMODE_R ) ) { - OS_TPrintf( "PrivateKey read failed.\n" ); + kamiFontPrintfConsoleEx(CONSOLE_RED, "PrivateKey read failed.\n" ); }else { keyLength = FS_GetFileLength( &file ); if( keyLength > 0 ) { @@ -419,7 +419,7 @@ static void ReadPrivateKey( void ) OS_TPrintf( "PrivateKey read succeeded.\n" ); result = TRUE; }else { - OS_TPrintf( "PrivateKey read failed.\n" ); + kamiFontPrintfConsoleEx(CONSOLE_RED, "PrivateKey read failed.\n" ); } } FS_CloseFile( &file ); @@ -458,9 +458,9 @@ static void ReadHWInfoFile( void ) retval = LCFGi_THW_ReadNormalInfo(); if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { - OS_TPrintf( "HW Normal Info read succeeded.\n" ); + OS_Printf("HW Normal Info read succeeded.\n" ); }else { - OS_TPrintf( "HW Normal Info read failed.\n" ); + kamiFontPrintfConsoleEx(0, "HW Normal Info read failed.\n" ); } OS_TPrintf( "HW Normal Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); @@ -468,9 +468,9 @@ static void ReadHWInfoFile( void ) start = OS_GetTick(); retval = s_pReadSecureInfoFunc(); if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { - OS_TPrintf( "HW Secure Info read succeeded.\n" ); + OS_Printf("HW Secure Info read succeeded.\n" ); }else { - OS_TPrintf( "HW Secure Info read failed.\n" ); + kamiFontPrintfConsoleEx(0, "HW Secure Info read failed.\n" ); } OS_TPrintf( "HW Secure Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); } @@ -541,13 +541,13 @@ static BOOL WriteHWNormalInfoFile( void ) result = LCFGi_THW_ReadNormalInfo(); if( result != LCFG_TSF_READ_RESULT_SUCCEEDED ) { if( !LCFGi_THW_RecoveryNormalInfo( result ) ) { - OS_TPrintf( "HW Normal Info Recovery failed.\n" ); + kamiFontPrintfConsoleEx(CONSOLE_RED, "HW Normal Info Recovery failed.\n" ); isWrite = FALSE; } } if( isWrite && !LCFGi_THW_WriteNormalInfo() ) { - OS_TPrintf( "HW Normal Info Write failed.\n" ); + kamiFontPrintfConsoleEx(CONSOLE_RED, "HW Normal Info Write failed.\n" ); } return isWrite; @@ -574,7 +574,7 @@ static BOOL WriteHWSecureInfoFile( u8 region ) // リードに失敗したらリカバリ if( result != LCFG_TSF_READ_RESULT_SUCCEEDED ) { if( !LCFGi_THW_RecoverySecureInfo( result ) ) { - OS_TPrintf( "HW Secure Info Recovery failed.\n" ); + kamiFontPrintfConsoleEx(CONSOLE_RED, "HW Secure Info Recovery failed.\n" ); isWrite = FALSE; } } @@ -611,7 +611,7 @@ static BOOL WriteHWSecureInfoFile( u8 region ) if( isWrite && !LCFGi_THW_WriteSecureInfo( s_pPrivKeyBuffer ) ) { isWrite = FALSE; - OS_TPrintf( "HW Secure Info Write failed.\n" ); + kamiFontPrintfConsoleEx(CONSOLE_RED, "HW Secure Info Write failed.\n" ); } return isWrite; diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c index 17bba7e0..962827d3 100644 --- a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c @@ -79,6 +79,8 @@ static void* spStack; static u32 sCurrentProgress; +static vu8 sNowImport = FALSE; + /*---------------------------------------------------------------------------* 内部関数宣言 *---------------------------------------------------------------------------*/ @@ -584,6 +586,7 @@ static BOOL ImportTad(char* file_name, TadWriteOption option) char full_path[FS_ENTRY_LONGNAME_MAX+6]; OSThread thread; BOOL ret = FALSE; + s32 nam_result; // フルパスを作成 MakeFullPathForSD(file_name, full_path); @@ -632,6 +635,9 @@ static BOOL ImportTad(char* file_name, TadWriteOption option) } } + // インポート開始フラグを立てる + sNowImport = TRUE; + // 進捗スレッド作成 spStack = OS_Alloc(THREAD_STACK_SIZE); MI_CpuClear8(spStack, THREAD_STACK_SIZE); @@ -645,10 +651,15 @@ static BOOL ImportTad(char* file_name, TadWriteOption option) OS_Printf( "Import %s Start.\n", full_path ); kamiFontPrintfConsole(CONSOLE_ORANGE, "Import %s Start.\n", file_name ); - if ( NAM_ImportTad( full_path ) == NAM_OK ) + nam_result = NAM_ImportTad( full_path ); + + // 進捗スレッドの自力終了を待つ + while (sNowImport){ OS_Sleep(1); }; + + if ( nam_result == NAM_OK ) { - ret = TRUE; kamiFontPrintfConsole(CONSOLE_ORANGE, "Import %s Sucess.\n", file_name ); + ret = TRUE; } else { @@ -676,25 +687,31 @@ static void Destructor(void* /*arg*/) static void ProgressThread(void* /*arg*/) { - u32 currentSize; - u32 totalSize; + u32 currentSize; + u32 totalSize = 0; + u32 totalSizeBk = 0; ProgressInit(); while (TRUE) { NAM_GetProgress(¤tSize, &totalSize); - if (totalSize != 0) + + if ((totalSize > 0 && totalSize == currentSize) || totalSizeBk > totalSize) + { + // 既にインポートが終了 + ProgressDraw((f32)1.0); + break; + } + else if (totalSize > 0) { ProgressDraw((f32)currentSize/totalSize); - - // 100%なら終了 - if (currentSize == totalSize) - { - break; - } } + + totalSizeBk = totalSize; } + + sNowImport = FALSE; } /*---------------------------------------------------------------------------*