TMPフォルダに保存したアプリを起動するサンプル

現状、ファイルを消す処理を入れていないのでTMPにアプリが残ります

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@510 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2008-01-24 02:48:49 +00:00
parent d8d4cf3fca
commit e0577ff3ce
21 changed files with 1251 additions and 6 deletions

View File

@ -400,12 +400,6 @@ OS_TPrintf("RebootSystem failed: cant read file(%d, %d)\n", source[i], len);
(void)FS_CloseFile(file); (void)FS_CloseFile(file);
if(pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_TEMP)
{
// tmpアプリの場合はファイル削除
// TODO:その他読み込み等の失敗時にもDeleteする必要あり
(void)FS_DeleteFile(path);
}
} }
// ROMヘッダバッファをコピー // ROMヘッダバッファをコピー

View File

@ -117,6 +117,9 @@ void TwlMain( void )
(void)SYSM_GetCardTitleList( s_titleList ); // カードアプリリストの取得カードアプリはs_titleList[0]に格納される) (void)SYSM_GetCardTitleList( s_titleList ); // カードアプリリストの取得カードアプリはs_titleList[0]に格納される)
// TODO:bootTypeがLAUNCHER_BOOTTYPE_TEMPでない場合、tmpフォルダ内のデータを消す
// 「ダイレクトブートでない」なら // 「ダイレクトブートでない」なら
if( !pBootTitle ) { if( !pBootTitle ) {
// アプリ間パラメタをクリア // アプリ間パラメタをクリア

View File

@ -0,0 +1,59 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - demos - simpleShoot-1
# 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: $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
TITLEID_LO = ETFA
TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad
TARGET_BIN = main.srl
ROM_SPEC = main.rsf
MISC_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/misc
SRCS = main.c ExecTmpApp.c \
$(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c
LINCLUDES = $(MISC_DIR)/include
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)'
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
LDIRT_CLEAN = $(TARGET_TAD)
INSTALL_TARGETS = $(TARGET_TAD)
INSTALL_DIR = $(SDK_NMENU_DATADIR)
#----------------------------------------------------------------------------
do-build : $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
#===== End of Makefile =====

View File

@ -0,0 +1,181 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-BB.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:: 2007-11-21#$
# $Rev: 240 $
# $Author: yosiokat $
#----------------------------------------------------------------------------
#
# 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 "YourAppName"
#_GameCode $(TITLEID_LO)
#
# 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 ../banner/banner.bnr
###
### Setting for TWL
###
#
# BANNER FILE:
#
BannerTWLFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
AppType User
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard/NAND]
#
Media NAND
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
GameCode $(TITLEID_LO)
#
# Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M]
#
#PublicSaveDataSize 32K
#
# Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M]
#
#PrivateSaveDataSize 16K
#
# Enable SaveBannerFile
SaveBannerFile FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot ../data
Root /data
File NTR_IPL_font_m.NFTR simple.srl
}

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: ExecTmpApp.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:: 2007-10-31#$
$Rev: 91 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <sysmenu.h>
#include "misc.h"
#include "ExecTmpApp.h"
// define data------------------------------------------
#define RETURN_BUTTON_TOP_X 2
#define RETURN_BUTTON_TOP_Y 21
#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 )
#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 )
#define COPB_MENU_ELEMENT_NUM 2 // メニューの項目数
// extern data------------------------------------------
// function's prototype declaration---------------------
static void MenuScene( void );
// global variable -------------------------------------
extern RTCDrawProperty g_rtcDraw;
// static variable -------------------------------------
static u16 s_csr = 0;
static void(*s_pNowProcess)(void);
// const data -----------------------------------------
static const u16 *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] =
{
L"tmpフォルダにアプリを保存し起動",
L"ランチャーに戻る",
};
static MenuPos s_menuPos[] = {
{ TRUE, 4 * 8, 8 * 8 },
{ TRUE, 4 * 8, 10 * 8 },
};
static const MenuParam s_menuParam = {
COPB_MENU_ELEMENT_NUM,
TXT_COLOR_BLACK,
TXT_COLOR_GREEN,
TXT_COLOR_RED,
&s_menuPos[ 0 ],
(const u16 **)&s_pStrMenu,
};
//======================================================
// アプリ連携テストプログラムB
//======================================================
static void DrawMenuScene( void )
{
PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"ExecTmpApp");
GetAndDrawRTCData( &g_rtcDraw, TRUE );
// メニュー項目
DrawMenu( s_csr, &s_menuParam );
}
static void MenuInit( void )
{
GX_DispOff();
GXS_DispOff();
NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE );
PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"ExecTmpApp");
GetAndDrawRTCData( &g_rtcDraw, TRUE );
SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 );
GXS_SetVisiblePlane( GX_PLANEMASK_BG0 );
s_pNowProcess = MenuScene;
DrawMenuScene();
GX_DispOn();
GXS_DispOn();
}
static void MenuScene(void)
{
BOOL tp_select = FALSE;
LauncherBootFlags tempflag = {TRUE, LAUNCHER_BOOTTYPE_TEMP, TRUE, FALSE, FALSE, FALSE, 0};
ReadTP();
//--------------------------------------
// キー入力処理
//--------------------------------------
if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動
if( ++s_csr == COPB_MENU_ELEMENT_NUM ) {
s_csr=0;
}
}
if( pad.trg & PAD_KEY_UP ){
if( --s_csr & 0x80 ) {
s_csr=COPB_MENU_ELEMENT_NUM - 1;
}
}
tp_select = SelectMenuByTP( &s_csr, &s_menuParam );
DrawMenuScene();
if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐
if( s_menuPos[ s_csr ].enable ) {
u64 targetApp = 0x00030004534d504c;// SMPL
static char destfilename[256];
s32 len = 0;
s32 llen;
BOOL success = TRUE;
FSFile src,dest;
void *buf;
switch( s_csr ) {
case 0:
STD_TSNPrintf( destfilename, 31, "nand:/tmp/%.16llx.srl", targetApp );
// tmpに保存
FS_DeleteFile(destfilename);
FS_CreateFile(destfilename, FS_PERMIT_R | FS_PERMIT_W);
FS_InitFile( &src );
FS_InitFile( &dest );
if ( !FS_OpenFileEx( &src, "rom:/data/simple.srl", FS_FILEMODE_R ) ) success = FALSE;
len = (int)FS_GetFileLength( &src );
buf = (void *)0x02400000;// 適当にあいてるところ
llen = FS_ReadFile( &src, buf, len );
if ( !FS_CloseFile( &src ) ) success = FALSE;
if (len != llen) success = FALSE;
if ( !FS_OpenFileEx( &dest, destfilename, FS_FILEMODE_W ) ) success = FALSE;
llen = FS_WriteFile( &dest, buf, len );
if ( !FS_CloseFile( &dest ) ) success = FALSE;
if (len != llen) success = FALSE;
if( !success ) break;
//アプリ起動
OS_SetLauncherParamAndResetHardware( 0, targetApp, &tempflag );
break;
case 1:
OS_SetLauncherParamAndResetHardware( 0, NULL, &tempflag );
//再起動
break;
}
}
}
}
// 初期化
void ExecTmpAppInit( void )
{
ChangeUserColor( LCFG_TSD_GetUserColor() );
MenuInit();
}
// メインループ
void ExecTmpAppMain(void)
{
s_pNowProcess();
}

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: ExecTmpApp.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:: 2007-10-30#$
$Rev: 73 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#ifndef __COOPERATION_B_H__
#define __COOPERATION_B_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <twl.h>
// define data----------------------------------------------------------
void ExecTmpAppInit( void );
void ExecTmpAppMain( void );
#ifdef __cplusplus
}
#endif
#endif // __COOPERATION_B_H__

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
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:: 2007-11-27#$
$Rev: 272 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include "misc.h"
#include "ExecTmpApp.h"
// extern data-----------------------------------------------------------------
// define data-----------------------------------------------------------------
// function's prototype-------------------------------------------------------
static void INTR_VBlank( void );
// global variable-------------------------------------------------------------
// static variable-------------------------------------------------------------
BOOL g_isValidTSD;
RTCDrawProperty g_rtcDraw = {
TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y
};
// const data------------------------------------------------------------------
// ============================================================================
// function's description
// ============================================================================
void TwlMain(void)
{
// 初期化----------------------------------
OS_Init();
OS_InitTick();
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
GX_Init();
GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON
FS_Init( 3 );
// 割り込み許可----------------------------
(void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
// デバイス初期化-------------------------------
TP_Init();
(void)RTC_Init();
// システムの初期化------------------
InitAllocator();
// ※本来ならランチャーからのパラメータチェックを行い、
// 初回起動シーケンスに入るパスがある
// TWL設定のリード
SYSM_SetAllocFunc( Alloc, Free ); // SYSM_ReadTWLSettingsFile()の実行に必要。
// ::::::::::::::::::::::::::::::::::::::::::::::
// TWL設定データファイルの読み込み
// ::::::::::::::::::::::::::::::::::::::::::::::
(void)LCFG_ReadHWSecureInfo();
g_isValidTSD = LCFG_ReadTWLSettings();
if( g_isValidTSD ) {
SYSM_CaribrateTP();
}
InitBG();
GetAndDrawRTCData( &g_rtcDraw, TRUE );
ExecTmpAppInit();
// メインループ----------------------------
while(1){
OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち
ReadKeyPad(); // キー入力の取得
ReadTP(); // TP入力の取得
ExecTmpAppMain();
}
}
// ============================================================================
// 割り込み処理
// ============================================================================
// Vブランク割り込み
static void INTR_VBlank(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット
}

View File

@ -0,0 +1,30 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# 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:: 2007-10-03#$
# $Rev: 1319 $
# $Author: kitase_hirotake $
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = SimpleApp banner ARM9
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,56 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - demos - simpleShoot-1
# 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: $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
TITLEID_LO = SMPL
TARGET_BIN = simple.srl
ROM_SPEC = main.rsf
MISC_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/misc
SRCS = main.c SimpleApp.c \
$(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c
LINCLUDES = $(MISC_DIR)/include
MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)'
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN)
INSTALL_DIR = ../../data
#----------------------------------------------------------------------------
do-build : $(TARGETS)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
#===== End of Makefile =====

