diff --git a/build/tests/FakeRomHeader/Makefile b/build/tests/FakeRomHeader/Makefile index 24b9ea7c..892956ee 100644 --- a/build/tests/FakeRomHeader/Makefile +++ b/build/tests/FakeRomHeader/Makefile @@ -21,7 +21,7 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs -TARGETS = FakeRomHeader.exe +TARGETS = FakeRomHeader$(SUFFIX).exe SOURCES_C = main.c keys.c @@ -46,14 +46,18 @@ LIBDIGEST = $(ROOT)/build/tools/makerom.TWL/digest/lib/X86/libdigest_x86.a ifeq ($(KEY_LAUNCHER),TRUE) MACROS += -DKEY_LAUNCHER +SUFFIX = .launcher else ifeq ($(KEY_SECURE),TRUE) MACROS += -DKEY_SECURE +SUFFIX = .secure else ifeq ($(KEY_SYSTEM),TRUE) MACROS += -DKEY_SYSTEM +SUFFIX = .sys else MACROS += -DKEY_USER +SUFFIX = .user endif endif endif diff --git a/build/tests/FakeRomHeader/main.c b/build/tests/FakeRomHeader/main.c index 2fa286b3..52e95cd9 100644 --- a/build/tests/FakeRomHeader/main.c +++ b/build/tests/FakeRomHeader/main.c @@ -61,7 +61,9 @@ typedef struct _SContext BOOL bPlatform; BOOL bSignFlag; BOOL bDevFlag; - + BOOL bVerFlag; + int verNum; + FILE *ifp; FILE *ofp; } @@ -97,11 +99,12 @@ void usage() printf( " input_file : a ROM data file (generated by makerom.TWL).\n" ); printf( " output_file : a destination file.\n" ); printf( "\nOption:\n" ); - printf( "-h : print help only.\n" ); - printf( "-p : write invalid platform code in a ROM Header.\n" ); - printf( "-s : negate flag for the signature in a ROM Header.\n" ); - printf( "-d : negate a new developer encrypt flag, and assert an old one.\n" ); - printf( "-----------------------------------------------------------------------------\n" ); + printf( "-h : print help only.\n" ); + printf( "-p : write invalid platform code in a ROM Header.\n" ); + printf( "-s : negate flag for the signature in a ROM Header.\n" ); + printf( "-d : negate a new developer encrypt flag, and assert an old one.\n" ); + printf( "-v NUM: change ROM version in a ROM Header.\n" ); + printf( "-----------------------------------------------------------------------------\n" ); } int main(int argc, char *argv[]) @@ -122,7 +125,7 @@ int main(int argc, char *argv[]) memset( &context, 0, sizeof(SContext) ); // オプション - while( (opt = getopt(argc, argv, "hpsd")) >= 0 ) + while( (opt = getopt(argc, argv, "hpsdv:")) >= 0 ) { switch( opt ) { @@ -143,6 +146,11 @@ int main(int argc, char *argv[]) context.bDevFlag = TRUE; break; + case 'v': + context.bVerFlag = TRUE; + context.verNum = atoi(optarg); + break; + default: // オプション引数が指定されていないときにも実行される usage(); fprintf( stdout, "error: illegal option\n" ); @@ -269,6 +277,12 @@ static BOOL iMain( SContext *pContext ) rh.s.developer_encrypt_old = 0x1; rh.s.exFlags.developer_encrypt = 0x0; } + + if( pContext->bVerFlag ) + { + printf( "ROM version: 0x%02x -> 0x%02x\n", rh.s.rom_version, pContext->verNum ); + rh.s.rom_version = pContext->verNum; + } } // ヘッダCRC計算 diff --git a/tools/bin/FakeRomHeader.launcher.exe b/tools/bin/FakeRomHeader.launcher.exe new file mode 100755 index 00000000..a707d7c8 Binary files /dev/null and b/tools/bin/FakeRomHeader.launcher.exe differ diff --git a/tools/bin/FakeRomHeader.secure.exe b/tools/bin/FakeRomHeader.secure.exe new file mode 100755 index 00000000..bf4abcba Binary files /dev/null and b/tools/bin/FakeRomHeader.secure.exe differ diff --git a/tools/bin/FakeRomHeader.sys.exe b/tools/bin/FakeRomHeader.sys.exe new file mode 100755 index 00000000..fc4c9105 Binary files /dev/null and b/tools/bin/FakeRomHeader.sys.exe differ diff --git a/tools/bin/FakeRomHeader.user.exe b/tools/bin/FakeRomHeader.user.exe new file mode 100755 index 00000000..015b3552 Binary files /dev/null and b/tools/bin/FakeRomHeader.user.exe differ