Applied all relevant PCem commits;

Extensively cleaned up and changed the CD-ROM code;
Removed CD-ROM IOCTTL (it was causing performance and stability issues);
Turned a lot of things into device_t's;
Added the PS/1 Model 2011 XTA and standalone XTA hard disk controllers, ported from Varcem;
Numerous FDC fixes for the PS/1 Model 2121;
NVR changes ported from Varcem;
The PCap code no longer requires libpcap to be compiled;
Numerous fixes to various SCSI controllers;
Updated NukedOPL to 1.8;
Fixes to OpenAL initialization and closing, should give less Audio issues now;
Revorked parts of the common (S)VGA code (also based on code from QEMU);
Removed the Removable SCSI hard disks (they were a never finished experiment so there was no need to keep them there);
Cleaned up the SCSI hard disk and Iomega ZIP code (but more cleanups of that are coming in the future);
In some occasions (IDE hard disks in multiple sector mode and SCSI hard disks) the status bar icon is no longer updated, should improve performance a bit;
Redid the way the tertiary and quaternary IDE controllers are configured (and they are now device_t's);
Extensively reworked the IDE code and fixed quite a few bugs;
Fixes to XT MFM, AT MFM, and AT ESDI code;
Some changes to XTIDE and MCA ESDI code;
Some fixes to the CD-ROM image handler.
This commit is contained in:
OBattler
2018-04-25 23:51:13 +02:00
parent 2789adca0e
commit a412ceb4d9
151 changed files with 21026 additions and 21058 deletions

View File

@@ -8,7 +8,7 @@
*
* Application resource script for Windows.
*
* Version: @(#)86Box.rc 1.0.31 2018/03/06
* Version: @(#)86Box.rc 1.0.32 2018/03/26
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -445,16 +445,17 @@ BEGIN
PUSHBUTTON "Configure",IDC_CONFIGURE_SCSI,214,7,46,12
LTEXT "HD Controller:",IDT_1717,7,26,61,10
COMBOBOX IDC_COMBO_HDC,71,25,189,120,CBS_DROPDOWNLIST |
COMBOBOX IDC_COMBO_HDC,71,25,149,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_HDC,214,25,46,12
LTEXT "Tertiary IDE:",IDT_1718,7,44,61,10
COMBOBOX IDC_COMBO_IDE_TER,71,43,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Tertiary IDE Controller",IDC_CHECK_IDE_TER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,44,199,10
PUSHBUTTON "Configure",IDC_BUTTON_IDE_TER,214,43,46,12
LTEXT "Quaternary IDE:",IDT_1719,7,62,61,10
COMBOBOX IDC_COMBO_IDE_QUA,71,61,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Quaternary IDE Controller",IDC_CHECK_IDE_QUA,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,62,199,10
PUSHBUTTON "Configure",IDC_BUTTON_IDE_QUA,214,61,46,12
CONTROL "ISABugger device",IDC_CHECK_BUGGER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,80,94,10
@@ -570,7 +571,7 @@ BEGIN
CONTROL "List1",IDC_LIST_ZIP_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,137,253,60
LTEXT "ZIP drives:",IDT_1739,7,127,50,8
LTEXT "ZIP drives:",IDT_1759,7,127,50,8
COMBOBOX IDC_COMBO_ZIP_BUS,73,204,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1753,57,206,14,8
@@ -617,12 +618,10 @@ END
161 ICON DISCARDABLE "win/icons/cdrom_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"
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"
256 ICON DISCARDABLE "win/icons/machine.ico"
257 ICON DISCARDABLE "win/icons/display.ico"
258 ICON DISCARDABLE "win/icons/input_devices.ico"
@@ -641,8 +640,6 @@ END
417 ICON DISCARDABLE "win/icons/cdrom_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"
@@ -936,8 +933,8 @@ BEGIN
IDS_2153 "Unable to load Keyboard Accelerators!"
IDS_2154 "Unable to register Raw Input!"
IDS_2155 "IRQ %i"
IDS_2156 "%" PRIu64
IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")"
IDS_2156 "%u"
IDS_2157 "%u MB (CHS: %i, %i, %i)"
IDS_2158 "Floppy %i (%s): %ls"
IDS_2159 "All images (*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.360;*.720;*.86F;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.360;*.720;*.BIN;*.CQ?;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
@@ -957,7 +954,7 @@ BEGIN
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_2177 "ZIP %03i %i (%s): %ls"
IDS_2178 "Speed"
IDS_4096 "Hard disk (%s)"
@@ -979,23 +976,18 @@ BEGIN
IDS_4112 "Please enter a valid file name"
IDS_4113 "Remember to partition and format the new drive"
IDS_4114 "MFM/RLL or ESDI CD-ROM drives never existed"
IDS_4115 "Removable disk %i (SCSI): %ls"
IDS_4352 "MFM/RLL"
IDS_4353 "XT IDE"
IDS_4353 "XTA"
IDS_4354 "ESDI"
IDS_4355 "IDE (PIO-only)"
IDS_4356 "IDE (PIO+DMA)"
IDS_4357 "SCSI"
IDS_4358 "SCSI (removable)"
IDS_4355 "IDE"
IDS_4356 "SCSI"
IDS_4608 "MFM/RLL (%01i:%01i)"
IDS_4609 "XT IDE (%01i:%01i)"
IDS_4609 "XTA (%01i:%01i)"
IDS_4610 "ESDI (%01i:%01i)"
IDS_4611 "IDE (PIO-only) (%01i:%01i)"
IDS_4612 "IDE (PIO+DMA) (%01i:%01i)"
IDS_4613 "SCSI (%02i:%02i)"
IDS_4614 "SCSI (removable) (%02i:%02i)"
IDS_4611 "IDE (%01i:%01i)"
IDS_4612 "SCSI (%02i:%02i)"
IDS_5120 "CD-ROM %i (%s): %s"
@@ -1003,17 +995,15 @@ BEGIN
IDS_5377 "<Reserved>"
IDS_5378 "<Reserved>"
IDS_5379 "<Reserved>"
IDS_5380 "ATAPI (PIO-only)"
IDS_5381 "ATAPI (PIO and DMA)"
IDS_5382 "SCSI"
IDS_5380 "ATAPI"
IDS_5381 "SCSI"
IDS_5632 "Disabled"
IDS_5633 "<Reserved>"
IDS_5634 "<Reserved>"
IDS_5635 "<Reserved>"
IDS_5636 "ATAPI (PIO-only) (%01i:%01i)"
IDS_5637 "ATAPI (PIO and DMA) (%01i:%01i)"
IDS_5638 "SCSI (%02i:%02i)"
IDS_5636 "ATAPI (%01i:%01i)"
IDS_5637 "SCSI (%02i:%02i)"
IDS_5888 "160 kB"
IDS_5889 "180 kB"

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.113 2018/03/18
# Version: @(#)Makefile.mingw 1.0.114 2018/03/31
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -108,6 +108,9 @@ else
ifndef STEALTH32
STEALTH32 := n
endif
ifndef VGAWONDER
VGAWONDER := n
endif
ifndef VNC
VNC := n
endif
@@ -391,6 +394,10 @@ OPTS += -DUSE_STEALTH32
DEVBROBJ += vid_icd2061.o
endif
ifeq ($(VGAWONDER), y)
OPTS += -DUSE_VGAWONDER
endif
ifeq ($(XL24), y)
OPTS += -DUSE_XL24
endif
@@ -433,13 +440,13 @@ MCHOBJ := machine.o machine_table.o \
m_xt_xi8088.o \
m_pcjr.o \
m_amstrad.o \
m_europc.o m_europc_hdc.o \
m_europc.o \
m_olivetti_m24.o m_tandy.o \
m_at.o \
m_at_ali1429.o m_at_commodore.o \
m_at_neat.o m_at_headland.o \
m_at_t3100e.o m_at_t3100e_vid.o \
m_ps1.o \
m_ps1.o m_ps1_hdc.o \
m_ps2_isa.o m_ps2_mca.o \
m_at_opti495.o m_at_scat.o \
m_at_compaq.o m_at_wd76c10.o \
@@ -467,10 +474,10 @@ FDDOBJ := fdd.o fdc.o fdi2raw.o \
HDDOBJ := hdd.o \
hdd_image.o hdd_table.o \
hdc.o \
hdc_mfm_xt.o hdc_xtide.o \
hdc_mfm_at.o \
hdc_mfm_xt.o hdc_mfm_at.o \
hdc_xta.o \
hdc_esdi_at.o hdc_esdi_mca.o \
hdc_ide.o
hdc_xtide.o hdc_ide.o
CDROMOBJ := cdrom.o \
cdrom_dosbox.o cdrom_image.o cdrom_null.o
@@ -549,7 +556,7 @@ VIDOBJ := video.o \
PLATOBJ := win.o \
win_dynld.o win_thread.o \
win_cdrom.o win_cdrom_ioctl.o win_keyboard.o \
win_cdrom.o win_keyboard.o \
win_mouse.o win_joystick.o win_midi.o
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(MCHOBJ) $(DEVOBJ) \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -8,7 +8,7 @@
*
* Windows resource defines.
*
* Version: @(#)resource.h 1.0.22 2018/03/06
* Version: @(#)resource.h 1.0.23 2018/03/26
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -58,8 +58,7 @@
#define IDT_1715 1715 /* Network adapter: */
#define IDT_1716 1716 /* SCSI Controller: */
#define IDT_1717 1717 /* HD Controller: */
#define IDT_1718 1718 /* Tertiary IDE: */
#define IDT_1719 1719 /* Quaternary IDE: */
#define IDT_1718 1718
#define IDT_1720 1720 /* Hard disks: */
#define IDT_1721 1721 /* Bus: */
#define IDT_1722 1722 /* Channel: */
@@ -91,6 +90,7 @@
#define IDT_1756 1756 /* Channel: */
#define IDT_1757 1757 /* Progress: */
#define IDT_1758 1758 /* Speed: */
#define IDT_1759 1759 /* ZIP drives: */
/*
@@ -157,9 +157,12 @@
#define IDC_COMBO_SCSI 1121
#define IDC_CONFIGURE_SCSI 1122
#define IDC_COMBO_HDC 1123
#define IDC_COMBO_IDE_TER 1124
#define IDC_COMBO_IDE_QUA 1125
#define IDC_CHECK_BUGGER 1126
#define IDC_CONFIGURE_HDC 1124
#define IDC_CHECK_IDE_TER 1125
#define IDC_BUTTON_IDE_TER 1126
#define IDC_CHECK_IDE_QUA 1127
#define IDC_BUTTON_IDE_QUA 1128
#define IDC_CHECK_BUGGER 1129
#define IDC_HARD_DISKS 1130 /* hard disk config */
#define IDC_LIST_HARD_DISKS 1131

View File

@@ -8,7 +8,7 @@
*
* Platform main support module for Windows.
*
* Version: @(#)win.c 1.0.46 2018/03/16
* Version: @(#)win.c 1.0.47 2018/03/28
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -75,6 +75,7 @@ static rc_str_t *lpRCstr2048,
*lpRCstr5888,
*lpRCstr6144,
*lpRCstr7168;
static int vid_api_inited = 0;
static struct {
@@ -202,27 +203,26 @@ plat_get_string(int i)
{
LPTSTR str;
if ((i >= 2048) && (i <= 3071)) {
if ((i >= 2048) && (i <= 3071))
str = lpRCstr2048[i-2048].str;
} else if ((i >= 4096) && (i <= 4351)) {
else if ((i >= 4096) && (i <= 4351))
str = lpRCstr4096[i-4096].str;
} else if ((i >= 4352) && (i <= 4607)) {
else if ((i >= 4352) && (i <= 4607))
str = lpRCstr4352[i-4352].str;
} else if ((i >= 4608) && (i <= 5119)) {
else if ((i >= 4608) && (i <= 5119))
str = lpRCstr4608[i-4608].str;
} else if ((i >= 5120) && (i <= 5375)) {
else if ((i >= 5120) && (i <= 5375))
str = lpRCstr5120[i-5120].str;
} else if ((i >= 5376) && (i <= 5631)) {
else if ((i >= 5376) && (i <= 5631))
str = lpRCstr5376[i-5376].str;
} else if ((i >= 5632) && (i <= 5887)) {
else if ((i >= 5632) && (i <= 5887))
str = lpRCstr5632[i-5632].str;
} else if ((i >= 5888) && (i <= 6143)) {
else if ((i >= 5888) && (i <= 6143))
str = lpRCstr5888[i-5888].str;
} else if ((i >= 6144) && (i <= 7167)) {
else if ((i >= 6144) && (i <= 7167))
str = lpRCstr6144[i-6144].str;
} else {
else
str = lpRCstr7168[i-7168].str;
}
return((wchar_t *)str);
}
@@ -251,29 +251,24 @@ CreateConsole(int init)
/* Not logging to file, attach to console. */
if (! AttachConsole(ATTACH_PARENT_PROCESS)) {
/* Parent has no console, create one. */
AllocConsole();
if (! AllocConsole()) {
/* Cannot create console, just give up. */
return;
}
}
fp = NULL;
if ((h = GetStdHandle(STD_OUTPUT_HANDLE)) != NULL) {
/* We got the handle, now open a file descriptor. */
if ((i = _open_osfhandle((intptr_t)h, _O_TEXT)) != -1) {
/* We got a file descriptor, now allocate a new stream. */
if ((fp = _fdopen(i, "w")) != NULL) {
/* Got the stream, re-initialize stdout without it. */
(void)freopen("CONOUT$", "w", stdout);
setvbuf(stdout, NULL, _IONBF, 0);
fflush(stdout);
}
}
}
h = GetStdHandle(STD_OUTPUT_HANDLE);
i = _open_osfhandle((intptr_t)h, _O_TEXT);
fp = _fdopen(i, "w");
setvbuf(fp, NULL, _IONBF, 1);
*stdout = *fp;
h = GetStdHandle(STD_ERROR_HANDLE);
i = _open_osfhandle((intptr_t)h, _O_TEXT);
fp = _fdopen(i, "w");
setvbuf(fp, NULL, _IONBF, 1);
*stderr = *fp;
#if 0
/* Set up stdin as well. */
h = GetStdHandle(STD_INPUT_HANDLE);
i = _open_osfhandle((intptr_t)h, _O_TEXT);
fp = _fdopen(i, "r");
setvbuf(fp, NULL, _IONBF, 128);
*stdin = *fp;
#endif
}
@@ -588,7 +583,7 @@ plat_vidapi(char *name)
{
int i;
if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(1);
if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(0);
for (i=0; i<4; i++) {
if (vid_apis[0][i].name &&
@@ -596,7 +591,7 @@ plat_vidapi(char *name)
}
/* Default value. */
return(1);
return(0);
}
@@ -607,25 +602,16 @@ plat_vidapi_name(int api)
char *name = "default";
switch(api) {
#if USE_WX
case 0:
break;
case 1:
name = "wxwidgets";
break;
#else
case 0:
name = "ddraw";
break;
case 1:
#if 0
/* Direct3D is default. */
name = "d3d";
/* DirectDraw is default. */
name = "ddraw";
#endif
break;
#endif
case 1:
name = "d3d";
break;
#ifdef USE_VNC
case 2:
@@ -679,6 +665,8 @@ plat_setvid(int api)
device_force_redraw();
vid_api_inited = 1;
return(1);
}
@@ -687,7 +675,7 @@ plat_setvid(int api)
void
plat_vidsize(int x, int y)
{
if (! vid_apis[video_fullscreen][vid_api].resize) return;
if (!vid_api_inited || !vid_apis[video_fullscreen][vid_api].resize) return;
startblit();
video_wait_for_blit();
@@ -798,6 +786,16 @@ take_screenshot(void)
}
/* LPARAM interface to plat_get_string(). */
LPARAM win_get_string(int id)
{
wchar_t *ret;
ret = plat_get_string(id);
return ((LPARAM) ret);
}
void /* plat_ */
startblit(void)
{

View File

@@ -8,7 +8,7 @@
*
* Platform support defintions for Win32.
*
* Version: @(#)win.h 1.0.15 2018/03/18
* Version: @(#)win.h 1.0.16 2018/03/28
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -91,6 +91,8 @@ extern void keyboard_handle(LPARAM lParam, int infocus);
extern void win_mouse_init(void);
extern void win_mouse_close(void);
extern LPARAM win_get_string(int id);
extern intptr_t fdd_type_to_icon(int type);
#ifdef EMU_DEVICE_H

View File

@@ -8,13 +8,13 @@
*
* Handle the About dialog.
*
* Version: @(#)win_about.c 1.0.5 2017/12/13
* Version: @(#)win_about.c 1.0.6 2018/03/28
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define UNICODE
#define BITMAP WINDOWS_BITMAP
@@ -39,13 +39,15 @@ static BOOL CALLBACK
AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
HANDLE ih;
switch (message) {
case WM_INITDIALOG:
plat_pause(1);
h = GetDlgItem(hdlg, IDC_ABOUT_ICON);
ih = LoadImage(hinstance,(PCTSTR)100,IMAGE_ICON,64,64,0);
SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON,
(LPARAM)LoadImage(hinstance,(PCTSTR)100,IMAGE_ICON,64,64,0));
(LPARAM)ih);
break;
case WM_COMMAND:

View File

@@ -8,7 +8,7 @@
*
* Handle the platform-side of CDROM drives.
*
* Version: @(#)win_cdrom.c 1.0.6 2018/03/17
* Version: @(#)win_cdrom.c 1.0.7 2018/03/26
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -28,43 +28,18 @@
#include <stdlib.h>
#include <wchar.h>
#include "../config.h"
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../disk/hdd.h"
#include "../disk/zip.h"
#include "../scsi/scsi.h"
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../scsi/scsi_disk.h"
#include "../plat.h"
#include "../ui.h"
#include "win.h"
uint8_t host_cdrom_drive_available[26];
uint8_t host_cdrom_drive_available_num = 0;
void
cdrom_init_host_drives(void)
{
WCHAR s[64];
int i = 0;
host_cdrom_drive_available_num = 0;
for (i='A'; i<='Z'; i++) {
_swprintf(s, L"%c:\\", i);
if (GetDriveType(s)==DRIVE_CDROM) {
host_cdrom_drive_available[i - 'A'] = 1;
host_cdrom_drive_available_num++;
} else {
host_cdrom_drive_available[i - 'A'] = 0;
}
}
}
void
cdrom_eject(uint8_t id)
{
@@ -73,12 +48,6 @@ cdrom_eject(uint8_t id)
return;
}
if ((cdrom_drives[id].host_drive >= 'A') &&
(cdrom_drives[id].host_drive <= 'Z')) {
ui_sb_check_menu_item(SB_CDROM|id,
IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
if (cdrom_image[id].prev_image_path) {
free(cdrom_image[id].prev_image_path);
cdrom_image[id].prev_image_path = NULL;
@@ -89,12 +58,13 @@ cdrom_eject(uint8_t id)
wcscpy(cdrom_image[id].prev_image_path, cdrom_image[id].image_path);
}
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
cdrom_drives[id].handler->exit(id);
cdrom_close(id);
cdrom_null_open(id, 0);
cdrom[id]->handler->exit(id);
cdrom_close_handler(id);
memset(cdrom_image[id].image_path, 0, 2048);
cdrom_null_open(id);
if (cdrom_drives[id].bus_type) {
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
cdrom_insert(cdrom[id]);
}
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
@@ -111,14 +81,13 @@ cdrom_eject(uint8_t id)
void
cdrom_reload(uint8_t id)
{
int new_cdrom_drive;
if ((cdrom_drives[id].host_drive == cdrom_drives[id].prev_host_drive) || (cdrom_drives[id].prev_host_drive == 0) || (cdrom_drives[id].host_drive != 0)) {
/* Switch from empty to empty. Do nothing. */
return;
}
cdrom_close(id);
cdrom_close_handler(id);
memset(cdrom_image[id].image_path, 0, 2048);
if (cdrom_drives[id].prev_host_drive == 200) {
wcscpy(cdrom_image[id].image_path, cdrom_image[id].prev_image_path);
@@ -127,7 +96,7 @@ cdrom_reload(uint8_t id)
image_open(id, cdrom_image[id].image_path);
if (cdrom_drives[id].bus_type) {
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
cdrom_insert(cdrom[id]);
}
if (wcslen(cdrom_image[id].image_path) == 0) {
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
@@ -140,17 +109,6 @@ cdrom_reload(uint8_t id)
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_CHECKED);
ui_sb_update_icon_state(SB_CDROM|id, 0);
}
} else {
new_cdrom_drive = cdrom_drives[id].prev_host_drive;
ioctl_open(id, new_cdrom_drive);
if (cdrom_drives[id].bus_type) {
/* Signal disc change to the emulated machine. */
cdrom_insert(id);
}
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = new_cdrom_drive;
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
ui_sb_update_icon_state(SB_CDROM|id, 0);
}
ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
@@ -194,56 +152,3 @@ zip_reload(uint8_t id)
config_save();
}
void
removable_disk_unload(uint8_t id)
{
if (wcslen(hdd[id].fn) == 0) {
/* Switch from empty to empty. Do nothing. */
return;
}
scsi_unloadhd(hdd[id].scsi_id, hdd[id].scsi_lun, id);
scsi_disk_insert(id);
}
void
removable_disk_eject(uint8_t id)
{
removable_disk_unload(id);
ui_sb_update_icon_state(SB_RDISK|id, 1);
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_update_tip(SB_RDISK|id);
config_save();
}
void
removable_disk_reload(uint8_t id)
{
if (wcslen(hdd[id].fn) != 0) {
/* Attempting to reload while an image is already loaded. Do nothing. */
return;
}
scsi_reloadhd(id);
#if 0
scsi_disk_insert(id);
#endif
ui_sb_update_icon_state(SB_RDISK|id, wcslen(hdd[id].fn) ? 0 : 1);
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_EJECT | id, MF_BYCOMMAND | (wcslen(hdd[id].fn) ? MF_ENABLED : MF_GRAYED));
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_enable_menu_item(SB_RDISK|id, IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | (wcslen(hdd[id].fn) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_RDISK|id);
config_save();
}

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@
* NOTES: This code should be re-merged into a single init() with a
* 'fullscreen' argument, indicating FS mode is requested.
*
* Version: @(#)win_ddraw.cpp 1.0.6 2018/03/16
* Version: @(#)win_ddraw.cpp 1.0.7 2018/03/28
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -110,7 +110,6 @@ DoubleLines(uint8_t *dst, uint8_t *src)
static void
SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
{
BITMAPFILEHEADER bmpFileHeader;
BITMAPINFO bmpInfo;
HDC hdc;
LPVOID pBuf = NULL;

View File

@@ -8,7 +8,7 @@
*
* Windows device configuration dialog implementation.
*
* Version: @(#)win_devconf.c 1.0.17 2018/03/20
* Version: @(#)win_devconf.c 1.0.18 2018/04/01
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -468,7 +468,7 @@ uint8_t deviceconfig_open(HWND hwnd, const device_t *device)
deviceconfig_changed = 0;
memset(data_block, 0, 4096);
memset(data_block, 0, 16384);
dlg->style = DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU;
dlg->x = 10;
@@ -480,10 +480,10 @@ uint8_t deviceconfig_open(HWND hwnd, const device_t *device)
*data++ = 0; /*no menu*/
*data++ = 0; /*predefined dialog box class*/
data += MultiByteToWideChar(CP_ACP, 0, "Device Configuration", -1, data, 50);
data += MultiByteToWideChar(CP_ACP, 0, "Device Configuration", -1, data, 120);
*data++ = 9; /*Point*/
data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 50);
data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 120);
if (((uintptr_t)data) & 2)
data++;

View File

@@ -8,7 +8,7 @@
*
* Several dialogs for the application.
*
* Version: @(#)win_dialog.c 1.0.8 2018/01/21
* Version: @(#)win_dialog.c 1.0.9 2018/04/01
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -32,53 +32,11 @@
#include "win.h"
WCHAR path[MAX_PATH];
WCHAR wopenfilestring[260];
char openfilestring[260];
uint8_t filterindex = 0;
static int CALLBACK
BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED)
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
return(0);
}
wchar_t *
BrowseFolder(wchar_t *saved_path, wchar_t *title)
{
BROWSEINFO bi = { 0 };
LPITEMIDLIST pidl;
IMalloc *imalloc;
bi.lpszTitle = title;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM) saved_path;
pidl = SHBrowseForFolder(&bi);
if (pidl != 0) {
/* Get the name of the folder and put it in path. */
SHGetPathFromIDList(pidl, path);
/* Free memory used. */
imalloc = 0;
if (SUCCEEDED(SHGetMalloc(&imalloc))) {
imalloc->lpVtbl->Free(imalloc, pidl);
imalloc->lpVtbl->Release(imalloc);
}
return(path);
}
return(L"");
}
int
ui_msgbox(int flags, void *arg)
{

View File

@@ -8,7 +8,7 @@
*
* Handle the New Floppy Image dialog.
*
* Version: @(#)win_new_floppy.c 1.0.5 2018/03/19
* Version: @(#)win_new_floppy.c 1.0.6 2018/03/28
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
@@ -65,7 +65,7 @@ disk_size_t disk_sizes[14] = { { 0, 1, 2, 1, 0, 40, 8, 2, 0xFE, 2, 2, 1, 112
{ 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;
static unsigned char *empty;
static int
@@ -137,7 +137,7 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
if (array_size2 & 15)
array_size += 2;
empty = (char *) malloc(array_size);
empty = (unsigned char *) malloc(array_size);
memset(tarray, 0, 2048);
memset(empty, 0, array_size);
@@ -209,7 +209,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
zero_bytes = fat2_offs + fat_size + root_dir_bytes;
if (!is_zip && is_fdi) {
empty = (char *) malloc(base);
empty = (unsigned char *) malloc(base);
memset(empty, 0, base);
*(uint32_t *) &(empty[0x08]) = (uint32_t) base;
@@ -223,7 +223,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
free(empty);
}
empty = (char *) malloc(total_size);
empty = (unsigned char *) malloc(total_size);
memset(empty, 0x00, zero_bytes);
if (!is_zip) {
@@ -344,7 +344,7 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi,
pbar_max++;
if (is_zdi) {
empty = (char *) malloc(base);
empty = (unsigned char *) malloc(base);
memset(empty, 0, base);
*(uint32_t *) &(empty[0x08]) = (uint32_t) base;
@@ -364,7 +364,7 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi,
pbar_max -= 2;
}
empty = (char *) malloc(total_size);
empty = (unsigned char *) malloc(total_size);
memset(empty, 0x00, zero_bytes);
if (total_sectors == ZIP_SECTORS) {
@@ -566,16 +566,16 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
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));
SendMessage(h, CB_ADDSTRING, 0, win_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_ADDSTRING, 0, win_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_ADDSTRING, 0, win_get_string(IDS_6144 + i));
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);

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.17 2018/03/18
* Version: @(#)win_stbar.c 1.0.17 2018/03/26
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -33,14 +33,14 @@
#include "../cpu/cpu.h"
#include "../device.h"
#include "../machine/machine.h"
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../disk/hdd.h"
#include "../disk/hdc.h"
#include "../disk/zip.h"
#include "../floppy/fdd.h"
#include "../scsi/scsi.h"
#include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h"
#include "../scsi/scsi_disk.h"
#include "../network/network.h"
#include "../video/video.h"
@@ -63,11 +63,11 @@ static HMENU *sb_menu_handles;
static HMENU menuSBAR;
static WCHAR **sbTips;
static int *iStatusWidths;
static int *sb_icon_flags;
static int *sb_part_meanings;
static int *sb_part_icons;
static int sb_parts = 0;
static int sb_ready = 0;
static uint8_t sb_map[256];
/* Also used by win_settings.c */
@@ -80,22 +80,13 @@ fdd_type_to_icon(int type)
case 0:
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 1: case 2: case 3: case 4:
case 5: case 6:
ret = 128;
break;
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 7: case 8: case 9: case 10:
case 11: case 12: case 13:
ret = 144;
break;
@@ -150,9 +141,6 @@ StatusBarCreateFloppySubmenu(HMENU m, int id)
static void
StatusBarCreateCdromSubmenu(HMENU m, int id)
{
WCHAR s[64];
int i;
AppendMenu(m, MF_STRING, IDM_CDROM_MUTE | id,
plat_get_string(IDS_2165));
AppendMenu(m, MF_SEPARATOR, 0, 0);
@@ -164,41 +152,12 @@ StatusBarCreateCdromSubmenu(HMENU m, int id)
AppendMenu(m, MF_STRING, IDM_CDROM_IMAGE | id,
plat_get_string(IDS_2168));
if (host_cdrom_drive_available_num == 0) {
if ((cdrom_drives[id].host_drive >= 'A') &&
(cdrom_drives[id].host_drive <= 'Z')) {
cdrom_drives[id].host_drive = 0;
}
goto check_menu_items;
} else {
if ((cdrom_drives[id].host_drive >= 'A') &&
(cdrom_drives[id].host_drive <= 'Z')) {
if (!host_cdrom_drive_available[cdrom_drives[id].host_drive - 'A']) {
cdrom_drives[id].host_drive = 0;
}
}
}
AppendMenu(m, MF_SEPARATOR, 0, 0);
for (i=0; i<26; i++) {
_swprintf(s, L"Host CD/DVD Drive (%c:)", i+'A');
if (host_cdrom_drive_available[i])
AppendMenu(m, MF_STRING, IDM_CDROM_HOST_DRIVE | (i<<3)|id, s);
}
check_menu_items:
if (! cdrom_drives[id].sound_on)
CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED);
if (cdrom_drives[id].host_drive == 200)
CheckMenuItem(m, IDM_CDROM_IMAGE | id, MF_CHECKED);
else
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z')) {
CheckMenuItem(m, IDM_CDROM_HOST_DRIVE | id |
((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
} else {
else {
cdrom_drives[id].host_drive = 0;
CheckMenuItem(m, IDM_CDROM_EMPTY | id, MF_CHECKED);
}
@@ -231,74 +190,26 @@ StatusBarCreateZIPSubmenu(HMENU m, int id)
}
static void
StatusBarCreateRemovableDiskSubmenu(HMENU m, int id)
{
AppendMenu(m, MF_STRING, IDM_RDISK_EJECT | id,
plat_get_string(IDS_2164));
AppendMenu(m, MF_STRING, IDM_RDISK_RELOAD | id,
plat_get_string(IDS_2167));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_RDISK_SEND_CHANGE | id,
plat_get_string(IDS_2142));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_RDISK_IMAGE | id,
plat_get_string(IDS_2168));
AppendMenu(m, MF_STRING, IDM_RDISK_IMAGE_WP | id,
plat_get_string(IDS_2169));
}
/* API */
int
ui_sb_find_part(int tag)
{
int found = -1;
int i;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL)) {
return -1;
}
for (i=0; i<sb_parts; i++) {
if (sb_part_meanings[i] == tag) {
found = i;
break;
}
}
return(found);
}
/* API: update one of the icons after activity. */
void
ui_sb_update_icon(int tag, int active)
{
int temp_flags = 0;
int found;
uint8_t found = 0xff;
if (!update_icons)
return;
if (((tag & 0xf0) >= SB_TEXT) || !sb_ready || (sb_parts == 0) || (sb_icon_flags == NULL) || (sb_part_icons == NULL)) {
if (((tag & 0xf0) >= SB_TEXT) || !sb_ready)
return;
}
temp_flags |= active;
found = sb_map[tag];
if (found != 0xff) {
sb_part_icons[found] &= ~1;
sb_part_icons[found] |= active;
found = ui_sb_find_part(tag);
if (found != -1) {
if (temp_flags != (sb_icon_flags[found] & 1)) {
sb_icon_flags[found] &= ~1;
sb_icon_flags[found] |= active;
sb_part_icons[found] &= ~257;
sb_part_icons[found] |= sb_icon_flags[found];
SendMessage(hwndSBAR, SB_SETICON, found,
(LPARAM)hIcon[sb_part_icons[found]]);
}
SendMessage(hwndSBAR, SB_SETICON, found,
(LPARAM)hIcon[sb_part_icons[found]]);
}
}
@@ -307,19 +218,15 @@ ui_sb_update_icon(int tag, int active)
void
ui_sb_update_icon_state(int tag, int state)
{
int found = -1;
uint8_t found = 0xff;
if (((tag & 0xf0) >= SB_HDD) || !sb_ready || (sb_parts == 0) || (sb_icon_flags == NULL) || (sb_part_icons == NULL)) {
if (((tag & 0xf0) >= SB_HDD) || !sb_ready)
return;
}
found = ui_sb_find_part(tag);
if (found != -1) {
sb_icon_flags[found] &= ~256;
sb_icon_flags[found] |= state ? 256 : 0;
sb_part_icons[found] &= ~257;
sb_part_icons[found] |= sb_icon_flags[found];
found = sb_map[tag];
if (found != 0xff) {
sb_part_icons[found] &= ~256;
sb_part_icons[found] |= (state ? 256 : 0);
SendMessage(hwndSBAR, SB_SETICON, found,
(LPARAM)hIcon[sb_part_icons[found]]);
@@ -357,28 +264,22 @@ StatusBarCreateFloppyTip(int part)
static void
StatusBarCreateCdromTip(int part)
{
WCHAR wtext[512];
WCHAR tempTip[512];
WCHAR *szText;
int id;
int drive = sb_part_meanings[part] & 0xf;
int bus = cdrom_drives[drive].bus_type;
id = IDS_4352 + (bus - 1);
id = IDS_5377 + (bus - 1);
szText = plat_get_string(id);
if (cdrom_drives[drive].host_drive == 200) {
if (wcslen(cdrom_image[drive].image_path) == 0) {
if (wcslen(cdrom_image[drive].image_path) == 0)
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, plat_get_string(IDS_2057));
} else {
else
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, cdrom_image[drive].image_path);
}
} else if ((cdrom_drives[drive].host_drive >= 'A') && (cdrom_drives[drive].host_drive <= 'Z')) {
_swprintf(wtext, plat_get_string(IDS_2058), cdrom_drives[drive].host_drive & ~0x20);
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, wtext);
} else {
} else
_swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, plat_get_string(IDS_2057));
}
if (sbTips[part] != NULL) {
free(sbTips[part]);
@@ -393,38 +294,22 @@ static void
StatusBarCreateZIPTip(int part)
{
WCHAR tempTip[512];
WCHAR *szText;
int id;
int drive = sb_part_meanings[part] & 0xf;
int bus = zip_drives[drive].bus_type;
id = IDS_5377 + (bus - 1);
szText = plat_get_string(id);
int type = zip_drives[drive].is_250 ? 250 : 100;
if (wcslen(zip_drives[drive].image_path) == 0) {
_swprintf(tempTip, plat_get_string(IDS_2177),
drive+1, type, plat_get_string(IDS_2057));
type, drive+1, szText, 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)
{
WCHAR tempTip[512];
int drive = sb_part_meanings[part] & 0x1f;
if (wcslen(hdd[drive].fn) == 0) {
_swprintf(tempTip, plat_get_string(IDS_4115), drive, plat_get_string(IDS_2057));
} else {
_swprintf(tempTip, plat_get_string(IDS_4115), drive, hdd[drive].fn);
type, drive+1, szText, zip_drives[drive].image_path);
}
if (sbTips[part] != NULL) {
@@ -487,18 +372,13 @@ StatusBarCreateSoundTip(int part)
void
ui_sb_update_tip(int meaning)
{
int part = -1;
int i;
uint8_t part = 0xff;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL)) return;
for (i=0; i<sb_parts; i++) {
if (sb_part_meanings[i] == meaning) {
part = i;
}
}
part = sb_map[meaning];
if (part != -1) {
if (part != 0xff) {
switch(meaning & 0xf0) {
case SB_FLOPPY:
StatusBarCreateFloppyTip(part);
@@ -512,10 +392,6 @@ ui_sb_update_tip(int meaning)
StatusBarCreateZIPTip(part);
break;
case SB_RDISK:
StatusBarCreateRemovableDiskTip(part);
break;
case SB_HDD:
StatusBarCreateDiskTip(part);
break;
@@ -597,8 +473,8 @@ ui_sb_update_panes(void)
{
int i, id, hdint;
int edge = 0;
int c_mfm, c_esdi, c_scsi;
int c_xtide, c_ide_pio, c_ide_dma;
int c_mfm, c_esdi, c_xta;
int c_ide, c_scsi;
int do_net;
sb_ready = 0;
@@ -606,9 +482,8 @@ ui_sb_update_panes(void)
hdint = (machines[machine].flags & MACHINE_HDC) ? 1 : 0;
c_mfm = hdd_count(HDD_BUS_MFM);
c_esdi = hdd_count(HDD_BUS_ESDI);
c_xtide = hdd_count(HDD_BUS_XTIDE);
c_ide_pio = hdd_count(HDD_BUS_IDE_PIO_ONLY);
c_ide_dma = hdd_count(HDD_BUS_IDE_PIO_AND_DMA);
c_xta = hdd_count(HDD_BUS_XTA);
c_ide = hdd_count(HDD_BUS_IDE);
c_scsi = hdd_count(HDD_BUS_SCSI);
do_net = network_available();
@@ -629,14 +504,12 @@ ui_sb_update_panes(void)
free(sb_part_icons);
sb_part_icons = NULL;
}
if (sb_icon_flags) {
free(sb_icon_flags);
sb_icon_flags = NULL;
}
StatusBarDestroyMenus();
StatusBarDestroyTips();
}
memset(sb_map, 0xff, sizeof(sb_map));
sb_parts = 0;
for (i=0; i<FDD_NUM; i++) {
if (fdd_get_type(i) != 0)
@@ -644,50 +517,27 @@ ui_sb_update_panes(void)
}
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
if ((cdrom_drives[i].bus_type == CDROM_BUS_ATAPI) &&
!(hdint || !memcmp(hdc_name, "ide", 3)))
continue;
}
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
if ((cdrom_drives[i].bus_type == CDROM_BUS_SCSI) &&
(scsi_card_current == 0)) {
(scsi_card_current == 0))
continue;
}
if (cdrom_drives[i].bus_type != 0) {
if (cdrom_drives[i].bus_type != 0)
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))) {
if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) &&
!(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)) {
(scsi_card_current == 0))
continue;
}
if (zip_drives[i].bus_type != 0) {
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++;
}
}
if (c_mfm && (hdint || !memcmp(hdc_name, "mfm", 3))) {
/* MFM drives, and MFM or Internal controller. */
@@ -697,23 +547,14 @@ ui_sb_update_panes(void)
/* ESDI drives, and ESDI or Internal controller. */
sb_parts++;
}
if (c_xtide && !memcmp(hdc_name, "xtide", 5)) {
if (c_xta && (hdint || !memcmp(hdc_name, "xta", 3)))
sb_parts++;
}
if (c_ide_pio && (hdint || !memcmp(hdc_name, "ide", 3))) {
/* IDE_PIO drives, and IDE or Internal controller. */
if (c_ide && (hdint || !memcmp(hdc_name, "xtide", 5) || !memcmp(hdc_name, "ide", 3)))
sb_parts++;
}
if (c_ide_dma && (hdint || !memcmp(hdc_name, "ide", 3))) {
/* IDE_DMA drives, and IDE or Internal controller. */
if (c_scsi && (scsi_card_current != 0))
sb_parts++;
}
if (c_scsi && (scsi_card_current != 0)) {
if (do_net)
sb_parts++;
}
if (do_net) {
sb_parts++;
}
sb_parts += 2;
iStatusWidths = (int *)malloc(sb_parts * sizeof(int));
@@ -722,8 +563,6 @@ ui_sb_update_panes(void)
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
sb_part_icons = (int *)malloc(sb_parts * sizeof(int));
memset(sb_part_icons, 0, sb_parts * sizeof(int));
sb_icon_flags = (int *)malloc(sb_parts * sizeof(int));
memset(sb_icon_flags, 0, sb_parts * sizeof(int));
sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
@@ -735,56 +574,38 @@ ui_sb_update_panes(void)
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_FLOPPY | i;
sb_map[SB_FLOPPY | i] = sb_parts;
sb_parts++;
}
}
for (i=0; i<CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_ONLY) &&
if ((cdrom_drives[i].bus_type == CDROM_BUS_ATAPI) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((cdrom_drives[i].bus_type==CDROM_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
if ((cdrom_drives[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0))
continue;
}
if ((cdrom_drives[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0)) {
continue;
}
if (cdrom_drives[i].bus_type != 0) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_CDROM | i;
sb_map[SB_CDROM | i] = sb_parts;
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))) {
if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) &&
!(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))) {
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && (scsi_card_current == 0))
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;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_RDISK | i;
sb_map[SB_ZIP | i] = sb_parts;
sb_parts++;
}
}
@@ -792,54 +613,56 @@ ui_sb_update_panes(void)
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_MFM;
sb_map[SB_HDD | HDD_BUS_MFM] = sb_parts;
sb_parts++;
}
if (c_esdi && (hdint || !memcmp(hdc_name, "esdi", 4))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_ESDI;
sb_map[SB_HDD | HDD_BUS_ESDI] = sb_parts;
sb_parts++;
}
if (c_xtide && !memcmp(hdc_name, "xtide", 5)) {
if (c_xta && (hdint || !memcmp(hdc_name, "xta", 3))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_XTIDE;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_XTA;
sb_map[SB_HDD | HDD_BUS_XTA] = sb_parts;
sb_parts++;
}
if (c_ide_pio && (hdint || !memcmp(hdc_name, "ide", 3))) {
if (c_ide && (hdint || !memcmp(hdc_name, "xtide", 5) || !memcmp(hdc_name, "ide", 3))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_IDE_PIO_ONLY;
sb_parts++;
}
if (c_ide_dma && (hdint || !memcmp(hdc_name, "ide", 3))) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_IDE_PIO_AND_DMA;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_IDE;
sb_map[SB_HDD | HDD_BUS_IDE] = sb_parts;
sb_parts++;
}
if (c_scsi && (scsi_card_current != 0)) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_HDD | HDD_BUS_SCSI;
sb_map[SB_HDD | HDD_BUS_SCSI] = sb_parts;
sb_parts++;
}
if (do_net) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_NETWORK;
sb_map[SB_NETWORK] = sb_parts;
sb_parts++;
}
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_SOUND;
sb_map[SB_SOUND] = sb_parts;
sb_parts++;
if (sb_parts)
iStatusWidths[sb_parts - 1] += (24 - SB_ICON_WIDTH);
iStatusWidths[sb_parts] = -1;
sb_part_meanings[sb_parts] = SB_TEXT;
sb_map[SB_TEXT] = sb_parts;
sb_parts ++;
SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths);
@@ -847,24 +670,21 @@ ui_sb_update_panes(void)
for (i=0; i<sb_parts; i++) {
switch (sb_part_meanings[i] & 0xf0) {
case SB_FLOPPY: /* Floppy */
sb_icon_flags[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
sb_part_icons[i] = fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf)) | sb_icon_flags[i];
sb_part_icons[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
sb_part_icons[i] |= fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf));
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
StatusBarCreateFloppySubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
EnableMenuItem(sb_menu_handles[i], IDM_FLOPPY_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED));
EnableMenuItem(sb_menu_handles[i], IDM_FLOPPY_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 256) ? MF_GRAYED : MF_ENABLED));
StatusBarCreateFloppyTip(i);
break;
case SB_CDROM: /* CD-ROM */
id = sb_part_meanings[i] & 0xf;
if (cdrom_drives[id].host_drive == 200) {
sb_icon_flags[i] = (wcslen(cdrom_image[id].image_path) == 0) ? 256 : 0;
} else if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z')) {
sb_icon_flags[i] = 0;
} else {
sb_icon_flags[i] = 256;
}
sb_part_icons[i] = 160 | sb_icon_flags[i];
if (cdrom_drives[id].host_drive == 200)
sb_part_icons[i] = (wcslen(cdrom_image[id].image_path) == 0) ? 256 : 0;
else
sb_part_icons[i] = 256;
sb_part_icons[i] |= 160;
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
StatusBarCreateCdromSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
EnableMenuItem(sb_menu_handles[i], IDM_CDROM_RELOAD | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | MF_GRAYED);
@@ -872,32 +692,21 @@ ui_sb_update_panes(void)
break;
case SB_ZIP: /* Iomega ZIP */
sb_icon_flags[i] = (wcslen(zip_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 256 : 0;
sb_part_icons[i] = 176 + sb_icon_flags[i];
sb_part_icons[i] = (wcslen(zip_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 256 : 0;
sb_part_icons[i] |= 176;
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));
EnableMenuItem(sb_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[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] = 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));
EnableMenuItem(sb_menu_handles[i], IDM_RDISK_RELOAD | (sb_part_meanings[i] & 0x1f), MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(sb_menu_handles[i], IDM_RDISK_SEND_CHANGE | (sb_part_meanings[i] & 0x1f), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED));
StatusBarCreateRemovableDiskTip(i);
break;
case SB_HDD: /* Hard disk */
sb_part_icons[i] = 208;
sb_part_icons[i] = 192;
StatusBarCreateDiskTip(i);
break;
case SB_NETWORK: /* Network */
sb_part_icons[i] = 224;
sb_part_icons[i] = 208;
StatusBarCreateNetworkTip(i);
break;
@@ -916,9 +725,8 @@ ui_sb_update_panes(void)
SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L"");
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)hIcon[sb_part_icons[i]]);
SendMessage(hwndSBAR, SB_SETTIPTEXT, i, (LPARAM)sbTips[i]);
} else {
} else
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)NULL);
}
}
sb_ready = 1;
@@ -979,13 +787,11 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR temp_path[1024];
RECT rc;
POINT pt;
int new_cdrom_drive;
int ret = 0;
int item_id = 0;
int item_params = 0;
int id = 0;
int part = 0;
int letter = 0;
uint8_t part = 0;
switch (message) {
case WM_COMMAND:
@@ -995,15 +801,15 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (item_id) {
case IDM_FLOPPY_IMAGE_NEW:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_FLOPPY | id);
part = sb_map[SB_FLOPPY | id];
NewFloppyDialogCreate(hwnd, id, part);
break;
case IDM_FLOPPY_IMAGE_EXISTING:
case IDM_FLOPPY_IMAGE_EXISTING_WP:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_FLOPPY | id);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[SB_FLOPPY | id];
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
ret = file_dlg_w_st(hwnd, IDS_2159, floppyfns[id], 0);
@@ -1013,8 +819,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_FLOPPY_EJECT:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_FLOPPY | id);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[SB_FLOPPY | id];
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
fdd_close(id);
@@ -1027,8 +833,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_FLOPPY_EXPORT_TO_86F:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_FLOPPY | id);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[SB_FLOPPY | id];
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
ret = file_dlg_w_st(hwnd, IDS_2173, floppyfns[id], 1);
@@ -1043,8 +849,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_CDROM_MUTE:
id = item_params & 0x0007;
part = ui_sb_find_part(SB_CDROM | id);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[SB_CDROM | id];
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
cdrom_drives[id].sound_on ^= 1;
@@ -1065,8 +871,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_CDROM_IMAGE:
id = item_params & 0x0007;
part = ui_sb_find_part(SB_CDROM | id);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[SB_CDROM | id];
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
if (!file_dlg_w_st(hwnd, IDS_2075, cdrom_image[id].image_path, 0)) {
@@ -1075,15 +881,13 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (!cdrom_image[id].prev_image_path)
cdrom_image[id].prev_image_path = (wchar_t *) malloc(1024);
wcscpy(cdrom_image[id].prev_image_path, cdrom_image[id].image_path);
cdrom_drives[id].handler->exit(id);
cdrom_close(id);
cdrom[id]->handler->exit(id);
cdrom_close_handler(id);
memset(cdrom_image[id].image_path, 0, 2048);
image_open(id, temp_path);
/* Signal media change to the emulated machine. */
cdrom_insert(id);
cdrom_insert(cdrom[id]);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z')) {
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
cdrom_drives[id].host_drive = (wcslen(cdrom_image[id].image_path) == 0) ? 0 : 200;
if (cdrom_drives[id].host_drive == 200) {
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_CHECKED);
@@ -1099,52 +903,17 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case IDM_CDROM_HOST_DRIVE:
id = item_params & 0x0007;
letter = ((item_params >> 3) & 0x001f) + 'A';
part = ui_sb_find_part(SB_CDROM | id);
if ((part == -1) || (sb_menu_handles == NULL))
{
break;
}
new_cdrom_drive = letter;
if (cdrom_drives[id].host_drive == new_cdrom_drive)
{
/* Switching to the same drive. Do nothing. */
break;
}
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
cdrom_drives[id].handler->exit(id);
cdrom_close(id);
ioctl_open(id, new_cdrom_drive);
/* Signal media change to the emulated machine. */
cdrom_insert(id);
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
{
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED);
}
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED);
cdrom_drives[id].host_drive = new_cdrom_drive;
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED);
EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_update_icon_state(SB_CDROM | id, 0);
ui_sb_update_tip(SB_CDROM | id);
config_save();
break;
case IDM_ZIP_IMAGE_NEW:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_ZIP | id);
part = sb_map[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))
part = sb_map[SB_ZIP | id];
if ((part == 0xff) || (sb_menu_handles == NULL))
break;
ret = file_dlg_w_st(hwnd, IDS_2175, zip_drives[id].image_path, 0);
@@ -1162,49 +931,6 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
zip_reload(id);
break;
case IDM_RDISK_EJECT:
id = item_params & 0x001f;
removable_disk_eject(id);
break;
case IDM_RDISK_RELOAD:
id = item_params & 0x001f;
removable_disk_reload(id);
break;
case IDM_RDISK_SEND_CHANGE:
id = item_params & 0x001f;
scsi_disk_insert(id);
break;
case IDM_RDISK_IMAGE:
case IDM_RDISK_IMAGE_WP:
id = item_params & 0x001f;
ret = file_dlg_w_st(hwnd, IDS_4106, hdd[id].fn, id);
if (!ret) {
removable_disk_unload(id);
memset(hdd[id].fn, 0, sizeof(hdd[id].fn));
wcscpy(hdd[id].fn, wopenfilestring);
hdd[id].wp = (item_id == IDM_RDISK_IMAGE_WP) ? 1 : 0;
scsi_loadhd(hdd[id].scsi_id, hdd[id].scsi_lun, id);
scsi_disk_insert(id);
if (wcslen(hdd[id].fn) > 0) {
ui_sb_update_icon_state(SB_RDISK | id, 0);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_ENABLED);
}
else {
ui_sb_update_icon_state(SB_RDISK | id, 1);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(sb_menu_handles[part], IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_GRAYED);
}
ui_sb_update_tip(SB_RDISK | id);
config_save();
}
break;
default:
break;
}
@@ -1260,8 +986,6 @@ 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 = 259; i < 260; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 384; i < 386; i++)
@@ -1272,8 +996,6 @@ 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;
@@ -1317,8 +1039,6 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
sb_part_icons = (int *)malloc(sb_parts * sizeof(int));
memset(sb_part_icons, 0, sb_parts * sizeof(int));
sb_icon_flags = (int *)malloc(sb_parts * sizeof(int));
memset(sb_icon_flags, 0, sb_parts * sizeof(int));
sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
@@ -1339,10 +1059,10 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
void
ui_sb_check_menu_item(int tag, int id, int chk)
{
int part;
uint8_t part;
part = ui_sb_find_part(tag);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[tag];
if ((part == 0xff) || (sb_menu_handles == NULL))
return;
CheckMenuItem(sb_menu_handles[part], id, chk);
@@ -1353,10 +1073,10 @@ ui_sb_check_menu_item(int tag, int id, int chk)
void
ui_sb_enable_menu_item(int tag, int id, int flg)
{
int part;
uint8_t part;
part = ui_sb_find_part(tag);
if ((part == -1) || (sb_menu_handles == NULL))
part = sb_map[tag];
if ((part == 0xff) || (sb_menu_handles == NULL))
return;
EnableMenuItem(sb_menu_handles[part], id, flg);
@@ -1367,18 +1087,14 @@ ui_sb_enable_menu_item(int tag, int id, int flg)
void
ui_sb_set_text_w(wchar_t *wstr)
{
int part = -1;
int i;
uint8_t part = 0xff;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL)) return;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
return;
for (i=0; i<sb_parts; i++) {
if (sb_part_meanings[i] == SB_TEXT) {
part = i;
}
}
part = sb_map[SB_TEXT];
if (part != -1)
if (part != 0xff)
SendMessage(hwndSBAR, SB_SETTEXT, part | SBT_NOBORDERS, (LPARAM)wstr);
}

