--- np2/win9x/dialog/d_disk.cpp 2005/02/07 15:39:27 1.11 +++ np2/win9x/dialog/d_disk.cpp 2006/12/24 00:52:30 1.16 @@ -2,6 +2,7 @@ #include "strres.h" #include "resource.h" #include "np2.h" +#include "oemtext.h" #include "dosio.h" #include "sysmng.h" #include "toolwin.h" @@ -13,85 +14,100 @@ #include "newdisk.h" -static const char fddui_title[] = "Select floppy image"; -static const char fddui_filter[] = \ - "D88 image files (*.D88;*.D98)\0" \ - "*.d88;*.88d;*.d98;*.98d\0" \ - "Floppy disk images (*.XDF;*.HDM;*.DUP;*.2HD)\0" \ - "*.xdf;*.hdm;*.dup;*.2hd;*.tfd\0" \ - "All supported Files\0" \ - "*.d88;*.88d;*.d98;*.98d;*.fdi;" \ - "*.xdf;*.hdm;*.dup;*.2hd;*.tfd\0" \ - "All files (*.*)\0*.*\0"; -static const FILESEL fddui = {fddui_title, str_d88, fddui_filter, 3}; +static const TCHAR fddui_title[] = _T("Select floppy image"); +static const TCHAR fddui_filter[] = \ + _T("D88 image files (*.D88;*.D98)\0") \ + _T("*.d88;*.88d;*.d98;*.98d\0") \ + _T("Floppy disk images (*.XDF;*.HDM;*.DUP;*.2HD)\0") \ + _T("*.xdf;*.hdm;*.dup;*.2hd;*.tfd\0") \ + _T("All supported Files\0") \ + _T("*.d88;*.88d;*.d98;*.98d;*.fdi;") \ + _T("*.xdf;*.hdm;*.dup;*.2hd;*.tfd\0") \ + _T("All files (*.*)\0*.*\0"); +static const FILESEL fddui = {fddui_title, tchar_d88, fddui_filter, 3}; #if defined(SUPPORT_SASI) -static const char sasiui_title[] = "Select SASI/IDE HDD image"; +static const TCHAR sasiui_title[] = _T("Select SASI/IDE HDD image"); #else -static const char sasiui_title[] = "Select HDD image"; +static const TCHAR sasiui_title[] = _T("Select HDD image"); +#endif +static const TCHAR sasiui_filter[] = \ + _T("Anex86 harddisk image files (*.HDI)\0") \ + _T("*.hdi\0") \ + _T("T98 harddisk image files (*.THD)\0") \ + _T("*.thd\0") \ + _T("T98-Next harddisk image files (*.NHD)\0") \ + _T("*.nhd\0") \ + _T("All supported Files\0") \ + _T("*.thd;*.nhd;*.hdi\0"); +static const FILESEL sasiui = {sasiui_title, tchar_thd, sasiui_filter, 4}; + +#if defined(SUPPORT_IDEIO) +static const TCHAR isoui_title[] = _T("Select ISO-9660 image"); +static const TCHAR tchar_iso[] = _T("iso"); +static const TCHAR isoui_filter[] = \ + _T("Cue sheets\0") \ + _T("*.cue\0") \ + _T("ISO-9660 image files\0") \ + _T("*.iso;*.img\0") \ + _T("All supported Files\0") \ + _T("*.cue;*.iso;*.img\0") \ + _T("All Files\0") \ + _T("*.*\0"); +static const FILESEL isoui = {isoui_title, tchar_iso, isoui_filter, 3}; #endif -static const char sasiui_filter[] = \ - "Anex86 harddisk image files (*.HDI)\0" \ - "*.hdi\0" \ - "T98 harddisk image files (*.THD)\0" \ - "*.thd\0" \ - "T98-Next harddisk image files (*.NHD)\0" \ - "*.nhd\0" \ - "All supported Files\0" \ - "*.thd;*.nhd;*.hdi\0"; -static const FILESEL sasiui = {sasiui_title, str_thd, sasiui_filter, 4}; #if defined(SUPPORT_SCSI) -static const char scsiui_title[] = "Select SCSI HDD image"; -static const char scsiui_filter[] = \ - "Virtual98 harddisk image files (*.HDD)\0" \ - "*.hdd\0"; -static const FILESEL scsiui = {scsiui_title, str_hdd, scsiui_filter, 1}; +static const TCHAR scsiui_title[] = _T("Select SCSI HDD image"); +static const TCHAR scsiui_filter[] = \ + _T("Virtual98 harddisk image files (*.HDD)\0") \ + _T("*.hdd\0"); +static const FILESEL scsiui = {scsiui_title, tchar_hdd, scsiui_filter, 1}; #endif -static const char newdisk_title[] = "Create disk image"; +static const TCHAR newdisk_title[] = _T("Create disk image"); #if defined(SUPPORT_SCSI) -static const char newdisk_filter[] = \ - "D88 image files (*.D88;*.88D)\0" \ - "*.d88;*.88d;*.d98;*.98d\0" \ - "Anex86 harddisk image files (*.HDI)\0" \ - "*.hdi\0" \ - "T98 harddisk image files (*.THD)\0" \ - "*.thd\0" \ - "T98-Next harddisk image files (*.NHD)\0" \ - "*.nhd\0" \ - "Virtual98 harddisk image files (*.HDD)\0" \ - "*.hdd\0"; +static const TCHAR newdisk_filter[] = \ + _T("D88 image files (*.D88;*.88D)\0") \ + _T("*.d88;*.88d;*.d98;*.98d\0") \ + _T("Anex86 harddisk image files (*.HDI)\0") \ + _T("*.hdi\0") \ + _T("T98 harddisk image files (*.THD)\0") \ + _T("*.thd\0") \ + _T("T98-Next harddisk image files (*.NHD)\0") \ + _T("*.nhd\0") \ + _T("Virtual98 harddisk image files (*.HDD)\0") \ + _T("*.hdd\0"); #else -static const char newdisk_filter[] = \ - "D88 image files (*.D88;*.88D)\0" \ - "*.d88;*.88d;*.d98;*.98d\0" \ - "Anex86 harddisk image files (*.HDI)\0" \ - "*.hdi\0" \ - "T98 harddisk image files (*.THD)\0" \ - "*.thd\0" \ - "T98-Next harddisk image files (*.NHD)\0" \ - "*.nhd\0"; +static const TCHAR newdisk_filter[] = \ + _T("D88 image files (*.D88;*.88D)\0") \ + _T("*.d88;*.88d;*.d98;*.98d\0") \ + _T("Anex86 harddisk image files (*.HDI)\0") \ + _T("*.hdi\0") \ + _T("T98 harddisk image files (*.THD)\0") \ + _T("*.thd\0") \ + _T("T98-Next harddisk image files (*.NHD)\0") \ + _T("*.nhd\0"); #endif -static const FILESEL newdiskui = {newdisk_title, str_d88, newdisk_filter, 1}; +static const FILESEL newdiskui = {newdisk_title, tchar_d88, newdisk_filter, 1}; // ---- void dialog_changefdd(HWND hWnd, REG8 drv) { -const char *p; - char path[MAX_PATH]; - int readonly; +const OEMCHAR *p; + OEMCHAR path[MAX_PATH]; + int readonly; if (drv < 4) { p = fdd_diskname(drv); if ((p == NULL) || (p[0] == '\0')) { p = fddfolder; } - file_cpyname(path, p, sizeof(path)); - if (dlgs_selectfile(hWnd, &fddui, path, sizeof(path), &readonly)) { - file_cpyname(fddfolder, path, sizeof(fddfolder)); + file_cpyname(path, p, NELEMENTS(path)); + if (dlgs_selectfile(hWnd, &fddui, path, NELEMENTS(path), &readonly)) { + file_cpyname(fddfolder, path, NELEMENTS(fddfolder)); sysmng_update(SYS_UPDATEOSCFG); diskdrv_setfdd(drv, path, readonly); toolwin_setfdd(drv, path); @@ -102,23 +118,26 @@ const char *p; void dialog_changehdd(HWND hWnd, REG8 drv) { UINT num; -const char *p; +const OEMCHAR *p; const FILESEL *hddui; - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; + p = diskdrv_getsxsi(drv); num = drv & 0x0f; - p = NULL; hddui = NULL; if (!(drv & 0x20)) { // SASI/IDE if (num < 2) { - p = np2cfg.sasihdd[num]; hddui = &sasiui; } +#if defined(SUPPORT_IDEIO) + else if (num == 2) { + hddui = &isoui; + } +#endif } #if defined(SUPPORT_SCSI) else { // SCSI if (num < 4) { - p = np2cfg.scsihdd[num]; hddui = &scsiui; } } @@ -126,12 +145,12 @@ const FILESEL *hddui; if (hddui == NULL) { return; } - if (p[0] == '\0') { + if ((p == NULL) || (p[0] == '\0')) { p = hddfolder; } - file_cpyname(path, p, sizeof(path)); - if (dlgs_selectfile(hWnd, hddui, path, sizeof(path), NULL)) { - file_cpyname(hddfolder, path, sizeof(hddfolder)); + file_cpyname(path, p, NELEMENTS(path)); + if (dlgs_selectfile(hWnd, hddui, path, NELEMENTS(path), NULL)) { + file_cpyname(hddfolder, path, NELEMENTS(hddfolder)); sysmng_update(SYS_UPDATEOSCFG); diskdrv_sethdd(drv, path); } @@ -140,7 +159,7 @@ const FILESEL *hddui; // ---- newdisk -static const char str_newdisk[] = "newdisk"; +static const OEMCHAR str_newdisk[] = OEMTEXT("newdisk"); static const UINT32 hddsizetbl[5] = {20, 41, 65, 80, 128}; static const UINT16 sasires[6] = { @@ -149,7 +168,7 @@ static const UINT16 sasires[6] = { IDC_NEWSASI30MB, IDC_NEWSASI40MB}; static UINT8 makefdtype = DISKTYPE_2HD << 4; -static char disklabel[16+1]; +static OEMCHAR disklabel[16+1]; static UINT hddsize; static UINT hddminsize; static UINT hddmaxsize; @@ -158,12 +177,12 @@ static LRESULT CALLBACK NewHddDlgProc(HW WPARAM wp, LPARAM lp) { UINT val; - char work[32]; + TCHAR work[32]; switch (msg) { case WM_INITDIALOG: SETLISTUINT32(hWnd, IDC_HDDSIZE, hddsizetbl); - SPRINTF(work, "(%d-%dMB)", hddminsize, hddmaxsize); + wsprintf(work, _T("(%d-%dMB)"), hddminsize, hddmaxsize); SetWindowText(GetDlgItem(hWnd, IDC_HDDLIMIT), work); SetFocus(GetDlgItem(hWnd, IDC_HDDSIZE)); return(FALSE); @@ -172,8 +191,8 @@ static LRESULT CALLBACK NewHddDlgProc(HW switch(LOWORD(wp)) { case IDOK: GetWindowText(GetDlgItem(hWnd, IDC_HDDSIZE), - work, sizeof(work)); - val = (UINT)milstr_solveINT(work); + work, NELEMENTS(work)); + val = (UINT)miltchar_solveINT(work); if (val < hddminsize) { val = hddminsize; } @@ -251,6 +270,9 @@ static LRESULT CALLBACK NewdiskDlgProc(H WPARAM wp, LPARAM lp) { UINT16 res; +#if defined(OSLANG_UTF8) + TCHAR buf[17]; +#endif switch (msg) { case WM_INITDIALOG: @@ -274,11 +296,17 @@ static LRESULT CALLBACK NewdiskDlgProc(H case WM_COMMAND: switch(LOWORD(wp)) { case IDOK: +#if defined(OSLANG_UTF8) GetWindowText(GetDlgItem(hWnd, IDC_DISKLABEL), - disklabel, sizeof(disklabel)); - if (milstr_kanji1st(disklabel, sizeof(disklabel) - 1)) { - disklabel[sizeof(disklabel) - 1] = '\0'; + buf, NELEMENTS(buf)); + tchartooem(disklabel, NELEMENTS(disklabel), buf, -1); +#else + GetWindowText(GetDlgItem(hWnd, IDC_DISKLABEL), + disklabel, NELEMENTS(disklabel)); + if (milstr_kanji1st(disklabel, NELEMENTS(disklabel) - 1)) { + disklabel[NELEMENTS(disklabel) - 1] = '\0'; } +#endif if (GetDlgItemCheck(hWnd, IDC_MAKE2DD)) { makefdtype = (DISKTYPE_2DD << 4); } @@ -312,18 +340,18 @@ static LRESULT CALLBACK NewdiskDlgProc(H void dialog_newdisk(HWND hWnd) { - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; HINSTANCE hinst; -const char *ext; +const OEMCHAR *ext; - file_cpyname(path, fddfolder, sizeof(path)); + file_cpyname(path, fddfolder, NELEMENTS(path)); file_cutname(path); - file_catname(path, str_newdisk, sizeof(path)); + file_catname(path, str_newdisk, NELEMENTS(path)); - if (!dlgs_selectwritefile(hWnd, &newdiskui, path, sizeof(path))) { + if (!dlgs_selectwritefile(hWnd, &newdiskui, path, NELEMENTS(path))) { return; } - hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); + hinst = GetWindowInst(hWnd); ext = file_getext(path); if (!file_cmpname(ext, str_thd)) { hddsize = 0;