View File

@ -0,0 +1,181 @@
#----------------------------------------------------------------------------
# Project: TwlSDK - include
# File: ROM-BB.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:: 2007-11-21#$
# $Rev: 240 $
# $Author: yosiokat $
#----------------------------------------------------------------------------
#
# 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 "YourAppName"
#_GameCode $(TITLEID_LO)
#
# 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 ../banner/banner.bnr
###
### Setting for TWL
###
#
# BANNER FILE:
#
BannerTWLFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr
#
# Digest parameters:
#
DigestParam 1024 32
#
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD]
# don't have to edit
#
WramMapping $(MAKEROM_WRAM_MAPPING)
#
# Codec mode:
# don't have to edit
#
CodecMode $(MAKEROM_CODEC_MODE)
###
#### END
}
AppendProperty
{
#
# Publisher : "Nintendo"
# don't have to edit
Publisher Nintendo
#
# Application type : [USER/SYSTEM]
# don't have to edit
AppType User
#
# launch title on the launcher : [TRUE/FALSE]
# don't have to edit
Launch TRUE
#
# Boot allowed Media: [GameCard/NAND]
#
Media NAND
#
# GameCode for TitleID : Your GameCode in 4 ascii words
#
GameCode $(TITLEID_LO)
#
# Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M]
#
#PublicSaveDataSize 32K
#
# Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M]
#
#PrivateSaveDataSize 16K
#
# Enable SaveBannerFile
SaveBannerFile FALSE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data
Root /data
File NTR_IPL_font_m.NFTR
}

View File

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: SimpleApp.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:: 2007-10-31#$
$Rev: 91 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <sysmenu.h>
#include "misc.h"
#include "SimpleApp.h"
// define data------------------------------------------
#define RETURN_BUTTON_TOP_X 2
#define RETURN_BUTTON_TOP_Y 21
#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 )
#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 )
#define COPB_MENU_ELEMENT_NUM 1 // メニューの項目数
// extern data------------------------------------------
// function's prototype declaration---------------------
static void MenuScene( void );
// global variable -------------------------------------
extern RTCDrawProperty g_rtcDraw;
// static variable -------------------------------------
static u16 s_csr = 0;
static void(*s_pNowProcess)(void);
// const data -----------------------------------------
static const u16 *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] =
{
L"ランチャーに戻る",
};
static MenuPos s_menuPos[] = {
{ TRUE, 4 * 8, 8 * 8 },
};
static const MenuParam s_menuParam = {
COPB_MENU_ELEMENT_NUM,
TXT_COLOR_BLACK,
TXT_COLOR_GREEN,
TXT_COLOR_RED,
&s_menuPos[ 0 ],
(const u16 **)&s_pStrMenu,
};
//======================================================
// アプリ連携テストプログラムB
//======================================================
static void DrawMenuScene( void )
{
PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleApp");
PutStringUTF16( 1*8, 18*8, TXT_COLOR_BLACK, (const u16 *)L"単純アプリ...");
GetAndDrawRTCData( &g_rtcDraw, TRUE );
// メニュー項目
DrawMenu( s_csr, &s_menuParam );
}
static void MenuInit( void )
{
GX_DispOff();
GXS_DispOff();
NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE );
PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleApp");
GetAndDrawRTCData( &g_rtcDraw, TRUE );
SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 );
GXS_SetVisiblePlane( GX_PLANEMASK_BG0 );
s_pNowProcess = MenuScene;
DrawMenuScene();
GX_DispOn();
GXS_DispOn();
}
static void MenuScene(void)
{
BOOL tp_select = FALSE;
LauncherBootFlags tempflag = {TRUE, OS_BOOTTYPE_NAND, TRUE, FALSE, FALSE, FALSE, 0};
ReadTP();
//--------------------------------------
// キー入力処理
//--------------------------------------
if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動
if( ++s_csr == COPB_MENU_ELEMENT_NUM ) {
s_csr=0;
}
}
if( pad.trg & PAD_KEY_UP ){
if( --s_csr & 0x80 ) {
s_csr=COPB_MENU_ELEMENT_NUM - 1;
}
}
tp_select = SelectMenuByTP( &s_csr, &s_menuParam );
DrawMenuScene();
if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐
if( s_menuPos[ s_csr ].enable ) {
switch( s_csr ) {
case 0:
OS_SetLauncherParamAndResetHardware( 0, NULL, &tempflag );
//再起動
break;
}
}
}
}
// 初期化
void SimpleAppInit( void )
{
ChangeUserColor( LCFG_TSD_GetUserColor() );
MenuInit();
}
// メインループ
void SimpleAppMain(void)
{
s_pNowProcess();
}

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: SimpleApp.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:: 2007-10-30#$
$Rev: 73 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#ifndef __COOPERATION_B_H__
#define __COOPERATION_B_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <twl.h>
// define data----------------------------------------------------------
void SimpleAppInit( void );
void SimpleAppMain( void );
#ifdef __cplusplus
}
#endif
#endif // __COOPERATION_B_H__

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
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:: 2007-11-27#$
$Rev: 272 $
$Author: yosiokat $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include "misc.h"
#include "SimpleApp.h"
// extern data-----------------------------------------------------------------
// define data-----------------------------------------------------------------
// function's prototype-------------------------------------------------------
static void INTR_VBlank( void );
// global variable-------------------------------------------------------------
// static variable-------------------------------------------------------------
BOOL g_isValidTSD;
RTCDrawProperty g_rtcDraw = {
TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y
};
// const data------------------------------------------------------------------
// ============================================================================
// function's description
// ============================================================================
void TwlMain(void)
{
// 初期化----------------------------------
OS_Init();
OS_InitTick();
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
GX_Init();
GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON
FS_Init( 3 );
// 割り込み許可----------------------------
(void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
// デバイス初期化-------------------------------
TP_Init();
(void)RTC_Init();
// システムの初期化------------------
InitAllocator();
// ※本来ならランチャーからのパラメータチェックを行い、
// 初回起動シーケンスに入るパスがある
// TWL設定のリード
SYSM_SetAllocFunc( Alloc, Free ); // SYSM_ReadTWLSettingsFile()の実行に必要。
// ::::::::::::::::::::::::::::::::::::::::::::::
// TWL設定データファイルの読み込み
// ::::::::::::::::::::::::::::::::::::::::::::::
(void)LCFG_ReadHWSecureInfo();
g_isValidTSD = LCFG_ReadTWLSettings();
if( g_isValidTSD ) {
SYSM_CaribrateTP();
}
InitBG();
GetAndDrawRTCData( &g_rtcDraw, TRUE );
SimpleAppInit();
// メインループ----------------------------
while(1){
OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち
ReadKeyPad(); // キー入力の取得
ReadTP(); // TP入力の取得
SimpleAppMain();
}
}
// ============================================================================
// 割り込み処理
// ============================================================================
// Vブランク割り込み
static void INTR_VBlank(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット
}

View File

@ -0,0 +1,30 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# 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:: 2007-10-03#$
# $Rev: 1319 $
# $Author: kitase_hirotake $
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = banner ARM9
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,49 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# 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:: 2007-10-03#$
# $Rev: 1319 $
# $Author: kitase_hirotake $
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
ICON_DIR = ./icon
BANNER_ICON = $(ICON_DIR)/gameIcon.bmp
BANNER_SPEC = banner_v3.bsf
TARGETS = banner.bnr
INSTALL_DIR = ./
INSTALL_TARGETS = $(TARGETS)
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
LDIRT_CLEAN = $(TARGETS) \
$(BANNER_ICON_NAME).nbfs \
$(BANNER_ICON_NAME).nbfc \
$(BANNER_ICON_NAME).nbfp \
$(TARGETS:.bnr=.srl)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS)
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON)
$(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \
$(MAKEBANNER) -d -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)
#

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

View File

@ -0,0 +1,49 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlIPL
# 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:: 2007-10-03#$
# $Rev: 1319 $
# $Author: kitase_hirotake $
#----------------------------------------------------------------------------
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
ICON_DIR = ./icon
BANNER_ICON = $(ICON_DIR)/gameIcon.bmp
BANNER_SPEC = banner_v3.bsf
TARGETS = banner.bnr
INSTALL_DIR = ./
INSTALL_TARGETS = $(TARGETS)
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
LDIRT_CLEAN = $(TARGETS) \
$(BANNER_ICON_NAME).nbfs \
$(BANNER_ICON_NAME).nbfc \
$(BANNER_ICON_NAME).nbfp \
$(TARGETS:.bnr=.srl)
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS)
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON)
$(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \
$(MAKEBANNER) -d -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)
#

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.