mirror of
https://github.com/rvtr/TwlToolsRED.git
synced 2025-10-31 06:41:18 -04:00
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@386 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
b720f43691
commit
fb98fa96f8
@ -8,6 +8,16 @@
|
|||||||
#define AES_KEY_BIT_LEN 256
|
#define AES_KEY_BIT_LEN 256
|
||||||
#define AES_KEY_BYTE_LEN (AES_KEY_BIT_LEN/8)
|
#define AES_KEY_BYTE_LEN (AES_KEY_BIT_LEN/8)
|
||||||
|
|
||||||
|
static u8 my_sign_aes_key[AES_KEY_BYTE_LEN] = {
|
||||||
|
0x02,0xB6,0x01,0xD8,0x01,0x80,0x01,0x77,0xB4,0x01,0xCB,0x01,0xBD,0x5F,0x18,0x0F,
|
||||||
|
0xF6,0x39,0x9C,0xC6,0x90,0xAC,0xC1,0x0D,0x03,0x74,0x6E,0x8D,0xD1,0xBA,0x37,0x46
|
||||||
|
};
|
||||||
|
|
||||||
|
static u8 my_sign_aes_iv[AES_BLOCK_SIZE] = {
|
||||||
|
0xC3,0x85,0x93,0xFE,0xA8,0x2D,0xBF,0xFB,0xED,0x42,0xE0,0x42,0xFD,0x17,0x04,0xB0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static BOOL my_sign_check(MY_SIGN_SIGNATURE *encrypted_sign, u8 *buf, int buf_size)
|
static BOOL my_sign_check(MY_SIGN_SIGNATURE *encrypted_sign, u8 *buf, int buf_size)
|
||||||
{
|
{
|
||||||
@ -113,9 +123,6 @@ BOOL my_sign_FS_OpenFile(MY_SIGN_File *msfile, char *path)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OS_TPrintf("hash offset = %d\n",offsetof(MY_SIGN_SIGNATURE, hash));
|
|
||||||
|
|
||||||
|
|
||||||
RsaTestInit();
|
RsaTestInit();
|
||||||
|
|
||||||
FS_InitFile(&(msfile->f));
|
FS_InitFile(&(msfile->f));
|
||||||
@ -229,32 +236,13 @@ int my_sign_FS_ReadFile(MY_SIGN_File *msfile, u8 *buf, int buf_size)
|
|||||||
u8 *user_buf_ptr;
|
u8 *user_buf_ptr;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
int readlen;
|
int readlen;
|
||||||
|
int temp_size;
|
||||||
|
BOOL cache_valid_flag;
|
||||||
|
|
||||||
if( msfile->open_flag != TRUE ) {
|
if( msfile->open_flag != TRUE ) {
|
||||||
return -1; /* error */
|
return -1; /* error */
|
||||||
}
|
}
|
||||||
|
|
||||||
// msfile->pos = 0; /* original file pos */
|
|
||||||
// MY_SIGN_BLOCK_SIZE
|
|
||||||
/*
|
|
||||||
typedef struct {
|
|
||||||
u32 magic_code;
|
|
||||||
u32 org_file_size;
|
|
||||||
u32 num_of_block;
|
|
||||||
u32 file_offset_L2_sign_table;
|
|
||||||
u32 file_offset_data_block;
|
|
||||||
u32 dummy[3];
|
|
||||||
MY_SIGN_SIGNATURE L2_sign;
|
|
||||||
} MY_SIGN_HEADER;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// header.file_offset_data_block;
|
|
||||||
|
|
||||||
|
|
||||||
// OS_TPrintf("%s %d\n",__FUNCTION__, __LINE__);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
user_buf_size = buf_size;
|
user_buf_size = buf_size;
|
||||||
user_buf_ptr = buf;
|
user_buf_ptr = buf;
|
||||||
|
|
||||||
@ -262,79 +250,97 @@ int my_sign_FS_ReadFile(MY_SIGN_File *msfile, u8 *buf, int buf_size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while( user_buf_size > 0 ) {
|
||||||
|
block_no = msfile->pos / MY_SIGN_BLOCK_SIZE;
|
||||||
|
block_buf_out_pos = msfile->pos % MY_SIGN_BLOCK_SIZE;
|
||||||
|
|
||||||
loop_0:
|
if( block_no >= (int)msfile->header.num_of_block ) {
|
||||||
|
OS_TPrintf("%s %d pos = %d block_no = %d\n",__FUNCTION__, __LINE__,msfile->pos, block_no);
|
||||||
block_no = msfile->pos / MY_SIGN_BLOCK_SIZE;
|
|
||||||
block_buf_out_pos = msfile->pos % MY_SIGN_BLOCK_SIZE;
|
|
||||||
|
|
||||||
if( block_no >= (int)msfile->header.num_of_block ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// OS_TPrintf("%s %d pos = %d block_no = %d\n",__FUNCTION__, __LINE__,msfile->pos, block_no);
|
|
||||||
|
|
||||||
|
|
||||||
enc_file_pos = (int)msfile->header.file_offset_data_block + block_no * MY_SIGN_BLOCK_SIZE;
|
|
||||||
if( FALSE == FS_SeekFile(&(msfile->f), enc_file_pos , FS_SEEK_SET) ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
readlen = FS_ReadFile(&(msfile->f), msfile->block_buf_in, MY_SIGN_BLOCK_SIZE);
|
|
||||||
if( readlen != MY_SIGN_BLOCK_SIZE ) {
|
|
||||||
OS_TPrintf("%s %d Failed read File readlen=%d\n",__FUNCTION__, __LINE__, readlen);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
L2_sign_table_temp = msfile->L2_sign_table + block_no;
|
|
||||||
|
|
||||||
/* データブロックの署名チェック */
|
|
||||||
if( FALSE == my_sign_check( L2_sign_table_temp, msfile->block_buf_in, MY_SIGN_BLOCK_SIZE) ) {
|
|
||||||
OS_TPrintf("Data Hash check Error!\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* AESキーのセット */
|
|
||||||
for( i = 0 ; i < AES_KEY_BYTE_LEN ; i++ ) {
|
|
||||||
aes_key_buf[i] = (u8)i;
|
|
||||||
}
|
|
||||||
AES_set_decrypt_key(aes_key_buf, AES_KEY_BIT_LEN, &aes_key);
|
|
||||||
|
|
||||||
for( i = 0 ; i < AES_BLOCK_SIZE ; i++ ) {
|
|
||||||
aes_iv[i] = (u8)i;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(msfile->block_buf_out, 0 , MY_SIGN_BLOCK_SIZE);
|
|
||||||
|
|
||||||
/* AES復号化 */
|
|
||||||
for( i = 0 ; i < (MY_SIGN_BLOCK_SIZE / AES_BLOCK_SIZE) ; i++ ) {
|
|
||||||
AES_cbc_encrypt( &(msfile->block_buf_in[AES_BLOCK_SIZE*i]), &(msfile->block_buf_out[AES_BLOCK_SIZE*i]),
|
|
||||||
AES_BLOCK_SIZE, &aes_key, aes_iv, AES_DECRYPT );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// block_no
|
|
||||||
while( user_buf_size ) {
|
|
||||||
if( msfile->pos >= (int)msfile->header.org_file_size ) {
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if( block_buf_out_pos >= MY_SIGN_BLOCK_SIZE ) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*user_buf_ptr++ = msfile->block_buf_out[block_buf_out_pos];
|
|
||||||
block_buf_out_pos++;
|
// OS_TPrintf("%s %d pos = %d block_no = %d\n",__FUNCTION__, __LINE__,msfile->pos, block_no);
|
||||||
msfile->pos++;
|
|
||||||
user_buf_size--;
|
enc_file_pos = (int)msfile->header.file_offset_data_block + block_no * MY_SIGN_BLOCK_SIZE;
|
||||||
num++;
|
|
||||||
}
|
cache_valid_flag = FALSE;
|
||||||
if( user_buf_size > 0 ) {
|
if( msfile->now_cache == TRUE ) {
|
||||||
goto loop_0;
|
if( msfile->cache_msfile == (void *)msfile ) {
|
||||||
|
if( msfile->cache_block_no == block_no ) {
|
||||||
|
cache_valid_flag = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cache_valid_flag == FALSE ) {
|
||||||
|
if( FALSE == FS_SeekFile(&(msfile->f), enc_file_pos , FS_SEEK_SET) ) {
|
||||||
|
OS_TPrintf("%s %d Failed seek File pos=%d\n",__FUNCTION__, __LINE__, enc_file_pos );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
readlen = FS_ReadFile(&(msfile->f), msfile->block_buf_in, MY_SIGN_BLOCK_SIZE);
|
||||||
|
if( readlen != MY_SIGN_BLOCK_SIZE ) {
|
||||||
|
OS_TPrintf("%s %d Failed read File readlen=%d\n",__FUNCTION__, __LINE__, readlen);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
L2_sign_table_temp = msfile->L2_sign_table + block_no;
|
||||||
|
|
||||||
|
/* データブロックの署名チェック */
|
||||||
|
if( FALSE == my_sign_check( L2_sign_table_temp, msfile->block_buf_in, MY_SIGN_BLOCK_SIZE) ) {
|
||||||
|
OS_TPrintf("Data Hash check Error!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AESキーのセット */
|
||||||
|
#if 1
|
||||||
|
for( i = 0 ; i < AES_KEY_BYTE_LEN ; i++ ) {
|
||||||
|
aes_key_buf[i] = my_sign_aes_key[i];
|
||||||
|
}
|
||||||
|
for( i = 0 ; i < AES_BLOCK_SIZE ; i++ ) {
|
||||||
|
aes_iv[i] = my_sign_aes_iv[i];
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
for( i = 0 ; i < AES_KEY_BYTE_LEN ; i++ ) {
|
||||||
|
aes_key_buf[i] = (u8)i;
|
||||||
|
}
|
||||||
|
for( i = 0 ; i < AES_BLOCK_SIZE ; i++ ) {
|
||||||
|
aes_iv[i] = (u8)i;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
AES_set_decrypt_key(aes_key_buf, AES_KEY_BIT_LEN, &aes_key);
|
||||||
|
|
||||||
|
memset(msfile->block_buf_out, 0 , MY_SIGN_BLOCK_SIZE);
|
||||||
|
|
||||||
|
/* AES復号化 */
|
||||||
|
for( i = 0 ; i < (MY_SIGN_BLOCK_SIZE / AES_BLOCK_SIZE) ; i++ ) {
|
||||||
|
AES_cbc_encrypt( &(msfile->block_buf_in[AES_BLOCK_SIZE*i]), &(msfile->block_buf_out[AES_BLOCK_SIZE*i]),
|
||||||
|
AES_BLOCK_SIZE, &aes_key, aes_iv, AES_DECRYPT );
|
||||||
|
|
||||||
|
}
|
||||||
|
msfile->now_cache = TRUE;
|
||||||
|
msfile->cache_msfile = (void *)msfile;
|
||||||
|
msfile->cache_block_no = block_no;
|
||||||
|
// OS_TPrintf("%s %d cache change\n",__FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
temp_size = (MY_SIGN_BLOCK_SIZE - block_buf_out_pos);
|
||||||
|
if( (msfile->pos + temp_size) >= (int)msfile->header.org_file_size ) {
|
||||||
|
temp_size = (int)msfile->header.org_file_size - msfile->pos;
|
||||||
|
}
|
||||||
|
if( temp_size > user_buf_size ) {
|
||||||
|
temp_size = user_buf_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(user_buf_ptr, &(msfile->block_buf_out[block_buf_out_pos]), (u32)temp_size );
|
||||||
|
user_buf_ptr += temp_size;
|
||||||
|
block_buf_out_pos += temp_size;
|
||||||
|
msfile->pos += temp_size;
|
||||||
|
user_buf_size -= temp_size;
|
||||||
|
num += temp_size;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// OS_TPrintf("%s %d num=%d\n",__FUNCTION__, __LINE__,num);
|
||||||
end:
|
end:
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,9 @@ typedef struct {
|
|||||||
MY_SIGN_HEADER header;
|
MY_SIGN_HEADER header;
|
||||||
u8 *block_buf_in;
|
u8 *block_buf_in;
|
||||||
u8 *block_buf_out;
|
u8 *block_buf_out;
|
||||||
|
BOOL now_cache;
|
||||||
|
void *cache_msfile;
|
||||||
|
int cache_block_no;
|
||||||
} MY_SIGN_File;
|
} MY_SIGN_File;
|
||||||
|
|
||||||
BOOL my_sign_FS_OpenFile(MY_SIGN_File *msfile, char *path);
|
BOOL my_sign_FS_OpenFile(MY_SIGN_File *msfile, char *path);
|
||||||
|
|||||||
@ -475,6 +475,9 @@ static BOOL pre_install_load_sd_file(char *path, FSFile *log_fd)
|
|||||||
int temp_filename_count;
|
int temp_filename_count;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
|
|
||||||
|
OS_TPrintf("%s %d path=%s\n", __FUNCTION__,__LINE__,path);
|
||||||
|
|
||||||
my_sign_FS_InitFile(&file);
|
my_sign_FS_InitFile(&file);
|
||||||
|
|
||||||
bSuccess = my_sign_FS_OpenFile(&file, path);
|
bSuccess = my_sign_FS_OpenFile(&file, path);
|
||||||
|
|||||||
@ -221,6 +221,7 @@ static int Check_User_Titles_ETicket_Only(void)
|
|||||||
OS_TPrintf(" usr.:%3d:0x%llx %s common\n", i, id, game_code);
|
OS_TPrintf(" usr.:%3d:0x%llx %s common\n", i, id, game_code);
|
||||||
array_eticket_only_titles[user_title_count] = id;
|
array_eticket_only_titles[user_title_count] = id;
|
||||||
#if 0
|
#if 0
|
||||||
|
/* 失敗するに決まってる、NAM_ReadTitleInfoが失敗するので。 */
|
||||||
if( TRUE == pre_install_get_version(id, &version) ) {
|
if( TRUE == pre_install_get_version(id, &version) ) {
|
||||||
array_eticket_only_titles_version[user_title_count] = (int)version;
|
array_eticket_only_titles_version[user_title_count] = (int)version;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,8 @@ PACKAGE = cryptopc
|
|||||||
|
|
||||||
OPENSSL_DIR = c:/OpenSSL/openssl-1.0.0-beta2
|
OPENSSL_DIR = c:/OpenSSL/openssl-1.0.0-beta2
|
||||||
|
|
||||||
# SRCS = main.c
|
SRCS = main.c
|
||||||
SRCS = m.c
|
# SRCS = m.c
|
||||||
|
|
||||||
HEADS = my_sign.h
|
HEADS = my_sign.h
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,16 @@ typedef unsigned long long u64;
|
|||||||
static FILE *fp_key = NULL;
|
static FILE *fp_key = NULL;
|
||||||
static int rsaSize;
|
static int rsaSize;
|
||||||
|
|
||||||
|
static u8 my_sign_aes_key[AES_KEY_BYTE_LEN] = {
|
||||||
|
0x02,0xB6,0x01,0xD8,0x01,0x80,0x01,0x77,0xB4,0x01,0xCB,0x01,0xBD,0x5F,0x18,0x0F,
|
||||||
|
0xF6,0x39,0x9C,0xC6,0x90,0xAC,0xC1,0x0D,0x03,0x74,0x6E,0x8D,0xD1,0xBA,0x37,0x46
|
||||||
|
};
|
||||||
|
|
||||||
|
static u8 my_sign_aes_iv[AES_BLOCK_SIZE] = {
|
||||||
|
0xC3,0x85,0x93,0xFE,0xA8,0x2D,0xBF,0xFB,0xED,0x42,0xE0,0x42,0xFD,0x17,0x04,0xB0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static int my_sign_make(MY_SIGN_SIGNATURE *encrypted_sign, u8 *buf, int buf_size)
|
static int my_sign_make(MY_SIGN_SIGNATURE *encrypted_sign, u8 *buf, int buf_size)
|
||||||
{
|
{
|
||||||
MY_SIGN_SIGNATURE temp_sign;
|
MY_SIGN_SIGNATURE temp_sign;
|
||||||
@ -331,13 +341,22 @@ int main(int ac, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
/* AESキーのセット */
|
/* AESキーのセット */
|
||||||
|
#if 1
|
||||||
|
for( i = 0 ; i < AES_KEY_BYTE_LEN ; i++ ) {
|
||||||
|
aes_key_buf[i] = my_sign_aes_key[i];
|
||||||
|
}
|
||||||
|
for( i = 0 ; i < AES_BLOCK_SIZE ; i++ ) {
|
||||||
|
aes_iv[i] = my_sign_aes_iv[i];
|
||||||
|
}
|
||||||
|
#else
|
||||||
for( i = 0 ; i < AES_KEY_BYTE_LEN ; i++ ) {
|
for( i = 0 ; i < AES_KEY_BYTE_LEN ; i++ ) {
|
||||||
aes_key_buf[i] = (u8)i;
|
aes_key_buf[i] = (u8)i;
|
||||||
}
|
}
|
||||||
AES_set_encrypt_key(aes_key_buf, AES_KEY_BIT_LEN, &aes_key);
|
|
||||||
for( i = 0 ; i < AES_BLOCK_SIZE ; i++ ) {
|
for( i = 0 ; i < AES_BLOCK_SIZE ; i++ ) {
|
||||||
aes_iv[i] = (u8)i;
|
aes_iv[i] = (u8)i;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
AES_set_encrypt_key(aes_key_buf, AES_KEY_BIT_LEN, &aes_key);
|
||||||
|
|
||||||
memset(block_buf_out, 0 , MY_SIGN_BLOCK_SIZE);
|
memset(block_buf_out, 0 , MY_SIGN_BLOCK_SIZE);
|
||||||
for( i = 0 ; i < (MY_SIGN_BLOCK_SIZE / AES_BLOCK_SIZE) ; i++ ) {
|
for( i = 0 ; i < (MY_SIGN_BLOCK_SIZE / AES_BLOCK_SIZE) ; i++ ) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
[ROM—p] make_tad_table.exe -dir . -o table_file.txt -var MAKEROM_TAD_ROMFILES -fdir tads -mk Makefile.inc
|
[ROM—p] make_tad_table.exe -dir . -o table_file.txt -var MAKEROM_TAD_ROMFILES -fdir tads -mk Makefile.inc
|
||||||
[SD—p] make_tad_table.exe -dir . -o table_file.txt -fdir tads_sd
|
[SD用] make_tad_table.exe -sd -dir . -o table_file.txt -fdir sdtads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -201,7 +201,7 @@ static write_tad_table_form(FILE *fp, u32 tid_hi, u32 tid_lo, char *filename)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void read_file_and_print_titleid( char *path , char *d_name, FILE *fp_out, FILE *fp_mk)
|
static void read_file_and_print_titleid( char *path , char *d_name, FILE *fp_out, FILE *fp_mk, BOOL is_sd )
|
||||||
{
|
{
|
||||||
FILE *fp_in = NULL;
|
FILE *fp_in = NULL;
|
||||||
TAD_INFO tad_info;
|
TAD_INFO tad_info;
|
||||||
@ -214,7 +214,8 @@ static void read_file_and_print_titleid( char *path , char *d_name, FILE *fp_out
|
|||||||
fprintf(stderr, "error: file open %s\n",path);
|
fprintf(stderr, "error: file open %s\n",path);
|
||||||
goto end_file;
|
goto end_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TADファイルかどうかチェック */
|
||||||
if( FALSE == read_tad_info(fp_in, &tad_info) ) {
|
if( FALSE == read_tad_info(fp_in, &tad_info) ) {
|
||||||
// fprintf(stderr, "error:%s %d\n",__FUNCTION__,__LINE__);
|
// fprintf(stderr, "error:%s %d\n",__FUNCTION__,__LINE__);
|
||||||
goto end_file;
|
goto end_file;
|
||||||
@ -239,13 +240,23 @@ static void read_file_and_print_titleid( char *path , char *d_name, FILE *fp_out
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( fp_out ) {
|
if( fp_out ) {
|
||||||
fprintf(fp_out, "0x%08x%08x, %d , %d , rom:/%s,\n", titleid_hi, titleid_lo, 0 , 0 , d_name);
|
if( is_sd == FALSE ) {
|
||||||
|
fprintf(fp_out, "0x%08x%08x, %d , %d , rom:/%s,\n", titleid_hi, titleid_lo, 0 , 0 , d_name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(fp_out, "0x%08x%08x, %d , %d , sdmc:/%s,\n", titleid_hi, titleid_lo, 0 , 0 , d_name);
|
||||||
|
}
|
||||||
if( fp_mk ) {
|
if( fp_mk ) {
|
||||||
fprintf(fp_mk, "\t\t%s \\\n", d_name);
|
fprintf(fp_mk, "\t\t%s \\\n", d_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("0x%08x%08x, %d , %d , rom:/%s,\n", titleid_hi, titleid_lo, 0 , 0 , d_name);
|
if( is_sd == FALSE ) {
|
||||||
|
printf("0x%08x%08x, %d , %d , rom:/%s,\n", titleid_hi, titleid_lo, 0 , 0 , d_name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("0x%08x%08x, %d , %d , sdmc:/%s,\n", titleid_hi, titleid_lo, 0 , 0 , d_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -278,6 +289,7 @@ int main(int argc, char **argv)
|
|||||||
BOOL mk_file_flag = FALSE;
|
BOOL mk_file_flag = FALSE;
|
||||||
BOOL var_name_flag = FALSE;
|
BOOL var_name_flag = FALSE;
|
||||||
BOOL file_dir_flag = FALSE;
|
BOOL file_dir_flag = FALSE;
|
||||||
|
BOOL sd_flag = FALSE;
|
||||||
|
|
||||||
char *prog;
|
char *prog;
|
||||||
int badops = 0;
|
int badops = 0;
|
||||||
@ -340,6 +352,9 @@ int main(int argc, char **argv)
|
|||||||
else if (strcmp(*argv,"-d") == 0 ) {
|
else if (strcmp(*argv,"-d") == 0 ) {
|
||||||
debug_print_flag = TRUE;
|
debug_print_flag = TRUE;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv,"-sd") == 0 ) {
|
||||||
|
sd_flag = TRUE;
|
||||||
|
}
|
||||||
else if ( !read_file_flag ) {
|
else if ( !read_file_flag ) {
|
||||||
infile = *argv;
|
infile = *argv;
|
||||||
read_file_flag = TRUE;
|
read_file_flag = TRUE;
|
||||||
@ -395,7 +410,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ディレクトリ中のTADファイルをリストにして表示する。 */
|
||||||
while( (dr = readdir(dir)) != NULL ) {
|
while( (dr = readdir(dir)) != NULL ) {
|
||||||
if (!strcmp(dr->d_name, ".") || !strcmp(dr->d_name, "..")) {
|
if (!strcmp(dr->d_name, ".") || !strcmp(dr->d_name, "..")) {
|
||||||
continue;
|
continue;
|
||||||
@ -425,11 +440,14 @@ int main(int argc, char **argv)
|
|||||||
if( file_dir_flag ) {
|
if( file_dir_flag ) {
|
||||||
strcpy( rom_file_full_path, file_dir);
|
strcpy( rom_file_full_path, file_dir);
|
||||||
strcat( rom_file_full_path, "/");
|
strcat( rom_file_full_path, "/");
|
||||||
|
if( sd_flag == TRUE ) {
|
||||||
|
strcat( rom_file_full_path, "en_");
|
||||||
|
}
|
||||||
strcat( rom_file_full_path, dr->d_name);
|
strcat( rom_file_full_path, dr->d_name);
|
||||||
read_file_and_print_titleid( full_path ,rom_file_full_path, fp_out , fp_mk );
|
read_file_and_print_titleid( full_path ,rom_file_full_path, fp_out , fp_mk , sd_flag);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
read_file_and_print_titleid( full_path ,dr->d_name, fp_out , fp_mk );
|
read_file_and_print_titleid( full_path ,dr->d_name, fp_out , fp_mk , sd_flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user