View File

@@ -8,13 +8,13 @@
*
* Implement threads and mutexes for the Win32 platform.
*
* Version: @(#)win_thread.c 1.0.5 2017/10/19
* Version: @(#)win_thread.c 1.0.6 2018/03/28
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2017 Fred N. van Kempen.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017,2018 Fred N. van Kempen.
*/
#define UNICODE
#define BITMAP WINDOWS_BITMAP
@@ -39,7 +39,8 @@ typedef struct {
thread_t *
thread_create(void (*func)(void *param), void *param)
{
return((thread_t *)_beginthread(func, 0, param));
uintptr_t bt = _beginthread(func, 0, param);
return((thread_t *)bt);
}

View File

@@ -8,7 +8,7 @@
*
* user Interface module for WinAPI on Windows.
*
* Version: @(#)win_ui.c 1.0.23 2018/03/19
* Version: @(#)win_ui.c 1.0.24 2018/04/21
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -75,12 +75,10 @@ show_cursor(int val)
return;
if (val == 0) {
while (1) {
while (1)
if (ShowCursor(FALSE) < 0) break;
}
} else {
} else
ShowCursor(TRUE);
}
vis = val;
}
@@ -94,23 +92,6 @@ LoadIconEx(PCTSTR pszIconName)
}
#if 0
static void
win_menu_update(void)
{
menuMain = LoadMenu(hinstance, L"MainMenu"));
menuSBAR = LoadMenu(hinstance, L"StatusBarMenu");
initmenu();
SetMenu(hwndMain, menu);
win_title_update = 1;
}
#endif
static void
video_toggle_option(HMENU h, int *val, int id)
{
@@ -554,6 +535,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
#endif
#if 0
case IDM_CONFIG_LOAD:
plat_pause(1);
if (!file_dlg_st(hwnd, IDS_2160, "", 0) &&
@@ -571,6 +553,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
plat_pause(0);
break;
#endif
}
return(0);
@@ -749,11 +732,6 @@ ui_init(int nCmdShow)
HACCEL haccel; /* handle to accelerator table */
int bRet;
#if 0
/* We should have an application-wide at_exit catcher. */
atexit(plat_mouse_capture);
#endif
if (settings_only) {
if (! pc_init_modules()) {
/* Dang, no ROMs found at all! */
@@ -1021,9 +999,6 @@ plat_resize(int x, int y)
int sb_borders[3];
RECT r;
#if 0
pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", video_fullscreen, vid_api, x, y);
#endif
/* First, see if we should resize the UI window. */
if (!vid_resize) {
video_wait_for_blit();