diff --git a/build/tests/AppliCooperation/CooperationA/ARM9/Makefile b/build/tests/AppliCooperation/CooperationA/ARM9/Makefile index 66f53e68..d7403156 100644 --- a/build/tests/AppliCooperation/CooperationA/ARM9/Makefile +++ b/build/tests/AppliCooperation/CooperationA/ARM9/Makefile @@ -1,6 +1,6 @@ #! make -f #---------------------------------------------------------------------------- -# Project: TwlSDK - demos - simpleShoot-1 +# Project: TwlSDK - demos.TWL - nandApp - appliCooperation - cooperationA # File: Makefile # # Copyright 2007 Nintendo. All rights reserved. @@ -16,35 +16,31 @@ # $Author: $ #---------------------------------------------------------------------------- -SUBDIRS = - #---------------------------------------------------------------------------- -TARGET_FIRM = SYSTEMMENU TARGET_PLATFORM = TWL TWL_ARCHGEN = LIMITED TITLEID_LO = COPA -TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad -TARGET_BIN = main.srl +TARGET_BIN = CooperationA.tad ROM_SPEC = main.rsf -MISC_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/misc +SRCS = main.c CooperationA.c misc_simple.c data.c -SRCS = main.c CooperationA.c \ - $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c +LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include -LINCLUDES = $(MISC_DIR)/include +LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE) -MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' +include $(TWLSDK_ROOT)/build/buildtools/commondefs -LDIRT_CLEAN = $(TARGET_TAD) -INSTALL_TARGETS = $(TARGET_TAD) +SDK_NMENU_DATADIR = $(ROOT)/build/tools/TwlNMenu/data +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) INSTALL_DIR = $(SDK_NMENU_DATADIR) #---------------------------------------------------------------------------- @@ -52,7 +48,7 @@ INSTALL_DIR = $(SDK_NMENU_DATADIR) do-build : $(TARGETS) -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include $(TWLSDK_ROOT)/build/buildtools/modulerules #---------------------------------------------------------------------------- diff --git a/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c b/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c index 9c7a60ac..e30e9c9a 100644 --- a/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c +++ b/build/tests/AppliCooperation/CooperationA/ARM9/src/CooperationA.c @@ -16,8 +16,7 @@ *---------------------------------------------------------------------------*/ #include -#include -#include "misc.h" +#include "misc_simple.h" #include "CooperationA.h" // define data------------------------------------------ @@ -27,34 +26,31 @@ #define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) // ソフトウェアキーボードLCD領域 -#define CLIST_LT_X 23 -#define CLIST_LT_Y 50 +#define CLIST_LT_X 2 +#define CLIST_LT_Y 6 -#define CLIST_MARGIN 14 +#define CLIST_MARGIN 2 #define CLIST_KEY_PER_SEGMENT 5 -#define CLIST_SEGMENT_INTERVAL 7 +#define CLIST_SEGMENT_INTERVAL 1 #define COPA_MENU_ELEMENT_NUM 3 // メニューの項目数 #define CHAR_LIST_CHAR_NUM 120 -#define CHAR_LIST_MODE_NUM 3 +#define CHAR_LIST_MODE_NUM 1 // 特殊キーコード -#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 EOM_ (char)0xf8 +#define CODE_BUTTON_TOP_ (char)0xf9 +#define DEL_BUTTON_ (char)0xf9 +#define SPACE_BUTTON_ (char)0xfa +#define VAR_BUTTON1_ (char)0xfb +#define VAR_BUTTON2_ (char)0xfc +#define OK_BUTTON_ (char)0xfd +#define CANCEL_BUTTON_ (char)0xfe +#define CODE_BUTTON_BOTTOM_ (char)0xff -#define CHAR_USCORE L'_' +#define CHAR_USCORE '_' #define KEY_PER_LINE 11 -#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー - -#define KEY_OK 0xffff -#define KEY_CANCEL 0xfffe +#define KEY_START 98 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー #define PARAM_LENGTH 10 @@ -63,8 +59,8 @@ typedef struct CopA_Work u16 csr; int char_mode; u16 key_csr; - u16 parameter[ PARAM_LENGTH + 1 ]; - u16 temp_parameter[ PARAM_LENGTH + 1 ]; + char parameter[ PARAM_LENGTH + 1 ]; + char temp_parameter[ PARAM_LENGTH + 1 ]; u8 temp_parameter_length; void(*pNowProcess)(void); int starx,stary; @@ -77,27 +73,26 @@ typedef struct CopA_Work 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}; +static CopA_Work s_work = (CopA_Work){0,0,0,"","",0,0,0}; // const data ----------------------------------------- -static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; +static const char char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; -static const u16 *s_pStrMenu[ COPA_MENU_ELEMENT_NUM ] = +static const char *s_pStrMenu[ COPA_MENU_ELEMENT_NUM ] = { - L"パラメータ設定", - L"Bを起動", - L"ランチャーに戻る", + "Set Parameter", + "Launch CooperationB", + "Return to Launcher", }; static MenuPos s_menuPos[] = { - { TRUE, 4 * 8, 8 * 8 }, - { TRUE, 4 * 8, 10 * 8 }, - { TRUE, 4 * 8, 12 * 8 }, - { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 3, 6 }, + { TRUE, 3, 8 }, + { TRUE, 3, 10 }, + { TRUE, 3, 12 }, }; static const MenuParam s_menuParam = { @@ -106,50 +101,36 @@ static const MenuParam s_menuParam = { TXT_COLOR_GREEN, TXT_COLOR_RED, &s_menuPos[ 0 ], - (const u16 **)&s_pStrMenu, + (const char **)&s_pStrMenu, }; -static const u16 *str_button_char[CHAR_LIST_MODE_NUM] = { - L"かな", - L"カナ", - L"英数", +static const char *str_button_char[CHAR_LIST_MODE_NUM] = { + "eisuu", }; -static u16 next_char_mode[CHAR_LIST_MODE_NUM-1]; +//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 char str_button_del[] = "DEL"; +static const char str_button_space[] = "SPACE"; +static const char str_button_ok[] = "OK"; +static const char str_button_cancel[] = "CANCEL"; -static const u16 *str_button[] = { - (const u16 *)str_button_del, - (const u16 *)str_button_space, +static const char *str_button[] = { + (const char *)str_button_del, + (const char *)str_button_space, NULL, NULL, - (const u16 *)str_button_ok, - (const u16 *)str_button_cancel, + (const char *)str_button_ok, + (const char *)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] ); + myDp_Printf( 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, MAIN_SCREEN, str_button[x] ); } else { - u16 s[2]; + char 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 ); + myDp_Printf( 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, MAIN_SCREEN, s ); } } } @@ -199,7 +181,7 @@ static void DrawCharKeys( void ) // 一文字削除 static void DeleteACharacter( void ) { - u16 *buf; + char *buf; u8 *length; buf = s_work.temp_parameter; length = &s_work.temp_parameter_length; @@ -211,12 +193,8 @@ 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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "CooperationA"); GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); @@ -227,9 +205,9 @@ static void MenuInit( void ) } // 選択中文字キー・特殊キーで決定した時の挙動 -static void PushKeys( u16 code ) +static void PushKeys( char code ) { - u16 *buf; + char *buf; u8 *length; u16 max_length; buf = s_work.temp_parameter; @@ -243,17 +221,17 @@ static void PushKeys( u16 code ) { case VAR_BUTTON1_: case VAR_BUTTON2_: - SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); +// SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); break; case DEL_BUTTON_: DeleteACharacter(); break; case SPACE_BUTTON_: - if(*length < max_length) buf[(*length)++] = L' '; + if(*length < max_length) buf[(*length)++] = ' '; break; case OK_BUTTON_: - SVC_CpuClear(0, buf + *length, (max_length - *length) * 2, 16);// ゼロクリア - MI_CpuCopy8(buf, s_work.parameter, 2*(PARAM_LENGTH+1)); + MI_CpuClear8(buf + *length, (u32)(max_length - *length));// ゼロクリア + MI_CpuCopy8(buf, s_work.parameter, (PARAM_LENGTH+1)); // セーブ後にキャンセル処理と合流 case CANCEL_BUTTON_: MenuInit(); @@ -269,73 +247,14 @@ static void PushKeys( u16 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 ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_RIGHT) ){ // カーソルの移動 do { if(s_work.key_csr%KEY_PER_LINE != KEY_PER_LINE-1) s_work.key_csr++; @@ -344,7 +263,7 @@ static void PadDetectOnKey( void ) } while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); } - if( pad.trg & PAD_KEY_LEFT ){ + if( MYPAD_IS_TRIG(PAD_KEY_LEFT) ){ do { if(s_work.key_csr%KEY_PER_LINE != 0) s_work.key_csr--; @@ -353,7 +272,7 @@ static void PadDetectOnKey( void ) } while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); } - if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動 do { s_work.key_csr += KEY_PER_LINE; @@ -361,7 +280,7 @@ static void PadDetectOnKey( void ) } while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); } - if( pad.trg & PAD_KEY_UP ){ + if( MYPAD_IS_TRIG(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; @@ -371,12 +290,10 @@ static void PadDetectOnKey( void ) 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 ) ) { // キーが押された + if( MYPAD_IS_TRIG(PAD_BUTTON_A) ) { // キーが押された PushKeys( char_tbl[s_work.char_mode][s_work.key_csr] ); - }else if( pad.trg & PAD_BUTTON_B ) { + }else if( MYPAD_IS_TRIG(PAD_BUTTON_B) ) { DeleteACharacter(); } } @@ -384,9 +301,8 @@ static void PadDetectOnKey( void ) // パラメータ編集画面の描画処理 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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "PARAMETER" ); + myDp_Printf( 11, 3, TXT_COLOR_BLACK, MAIN_SCREEN, s_work.temp_parameter ); DrawCharKeys(); } @@ -397,17 +313,14 @@ static void SetParameterInit( void ) 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 ); + MI_CpuCopy8(s_work.parameter, s_work.temp_parameter, (PARAM_LENGTH+1)); + s_work.temp_parameter_length = (u8)STD_GetStringLength( 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); + MI_CpuFill8( &s_work.temp_parameter[ s_work.temp_parameter_length ], CHAR_USCORE, (u32)(PARAM_LENGTH - s_work.temp_parameter_length) ); } DrawSetParameterScene(); - SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); - GX_SetVisiblePlane ( GX_PLANEMASK_BG0 ); GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); } @@ -415,8 +328,6 @@ static void SetParameterInit( void ) // パラメータ編集メイン static void SetParameterMain( void ) { - ReadTP(); - PadDetectOnKey(); // 描画処理 @@ -425,49 +336,55 @@ static void SetParameterMain( void ) 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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "CooperationA"); + myDp_Printf( 19 , 6, TXT_COLOR_DARKLIGHTBLUE, MAIN_SCREEN, s_work.parameter ); // メニュー項目 - DrawMenu( s_work.csr, &s_menuParam ); - PrintfSJIS( 1*8, 20*8, TXT_COLOR_BLACK, "★の位置:(%d,%d)",s_work.starx, s_work.stary); + myDp_DrawMenu( s_work.csr, MAIN_SCREEN, &s_menuParam ); + myDp_Printf( 1, 20, TXT_COLOR_BLACK, MAIN_SCREEN, "'*' pos = (%d,%d)", s_work.starx, s_work.stary); + myDp_Printf( s_work.starx, s_work.stary, TXT_COLOR_RED, MAIN_SCREEN, "*"); } static void MenuScene(void) { - BOOL tp_select = FALSE; - static TPData tgt = (TPData){0,0,0,0}; LauncherBootFlags tempflag = {TRUE, LAUNCHER_BOOTTYPE_NAND, TRUE, FALSE, FALSE, FALSE, 0}; - - ReadTP(); - + //-------------------------------------- // キー入力処理 //-------------------------------------- - if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動 if( ++s_work.csr == COPA_MENU_ELEMENT_NUM ) { s_work.csr=0; } + if( ++s_work.stary == 24) + { + s_work.stary = 0; + } } - if( pad.trg & PAD_KEY_UP ){ + if( MYPAD_IS_TRIG(PAD_KEY_UP) ){ if( --s_work.csr & 0x80 ) { s_work.csr=COPA_MENU_ELEMENT_NUM - 1; } + if( --s_work.stary == -1) + { + s_work.stary = 23; + } } - 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) ); + if( MYPAD_IS_TRIG(PAD_KEY_LEFT) ){ // カーソルの移動 + if( --s_work.starx == -1) + { + s_work.starx = 31; + } + } + if( MYPAD_IS_TRIG(PAD_KEY_RIGHT) ){ + if( ++s_work.starx == 32) + { + s_work.starx = 0; + } } DrawMenuScene(); - if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( MYPAD_IS_TRIG(PAD_BUTTON_A)) { // メニュー項目への分岐 if( s_menuPos[ s_work.csr ].enable ) { switch( s_work.csr ) { case 0: @@ -479,11 +396,11 @@ static void MenuScene(void) { FSFile f; FS_InitFile(&f); - if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"ライトエラー1",s_work.parameter,14); break;} + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8("W Error 1",s_work.parameter,10); 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;} + if(!FS_OpenFileEx(&f, "test.dat", FS_FILEMODE_W)) {MI_CpuCopy8("W Error 2",s_work.parameter,10); break;} + if(-1 == FS_WriteFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8("W Error 3",s_work.parameter,10); break;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8("W Error 4",s_work.parameter,10); break;} } // アプリ間パラメータをセット { @@ -493,7 +410,7 @@ static void MenuScene(void) OS_InitArgBufferForDelivery( OS_DELIVER_ARG_BUFFER_SIZE ); // validフラグを立てる OS_SetValidDeliveryArgumentInfo( TRUE ); - // メーカーコードとゲームコードのセット(Launcher側でやるべき?) + // メーカーコードとゲームコードのセット OS_SetMakerCodeToDeliveryArgumentInfo( *maker_code_src_addr ); OS_SetGameCodeToDeliveryArgumentInfo( *game_code_src_addr ); OS_SetTitleIdToDeliveryArgumentInfo( 0x00030004434f5041 ); @@ -515,9 +432,9 @@ static void MenuScene(void) // 初期化 void CooperationAInit( void ) { - ChangeUserColor( LCFG_TSD_GetUserColor() ); s_work.parameter[0] = 0; MenuInit(); + FS_Init(3); { if( OS_IsValidDeliveryArgumentInfo() ) @@ -528,10 +445,10 @@ void CooperationAInit( void ) // セーブしたデータから復帰 FSFile f; FS_InitFile(&f); - if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"リードエラー1",s_work.parameter,14); return;} + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8("R Error 1",s_work.parameter,10); 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;} + if(-1 == FS_ReadFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8("R Error 2",s_work.parameter,10); return;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8("R Error 3",s_work.parameter,10); return;} } } } @@ -548,87 +465,31 @@ void CooperationAMain(void) // ソフトウェアキーボード用キャラテーブル //====================================================== -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_, - }, - +static const char char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM] = { { // 英数 - 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_, + 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', DEL_BUTTON_, + 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', SPACE_BUTTON_, + 'U', 'V', 'W', 'X', 'Y', + '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_, + 'a', 'b', 'c', 'd', 'e', + 'f', 'g', 'h', 'i', 'j', EOM_, + 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', EOM_, + 'u', 'v', 'w', 'x', 'y', + '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_, + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', EOM_, + '!', EOM_, '&', EOM_, '/', + ',', EOM_, '.', EOM_, '-', OK_BUTTON_, + '\'', EOM_, '"', EOM_, EOM_, + '@', EOM_, '(', EOM_, ')', CANCEL_BUTTON_, EOM_, EOM_, EOM_, EOM_, EOM_, - EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, }, diff --git a/build/tests/AppliCooperation/CooperationA/ARM9/src/main.c b/build/tests/AppliCooperation/CooperationA/ARM9/src/main.c index 61c26b72..c92cd26c 100644 --- a/build/tests/AppliCooperation/CooperationA/ARM9/src/main.c +++ b/build/tests/AppliCooperation/CooperationA/ARM9/src/main.c @@ -16,7 +16,7 @@ *---------------------------------------------------------------------------*/ #include -#include "misc.h" +#include "misc_simple.h" #include "CooperationA.h" // extern data----------------------------------------------------------------- @@ -30,9 +30,6 @@ static void INTR_VBlank( void ); // 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------------------------------------------------------------------ @@ -42,57 +39,19 @@ RTCDrawProperty g_rtcDraw = { // ============================================================================ 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 ); // LCFG_ReadTWLSettings()の実行に必要。 - - // :::::::::::::::::::::::::::::::::::::::::::::: - // TWL設定データファイルの読み込み - // :::::::::::::::::::::::::::::::::::::::::::::: - (void)LCFG_ReadHWSecureInfo(); - g_isValidTSD = LCFG_ReadTWLSettings(); - if( g_isValidTSD ) { - SYSM_CaribrateTP(); - } - - InitBG(); - GetAndDrawRTCData( &g_rtcDraw, TRUE ); - + myInit(); + CooperationAInit(); // メインループ---------------------------- while(1){ - OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち - - ReadKeyPad(); // キー入力の取得 - ReadTP(); // TP入力の取得 + myPreMain(); + CooperationAMain(); + + myProMain(); + + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち } } diff --git a/build/tests/AppliCooperation/CooperationA/Makefile b/build/tests/AppliCooperation/CooperationA/Makefile index 9cf34e12..b9a231a1 100644 --- a/build/tests/AppliCooperation/CooperationA/Makefile +++ b/build/tests/AppliCooperation/CooperationA/Makefile @@ -1,6 +1,6 @@ #! make -f #---------------------------------------------------------------------------- -# Project: TwlIPL +# Project: TwlSDK - demos.TWL - nandApp - appliCooperation - cooperationA # File: Makefile # # Copyright 2007 Nintendo. All rights reserved. @@ -11,9 +11,9 @@ # 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 $ +# $Date:: $ +# $Rev: $ +# $Author: $ #---------------------------------------------------------------------------- include $(TWLSDK_ROOT)/build/buildtools/commondefs diff --git a/build/tests/AppliCooperation/CooperationB/ARM9/Makefile b/build/tests/AppliCooperation/CooperationB/ARM9/Makefile index 276471a5..84539004 100644 --- a/build/tests/AppliCooperation/CooperationB/ARM9/Makefile +++ b/build/tests/AppliCooperation/CooperationB/ARM9/Makefile @@ -1,6 +1,6 @@ #! make -f #---------------------------------------------------------------------------- -# Project: TwlSDK - demos - simpleShoot-1 +# Project: TwlSDK - demos.TWL - nandApp - AppliCooperation - CooperationB # File: Makefile # # Copyright 2007 Nintendo. All rights reserved. @@ -16,35 +16,31 @@ # $Author: $ #---------------------------------------------------------------------------- -SUBDIRS = - #---------------------------------------------------------------------------- -TARGET_FIRM = SYSTEMMENU TARGET_PLATFORM = TWL TWL_ARCHGEN = LIMITED TITLEID_LO = COPB -TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad -TARGET_BIN = main.srl +TARGET_BIN = CooperationB.tad ROM_SPEC = main.rsf -MISC_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/misc +SRCS = main.c CooperationB.c misc_simple.c data.c -SRCS = main.c CooperationB.c \ - $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c +LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include -LINCLUDES = $(MISC_DIR)/include +LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE) -MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' +include $(TWLSDK_ROOT)/build/buildtools/commondefs -LDIRT_CLEAN = $(TARGET_TAD) -INSTALL_TARGETS = $(TARGET_TAD) +SDK_NMENU_DATADIR = $(ROOT)/build/tools/TwlNMenu/data +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) INSTALL_DIR = $(SDK_NMENU_DATADIR) #---------------------------------------------------------------------------- @@ -52,7 +48,7 @@ INSTALL_DIR = $(SDK_NMENU_DATADIR) do-build : $(TARGETS) -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include $(TWLSDK_ROOT)/build/buildtools/modulerules #---------------------------------------------------------------------------- diff --git a/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c b/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c index 5bd3e3b6..29d2466b 100644 --- a/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c +++ b/build/tests/AppliCooperation/CooperationB/ARM9/src/CooperationB.c @@ -16,16 +16,10 @@ *---------------------------------------------------------------------------*/ #include -#include -#include "misc.h" +#include "misc_simple.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 @@ -37,23 +31,22 @@ 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 char s_parameter[ PARAM_LENGTH + 1 ]; static void(*s_pNowProcess)(void); // const data ----------------------------------------- -static const u16 *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] = +static const char *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] = { - L"呼び出し元アプリを起動", - L"ランチャーに戻る", + "Launch Former App", + "Return to Launcher", }; static MenuPos s_menuPos[] = { - { FALSE, 4 * 8, 8 * 8 }, - { TRUE, 4 * 8, 10 * 8 }, + { FALSE, 3, 6 }, + { TRUE, 3, 8 }, }; static const MenuParam s_menuParam = { @@ -62,7 +55,7 @@ static const MenuParam s_menuParam = { TXT_COLOR_GREEN, TXT_COLOR_RED, &s_menuPos[ 0 ], - (const u16 **)&s_pStrMenu, + (const char **)&s_pStrMenu, }; //====================================================== @@ -71,33 +64,27 @@ static const MenuParam s_menuParam = { 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",OS_IsValidDeliveryArgumentInfo() ? OS_GetTitleIdFromDeliveryArgumentInfo() : 0x0); - GetAndDrawRTCData( &g_rtcDraw, TRUE ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "CooperationB"); + myDp_Printf( 1, 18, TXT_COLOR_BLACK, MAIN_SCREEN, "Received Paramater:"); + myDp_Printf( 3 , 19, TXT_COLOR_DARKLIGHTBLUE, MAIN_SCREEN, s_parameter ); + myDp_Printf( 1, 14, TXT_COLOR_BLACK, MAIN_SCREEN, "Former App:"); + myDp_Printf(3, 15, TXT_COLOR_BLACK, MAIN_SCREEN, "0x%llx",OS_IsValidDeliveryArgumentInfo() ? OS_GetTitleIdFromDeliveryArgumentInfo() : 0x0); // メニュー項目 - DrawMenu( s_csr, &s_menuParam ); + myDp_DrawMenu( s_csr, MAIN_SCREEN, &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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "CooperationB"); GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); s_pNowProcess = MenuScene; - MI_CpuClear8(s_parameter, 2*(PARAM_LENGTH+1)); + MI_CpuClear8(s_parameter, (PARAM_LENGTH+1)); { if( OS_IsValidDeliveryArgumentInfo() ) @@ -106,7 +93,7 @@ static void MenuInit( void ) OS_DecodeDeliveryBuffer(); if(OS_GetArgv(1) != NULL) { - MI_CpuCopy8(OS_GetArgv(1), s_parameter, 2*(PARAM_LENGTH+1)); + MI_CpuCopy8(OS_GetArgv(1), s_parameter, (PARAM_LENGTH+1)); } else { @@ -123,29 +110,25 @@ static void MenuInit( void ) static void MenuScene(void) { - BOOL tp_select = FALSE; LauncherBootFlags tempflag = {TRUE, LAUNCHER_BOOTTYPE_NAND, TRUE, FALSE, FALSE, FALSE, 0}; - ReadTP(); - //-------------------------------------- // キー入力処理 //-------------------------------------- - if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動 if( ++s_csr == COPB_MENU_ELEMENT_NUM ) { s_csr=0; } } - if( pad.trg & PAD_KEY_UP ){ + if( MYPAD_IS_TRIG(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( MYPAD_IS_TRIG(PAD_BUTTON_A) ) { // メニュー項目への分岐 if( s_menuPos[ s_csr ].enable ) { switch( s_csr ) { case 0: @@ -181,7 +164,6 @@ static void MenuScene(void) // 初期化 void CooperationBInit( void ) { - ChangeUserColor( LCFG_TSD_GetUserColor() ); s_parameter[0] = 0; MenuInit(); } diff --git a/build/tests/AppliCooperation/CooperationB/ARM9/src/main.c b/build/tests/AppliCooperation/CooperationB/ARM9/src/main.c index 7414def0..e9267dc1 100644 --- a/build/tests/AppliCooperation/CooperationB/ARM9/src/main.c +++ b/build/tests/AppliCooperation/CooperationB/ARM9/src/main.c @@ -16,7 +16,7 @@ *---------------------------------------------------------------------------*/ #include -#include "misc.h" +#include "misc_simple.h" #include "CooperationB.h" // extern data----------------------------------------------------------------- @@ -30,9 +30,6 @@ static void INTR_VBlank( void ); // 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------------------------------------------------------------------ @@ -42,57 +39,19 @@ RTCDrawProperty g_rtcDraw = { // ============================================================================ 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 ); // LCFG_ReadTWLSettings()の実行に必要。 - - // :::::::::::::::::::::::::::::::::::::::::::::: - // TWL設定データファイルの読み込み - // :::::::::::::::::::::::::::::::::::::::::::::: - (void)LCFG_ReadHWSecureInfo(); - g_isValidTSD = LCFG_ReadTWLSettings(); - if( g_isValidTSD ) { - SYSM_CaribrateTP(); - } - - InitBG(); - GetAndDrawRTCData( &g_rtcDraw, TRUE ); - + myInit(); + CooperationBInit(); // メインループ---------------------------- while(1){ - OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち - - ReadKeyPad(); // キー入力の取得 - ReadTP(); // TP入力の取得 + myPreMain(); + CooperationBMain(); + + myProMain(); + + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち } } diff --git a/build/tests/AppliCooperation/CooperationC/ARM9/Makefile b/build/tests/AppliCooperation/CooperationC/ARM9/Makefile index 827122e5..7ff46584 100644 --- a/build/tests/AppliCooperation/CooperationC/ARM9/Makefile +++ b/build/tests/AppliCooperation/CooperationC/ARM9/Makefile @@ -1,6 +1,6 @@ #! make -f #---------------------------------------------------------------------------- -# Project: TwlSDK - demos - simpleShoot-1 +# Project: TwlSDK - demos.TWL - nandApp - AppliCooperation - CooperationC # File: Makefile # # Copyright 2007 Nintendo. All rights reserved. @@ -16,35 +16,31 @@ # $Author: $ #---------------------------------------------------------------------------- -SUBDIRS = - #---------------------------------------------------------------------------- -TARGET_FIRM = SYSTEMMENU TARGET_PLATFORM = TWL TWL_ARCHGEN = LIMITED TITLEID_LO = COPC -TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad -TARGET_BIN = main.srl +TARGET_BIN = CooperationC.tad ROM_SPEC = main.rsf -MISC_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/misc +SRCS = main.c CooperationC.c misc_simple.c data.c -SRCS = main.c CooperationC.c \ - $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c +LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include -LINCLUDES = $(MISC_DIR)/include +LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE) -MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a -include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' +include $(TWLSDK_ROOT)/build/buildtools/commondefs -LDIRT_CLEAN = $(TARGET_TAD) -INSTALL_TARGETS = $(TARGET_TAD) +SDK_NMENU_DATADIR = $(ROOT)/build/tools/TwlNMenu/data +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) INSTALL_DIR = $(SDK_NMENU_DATADIR) #---------------------------------------------------------------------------- @@ -52,7 +48,7 @@ INSTALL_DIR = $(SDK_NMENU_DATADIR) do-build : $(TARGETS) -include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include $(TWLSDK_ROOT)/build/buildtools/modulerules #---------------------------------------------------------------------------- diff --git a/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.c b/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.c index e689da91..d546331c 100644 --- a/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.c +++ b/build/tests/AppliCooperation/CooperationC/ARM9/src/CooperationC.c @@ -16,8 +16,7 @@ *---------------------------------------------------------------------------*/ #include -#include -#include "misc.h" +#include "misc_simple.h" #include "CooperationC.h" // define data------------------------------------------ @@ -27,34 +26,31 @@ #define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) // ソフトウェアキーボードLCD領域 -#define CLIST_LT_X 23 -#define CLIST_LT_Y 50 +#define CLIST_LT_X 2 +#define CLIST_LT_Y 6 -#define CLIST_MARGIN 14 +#define CLIST_MARGIN 2 #define CLIST_KEY_PER_SEGMENT 5 -#define CLIST_SEGMENT_INTERVAL 7 +#define CLIST_SEGMENT_INTERVAL 1 #define COPA_MENU_ELEMENT_NUM 3 // メニューの項目数 #define CHAR_LIST_CHAR_NUM 120 -#define CHAR_LIST_MODE_NUM 3 +#define CHAR_LIST_MODE_NUM 1 // 特殊キーコード -#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 EOM_ (char)0xf8 +#define CODE_BUTTON_TOP_ (char)0xf9 +#define DEL_BUTTON_ (char)0xf9 +#define SPACE_BUTTON_ (char)0xfa +#define VAR_BUTTON1_ (char)0xfb +#define VAR_BUTTON2_ (char)0xfc +#define OK_BUTTON_ (char)0xfd +#define CANCEL_BUTTON_ (char)0xfe +#define CODE_BUTTON_BOTTOM_ (char)0xff -#define CHAR_USCORE L'_' +#define CHAR_USCORE '_' #define KEY_PER_LINE 11 -#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー - -#define KEY_OK 0xffff -#define KEY_CANCEL 0xfffe +#define KEY_START 98 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー #define PARAM_LENGTH 10 @@ -63,8 +59,8 @@ typedef struct CopA_Work u16 csr; int char_mode; u16 key_csr; - u16 parameter[ PARAM_LENGTH + 1 ]; - u16 temp_parameter[ PARAM_LENGTH + 1 ]; + char parameter[ PARAM_LENGTH + 1 ]; + char temp_parameter[ PARAM_LENGTH + 1 ]; u8 temp_parameter_length; void(*pNowProcess)(void); int starx,stary; @@ -77,27 +73,26 @@ typedef struct CopA_Work 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}; +static CopA_Work s_work = (CopA_Work){0,0,0,"","",0,0,0}; // const data ----------------------------------------- -static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; +static const char char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; -static const u16 *s_pStrMenu[ COPA_MENU_ELEMENT_NUM ] = +static const char *s_pStrMenu[ COPA_MENU_ELEMENT_NUM ] = { - L"パラメータ設定", - L"Bを起動", - L"ランチャーに戻る", + "Set Parameter", + "Launch CooperationB", + "Return to Launcher", }; static MenuPos s_menuPos[] = { - { TRUE, 4 * 8, 8 * 8 }, - { TRUE, 4 * 8, 10 * 8 }, - { TRUE, 4 * 8, 12 * 8 }, - { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 3, 6 }, + { TRUE, 3, 8 }, + { TRUE, 3, 10 }, + { TRUE, 3, 12 }, }; static const MenuParam s_menuParam = { @@ -106,50 +101,36 @@ static const MenuParam s_menuParam = { TXT_COLOR_GREEN, TXT_COLOR_RED, &s_menuPos[ 0 ], - (const u16 **)&s_pStrMenu, + (const char **)&s_pStrMenu, }; -static const u16 *str_button_char[CHAR_LIST_MODE_NUM] = { - L"かな", - L"カナ", - L"英数", +static const char *str_button_char[CHAR_LIST_MODE_NUM] = { + "eisuu", }; -static u16 next_char_mode[CHAR_LIST_MODE_NUM-1]; +//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 char str_button_del[] = "DEL"; +static const char str_button_space[] = "SPACE"; +static const char str_button_ok[] = "OK"; +static const char str_button_cancel[] = "CANCEL"; -static const u16 *str_button[] = { - (const u16 *)str_button_del, - (const u16 *)str_button_space, +static const char *str_button[] = { + (const char *)str_button_del, + (const char *)str_button_space, NULL, NULL, - (const u16 *)str_button_ok, - (const u16 *)str_button_cancel, + (const char *)str_button_ok, + (const char *)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] ); + myDp_Printf( 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, MAIN_SCREEN, str_button[x] ); } else { - u16 s[2]; + char 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 ); + myDp_Printf( 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, MAIN_SCREEN, s ); } } } @@ -199,7 +181,7 @@ static void DrawCharKeys( void ) // 一文字削除 static void DeleteACharacter( void ) { - u16 *buf; + char *buf; u8 *length; buf = s_work.temp_parameter; length = &s_work.temp_parameter_length; @@ -211,12 +193,8 @@ 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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "CooperationC"); GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); @@ -227,9 +205,9 @@ static void MenuInit( void ) } // 選択中文字キー・特殊キーで決定した時の挙動 -static void PushKeys( u16 code ) +static void PushKeys( char code ) { - u16 *buf; + char *buf; u8 *length; u16 max_length; buf = s_work.temp_parameter; @@ -243,17 +221,17 @@ static void PushKeys( u16 code ) { case VAR_BUTTON1_: case VAR_BUTTON2_: - SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); +// SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); break; case DEL_BUTTON_: DeleteACharacter(); break; case SPACE_BUTTON_: - if(*length < max_length) buf[(*length)++] = L' '; + if(*length < max_length) buf[(*length)++] = ' '; break; case OK_BUTTON_: - SVC_CpuClear(0, buf + *length, (max_length - *length) * 2, 16);// ゼロクリア - MI_CpuCopy8(buf, s_work.parameter, 2*(PARAM_LENGTH+1)); + MI_CpuClear8(buf + *length, (u32)(max_length - *length));// ゼロクリア + MI_CpuCopy8(buf, s_work.parameter, (PARAM_LENGTH+1)); // セーブ後にキャンセル処理と合流 case CANCEL_BUTTON_: MenuInit(); @@ -269,73 +247,14 @@ static void PushKeys( u16 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 ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_RIGHT) ){ // カーソルの移動 do { if(s_work.key_csr%KEY_PER_LINE != KEY_PER_LINE-1) s_work.key_csr++; @@ -344,7 +263,7 @@ static void PadDetectOnKey( void ) } while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); } - if( pad.trg & PAD_KEY_LEFT ){ + if( MYPAD_IS_TRIG(PAD_KEY_LEFT) ){ do { if(s_work.key_csr%KEY_PER_LINE != 0) s_work.key_csr--; @@ -353,7 +272,7 @@ static void PadDetectOnKey( void ) } while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); } - if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動 do { s_work.key_csr += KEY_PER_LINE; @@ -361,7 +280,7 @@ static void PadDetectOnKey( void ) } while(char_tbl[s_work.char_mode][s_work.key_csr]==EOM_); } - if( pad.trg & PAD_KEY_UP ){ + if( MYPAD_IS_TRIG(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; @@ -371,12 +290,10 @@ static void PadDetectOnKey( void ) 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 ) ) { // キーが押された + if( MYPAD_IS_TRIG(PAD_BUTTON_A) ) { // キーが押された PushKeys( char_tbl[s_work.char_mode][s_work.key_csr] ); - }else if( pad.trg & PAD_BUTTON_B ) { + }else if( MYPAD_IS_TRIG(PAD_BUTTON_B) ) { DeleteACharacter(); } } @@ -384,9 +301,8 @@ static void PadDetectOnKey( void ) // パラメータ編集画面の描画処理 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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "PARAMETER" ); + myDp_Printf( 11, 3, TXT_COLOR_BLACK, MAIN_SCREEN, s_work.temp_parameter ); DrawCharKeys(); } @@ -397,17 +313,14 @@ static void SetParameterInit( void ) 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 ); + MI_CpuCopy8(s_work.parameter, s_work.temp_parameter, (PARAM_LENGTH+1)); + s_work.temp_parameter_length = (u8)STD_GetStringLength( 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); + MI_CpuFill8( &s_work.temp_parameter[ s_work.temp_parameter_length ], CHAR_USCORE, (u32)(PARAM_LENGTH - s_work.temp_parameter_length) ); } DrawSetParameterScene(); - SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); - GX_SetVisiblePlane ( GX_PLANEMASK_BG0 ); GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); } @@ -415,8 +328,6 @@ static void SetParameterInit( void ) // パラメータ編集メイン static void SetParameterMain( void ) { - ReadTP(); - PadDetectOnKey(); // 描画処理 @@ -425,49 +336,55 @@ static void SetParameterMain( void ) 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 ); + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "CooperationC"); + myDp_Printf( 19 , 6, TXT_COLOR_DARKLIGHTBLUE, MAIN_SCREEN, s_work.parameter ); // メニュー項目 - DrawMenu( s_work.csr, &s_menuParam ); - PrintfSJIS( 1*8, 20*8, TXT_COLOR_BLACK, "Lの位置:(%d,%d)",s_work.starx, s_work.stary); + myDp_DrawMenu( s_work.csr, MAIN_SCREEN, &s_menuParam ); + myDp_Printf( 1, 20, TXT_COLOR_BLACK, MAIN_SCREEN, "'$' pos = (%d,%d)", s_work.starx, s_work.stary); + myDp_Printf( s_work.starx, s_work.stary, TXT_COLOR_RED, MAIN_SCREEN, "$"); } static void MenuScene(void) { - BOOL tp_select = FALSE; - static TPData tgt = (TPData){0,0,0,0}; LauncherBootFlags tempflag = {TRUE, LAUNCHER_BOOTTYPE_NAND, TRUE, FALSE, FALSE, FALSE, 0}; - - ReadTP(); - + //-------------------------------------- // キー入力処理 //-------------------------------------- - if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動 if( ++s_work.csr == COPA_MENU_ELEMENT_NUM ) { s_work.csr=0; } + if( ++s_work.stary == 24) + { + s_work.stary = 0; + } } - if( pad.trg & PAD_KEY_UP ){ + if( MYPAD_IS_TRIG(PAD_KEY_UP) ){ if( --s_work.csr & 0x80 ) { s_work.csr=COPA_MENU_ELEMENT_NUM - 1; } + if( --s_work.stary == -1) + { + s_work.stary = 23; + } } - 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) ); + if( MYPAD_IS_TRIG(PAD_KEY_LEFT) ){ // カーソルの移動 + if( --s_work.starx == -1) + { + s_work.starx = 31; + } + } + if( MYPAD_IS_TRIG(PAD_KEY_RIGHT) ){ + if( ++s_work.starx == 32) + { + s_work.starx = 0; + } } DrawMenuScene(); - if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( MYPAD_IS_TRIG(PAD_BUTTON_A)) { // メニュー項目への分岐 if( s_menuPos[ s_work.csr ].enable ) { switch( s_work.csr ) { case 0: @@ -479,11 +396,11 @@ static void MenuScene(void) { FSFile f; FS_InitFile(&f); - if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"ライトエラー1",s_work.parameter,14); break;} + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8("W Error 1",s_work.parameter,10); 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;} + if(!FS_OpenFileEx(&f, "test.dat", FS_FILEMODE_W)) {MI_CpuCopy8("W Error 2",s_work.parameter,10); break;} + if(-1 == FS_WriteFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8("W Error 3",s_work.parameter,10); break;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8("W Error 4",s_work.parameter,10); break;} } // アプリ間パラメータをセット { @@ -493,7 +410,7 @@ static void MenuScene(void) OS_InitArgBufferForDelivery( OS_DELIVER_ARG_BUFFER_SIZE ); // validフラグを立てる OS_SetValidDeliveryArgumentInfo( TRUE ); - // メーカーコードとゲームコードのセット(Launcher側でやるべき?) + // メーカーコードとゲームコードのセット OS_SetMakerCodeToDeliveryArgumentInfo( *maker_code_src_addr ); OS_SetGameCodeToDeliveryArgumentInfo( *game_code_src_addr ); OS_SetTitleIdToDeliveryArgumentInfo( 0x00030004434f5043 ); @@ -515,12 +432,12 @@ static void MenuScene(void) // 初期化 void CooperationCInit( void ) { - ChangeUserColor( LCFG_TSD_GetUserColor() ); s_work.parameter[0] = 0; MenuInit(); + FS_Init(3); { - if(OS_IsValidDeliveryArgumentInfo()) + if( OS_IsValidDeliveryArgumentInfo() ) { OS_DecodeDeliveryBuffer(); if(STD_CompareNString((const char *)OS_GetArgv(1), "-r", 3) == 0) @@ -528,10 +445,10 @@ void CooperationCInit( void ) // セーブしたデータから復帰 FSFile f; FS_InitFile(&f); - if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8(L"リードエラー1",s_work.parameter,14); return;} + if(!FS_SetCurrentDirectory("dataPrv:/")) {MI_CpuCopy8("R Error 1",s_work.parameter,10); 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;} + if(-1 == FS_ReadFile(&f, &s_work, sizeof(s_work))) {MI_CpuCopy8("R Error 2",s_work.parameter,10); return;} + if(!FS_CloseFile( &f )) {MI_CpuCopy8("R Error 3",s_work.parameter,10); return;} } } } @@ -548,87 +465,31 @@ void CooperationCMain(void) // ソフトウェアキーボード用キャラテーブル //====================================================== -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_, - }, - +static const char char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM] = { { // 英数 - 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_, + 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', DEL_BUTTON_, + 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', SPACE_BUTTON_, + 'U', 'V', 'W', 'X', 'Y', + '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_, + 'a', 'b', 'c', 'd', 'e', + 'f', 'g', 'h', 'i', 'j', EOM_, + 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', EOM_, + 'u', 'v', 'w', 'x', 'y', + '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_, + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', EOM_, + '!', EOM_, '&', EOM_, '/', + ',', EOM_, '.', EOM_, '-', OK_BUTTON_, + '\'', EOM_, '"', EOM_, EOM_, + '@', EOM_, '(', EOM_, ')', CANCEL_BUTTON_, EOM_, EOM_, EOM_, EOM_, EOM_, - EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, EOM_, }, diff --git a/build/tests/AppliCooperation/CooperationC/ARM9/src/main.c b/build/tests/AppliCooperation/CooperationC/ARM9/src/main.c index d72cdd21..1f5e10b7 100644 --- a/build/tests/AppliCooperation/CooperationC/ARM9/src/main.c +++ b/build/tests/AppliCooperation/CooperationC/ARM9/src/main.c @@ -16,7 +16,7 @@ *---------------------------------------------------------------------------*/ #include -#include "misc.h" +#include "misc_simple.h" #include "CooperationC.h" // extern data----------------------------------------------------------------- @@ -30,9 +30,6 @@ static void INTR_VBlank( void ); // 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------------------------------------------------------------------ @@ -42,57 +39,19 @@ RTCDrawProperty g_rtcDraw = { // ============================================================================ 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 ); // LCFG_ReadTWLSettings()の実行に必要。 - - // :::::::::::::::::::::::::::::::::::::::::::::: - // TWL設定データファイルの読み込み - // :::::::::::::::::::::::::::::::::::::::::::::: - (void)LCFG_ReadHWSecureInfo(); - g_isValidTSD = LCFG_ReadTWLSettings(); - if( g_isValidTSD ) { - SYSM_CaribrateTP(); - } - - InitBG(); - GetAndDrawRTCData( &g_rtcDraw, TRUE ); - + myInit(); + CooperationCInit(); // メインループ---------------------------- while(1){ - OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち - - ReadKeyPad(); // キー入力の取得 - ReadTP(); // TP入力の取得 + myPreMain(); + CooperationCMain(); + + myProMain(); + + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち } } diff --git a/build/tests/AppliCooperation/Makefile b/build/tests/AppliCooperation/Makefile index 0f3d37b5..b640c858 100644 --- a/build/tests/AppliCooperation/Makefile +++ b/build/tests/AppliCooperation/Makefile @@ -1,6 +1,6 @@ #! make -f #---------------------------------------------------------------------------- -# Project: TwlIPL +# Project: TwlSDK - demos.TWL - nandApp - appliCooperation # File: Makefile # # Copyright 2007 Nintendo. All rights reserved. @@ -11,9 +11,9 @@ # 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 $ +# $Date:: $ +# $Rev: $ +# $Author: $ #---------------------------------------------------------------------------- include $(TWLSDK_ROOT)/build/buildtools/commondefs diff --git a/build/tests/ExecPreLoadedApp/ARM9/Makefile b/build/tests/ExecPreLoadedApp/ARM9/Makefile index cb2ec573..b3307589 100644 --- a/build/tests/ExecPreLoadedApp/ARM9/Makefile +++ b/build/tests/ExecPreLoadedApp/ARM9/Makefile @@ -34,16 +34,12 @@ LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE) -LLIBRARIES += libboc$(TWL_LIBSUFFIX).a \ - libes$(TWL_LIBSUFFIX).a \ - libnam$(TWL_LIBSUFFIX).a \ - libDEMO$(TWL_LIBSUFFIX).a +LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a ADDRESS_DTCM = 0x0e000000 MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' -include $(TWLSDK_ROOT)/add-ins/es/commondefs.es include $(TWLSDK_ROOT)/build/buildtools/commondefs DEFAULT_COMP_ARM7 = my_racoon diff --git a/build/tests/ExecPreLoadedApp/banner/banner_v3.bsf b/build/tests/ExecPreLoadedApp/banner/banner_v3.bsf index 1471d41d..05e7140d 100644 Binary files a/build/tests/ExecPreLoadedApp/banner/banner_v3.bsf and b/build/tests/ExecPreLoadedApp/banner/banner_v3.bsf differ diff --git a/build/tests/ExecPreLoadedApp/banner/icon/gameIcon.bmp b/build/tests/ExecPreLoadedApp/banner/icon/gameIcon.bmp index 3ee487c3..a8b22308 100644 Binary files a/build/tests/ExecPreLoadedApp/banner/icon/gameIcon.bmp and b/build/tests/ExecPreLoadedApp/banner/icon/gameIcon.bmp differ diff --git a/build/tests/ExecTmpApp/ARM9/Makefile b/build/tests/ExecTmpApp/ARM9/Makefile index 53937bd2..703dcf7d 100644 --- a/build/tests/ExecTmpApp/ARM9/Makefile +++ b/build/tests/ExecTmpApp/ARM9/Makefile @@ -33,14 +33,10 @@ LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE) -LLIBRARIES += libboc$(TWL_LIBSUFFIX).a \ - libes$(TWL_LIBSUFFIX).a \ - libnam$(TWL_LIBSUFFIX).a \ - libDEMO$(TWL_LIBSUFFIX).a +LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' -include $(TWLSDK_ROOT)/add-ins/es/commondefs.es include $(TWLSDK_ROOT)/build/buildtools/commondefs SDK_NMENU_DATADIR = $(ROOT)/build/tools/TwlNMenu/data diff --git a/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp b/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp index d2c5448f..588fc8cd 100644 Binary files a/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp and b/build/tests/ExecTmpApp/banner/icon/gameIcon.bmp differ diff --git a/build/tests/SimpleApp/ARM9/Makefile b/build/tests/SimpleApp/ARM9/Makefile index f55a7919..b71327c1 100644 --- a/build/tests/SimpleApp/ARM9/Makefile +++ b/build/tests/SimpleApp/ARM9/Makefile @@ -35,14 +35,10 @@ LINCLUDES = $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/include LLIBRARY_DIRS += $(TWLSDK_ROOT)/build/demos/gx/UnitTours/DEMOLib/lib/$(TWL_BUILDTYPE) -LLIBRARIES += libboc$(TWL_LIBSUFFIX).a \ - libes$(TWL_LIBSUFFIX).a \ - libnam$(TWL_LIBSUFFIX).a \ - libDEMO$(TWL_LIBSUFFIX).a +LLIBRARIES += libDEMO$(TWL_LIBSUFFIX).a MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' -include $(TWLSDK_ROOT)/add-ins/es/commondefs.es include $(TWLSDK_ROOT)/build/buildtools/commondefs #---------------------------------------------------------------------------- diff --git a/build/tests/SimpleApp/banner/icon/gameIcon.bmp b/build/tests/SimpleApp/banner/icon/gameIcon.bmp index d2c5448f..71221647 100644 Binary files a/build/tests/SimpleApp/banner/icon/gameIcon.bmp and b/build/tests/SimpleApp/banner/icon/gameIcon.bmp differ