mirror of
https://github.com/rvtr/TwlToolsRED.git
synced 2025-10-31 06:41:18 -04:00
メニュースキップフラグ立てツール:ヘッダCRCがおかしいとき後続の処理をしないようにした。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@298 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
5283954fa1
commit
b7adc5a32f
@ -106,7 +106,9 @@ int main(int argc, char *argv[])
|
|||||||
BOOL bResult = TRUE;
|
BOOL bResult = TRUE;
|
||||||
BOOL bForceOverwrite = FALSE;
|
BOOL bForceOverwrite = FALSE;
|
||||||
BOOL bEnableFlag = FALSE; // フラグを立てるかどうか
|
BOOL bEnableFlag = FALSE; // フラグを立てるかどうか
|
||||||
|
ROM_Header rh;
|
||||||
|
u16 h_crc = 0;
|
||||||
|
|
||||||
printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" );
|
printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" );
|
||||||
printf( " ManuSkipFlagTool [%s-%s]\n", SDK_REVISION, IPL_REVISION );
|
printf( " ManuSkipFlagTool [%s-%s]\n", SDK_REVISION, IPL_REVISION );
|
||||||
printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" );
|
printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" );
|
||||||
@ -202,6 +204,22 @@ int main(int argc, char *argv[])
|
|||||||
goto FINALIZE;
|
goto FINALIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SRLかどうかのチェック
|
||||||
|
fseek( context.ifp, 0, SEEK_SET );
|
||||||
|
if( sizeof(ROM_Header) != fread( &rh, 1, sizeof(ROM_Header), context.ifp ) )
|
||||||
|
{
|
||||||
|
printf( "\n*** Error: Failed to read the ROM Header. ***\n" );
|
||||||
|
bResult = FALSE;
|
||||||
|
goto FINALIZE;
|
||||||
|
}
|
||||||
|
h_crc = CalcCRC16( CRC16_INIT_VALUE, (u8*)&rh, CALC_CRC16_SIZE ); // ヘッダCRCがおかしいとき不正ROMとみなす
|
||||||
|
if( h_crc != rh.s.header_crc16 )
|
||||||
|
{
|
||||||
|
printf( "\n*** Error: Invalid header CRC. ***\n" );
|
||||||
|
bResult = FALSE;
|
||||||
|
goto FINALIZE;
|
||||||
|
}
|
||||||
|
|
||||||
// ファイルコピー
|
// ファイルコピー
|
||||||
if( !CopyFile( context.ofp, context.ifp ) )
|
if( !CopyFile( context.ofp, context.ifp ) )
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user