サブバナー変更テストプログラムの追加

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@800 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yoshida_teruhisa 2008-03-04 04:58:24 +00:00
parent 8f9a322839
commit 39486cab1c
11 changed files with 629 additions and 0 deletions

View File

@ -0,0 +1,62 @@
#! 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$
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
TITLEID_LO = SBNR
TARGET_BIN = SubBanner.tad
ROM_SPEC = main.rsf
MISC_DIR = ../../misc
DATA_DIR = ../../data
SRCS = main.c SubBanner.c \
$(MISC_DIR)/misc_simple.c \
$(DATA_DIR)/data.c
LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include \
$(MISC_DIR) \
$(DATA_DIR)
LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE)
LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a
MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)'
include $(TWLSDK_ROOT)/build/buildtools/commondefs
SDK_NMENU_DATADIR = $(ROOT)/build/tools/TwlNMenu/data
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN)
INSTALL_DIR = $(SDK_NMENU_DATADIR)
#----------------------------------------------------------------------------
do-build : $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
#===== End of Makefile =====

View File

@ -0,0 +1,182 @@
#----------------------------------------------------------------------------
# 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:: $
# $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 "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
###
#
# 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)
#
# Enable TmpJump:
#
#PermitTmpJump TRUE
###
#### 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 SubBannerFile
SubBannerFile TRUE
}
RomSpec
{
Offset 0x00000000
Segment ALL
HostRoot ../banner
Root /data
File sub_banner.bnr
}

View File

@ -0,0 +1,186 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: SubBanner.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 <twl/os/common/banner.h>
#include "misc_simple.h"
#include "SubBanner.h"
// define data------------------------------------------
#define COPB_MENU_ELEMENT_NUM 3 // メニューの項目数
// extern data------------------------------------------
// function's prototype declaration---------------------
static void MenuScene( void );
// global variable -------------------------------------
// static variable -------------------------------------
static u16 s_csr = 0;
static void(*s_pNowProcess)(void);
// const data -----------------------------------------
static const char *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] =
{
"write sub banner file",
"delete sub banner file",
"return to launcher",
};
static MenuPos s_menuPos[] = {
{ TRUE, 3, 8 },
{ TRUE, 3, 9 },
{ TRUE, 3, 10 },
};
static const MenuParam s_menuParam = {
COPB_MENU_ELEMENT_NUM,
TXT_COLOR_BLACK,
TXT_COLOR_GREEN,
TXT_COLOR_RED,
&s_menuPos[ 0 ],
(const char **)&s_pStrMenu,
};
//======================================================
// サブバナーテストプログラム
//======================================================
static void DrawMenuScene( void )
{
myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "SubBanner");
// メニュー項目
myDp_DrawMenu( s_csr, MAIN_SCREEN, &s_menuParam );
}
static void MenuInit( void )
{
GX_DispOff();
GXS_DispOff();
FS_Init(3);
myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "SubBanner");
s_pNowProcess = MenuScene;
DrawMenuScene();
GX_DispOn();
GXS_DispOn();
}
static void MenuScene(void)
{
LauncherBootFlags tempflag = {TRUE, OS_BOOTTYPE_NAND, TRUE, FALSE, FALSE, FALSE, 0};
//--------------------------------------
// キー入力処理
//--------------------------------------
if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動
if( ++s_csr == COPB_MENU_ELEMENT_NUM ) {
s_csr=0;
}
}
if( MYPAD_IS_TRIG(PAD_KEY_UP) ){
if( --s_csr & 0x80 ) {
s_csr=COPB_MENU_ELEMENT_NUM - 1;
}
}
DrawMenuScene();
if( MYPAD_IS_TRIG(PAD_BUTTON_A) ) { // メニュー項目への分岐
if( s_menuPos[ s_csr ].enable ) {
switch( s_csr ) {
TWLSubBannerFile subBanner;
FSFile file[1];
s32 readLen;
case 0:
//subbanner書き込み
FS_InitFile(file);
if (FS_OpenFileEx(file, "rom:/data/sub_banner.bnr", FS_FILEMODE_R) )
{
readLen = FS_ReadFile(file, &subBanner, sizeof(TWLSubBannerFile));
FS_CloseFile(file);
if( readLen == sizeof(TWLSubBannerFile) )
{
// 成功
if (FS_OpenFileEx(file, "nand:/<banner>", FS_FILEMODE_W) )
{
if( sizeof(TWLSubBannerFile) == FS_WriteFile(file, &subBanner, sizeof(TWLSubBannerFile)) )
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "write succeed. ");
}else
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "write failed. ");
}
FS_CloseFile(file);
}else
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "banner file open failed.");
}
}else
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "read romfile failed. ");
}
}else
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "open romfile failed. ");
}
break;
case 1:
//subbanner消去
FS_InitFile(file);
MI_CpuClear8( &subBanner, sizeof(TWLSubBannerFile) );
if (FS_OpenFileEx(file, "nand:/<banner>", FS_FILEMODE_W) )
{
if( sizeof(TWLSubBannerFile) == FS_WriteFile(file, &subBanner, sizeof(TWLSubBannerFile)) )
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "write succeed. ");
}else
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "write failed. ");
}
FS_CloseFile(file);
}else
{
myDp_Printf( 1, 3, TXT_COLOR_RED, MAIN_SCREEN, "banner file open failed.");
}
break;
case 2:
OS_SetLauncherParamAndResetHardware( NULL, &tempflag );
//再起動
break;
}
}
}
}
// 初期化
void SubBannerInit( void )
{
MenuInit();
}
// メインループ
void SubBannerMain(void)
{
s_pNowProcess();
}

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: SubBanner.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 __SUBBANNER_H__
#define __SUBBANNER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <twl.h>
// define data----------------------------------------------------------
void SubBannerInit( void );
void SubBannerMain( void );
#ifdef __cplusplus
}
#endif
#endif // __SUBBANNER_H__

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*
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:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include "misc_simple.h"
#include "SubBanner.h"
// extern data-----------------------------------------------------------------
// define data-----------------------------------------------------------------
// function's prototype-------------------------------------------------------
static void INTR_VBlank( void );
// global variable-------------------------------------------------------------
// static variable-------------------------------------------------------------
BOOL g_isValidTSD;
// const data------------------------------------------------------------------
// ============================================================================
// function's description
// ============================================================================
void TwlMain(void)
{
myInit();
SubBannerInit();
// メインループ----------------------------
while(1){
myPreMain();
SubBannerMain();
myProMain();
OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち
}
}
// ============================================================================
// 割り込み処理
// ============================================================================
// Vブランク割り込み
static void INTR_VBlank(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット
}

