/*---------------------------------------------------------------------------* Project: TwlSDK - tests - appjumpTest - Card File: main.c Copyright 2008 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Date:: $ $Rev$ $Author$ *---------------------------------------------------------------------------*/ #include "common.h" #include "screen.h" /*---------------------------------------------------------------------------* 変数 定義 *---------------------------------------------------------------------------*/ // キー入力 static KeyInfo gKey; // アプリ間パラメータ static AppParam gAppParam; // アプリ間パラメータとして文字列をセットするかどうか static BOOL gIsSetDelArg = TRUE; // アプリ間パラメータとして引き渡された文字列を格納するバッファ(6つまで) static char gStrAppParam[6][APPJUMP_STRING_LENGTH + 1] ATTRIBUTE_ALIGN(32); // アプリ間パラメータとして引き渡された文字列の個数 static int gArgc; /*---------------------------------------------------------------------------* Prototype *---------------------------------------------------------------------------*/ static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn); /*---------------------------------------------------------------------------*/ void TwlMain(void) { OSDeliverArgInfo argInfo; int result; int argSize =sizeof(u32); InitCommon(); InitScreen(); GX_DispOn(); GXS_DispOn(); ClearScreen(); // キー入力情報取得の空呼び出し(IPL での A ボタン押下対策) ReadKey(&gKey); OS_InitDeliverArgInfo(&argInfo, sizeof(AppParam)); OS_DecodeDeliverArg(); /* アプリ間パラメータ(バイナリデータの取得) */ if ( OS_DELIVER_ARG_SUCCESS != (result = OS_GetBinaryFromDeliverArg( &gAppParam, &argSize, sizeof(AppParam))) ) { PutMainScreen(1, 16, 0xf1, "ERROR!: READ_ERROR (%d)", result); OS_WaitVBlankIntr(); OS_Terminate(); } /* アプリ間パラメータ(文字列)の取得 */ if ((gArgc = OS_GetDeliverArgc()) > 0) { int i; OS_TPrintf("argc = %d\n", gArgc); for (i=0; i < gArgc-1 && i < 6; i++) { STD_StrLCpy(gStrAppParam[i], (const char*)OS_GetDeliverArgv(i+1), APPJUMP_STRING_LENGTH); gStrAppParam[i][APPJUMP_STRING_LENGTH] = '\0'; } } while(TRUE) { int i; // 自動テスト中に、ユーザのキー入力による終了指示を受け付けるためにウエイトを入れる if (gAppParam.isAutoJump == 1) { OSTick tick = OS_GetTick(); PutMainScreen(1, 9, 0xf8, "executing auto app jump..."); PutMainScreen(1, 11, 0xff, "wait 2 seconds..."); PutMainScreen(1, 13, 0xff, "START: quit auto app jump"); do { ReadKey(&gKey); if (gKey.trg & PAD_BUTTON_START) { break; } OS_WaitVBlankIntr(); } while (OS_TicksToSeconds(OS_GetTick() - tick) < 2); } else { // キー入力情報取得 ReadKey(&gKey); } // 画面クリア ClearScreen(); // メイン画面描画 PutMainScreen(0, 2, 0xf4, " ****** This APP is CARD ****** "); PutMainScreen(0, 5, 0xff, " APP JUMP : %u times ", gAppParam.jumpCount); PutMainScreen(0, 7, 0xff, " DELIVERED PARAM (recent 6 app)"); for (i=0; i