diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c b/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c index ffa27f17..d01dede3 100644 --- a/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c @@ -129,7 +129,7 @@ static void FreeForNAM(void *p) } // SystemMenuの初期化 -void SYSM_Init( void ) +void SYSM_Init( void *(*pAlloc)(u32), void (*pFree)(void*) ) { #ifdef __SYSM_DEBUG pSysm = GetSYSMWork(); @@ -140,6 +140,8 @@ void SYSM_Init( void ) TP_Init(); RTC_Init(); + SYSM_SetAllocFunc( pAlloc, pFree ); + // WRAM設定はいる? // MI_SetMainMemoryPriority(MI_PROCESSOR_ARM7); // MI_SetWramBank(MI_WRAM_ARM7_ALL); diff --git a/build/systemMenu_RED/Launcher/ARM9/Makefile b/build/systemMenu_RED/Launcher/ARM9/Makefile index ab58b8ce..074e94d0 100644 --- a/build/systemMenu_RED/Launcher/ARM9/Makefile +++ b/build/systemMenu_RED/Launcher/ARM9/Makefile @@ -22,7 +22,7 @@ SUBDIRS = TARGET_FIRM = SYSTEMMENU TARGET_PLATFORM = TWL -TWL_ARCHGEN = LIMITED +#TWL_ARCHGEN = LIMITED TARGET_BIN = main.srl diff --git a/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c index 03fa5f13..a0466924 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c @@ -105,12 +105,11 @@ void LoadLogoData(void) { u32 temp[ 0x500 / sizeof(u32) ]; u16 *pBuff = NNS_FndAllocFromAllocator( &g_allocator, 0x1000 ); - MI_CpuClear32( pBuff, 0x1000 ); - if( pBuff == NULL ) { OS_TPrintf( " %s : memory allocate error.\n", __FUNCTION__ ); return; } + MI_CpuClear32( pBuff, 0x1000 ); UnCompNintendoLogo( (u16 *)Nin_Char_Diff_Huff, pBuff, temp ); // NintendoロゴをpBuffに展開 MI_CpuCopy32( pBuff, (u32 *)HW_OBJ_VRAM, 0x340 ); // OBJ-VRAMにロード diff --git a/build/systemMenu_RED/Launcher/ARM9/src/main.c b/build/systemMenu_RED/Launcher/ARM9/src/main.c index 14757ddb..8a3a1ba2 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/main.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/main.c @@ -74,13 +74,13 @@ void TwlMain( void ) (void)OS_EnableIrqMask(OS_IE_V_BLANK); (void)GX_VBlankIntr(TRUE); - // システムメニュー初期化---------- - SYSM_Init(); // OS_Initの後でコール。 - // システムの初期化---------------- InitAllocator( &g_allocator ); CMN_InitFileSystem( &g_allocator ); + // システムメニュー初期化---------- + SYSM_Init( Alloc, Free ); // OS_Initの後でコール。 + // リセットパラメータの取得-------- if( SYSM_GetResetParam()->isLogoSkip ) { if( SYSM_GetResetParam()->bootTitleID ) { // アプリ直接起動の指定があったらロゴデモを飛ばして指定アプリ起動 @@ -320,9 +320,24 @@ static void InitAllocator( NNSFndAllocator* pAllocator ) heapHandle = NNS_FndCreateExpHeap(heapMemory, heapSize); SDK_ASSERT( heapHandle != NNS_FND_HEAP_INVALID_HANDLE ); - NNS_FndInitAllocatorForExpHeap(pAllocator, heapHandle, 4); + NNS_FndInitAllocatorForExpHeap(pAllocator, heapHandle, 32); } + +// メモリ割り当て +void *Alloc( u32 size ) +{ + return NNS_FndAllocFromAllocator( &g_allocator, size ); +} + + +// メモリ解放 +void Free( void *pBuffer ) +{ + NNS_FndFreeToAllocator( &g_allocator, pBuffer ); +} + + #if 0 // mallocシステムの初期化 static void InitAllocSystem(void) diff --git a/build/systemMenu_RED/Launcher/ARM9/src/misc.h b/build/systemMenu_RED/Launcher/ARM9/src/misc.h index 67b32bda..db4fff88 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/misc.h +++ b/build/systemMenu_RED/Launcher/ARM9/src/misc.h @@ -130,6 +130,9 @@ extern NNSG2dCharCanvas gCanvas; // CharCanvas extern NNSG2dTextCanvas gTextCanvas; // TextCanvas // function------------------------------------------------------------- +void *Alloc( u32 size ); +void Free( void *pBuffer ); + void InitBG( void ); void PutStringUTF16 ( int x, int y, int color, const u16 *strUTF16 ); void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ); diff --git a/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h b/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h index 6797a7d7..0bc547b2 100644 --- a/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h +++ b/include/sysmenu/sysmenu_lib/ARM9/sysmenu_api.h @@ -61,7 +61,8 @@ extern void *(*SYSM_Alloc)( u32 size ); extern void (*SYSM_Free)( void *ptr ); // function------------------------------------------------------------- -extern void SYSM_Init( void ); +extern void SYSM_Init( void *(*pAlloc)(u32), void (*pFree)(void*) ); +//extern void SYSM_Init( void ); extern void SYSM_SetAllocFunc( void *(*pAlloc)(u32), void (*pFree)(void*) ); extern BOOL SYSM_IsLogoDemoSkip( void );