From d74e44c5adcb27ee5cf657a08600bc4252523a68 Mon Sep 17 00:00:00 2001 From: yoshida_teruhisa Date: Tue, 18 Dec 2007 05:06:13 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=97=E3=83=AA=E9=96=93=E9=80=A3?= =?UTF-8?q?=E6=90=BA=E3=81=AE=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20=E3=80=80=E3=83=BBCooperationA=E3=80=81Coo?= =?UTF-8?q?perationC=E3=81=8B=E3=82=89CooperationB=E3=82=92=E3=83=91?= =?UTF-8?q?=E3=83=A9=E3=83=A1=E3=82=BF=E3=81=A4=E3=81=8D=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=20?= =?UTF-8?q?=E3=80=80=E3=83=BBCooperationB=E3=81=8B=E3=82=89=E3=80=81?= =?UTF-8?q?=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=97=E5=85=83=E3=82=A2=E3=83=97?= =?UTF-8?q?=E3=83=AA=E3=82=92=E8=B5=B7=E5=8B=95=E3=83=BB=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E5=BE=A9=E5=85=83=E3=81=99=E3=82=8B=E3=82=B5=E3=83=B3=E3=83=97?= =?UTF-8?q?=E3=83=AB=20=E3=81=9D=E3=81=AE=E4=BB=96smallfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@371 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/systemMenu_RED/Launcher/ARM9/src/main.c | 7 +- .../MachineSettings/ARM9/src/setOwnerInfo.c | 2 +- .../CooperationA/ARM9/Makefile | 59 ++ .../CooperationA/ARM9/main.rsf | 154 +++++ .../CooperationA/ARM9/src/CooperationA.c | 633 ++++++++++++++++++ .../CooperationA/ARM9/src/CooperationA.h | 37 + .../CooperationA/ARM9/src/main.c | 109 +++ .../AppliCooperation/CooperationA/Makefile | 30 + .../CooperationA/banner/Makefile | 49 ++ .../CooperationA/banner/banner_v3.bsf | Bin 0 -> 886 bytes .../CooperationA/banner/icon/gameIcon.bmp | Bin 0 -> 630 bytes .../CooperationB/ARM9/Makefile | 59 ++ .../CooperationB/ARM9/main.rsf | 154 +++++ .../CooperationB/ARM9/src/CooperationB.c | 185 +++++ .../CooperationB/ARM9/src/CooperationB.h | 37 + .../CooperationB/ARM9/src/main.c | 109 +++ .../AppliCooperation/CooperationB/Makefile | 30 + .../CooperationB/banner/Makefile | 49 ++ .../CooperationB/banner/banner_v3.bsf | Bin 0 -> 886 bytes .../CooperationB/banner/icon/gameIcon.bmp | Bin 0 -> 630 bytes .../CooperationC/ARM9/Makefile | 59 ++ .../CooperationC/ARM9/main.rsf | 154 +++++ .../CooperationC/ARM9/src/CooperationC.c | 633 ++++++++++++++++++ .../CooperationC/ARM9/src/CooperationC.h | 37 + .../CooperationC/ARM9/src/main.c | 109 +++ .../AppliCooperation/CooperationC/Makefile | 30 + .../CooperationC/banner/Makefile | 49 ++ .../CooperationC/banner/banner_v3.bsf | Bin 0 -> 886 bytes .../CooperationC/banner/icon/gameIcon.bmp | Bin 0 -> 630 bytes build/tests/AppliCooperation/Makefile | 30 + build/tests/Makefile | 2 +- 31 files changed, 2803 insertions(+), 3 deletions(-) create mode 100644 build/tests/AppliCooperation/CooperationA/ARM9/Makefile create mode 100644 build/tests/AppliCooperation/CooperationA/ARM9/main.rsf create mode 100644 build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c create mode 100644 build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.h create mode 100644 build/tests/AppliCooperation/CooperationA/ARM9/src/main.c create mode 100644 build/tests/AppliCooperation/CooperationA/Makefile create mode 100644 build/tests/AppliCooperation/CooperationA/banner/Makefile create mode 100644 build/tests/AppliCooperation/CooperationA/banner/banner_v3.bsf create mode 100644 build/tests/AppliCooperation/CooperationA/banner/icon/gameIcon.bmp create mode 100644 build/tests/AppliCooperation/CooperationB/ARM9/Makefile create mode 100644 build/tests/AppliCooperation/CooperationB/ARM9/main.rsf create mode 100644 build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c create mode 100644 build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.h create mode 100644 build/tests/AppliCooperation/CooperationB/ARM9/src/main.c create mode 100644 build/tests/AppliCooperation/CooperationB/Makefile create mode 100644 build/tests/AppliCooperation/CooperationB/banner/Makefile create mode 100644 build/tests/AppliCooperation/CooperationB/banner/banner_v3.bsf create mode 100644 build/tests/AppliCooperation/CooperationB/banner/icon/gameIcon.bmp create mode 100644 build/tests/AppliCooperation/CooperationC/ARM9/Makefile create mode 100644 build/tests/AppliCooperation/CooperationC/ARM9/main.rsf create mode 100644 build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.c create mode 100644 build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.h create mode 100644 build/tests/AppliCooperation/CooperationC/ARM9/src/main.c create mode 100644 build/tests/AppliCooperation/CooperationC/Makefile create mode 100644 build/tests/AppliCooperation/CooperationC/banner/Makefile create mode 100644 build/tests/AppliCooperation/CooperationC/banner/banner_v3.bsf create mode 100644 build/tests/AppliCooperation/CooperationC/banner/icon/gameIcon.bmp create mode 100644 build/tests/AppliCooperation/Makefile diff --git a/build/systemMenu_RED/Launcher/ARM9/src/main.c b/build/systemMenu_RED/Launcher/ARM9/src/main.c index 825ab5dd..10700244 100644 --- a/build/systemMenu_RED/Launcher/ARM9/src/main.c +++ b/build/systemMenu_RED/Launcher/ARM9/src/main.c @@ -82,8 +82,13 @@ void TwlMain( void ) // 初回起動シーケンス判定、 // 検査用オート起動カード判定、量産ライン用キーショートカット起動判定等のリード - // 「ダイレクトブートでない」なら、NAND & カードアプリリスト取得 + // 「ダイレクトブートでない」なら if( !pBootTitle ) { + // アプリ間パラメータの呼び出し元アプリ情報をクリア + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + arginfo->gameCode = NULL; + + // NAND & カードアプリリスト取得 (void)SYSM_GetNandTitleList( s_titleList, LAUNCHER_TITLE_LIST_NUM ); // NANDアプリリストの取得(内蔵アプリはs_titleList[1]から格納される) (void)SYSM_GetCardTitleList( s_titleList ); // カードアプリリストの取得(カードアプリはs_titleList[0]に格納される) } diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c index 9cd5bba5..e24e3d2f 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c @@ -99,7 +99,7 @@ static u8 s_color_csr = 0; static BOOL s_birth_csr = FALSE; static TWLDate s_temp_birthday; static u16 s_temp_name[ TWL_NICKNAME_LENGTH + 1 ]; -static u16 s_temp_comment[ TWL_NICKNAME_LENGTH + 1 ]; +static u16 s_temp_comment[ TWL_COMMENT_LENGTH + 1 ]; static u8 s_temp_name_length; static u8 s_temp_comment_length; diff --git a/build/tests/AppliCooperation/CooperationA/ARM9/Makefile b/build/tests/AppliCooperation/CooperationA/ARM9/Makefile new file mode 100644 index 00000000..f804756f --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/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 = COPA +TARGET_TAD = $(BINDIR)/$(TITLEID_LO).tad + +TARGET_BIN = main.srl + +ROM_SPEC = main.rsf + +MISC_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/misc + +SRCS = main.c CooperationA.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/AppliCooperation/CooperationA/ARM9/main.rsf b/build/tests/AppliCooperation/CooperationA/ARM9/main.rsf new file mode 100644 index 00000000..f5692e24 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/ARM9/main.rsf @@ -0,0 +1,154 @@ +#---------------------------------------------------------------------------- +# 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 + + # + # Boot allowed Media: [GameCard/NAND/SDCard/DownloadPlay] + # possible to choose one or more. + # + BootMedia GameCard NAND SDCard DownloadPlay + + # + # Certification FILE: + # + Certificate $(TWLSDK_ROOT)/include/twl/specfiles/default_sgn.sbin + #Certificate ./my_sgn.sbin + + # + # 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) + + TitleID_Lo $(TITLEID_LO) + TitleID_Hi 0x00010001 + PrivateSaveDataSize 16K +# PublicSaveDataSize 16K + + ### + #### END +} + +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/AppliCooperation/CooperationA/ARM9/src/CooperationA.c b/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c new file mode 100644 index 00000000..b000dc88 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c @@ -0,0 +1,633 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: CooperationA.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 "CooperationA.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 ) + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 + +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +#define COPA_MENU_ELEMENT_NUM 3 // メニューの項目数 +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe + +#define PARAM_LENGTH 10 + +typedef struct CopA_Work +{ + u16 csr; + int char_mode; + u16 key_csr; + u16 parameter[ PARAM_LENGTH + 1 ]; + u16 temp_parameter[ PARAM_LENGTH + 1 ]; + u8 temp_parameter_length; + void(*pNowProcess)(void); + int starx,stary; +} CopA_Work; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +static void MenuScene( void ); + +// global variable ------------------------------------- +extern RTCDrawProperty g_rtcDraw; + +// static variable ------------------------------------- + +static CopA_Work s_work = (CopA_Work){0,0,0,L"",L"",0,0,0}; + +// const data ----------------------------------------- +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; + +static const u16 *s_pStrMenu[ COPA_MENU_ELEMENT_NUM ] = +{ + L"パラメータ設定", + L"Bを起動", + L"ランチャーに戻る", +}; + +static MenuPos s_menuPos[] = { + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, +}; + +static const MenuParam s_menuParam = { + COPA_MENU_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_menuPos[ 0 ], + (const u16 **)&s_pStrMenu, +}; + +static const u16 *str_button_char[CHAR_LIST_MODE_NUM] = { + L"かな", + L"カナ", + L"英数", + }; + +static u16 next_char_mode[CHAR_LIST_MODE_NUM-1]; + +static const u16 str_button_del[] = L"ADEL"; +static const u16 str_button_space[] = L"SPACE"; +static const u16 str_button_ok[] = L"OK"; +static const u16 str_button_cancel[] = L"CANCEL"; + +static const u16 *str_button[] = { + (const u16 *)str_button_del, + (const u16 *)str_button_space, + NULL, + NULL, + (const u16 *)str_button_ok, + (const u16 *)str_button_cancel, + }; + +//====================================================== +// アプリ連携テストプログラムA +//====================================================== + +// UTF16の文字列長算出 +static u8 MY_StrLen( const u16 *pStr ) +{ + u8 len = 0; + while( *pStr++ ) { + ++len; + if( len == 255 ) { + break; + } + } + return len; +} + +static void SetSoftKeyboardButton(int mode) +{ + int l; + int count = 0; + for(l=0; l= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, s ); + } + } + } +} + +// 一文字削除 +static void DeleteACharacter( void ) +{ + u16 *buf; + u8 *length; + buf = s_work.temp_parameter; + length = &s_work.temp_parameter_length; + + if(*length > 0) buf[--(*length)] = CHAR_USCORE; +} + +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"CooperationA"); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + + s_work.pNowProcess = MenuScene; + + GX_DispOn(); + GXS_DispOn(); +} + +// 選択中文字キー・特殊キーで決定した時の挙動 +static void PushKeys( u16 code ) +{ + u16 *buf; + u8 *length; + u16 max_length; + buf = s_work.temp_parameter; + length = &s_work.temp_parameter_length; + max_length = PARAM_LENGTH; + + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + // 特殊キー + switch(code) + { + case VAR_BUTTON1_: + case VAR_BUTTON2_: + SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); + break; + case DEL_BUTTON_: + DeleteACharacter(); + break; + case SPACE_BUTTON_: + if(*length < max_length) buf[(*length)++] = L' '; + break; + case OK_BUTTON_: + SVC_CpuClear(0, buf + *length, (max_length - *length) * 2, 16);// ゼロクリア + MI_CpuCopy8(buf, s_work.parameter, 2*(PARAM_LENGTH+1)); + // セーブ後にキャンセル処理と合流 + case CANCEL_BUTTON_: + MenuInit(); + break; + default:// unknown code + break; + } + } + else + { + // 普通キー + if(*length < max_length) buf[(*length)++] = code; + } +} + +// PadDetectOnKeyのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectSoftwareKeyFunc( u16 *csr, TPData *tgt ) +{ + // まずは候補となる座標(カーソル単位)を取得 + int csrx; + int csry; + int csrxy; + int a; + int b; + NNSG2dTextRect rect; + u16 code; + BOOL ret; + + csrx = tgt->x - CLIST_LT_X; + csrx = csrx - (CLIST_SEGMENT_INTERVAL*(csrx/(CLIST_MARGIN*CLIST_KEY_PER_SEGMENT+CLIST_SEGMENT_INTERVAL))); + csrx = csrx / CLIST_MARGIN; + csry = (tgt->y - CLIST_LT_Y) / CLIST_MARGIN; + if(csrx < 0 ) return FALSE; + + if ( csrx >= KEY_PER_LINE ) csrx = KEY_PER_LINE - 1; + csrxy = csrx + csry * KEY_PER_LINE; + + if ( csrxy < 0 || csrxy >= CHAR_LIST_CHAR_NUM) return FALSE;// 明らかにはみ出した + + // 候補座標のキーコード取得 + code = char_tbl[s_work.char_mode][csrxy]; + if(code == EOM_) return FALSE; + + // 候補座標の領域取得 + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + // rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, s ); + // 文字幅じゃかなり判定が厳しい……ギリギリまでとってみる + rect.width = CLIST_MARGIN; + rect.height = CLIST_MARGIN; + } + a = CLIST_LT_X + CLIST_MARGIN*(csrxy%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((csrxy%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT); + b = CLIST_LT_Y + CLIST_MARGIN*(csrxy/KEY_PER_LINE); + + // 候補座標の領域にタッチ座標が含まれているかチェック + ret = WithinRangeTP( a, b, a+rect.width, b+rect.height, tgt ); + + if(ret) + { + *csr = (u16)csrxy; + } + return ret; +} + +// ソフトウェアキー上でのキーパッド及びタッチパッド処理 +// 先にReadTPしておくこと。 +static void PadDetectOnKey( void ) +{ + SelectSomethingFunc func[1]; + BOOL tp_select = FALSE; + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_RIGHT ){ // カーソルの移動 + do + { + if(s_work.key_csr%KEY_PER_LINE != KEY_PER_LINE-1) s_work.key_csr++; + else s_work.key_csr -= KEY_PER_LINE-1; + if( s_work.key_csr == CHAR_LIST_CHAR_NUM ) s_work.key_csr -= s_work.key_csr%KEY_PER_LINE; + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_LEFT ){ + do + { + if(s_work.key_csr%KEY_PER_LINE != 0) s_work.key_csr--; + else s_work.key_csr += KEY_PER_LINE-1; + if( s_work.key_csr & 0x8000 ) s_work.key_csr = KEY_PER_LINE-1; + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + do + { + s_work.key_csr += KEY_PER_LINE; + if( s_work.key_csr >= CHAR_LIST_CHAR_NUM ) s_work.key_csr -= KEY_PER_LINE*(s_work.key_csr/KEY_PER_LINE); + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_UP ){ + do + { + if( s_work.key_csr < KEY_PER_LINE ) s_work.key_csr += (CHAR_LIST_CHAR_NUM/KEY_PER_LINE)*KEY_PER_LINE; + else s_work.key_csr -= KEY_PER_LINE; + if( s_work.key_csr >= CHAR_LIST_CHAR_NUM ) s_work.key_csr -= KEY_PER_LINE; + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + + func[0] = (SelectSomethingFunc)SelectSoftwareKeyFunc; + tp_select = SelectSomethingByTP(&s_work.key_csr, func, 1 ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // キーが押された + PushKeys( char_tbl[s_work.char_mode][s_work.key_csr] ); + }else if( pad.trg & PAD_BUTTON_B ) { + DeleteACharacter(); + } +} + +// パラメータ編集画面の描画処理 +static void DrawSetParameterScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"PARAMETER" ); + PutStringUTF16( 128-60 , 21 , TXT_UCOLOR_G0, s_work.temp_parameter ); + DrawCharKeys(); +} + +// パラメータ編集の初期化 +static void SetParameterInit( void ) +{ + SetSoftKeyboardButton(0); + s_work.key_csr = KEY_START; + + // パラメータ用テンポラリバッファの初期化 + MI_CpuCopy8(s_work.parameter, s_work.temp_parameter, 2*(PARAM_LENGTH+1)); + s_work.temp_parameter_length = MY_StrLen( s_work.temp_parameter ); + if( s_work.temp_parameter_length < PARAM_LENGTH ) { + SVC_CpuClear(CHAR_USCORE, &s_work.temp_parameter[ s_work.temp_parameter_length ], + ( PARAM_LENGTH - s_work.temp_parameter_length ) * 2, 16); + } + + DrawSetParameterScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// パラメータ編集メイン +static void SetParameterMain( void ) +{ + ReadTP(); + + PadDetectOnKey(); + + // 描画処理 + DrawSetParameterScene(); +} + +static void DrawMenuScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"CooperationA"); + PutStringUTF16( s_work.starx-6, s_work.stary-6, TXT_UCOLOR_G0, (const u16 *)L"★"); + PutStringUTF16( 128 , 8*8, TXT_UCOLOR_G0, s_work.parameter ); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + // メニュー項目 + DrawMenu( s_work.csr, &s_menuParam ); + PrintfSJIS( 1*8, 20*8, TXT_COLOR_BLACK, "★の位置:(%d,%d)",s_work.starx, s_work.stary); +} + +static void MenuScene(void) +{ + BOOL tp_select = FALSE; + static TPData tgt = (TPData){0,0,0,0}; + BootFlags tempflag = {TRUE, 0, TRUE, FALSE, FALSE, FALSE, 0}; + + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( ++s_work.csr == COPA_MENU_ELEMENT_NUM ) { + s_work.csr=0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --s_work.csr & 0x80 ) { + s_work.csr=COPA_MENU_ELEMENT_NUM - 1; + } + } + tp_select = SelectMenuByTP( &s_work.csr, &s_menuParam ); + + if(tpd.disp.touch) + { + tgt = tpd.disp; + if(s_work.starx != tgt.x) s_work.starx += (((tgt.x - s_work.starx)>>3) + ((tgt.x > s_work.starx) ? 1 : -1) ); + if(s_work.stary != tgt.y) s_work.stary += (((tgt.y - s_work.stary)>>3) + ((tgt.y > s_work.stary) ? 1 : -1) ); + } + + DrawMenuScene(); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( s_menuPos[ s_work.csr ].enable ) { + switch( s_work.csr ) { + case 0: + SetParameterInit(); + s_work.pNowProcess = SetParameterMain; + break; + case 1: + // 現在のアプリ状態をセーブ + { + FSFile f; + FS_InitFile(&f); + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"ライトエラー1",s_work.parameter,14); break;} + FS_CreateFile("test.dat", FS_PERMIT_R | FS_PERMIT_W ); + if(!FS_OpenFileEx(&f, "test.dat", FS_FILEMODE_W)) {MI_CpuCopy8(L"ライトエラー2",s_work.parameter,14); break;} + if(-1 == FS_WriteFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8(L"ライトエラー3",s_work.parameter,14); break;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8(L"ライトエラー4",s_work.parameter,14); break;} + } + // アプリ間パラメータをセット + { + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + // メーカーコードとゲームコードのセット(Launcher側でやるべき?) + u16 *maker_code_src_addr = (u16 *)(HW_TWL_ROM_HEADER_BUF + 0x10); + u32 *game_code_src_addr = (u32 *)(HW_TWL_ROM_HEADER_BUF + 0xc); + arginfo->makerCode = *maker_code_src_addr; + // まだゲームコードは証明書の関係でNTRJしか入ってない……ので強制的に値代入 + //arginfo->gameCode = *game_code_src_addr; + arginfo->gameCode = 0x41504f43; // 下位から'C','O','P','A' + // アプリ専用部分のセット + MI_CpuCopy8(s_work.parameter, arginfo->buf, 2*(PARAM_LENGTH+1)); + } + //B起動 + OS_SetResetParamAndResetHardware( 0, 0x00010001434f5042, &tempflag ); + break; + case 2: + OS_SetResetParamAndResetHardware( 0, NULL, &tempflag ); + //再起動 + break; + } + } + } +} + +// 初期化 +void CooperationAInit( void ) +{ + ChangeUserColor( TSD_GetUserColor() ); + s_work.parameter[0] = 0; + MenuInit(); + + { + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + if(arginfo->gameCode != NULL) + { + if(STD_CompareNString((const char *)arginfo->buf, "-r", 3) == 0) + { + // セーブしたデータから復帰 + FSFile f; + FS_InitFile(&f); + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"リードエラー1",s_work.parameter,14); return;} + if(!FS_OpenFileEx(&f, "test.dat", FS_FILEMODE_R)) {return;} + if(-1 == FS_ReadFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8(L"リードエラー2",s_work.parameter,14); return;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8(L"リードエラー3",s_work.parameter,14); return;} + } + } + } +} + +// メインループ +void CooperationAMain(void) +{ + s_work.pNowProcess(); +} + + +//====================================================== +// ソフトウェアキーボード用キャラテーブル +//====================================================== + +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM] = { + { // ひらがな + L'あ', L'い', L'う', L'え', L'お', + L'か', L'き', L'く', L'け', L'こ', DEL_BUTTON_, + L'さ', L'し', L'す', L'せ', L'そ', + L'た', L'ち', L'つ', L'て', L'と', SPACE_BUTTON_, + L'な', L'に', L'ぬ', L'ね', L'の', + L'は', L'ひ', L'ふ', L'へ', L'ほ', EOM_, + + L'ま', L'み', L'む', L'め', L'も', + L'や', EOM_, L'ゆ', EOM_, L'よ', VAR_BUTTON1_, + L'ら', L'り', L'る', L'れ', L'ろ', + L'わ', L'ゐ', L'ゑ', L'を', L'ん', VAR_BUTTON2_, + L'ぁ', L'ぃ', L'ぅ', L'ぇ', L'ぉ', + L'ゃ', EOM_, L'ゅ', EOM_, L'ょ', EOM_, + + L'が', L'ぎ', L'ぐ', L'げ', L'ご', + L'ざ', L'じ', L'ず', L'ぜ', L'ぞ', EOM_, + L'だ', L'ぢ', L'づ', L'で', L'ど', + L'ば', L'び', L'ぶ', L'べ', L'ぼ', OK_BUTTON_, + L'ぱ', L'ぴ', L'ぷ', L'ぺ', L'ぽ', + L'っ', L'、', L'。', L'!', L'?', EOM_, + + L'「', L'」', L'〜', L'・', L'ー', + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // カタカナ + L'ア', L'イ', L'ウ', L'エ', L'オ', + L'カ', L'キ', L'ク', L'ケ', L'コ', DEL_BUTTON_, + L'サ', L'シ', L'ス', L'セ', L'ソ', + L'タ', L'チ', L'ツ', L'テ', L'ト', SPACE_BUTTON_, + L'ナ', L'ニ', L'ヌ', L'ネ', L'ノ', + L'ハ', L'ヒ', L'フ', L'ヘ', L'ホ', EOM_, + + L'マ', L'ミ', L'ム', L'メ', L'モ', + L'ヤ', EOM_, L'ユ', EOM_, L'ヨ', VAR_BUTTON1_, + L'ラ', L'リ', L'ル', L'レ', L'ロ', + L'ワ', EOM_, L'ヲ', EOM_, L'ン', VAR_BUTTON2_, + L'ァ', L'ィ', L'ゥ', L'ェ', L'ォ', + L'ャ', EOM_, L'ュ', EOM_, L'ョ', EOM_, + + L'ガ', L'ギ', L'グ', L'ゲ', L'ゴ', + L'ザ', L'ジ', L'ズ', L'ゼ', L'ゾ', EOM_, + L'ダ', L'ヂ', L'ヅ', L'デ', L'ド', + L'バ', L'ビ', L'ブ', L'ベ', L'ボ', OK_BUTTON_, + L'パ', L'ピ', L'プ', L'ペ', L'ポ', + L'ッ', L'、', L'。', L'!', L'ー', EOM_, + + L'「', L'」', L'〜', L'・', EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // 英数 + L'A', L'B', L'C', L'D', L'E', + L'F', L'G', L'H', L'I', L'J', DEL_BUTTON_, + L'K', L'L', L'M', L'N', L'O', + L'P', L'Q', L'R', L'S', L'T', SPACE_BUTTON_, + L'U', L'V', L'W', L'X', L'Y', + L'Z', EOM_, EOM_, EOM_, EOM_, EOM_, + + L'a', L'b', L'c', L'd', L'e', + L'f', L'g', L'h', L'i', L'j', VAR_BUTTON1_, + L'k', L'l', L'm', L'n', L'o', + L'p', L'q', L'r', L's', L't', VAR_BUTTON2_, + L'u', L'v', L'w', L'x', L'y', + L'z', EOM_, EOM_, EOM_, EOM_, EOM_, + + L'0', L'1', L'2', L'3', L'4', + L'5', L'6', L'7', L'8', L'9', EOM_, + L'!', EOM_, L'&', EOM_, L'/', + L',', EOM_, L'.', EOM_, L'−', OK_BUTTON_, + L'’', EOM_, L'”', EOM_, EOM_, + L'@', EOM_, L'(', EOM_, L')', EOM_, + + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, +}; \ No newline at end of file diff --git a/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.h b/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.h new file mode 100644 index 00000000..160f0fb9 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: CooperationA.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_A_H__ +#define __COOPERATION_A_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +void CooperationAInit( void ); +void CooperationAMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __COOPERATION_A_H__ diff --git a/build/tests/AppliCooperation/CooperationA/ARM9/src/main.c b/build/tests/AppliCooperation/CooperationA/ARM9/src/main.c new file mode 100644 index 00000000..e87a40b7 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/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 "CooperationA.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)THW_ReadSecureInfo(); + g_isValidTSD = SYSM_ReadTWLSettingsFile(); + if( g_isValidTSD ) { + SYSM_CaribrateTP(); + } + + InitBG(); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + CooperationAInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + CooperationAMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/AppliCooperation/CooperationA/Makefile b/build/tests/AppliCooperation/CooperationA/Makefile new file mode 100644 index 00000000..9cf34e12 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/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/AppliCooperation/CooperationA/banner/Makefile b/build/tests/AppliCooperation/CooperationA/banner/Makefile new file mode 100644 index 00000000..ea261271 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationA/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/AppliCooperation/CooperationA/banner/banner_v3.bsf b/build/tests/AppliCooperation/CooperationA/banner/banner_v3.bsf new file mode 100644 index 0000000000000000000000000000000000000000..abd490d1dbaa194e152e550a8c35a2946c480c1b GIT binary patch literal 886 zcmc(eO-jT-5QX1X!8^V0xDm7V;y@o5HlRX{iOrwA8%y)N# zF0ZcC61_1B_k$*1JJki54ZYY8`)Qw^qsO>-v#<8u4gzMR^H3i!uN8ADHH2jurdQFm zYgrp~qRSrWBfRn7?#6wBtKHFQ+gCU4VXrQad!d{6_4~>klkopRjhEiNi3;X1)&u*L j*x_ufUDg_xD^P`YK+dRSy2ow*9y4+|^*K1t*s%WqU_61# literal 0 HcmV?d00001 diff --git a/build/tests/AppliCooperation/CooperationA/banner/icon/gameIcon.bmp b/build/tests/AppliCooperation/CooperationA/banner/icon/gameIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4837ffe03da437acfacd35f267ecc39d93c0f664 GIT binary patch literal 630 zcmY+BJx}965QYbYL2#>y@6&KNq&SXgG#XKoBs81Nh^%ix%dYEU z#WW0~h*pqqTJ}OP10>vl}w+A{h@qxfcd3ms>}RLZO;QyGIb#-8J+n6ct18#*g4l#e-fq z^v0)ZlhridJs&_=JH;_7m1@clq5&%GKjRd2qnd%0(10-K|3clgkdLDXx05t{w{BV4 z?E#NY)E%9LAG#K OraI;oe#=My67&zbvKV^+ literal 0 HcmV?d00001 diff --git a/build/tests/AppliCooperation/CooperationB/ARM9/Makefile b/build/tests/AppliCooperation/CooperationB/ARM9/Makefile new file mode 100644 index 00000000..4d6e5833 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/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 = COPB +TARGET_TAD = $(BINDIR)/$(TITLEID_LO).tad + +TARGET_BIN = main.srl + +ROM_SPEC = main.rsf + +MISC_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/misc + +SRCS = main.c CooperationB.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/AppliCooperation/CooperationB/ARM9/main.rsf b/build/tests/AppliCooperation/CooperationB/ARM9/main.rsf new file mode 100644 index 00000000..3d484904 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/ARM9/main.rsf @@ -0,0 +1,154 @@ +#---------------------------------------------------------------------------- +# 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 + + # + # Boot allowed Media: [GameCard/NAND/SDCard/DownloadPlay] + # possible to choose one or more. + # + BootMedia GameCard NAND SDCard DownloadPlay + + # + # Certification FILE: + # + Certificate $(TWLSDK_ROOT)/include/twl/specfiles/default_sgn.sbin + #Certificate ./my_sgn.sbin + + # + # 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) + + TitleID_Lo $(TITLEID_LO) + TitleID_Hi 0x00010001 +# PrivateSaveDataSize 16K +# PublicSaveDataSize 16K + + ### + #### END +} + +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/AppliCooperation/CooperationB/ARM9/src/CooperationB.c b/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c new file mode 100644 index 00000000..196f6f25 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: CooperationB.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 "CooperationB.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 // メニューの項目数 + +#define PARAM_LENGTH 10 + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +static void MenuScene( void ); + +// global variable ------------------------------------- +extern RTCDrawProperty g_rtcDraw; + +// static variable ------------------------------------- +static u16 s_csr = 0; +static u16 s_parameter[ PARAM_LENGTH + 1 ]; +static void(*s_pNowProcess)(void); + +static u32 invGameCode; + +// const data ----------------------------------------- +static const u16 *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] = +{ + L"呼び出し元アプリを起動", + L"ランチャーに戻る", +}; + +static MenuPos s_menuPos[] = { + { FALSE, 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"CooperationB"); + PutStringUTF16( 1*8, 18*8, TXT_COLOR_BLACK, (const u16 *)L"受け取ったパラメータ:"); + PutStringUTF16( 3 * 8 , 20*8, TXT_UCOLOR_G0, s_parameter ); + PutStringUTF16( 1*8, 14*8, TXT_COLOR_BLACK, (const u16 *)L"呼び出し元アプリ:"); + PrintfSJIS(3*8, 16*8, TXT_COLOR_BLACK, "0x%llx",(u64)0x0001000100000000 + invGameCode); + 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"CooperationB"); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + + s_pNowProcess = MenuScene; + + MI_CpuClear8(s_parameter, 2*(PARAM_LENGTH+1)); + + { + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + u8 *gc = (u8 *)&arginfo->gameCode; + invGameCode = (u32)(gc[0]<<24) + (u32)(gc[1]<<16) + (u32)(gc[2]<<8) + (u32)gc[3]; + if(invGameCode != NULL) + { + s_menuPos[ 0 ].enable = TRUE; + MI_CpuCopy8(arginfo->buf, s_parameter, 2*(PARAM_LENGTH+1)); + } + } + + DrawMenuScene(); + + GX_DispOn(); + GXS_DispOn(); +} + +static void MenuScene(void) +{ + BOOL tp_select = FALSE; + BootFlags tempflag = {TRUE, 0, 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: + if(invGameCode != NULL) + { + // アプリ間パラメータをセット + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + // メーカーコードとゲームコードのセット(Launcher側でやるべき?) + u16 *maker_code_src_addr = (u16 *)(HW_TWL_ROM_HEADER_BUF + 0x10); + u32 *game_code_src_addr = (u32 *)(HW_TWL_ROM_HEADER_BUF + 0xc); + arginfo->makerCode = *maker_code_src_addr; + arginfo->gameCode = *game_code_src_addr; + // アプリ専用部分のセット + MI_CpuCopy8("-r", arginfo->buf, 3); + //呼び出し元アプリ起動 + OS_SetResetParamAndResetHardware( 0, (u64)0x0001000100000000 + invGameCode, &tempflag ); + //OS_SetResetParamAndResetHardware( 0, (u64)0x00010001434f5041, &tempflag ); + } + break; + case 1: + OS_SetResetParamAndResetHardware( 0, NULL, &tempflag ); + //再起動 + break; + } + } + } +} + +// 初期化 +void CooperationBInit( void ) +{ + ChangeUserColor( TSD_GetUserColor() ); + s_parameter[0] = 0; + MenuInit(); +} + +// メインループ +void CooperationBMain(void) +{ + s_pNowProcess(); +} \ No newline at end of file diff --git a/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.h b/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.h new file mode 100644 index 00000000..88002c24 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: CooperationB.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 CooperationBInit( void ); +void CooperationBMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __COOPERATION_B_H__ diff --git a/build/tests/AppliCooperation/CooperationB/ARM9/src/main.c b/build/tests/AppliCooperation/CooperationB/ARM9/src/main.c new file mode 100644 index 00000000..d4fa27b5 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/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 "CooperationB.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)THW_ReadSecureInfo(); + g_isValidTSD = SYSM_ReadTWLSettingsFile(); + if( g_isValidTSD ) { + SYSM_CaribrateTP(); + } + + InitBG(); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + CooperationBInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + CooperationBMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/AppliCooperation/CooperationB/Makefile b/build/tests/AppliCooperation/CooperationB/Makefile new file mode 100644 index 00000000..9cf34e12 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/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/AppliCooperation/CooperationB/banner/Makefile b/build/tests/AppliCooperation/CooperationB/banner/Makefile new file mode 100644 index 00000000..ea261271 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationB/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/AppliCooperation/CooperationB/banner/banner_v3.bsf b/build/tests/AppliCooperation/CooperationB/banner/banner_v3.bsf new file mode 100644 index 0000000000000000000000000000000000000000..8513828c577c8bdc439c2fa46c25995f56ca6576 GIT binary patch literal 886 zcmc(eO-jT-5QX1X!8Uc;5p$({~$rqRE4=DNE< zms3}2iQX86`(Bf)o$7+jhFT__8F|hvtXvBfj literal 0 HcmV?d00001 diff --git a/build/tests/AppliCooperation/CooperationB/banner/icon/gameIcon.bmp b/build/tests/AppliCooperation/CooperationB/banner/icon/gameIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d2c5448f8c747566f67508f9121d3d158a39e05f GIT binary patch literal 630 zcmY+BF;C+#7=}MiNQ`&gi$tOhCsiG2s{Vi`BN-}^4Th?%2P9Ajlt`Ues&?-}=W-`q z=DQ_c0ja7-#L(6w6VP8kQeN8?2d`u&kNxQT9H-$&-$*CI{1f9~J9cOnZ^(AvfSGeV zip3(8%Vnz9>*TsFHJeRpwOZ8c^{C(P(_k>5@pw$r>6FqmrP*voQcBuvHbmZ+&|VmZ zSaBW4v5_Bd5$lG5=TvR0fRx^1#$dQuFg#Rl6{ +#include +#include "misc.h" +#include "CooperationC.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 ) + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 + +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +#define COPA_MENU_ELEMENT_NUM 3 // メニューの項目数 +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe + +#define PARAM_LENGTH 10 + +typedef struct CopA_Work +{ + u16 csr; + int char_mode; + u16 key_csr; + u16 parameter[ PARAM_LENGTH + 1 ]; + u16 temp_parameter[ PARAM_LENGTH + 1 ]; + u8 temp_parameter_length; + void(*pNowProcess)(void); + int starx,stary; +} CopA_Work; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +static void MenuScene( void ); + +// global variable ------------------------------------- +extern RTCDrawProperty g_rtcDraw; + +// static variable ------------------------------------- + +static CopA_Work s_work = (CopA_Work){0,0,0,L"",L"",0,0,0}; + +// const data ----------------------------------------- +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; + +static const u16 *s_pStrMenu[ COPA_MENU_ELEMENT_NUM ] = +{ + L"パラメータ設定", + L"Bを起動", + L"ランチャーに戻る", +}; + +static MenuPos s_menuPos[] = { + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, +}; + +static const MenuParam s_menuParam = { + COPA_MENU_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_menuPos[ 0 ], + (const u16 **)&s_pStrMenu, +}; + +static const u16 *str_button_char[CHAR_LIST_MODE_NUM] = { + L"かな", + L"カナ", + L"英数", + }; + +static u16 next_char_mode[CHAR_LIST_MODE_NUM-1]; + +static const u16 str_button_del[] = L"ADEL"; +static const u16 str_button_space[] = L"SPACE"; +static const u16 str_button_ok[] = L"OK"; +static const u16 str_button_cancel[] = L"CANCEL"; + +static const u16 *str_button[] = { + (const u16 *)str_button_del, + (const u16 *)str_button_space, + NULL, + NULL, + (const u16 *)str_button_ok, + (const u16 *)str_button_cancel, + }; + +//====================================================== +// アプリ連携テストプログラムA +//====================================================== + +// UTF16の文字列長算出 +static u8 MY_StrLen( const u16 *pStr ) +{ + u8 len = 0; + while( *pStr++ ) { + ++len; + if( len == 255 ) { + break; + } + } + return len; +} + +static void SetSoftKeyboardButton(int mode) +{ + int l; + int count = 0; + for(l=0; l= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, s ); + } + } + } +} + +// 一文字削除 +static void DeleteACharacter( void ) +{ + u16 *buf; + u8 *length; + buf = s_work.temp_parameter; + length = &s_work.temp_parameter_length; + + if(*length > 0) buf[--(*length)] = CHAR_USCORE; +} + +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"CooperationC"); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + + s_work.pNowProcess = MenuScene; + + GX_DispOn(); + GXS_DispOn(); +} + +// 選択中文字キー・特殊キーで決定した時の挙動 +static void PushKeys( u16 code ) +{ + u16 *buf; + u8 *length; + u16 max_length; + buf = s_work.temp_parameter; + length = &s_work.temp_parameter_length; + max_length = PARAM_LENGTH; + + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + // 特殊キー + switch(code) + { + case VAR_BUTTON1_: + case VAR_BUTTON2_: + SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); + break; + case DEL_BUTTON_: + DeleteACharacter(); + break; + case SPACE_BUTTON_: + if(*length < max_length) buf[(*length)++] = L' '; + break; + case OK_BUTTON_: + SVC_CpuClear(0, buf + *length, (max_length - *length) * 2, 16);// ゼロクリア + MI_CpuCopy8(buf, s_work.parameter, 2*(PARAM_LENGTH+1)); + // セーブ後にキャンセル処理と合流 + case CANCEL_BUTTON_: + MenuInit(); + break; + default:// unknown code + break; + } + } + else + { + // 普通キー + if(*length < max_length) buf[(*length)++] = code; + } +} + +// PadDetectOnKeyのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectSoftwareKeyFunc( u16 *csr, TPData *tgt ) +{ + // まずは候補となる座標(カーソル単位)を取得 + int csrx; + int csry; + int csrxy; + int a; + int b; + NNSG2dTextRect rect; + u16 code; + BOOL ret; + + csrx = tgt->x - CLIST_LT_X; + csrx = csrx - (CLIST_SEGMENT_INTERVAL*(csrx/(CLIST_MARGIN*CLIST_KEY_PER_SEGMENT+CLIST_SEGMENT_INTERVAL))); + csrx = csrx / CLIST_MARGIN; + csry = (tgt->y - CLIST_LT_Y) / CLIST_MARGIN; + if(csrx < 0 ) return FALSE; + + if ( csrx >= KEY_PER_LINE ) csrx = KEY_PER_LINE - 1; + csrxy = csrx + csry * KEY_PER_LINE; + + if ( csrxy < 0 || csrxy >= CHAR_LIST_CHAR_NUM) return FALSE;// 明らかにはみ出した + + // 候補座標のキーコード取得 + code = char_tbl[s_work.char_mode][csrxy]; + if(code == EOM_) return FALSE; + + // 候補座標の領域取得 + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + // rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, s ); + // 文字幅じゃかなり判定が厳しい……ギリギリまでとってみる + rect.width = CLIST_MARGIN; + rect.height = CLIST_MARGIN; + } + a = CLIST_LT_X + CLIST_MARGIN*(csrxy%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((csrxy%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT); + b = CLIST_LT_Y + CLIST_MARGIN*(csrxy/KEY_PER_LINE); + + // 候補座標の領域にタッチ座標が含まれているかチェック + ret = WithinRangeTP( a, b, a+rect.width, b+rect.height, tgt ); + + if(ret) + { + *csr = (u16)csrxy; + } + return ret; +} + +// ソフトウェアキー上でのキーパッド及びタッチパッド処理 +// 先にReadTPしておくこと。 +static void PadDetectOnKey( void ) +{ + SelectSomethingFunc func[1]; + BOOL tp_select = FALSE; + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_RIGHT ){ // カーソルの移動 + do + { + if(s_work.key_csr%KEY_PER_LINE != KEY_PER_LINE-1) s_work.key_csr++; + else s_work.key_csr -= KEY_PER_LINE-1; + if( s_work.key_csr == CHAR_LIST_CHAR_NUM ) s_work.key_csr -= s_work.key_csr%KEY_PER_LINE; + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_LEFT ){ + do + { + if(s_work.key_csr%KEY_PER_LINE != 0) s_work.key_csr--; + else s_work.key_csr += KEY_PER_LINE-1; + if( s_work.key_csr & 0x8000 ) s_work.key_csr = KEY_PER_LINE-1; + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + do + { + s_work.key_csr += KEY_PER_LINE; + if( s_work.key_csr >= CHAR_LIST_CHAR_NUM ) s_work.key_csr -= KEY_PER_LINE*(s_work.key_csr/KEY_PER_LINE); + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_UP ){ + do + { + if( s_work.key_csr < KEY_PER_LINE ) s_work.key_csr += (CHAR_LIST_CHAR_NUM/KEY_PER_LINE)*KEY_PER_LINE; + else s_work.key_csr -= KEY_PER_LINE; + if( s_work.key_csr >= CHAR_LIST_CHAR_NUM ) s_work.key_csr -= KEY_PER_LINE; + } + while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); + } + + func[0] = (SelectSomethingFunc)SelectSoftwareKeyFunc; + tp_select = SelectSomethingByTP(&s_work.key_csr, func, 1 ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // キーが押された + PushKeys( char_tbl[s_work.char_mode][s_work.key_csr] ); + }else if( pad.trg & PAD_BUTTON_B ) { + DeleteACharacter(); + } +} + +// パラメータ編集画面の描画処理 +static void DrawSetParameterScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"PARAMETER" ); + PutStringUTF16( 128-60 , 21 , TXT_UCOLOR_G0, s_work.temp_parameter ); + DrawCharKeys(); +} + +// パラメータ編集の初期化 +static void SetParameterInit( void ) +{ + SetSoftKeyboardButton(0); + s_work.key_csr = KEY_START; + + // パラメータ用テンポラリバッファの初期化 + MI_CpuCopy8(s_work.parameter, s_work.temp_parameter, 2*(PARAM_LENGTH+1)); + s_work.temp_parameter_length = MY_StrLen( s_work.temp_parameter ); + if( s_work.temp_parameter_length < PARAM_LENGTH ) { + SVC_CpuClear(CHAR_USCORE, &s_work.temp_parameter[ s_work.temp_parameter_length ], + ( PARAM_LENGTH - s_work.temp_parameter_length ) * 2, 16); + } + + DrawSetParameterScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// パラメータ編集メイン +static void SetParameterMain( void ) +{ + ReadTP(); + + PadDetectOnKey(); + + // 描画処理 + DrawSetParameterScene(); +} + +static void DrawMenuScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"CooperationC"); + PutStringUTF16( s_work.starx-6, s_work.stary-6, TXT_UCOLOR_G0, (const u16 *)L"L"); + PutStringUTF16( 128 , 8*8, TXT_UCOLOR_G0, s_work.parameter ); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + // メニュー項目 + DrawMenu( s_work.csr, &s_menuParam ); + PrintfSJIS( 1*8, 20*8, TXT_COLOR_BLACK, "Lの位置:(%d,%d)",s_work.starx, s_work.stary); +} + +static void MenuScene(void) +{ + BOOL tp_select = FALSE; + static TPData tgt = (TPData){0,0,0,0}; + BootFlags tempflag = {TRUE, 0, TRUE, FALSE, FALSE, FALSE, 0}; + + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( ++s_work.csr == COPA_MENU_ELEMENT_NUM ) { + s_work.csr=0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --s_work.csr & 0x80 ) { + s_work.csr=COPA_MENU_ELEMENT_NUM - 1; + } + } + tp_select = SelectMenuByTP( &s_work.csr, &s_menuParam ); + + if(tpd.disp.touch) + { + tgt = tpd.disp; + if(s_work.starx != tgt.x) s_work.starx += (((tgt.x - s_work.starx)>>3) + ((tgt.x > s_work.starx) ? 1 : -1) ); + if(s_work.stary != tgt.y) s_work.stary += (((tgt.y - s_work.stary)>>3) + ((tgt.y > s_work.stary) ? 1 : -1) ); + } + + DrawMenuScene(); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( s_menuPos[ s_work.csr ].enable ) { + switch( s_work.csr ) { + case 0: + SetParameterInit(); + s_work.pNowProcess = SetParameterMain; + break; + case 1: + // 現在のアプリ状態をセーブ + { + FSFile f; + FS_InitFile(&f); + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"ライトエラー1",s_work.parameter,14); break;} + FS_CreateFile("test.dat", FS_PERMIT_R | FS_PERMIT_W ); + if(!FS_OpenFileEx(&f, "test.dat", FS_FILEMODE_W)) {MI_CpuCopy8(L"ライトエラー2",s_work.parameter,14); break;} + if(-1 == FS_WriteFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8(L"ライトエラー3",s_work.parameter,14); break;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8(L"ライトエラー4",s_work.parameter,14); break;} + } + // アプリ間パラメータをセット + { + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + // メーカーコードとゲームコードのセット(Launcher側でやるべき?) + u16 *maker_code_src_addr = (u16 *)(HW_TWL_ROM_HEADER_BUF + 0x10); + u32 *game_code_src_addr = (u32 *)(HW_TWL_ROM_HEADER_BUF + 0xc); + arginfo->makerCode = *maker_code_src_addr; + // まだゲームコードは証明書の関係でNTRJしか入ってない……ので強制的に値代入 + //arginfo->gameCode = *game_code_src_addr; + arginfo->gameCode = 0x43504f43; // 下位から'C','O','P','C' + // アプリ専用部分のセット + MI_CpuCopy8(s_work.parameter, arginfo->buf, 2*(PARAM_LENGTH+1)); + } + //B起動 + OS_SetResetParamAndResetHardware( 0, 0x00010001434f5042, &tempflag ); + break; + case 2: + OS_SetResetParamAndResetHardware( 0, NULL, &tempflag ); + //再起動 + break; + } + } + } +} + +// 初期化 +void CooperationCInit( void ) +{ + ChangeUserColor( TSD_GetUserColor() ); + s_work.parameter[0] = 0; + MenuInit(); + + { + OSDeliverArgInfo *arginfo = (OSDeliverArgInfo *)HW_PARAM_DELIVER_ARG; + if(arginfo->gameCode != NULL) + { + if(STD_CompareNString((const char *)arginfo->buf, "-r", 3) == 0) + { + // セーブしたデータから復帰 + FSFile f; + FS_InitFile(&f); + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"リードエラー1",s_work.parameter,14); return;} + if(!FS_OpenFileEx(&f, "test.dat", FS_FILEMODE_R)) {return;} + if(-1 == FS_ReadFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8(L"リードエラー2",s_work.parameter,14); return;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8(L"リードエラー3",s_work.parameter,14); return;} + } + } + } +} + +// メインループ +void CooperationCMain(void) +{ + s_work.pNowProcess(); +} + + +//====================================================== +// ソフトウェアキーボード用キャラテーブル +//====================================================== + +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM] = { + { // ひらがな + L'あ', L'い', L'う', L'え', L'お', + L'か', L'き', L'く', L'け', L'こ', DEL_BUTTON_, + L'さ', L'し', L'す', L'せ', L'そ', + L'た', L'ち', L'つ', L'て', L'と', SPACE_BUTTON_, + L'な', L'に', L'ぬ', L'ね', L'の', + L'は', L'ひ', L'ふ', L'へ', L'ほ', EOM_, + + L'ま', L'み', L'む', L'め', L'も', + L'や', EOM_, L'ゆ', EOM_, L'よ', VAR_BUTTON1_, + L'ら', L'り', L'る', L'れ', L'ろ', + L'わ', L'ゐ', L'ゑ', L'を', L'ん', VAR_BUTTON2_, + L'ぁ', L'ぃ', L'ぅ', L'ぇ', L'ぉ', + L'ゃ', EOM_, L'ゅ', EOM_, L'ょ', EOM_, + + L'が', L'ぎ', L'ぐ', L'げ', L'ご', + L'ざ', L'じ', L'ず', L'ぜ', L'ぞ', EOM_, + L'だ', L'ぢ', L'づ', L'で', L'ど', + L'ば', L'び', L'ぶ', L'べ', L'ぼ', OK_BUTTON_, + L'ぱ', L'ぴ', L'ぷ', L'ぺ', L'ぽ', + L'っ', L'、', L'。', L'!', L'?', EOM_, + + L'「', L'」', L'〜', L'・', L'ー', + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // カタカナ + L'ア', L'イ', L'ウ', L'エ', L'オ', + L'カ', L'キ', L'ク', L'ケ', L'コ', DEL_BUTTON_, + L'サ', L'シ', L'ス', L'セ', L'ソ', + L'タ', L'チ', L'ツ', L'テ', L'ト', SPACE_BUTTON_, + L'ナ', L'ニ', L'ヌ', L'ネ', L'ノ', + L'ハ', L'ヒ', L'フ', L'ヘ', L'ホ', EOM_, + + L'マ', L'ミ', L'ム', L'メ', L'モ', + L'ヤ', EOM_, L'ユ', EOM_, L'ヨ', VAR_BUTTON1_, + L'ラ', L'リ', L'ル', L'レ', L'ロ', + L'ワ', EOM_, L'ヲ', EOM_, L'ン', VAR_BUTTON2_, + L'ァ', L'ィ', L'ゥ', L'ェ', L'ォ', + L'ャ', EOM_, L'ュ', EOM_, L'ョ', EOM_, + + L'ガ', L'ギ', L'グ', L'ゲ', L'ゴ', + L'ザ', L'ジ', L'ズ', L'ゼ', L'ゾ', EOM_, + L'ダ', L'ヂ', L'ヅ', L'デ', L'ド', + L'バ', L'ビ', L'ブ', L'ベ', L'ボ', OK_BUTTON_, + L'パ', L'ピ', L'プ', L'ペ', L'ポ', + L'ッ', L'、', L'。', L'!', L'ー', EOM_, + + L'「', L'」', L'〜', L'・', EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // 英数 + L'A', L'B', L'C', L'D', L'E', + L'F', L'G', L'H', L'I', L'J', DEL_BUTTON_, + L'K', L'L', L'M', L'N', L'O', + L'P', L'Q', L'R', L'S', L'T', SPACE_BUTTON_, + L'U', L'V', L'W', L'X', L'Y', + L'Z', EOM_, EOM_, EOM_, EOM_, EOM_, + + L'a', L'b', L'c', L'd', L'e', + L'f', L'g', L'h', L'i', L'j', VAR_BUTTON1_, + L'k', L'l', L'm', L'n', L'o', + L'p', L'q', L'r', L's', L't', VAR_BUTTON2_, + L'u', L'v', L'w', L'x', L'y', + L'z', EOM_, EOM_, EOM_, EOM_, EOM_, + + L'0', L'1', L'2', L'3', L'4', + L'5', L'6', L'7', L'8', L'9', EOM_, + L'!', EOM_, L'&', EOM_, L'/', + L',', EOM_, L'.', EOM_, L'−', OK_BUTTON_, + L'’', EOM_, L'”', EOM_, EOM_, + L'@', EOM_, L'(', EOM_, L')', EOM_, + + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, +}; \ No newline at end of file diff --git a/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.h b/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.h new file mode 100644 index 00000000..f5c21649 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: CooperationC.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_C_H__ +#define __COOPERATION_C_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +void CooperationCInit( void ); +void CooperationCMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __COOPERATION_C_H__ diff --git a/build/tests/AppliCooperation/CooperationC/ARM9/src/main.c b/build/tests/AppliCooperation/CooperationC/ARM9/src/main.c new file mode 100644 index 00000000..eae44518 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationC/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 "CooperationC.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)THW_ReadSecureInfo(); + g_isValidTSD = SYSM_ReadTWLSettingsFile(); + if( g_isValidTSD ) { + SYSM_CaribrateTP(); + } + + InitBG(); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + CooperationCInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + CooperationCMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/AppliCooperation/CooperationC/Makefile b/build/tests/AppliCooperation/CooperationC/Makefile new file mode 100644 index 00000000..9cf34e12 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationC/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/AppliCooperation/CooperationC/banner/Makefile b/build/tests/AppliCooperation/CooperationC/banner/Makefile new file mode 100644 index 00000000..ea261271 --- /dev/null +++ b/build/tests/AppliCooperation/CooperationC/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/AppliCooperation/CooperationC/banner/banner_v3.bsf b/build/tests/AppliCooperation/CooperationC/banner/banner_v3.bsf new file mode 100644 index 0000000000000000000000000000000000000000..44d1726f0cfd0008ac03707a4d7b630a8335add7 GIT binary patch literal 886 zcmc(eO-jT-5QX1X!8-)9R$BxY**Rh24{4VoD!9qao*9k!WP}!`JcV{ zZlD`YQBtF5(kcox*F70aZiK=>YqXcdmS{m-`aS1nMx`d}u(xm}baJ30U1+$`&RlnQ z=yK{xEzujH@X%{=wR2sO+0v`|G+*ZVC47pCck^aGOzbg3UHbYl^I9>dQZXz`KfQ{s zZOhuA6J7T}pWu!Ab~o-bTfOhd(6n?)aT$FW5fOnaZG{R literal 0 HcmV?d00001 diff --git a/build/tests/AppliCooperation/CooperationC/banner/icon/gameIcon.bmp b/build/tests/AppliCooperation/CooperationC/banner/icon/gameIcon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0d8cd7c400665fc6476fd9a4bc8035e8c75513fc GIT binary patch literal 630 zcmY+BzfU4T6vy8glPmRl3fWK?sE#H40qjLYdM^L#j;}4PNE!a83 zr%)(RrBb1Ky-uFzQLELWPNzftexC+|0S$*knoK4%o6RUm5}MEFq?Dr7YDMJ#7xXm@ zL#%kN>pF|f29m5dHsto>acshpQ*b22Y z+50nvaCm`ZRI9aA9PueC96aC@4Y!tojnIUU^M}yzeB=|(aXYHn3md+l-5m*jZtm!J zxC55QBC!=%ZznJ;jIZvQ<)!*-eYPJWkK1@`niiICU#=c6AIu*1dqK94$2ZSH3*-2J z1(}k!PtU>%Cz=m&H!Xq;s+3Y-LAMAtmNxPVzx1Pj G3VH{lRu*gk literal 0 HcmV?d00001 diff --git a/build/tests/AppliCooperation/Makefile b/build/tests/AppliCooperation/Makefile new file mode 100644 index 00000000..0f3d37b5 --- /dev/null +++ b/build/tests/AppliCooperation/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 = CooperationA CooperationB CooperationC + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/Makefile b/build/tests/Makefile index 8b841df2..8002d17b 100644 --- a/build/tests/Makefile +++ b/build/tests/Makefile @@ -20,7 +20,7 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs #---------------------------------------------------------------------------- -SUBDIRS = RelocateChecker +SUBDIRS = RelocateChecker AppliCooperation #----------------------------------------------------------------------------