--- np2/embed/menu/filesel.c 2003/11/28 08:01:32 1.1 +++ np2/embed/menu/filesel.c 2004/06/21 03:18:04 1.11 @@ -20,15 +20,41 @@ enum { DID_FILTER }; -static const BYTE str_dirname[] = { // ファイルの場所 - 0xcc,0xa7,0xb2,0xd9,0x82,0xcc,0x8f,0xea,0x8f,0x8a,0}; -static const BYTE str_filename[] = { // ファイル名 - 0xcc,0xa7,0xb2,0xd9,0x96,0xbc,0}; -static const BYTE str_filetype[] = { // ファイルの種類 - 0xcc,0xa7,0xb2,0xd9,0x82,0xcc,0x8e,0xed,0x97,0xde,0}; -static const BYTE str_open[] = { // 開く - 0x8a,0x4a,0x82,0xad,0}; - +#if !defined(RESOURCE_US) && (!defined(CHARSET_OEM) || defined(OSLANG_SJIS)) +static const char str_dirname[] = // ファイルの場所 + "\203\164\203\100\203\103\203\213\202\314\217\352\217\212"; +static const char str_filename[] = // ファイル名 + "\203\164\203\100\203\103\203\213\226\274"; +static const char str_filetype[] = // ファイルの種類 + "\203\164\203\100\203\103\203\213\202\314\216\355\227\336"; +static const char str_open[] = // 開く + "\212\112\202\255"; +#elif defined(OSLANG_EUC) +static const char str_dirname[] = // ファイルの場所 + "\245\325\245\241\245\244\245\353\244\316\276\354\275\352"; +static const char str_filename[] = // ファイル名 + "\245\325\245\241\245\244\245\353\314\276"; +static const char str_filetype[] = // ファイルの種類 + "\245\325\245\241\245\244\245\353\244\316\274\357\316\340"; +static const char str_open[] = // 開く + "\263\253\244\257"; +#elif defined(OSLANG_UTF8) && !defined(RESOURCE_US) +static const char str_dirname[] = // ファイルの場所 + "\343\203\225\343\202\241\343\202\244\343\203\253\343\201\256" \ + "\345\240\264\346\211\200"; +static const char str_filename[] = // ファイル名 + "\343\203\225\343\202\241\343\202\244\343\203\253\345\220\215"; +static const char str_filetype[] = // ファイルの種類 + "\343\203\225\343\202\241\343\202\244\343\203\253\343\201\256" \ + "\347\250\256\351\241\236"; +static const char str_open[] = // 開く + "\351\226\213\343\201\217"; +#else +static const char str_dirname[] = "Look in"; +static const char str_filename[] = "File name"; +static const char str_filetype[] = "Files of type"; +static const char str_open[] = "Open"; +#endif #if defined(SIZE_QVGA) enum { @@ -129,7 +155,7 @@ static FLIST getflist(int pos) { return(ret); } -static BOOL fappend(LISTARRAY flist, FILEFINDT *fft) { +static BOOL fappend(LISTARRAY flist, FLINFO *fli) { FLIST fl; FLIST *st; @@ -139,8 +165,8 @@ static BOOL fappend(LISTARRAY flist, FIL if (fl == NULL) { return(FAILURE); } - fl->isdir = (fft->attr & 0x10)?1:0; - file_cpyname(fl->name, fft->path, sizeof(fl->name)); + fl->isdir = (fli->attr & 0x10)?1:0; + file_cpyname(fl->name, fli->path, sizeof(fl->name)); st = &filesel.fbase; while(1) { cur = *st; @@ -181,12 +207,12 @@ const char *p; static void dlgsetlist(void) { LISTARRAY flist; - FILEFINDH ffh; - FILEFINDT fft; + FLISTH flh; + FLINFO fli; BOOL append; FLIST fl; ITEMEXPRM prm; -#if defined(OSLANG_EUC) +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) char sjis[MAX_PATH]; #endif @@ -196,6 +222,10 @@ static void dlgsetlist(void) { codecnv_euc2sjis(sjis, sizeof(sjis), file_getname(filesel.path), (UINT)-1); menudlg_settext(DID_FOLDER, sjis); +#elif defined(OSLANG_UTF8) + oemtext_oem2sjis(sjis, sizeof(sjis), + file_getname(filesel.path), (UINT)-1); + menudlg_settext(DID_FOLDER, sjis); #else menudlg_settext(DID_FOLDER, file_getname(filesel.path)); #endif @@ -203,30 +233,23 @@ static void dlgsetlist(void) { flist = listarray_new(sizeof(_FLIST), 64); filesel.flist = flist; filesel.fbase = NULL; - ffh = file_find1st(filesel.path, &fft); - if (ffh != FILEFINDH_INVALID) { + flh = file_list1st(filesel.path, &fli); + if (flh != FLISTH_INVALID) { do { append = FALSE; - if (fft.attr & 0x10) { -#if defined(WIN32) && !defined(_WIN32_WCE) - if ((file_cmpname(fft.path, ".")) && - (file_cmpname(fft.path, ".."))) { - append = TRUE; - } -#else + if (fli.attr & 0x10) { append = TRUE; -#endif } - else if (!(fft.attr & 0x08)) { - append = checkext(fft.path, filesel.ext); + else if (!(fli.attr & 0x08)) { + append = checkext(fli.path, filesel.ext); } if (append) { - if (fappend(flist, &fft) != SUCCESS) { + if (fappend(flist, &fli) != SUCCESS) { break; } } - } while(file_findnext(ffh, &fft) == SUCCESS); - file_findclose(ffh); + } while(file_listnext(flh, &fli) == SUCCESS); + file_listclose(flh); } prm.pos = 0; fl = filesel.fbase; @@ -236,6 +259,9 @@ static void dlgsetlist(void) { #if defined(OSLANG_EUC) codecnv_euc2sjis(sjis, sizeof(sjis), fl->name, (UINT)-1); prm.str = sjis; +#elif defined(OSLANG_UTF8) + oemtext_oem2sjis(sjis, sizeof(sjis), fl->name, (UINT)-1); + prm.str = sjis; #else prm.str = fl->name; #endif @@ -247,7 +273,7 @@ static void dlgsetlist(void) { static void dlginit(void) { -#if defined(OSLANG_EUC) +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) char sjis[MAX_PATH]; #endif @@ -257,6 +283,10 @@ static void dlginit(void) { codecnv_euc2sjis(sjis, sizeof(sjis), file_getname(filesel.path), (UINT)-1); menudlg_settext(DID_FILE, sjis); +#elif defined(OSLANG_UTF8) + oemtext_oem2sjis(sjis, sizeof(sjis), + file_getname(filesel.path), (UINT)-1); + menudlg_settext(DID_FILE, sjis); #else menudlg_settext(DID_FILE, file_getname(filesel.path)); #endif @@ -290,7 +320,7 @@ static BOOL dlgupdate(void) { static void dlgflist(void) { FLIST fl; -#if defined(OSLANG_EUC) +#if defined(OSLANG_EUC) || defined(OSLANG_UTF8) char sjis[MAX_PATH]; #endif @@ -299,6 +329,9 @@ static void dlgflist(void) { #if defined(OSLANG_EUC) codecnv_euc2sjis(sjis, sizeof(sjis), fl->name, (UINT)-1); menudlg_settext(DID_FILE, sjis); +#elif defined(OSLANG_UTF8) + oemtext_oem2sjis(sjis, sizeof(sjis), fl->name, (UINT)-1); + menudlg_settext(DID_FILE, sjis); #else menudlg_settext(DID_FILE, fl->name); #endif @@ -386,16 +419,23 @@ const char *title; // ---- -static const char diskfilter[] = "All supported Files"; +static const char diskfilter[] = "All supported files"; static const char fddtitle[] = "Select floppy image"; -static const char fddext[] = "d88\088d\0d98\098d\0xdf\0hdm\0dup\02hd\0tfd\0"; +static const char fddext[] = "d88\088d\0d98\098d\0fdi\0" \ + "xdf\0hdm\0dup\02hd\0tfd\0"; static const char hddtitle[] = "Select HDD image"; -static const char hddext[] = "thd\0hdi\0"; +static const char sasiext[] = "thd\0nhd\0hdi\0"; static const FSELPRM fddprm = {fddtitle, diskfilter, fddext}; -static const FSELPRM hddprm = {hddtitle, diskfilter, hddext}; +static const FSELPRM sasiprm = {hddtitle, diskfilter, sasiext}; + +#if defined(SUPPORT_SCSI) +static const char scsiext[] = "hdd\0"; +static const FSELPRM scsiprm = {hddtitle, diskfilter, scsiext}; +#endif + -void filesel_fdd(BYTE drv) { +void filesel_fdd(REG8 drv) { char path[MAX_PATH]; @@ -406,14 +446,32 @@ void filesel_fdd(BYTE drv) { } } -void filesel_sasi(BYTE drv) { +void filesel_hdd(REG8 drv) { - char path[MAX_PATH]; + UINT num; + char *p; +const FSELPRM *prm; + char path[MAX_PATH]; - if (drv < 2) { - if (selectfile(&hddprm, path, sizeof(path), np2cfg.hddfile[drv])) { - diskdrv_sethdd(drv, path); + num = drv & 0x0f; + p = NULL; + prm = NULL; + if (!(drv & 0x20)) { // SASI/IDE + if (num < 2) { + p = np2cfg.sasihdd[num]; + prm = &sasiprm; + } + } +#if defined(SUPPORT_SCSI) + else { // SCSI + if (num < 4) { + p = np2cfg.scsihdd[num]; + prm = &scsiprm; } } +#endif + if ((prm) && (selectfile(prm, path, sizeof(path), p))) { + diskdrv_sethdd(drv, path); + } }