Adding the hard disk image now shows a progress bar indicating progress so that the end user is no longer left with a non-responding dialog and no idea what's going on.

This commit is contained in:
OBattler
2018-01-24 20:58:39 +01:00
parent 07609adf4c
commit 47d6e815b6
4 changed files with 51 additions and 9 deletions

View File

@@ -8,15 +8,13 @@
*
* Handling of hard disk image files.
*
* Version: @(#)hdd_image.c 1.0.9 2017/12/09
* Version: @(#)hdd_image.c 1.0.10 2018/01/24
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
@@ -354,10 +352,12 @@ prepare_new_hard_disk:
empty_sector_1mb = (char *) malloc(1048576);
memset(empty_sector_1mb, 0, 1048576);
pclog("Writing image sectors: [");
if (s > 0)
{
for (i = 0; i < s; i++)
{
pclog("#");
fwrite(empty_sector, 1, 512, hdd_images[id].file);
}
}
@@ -366,9 +366,11 @@ prepare_new_hard_disk:
{
for (i = 0; i < t; i++)
{
pclog("#");
fwrite(empty_sector_1mb, 1, 1045876, hdd_images[id].file);
}
}
pclog("]\n");
free(empty_sector_1mb);
}

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.24 2018/01/19
* Version: @(#)86Box.rc 1.0.25 2018/01/24
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -516,6 +516,9 @@ BEGIN
LTEXT "LUN:",IDT_1724,168,72,15,8
COMBOBOX IDC_COMBO_HD_CHANNEL_IDE,134,71,77,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Progress:",IDT_1752,7,7,204,9
CONTROL "IMGCreateProgress",IDC_PBAR_IMG_CREATE,"msctls_progress32",PBS_SMOOTH |
WS_BORDER,7,16,204,12
END
DLG_CFG_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 202

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.17 2018/01/18
* Version: @(#)resource.h 1.0.18 2018/01/24
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -85,6 +85,7 @@
#define IDT_1749 1749 /* File name: */
#define IDT_1750 1750 /* Disk size: */
#define IDT_1751 1751 /* RPM mode: */
#define IDT_1752 1752 /* Progress: */
/*
@@ -170,6 +171,7 @@
#define IDC_EDIT_HD_CYL 1143
#define IDC_EDIT_HD_SIZE 1144
#define IDC_COMBO_HD_TYPE 1145
#define IDC_PBAR_IMG_CREATE 1146
#define IDC_REMOV_DEVICES 1150 /* removable dev config */
#define IDC_LIST_FLOPPY_DRIVES 1151

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.32 2018/01/24
* Version: @(#)win_settings.c 1.0.33 2018/01/24
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -2807,6 +2807,15 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
}
h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME);
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDT_1752);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
no_update = 0;
return TRUE;
@@ -2939,11 +2948,36 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
size -= r;
r >>= 11;
if (size || r) {
h = GetDlgItem(hdlg, IDT_1731);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_CFILE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) (size + r - 1));
SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0);
EnableWindow(h, TRUE);
ShowWindow(h, SW_SHOW);
h = GetDlgItem(hdlg, IDT_1752);
EnableWindow(h, TRUE);
ShowWindow(h, SW_SHOW);
}
if (size)
{
for (i = 0; i < size; i++)
{
fwrite(buf, 1, 512, f);
SendMessage(h, PBM_SETPOS, (WPARAM) i, (LPARAM) 0);
}
}
@@ -2954,6 +2988,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
for (i = 0; i < r; i++)
{
fwrite(big_buf, 1, 1048576, f);
SendMessage(h, PBM_SETPOS, (WPARAM) (size + i), (LPARAM) 0);
}
free(big_buf);
}