From ddb34e418b14a6f5aae4750133c1f7e5fec057c9 Mon Sep 17 00:00:00 2001 From: kamikawa Date: Thu, 27 Mar 2008 09:39:55 +0000 Subject: [PATCH] =?UTF-8?q?InstalledSoftBoxCount=20FreeSoftBoxCount=20?= =?UTF-8?q?=E3=81=AE=E5=AF=BE=E5=BF=9C=E4=BD=9C=E6=A5=AD=E3=82=92=E8=A1=8C?= =?UTF-8?q?=E3=81=84=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82=20FreeSoftBoxCoun?= =?UTF-8?q?t=E3=81=AB=E7=A9=BA=E3=81=8D=E3=81=8C=E7=84=A1=E3=81=84?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=AF=E3=82=A4=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82=20HWInfo?= =?UTF-8?q?=E3=81=AE=E5=89=8A=E9=99=A4=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=82=92=E3=81=AA=E3=81=8F=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=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/TwlIPL/trunk@984 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../ARM9.TWL/include/process_hw_info.h | 16 +++- .../NandInitializer/ARM9.TWL/src/main.c | 19 +++++ .../ARM9.TWL/src/process_auto.c | 2 + .../ARM9.TWL/src/process_format.c | 10 ++- .../ARM9.TWL/src/process_hw_info.c | 80 ++++++++++++------- .../ARM9.TWL/src/process_import.c | 21 ++++- 6 files changed, 114 insertions(+), 34 deletions(-) diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h index 0f9ff672..59a68f45 100644 --- a/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/include/process_hw_info.h @@ -11,8 +11,8 @@ in whole or in part, without the prior written consent of Nintendo. $Date:: $ - $Rev:$ - $Author:$ + $Rev$ + $Author$ *---------------------------------------------------------------------------*/ #ifndef PROCESS_HW_INFO_H_ @@ -42,6 +42,18 @@ void* HWInfoProcess2(void); void* HWInfoProcess3(void); void* HWInfoProcess4(void); +/*---------------------------------------------------------------------------* + Name: UpdateNandBoxCount + + Description: InstalledSoftBoxCount, FreeSoftBoxCount の値を + 現在のNANDの状態に合わせて更新します。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateNandBoxCount( void ); + /*===========================================================================*/ #ifdef __cplusplus diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c index 8d514aab..44a1f398 100644 --- a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/main.c @@ -28,6 +28,8 @@ #include "kami_pxi.h" #include "sd_event.h" #include "process_fade.h" +#include "hwi.h" + extern void HWInfoWriterInit( void ); /*---------------------------------------------------------------------------* @@ -116,6 +118,23 @@ TwlMain() #endif kamiFontPrintfConsole( CONSOLE_ORANGE, "+---------------------------+\n"); + // HWInfo関連の前準備 + switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain )) + { + case HWI_INIT_FAILURE: + kamiFontPrintfConsoleEx(CONSOLE_RED, "HWI_INIT() Failure!\n" ); + break; + case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, "[PRO Signature MODE]\n" ); + break; + case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, "[DEV Signature MODE]\n" ); + break; + case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: + kamiFontPrintfConsoleEx(CONSOLE_RED, "[No Signature MODE]\n" ); + break; + } + while (1) { kamiPadRead(); diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c index 57825fea..628584ae 100644 --- a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_auto.c @@ -153,7 +153,9 @@ void* AutoProcess2(void) kamiFontPrintf(3, 11, FONT_COLOR_BLACK, " WRITE ETICKET SIGN "); kamiFontPrintf(3, 13, FONT_COLOR_BLACK, " INPORT TAD FROM SD "); kamiFontPrintf(3, 15, FONT_COLOR_BLACK, " INPORT NANDFIRM FROM SD"); +#ifndef AUTO_FORMAT_MODE kamiFontPrintf(3, 22, FONT_COLOR_BLACK, " Button B : return to menu"); +#endif for (i=0;i #include #include +#include #include "kami_font.h" #include "kami_pxi.h" #include "process_topmenu.h" @@ -42,7 +43,7 @@ 定数定義 *---------------------------------------------------------------------------*/ -#define NUM_OF_MENU_SELECT 8 +#define NUM_OF_MENU_SELECT 7 #define DOT_OF_MENU_SPACE 16 #define CHAR_OF_MENU_SPACE 2 #define CURSOR_ORIGIN_X 32 @@ -94,7 +95,7 @@ static BOOL s_isReadTSD; static BOOL WriteHWInfoFile( u8 region ); static BOOL WriteHWNormalInfoFile( void ); static BOOL WriteHWSecureInfoFile( u8 region ); -static BOOL DeleteHWInfoFile( void ); +//static BOOL DeleteHWInfoFile( void ); const LCFGTWLHWNormalInfo *LCFG_THW_GetDefaultNormalInfo( void ); const LCFGTWLHWSecureInfo *LCFG_THW_GetDefaultSecureInfo( void ); @@ -117,7 +118,6 @@ const LCFGTWLHWSecureInfo *LCFG_THW_GetSecureInfo( void ); void* HWInfoProcess0(void) { - HwiInitResult initResult; int i; // 文字列全クリア @@ -141,10 +141,10 @@ void* HWInfoProcess0(void) kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "+--------------------+----+"); kamiFontPrintf(3, 17, FONT_COLOR_BLACK, "l REGION KOREA l l"); kamiFontPrintf(3, 18, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 19, FONT_COLOR_BLACK, "l DELETE l l"); +// kamiFontPrintf(3, 19, FONT_COLOR_BLACK, "l DELETE l l"); +// kamiFontPrintf(3, 20, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf(3, 19, FONT_COLOR_BLACK, "l RETURN l l"); kamiFontPrintf(3, 20, FONT_COLOR_BLACK, "+--------------------+----+"); - kamiFontPrintf(3, 21, FONT_COLOR_BLACK, "l RETURN l l"); - kamiFontPrintf(3, 22, FONT_COLOR_BLACK, "+--------------------+----+"); // 背景全クリア for (i=0;i<24;i++) @@ -160,24 +160,6 @@ void* HWInfoProcess0(void) // カーソル除外 SetCursorPos((u16)200, (u16)200); - // 前準備 - initResult = HWI_Init( OS_AllocFromMain, OS_FreeToMain ); - switch (initResult) - { - case HWI_INIT_FAILURE: - kamiFontPrintfConsoleEx(CONSOLE_RED, "HWI_INIT() Failure!\n" ); - break; - case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: - kamiFontPrintfConsoleEx(CONSOLE_ORANGE, "[PRO Signature MODE]\n" ); - break; - case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: - kamiFontPrintfConsoleEx(CONSOLE_ORANGE, "[DEV Signature MODE]\n" ); - break; - case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: - kamiFontPrintfConsoleEx(CONSOLE_RED, "[No Signature MODE]\n" ); - break; - } - FADE_IN_RETURN( HWInfoProcess1 ); } @@ -255,11 +237,11 @@ void* HWInfoProcess2(void) OS_TPrintf( "Write Start.\n" ); result = WriteHWInfoFile( (u8)sMenuSelectNo ); break; +// case 6: +// OS_TPrintf( "Delete start.\n" ); +// result = DeleteHWInfoFile(); +// break; case 6: - OS_TPrintf( "Delete start.\n" ); - result = DeleteHWInfoFile(); - break; - case 7: FADE_OUT_RETURN( TopmenuProcess0 ); } @@ -311,6 +293,7 @@ static BOOL WriteHWInfoFile( u8 region ) static const char *pMsgSignWriting = "Writing Sign File..."; static const char *pMsgSucceeded = "Success!\n"; static const char *pMsgFailed = "Failed!\n"; + u32 installedSoftBoxCount = 0; BOOL result = TRUE; // ノーマルファイルのライト @@ -344,6 +327,9 @@ static BOOL WriteHWInfoFile( u8 region ) } HWI_ModifyLanguage( region ); + + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + UpdateNandBoxCount(); return result; } @@ -390,3 +376,41 @@ static BOOL DeleteHWInfoFile( void ) return result; } + +/*---------------------------------------------------------------------------* + Name: UpdateNandBoxCount + + Description: InstalledSoftBoxCount, FreeSoftBoxCount の値を + 現在のNANDの状態に合わせて更新します。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +void UpdateNandBoxCount( void ) +{ + u32 installedSoftBoxCount; + u32 freeSoftBoxCount; + + // InstalledSoftBoxCount, FreeSoftBoxCount を数えなおす + installedSoftBoxCount = NAMUT_SearchInstalledSoftBoxCount(); + freeSoftBoxCount = LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - installedSoftBoxCount; + +// OS_Printf("installedSoftBoxCount = %d\n", installedSoftBoxCount); +// OS_Printf("freeSoftBoxCount = %d\n", freeSoftBoxCount); + + // LCFGライブラリの静的変数に対する更新 + LCFG_TSD_SetInstalledSoftBoxCount( (u8)installedSoftBoxCount ); + LCFG_TSD_SetFreeSoftBoxCount( (u8)freeSoftBoxCount ); + + // LCFGライブラリの静的変数の値をNANDに反映 + { + u8 *pBuffer = OS_Alloc( LCFG_WRITE_TEMP ); + if( pBuffer ) { + (void)LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + OS_Free( pBuffer ); + } + } +} + diff --git a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c index 04653bf9..656dd220 100644 --- a/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c +++ b/build/systemMenu_RED/NandInitializer/ARM9.TWL/src/process_import.c @@ -20,10 +20,13 @@ #include #include #include +#include +#include #include "kami_font.h" #include "kami_pxi.h" #include "process_topmenu.h" #include "process_import.h" +#include "process_hw_info.h" #include "process_eticket.h" #include "process_auto.h" #include "process_fade.h" @@ -675,6 +678,17 @@ static BOOL ImportTad(char* file_name, TadWriteOption option) } } + // NOT_LAUNCH_FLAG または DATA_ONLY_FLAG が立っていないタイトルの場合 + // freeSoftBoxCountに空きがなければインポートしない + if (!(titleInfo.titleId & (TITLE_ID_NOT_LAUNCH_FLAG_MASK | TITLE_ID_DATA_ONLY_FLAG_MASK))) + { + if (NAMUT_SearchInstalledSoftBoxCount() == LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX) + { + kamiFontPrintfConsole(1, "NAND FreeSoftBoxCount == 0"); + return FALSE; + } + } + // インポート開始フラグを立てる sNowImport = TRUE; @@ -698,14 +712,17 @@ static BOOL ImportTad(char* file_name, TadWriteOption option) if ( nam_result == NAM_OK ) { - kamiFontPrintfConsole(CONSOLE_ORANGE, "Import %s Sucess.\n", file_name ); + kamiFontPrintfConsole(CONSOLE_ORANGE, "Sucess!\n"); ret = TRUE; } else { - kamiFontPrintfConsole(1, "Import %s Fail.\n", file_name ); + kamiFontPrintfConsole(CONSOLE_RED, "Fail!\n"); } + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + UpdateNandBoxCount(); + return ret; }