Merge branch 'master' of github.com:86Box/86Box into tc1995

This commit is contained in:
TC1995
2020-07-16 19:33:28 +02:00
18 changed files with 701 additions and 122 deletions

View File

@@ -309,6 +309,8 @@ void codegen_block_start_recompile(codeblock_t *block)
addbyte(0xf6);
#endif
call(block, (uintptr_t)x86gpf);
while (block_pos < BLOCK_EXIT_OFFSET)
addbyte(0x90); /*NOP*/
#else
addbyte(0xc6); /* mov byte ptr[&(cpu_state.abrt)],ABRT_GPF */
addbyte(0x05);
@@ -320,8 +322,6 @@ void codegen_block_start_recompile(codeblock_t *block)
addbyte(0xa3);
addlong((uint32_t) (uintptr_t) &(abrt_error));
#endif
while (block_pos < BLOCK_EXIT_OFFSET)
addbyte(0x90); /*NOP*/
block_pos = BLOCK_EXIT_OFFSET; /*Exit code*/
addbyte(0x48); /*ADDL $40,%rsp*/
addbyte(0x83);

View File

@@ -8,7 +8,11 @@
#define HASH(l) ((l) & 0x1ffff)
#define BLOCK_EXIT_OFFSET 0x7e0
#ifdef OLD_GPF
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
#else
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 15)
#endif
#define BLOCK_MAX 1620

View File

@@ -22,7 +22,7 @@
#include <stddef.h>
#ifdef USE_NEW_DYNAREC
#define readmemb(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==LOOKUP_INV)?readmembl((s)+(a)): *(uint8_t *)(readlookup2[(uint32_t)((s)+(a))>>12] + (uintptr_t)((s) + (a))) )
#define readmemb(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==LOOKUP_INV)?readmembl((s)+(a)): *(uint8_t *)(readlookup2[(uint32_t)((s)+(a))>>12] + (uintptr_t)((s) + (a))))
#define readmemw(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==LOOKUP_INV || (((s)+(a)) & 1))?readmemwl((s)+(a)):*(uint16_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uintptr_t)((s)+(a))))
#define readmeml(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==LOOKUP_INV || (((s)+(a)) & 3))?readmemll((s)+(a)):*(uint32_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uintptr_t)((s)+(a))))
#define readmemq(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==LOOKUP_INV || (((s)+(a)) & 7))?readmemql((s)+(a)):*(uint64_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uintptr_t)((s)+(a))))

View File

@@ -35,6 +35,7 @@
#include <86box/hdc_ide.h>
#include <86box/hdc_ide_sff8038i.h>
#include <86box/zip.h>
#include <86box/mo.h>
typedef struct
@@ -332,6 +333,11 @@ cmd640_reset(void *p)
(zip_drives[i].ide_channel < 4) && zip_drives[i].priv)
zip_reset((scsi_common_t *) zip_drives[i].priv);
}
for (i = 0; i < MO_NUM; i++) {
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) &&
(mo_drives[i].ide_channel < 4) && mo_drives[i].priv)
mo_reset((scsi_common_t *) mo_drives[i].priv);
}
cmd640_set_irq(0x00, p);
cmd640_set_irq(0x01, p);

View File

@@ -41,6 +41,7 @@
#include <86box/hdc_ide.h>
#include <86box/hdc_ide_sff8038i.h>
#include <86box/zip.h>
#include <86box/mo.h>
static int next_id = 0;
@@ -440,6 +441,11 @@ sff_reset(void *p)
(zip_drives[i].ide_channel < 4) && zip_drives[i].priv)
zip_reset((scsi_common_t *) zip_drives[i].priv);
}
for (i = 0; i < MO_NUM; i++) {
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) &&
(mo_drives[i].ide_channel < 4) && mo_drives[i].priv)
mo_reset((scsi_common_t *) mo_drives[i].priv);
}
sff_bus_master_set_irq(0x00, p);
sff_bus_master_set_irq(0x01, p);

View File

@@ -112,6 +112,7 @@
#define IDS_2136 2136 // "Don't Exit"
#define IDS_2137 2137 // "Reset"
#define IDS_2138 2138 // "Don't Reset"
#define IDS_2139 2139 // "CD-ROM drives"
#define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i"
@@ -198,7 +199,7 @@
#define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 71
#define STR_NUM_2048 92
#define STR_NUM_3072 11
#define STR_NUM_4096 18
#define STR_NUM_4352 7

View File

@@ -203,7 +203,7 @@ extern uintptr_t * readlookup2;
extern int readlnext;
extern int writelookup[256],
writelookupp[256];
extern uintptr_t *writelookup2;
extern uintptr_t * writelookup2;
extern int writelnext;
extern uint32_t ram_mapped_addr[64];

View File

