--- np2/embed/menu/filesel.c 2003/11/28 08:01:32 1.1 +++ np2/embed/menu/filesel.c 2004/02/14 08:12:18 1.6 @@ -129,7 +129,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 +139,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,8 +181,8 @@ const char *p; static void dlgsetlist(void) { LISTARRAY flist; - FILEFINDH ffh; - FILEFINDT fft; + FLISTH flh; + FLINFO fli; BOOL append; FLIST fl; ITEMEXPRM prm; @@ -203,30 +203,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; @@ -386,16 +379,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 +406,32 @@ void filesel_fdd(BYTE drv) { } } -void filesel_sasi(BYTE drv) { +void filesel_hdd(REG8 drv) { - char path[MAX_PATH]; - - if (drv < 2) { - if (selectfile(&hddprm, path, sizeof(path), np2cfg.hddfile[drv])) { - diskdrv_sethdd(drv, path); + UINT num; + char *p; +const FSELPRM *prm; + char path[MAX_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); + } }