From b11959ec39a6f9117b0b1fcb3a69d2dc30ad89e1 Mon Sep 17 00:00:00 2001 From: yoshida_teruhisa Date: Thu, 4 Sep 2008 01:52:22 +0000 Subject: [PATCH] =?UTF-8?q?DHT=E7=94=A8=E3=83=90=E3=83=83=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=92=E5=8B=95=E7=9A=84=E7=A2=BA=E4=BF=9D=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4=E3=80=81?= =?UTF-8?q?DHT=E3=83=87=E3=83=BC=E3=82=BF=E3=83=99=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E6=99=82=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=81=8C=E7=B5=90=E6=A7=8B=E9=81=A9=E5=BD=93?= =?UTF-8?q?=E3=81=A0=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3?= 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@2392 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../sysmenu/ARM9/src/title.c | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/title.c b/build/libraries_sysmenu/sysmenu/ARM9/src/title.c index e7410a23..2f95a657 100644 --- a/build/libraries_sysmenu/sysmenu/ARM9/src/title.c +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/title.c @@ -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();