diff --git a/build/tests/CheckSharedFont/Makefile b/build/tests/CheckSharedFont/Makefile new file mode 100644 index 00000000..1513319c --- /dev/null +++ b/build/tests/CheckSharedFont/Makefile @@ -0,0 +1,42 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - FS - overlay +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_BIN = main.srl + +SRCS = main.c loadSharedFont.c + +LLIBRARIES += libsharedfont$(TWL_LIBSUFFIX).a + +ROM_SPEC = ROM-TS_nand.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckSharedFont/ROM-TS_nand.rsf b/build/tests/CheckSharedFont/ROM-TS_nand.rsf new file mode 100644 index 00000000..546adb61 --- /dev/null +++ b/build/tests/CheckSharedFont/ROM-TS_nand.rsf @@ -0,0 +1,263 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [0 - 255] + # + #AgreeEULAVersion 0 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 0 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 0K + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization [0 - 31, ALWAYS, FREE] + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / ALWAYS / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckSharedFont/src/loadSharedFont.c b/build/tests/CheckSharedFont/src/loadSharedFont.c new file mode 100644 index 00000000..e09fdb3b --- /dev/null +++ b/build/tests/CheckSharedFont/src/loadSharedFont.c @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#include +#include "loadSharedFont.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- +#define FONT_LOAD_THREAD_PRIO 13 +#define THREAD_STACK_SIZE 1024 + +// function's prototype------------------------------------------------------- + +// global variable------------------------------------------------------------- +BOOL g_isSucceededLoad[ OS_SHARED_FONT_MAX ]; + +// static variable------------------------------------------------------------- +static u64 s_fontLoadThreadStack[THREAD_STACK_SIZE / sizeof(u64)]; +static OSThread s_fontLoadThread; +static OSTick s_fontLoadStartTick; +static u8 *s_pFontBuffer[ OS_SHARED_FONT_MAX ]; // 読み込みはテストなのでロード先はstatic変数にしている。 +static BOOL s_isStarted = FALSE; + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// 共有フォントロード +// ============================================================================ +BOOL LoadSharedFontInit( void ) +{ + u8 *pBuffer; + int size; + + s_fontLoadStartTick = OS_GetTick(); + + // ロードスレッド生成 + OS_CreateThread(&s_fontLoadThread, + LoadSharedFontThread, + NULL, + s_fontLoadThreadStack + THREAD_STACK_SIZE / sizeof(u64), + THREAD_STACK_SIZE, FONT_LOAD_THREAD_PRIO); + + // フォントロード準備 + if( !OS_InitSharedFont() ) { + OS_TPrintf( "OS_InitSharedFont failed.\n" ); + return FALSE; + } + size = OS_GetSharedFontTableSize(); + if( size < 0 ) { + OS_TPrintf( "OS_GetSharedTableSize failed.\n" ); + return FALSE; + } + + pBuffer = OS_Alloc( (u32)size ); + if( pBuffer == NULL ) { + OS_TPrintf( "malloc failed.\n" ); + return FALSE; + } + if( !OS_LoadSharedFontTable( pBuffer ) ) { + OS_TPrintf( "OS_LoadSharedTable failed.\n" ); + return FALSE; + } + + // ロードスレッド起動 + OS_WakeupThreadDirect(&s_fontLoadThread); + s_isStarted = TRUE; + return TRUE; +} + + +void LoadSharedFontThread( void *arg ) +{ +#pragma unused(arg) + BOOL retval = TRUE; + OSSharedFontIndex i; + + for( i = OS_SHARED_FONT_WW_S; i < OS_SHARED_FONT_MAX; i++ ) { + int size; + + OS_TPrintf( "%s read.\n", OS_GetSharedFontName( i ) ); + + size = OS_GetSharedFontSize( i ); + if( size < 0 ) { + OS_TPrintf( " get font size failed.\n" ); + retval = FALSE; + } + + // FSのキャッシュが怪しそうなので、とりあえずアラインメントをとっておく。 + size = MATH_ROUNDUP( size, 32 ); + + s_pFontBuffer[ i ] = OS_Alloc( (u32)size ); + if( s_pFontBuffer[ i ] == NULL ) { + OS_TPrintf( " malloc failed.\n" ); + retval = FALSE; + } + + if( OS_LoadSharedFont( i, s_pFontBuffer[ i ] ) ) { + OS_TPrintf( " load succeeded.\n" ); + g_isSucceededLoad[ i ] = TRUE; + }else { + OS_TPrintf( " load failed.\n" ); + g_isSucceededLoad[ i ] = FALSE; + retval = FALSE; + } + } + OS_TPrintf( "Shared Font load time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - s_fontLoadStartTick ) ); +} + + +BOOL IsFinishedLoadSharedFont( void ) +{ + if( s_isStarted ) { + return OS_IsThreadTerminated( &s_fontLoadThread ); + }else { + return TRUE; + } +} + diff --git a/build/tests/CheckSharedFont/src/loadSharedFont.h b/build/tests/CheckSharedFont/src/loadSharedFont.h new file mode 100644 index 00000000..67c563ed --- /dev/null +++ b/build/tests/CheckSharedFont/src/loadSharedFont.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef __LOAD_SHARED_FONT_H__ +#define __LOAD_SHARED_FONT_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- +// global variables-------------------------------------------------- +extern BOOL g_isSucceededLoad[ OS_SHARED_FONT_MAX ]; + +// function---------------------------------------------------------- +BOOL LoadSharedFontInit( void ); +void LoadSharedFontThread( void *arg ); +BOOL IsFinishedLoadSharedFont( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __LOAD_SHARED_FONT_H__ diff --git a/build/tests/CheckSharedFont/src/main.c b/build/tests/CheckSharedFont/src/main.c new file mode 100644 index 00000000..80793aee --- /dev/null +++ b/build/tests/CheckSharedFont/src/main.c @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - FS - overlay + File: main.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + + +#include + +#include "DEMO.h" +#include "loadSharedFont.h" + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: アプリケーションメインエントリ + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + + OS_Init(); + OS_InitTick(); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + { + OSHeapHandle hh; + void *tmp; + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_TPanic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); + } + + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBitmap(); + DEMOHookConsole(); + + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 0, 1)); + DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR); + DEMOStartDisplay(); + + FS_Init(FS_DMA_NOT_USE); + + OS_TPrintf("--------------------------------\n" + "Shared Font sample.\n"); + + (void)LoadSharedFontInit(); + + + while( !IsFinishedLoadSharedFont() ) { + OS_WaitVBlankIntr(); + } + + // 結果表示 + { + int i; + int ox = 10; + int oy = 60; + DEMOFillRect(0, 0, GX_LCD_SIZE_X, GX_LCD_SIZE_Y, DEMO_RGB_CLEAR); + DEMOSetBitmapTextColor(GX_RGBA(0, 31, 0, 1)); + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1)); + DEMODrawFrame(ox, oy, 240, 10 + OS_SHARED_FONT_MAX * 10, GX_RGBA( 0, 31, 0, 1)); + for (i = 0; i < OS_SHARED_FONT_MAX; ++i) + { + DEMODrawText(ox + 10, oy + 5 + i * 10, "%s %s load ", + OS_GetSharedFontName( (OSSharedFontIndex)i ), g_isSucceededLoad[ i ] ? "suceeded" : "failed"); + } + } + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + OS_Terminate(); +} + + diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus3/SDK_5_0_FC_plus3_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus3/SDK_5_0_FC_plus3_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..b8b07226 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus3/SDK_5_0_FC_plus3_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls differ