From 7ca072e953bf17aa73c271504ffc0cf899f029ca Mon Sep 17 00:00:00 2001 From: nishikawa_takeshi Date: Mon, 29 Jun 2009 07:08:41 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=8A=E3=83=BC=E3=81=AE=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E6=95=B0=E3=81=AE=E8=A8=88=E7=AE=97=E3=81=8C?= =?UTF-8?q?=E3=81=8A=E3=81=8B=E3=81=97=E3=81=8B=E3=81=A3=E3=81=9F=E7=82=B9?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@327 7061adef-622a-194b-ae81-725974e89856 --- .../BannerForcefulInserter.bat | 2 +- build/tools/BannerForcefulInserter/main.c | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build/tools/BannerForcefulInserter/BannerForcefulInserter.bat b/build/tools/BannerForcefulInserter/BannerForcefulInserter.bat index dd1107f..568d7e7 100644 --- a/build/tools/BannerForcefulInserter/BannerForcefulInserter.bat +++ b/build/tools/BannerForcefulInserter/BannerForcefulInserter.bat @@ -81,7 +81,7 @@ if not exist "%input_rom%" ( rem 出力パス set output_banner_srl_short=%~n1.banner.srl -set output_dir=%~d1%~p1%~n1.master.out\ +set output_dir=%~d1%~p1%~n1.banner.out\ if %light_mode%=="YES" ( set output_dir=%~d1%~p1%\ ) diff --git a/build/tools/BannerForcefulInserter/main.c b/build/tools/BannerForcefulInserter/main.c index 5a524bb..ac77e05 100644 --- a/build/tools/BannerForcefulInserter/main.c +++ b/build/tools/BannerForcefulInserter/main.c @@ -282,21 +282,32 @@ static BOOL iMain( SContext *pContext ) } printf("InitialCode : %c%c%c%c\n", rh.s.game_code[0], rh.s.game_code[1], rh.s.game_code[2], rh.s.game_code[3]); + // バナーサイズを計算 + fseek(pContext->banner_fp, 0, SEEK_END); + banner_size = ftell(pContext->banner_fp); + // バナー用のページをファイルの末尾に追加する { - int filesize, pagenum, i; + int filesize, ifp_pages, banner_pages, i; + + // 入力ファイルの格納に必要なページ数を計算 fseek(pContext->ifp, 0, SEEK_END); filesize = ftell(pContext->ifp); - pagenum = filesize / CARD_PAGE_SIZE; + ifp_pages = filesize / CARD_PAGE_SIZE; if( filesize % CARD_PAGE_SIZE ) // 中途半端なサイズのときページを埋めてそのあとにページを追加したい { - pagenum++; + ifp_pages++; + } + + // バナーの格納に必要なページ数を計算 + banner_pages = banner_size / CARD_PAGE_SIZE; + if( banner_size / CARD_PAGE_SIZE ) + { + banner_pages++; } - pagenum++; // バナー用のページ - // ページ数だけファイルを0クリア - for(i=0; i < pagenum; i++ ) + for(i=0; i < (ifp_pages+banner_pages); i++ ) { u8 page[CARD_PAGE_SIZE]; memset( page, 0, CARD_PAGE_SIZE ); @@ -306,7 +317,7 @@ static BOOL iMain( SContext *pContext ) return FALSE; } } - append_banner_offset = (pagenum-1)*CARD_PAGE_SIZE; // バナーを入れる場所 + append_banner_offset = ifp_pages*CARD_PAGE_SIZE; // バナーを入れる場所 } // ファイルコピー @@ -317,8 +328,6 @@ static BOOL iMain( SContext *pContext ) } // バナーを読み込む - fseek(pContext->banner_fp, 0, SEEK_END); - banner_size = ftell(pContext->banner_fp); banner_buf = (u8*)malloc(banner_size); if( !banner_buf ) {