@@ -59,7 +59,8 @@ typedef struct
int8_t supported_media[KNOWN_MO_TYPES];
} mo_drive_type_t;
static const mo_drive_type_t mo_drive_types[22] = {
#define KNOWN_MO_DRIVE_TYPES 22
static const mo_drive_type_t mo_drive_types[KNOWN_MO_DRIVE_TYPES] = {
{"86BOX", "MAGNETO OPTICAL", "1.00",{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
{"FUJITSU", "M2512A", "1314",{1, 1, 0, 0, 0, 0, 0, 0, 0}},
{"FUJITSU", "M2513-MCC3064SS", "1.00",{1, 1, 1, 1, 0, 0, 0, 0, 0, 0}},
@@ -117,35 +118,31 @@ typedef struct {
} mo_drive_t;
typedef struct {
uint8_t id,
error, status,
phase,
features,
is_dma,
do_page_save,
unit_attention;
mode_sense_pages_t ms_pages_saved;
mo_drive_t *drv;
mo_drive_t *drv;
uint16_t request_length,
max_transfer_len;
uint8_t *buffer,
atapi_cdb[16],
current_cdb[16],
sense[256];
int requested_blocks, packet_status,
request_pos, old_len,
total_length;
uint8_t status, phase,
error, id,
features, pad0,
pad1, pad2;
uint32_t sector_pos, sector_len,
packet_len, pos,
seek_pos;
uint16_t request_length, max_transfer_len;
double callback;
int requested_blocks, packet_status,
total_length, do_page_save,
unit_attention, request_pos,
old_len, pad3;
mode_sense_pages_t ms_pages_saved;
uint32_t sector_pos, sector_len,
packet_len, pos;
uint8_t *buffer,
atapi_cdb[16],
current_cdb[16],
sense[256];
double callback;
} mo_t;

View File

@@ -39,7 +39,8 @@
#define DLG_CFG_HARD_DISKS 118 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS_ADD 119 /* 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 */
#define DLG_CFG_CDROM_DRIVES 121 /* sub-dialog of config */
#define DLG_CFG_OTHER_REMOVABLE_DEVICES 122 /* sub-dialog of config */
/* Static text label IDs. */
#define IDT_1700 1700 /* Language: */
@@ -100,6 +101,11 @@
#define IDT_1766 1766 /* Board #4: */
#define IDT_1767 1767 /* ISA RTC: */
#define IDT_1768 1768 /* Ext FD Controller: */
#define IDT_1769 1769 /* MO drives: */
#define IDT_1770 1770 /* Bus: */
#define IDT_1771 1771 /* ID: */
#define IDT_1772 1772 /* Channel */
#define IDT_1773 1773 /* Type: */
/*
@@ -236,6 +242,7 @@
#define IDC_COMBO_MO_ID 1189
#define IDC_COMBO_MO_LUN 1191
#define IDC_COMBO_MO_CHANNEL_IDE 1192
#define IDC_COMBO_MO_TYPE 1193
#define IDC_SLIDER_GAIN 1190 /* sound gain dialog */

View File

@@ -232,7 +232,7 @@ extern pc_timer_t * timer_head;
extern int timer_inited;
__inline void
static __inline void
timer_remove_head_inline(void)
{
pc_timer_t *timer;
@@ -250,7 +250,7 @@ timer_remove_head_inline(void)
}
__inline void
static __inline void
timer_process_inline(void)
{
pc_timer_t *timer;

View File

@@ -164,7 +164,8 @@ extern void NewFloppyDialogCreate(HWND hwnd, int id, int part);
#define SETTINGS_PAGE_PERIPHERALS 6
#define SETTINGS_PAGE_HARD_DISKS 7
#define SETTINGS_PAGE_FLOPPY_DRIVES 8
#define SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES 9
#define SETTINGS_PAGE_CDROM_DRIVES 9
#define SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES 10
extern void win_settings_open(HWND hwnd);
extern void win_settings_open_ex(HWND hwnd, int category);

View File

@@ -579,7 +579,11 @@ mem_addr_translate(uint32_t addr, uint32_t chunk_start, uint32_t len)
void
addreadlookup(uint32_t virt, uint32_t phys)
{
#if (defined __amd64__ || defined _M_X64)
uint64_t a;
#else
uint32_t a;
#endif
if (virt == 0xffffffff) return;
@@ -588,7 +592,11 @@ addreadlookup(uint32_t virt, uint32_t phys)
if (readlookup[readlnext] != (int) 0xffffffff)
readlookup2[readlookup[readlnext]] = LOOKUP_INV;
a = (uintptr_t)(phys & ~0xfff) - (uintptr_t)(virt & ~0xfff);
#if (defined __amd64__ || defined _M_X64)
a = ((uint64_t)(phys & ~0xfff) - (uint64_t)(virt & ~0xfff));
#else
a = ((uint32_t)(phys & ~0xfff) - (uint32_t)(virt & ~0xfff));
#endif
if ((phys & ~0xfff) >= (1 << 30))
readlookup2[virt>>12] = (uintptr_t)&ram2[a - (1 << 30)];
@@ -606,7 +614,11 @@ addreadlookup(uint32_t virt, uint32_t phys)
void
addwritelookup(uint32_t virt, uint32_t phys)
{
#if (defined __amd64__ || defined _M_X64)
uint64_t a;
#else
uint32_t a;
#endif
if (virt == 0xffffffff) return;
@@ -632,7 +644,11 @@ addwritelookup(uint32_t virt, uint32_t phys)
#endif
page_lookup[virt >> 12] = &pages[phys >> 12];
else {
a = (uintptr_t)(phys & ~0xfff) - (uintptr_t)(virt & ~0xfff);
#if (defined __amd64__ || defined _M_X64)
a = ((uint64_t)(phys & ~0xfff) - (uint64_t)(virt & ~0xfff));
#else
a = ((uint32_t)(phys & ~0xfff) - (uint32_t)(virt & ~0xfff));
#endif
if ((phys & ~0xfff) >= (1 << 30))
writelookup2[virt>>12] = (uintptr_t)&ram2[a - (1 << 30)];
@@ -2530,22 +2546,31 @@ mem_reset(void)
free(ram);
ram = NULL;
}
#if (defined __amd64__ || defined _M_X64)
if (ram2 != NULL) {
free(ram2);
ram2 = NULL;
}
#endif
if (mem_size > 2097152)
fatal("Attempting to use more than 2 GB of guest RAM\n");
#if (defined __amd64__ || defined _M_X64)
if (mem_size > 1048576) {
ram = (uint8_t *)malloc(1 << 30); /* allocate and clear the RAM block of the first 1 GB */
memset(ram, 0x00, 1 << 30);
memset(ram, 0x00, (1 << 30));
ram2 = (uint8_t *)malloc(m - (1 << 30)); /* allocate and clear the RAM block above 1 GB */
memset(ram2, 0x00, m - (1 << 30));
} else {
ram = (uint8_t *)malloc(m); /* allocate and clear the RAM block */
memset(ram, 0x00, m);
}
#else
ram = (uint8_t *)malloc(m); /* allocate and clear the RAM block */
memset(ram, 0x00, m);
if (mem_size > 1048576)
ram2 = &(ram[1 << 30]);
#endif
/*
* Allocate the page table based on how much RAM we have.

View File

@@ -67,6 +67,7 @@
#include <86box/scsi_device.h>
#include <86box/cdrom.h>
#include <86box/zip.h>
#include <86box/mo.h>
#include <86box/scsi_disk.h>
#include <86box/cdrom_image.h>
#include <86box/network.h>
@@ -519,6 +520,7 @@ usage:
mouse_init();
cdrom_global_init();
zip_global_init();
mo_global_init();
/* Load the configuration file. */
config_load();
@@ -705,6 +707,8 @@ pc_reset_hard_close(void)
zip_close();
mo_close();
scsi_disk_close();
closeal();
@@ -787,6 +791,8 @@ pc_reset_hard_init(void)
zip_hard_reset();
mo_hard_reset();
scsi_disk_hard_reset();
/* Reset and reconfigure the Network Card layer. */
@@ -888,6 +894,8 @@ pc_close(thread_t *ptr)
zip_close();
mo_close();
scsi_disk_close();
}

View File

@@ -627,7 +627,7 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,196,86,64,10
END
DLG_CFG_OTHER_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 221
DLG_CFG_CDROM_DRIVES DIALOG DISCARDABLE 97, 0, 267, 150
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
@@ -647,6 +647,30 @@ BEGIN
COMBOBOX IDC_COMBO_CD_SPEED,33,105,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Speed:",IDT_1758,7,107,24,8
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_MO_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,18,253,60
LTEXT "MO drives:",IDT_1769,7,7,50,8
COMBOBOX IDC_COMBO_MO_BUS,33,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1770,7,87,24,8
COMBOBOX IDC_COMBO_MO_ID,170,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "ID:",IDT_1771,131,87,38,8
COMBOBOX IDC_COMBO_MO_CHANNEL_IDE,170,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Channel:",IDT_1772,131,87,38,8
COMBOBOX IDC_COMBO_MO_TYPE,33,105,120,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Type:",IDT_1773,7,107,24,8
CONTROL "List1",IDC_LIST_ZIP_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,137,253,60
@@ -654,7 +678,7 @@ BEGIN
COMBOBOX IDC_COMBO_ZIP_BUS,23,204,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1753,7,206,14,8
COMBOBOX IDC_COMBO_ZIP_ID,139,204,61,12,CBS_DROPDOWNLIST |
COMBOBOX IDC_COMBO_ZIP_ID,149,204,61,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "ID:",IDT_1754,120,206,28,8
COMBOBOX IDC_COMBO_ZIP_CHANNEL_IDE,149,204,61,12,CBS_DROPDOWNLIST |
@@ -708,8 +732,8 @@ END
161 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico"
176 ICON DISCARDABLE "win/icons/zip_empty.ico"
177 ICON DISCARDABLE "win/icons/zip_empty_active.ico"
183 ICON DISCARDABLE "win/icons/mo_empty.ico"
184 ICON DISCARDABLE "win/icons/mo_empty_active.ico"
184 ICON DISCARDABLE "win/icons/mo_empty.ico"
185 ICON DISCARDABLE "win/icons/mo_empty_active.ico"
240 ICON DISCARDABLE "win/icons/machine.ico"
241 ICON DISCARDABLE "win/icons/display.ico"
242 ICON DISCARDABLE "win/icons/input_devices.ico"
@@ -955,7 +979,7 @@ BEGIN
IDS_2112 "Are you sure you want to hard reset the emulated machine?"
IDS_2113 "Are you sure you want to exit 86Box?"
IDS_2114 "Unable to initialize Ghostscript"
IDS_2115 "MO %i (%03i): %ls"
IDS_2115 "MO %i (%ls): %ls"
IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0"
IDS_2117 "Welcome to 86Box!"
IDS_2118 "Internal controller"
@@ -999,6 +1023,7 @@ BEGIN
IDS_2136 "Don't Exit"
IDS_2137 "Reset"
IDS_2138 "Don't Reset"
IDS_2139 "CD-ROM drives"
END
STRINGTABLE DISCARDABLE

View File

@@ -218,17 +218,17 @@ ifndef NEW_DYNAREC
NEW_DYNAREC := n
endif
ifndef DYNAREC
DYNAREC := y
DYNAREC := y
endif
ifeq ($(DYNAREC), y)
ifeq ($(ARM), y)
ifeq ($(NEW_DYNAREC), n)
DYNAREC := n
DYNAREC := n
endif
endif
ifeq ($(ARM64), y)
ifeq ($(NEW_DYNAREC), n)
DYNAREC := n
DYNAREC := n
endif
endif
endif
@@ -311,13 +311,13 @@ ifeq ($(ARM64), y)
CPP := aarch64-w64-mingw32-g++
CC := aarch64-w64-mingw32-gcc
WINDRES := aarch64-w64-mingw32-windres
STRIP := aarch64-w64-mingw32-strip
STRIP := aarch64-w64-mingw32-strip
endif
ifeq ($(ARM), y)
CPP := armv7-w64-mingw32-g++
CC := armv7-w64-mingw32-gcc
WINDRES := armv7-w64-mingw32-windres
STRIP := armv7-w64-mingw32-strip
STRIP := armv7-w64-mingw32-strip
endif
DEPS = -MMD -MF $*.d -c $<
DEPFILE := win/.depends
@@ -366,13 +366,13 @@ else
endif
AFLAGS := -msse2 -mfpmath=sse
ifeq ($(ARM), y)
DFLAGS := -march=armv7-a
AOPTIM :=
DFLAGS := -march=armv7-a
AOPTIM :=
AFLAGS := -mfloat-abi=hard
endif
ifeq ($(ARM64), y)
DFLAGS := -march=armv8-a
AOPTIM :=
DFLAGS := -march=armv8-a
AOPTIM :=
AFLAGS := -mfloat-abi=hard
endif
RFLAGS := --input-format=rc -O coff -Iinclude
@@ -384,6 +384,10 @@ ifeq ($(VRAMDUMP), y)
OPTS += -DENABLE_VRAM_DUMP
RFLAGS += -DENABLE_VRAM_DUMP
endif
ifeq ($(NOHOOK), y)
OPTS += -DNO_KEYBOARD_HOOK
RFLAGS += -DNO_KEYBOARD_HOOK
endif
# Optional modules.

View File

@@ -51,6 +51,7 @@
#include <86box/hdc.h>
#include <86box/hdc_ide.h>
#include <86box/zip.h>
#include <86box/mo.h>
#include <86box/fdd.h>
#include <86box/fdc.h>
#include <86box/fdc_ext.h>
@@ -116,6 +117,7 @@ static int temp_fdd_check_bpb[FDD_NUM];
/* Other removable devices category */
static cdrom_t temp_cdrom[CDROM_NUM];
static zip_drive_t temp_zip_drives[ZIP_NUM];
static mo_drive_t temp_mo_drives[MO_NUM];
static HWND hwndParentDialog, hwndChildDialog;
@@ -320,6 +322,13 @@ win_settings_init(void)
else if (zip_drives[i].bus_type == ZIP_BUS_SCSI)
scsi_tracking[zip_drives[i].scsi_device_id >> 3] |= (1 << ((zip_drives[i].scsi_device_id & 0x07) << 3));
}
memcpy(temp_mo_drives, mo_drives, MO_NUM * sizeof(mo_drive_t));
for (i = 0; i < MO_NUM; i++) {
if (mo_drives[i].bus_type == MO_BUS_ATAPI)
ide_tracking |= (1 << (mo_drives[i].ide_channel << 3));
else if (mo_drives[i].bus_type == MO_BUS_SCSI)
scsi_tracking[mo_drives[i].scsi_device_id >> 3] |= (1 << ((mo_drives[i].scsi_device_id & 0x07) << 3));
}
temp_deviceconfig = 0;
}
@@ -402,6 +411,7 @@ win_settings_changed(void)
/* Other removable devices category */
i = i || memcmp(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t));
i = i || memcmp(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t));
i = i || memcmp(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t));
i = i || !!temp_deviceconfig;
@@ -530,6 +540,11 @@ win_settings_save(void)
zip_drives[i].f = NULL;
zip_drives[i].priv = NULL;
}
memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t));
for (i = 0; i < MO_NUM; i++) {
mo_drives[i].f = NULL;
mo_drives[i].priv = NULL;
}
/* Mark configuration as changed. */
config_changed = 1;
@@ -3785,6 +3800,67 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList)
return TRUE;
}
static BOOL
win_settings_mo_drives_recalc_list(HWND hwndList)
{
LVITEM lvI;
int i = 0, fsid = 0;
WCHAR szText[256];
char szType[30];
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < MO_NUM; i++) {
fsid = combo_id_to_format_string_id(temp_mo_drives[i].bus_type);
lvI.iSubItem = 0;
switch (temp_mo_drives[i].bus_type) {
case MO_BUS_DISABLED:
default:
lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0;
break;
case MO_BUS_ATAPI:
wsprintf(szText, plat_get_string(fsid), temp_mo_drives[i].ide_channel >> 1, temp_mo_drives[i].ide_channel & 1);
lvI.pszText = szText;
lvI.iImage = 1;
break;
case MO_BUS_SCSI:
wsprintf(szText, plat_get_string(fsid), temp_mo_drives[i].scsi_device_id);
lvI.pszText = szText;
lvI.iImage = 1;
break;
}
lvI.iItem = i;
if (ListView_InsertItem(hwndList, &lvI) == -1)
return FALSE;
lvI.iSubItem = 1;
if (temp_mo_drives[i].bus_type == MO_BUS_DISABLED)
lvI.pszText = plat_get_string(IDS_2103);
else {
memset(szType, 0, 30);
memcpy(szType, mo_drive_types[temp_mo_drives[i].type].vendor, 8);
szType[strlen(szType)] = ' ';
memcpy(szType + strlen(szType), mo_drive_types[temp_mo_drives[i].type].model, 16);
szType[strlen(szType)] = ' ';
memcpy(szType + strlen(szType), mo_drive_types[temp_mo_drives[i].type].revision, 4);
mbstowcs(szText, szType, strlen(szType)+1);
lvI.pszText = szText;
}
lvI.iItem = i;
lvI.iImage = 0;
if (ListView_SetItem(hwndList, &lvI) == -1)
return FALSE;
}
return TRUE;
}
static BOOL
win_settings_zip_drives_recalc_list(HWND hwndList)
@@ -3903,6 +3979,34 @@ win_settings_cdrom_drives_init_columns(HWND hwndList)
}
static BOOL
win_settings_mo_drives_init_columns(HWND hwndList)
{
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.iSubItem = 0;
lvc.pszText = plat_get_string(IDS_2081);
lvc.cx = 120;
lvc.fmt = LVCFMT_LEFT;
if (ListView_InsertColumn(hwndList, 0, &lvc) == -1)
return FALSE;
lvc.iSubItem = 1;
lvc.pszText = plat_get_string(IDS_2092);
lvc.cx = 260;
lvc.fmt = LVCFMT_LEFT;
if (ListView_InsertColumn(hwndList, 1, &lvc) == -1)
return FALSE;
return TRUE;
}
static BOOL
win_settings_zip_drives_init_columns(HWND hwndList)
{
@@ -4046,6 +4150,63 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i)
return;
}
static void
win_settings_mo_drives_update_item(HWND hwndList, int i)
{
LVITEM lvI;
WCHAR szText[256];
char szType[30];
int fsid;
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
lvI.iSubItem = 0;
lvI.iItem = i;
fsid = combo_id_to_format_string_id(temp_mo_drives[i].bus_type);
switch (temp_mo_drives[i].bus_type) {
case MO_BUS_DISABLED:
default:
lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0;
break;
case MO_BUS_ATAPI:
wsprintf(szText, plat_get_string(fsid), temp_mo_drives[i].ide_channel >> 1, temp_mo_drives[i].ide_channel & 1);
lvI.pszText = szText;
lvI.iImage = 1;
break;
case MO_BUS_SCSI:
wsprintf(szText, plat_get_string(fsid), temp_mo_drives[i].scsi_device_id);
lvI.pszText = szText;
lvI.iImage = 1;
break;
}
if (ListView_SetItem(hwndList, &lvI) == -1)
return;
lvI.iSubItem = 1;
if (temp_mo_drives[i].bus_type == MO_BUS_DISABLED)
lvI.pszText = plat_get_string(IDS_2103);
else {
memset(szType, 0, 30);
memcpy(szType, mo_drive_types[temp_mo_drives[i].type].vendor, 8);
szType[strlen(szType)] = ' ';
memcpy(szType + strlen(szType), mo_drive_types[temp_mo_drives[i].type].model, 16);
szType[strlen(szType)] = ' ';
memcpy(szType + strlen(szType), mo_drive_types[temp_mo_drives[i].type].revision, 4);
mbstowcs(szText, szType, strlen(szType)+1);
lvI.pszText = szText;
}
lvI.iItem = i;
lvI.iImage = 0;
if (ListView_SetItem(hwndList, &lvI) == -1)
return;
}
static void
win_settings_zip_drives_update_item(HWND hwndList, int i)
@@ -4200,6 +4361,124 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id)
}
}
static void
mo_add_locations(HWND hdlg)
{
LPTSTR lptsTemp;
char *temp;
HWND h;
int i = 0;
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
temp = (char*) malloc(30*sizeof(char));
h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS);
for (i = MO_BUS_DISABLED; i <= MO_BUS_SCSI; i++) {
if ((i == MO_BUS_DISABLED) || (i >= MO_BUS_ATAPI))
SendMessage(h, CB_ADDSTRING, 0, win_get_string(combo_id_to_string_id(i)));
}
h = GetDlgItem(hdlg, IDC_COMBO_MO_ID);
for (i = 0; i < 16; i++) {
wsprintf(lptsTemp, plat_get_string(IDS_4098), i);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE);
for (i = 0; i < 8; i++) {
wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE);
for (int i=0; i < KNOWN_MO_DRIVE_TYPES; i++) {
memset(temp, 0, 30);
memcpy(temp, mo_drive_types[i].vendor, 8);
temp[strlen(temp)] = ' ';
memcpy(temp + strlen(temp), mo_drive_types[i].model, 16);
temp[strlen(temp)] = ' ';
memcpy(temp + strlen(temp), mo_drive_types[i].revision, 4);
mbstowcs(lptsTemp, temp, strlen(temp)+1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
}
free(temp);
free(lptsTemp);
}
static void
mo_recalc_location_controls(HWND hdlg, int assign_id)
{
int i = 0;
HWND h;
int bus = temp_mo_drives[lv1_current_sel].bus_type;
for (i = IDT_1771; i < (IDT_1772 + 1); i++) {
h = GetDlgItem(hdlg, i);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
}
h = GetDlgItem(hdlg, IDC_COMBO_MO_ID);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE);
if (bus == MO_BUS_DISABLED) {
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
} else {
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_mo_drives[lv1_current_sel].type, 0);
}
h = GetDlgItem(hdlg, IDT_1773);
if (bus == CDROM_BUS_DISABLED) {
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
} else {
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
}
switch(bus) {
case MO_BUS_ATAPI: /* ATAPI */
h = GetDlgItem(hdlg, IDT_1772);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
if (assign_id)
temp_mo_drives[lv1_current_sel].ide_channel = next_free_ide_channel();
h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_mo_drives[lv1_current_sel].ide_channel, 0);
break;
case MO_BUS_SCSI: /* SCSI */
h = GetDlgItem(hdlg, IDT_1771);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
if (assign_id)
next_free_scsi_id((uint8_t *) &temp_mo_drives[lv1_current_sel].scsi_device_id);
h = GetDlgItem(hdlg, IDC_COMBO_MO_ID);
ShowWindow(h, SW_SHOW);
EnableWindow(h, TRUE);
SendMessage(h, CB_SETCURSEL, temp_mo_drives[lv1_current_sel].scsi_device_id, 0);
break;
}
}
static void
zip_add_locations(HWND hdlg)
@@ -4335,6 +4614,26 @@ zip_untrack(uint8_t id)
}
static void
mo_track(uint8_t id)
{
if (temp_mo_drives[id].bus_type == MO_BUS_ATAPI)
ide_tracking |= (1 << (temp_zip_drives[id].ide_channel << 3));
else if (temp_mo_drives[id].bus_type == MO_BUS_SCSI)
scsi_tracking[temp_mo_drives[id].scsi_device_id >> 3] |= (1 << (temp_mo_drives[id].scsi_device_id & 0x07));
}
static void
mo_untrack(uint8_t id)
{
if (temp_mo_drives[id].bus_type == MO_BUS_ATAPI)
ide_tracking &= ~(1 << (temp_zip_drives[id].ide_channel << 3));
else if (temp_mo_drives[id].bus_type == MO_BUS_SCSI)
scsi_tracking[temp_mo_drives[id].scsi_device_id >> 3] &= ~(1 << (temp_mo_drives[id].scsi_device_id & 0x07));
}
#if defined(__amd64__) || defined(__aarch64__)
static LRESULT CALLBACK
#else
@@ -4446,13 +4745,12 @@ static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h = NULL;
int old_sel = 0, b = 0, assign = 0;
uint32_t b2 = 0;
const uint8_t cd_icons[3] = { 249, 32, 0 };
const uint8_t zip_icons[3] = { 250, 48, 0 };
switch (message) {
case WM_INITDIALOG:
@@ -4485,33 +4783,6 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
cdrom_recalc_location_controls(hdlg, 0);
lv2_current_sel = 0;
h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES);
win_settings_zip_drives_init_columns(h);
image_list_init(h, (const uint8_t *) zip_icons);
win_settings_zip_drives_recalc_list(h);
ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
zip_add_locations(hdlg);
h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS);
switch (temp_zip_drives[lv2_current_sel].bus_type) {
case ZIP_BUS_DISABLED:
default:
b = 0;
break;
case ZIP_BUS_ATAPI:
b = 1;
break;
case ZIP_BUS_SCSI:
b = 2;
break;
}
SendMessage(h, CB_SETCURSEL, b, 0);
zip_recalc_location_controls(hdlg, 0);
ignore_change = 0;
return TRUE;
@@ -4550,41 +4821,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
SendMessage(h, CB_SETCURSEL, b, 0);
cdrom_recalc_location_controls(hdlg, 0);
ignore_change = 0;
} else if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_ZIP_DRIVES)) {
old_sel = lv2_current_sel;
lv2_current_sel = get_selected_drive(hdlg, IDC_LIST_ZIP_DRIVES);
if (lv2_current_sel == old_sel)
return FALSE;
else if (lv2_current_sel == -1) {
ignore_change = 1;
lv2_current_sel = old_sel;
ListView_SetItemState(h, lv2_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
ignore_change = 0;
return FALSE;
}
ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS);
switch (temp_zip_drives[lv2_current_sel].bus_type) {
case ZIP_BUS_DISABLED:
default:
b = 0;
break;
case ZIP_BUS_ATAPI:
b = 1;
break;
case ZIP_BUS_SCSI:
b = 2;
break;
}
SendMessage(h, CB_SETCURSEL, b, 0);
zip_recalc_location_controls(hdlg, 0);
mo_recalc_location_controls(hdlg, 0);
ignore_change = 0;
}
break;
@@ -4594,7 +4831,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
return FALSE;
ignore_change = 1;
switch (LOWORD(wParam)) {
switch (LOWORD(wParam)) {
case IDC_COMBO_CD_BUS:
h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS);
b = SendMessage(h, CB_GETCURSEL, 0, 0);
@@ -4646,6 +4883,221 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
win_settings_cdrom_drives_update_item(h, lv1_current_sel);
break;
}
ignore_change = 0;
default:
return FALSE;
}
return FALSE;
}
#if defined(__amd64__) || defined(__aarch64__)
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h = NULL;
int old_sel = 0, b = 0, assign = 0;
uint32_t b2 = 0;
const uint8_t mo_icons[3] = { 251, 56, 0 };
const uint8_t zip_icons[3] = { 250, 48, 0 };
switch (message) {
case WM_INITDIALOG:
ignore_change = 1;
lv1_current_sel = 0;
h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
win_settings_mo_drives_init_columns(h);
image_list_init(h, (const uint8_t *) mo_icons);
win_settings_mo_drives_recalc_list(h);
ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
mo_add_locations(hdlg);
h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS);
switch (temp_mo_drives[lv1_current_sel].bus_type) {
case MO_BUS_DISABLED:
default:
b = 0;
break;
case MO_BUS_ATAPI:
b = 1;
break;
case MO_BUS_SCSI:
b = 2;
break;
}
SendMessage(h, CB_SETCURSEL, b, 0);
mo_recalc_location_controls(hdlg, 0);
lv2_current_sel = 0;
h = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES);
win_settings_zip_drives_init_columns(h);
image_list_init(h, (const uint8_t *) zip_icons);
win_settings_zip_drives_recalc_list(h);
ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
zip_add_locations(hdlg);
h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS);
switch (temp_zip_drives[lv2_current_sel].bus_type) {
case ZIP_BUS_DISABLED:
default:
b = 0;
break;
case ZIP_BUS_ATAPI:
b = 1;
break;
case ZIP_BUS_SCSI:
b = 2;
break;
}
SendMessage(h, CB_SETCURSEL, b, 0);
zip_recalc_location_controls(hdlg, 0);
ignore_change = 0;
return TRUE;
case WM_NOTIFY:
if (ignore_change)
return FALSE;
if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_MO_DRIVES)) {
old_sel = lv1_current_sel;
lv1_current_sel = get_selected_drive(hdlg, IDC_LIST_MO_DRIVES);
if (lv1_current_sel == old_sel)
return FALSE;
else if (lv1_current_sel == -1) {
ignore_change = 1;
lv1_current_sel = old_sel;
ListView_SetItemState(h, lv1_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
ignore_change = 0;
return FALSE;
}
ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS);
switch (temp_mo_drives[lv1_current_sel].bus_type) {
case MO_BUS_DISABLED:
default:
b = 0;
break;
case MO_BUS_ATAPI:
b = 1;
break;
case MO_BUS_SCSI:
b = 2;
break;
}
SendMessage(h, CB_SETCURSEL, b, 0);
mo_recalc_location_controls(hdlg, 0);
ignore_change = 0;
} else if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_ZIP_DRIVES)) {
old_sel = lv2_current_sel;
lv2_current_sel = get_selected_drive(hdlg, IDC_LIST_ZIP_DRIVES);
if (lv2_current_sel == old_sel)
return FALSE;
else if (lv2_current_sel == -1) {
ignore_change = 1;
lv2_current_sel = old_sel;
ListView_SetItemState(h, lv2_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
ignore_change = 0;
return FALSE;
}
ignore_change = 1;
h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS);
switch (temp_zip_drives[lv2_current_sel].bus_type) {
case ZIP_BUS_DISABLED:
default:
b = 0;
break;
case ZIP_BUS_ATAPI:
b = 1;
break;
case ZIP_BUS_SCSI:
b = 2;
break;
}
SendMessage(h, CB_SETCURSEL, b, 0);
zip_recalc_location_controls(hdlg, 0);
ignore_change = 0;
}
break;
case WM_COMMAND:
if (ignore_change)
return FALSE;
ignore_change = 1;
switch (LOWORD(wParam)) {
case IDC_COMBO_MO_BUS:
h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS);
b = SendMessage(h, CB_GETCURSEL, 0, 0);
switch (b) {
case 0:
b2 = MO_BUS_DISABLED;
break;
case 1:
b2 = MO_BUS_ATAPI;
break;
case 2:
b2 = MO_BUS_SCSI;
break;
}
if (b2 == temp_mo_drives[lv1_current_sel].bus_type)
break;
mo_untrack(lv1_current_sel);
assign = (temp_mo_drives[lv1_current_sel].bus_type == b2) ? 0 : 1;
if (temp_mo_drives[lv1_current_sel].bus_type == MO_BUS_DISABLED)
temp_mo_drives[lv1_current_sel].type = 0;
temp_mo_drives[lv1_current_sel].bus_type = b2;
mo_recalc_location_controls(hdlg, assign);
mo_track(lv1_current_sel);
h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
win_settings_mo_drives_update_item(h, lv1_current_sel);
break;
case IDC_COMBO_MO_ID:
h = GetDlgItem(hdlg, IDC_COMBO_MO_ID);
mo_untrack(lv1_current_sel);
temp_mo_drives[lv1_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0);
mo_track(lv1_current_sel);
h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
win_settings_mo_drives_update_item(h, lv1_current_sel);
break;
case IDC_COMBO_MO_CHANNEL_IDE:
h = GetDlgItem(hdlg, IDC_COMBO_MO_CHANNEL_IDE);
mo_untrack(lv1_current_sel);
temp_mo_drives[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
mo_track(lv1_current_sel);
h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
win_settings_mo_drives_update_item(h, lv1_current_sel);
break;
case IDC_COMBO_MO_TYPE:
h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE);
temp_mo_drives[lv1_current_sel].type = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
win_settings_mo_drives_update_item(h, lv1_current_sel);
break;
case IDC_COMBO_ZIP_BUS:
h = GetDlgItem(hdlg, IDC_COMBO_ZIP_BUS);
@@ -4746,6 +5198,9 @@ void win_settings_show_child(HWND hwndParent, DWORD child_id)
case SETTINGS_PAGE_FLOPPY_DRIVES:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_FLOPPY_DRIVES, hwndParent, win_settings_floppy_drives_proc);
break;
case SETTINGS_PAGE_CDROM_DRIVES:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_CDROM_DRIVES, hwndParent, win_settings_cdrom_drives_proc);
break;
case SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES:
hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_OTHER_REMOVABLE_DEVICES, hwndParent, win_settings_other_removable_devices_proc);
break;
@@ -4767,13 +5222,18 @@ win_settings_main_insert_categories(HWND hwndList)
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < 10; i++) {
lvI.pszText = plat_get_string(IDS_2065+i);
lvI.iItem = i;
lvI.iImage = i;
for (i = 0; i < 11; i++) {
if (i <= 8)
lvI.pszText = plat_get_string(IDS_2065+i);
else if (i == 9)
lvI.pszText = plat_get_string(IDS_2139);
else if (i == 10)
lvI.pszText = plat_get_string(IDS_2074);
lvI.iItem = i;
lvI.iImage = i;
if (ListView_InsertItem(hwndList, &lvI) == -1)
return FALSE;
if (ListView_InsertItem(hwndList, &lvI) == -1)
return FALSE;
}
return TRUE;
@@ -4815,7 +5275,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h = NULL;
int category, i = 0, j = 0;
const uint8_t cat_icons[11] = { 240, 241, 242, 243, 80, 244, 245, 64, 246, 247, 0 };
const uint8_t cat_icons[12] = { 240, 241, 242, 243, 80, 244, 245, 64, 246, 32, 247, 0 };
hwndParentDialog = hdlg;
@@ -4831,7 +5291,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_NOTIFY:
if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST)) {
category = -1;
for (i = 0; i < 10; i++) {
for (i = 0; i < 11; i++) {
h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
if (j)

View File

@@ -51,6 +51,7 @@
#include <86box/plat.h>
#include <86box/ui.h>
#include <86box/win.h>
#include <86box/mo.h>
#ifndef GWL_WNDPROC
#define GWL_WNDPROC GWLP_WNDPROC
@@ -491,6 +492,18 @@ ui_sb_update_panes(void)
continue;
if (zip_drives[i].bus_type != 0)
sb_parts++;
}
for (i=0; i<MO_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) &&
!(hdint || !memcmp(hdc_name, "ide", 3)))
continue;
if ((mo_drives[i].bus_type == MO_BUS_SCSI) &&
(scsi_card_current == 0))
continue;
if (mo_drives[i].bus_type != 0)
sb_parts++;
}
if (c_mfm && (hdint || !memcmp(hdc_name, "st506", 5))) {
/* MFM drives, and MFM or Internal controller. */
@@ -793,6 +806,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 48; i < 50; i++)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 56; i < 58; i++)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 64; i < 66; i++)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 80; i < 82; i++)
@@ -805,6 +820,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 176; i < 178; i++)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 184; i < 186; i++)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
for (i = 243; i < 244; i++)
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);

