FakeromHeaderの機能制限版から-Nオプション削除。NTRアプリのときにはエラーになるように修正。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2902 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
nishikawa_takeshi 2009-08-20 11:45:17 +00:00
parent e3349fb239
commit 09ef4fb736

View File

@ -107,10 +107,10 @@ void usage()
printf( " input_file : a ROM data file (generated by makerom.TWL).\n" ); printf( " input_file : a ROM data file (generated by makerom.TWL).\n" );
printf( " output_file : a destination file.\n" ); printf( " output_file : a destination file.\n" );
#else #else
printf( "Usage: fakeRomHeader.exe input_file output_file new_version\n" ); printf( "Usage: RomVersionChanger.exe input_file output_file new_ROM_version\n" );
printf( " input_file : a ROM data file (generated by makerom.TWL).\n" ); printf( " input_file : a source ROM file.\n" );
printf( " output_file : a destination file.\n" ); printf( " output_file : a destination ROM file.\n" );
printf( " ROM_version : a new ROM version.\n" ); printf( " new_ROM_version : a new ROM version.\n" );
#endif #endif
printf( "\nOption:\n" ); printf( "\nOption:\n" );
printf( "-h : print help only.\n" ); printf( "-h : print help only.\n" );
@ -122,8 +122,8 @@ void usage()
printf( "-m : [Only NTR limited ROM] Rom speed type replace 1TROM from MROM.\n" ); printf( "-m : [Only NTR limited ROM] Rom speed type replace 1TROM from MROM.\n" );
printf( "-D : assert a disable flag of debugger alalysis.\n" ); printf( "-D : assert a disable flag of debugger alalysis.\n" );
printf( "-c : assert a check(inspection) card flag.\n" ); printf( "-c : assert a check(inspection) card flag.\n" );
#endif
printf( "-N : skip appending signature [using for NTR limited ROM]" ); printf( "-N : skip appending signature [using for NTR limited ROM]" );
#endif
printf( "-f : force to overwrite a output_file.\n" ); printf( "-f : force to overwrite a output_file.\n" );
printf( "-----------------------------------------------------------------------------\n" ); printf( "-----------------------------------------------------------------------------\n" );
} }
@ -154,7 +154,7 @@ int main(int argc, char *argv[])
#ifdef FOR_RED #ifdef FOR_RED
while( (opt = getopt(argc, argv, "hpsdmv:DcfN")) >= 0 ) while( (opt = getopt(argc, argv, "hpsdmv:DcfN")) >= 0 )
#endif #endif
while( (opt = getopt(argc, argv, "hfN")) >= 0 ) while( (opt = getopt(argc, argv, "hf")) >= 0 )
{ {
switch( opt ) switch( opt )
{ {
@ -192,11 +192,11 @@ int main(int argc, char *argv[])
case 'c': case 'c':
context.bCheckCard = TRUE; context.bCheckCard = TRUE;
break; break;
#endif
case 'N': case 'N':
context.bNTR = TRUE; context.bNTR = TRUE;
break; break;
#endif
case 'f': case 'f':
bForceOverwrite = TRUE; bForceOverwrite = TRUE;
break; break;
@ -334,18 +334,23 @@ static BOOL iMain( SContext *pContext )
#ifndef FOR_RED #ifndef FOR_RED
// 署名の検証 // 署名の検証
if( !(pContext->bNTR) ) if( !DecryptSignRomHeader(&rh) )
{ {
if( !DecryptSignRomHeader(&rh) ) printf( "Decrypt Sign: Failed\n" );
{ return FALSE;
printf( "Decrypt Sign: Failed\n" );
return FALSE;
}
printf( "Decrypt Sign: Succeeded\n" );
} }
else if( rh.s.platform_code == PLATFORM_CODE_NTR ) printf( "Decrypt Sign: Succeeded\n" );
// NTRのときエラー(よくありそうなので仰々しく出力)
if( rh.s.platform_code == PLATFORM_CODE_NTR )
{ {
printf( "\n*** Error: required -N option for NTR Limited application. ***\n" ); printf("\n");
printf("******************** Error *******************\n");
printf("* *\n");
printf("* NTR Limited tytle is not supported. *\n");
printf("* *\n");
printf("************************************************\n");
printf("\n");
return FALSE; return FALSE;
} }
@ -362,20 +367,8 @@ static BOOL iMain( SContext *pContext )
printf("************************************************\n"); printf("************************************************\n");
printf("\n"); printf("\n");
} }
printf("Initial Code: %c%c%c%c\n",
// NTRÌÆ«à”O̽ߌx<C592><78> rh.s.game_code[0], rh.s.game_code[1], rh.s.game_code[2], rh.s.game_code[3]);
if( rh.s.platform_code == PLATFORM_CODE_NTR )
{
printf("\n");
printf("******************** Warning *******************\n");
printf("* *\n");
printf("* Platform is NTR Limited. *\n");
printf("* *\n");
printf("* Clone-boot application is not supported. *\n");
printf("* *\n");
printf("************************************************\n");
printf("\n");
}
#endif //#ifndef FOR_RED #endif //#ifndef FOR_RED
// ROMヘッダをいじる // ROMヘッダをいじる
@ -451,7 +444,9 @@ static BOOL iMain( SContext *pContext )
} }
// ヘッダCRC計算 // ヘッダCRC計算
printf("Header CRC: 0x%04X -> ", rh.s.header_crc16);
rh.s.header_crc16 = CalcCRC16( CRC16_INIT_VALUE, (u8*)&rh, CALC_CRC16_SIZE ); rh.s.header_crc16 = CalcCRC16( CRC16_INIT_VALUE, (u8*)&rh, CALC_CRC16_SIZE );
printf("0x%04X\n", rh.s.header_crc16);
// 再署名 // 再署名
if( !(pContext->bMROM) && !(pContext->bNTR) ) // NTR専用オプションのときは署名しない if( !(pContext->bMROM) && !(pContext->bNTR) ) // NTR専用オプションのときは署名しない