Some tweaks to hard disk image creation.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Main include file for the application.
|
* Main include file for the application.
|
||||||
*
|
*
|
||||||
* Version: @(#)86box.h 1.0.20 2018/03/18
|
* Version: @(#)86box.h 1.0.21 2018/03/19
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -134,6 +134,7 @@ extern int config_changed; /* config has changed */
|
|||||||
#ifdef HAVE_STDARG_H
|
#ifdef HAVE_STDARG_H
|
||||||
extern void pclog_ex(const char *fmt, va_list);
|
extern void pclog_ex(const char *fmt, va_list);
|
||||||
#endif
|
#endif
|
||||||
|
extern void pclog_toggle_suppr(void);
|
||||||
extern void pclog(const char *fmt, ...);
|
extern void pclog(const char *fmt, ...);
|
||||||
extern void fatal(const char *fmt, ...);
|
extern void fatal(const char *fmt, ...);
|
||||||
extern void set_screen_size(int x, int y);
|
extern void set_screen_size(int x, int y);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Handling of hard disk image files.
|
* Handling of hard disk image files.
|
||||||
*
|
*
|
||||||
* Version: @(#)hdd_image.c 1.0.12 2018/02/08
|
* Version: @(#)hdd_image.c 1.0.13 2018/03/19
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -288,29 +288,29 @@ int hdd_image_load(int id)
|
|||||||
if (ftello64(hdd_images[id].file) < (full_size + hdd_images[id].base)) {
|
if (ftello64(hdd_images[id].file) < (full_size + hdd_images[id].base)) {
|
||||||
s = (full_size + hdd_images[id].base) - ftello64(hdd_images[id].file);
|
s = (full_size + hdd_images[id].base) - ftello64(hdd_images[id].file);
|
||||||
prepare_new_hard_disk:
|
prepare_new_hard_disk:
|
||||||
s >>= 9;
|
t = s >> 20; /* Amount of 1 MB blocks. */
|
||||||
t = (s >> 11) << 11;
|
s &= 0xfffff; /* 1 MB mask. */
|
||||||
s -= t;
|
|
||||||
t >>= 11;
|
|
||||||
|
|
||||||
empty_sector_1mb = (char *) malloc(1048576);
|
empty_sector_1mb = (char *) malloc(1048576);
|
||||||
memset(empty_sector_1mb, 0, 1048576);
|
memset(empty_sector_1mb, 0, 1048576);
|
||||||
|
|
||||||
|
/* Temporarily switch off suppression of seen messages so that the
|
||||||
|
progress gets displayed. */
|
||||||
|
pclog_toggle_suppr();
|
||||||
pclog("Writing image sectors: [");
|
pclog("Writing image sectors: [");
|
||||||
if (s > 0) {
|
|
||||||
for (i = 0; i < s; i++) {
|
/* First, write all the 1 MB blocks. */
|
||||||
|
if (t > 0) {
|
||||||
|
for (i = 0; i < t; i++) {
|
||||||
|
fwrite(empty_sector_1mb, 1, 1045876, hdd_images[id].file);
|
||||||
pclog("#");
|
pclog("#");
|
||||||
fwrite(empty_sector, 1, 512, hdd_images[id].file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t > 0) {
|
/* Then, write the remainder. */
|
||||||
for (i = 0; i < t; i++) {
|
fwrite(empty_sector_1mb, 1, s, hdd_images[id].file);
|
||||||
pclog("#");
|
pclog("#]\n");
|
||||||
fwrite(empty_sector_1mb, 1, 1045876, hdd_images[id].file);
|
pclog_toggle_suppr();
|
||||||
}
|
|
||||||
}
|
|
||||||
pclog("]\n");
|
|
||||||
|
|
||||||
free(empty_sector_1mb);
|
free(empty_sector_1mb);
|
||||||
}
|
}
|
||||||
|
19
src/pc.c
19
src/pc.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Main emulator module where most things are controlled.
|
* Main emulator module where most things are controlled.
|
||||||
*
|
*
|
||||||
* Version: @(#)pc.c 1.0.67 2018/03/19
|
* Version: @(#)pc.c 1.0.68 2018/03/19
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -170,9 +170,13 @@ int unscaled_size_x = SCREEN_RES_X, /* current unscaled size X */
|
|||||||
efscrnsz_y = SCREEN_RES_Y;
|
efscrnsz_y = SCREEN_RES_Y;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef RELEASE_BUILD
|
||||||
static char buff[1024];
|
static char buff[1024];
|
||||||
static int seen = 0;
|
static int seen = 0;
|
||||||
|
|
||||||
|
static int suppr_seen = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Log something to the logfile or stdout.
|
* Log something to the logfile or stdout.
|
||||||
*
|
*
|
||||||
@@ -197,10 +201,10 @@ pclog_ex(const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vsprintf(temp, fmt, ap);
|
vsprintf(temp, fmt, ap);
|
||||||
if (! strcmp(buff, temp)) {
|
if (suppr_seen && ! strcmp(buff, temp)) {
|
||||||
seen++;
|
seen++;
|
||||||
} else {
|
} else {
|
||||||
if (seen) {
|
if (suppr_seen && seen) {
|
||||||
fprintf(stdlog, "*** %d repeats ***\n", seen);
|
fprintf(stdlog, "*** %d repeats ***\n", seen);
|
||||||
}
|
}
|
||||||
seen = 0;
|
seen = 0;
|
||||||
@@ -213,6 +217,15 @@ pclog_ex(const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
pclog_toggle_suppr(void)
|
||||||
|
{
|
||||||
|
#ifndef RELEASE_BUILD
|
||||||
|
suppr_seen ^= 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Log something. We only do this in non-release builds. */
|
/* Log something. We only do this in non-release builds. */
|
||||||
void
|
void
|
||||||
pclog(const char *fmt, ...)
|
pclog(const char *fmt, ...)
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Windows 86Box Settings dialog handler.
|
* Windows 86Box Settings dialog handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings.c 1.0.45 2018/03/19
|
* Version: @(#)win_settings.c 1.0.46 2018/03/19
|
||||||
*
|
*
|
||||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -2986,10 +2986,9 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, 512);
|
memset(buf, 0, 512);
|
||||||
size >>= 9;
|
|
||||||
r = (size >> 11) << 11;
|
r = size >> 20;
|
||||||
size -= r;
|
size &= 0xfffff;
|
||||||
r >>= 11;
|
|
||||||
|
|
||||||
if (size || r) {
|
if (size || r) {
|
||||||
h = GetDlgItem(hdlg, IDT_1731);
|
h = GetDlgItem(hdlg, IDT_1731);
|
||||||
@@ -3005,10 +3004,10 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
|
|||||||
ShowWindow(h, SW_HIDE);
|
ShowWindow(h, SW_HIDE);
|
||||||
|
|
||||||
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
|
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);
|
EnableWindow(h, TRUE);
|
||||||
ShowWindow(h, SW_SHOW);
|
ShowWindow(h, SW_SHOW);
|
||||||
|
SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) r);
|
||||||
|
SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0);
|
||||||
|
|
||||||
h = GetDlgItem(hdlg, IDT_1752);
|
h = GetDlgItem(hdlg, IDT_1752);
|
||||||
EnableWindow(h, TRUE);
|
EnableWindow(h, TRUE);
|
||||||
@@ -3017,11 +3016,8 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
for (i = 0; i < size; i++)
|
fwrite(buf, 1, size, f);
|
||||||
{
|
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
|
||||||
fwrite(buf, 1, 512, f);
|
|
||||||
SendMessage(h, PBM_SETPOS, (WPARAM) i, (LPARAM) 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
@@ -3031,7 +3027,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
|
|||||||
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 + i), (LPARAM) 0);
|
SendMessage(h, PBM_SETPOS, (WPARAM) (size + 1), (LPARAM) 0);
|
||||||
}
|
}
|
||||||
free(big_buf);
|
free(big_buf);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user