util_menuAppManagerにてNANDタイトル情報を取得する際に、InstalledSoftBoxCountおよびFreeSoftBoxCountを正しい値に修正する処理を追加

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2118 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2008-08-06 08:01:19 +00:00
parent f818fd7e7d
commit 7030e95953

View File

@ -40,6 +40,8 @@ static void AMN_unlockSubBannerFileBuffer();
static u32 AMN_getBannerAnimeCRC(const BannerAnime* pAnime); static u32 AMN_getBannerAnimeCRC(const BannerAnime* pAnime);
static BOOL AMN_checkAndReplaceBannerAnime(s32 index); static BOOL AMN_checkAndReplaceBannerAnime(s32 index);
static void AMNi_updateFreeBoxCount( u8 count );
static vu8 sThreadStarted; static vu8 sThreadStarted;
static vu8 sReadCancelFlag; // とりあえず無視。 static vu8 sReadCancelFlag; // とりあえず無視。
static vu8 sNandTitleListReady; static vu8 sNandTitleListReady;
@ -609,6 +611,7 @@ static void AMN_initNandTitleList_()
s32 ret; s32 ret;
s32 l; s32 l;
NAMTitleId* pNandAllTitleIDList = NULL; NAMTitleId* pNandAllTitleIDList = NULL;
u8 count_valid_app_for_launcher = 0;
// インポートされているタイトルの取得 // インポートされているタイトルの取得
sNandAllTitleListLength = NAM_GetNumTitles(); sNandAllTitleListLength = NAM_GetNumTitles();
@ -646,9 +649,16 @@ static void AMN_initNandTitleList_()
AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], TRUE ); AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], TRUE );
// 本体設定の場合、アプリマネージャ用indexは飛び飛びになったり、ForSetting()が返す値(個数)より大きくなるので // 本体設定の場合、アプリマネージャ用indexは飛び飛びになったり、ForSetting()が返す値(個数)より大きくなるので
// getNandTitleListLengthForSetting()は用意しない。 // getNandTitleListLengthForSetting()は用意しない。
// FreeboxCount更新のためのカウンタ
count_valid_app_for_launcher++;
} }
} }
// FreeboxCount更新
AMNi_updateFreeBoxCount( count_valid_app_for_launcher );
// ローンチ対象でないタイトルの情報の取得 // ローンチ対象でないタイトルの情報の取得
for (l = 0; l < sNandAllTitleListLength; l++) { for (l = 0; l < sNandAllTitleListLength; l++) {
if (!AMN_isTitleIdValidForLauncher(pNandAllTitleIDList[l])) { if (!AMN_isTitleIdValidForLauncher(pNandAllTitleIDList[l])) {
@ -667,6 +677,7 @@ static void AMN_initNandTitleRomHeaderShortList_()
s32 ret; s32 ret;
s32 l; s32 l;
NAMTitleId* pNandAllTitleIDList = NULL; NAMTitleId* pNandAllTitleIDList = NULL;
u8 count_valid_app_for_launcher = 0;
// インポートされているタイトルの取得 // インポートされているタイトルの取得
sNandAllTitleListLength = NAM_GetNumTitles(); sNandAllTitleListLength = NAM_GetNumTitles();
@ -697,7 +708,14 @@ static void AMN_initNandTitleRomHeaderShortList_()
// タイトルの情報(ヘッダのみ)の取得 // タイトルの情報(ヘッダのみ)の取得
for (l = 0; l < sNandAllTitleListLength; l++) { for (l = 0; l < sNandAllTitleListLength; l++) {
AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], FALSE ); AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], FALSE );
if (AMN_isTitleIdValidForLauncher(pNandAllTitleIDList[l])) {
// FreeboxCount更新のためのカウンタ
count_valid_app_for_launcher++;
} }
}
// FreeboxCount更新
AMNi_updateFreeBoxCount( count_valid_app_for_launcher );
if (pNandAllTitleIDList) { if (pNandAllTitleIDList) {
AMNi_Free( pNandAllTitleIDList ); AMNi_Free( pNandAllTitleIDList );
@ -1205,6 +1223,58 @@ BOOL AMN_isIndexValidForSetting(s32 index)
return FALSE; return FALSE;
} }
static void AMNi_updateFreeBoxCount( u8 count )
{
u32 installed;
u8 free;
BOOL changed = FALSE;
u8 *pBuffer;
BOOL retval = TRUE;
installed = LCFG_TSD_GetInstalledSoftBoxCount();
free = LCFG_TSD_GetFreeSoftBoxCount();
if( count > LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX )
{
count = LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX;
}
OS_TPrintf( "AMNi_updateFreeBoxCount : Install:%d, Free:%d, LCFG_Install:%d, LCFG_Free:%d, MAX:%d\n",
count, LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - count, installed, free, LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX );
if( (u8)installed != count )
{
LCFG_TSD_SetInstalledSoftBoxCount( ( u8 )count );
changed = TRUE;
}
if( LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - count != free )
{
LCFG_TSD_SetFreeSoftBoxCount( (u8)( LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - count ) );
changed = TRUE;
}
if(changed)
{
// LCFGライブラリの静的変数の値をNANDに反映
pBuffer = AMNi_Alloc( LCFG_WRITE_TEMP );
if (!pBuffer) {
OS_TPrintf( "AMNi_updateFreeBoxCount : AMNi_Alloc failed.\n" );
return;
}
retval = LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer );
AMNi_Free( pBuffer );
if (!retval) {
OS_TPrintf( "AMNi_updateFreeBoxCount : LCFG_WriteTWLSettings failed.\n" );
return;
}
OS_TPrintf( "AMNi_updateFreeBoxCount : FreeBoxCount is updated.\n" );
}else
{
OS_TPrintf( "AMNi_updateFreeBoxCount : FreeBoxCount is not updated.\n" );
}
}
/*-------------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------------
// アプリケーションに埋め込むテストコードのサンプル // アプリケーションに埋め込むテストコードのサンプル