Added Iomega ZIP emulation.

This commit is contained in:
OBattler
2018-01-26 22:17:09 +01:00
parent 45e55a7163
commit 410ecb1f22
28 changed files with 5050 additions and 405 deletions

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.25 2018/01/24
* Version: @(#)86Box.rc 1.0.26 2018/01/23
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -272,22 +272,25 @@ BEGIN
COMBOBOX IDC_COMBO_RPM_MODE,53,45,166,14,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_CFILE,206,5,13,14
LTEXT "Progress:",IDT_1757,7,45,44,12,SS_CENTERIMAGE
CONTROL "IMGCreateProgress",IDC_PBAR_IMG_CREATE,"msctls_progress32",PBS_SMOOTH |
WS_BORDER,53,45,166,14
END
DLG_CONFIG DIALOG DISCARDABLE 0, 0, 366, 241
DLG_CONFIG DIALOG DISCARDABLE 0, 0, 366, 251
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "86Box Settings"
FONT 9, "Segoe UI"
BEGIN
DEFPUSHBUTTON "OK",IDOK,246,220,50,14
PUSHBUTTON "Cancel",IDCANCEL,307,220,50,14
DEFPUSHBUTTON "OK",IDOK,246,230,50,14
PUSHBUTTON "Cancel",IDCANCEL,307,230,50,14
CONTROL "List2",IDC_SETTINGSCATLIST,"SysListView32",LVS_LIST |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,90,197
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,211,363,1
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,90,207
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,221,363,1
/* Leave this commented out until we get into localization. */
#if 0
LTEXT "Language:",IDT_1700,7,222,41,10
COMBOBOX IDC_COMBO_LANG,48,221,108,120,CBS_DROPDOWN | WS_VSCROLL |
LTEXT "Language:",IDT_1700,7,232,41,10
COMBOBOX IDC_COMBO_LANG,48,231,108,120,CBS_DROPDOWN | WS_VSCROLL |
WS_TABSTOP
#endif
END
@@ -521,7 +524,7 @@ BEGIN
WS_BORDER,7,16,204,12
END
DLG_CFG_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 202
DLG_CFG_FLOPPY_DRIVES DIALOG DISCARDABLE 97, 0, 267, 103
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -536,22 +539,46 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,131,86,64,10
CONTROL "Check BPB",IDC_CHECKBPB,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,196,86,64,10
END
DLG_CFG_OTHER_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 221
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
CONTROL "List1",IDC_LIST_CDROM_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,116,253,60
LTEXT "CD-ROM drives:",IDT_1739,7,106,50,8
COMBOBOX IDC_COMBO_CD_BUS,33,183,90,12,CBS_DROPDOWNLIST |
WS_TABSTOP,7,18,253,60
LTEXT "CD-ROM drives:",IDT_1739,7,7,50,8
COMBOBOX IDC_COMBO_CD_BUS,33,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1740,7,184,24,8
COMBOBOX IDC_COMBO_CD_ID,170,183,22,12,CBS_DROPDOWNLIST |
LTEXT "Bus:",IDT_1740,7,86,24,8
COMBOBOX IDC_COMBO_CD_ID,170,85,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "ID:",IDT_1741,131,184,38,8
COMBOBOX IDC_COMBO_CD_LUN,239,183,22,12,CBS_DROPDOWNLIST |
LTEXT "ID:",IDT_1741,131,86,38,8
COMBOBOX IDC_COMBO_CD_LUN,239,85,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LUN:",IDT_1742,200,184,38,8
COMBOBOX IDC_COMBO_CD_CHANNEL_IDE,170,183,90,12,CBS_DROPDOWNLIST |
LTEXT "LUN:",IDT_1742,200,86,38,8
COMBOBOX IDC_COMBO_CD_CHANNEL_IDE,170,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Channel:",IDT_1743,131,184,38,8
LTEXT "Channel:",IDT_1743,131,86,38,8
CONTROL "List1",IDC_LIST_ZIP_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,117,253,60
LTEXT "ZIP drives:",IDT_1739,7,107,50,8
COMBOBOX IDC_COMBO_ZIP_BUS,33,184,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1753,7,185,24,8
COMBOBOX IDC_COMBO_ZIP_ID,170,184,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "ID:",IDT_1754,131,185,38,8
COMBOBOX IDC_COMBO_ZIP_LUN,239,184,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LUN:",IDT_1755,200,185,38,8
COMBOBOX IDC_COMBO_ZIP_CHANNEL_IDE,170,184,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Channel:",IDT_1756,131,185,38,8
CONTROL "ZIP 250",IDC_CHECK250,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,204,64,10
END
@@ -582,12 +609,14 @@ END
145 ICON DISCARDABLE "win/icons/floppy_35_active.ico"
160 ICON DISCARDABLE "win/icons/cdrom.ico"
161 ICON DISCARDABLE "win/icons/cdrom_active.ico"
176 ICON DISCARDABLE "win/icons/removable_disk.ico"
177 ICON DISCARDABLE "win/icons/removable_disk_active.ico"
192 ICON DISCARDABLE "win/icons/hard_disk.ico"
193 ICON DISCARDABLE "win/icons/hard_disk_active.ico"
208 ICON DISCARDABLE "win/icons/network.ico"
209 ICON DISCARDABLE "win/icons/network_active.ico"
176 ICON DISCARDABLE "win/icons/zip.ico"
177 ICON DISCARDABLE "win/icons/zip_active.ico"
192 ICON DISCARDABLE "win/icons/removable_disk.ico"
193 ICON DISCARDABLE "win/icons/removable_disk_active.ico"
208 ICON DISCARDABLE "win/icons/hard_disk.ico"
209 ICON DISCARDABLE "win/icons/hard_disk_active.ico"
224 ICON DISCARDABLE "win/icons/network.ico"
225 ICON DISCARDABLE "win/icons/network_active.ico"
256 ICON DISCARDABLE "win/icons/machine.ico"
257 ICON DISCARDABLE "win/icons/display.ico"
258 ICON DISCARDABLE "win/icons/input_devices.ico"
@@ -596,17 +625,21 @@ END
261 ICON DISCARDABLE "win/icons/ports.ico"
262 ICON DISCARDABLE "win/icons/other_peripherals.ico"
263 ICON DISCARDABLE "win/icons/hard_disk.ico"
264 ICON DISCARDABLE "win/icons/removable_devices.ico"
264 ICON DISCARDABLE "win/icons/floppy_drives.ico"
265 ICON DISCARDABLE "win/icons/other_removable_devices.ico"
384 ICON DISCARDABLE "win/icons/floppy_525_empty.ico"
385 ICON DISCARDABLE "win/icons/floppy_525_empty_active.ico"
400 ICON DISCARDABLE "win/icons/floppy_35_empty.ico"
401 ICON DISCARDABLE "win/icons/floppy_35_empty_active.ico"
416 ICON DISCARDABLE "win/icons/cdrom_empty.ico"
417 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico"
432 ICON DISCARDABLE "win/icons/removable_disk_empty.ico"
433 ICON DISCARDABLE "win/icons/removable_disk_empty_active.ico"
432 ICON DISCARDABLE "win/icons/zip_empty.ico"
433 ICON DISCARDABLE "win/icons/zip_empty_active.ico"
448 ICON DISCARDABLE "win/icons/removable_disk_empty.ico"
449 ICON DISCARDABLE "win/icons/removable_disk_empty_active.ico"
512 ICON DISCARDABLE "win/icons/floppy_disabled.ico"
514 ICON DISCARDABLE "win/icons/cdrom_disabled.ico"
515 ICON DISCARDABLE "win/icons/zip_disabled.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -739,12 +772,20 @@ BEGIN
BOTTOMMARGIN, 137
END
DLG_CFG_REMOVABLE_DEVICES, DIALOG
DLG_CFG_FLOPPY_DRIVES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 260
TOPMARGIN, 7
BOTTOMMARGIN, 195
BOTTOMMARGIN, 96
END
DLG_CFG_OTHER_REMOVABLE_DEVICES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 260
TOPMARGIN, 7
BOTTOMMARGIN, 214
END
END
#endif // APSTUDIO_INVOKED
@@ -786,8 +827,8 @@ BEGIN
IDS_2070 "Ports (COM & LPT)"
IDS_2071 "Other peripherals"
IDS_2072 "Hard disks"
IDS_2073 "Removable devices"
IDS_2074 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
IDS_2073 "Floppy drives"
IDS_2074 "Other removable devices"
IDS_2075 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0"
IDS_2076 "Host CD/DVD Drive (%c:)"
IDS_2077 "Click to capture mouse"
@@ -828,6 +869,7 @@ BEGIN
IDS_2104 "Network Type"
IDS_2105 "Surround Module"
IDS_2106 "MPU-401 Base Address"
IDS_2107 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
IDS_2108 "On-board RAM"
IDS_2109 "Memory Size"
IDS_2110 "Display Type"
@@ -907,6 +949,9 @@ BEGIN
IDS_2172 "E&xport to 86F..."
IDS_2173 "Surface images (*.86F)\0*.86F\0"
IDS_2174 "All images (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0Basic sector images (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0Surface images (*.86F)\0*.86F\0"
IDS_2175 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0"
IDS_2176 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0"
IDS_2177 "ZIP %i (%03i): %ls"
IDS_4096 "Hard disk (%s)"
IDS_4097 "%01i:%01i"
@@ -975,6 +1020,8 @@ BEGIN
IDS_5897 "DMF (cluster 1024)"
IDS_5898 "DMF (cluster 2048)"
IDS_5899 "2.88 MB"
IDS_5900 "ZIP 100"
IDS_5901 "ZIP 250"
IDS_6144 "Perfect RPM"
IDS_6145 "1%% below perfect RPM"

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.93 2018/01/25
# Version: @(#)Makefile.mingw 1.0.94 2018/01/25
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -400,7 +400,8 @@ DEVOBJ := bugger.o lpt.o $(SERIAL) \
joystick_standard.o joystick_ch_flightstick_pro.o \
joystick_sw_pad.o joystick_tm_fcs.o \
mouse.o \
mouse_serial.o mouse_ps2.o mouse_bus.o
mouse_serial.o mouse_ps2.o mouse_bus.o \
zip.o
FDDOBJ := fdd.o fdc.o fdi2raw.o \
fdd_common.o fdd_86f.o \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/win/icons/zip.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/win/icons/zip_empty.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.18 2018/01/24
* Version: @(#)resource.h 1.0.19 2018/01/26
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -36,7 +36,8 @@
#define DLG_CFG_PERIPHERALS 117 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS 118 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS_ADD 119 /* sub-dialog of config */
#define DLG_CFG_REMOVABLE_DEVICES 120 /* sub-dialog of config */
#define DLG_CFG_FLOPPY_DRIVES 120 /* sub-dialog of config */
#define DLG_CFG_OTHER_REMOVABLE_DEVICES 121 /* sub-dialog of config */
/* Static text label IDs. */
#define IDT_1700 1700 /* Language: */
@@ -86,6 +87,11 @@
#define IDT_1750 1750 /* Disk size: */
#define IDT_1751 1751 /* RPM mode: */
#define IDT_1752 1752 /* Progress: */
#define IDT_1753 1753 /* Bus: */
#define IDT_1754 1754 /* ID: */
#define IDT_1755 1755 /* LUN: */
#define IDT_1756 1756 /* Channel: */
#define IDT_1757 1757 /* Progress: */
/*
@@ -178,17 +184,17 @@
#define IDC_COMBO_FD_TYPE 1152
#define IDC_CHECKTURBO 1153
#define IDC_CHECKBPB 1154
#define IDC_BUTTON_FDD_ADD 1155 // status bar menu
#define IDC_BUTTON_FDD_EDIT 1156 // status bar menu
#define IDC_BUTTON_FDD_REMOVE 1157 // status bar menu
#define IDC_LIST_CDROM_DRIVES 1158
#define IDC_COMBO_CD_BUS 1159
#define IDC_COMBO_CD_ID 1160
#define IDC_COMBO_CD_LUN 1161
#define IDC_COMBO_CD_CHANNEL_IDE 1162
#define IDC_BUTTON_CDROM_ADD 1163 // status bar menu
#define IDC_BUTTON_CDROM_EDIT 1164 // status bar menu
#define IDC_BUTTON_CDROM_REMOVE 1165 // status bar menu
#define IDC_LIST_CDROM_DRIVES 1155
#define IDC_COMBO_CD_BUS 1156
#define IDC_COMBO_CD_ID 1157
#define IDC_COMBO_CD_LUN 1158
#define IDC_COMBO_CD_CHANNEL_IDE 1159
#define IDC_LIST_ZIP_DRIVES 1160
#define IDC_COMBO_ZIP_BUS 1161
#define IDC_COMBO_ZIP_ID 1162
#define IDC_COMBO_ZIP_LUN 1163
#define IDC_COMBO_ZIP_CHANNEL_IDE 1164
#define IDC_CHECK250 1165
#define IDC_SLIDER_MAIN 1180 /* sound gain dialog */
#define IDC_SLIDER_CD 1181
@@ -289,11 +295,17 @@
#define IDM_CDROM_IMAGE 0x2500
#define IDM_CDROM_HOST_DRIVE 0x2600
#define IDM_RDISK_EJECT 0x3200
#define IDM_RDISK_RELOAD 0x3300
#define IDM_RDISK_SEND_CHANGE 0x3400
#define IDM_RDISK_IMAGE 0x3500
#define IDM_RDISK_IMAGE_WP 0x3600
#define IDM_ZIP_IMAGE_NEW 0x3200
#define IDM_ZIP_IMAGE_EXISTING 0x3300
#define IDM_ZIP_IMAGE_EXISTING_WP 0x3400
#define IDM_ZIP_EJECT 0x3500
#define IDM_ZIP_RELOAD 0x3600
#define IDM_RDISK_EJECT 0x4200
#define IDM_RDISK_RELOAD 0x4300
#define IDM_RDISK_SEND_CHANGE 0x4400
#define IDM_RDISK_IMAGE 0x4500
#define IDM_RDISK_IMAGE_WP 0x4600
/* Next default values for new objects */

View File

@@ -8,7 +8,7 @@
*
* Platform main support module for Windows.
*
* Version: @(#)win.c 1.0.44 2018/01/18
* Version: @(#)win.c 1.0.45 2018/01/23
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -716,7 +716,7 @@ plat_setfullscreen(int on)
if (on && video_fullscreen_first) {
video_fullscreen_first = 0;
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2074);
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2107);
}
/* OK, claim the video. */

View File

@@ -31,6 +31,7 @@
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../zip.h"
#include "../disk/hdd.h"
#include "../scsi/scsi.h"
#include "../scsi/scsi_disk.h"
@@ -151,6 +152,42 @@ cdrom_reload(uint8_t id)
}
void
zip_eject(uint8_t id)
{
zip_close(id);
if (zip_drives[id].bus_type) {
/* Signal disk change to the emulated machine. */
zip_insert(id);
}
ui_sb_update_icon_state(SB_ZIP | id, 1);
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
ui_sb_update_tip(SB_ZIP | id);
config_save();
}
void
zip_reload(uint8_t id)
{
zip_disk_reload(id);
if (wcslen(zip_drives[id].image_path) == 0) {
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_update_icon_state(SB_ZIP|id, 1);
} else {
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
ui_sb_update_icon_state(SB_ZIP|id, 0);
}
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_update_tip(SB_ZIP|id);
config_save();
}
void
removable_disk_unload(uint8_t id)
{

View File

@@ -8,7 +8,7 @@
*
* Handle the New Floppy Image dialog.
*
* Version: @(#)win_new_floppy.c 1.0.0 2018/01/18
* Version: @(#)win_new_floppy.c 1.0.1 2018/01/26
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
@@ -19,6 +19,7 @@
#include <windows.h>
#include <windowsx.h>
#undef BITMAP
#include <commctrl.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -28,6 +29,7 @@
#include "../plat.h"
#include "../random.h"
#include "../ui.h"
#include "../zip.h"
#include "win.h"
@@ -48,18 +50,20 @@ typedef struct {
} disk_size_t;
disk_size_t disk_sizes[12] = { { 0, 1, 2, 1, 0, 40, 8, 2, 0xFE, 2, 2, 1, 112 }, /* 160k */
{ 0, 1, 2, 1, 0, 40, 9, 2, 0xFC, 2, 2, 1, 112 }, /* 180k */
{ 0, 2, 2, 1, 0, 40, 8, 2, 0xFF, 2, 2, 1, 112 }, /* 320k */
{ 0, 2, 2, 1, 0, 40, 9, 2, 0xFD, 2, 2, 2, 112 }, /* 360k */
{ 0, 2, 2, 1, 0, 80, 8, 2, 0xFB, 2, 2, 2, 112 }, /* 640k */
{ 0, 2, 2, 1, 0, 80, 9, 2, 0xF9, 2, 2, 3, 112 }, /* 720k */
{ 1, 2, 0, 1, 1, 80, 15, 2, 0xF9, 1, 2, 7, 224 }, /* 1.2M */
{ 1, 2, 0, 1, 1, 77, 8, 3, 0xFE, 1, 2, 2, 192 }, /* 1.25M */
{ 1, 2, 0, 1, 0, 80, 18, 2, 0xF0, 1, 2, 9, 224 }, /* 1.44M */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 2, 2, 5, 16 }, /* DMF cluster 1024 */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 4, 2, 3, 16 }, /* DMF cluster 2048 */
{ 2, 2, 3, 1, 0, 80, 36, 2, 0xF0, 2, 2, 9, 240 } }; /* 2.88M */
disk_size_t disk_sizes[14] = { { 0, 1, 2, 1, 0, 40, 8, 2, 0xFE, 2, 2, 1, 112 }, /* 160k */
{ 0, 1, 2, 1, 0, 40, 9, 2, 0xFC, 2, 2, 1, 112 }, /* 180k */
{ 0, 2, 2, 1, 0, 40, 8, 2, 0xFF, 2, 2, 1, 112 }, /* 320k */
{ 0, 2, 2, 1, 0, 40, 9, 2, 0xFD, 2, 2, 2, 112 }, /* 360k */
{ 0, 2, 2, 1, 0, 80, 8, 2, 0xFB, 2, 2, 2, 112 }, /* 640k */
{ 0, 2, 2, 1, 0, 80, 9, 2, 0xF9, 2, 2, 3, 112 }, /* 720k */
{ 1, 2, 0, 1, 1, 80, 15, 2, 0xF9, 1, 2, 7, 224 }, /* 1.2M */
{ 1, 2, 0, 1, 1, 77, 8, 3, 0xFE, 1, 2, 2, 192 }, /* 1.25M */
{ 1, 2, 0, 1, 0, 80, 18, 2, 0xF0, 1, 2, 9, 224 }, /* 1.44M */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 2, 2, 5, 16 }, /* DMF cluster 1024 */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 4, 2, 3, 16 }, /* DMF cluster 2048 */
{ 2, 2, 3, 1, 0, 80, 36, 2, 0xF0, 2, 2, 9, 240 }, /* 2.88M */
{ 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */
{ 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 } }; /* ZIP 250 */
static char *empty;
@@ -168,6 +172,9 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
}
static int is_zip;
static int
create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
{
@@ -188,6 +195,8 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
sector_bytes = (128 << disk_size.sector_len);
total_sectors = disk_size.sides * disk_size.tracks * disk_size.sectors;
if (total_sectors > ZIP_SECTORS)
total_sectors = ZIP_250_SECTORS;
total_size = total_sectors * sector_bytes;
root_dir_bytes = (disk_size.root_dir_entries << 5);
fat_size = (disk_size.spfat * sector_bytes);
@@ -195,7 +204,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
fat2_offs = fat1_offs + fat_size;
zero_bytes = fat2_offs + fat_size + root_dir_bytes;
if (is_fdi) {
if (!is_zip && is_fdi) {
empty = (char *) malloc(base);
memset(empty, 0, base);
@@ -212,52 +221,58 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
empty = (char *) malloc(total_size);
memset(empty, 0x00, zero_bytes);
memset(empty + zero_bytes, 0xF6, total_size - zero_bytes);
empty[0x00] = 0xEB; /* Jump to make MS-DOS happy. */
empty[0x01] = 0x58;
empty[0x02] = 0x90;
if (!is_zip) {
memset(empty + zero_bytes, 0xF6, total_size - zero_bytes);
empty[0x03] = 0x38; /* '86BOX5.0' OEM ID. */
empty[0x04] = 0x36;
empty[0x05] = 0x42;
empty[0x06] = 0x4F;
empty[0x07] = 0x58;
empty[0x08] = 0x35;
empty[0x09] = 0x2E;
empty[0x0A] = 0x30;
empty[0x00] = 0xEB; /* Jump to make MS-DOS happy. */
empty[0x01] = 0x58;
empty[0x02] = 0x90;
*(uint16_t *) &(empty[0x0B]) = (uint16_t) sector_bytes;
*(uint8_t *) &(empty[0x0D]) = (uint8_t) disk_size.spc;
*(uint16_t *) &(empty[0x0E]) = (uint16_t) 1;
*(uint8_t *) &(empty[0x10]) = (uint8_t) disk_size.num_fats;
*(uint16_t *) &(empty[0x11]) = (uint16_t) disk_size.root_dir_entries;
*(uint16_t *) &(empty[0x13]) = (uint16_t) total_sectors;
*(uint8_t *) &(empty[0x15]) = (uint8_t) disk_size.media_desc;
*(uint16_t *) &(empty[0x16]) = (uint16_t) disk_size.spfat;
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sectors;
*(uint8_t *) &(empty[0x1A]) = (uint8_t) disk_size.sides;
empty[0x03] = 0x38; /* '86BOX5.0' OEM ID. */
empty[0x04] = 0x36;
empty[0x05] = 0x42;
empty[0x06] = 0x4F;
empty[0x07] = 0x58;
empty[0x08] = 0x35;
empty[0x09] = 0x2E;
empty[0x0A] = 0x30;
empty[0x26] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x27] = random_generate();
empty[0x28] = random_generate();
empty[0x29] = random_generate();
empty[0x2A] = random_generate();
*(uint16_t *) &(empty[0x0B]) = (uint16_t) sector_bytes;
*(uint8_t *) &(empty[0x0D]) = (uint8_t) disk_size.spc;
*(uint16_t *) &(empty[0x0E]) = (uint16_t) 1;
*(uint8_t *) &(empty[0x10]) = (uint8_t) disk_size.num_fats;
*(uint16_t *) &(empty[0x11]) = (uint16_t) disk_size.root_dir_entries;
*(uint16_t *) &(empty[0x13]) = (uint16_t) total_sectors;
*(uint8_t *) &(empty[0x15]) = (uint8_t) disk_size.media_desc;
*(uint16_t *) &(empty[0x16]) = (uint16_t) disk_size.spfat;
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sectors;
*(uint8_t *) &(empty[0x1A]) = (uint8_t) disk_size.sides;
memset(&(empty[0x2B]), 0x20, 11);
empty[0x26] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x27] = random_generate();
empty[0x28] = random_generate();
empty[0x29] = random_generate();
empty[0x2A] = random_generate();
empty[0x36] = 'F';
empty[0x37] = 'A';
empty[0x38] = 'T';
empty[0x39] = '1';
empty[0x3A] = '2';
memset(&(empty[0x2B]), 0x20, 11);
empty[0x1FE] = 0x55;
empty[0x1FF] = 0xAA;
empty[0x36] = 'F';
empty[0x37] = 'A';
empty[0x38] = 'T';
empty[0x39] = '1';
empty[0x3A] = '2';
empty[0x3B] = ' ';
empty[0x3C] = ' ';
empty[0x3D] = ' ';
empty[fat1_offs + 0x00] = empty[fat2_offs + 0x00] = empty[0x15];
empty[fat1_offs + 0x01] = empty[fat2_offs + 0x01] = empty[0xFF];
empty[fat1_offs + 0x02] = empty[fat2_offs + 0x02] = empty[0xFF];
empty[0x1FE] = 0x55;
empty[0x1FF] = 0xAA;
empty[fat1_offs + 0x00] = empty[fat2_offs + 0x00] = empty[0x15];
empty[fat1_offs + 0x01] = empty[fat2_offs + 0x01] = 0xFF;
empty[fat1_offs + 0x02] = empty[fat2_offs + 0x02] = 0xFF;
}
fwrite(empty, 1, total_size, f);
free(empty);
@@ -268,6 +283,236 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
}
static int
create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi, HWND hwnd)
{
HWND h;
FILE *f;
uint32_t total_size = 0;
uint32_t total_sectors = 0;
uint32_t sector_bytes = 0;
uint32_t root_dir_bytes = 0;
uint32_t fat_size = 0;
uint32_t fat1_offs = 0;
uint32_t fat2_offs = 0;
uint32_t zero_bytes = 0;
uint16_t base = 0x1000;
uint32_t pbar_max = 0;
uint32_t i;
f = plat_fopen(file_name, L"wb");
if (!f)
return 0;
sector_bytes = (128 << disk_size.sector_len);
total_sectors = disk_size.sides * disk_size.tracks * disk_size.sectors;
if (total_sectors > ZIP_SECTORS)
total_sectors = ZIP_250_SECTORS;
total_size = total_sectors * sector_bytes;
root_dir_bytes = (disk_size.root_dir_entries << 5);
fat_size = (disk_size.spfat * sector_bytes);
fat1_offs = sector_bytes;
fat2_offs = fat1_offs + fat_size;
zero_bytes = fat2_offs + fat_size + root_dir_bytes;
pbar_max = total_size;
if (is_zdi)
pbar_max += base;
pbar_max >>= 11;
pbar_max--;
h = GetDlgItem(hwnd, IDC_COMBO_RPM_MODE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hwnd, IDT_1751);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE);
SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) pbar_max);
SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0);
EnableWindow(h, TRUE);
ShowWindow(h, SW_SHOW);
h = GetDlgItem(hwnd, IDT_1757);
EnableWindow(h, TRUE);
ShowWindow(h, SW_SHOW);
h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE);
pbar_max++;
if (is_zdi) {
empty = (char *) malloc(base);
memset(empty, 0, base);
*(uint32_t *) &(empty[0x08]) = (uint32_t) base;
*(uint32_t *) &(empty[0x0C]) = total_size;
*(uint16_t *) &(empty[0x10]) = (uint16_t) sector_bytes;
*(uint8_t *) &(empty[0x14]) = (uint8_t) disk_size.sectors;
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sides;
*(uint8_t *) &(empty[0x1C]) = (uint8_t) disk_size.tracks;
fwrite(empty, 1, 2048, f);
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
fwrite(&empty[0x0800], 1, 2048, f);
free(empty);
SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0);
pbar_max -= 2;
}
empty = (char *) malloc(total_size);
memset(empty, 0x00, zero_bytes);
if (total_sectors == ZIP_SECTORS) {
/* ZIP 100 */
/* MBR */
*(uint64_t *) &(empty[0x0000]) = 0x0000030000025245LL;
*(uint64_t *) &(empty[0x0008]) = 0x0000000000000000LL;
*(uint64_t *) &(empty[0x0010]) = 0x0900E90300000100LL;
*(uint64_t *) &(empty[0x0018]) = 0x726F70726F430100LL;
*(uint64_t *) &(empty[0x0020]) = 0x202D206E6F697461LL;
*(uint64_t *) &(empty[0x0028]) = 0x30392F33322F3131LL;
*(uint64_t *) &(empty[0x01AE]) = 0x0116010100E905E2LL;
*(uint64_t *) &(empty[0x01B6]) = 0x226BEDCE014E0135LL;
*(uint64_t *) &(empty[0x01BE]) = 0x5E203F0600010180LL;
*(uint64_t *) &(empty[0x01C6]) = 0x0002FE6000000020LL;
*(uint16_t *) &(empty[0x01FE]) = 0xAA55;
/* 4 sectors filled with 0xFA */
memset(&(empty[0x0200]), 0xFA, 0x0800);
/* Iomega_Reserved sector */
*(uint64_t *) &(empty[0x0A00]) = 0x0500000000004D50LL;
*(uint64_t *) &(empty[0x0A08]) = 0xAFF9010051060100LL;
*(uint64_t *) &(empty[0x0A30]) = 0x525F6167656D6F49LL;
*(uint64_t *) &(empty[0x0A38]) = 0x0064657672657365LL;
*(uint64_t *) &(empty[0x0A54]) = 0x03000000AFF90100LL;
/* 26 sectors filled with 0x48 */
memset(&(empty[0x0C00]), 0x48, 0x3400);
/* Boot sector */
*(uint64_t *) &(empty[0x4000]) = 0x584F4236389058EBLL;
*(uint64_t *) &(empty[0x4008]) = 0x0001040200302E35LL;
*(uint64_t *) &(empty[0x4010]) = 0x00C0F80000020002LL;
*(uint64_t *) &(empty[0x4018]) = 0x0000002000400020LL;
*(uint32_t *) &(empty[0x4020]) = 0x0002FFE0;
*(uint16_t *) &(empty[0x4024]) = 0x0080;
empty[0x4026] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x4027] = random_generate();
empty[0x4028] = random_generate();
empty[0x4029] = random_generate();
empty[0x402A] = random_generate();
memset(&(empty[0x402B]), 0x00, 0x000B);
memset(&(empty[0x4036]), 0x20, 0x0008);
empty[0x4036] = 'F';
empty[0x4037] = 'A';
empty[0x4038] = 'T';
empty[0x4039] = '1';
empty[0x403A] = '6';
empty[0x41FE] = 0x55;
empty[0x41FF] = 0xAA;
empty[0x4200] = empty[0x1C200] = empty[0x4015];
empty[0x4201] = empty[0x1C201] = 0xFF;
empty[0x4202] = empty[0x1C202] = 0xFF;
empty[0x4203] = empty[0x1C203] = 0xFF;
/* Root directory = 0x34200
Data = 0x38200 */
} else {
/* ZIP 250 */
/* MBR */
*(uint64_t *) &(empty[0x0000]) = 0x2054524150492EEBLL;
*(uint64_t *) &(empty[0x0008]) = 0x3930302065646F63LL;
*(uint64_t *) &(empty[0x0010]) = 0x67656D6F49202D20LL;
*(uint64_t *) &(empty[0x0018]) = 0x726F70726F432061LL;
*(uint64_t *) &(empty[0x0020]) = 0x202D206E6F697461LL;
*(uint64_t *) &(empty[0x0028]) = 0x30392F33322F3131LL;
*(uint64_t *) &(empty[0x01AE]) = 0x0116010100E900E9LL;
*(uint64_t *) &(empty[0x01B6]) = 0x2E32A7AC014E0135LL;
*(uint64_t *) &(empty[0x01EE]) = 0xEE203F0600010180LL;
*(uint64_t *) &(empty[0x01F6]) = 0x000777E000000020LL;
*(uint16_t *) &(empty[0x01FE]) = 0xAA55;
/* 31 sectors filled with 0x48 */
memset(&(empty[0x0200]), 0x48, 0x3E00);
/* The second sector begins with some strange data
in my reference image. */
*(uint64_t *) &(empty[0x0200]) = 0x3831393230334409LL;
*(uint64_t *) &(empty[0x0208]) = 0x6A57766964483130LL;
*(uint64_t *) &(empty[0x0210]) = 0x3C3A34676063653FLL;
*(uint64_t *) &(empty[0x0218]) = 0x586A56A8502C4161LL;
*(uint64_t *) &(empty[0x0220]) = 0x6F2D702535673D6CLL;
*(uint64_t *) &(empty[0x0228]) = 0x255421B8602D3456LL;
*(uint64_t *) &(empty[0x0230]) = 0x577B22447B52603ELL;
*(uint64_t *) &(empty[0x0238]) = 0x46412CC871396170LL;
*(uint64_t *) &(empty[0x0240]) = 0x704F55237C5E2626LL;
*(uint64_t *) &(empty[0x0248]) = 0x6C7932C87D5C3C20LL;
*(uint64_t *) &(empty[0x0250]) = 0x2C50503E47543D6ELL;
*(uint64_t *) &(empty[0x0258]) = 0x46394E807721536ALL;
*(uint64_t *) &(empty[0x0260]) = 0x505823223F245325LL;
*(uint64_t *) &(empty[0x0268]) = 0x365C79B0393B5B6ELL;
/* Boot sector */
*(uint64_t *) &(empty[0x4000]) = 0x584F4236389058EBLL;
*(uint64_t *) &(empty[0x4008]) = 0x0001080200302E35LL;
*(uint64_t *) &(empty[0x4010]) = 0x00EFF80000020002LL;
*(uint64_t *) &(empty[0x4018]) = 0x0000002000400020LL;
*(uint32_t *) &(empty[0x4020]) = 0x000777E0;
*(uint16_t *) &(empty[0x4024]) = 0x0080;
empty[0x4026] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x4027] = random_generate();
empty[0x4028] = random_generate();
empty[0x4029] = random_generate();
empty[0x402A] = random_generate();
memset(&(empty[0x402B]), 0x00, 0x000B);
memset(&(empty[0x4036]), 0x20, 0x0008);
empty[0x4036] = 'F';
empty[0x4037] = 'A';
empty[0x4038] = 'T';
empty[0x4039] = '1';
empty[0x403A] = '6';
empty[0x41FE] = 0x55;
empty[0x41FF] = 0xAA;
empty[0x4200] = empty[0x22000] = empty[0x4015];
empty[0x4201] = empty[0x22001] = 0xFF;
empty[0x4202] = empty[0x22002] = 0xFF;
empty[0x4203] = empty[0x22003] = 0xFF;
/* Root directory = 0x3FE00
Data = 0x38200 */
}
for (i = 0; i < pbar_max; i++) {
fwrite(&empty[i << 11], 1, 2048, f);
SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0);
}
free(empty);
fclose(f);
return 1;
}
static int fdd_id, sb_part;
static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */
@@ -306,18 +551,27 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
uint8_t disk_size, rpm_mode;
int ret;
FILE *f;
int zip_types;
switch (message) {
case WM_INITDIALOG:
plat_pause(1);
memset(fd_file_name, 0, 512 * sizeof(wchar_t));
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
for (i = 0; i < 12; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_5888 + i));
if (is_zip) {
zip_types = zip_drives[fdd_id].is_250 ? 2 : 1;
for (i = 0; i < zip_types; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_5900 + i));
} else {
for (i = 0; i < 12; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_5888 + i));
}
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE);
for (i = 0; i < 4; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_6144 + i));
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDT_1751);
@@ -325,6 +579,12 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDOK);
EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDT_1757);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
break;
case WM_COMMAND:
@@ -332,15 +592,24 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDOK:
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
disk_size = SendMessage(h, CB_GETCURSEL, 0, 0);
if (is_zip)
disk_size += 12;
if (file_type == 2) {
h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE);
rpm_mode = SendMessage(h, CB_GETCURSEL, 0, 0);
ret = create_86f(fd_file_name, disk_sizes[disk_size], rpm_mode);
} else
ret = create_sector_image(fd_file_name, disk_sizes[disk_size], file_type);
if (ret)
ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name);
else {
} else {
if (is_zip)
ret = create_zip_sector_image(fd_file_name, disk_sizes[disk_size], file_type, hdlg);
else
ret = create_sector_image(fd_file_name, disk_sizes[disk_size], file_type);
}
if (ret) {
if (is_zip)
ui_sb_mount_zip_img(fdd_id, sb_part, 0, fd_file_name);
else
ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name);
} else {
new_floppy_msgbox(hdlg, MBX_ERROR, (wchar_t *)IDS_4108);
return TRUE;
}
@@ -350,7 +619,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
case IDC_CFILE:
if (!file_dlg_w(hdlg, plat_get_string(IDS_2174), L"", 1)) {
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME);
f = _wfopen(wopenfilestring, L"rb");
if (f != NULL) {
@@ -362,16 +631,24 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
memset(fd_file_name, 0, sizeof(fd_file_name));
wcscpy(fd_file_name, wopenfilestring);
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
EnableWindow(h, TRUE);
if (!is_zip || zip_drives[fdd_id].is_250)
EnableWindow(h, TRUE);
wcs_len = wcslen(wopenfilestring);
ext_offs = wcs_len - 4;
ext = &(wopenfilestring[ext_offs]);
if ((wcs_len >= 4) && !wcsicmp(ext, L".FDI"))
file_type = 1;
else if ((wcs_len >= 4) && !wcsicmp(ext, L".86F"))
file_type = 2;
else
file_type = 0;
if (is_zip) {
if (((wcs_len >= 4) && !wcsicmp(ext, L".ZDI")))
file_type = 1;
else
file_type = 0;
} else {
if (((wcs_len >= 4) && !wcsicmp(ext, L".FDI")))
file_type = 1;
else if ((((wcs_len >= 4) && !wcsicmp(ext, L".86F")) || (filterindex == 3)))
file_type = 2;
else
file_type = 0;
}
h = GetDlgItem(hdlg, IDT_1751);
if (file_type == 2) {
EnableWindow(h, TRUE);
@@ -407,7 +684,8 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
void
NewFloppyDialogCreate(HWND hwnd, int id, int part)
{
fdd_id = id;
fdd_id = id & 0x7f;
sb_part = part;
is_zip = !!(id & 0x80);
DialogBox(hinstance, (LPCTSTR)DLG_NEW_FLOPPY, hwnd, NewFloppyDialogProcedure);
}

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
*
* Implement the application's Status Bar.
*
* Version: @(#)win_stbar.c 1.0.9 2018/01/18
* Version: @(#)win_stbar.c 1.0.10 2018/01/23
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -36,6 +36,7 @@
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../zip.h"
#include "../disk/hdd.h"
#include "../disk/hdc.h"
#include "../floppy/fdd.h"
@@ -132,11 +133,11 @@ StatusBarCreateFloppySubmenu(HMENU m, int id)
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id,
plat_get_string(IDS_2163));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id,
plat_get_string(IDS_2164));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_FLOPPY_EXPORT_TO_86F | id,
plat_get_string(IDS_2172));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id,
plat_get_string(IDS_2164));
if (floppyfns[id][0] == 0x0000) {
EnableMenuItem(m, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
@@ -203,11 +204,37 @@ check_menu_items:
}
static void
StatusBarCreateZIPSubmenu(HMENU m, int id)
{
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_NEW | id,
plat_get_string(IDS_2161));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING | id,
plat_get_string(IDS_2162));
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING_WP | id,
plat_get_string(IDS_2163));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_ZIP_EJECT | id,
plat_get_string(IDS_2164));
AppendMenu(m, MF_STRING, IDM_ZIP_RELOAD | id,
plat_get_string(IDS_2167));
if (zip_drives[id].image_path[0] == 0x0000) {
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
} else {
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
}
}
static void
StatusBarCreateRemovableDiskSubmenu(HMENU m, int id)
{
AppendMenu(m, MF_STRING, IDM_RDISK_EJECT | id,
plat_get_string(IDS_2166));
plat_get_string(IDS_2164));
AppendMenu(m, MF_STRING, IDM_RDISK_RELOAD | id,
plat_get_string(IDS_2167));
AppendMenu(m, MF_SEPARATOR, 0, 0);
@@ -358,6 +385,32 @@ StatusBarCreateCdromTip(int part)
}
static void
StatusBarCreateZIPTip(int part)
{
WCHAR tempTip[512];
int drive = sb_part_meanings[part] & 0xf;
int type = zip_drives[drive].is_250 ? 250 : 100;
if (wcslen(floppyfns[drive]) == 0) {
_swprintf(tempTip, plat_get_string(IDS_2177),
drive+1, type, plat_get_string(IDS_2057));
} else {
_swprintf(tempTip, plat_get_string(IDS_2177),
drive+1, type, zip_drives[drive].image_path);
}
if (sbTips[part] != NULL) {
free(sbTips[part]);
sbTips[part] = NULL;
}
sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2);
wcscpy(sbTips[part], tempTip);
}
static void
StatusBarCreateRemovableDiskTip(int part)
{
@@ -437,6 +490,10 @@ ui_sb_update_tip(int meaning)
StatusBarCreateCdromTip(part);
break;
case SB_ZIP:
StatusBarCreateZIPTip(part);
break;
case SB_RDISK:
StatusBarCreateRemovableDiskTip(part);
break;
@@ -584,6 +641,27 @@ ui_sb_update_panes(void)
sb_parts++;
}
}
for (i=0; i<ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) &&
(scsi_card_current == 0)) {
continue;
}
if (zip_drives[i].bus_type != 0) {
sb_parts++;
}
}
for (i=0; i<HDD_NUM; i++) {
if ((hdd[i].bus==HDD_BUS_SCSI_REMOVABLE) && (scsi_card_current != 0)) {
sb_parts++;
@@ -659,6 +737,27 @@ ui_sb_update_panes(void)
sb_parts++;
}
}
for (i=0; i<ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && (scsi_card_current == 0)) {
continue;
}
if (zip_drives[i].bus_type != 0) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_ZIP | i;
sb_parts++;
}
}
for (i=0; i<HDD_NUM; i++) {
if ((hdd[i].bus==HDD_BUS_SCSI_REMOVABLE) && (scsi_card_current != 0)) {
edge += SB_ICON_WIDTH;
@@ -745,9 +844,18 @@ ui_sb_update_panes(void)
StatusBarCreateCdromTip(i);
break;
case SB_ZIP: /* Iomega ZIP */
sb_icon_flags[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
sb_part_icons[i] = 176 + sb_icon_flags[i];
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
StatusBarCreateZIPSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
EnableMenuItem(sb_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED));
StatusBarCreateZIPTip(i);
break;
case SB_RDISK: /* Removable hard disk */
sb_icon_flags[i] = (wcslen(hdd[sb_part_meanings[i] & 0x1f].fn) == 0) ? 256 : 0;
sb_part_icons[i] = 176 + sb_icon_flags[i];
sb_part_icons[i] = 192 + sb_icon_flags[i];
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
StatusBarCreateRemovableDiskSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0x1f);
EnableMenuItem(sb_menu_handles[i], IDM_RDISK_EJECT | (sb_part_meanings[i] & 0x1f), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED));
@@ -757,12 +865,12 @@ ui_sb_update_panes(void)
break;
case SB_HDD: /* Hard disk */
sb_part_icons[i] = 192;
sb_part_icons[i] = 208;
StatusBarCreateDiskTip(i);
break;
case SB_NETWORK: /* Network */
sb_part_icons[i] = 208;
sb_part_icons[i] = 224;
StatusBarCreateNetworkTip(i);
break;
@@ -802,14 +910,29 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
void
ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
{
fdd_close(id);
ui_writeprot[id] = wp;
fdd_load(id, file_name);
ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_FLOPPY | id);
config_save();
fdd_close(id);
ui_writeprot[id] = wp;
fdd_load(id, file_name);
ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_FLOPPY | id);
config_save();
}
void
ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
{
zip_close(id);
zip_drives[id].ui_writeprot = wp;
zip_load(id, file_name);
zip_insert(id);
ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED));
ui_sb_update_tip(SB_ZIP | id);
config_save();
}
@@ -981,6 +1104,34 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
config_save();
break;
case IDM_ZIP_IMAGE_NEW:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_ZIP | id);
NewFloppyDialogCreate(hwnd, id | 0x80, part); /* NewZIPDialogCreate */
break;
case IDM_ZIP_IMAGE_EXISTING:
case IDM_ZIP_IMAGE_EXISTING_WP:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_ZIP | id);
if ((part == -1) || (sb_menu_handles == NULL))
break;
ret = file_dlg_w_st(hwnd, IDS_2175, zip_drives[id].image_path, 0);
if (! ret)
ui_sb_mount_zip_img(id, part, (item_id == IDM_ZIP_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
break;
case IDM_ZIP_EJECT:
id = item_params & 0x0003;
zip_eject(id);
break;
case IDM_ZIP_RELOAD:
id = item_params & 0x0003;
zip_reload(id);
break;
case IDM_RDISK_EJECT:
id = item_params & 0x001f;
removable_disk_eject(id);
@@ -1068,6 +1219,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 208; i < 210; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 224; i < 226; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 384; i < 386; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 400; i < 402; i++)
@@ -1076,6 +1229,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 432; i < 434; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 448; i < 450; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
GetWindowRect(hwndParent, &rectDialog);
dw = rectDialog.right - rectDialog.left;