Applied Ryuzaki's fixes for the New Floppy/ZIP Image and Settings dialog progress bars, those now work correctly.

This commit is contained in:
OBattler
2019-11-19 04:52:24 +01:00
parent 26009044d7
commit 4d39da9cfe
2 changed files with 23 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
* *
* Handle the New Floppy Image dialog. * Handle the New Floppy Image dialog.
* *
* Version: @(#)win_new_floppy.c 1.0.12 2019/10/22 * Version: @(#)win_new_floppy.c 1.0.13 2019/11/19
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* *
@@ -302,6 +302,7 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi,
uint16_t base = 0x1000; uint16_t base = 0x1000;
uint32_t pbar_max = 0; uint32_t pbar_max = 0;
uint32_t i; uint32_t i;
MSG msg;
f = plat_fopen(file_name, L"wb"); f = plat_fopen(file_name, L"wb");
if (!f) if (!f)
@@ -496,6 +497,11 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi,
for (i = 0; i < pbar_max; i++) { for (i = 0; i < pbar_max; i++) {
fwrite(&empty[i << 11], 1, 2048, f); fwrite(&empty[i << 11], 1, 2048, f);
SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} }
free(empty); free(empty);

View File

@@ -8,7 +8,7 @@
* *
* Windows 86Box Settings dialog handler. * Windows 86Box Settings dialog handler.
* *
* Version: @(#)win_settings.c 1.0.60 2019/11/02 * Version: @(#)win_settings.c 1.0.61 2019/11/19
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* David Hrdlička, <hrdlickadavid@outlook.com> * David Hrdlička, <hrdlickadavid@outlook.com>
@@ -2515,6 +2515,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
uint8_t id = 0; uint8_t id = 0;
wchar_t *twcs; wchar_t *twcs;
vhd_footer_t *vft = NULL; vhd_footer_t *vft = NULL;
MSG msg;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
@@ -2672,7 +2673,8 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
fwrite(&zero, 1, 4, f); /* 00000004: [Translation] Heads per cylinder */ fwrite(&zero, 1, 4, f); /* 00000004: [Translation] Heads per cylinder */
} }
memset(buf, 0, 512); big_buf = (char *) malloc(1048576);
memset(big_buf, 0, 1048576);
temp_size = size; temp_size = size;
@@ -2703,19 +2705,23 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
ShowWindow(h, SW_SHOW); ShowWindow(h, SW_SHOW);
} }
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
if (size) { if (size) {
fwrite(buf, 1, size, f); fwrite(big_buf, 1, size, f);
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
} }
if (r) { if (r) {
big_buf = (char *) malloc(1048576);
memset(big_buf, 0, 1048576);
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
fwrite(big_buf, 1, 1048576, f); fwrite(big_buf, 1, 1048576, f);
SendMessage(h, PBM_SETPOS, (WPARAM) (size + 1), (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) (size + 1), (LPARAM) 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} }
free(big_buf);
} }
if (image_is_vhd(hd_file_name, 0)) { if (image_is_vhd(hd_file_name, 0)) {
@@ -2727,14 +2733,14 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
vft->geom.heads = hpc; vft->geom.heads = hpc;
vft->geom.spt = spt; vft->geom.spt = spt;
generate_vhd_checksum(vft); generate_vhd_checksum(vft);
memset(buf, 0, 512); vhd_footer_to_bytes((uint8_t *) big_buf, vft);
vhd_footer_to_bytes((uint8_t *) buf, vft); fwrite(big_buf, 1, 512, f);
fwrite(buf, 1, 512, f);
memset(buf, 0, 512);
free(vft); free(vft);
vft = NULL; vft = NULL;
} }
free(big_buf);
fclose(f); fclose(f);
settings_msgbox(MBX_INFO, (wchar_t *)IDS_4113); settings_msgbox(MBX_INFO, (wchar_t *)IDS_4113);
} }