#include #include #include #include #include "screen.h" #include "../../../../common/my_defs.h" #include "../../ver.h" Gui gui; u8 scr_evnt; enum{ //PANEL_END, PANEL_ERROR, PANEL_SUCCESS, PANEL_TOPMENU, PANEL_TITLE, PANEL_QUIT, PANEL_READ, PANEL_WRITE, PANEL_YES, PANEL_NO, PANEL_CONFIRM, PANEL_DELCONF, PANEL_MENU, PANEL_BKUP, PANEL_INSEXIT, PANEL_DBGLOG }; enum{ MESSAGE_VERSION, MESSAGE_PRODUCT, MESSAGE_PRODUCT2, MESSAGE_ERROR_TITLE, MESSAGE_ERROR_INFO, MESSAGE_ERROR_INFO2, MESSAGE_ERROR_INFO3, MESSAGE_SUCCESS_TITLE, MESSAGE_SUCCESS_INFO, MESSAGE_SUCCESS_INFO2, MESSAGE_CONFIRM_TITLE, MESSAGE_CONFIRM_MSG, MESSAGE_DELCONF_TITLE, MESSAGE_DELCONF_MSG, MESSAGE_DELCONF_MSG2, MESSAGE_DELCONF_MSG3, //MESSAGE_TOPMENU_HELP_TITLE, MESSAGE_TOPMENU_HELP_READ, MESSAGE_TOPMENU_HELP_WRITE, MESSAGE_TOPMENU_HELP_END, MESSAGE_TOPMENU_HELP_OPERATE, MESSAGE_TITLE, MESSAGE_MENU_READ, MESSAGE_MENU_WRITE, //MESSAGE_MENU_END, MESSAGE_MENU_OPERATE, MESSAGE_MENU_CAUTION, MESSAGE_MENU_ERROR, MESSAGE_MENU_DEBUG, MESSAGE_INSEXT_1, MESSAGE_INSEXT_2, MESSAGE_INSEXT_3, MESSAGE_OPERATE, MESSAGE_RESULT, MESSAGE_QUIT_OPERATE, MESSAGE_CONF, MESSAGE_COUNT, MESSAGE_COUNT2, MESSAGE_STATUS }; enum{ MEMO_DBGLOG }; //画面消去、コンポーネントをディセーブル void ScrClr() { gui.ButtonMask(0); gui.DisableAll(); gui.Draw(); } nn::os::Tick holdTck; u32 holdVal; //---------------------------------イベントコールバック //----------------PADボタン void pushButton(u32 sts) { //NN_LOG("button > %4x\n",button); u32 trg = sts & 0x0ffff; u32 hld = sts >> 16; /* if (holdVal)//同時押し猶予期間 { if (nn::fnd::TimeSpan::FromMilliSeconds(100) > (nn::os::Tick::GetSystemCurrent()-holdTck)){ holdVal |= trg; if (holdVal == nn::hid::BUTTON_LEFT | holdVal & nn::hid::BUTTON_X ){ holdVal = 0; scr_evnt = EVNT_PUSH_LEFT_X; } }else holdVal = 0; }else if( (holdVal = trg & (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X ))>0) {//一定時間どっちかのボタン押し維持 holdTck = nn::os::Tick::GetSystemCurrent(); } */ if( holdVal )//押し続け判定 { if (hld != holdVal) { holdVal = 0; }else if (nn::fnd::TimeSpan::FromMilliSeconds(4000) < (nn::os::Tick::GetSystemCurrent()-holdTck)) { holdVal = 0; scr_evnt = EVNT_PUSH_LEFT_X; } }else if (hld == ( nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X )) { holdVal = hld; holdTck = nn::os::Tick::GetSystemCurrent(); } else if (trg & nn::hid::BUTTON_B)scr_evnt = EVNT_PUSH_B; } //-----------------パネルをタッチ // ---- Top Menu :READ void touchRead(u32 pos NN_IS_UNUSED_VAR) { scr_evnt = EVNT_SEL_READ; } // ---- Top Menu :WRITE void touchWrite(u32 pos NN_IS_UNUSED_VAR) { scr_evnt = EVNT_SEL_WRITE; } //---- Top Menu :END //void touchEnd(u32 pos NN_IS_UNUSED_VAR) //{ // scr_evnt = EVNT_SEL_END; //} //---- YES void touchYes(u32 pos NN_IS_UNUSED_VAR) { scr_evnt = EVNT_YES; } //---- NO void touchNo(u32 pos NN_IS_UNUSED_VAR) { scr_evnt = EVNT_NO; } void touchQuit(u32 pos NN_IS_UNUSED_VAR) { scr_evnt = EVNT_QUIT; } #define NULL_PTR 0 #define NULL_STR 0 #define SCREEN_UPPER 0 #define SCREEN_LOWER 1 #define LOC_CONF_X 60 #define LOC_CONF_Y 20 #define LOC_CONF_W (400 - LOC_CONF_X*2) #define LOC_CONF_H 70 #define LOC_LOG_X 50 #define LOC_LOG_W (400 - LOC_LOG_X*2) #define LOC_LOG_Y (LOC_CONF_Y + LOC_CONF_H + 10) #define LOC_LOG_H (240 - LOC_LOG_Y - 10) #define LOG_MAX 10 // -------------------------------------------------- コンポーネント設計 //下画面 //Top Menu #ifdef USE_WCHAR const tPanel panel_Read = {(uptr)touchRead,L"Export",80+20,30,160,80,PANEL_READ,SCREEN_LOWER}; //const tPanel panel_Write = {(uptr)touchWrite,"Restore",80+20,130,160,80,PANEL_WRITE,SCREEN_LOWER}; //const tPanel panel_End = {(uptr)touchEnd,"End",80,180,160,30,PANEL_END,SCREEN_LOWER}; //Yes No const tPanel panel_Yes = {(uptr)touchYes,L"YES",40+10,60,80,120,PANEL_YES,SCREEN_LOWER}; const tPanel panel_No = {(uptr)touchNo,L"NO",200+30,60,80,120,PANEL_NO,SCREEN_LOWER}; //Quit const tPanel panel_Quit = {(uptr)touchQuit,L"Quit",80+20,60,160,120,PANEL_QUIT,SCREEN_LOWER}; #else const tPanel panel_Read = {(uptr)touchRead,"Export",80+20,30,160,80,PANEL_READ,SCREEN_LOWER}; //Yes No const tPanel panel_Yes = {(uptr)touchYes,"YES",40+10,60,80,120,PANEL_YES,SCREEN_LOWER}; const tPanel panel_No = {(uptr)touchNo,"NO",200+30,60,80,120,PANEL_NO,SCREEN_LOWER}; //Quit const tPanel panel_Quit = {(uptr)touchQuit,"Quit",80+20,60,160,120,PANEL_QUIT,SCREEN_LOWER}; #endif //上画面 //デバグ用 //エラー表示 const tPanel panel_Error = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_ERROR,SCREEN_UPPER}; const tMessage mess_Title_Err = {L"title",10,10,COLOR_RED,8,MESSAGE_ERROR_TITLE,PANEL_ERROR}; const tMessage mess_Info_Err = {L"info",10,22,COLOR_RED,8,MESSAGE_ERROR_INFO,PANEL_ERROR}; const tMessage mess_Info2_Err = {L"info2",10,40,COLOR_RED,8,MESSAGE_ERROR_INFO2,PANEL_ERROR}; const tMessage mess_Info3_Err = {L"info3",10,50,COLOR_RED,8,MESSAGE_ERROR_INFO3,PANEL_ERROR}; //成功 const tPanel panel_Success = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_SUCCESS,SCREEN_UPPER}; const tMessage mess_Title_Suc = {L"title",10,10,COLOR_GREEN,8,MESSAGE_SUCCESS_TITLE,PANEL_SUCCESS}; const tMessage mess_Info_Suc = {L"info",10,40,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO,PANEL_SUCCESS}; const tMessage mess_Info2_Suc = {L"info2",10,50,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO2,PANEL_SUCCESS}; //実行確認 const tPanel panel_Confirm = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_CONFIRM,SCREEN_UPPER}; const tMessage mess_conf_Title = {L"title",10,10,COLOR_YELLO,8,MESSAGE_CONFIRM_TITLE,PANEL_CONFIRM}; const tMessage mess_conf_Msg = {L"Do you execute?",10,40,COLOR_WHITE,8,MESSAGE_CONFIRM_MSG,PANEL_CONFIRM}; //トップメニュー const tPanel panel_topmenu_help = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_TOPMENU,SCREEN_UPPER}; const tMessage mess_topmenu_help_read = {L"[Backup] Card -> SD",10,4,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU}; const tMessage mess_topmenu_help_notread = {L"[Backup] is Invalid",10,4,COLOR_RED,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU}; //const tMessage mess_topmenu_help_write = {"[Restore] bkup -> Card",10,16,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU}; //const tMessage mess_topmenu_help_notwrite = {"[Restore] is Invalid",10,16,COLOR_RED,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU}; //const tMessage mess_topmenu_help_end = {"[End] return to SystemMenu",10,28,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_END,PANEL_TOPMENU}; const tMessage mess_topmenu_help_operate = {L"touch below",10,48,COLOR_GREEN,8,MESSAGE_TOPMENU_HELP_OPERATE,PANEL_TOPMENU}; //ログ表示 const tPanel panel_dbglog = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_DBGLOG,SCREEN_UPPER}; const tMemo memo_dbglog = {LOG_MAX,10,10,COLOR_WHITE,8,MEMO_DBGLOG,PANEL_DBGLOG}; //通常時 //タイトル #define FONT_SIZE_TITLE 12 #define LOC_TITL_X (40-FONT_SIZE_TITLE*2) #define LOC_TITL_Y 20 #define LOC_TITL_W (400 - LOC_CONF_X*2) #define LOC_TITL_H 50 #define FONT_SIZE_PRODUCT 10 const tPanel panel_title = {NULL_PTR,NULL_STR,LOC_TITL_X,LOC_TITL_Y,LOC_TITL_W,LOC_TITL_H,PANEL_TITLE,SCREEN_UPPER}; const tMessage mess_title = {L"title",0,0,COLOR_WHITE,FONT_SIZE_TITLE,MESSAGE_TITLE,PANEL_TITLE}; const tMessage mess_product = {L"product",0,LOC_TITL_H - 22,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT,PANEL_TITLE}; //const tMessage mess_product2 = {"product2",0,LOC_TITL_H - 10,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT2,PANEL_TITLE}; const tMessage mess_version = {L"version",LOC_TITL_W-FONT_SIZE_PRODUCT*6,FONT_SIZE_TITLE+2,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_VERSION,PANEL_TITLE}; #define LOC_MESS_X 20 #define LOC_MESS_W (400 - LOC_MESS_X*2) #define LOC_MESS_Y (LOC_TITL_Y + LOC_TITL_H + 10) #define LOC_MESS_H (240 - LOC_MESS_Y - 10) //TOPメニュー //情報表示はログと排他 #define FONT_SIZE 10 #define STR_LINE(ln) (FONT_SIZE + 2)*ln const tPanel panel_menu = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_MENU,SCREEN_UPPER}; const tMessage mess_menu_read = {L"[Export] Write to SD",10,STR_LINE(1),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_READ,PANEL_MENU}; //const tMessage mess_menu_write = {"[Restore] restore to Card",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_WRITE,PANEL_MENU}; //const tMessage mess_menu_end = {"[End] close this apprication",10,STR_LINE(3),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_END,PANEL_MENU}; const tMessage mess_menu_operate = {L"touch below",10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_MENU_OPERATE,PANEL_MENU}; const tMessage mess_bkuperr = {L"SD error",10,STR_LINE(6),COLOR_RED,FONT_SIZE,MESSAGE_MENU_ERROR,PANEL_MENU}; const tMessage mess_carderr = {L"CARD error",10,STR_LINE(7),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_CAUTION,PANEL_MENU}; //const tMessage mess_debug = {"Crush Mode",10,STR_LINE(3),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_DEBUG,PANEL_MENU}; //Backup //const tPanel panel_bkup = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_BKUP,SCREEN_UPPER}; const tPanel panel_bkup = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_BKUP,SCREEN_UPPER}; const tMessage mess_quit_operate = {L"touch [Quit],or Push B",10,STR_LINE(4),COLOR_SKY,FONT_SIZE,MESSAGE_QUIT_OPERATE,PANEL_BKUP}; const tMessage mess_conf = {L"Do you execute?",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_CONF,PANEL_BKUP}; const tMessage mess_result = {L"result",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_RESULT,PANEL_BKUP}; const tMessage mess_operate = {L"touch below",10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_OPERATE,PANEL_BKUP}; const tMessage mess_status = {L"status",10,STR_LINE(7),COLOR_WHITE,FONT_SIZE,MESSAGE_STATUS,PANEL_BKUP}; const tMessage mess_count = {L"count",10,STR_LINE(8),COLOR_WHITE,FONT_SIZE,MESSAGE_COUNT,PANEL_BKUP}; const tMessage mess_count2 = {L"count2",10,STR_LINE(9),COLOR_GREEN,FONT_SIZE,MESSAGE_COUNT2,PANEL_BKUP}; //挿抜発生時 //const tPanel panel_insexit = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_INSEXIT,SCREEN_UPPER}; const tPanel panel_insexit = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_INSEXIT,SCREEN_UPPER}; const tMessage mess_insexit = {L"device insert or pull out is detected",10,STR_LINE(3),COLOR_RED,8,MESSAGE_INSEXT_1,PANEL_INSEXIT}; const tMessage mess_insexit2 = {L"return to top menu",10,STR_LINE(5),COLOR_WHITE,8,MESSAGE_INSEXT_2,PANEL_INSEXIT}; const tMessage mess_insexit3 = {L"please touch or push B",10,STR_LINE(6),COLOR_WHITE,8,MESSAGE_INSEXT_3,PANEL_INSEXIT}; //削除確認 //const tPanel panel_delconf = {NULL_PTR,NULL_STR,LOC_CONF_X-10,LOC_CONF_Y,LOC_CONF_W+10,LOC_CONF_H*2,PANEL_DELCONF,SCREEN_UPPER}; const tPanel panel_delconf = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y-36,LOC_MESS_W,LOC_MESS_H,PANEL_DELCONF,SCREEN_UPPER}; const tMessage mess_delconf_Title = {L" *** DELETE *** ",10,10,COLOR_YELLO,16,MESSAGE_DELCONF_TITLE,PANEL_DELCONF}; const tMessage mess_delconf_Msg = {L" caution!",10,50,COLOR_YELLO,12,MESSAGE_DELCONF_MSG,PANEL_DELCONF}; const tMessage mess_delconf_Msg2 = {L"this is delete data on SD",10,70,COLOR_YELLO,12,MESSAGE_DELCONF_MSG2,PANEL_DELCONF}; const tMessage mess_delconf_Msg3 = {L"Do you execute?",10,90,COLOR_YELLO,12,MESSAGE_DELCONF_MSG3,PANEL_DELCONF}; nn::os::LightEvent stopEvnt(true); wchar_t scr_ver[16]; wchar_t scr_err[32]; wchar_t scr_debug[32]; //menu bool ScrInitialize(uptr heap,u32 size) { scr_evnt = EVNT_NONE; holdVal = 0; holdTck = nn::fnd::TimeSpan(0); if (gui.Initialize(heap,size,&stopEvnt)==false)return false; gui.ButtonCallback((uptr)pushButton); //コンポーネント登録 gui.PanelSet(&panel_Read); // gui.PanelSet(&panel_Write); // gui.PanelSet(&panel_End); gui.PanelSet(&panel_Yes); gui.PanelSet(&panel_No); gui.PanelSet(&panel_Quit); gui.PanelSet(&panel_Error); gui.PanelSet(&panel_Success); gui.PanelSet(&panel_Confirm); gui.PanelSet(&panel_delconf); gui.PanelSet(&panel_topmenu_help); gui.PanelSet(&panel_title); gui.PanelSet(&panel_menu); gui.PanelSet(&panel_bkup); gui.PanelSet(&panel_dbglog); gui.PanelSet(&panel_insexit); gui.PanelLineStyle(PANEL_TITLE,COLOR_BLACK); gui.MessSet(&mess_Title_Err); gui.MessSet(&mess_Info_Err); gui.MessSet(&mess_Info2_Err); gui.MessSet(&mess_Info3_Err); gui.MessSet(&mess_Title_Suc); gui.MessSet(&mess_Info_Suc); gui.MessSet(&mess_Info2_Suc); gui.MessSet(&mess_conf_Title); gui.MessSet(&mess_conf_Msg); gui.MessSet(&mess_delconf_Title); gui.MessSet(&mess_delconf_Msg); gui.MessSet(&mess_delconf_Msg2); gui.MessSet(&mess_delconf_Msg3); gui.MessSet(&mess_topmenu_help_read); // gui.MessSet(&mess_topmenu_help_write); // gui.MessSet(&mess_topmenu_help_end); gui.MessSet(&mess_topmenu_help_operate); gui.MessSet(&mess_title); gui.MessSet(&mess_version); gui.MessSet(&mess_product); // gui.MessSet(&mess_product2); gui.MessSet(&mess_menu_read); // gui.MessSet(&mess_menu_write); // gui.MessSet(&mess_menu_end); gui.MessSet(&mess_menu_operate); gui.MessSet(&mess_quit_operate); gui.MessSet(&mess_conf); gui.MessSet(&mess_operate); gui.MessSet(&mess_bkuperr); gui.MessSet(&mess_carderr); // gui.MessSet(&mess_debug); gui.MessSet(&mess_result); gui.MessSet(&mess_status); gui.MessSet(&mess_count); gui.MessSet(&mess_count2); gui.MessSet(&mess_insexit); gui.MessSet(&mess_insexit2); gui.MessSet(&mess_insexit3); //gui.MemoSet(&memo_dbglog); //gui.MemoEffective(MESSAGE_PRODUCT); gui.MessEffective(MESSAGE_ERROR_TITLE); gui.MessEffective(MESSAGE_ERROR_INFO); gui.MessEffective(MESSAGE_ERROR_INFO2); gui.MessEffective(MESSAGE_ERROR_INFO3); gui.MessEffective(MESSAGE_SUCCESS_TITLE); gui.MessEffective(MESSAGE_SUCCESS_INFO); gui.MessEffective(MESSAGE_SUCCESS_INFO2); gui.MessEffective(MESSAGE_CONFIRM_TITLE); gui.MessEffective(MESSAGE_CONFIRM_MSG); gui.MessEffective(MESSAGE_DELCONF_TITLE); gui.MessEffective(MESSAGE_DELCONF_MSG); gui.MessEffective(MESSAGE_DELCONF_MSG2); gui.MessEffective(MESSAGE_DELCONF_MSG3); gui.MessEffective(MESSAGE_TOPMENU_HELP_READ); gui.MessEffective(MESSAGE_TOPMENU_HELP_WRITE); gui.MessEffective(MESSAGE_TOPMENU_HELP_END); gui.MessEffective(MESSAGE_TOPMENU_HELP_OPERATE); gui.MessEffective(MESSAGE_MENU_READ); gui.MessEffective(MESSAGE_MENU_WRITE); // gui.MessEffective(MESSAGE_MENU_END); gui.MessEffective(MESSAGE_MENU_OPERATE); gui.MessEffective(MESSAGE_INSEXT_1); gui.MessEffective(MESSAGE_INSEXT_2); gui.MessEffective(MESSAGE_INSEXT_3); gui.MessEffective(MESSAGE_TITLE); gui.MessEffective(MESSAGE_VERSION); // gui.MemoEffective(MEMO_DBGLOG); gui.PanelLineStyle(PANEL_DELCONF,COLOR_YELLO); swprintf(scr_ver,10,L"ver %.2f",VERSION); gui.MessStr(MESSAGE_VERSION,scr_ver); gui.MessStr(MESSAGE_MENU_CAUTION,scr_err); gui.MessStr(MESSAGE_MENU_ERROR,scr_err); gui.MessStr(MESSAGE_MENU_DEBUG,scr_debug); return true; } void ScrFinalize() { stopEvnt.Signal(); while(stopEvnt.TryWait()){ nn::os::Thread::Yield(); }; gui.Finalize(); } //YES-NO ボタン void YesNo() { gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_B); gui.PanelEffective(PANEL_YES); gui.PanelEffective(PANEL_NO); gui.Draw(); } void Quit() { gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_B); gui.PanelEffective(PANEL_QUIT); gui.Draw(); } //トップメニュー画面 //引数:カード状態 void scr_TopMenuDbg(bool formatted,bool insertted)//デバッグ用 { NN_UNUSED_VAR(insertted); scr_evnt = EVNT_NONE; gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_R | nn::hid::BUTTON_L); if (formatted) {//リード可能 gui.MessSet(&mess_topmenu_help_read); gui.PanelEffective(PANEL_READ); }else{//リード不可 gui.MessSet(&mess_topmenu_help_notread); gui.PanelEffective(PANEL_READ,false); } // if (insertted) // {//書き込み可 // gui.MessSet(&mess_topmenu_help_write); // gui.PanelEffective(PANEL_WRITE); // }else{//書き込み不可 // gui.MessSet(&mess_topmenu_help_notwrite); // gui.PanelEffective(PANEL_WRITE,false); // } gui.MessEffective(MESSAGE_TOPMENU_HELP_READ); // gui.MessEffective(MESSAGE_TOPMENU_HELP_WRITE); // gui.PanelEffective(PANEL_END); gui.PanelEffective(PANEL_TOPMENU); gui.Draw(); } //通常時 //プロダクトコード //引数:カード、拡張セーブに記録されたもの wchar_t scr_pcode[32]; void scr_PrdCode(char *s) { wcscpy(scr_pcode,L"CARD : "); if (s[0]==0) wcscat(scr_pcode,L"----"); else mbstowcs(&scr_pcode[7],s,30); gui.MessStr(MESSAGE_PRODUCT,scr_pcode); } /* char scr_pcode2[64]; void scr_PrdCodeEx(char *s) { strcpy(scr_pcode2,"BKUP : "); if (s[0]==0) strcat(scr_pcode2,"----"); else strcat(scr_pcode2,s); gui.MessStr(MESSAGE_PRODUCT2,scr_pcode2); } */ //削除の実行確認 void scr_DelConf() { scr_evnt = EVNT_NONE; gui.PanelEffective(PANEL_DELCONF); YesNo(); } //Top menu //引数:デバイス状態 //arg : プロダクトコード一致 void scr_TopMenu(bool formatted,bool inserted,bool sdins,int err) { int i; scr_evnt = EVNT_NONE; u32 mask = 0; mask |= (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);//LEFT+X = Delete 有効 gui.MessStr(MESSAGE_TITLE,L" < CTR Card Savedata Exporter >"); gui.MessEffective(MESSAGE_MENU_ERROR,false,false); gui.MessEffective(MESSAGE_MENU_CAUTION,false,false); gui.MessEffective(MESSAGE_MENU_OPERATE,false,false); if (formatted && sdins) {//バックアップ可能 gui.MessEffective(MESSAGE_MENU_OPERATE); gui.PanelEffective(PANEL_READ); }else { gui.PanelEffective(PANEL_READ,false,false); if (inserted == false) { wcscpy(scr_err,L"Please Insert Card"); gui.MessEffective(MESSAGE_MENU_CAUTION); }else if (sdins == false) { wcscpy(scr_err,L"SD protected or not Insert"); gui.MessEffective(MESSAGE_MENU_CAUTION); }else{ if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + TGT_CARD;//バックアップがない else i = ERC_EXEC;//不明 swprintf(scr_err,12,L"ERROR %d",i); gui.MessEffective(MESSAGE_MENU_ERROR); } } gui.ButtonMask(mask); gui.MessEffective(MESSAGE_PRODUCT); //gui.MessEffective(MESSAGE_PRODUCT2); gui.PanelEffective(PANEL_TITLE); gui.PanelEffective(PANEL_MENU); gui.Draw(); } //デバッグ用、ボタン待ち void ScrStep() { scr_evnt = EVNT_NONE; gui.ButtonMask(nn::hid::BUTTON_B); } void ClearBkupMess() { gui.MessEffective(MESSAGE_CONF,false,false); gui.MessEffective(MESSAGE_RESULT,false,false); gui.MessEffective(MESSAGE_OPERATE,false,false); gui.MessEffective(MESSAGE_QUIT_OPERATE,false,false); gui.MessEffective(MESSAGE_STATUS,false,false); gui.MessEffective(MESSAGE_COUNT,false,false); gui.MessEffective(MESSAGE_COUNT2,false,false); gui.PanelEffective(PANEL_BKUP); } //Backup void scr_Backup() { scr_evnt = EVNT_NONE; gui.PanelLineStyle(PANEL_BKUP,COLOR_SKY); gui.MessStr(MESSAGE_TITLE,L" --- Backup Card Savedata ---"); gui.PanelEffective(PANEL_TITLE); ClearBkupMess(); gui.Draw(); } void scr_BackupYesNo() { scr_Backup(); gui.MessEffective(MESSAGE_CONF); gui.MessEffective(MESSAGE_OPERATE); YesNo(); } //restore void scr_Restore() { scr_evnt = EVNT_NONE; gui.PanelLineStyle(PANEL_BKUP,COLOR_PARPL); gui.MessStr(MESSAGE_TITLE,L"--- Restore Card Savedata ---"); gui.PanelEffective(PANEL_TITLE); ClearBkupMess();//backupと同じパネルを使う gui.Draw(); } void scr_RestoreYesNo() { scr_Restore(); gui.MessEffective(MESSAGE_CONF); gui.MessEffective(MESSAGE_OPERATE); YesNo(); } void scr_Status(wchar_t *s,eColor col) { gui.MessCol(MESSAGE_STATUS,col); gui.MessStr(MESSAGE_STATUS,s); gui.MessEffective(MESSAGE_STATUS); gui.Draw(); } void scr_ResultQuit(wchar_t *s,eColor col) { gui.MessCol(MESSAGE_RESULT,col); gui.MessStr(MESSAGE_RESULT,s); gui.MessEffective(MESSAGE_RESULT); gui.MessEffective(MESSAGE_QUIT_OPERATE); Quit(); } void scr_InsExitQuit() { ClearBkupMess(); gui.PanelLineStyle(PANEL_INSEXIT,COLOR_RED); gui.PanelEffective(PANEL_INSEXIT); Quit(); } // カウント/MAX 表示 wchar_t str_Counter[128]; wchar_t str_Counter2[128]; void scr_CountPerMax(int ct,int max) { swprintf(str_Counter,16,L"%d / %d",ct,max); gui.MessStr(MESSAGE_COUNT,str_Counter); gui.MessEffective(MESSAGE_COUNT); gui.Draw(); } //ゲージ&total void scr_CountPerMax2(int ct,int max,int total) { if (total == -1) str_Counter2[0]=0; else if (total != 0){ // gui.MessCol(MESSAGE_COUNT2,COLOR_WHITE); swprintf(str_Counter2,20,L"total size %d",total); }else{ // gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO); int i; int lv = ct/(max/25); for (i =0;i'; while ( i < 25 )str_Counter2[i++] = '|'; str_Counter2[i] = 0; } //sprintf(str_Counter2,"%d / %d",ct,max); gui.MessStr(MESSAGE_COUNT2,str_Counter2); gui.MessEffective(MESSAGE_COUNT2); gui.Draw(); } void scr_MessOnCount2(wchar_t *str) { // gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO); gui.MessStr(MESSAGE_COUNT2,str); gui.MessEffective(MESSAGE_COUNT2); gui.Draw(); } void scr_MessOnCount(wchar_t *str) { // gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO); gui.MessStr(MESSAGE_COUNT,str); gui.MessEffective(MESSAGE_COUNT); gui.Draw(); } /* //実行確認 void scr_ConfirmDbg(char *str) { scr_evnt = EVNT_NONE; gui.MessStr(MESSAGE_CONFIRM_TITLE,str); gui.PanelEffective(PANEL_CONFIRM); YesNo(); } //エラー表示とQuitボタン void scr_ErrorQuitDbg(tColStr **s) { scr_evnt = EVNT_NONE; gui.MessStr(MESSAGE_ERROR_TITLE,s[0]->str); gui.MessCol(MESSAGE_ERROR_TITLE,s[0]->color); gui.MessStr(MESSAGE_ERROR_INFO,s[1]->str); gui.MessCol(MESSAGE_ERROR_INFO,s[1]->color); gui.MessStr(MESSAGE_ERROR_INFO2,s[2]->str); gui.MessCol(MESSAGE_ERROR_INFO2,s[2]->color); gui.MessStr(MESSAGE_ERROR_INFO3,s[3]->str); gui.MessCol(MESSAGE_ERROR_INFO3,s[3]->color); gui.PanelEffective(PANEL_ERROR); Quit(); } //成功表示とQuitボタン void scr_SuccessQuitDbg(tColStr **s) { scr_evnt = EVNT_NONE; gui.MessStr(MESSAGE_SUCCESS_TITLE,s[0]->str); gui.MessCol(MESSAGE_SUCCESS_TITLE,s[0]->color); gui.MessStr(MESSAGE_SUCCESS_INFO,s[1]->str); gui.MessCol(MESSAGE_SUCCESS_INFO,s[1]->color); gui.MessStr(MESSAGE_SUCCESS_INFO2,s[2]->str); gui.MessCol(MESSAGE_SUCCESS_INFO2,s[2]->color); gui.PanelEffective(PANEL_SUCCESS); Quit(); } */ void scr_Draw() { gui.Draw(); } void scr_GetEvnt() { // gui.thUpdate(); }