共有フォントのロードテストプログラムを追加。

ランチャーチェック表の追加。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1527 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yosiokat 2008-05-26 08:38:13 +00:00
parent 6b5783bce7
commit 2a8379931b
6 changed files with 577 additions and 0 deletions

View File

@ -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 =====

View File

@ -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
}

View File

@ -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 <twl.h>
#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;
}
}

View File

@ -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 <twl.h>
#include <twl/os/common/sharedFont.h>
#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__

View File

@ -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 <nitro.h>
#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();
}