|
|
| version 1.2, 2003/10/21 11:22:05 | version 1.5, 2003/10/30 12:45:38 |
|---|---|
| Line 3 | Line 3 |
| #include "resource.h" | #include "resource.h" |
| #include "np2.h" | #include "np2.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "sysmng.h" | |
| #include "toolwin.h" | |
| #include "dialog.h" | #include "dialog.h" |
| #include "dialogs.h" | #include "dialogs.h" |
| #include "pccore.h" | #include "pccore.h" |
| Line 47 static const FILESEL newdiskui = {newdis | Line 49 static const FILESEL newdiskui = {newdis |
| void dialog_changefdd(HWND hWnd, BYTE drv) { | void dialog_changefdd(HWND hWnd, BYTE drv) { |
| const char *p; | const char *p; |
| char path[MAX_PATH]; | |
| int readonly; | int readonly; |
| if (drv < 4) { | if (drv < 4) { |
| p = dlgs_selectfile(hWnd, &fddui, fdd_diskname(drv), | p = fdd_diskname(drv); |
| fddfolder, sizeof(fddfolder), &readonly); | if ((p == NULL) || (p[0] == '\0')) { |
| if (p != NULL) { | p = fddfolder; |
| diskdrv_setfdd(drv, p, readonly); | } |
| file_cpyname(path, p, sizeof(path)); | |
| if (dlgs_selectfile(hWnd, &fddui, path, sizeof(path), &readonly)) { | |
| file_cpyname(fddfolder, path, sizeof(fddfolder)); | |
| sysmng_update(SYS_UPDATEOSCFG); | |
| diskdrv_setfdd(drv, path, readonly); | |
| toolwin_setfdd(drv, path); | |
| } | } |
| } | } |
| } | } |
| void dialog_changehdd(HWND hWnd, BYTE drv) { | void dialog_changehdd(HWND hWnd, BYTE drv) { |
| const char *p; | const char *p; |
| char path[MAX_PATH]; | |
| if (drv < 2) { | if (drv < 2) { |
| p = dlgs_selectfile(hWnd, &hddui, np2cfg.hddfile[drv], | p = np2cfg.hddfile[drv]; |
| hddfolder, sizeof(hddfolder), NULL); | if ((p == NULL) || (p[0] == '\0')) { |
| if (p != NULL) { | p = hddfolder; |
| diskdrv_sethdd(drv, p); | } |
| file_cpyname(path, p, sizeof(path)); | |
| if (dlgs_selectfile(hWnd, &hddui, path, sizeof(path), NULL)) { | |
| file_cpyname(hddfolder, path, sizeof(hddfolder)); | |
| sysmng_update(SYS_UPDATEOSCFG); | |
| diskdrv_sethdd(drv, path); | |
| } | } |
| } | } |
| } | } |
| Line 194 static LRESULT CALLBACK NewdiskDlgProc(H | Line 209 static LRESULT CALLBACK NewdiskDlgProc(H |
| void dialog_newdisk(HWND hWnd) { | void dialog_newdisk(HWND hWnd) { |
| char path[MAX_PATH]; | char path[MAX_PATH]; |
| const char *p; | |
| HINSTANCE hinst; | HINSTANCE hinst; |
| file_cpyname(path, fddfolder, sizeof(path)); | file_cpyname(path, fddfolder, sizeof(path)); |
| file_cutname(path); | file_cutname(path); |
| file_catname(path, str_newdisk, sizeof(path)); | file_catname(path, str_newdisk, sizeof(path)); |
| p = dlgs_selectwritefile(hWnd, &newdiskui, path, NULL, 0); | if (!dlgs_selectwritefile(hWnd, &newdiskui, path, sizeof(path))) { |
| if (p == NULL) { | |
| return; | return; |
| } | } |
| hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); |
| if (!file_cmpname(file_getext((char *)p), str_thd)) { | if (!file_cmpname(file_getext(path), str_thd)) { |
| hddsize = 0; | hddsize = 0; |
| if (DialogBox(hinst, MAKEINTRESOURCE(IDD_NEWHDDDISK), | if (DialogBox(hinst, MAKEINTRESOURCE(IDD_NEWHDDDISK), |
| hWnd, (DLGPROC)NewHddDlgProc) == IDOK) { | hWnd, (DLGPROC)NewHddDlgProc) == IDOK) { |
| newdisk_hdd(p, hddsize); // (hddsize < 5) || (hddsize > 256) | newdisk_hdd(path, hddsize); // (hddsize < 5) || (hddsize > 256) |
| } | } |
| } | } |
| else { | else { |
| if (DialogBox(hinst, | if (DialogBox(hinst, |
| MAKEINTRESOURCE(np2cfg.usefd144?IDD_NEWDISK2:IDD_NEWDISK), | MAKEINTRESOURCE(np2cfg.usefd144?IDD_NEWDISK2:IDD_NEWDISK), |
| hWnd, (DLGPROC)NewdiskDlgProc) == IDOK) { | hWnd, (DLGPROC)NewdiskDlgProc) == IDOK) { |
| newdisk_fdd(p, makefdtype, disklabel); | newdisk_fdd(path, makefdtype, disklabel); |
| } | } |
| } | } |
| } | } |