Added support for up to 4 IDE hard drives.
This commit is contained in:
parent
c84cf05dc2
commit
e10ee63a10
7 changed files with 325 additions and 18 deletions
|
|
@ -454,7 +454,7 @@ typedef struct
|
|||
int tracks;
|
||||
} PcemHDC;
|
||||
|
||||
PcemHDC hdc[2];
|
||||
PcemHDC hdc[4];
|
||||
|
||||
/*Keyboard*/
|
||||
int keybsenddelay;
|
||||
|
|
|
|||
17
src/ide.c
17
src/ide.c
|
|
@ -150,7 +150,7 @@ IDE ide_drives[4];
|
|||
|
||||
IDE *ext_ide;
|
||||
|
||||
char ide_fn[2][512];
|
||||
char ide_fn[4][512];
|
||||
|
||||
int (*ide_bus_master_read_sector)(int channel, uint8_t *data);
|
||||
int (*ide_bus_master_write_sector)(int channel, uint8_t *data);
|
||||
|
|
@ -277,9 +277,9 @@ static void ide_identify(IDE *ide)
|
|||
ide->buffer[3] = 16; /* Heads */
|
||||
ide->buffer[6] = 63; /* Sectors */
|
||||
#else
|
||||
ide->buffer[1] = hdc[cur_ide[0]].tracks; /* Cylinders */
|
||||
ide->buffer[3] = hdc[cur_ide[0]].hpc; /* Heads */
|
||||
ide->buffer[6] = hdc[cur_ide[0]].spt; /* Sectors */
|
||||
ide->buffer[1] = hdc[cur_ide[ide->board]].tracks; /* Cylinders */
|
||||
ide->buffer[3] = hdc[cur_ide[ide->board]].hpc; /* Heads */
|
||||
ide->buffer[6] = hdc[cur_ide[ide->board]].spt; /* Sectors */
|
||||
#endif
|
||||
ide_padstr((char *) (ide->buffer + 10), "", 20); /* Serial Number */
|
||||
ide_padstr((char *) (ide->buffer + 23), "v1.0", 8); /* Firmware */
|
||||
|
|
@ -301,8 +301,8 @@ static void ide_identify(IDE *ide)
|
|||
ide->buffer[60] = (65535 * 16 * 63) & 0xFFFF; /* Total addressable sectors (LBA) */
|
||||
ide->buffer[61] = (65535 * 16 * 63) >> 16;
|
||||
#else
|
||||
ide->buffer[60] = (hdc[cur_ide[0]].tracks * hdc[cur_ide[0]].hpc * hdc[cur_ide[0]].spt) & 0xFFFF; /* Total addressable sectors (LBA) */
|
||||
ide->buffer[61] = (hdc[cur_ide[0]].tracks * hdc[cur_ide[0]].hpc * hdc[cur_ide[0]].spt) >> 16;
|
||||
ide->buffer[60] = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt) & 0xFFFF; /* Total addressable sectors (LBA) */
|
||||
ide->buffer[61] = (hdc[cur_ide[ide->board]].tracks * hdc[cur_ide[ide->board]].hpc * hdc[cur_ide[ide->board]].spt) >> 16;
|
||||
#endif
|
||||
ide->buffer[63] = 7; /*Multiword DMA*/
|
||||
ide->buffer[80] = 0xe; /*ATA-1 to ATA-3 supported*/
|
||||
|
|
@ -565,8 +565,11 @@ void resetide(void)
|
|||
#else
|
||||
loadhd(&ide_drives[0], 0, ide_fn[0]);
|
||||
loadhd(&ide_drives[1], 1, ide_fn[1]);
|
||||
loadhd(&ide_drives[2], 2, ide_fn[2]);
|
||||
if (cdrom_enabled)
|
||||
ide_drives[2].type = IDE_CDROM;
|
||||
ide_drives[3].type = IDE_CDROM;
|
||||
else
|
||||
loadhd(&ide_drives[3], 3, ide_fn[3]);
|
||||
#endif
|
||||
|
||||
cur_ide[0] = 0;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ extern int ideboard;
|
|||
|
||||
extern int idecallback[2];
|
||||
|
||||
extern char ide_fn[2][512];
|
||||
extern char ide_fn[4][512];
|
||||
|
||||
#endif //__IDE__
|
||||
|
|
|
|||
20
src/pc.c
20
src/pc.c
|
|
@ -539,6 +539,18 @@ void loadconfig(char *fn)
|
|||
p = (char *)config_get_string(NULL, "hdd_fn", "");
|
||||
if (p) strcpy(ide_fn[1], p);
|
||||
else strcpy(ide_fn[1], "");
|
||||
hdc[2].spt = config_get_int(NULL, "hde_sectors", 0);
|
||||
hdc[2].hpc = config_get_int(NULL, "hde_heads", 0);
|
||||
hdc[2].tracks = config_get_int(NULL, "hde_cylinders", 0);
|
||||
p = (char *)config_get_string(NULL, "hde_fn", "");
|
||||
if (p) strcpy(ide_fn[2], p);
|
||||
else strcpy(ide_fn[2], "");
|
||||
hdc[3].spt = config_get_int(NULL, "hdf_sectors", 0);
|
||||
hdc[3].hpc = config_get_int(NULL, "hdf_heads", 0);
|
||||
hdc[3].tracks = config_get_int(NULL, "hdf_cylinders", 0);
|
||||
p = (char *)config_get_string(NULL, "hdf_fn", "");
|
||||
if (p) strcpy(ide_fn[3], p);
|
||||
else strcpy(ide_fn[3], "");
|
||||
}
|
||||
|
||||
void saveconfig()
|
||||
|
|
@ -578,6 +590,14 @@ void saveconfig()
|
|||
config_set_int(NULL, "hdd_heads", hdc[1].hpc);
|
||||
config_set_int(NULL, "hdd_cylinders", hdc[1].tracks);
|
||||
config_set_string(NULL, "hdd_fn", ide_fn[1]);
|
||||
config_set_int(NULL, "hde_sectors", hdc[2].spt);
|
||||
config_set_int(NULL, "hde_heads", hdc[2].hpc);
|
||||
config_set_int(NULL, "hde_cylinders", hdc[2].tracks);
|
||||
config_set_string(NULL, "hde_fn", ide_fn[2]);
|
||||
config_set_int(NULL, "hdf_sectors", hdc[3].spt);
|
||||
config_set_int(NULL, "hdf_heads", hdc[3].hpc);
|
||||
config_set_int(NULL, "hdf_cylinders", hdc[3].tracks);
|
||||
config_set_string(NULL, "hdf_fn", ide_fn[3]);
|
||||
|
||||
config_save(config_file_default);
|
||||
}
|
||||
|
|
|
|||
34
src/pc.rc
34
src/pc.rc
|
|
@ -86,13 +86,13 @@ BEGIN
|
|||
LTEXT "Memory :",IDC_STATIC,15,156,40,10
|
||||
END
|
||||
|
||||
HdConfDlg DIALOGEX 0, 0, 210, 172
|
||||
HdConfDlg DIALOGEX 0, 0, 210, 312
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Configure Hard Discs"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,31+12,152,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,101+12,152,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,31+12,292,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,101+12,292,50,14
|
||||
|
||||
LTEXT "C:",IDC_STATIC,7,6,27,10
|
||||
EDITTEXT IDC_EDIT_C_FN, 7, 22, 136, 12, WS_DISABLED
|
||||
|
|
@ -121,6 +121,34 @@ BEGIN
|
|||
LTEXT "Heads:",IDC_STATIC,63,108,29,8
|
||||
LTEXT "Cylinders:",IDC_STATIC,120,108,32,12
|
||||
LTEXT "", IDC_TEXT_D_SIZE, 7, 124, 136, 12
|
||||
|
||||
LTEXT "E:",IDC_STATIC,7,146,27,10
|
||||
EDITTEXT IDC_EDIT_E_FN, 7, 162, 136, 12, WS_DISABLED
|
||||
PUSHBUTTON "...",IDC_EFILE,7 + 136, 162, 16, 14
|
||||
PUSHBUTTON "New",IDC_ENEW,7 + 136 + 16, 162, 24, 14
|
||||
PUSHBUTTON "Eject", IDC_EJECTE, 7 + 136 + 16 + 24, 162, 24, 14
|
||||
|
||||
EDITTEXT IDC_EDIT_E_SPT,36,178,16,12, WS_DISABLED
|
||||
EDITTEXT IDC_EDIT_E_HPC,94,178,16,12, WS_DISABLED
|
||||
EDITTEXT IDC_EDIT_E_CYL,152,178,28,12, WS_DISABLED
|
||||
LTEXT "Sectors:",IDC_STATIC,7,178,27,10
|
||||
LTEXT "Heads:",IDC_STATIC,63,178,29,8
|
||||
LTEXT "Cylinders:",IDC_STATIC,120,178,32,12
|
||||
LTEXT "", IDC_TEXT_E_SIZE, 7, 194, 136, 12
|
||||
|
||||
LTEXT "F:",IDC_STATIC,7,216,27,10
|
||||
EDITTEXT IDC_EDIT_F_FN, 7, 232, 136, 12, WS_DISABLED
|
||||
PUSHBUTTON "...",IDC_FFILE,7 + 136, 232, 16, 14
|
||||
PUSHBUTTON "New",IDC_FNEW,7 + 136 + 16, 232, 24, 14
|
||||
PUSHBUTTON "Eject", IDC_EJECTF, 7 + 136 + 16 + 24, 232, 24, 14
|
||||
|
||||
EDITTEXT IDC_EDIT_F_SPT,36,248,16,12, WS_DISABLED
|
||||
EDITTEXT IDC_EDIT_F_HPC,94,248,16,12, WS_DISABLED
|
||||
EDITTEXT IDC_EDIT_F_CYL,152,248,28,12, WS_DISABLED
|
||||
LTEXT "Sectors:",IDC_STATIC,7,248,27,10
|
||||
LTEXT "Heads:",IDC_STATIC,63,248,29,8
|
||||
LTEXT "Cylinders:",IDC_STATIC,120,248,32,12
|
||||
LTEXT "", IDC_TEXT_F_SIZE, 7, 264, 136, 12
|
||||
|
||||
END
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,14 @@
|
|||
#define IDC_DNEW 1055
|
||||
#define IDC_EJECTC 1056
|
||||
#define IDC_EJECTD 1057
|
||||
#define IDC_EDITE 1058
|
||||
#define IDC_EFILE 1059
|
||||
#define IDC_ENEW 1060
|
||||
#define IDC_EDITF 1061
|
||||
#define IDC_FFILE 1062
|
||||
#define IDC_FNEW 1063
|
||||
#define IDC_EJECTE 1064
|
||||
#define IDC_EJECTF 1065
|
||||
#define IDC_MEMSPIN 1070
|
||||
#define IDC_MEMTEXT 1071
|
||||
#define IDC_STEXT1 1100
|
||||
|
|
@ -76,10 +84,20 @@
|
|||
#define IDC_EDIT_D_SPT 1203
|
||||
#define IDC_EDIT_D_HPC 1204
|
||||
#define IDC_EDIT_D_CYL 1205
|
||||
#define IDC_TEXT_C_SIZE 1210
|
||||
#define IDC_TEXT_D_SIZE 1211
|
||||
#define IDC_EDIT_C_FN 1220
|
||||
#define IDC_EDIT_D_FN 1221
|
||||
#define IDC_EDIT_E_SPT 1206
|
||||
#define IDC_EDIT_E_HPC 1207
|
||||
#define IDC_EDIT_E_CYL 1208
|
||||
#define IDC_EDIT_F_SPT 1209
|
||||
#define IDC_EDIT_F_HPC 1210
|
||||
#define IDC_EDIT_F_CYL 1211
|
||||
#define IDC_TEXT_C_SIZE 1220
|
||||
#define IDC_TEXT_D_SIZE 1221
|
||||
#define IDC_TEXT_E_SIZE 1222
|
||||
#define IDC_TEXT_F_SIZE 1223
|
||||
#define IDC_EDIT_C_FN 1230
|
||||
#define IDC_EDIT_D_FN 1231
|
||||
#define IDC_EDIT_E_FN 1232
|
||||
#define IDC_EDIT_F_FN 1233
|
||||
|
||||
#define IDC_CONFIGUREVID 1200
|
||||
#define IDC_CONFIGURESND 1201
|
||||
|
|
|
|||
242
src/win-hdconf.c
242
src/win-hdconf.c
|
|
@ -18,7 +18,7 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA
|
|||
char s[260];
|
||||
HWND h;
|
||||
int c;
|
||||
PcemHDC hd[2];
|
||||
PcemHDC hd[4];
|
||||
FILE *f;
|
||||
uint8_t buf[512];
|
||||
switch (message)
|
||||
|
|
@ -213,7 +213,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
{
|
||||
char s[260];
|
||||
HWND h;
|
||||
PcemHDC hd[2];
|
||||
PcemHDC hd[4];
|
||||
FILE *f;
|
||||
off64_t sz;
|
||||
switch (message)
|
||||
|
|
@ -222,6 +222,8 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
pause = 1;
|
||||
hd[0] = hdc[0];
|
||||
hd[1] = hdc[1];
|
||||
hd[2] = hdc[2];
|
||||
hd[3] = hdc[3];
|
||||
hd_changed = 0;
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_C_SPT);
|
||||
|
|
@ -248,6 +250,30 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
h= GetDlgItem(hdlg, IDC_EDIT_D_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[1]);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_SPT);
|
||||
sprintf(s, "%i", hdc[2].spt);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_HPC);
|
||||
sprintf(s, "%i", hdc[2].hpc);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_CYL);
|
||||
sprintf(s, "%i", hdc[2].tracks);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h= GetDlgItem(hdlg, IDC_EDIT_E_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[2]);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_SPT);
|
||||
sprintf(s, "%i", hdc[3].spt);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_HPC);
|
||||
sprintf(s, "%i", hdc[3].hpc);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_CYL);
|
||||
sprintf(s, "%i", hdc[3].tracks);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h= GetDlgItem(hdlg, IDC_EDIT_F_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)ide_fn[3]);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_C_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd[0].tracks*(uint64_t)hd[0].hpc)*(uint64_t)hd[0].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
|
@ -255,6 +281,14 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
h = GetDlgItem(hdlg, IDC_TEXT_D_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd[1].tracks*(uint64_t)hd[1].hpc)*(uint64_t)hd[1].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_E_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd[2].tracks*(uint64_t)hd[2].hpc)*(uint64_t)hd[2].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_F_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd[3].tracks*(uint64_t)hd[3].hpc)*(uint64_t)hd[3].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
|
@ -289,8 +323,34 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
h = GetDlgItem(hdlg, IDC_EDIT_D_FN);
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[1]);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_SPT);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[2].spt);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_HPC);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[2].hpc);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_CYL);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[2].tracks);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_FN);
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[2]);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_SPT);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[3].spt);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_HPC);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[3].hpc);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_CYL);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[3].tracks);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_FN);
|
||||
SendMessage(h, WM_GETTEXT, 511, (LPARAM)ide_fn[3]);
|
||||
|
||||
hdc[0] = hd[0];
|
||||
hdc[1] = hd[1];
|
||||
hdc[2] = hd[2];
|
||||
hdc[3] = hd[3];
|
||||
|
||||
saveconfig();
|
||||
|
||||
|
|
@ -324,6 +384,28 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
SetDlgItemText(hdlg, IDC_EDIT_D_FN, "");
|
||||
hd_changed = 1;
|
||||
return TRUE;
|
||||
case IDC_EJECTE:
|
||||
hd[2].spt = 0;
|
||||
hd[2].hpc = 0;
|
||||
hd[2].tracks = 0;
|
||||
ide_fn[2][0] = 0;
|
||||
SetDlgItemText(hdlg, IDC_EDIT_E_SPT, "0");
|
||||
SetDlgItemText(hdlg, IDC_EDIT_E_HPC, "0");
|
||||
SetDlgItemText(hdlg, IDC_EDIT_E_CYL, "0");
|
||||
SetDlgItemText(hdlg, IDC_EDIT_E_FN, "");
|
||||
hd_changed = 1;
|
||||
return TRUE;
|
||||
case IDC_EJECTF:
|
||||
hd[3].spt = 0;
|
||||
hd[3].hpc = 0;
|
||||
hd[3].tracks = 0;
|
||||
ide_fn[3][0] = 0;
|
||||
SetDlgItemText(hdlg, IDC_EDIT_F_SPT, "0");
|
||||
SetDlgItemText(hdlg, IDC_EDIT_F_HPC, "0");
|
||||
SetDlgItemText(hdlg, IDC_EDIT_F_CYL, "0");
|
||||
SetDlgItemText(hdlg, IDC_EDIT_F_FN, "");
|
||||
hd_changed = 1;
|
||||
return TRUE;
|
||||
|
||||
case IDC_CNEW:
|
||||
if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1)
|
||||
|
|
@ -449,6 +531,130 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
return TRUE;
|
||||
|
||||
case IDC_ENEW:
|
||||
if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1)
|
||||
{
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_SPT);
|
||||
sprintf(s, "%i", hd_new_spt);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_HPC);
|
||||
sprintf(s, "%i", hd_new_hpc);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_CYL);
|
||||
sprintf(s, "%i", hd_new_cyl);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name);
|
||||
|
||||
h= GetDlgItem(hdlg, IDC_TEXT_E_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
||||
hd_changed = 1;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDC_EFILE:
|
||||
if (!getfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", ""))
|
||||
{
|
||||
f = fopen64(openfilestring, "rb");
|
||||
if (!f)
|
||||
{
|
||||
MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK);
|
||||
return TRUE;
|
||||
}
|
||||
fseeko64(f, -1, SEEK_END);
|
||||
sz = ftello64(f) + 1;
|
||||
fclose(f);
|
||||
hd_new_spt = 63;
|
||||
hd_new_hpc = 16;
|
||||
hd_new_cyl = ((sz / 512) / 16) / 63;
|
||||
|
||||
if (DialogBox(hinstance, TEXT("HdSizeDlg"), hdlg, hdsize_dlgproc) == 1)
|
||||
{
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_SPT);
|
||||
sprintf(s, "%i", hd_new_spt);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_HPC);
|
||||
sprintf(s, "%i", hd_new_hpc);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_CYL);
|
||||
sprintf(s, "%i", hd_new_cyl);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_E_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
||||
hd_changed = 1;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDC_FNEW:
|
||||
if (DialogBox(hinstance, TEXT("HdNewDlg"), hdlg, hdnew_dlgproc) == 1)
|
||||
{
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_SPT);
|
||||
sprintf(s, "%i", hd_new_spt);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_HPC);
|
||||
sprintf(s, "%i", hd_new_hpc);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_CYL);
|
||||
sprintf(s, "%i", hd_new_cyl);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)hd_new_name);
|
||||
|
||||
h= GetDlgItem(hdlg, IDC_TEXT_F_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
||||
hd_changed = 1;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDC_FFILE:
|
||||
if (!getfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", ""))
|
||||
{
|
||||
f = fopen64(openfilestring, "rb");
|
||||
if (!f)
|
||||
{
|
||||
MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK);
|
||||
return TRUE;
|
||||
}
|
||||
fseeko64(f, -1, SEEK_END);
|
||||
sz = ftello64(f) + 1;
|
||||
fclose(f);
|
||||
hd_new_spt = 63;
|
||||
hd_new_hpc = 16;
|
||||
hd_new_cyl = ((sz / 512) / 16) / 63;
|
||||
|
||||
if (DialogBox(hinstance, TEXT("HdSizeDlg"), hdlg, hdsize_dlgproc) == 1)
|
||||
{
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_SPT);
|
||||
sprintf(s, "%i", hd_new_spt);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_HPC);
|
||||
sprintf(s, "%i", hd_new_hpc);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_CYL);
|
||||
sprintf(s, "%i", hd_new_cyl);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_FN);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_F_SIZE);
|
||||
sprintf(s, "Size : %imb", (((((uint64_t)hd_new_cyl*(uint64_t)hd_new_hpc)*(uint64_t)hd_new_spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
|
||||
hd_changed = 1;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDC_EDIT_C_SPT: case IDC_EDIT_C_HPC: case IDC_EDIT_C_CYL:
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_C_SPT);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
|
|
@ -480,6 +686,38 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR
|
|||
sprintf(s, "Size : %imb", ((((hd[1].tracks*hd[1].hpc)*hd[1].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
return TRUE;
|
||||
|
||||
case IDC_EDIT_E_SPT: case IDC_EDIT_E_HPC: case IDC_EDIT_E_CYL:
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_SPT);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[2].spt);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_HPC);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[2].hpc);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_E_CYL);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[2].tracks);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_E_SIZE);
|
||||
sprintf(s, "Size : %imb", ((((hd[2].tracks*hd[2].hpc)*hd[2].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
return TRUE;
|
||||
|
||||
case IDC_EDIT_F_SPT: case IDC_EDIT_F_HPC: case IDC_EDIT_F_CYL:
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_SPT);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[3].spt);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_HPC);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[3].hpc);
|
||||
h = GetDlgItem(hdlg, IDC_EDIT_F_CYL);
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM)s);
|
||||
sscanf(s, "%i", &hd[3].tracks);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_TEXT_F_SIZE);
|
||||
sprintf(s, "Size : %imb", ((((hd[3].tracks*hd[3].hpc)*hd[3].spt)*512)/1024)/1024);
|
||||
SendMessage(h, WM_SETTEXT, 0, (LPARAM)s);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue