DHT用バッファを動的確保するように変更、DHTデータベース作成時のエラー処理が結構適当だったので修正

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2392 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2008-09-04 01:52:22 +00:00
parent f270ea75ac
commit b11959ec39

View File

@ -120,8 +120,7 @@ static u8 *s_calc_hash = NULL;
static BOOL s_b_dev = FALSE;
static BOOL s_result_phase1 = FALSE;
static u8 dht_buffer[DS_HASH_TABLE_SIZE] ATTRIBUTE_ALIGN(256);
static DHTFile *const dht = (DHTFile*)dht_buffer;
static DHTFile *dht = NULL;
static const u8* hash0 = NULL;
static const u8* hash1 = NULL;
@ -231,16 +230,23 @@ static void PrepareDHTDatabase(void)
if ( FS_SeekFile(&file, sizeof(ROM_Header), FS_SEEK_SET) )
#endif
{
DHT_PrepareDatabase(dht, &file);
DC_FlushRange(dht, DHT_GetDatabaseLength(dht));
dht = SYSM_Alloc( DS_HASH_TABLE_SIZE );
if( dht != NULL )
{
if( DHT_PrepareDatabase(dht, &file) )
{
DC_FlushRange(dht, DHT_GetDatabaseLength(dht));
FS_CloseFile(&file);
return;
}
}
}
FS_CloseFile(&file);
}
}
else
{
MI_CpuClear8(dht, sizeof(DHTHeader));
}
MI_CpuClear8(dht, sizeof(DHTHeader));
dht = NULL;
}
static BOOL WrapperFunc_ReadCardData(void* dest, s32 offset, s32 length, void* arg)
@ -1779,6 +1785,13 @@ void SYSM_TryToBootTitle( TitleProperty *pBootTitle )
s_calc_hash = NULL;
}
if(dht)
{
// dht用バッファが確保されていたら解放
SYSM_Free( dht );
dht = NULL;
}
// ダイレクトブート時など、まだSystemMenuVersionのデータがセットされていない場合は、ここでセットする。
if( *(u8 *)HW_SYSM_VER_INFO_CONTENT_LAST_INITIAL_CODE == 0 ) {
SYSM_SetSystemMenuVersionControlData();