diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c b/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c index 6677194d..9105a7de 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c @@ -22,15 +22,15 @@ // define data------------------------------------------ // キャンセルボタンLCD領域 -#define CANCEL_BUTTON_LT_X ( 12 * 8 ) -#define CANCEL_BUTTON_LT_Y ( 21 * 8 ) -#define CANCEL_BUTTON_RB_X ( (CANCEL_BUTTON_LT_X + 8) * 8 ) -#define CANCEL_BUTTON_RB_Y ( (CANCEL_BUTTON_LT_Y + 2) * 8 ) +#define CANCEL_BUTTON_TOP_X ( 12 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + 5 * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + 2 * 8 ) // OKボタンLCD領域 -#define OK_BUTTON_LT_X ( 22 * 8 ) -#define OK_BUTTON_LT_Y ( 21 * 8 ) -#define OK_BUTTON_RB_X ( (OK_BUTTON_LT_X + 8) * 8 ) -#define OK_BUTTON_RB_Y ( (OK_BUTTON_LT_Y + 2) * 8 ) +#define OK_BUTTON_TOP_X ( 22 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + 2 * 8 ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + 2 * 8 ) #define SETTING_MENU_ELEMENT_NUM 4 // メインメニューの項目数 @@ -153,7 +153,6 @@ int MachineSettingMain( void ) { BOOL tp_select; - GetAndDrawRtcData(); ReadTP(); //-------------------------------------- @@ -218,18 +217,18 @@ int MachineSettingMain( void ) // OK / CANCELボタンの描画 void DrawOKCancelButton(void) { - (void)PutStringUTF16( CANCEL_BUTTON_LT_X, CANCEL_BUTTON_LT_Y, TXT_COLOR_CYAN, (const u16 *)L" CANCEL "); - (void)PutStringUTF16( OK_BUTTON_LT_X, OK_BUTTON_LT_Y, TXT_COLOR_CYAN, (const u16 *)L" OK "); + (void)PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"CANCEL"); + (void)PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"OK"); } // OK or CANCELボタン押下チェック void CheckOKCancelButton(BOOL *tp_ok, BOOL *tp_cancel) { - *tp_cancel = InRangeTp( CANCEL_BUTTON_LT_X, CANCEL_BUTTON_LT_Y, - CANCEL_BUTTON_RB_X, CANCEL_BUTTON_RB_Y, &tpd.disp ); - *tp_ok = InRangeTp( OK_BUTTON_LT_X, OK_BUTTON_LT_Y, - OK_BUTTON_RB_X, OK_BUTTON_RB_Y, &tpd.disp ); + *tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); + *tp_ok = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, &tpd.disp ); } diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c b/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c index 7d0a4703..8cd7d8bd 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c @@ -393,11 +393,11 @@ int TP_CalibrationMain( void ) SetPoint16x16( tpd.disp.x, tpd.disp.y ); // [OK] [CANCEL] [RETRY]ボタン押下チェック - tp_ok = InRangeTp( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + tp_ok = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, &tpd.disp ); - tp_cancel = InRangeTp( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); - tp_retry = InRangeTp( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y, + tp_retry = WithinRangeTP( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y, RETRY_BUTTON_BOTTOM_X, RETRY_BUTTON_BOTTOM_Y, &tpd.disp ); if( tpd.raw.validity==TP_VALIDITY_VALID ) { diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/main.c b/build/systemMenu_RED/MachineSettings/ARM9/src/main.c index bf346a1c..a0e86317 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/main.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/main.c @@ -31,6 +31,9 @@ static void INTR_VBlank( void ); // global variable------------------------------------------------------------- NNSFndAllocator g_allocator; int (*g_pNowProcess)( void ); +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; // static variable------------------------------------------------------------- @@ -70,8 +73,8 @@ void TwlMain(void) SYSM_CaribrateTP(); InitBG(); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); MachineSettingInit(); - InitGetAndDrawRtcData( RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y ); // メインループ---------------------------- while ( 1 ) { OS_WaitIrq( 1, OS_IE_V_BLANK ); // Vブランク割り込み待ち @@ -80,7 +83,7 @@ void TwlMain(void) (void)g_pNowProcess(); - GetAndDrawRtcData(); + GetAndDrawRTCData( &g_rtcDraw, FALSE ); } } diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/misc.c b/build/systemMenu_RED/MachineSettings/ARM9/src/misc.c index 563a8c4c..67d6de82 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/misc.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/misc.c @@ -74,6 +74,8 @@ typedef struct RtcDrawPos{ }RtcDrawPos; // function's prototype------------------------------------------------------- +static BOOL WaitDetachTP( void ); +static void StartDetachTP( void ); static void InitScreen( void ); static void InitCanvas( void ); static void GetAndDrawRtcDataCore( BOOL forceGetFlag ); @@ -285,6 +287,24 @@ void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ) } +// 書式付きで作成した文字列を表示した場合の幅を取得する +int GetPrintfWidth( const NNSG2dTextCanvas *pCanvas, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + return NNS_G2dTextCanvasGetTextWidth( pCanvas, s_strBufferUTF16 ); +} + + // SJISでPrintf形式で文字表示(内部でUTF16に変換) void PrintfSJIS( int x, int y, int color, const char *fmt, ... ) { @@ -367,7 +387,7 @@ void ReadTP(void) // TPデタッチを待つ -BOOL WaitDetachTP( void ) +static BOOL WaitDetachTP( void ) { // s_detach_countが始動していたら、カウント判定。 if(s_detach_count > 0) { @@ -383,7 +403,7 @@ BOOL WaitDetachTP( void ) // TPデタッチ待ちの開始 -void StartDetachTP( void ) +static void StartDetachTP( void ) { s_detach_count = TP_CSR_DETACH_COUNT; } @@ -451,7 +471,7 @@ BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ) OS_TPrintf( "MENU[ %d ] : top_x = %02d top_y = %02d bot_x = %02d bot_y = %02d : ", i, top_x, top_y, bottom_x, bottom_y ); - if( InRangeTp( top_x, top_y, bottom_x, bottom_y, target ) ) { + if( WithinRangeTP( top_x, top_y, bottom_x, bottom_y, target ) ) { OS_TPrintf( "InRange\n" ); if( tpd.disp.validity == TP_VALIDITY_VALID ) { // カーソルをその要素に移動 if( csr_old == i ) { @@ -482,7 +502,7 @@ BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ) // 現在のタッチパネル座標が指定領域内にあるかどうかを返す。 -BOOL InRangeTp( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ) +BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ) { if( ( tgt->x >= top_x ) && ( tgt->x <= bottom_x ) && @@ -497,79 +517,6 @@ BOOL InRangeTp( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ) } -//=============================================== -// RTCアクセスルーチン -//=============================================== - -// RTCデータ取得&表示の初期化 -void InitGetAndDrawRtcData( int drawDatePos_x, int drawDatePos_y, int drawTimePos_x, int drawTimePos_y) -{ - s_vcount = 0; - s_rtcPos.date_x = drawDatePos_x; - s_rtcPos.date_y = drawDatePos_y; - s_rtcPos.time_x = drawTimePos_x; - s_rtcPos.time_y = drawTimePos_y; - - (void)RTC_GetDateTime( &s_rtcDate, &s_rtcTime); - GetAndDrawRtcDataCore( TRUE ); -} - - -void GetAndDrawRtcData( void ) -{ - GetAndDrawRtcDataCore( FALSE ); -} - - -// RTC情報の取得&表示 -static void GetAndDrawRtcDataCore( BOOL forceGetFlag ) -{ - u32 year; - RTCDate date_old; - RTCTime time_old; - - // RTC情報の取得 - if( forceGetFlag || ( s_vcount++ == 60 ) ) { - s_vcount = 0; - MI_CpuCopy16( &s_rtcDate, &date_old, sizeof(RTCDate) ); - MI_CpuCopy16( &s_rtcTime, &time_old, sizeof(RTCTime) ); - - (void)RTC_GetDateTime( &s_rtcDate, &s_rtcTime ); - - // 前RTC情報の消去 - { - year = s_rtcDate.year + 2000; - PrintfSJISSub( s_rtcPos.date_x, s_rtcPos.date_y, TXT_COLOR_WHITE, "%d/%02d/%02d[%3s]", - year, - date_old.month, - date_old.day, - g_strWeek[ date_old.week ] - ); - PrintfSJISSub( s_rtcPos.time_x, s_rtcPos.time_y, TXT_COLOR_WHITE, "%02d:%02d:%02d", - time_old.hour, - time_old.minute, - time_old.second - ); - } - // RTC情報の表示 - { - year = s_rtcDate.year + 2000; - PrintfSJISSub( s_rtcPos.date_x, s_rtcPos.date_y, TXT_COLOR_BLACK, "%d/%02d/%02d[%3s]", - year, - s_rtcDate.month, - s_rtcDate.day, - g_strWeek[ s_rtcDate.week ] - ); - PrintfSJISSub( s_rtcPos.time_x, s_rtcPos.time_y, TXT_COLOR_BLACK, "%02d:%02d:%02d", - s_rtcTime.hour, - s_rtcTime.minute, - s_rtcTime.second - ); - } - } -} - - // バナーアイコンOBJのロード void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ) { @@ -588,3 +535,68 @@ void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ) 15, // palette 0); // affine } + + +//=============================================== +// RTCアクセスルーチン +//=============================================== + +// RTCデータの取得 +BOOL GetRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ) +{ + if( forceGetFlag || ( pRTCDraw->vcount++ == 59 ) ) { + pRTCDraw->vcount = 0; + MI_CpuCopy16( &pRTCDraw->date, &pRTCDraw->date_old, sizeof(RTCDate) ); + MI_CpuCopy16( &pRTCDraw->time, &pRTCDraw->time_old, sizeof(RTCTime) ); + (void)RTC_GetDateTime( &pRTCDraw->date, &pRTCDraw->time ); + return TRUE; + } + return FALSE; +} + + +// RTCデータの表示 +void DrawRTCData( RTCDrawProperty *pRTCDraw ) +{ + void (*pPrintFunc)( int x, int y, int color, const char *fmt, ... ) = + ( pRTCDraw->isTopLCD ) ? PrintfSJISSub : PrintfSJIS; + + // 前RTC情報の消去 + { + u32 year = pRTCDraw->date_old.year + 2000; + pPrintFunc( pRTCDraw->date_x, pRTCDraw->date_y, TXT_COLOR_WHITE, "%04d/%02d/%02d[%3s]", + year, + pRTCDraw->date_old.month, + pRTCDraw->date_old.day, + g_strWeek[ pRTCDraw->date_old.week ] + ); + pPrintFunc( pRTCDraw->time_x, pRTCDraw->time_y, TXT_COLOR_WHITE, "%02d:%02d:%02d", + pRTCDraw->time_old.hour, + pRTCDraw->time_old.minute, + pRTCDraw->time_old.second + ); + } + // RTC情報の表示 + { + u32 year = pRTCDraw->date.year + 2000; + pPrintFunc( pRTCDraw->date_x, pRTCDraw->date_y, TXT_COLOR_BLACK, "%d/%02d/%02d[%3s]", + year, + pRTCDraw->date.month, + pRTCDraw->date.day, + g_strWeek[ pRTCDraw->date.week ] + ); + pPrintFunc( pRTCDraw->time_x, pRTCDraw->time_y, TXT_COLOR_BLACK, "%02d:%02d:%02d", + pRTCDraw->time.hour, + pRTCDraw->time.minute, + pRTCDraw->time.second + ); + } +} + +// RTCデータの取得&表示 +void GetAndDrawRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ) +{ + if( GetRTCData( pRTCDraw, forceGetFlag ) ) { + DrawRTCData( pRTCDraw ); + } +} diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/misc.h b/build/systemMenu_RED/MachineSettings/ARM9/src/misc.h index c025ce7b..e0f0a404 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/misc.h +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/misc.h @@ -119,10 +119,25 @@ typedef struct MenuParam { }MenuParam; +// RTCデータ表示位置ワーク +typedef struct RTCDrawProperty { + BOOL isTopLCD; + int date_x; + int date_y; + int time_x; + int time_y; + int vcount; + RTCDate date; + RTCTime time; + RTCDate date_old; + RTCTime time_old; +}RTCDrawProperty; + // global variables-------------------------------------------------- extern TpWork tpd; // タッチパネルデータ extern KeyWork pad; // キーパッド入力データ extern const u8 *const g_strWeek[ 7 ]; // 曜日文字列 +extern RTCDrawProperty g_rtcDraw; extern NNSFndAllocator g_allocator; // メモリアロケータ extern NNSG2dFont gFont; // フォント @@ -131,20 +146,20 @@ extern NNSG2dTextCanvas gTextCanvas; // TextCanvas // function------------------------------------------------------------- void InitBG( void ); +int GetPrintfWidth( const NNSG2dTextCanvas *pCanvas, const char *fmt, ... ); void PutStringUTF16 ( int x, int y, int color, const u16 *strUTF16 ); void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ); void PrintfSJIS ( int x, int y, int color, const char *fmt, ... ); void PrintfSJISSub( int x, int y, int color, const char *fmt, ... ); void ReadKeyPad( void ); void ReadTP( void ); -BOOL WaitDetachTP( void ); -void StartDetachTP( void ); void DrawMenu( u16 nowCsr, const MenuParam *pMenu ); BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ); -BOOL InRangeTp( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ); -void InitGetAndDrawRtcData( int drawDatePos_x, int drawDatePos_y, int drawTimePos_x, int drawTimePos_y ); -void GetAndDrawRtcData( void ); +BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ); void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ); +BOOL GetRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ); +void DrawRTCData( RTCDrawProperty *pRTCDraw ); +void GetAndDrawRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ); #ifdef __cplusplus } diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/AgbLcdSel.c b/build/systemMenu_RED/MachineSettings/ARM9/src/old/AgbLcdSel.c deleted file mode 100644 index cc9bd64f..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/AgbLcdSel.c +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: AgbLcdSel.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include "misc.h" -#include "DS_Setting.h" - -// define data------------------------------------------ -#define CANCEL_BUTTON_LT_X 2 -#define CANCEL_BUTTON_LT_Y 21 -#define CANCEL_BUTTON_RB_X (CANCEL_BUTTON_LT_X+8) -#define CANCEL_BUTTON_RB_Y (CANCEL_BUTTON_LT_Y+2) - -// extern data------------------------------------------ - -// function's prototype declaration--------------------- -void SEQ_AgbLcdSelect_init(void); -int SEQ_AgbLcdSelect(void); - -// global variable ------------------------------------- - -// static variable ------------------------------------- -static u16 agbLcd = 0; - -// const data ----------------------------------------- -static const u8 *const str_lcd[] ATTRIBUTE_ALIGN(2) = { - (const u8 *)"TOP LCD", - (const u8 *)"BOTTOM LCD", -}; - -static const MenuComponent agbLcdSel = { - 2, - 10, - 8, - 0, - 4, - 8, - WHITE, - HIGHLIGHT_Y, - (const u8 **)&str_lcd, -}; - - -//====================================================== -// function's description -//====================================================== - -// AGBモード設定の初期化 -void SEQ_AgbLcdSelect_init(void) -{ - GXS_SetVisiblePlane(GX_PLANEMASK_NONE); - - MI_CpuClearFast(bgBakS,sizeof(bgBakS)); - - ClearAllStringSJIS(); - - (void)DrawStringSJIS( 1, 0, YELLOW, (const u8 *)"AGB-MODE LCD SELECT"); - (void)DrawStringSJIS( CANCEL_BUTTON_LT_X, CANCEL_BUTTON_LT_Y,HIGHLIGHT_C, (const u8 *)" CANCEL "); - - if(GetSYSMWork()->ncd_invalid) { - agbLcd = 0; - }else { - agbLcd = GetNCDWork()->option.agbLcd; - if(agbLcd > 1) agbLcd = 1; - } - - DrawMenu((u16)agbLcd, &agbLcdSel); - SVC_CpuClear(0x0000, &tpd, sizeof(TpWork), 16); - - GXS_SetVisiblePlane(GX_PLANEMASK_OBJ | GX_PLANEMASK_BG1); -} - - -// AGBモード設定 -int SEQ_AgbLcdSelect(void) -{ - BOOL tp_select; - BOOL tp_cancel = FALSE; - - ReadTP(); // タッチパネル入力の取得 - - //-------------------------------------- - // キー入力処理 - //-------------------------------------- - if(pad.trg & (PAD_KEY_DOWN | PAD_KEY_UP)){ // カーソルの移動 - agbLcd ^= 0x01; - } - tp_select = SelectMenuByTp((u16 *)&agbLcd, &agbLcdSel); - DrawMenu((u16)agbLcd, &agbLcdSel); - - // [CANCEL]ボタン押下チェック - if(tpd.disp.touch) { - tp_cancel = InRangeTp(CANCEL_BUTTON_LT_X*8, CANCEL_BUTTON_LT_Y*8, - CANCEL_BUTTON_RB_X*8, CANCEL_BUTTON_RB_Y*8, &tpd.disp); - } - - if((pad.trg & PAD_BUTTON_A) || (tp_select)) { // メニュー項目への分岐 - GetSYSMWork()->ncd_invalid = 0; - GetNCDWork()->option.agbLcd = agbLcd; - // :::::::::::::::::::::::::::::::::::::::::::::: - // NVRAMへの書き込み - // :::::::::::::::::::::::::::::::::::::::::::::: - (void)NVRAMm_WriteNitroConfigData(GetNCDWork()); - SEQ_MainMenu_init(); - return 0; - }else if((pad.trg & PAD_BUTTON_B) || (tp_cancel)) { - SEQ_MainMenu_init(); - return 0; - } - - ReadTP(); - - return 0; -} - - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/autoBoot.c b/build/systemMenu_RED/MachineSettings/ARM9/src/old/autoBoot.c deleted file mode 100644 index 77fba356..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/autoBoot.c +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: autoBoot.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include "misc.h" -#include "DS_Setting.h" - -// define data------------------------------------------ -#define CANCEL_BUTTON_LT_X 2 -#define CANCEL_BUTTON_LT_Y 21 -#define CANCEL_BUTTON_RB_X (CANCEL_BUTTON_LT_X+8) -#define CANCEL_BUTTON_RB_Y (CANCEL_BUTTON_LT_Y+2) - -// extern data------------------------------------------ - -// function's prototype declaration--------------------- -void SEQ_AutoBootSelect_init(void); -int SEQ_AutoBootSelect(void); - -// global variable ------------------------------------- - -// static variable ------------------------------------- -static u16 autoBootFlag = 0; - -// const data ----------------------------------------- -static const u8 *const str_lcd[] ATTRIBUTE_ALIGN(2) = { - (const u8 *)" OFF ", - (const u8 *)" ON ", -}; - -static const MenuComponent autoBootSel = { - 2, - 12, - 8, - 0, - 4, - 8, - WHITE, - HIGHLIGHT_Y, - (const u8 **)&str_lcd, -}; - - -//====================================================== -// function's description -//====================================================== - -// AGBモード設定の初期化 -void SEQ_AutoBootSelect_init(void) -{ - GXS_SetVisiblePlane(GX_PLANEMASK_NONE); - - MI_CpuClearFast(bgBakS,sizeof(bgBakS)); - - ClearAllStringSJIS(); - - (void)DrawStringSJIS( 1, 0, YELLOW, (const u8 *)"AUTO BOOT SELECT"); - (void)DrawStringSJIS( CANCEL_BUTTON_LT_X, CANCEL_BUTTON_LT_Y,HIGHLIGHT_C, (const u8 *)" CANCEL "); - - if(GetSYSMWork()->ncd_invalid) { - autoBootFlag = 0; - }else { - autoBootFlag = GetNCDWork()->option.autoBootFlag; - if(autoBootFlag > 1) autoBootFlag = 1; - } - - DrawMenu((u16)autoBootFlag, &autoBootSel); - SVC_CpuClear(0x0000, &tpd, sizeof(TpWork), 16); - - GXS_SetVisiblePlane(GX_PLANEMASK_OBJ | GX_PLANEMASK_BG1); -} - - -// AGBモード設定 -int SEQ_AutoBootSelect(void) -{ - BOOL tp_select; - BOOL tp_cancel = FALSE; - - ReadTP(); // タッチパネル入力の取得 - - //-------------------------------------- - // キー入力処理 - //-------------------------------------- - if(pad.trg & (PAD_KEY_DOWN | PAD_KEY_UP)){ // カーソルの移動 - autoBootFlag ^= 0x01; - } - tp_select = SelectMenuByTp((u16 *)&autoBootFlag, &autoBootSel); - DrawMenu((u16)autoBootFlag, &autoBootSel); - - // [CANCEL]ボタン押下チェック - if(tpd.disp.touch) { - tp_cancel = InRangeTp(CANCEL_BUTTON_LT_X*8, CANCEL_BUTTON_LT_Y*8, - CANCEL_BUTTON_RB_X*8, CANCEL_BUTTON_RB_Y*8, &tpd.disp); - } - - if((pad.trg & PAD_BUTTON_A) || (tp_select)) { // メニュー項目への分岐 - GetSYSMWork()->ncd_invalid = 0; - GetNCDWork()->option.autoBootFlag = autoBootFlag; - // :::::::::::::::::::::::::::::::::::::::::::::: - // NVRAMへの書き込み - // :::::::::::::::::::::::::::::::::::::::::::::: - (void)NVRAMm_WriteNitroConfigData(GetNCDWork()); - SEQ_MainMenu_init(); - return 0; - }else if((pad.trg & PAD_BUTTON_B) || (tp_cancel)) { - SEQ_MainMenu_init(); - return 0; - } - - ReadTP(); - - return 0; -} - - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/font.c b/build/systemMenu_RED/MachineSettings/ARM9/src/old/font.c deleted file mode 100644 index 916334ac..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/font.c +++ /dev/null @@ -1,1030 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: font.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include "font.h" -#include "misc.h" - -// define data---------------------------------- -#define SEARCH_ENTRY_MAX_NUM 128 // 処理が重くなるのを防ぐための、エントリのサーチ回数上限 -#define NITRO_CHAR_SIZE 0x20 // NITRO標準キャラクタサイズ(4bitカラー) -#define CHAR_CODE_OFFSET (SJIS_CHAR_VRAM_OFFSET / NITRO_CHAR_SIZE) // キャラナンバーをスクリーンに転送する際のオフセット(BG_CHAR_VRAM+0x4000から始めているので、オフセットは0x200) -#define DRAW_CHAR_NUM_LIMIT (SJIS_CHAR_VRAM_SIZE / NITRO_CHAR_SIZE) // 1つの文字列で表示できるキャラクタ数の限界 - -#define HANDLE_INDEX 0x40000000 - -// フォント構成データ -typedef struct FontComponent { - u16 need_tate_dot; // 文字を表示するのに必要なキャラ単位のドット数 - u16 tate_dot; // 文字キャラの縦ドット数 - u16 yoko_dot; // 文字キャラの横ドット数 - u16 org_char_size; // 文字キャラのbyteサイズ - u32 org_row_size; // 文字キャラ - u32 start_adr; // キャラクタバイナリのスタートアドレス - u32 end_adr; // キャラクタバイナリのエンドアドレス -}FontComponent; - - -// VRAMキャラデータのメモリブロック動的確保リスト -typedef struct CharAllocListTag CharAllocList; -struct CharAllocListTag { - CharAllocList *next; // 次のメモリブロック確保構造体へのポインタ - u16 memTop; // キャラ割り当てテーブルcharAllocTblの占有ブロックの先頭ポイント - u16 memNum; // 確保したメモリブロックの数 -}CharAllocListTag; - - -// SJIS文字列表示のためのVRAMエントリデータ -typedef struct StrEntry { - const FontComponent *font; // 表示するフォントの構成要素 - u32 dataAddr; // データ元のアドレス(IDとして使用) - u32 *charMemp; // 動的に確保したVRAMメモリブロックへのポインタ - u16 charNum; // トータルのキャラ数 - u16 drawPos; // 表示位置(BGスクリーンバッファの先頭からの2byteオフセット) -}StrEntry; - - -// フォントの文字間隔詰め展開用データ -typedef struct FontPropotion { - u16 *leftp; // 現在の左側フォントデータへのポインタ - u16 *rightp; // 現在の右側フォントデータへのポインタ - u16 h_offset; // 16x16ドット単位のキャラクタデータ内の現在の横オフセット - u8 pad[2]; - u32 buff16x16[2][16/2]; -}FontPropotion; - -// インクリメント/インクリメントなしフラグ(SetScrDataで使用) -typedef enum IncFlag { - NO_INC, // インクリメントなし - INC_1 // 1インクリメント -}IncFlag; - -// extern data---------------------------- -extern void _binary_f12han_dat(void); -extern void _binary_f12han_dat_end(void); - - -// function's prototype declaration------------- -static void SetScrData(u16 code_top, StrEntry *sEntryp, IncFlag inc_flag); -static u16 MeasureStringCharWidth(const u8 *str); -static void SpreadStringCloser(u8 *str, StrEntry *sEntryp, u16 v_offset); -static void SetFirstFont(u8 **strpp, u16 v_offset, FontPropotion *fontProp); -static u8 * CloseFontChar(u8 **strpp, u16 v_offset, FontPropotion *fontProp); -static u32 CalcCharCodeAddress(u8 **strpp, const FontComponent **font); -static void SpreadFontZen(u16 bit0_color, u16 bit1_color, u8 *fromAdr, u32 *toAdr); -static void InitStrEntryTable( StrEntry **sEntrypp ); -static StrEntry *GetStrEntry( u16 handle ); -static StrEntry **GetStrEntryAddress( u16 handle ); -static int InsertStrEntry(u16 *handle, u16 charNum); -static int InsertStrEntry2(u16 handle, u16 charNum); -static u16 DeleteStrEntry( u16 handle); -static BOOL GetEmptyStrEntry(u32 dataAddr, u16 *handlep); -static u16 SearchStrEntry(u32 dataAddr); -static u8 * HexToDecimalString(const void *hexp, u8 *strp, u16 figure, u16 size); -static u8 * HexToString(const void *hexp, u8 *strp, u16 figure); -static void InitAllocSystemSJIS( TargetScreen target ); -static void *AllocMemoryFromVram( u32 size ); -static void FreeMemoryToVram( void *p ); - -static u16 DrawStringSJIS_Core( int x, int y, u16 color, const void *strp, u32 handleIndex); -static u32 CalcHandleIndex(u32 dataAddr, u32 index); - -// global variables----------------------------- - - -// static variables----------------------------- -static int font_init = 0; -static TargetScreen targetScreen = BOTTOM_SCREEN; -static const FontComponent *nowFontHan; -static StrEntry *entryTblS[ STR_ENTRY_MAX_NUM ]; -static StrEntry *entryTblM[ STR_ENTRY_MAX_NUM ]; -static StrEntry **entryTblp; -static u16 *bgBakp; - -// const data----------------------------------- -const u16 tbl_ASCII_to_SJIS[0x100]; -const FontComponent fontTypeTableHan[] = { - { 16, 12, 6, 12, 14*0xbc, (u32)&_binary_f12han_dat, (u32)&_binary_f12han_dat_end}, -}; - - -// functions description------------------------ - -//---------------------------------------------- -// API関数 -//---------------------------------------------- - -// フォントAPIの初期化 -void InitFont( TargetScreen target) -{ - if( font_init & (0x01 << target ) ) { // ターゲットが初期すみならリターン - return; - } - - InitAllocSystemSJIS( target ); // ターゲットのVRAMアリーナ初期化 - - if( target == TOP_SCREEN ) { // ターゲットのエントリを初期化 - InitStrEntryTable( &entryTblM[0] ); - }else { - InitStrEntryTable( &entryTblS[0] ); - } - - if( font_init == 0 ) { // まだ何も初期化されていないなら、スクリーンを初期設定に。 - SetTargetScreenSJIS( target ); - } - - SetFont( (FontType)0 ); - font_init |= 0x01 << target; -} - - -// 表示フォントの切り替え -void SetFont(FontType font) -{ - if(font >= FONT_TYPE_MAX) { - font = (FontType)0; - } - nowFontHan = &fontTypeTableHan[font]; -} - - -// 表示ターゲットスクリーンの切り替え -void SetTargetScreenSJIS( TargetScreen target ) -{ - targetScreen = target; - if( target == TOP_SCREEN ) { - entryTblp = &entryTblM[0]; - bgBakp = bgBakM; - }else { - entryTblp = &entryTblS[0]; - bgBakp = bgBakS; - } -} - - -// 指定されたSJIS文字列を表示する。(ハンドル指定なしでハンドル算出加算値付き) -static u16 DrawStringSJIS_Core( int x, int y, u16 color, const void *strp, u32 handleIndex) -{ - StrEntry *sEntryp; - int newEntry; - u16 handle; - u16 charNum; - u16 code; - u16 v_offset = 1; // ※v_offsetは引数にすることもできる。 - - InitFont( targetScreen ); - - // 空文字列チェック - if(*(u8 *)strp == 0x00) { - return 0; - } - - // 文字列表示に必要なキャラクタ数の測定 - charNum = MeasureStringCharWidth((const u8 *)strp); - if(charNum > DRAW_CHAR_NUM_LIMIT) { // 必要キャラクタ数が512以内ならメモリ確保。 - OS_Printf("SJIS-draw: str length max over.\n"); - return DSJIS_ERR_STR_LENGTH_TOO_LONG; - } - - // ハンドル取得 - if( !GetEmptyStrEntry( handleIndex, &handle ) ) { - OS_Printf("SJIS-draw: error StrEntry get failed.\n"); - return DSJIS_ERR_ENTRY_GET_FAILED; - } - - // 文字列エントリの登録 - newEntry = InsertStrEntry2( handle, charNum ); - if(newEntry < 0) { - OS_Printf("SJIS-draw: error StrEntry alloc failed.\n"); - return DSJIS_ERR_ENTRY_ALLOC_FAILED; - } - sEntryp = GetStrEntry(handle); // エントリへのポインタを格納 - sEntryp->dataAddr = handleIndex; - - // VRAMキャラメモリの動的確保 - if(newEntry > 0) { - sEntryp->charMemp = AllocMemoryFromVram( (u32)( charNum * NITRO_CHAR_SIZE * 2 ) ); - // ※縦も2キャラ分必要なので、NITRO_CHAR_SIZE*2 -// OS_Printf("alloc charMemp = %x\n",sEntryp->charMemp); - if( sEntryp->charMemp == NULL ) { // メモリ確保に失敗したら、エントリのメモリを解放してリターン - OS_Printf("VRAM char memory alloc failed.\n"); - OS_Free(sEntryp); - return DSJIS_ERR_CHAR_ALLOC_FAILED; - } - } - - // 文字列エントリの登録 - sEntryp->font = nowFontHan; // 現在のフォントタイプを格納 - sEntryp->drawPos = (u16)(x + y * 0x20); // 表示場所を格納。 - sEntryp->charNum = charNum; - - // 縦配置位置指定v_offsetの矯正 - if(v_offset) { - if(((nowFontHan->tate_dot & 0x07)== 0)) { // 縦8dot or 16dotの場合はv_offsetは0 - v_offset = 0; - }else { - if( (16 - nowFontHan->tate_dot) < v_offset ) { // それ以外の時は、縦16dotに収まる範囲に矯正 - v_offset = (u16)(16 - nowFontHan->tate_dot); - } - } - } - // 対象文字列のフォントデータをビット展開&キャラデータ詰めをおこなって、確保したVRAMキャラメモリに転送 - SpreadStringCloser((u8 *)strp, sEntryp, v_offset); - - // スクリーンデータに今回の文字列のキャラナンバーを書き込み - code = (u16)( (((u32)sEntryp->charMemp - (u32)G2_GetBG1CharPtr()) / NITRO_CHAR_SIZE) | color ); - SetScrData(code, sEntryp, INC_1); - - return handle; -} - -// ハンドルインデックスの算出 -static u32 CalcHandleIndex(u32 dataAddr, u32 index) -{ - if(index) { - index += (u32)( HANDLE_INDEX + dataAddr ); // インデックスを加算した場合は、他のデータのアドレスと被らないよう、NITROメモリマップ外になるようオフセットを加算。 - }else { - index = dataAddr; - } - return index; -} - - -// 指定されたSJIS文字列を表示する。(ハンドル指定なし) -u16 DrawStringSJIS( int x, int y, u16 color, const void *strp) -{ - return DrawStringSJIS_Core( x, y, color, strp, (u32)strp ); // index = strp でCoreをコール -} - - -// 指定された値を16進数で表示する。(ハンドル指定なし版) -u16 DrawHexSJIS( int x, int y, u16 color, const void *hexp, u16 figure) -{ - u8 buff[16]; - u8 *strp = HexToString(hexp, buff, figure); - return DrawStringSJIS_Core(x, y, color, strp, (u32)hexp ); -} - - -// 指定された値を10進数で表示する。(ハンドル指定なし版) -u16 DrawDecimalSJIS( int x, int y, u16 color, const void *hexp, u16 figure, u16 size) -{ - u8 buff[16]; - u8 *strp = HexToDecimalString(hexp, buff, figure, size); - return DrawStringSJIS_Core(x, y, color, strp, (u32)hexp ); -} - - -// 指定されたSJIS文字列を表示する。(ハンドル指定なしでハンドル算出加算値付き) -u16 DrawStringSJISEx( int x, int y, u16 color, const void *strp, u32 index) -{ - index = CalcHandleIndex( (u32)strp, index); - return DrawStringSJIS_Core( x, y, color, strp, index ); // index を加算してCoreをコール -} - - -// 指定された値を16進数で表示する。(ハンドル指定なし版) -u16 DrawHexSJISEx( int x, int y, u16 color, const void *hexp, u16 figure, u32 index) -{ - u8 buff[16]; - u8 *strp = HexToString(hexp, buff, figure); - index = CalcHandleIndex( (u32)hexp, index); - return DrawStringSJIS_Core( x, y, color, strp, index ); -} - - -// 指定された値を10進数で表示する。(ハンドル指定なし版) -u16 DrawDecimalSJISEx( int x, int y, u16 color, const void *hexp, u16 figure, u16 size, u32 index) -{ - u8 buff[16]; - u8 *strp = HexToDecimalString(hexp, buff, figure, size); - index = CalcHandleIndex( (u32)hexp, index); - return DrawStringSJIS_Core(x, y, color, strp, index); -} - - -// 指定コードから始まるスクリーンデータのセット -static void SetScrData(u16 code_top, StrEntry *sEntryp, IncFlag inc_flag) -{ - u16 i; - u16 lastPos; - u16 pos_l; - u16 *buffp_l; - u16 *buffp_h; - - lastPos = 0x800 >> 1; // バッファ最終位置 == BGスクリーンサイズ(0x800) - pos_l = (u16)(sEntryp->drawPos + 0x0020); // 下8dotキャラクタ表示位置 - buffp_h = bgBakp + sEntryp->drawPos; - buffp_l = buffp_h + 0x0020; - - for(i = 0; i < sEntryp->charNum; i++) { - *buffp_h++ = code_top; - code_top += inc_flag; - if(nowFontHan->need_tate_dot == 16) { // 必要縦ドットが16の場合(8ドット文字以外全部)、もう1キャラセット - *buffp_l++ = code_top; - } - code_top += inc_flag; - pos_l++; - if(pos_l == lastPos) { - break; - } - } -} - - -// 指定されたハンドルのSJIS文字列をクリアする。 -void ClearStringSJIS_handle(u16 handle) -{ - StrEntry *sEntryp; - - InitFont( targetScreen ); - - sEntryp = GetStrEntry(handle); - if(sEntryp == NULL) { - return; - } - - // スクリーンデータのクリア - SetScrData(0x0000, sEntryp, NO_INC); - - // キャラクタデータのクリア -// MI_CpuClearFast(sEntryp->charMemp, sEntryp->charNum * NITRO_CHAR_SIZE * 2); - // 動的に確保したVRAMキャラデータのクリア - FreeMemoryToVram( sEntryp->charMemp ); // このエントリが確保していたキャラクタメモリの解放。 - (void)DeleteStrEntry(handle); -} - - -// 指定されたデータアドレスで表示しているSJIS文字列をクリアする。 -void ClearStringSJIS(void *datap) -{ - u16 handle = SearchStrEntry( (u32)datap ); - - if( handle > STR_ENTRY_MAX_NUM ) { - return; - } - ClearStringSJIS_handle(handle); -} - - -// 指定されたデータアドレスで表示しているSJIS文字列をクリアする。Ex系で描画したものを消す場合。 -void ClearStringSJISEx(void *datap, u32 handleIndex) -{ - u16 handle; - - handleIndex = CalcHandleIndex( (u32)datap, handleIndex); - - handle = SearchStrEntry( (u32)handleIndex ); - - if( handle > STR_ENTRY_MAX_NUM ) { - return; - } - ClearStringSJIS_handle(handle); -} - - - -// 現在登録されている全てのSJIS文字列をクリアする(動的メモリも全て解放) -void ClearAllStringSJIS(void) -{ - u16 handle; - - InitFont( targetScreen ); - - for(handle = 0; handle < STR_ENTRY_MAX_NUM; handle++) { - if( GetStrEntry( handle ) != NULL) { - ClearStringSJIS_handle(handle); - } - } -} - - -// 指定されたハンドルで表示されている文字列のカラーを変更。 -u16 ChangeColorSJIS(u16 handle, u16 new_color) -{ - int i; - u16 *buffp_l; - u16 *buffp_h; - StrEntry *sEntryp = GetStrEntry( handle ); // エントリへのポインタを格納 - - if((handle > STR_ENTRY_MAX_NUM) || (sEntryp == NULL)) { - return 0; - } - - buffp_h = bgBakp + sEntryp->drawPos; - buffp_l = buffp_h + 0x20; - for(i = 0; i < sEntryp->charNum; i++) { - *buffp_h = (u16)((*buffp_h & 0x0fff) | new_color); - *buffp_l = (u16)((*buffp_l & 0x0fff) | new_color); - buffp_h++; - buffp_l++; - } - return 1; -} - -//---------------------------------------------- -// 文字列エントリテーブルの処理 -//---------------------------------------------- - -// エントリテーブルの初期化 -static void InitStrEntryTable( StrEntry **sEntrypp ) -{ - u16 i; - for(i = 0; i < STR_ENTRY_MAX_NUM; i++) { - *sEntrypp++ = NULL; - } -} - - -// 指定されたハンドルのStrEntryポインタを返す -static StrEntry * GetStrEntry( u16 handle ) -{ - if ( handle >= STR_ENTRY_MAX_NUM ) { - return NULL; - }else { -// return entryTblS[ handle ]; - return entryTblp[ handle ]; - } -} - - -// 指定されたハンドルのStrEntryポインタへのポインタを返す -static StrEntry ** GetStrEntryAddress( u16 handle ) -{ - if ( handle >= STR_ENTRY_MAX_NUM ) { - return NULL; - }else { -// return &entryTblS[ handle ]; - return &entryTblp[ handle ]; - } -} - - -// StrEntryの登録 -static int InsertStrEntry(u16 *handle, u16 charNum) -{ - StrEntry **sEntrypp = GetStrEntryAddress( *handle ); - - if(*handle >= STR_ENTRY_MAX_NUM) { - return -1; - }else if(*handle > 0) { - if( *sEntrypp != NULL) { // 指定ハンドルに既にエントリがある場合は、確保メモリ量を新規メモリ量と比べて、 - if( charNum > (*sEntrypp)->charNum ) { // 再確保が必要な場合は、メモリ解放→再確保を行う。 -// OS_Printf("SJIS: same entry free to charMemory.\n"); -// OS_Printf("free charMemp = %x\n",(*sEntrypp)->charMemp); - SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア - FreeMemoryToVram( (*sEntrypp)->charMemp ); // このエントリが確保していたキャラクタメモリの解放。 - return 1; - }else { - if( charNum < (*sEntrypp)->charNum ) { - SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア - } - return 0; // このエントリでは、キャラクタメモリを継続して使用 - } - } - } - - // *handle == 0 // 指定ハンドルが0の時は新しいハンドルを確保 - *handle = 0; - sEntrypp = GetStrEntryAddress( *handle ); - - for( ; *handle < STR_ENTRY_MAX_NUM; (*handle)++ ) { - if( *sEntrypp++ == NULL) { // NULLエントリを探す - break; - } - } - if(*handle == STR_ENTRY_MAX_NUM) { - return -1; // NULLエントリが見つからなかったら、エラー終了。 - } - - // StrEntryのメモリ確保 - *sEntrypp = (StrEntry *)NNS_FndAllocFromAllocator( gAllocator, ( sizeof(StrEntry) ); - if( *sEntrypp == NULL) { - OS_Printf("StrEntry allocate failed.\n"); - return -1; - }else { - return 1; - } -} - - -// エントリ挿入処理2 -static int InsertStrEntry2(u16 handle, u16 charNum) -{ - StrEntry **sEntrypp = GetStrEntryAddress( handle ); - - if( *sEntrypp != NULL) { // 指定ハンドルに既にエントリがある場合は、確保メモリ量を新規メモリ量と比べて、 - if( charNum > (*sEntrypp)->charNum ) { // 再確保が必要な場合は、メモリ解放→再確保を行う。 -// OS_Printf("SJIS: same entry free to charMemory.\n"); -// OS_Printf("free charMemp = %x\n",(*sEntrypp)->charMemp); - SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア - FreeMemoryToVram( (*sEntrypp)->charMemp ); // このエントリが確保していたキャラクタメモリの解放。 - return 1; - }else { - if( charNum < (*sEntrypp)->charNum ) { - SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア - } - return 0; // このエントリでは、キャラクタメモリを継続して使用 - } - } - - // StrEntryのメモリを新規確保 - *sEntrypp = (StrEntry *)OS_Alloc( sizeof(StrEntry) ); - if( *sEntrypp == NULL) { - OS_Printf("StrEntry allocate failed.\n"); - return -1; - }else { - return 1; - } -} - - -// 指定されたハンドルのStrEntry要素をエントリテーブルから削除 -static u16 DeleteStrEntry(u16 handle) -{ - StrEntry **sEntrypp = GetStrEntryAddress( handle ); - - if( *sEntrypp == NULL) { - return NULL; - } - - OS_Free( *sEntrypp ); - *sEntrypp = NULL; - - return handle; -} - - -// 空きエントリを探す(あんま効率よくない) -static BOOL GetEmptyStrEntry(u32 dataAddr, u16 *handlep) -{ - int i = SEARCH_ENTRY_MAX_NUM; // 処理が重くなるのを防ぐため、サーチ回数に制限を加える。 - u16 handle = (u16)( (dataAddr >> 2) & (STR_ENTRY_MAX_NUM - 1) ); - - while(i--) { - StrEntry *sEntryp = GetStrEntry( handle ); - if( sEntryp == NULL ) { - *handlep = handle; - return TRUE; // 新規ハンドル位置確保 - }else { - if( sEntryp->dataAddr == dataAddr ) { - *handlep = handle; - return TRUE; // 既存ハンドル位置発見 - } - handle = (u16)( (handle + 1) & (STR_ENTRY_MAX_NUM - 1) ); - } - } - return FALSE; -} - - -// 指定データのハンドルを探す(あんま効率よくない) -static u16 SearchStrEntry(u32 dataAddr) -{ - int i = SEARCH_ENTRY_MAX_NUM; // 処理が重くなるのを防ぐため、サーチ回数に制限を加える。 - u16 handle = (u16)( (dataAddr >> 2) & (STR_ENTRY_MAX_NUM - 1) ); - - while(i--) { - StrEntry *sEntryp = GetStrEntry( handle ); - if(sEntryp != NULL) { - if( sEntryp->dataAddr == dataAddr ) { - return handle; // 既存ハンドル位置発見 - } - } - handle = (u16)( (handle + 1) & (STR_ENTRY_MAX_NUM - 1) ); - } - return 0xffff; -} - - -//---------------------------------------------- -// キャラクタVRAMの動的確保処理 -//---------------------------------------------- - -// 文字列表示に必要なキャラクタ数の測定 -static u16 MeasureStringCharWidth(const u8 *str) -{ - u16 totalWidth = 0; // 文字列のトータルの横ドットサイズ - u16 charNum = 0; // 文字列表示に必要なキャラクタ数 - - // 文字列のトータルの横ドットサイズを算出 - while(*str) { // 各文字は SJIS か ASCII か? - if( ((*str >= SJIS_HIGHER_CODE1_MIN) && (*str <= SJIS_HIGHER_CODE1_MAX)) - || ((*str >= SJIS_HIGHER_CODE2_MIN) && (*str <= SJIS_HIGHER_CODE2_MAX)) ) { - str += 2; // SJIS文字 - totalWidth += nowFontHan->yoko_dot; - }else { - str++; // ASCII文字 - totalWidth += nowFontHan->yoko_dot; - } - } - // トータル横ドット数から、文字列の表示に必要なキャラクタ数を算出 - charNum = (u16)(totalWidth >> 3); - if(totalWidth & 0x0007) { - charNum = (u16)(charNum + 1); - } - - return charNum; -} - - -//---------------------------------------------- -// フォントデータ→NITROキャラデータへの変換関数群 -//---------------------------------------------- - -// 指定された文字列を指定メモリブロックに展開しながら転送(使用フォントによって文字詰めも行う) -static void SpreadStringCloser(u8 *strp, StrEntry *sEntryp, u16 v_offset) -{ - u32 charBuff[(NITRO_CHAR_SIZE * 4) / 4]; // 16x16キャラ2文字で4キャラ分のバッファ。(2文字展開して、文字詰めを行うため) - u8 *charMemp; - u8 *fromAdr; - u16 i; - u16 charNum; - FontPropotion fontPro; - - // Spread target string char data to WRAM pool - charNum = sEntryp->charNum; - charMemp = (u8 *)sEntryp->charMemp; - fontPro.h_offset = 0; - fontPro.leftp = (u16 *)0x0; - fontPro.rightp = (u16 *)0x0; - - while(1) { - // 隣接する2つの1bitフォントデータを16x16ドットキャラクタ配列にロード - if(fontPro.h_offset == 0) { - SetFirstFont(&strp, v_offset, &fontPro); // 表示文字列を16x16ドット単位に区切った時に先頭にくるキャラクタをロード - } - fromAdr = CloseFontChar(&strp, v_offset, &fontPro); // 上記キャラクタに隣接するキャラクタをロード - - // ロードした1bitフォントデータを4bitNITROキャラデータに展開 - SpreadFontZen(3, 1, fromAdr, (u32 *)charBuff); // キャラクタデータを4bitに展開。 - - // 展開したキャラデータをVRAMにコピー - fromAdr = (u8 *)charBuff; - for(i = 0; i < 2; i++) { // 生成した16x16ドット(4キャラ)分のデータを転送 - MI_CpuCopyFast(fromAdr, charMemp, (NITRO_CHAR_SIZE * 2)); - fromAdr += NITRO_CHAR_SIZE * 2; - charMemp+= NITRO_CHAR_SIZE * 2; - if(--charNum == 0) { - return; - } - } - } -} - - -// 最初のフォントデータをバッファにセット -static void SetFirstFont(u8 **strpp, u16 v_offset, FontPropotion *fontProp) -{ - u8 tate; - u8 *fontAdr; - u16 *firstp; - const FontComponent *fontComp; - - if(**strpp == 0x00) { - return; - } - - fontAdr = (u8 *)CalcCharCodeAddress(strpp, &fontComp); // 今回の文字のコードから、フォントデータ格納アドレスを算出。 - - MI_CpuClearFast(fontProp->buff16x16[0], 64); // 16x16ドット単位の一時展開バッファのクリア - - firstp = (u16 *)fontProp->buff16x16[0] + v_offset; - for(tate = 0; tate < fontComp->tate_dot - 1; tate++) { - *firstp = (u16)(*fontAdr++ << 8); - if(fontComp->yoko_dot > 8) { - *firstp |= *fontAdr++; - } - firstp++; - } - fontProp->h_offset = fontComp->yoko_dot; - fontProp->leftp = (u16 *)fontProp->buff16x16[0]; - fontProp->rightp = (u16 *)fontProp->buff16x16[1]; -} - - -// 隣接するフォントデータをバッファにセット -static u8 * CloseFontChar(u8 **strpp, u16 v_offset, FontPropotion *fontProp) -{ - u8 tate; - u8 *fontAdr; - u16 *temp; - u16 *leftp_tmp; - u16 *rightp_tmp; - const FontComponent *fontComp; - - while(fontProp->h_offset < 16) { - if(**strpp == 0x00) { - break; - } - - fontAdr = (u8 *)CalcCharCodeAddress(strpp, &fontComp); // 今回の文字のコードから、フォントデータ格納アドレスを算出。 - - leftp_tmp = fontProp->leftp + v_offset; // フォントデータを横ドット詰めしながらロード - rightp_tmp = fontProp->rightp + v_offset; - for(tate=0; tate < fontComp->tate_dot - 1; tate++) { - *rightp_tmp = (u16)(*fontAdr++ << 8); - if(fontComp->yoko_dot > 8) { - *rightp_tmp |= *fontAdr++; - } - - *leftp_tmp |= *rightp_tmp >> fontProp->h_offset; - *rightp_tmp <<= 16 - fontProp->h_offset; - leftp_tmp++; - rightp_tmp++; - } - fontProp->h_offset += fontComp->yoko_dot; - } - fontProp->h_offset -= 16; - temp = fontProp->leftp; - fontProp->leftp = fontProp->rightp; - fontProp->rightp = temp; - return (u8 *)temp; -} - - -// 文字コードに対応したフォントデータ格納アドレスを算出する。 -static u32 CalcCharCodeAddress(u8 **strpp, const FontComponent **font) -{ - u8 higher_code; - u8 lower_code; - u16 sjis_code; - u32 adr; - - // 対象文字が SJIS or ASCII かを判定 - higher_code = *(*strpp)++; - if( ((higher_code >= SJIS_HIGHER_CODE1_MIN) && (higher_code <= SJIS_HIGHER_CODE1_MAX)) - ||((higher_code >= SJIS_HIGHER_CODE2_MIN) && (higher_code <= SJIS_HIGHER_CODE2_MAX)) ) { // SJISか? - lower_code = *(*strpp)++; - *font = nowFontHan; - }else { // ASCII - sjis_code = tbl_ASCII_to_SJIS[higher_code]; - higher_code = (u8)(sjis_code >> 8); - lower_code = (u8)(sjis_code & 0x00ff); - *font = nowFontHan; - } - - // 文字コードからフォントデータアドレスを算出 - if(higher_code <= SJIS_HIGHER_CODE1_MIN + 3) { - higher_code -= 0x81; - }else if(higher_code <= SJIS_HIGHER_CODE1_MIN + 6) { - higher_code -= 0x83; - }else if(higher_code <= SJIS_HIGHER_CODE1_MAX) { - higher_code -= 0x84; - }else if(higher_code >= SJIS_HIGHER_CODE2_MIN) { - higher_code -= 0xc4; - } - - if(lower_code < 0x80) { - lower_code -= 0x40; - }else { - lower_code -= 0x41; - } - - adr = (*font)->start_adr - +((*font)->org_row_size) * higher_code - +((*font)->org_char_size+2) * lower_code + 2; - - return adr; -} - - -// 指定バッファの1bitフォントデータを4bitNITROキャラデータに展開。 -static void SpreadFontZen(u16 bit0_color, u16 bit1_color, u8 *fromAdr, u32 *toAdr) -{ - int i; - u8 tate; - u8 yoko; - u8 rd_data; - u32 wr_data; - u32 b0c; - u32 b1c; - u32 *toAdr_left; - u32 *toAdr_right; - - toAdr_left = toAdr; - toAdr_right = toAdr + 16; // toAdr + (16 * 4byte) - - for(tate = 0; tate < nowFontHan->need_tate_dot; tate++) { // キャラクタの縦ドット数だけ展開 - // 左右それぞれの8dotキャラを展開 - for(yoko = 0; yoko < 2; yoko++) { - wr_data = 0x00000000; // ライトデータ初期化 - - if(tate < nowFontHan->tate_dot) { - rd_data = *fromAdr++; // 左右8dotキャラの読み出し - b0c = (u32)bit0_color; // bit0 のカラー - b1c = (u32)bit1_color; // bit1 のカラー - - for(i = 0; i < 8; i++) { // 8dot分の各1bitの判定 - if(rd_data & 0x80) { - wr_data |= b1c; // "1"をカラー1へ - }else { - wr_data |= b0c; // "0"をカラー0へ - } - rd_data <<= 1; - b0c <<= 4; - b1c <<= 4; - } - } - - if(yoko==0) { - *toAdr_right++ = wr_data; // 32bit書きこみ - }else { - *toAdr_left++ = wr_data; - } - } - } -} - - -//---------------------------------------------- -// MALLOCシステムの初期化 -//---------------------------------------------- - -// VRAM上にヒープを作成。(アリーナにVRAMはないので、WRAM_MAIN, WRAM_SUBのアリーナで代用) -static void InitAllocSystemSJIS( TargetScreen target ) -{ - void* tempLo; - OSHeapHandle hh; - - // VRAM上にヒープを作成 - - if( target == TOP_SCREEN ) { - // メインLCD - OS_SetArenaLo( OS_ARENA_WRAM_MAIN, (void *)VRAM_M_ARENA_LO ); - OS_SetArenaHi( OS_ARENA_WRAM_MAIN, (void *)VRAM_M_ARENA_HI ); - tempLo = OS_InitAlloc( OS_ARENA_WRAM_MAIN, OS_GetWramMainArenaLo(), OS_GetWramMainArenaHi(), 1 ); - OS_SetArenaLo( OS_ARENA_WRAM_MAIN, tempLo ); - - hh = OS_CreateHeap( OS_ARENA_WRAM_MAIN, OS_GetWramMainArenaLo(), OS_GetWramMainArenaHi() ); - if(hh < 0) OS_Panic( "ARM9-MAIN LCD: Fail to create heap...\n" ); - OS_Printf( " arena lo = %x\n", OS_GetWramMainArenaLo() ); - OS_Printf( "WRAM arena hi = %x\n", OS_GetWramMainArenaHi() ); - hh = OS_SetCurrentHeap( OS_ARENA_WRAM_MAIN, hh ); - }else { // BOTTOM_SCREEN - // サブLCD - OS_SetArenaLo( OS_ARENA_WRAM_SUB, (void *)VRAM_S_ARENA_LO ); - OS_SetArenaHi( OS_ARENA_WRAM_SUB, (void *)VRAM_S_ARENA_HI ); - tempLo = OS_InitAlloc( OS_ARENA_WRAM_SUB, OS_GetWramSubArenaLo(), OS_GetWramSubArenaHi(), 1 ); - OS_SetArenaLo( OS_ARENA_WRAM_SUB, tempLo ); - - hh = OS_CreateHeap( OS_ARENA_WRAM_SUB, OS_GetWramSubArenaLo(), OS_GetWramSubArenaHi() ); - if(hh < 0) OS_Panic( "ARM9-SUB LCD: Fail to create heap...\n" ); - OS_Printf( "WRAM arena lo = %x\n", OS_GetWramSubArenaLo() ); - OS_Printf( "WRAM arena hi = %x\n", OS_GetWramSubArenaHi() ); - hh = OS_SetCurrentHeap( OS_ARENA_WRAM_SUB, hh ); - } -} - - -// VRAMへのキャラメモリ確保 -static void *AllocMemoryFromVram( u32 size ) -{ - if ( targetScreen == TOP_SCREEN ) { - return OS_AllocFromWramMain( size ); // ※縦も2キャラ分必要なので、NITRO_CHAR_SIZE*2 - }else { - return OS_AllocFromWramSub ( size ); // ※縦も2キャラ分必要なので、NITRO_CHAR_SIZE*2 - } -} - - -// VRAMへのキャラメモリ解放 -static void FreeMemoryToVram( void *p ) -{ - if ( targetScreen == TOP_SCREEN ) { - OS_FreeToWramMain( p ); - }else { - OS_FreeToWramSub( p ); - } -} - - -//---------------------------------------------- -// 16進データを文字列に変換 -//---------------------------------------------- - -// メインメモリからでも大丈夫な形式での1byteのデータ読み出し。 -__inline static u16 ReadByteHWBus(const void *srcp) -{ - if( (u32)srcp & 0x00000001 ) return (u16)(*(u16 *)( (u32)srcp ^ 0x00000001 ) >> 8 ); - else return (u16)(*(u16 *)( srcp ) & 0x00ff ); -} - -// 16進データを10進文字列に変換 -static u8 *HexToDecimalString(const void *hexp, u8 *strp, u16 figure, u16 size) -{ - u16 i; - u32 target = 0; - - for(i = 0; i < size; i++) { - target |= ReadByteHWBus( ((u8 *)hexp)++ ) << (8 * i); - } - - strp += figure; - *strp-- = 0x00; - for(i = 0; i < figure; i++) { - CP_SetDiv32_32(target, 10); - *strp-- = (u8 )(CP_GetDivRemainder32() + 0x30); - target = (u32) CP_GetDivResult32(); - } - return (strp + 1); -} - - -// 16進データを16進文字列に変換 -static u8 *HexToString(const void *hexp, u8 *strp, u16 figure) -{ - u16 i; - u8 hex; - - strp += figure; - *strp-- = 0x00; - - for(i = 0; i < figure; i++){ - hex = (u8)ReadByteHWBus(hexp); - if(i & 0x01){ - hex = (u8)( (hex >> 4) & 0x0f); - ((u8 *)hexp)++; - }else{ - hex = (u8)( hex & 0x0f); - } - if(hex < 0x000a) hex += 0x30; - else hex += 0x41 - 0x0a; - *strp-- = hex; - } - return (strp + 1); -} - - -//---------------------------------------------- -// ASCII -> SJIS 変換テーブル -//---------------------------------------------- - -const u16 tbl_ASCII_to_SJIS[0x100] = { - // 00 - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - // 10 - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - // 20 - 0x8140,0x8149,0x8168,0x81f2,0x8190,0x8193,0x8195,0x8166, - 0x8169,0x816a,0x8196,0x817b,0x8143,0x817c,0x8144,0x815e, - // 30 - 0x824f,0x8250,0x8251,0x8252,0x8253,0x8254,0x8255,0x8256, - 0x8257,0x8258,0x8146,0x8147,0x8183,0x8181,0x8184,0x8148, - // 40 - 0x8197,0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266, - 0x8267,0x8268,0x8269,0x826a,0x826b,0x826c,0x826d,0x826e, - // 50 - 0x826f,0x8270,0x8271,0x8272,0x8273,0x8274,0x8275,0x8276, - 0x8277,0x8278,0x8279,0x816d,0x818f,0x816e,0x814f,0x8151, - // 60 - 0x8165,0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287, - 0x8288,0x8289,0x828a,0x828b,0x828c,0x828d,0x828e,0x828f, - // 70 - 0x8290,0x8291,0x8292,0x8293,0x8294,0x8295,0x8296,0x8297, - 0x8298,0x8299,0x829a,0x816f,0x8162,0x8170,0x8160,0x81fc, - - // 80 - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - // 90 - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - // a0 - 0x81fc,0x8142,0x8175,0x8176,0x8141,0x8145,0x8192,0x8340, - 0x8342,0x8344,0x8346,0x8348,0x8383,0x8385,0x8387,0x8362, - // b0 - 0x815b,0x8341,0x8343,0x8345,0x8347,0x8349,0x834a,0x834c, - 0x834e,0x8350,0x8352,0x8354,0x8356,0x8358,0x835a,0x835c, - // c0 - 0x835e,0x8360,0x8363,0x8365,0x8367,0x8369,0x836a,0x836b, - 0x836c,0x836d,0x836e,0x8371,0x8374,0x8377,0x837a,0x837d, - // d0 - 0x837e,0x837f,0x838a,0x8382,0x8384,0x8386,0x8388,0x8389, - 0x838a,0x838b,0x838c,0x838d,0x838f,0x8393,0x814a,0x814b, - - // e0 - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - // f0 - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, - 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, -}; - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/font.h b/build/systemMenu_RED/MachineSettings/ARM9/src/old/font.h deleted file mode 100644 index 90e96b13..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/font.h +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: font.h - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef __FONT_H_ -#define __FONT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// define data---------------------------------- -#define STR_ENTRY_MAX_NUM 256 // 登録可能な文字列データの最大個数 - -#define SJIS_CHAR_VRAM_OFFSET 0x4000 // SJIS文字列キャラクタ用VRAMのオフセット値 -#define SJIS_CHAR_VRAM_SIZE (0x8000 + 0x20) //   〃          のサイズ(0x20はヒープのヘッダ) - -#define VRAM_M_ARENA_LO (HW_BG_VRAM + SJIS_CHAR_VRAM_OFFSET - 0x20) -#define VRAM_M_ARENA_HI (VRAM_M_ARENA_LO + SJIS_CHAR_VRAM_SIZE) -#define VRAM_S_ARENA_LO (HW_DB_BG_VRAM + SJIS_CHAR_VRAM_OFFSET - 0x20) -#define VRAM_S_ARENA_HI (VRAM_S_ARENA_LO + SJIS_CHAR_VRAM_SIZE) - // VRAMアリーナのLo & Hi - // SJISコード判定用の値 -#define SJIS_HIGHER_CODE1_MIN 0x81 -#define SJIS_HIGHER_CODE1_MAX 0x9f -#define SJIS_HIGHER_CODE2_MIN 0xe0 -#define SJIS_HIGHER_CODE2_MAX 0xea - -// 関数のエラーリターン値 -#define DSJIS_ERR_ENTRY_GET_FAILED 0x8000 -#define DSJIS_ERR_ENTRY_ALLOC_FAILED 0x8001 -#define DSJIS_ERR_CHAR_ALLOC_FAILED 0x8002 -#define DSJIS_ERR_STR_MEMORY_OVER 0x8003 -#define DSJIS_ERR_STR_LENGTH_TOO_LONG 0x8004 - -// SetTargetScreenSJISの引数target -typedef enum TargetScreen { - TOP_SCREEN =0, - BOTTOM_SCREEN -}TargetScreen; - -// フォント種類データ(SelectFontで指定) -typedef enum FontType{ // 全角  半角 - FONT12, // 12x12 & 12x 7dot - FONT_TYPE_MAX -}FontType; - - -// function's prototype declaration------------- - -void InitFont( TargetScreen target ); -void SetFont( FontType font ); -void SetTargetScreenSJIS( TargetScreen target ); -u16 ChangeColorSJIS( u16 handle, u16 new_color ); - -// 以下の表示関数は、データアドレスからデータハンドルを算出するので、ハンドルを引数で与えなくて良いが、同一アドレスのデータを複数場所に配置することができない。 -u16 DrawStringSJIS ( int x, int y, u16 color, const void *str ); -u16 DrawHexSJIS ( int x, int y, u16 color, const void *hexp, u16 figure ); -u16 DrawDecimalSJIS( int x, int y, u16 color, const void *hexp, u16 figure, u16 size ); - -// Ex系は、引数にindexを設けることで、上記関数で制限されている同一アドレスデータの複数場所配置に対応している。 -u16 DrawStringSJISEx ( int x, int y, u16 color, const void *strp, u32 index ); -u16 DrawHexSJISEx ( int x, int y, u16 color, const void *hexp, u16 figure, u32 index ); -u16 DrawDecimalSJISEx( int x, int y, u16 color, const void *hexp, u16 figure, u16 size, u32 index ); - -// 表示文字列クリア関数 -void ClearStringSJIS( void *datap ); -void ClearStringSJISEx( void *datap, u32 handleIndex ); -void ClearStringSJIS_handle( u16 handle ); -void ClearAllStringSJIS( void ); - - -#ifdef __cplusplus -} -#endif - -#endif // __FONT_H_ - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/misc.c b/build/systemMenu_RED/MachineSettings/ARM9/src/old/misc.c deleted file mode 100644 index 7b186a98..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/misc.c +++ /dev/null @@ -1,384 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: myFunc.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include "misc.h" - -// define data---------------------------------- - -// function's prototype------------------------- - -// extern data---------------------------------- -//extern u16 bgBakS[32*24]; // BG バックアップ -//extern GXOamAttr oamBakS[128]; // OAM バックアップ - - -// const data----------------------------------- -//const u16 csr_charList1[] ={0x008c, 0x008c, 0x008c, 0x008c}; -//const u8 str_time_period[]={" . ."}; - - -// global variable------------------------------ -int (*g_pNowProcess)(void); -//MyTime myTime; -//KeyWork pad; - -// static variable------------------------------ -static u16 key_rapid[4]; -//static u16 csr_animeCount, csr_animeCharNum; -//static u16 csr_pos_x, csr_pos_y, csr_add_y; -//static u16 blinkCount; - - -// ============================================================================ -// function's description -// ============================================================================ - -// BgBakオフセット値算出 -__inline static u16 *calcBgOffset(u16 pos_x,u16 pos_y) -{ - return bgBakS+pos_x+(pos_y<<5); -} - - -// メインメモリからでも大丈夫な形式での1byteのデータ読み出し。 -__inline static u16 ReadByteHWBus(const void *srcp) -{ - if( (u32)srcp & 0x00000001 ) return (u16)(*(u16 *)( (u32)srcp ^ 0x00000001 ) >> 8 ); - else return (u16)(*(u16 *)( srcp ) & 0x00ff ); -} - - -// 初期化 -void mf_init(void) -{ - mf_KEYPAD_initRapid(); -// mf_BLINK_initCounter(); -} - - -/* -// キー入力読み出し -void mf_KEYPAD_read(void) -{ - u16 ReadData= PAD_Read(); - pad.trg = (u16)(ReadData & (ReadData ^ pad.cont)); // トリガ 入力 - pad.cont= ReadData; // ベタ 入力 -} -*/ - - -// キー連射入力処理 初期化(十字キーのみ) -void mf_KEYPAD_initRapid(void) -{ - u16 *krp=key_rapid; - - *krp++=0; - *krp++=0; - *krp++=0; - *krp++=0; -} - - -// キー連射入力(十字キーのみ) -void mf_KEYPAD_rapid(void) -{ - u16 mask,i; - - for(i=0;i<4;i++){ - mask=(u16)(0x0001<<(i+4)); - if(pad.cont & mask){ - key_rapid[i]++; - if(key_rapid[i]==30) { - pad.trg|=mask; - key_rapid[i]=20; - } - }else{ - key_rapid[i]=0; - } - } -} - - -// Xframeウェイト -void mf_waitXframe(u16 frame) -{ - BOOL prelIRQ=OS_EnableIrq(); - while(frame--) OS_WaitIrq(1, OS_IE_V_BLANK); - (void)OS_RestoreIrq(prelIRQ); -} - - - -// 矩形BGクリア -void mf_clearRect(u16 pos_x,u16 pos_y,u8 height,u8 width) -{ - u16 i,j; - u16 *dstp=calcBgOffset(pos_x,pos_y); - - for(i=0;i0) mask=(mask<<8)|0xff; - target=(*(u32 *)valuep)&mask; - count=10; - divisor=1000000000; - dstp=calcBgOffset(pos_x,pos_y); - while(count) { - CP_SetDiv32_32(target, divisor); - if (count<=drawLength) { - charCode=(u16)(CP_GetDivResult32()+0x0030); - *dstp++ =(u16)(charCode | color); - } - target=(u32)CP_GetDivRemainder32(); - CP_SetDiv32_32(divisor, 10); - divisor=(u32)CP_GetDivResult32(); - count--; - } -} - - -// 16進データ表示 -void mf_drawHex(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength) -{ - u16 count,charCode; - u16 *dstp=calcBgOffset(pos_x,pos_y)+drawLength-1; - - for(count=0;count>4) & 0x000f); - ((u8 *)valuep)++; - }else{ - charCode=(u16)( charCode & 0x000f); - } - if (charCode<0x000a) charCode+=0x0030; - else charCode+=0x0041-0x000a; - *dstp--=(u16)(charCode | color); - } -} - - -// 1byte文字列データ表示(0x00〜0xffまでの1文字が1byteで良い文字列を描画する -void mf_drawString(u16 pos_x,u16 pos_y, u16 color, const u8 *strp) -{ - u16 data16; - u16 *dstp=calcBgOffset(pos_x,pos_y); - - while(1) { - data16=ReadByteHWBus(strp++); - if(data16==0) break; - *dstp++=(u16)(color | data16); - } -} - - -// 2byte文字列データ表示(0x0100以降の1文字に2byte必要な文字列を描画する -void mf_drawString2(u16 pos_x,u16 pos_y, u16 color, const u16 *strp) -{ - u16 *dstp=calcBgOffset(pos_x,pos_y); - - while(*strp) *dstp++ = (u16)(*strp++ | color); -} - -// 矩形フレーム描画 -void mf_drawRectFrame(u16 pos_x,u16 pos_y,u16 color,u8 height,u8 width) -{ - u16 i,j,code; - u16 *dstp; - - for(i=0;i -#include "misc.h" - -// define data --------------------------------- - -// パレットカラー -#define WHITE (0<<12) -#define RED (1<<12) -#define GREEN (2<<12) -#define BLUE (3<<12) -#define YELLOW (4<<12) -#define CYAN (5<<12) -#define PURPLE (6<<12) -#define LIGHTGREEN (7<<12) -#define HIGHLIGHT_Y (8<<12) -#define HIGHLIGHT_C (9<<12) -#define HIGHLIGHT_W (10<<12) -#define HIGHLIGHT_B (11<<12) - -// 時間計測構造体 -typedef struct { - int enable; - int frame; - int second; - int minute; - int hour; -}MyTime; - -// キーデータ・ワークエリア構造体 -//typedef struct { -// u16 trg; // トリガ入力 -// u16 cont; // ベタ 入力 -//}KeyWork; - - -// global variable------------------------------ -extern MyTime myTime; -//extern KeyWork pad; -extern int (*g_pNowProcess)(void); - - -// const data----------------------------------- -extern const u16 myPlttData[12][16]; // パレットデータ -extern const u16 myChar[0x2800*8/16]; // キャラクターデータ - - -// function------------------------------------- -extern void mf_init(void); -extern void mf_KEYPAD_read(void); -extern void mf_KEYPAD_initRapid(void); -extern void mf_KEYPAD_rapid(void); -extern void mf_waitXframe(u16 frame); -extern void mf_clearRect(u16 pos_x,u16 pos_y,u8 height,u8 width); -/* -extern void mf_drawUInt(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength,u8 size); -extern void mf_drawHex(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength); -extern void mf_drawString(u16 pos_x,u16 pos_y,u16 color,const u8 *strp); -extern void mf_drawString2(u16 pos_x,u16 pos_y,u16 color,const u16 *strp); -extern void mf_drawRectFrame(u16 pos_x,u16 pos_y,u16 color,u8 height,u8 width); -extern void mf_CSR_init(u16 pos_x,u16 pos_y,u16 add_y); -extern void mf_CSR_moveAndAnime(int nowNum); -extern void mf_CSR_anime(const u16 *csr_charListp); -extern void mf_BLINK_initCounter(void); -extern void mf_BLINK_drawString(u16 pos_x,u16 pos_y,u16 color,const u8 *strp); -extern void mf_TIME_init(void); -extern void mf_TIME_start(int init_flag); -extern void mf_TIME_stop(void); -extern void mf_TIME_count(void); -extern void mf_TIME_draw(u16 pos_x,u16 pos_y,u16 color); -extern void mf_strcpy(const u8 *str1p,u8 *str2p); -extern u8 mf_strcmp(const u8 *str1p,const u8 *str2p); -*/ - -#ifdef __cplusplus -} -#endif - -#endif // __MISC_H__ - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/myChar.c b/build/systemMenu_RED/MachineSettings/ARM9/src/old/myChar.c deleted file mode 100644 index de62a8a4..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/myChar.c +++ /dev/null @@ -1,684 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: myChar.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include "misc.h" -#include "myFontequ.h" - -// パレットデータ-------------------------------------------------------------- -#define RGB555(r,g,b) (b<<10|g<<5|r) - -// 背景黒ベース -const u16 myPlttData[12][16] = { - {RGB555(31,31,31), RGB555( 0, 0, 0), RGB555(15,15,15), RGB555(31,31,31),}, // White - {RGB555(31,31,31), RGB555(31, 0, 0), RGB555(31,31,31), RGB555(31,31,31),}, // Red - {RGB555(31,31,31), RGB555( 0, 19, 0), RGB555(31,31,31), RGB555(31,31,31),}, // Green - {RGB555(31,31,31), RGB555( 0, 11, 31), RGB555(31,31,31), RGB555(31,31,31),}, // Blue - {RGB555(31,31,31), RGB555(31, 31, 0), RGB555(31,31,31), RGB555(31,31,31),}, // Yellow - {RGB555(31,31,31), RGB555( 0, 31, 31), RGB555(31,31,31), RGB555(31,31,31),}, // Cyan - {RGB555(31,31,31), RGB555(31, 0, 31), RGB555(31,31,31), RGB555(31,31,31),}, // Purple - {RGB555(31,31,31), RGB555( 0, 31, 0), RGB555(31,31,31), RGB555(31,31,31),}, // Light Green - {RGB555(31,31,31), RGB555(31,31,31), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // HighLight Yellow - {RGB555(31,31,31), RGB555(31,31,31), RGB555( 0, 31, 31), RGB555( 0, 31, 31),}, // HighLight CYAN - {RGB555(31,31,31), RGB555(31,31,31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // HighLight WHITE - {RGB555(31,31,31), RGB555(31,31,31), RGB555( 0, 11, 31), RGB555( 0, 11, 31),}, // HighLight BLUE -}; - -// キャラクタデータ------------------------------------------------------------ -/* -const u16 myChar[0x2800*8/16]={ - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //0 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //3 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //4 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //5 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //6 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //7 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //8 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //b - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //c - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //d - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //e - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //f - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //10 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //11 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //12 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //13 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //14 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //15 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //16 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //17 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //18 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //19 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1a - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1b - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1c - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1d - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1e - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1f - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //20 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //21 - 0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,0x2333,0x3332, - 0x2113,0x3211,0x2113,0x3211,0x2123,0x3212,0x3213,0x3321, //22 - 0x3323,0x3332,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x2133,0x3321,0x1113,0x3211,0x2123,0x3321, //23 - 0x2133,0x3321,0x1113,0x3211,0x2123,0x3321,0x3233,0x3332, - 0x3333,0x3333,0x1333,0x3332,0x1133,0x3211,0x1213,0x3322, //24 - 0x1123,0x3311,0x1233,0x2112,0x1113,0x3211,0x1223,0x3322, - 0x3333,0x3333,0x2133,0x2133,0x1213,0x3212,0x2123,0x3321, //25 - 0x1233,0x3212,0x2133,0x2121,0x3213,0x3212,0x3323,0x3323, - 0x3333,0x3333,0x1133,0x3331,0x2113,0x3212,0x1123,0x3321, //26 - 0x2113,0x2111,0x3213,0x3213,0x1123,0x2121,0x2233,0x3232, - 0x1133,0x3332,0x1133,0x3332,0x1233,0x3332,0x2133,0x3333, //27 - 0x3233,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3213,0x3333,0x3321,0x1333,0x3332, //28 - 0x1333,0x3332,0x1333,0x3332,0x2333,0x3331,0x3333,0x3312, - 0x3333,0x3333,0x3133,0x3333,0x1233,0x3333,0x2333,0x3321, //29 - 0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2133,0x3333, - 0x3333,0x3333,0x1333,0x3332,0x1213,0x3212,0x1133,0x3321, //2a - 0x1233,0x3332,0x1133,0x3321,0x1213,0x3212,0x1323,0x3222, - 0x3333,0x3333,0x3333,0x3333,0x1333,0x3332,0x1333,0x3332, //2b - 0x1113,0x3211,0x1223,0x3222,0x1333,0x3332,0x2333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2c - 0x1133,0x3332,0x1133,0x3332,0x1233,0x3332,0x2133,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2d - 0x1113,0x3211,0x2223,0x3222,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2e - 0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x2233,0x3333, - 0x3333,0x3333,0x3333,0x2133,0x3333,0x3213,0x3333,0x3321, //2f - 0x1333,0x3332,0x2133,0x3333,0x3213,0x3333,0x3323,0x3333, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //30 - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x1333,0x3321,0x1133,0x3321,0x1233,0x3321, //31 - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x1113,0x3211,0x2223,0x2112,0x1133,0x3211, //32 - 0x2113,0x3322,0x2113,0x3333,0x1113,0x2111,0x2223,0x3222, - 0x3333,0x3333,0x1113,0x3211,0x2223,0x2112,0x1133,0x3211, //33 - 0x2233,0x2112,0x3333,0x2113,0x1113,0x3211,0x2223,0x3322, - 0x3333,0x3333,0x3333,0x3211,0x1333,0x3211,0x2133,0x3211, //34 - 0x3213,0x3211,0x1113,0x2111,0x2223,0x3211,0x3333,0x3322, - 0x3333,0x3333,0x1113,0x3211,0x2213,0x3322,0x1113,0x3211, //35 - 0x2223,0x2112,0x3333,0x2113,0x1113,0x3211,0x2223,0x3322, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x3322,0x1113,0x3211, //36 - 0x2113,0x2112,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x1113,0x2111,0x2223,0x2122,0x3333,0x3213, //37 - 0x3333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3332, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x1123,0x3211, //38 - 0x2113,0x2112,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //39 - 0x1123,0x2111,0x2233,0x2112,0x1133,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, //3a - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, //3b - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3321, - 0x3333,0x3333,0x3333,0x3321,0x1333,0x3332,0x2133,0x3333, //3c - 0x2133,0x3333,0x1233,0x3333,0x2333,0x3321,0x3333,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3211, //3d - 0x2233,0x3222,0x1133,0x3211,0x2233,0x3222,0x3333,0x3333, - 0x3333,0x3333,0x1333,0x3333,0x2333,0x3331,0x3333,0x3212, //3e - 0x3333,0x3213,0x3333,0x3321,0x1333,0x3332,0x2333,0x3333, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //3f - 0x3223,0x3211,0x1333,0x3321,0x2333,0x3332,0x1333,0x3321, - 0x3333,0x3333,0x1133,0x3321,0x2213,0x3212,0x1213,0x2121, //40 - 0x2113,0x2121,0x2113,0x2121,0x1213,0x3211,0x1123,0x2121, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //41 - 0x1113,0x2111,0x2113,0x2112,0x2113,0x2113,0x2223,0x2223, - 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //42 - 0x2113,0x2112,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2223, //43 - 0x2113,0x3333,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x2113,0x2113, //44 - 0x2113,0x2113,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322, - 0x3333,0x3333,0x1113,0x2111,0x2113,0x2222,0x1113,0x3211, //45 - 0x2113,0x3222,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222, - 0x3333,0x3333,0x1113,0x2111,0x2113,0x2222,0x1113,0x3211, //46 - 0x2113,0x3222,0x2113,0x3333,0x2113,0x3333,0x2223,0x3333, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x3322,0x2113,0x2111, //47 - 0x2113,0x2112,0x2113,0x2113,0x1123,0x2111,0x2233,0x3222, - 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x1113,0x2111, //48 - 0x2113,0x2112,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //49 - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x3333,0x2113,0x3333,0x2113,0x3333,0x2113, //4a - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x2113,0x2113,0x2113,0x3211,0x1113,0x3322, //4b - 0x1113,0x3331,0x2113,0x3311,0x2113,0x2112,0x2223,0x2223, - 0x3333,0x3333,0x2113,0x3333,0x2113,0x3333,0x2113,0x3333, //4c - 0x2113,0x3333,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222, - 0x3333,0x3333,0x2133,0x2133,0x1113,0x1112,0x1113,0x1112, //4d - 0x1113,0x1111,0x2113,0x1121,0x2113,0x1121,0x3223,0x2232, - 0x3333,0x3333,0x2113,0x2113,0x1113,0x2112,0x1113,0x2112, //4e - 0x2113,0x2111,0x2113,0x2111,0x2113,0x2112,0x2223,0x2223, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //4f - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //50 - 0x2113,0x3322,0x2113,0x3333,0x2113,0x3333,0x2223,0x3333, - 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //51 - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x2111, - 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //52 - 0x2113,0x2112,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, - 0x3333,0x3333,0x1133,0x2111,0x2113,0x3222,0x1123,0x3331, //53 - 0x1233,0x3311,0x2333,0x2112,0x1113,0x3211,0x2223,0x3322, - 0x3333,0x3333,0x1113,0x2111,0x1223,0x3221,0x1333,0x3321, //54 - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2113,0x2113, //55 - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2113,0x2113, //56 - 0x2113,0x2113,0x2123,0x3213,0x1233,0x3321,0x2333,0x3332, - 0x3333,0x3333,0x2113,0x1121,0x2113,0x1121,0x2113,0x1121, //57 - 0x1113,0x1111,0x1123,0x2112,0x2133,0x2133,0x3233,0x3233, - 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x1123,0x3211, //58 - 0x1233,0x3211,0x2113,0x2112,0x2113,0x2113,0x3223,0x3223, - 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2133,0x3213, //59 - 0x1133,0x3211,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x1113,0x2111,0x2223,0x2112,0x1333,0x3221, //5a - 0x1133,0x3332,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222, - 0x3333,0x3333,0x1333,0x3321,0x1333,0x3322,0x1333,0x3332, //5b - 0x1333,0x3332,0x1333,0x3332,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x3313,0x3333,0x3123,0x3333,0x1233,0x3333, //5c - 0x2333,0x3331,0x3333,0x3312,0x3333,0x3123,0x3333,0x3233, - 0x3333,0x3333,0x1333,0x3321,0x2333,0x3321,0x3333,0x3321, //5d - 0x3333,0x3321,0x3333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x1333,0x3332,0x2133,0x3321,0x3233,0x3322, //5e - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //5f - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2222, - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3332,0x2333,0x3321, //60 - 0x3333,0x3332,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2213,0x2112, //61 - 0x1123,0x2111,0x2113,0x2112,0x1123,0x2111,0x2233,0x2222, - 0x2113,0x3333,0x2113,0x3333,0x1113,0x3211,0x2113,0x2112, //62 - 0x2113,0x2113,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2122, //63 - 0x2113,0x3233,0x2113,0x2133,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x2113,0x3333,0x2113,0x1133,0x2111,0x2113,0x2112, //64 - 0x2113,0x2113,0x2113,0x2113,0x1123,0x2111,0x2233,0x2222, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2112, //65 - 0x1113,0x2111,0x2113,0x3222,0x1123,0x2111,0x2233,0x3222, - 0x1333,0x3211,0x1133,0x3322,0x1113,0x3321,0x1123,0x3332, //66 - 0x1133,0x3332,0x1133,0x3332,0x1133,0x3332,0x2233,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x2111,0x2113,0x2112, //67 - 0x2113,0x2113,0x1123,0x2111,0x2213,0x2112,0x1133,0x3211, - 0x2113,0x3333,0x2113,0x3333,0x1113,0x3311,0x2113,0x2112, //68 - 0x2113,0x2113,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, - 0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,0x1333,0x3321, //69 - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3211,0x3333,0x3322,0x3333,0x3211,0x3333,0x3211, //6a - 0x3333,0x3211,0x3333,0x3211,0x3213,0x3211,0x1123,0x3321, - 0x2113,0x3333,0x2113,0x3213,0x2113,0x3211,0x1113,0x3321, //6b - 0x1113,0x3321,0x2113,0x3311,0x2113,0x2112,0x2223,0x3223, - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //6c - 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x1211,0x1121, //6d - 0x1211,0x1121,0x1211,0x1121,0x1211,0x1121,0x2322,0x2232, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x2113,0x2112, //6e - 0x2113,0x2113,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2112, //6f - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x2113,0x2112, //70 - 0x2113,0x2113,0x1113,0x3211,0x2113,0x3322,0x2113,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x2111,0x2113,0x2112, //71 - 0x2113,0x2113,0x1123,0x2111,0x2233,0x2112,0x3333,0x2113, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x2112,0x1133,0x2111, //72 - 0x1133,0x3222,0x1133,0x3332,0x1133,0x3332,0x2233,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x1113,0x3322, //73 - 0x1133,0x3211,0x2233,0x2111,0x1133,0x3211,0x2233,0x3322, - 0x1133,0x3332,0x1113,0x3321,0x1123,0x3332,0x1133,0x3332, //74 - 0x1133,0x3332,0x1133,0x3332,0x1233,0x3321,0x2333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //75 - 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //76 - 0x2113,0x2113,0x2113,0x3213,0x1113,0x3321,0x2223,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1211,0x1121,0x1211,0x1121, //77 - 0x1211,0x1121,0x1211,0x1121,0x1111,0x2111,0x2222,0x3222, - 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //78 - 0x1123,0x3211,0x2113,0x2112,0x2113,0x2113,0x3223,0x3223, - 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //79 - 0x2113,0x2113,0x1123,0x2111,0x2233,0x2112,0x1133,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x3211, //7a - 0x1333,0x3321,0x1133,0x3332,0x1113,0x2111,0x2223,0x2222, - 0x3333,0x3333,0x3333,0x3321,0x1333,0x3332,0x1333,0x3332, //7b - 0x2133,0x3333,0x1333,0x3332,0x1333,0x3332,0x3333,0x3321, - 0x3333,0x3333,0x1333,0x3332,0x1333,0x3332,0x1333,0x3332, //7c - 0x1333,0x3332,0x1333,0x3332,0x1333,0x3332,0x2333,0x3332, - 0x3333,0x3333,0x1333,0x3332,0x3333,0x3321,0x3333,0x3321, //7d - 0x3333,0x3213,0x3333,0x3321,0x3333,0x3321,0x1333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3113,0x3333, //7e - 0x1221,0x2133,0x2332,0x3211,0x3333,0x3322,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //7f - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,0x2211,0x2222, //80 - 0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,0x2211,0x2222, - 0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,0x1111,0x2222, //81 - 0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,0x1111,0x2222, - 0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,0x1111,0x2211, //82 - 0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,0x1111,0x2211, - 0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111, //83 - 0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111, - 0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222, //84 - 0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222, - 0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, //85 - 0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, - 0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, //86 - 0x1111,0x1111,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //87 - 0x1111,0x1111,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3333,0x2213, //88 - 0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x1111,0x2222,0x2222, //89 - 0x1111,0x1111,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x1111,0x2222,0x2222, //8a - 0x1111,0x1111,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, - 0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, //8b - 0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, - 0x3133,0x3333,0x1133,0x3333,0x1133,0x3331,0x1133,0x3311, //8c - 0x1133,0x3321,0x1133,0x3332,0x2133,0x3333,0x3233,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3332, //8d - 0x2123,0x3213,0x1133,0x3321,0x1213,0x3212,0x2113,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //8e - 0x3333,0x3321,0x3213,0x3213,0x3213,0x3213,0x2133,0x3323, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //8f - 0x1133,0x3332,0x2213,0x3321,0x3323,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x2133,0x3333, //90 - 0x1113,0x3321,0x1223,0x3332,0x2133,0x3333,0x1213,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3312, //91 - 0x2123,0x3323,0x1113,0x3321,0x2113,0x3213,0x2113,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3213,0x3321, //92 - 0x1123,0x3211,0x2113,0x3212,0x1223,0x3322,0x1333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //93 - 0x1213,0x3321,0x1113,0x3212,0x1213,0x3211,0x1323,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //94 - 0x1333,0x3321,0x1133,0x3332,0x1213,0x3321,0x1123,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //95 - 0x1333,0x3321,0x2113,0x3212,0x3223,0x3213,0x1333,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //96 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //97 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //98 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //99 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9a - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9b - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9c - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9d - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9e - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9f - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a0 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a1 - 0x3333,0x3333,0x1133,0x3321,0x2133,0x3321,0x1133,0x3321, - 0x3333,0x3333,0x1333,0x3211,0x1333,0x3322,0x1333,0x3332, //a2 - 0x1333,0x3332,0x2333,0x3332,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //a3 - 0x3333,0x3321,0x3333,0x3321,0x1133,0x3321,0x2233,0x3322, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a4 - 0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x1333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a5 - 0x1333,0x3332,0x2333,0x3332,0x3333,0x3333,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //a6 - 0x1113,0x2111,0x2223,0x2122,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3321, //a7 - 0x2223,0x3321,0x2133,0x3321,0x2133,0x3332,0x3213,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //a8 - 0x1133,0x3332,0x2111,0x3333,0x2122,0x3333,0x2133,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //a9 - 0x1113,0x3211,0x2213,0x3212,0x3323,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //aa - 0x1133,0x3321,0x1233,0x3332,0x1333,0x3332,0x1113,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //ab - 0x1113,0x3211,0x2223,0x3321,0x1333,0x3321,0x2113,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1213,0x3211, //ac - 0x2111,0x3212,0x2122,0x3323,0x1333,0x3332,0x1333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //ad - 0x1113,0x3321,0x2223,0x3321,0x3333,0x3321,0x1113,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3211, //ae - 0x2233,0x3212,0x1133,0x3211,0x2233,0x3212,0x1133,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //af - 0x1213,0x3212,0x2323,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //b0 - 0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x3333,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x3212, //b1 - 0x2133,0x3213,0x2133,0x3321,0x2133,0x3332,0x3211,0x3333, - 0x3333,0x3333,0x3333,0x2133,0x3333,0x3213,0x1333,0x3321, //b2 - 0x2113,0x3321,0x3223,0x3321,0x3333,0x3321,0x3333,0x3321, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x2213,0x2122, //b3 - 0x3323,0x2133,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x1223,0x3322, //b4 - 0x1333,0x3332,0x1333,0x3332,0x1333,0x3332,0x1111,0x2111, - 0x3333,0x3333,0x3333,0x3213,0x1113,0x2111,0x2223,0x3212, //b5 - 0x3333,0x3211,0x1333,0x3212,0x1333,0x3212,0x2113,0x3213, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x1223,0x2122, //b6 - 0x1333,0x2132,0x2133,0x2133,0x2133,0x2133,0x3213,0x3213, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x2223,0x3221, //b7 - 0x3333,0x3321,0x1113,0x1111,0x2223,0x2212,0x3333,0x3213, - 0x3333,0x3333,0x1133,0x2111,0x2133,0x2122,0x3213,0x2133, //b8 - 0x3323,0x3213,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3213,0x3333,0x1113,0x2111,0x2213,0x3212, //b9 - 0x3321,0x3213,0x3332,0x3321,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //ba - 0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x1113,0x2111, - 0x3333,0x3333,0x3213,0x3213,0x1111,0x2111,0x2212,0x3212, //bb - 0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x2113,0x2133,0x3223,0x2133, //bc - 0x2113,0x2133,0x3223,0x2133,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x3212, //bd - 0x3333,0x3321,0x3333,0x3321,0x1333,0x3212,0x2113,0x2133, - 0x3333,0x3333,0x2133,0x3333,0x1133,0x2111,0x2111,0x2122, //be - 0x2122,0x3213,0x2133,0x3323,0x2133,0x3333,0x1133,0x2111, - 0x3333,0x3333,0x3333,0x3333,0x3213,0x2133,0x3213,0x2133, //bf - 0x2123,0x3213,0x3233,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x1133,0x2111,0x2133,0x2122,0x2133,0x2133, //c0 - 0x1213,0x2111,0x2323,0x2122,0x3333,0x3213,0x1133,0x3321, - 0x3333,0x3333,0x3333,0x3213,0x1113,0x3321,0x2223,0x3321, //c1 - 0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1213,0x2132,0x1213,0x2132, //c2 - 0x2323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x1111,0x2111, //c3 - 0x2222,0x3221,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333, - 0x3333,0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x3333, //c4 - 0x1133,0x3332,0x2133,0x3211,0x2133,0x3322,0x2133,0x3333, - 0x3333,0x3333,0x3333,0x3321,0x1111,0x2111,0x2222,0x3221, //c5 - 0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2233,0x3322, //c6 - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x2111, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x3212, //c7 - 0x3133,0x3321,0x1233,0x3332,0x2133,0x3321,0x3211,0x3213, - 0x3333,0x3333,0x1333,0x3332,0x1111,0x2111,0x2222,0x3212, //c8 - 0x3333,0x3321,0x1133,0x3212,0x1211,0x2132,0x1322,0x3232, - 0x3333,0x3333,0x3333,0x3213,0x3333,0x3213,0x3333,0x3213, //c9 - 0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333, - 0x3333,0x3333,0x1333,0x3332,0x3333,0x3321,0x3213,0x3213, //ca - 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133, - 0x3333,0x3333,0x3213,0x2133,0x3213,0x3211,0x1113,0x3322, //cb - 0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1133,0x2111, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x2122, //cc - 0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x1213,0x3332, //cd - 0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233, - 0x3333,0x3333,0x1333,0x3332,0x1111,0x2111,0x1222,0x3222, //ce - 0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x2122, //cf - 0x3213,0x3213,0x2133,0x3321,0x1333,0x3332,0x3333,0x3321, - 0x3333,0x3333,0x3113,0x3333,0x1223,0x3311,0x2333,0x2122, //d0 - 0x1133,0x3231,0x2233,0x3212,0x1113,0x3322,0x2223,0x2111, - 0x3333,0x3333,0x1333,0x3332,0x2133,0x3333,0x3213,0x3333, //d1 - 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x1111,0x2111, - 0x3333,0x3333,0x3333,0x3213,0x3213,0x3213,0x2133,0x3321, //d2 - 0x1333,0x3332,0x1333,0x3332,0x2133,0x3321,0x3211,0x3213, - 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2122,0x3222, //d3 - 0x1111,0x2111,0x2122,0x3222,0x2133,0x3333,0x1133,0x2111, - 0x3333,0x3333,0x2133,0x3333,0x1133,0x2111,0x2111,0x2122, //d4 - 0x2122,0x3213,0x2133,0x3323,0x1333,0x3332,0x1333,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x3321,0x2223,0x3321, //d5 - 0x3333,0x3321,0x3333,0x3321,0x3333,0x3321,0x1111,0x2111, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //d6 - 0x1113,0x2111,0x2223,0x2122,0x3333,0x2133,0x1113,0x2111, - 0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x1111,0x2111, //d7 - 0x2222,0x2122,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x3333,0x3213,0x3213,0x3213,0x3213,0x3213,0x3213, //d8 - 0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x1333,0x3332,0x1213,0x3332,0x1213,0x3332, //d9 - 0x1213,0x2132,0x1213,0x2132,0x1213,0x3212,0x1321,0x3321, - 0x3333,0x3333,0x3213,0x3333,0x3213,0x3333,0x3213,0x3333, //da - 0x3213,0x3213,0x3213,0x3213,0x3213,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2213,0x2122, //db - 0x3213,0x2133,0x3213,0x2133,0x3213,0x2133,0x1113,0x2111, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2213,0x2122, //dc - 0x3323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x1113,0x2132,0x2223,0x2133, //dd - 0x3333,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x1223,0x2122, //de - 0x1333,0x2132,0x2133,0x2133,0x2133,0x2133,0x3213,0x3213, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x2223,0x3221, //df - 0x3333,0x3321,0x1113,0x1111,0x2223,0x2212,0x3333,0x3213, - 0x3333,0x1213,0x3333,0x2323,0x1133,0x2111,0x2133,0x2122, //e0 - 0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x1313,0x3213,0x2323,0x1113,0x2111,0x2213,0x3212, //e1 - 0x3321,0x3213,0x3332,0x3321,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x1313,0x3333,0x2323,0x1113,0x2111,0x2223,0x2122, //e2 - 0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x1113,0x2111, - 0x3333,0x1313,0x3333,0x2323,0x3213,0x3213,0x1111,0x2111, //e3 - 0x2212,0x3212,0x3213,0x3213,0x3323,0x3321,0x1133,0x3332, - 0x3333,0x1313,0x3333,0x2323,0x2113,0x2133,0x3223,0x2133, //e4 - 0x2113,0x2133,0x3223,0x2133,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x1313,0x3333,0x2323,0x1113,0x2111,0x2223,0x3212, //e5 - 0x3333,0x3321,0x3333,0x3321,0x1333,0x3212,0x2113,0x2133, - 0x3333,0x1313,0x2133,0x2323,0x1133,0x2111,0x2111,0x2122, //e6 - 0x2122,0x3213,0x2133,0x3323,0x2133,0x3333,0x1133,0x2111, - 0x3333,0x1313,0x3333,0x2323,0x3213,0x2133,0x3213,0x2133, //e7 - 0x2123,0x3213,0x3233,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x1313,0x3333,0x2323,0x1133,0x2111,0x2133,0x2122, //e8 - 0x1213,0x2111,0x2323,0x2122,0x3333,0x3213,0x1133,0x3321, - 0x3333,0x1313,0x3333,0x2323,0x1113,0x3211,0x2223,0x3321, //e9 - 0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x1313,0x3333,0x2323,0x1213,0x2132,0x1213,0x2132, //ea - 0x2323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, - 0x3333,0x1313,0x3333,0x2323,0x1113,0x3211,0x2223,0x3322, //eb - 0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x2133,0x1313,0x2133,0x2323,0x2133,0x3333, //ec - 0x1133,0x3333,0x2133,0x3211,0x2133,0x3322,0x2133,0x3333, - 0x3333,0x1313,0x1333,0x2323,0x3333,0x3331,0x3213,0x3213, //ed - 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133, - 0x3333,0x1313,0x3213,0x2323,0x3213,0x2111,0x1113,0x3222, //ee - 0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1123,0x2111, - 0x3333,0x1313,0x3333,0x2323,0x1111,0x2111,0x2222,0x2122, //ef - 0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x3333,0x1313,0x2133,0x2323,0x1213,0x3332, //f0 - 0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233, - 0x3333,0x1313,0x1333,0x2323,0x1111,0x2111,0x1222,0x3222, //f1 - 0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x2213,0x2122, //f2 - 0x3323,0x2133,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3133,0x1333,0x1212,0x3333,0x2121,0x3213,0x3213, //f3 - 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133, - 0x3333,0x3133,0x3213,0x1213,0x3213,0x2111,0x1113,0x3222, //f4 - 0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1133,0x2111, - 0x3333,0x3133,0x3333,0x1213,0x1111,0x2111,0x2222,0x2122, //f5 - 0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332, - 0x3333,0x3133,0x3333,0x1213,0x2133,0x2123,0x1213,0x3232, //f6 - 0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233, - 0x3333,0x3133,0x1333,0x1212,0x1111,0x2111,0x1222,0x3222, //f7 - 0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //f8 - 0x1113,0x2113,0x1223,0x3221,0x2133,0x3332,0x1133,0x2111, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3321,0x2123,0x2132, //f9 - 0x1113,0x3211,0x2121,0x2121,0x1321,0x2132,0x2113,0x3213, - 0x3333,0x3333,0x3213,0x3333,0x3213,0x3213,0x3213,0x2133, //fa - 0x3213,0x2133,0x3213,0x2133,0x1213,0x3232,0x2133,0x3333, - 0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x1333,0x3211, //fb - 0x2113,0x2122,0x3223,0x2133,0x3333,0x3213,0x1133,0x3321, - 0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x1113,0x3211, //fc - 0x2223,0x3321,0x1333,0x3332,0x2133,0x3321,0x3213,0x2113, - 0x3333,0x3333,0x2133,0x2133,0x1133,0x2121,0x2113,0x3232, //fd - 0x1123,0x3211,0x2113,0x2122,0x2121,0x2133,0x2113,0x3213, - 0x3333,0x3333,0x3333,0x3321,0x2133,0x3213,0x1111,0x2132, //fe - 0x2122,0x2121,0x3213,0x3321,0x3321,0x3321,0x1132,0x3332, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2223,0x3321, //ff - 0x1133,0x2111,0x2233,0x3212,0x3313,0x3323,0x1133,0x3211, - 0x3333,0x3333,0x3333,0x3213,0x3333,0x3321,0x1333,0x3332, //100 - 0x2133,0x3333,0x1333,0x3332,0x3333,0x3321,0x3333,0x3213, - 0x3333,0x3333,0x3333,0x3213,0x1213,0x2111,0x2213,0x3212, //101 - 0x3213,0x3213,0x3213,0x3213,0x2133,0x3213,0x3233,0x3321, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2233,0x2122, //102 - 0x3333,0x3213,0x3333,0x3323,0x3213,0x3333,0x1133,0x2111, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2223,0x3321, //103 - 0x3333,0x3212,0x3333,0x3213,0x3213,0x3333,0x1123,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x3213,0x3333,0x3213,0x3333, //104 - 0x3213,0x3333,0x3213,0x3333,0x3213,0x3213,0x1123,0x3321, - 0x3333,0x3333,0x3333,0x3321,0x1113,0x2111,0x2223,0x3221, //105 - 0x1133,0x3321,0x2133,0x3321,0x1333,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x3333,0x3333,0x3213,0x3321,0x1113,0x2111, //106 - 0x3211,0x3321,0x3212,0x3321,0x3213,0x2133,0x1133,0x3211, - 0x3333,0x3333,0x2133,0x2133,0x2133,0x2133,0x3233,0x3213, //107 - 0x1113,0x2111,0x1223,0x3222,0x2133,0x3333,0x1333,0x2111, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //108 - 0x3213,0x2111,0x3213,0x3222,0x1213,0x3332,0x3321,0x2111, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //109 - 0x1213,0x3311,0x2113,0x2122,0x3223,0x2133,0x1333,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2211,0x2122, //10a - 0x3322,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321, - 0x3333,0x3333,0x3333,0x2113,0x1133,0x3211,0x2211,0x3321, //10b - 0x1322,0x3332,0x1333,0x3332,0x3333,0x3321,0x3333,0x2113, - 0x3333,0x3333,0x3213,0x3333,0x3213,0x2133,0x2133,0x3211, //10c - 0x1133,0x3322,0x2213,0x3333,0x3213,0x3333,0x1133,0x2111, - 0x3333,0x3333,0x2133,0x3333,0x1111,0x2112,0x2212,0x3223, //10d - 0x3213,0x3213,0x1321,0x3211,0x2132,0x2112,0x1333,0x3221, - 0x3333,0x3333,0x3333,0x3333,0x1213,0x2111,0x2213,0x3222, //10e - 0x3213,0x3333,0x3213,0x3333,0x3213,0x3321,0x2133,0x2113, - 0x3333,0x3333,0x3333,0x3321,0x3213,0x3321,0x1213,0x3211, //10f - 0x2113,0x2121,0x1121,0x2112,0x2121,0x2121,0x3213,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x3213,0x3211,0x1211,0x2122, //110 - 0x2112,0x2133,0x3213,0x2111,0x3211,0x2121,0x3212,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2122, //111 - 0x2121,0x2133,0x2121,0x2133,0x2121,0x2133,0x3213,0x3213, - 0x3333,0x3333,0x3333,0x3213,0x1121,0x2111,0x2221,0x3212, //112 - 0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221, - 0x3333,0x3333,0x2133,0x3333,0x2111,0x3213,0x3212,0x2113, //113 - 0x3321,0x3213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332, - 0x3333,0x3333,0x1133,0x3333,0x2233,0x3321,0x3333,0x3332, //114 - 0x1213,0x3332,0x3321,0x2121,0x3321,0x2121,0x1132,0x3232, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3332, //115 - 0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x2233, - 0x3333,0x3333,0x1321,0x2111,0x2321,0x3212,0x1321,0x2111, //116 - 0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221, - 0x3333,0x3333,0x1113,0x3211,0x2223,0x3321,0x1113,0x3211, //117 - 0x2223,0x3321,0x1113,0x3321,0x2221,0x3211,0x1113,0x3322, - 0x3333,0x3333,0x1113,0x3321,0x1223,0x3332,0x2133,0x3213, //118 - 0x1113,0x3211,0x2121,0x2112,0x3211,0x3213,0x3322,0x3321, - 0x3333,0x3333,0x2133,0x3333,0x1111,0x3212,0x2122,0x2133, //119 - 0x2113,0x3333,0x2121,0x2133,0x3213,0x2133,0x1133,0x3211, - 0x3333,0x3333,0x3333,0x3321,0x1213,0x3211,0x2113,0x2121, //11a - 0x1211,0x2132,0x1121,0x2132,0x2121,0x2133,0x3213,0x3213, - 0x3333,0x3333,0x1333,0x3332,0x1113,0x3321,0x2123,0x3332, //11b - 0x1113,0x3321,0x2123,0x2132,0x2133,0x2133,0x1333,0x3211, - 0x3333,0x3333,0x3333,0x3321,0x1213,0x3211,0x2113,0x2121, //11c - 0x3211,0x2132,0x2122,0x3213,0x2133,0x3323,0x1333,0x3332, - 0x3333,0x3333,0x1333,0x3332,0x1321,0x3211,0x1121,0x2122, //11d - 0x1211,0x2132,0x1321,0x2132,0x1332,0x3212,0x2133,0x3323, - 0x3333,0x3333,0x1333,0x3332,0x1333,0x3211,0x1333,0x3322, //11e - 0x1333,0x3332,0x1113,0x3321,0x1221,0x3212,0x2113,0x3323, - 0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x2133,0x3211, //11f - 0x1213,0x2122,0x2113,0x2133,0x3223,0x2133,0x1333,0x3211, - 0x3333,0x3333,0x2133,0x3333,0x3213,0x3213,0x3213,0x3213, //120 - 0x2113,0x3213,0x3223,0x3213,0x3333,0x3321,0x1133,0x3332, - 0x3333,0x3333,0x1113,0x3211,0x2223,0x3321,0x1333,0x3211, //121 - 0x2113,0x2122,0x1221,0x2121,0x2132,0x2121,0x1333,0x3211, - 0x3333,0x3333,0x3333,0x3211,0x1213,0x3212,0x1211,0x3212, //122 - 0x2112,0x3213,0x3213,0x3213,0x3211,0x3213,0x3212,0x2133, - 0x3333,0x3333,0x1333,0x3211,0x2113,0x3321,0x1223,0x3332, //123 - 0x1133,0x3211,0x2211,0x2122,0x3322,0x2133,0x1333,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x3213,0x3311,0x1211,0x2122, //124 - 0x2112,0x2133,0x3213,0x2133,0x3211,0x2133,0x3212,0x3211, - 0x3333,0x3333,0x3333,0x3333,0x1333,0x3332,0x1333,0x3332, //125 - 0x2133,0x3333,0x1133,0x3332,0x1213,0x2132,0x3321,0x3211, - 0x3333,0x1313,0x3333,0x2323,0x2133,0x3213,0x1111,0x2132, //126 - 0x2122,0x2121,0x3213,0x3221,0x3321,0x3321,0x1132,0x3332, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2223,0x3321, //127 - 0x1133,0x2111,0x2233,0x3212,0x3313,0x3323,0x1123,0x3211, - 0x3333,0x1313,0x3333,0x2323,0x3333,0x3321,0x1333,0x3332, //128 - 0x2133,0x3333,0x1233,0x3333,0x2333,0x3331,0x3333,0x3312, - 0x3333,0x1313,0x3333,0x2323,0x1213,0x2111,0x3213,0x3213, //129 - 0x3213,0x3213,0x3213,0x3213,0x2123,0x3213,0x3233,0x3321, - 0x3333,0x1313,0x3333,0x2323,0x1133,0x3211,0x2233,0x2122, //12a - 0x3333,0x3213,0x3333,0x3323,0x3213,0x3333,0x1123,0x3111, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2223,0x3321, //12b - 0x3333,0x3212,0x3333,0x3213,0x3213,0x3323,0x1123,0x3211, - 0x3333,0x3333,0x3333,0x3131,0x3213,0x3232,0x3213,0x3333, //12c - 0x3213,0x3333,0x3213,0x3333,0x3213,0x3213,0x1133,0x3321, - 0x3333,0x1313,0x3333,0x2321,0x1113,0x2111,0x2223,0x3321, //12d - 0x1133,0x3321,0x2133,0x3321,0x1333,0x3321,0x1113,0x3332, - 0x3333,0x1313,0x3333,0x2323,0x3213,0x3321,0x1113,0x2111, //12e - 0x2211,0x3221,0x3212,0x3321,0x3213,0x2132,0x1133,0x3211, - 0x3333,0x1313,0x2133,0x2323,0x2133,0x2133,0x3233,0x3213, //12f - 0x1113,0x3111,0x1223,0x3222,0x2133,0x3333,0x1233,0x2111, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2123,0x3322, //130 - 0x3213,0x2111,0x3213,0x3222,0x1213,0x3332,0x2321,0x2111, - 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2123,0x3322, //131 - 0x1213,0x3211,0x2113,0x2122,0x3223,0x2133,0x1333,0x3211, - 0x3333,0x1313,0x3333,0x2323,0x1133,0x3211,0x2211,0x2122, //132 - 0x3322,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321, - 0x3333,0x1313,0x3333,0x2323,0x1133,0x2111,0x2211,0x3221, //133 - 0x1322,0x3332,0x1333,0x3332,0x3333,0x3321,0x3333,0x2113, - 0x3333,0x1313,0x3213,0x2323,0x3213,0x2133,0x2133,0x3211, //134 - 0x1133,0x3322,0x2213,0x3333,0x3213,0x3333,0x1133,0x2111, - 0x3333,0x1313,0x3333,0x2323,0x1121,0x2111,0x2221,0x3212, //135 - 0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221, - 0x3333,0x1313,0x2133,0x2323,0x2111,0x3213,0x3212,0x2113, //136 - 0x3321,0x3213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332, - 0x3333,0x1313,0x1133,0x2323,0x2233,0x3321,0x3333,0x3332, //137 - 0x1213,0x3332,0x2321,0x2121,0x3321,0x2121,0x1132,0x3232, - 0x3333,0x3333,0x3333,0x3131,0x3333,0x3232,0x1133,0x3332, //138 - 0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x3233, - 0x3333,0x1313,0x1321,0x2321,0x2321,0x3212,0x1321,0x2111, //139 - 0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221, - 0x3333,0x3133,0x3333,0x1213,0x1121,0x2111,0x2221,0x3212, //13a - 0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221, - 0x3333,0x3133,0x2133,0x1213,0x2111,0x2123,0x3213,0x1113, //13b - 0x3321,0x2213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332, - 0x3333,0x3133,0x1133,0x1213,0x2233,0x2121,0x3333,0x3232, //13c - 0x1213,0x3332,0x3321,0x2121,0x3321,0x2121,0x1132,0x3232, - 0x3333,0x3313,0x3333,0x2121,0x3333,0x3212,0x1133,0x3322, //13d - 0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x3233, - 0x3333,0x3133,0x1321,0x1211,0x2321,0x2112,0x1321,0x2111, //13e - 0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221, - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //13f - 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, -}; -*/ diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/myFontequ.h b/build/systemMenu_RED/MachineSettings/ARM9/src/old/myFontequ.h deleted file mode 100644 index 5b118478..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/myFontequ.h +++ /dev/null @@ -1,335 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: myFontequ.h - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef __MY_FONT_H__ -#define __MY_FONT_H__ - -// 文字コードの定義 - -#define EOM_ 0x00 // 終了コード - -// オーナー情報編集用ボタン---------------------- -#define CODE_BUTTON_TOP_ 0x200 -#define VAR_BUTTON1_ CODE_BUTTON_TOP_ -#define VAR_BUTTON2_ (CODE_BUTTON_TOP_ + 1) -#define DEL_BUTTON_ (CODE_BUTTON_TOP_ + 2) -#define CANCEL_BUTTON_ (CODE_BUTTON_TOP_ + 3) -#define OK_BUTTON_ (CODE_BUTTON_TOP_ + 4) -#define CODE_BUTTON_BOTTOM_ (CODE_BUTTON_TOP_ + 5) - -/* -// ひらがな---------------------------------------- - -#define a_ 0x0f9 // "あ" -#define i_ 0x0fa // "い" -#define u_ 0x0fb // "う" -#define e_ 0x0fc // "え" -#define o_ 0x0fd // "お" - -#define ka_ 0x0fe // "か" -#define ki_ 0x0ff // "き" -#define ku_ 0x100 // "く" -#define ke_ 0x101 // "け" -#define ko_ 0x102 // "こ" - -#define sa_ 0x103 // "さ" -#define si_ 0x104 // "し" -#define su_ 0x105 // "す" -#define se_ 0x106 // "せ" -#define so_ 0x107 // "そ" - -#define ta_ 0x108 // "た" -#define ti_ 0x109 // "ち" -#define tu_ 0x10a // "つ" -#define te_ 0x10b // "て" -#define to_ 0x10c // "と" - -#define na_ 0x10d // "な" -#define ni_ 0x10e // "に" -#define nu_ 0x10f // "ぬ" -#define ne_ 0x110 // "ね" -#define no_ 0x111 // "の" - -#define ha_ 0x112 // "は" -#define hi_ 0x113 // "ひ" -#define hu_ 0x114 // "ふ" -#define he_ 0x115 // "へ" -#define ho_ 0x116 // "ほ" - -#define ma_ 0x117 // "ま" -#define mi_ 0x118 // "み" -#define mu_ 0x119 // "む" -#define me_ 0x11a // "め" -#define mo_ 0x11b // "も" - -#define ya_ 0x11c // "や" -#define yu_ 0x11d // "ゆ" -#define yo_ 0x11e // "よ" - -#define ra_ 0x11f // "ら" -#define ri_ 0x120 // "り" -#define ru_ 0x121 // "る" -#define re_ 0x122 // "れ" -#define ro_ 0x123 // "ろ" - -#define wa_ 0x124 // "わ" -#define wo_ 0x0f8 // "を" -#define n_ 0x125 // "ん" - - -#define ga_ 0x126 // "が" -#define gi_ 0x127 // "ぎ" -#define gu_ 0x128 // "ぐ" -#define ge_ 0x129 // "げ" -#define go_ 0x12a // "ご" -#define za_ 0x12b // "ざ" -#define zi_ 0x12c // "じ" -#define zu_ 0x12d // "ず" -#define ze_ 0x12e // "ぜ" -#define zo_ 0x12f // "ぞ" -#define da_ 0x130 // "だ" -#define di_ 0x131 // "ぢ" -#define du_ 0x132 // "づ" -#define de_ 0x133 // "で" -#define do_ 0x134 // "ど" -#define ba_ 0x135 // "ば" -#define bi_ 0x136 // "び" -#define bu_ 0x137 // "ぶ" -#define be_ 0x138 // "べ" -#define bo_ 0x139 // "ぼ" -#define pa_ 0x13a // "ぱ" -#define pi_ 0x13b // "ぴ" -#define pu_ 0x13c // "ぷ" -#define pe_ 0x13d // "ぺ" -#define po_ 0x13e // "ぽ" - -#define aa_ 0x08d // "ぁ" -#define ii_ 0x08e // "ぃ" -#define uu_ 0x08f // "ぅ" -#define ee_ 0x090 // "ぇ" -#define oo_ 0x091 // "ぉ" -#define yya_ 0x092 // "ゃ" -#define yyu_ 0x093 // "ゅ" -#define yyo_ 0x094 // "ょ" -#define ttu_ 0x095 // "っ" - - -// カタカナ---------------------------------------- -#define A_ 0x0b1 // "ア" -#define I_ 0x0b2 // "イ" -#define U_ 0x0b3 // "ウ" -#define E_ 0x0b4 // "エ" -#define O_ 0x0b5 // "オ" -#define KA_ 0x0b6 // "カ" -#define KI_ 0x0b7 // "キ" -#define KU_ 0x0b8 // "ク" -#define KE_ 0x0b9 // "ケ" -#define KO_ 0x0ba // "コ" -#define SA_ 0x0bb // "サ" -#define SI_ 0x0bc // "シ" -#define SU_ 0x0bd // "ス" -#define SE_ 0x0be // "セ" -#define SO_ 0x0bf // "ソ" -#define TA_ 0x0c0 // "タ" -#define TI_ 0x0c1 // "チ" -#define TU_ 0x0c2 // "ツ" -#define TE_ 0x0c3 // "テ" -#define TO_ 0x0c4 // "ト" -#define NA_ 0x0c5 // "ナ" -#define NI_ 0x0c6 // "ニ" -#define NU_ 0x0c7 // "ヌ" -#define NE_ 0x0c8 // "ネ" -#define NO_ 0x0c9 // "ノ" -#define HA_ 0x0ca // "ハ" -#define HI_ 0x0cb // "ヒ" -#define HU_ 0x0cc // "フ" -#define HE_ 0x0cd // "ヘ" -#define HO_ 0x0ce // "ホ" -#define MA_ 0x0cf // "マ" -#define MI_ 0x0d0 // "ミ" -#define MU_ 0x0d1 // "ム" -#define ME_ 0x0d2 // "メ" -#define MO_ 0x0d3 // "モ" -#define YA_ 0x0d4 // "ヤ" -#define YU_ 0x0d5 // "ユ" -#define YO_ 0x0d6 // "ヨ" -#define RA_ 0x0d7 // "ラ" -#define RI_ 0x0d8 // "リ" -#define RU_ 0x0d9 // "ル" -#define RE_ 0x0da // "レ" -#define RO_ 0x0db // "ロ" -#define WA_ 0x0dc // "ワ" -#define WO_ 0x0a6 // "ヲ" -#define N_ 0x0dd // "ン" - -#define GA_ 0x0de // "ガ" -#define GI_ 0x0df // "ギ" -#define GU_ 0x0e0 // "グ" -#define GE_ 0x0e1 // "ゲ" -#define GO_ 0x0e2 // "ゴ" -#define ZA_ 0x0e3 // "ザ" -#define ZI_ 0x0e4 // "ジ" -#define ZU_ 0x0e5 // "ズ" -#define ZE_ 0x0e6 // "ゼ" -#define ZO_ 0x0e7 // "ゾ" -#define DA_ 0x0e8 // "ダ" -#define DI_ 0x0e9 // "ヂ" -#define DU_ 0x0ea // "ヅ" -#define DE_ 0x0eb // "デ" -#define DO_ 0x0ec // "ド" -#define BA_ 0x0ed // "バ" -#define BI_ 0x0ee // "ビ" -#define BU_ 0x0ef // "ブ" -#define BE_ 0x0f0 // "ベ" -#define BO_ 0x0f1 // "ボ" -#define VU_ 0x0f2 // "ヴ" -#define PA_ 0x0f3 // "パ" -#define PI_ 0x0f4 // "ピ" -#define PU_ 0x0f5 // "プ" -#define PE_ 0x0f6 // "ペ" -#define PO_ 0x0f7 // "ポ" - -#define AA_ 0x0a7 // "ァ" -#define II_ 0x0a8 // "ィ" -#define UU_ 0x0a9 // "ゥ" -#define EE_ 0x0aa // "ェ" -#define OO_ 0x0ab // "ォ" -#define YYA_ 0x0ac // "ャ" -#define YYU_ 0x0ad // "ュ" -#define YYO_ 0x0ae // "ョ" -#define TTU_ 0x0af // "ッ" - - -// アルファベット大文字---------------------------- -#define A__ 0x041 // "A" -#define B__ 0x042 // "B" -#define C__ 0x043 // "C" -#define D__ 0x044 // "D" -#define E__ 0x045 // "E" -#define F__ 0x046 // "F" -#define G__ 0x047 // "G" -#define H__ 0x048 // "H" -#define I__ 0x049 // "I" -#define J__ 0x04a // "J" -#define K__ 0x04b // "K" -#define L__ 0x04c // "L" -#define M__ 0x04d // "M" -#define N__ 0x04e // "N" -#define O__ 0x04f // "O" -#define P__ 0x050 // "P" -#define Q__ 0x051 // "Q" -#define R__ 0x052 // "R" -#define S__ 0x053 // "S" -#define T__ 0x054 // "T" -#define U__ 0x055 // "U" -#define V__ 0x056 // "V" -#define W__ 0x057 // "W" -#define X__ 0x058 // "X" -#define Y__ 0x059 // "Y" -#define Z__ 0x05a // "Z" - - -// アルファベット小文字---------------------------- -#define a__ 0x061 // "a" -#define b__ 0x062 // "b" -#define c__ 0x063 // "c" -#define d__ 0x064 // "d" -#define e__ 0x065 // "e" -#define f__ 0x066 // "f" -#define g__ 0x067 // "g" -#define h__ 0x068 // "h" -#define i__ 0x069 // "i" -#define j__ 0x06a // "j" -#define k__ 0x06b // "k" -#define l__ 0x06c // "l" -#define m__ 0x06d // "m" -#define n__ 0x06e // "n" -#define o__ 0x06f // "o" -#define p__ 0x070 // "p" -#define q__ 0x071 // "q" -#define r__ 0x072 // "r" -#define s__ 0x073 // "s" -#define t__ 0x074 // "t" -#define u__ 0x075 // "u" -#define v__ 0x076 // "v" -#define w__ 0x077 // "w" -#define x__ 0x078 // "x" -#define y__ 0x079 // "y" -#define z__ 0x07a // "z" - - -// 数字-------------------------------------------- -#define n0_ 0x030 // "0" -#define n1_ 0x031 // "1" -#define n2_ 0x032 // "2" -#define n3_ 0x033 // "3" -#define n4_ 0x034 // "4" -#define n5_ 0x035 // "5" -#define n6_ 0x036 // "6" -#define n7_ 0x037 // "7" -#define n8_ 0x038 // "8" -#define n9_ 0x039 // "9" - -// 記号-------------------------------------------- -#define spc_ 0x020 // " " -#define bicri_ 0x021 // "!" -#define cyoncyon_ 0x022 // "”" -#define sharp_ 0x023 // "#" -#define dollar_ 0x024 // "#" -#define percent_ 0x025 // "%" -#define and_ 0x026 // "&" -#define cyon_ 0x027 // "’" -#define kakko_ 0x028 // "(" -#define kakkot_ 0x029 // ")" -#define kome_ 0x02a // "*" -#define tasu_ 0x02b // "+" -#define comma_ 0x02c // "," -#define hiku_ 0x02d // "−" -#define period_ 0x02e // "." -#define sura_ 0x02f // "/" - -#define colon_ 0x03a // ":" -#define semicolon_ 0x03b // ";" -#define dainari_ 0x03c // "<" -#define equal_ 0x03d // "=" -#define syounari_ 0x03e // ">" -#define hate_ 0x03f // "?" - -#define atomark_ 0x040 // "@" -#define dkakko_ 0x05b // "[" -#define bsura_ 0x05c // "/" -#define dkakkot_ 0x05d // "]" -#define yama_ 0x05e // "^" -#define uscore_ 0x05f // "_" - -#define bcyon_ 0x060 // "‘" -#define ckakko_ 0x07b // "{" -#define mataha_ 0x07c // "|" -#define ckakkot_ 0x07d // "}" -#define kara_ 0x07e // "〜" - -#define kten_ 0x0a1 // "。" -#define k_kakko_ 0x0a2 // "「" -#define k_kakkot_ 0x0a3 // "」" -#define tten_ 0x0a4 // "、" -#define nakat_ 0x0a5 // "・" -#define bou_ 0x0b0 // "ー" - -#define yazi_ 0x08c // "▼" -*/ - -#endif /* __MY_FONT_H_ */ diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/unicode.c b/build/systemMenu_RED/MachineSettings/ARM9/src/old/unicode.c deleted file mode 100644 index 8e6f2884..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/unicode.c +++ /dev/null @@ -1,567 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: unicode.c - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#include -#include -#include "unicode.h" -#include "font.h" - -// define data------------------------------------------ -#define TBL8140_ELEM_NUM 0xbd // 8140tblの要素数 -#define TBL849f_ELEM_NUM 0x20 // 849ftblの要素数 - -typedef struct SjisUtf16Pare { - u16 sjis; - u16 unicode; -}SjisUtf16Pare; - -// extern data------------------------------------------ - -// function's prototype declaration--------------------- -static u16 SearchUnicodeTable(u16 unicode, SjisUtf16Pare *tblp, int elem_num); - -// global variable ------------------------------------- - -// static variable ------------------------------------- - -// const data ----------------------------------------- -static const SjisUtf16Pare tblSJIS_UTF16_8140[ TBL8140_ELEM_NUM ]; -static const SjisUtf16Pare tblSJIS_UTF16_849f[ TBL849f_ELEM_NUM ]; - - -//====================================================== -// SJIS-BEからUTF16-LEへの変換 -//====================================================== -void ExSJIS_BEtoUTF16_LE(u8 *sjisp, u16 *unip, u16 length) -{ - u16 code; - - while( (*sjisp) && (length-- > 0) ) { - if( ((*sjisp >= SJIS_HIGHER_CODE1_MIN) && (*sjisp <= SJIS_HIGHER_CODE1_MAX)) - ||((*sjisp >= SJIS_HIGHER_CODE2_MIN) && (*sjisp <= SJIS_HIGHER_CODE2_MAX)) ) { // SJISか? - code = (u16)( (u16)*sjisp++ << 8 ); - code |= (u16)*sjisp++; - }else { // ASCII - code = (u16)*sjisp++; - } - - if(code == 0x005c) - { - *unip = 0x00a5; // \ - - }else if(code == 0x007e) - { - *unip = 0x203e; // ~ - - }else if( (code == 0x000d) || (code == 0x000a) ) { - *unip = code; // 改行コード - - }else if( (code >= 0x0020) && (code < 0x007e) ) // ' ' 〜 } - { - *unip = code; - - }else if( (code >= 0x00a1) && (code <= 0x00df) ) // 。 〜 ゚ - { - *unip = (u16)( (code - 0x00a1) + 0xff61 ); - - }else if( (code >= 0x8140) && (code <= 0x81fc) ) // ' ' 〜 ○ - { - // バラバラなので、テーブル引き - *unip = tblSJIS_UTF16_8140[ code - 0x8140 ].unicode; - - }else if( (code >= 0x824f) && (code <= 0x8258) ) // 0 〜 9 - { - *unip = (u16)( (code - 0x824f) + 0xff10 ); - - }else if( (code >= 0x8260) && (code <= 0x8279) ) // A 〜 Z - { - *unip = (u16)( (code - 0x8260) + 0xff21 ); - - }else if( (code >= 0x8281) && (code <= 0x829a) ) // a 〜 z - { - *unip = (u16)( (code - 0x8281) + 0xff41 ); - - }else if( (code >= 0x829f) && (code <= 0x82f1) ) // ぁ 〜 ん - { - *unip = (u16)( (code - 0x829f) + 0x3041 ); - - }else if( (code >= 0x8340) && (code <= 0x8396) ) // ァ 〜 ヶ ※0x837fは抜け - { - *unip = (u16)( (code - 0x8340) + 0x30a1 ); - if( code == 0x837f ) { - *unip = 0x3000; - }else if( code > 0x837f ) { - (*unip)--; - } - - }else if( (code >= 0x839f) && (code <= 0x83b6) ) // Α 〜 Ω - { - *unip = (u16)( (code - 0x839f) + 0x0391 ); - if(code >= 0x83b0) (*unip)++; - - }else if( (code >= 0x83bf) && (code <= 0x83d6) ) // α 〜 ω - { - *unip = (u16)( (code - 0x83bf) + 0x03b1 ); - if (code >= 0x83d0) (*unip)++; - - }else if( (code >= 0x8440) && (code <= 0x8460) ) // А 〜 Я - { - *unip = (u16)( (code - 0x8440) + 0x0410 ); - if( code == 0x8446 ) { - *unip = 0x0401; - }else if( code > 0x8446 ){ - (*unip)--; - } - - }else if( (code >= 0x8470) && (code <= 0x8491) ) // а 〜 я ※0x847fは抜け - { - *unip = (u16)( (code - 0x8470) + 0x0430 ); - if( code == 0x8476 ) { - *unip = 0x0451; - }else if( code == 0x847f ) { - *unip = 0x3000; - }else if( code > 0x8476 ){ - (*unip)--; - if( code > 0x847f ){ - (*unip)--; - } - } - - }else if( (code >= 0x849f) && (code <= 0x84be) ) // ─ 〜 ╂ - { - // バラバラなので、テーブル引き - *unip = tblSJIS_UTF16_849f[ code - 0x849f ].unicode; - }else { - *unip = 0x3000; - } - - unip++; - } -} - - -//====================================================== -// UTF16-LEからSJIS-BEへの変換 -//====================================================== -void ExUTF16_LEtoSJIS_BE(u8 *sjisp, u16 *unip, u16 length) -{ - u16 code, sjis_le; - - while( (*unip) && (length-- > 0) ) { - code = *unip++; - sjis_le = 0; - - if(code == 0x00a5) - { - sjis_le = 0x005c; // \ - - }else if(code == 0x005c) - { - sjis_le = 0x815f; // \ - - }else if(code == 0x203e) - { - sjis_le = 0x007e; // ~ - - }else if( (code == 0x000d) || (code == 0x000a) ) { - sjis_le = code; // 改行コード - - }else if( (code >= 0x0020) && (code < 0x007e) ) // ' ' 〜 } - { - sjis_le = code; - - }else if( (code >= 0x00a2) && (code <= 0x00f7) ) - { // Unicode = 0x00a2 - 0x00f7 は、 SJIS = 0x814c - 0x81f7に配置 - sjis_le = SearchUnicodeTable(code, (SjisUtf16Pare *)&tblSJIS_UTF16_8140[0xc], 0x81f7 - 0x814c); - - }else if( (code >= 0xff61) && (code <= 0xff9f) ) // 。 〜 ゚ - { - sjis_le = (u16)( (code - 0xff61) + 0x00a1 ); - - }else if(code == 0x4edd) { - sjis_le = 0x8157; - - }else if( (code >= 0xff01) && (code <= 0xffe5) ) - { - if( (code >= 0xff10) && (code <= 0xff19) ) // 0 〜 9 - { - sjis_le = (u16)( (code - 0xff10) + 0x824f ); - - }else if( (code >= 0xff21) && (code <= 0xff3a) ) // A 〜 Z - { - sjis_le = (u16)( (code - 0xff21) + 0x8260 ); - - }else if( (code >= 0xff41) && (code <= 0xff5a) ) // a 〜 z - { - sjis_le = (u16)( (code - 0xff41) + 0x8281 ); - }else { // Unicode = 0xff01 - 0xffe5 は、 SJIS = 0x8143 - 0x8197に配置 - sjis_le = SearchUnicodeTable(code, (SjisUtf16Pare *)&tblSJIS_UTF16_8140[3], 0x8197 - 0x8143); - } - - }else if( (code >= 0x3000) && (code <= 0x30fe) ) - { - if( (code >= 0x3041) && (code <= 0x3093) ) // ぁ 〜 ん - { - sjis_le = (u16)( (code - 0x3041) + 0x829f ); - - }else if( (code >= 0x30a1) && (code <= 0x30f6) ) // ァ 〜 ヶ ※0x837fは抜け - { - sjis_le = (u16)( (code - 0x30a1) + 0x8340 ); - if( code >= 0x30e0 ) { - (sjis_le)++; - } - }else { // Unicode = 0x3000 - 0x30fe は、 SJIS = 0x8140 - 0x81acに配置 - sjis_le = SearchUnicodeTable(code, (SjisUtf16Pare *)&tblSJIS_UTF16_8140[0], 0x81ac - 0x8140); - } - - }else if( (code >= 0x0391) && (code <= 0x03a9) ) // Α 〜 Ω - { - sjis_le = (u16)( (code - 0x0391) + 0x839f ); - if(code >= 0x03a3) (sjis_le)--; - - }else if( (code >= 0x03b1) && (code <= 0x03c9) ) // α 〜 ω - { - sjis_le = (u16)( (code - 0x03b1) + 0x83bf ); - if (code >= 0x03c3) (sjis_le)--; - - }else if( code == 0x0401 ) - { - sjis_le = 0x8446; - - }else if( (code >= 0x0410) && (code <= 0x042f) ) // А 〜 Я - { - sjis_le = (u16)( (code - 0x0410) + 0x8440 ); - if( code >= 0x0416 ){ - (sjis_le)++; - } - - }else if( (code >= 0x0430) && (code <= 0x044f) ) // а 〜 я ※0x847fは抜け - { - sjis_le = (u16)( (code - 0x0430) + 0x8470 ); - if( code >= 0x0436 ){ - (sjis_le)++; - if( code >= 0x043e ){ - (sjis_le)++; - } - } - - }else if( code == 0x0451 ) - { - sjis_le = 0x8476; - - }else if( (code >= 0x2500) && (code <= 0x254b) ) // ─ 〜 ╂ - { - sjis_le = SearchUnicodeTable(code, (SjisUtf16Pare *)&tblSJIS_UTF16_849f, TBL849f_ELEM_NUM); - - }else if( ( (code >= 0x2010) && (code <= 0x2312) ) || ( (code >= 0x25a0) && (code <= 0x266f) ) ) - { // 上記コードは、 SJIS = 0x815c - 0x81fcに配置 - sjis_le = SearchUnicodeTable(code, (SjisUtf16Pare *)&tblSJIS_UTF16_8140[0x815c - 0x8140], 0x81fc - 0x815c); - - }else - { - sjis_le = 0x8140; - } - - // 変換したSJISコードをバッファに格納 - if( sjis_le & 0xff00) { // ASCIIコードでなければ、ビッグエンディアン形式で格納。 - *sjisp++ = (u8)(sjis_le >> 8); - } - *sjisp++ = (u8)(sjis_le); - } -} - - -// Unicode -> SJISへのテーブル引き -static u16 SearchUnicodeTable(u16 unicode, SjisUtf16Pare *tblp, int elem_num) -{ - elem_num++; - while(elem_num--) { - if(tblp->unicode == unicode) { - return tblp->sjis; - } - tblp++; - } - return 0x8140; -} - - -//====================================================== -// SJIS-BE <-> UTF16-LE変換のチェック -//====================================================== -void CheckSJIS_BEtoUTF16_LE(void) -{ - u16 sjis, sjis_be, rev_sjis, sjis_le; - u16 unicode; - - // ASCIIコードのチェック - for ( sjis = 0; sjis < 0x00ff; sjis++ ) { - unicode = 0; - rev_sjis = 0; - ExSJIS_BEtoUTF16_LE( (u8 *)&sjis, &unicode, 1); - ExUTF16_LEtoSJIS_BE( (u8 *)&rev_sjis, &unicode, 1); - sjis_le = (u16)( (rev_sjis >> 8) | (rev_sjis << 8) ); - OS_Printf("0x%x\t-> 0x%x\t-> 0x%x\n", sjis, unicode, sjis_le); - } - - // SJISコードのチェック - for ( sjis = 0x8140; sjis < 0x84ff; sjis++ ) { - unicode = 0; - rev_sjis = 0; - sjis_be = (u16)( (sjis >> 8) | (sjis << 8) ); - ExSJIS_BEtoUTF16_LE( (u8 *)&sjis_be, &unicode, 1); - ExUTF16_LEtoSJIS_BE( (u8 *)&rev_sjis, &unicode, 1); - sjis_le = (u16)( (rev_sjis >> 8) | (rev_sjis << 8) ); - OS_Printf("0x%x\t-> 0x%x\t-> 0x%x\n", sjis, unicode, sjis_le); - } -} - - -//====================================================== -// SJISコード->Unicodeテーブル -//====================================================== - -// 0x8140〜 -static const SjisUtf16Pare tblSJIS_UTF16_8140[ TBL8140_ELEM_NUM ] = { - { 0x8140, 0x3000 }, //   - { 0x8141, 0x3001 }, // 、 - { 0x8142, 0x3002 }, // 。 - { 0x8143, 0xFF0C }, // , - { 0x8144, 0xFF0E }, // . - { 0x8145, 0x30FB }, // ・ - { 0x8146, 0xFF1A }, // : - { 0x8147, 0xFF1B }, // ; - { 0x8148, 0xFF1F }, // ? - { 0x8149, 0xFF01 }, // ! - { 0x814A, 0x309B }, // ゛ - { 0x814B, 0x309C }, // ゜ - { 0x814C, 0x00B4 }, // ´ - { 0x814D, 0xFF40 }, // ` - { 0x814E, 0x00A8 }, // ¨ - { 0x814F, 0xFF3E }, // ^ - { 0x8150, 0xFFE3 }, //  ̄ - { 0x8151, 0xFF3F }, // _ - { 0x8152, 0x30FD }, // ヽ - { 0x8153, 0x30FE }, // ヾ - { 0x8154, 0x309D }, // ゝ - { 0x8155, 0x309E }, // ゞ - { 0x8156, 0x3003 }, // 〃 - { 0x8157, 0x4EDD }, // 仝 - { 0x8158, 0x3005 }, // 々 - { 0x8159, 0x3006 }, // 〆 - { 0x815A, 0x3007 }, // 〇 - { 0x815B, 0x30FC }, // ー - { 0x815C, 0x2015 }, // ― - { 0x815D, 0x2010 }, // ‐ - { 0x815E, 0xFF0F }, // / - { 0x815F, 0x005C }, // \ - { 0x8160, 0x301C }, // 〜 - { 0x8161, 0x2016 }, // ‖ - { 0x8162, 0xFF5C }, // | - { 0x8163, 0x2026 }, // … - { 0x8164, 0x2025 }, // ‥ - { 0x8165, 0x2018 }, // ‘ - { 0x8166, 0x2019 }, // ’ - { 0x8167, 0x201C }, // “ - { 0x8168, 0x201D }, // ” - { 0x8169, 0xFF08 }, // ( - { 0x816A, 0xFF09 }, // ) - { 0x816B, 0x3014 }, // 〔 - { 0x816C, 0x3015 }, // 〕 - { 0x816D, 0xFF3B }, // [ - { 0x816E, 0xFF3D }, // ] - { 0x816F, 0xFF5B }, // { - { 0x8170, 0xFF5D }, // } - { 0x8171, 0x3008 }, // 〈 - { 0x8172, 0x3009 }, // 〉 - { 0x8173, 0x300A }, // 《 - { 0x8174, 0x300B }, // 》 - { 0x8175, 0x300C }, // 「 - { 0x8176, 0x300D }, // 」 - { 0x8177, 0x300E }, // 『 - { 0x8178, 0x300F }, // 』 - { 0x8179, 0x3010 }, // 【 - { 0x817A, 0x3011 }, // 】 - { 0x817B, 0xFF0B }, // + - { 0x817C, 0x2212 }, // − - { 0x817D, 0x00B1 }, // ± - { 0x817E, 0x00D7 }, // × - { 0x817F, 0x3000 }, // - { 0x8180, 0x00F7 }, // ÷ - { 0x8181, 0xFF1D }, // = - { 0x8182, 0x2260 }, // ≠ - { 0x8183, 0xFF1C }, // < - { 0x8184, 0xFF1E }, // > - { 0x8185, 0x2266 }, // ≦ - { 0x8186, 0x2267 }, // ≧ - { 0x8187, 0x221E }, // ∞ - { 0x8188, 0x2234 }, // ∴ - { 0x8189, 0x2642 }, // ♂ - { 0x818A, 0x2640 }, // ♀ - { 0x818B, 0x00B0 }, // ° - { 0x818C, 0x2032 }, // ′ - { 0x818D, 0x2033 }, // ″ - { 0x818E, 0x2103 }, // ℃ - { 0x818F, 0xFFE5 }, // ¥ - { 0x8190, 0xFF04 }, // $ - { 0x8191, 0x00A2 }, // ¢ - { 0x8192, 0x00A3 }, // £ - { 0x8193, 0xFF05 }, // % - { 0x8194, 0xFF03 }, // # - { 0x8195, 0xFF06 }, // & - { 0x8196, 0xFF0A }, // * - { 0x8197, 0xFF20 }, // @ - { 0x8198, 0x00A7 }, // § - { 0x8199, 0x2606 }, // ☆ - { 0x819A, 0x2605 }, // ★ - { 0x819B, 0x25CB }, // ○ - { 0x819C, 0x25CF }, // ● - { 0x819D, 0x25CE }, // ◎ - { 0x819E, 0x25C7 }, // ◇ - { 0x819F, 0x25C6 }, // ◆ - { 0x81A0, 0x25A1 }, // □ - { 0x81A1, 0x25A0 }, // ■ - { 0x81A2, 0x25B3 }, // △ - { 0x81A3, 0x25B2 }, // ▲ - { 0x81A4, 0x25BD }, // ▽ - { 0x81A5, 0x25BC }, // ▼ - { 0x81A6, 0x203B }, // ※ - { 0x81A7, 0x3012 }, // 〒 - { 0x81A8, 0x2192 }, // → - { 0x81A9, 0x2190 }, // ← - { 0x81AA, 0x2191 }, // ↑ - { 0x81AB, 0x2193 }, // ↓ - { 0x81AC, 0x3013 }, // 〓 - { 0x81AD, 0x3000 }, // - { 0x81AE, 0x3000 }, // - { 0x81AF, 0x3000 }, // - { 0x81B0, 0x3000 }, // - { 0x81B1, 0x3000 }, // - { 0x81B2, 0x3000 }, // - { 0x81B3, 0x3000 }, // - { 0x81B4, 0x3000 }, // - { 0x81B5, 0x3000 }, // - { 0x81B6, 0x3000 }, // - { 0x81B7, 0x3000 }, // - { 0x81B8, 0x2208 }, // ∈ - { 0x81B9, 0x220B }, // ∋ - { 0x81BA, 0x2286 }, // ⊆ - { 0x81BB, 0x2287 }, // ⊇ - { 0x81BC, 0x2282 }, // ⊂ - { 0x81BD, 0x2283 }, // ⊃ - { 0x81BE, 0x222A }, // ∪ - { 0x81BF, 0x2229 }, // ∩ - { 0x81C0, 0x3000 }, // - { 0x81C1, 0x3000 }, // - { 0x81C2, 0x3000 }, // - { 0x81C3, 0x3000 }, // - { 0x81C4, 0x3000 }, // - { 0x81C5, 0x3000 }, // - { 0x81C6, 0x3000 }, // - { 0x81C7, 0x3000 }, // - { 0x81C8, 0x2227 }, // ∧ - { 0x81C9, 0x2228 }, // ∨ - { 0x81CA, 0x00AC }, // ¬ - { 0x81CB, 0x21D2 }, // ⇒ - { 0x81CC, 0x21D4 }, // ⇔ - { 0x81CD, 0x2200 }, // ∀ - { 0x81CE, 0x2203 }, // ∃ - { 0x81CF, 0x3000 }, // - { 0x81D0, 0x3000 }, // - { 0x81D1, 0x3000 }, // - { 0x81D2, 0x3000 }, // - { 0x81D3, 0x3000 }, // - { 0x81D4, 0x3000 }, // - { 0x81D5, 0x3000 }, // - { 0x81D6, 0x3000 }, // - { 0x81D7, 0x3000 }, // - { 0x81D8, 0x3000 }, // - { 0x81D9, 0x3000 }, // - { 0x81DA, 0x2220 }, // ∠ - { 0x81DB, 0x22A5 }, // ⊥ - { 0x81DC, 0x2312 }, // ⌒ - { 0x81DD, 0x2202 }, // ∂ - { 0x81DE, 0x2207 }, // ∇ - { 0x81DF, 0x2261 }, // ≡ - { 0x81E0, 0x2252 }, // ≒ - { 0x81E1, 0x226A }, // ≪ - { 0x81E2, 0x226B }, // ≫ - { 0x81E3, 0x221A }, // √ - { 0x81E4, 0x223D }, // ∽ - { 0x81E5, 0x221D }, // ∝ - { 0x81E6, 0x2235 }, // ∵ - { 0x81E7, 0x222B }, // ∫ - { 0x81E8, 0x222C }, // ∬ - { 0x81E9, 0x3000 }, // - { 0x81EA, 0x3000 }, // - { 0x81EB, 0x3000 }, // - { 0x81EC, 0x3000 }, // - { 0x81EE, 0x3000 }, // - { 0x81EE, 0x3000 }, // - { 0x81EF, 0x3000 }, // - { 0x81F0, 0x212B }, // Å - { 0x81F1, 0x2030 }, // ‰ - { 0x81F2, 0x266F }, // ♯ - { 0x81F3, 0x266D }, // ♭ - { 0x81F4, 0x266A }, // ♪ - { 0x81F5, 0x2020 }, // † - { 0x81F6, 0x2021 }, // ‡ - { 0x81F7, 0x00B6 }, // ¶ - { 0x81F8, 0x3000 }, // - { 0x81F9, 0x3000 }, // - { 0x81FA, 0x3000 }, // - { 0x81FB, 0x3000 }, // - { 0x81FC, 0x25EF }, // ◯ -}; - - -// 0x849f〜 -// Unicodeでは、0x2500-0x254bの間 -static const SjisUtf16Pare tblSJIS_UTF16_849f[ TBL849f_ELEM_NUM ] = { - { 0x849F, 0x2500 }, // ─ - { 0x84A0, 0x2502 }, // │ - { 0x84A1, 0x250C }, // ┌ - { 0x84A2, 0x2510 }, // ┐ - { 0x84A3, 0x2518 }, // ┘ - { 0x84A4, 0x2514 }, // └ - { 0x84A5, 0x251C }, // ├ - { 0x84A6, 0x252C }, // ┬ - { 0x84A7, 0x2524 }, // ┤ - { 0x84A8, 0x2534 }, // ┴ - { 0x84A9, 0x253C }, // ┼ - { 0x84AA, 0x2501 }, // ━ - { 0x84AB, 0x2503 }, // ┃ - { 0x84AC, 0x250F }, // ┏ - { 0x84AD, 0x2513 }, // ┓ - { 0x84AE, 0x251B }, // ┛ - { 0x84AF, 0x2517 }, // ┗ - { 0x84B0, 0x2523 }, // ┣ - { 0x84B1, 0x2533 }, // ┳ - { 0x84B2, 0x252B }, // ┫ - { 0x84B3, 0x253B }, // ┻ - { 0x84B4, 0x254B }, // ╋ - { 0x84B5, 0x2520 }, // ┠ - { 0x84B6, 0x252F }, // ┯ - { 0x84B7, 0x2528 }, // ┨ - { 0x84B8, 0x2537 }, // ┷ - { 0x84B9, 0x253F }, // ┿ - { 0x84BA, 0x251D }, // ┝ - { 0x84BB, 0x2530 }, // ┰ - { 0x84BC, 0x2525 }, // ┥ - { 0x84BD, 0x2538 }, // ┸ - { 0x84BE, 0x2542 }, // ╂ -}; - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/old/unicode.h b/build/systemMenu_RED/MachineSettings/ARM9/src/old/unicode.h deleted file mode 100644 index b5592556..00000000 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/old/unicode.h +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: TwlIPL - File: unicode.h - - Copyright 2007 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Date:: $ - $Rev$ - $Author$ - *---------------------------------------------------------------------------*/ - -#ifndef __UNICODE_H_ -#define __UNICODE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// define data---------------------------------- - -// function's prototype declaration------------- -void ExSJIS_BEtoUTF16_LE(u8 *sjisp, u16 *unip, u16 length); -void ExUTF16_LEtoSJIS_BE(u8 *sjisp, u16 *unip, u16 length); -void CheckSJIS_BEtoUTF16_LE(void); - - -#ifdef __cplusplus -} -#endif - -#endif // __UNICODE_H_ - diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/selectLanguage.c b/build/systemMenu_RED/MachineSettings/ARM9/src/selectLanguage.c index bbee9c4b..49b3f64f 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/selectLanguage.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/selectLanguage.c @@ -123,7 +123,7 @@ int SelectLanguageMain( void ) // [CANCEL]ボタン押下チェック if( tpd.disp.touch ) { - tp_cancel = InRangeTp( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); } diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c index 3016c74d..20f9457a 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c @@ -256,7 +256,7 @@ int SEQ_OwnerInfo(void) ReadTP(); // タッチパネル入力の取得 if(tpd.disp.touch) { // [RETURN]ボタン押下チェック - tp_return = InRangeTp(RETURN_BUTTON_LT_X*8, RETURN_BUTTON_LT_Y*8-4, + tp_return = WithinRangeTP(RETURN_BUTTON_LT_X*8, RETURN_BUTTON_LT_Y*8-4, RETURN_BUTTON_RB_X*8, RETURN_BUTTON_RB_Y*8-4, &tpd.disp); } @@ -368,7 +368,7 @@ static int SEQ_InputBirthday(void) x_base = (ownerInfoSel.pos_x + 13) * 8; y_base = (ownerInfoSel.pos_y + OWNER_INFO_CSR_NEXT_Y_NUM * 1) * 8 + 6; // 入力項目移動のチェック - if( InRangeTp( x_base, (y_base - 6), (x_base + 80), (y_base + 6), &tpd.disp) ) { + if( WithinRangeTP( x_base, (y_base - 6), (x_base + 80), (y_base + 6), &tpd.disp) ) { if(tpd.disp.x < x_base + 2 * 8) { new_seq = SEQ_MONTH_SET; }else if((tpd.disp.x >= x_base + 3 * 8) && (tpd.disp.x < x_base + 5 * 8)) { @@ -380,7 +380,7 @@ static int SEQ_InputBirthday(void) ow->seq = new_seq - 1; }else { // 入力値の増減 - if(InRangeTp( ow->inp.pos_x * 8, (y_base - 30), (ow->inp.pos_x + ow->inp.keta_max) * 8, (y_base + 30), &tpd.disp)) { + if(WithinRangeTP( ow->inp.pos_x * 8, (y_base - 30), (ow->inp.pos_x + ow->inp.keta_max) * 8, (y_base + 30), &tpd.disp)) { ow->inp.y_offset = tpd.disp.y - y_base; abs_y_offset = (ow->inp.y_offset >= 0) ? ow->inp.y_offset : -ow->inp.y_offset; if(abs_y_offset <= 6) { @@ -538,7 +538,7 @@ static int SEQ_InputFavoriteColor(void) x_base = FCOLOR_LT_X * 8; y_base = FCOLOR_LT_Y * 8 + 6; // 入力値の増減 - if(InRangeTp( ow->inp.pos_x * 8, (y_base - 30), (ow->inp.pos_x + ow->inp.keta_max) * 8, (y_base + 30), &tpd.disp)) { + if(WithinRangeTP( ow->inp.pos_x * 8, (y_base - 30), (ow->inp.pos_x + ow->inp.keta_max) * 8, (y_base + 30), &tpd.disp)) { ow->inp.y_offset = tpd.disp.y - y_base; abs_y_offset = (ow->inp.y_offset >= 0) ? ow->inp.y_offset : -ow->inp.y_offset; if(abs_y_offset <= 6) { @@ -864,7 +864,7 @@ static BOOL MoveCharCursorTp(CsrPos *csrp) ow->detach_count = 0; if(tpd.disp.touch) { - if(InRangeTp(CLIST_LT_X*8, CLIST_LT_Y*8-4, CLIST_RB_X*8-1, CLIST_RB_Y*8-4, &tpd.disp)) { + if(WithinRangeTP(CLIST_LT_X*8, CLIST_LT_Y*8-4, CLIST_RB_X*8-1, CLIST_RB_Y*8-4, &tpd.disp)) { // 少しマージンあり。 temp.x = (u16)((tpd.disp.x - CLIST_LT_X * 8) / 8); temp.y = (u16)((tpd.disp.y - (CLIST_LT_Y * 8)) / 16); diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c index 2c8e99b9..3c6ffe32 100644 --- a/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c @@ -26,18 +26,20 @@ // RETURNボタンLCD領域 #define RETURN_BUTTON_TOP_X ( 2 * 8 ) #define RETURN_BUTTON_TOP_Y ( 21 * 8 ) -#define RETURN_BUTTON_BOTTOM_X ( (RETURN_BUTTON_TOP_X + 8) * 8 ) -#define RETURN_BUTTON_BOTTOM_Y ( (RETURN_BUTTON_TOP_Y + 2) * 8 ) +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 6 * 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 * 8 ) // 日付データLCD領域 -#define DATE_TOP_X ( 5 * 8 ) #define DATE_TOP_Y ( 10 * 8 ) - // 時刻データLCD領域 -#define TIME_TOP_X ( (DATE_TOP_X + 14) * 8 ) -#define TIME_TOP_Y ( DATE_TOP_Y * 8 ) +#define YEAR_TOP_X ( 5 * 8 ) +#define MONTH_TOP_X ( YEAR_TOP_X + 5 * 8 ) +#define DAY_TOP_X ( MONTH_TOP_X + 3 * 8 ) - // RTC設定メニュー要素 -#define RTC_MENU_ELEM_NUM 1 + // 時刻データLCD領域 +#define TIME_TOP_Y ( DATE_TOP_Y ) +#define HOUR_TOP_X ( DAY_TOP_X + 5 * 8 ) +#define MINUTE_TOP_X ( HOUR_TOP_X + 3 * 8 ) +#define SECOND_TOP_X ( MINUTE_TOP_X + 3 * 8 ) // 文字入力タッチパネル用カウンタ #define S_UPDOWN_COUNT_MAX 16 @@ -49,9 +51,11 @@ // 日付時刻入力シーケンス用ワーク typedef struct DateTimeParam { int seq; // シーケンス番号 - int *tgtp; // 入力対象の変数へのポインタ + int *pTgt; // 入力対象の変数へのポインタ RTCDate Date; RTCTime Time; + RTCDate Date_old; + RTCTime Time_old; }DateTimeParam; @@ -63,26 +67,36 @@ typedef struct SetRtcWork { InputNumParam inp; // 数値入力インターフェース用ワーク }SetRtcWork; + +typedef struct DateTimeWidth { + int year; + int month; + int day; + int hour; + int minute; + int second; +}DateTimeWidth; + // extern data------------------------------------------ // function's prototype declaration--------------------- RTCWeek CalcWeekFromDate( u32 year, u32 month, u32 day ); -void InputDecimal(int *tgtp, InputNumParam *inpp); +void InputDecimal(int *pTgt, InputNumParam *inpp); static void InputRtcDateTimeInit( int start ); static int InputRtcDateTimeMain( void ); static void TransmitRtcData(DateTimeParam *dtpp, RtcDateTime *rtcp); -static void SelectString( int *tgtp, const u8 **const strpp, InputNumParam *inpp); +static void SelectString( int *pTgt, const u8 **const pStrp, InputNumParam *inpp); static void BcdToHex(int *bcdp); static void HexToBcd(int *hexp); static BOOL CheckLeapYear( u32 year ); +static void DrawDateTime( RTCDate *pDate, RTCTime *pTime, int color ); // global variable ------------------------------------- // static variable ------------------------------------- -SetRtcWork *s_pRTCWork; // RTC設定用ワーク - +static SetRtcWork *s_pWork; // RTC設定用ワーク // const data ----------------------------------------- //====================================================== @@ -97,8 +111,6 @@ void SetRTCInit( void ) NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"DATE & TIME SET" ); - PrintfSJIS( DATE_TOP_X + 3 * 8, DATE_TOP_Y, TXT_COLOR_BLACK, "/ / [ ] : :"); - PutStringUTF16( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L" RETURN " ); if( g_initialSet ) { @@ -109,14 +121,25 @@ void SetRTCInit( void ) } } - s_pRTCWork = NNS_FndAllocFromAllocator( &g_allocator, sizeof(SetRtcWork) ); // RTC設定用ワークの確保 - if( s_pRTCWork == NULL ) { + s_pWork = NNS_FndAllocFromAllocator( &g_allocator, sizeof(SetRtcWork) ); // RTC設定用ワークの確保 + if( s_pWork == NULL ) { OS_Panic( "ARM9- Fail to allocate memory...\n" ); } - SVC_CpuClear( 0x0000, s_pRTCWork, sizeof(SetRtcWork), 16 ); + SVC_CpuClear( 0x0000, s_pWork, sizeof(SetRtcWork), 16 ); SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + RTC_GetDateTime( &s_pWork->dtp.Date, &s_pWork->dtp.Time ); + s_pWork->dtp.Date.year += 2000; + + PrintfSJIS ( YEAR_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%04d", s_pWork->dtp.Date.year ); + PrintfSJIS ( MONTH_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Date.month ); + PrintfSJIS ( DAY_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Date.day ); + PrintfSJIS ( HOUR_TOP_X, TIME_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Time.hour ); + PrintfSJIS ( MINUTE_TOP_X, TIME_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Time.minute ); + + DrawDateTime( &s_pWork->dtp.Date, &s_pWork->dtp.Time, TXT_COLOR_BLACK ); + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 ); GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); GX_DispOn(); @@ -124,6 +147,20 @@ void SetRTCInit( void ) } +// 指定した日付・時刻の表示 +static void DrawDateTime( RTCDate *pDate, RTCTime *pTime, int color ) +{ + PrintfSJIS( YEAR_TOP_X, DATE_TOP_Y, color, "%04d", pDate->year ); + PrintfSJIS( MONTH_TOP_X, DATE_TOP_Y, color, "%02d", pDate->month ); + PrintfSJIS( DAY_TOP_X, DATE_TOP_Y, color, "%02d", pDate->day ); + PrintfSJIS( HOUR_TOP_X, TIME_TOP_Y, color, "%02d", pTime->hour ); + PrintfSJIS( MINUTE_TOP_X, TIME_TOP_Y, color, "%02d", pTime->minute ); + PutStringUTF16( YEAR_TOP_X + 4 * 8, DATE_TOP_Y, color, L"/" ); + PutStringUTF16( MONTH_TOP_X + 2 * 8, DATE_TOP_Y, color, L"/" ); + PutStringUTF16( HOUR_TOP_X + 2 * 8, TIME_TOP_Y, color, L":" ); +} + + // RTC設定シーケンス int SetRTCMain( void ) { @@ -133,11 +170,11 @@ int SetRTCMain( void ) ReadTP(); // TP入力の取得 if(tpd.disp.touch) { - tp_set = InRangeTp( DATE_TOP_X, DATE_TOP_Y, // [RTC設定]領域押下チェック - ( TIME_TOP_X + 8 * 8 ), (TIME_TOP_Y + 2 * 8 ), &tpd.disp ); - // [RETURN]ボタン押下チェック - tp_return = InRangeTp( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, - RETURN_BUTTON_BOTTOM_X, RETURN_BUTTON_BOTTOM_Y, &tpd.disp ); + tp_set = WithinRangeTP( YEAR_TOP_X, DATE_TOP_Y, // [RTC設定]領域押下チェック + SECOND_TOP_X, DATE_TOP_Y + 16, &tpd.disp ); + // [RETURN]ボタン押下チェック + tp_return = WithinRangeTP( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, + RETURN_BUTTON_BOTTOM_X, RETURN_BUTTON_BOTTOM_Y, &tpd.disp ); } if( g_initialSet && !GetNCDWork()->option.input_rtc ) { tp_set = TRUE; @@ -145,30 +182,16 @@ int SetRTCMain( void ) //-------------------------------------- // キー入力処理 //-------------------------------------- - if( pad.trg & PAD_KEY_DOWN ) { // カーソルの移動 - if( ++s_pRTCWork->csr == RTC_MENU_ELEM_NUM) { - s_pRTCWork->csr = 0; - } - } - if( pad.trg & PAD_KEY_UP ) { - if( --s_pRTCWork->csr < 0 ) { - s_pRTCWork->csr = RTC_MENU_ELEM_NUM - 1; - } - } - if( ( pad.trg & PAD_BUTTON_A ) || tp_set ) { // RTC設定開始 - if( s_pRTCWork->csr == 0 ) { - InputRtcDateTimeInit( 1 ); - g_pNowProcess = InputRtcDateTimeMain; - } + InputRtcDateTimeInit( 1 ); + g_pNowProcess = InputRtcDateTimeMain; }else if( ( pad.trg & PAD_BUTTON_B ) || tp_return ) { // メニューに戻る - NNS_FndFreeToAllocator( &g_allocator, s_pRTCWork ); // RTC設定用ワークの解放 - s_pRTCWork = NULL; + NNS_FndFreeToAllocator( &g_allocator, s_pWork ); // RTC設定用ワークの解放 + s_pWork = NULL; MachineSettingInit(); } - #ifdef __SYSM_DEBUG - if( pad.trg & PAD_BUTTON_START ) { + else if( pad.trg & PAD_BUTTON_START ) { ClearRTC(); OS_Printf( "RTC offset in NVRAM is ZERO clear!\n" ); } @@ -186,10 +209,10 @@ int SetRTCMain( void ) static void InputRtcDateTimeInit( int start ) { NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE, - RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, 28 * 8, 2 * 8 ); + RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, 256 - RETURN_BUTTON_TOP_X, 2 * 8 ); if( start ) { DrawOKCancelButton(); - s_pRTCWork->dtp.seq = 0; + s_pWork->dtp.seq = 0; }else { PutStringUTF16( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"RETURN" ); } @@ -202,7 +225,7 @@ static int InputRtcDateTimeMain( void ) { BOOL tp_ok = FALSE; BOOL tp_cancel = FALSE; - int new_seq, x_base, y_base, abs_y_offset; + int new_seq, y_base, abs_y_offset; enum { // 日付時刻入力シーケンス番号 SEQ_INIT=0, @@ -211,128 +234,114 @@ static int InputRtcDateTimeMain( void ) SEQ_DAY_INIT, SEQ_DAY_SET, SEQ_HOUR_INIT, SEQ_HOUR_SET, SEQ_MINUTE_INIT, SEQ_MINUTE_SET, - SEQ_SECOND_INIT, SEQ_SECOND_SET, SEQ_END, - SEQ_RETURN=64 + SEQ_CANCEL=64 }; ReadTP(); // タッチパネル入力の取得 CheckOKCancelButton( &tp_ok, &tp_cancel ); // [OK],[CANCEL]ボタン押下チェック - s_pRTCWork->inp.y_offset = 0; + s_pWork->inp.y_offset = 0; if( tpd.disp.touch ) { // [CANCEL]ボタン押下チェック - if( ( s_pRTCWork->dtp.seq & 0x01 ) && ( s_pRTCWork->dtp.seq < SEQ_END ) ) { // SEQ_**_SETの時のみ有効 - new_seq = s_pRTCWork->dtp.seq; - x_base = DATE_TOP_X; + if( ( s_pWork->dtp.seq & 0x01 ) && ( s_pWork->dtp.seq < SEQ_END ) ) { // SEQ_**_SETの時のみ有効 + new_seq = s_pWork->dtp.seq; y_base = DATE_TOP_Y + 6; + // 入力項目移動のチェック - if( InRangeTp( x_base, (y_base - 6), (x_base + 22 * 8), (y_base + 6), &tpd.disp ) ) { - if( tpd.disp.x < x_base + 28 ) { + if( WithinRangeTP( YEAR_TOP_X, DATE_TOP_Y, SECOND_TOP_X, DATE_TOP_Y + 12, &tpd.disp ) ) { + if( tpd.disp.x < YEAR_TOP_X + 32 ) { new_seq = SEQ_YEAR_SET; - }else if( ( tpd.disp.x >= x_base + 4 * 8 ) && ( tpd.disp.x < x_base + 6 * 8 ) ) { + }else if( ( tpd.disp.x >= MONTH_TOP_X ) && ( tpd.disp.x < MONTH_TOP_X + 16 ) ) { new_seq = SEQ_MONTH_SET; - }else if( ( tpd.disp.x >= x_base + 7 * 8 ) && ( tpd.disp.x < x_base + 9 * 8 ) ) { + }else if( ( tpd.disp.x >= DAY_TOP_X ) && ( tpd.disp.x < DAY_TOP_X + 16 ) ) { new_seq = SEQ_DAY_SET; - }else if( ( tpd.disp.x >= x_base + 14 * 8 ) && ( tpd.disp.x < x_base + 16 * 8 ) ) { + }else if( ( tpd.disp.x >= HOUR_TOP_X ) && ( tpd.disp.x < HOUR_TOP_X + 16 ) ) { new_seq = SEQ_HOUR_SET; - }else if( ( tpd.disp.x >= x_base + 17 * 8 ) && ( tpd.disp.x < x_base + 19 * 8 ) ) { + }else if( ( tpd.disp.x >= MINUTE_TOP_X ) && ( tpd.disp.x < MINUTE_TOP_X + 16 ) ) { new_seq = SEQ_MINUTE_SET; - }else if( tpd.disp.x >= x_base + 20 * 8 ) { - new_seq = SEQ_SECOND_SET; } } - if( s_pRTCWork->dtp.seq != new_seq ) { - s_pRTCWork->dtp.seq = new_seq - 1; - }else { + if( s_pWork->dtp.seq != new_seq ) { + s_pWork->dtp.seq = new_seq - 1; + }else if( WithinRangeTP( s_pWork->inp.pos_x, y_base - 40, + s_pWork->inp.pos_x + s_pWork->inp.keta_max * 8, y_base + 60, &tpd.disp ) ) { // 入力値の増減 - if( InRangeTp( s_pRTCWork->inp.pos_x, (y_base - 30), - s_pRTCWork->inp.pos_x + s_pRTCWork->inp.keta_max * 8, y_base + 30, &tpd.disp ) ) { - s_pRTCWork->inp.y_offset = tpd.disp.y - y_base; - abs_y_offset = ( s_pRTCWork->inp.y_offset >= 0 ) ? s_pRTCWork->inp.y_offset : -s_pRTCWork->inp.y_offset; - if( abs_y_offset <= 6 ) { - s_pRTCWork->inp.y_offset = 0; - }else if( abs_y_offset <= 14 ){ - s_pRTCWork->inp.y_offset >>= 2; - }else if( abs_y_offset <= 22 ){ - s_pRTCWork->inp.y_offset >>= 1; - } + s_pWork->inp.y_offset = tpd.disp.y - y_base; + abs_y_offset = ( s_pWork->inp.y_offset >= 0 ) ? s_pWork->inp.y_offset : -s_pWork->inp.y_offset; + if( abs_y_offset <= 6 ) { + s_pWork->inp.y_offset = 0; + }else if( abs_y_offset <= 20 ){ + s_pWork->inp.y_offset >>= 2; + }else if( abs_y_offset <= 40 ){ + s_pWork->inp.y_offset >>= 1; } } } } // タッチパネル or キー入力によって、カーソル位置が動いた時に、元の位置のカーソルを消す。 - if( ( s_pRTCWork->dtp.seq > 0 ) && ( ( s_pRTCWork->dtp.seq & 0x01 ) == 0 ) ) { // SEQ_INITの時は実行しない - PrintfSJIS( s_pRTCWork->inp.pos_x, s_pRTCWork->inp.pos_y, TXT_COLOR_BLACK, - "%02d", *s_pRTCWork->dtp.tgtp ); + if( ( s_pWork->dtp.seq > 0 ) && ( ( s_pWork->dtp.seq & 0x01 ) == 0 ) ) { // SEQ_INITの時は実行しない + PrintfSJIS( s_pWork->inp.pos_x, s_pWork->inp.pos_y, TXT_COLOR_BLACK, "%02d", *s_pWork->dtp.pTgt ); } // 各シーケンスの処理 - switch(s_pRTCWork->dtp.seq){ + switch(s_pWork->dtp.seq){ case SEQ_INIT: - s_pRTCWork->dtp.Date = GetSYSMWork()->rtc[0].Date; - s_pRTCWork->dtp.Time = GetSYSMWork()->rtc[0].Time; - s_pRTCWork->dtp.Date.year += 2000; // yearを+2000する。 - s_pRTCWork->dtp.seq = SEQ_YEAR_INIT; + MI_CpuCopy32( &s_pWork->dtp.Date, &s_pWork->dtp.Date_old, sizeof(RTCDate) ); + MI_CpuCopy32( &s_pWork->dtp.Time, &s_pWork->dtp.Time_old, sizeof(RTCTime) ); + + s_pWork->dtp.seq = SEQ_YEAR_INIT; // ※SEQ_INITは直通でSEQ_YEAR_INITへ case SEQ_YEAR_INIT: - s_pRTCWork->inp.pos_x = DATE_TOP_X; - s_pRTCWork->inp.pos_y = DATE_TOP_Y; - s_pRTCWork->inp.keta_max = 4; - s_pRTCWork->inp.value_max = 2099; - s_pRTCWork->inp.value_min = 2000; -// s_pRTCWork->inp.value_min = 2004; -// if(s_pRTCWork->dtp.Date.year < 2004) { -// s_pRTCWork->dtp.Date.year = 2004; + s_pWork->inp.pos_x = YEAR_TOP_X; + s_pWork->inp.pos_y = DATE_TOP_Y; + s_pWork->inp.keta_max = 4; + s_pWork->inp.value_max = 2099; + s_pWork->inp.value_min = 2000; +// s_pWork->inp.value_min = 2004; +// if(s_pWork->dtp.Date.year < 2004) { +// s_pWork->dtp.Date.year = 2004; // } - s_pRTCWork->dtp.tgtp = (int *)&s_pRTCWork->dtp.Date.year; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Date.year; break; case SEQ_MONTH_INIT: - s_pRTCWork->inp.pos_x = DATE_TOP_X + 4 * 8; - s_pRTCWork->inp.keta_max = 2; - s_pRTCWork->inp.value_max = 12; - s_pRTCWork->inp.value_min = 1; - s_pRTCWork->dtp.tgtp = (int *)&s_pRTCWork->dtp.Date.month; + s_pWork->inp.pos_x = MONTH_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = 12; + s_pWork->inp.value_min = 1; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Date.month; break; case SEQ_DAY_INIT: - s_pRTCWork->inp.pos_x = DATE_TOP_X + 7 * 8; - s_pRTCWork->inp.keta_max = 2; - s_pRTCWork->inp.value_max = (int)SYSM_GetDayNum( s_pRTCWork->dtp.Date.year, s_pRTCWork->dtp.Date.month ); + s_pWork->inp.pos_x = DAY_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = (int)SYSM_GetDayNum( s_pWork->dtp.Date.year, s_pWork->dtp.Date.month ); // 年・月をもとにその月の日数を算出する。 - s_pRTCWork->inp.value_min = 1; - if(s_pRTCWork->dtp.Date.day > s_pRTCWork->inp.value_max) { - s_pRTCWork->dtp.Date.day = (u32)s_pRTCWork->inp.value_max; + s_pWork->inp.value_min = 1; + if(s_pWork->dtp.Date.day > s_pWork->inp.value_max) { + s_pWork->dtp.Date.day = (u32)s_pWork->inp.value_max; } - s_pRTCWork->dtp.tgtp = (int *)&s_pRTCWork->dtp.Date.day; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Date.day; break; case SEQ_HOUR_INIT: - s_pRTCWork->inp.pos_x = TIME_TOP_X; - s_pRTCWork->inp.keta_max = 2; - s_pRTCWork->inp.value_max = 23; - s_pRTCWork->inp.value_min = 0; - s_pRTCWork->dtp.tgtp = (int *)&s_pRTCWork->dtp.Time.hour; + s_pWork->inp.pos_x = HOUR_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = 23; + s_pWork->inp.value_min = 0; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Time.hour; break; case SEQ_MINUTE_INIT: - s_pRTCWork->inp.pos_x = TIME_TOP_X + 3 * 8; - s_pRTCWork->inp.keta_max = 2; - s_pRTCWork->inp.value_max = 59; - s_pRTCWork->inp.value_min = 0; - s_pRTCWork->dtp.tgtp = (int *)&s_pRTCWork->dtp.Time.minute; - break; - - case SEQ_SECOND_INIT: - s_pRTCWork->inp.pos_x = TIME_TOP_X + 6 * 8; - s_pRTCWork->inp.keta_max = 2; - s_pRTCWork->inp.value_max = 59; - s_pRTCWork->inp.value_min = 0; - s_pRTCWork->dtp.tgtp = (int *)&s_pRTCWork->dtp.Time.second; + s_pWork->inp.pos_x = MINUTE_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = 59; + s_pWork->inp.value_min = 0; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Time.minute; break; case SEQ_YEAR_SET: @@ -340,36 +349,37 @@ static int InputRtcDateTimeMain( void ) case SEQ_DAY_SET: case SEQ_HOUR_SET: case SEQ_MINUTE_SET: - case SEQ_SECOND_SET: - InputDecimal( s_pRTCWork->dtp.tgtp, &s_pRTCWork->inp ); + InputDecimal( s_pWork->dtp.pTgt, &s_pWork->inp ); - // 年月日入力ならば、曜日を算出して表示。 - if( ( s_pRTCWork->dtp.seq == SEQ_YEAR_SET ) || - ( s_pRTCWork->dtp.seq == SEQ_MONTH_SET ) || - ( s_pRTCWork->dtp.seq == SEQ_DAY_SET ) ) { - s_pRTCWork->dtp.Date.week = CalcWeekFromDate( s_pRTCWork->dtp.Date.year, s_pRTCWork->dtp.Date.month, s_pRTCWork->dtp.Date.day ); - PrintfSJIS( DATE_TOP_X + 10 * 8, DATE_TOP_Y, TXT_COLOR_BLACK, "%s", g_strWeek[ s_pRTCWork->dtp.Date.week ] ); + // 年月日入力ならば、曜日を再計算 + if( ( s_pWork->dtp.seq == SEQ_YEAR_SET ) || + ( s_pWork->dtp.seq == SEQ_MONTH_SET ) || + ( s_pWork->dtp.seq == SEQ_DAY_SET ) ) { + s_pWork->dtp.Date.week = CalcWeekFromDate( s_pWork->dtp.Date.year, s_pWork->dtp.Date.month, s_pWork->dtp.Date.day ); } // 年・月入力ならば、日数を算出して、現在の入力日が日数を超えていたら修正する。 - if( ( s_pRTCWork->dtp.seq == SEQ_YEAR_SET ) || - ( s_pRTCWork->dtp.seq == SEQ_MONTH_SET ) ) { - u32 dayNum = SYSM_GetDayNum( s_pRTCWork->dtp.Date.year, s_pRTCWork->dtp.Date.month ); - if( dayNum < s_pRTCWork->dtp.Date.day ) { - s_pRTCWork->dtp.Date.day = dayNum; - PrintfSJIS( DATE_TOP_X + 7 * 8, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pRTCWork->dtp.Date.day ); + if( ( s_pWork->dtp.seq == SEQ_YEAR_SET ) || + ( s_pWork->dtp.seq == SEQ_MONTH_SET ) ) { + u32 dayNum = SYSM_GetDayNum( s_pWork->dtp.Date.year, s_pWork->dtp.Date.month ); + if( dayNum < s_pWork->dtp.Date.day ) { + PrintfSJIS( DAY_TOP_X, DATE_TOP_Y, TXT_COLOR_WHITE, "%02d", s_pWork->dtp.Date.day ); + PrintfSJIS( DAY_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", dayNum ); + s_pWork->dtp.Date.day = dayNum; } } break; case SEQ_END: - s_pRTCWork->dtp.Date.year -= 2000; // yearを−2000する。 - s_pRTCWork->dtp.Time.second = 0; + s_pWork->dtp.Time.second = 0; + { + RTCDate date; // +-2000を処理するのが面倒なので、別バッファにコピーして処理 + MI_CpuCopy32( &s_pWork->dtp.Date, &date, sizeof(RTCDate) ); + date.year -= 2000; + (void)RTC_SetDateTime( &date, &s_pWork->dtp.Time ); + NCD_SetRtcOffset( SYSM_CalcRtcOffsetAndSetDateTime( &date, &s_pWork->dtp.Time ) ); + } - NCD_SetRtcOffset( SYSM_CalcRtcOffsetAndSetDateTime( &s_pRTCWork->dtp.Date, &s_pRTCWork->dtp.Time ) ); - - GetSYSMWork()->rtc[0].Date = s_pRTCWork->dtp.Date; - GetSYSMWork()->rtc[0].Time = s_pRTCWork->dtp.Time; GetSYSMWork()->ncd_invalid = 0; GetNCDWork()->option.input_rtc = 1; // RTC入力フラグを立てる。 // :::::::::::::::::::::::::::::::::::::::::::::: @@ -377,34 +387,44 @@ static int InputRtcDateTimeMain( void ) // :::::::::::::::::::::::::::::::::::::::::::::: (void)NVRAMm_WriteNitroConfigData( GetNCDWork() ); - // SEQ_ENDの時はこのままリターンする。 + // 上画面の表示更新 + GetAndDrawRTCData( &g_rtcDraw, TRUE ); - case SEQ_RETURN: + g_pNowProcess = SetRTCMain; + InputRtcDateTimeInit( 0 ); // 日付入力画面のクリア + return 0; + + case SEQ_CANCEL: + // 日付・時刻表示を元の値に戻して表示更新 + DrawDateTime( &s_pWork->dtp.Date, &s_pWork->dtp.Time, TXT_COLOR_WHITE ); + DrawDateTime( &s_pWork->dtp.Date_old, &s_pWork->dtp.Time_old, TXT_COLOR_BLACK ); + MI_CpuCopy32( &s_pWork->dtp.Date_old, &s_pWork->dtp.Date, sizeof(RTCDate) ); + MI_CpuCopy32( &s_pWork->dtp.Time_old, &s_pWork->dtp.Time, sizeof(RTCTime) ); g_pNowProcess = SetRTCMain; InputRtcDateTimeInit( 0 ); // 日付入力画面のクリア return 0; } - if( s_pRTCWork->dtp.seq & 0x01 ) { // SEQ_**_SETの時のみ有効 + if( s_pWork->dtp.seq & 0x01 ) { // SEQ_**_SETの時のみ有効 if( ( pad.trg & PAD_BUTTON_A ) || tp_ok ) { - s_pRTCWork->dtp.seq = SEQ_END; // Aボタンで決定 + s_pWork->dtp.seq = SEQ_END; // Aボタンで決定 }else if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { // Bボタンでキャンセル - s_pRTCWork->dtp.seq = SEQ_RETURN; + s_pWork->dtp.seq = SEQ_CANCEL; }else if( pad.trg & PAD_KEY_LEFT ) { - if( s_pRTCWork->dtp.seq == SEQ_YEAR_SET ) { - s_pRTCWork->dtp.seq = SEQ_SECOND_INIT; + if( s_pWork->dtp.seq == SEQ_YEAR_SET ) { + s_pWork->dtp.seq = SEQ_MINUTE_INIT; }else { - s_pRTCWork->dtp.seq -= 3; + s_pWork->dtp.seq -= 3; } }else if( pad.trg & PAD_KEY_RIGHT ) { - if( s_pRTCWork->dtp.seq == SEQ_SECOND_SET ) { - s_pRTCWork->dtp.seq = SEQ_YEAR_INIT; + if( s_pWork->dtp.seq == SEQ_MINUTE_SET ) { + s_pWork->dtp.seq = SEQ_YEAR_INIT; }else { - s_pRTCWork->dtp.seq++; + s_pWork->dtp.seq++; } } }else { // SEQ_**_INITの時のみ有効 - s_pRTCWork->dtp.seq++; + s_pWork->dtp.seq++; } return 0; } @@ -442,51 +462,58 @@ RTCWeek CalcWeekFromDate( u32 year, u32 month, u32 day ) /* // 文字列によるパラメータ選択 -static void SelectString(int *tgtp, const u8 **const srtpp, InputNumParam *inpp) +static void SelectString(int *pTgt, const u8 **const ppStr, InputNumParam *pInp ) { BOOL value_up = FALSE; BOOL value_down = FALSE; + const u8 *pStr_old = *pTgt; - if(inpp->y_offset == 0) { - inpp->up_count = S_UPDOWN_COUNT_MAX; + if( pInp->y_offset == 0 ) { + pInp->up_count = S_UPDOWN_COUNT_MAX; }else { - inpp->up_count ++; - if(inpp->up_count > S_UPDOWN_COUNT_MAX) { - inpp->up_count = 0; - if(inpp->y_offset < 0) value_up = TRUE; - else value_down = TRUE; + pInp->up_count ++; + if( pInp->up_count > S_UPDOWN_COUNT_MAX ) { + pInp->up_count = 0; + if( pInp->y_offset < 0 ) value_up = TRUE; + else value_down = TRUE; } } - if((pad.trg & PAD_KEY_DOWN) || (value_down)) { // 表示文字列切り替え - if(++*tgtp>inpp->value_max) *tgtp = 0; - }else if((pad.trg & PAD_KEY_UP) || (value_up)) { - if(--*tgtp & 0x8000) *tgtp = inpp->value_max; + if( ( pad.trg & PAD_KEY_DOWN ) || value_down ) { // 表示文字列切り替え + if( ++ *pTgt > pInp->value_max ) { + *pTgt = 0; + } + }else if( ( pad.trg & PAD_KEY_UP ) || value_up ) { + if( -- *pTgt & 0x8000 ) { + *pTgt = pInp->value_max; + } } - (void)DrawStringSJIS( inpp->pos_x, inpp->pos_y, HIGHLIGHT_Y, srtpp[*tgtp]); // 現在選択している文字列を表示 + PutStringUTF16( pInp->pos_x, pInp->pos_y, TXT_COLOR_WHITE, pStr_old ); // 旧文字列を消去 + PutStringUTF16( pInp->pos_x, pInp->pos_y, TXT_COLOR_BLACK, ppStr[ *pTgt ] ); // 現在選択している文字列を表示 } */ // 10進数数値入力 -void InputDecimal( int *tgtp, InputNumParam *inpp ) +void InputDecimal( int *pTgt, InputNumParam *pInp ) { BOOL value_up = FALSE; BOOL value_down = FALSE; + int old = *pTgt; - if( inpp->y_offset == 0 ) { - inpp->up_count = D_UP_COUNT_MAX; - inpp->down_count = D_DOWN_COUNT_MAX; - }else if( inpp->y_offset < 0 ) { - inpp->down_count += inpp->y_offset; - if( inpp->down_count < D_DOWN_COUNT_MAX ) { - inpp->down_count = 0; + if( pInp->y_offset == 0 ) { + pInp->up_count = D_UP_COUNT_MAX; + pInp->down_count = D_DOWN_COUNT_MAX; + }else if( pInp->y_offset < 0 ) { + pInp->down_count += pInp->y_offset; + if( pInp->down_count < D_DOWN_COUNT_MAX ) { + pInp->down_count = 0; value_down = TRUE; } }else { // y_offset > 0 - inpp->up_count += inpp->y_offset; - if( inpp->up_count > D_UP_COUNT_MAX ) { - inpp->up_count = 0; + pInp->up_count += pInp->y_offset; + if( pInp->up_count > D_UP_COUNT_MAX ) { + pInp->up_count = 0; value_up = TRUE; } } @@ -495,18 +522,19 @@ void InputDecimal( int *tgtp, InputNumParam *inpp ) if( value_down || ( pad.trg & PAD_KEY_UP ) || ( ( pad.cont & PAD_KEY_UP ) && ( pad.cont & PAD_BUTTON_R ) ) ) { - if( --*tgtp < inpp->value_min ) { - *tgtp = inpp->value_max; + if( --*pTgt < pInp->value_min ) { + *pTgt = pInp->value_max; } }else if( value_up || ( pad.trg & PAD_KEY_DOWN ) || ( ( pad.cont & PAD_KEY_DOWN ) && ( pad.cont & PAD_BUTTON_R ) ) ) { - if( ++*tgtp > inpp->value_max ) { - *tgtp = inpp->value_min; + if( ++*pTgt > pInp->value_max ) { + *pTgt = pInp->value_min; } } - PrintfSJIS( inpp->pos_x, inpp->pos_y, TXT_COLOR_GREEN, "%02d", *tgtp ); + PrintfSJIS( pInp->pos_x, pInp->pos_y, TXT_COLOR_WHITE, "%02d", old ); + PrintfSJIS( pInp->pos_x, pInp->pos_y, TXT_COLOR_GREEN, "%02d", *pTgt ); // 対象値をハイライト表示 } @@ -527,4 +555,3 @@ void ClearRTC( void ) // :::::::::::::::::::::::::::::::::::::::::::::: (void)NVRAMm_WriteNitroConfigData( GetNCDWork() ); } -