View File

@ -0,0 +1,31 @@
#! 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:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
TARGET_PLATFORM = TWL
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = banner ARM9
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,63 @@
#! 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:: $
# $Rev$
# $Author$
#----------------------------------------------------------------------------
TARGET_PLATFORM = TWL
include $(TWLSDK_ROOT)/build/buildtools/commondefs
MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe
ICON_DIR = ./icon
BANNER_ICON = $(ICON_DIR)/gameIcon.bmp
BANNER_SPEC = banner_v3.bsf
SUB_BANNER_ICON = $(ICON_DIR)/subIcon.bmp
SUB_BANNER_SPEC = sub_banner_v3.bsf
TARGETS = banner.bnr
SUB_TARGETS = sub_banner.bnr
INSTALL_DIR = ./
INSTALL_TARGETS = $(TARGETS) $(SUB_TARGETS)
BANNER_ICON_NAME = $(basename $(BANNER_ICON))
SUB_BANNER_ICON_NAME = $(basename $(SUB_BANNER_ICON))
LDIRT_CLEAN = $(TARGETS) $(SUB_TARGETS) \
$(BANNER_ICON_NAME).nbfs \
$(BANNER_ICON_NAME).nbfc \
$(BANNER_ICON_NAME).nbfp \
$(SUB_BANNER_ICON_NAME).nbfs \
$(SUB_BANNER_ICON_NAME).nbfc \
$(SUB_BANNER_ICON_NAME).nbfp \
$(TARGETS:.bnr=.srl)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#----------------------------------------------------------------------------
# build
#----------------------------------------------------------------------------
do-build: $(TARGETS) $(SUB_TARGETS)
$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON)
$(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \
$(MAKEBANNER) -d -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS)
$(SUB_TARGETS): $(SUB_BANNER_SPEC) $(SUB_BANNER_ICON)
$(NTEXCONV) -no -bg -bgb -bgnc $(SUB_BANNER_ICON) >/dev/null && \
$(MAKEBANNER) -s -d -N $(SUB_BANNER_ICON_NAME) $(SUB_BANNER_SPEC) $(SUB_TARGETS)
#

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.