View File

@@ -297,10 +297,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_CREATE:
SetTimer(hwnd, TIMER_1SEC, 1000, NULL);
#ifndef NO_KEYBOARD_HOOK
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc,
GetModuleHandle(NULL), 0);
hook_enabled = 1;
#endif
break;
case WM_COMMAND:
@@ -329,7 +331,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
else
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
if (i == 0) {
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
}
@@ -697,7 +701,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
else
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
if (i == 0) {
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
}
@@ -705,7 +711,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_DESTROY:
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
break;
@@ -746,7 +754,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
else
i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL);
if (i == 0) {
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
}
@@ -776,6 +786,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETFOCUS:
infocus = 1;
#ifndef NO_KEYBOARD_HOOK
if (! hook_enabled) {
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc,
@@ -783,15 +794,18 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
0);
hook_enabled = 1;
}
#endif
break;
case WM_KILLFOCUS:
infocus = 0;
plat_mouse_capture(0);
#ifndef NO_KEYBOARD_HOOK
if (hook_enabled) {
UnhookWindowsHookEx(hKeyboardHook);
hook_enabled = 0;
}
#endif
break;
case WM_ENTERSIZEMOVE:
@@ -1276,6 +1290,7 @@ input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_SETFOCUS:
infocus = 1;
#ifndef NO_KEYBOARD_HOOK
if (! hook_enabled) {
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc,
@@ -1283,15 +1298,18 @@ input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
0);
hook_enabled = 1;
}
#endif
break;
case WM_KILLFOCUS:
infocus = 0;
plat_mouse_capture(0);
#ifndef NO_KEYBOARD_HOOK
if (hook_enabled) {
UnhookWindowsHookEx(hKeyboardHook);
hook_enabled = 0;
}
#endif
break;
case WM_LBUTTONUP: