mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
TADインポートの進捗表示スレッドが解放されない不具合を修正。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@557 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
0680ef0d7b
commit
0a2c8de063
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user