diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/title.c b/build/libraries_sysmenu/sysmenu/ARM9/src/title.c index 9f813c46..ed710c29 100644 --- a/build/libraries_sysmenu/sysmenu/ARM9/src/title.c +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/title.c @@ -400,12 +400,6 @@ OS_TPrintf("RebootSystem failed: cant read file(%d, %d)\n", source[i], len); (void)FS_CloseFile(file); - if(pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_TEMP) - { - // tmpアプリの場合はファイル削除 - // TODO:その他読み込み等の失敗時にもDeleteする必要あり? - (void)FS_DeleteFile(path); - } } // ROMヘッダバッファをコピー diff --git a/build/systemMenu_RED/Launcher/ARM9/src/main.c b/build/systemMenu_RED/Launcher/ARM9/src/main.c index 395b1919..db244911 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/main.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/main.c @@ -117,6 +117,9 @@ void TwlMain( void ) (void)SYSM_GetCardTitleList( s_titleList ); // カードアプリリストの取得(カードアプリはs_titleList[0]に格納される) + // TODO:bootTypeがLAUNCHER_BOOTTYPE_TEMPでない場合、tmpフォルダ内のデータを消す + + // 「ダイレクトブートでない」なら if( !pBootTitle ) { // アプリ間パラメタをクリア diff --git a/build/tests/ExecTmpApp/ARM9/Makefile b/build/tests/ExecTmpApp/ARM9/Makefile new file mode 100644 index 00000000..db7701c4 --- /dev/null +++ b/build/tests/ExecTmpApp/ARM9/Makefile @@ -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 ===== diff --git a/build/tests/ExecTmpApp/ARM9/main.rsf b/build/tests/ExecTmpApp/ARM9/main.rsf new file mode 100644 index 00000000..dcaac345 --- /dev/null +++ b/build/tests/ExecTmpApp/ARM9/main.rsf @@ -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 +} diff --git a/build/tests/ExecTmpApp/ARM9/src/ExecTmpApp.c b/build/tests/ExecTmpApp/ARM9/src/ExecTmpApp.c new file mode 100644 index 00000000..6162b7e1 --- /dev/null +++ b/build/tests/ExecTmpApp/ARM9/src/ExecTmpApp.c @@ -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 +#include +#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(); +} diff --git a/build/tests/ExecTmpApp/ARM9/src/ExecTmpApp.h b/build/tests/ExecTmpApp/ARM9/src/ExecTmpApp.h new file mode 100644 index 00000000..b4ee250a --- /dev/null +++ b/build/tests/ExecTmpApp/ARM9/src/ExecTmpApp.h @@ -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 + +// define data---------------------------------------------------------- + +void ExecTmpAppInit( void ); +void ExecTmpAppMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __COOPERATION_B_H__ diff --git a/build/tests/ExecTmpApp/ARM9/src/main.c b/build/tests/ExecTmpApp/ARM9/src/main.c new file mode 100644 index 00000000..82ba2cfe --- /dev/null +++ b/build/tests/ExecTmpApp/ARM9/src/main.c @@ -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 +#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ブランク割込チェックのセット +} + diff --git a/build/tests/ExecTmpApp/Makefile b/build/tests/ExecTmpApp/Makefile new file mode 100644 index 00000000..0c600f92 --- /dev/null +++ b/build/tests/ExecTmpApp/Makefile @@ -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 ===== diff --git a/build/tests/ExecTmpApp/SimpleApp/ARM9/Makefile b/build/tests/ExecTmpApp/SimpleApp/ARM9/Makefile new file mode 100644 index 00000000..a4444ab0 --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/ARM9/Makefile @@ -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 ===== diff --git a/build/tests/ExecTmpApp/SimpleApp/ARM9/main.rsf b/build/tests/ExecTmpApp/SimpleApp/ARM9/main.rsf new file mode 100644 index 00000000..0ebcbf4b --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/ARM9/main.rsf @@ -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 +} diff --git a/build/tests/ExecTmpApp/SimpleApp/ARM9/src/SimpleApp.c b/build/tests/ExecTmpApp/SimpleApp/ARM9/src/SimpleApp.c new file mode 100644 index 00000000..77458e3f --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/ARM9/src/SimpleApp.c @@ -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 +#include +#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(); +} diff --git a/build/tests/ExecTmpApp/SimpleApp/ARM9/src/SimpleApp.h b/build/tests/ExecTmpApp/SimpleApp/ARM9/src/SimpleApp.h new file mode 100644 index 00000000..c93da6b7 --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/ARM9/src/SimpleApp.h @@ -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 + +// define data---------------------------------------------------------- + +void SimpleAppInit( void ); +void SimpleAppMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __COOPERATION_B_H__ diff --git a/build/tests/ExecTmpApp/SimpleApp/ARM9/src/main.c b/build/tests/ExecTmpApp/SimpleApp/ARM9/src/main.c new file mode 100644 index 00000000..ca4f1dcc --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/ARM9/src/main.c @@ -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 +#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ブランク割込チェックのセット +} + diff --git a/build/tests/ExecTmpApp/SimpleApp/Makefile b/build/tests/ExecTmpApp/SimpleApp/Makefile new file mode 100644 index 00000000..9cf34e12 --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/Makefile @@ -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 ===== diff --git a/build/tests/ExecTmpApp/SimpleApp/banner/Makefile b/build/tests/ExecTmpApp/SimpleApp/banner/Makefile new file mode 100644 index 00000000..ea261271 --- /dev/null +++ b/build/tests/ExecTmpApp/SimpleApp/banner/Makefile @@ -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) + +# diff --git a/build/tests/ExecTmpApp/SimpleApp/banner/banner_v3.bsf b/build/tests/ExecTmpApp/SimpleApp/banner/banner_v3.bsf new file mode 100644 index 00000000..d602c7f8 Binary files /dev/null and b/build/tests/ExecTmpApp/SimpleApp/banner/banner_v3.bsf differ diff --git a/build/tests/ExecTmpApp/SimpleApp/banner/icon/gameIcon.bmp b/build/tests/ExecTmpApp/SimpleApp/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..d2c5448f Binary files /dev/null and b/build/tests/ExecTmpApp/SimpleApp/banner/icon/gameIcon.bmp differ diff --git a/build/tests/ExecTmpApp/banner/Makefile b/build/tests/ExecTmpApp/banner/Makefile new file mode 100644 index 00000000..ea261271 --- /dev/null +++ b/build/tests/ExecTmpApp/banner/Makefile @@ -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) + +# diff --git a/build/tests/ExecTmpApp/banner/banner_v3.bsf b/build/tests/ExecTmpApp/banner/banner_v3.bsf new file mode 100644 index 00000000..d364b2af Binary files /dev/null and b/build/tests/ExecTmpApp/banner/banner_v3.bsf differ diff --git a/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp b/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..d2c5448f Binary files /dev/null and b/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp differ diff --git a/build/tests/ExecTmpApp/data/NTR_IPL_font_m.NFTR b/build/tests/ExecTmpApp/data/NTR_IPL_font_m.NFTR new file mode 100644 index 00000000..03ba3a48 Binary files /dev/null and b/build/tests/ExecTmpApp/data/NTR_IPL_font_m.NFTR differ