/** * Retrieves the font type of the specified file. * @param[in] fname The name of the font file * @return font type */ static UINT8 fonttypecheck(const OEMCHAR *fname) { const OEMCHAR *p; p = file_getext(fname); if (!file_cmpname(p, str_bmp)) { return(FONTTYPE_PC98); } p = file_getname(fname); if (!file_cmpname(p, v98fontname)) { return(FONTTYPE_V98); } if ((!file_cmpname(p, pc88ankname)) || (!file_cmpname(p, pc88knj1name)) || (!file_cmpname(p, pc88knj2name))) { return(FONTTYPE_PC88); } if ((!file_cmpname(p, fm7ankname)) || (!file_cmpname(p, fm7knjname))) { return(FONTTYPE_FM7); } if ((!file_cmpname(p, x1ank1name)) || (!file_cmpname(p, x1ank2name)) || (!file_cmpname(p, x1knjname))) { return(FONTTYPE_X1); } if (!file_cmpname(p, x68kfontname)) { return(FONTTYPE_X68); } return(FONTTYPE_NONE); }
BRESULT sxsicd_open(SXSIDEV sxsi, const OEMCHAR *fname) { const OEMCHAR *ext; ext = file_getext(fname); if (!file_cmpname(ext, str_cue)) { return(opencue(sxsi, fname)); } return(openimg(sxsi, fname, NULL, 0)); }
static int GetFileExt(char* filename) { char* p; char* n; int ftype; p = file_getext((char *)filename); n = file_getname((char *)filename); if ((!milstr_cmp(p, str_d88)) || (!milstr_cmp(p, str_d98))) { ftype = FTYPE_D88; } else if ((!milstr_cmp(p, str_ini))) { ftype = FTYPE_INI; } else if ((!milstr_cmp(p, str_bmp))) { ftype = FTYPE_BMP; } else if ((!milstr_cmp(p, str_thd))) { ftype = FTYPE_THD; } else if ((!milstr_cmp(p, str_nhd))) { ftype = FTYPE_NHD; } else if ((!milstr_cmp(p, str_hdi))) { ftype = FTYPE_HDI; } else if ((!milstr_cmp(p, str_hdd))) { ftype = FTYPE_HDD; } else if ((!milstr_cmp(p, str_fdi))) { ftype = FTYPE_FDI; } else if ((!milstr_cmp(p, "xdf")) || (!milstr_cmp(p, "dup")) || (!milstr_cmp(p, "hdm"))) { ftype = FTYPE_BETA; } else if ( (!file_cmpname(n, v98fontname)) || (!file_cmpname(n, pc88ankname)) || (!file_cmpname(n, pc88knj1name))|| (!file_cmpname(n, pc88knj2name))|| (!file_cmpname(n, fm7ankname)) || (!file_cmpname(n, fm7knjname)) || (!file_cmpname(n, x1ank1name)) || (!file_cmpname(n, x1ank2name)) || (!file_cmpname(n, x1knjname)) || (!file_cmpname(n, x68kfontname))) { ftype = FTYPE_SMIL; } else { ftype = FTYPE_NONE; } return(ftype); }
BRESULT fdd_set(REG8 drv, const OEMCHAR *fname, UINT ftype, int ro) { FDDFILE fdd; UINT fddtype; const OEMCHAR *p; BRESULT r; if (drv >= MAX_FDDFILE) { return(FAILURE); } fddtype = ftype; if (fddtype == FTYPE_NONE) { p = file_getext(fname); if ((!milstr_cmp(p, str_d88)) || (!milstr_cmp(p, str_88d)) || (!milstr_cmp(p, str_d98)) || (!milstr_cmp(p, str_98d))) { fddtype = FTYPE_D88; } else if (!milstr_cmp(p, str_fdi)) { fddtype = FTYPE_FDI; } else { fddtype = FTYPE_BETA; } } fdd = fddfile + drv; switch(fddtype) { case FTYPE_FDI: r = fddxdf_setfdi(fdd, fname, ro); if (r == SUCCESS) { break; } /* FALLTHROUGH */ case FTYPE_BETA: r = fddxdf_set(fdd, fname, ro); break; case FTYPE_D88: r = fddd88_set(fdd, fname, ro); break; default: r = FAILURE; } if (r == SUCCESS) { file_cpyname(fdd->fname, fname, NELEMENTS(fdd->fname)); fdd->ftype = ftype; fdd->ro = ro; } return(FAILURE); }
static BOOL checkext(OEMCHAR *path, const OEMCHAR *ext) { const OEMCHAR *p; if (ext == NULL) { return(TRUE); } p = file_getext(path); while(*ext) { if (!file_cmpname(p, ext)) { return(TRUE); } ext += OEMSTRLEN(ext) + 1; } return(FALSE); }
/** * 設定ファイルのパスを得る * @param[out] lpPath パス * @param[in] cchPath パス バッファの長さ */ void initgetfile(LPTSTR lpPath, UINT cchPath) { LPCTSTR lpIni = Np2Arg::GetInstance()->iniFilename(); if (lpIni) { file_cpyname(lpPath, lpIni, cchPath); LPCTSTR lpExt = file_getext(lpPath); if (lpExt[0] != '\0') { file_catname(lpPath, s_szExt, cchPath); } } else { file_cpyname(lpPath, modulefile, cchPath); file_cutext(lpPath); file_catname(lpPath, s_szExt, cchPath); } }
void dialog_writebmp(HWND hWnd) { SCRNSAVE ss; int type; FSPARAM fp; TCHAR szPath[MAX_PATH]; LPCTSTR pszExt; ss = scrnsave_create(); if (ss == NULL) { return; } type = scrnsave_gettype(ss); fp.lpszTitle = MAKEINTRESOURCE(IDS_BMPTITLE); fp.lpszDefExt = MAKEINTRESOURCE(IDS_BMPEXT); fp.lpszFilter = lpszBmpFilter[type]; fp.nFilterIndex = 1; file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath)); file_cutname(szPath); file_catname(szPath, szBmpFile, NELEMENTS(szPath)); if (dlgs_createfilenum(hWnd, &fp, szPath, NELEMENTS(szPath))) { file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder)); sysmng_update(SYS_UPDATEOSCFG); pszExt = file_getext(szPath); if ((type <= SCRNSAVE_8BIT) && (!file_cmpname(pszExt, TEXT("gif")))) { scrnsave_writegif(ss, szPath, SCRNSAVE_AUTO); } else if (!file_cmpname(pszExt, str_bmp)) { scrnsave_writebmp(ss, szPath, SCRNSAVE_AUTO); } } scrnsave_destroy(ss); }
void initgetfile(OEMCHAR *path, UINT size) { const OEMCHAR *ext; file_cpyname(path, modulefile, size); if (np2arg.ini) { if ((np2arg.ini[0] == '/') || (np2arg.ini[0] == '-')) { file_cutname(path); file_catname(path, file_getname(np2arg.ini + 2), size); } else { file_cpyname(path, np2arg.ini, size); } ext = file_getext(path); if (ext[0] != '\0') { file_catname(path, ext_ini, size); } } else { file_cutext(path); file_catname(path, ext_ini, size); } }
BRESULT sxsihdd_open(SXSIDEV sxsi, const OEMCHAR *fname) { FILEH fh; const OEMCHAR *ext; REG8 iftype; long totals; UINT32 headersize; UINT32 surfaces; UINT32 cylinders; UINT32 sectors; UINT32 size; fh = file_open(fname); if (fh == FILEH_INVALID) { goto sxsiope_err1; } ext = file_getext(fname); iftype = sxsi->drv & SXSIDRV_IFMASK; if ((iftype == SXSIDRV_SASI) && (!file_cmpname(ext, str_thd))) { THDHDR thd; // T98 HDD (IDE) if (file_read(fh, &thd, sizeof(thd)) != sizeof(thd)) { goto sxsiope_err2; } headersize = 256; surfaces = 8; cylinders = LOADINTELWORD(thd.cylinders); sectors = 33; size = 256; totals = cylinders * sectors * surfaces; } else if ((iftype == SXSIDRV_SASI) && (!file_cmpname(ext, str_nhd))) { NHDHDR nhd; // T98Next HDD (IDE) if ((file_read(fh, &nhd, sizeof(nhd)) != sizeof(nhd)) || (memcmp(nhd.sig, sig_nhd, 15))) { goto sxsiope_err2; } headersize = LOADINTELDWORD(nhd.headersize); surfaces = LOADINTELWORD(nhd.surfaces); cylinders = LOADINTELDWORD(nhd.cylinders); sectors = LOADINTELWORD(nhd.sectors); size = LOADINTELWORD(nhd.sectorsize); totals = cylinders * sectors * surfaces; } else if ((iftype == SXSIDRV_SASI) && (!file_cmpname(ext, str_hdi))) { HDIHDR hdi; // ANEX86 HDD (SASI) thanx Mamiya if (file_read(fh, &hdi, sizeof(hdi)) != sizeof(hdi)) { goto sxsiope_err2; } headersize = LOADINTELDWORD(hdi.headersize); surfaces = LOADINTELDWORD(hdi.surfaces); cylinders = LOADINTELDWORD(hdi.cylinders); sectors = LOADINTELDWORD(hdi.sectors); size = LOADINTELDWORD(hdi.sectorsize); totals = cylinders * sectors * surfaces; } else if ((iftype == SXSIDRV_SCSI) && (!file_cmpname(ext, str_hdd))) { VHDHDR vhd; // Virtual98 HDD (SCSI) if ((file_read(fh, &vhd, sizeof(vhd)) != sizeof(vhd)) || (memcmp(vhd.sig, sig_vhd, 5))) { goto sxsiope_err2; } headersize = sizeof(vhd); surfaces = vhd.surfaces; cylinders = LOADINTELWORD(vhd.cylinders); sectors = vhd.sectors; size = LOADINTELWORD(vhd.sectorsize); totals = (SINT32)LOADINTELDWORD(vhd.totals); } else { goto sxsiope_err2; } // フォーマット確認〜 if ((surfaces == 0) || (surfaces >= 256) || (cylinders == 0) || (cylinders >= 65536) || (sectors == 0) || (sectors >= 256) || (size == 0) || ((size & (size - 1)) != 0)) { goto sxsiope_err2; } if (iftype == SXSIDRV_SCSI) { if (!(size & 0x700)) { // not 256,512,1024 goto sxsiope_err2; } } sxsi->reopen = hdd_reopen; sxsi->read = hdd_read; sxsi->write = hdd_write; sxsi->format = hdd_format; sxsi->close = hdd_close; sxsi->hdl = (INTPTR)fh; sxsi->totals = totals; sxsi->cylinders = (UINT16)cylinders; sxsi->size = (UINT16)size; sxsi->sectors = (UINT8)sectors; sxsi->surfaces = (UINT8)surfaces; sxsi->headersize = headersize; sxsi->mediatype = gethddtype(sxsi); return(SUCCESS); sxsiope_err2: file_close(fh); sxsiope_err1: return(FAILURE); }