diff --git a/src/86box.h b/src/86box.h index 516356138..42b516047 100644 --- a/src/86box.h +++ b/src/86box.h @@ -8,13 +8,16 @@ * * Main emulator include file. * - * Version: @(#)86box.h 1.0.2 2017/06/04 + * Version: @(#)86box.h 1.0.3 2017/10/09 + * + * Authors: Miran Grca, + * Fred N. van Kempen, * - * Author: Miran Grca, * Copyright 2016-2017 Miran Grca. + * Copyright 2017 Fred N. van Kempen. */ -#ifndef BOX_H -# define BOX_H +#ifndef EMU_86BOX_H +# define EMU_86BOX_H #if defined(ENABLE_BUSLOGIC_LOG) || \ @@ -38,5 +41,8 @@ #define CONFIG_FILE_W L"86box.cfg" +#define NVR_PATH L"nvr" +#define SCREENSHOT_PATH L"screenshots" -#endif /*BOX_H*/ + +#endif /*EMU_86BOX_H*/ diff --git a/src/Makefile.mingw b/src/Makefile.mingw index b61d985fe..c4712b04e 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -8,7 +8,7 @@ # # Modified Makefile for Win32 (MinGW32) environment. # -# Version: @(#)Makefile.mingw 1.0.54 2017/10/07 +# Version: @(#)Makefile.mingw 1.0.55 2017/10/09 # # Authors: Miran Grca, # Fred N. van Kempen, @@ -106,19 +106,18 @@ VPATH := $(EXPATH) . cpu \ sound/munt/srchelper \ sound/resid-fp \ scsi video lzf network network/slirp win -PLAT := win/ ifeq ($(X64), y) -CPP := g++.exe -m64 -CC := gcc.exe -m64 +CPP := g++ -m64 +CC := gcc -m64 else -CPP := g++.exe -m32 -CC := gcc.exe -m32 +CPP := g++ -m32 +CC := gcc -m32 endif -WINDRES := windres.exe +WINDRES := windres DEPS = -MMD -MF $*.d -c $< # Set up the correct toolchain flags. -OPTS := -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF) +OPTS := -DWIN32 $(EXTRAS) $(STUFF) ifdef EXFLAGS OPTS += $(EXFLAGS) endif @@ -295,9 +294,8 @@ USBOBJ := usb.o endif SCSIOBJ := scsi.o \ - scsi_bios_command.o scsi_bus.o scsi_device.o scsi_disk.o \ - scsi_buslogic.o scsi_aha154x.o \ - scsi_ncr5380.o + scsi_bus.o scsi_bios_command.o scsi_device.o scsi_disk.o \ + scsi_buslogic.o scsi_aha154x.o scsi_ncr5380.o NETOBJ := network.o \ net_pcap.o \ diff --git a/src/bugger.c b/src/bugger.c index 2646d78cc..75d5c983c 100644 --- a/src/bugger.c +++ b/src/bugger.c @@ -44,7 +44,7 @@ * configuration register (CTRL_SPCFG bit set) but have to * remember that stuff first... * - * Version: @(#)bugger.c 1.0.6 2017/10/05 + * Version: @(#)bugger.c 1.0.7 2017/10/09 * * Author: Fred N. van Kempen, * Copyright 1989-2017 Fred N. van Kempen. @@ -55,7 +55,7 @@ #include #include "ibm.h" #include "io.h" -#include "win/win.h" +#include "ui.h" #include "bugger.h" @@ -104,7 +104,7 @@ bug_setui(void) (bug_ledr&0x02)?'R':'r', (bug_ledr&0x01)?'R':'r'); /* Send formatted string to the UI. */ - StatusBarSetText(bug_str); + ui_sb_set_text(bug_str); } diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index 62a9f41bf..6fb07fba5 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -9,7 +9,7 @@ * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)cdrom.c 1.0.13 2017/10/08 + * Version: @(#)cdrom.c 1.0.14 2017/10/09 * * Author: Miran Grca, * @@ -30,9 +30,8 @@ #include "../nvr.h" #include "../disk/hdc.h" #include "../disk/hdc_ide.h" -#include "../win/win.h" -#include "../win/win_cdrom_ioctl.h" -#include "../win/plat_iodev.h" +#include "../plat.h" +#include "../ui.h" #include "cdrom.h" #include "cdrom_image.h" #include "cdrom_null.h" @@ -2017,6 +2016,47 @@ static int cdrom_read_dvd_structure(uint8_t id, int format, const uint8_t *packe } } +/*SCSI Get Event Status Notification*/ +static uint32_t cdrom_get_event_status(uint8_t id, uint8_t *buffer) +{ + uint8_t event_code, media_status = 0; + + if (buffer[5]) + { + media_status = MS_TRAY_OPEN; + if (cdrom_drives[id].handler->stop) + { + cdrom_drives[id].handler->stop(id); + } + } + else + { + media_status = MS_MEDIA_PRESENT; + } + + event_code = MEC_NO_CHANGE; + if (media_status != MS_TRAY_OPEN) + { + if (!buffer[4]) + { + event_code = MEC_NEW_MEDIA; + cdrom_drives[id].handler->load(id); + } + else if (buffer[4]==2) + { + event_code = MEC_EJECT_REQUESTED; + cdrom_drives[id].handler->eject(id); + } + } + + buffer[4] = event_code; + buffer[5] = media_status; + buffer[6] = 0; + buffer[7] = 0; + + return 8; +} + void cdrom_insert(uint8_t id) { cdrom[id].unit_attention = 1; @@ -2120,15 +2160,6 @@ skip_ready_check: } /* Next it's time for NOT READY. */ - if (!ready) - { - cdrom[id].media_status = MEC_MEDIA_REMOVAL; - } - else - { - cdrom[id].media_status = (cdrom[id].unit_attention) ? MEC_NEW_MEDIA : MEC_NO_CHANGE; - } - if ((cdrom_command_flags[cdb[0]] & CHECK_READY) && !ready) { cdrom_log("CD-ROM %i: Not ready (%02X)\n", id, cdb[0]); @@ -2569,11 +2600,11 @@ cdrom_readtoc_fallback: cdrom[id].all_blocks_total = cdrom[id].block_total; if (cdrom[id].packet_status != CDROM_PHASE_COMPLETE) { - StatusBarUpdateIcon(SB_CDROM | id, 1); + ui_sb_update_icon(SB_CDROM | id, 1); } else { - StatusBarUpdateIcon(SB_CDROM | id, 0); + ui_sb_update_icon(SB_CDROM | id, 0); } return; @@ -2833,12 +2864,7 @@ cdrom_readtoc_fallback: if (gesn_cdb->class & (1 << GESN_MEDIA)) { gesn_event_header->notification_class |= GESN_MEDIA; - - cdbufferb[4] = cdrom[id].media_status; /* Bits 7-4 = Reserved, Bits 4-1 = Media Status */ - cdbufferb[5] = 1; /* Power Status (1 = Active) */ - cdbufferb[6] = 0; - cdbufferb[7] = 0; - used_len = 8; + used_len = cdrom_get_event_status(id, cdbufferb); } else { @@ -2847,8 +2873,6 @@ cdrom_readtoc_fallback: } gesn_event_header->len = used_len - sizeof(*gesn_event_header); - memcpy(cdbufferb, gesn_event_header, 4); - if (SCSI_BufferLength == -1) { SCSI_BufferLength = used_len; @@ -3790,7 +3814,7 @@ void cdrom_phase_callback(uint8_t id) cdrom[id].status = READY_STAT; cdrom[id].phase = 3; cdrom[id].packet_status = 0xFF; - StatusBarUpdateIcon(SB_CDROM | id, 0); + ui_sb_update_icon(SB_CDROM | id, 0); cdrom_irq_raise(id); return; case CDROM_PHASE_DATA_OUT: @@ -3805,7 +3829,7 @@ void cdrom_phase_callback(uint8_t id) cdrom[id].packet_status = CDROM_PHASE_COMPLETE; cdrom[id].status = READY_STAT; cdrom[id].phase = 3; - StatusBarUpdateIcon(SB_CDROM | id, 0); + ui_sb_update_icon(SB_CDROM | id, 0); cdrom_irq_raise(id); return; case CDROM_PHASE_DATA_IN: @@ -3820,7 +3844,7 @@ void cdrom_phase_callback(uint8_t id) cdrom[id].packet_status = CDROM_PHASE_COMPLETE; cdrom[id].status = READY_STAT; cdrom[id].phase = 3; - StatusBarUpdateIcon(SB_CDROM | id, 0); + ui_sb_update_icon(SB_CDROM | id, 0); cdrom_irq_raise(id); return; case CDROM_PHASE_ERROR: diff --git a/src/cdrom/cdrom_null.c b/src/cdrom/cdrom_null.c index 046bc97f5..28d383100 100644 --- a/src/cdrom/cdrom_null.c +++ b/src/cdrom/cdrom_null.c @@ -9,10 +9,11 @@ * Implementation of the CD-ROM null interface for unmounted * guest CD-ROM drives. * - * Version: @(#)cdrom_null.c 1.0.3 2017/09/24 + * Version: @(#)cdrom_null.c 1.0.4 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2016 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -22,130 +23,167 @@ #include #include "../ibm.h" #include "cdrom.h" -#include "../win/win_cdrom_ioctl.h" static CDROM null_cdrom; -static int null_ready(uint8_t id) +static int +null_ready(uint8_t id) { - return 0; + return(0); } + /* Always return 0, the contents of a null CD-ROM drive never change. */ -static int null_medium_changed(uint8_t id) +static int +null_medium_changed(uint8_t id) { - return 0; + return(0); } -static uint8_t null_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) + +static uint8_t +null_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) { - return 0x13; + return(0x13); } -static void null_eject(uint8_t id) + +static void +null_eject(uint8_t id) { } -static void null_load(uint8_t id) + +static void +null_load(uint8_t id) { } -static int null_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int ismsf, int cdrom_sector_type, int cdrom_sector_flags, int *len) +static int +null_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int ismsf, int cdrom_sector_type, int cdrom_sector_flags, int *len) { - *len = 0; - return 0; + *len = 0; + + return(0); } -static int null_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single) + +static int +null_readtoc(uint8_t id, uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single) { - return 0; + return(0); } -static int null_readtoc_session(uint8_t id, unsigned char *b, int msf, int maxlen) + +static int +null_readtoc_session(uint8_t id, uint8_t *b, int msf, int maxlen) { - return 0; + return(0); } -static int null_readtoc_raw(uint8_t id, unsigned char *b, int maxlen) + +static int +null_readtoc_raw(uint8_t id, uint8_t *b, int maxlen) { - return 0; + return(0); } -static uint32_t null_size(uint8_t id) + +static uint32_t +null_size(uint8_t id) { - return 0; + return(0); } -static int null_status(uint8_t id) + +static int +null_status(uint8_t id) { - return CD_STATUS_EMPTY; + return(CD_STATUS_EMPTY); } -void cdrom_null_reset(uint8_t id) + +void +cdrom_null_reset(uint8_t id) { } + void cdrom_set_null_handler(uint8_t id); -int cdrom_null_open(uint8_t id, char d) +int +cdrom_null_open(uint8_t id, char d) { - cdrom_set_null_handler(id); - return 0; + cdrom_set_null_handler(id); + + return(0); } -void null_close(uint8_t id) + +void +null_close(uint8_t id) { } -static void null_exit(uint8_t id) + +static +void null_exit(uint8_t id) { } -static int null_is_track_audio(uint8_t id, uint32_t pos, int ismsf) + +static int +null_is_track_audio(uint8_t id, uint32_t pos, int ismsf) { - return 0; + return(0); } -static int null_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t *len) + +static int +null_pass_through(uint8_t id, uint8_t *in_cdb, uint8_t *b, uint32_t *len) { - return 0; + return(0); } -static int null_media_type_id(uint8_t id) + +static int +null_media_type_id(uint8_t id) { - return 0x70; + return(0x70); } -void cdrom_set_null_handler(uint8_t id) + +void +cdrom_set_null_handler(uint8_t id) { - cdrom_drives[id].handler = &null_cdrom; - cdrom_drives[id].host_drive = 0; - memset(cdrom_image[id].image_path, 0, sizeof(cdrom_image[id].image_path)); + cdrom_drives[id].handler = &null_cdrom; + cdrom_drives[id].host_drive = 0; + memset(cdrom_image[id].image_path, 0, sizeof(cdrom_image[id].image_path)); } -static CDROM null_cdrom = -{ - null_ready, - null_medium_changed, - null_media_type_id, - NULL, - NULL, - null_readtoc, - null_readtoc_session, - null_readtoc_raw, - null_getcurrentsubchannel, - null_pass_through, - null_readsector_raw, - NULL, - null_load, - null_eject, - NULL, - NULL, - null_size, - null_status, - null_is_track_audio, - NULL, - null_exit + +static CDROM null_cdrom = { + null_ready, + null_medium_changed, + null_media_type_id, + NULL, + NULL, + null_readtoc, + null_readtoc_session, + null_readtoc_raw, + null_getcurrentsubchannel, + null_pass_through, + null_readsector_raw, + NULL, + null_load, + null_eject, + NULL, + NULL, + null_size, + null_status, + null_is_track_audio, + NULL, + null_exit }; diff --git a/src/config.c b/src/config.c index bc6cdbd98..fb2fa9174 100644 --- a/src/config.c +++ b/src/config.c @@ -8,7 +8,7 @@ * * Configuration file handler. * - * Version: @(#)config.c 1.0.14 2017/10/07 + * Version: @(#)config.c 1.0.15 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -47,15 +47,15 @@ #include "mouse.h" #include "network/network.h" #include "scsi/scsi.h" -#include "win/plat_joystick.h" -#include "win/plat_midi.h" #include "sound/midi.h" #include "sound/snd_dbopl.h" #include "sound/snd_mpu401.h" #include "sound/snd_opl.h" #include "sound/sound.h" #include "video/video.h" -#include "win/win.h" +#include "ui.h" +#include "win/plat_joystick.h" +#include "win/plat_midi.h" typedef struct _list_ { @@ -442,13 +442,13 @@ load_general(void) window_w = window_h = window_x = window_y = 0; } -#ifndef __unix +#ifdef USE_LANGUAGE /* * Currently, 86Box is English (US) only, but in the future * (version 1.30 at the earliest) other languages will be * added, therefore it is better to future-proof the code. */ - dwLanguage = config_get_hex16(cat, "language", 0x0409); + plat_language = config_get_hex16(cat, "language", 0x0409); #endif } @@ -633,9 +633,9 @@ load_network(void) if (p != NULL) { if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) { if ((network_ndev == 1) && strcmp(network_pcap, "none")) { - msgbox_error(hwndMain, IDS_2140); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2140); } else if (network_dev_to_id(p) == -1) { - msgbox_error(hwndMain, IDS_2141); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2141); } strcpy(network_pcap, "none"); @@ -1110,8 +1110,8 @@ config_load(wchar_t *fn) if (! config_read(fn)) { cpu = 0; -#ifndef __unix - dwLanguage = 0x0409; +#ifdef USE_LANGUAGE + plat_language = 0x0409; #endif scale = 1; vid_api = 1; @@ -1218,11 +1218,11 @@ save_general(void) config_delete_var(cat, "window_coordinates"); } -#ifndef __unix - if (dwLanguage == 0x0409) +#ifdef USE_LANGUAGE + if (plat_language == 0x0409) config_delete_var(cat, "language"); else - config_set_hex16(cat, "language", dwLanguage); + config_set_hex16(cat, "language", plat_language); #endif delete_section_if_empty(cat); diff --git a/src/disk/hdc_esdi_at.c b/src/disk/hdc_esdi_at.c index d7afe1660..91d847c5a 100644 --- a/src/disk/hdc_esdi_at.c +++ b/src/disk/hdc_esdi_at.c @@ -8,11 +8,12 @@ * * Driver for the ESDI controller (WD1007-vse1) for PC/AT. * - * Version: @(#)hdc_esdi_at.c 1.0.3 2017/10/05 + * Version: @(#)hdc_esdi_at.c 1.0.4 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, * Fred N. van Kempen, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. @@ -32,7 +33,7 @@ #include "../pic.h" #include "../rom.h" #include "../timer.h" -#include "../win/win.h" +#include "../ui.h" #include "hdc.h" #include "hdd.h" @@ -514,7 +515,7 @@ esdi_callback(void *priv) esdi->pos = 0; esdi->status = STAT_DRQ | STAT_READY | STAT_DSC; irq_raise(esdi); - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 1); break; case CMD_WRITE: @@ -549,7 +550,7 @@ esdi_callback(void *priv) } else { esdi->status = STAT_READY | STAT_DSC; } - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 1); break; case CMD_VERIFY: @@ -575,7 +576,7 @@ esdi_callback(void *priv) break; } - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 1); next_sector(esdi); esdi->secount = (esdi->secount - 1) & 0xff; if (esdi->secount) @@ -609,7 +610,7 @@ esdi_callback(void *priv) } esdi->status = STAT_READY | STAT_DSC; irq_raise(esdi); - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 1); break; case CMD_DIAGNOSE: @@ -737,7 +738,7 @@ esdi_callback(void *priv) break; } - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 0); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 0); } diff --git a/src/disk/hdc_esdi_mca.c b/src/disk/hdc_esdi_mca.c index e7ca5cc0d..19868e488 100644 --- a/src/disk/hdc_esdi_mca.c +++ b/src/disk/hdc_esdi_mca.c @@ -52,10 +52,11 @@ * however, are auto-configured by the system software as * shown above. * - * Version: @(#)hdc_esdi_mca.c 1.0.5 2017/10/05 + * Version: @(#)hdc_esdi_mca.c 1.0.6 2017/10/09 * * Authors: Sarah Walker, * Fred N. van Kempen, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2017 Fred N. van Kempen. */ @@ -73,7 +74,7 @@ #include "../pic.h" #include "../rom.h" #include "../timer.h" -#include "../win/win.h" +#include "../ui.h" #include "hdc.h" #include "hdd.h" @@ -326,7 +327,7 @@ esdi_callback(void *priv) if (dev->rba >= drive->sectors) fatal("Read past end of drive\n"); hdd_image_read(drive->hdd_num, dev->rba, 1, (uint8_t *)dev->data); - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 1); } while (dev->data_pos < 256) { @@ -407,11 +408,11 @@ esdi_callback(void *priv) hdd_image_write(drive->hdd_num, dev->rba, 1, (uint8_t *)dev->data); dev->rba++; dev->sector_pos++; - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 1); dev->data_pos = 0; } - StatusBarUpdateIcon(SB_HDD | HDD_BUS_ESDI, 0); + ui_sb_update_icon(SB_HDD | HDD_BUS_ESDI, 0); dev->status = STATUS_CMD_IN_PROGRESS; dev->cmd_state = 2; diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 38ad9aefb..cbc68bc80 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,10 +9,11 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.10 2017/10/05 + * Version: @(#)hdc_ide.c 1.0.11 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -30,7 +31,7 @@ #include "../device.h" #include "../cdrom/cdrom.h" #include "../scsi/scsi.h" -#include "../win/win.h" +#include "../ui.h" #include "hdc.h" #include "hdc_ide.h" #include "hdd.h" @@ -1297,7 +1298,7 @@ uint32_t ide_read_data(int ide_board, int length) } else { - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 0); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 0); } } } @@ -1645,7 +1646,7 @@ void callbackide(int ide_board) ide_irq_raise(ide); - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); return; case WIN_READ_DMA: @@ -1692,12 +1693,12 @@ void callbackide(int ide_board) ide_next_sector(ide); ide->atastat = BUSY_STAT; idecallback[ide_board]=6LL*IDE_TIME; - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); } else { ide_irq_raise(ide); - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 0); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 0); } } } @@ -1750,7 +1751,7 @@ void callbackide(int ide_board) ide->blockcount = 0; } - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); return; case WIN_WRITE: @@ -1771,12 +1772,12 @@ void callbackide(int ide_board) ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT; ide->pos=0; ide_next_sector(ide); - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); } else { ide->atastat = READY_STAT | DSC_STAT; - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 0); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 0); } return; @@ -1810,12 +1811,12 @@ void callbackide(int ide_board) ide_next_sector(ide); ide->atastat = BUSY_STAT; idecallback[ide_board]=6LL*IDE_TIME; - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); } else { ide_irq_raise(ide); - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 0); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 0); } } } @@ -1844,12 +1845,12 @@ void callbackide(int ide_board) ide->atastat = DRQ_STAT | READY_STAT | DSC_STAT; ide->pos=0; ide_next_sector(ide); - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); } else { ide->atastat = READY_STAT | DSC_STAT; - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 0); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 0); } return; @@ -1866,7 +1867,7 @@ void callbackide(int ide_board) ide->pos=0; ide->atastat = READY_STAT | DSC_STAT; ide_irq_raise(ide); - StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); + ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); return; case WIN_FORMAT: @@ -1883,7 +1884,7 @@ void callbackide(int ide_board) ide->atastat = READY_STAT | DSC_STAT; ide_irq_raise(ide); - /* StatusBarUpdateIcon(SB_HDD | hdd[ide->hdd_num].bus, 1); */ + /* ui_sb_update_icon(SB_HDD | hdd[ide->hdd_num].bus, 1); */ return; case WIN_DRIVE_DIAGNOSTICS: diff --git a/src/disk/hdc_mfm_at.c b/src/disk/hdc_mfm_at.c index 273badd3a..d191e8517 100644 --- a/src/disk/hdc_mfm_at.c +++ b/src/disk/hdc_mfm_at.c @@ -12,10 +12,11 @@ * based design. Most cards were WD1003-WA2 or -WAH, where the * -WA2 cards had a floppy controller as well (to save space.) * - * Version: @(#)hdd_mfm_at.c 1.0.5 2017/10/05 + * Version: @(#)hdd_mfm_at.c 1.0.6 2017/10/09 * * Authors: Sarah Walker, * Fred N. van Kempen, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2017 Fred N. van Kempen. */ @@ -29,7 +30,7 @@ #include "../io.h" #include "../pic.h" #include "../timer.h" -#include "../win/win.h" +#include "../ui.h" #include "hdc.h" #include "hdd.h" @@ -462,7 +463,7 @@ mfm_readw(uint16_t port, void *priv) mfm->callback = 6LL*MFM_TIME; timer_update_outstanding(); } else { - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 0); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 0); } } } @@ -562,7 +563,7 @@ do_callback(void *priv) mfm->reset = 0; - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 0); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 0); return; } @@ -596,7 +597,7 @@ do_callback(void *priv) mfm->pos = 0; mfm->status = STAT_DRQ|STAT_READY|STAT_DSC; irq_raise(mfm); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); break; case CMD_WRITE: @@ -621,9 +622,9 @@ do_callback(void *priv) mfm->status |= STAT_DRQ; mfm->pos = 0; next_sector(mfm); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); } else { - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 0); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 0); } irq_raise(mfm); break; @@ -637,7 +638,7 @@ do_callback(void *priv) mfm->pos = 0; mfm->status = STAT_READY|STAT_DSC; irq_raise(mfm); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); break; case CMD_FORMAT: @@ -657,7 +658,7 @@ do_callback(void *priv) mfm->status = STAT_READY|STAT_DSC; irq_raise(mfm); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); break; case CMD_DIAGNOSE: @@ -734,7 +735,7 @@ mfm_init(device_t *info) timer_add(do_callback, &mfm->callback, &mfm->callback, mfm); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 0); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 0); return(mfm); } @@ -754,13 +755,14 @@ mfm_close(void *priv) free(mfm); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 0); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 0); } device_t mfm_at_wd1003_device = { "WD1003 AT MFM/RLL Controller", - DEVICE_ISA | DEVICE_AT, 0, + DEVICE_ISA | DEVICE_AT, + 0, mfm_init, mfm_close, NULL, NULL, NULL, NULL, NULL, NULL }; diff --git a/src/disk/hdc_mfm_xt.c b/src/disk/hdc_mfm_xt.c index 1a6f091e6..c6e82fdfb 100644 --- a/src/disk/hdc_mfm_xt.c +++ b/src/disk/hdc_mfm_xt.c @@ -41,10 +41,11 @@ * Since all controllers (including the ones made by DTC) use * (mostly) the same API, we keep them all in this module. * - * Version: @(#)hdd_mfm_xt.c 1.0.7 2017/10/05 + * Version: @(#)hdd_mfm_xt.c 1.0.8 2017/10/09 * * Authors: Sarah Walker, * Fred N. van Kempen, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2017 Fred N. van Kempen. */ @@ -61,7 +62,7 @@ #include "../pic.h" #include "../rom.h" #include "../timer.h" -#include "../win/win.h" +#include "../ui.h" #include "hdc.h" #include "hdd.h" @@ -403,7 +404,7 @@ mfm_callback(void *priv) mfm_complete(mfm); - StatusBarUpdateIcon(SB_HDD | HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD | HDD_BUS_MFM, 1); break; default: @@ -448,7 +449,7 @@ mfm_callback(void *priv) hdd_image_read(drive->hdd_num, addr, 1, (uint8_t *) mfm->sector_buf); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); if (mfm->irq_dma_mask & DMA_ENA) mfm->callback = MFM_TIME; @@ -493,7 +494,7 @@ mfm_callback(void *priv) hdd_image_read(drive->hdd_num, addr, 1, (uint8_t *) mfm->sector_buf); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); mfm->state = STATE_SEND_DATA; @@ -505,7 +506,7 @@ mfm_callback(void *priv) } } else { mfm_complete(mfm); - StatusBarUpdateIcon(SB_HDD | HDD_BUS_MFM, 0); + ui_sb_update_icon(SB_HDD | HDD_BUS_MFM, 0); } break; @@ -566,7 +567,7 @@ mfm_callback(void *priv) hdd_image_write(drive->hdd_num, addr, 1, (uint8_t *) mfm->sector_buf); - StatusBarUpdateIcon(SB_HDD|HDD_BUS_MFM, 1); + ui_sb_update_icon(SB_HDD|HDD_BUS_MFM, 1); next_sector(mfm); mfm->data_pos = 0; @@ -857,7 +858,8 @@ xebec_available(void) device_t mfm_xt_xebec_device = { "IBM PC Fixed Disk Adapter", - 0, 0, + DEVICE_ISA, + 0, xebec_init, mfm_close, NULL, xebec_available, NULL, NULL, NULL, NULL @@ -908,7 +910,8 @@ dtc5150x_available(void) device_t mfm_xt_dtc5150x_device = { "DTC 5150X", - DEVICE_ISA, 0, + DEVICE_ISA, + 0, dtc5150x_init, mfm_close, NULL, dtc5150x_available, NULL, NULL, NULL, NULL diff --git a/src/disk/hdc_xtide.c b/src/disk/hdc_xtide.c index 2c8e110dc..d3e5789e1 100644 --- a/src/disk/hdc_xtide.c +++ b/src/disk/hdc_xtide.c @@ -21,11 +21,12 @@ * already on their way out, the newer IDE standard based on the * PC/AT controller and 16b design became the IDE we now know. * - * Version: @(#)hdc_xtide.c 1.0.7 2017/10/04 + * Version: @(#)hdc_xtide.c 1.0.8 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, * Fred N. van Kempen, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. diff --git a/src/disk/hdd.c b/src/disk/hdd.c index e7a11e3a9..90cb7a140 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -8,7 +8,7 @@ * * Common code to handle all sorts of hard disk images. * - * Version: @(#)hdd.c 1.0.3 2017/10/07 + * Version: @(#)hdd.c 1.0.4 2017/10/09 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -21,10 +21,7 @@ #include #include #include "../ibm.h" -#include "../cpu/cpu.h" -#include "../device.h" -#include "../machine/machine.h" -#include "../win/win.h" +#include "../ui.h" #include "hdd.h" @@ -50,7 +47,7 @@ hdd_string_to_bus(char *str, int cdrom) if (! strcmp(str, "mfm")) { if (cdrom) { no_cdrom: - msgbox_error(hwndMain, IDS_4114); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4114); return(0); } @@ -113,7 +110,7 @@ no_cdrom: } if (! strcmp(str, "usb")) - msgbox_error(hwndMain, IDS_4110); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4110); return(0); } diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index fdac86afd..e08d440db 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -9,7 +9,7 @@ * Implementation of the NEC uPD-765 and compatible floppy disk * controller. * - * Version: @(#)fdc.c 1.0.4 2017/10/05 + * Version: @(#)fdc.c 1.0.5 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -28,7 +28,7 @@ #include "../dma.h" #include "../pic.h" #include "../timer.h" -#include "../win/win.h" +#include "../ui.h" #include "floppy.h" #include "fdc.h" #include "fdd.h" @@ -678,7 +678,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) floppytime = 128LL * (1LL << TIMER_SHIFT); timer_update_outstanding(); floppyint=-1; - StatusBarUpdateIcon(SB_FLOPPY | 0, 0); + ui_sb_update_icon(SB_FLOPPY | 0, 0); fdc_reset(); } if (!fdd_get_flags(0)) @@ -715,7 +715,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv) for (i = 0; i < FDD_NUM; i++) { - StatusBarUpdateIcon(SB_FLOPPY | i, 0); + ui_sb_update_icon(SB_FLOPPY | i, 0); } fdc_reset(); @@ -988,7 +988,7 @@ bad_command: fdc.stat = 0x50; } floppytime = 0LL; - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 1); fdc.inread = 1; break; @@ -1033,7 +1033,7 @@ bad_command: floppy_writesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); floppytime = 0LL; fdc.written = 0; - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 1); fdc.pos = 0; if (fdc.pcjr) fdc.stat = 0xb0; @@ -1066,7 +1066,7 @@ bad_command: floppy_comparesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]); floppytime = 0LL; fdc.written = 0; - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 1); fdc.pos = 0; if (fdc.pcjr || !fdc.dma) { @@ -1110,7 +1110,7 @@ bad_command: fdc.stat = 0x50; } floppytime = 0LL; - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 1); fdc.inread = 1; break; @@ -1467,7 +1467,7 @@ void fdc_poll_common_finish(int compare, int st5) fdc.res[9]=fdc.sector; fdc.res[10]=fdc.params[4]; fdc_log("Read/write finish (%02X %02X %02X %02X %02X %02X %02X)\n" , fdc.res[4], fdc.res[5], fdc.res[6], fdc.res[7], fdc.res[8], fdc.res[9], fdc.res[10]); - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 0); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 0); paramstogo=7; } @@ -1513,7 +1513,7 @@ void fdc_callback(void *priv) return; case 2: /*Read track*/ - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 1); fdc.eot[fdc.drive]--; fdc.read_track_sector.id.r++; if (!fdc.eot[fdc.drive] || fdc.tc) @@ -1673,7 +1673,7 @@ void fdc_callback(void *priv) { fdc.sector++; } - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 1); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 1); switch (floppyint) { case 5: @@ -1912,7 +1912,7 @@ void fdc_error(int st5, int st6) fdc.res[10]=0; break; } - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 0); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 0); paramstogo=7; } @@ -2143,7 +2143,7 @@ void fdc_sectorid(uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uin fdc.res[8]=side; fdc.res[9]=sector; fdc.res[10]=size; - StatusBarUpdateIcon(SB_FLOPPY | fdc.drive, 0); + ui_sb_update_icon(SB_FLOPPY | fdc.drive, 0); paramstogo=7; } @@ -2199,7 +2199,7 @@ void fdc_hard_reset() for (i = 0; i < FDD_NUM; i++) { - StatusBarUpdateIcon(SB_FLOPPY | i, 0); + ui_sb_update_icon(SB_FLOPPY | i, 0); } } diff --git a/src/floppy/floppy.c b/src/floppy/floppy.c index a54f61b05..5c653cf84 100644 --- a/src/floppy/floppy.c +++ b/src/floppy/floppy.c @@ -9,10 +9,11 @@ * Generic floppy disk interface that communicates with the * other handlers. * - * Version: @(#)floppy.c 1.0.5 2017/10/05 + * Version: @(#)floppy.c 1.0.6 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -25,7 +26,7 @@ #include "../rom.h" #include "../config.h" #include "../timer.h" -#include "../win/win.h" +#include "../ui.h" #include "floppy.h" #include "floppy_86f.h" #include "floppy_fdi.h" @@ -158,7 +159,7 @@ void floppy_load(int drive, wchar_t *fn) drive_empty[drive] = 1; fdd_set_head(real_drive(drive), 0); memset(floppyfns[drive], 0, sizeof(floppyfns[drive])); - StatusBarUpdateIconState(drive, 1); + ui_sb_update_icon_state(drive, 1); } void floppy_close(int drive) @@ -177,7 +178,7 @@ void floppy_close(int drive) drives[drive].format = NULL; drives[drive].byteperiod = NULL; drives[drive].stop = NULL; - StatusBarUpdateIconState(drive, 1); + ui_sb_update_icon_state(drive, 1); } int floppy_notfound=0; diff --git a/src/floppy/floppy_86f.c b/src/floppy/floppy_86f.c index af3e7657e..a7a16c1e6 100644 --- a/src/floppy/floppy_86f.c +++ b/src/floppy/floppy_86f.c @@ -10,7 +10,7 @@ * data in the form of FM/MFM-encoded transitions) which also * forms the core of the emulator's floppy disk emulation. * - * Version: @(#)floppy_86f.c 1.0.5 2017/10/05 + * Version: @(#)floppy_86f.c 1.0.6 2017/10/09 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. @@ -28,7 +28,7 @@ #include "../dma.h" #include "../nvr.h" #include "../random.h" -#include "../win/win.h" +#include "../ui.h" #include "floppy.h" #include "fdc.h" #include "fdd.h" @@ -3425,7 +3425,7 @@ void d86f_load(int drive, wchar_t *fn) } fclose(d86f[drive].f); d86f[drive].f = NULL; - StatusBarUpdateIconState(drive, 1); + ui_sb_update_icon_state(drive, 1); return; } else diff --git a/src/keyboard.c b/src/keyboard.c index 86ae823f4..950b6ccec 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8,10 +8,11 @@ * * Host to guest keyboard interface and keyboard scan code sets. * - * Version: @(#)keyboard.c 1.0.2 2017/09/24 + * Version: @(#)keyboard.c 1.0.3 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -20,7 +21,7 @@ #include #include #include "ibm.h" -#include "plat_keyboard.h" +#include "win/plat_keyboard.h" #include "keyboard.h" diff --git a/src/machine/machine_ps2_mca.c b/src/machine/machine_ps2_mca.c index 9ced03bf9..68c1dfd5e 100644 --- a/src/machine/machine_ps2_mca.c +++ b/src/machine/machine_ps2_mca.c @@ -809,7 +809,10 @@ machine_ps2_common_init(machine_t *model) machine_common_init(model); +#if 0 + /* Already done in pc.c. */ mem_add_bios(); +#endif dma16_init(); ps2_dma_init(); keyboard_at_init(); diff --git a/src/mouse.c b/src/mouse.c index 3c72cdc06..567fba71a 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -8,12 +8,13 @@ * * Common driver module for MOUSE devices. * - * Version: @(#)mouse.c 1.0.8 2017/09/24 + * Version: @(#)mouse.c 1.0.9 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, * TheCollector1995, * Fred N. van Kempen, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -22,7 +23,6 @@ #include #include #include "ibm.h" -#include "cpu/cpu.h" #include "device.h" #include "mouse.h" #include "machine/machine.h" diff --git a/src/mouse_ps2.c b/src/mouse_ps2.c index a7dd4319a..00cda945d 100644 --- a/src/mouse_ps2.c +++ b/src/mouse_ps2.c @@ -6,7 +6,7 @@ #include "ibm.h" #include "keyboard_at.h" #include "mouse.h" -#include "plat_mouse.h" +#include "win/plat_mouse.h" int mouse_scan = 0; diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index ae26a5d36..449623715 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -10,7 +10,7 @@ * * NOTE: The file will also implement an NE1000 for 8-bit ISA systems. * - * Version: @(#)net_ne2000.c 1.0.17 2017/10/07 + * Version: @(#)net_ne2000.c 1.0.18 2017/10/09 * * Authors: Fred N. van Kempen, * Peter Grehan, grehan@iprg.nokia.com> @@ -18,6 +18,7 @@ * * Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy * Portions Copyright (C) 2002 MandrakeSoft S.A. + * Copyright 2017 Fred N. van Kempen. */ #include #include @@ -35,18 +36,14 @@ #include "../pic.h" #include "../random.h" #include "../device.h" -#include "../win/win.h" +#include "../ui.h" #include "network.h" #include "net_ne2000.h" #include "bswap.h" /* ROM BIOS file paths. */ -#ifdef DEV_BRANCH -#ifdef USE_NE1000 #define ROM_PATH_NE1000 L"roms/network/ne1000/ne1000.rom" -#endif -#endif #define ROM_PATH_NE2000 L"roms/network/ne2000/ne2000.rom" #define ROM_PATH_RTL8029 L"roms/network/rtl8029as/rtl8029as.rom" @@ -1675,7 +1672,7 @@ mcast_index(const void *dst) static void nic_tx(nic_t *dev, uint32_t val) { - StatusBarUpdateIcon(SB_NETWORK, 1); + ui_sb_update_icon(SB_NETWORK, 1); dev->CR.tx_packet = 0; dev->TSR.tx_ok = 1; @@ -1686,7 +1683,7 @@ nic_tx(nic_t *dev, uint32_t val) nic_interrupt(dev, 1); dev->tx_timer_active = 0; - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); } @@ -1707,7 +1704,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len) int idx, nextpage; int endbytes; - StatusBarUpdateIcon(SB_NETWORK, 1); + ui_sb_update_icon(SB_NETWORK, 1); if (io_len != 60) nelog(2, "%s: rx_frame with length %d\n", dev->name, io_len); @@ -1738,14 +1735,14 @@ nic_rx(void *priv, uint8_t *buf, int io_len) ) { nelog(1, "%s: no space\n", dev->name); - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); return; } if ((io_len < 40/*60*/) && !dev->RCR.runts_ok) { nelog(1, "%s: rejected small packet, length %d\n", dev->name, io_len); - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); return; } @@ -1767,7 +1764,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len) if (! dev->RCR.broadcast) { nelog(2, "%s: RX BC disabled\n", dev->name); - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); return; } } @@ -1780,7 +1777,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len) nelog(2, "%s: RX MC disabled\n", dev->name); #endif - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); return; } @@ -1789,7 +1786,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len) if (! (dev->mchash[idx>>3] & (1<<(idx&0x7)))) { nelog(2, "%s: RX MC not listed\n", dev->name); - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); return; } } @@ -1835,7 +1832,7 @@ nic_rx(void *priv, uint8_t *buf, int io_len) if (dev->IMR.rx_inte) nic_interrupt(dev, 1); - StatusBarUpdateIcon(SB_NETWORK, 0); + ui_sb_update_icon(SB_NETWORK, 0); } @@ -1894,8 +1891,7 @@ nic_init(device_t *info) dev->board = info->local; rom = NULL; switch(dev->board) { -#ifdef DEV_BRANCH -#ifdef USE_NE1000 +#if defined(DEV_BRANCH) && defined(USE_NE1000) case NE2K_NE1000: strcpy(dev->name, "NE1000"); dev->maclocal[0] = 0x00; /* 00:00:D8 (NE1000 ISA OID) */ @@ -1903,7 +1899,6 @@ nic_init(device_t *info) dev->maclocal[2] = 0xD8; rom = ROM_PATH_NE1000; break; -#endif #endif case NE2K_NE2000: @@ -2051,6 +2046,8 @@ nic_init(device_t *info) nelog(1, "%s: %s attached IO=0x%X IRQ=%d\n", dev->name, dev->is_pci?"PCI":"ISA", dev->base_address, dev->base_irq); + ui_sb_update_icon(SB_NETWORK, 0); + return(dev); } @@ -2071,8 +2068,7 @@ nic_close(void *priv) } -#ifdef DEV_BRANCH -#ifdef USE_NE1000 +#if defined(DEV_BRANCH) && defined(USE_NE1000) static device_config_t ne1000_config[] = { { @@ -2146,7 +2142,6 @@ static device_config_t ne1000_config[] = } }; #endif -#endif static device_config_t ne2000_config[] = { @@ -2241,22 +2236,20 @@ static device_config_t rtl8029as_config[] = }; -#ifdef DEV_BRANCH -#ifdef USE_NE1000 +#if defined(DEV_BRANCH) && defined(USE_NE1000) device_t ne1000_device = { "Novell NE1000", - DEVICE_ISA, + 0, NE2K_NE1000, nic_init, nic_close, NULL, NULL, NULL, NULL, NULL, ne1000_config }; #endif -#endif device_t ne2000_device = { "Novell NE2000", - DEVICE_ISA | DEVICE_AT, + DEVICE_AT, NE2K_NE2000, nic_init, nic_close, NULL, NULL, NULL, NULL, NULL, diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index 8472c6f7f..3003c765f 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -8,7 +8,7 @@ * * Handle WinPcap library processing. * - * Version: @(#)net_pcap.c 1.0.6 2017/09/24 + * Version: @(#)net_pcap.c 1.0.7 2017/10/09 * * Author: Fred N. van Kempen, */ @@ -21,9 +21,9 @@ #include "../ibm.h" #include "../config.h" #include "../device.h" -#include "network.h" #include "../win/plat_dynld.h" #include "../win/plat_thread.h" +#include "network.h" static void *pcap_handle; /* handle to WinPcap DLL */ diff --git a/src/network/net_slirp.c b/src/network/net_slirp.c index 9941f03ec..1299d89c6 100644 --- a/src/network/net_slirp.c +++ b/src/network/net_slirp.c @@ -8,7 +8,7 @@ * * Handle SLiRP library processing. * - * Version: @(#)net_slirp.c 1.0.5 2017/09/24 + * Version: @(#)net_slirp.c 1.0.6 2017/10/09 * * Author: Fred N. van Kempen, */ @@ -22,8 +22,8 @@ #include "../ibm.h" #include "../config.h" #include "../device.h" -#include "network.h" #include "../win/plat_thread.h" +#include "network.h" static queueADT slirpq; /* SLiRP library handle */ diff --git a/src/network/network.c b/src/network/network.c index 87f7a7f38..f6866def0 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -12,9 +12,11 @@ * it should be malloc'ed and then linked to the NETCARD def. * Will be done later. * - * Version: @(#)network.c 1.0.12 2017/10/04 + * Version: @(#)network.c 1.0.13 2017/10/09 * * Author: Fred N. van Kempen, + * + * Copyright 2017 Fred N. van Kempen. */ #include #include @@ -23,7 +25,7 @@ #include #include "../ibm.h" #include "../device.h" -#include "../win/plat_ui.h" +#include "../ui.h" #include "network.h" #include "net_ne2000.h" @@ -31,15 +33,13 @@ static netcard_t net_cards[] = { { "None", "none", NULL, NULL, NULL }, -#ifdef DEV_BRANCH -#ifdef USE_NE1000 - { "[ISA] Novell NE1000", "ne1k", &ne1000_device, +#if defined(DEV_BRANCH) && defined(USE_NE1000) + { "Novell NE1000", "ne1k", &ne1000_device, NULL, NULL }, #endif -#endif - { "[ISA] Novell NE2000", "ne2k", &ne2000_device, + { "Novell NE2000", "ne2k", &ne2000_device, NULL, NULL }, - { "[PCI] Realtek RTL8029AS","ne2kpci", &rtl8029as_device, + { "Realtek RTL8029AS", "ne2kpci", &rtl8029as_device, NULL, NULL }, { "", "", NULL, NULL, NULL } @@ -115,7 +115,7 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx) case NET_TYPE_PCAP: ret = network_pcap_setup(mac, rx, dev); if (ret < 0) { - plat_msgbox_error(IDS_2139); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2139); network_type = NET_TYPE_NONE; } break; diff --git a/src/network/pcap_if.c b/src/network/pcap_if.c index 31ec33f7d..7122e5ff4 100644 --- a/src/network/pcap_if.c +++ b/src/network/pcap_if.c @@ -10,16 +10,18 @@ * * Based on the "libpcap" examples. * - * Version: @(#)pcap_if.c 1.0.3 2017/06/04 + * Version: @(#)pcap_if.c 1.0.4 2017/10/09 * * Author: Fred N. van Kempen, + * + * Copyright 2017 Fred N. van Kempen. */ #include #include #include #include #include -#include "plat_dynld.h" +#include "../win/plat_dynld.h" static void *pcap_handle; /* handle to WinPcap DLL */ diff --git a/src/nvr.c b/src/nvr.c index da018461b..8ad43f540 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -186,7 +186,7 @@ * (DS12887A) which implemented a "century" register to be * compatible with Y2K. * - * Version: @(#)nvr.c 1.0.5 2017/10/02 + * Version: @(#)nvr.c 1.0.6 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -203,19 +203,17 @@ #include #include #include +#include "86Box.h" #include "ibm.h" #include "cpu/cpu.h" #include "pic.h" #include "timer.h" #include "device.h" #include "machine/machine.h" -#include "win/win.h" +#include "plat.h" #include "nvr.h" -#define NVR_FOLDER_PATH L"NVR" - - int64_t enable_sync; /* configuration variable: enable time sync */ int64_t nvr_dosave; /* NVR is dirty, needs saved */ @@ -755,16 +753,18 @@ nvr_path(wchar_t *str) /* Get the full prefix in place. */ memset(temp, 0x00, sizeof(temp)); wcscpy(temp, cfg_path); - wcscat(temp, NVR_FOLDER_PATH); + wcscat(temp, NVR_PATH); -#ifndef __unix /* Create the directory if needed. */ - if (! DirectoryExists(temp)) - CreateDirectory(temp, NULL); -#endif + if (! dir_check_exist(temp)) + dir_create(temp); /* Now append the actual filename. */ +#ifdef WIN32 wcscat(temp, L"\\"); +#else + wcscat(temp, L"/"); +#endif wcscat(temp, str); return(temp); diff --git a/src/pc.c b/src/pc.c index c7965784e..3739d3a90 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Emulation core dispatcher. * - * Version: @(#)pc.c 1.0.19 2017/10/08 + * Version: @(#)pc.c 1.0.20 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -73,13 +73,12 @@ # include "win/plat_dir.h" # undef UNICODE #endif +#include "ui.h" +#include "plat.h" #include "win/plat_joystick.h" #include "win/plat_keyboard.h" #include "win/plat_midi.h" #include "win/plat_mouse.h" -#include "win/plat_iodev.h" -#include "win/plat_ui.h" -#include "win/win.h" int window_w, window_h, window_x, window_y, window_remember; @@ -146,9 +145,7 @@ fatal(const char *format, ...) /* Make sure the message does not have a trailing newline. */ if ((sp = strchr(msg, '\n')) != NULL) *sp = '\0'; -#ifndef __unix - plat_msgbox_fatal(msg); -#endif + ui_msgbox(MBX_ERROR|MBX_FATAL|MBX_ANSI, msg); fflush(stdout); @@ -169,14 +166,16 @@ pc_concat(wchar_t *str) memset(temp, 0x00, sizeof(temp)); wcscpy(temp, cfg_path); -#ifndef __unix /* Create the directory if needed. */ - if (! DirectoryExists(temp)) - CreateDirectory(temp, NULL); -#endif + if (! dir_check_exist(temp)) + dir_create(temp); /* Now append the actual filename. */ +#ifdef WIN32 wcscat(temp, L"\\"); +#else + wcscat(temp, L"/"); +#endif wcscat(temp, str); return(temp); @@ -380,7 +379,7 @@ again: if (! rom_load_bios(romset)) { /* Whoops, ROMs not found. */ if (romset != -1) - msgbox_info(hwndMain, IDS_2063); + ui_msgbox(MBX_INFO, (wchar_t *)IDS_2063); /* Select another machine to use. */ for (c=0; c=0; c--) { if (gfx_present[c]) { diff --git a/src/plat.h b/src/plat.h new file mode 100644 index 000000000..282a02436 --- /dev/null +++ b/src/plat.h @@ -0,0 +1,69 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Define the various platform support functions. + * + * Version: @(#)plat.h 1.0.2 2017/10/09 + * + * Authors: Miran Grca, + * Fred N. van Kempen, + * + * Copyright 2016,2017 Miran Grca. + * Copyright 2017 Fred N. van Kempen. + */ +#ifndef EMU_PLAT_H +# define EMU_PLAT_H + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Global variables residing in the platform module. */ + + +/* System-related functions. */ +extern void get_executable_name(wchar_t *s, int size); +extern void set_window_title(wchar_t *s); +extern int dir_check_exist(wchar_t *path); +extern int dir_create(wchar_t *path); +extern void leave_fullscreen(void); + +/* Resource management. */ +extern wchar_t *plat_get_string(int id); +extern wchar_t *plat_get_string_from_string(char *str); + + +/* Platform-specific device support. */ +extern uint8_t host_cdrom_drive_available[26]; +extern uint8_t host_cdrom_drive_available_num; +extern uint32_t cdrom_capacity; + +extern void cdrom_init_host_drives(void); +extern void cdrom_close(uint8_t id); +extern void cdrom_eject(uint8_t id); +extern void cdrom_reload(uint8_t id); +extern void removable_disk_unload(uint8_t id); +extern void removable_disk_eject(uint8_t id); +extern void removable_disk_reload(uint8_t id); +extern int ioctl_open(uint8_t id, char d); +extern void ioctl_reset(uint8_t id); +extern void ioctl_close(uint8_t id); + + +/* Other stuff. */ +extern void startblit(void); +extern void endblit(void); + + +#ifdef __cplusplus +} +#endif + + +#endif /*EMU_PLAT_H*/ diff --git a/src/ppi.c b/src/ppi.c index 2fb10ec21..2b92eb9aa 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -13,8 +13,8 @@ #include #include "ibm.h" #include "pit.h" -#include "plat_keyboard.h" -#include "plat_mouse.h" +#include "win/plat_keyboard.h" +#include "win/plat_mouse.h" PPI ppi; diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index c093da63a..da2da94ba 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -12,10 +12,11 @@ * * NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go. * - * Version: @(#)scsi_aha154x.c 1.0.23 2017/10/08 + * Version: @(#)scsi_aha154x.c 1.0.24 2017/10/09 * * Authors: Fred N. van Kempen, * Original Buslogic version by SA1988 and Miran Grca. + * * Copyright 2017 Fred N. van Kempen. */ #include @@ -552,7 +553,7 @@ aha154x_eeprom(aha_t *dev, uint8_t cmd,uint8_t arg,uint8_t len,uint8_t off,uint8 } -/* Mess with the AHA-154xCF's Shadow RAM. */ +/* Map either the main or utility (Select) ROM into the memory space. */ static uint8_t aha154x_mmap(aha_t *dev, uint8_t cmd) { @@ -575,7 +576,7 @@ aha154x_mmap(aha_t *dev, uint8_t cmd) static void -RaiseIntr(aha_t *dev, int suppress, uint8_t Interrupt) +raise_irq(aha_t *dev, int suppress, uint8_t Interrupt) { if (Interrupt & (INTR_MBIF | INTR_MBOA)) { if (! (dev->Interrupt & INTR_HACC)) { @@ -601,7 +602,7 @@ RaiseIntr(aha_t *dev, int suppress, uint8_t Interrupt) static void -ClearIntr(aha_t *dev) +clear_irq(aha_t *dev) { dev->Interrupt = 0; aha_log("%s: lowering IRQ %i (stat 0x%02x)\n", @@ -611,7 +612,7 @@ ClearIntr(aha_t *dev) aha_log("%s: Raising Interrupt 0x%02X (Pending)\n", dev->name, dev->Interrupt); if (dev->MailboxOutInterrupts || !(dev->Interrupt & INTR_MBOA)) { - RaiseIntr(dev, 0, dev->PendingInterrupt); + raise_irq(dev, 0, dev->PendingInterrupt); } dev->PendingInterrupt = 0; } @@ -646,7 +647,7 @@ aha_reset(aha_t *dev) dev->shram_mode = 0; dev->last_mb = 0; - ClearIntr(dev); + clear_irq(dev); } @@ -691,7 +692,7 @@ aha_cmd_done(aha_t *dev, int suppress) if ((dev->Command != CMD_START_SCSI) && (dev->Command != CMD_BIOS_SCSI)) { dev->Status &= ~STAT_DFULL; aha_log("%s: Raising IRQ %i\n", dev->name, dev->Irq); - RaiseIntr(dev, suppress, INTR_HACC); + raise_irq(dev, suppress, INTR_HACC); } dev->Command = 0xff; @@ -1292,7 +1293,7 @@ aha_do_mail(aha_t *dev) aha_log("aha_do_mail(): Writing %i bytes at %08X\n", sizeof(CmdStatus), Outgoing + CodeOffset); DMAPageWrite(Outgoing + CodeOffset, (char *)&CmdStatus, sizeof(CmdStatus)); - RaiseIntr(dev, 0, dev->ToRaise); + raise_irq(dev, 0, dev->ToRaise); while (dev->Interrupt) { } @@ -1397,7 +1398,7 @@ aha_write(uint16_t port, uint8_t val, void *priv) } if (val & CTRL_IRST) { - ClearIntr(dev); + clear_irq(dev); } break; @@ -2277,13 +2278,8 @@ device_t aha1540b_device = { "Adaptec AHA-1540B", DEVICE_ISA | DEVICE_AT, AHA_154xB, - aha_init, - aha_close, - NULL, - NULL, - NULL, - NULL, - NULL, + aha_init, aha_close, NULL, + NULL, NULL, NULL, NULL, aha_154x_config }; @@ -2291,13 +2287,8 @@ device_t aha1542c_device = { "Adaptec AHA-1542C", DEVICE_ISA | DEVICE_AT, AHA_154xC, - aha_init, - aha_close, - NULL, - NULL, - NULL, - NULL, - NULL, + aha_init, aha_close, NULL, + NULL, NULL, NULL, NULL, aha_154x_config }; @@ -2305,13 +2296,8 @@ device_t aha1542cf_device = { "Adaptec AHA-1542CF", DEVICE_ISA | DEVICE_AT, AHA_154xCF, - aha_init, - aha_close, - NULL, - NULL, - NULL, - NULL, - NULL, + aha_init, aha_close, NULL, + NULL, NULL, NULL, NULL, aha_154x_config }; @@ -2319,11 +2305,7 @@ device_t aha1640_device = { "Adaptec AHA-1640", DEVICE_MCA, AHA_1640, - aha_init, - aha_close, - NULL, - NULL, - NULL, - NULL, + aha_init, aha_close, NULL, + NULL, NULL, NULL, NULL, NULL }; diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 4e64776cb..0950f7d58 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -10,11 +10,12 @@ * 0 - BT-545C ISA; * 1 - BT-958D PCI (but BT-545C ISA on non-PCI machines) * - * Version: @(#)scsi_buslogic.c 1.0.18 2017/10/08 + * Version: @(#)scsi_buslogic.c 1.0.19 2017/10/09 * * Authors: TheCollector1995, * Miran Grca, * Fred N. van Kempen, + * * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ @@ -3154,13 +3155,8 @@ device_t buslogic_device = { "Buslogic BT-545C ISA", DEVICE_ISA | DEVICE_AT, CHIP_BUSLOGIC_ISA, - Buslogic_Init, - BuslogicClose, - NULL, - NULL, - NULL, - NULL, - NULL, + Buslogic_Init, BuslogicClose, NULL, + NULL, NULL, NULL, NULL, BT545C_Config }; @@ -3168,12 +3164,7 @@ device_t buslogic_pci_device = { "Buslogic BT-958D PCI", DEVICE_PCI, CHIP_BUSLOGIC_PCI, - Buslogic_Init, - BuslogicClose, - NULL, - NULL, - NULL, - NULL, - NULL, + Buslogic_Init, BuslogicClose, NULL, + NULL, NULL, NULL, NULL, BT958D_Config }; diff --git a/src/scsi/scsi_disk.c b/src/scsi/scsi_disk.c index c50c43e2f..75a9d1e99 100644 --- a/src/scsi/scsi_disk.c +++ b/src/scsi/scsi_disk.c @@ -6,7 +6,7 @@ * * Emulation of SCSI fixed and removable disks. * - * Version: @(#)scsi_disk.c 1.0.11 2017/10/07 + * Version: @(#)scsi_disk.c 1.0.12 2017/10/09 * * Author: Miran Grca, * Copyright 2017 Miran Grca. @@ -27,8 +27,8 @@ #include "../disk/hdd.h" #include "../disk/hdc.h" #include "../disk/hdc_ide.h" -#include "../win/win.h" -#include "../win/plat_iodev.h" +#include "../plat.h" +#include "../ui.h" #include "scsi.h" #include "scsi_disk.h" @@ -1566,11 +1566,11 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb) shdc[id].all_blocks_total = shdc[id].block_total; if (shdc[id].packet_status != CDROM_PHASE_COMPLETE) { - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 1); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 1); } else { - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); } return; @@ -1736,7 +1736,7 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb) scsi_hd_data_command_finish(id, alloc_length, alloc_length, alloc_length, 1); } shdc[id].all_blocks_total = shdc[id].block_total; - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 1); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 1); return; case GPCMD_START_STOP_UNIT: @@ -2014,7 +2014,7 @@ void scsi_hd_phase_data_out(uint8_t id) SCSIPhase = SCSI_PHASE_STATUS; - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); break; default: fatal("SCSI HDD %i: Bad Command for phase 2 (%02X)\n", shdc[id].current_cdb[0]); @@ -2038,7 +2038,7 @@ void scsi_hd_callback(uint8_t id) shdc[id].status = READY_STAT; shdc[id].phase = 3; shdc[id].packet_status = 0xFF; - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); return; case CDROM_PHASE_DATA_OUT: scsi_hd_log("SCSI HD %i: PHASE_DATA_OUT\n", id); @@ -2051,7 +2051,7 @@ void scsi_hd_callback(uint8_t id) shdc[id].packet_status = CDROM_PHASE_COMPLETE; shdc[id].status = READY_STAT; shdc[id].phase = 3; - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); return; case CDROM_PHASE_DATA_IN: scsi_hd_log("SCSI HD %i: PHASE_DATA_IN\n", id); @@ -2063,7 +2063,7 @@ void scsi_hd_callback(uint8_t id) shdc[id].packet_status = CDROM_PHASE_COMPLETE; shdc[id].status = READY_STAT; shdc[id].phase = 3; - StatusBarUpdateIcon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); + ui_sb_update_icon((hdd[id].bus == HDD_BUS_SCSI_REMOVABLE) ? (SB_RDISK | id) : (SB_HDD | HDD_BUS_SCSI), 0); return; case CDROM_PHASE_ERROR: scsi_hd_log("SCSI HD %i: PHASE_ERROR\n", id); diff --git a/src/ui.h b/src/ui.h new file mode 100644 index 000000000..0b80d6bd6 --- /dev/null +++ b/src/ui.h @@ -0,0 +1,69 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Define the various UI functions. + * + * Version: @(#)ui.h 1.0.2 2017/10/09 + * + * Authors: Miran Grca, + * Fred N. van Kempen, + * + * Copyright 2016,2017 Miran Grca. + * Copyright 2017 Fred N. van Kempen. + */ +#ifndef EMU_UI_H +# define EMU_UI_H + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Strings. Those are defined within the platform. */ +#ifdef WIN32 +# include "win/resource.h" +#else +# ... dunno yet ... +#endif + + +/* Message Box functions. */ +#define MBX_INFO 1 +#define MBX_ERROR 2 +#define MBX_QUESTION 3 +#define MBX_FATAL 0x20 +#define MBX_ANSI 0x80 + +extern int ui_msgbox(int type, void *arg); + + +/* Status Bar functions. */ +#define SB_ICON_WIDTH 24 +#define SB_FLOPPY 0x00 +#define SB_CDROM 0x10 +#define SB_RDISK 0x20 +#define SB_HDD 0x40 +#define SB_NETWORK 0x50 +#define SB_TEXT 0x60 + +extern int ui_sb_find_part(int tag); +extern void ui_sb_update_panes(void); +extern void ui_sb_update_tip(int meaning); +extern void ui_sb_check_menu_item(int tag, int id, int chk); +extern void ui_sb_enable_menu_item(int tag, int id, int val); +extern void ui_sb_update_icon(int tag, int val); +extern void ui_sb_update_icon_state(int tag, int active); +extern void ui_sb_set_text_w(wchar_t *wstr); +extern void ui_sb_set_text(char *str); + +#ifdef __cplusplus +} +#endif + + +#endif /*EMU_UI_H*/ diff --git a/src/video/video.c b/src/video/video.c index 9d8ec3a88..b846311cd 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -8,6 +8,7 @@ #include #include #include +#include "../86box.h" #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" @@ -17,10 +18,10 @@ #include "../device.h" #include "../timer.h" #include "../win/plat_thread.h" +#include "../plat.h" #include "video.h" #include "vid_svga.h" #ifndef __unix -# include "../win/win.h" /*YUCK*/ # include "../win/win_cgapal.h" /*YUCK*/ #endif @@ -30,10 +31,10 @@ #include "vid_ati_mach64.h" #include "vid_cga.h" #ifdef DEV_BRANCH -#ifdef USE_CIRRUS -#include "vid_cl_ramdac.h" /* vid_cl_gd.c needs this */ -#include "vid_cl_gd.h" -#endif +# ifdef USE_CIRRUS +# include "vid_cl_ramdac.h" /* vid_cl_gd.c needs this */ +# include "vid_cl_gd.h" +# endif #endif #include "vid_ega.h" #include "vid_et4000.h" @@ -45,9 +46,9 @@ #include "vid_colorplus.h" #include "vid_mda.h" #ifdef DEV_BRANCH -#ifdef USE_RIVA -#include "vid_nv_riva128.h" -#endif +# ifdef USE_RIVA +# include "vid_nv_riva128.h" +# endif #endif #include "vid_olivetti_m24.h" #include "vid_oti067.h" @@ -120,12 +121,10 @@ static VIDEO_CARD video_cards[] = {"[PCI] Diamond Stealth 3D 2000 (S3 ViRGE)", "stealth3d_2000_pci", &s3_virge_pci_device, GFX_VIRGE_PCI}, {"[PCI] Diamond Stealth 3D 3000 (S3 ViRGE/VX)", "stealth3d_3000_pci", &s3_virge_988_pci_device, GFX_VIRGEVX_PCI}, {"[PCI] Diamond Stealth 64 DRAM (S3 Trio64)", "stealth64d_pci", &s3_diamond_stealth64_pci_device, GFX_STEALTH64_PCI}, -#ifdef DEV_BRANCH -#ifdef USE_RIVA +#if defined(DEV_BRANCH) && defined(USE_RIVA) {"[PCI] nVidia RIVA 128", "riva128", &riva128_device, GFX_RIVA128}, {"[PCI] nVidia RIVA TNT", "rivatnt", &rivatnt_device, GFX_RIVATNT}, {"[PCI] nVidia RIVA TNT2", "rivatnt2", &rivatnt2_device, GFX_RIVATNT2}, -#endif #endif {"[PCI] Number Nine 9FX (S3 Trio64)", "n9_9fx_pci", &s3_9fx_pci_device, GFX_N9_9FX_PCI}, {"[PCI] Paradise Bahamas 64 (S3 Vision864)", "bahamas64_pci", &s3_bahamas64_pci_device, GFX_BAHAMAS64_PCI}, @@ -703,59 +702,49 @@ void video_blit_memtoscreen_8(int x, int y, int w, int h) thread_set_event(blit_data.wake_blit_thread); } -time_t now; -struct tm *info; -wchar_t screenshot_fn_partial[2048]; -wchar_t screenshot_fn[4096]; -wchar_t screenshot_path[4096]; -BOOL DirectoryExists(LPCTSTR szPath) +void +take_screenshot(void) { - DWORD dwAttrib = GetFileAttributes(szPath); + wchar_t path[1024], fn[128]; + struct tm *info; + time_t now; - return (dwAttrib != INVALID_FILE_ATTRIBUTES && - (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); -} + pclog("Screenshot: video API is: %i\n", vid_api); + if ((vid_api < 0) || (vid_api > 1)) return; -void take_screenshot(void) -{ - if ((vid_api < 0) || (vid_api > 1)) return; - time(&now); - info = localtime(&now); - memset(screenshot_fn, 0, 8192); - memset(screenshot_fn_partial, 0, 4096); - memset(screenshot_path, 0, 8192); - pclog("Video API is: %i\n", vid_api); - append_filename_w(screenshot_path, cfg_path, L"screenshots", 4095); - if (!DirectoryExists(screenshot_path)) - { - CreateDirectory(screenshot_path, NULL); - } - if (vid_api == 1) - { - wcsftime(screenshot_fn_partial, 2048, L"screenshots\\%Y%m%d_%H%M%S.png", info); - append_filename_w(screenshot_fn, cfg_path, screenshot_fn_partial, 4095); - if (video_fullscreen) - { - d3d_fs_take_screenshot(screenshot_fn); - } - else - { - pclog("Direct 3D...\n"); - d3d_take_screenshot(screenshot_fn); - } - } - else if (vid_api == 0) - { - wcsftime(screenshot_fn_partial, 2048, L"screenshots\\%Y%m%d_%H%M%S.bmp", info); - append_filename_w(screenshot_fn, cfg_path, screenshot_fn_partial, 4095); - if (video_fullscreen) - { - ddraw_fs_take_screenshot(screenshot_fn); - } - else - { - ddraw_take_screenshot(screenshot_fn); - } - } + memset(fn, 0, sizeof(fn)); + memset(path, 0, sizeof(path)); + + (void)time(&now); + info = localtime(&now); + + append_filename_w(path, cfg_path, SCREENSHOT_PATH, sizeof(path)-2); + + if (! dir_check_exist(path)) + dir_create(path); + +#ifdef WIN32 + wcscat(path, L"\\"); +#else + wcscat(path, L"/"); +#endif + + if (vid_api == 1) { + wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info); + append_filename_w(path, cfg_path, fn, 1024); + if (video_fullscreen) + d3d_fs_take_screenshot(path); + else + d3d_take_screenshot(path); + } else if (vid_api == 0) { + wcsftime(path, 128, L"%Y%m%d_%H%M%S.bmp", info); + append_filename_w(path, cfg_path, fn, 1024); + if (video_fullscreen) + ddraw_fs_take_screenshot(path); + else + ddraw_take_screenshot(path); + } + + pclog("Screenshot: fn='%ws'\n", path); } diff --git a/src/win/plat_iodev.h b/src/win/plat_iodev.h deleted file mode 100644 index c9f1ba874..000000000 --- a/src/win/plat_iodev.h +++ /dev/null @@ -1,11 +0,0 @@ -extern uint8_t host_cdrom_drive_available[26]; -extern uint8_t host_cdrom_drive_available_num; - - -extern void cdrom_init_host_drives(void); -extern void cdrom_close(uint8_t id); -extern void cdrom_eject(uint8_t id); -extern void cdrom_reload(uint8_t id); -extern void removable_disk_unload(uint8_t id); -extern void removable_disk_eject(uint8_t id); -extern void removable_disk_reload(uint8_t id); diff --git a/src/win/plat_ui.h b/src/win/plat_ui.h deleted file mode 100644 index 2a5dfcc7b..000000000 --- a/src/win/plat_ui.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __unix -extern void plat_msgbox_error(int i); -extern wchar_t *plat_get_string(int i); - -//#ifndef IDS_2077 -//#define IDS_2077 2077 -//#endif - -//#ifndef IDS_2078 -//#define IDS_2078 2078 -//#endif - -//#ifndef IDS_2079 -//#define IDS_2079 2079 -//#endif - -#ifndef IDS_2139 -# define IDS_2139 2139 /* network/network.c */ -#endif - -#ifndef IDS_2171 -#define IDS_2171 2171 /* sound/midi_fluidsynth.c */ -#endif - -//#ifndef IDS_2219 -//#define IDS_2219 2219 -//#endif -#endif - -extern void plat_msgbox_fatal(char *string); - -extern void get_executable_name(wchar_t *s, int size); -extern void set_window_title(wchar_t *s); -extern void startblit(void); -extern void endblit(void); diff --git a/src/win/win.c b/src/win/win.c index 337f41d41..e227c58ff 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -8,7 +8,7 @@ * * The Emulator's Windows core. * - * Version: @(#)win.c 1.0.18 2017/10/08 + * Version: @(#)win.c 1.0.19 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -52,15 +52,14 @@ #include "../video/vid_ega.h" #include "../sound/sound.h" #include "../sound/snd_dbopl.h" +#include "../plat.h" +#include "../ui.h" #include "plat_keyboard.h" -#include "plat_iodev.h" #include "plat_mouse.h" #include "plat_midi.h" #include "plat_thread.h" #include "plat_ticks.h" -#include "plat_ui.h" #include "win.h" -#include "win_cdrom_ioctl.h" #include "win_cgapal.h" #include "win_ddraw.h" #include "win_d3d.h" @@ -165,16 +164,15 @@ LoadIconEx(PCTSTR pszIconName) static void win_menu_update(void) { -#if 0 - menu = LoadMenu(hThisInstance, TEXT("MainMenu")); + menuMain = LoadMenu(hinstance, L"MainMenu")); - smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu")); - initmenu(); + menuSBAR = LoadMenu(hinstance, L"StatusBarMenu"); - SetMenu(hwndMain, menu); + initmenu(); - win_title_update = 1; -#endif + SetMenu(hwndMain, menu); + + win_title_update = 1; } #endif @@ -545,7 +543,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (video_fullscreen_first) { video_fullscreen_first = 0; - msgbox_info(hwndMain, IDS_2074); + ui_msgbox(MBX_INFO, (wchar_t *)IDS_2074); } startblit(); @@ -693,7 +691,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_CONFIG_LOAD: pause = 1; if (! file_dlg_st(hwnd, IDS_2160, "", 0)) { - if (msgbox_reset_yn(hwndMain) == IDYES) { + if (ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES) { config_write(config_file_default); for (i = 0; i < FDD_NUM; i++) { @@ -747,7 +745,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) rom_load_bios(romset); network_init(); ResetAllMenus(); - StatusBarUpdatePanes(); + ui_sb_update_panes(); pc_reset_hard_init(); } } @@ -1184,8 +1182,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) haccel = LoadAccelerators(hInst, ACCEL_NAME); if (haccel == NULL) { MessageBox(hwndMain, - win_get_string(IDS_2053), - win_get_string(IDS_2050), + plat_get_string(IDS_2053), + plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(3); } @@ -1198,8 +1196,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) device.hwndTarget = hwnd; if (! RegisterRawInputDevices(&device, 1, sizeof(device))) { MessageBox(hwndMain, - win_get_string(IDS_2054), - win_get_string(IDS_2050), + plat_get_string(IDS_2054), + plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(4); } @@ -1224,8 +1222,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) vid_api ^= 1; if (! vid_apis[0][vid_api].init(hwndRender)) { MessageBox(hwnd, - win_get_string(IDS_2095), - win_get_string(IDS_2050), + plat_get_string(IDS_2095), + plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(5); } @@ -1254,8 +1252,8 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) if (! pc_init_modules()) { /* Dang, no ROMs found at all! */ MessageBox(hwnd, - win_get_string(IDS_2056), - win_get_string(IDS_2050), + plat_get_string(IDS_2056), + plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(6); } @@ -1360,6 +1358,23 @@ set_window_title(wchar_t *s) } +int +dir_check_exist(wchar_t *path) +{ + DWORD dwAttrib = GetFileAttributes(path); + + return(((dwAttrib != INVALID_FILE_ATTRIBUTES && + (dwAttrib & FILE_ATTRIBUTE_DIRECTORY))) ? 1 : 0); +} + + +int +dir_create(wchar_t *path) +{ + return((int)CreateDirectory(path, NULL)); +} + + uint64_t timer_read(void) { @@ -1418,8 +1433,8 @@ win_language_check(void) } -LPTSTR -win_get_string(int i) +wchar_t * +plat_get_string(int i) { LPTSTR str; @@ -1443,21 +1458,14 @@ win_get_string(int i) str = lpRCstr6144[i-6144].str; } - return(str); -} - - -LPTSTR -win_get_string_from_string(char *str) -{ - return(win_get_string(atoi(str))); + return((wchar_t *)str); } wchar_t * -plat_get_string(int i) +plat_get_string_from_string(char *str) { - return((wchar_t *)win_get_string(i)); + return(plat_get_string(atoi(str))); } diff --git a/src/win/win.h b/src/win/win.h index b6768ad5c..0c337ba31 100644 --- a/src/win/win.h +++ b/src/win/win.h @@ -6,13 +6,11 @@ * * This file is part of the 86Box distribution. * - * The Emulator's Windows core. + * This file should contain things only used by the platform + * support modules for Windows. Generic definitions for UI and + * platform go into ../plat*.h. * - * NOTE This should be named 'plat.h' and then include any - * Windows-specific header files needed, to keep them - * out of the main code. - * - * Version: @(#)win.h 1.0.4 2017/10/07 + * Version: @(#)win.h 1.0.4 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -55,41 +53,29 @@ #define WM_SAVESETTINGS 0x8888 -extern HINSTANCE hinstance; -extern HWND hwndMain; -extern HICON hIcon[512]; +extern int pause; extern int status_is_open; extern int mousecapture; extern LCID dwLanguage; +extern HINSTANCE hinstance; +extern HWND hwndMain; +extern HICON hIcon[512]; + extern char openfilestring[260]; extern WCHAR wopenfilestring[260]; -extern int pause; - #ifdef __cplusplus extern "C" { #endif extern HICON LoadIconEx(PCTSTR pszIconName); -extern BOOL DirectoryExists(LPCTSTR szPath); - -extern void leave_fullscreen(void); -extern void get_executable_name(wchar_t *s, int size); -extern void set_window_title(wchar_t *s); extern void win_language_set(void); extern void win_language_update(void); extern void win_language_check(void); -extern LPTSTR win_get_string(int i); -extern LPTSTR win_get_string_from_string(char *str); - -extern void startblit(void); -extern void endblit(void); - - #ifdef EMU_DEVICE_H extern void deviceconfig_open(HWND hwnd, device_t *device); #endif @@ -106,8 +92,7 @@ extern int hard_disk_was_added(void); extern void get_registry_key_map(void); extern void process_raw_input(LPARAM lParam, int infocus); -extern void cdrom_init_host_drives(void); -extern void cdrom_close(uint8_t id); +extern int fdd_type_to_icon(int type); /* Functions in win_about.c: */ @@ -120,39 +105,11 @@ extern void StatusWindowCreate(HWND hwnd); /* Functions in win_stbar.c: */ -#define SB_ICON_WIDTH 24 -#define SB_FLOPPY 0x00 -#define SB_CDROM 0x10 -#define SB_RDISK 0x20 -#define SB_HDD 0x40 -#define SB_NETWORK 0x50 -#define SB_TEXT 0x60 - extern HWND hwndSBAR; extern void StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst); -extern int fdd_type_to_icon(int type); -extern int StatusBarFindPart(int tag); -extern void StatusBarUpdatePanes(void); -extern void StatusBarUpdateTip(int meaning); -extern void StatusBarUpdateIcon(int tag, int val); -extern void StatusBarUpdateIconState(int tag, int active); -extern void StatusBarCheckMenuItem(int tag, int id, int chk); -extern void StatusBarEnableMenuItem(int tag, int id, int val); -extern void StatusBarSetTextW(wchar_t *wstr); -extern void StatusBarSetText(char *str); /* Functions in win_dialog.c: */ -extern int msgbox_reset(HWND hwndParent); -extern int msgbox_reset_yn(HWND hwndParent); -extern int msgbox_question(HWND hwndParent, int i); -extern void msgbox_info(HWND hwndParent, int i); -extern void msgbox_info_wstr(HWND hwndParent, WCHAR *wstr); -extern void msgbox_error(HWND hwndParent, int i); -extern void msgbox_error_wstr(HWND hwndParent, WCHAR *wstr); -extern void msgbox_fatal(HWND hwndParent, char *string); -extern void msgbox_critical(HWND hwndParent, int i); - extern int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save); extern int file_dlg(HWND hwnd, WCHAR *f, char *fn, int save); extern int file_dlg_mb(HWND hwnd, char *f, char *fn, int save); diff --git a/src/win/win_about.c b/src/win/win_about.c index af82fb1b4..18bcf6efa 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -8,7 +8,7 @@ * * Handle the About dialog. * - * Version: @(#)win_about.c 1.0.1 2017/10/07 + * Version: @(#)win_about.c 1.0.2 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -29,7 +29,6 @@ #include #include #include "../86box.h" -#include "../ibm.h" #include "win.h" diff --git a/src/win/win_cdrom.c b/src/win/win_cdrom.c index db698987d..e42dec844 100644 --- a/src/win/win_cdrom.c +++ b/src/win/win_cdrom.c @@ -8,7 +8,7 @@ * * Handle the platform-side of CDROM drives. * - * Version: @(#)win_cdrom.c 1.0.2 2017/10/07 + * Version: @(#)win_cdrom.c 1.0.3 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -34,9 +34,9 @@ #include "../disk/hdd.h" #include "../scsi/scsi.h" #include "../scsi/scsi_disk.h" -#include "plat_ui.h" +#include "../plat.h" +#include "../ui.h" #include "win.h" -#include "win_cdrom_ioctl.h" uint8_t host_cdrom_drive_available[26]; @@ -93,7 +93,7 @@ cdrom_eject(uint8_t id) if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z')) { - StatusBarCheckMenuItem(SB_CDROM|id, + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_UNCHECKED); } @@ -109,12 +109,12 @@ cdrom_eject(uint8_t id) cdrom_insert(id); } - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED); + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED); cdrom_drives[id].host_drive=0; - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED); - StatusBarUpdateIconState(SB_CDROM|id, 1); - StatusBarEnableMenuItem(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); - StatusBarUpdateTip(SB_CDROM|id); + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED); + ui_sb_update_icon_state(SB_CDROM|id, 1); + ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); + ui_sb_update_tip(SB_CDROM|id); config_save(); } @@ -140,15 +140,15 @@ cdrom_reload(uint8_t id) cdrom_insert(id); } if (wcslen(cdrom_image[id].image_path) == 0) { - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED); + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED); cdrom_drives[id].host_drive = 0; - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED); - StatusBarUpdateIconState(SB_CDROM|id, 1); + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED); + ui_sb_update_icon_state(SB_CDROM|id, 1); } else { - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED); + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED); cdrom_drives[id].host_drive = 200; - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_CHECKED); - StatusBarUpdateIconState(SB_CDROM|id, 0); + 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; @@ -157,14 +157,14 @@ cdrom_reload(uint8_t id) /* Signal disc change to the emulated machine. */ cdrom_insert(id); } - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED); + ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED); cdrom_drives[id].host_drive = new_cdrom_drive; - StatusBarCheckMenuItem(SB_CDROM|id, IDM_CDROM_HOST_DRIVE | id | ((cdrom_drives[id].host_drive - 'A') << 3), MF_CHECKED); - StatusBarUpdateIconState(SB_CDROM|id, 0); + 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); } - StatusBarEnableMenuItem(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); - StatusBarUpdateTip(SB_CDROM|id); + ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); + ui_sb_update_tip(SB_CDROM|id); config_save(); } @@ -187,12 +187,12 @@ void removable_disk_eject(uint8_t id) { removable_disk_unload(id); - StatusBarUpdateIconState(SB_RDISK|id, 1); - StatusBarEnableMenuItem(SB_RDISK|id, IDM_RDISK_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - StatusBarEnableMenuItem(SB_RDISK|id, IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); - StatusBarEnableMenuItem(SB_RDISK|id, IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | MF_GRAYED); + 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); - StatusBarUpdateTip(SB_RDISK|id); + ui_sb_update_tip(SB_RDISK|id); config_save(); } @@ -211,13 +211,13 @@ removable_disk_reload(uint8_t id) scsi_disk_insert(id); #endif - StatusBarUpdateIconState(SB_RDISK|id, wcslen(hdd[id].fn) ? 0 : 1); + ui_sb_update_icon_state(SB_RDISK|id, wcslen(hdd[id].fn) ? 0 : 1); - StatusBarEnableMenuItem(SB_RDISK|id, IDM_RDISK_EJECT | id, MF_BYCOMMAND | (wcslen(hdd[id].fn) ? MF_ENABLED : MF_GRAYED)); - StatusBarEnableMenuItem(SB_RDISK|id, IDM_RDISK_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); - StatusBarEnableMenuItem(SB_RDISK|id, IDM_RDISK_SEND_CHANGE | id, MF_BYCOMMAND | (wcslen(hdd[id].fn) ? MF_ENABLED : MF_GRAYED)); + 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)); - StatusBarUpdateTip(SB_RDISK|id); + ui_sb_update_tip(SB_RDISK|id); config_save(); } diff --git a/src/win/win_cdrom_ioctl.c b/src/win/win_cdrom_ioctl.c index 04600d5d4..e99b372d1 100644 --- a/src/win/win_cdrom_ioctl.c +++ b/src/win/win_cdrom_ioctl.c @@ -9,10 +9,11 @@ * Implementation of the CD-ROM host drive IOCTL interface for * Windows using SCSI Passthrough Direct. * - * Version: @(#)cdrom_ioctl.c 1.0.5 2017/10/04 + * Version: @(#)cdrom_ioctl.c 1.0.6 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2016 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -29,7 +30,7 @@ #include "../device.h" #include "../scsi/scsi.h" #include "../cdrom/cdrom.h" -#include "win_cdrom_ioctl.h" +#include "../plat.h" #define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f) diff --git a/src/win/win_cdrom_ioctl.h b/src/win/win_cdrom_ioctl.h deleted file mode 100644 index a81d773b8..000000000 --- a/src/win/win_cdrom_ioctl.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 86Box A hypervisor and IBM PC system emulator that specializes in - * running old operating systems and software designed for IBM - * PC systems and compatibles from 1981 through fairly recent - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Implementation of the CD-ROM host drive IOCTL interface for - * Windows using SCSI Passthrough Direct. - * - * This file lists the functions provided by various platform- - * specific cdrom-ioctl files. - * - * Version: @(#)cdrom_ioctl.h 1.0.3 2017/09/03 - * - * Authors: Sarah Walker, - * Miran Grca, - * Copyright 2008-2016 Sarah Walker. - * Copyright 2016,2017 Miran Grca. - */ -#ifndef EMU_CDROM_IOCTL_H -#define EMU_CDROM_IOCTL_H - - -extern uint32_t cdrom_capacity; - - -extern int ioctl_open(uint8_t id, char d); -extern void ioctl_reset(uint8_t id); - -extern void ioctl_close(uint8_t id); - - -#endif /*EMU_CDROM_IOCTL_H */ diff --git a/src/win/win_ddraw.cc b/src/win/win_ddraw.cc index cafdc164c..1cda4e892 100644 --- a/src/win/win_ddraw.cc +++ b/src/win/win_ddraw.cc @@ -8,6 +8,8 @@ #include #undef BITMAP #include "../video/video.h" +#include "../plat.h" +#include "../ui.h" #include "win_ddraw.h" #include "win_cgapal.h" #include "win.h" @@ -106,8 +108,8 @@ SaveBitmap(wchar_t *szFilename, HBITMAP hBitmap) if ((fp = _wfopen(szFilename, L"wb")) == NULL) { _swprintf(szMessage, - win_get_string(IDS_2088), szFilename); - msgbox_error_wstr(hwndMain, szMessage); + plat_get_string(IDS_2088), szFilename); + ui_msgbox(MBX_ERROR, szMessage); break; } diff --git a/src/win/win_deviceconfig.c b/src/win/win_deviceconfig.c index c606ce091..df1759af9 100644 --- a/src/win/win_deviceconfig.c +++ b/src/win/win_deviceconfig.c @@ -8,7 +8,7 @@ * * Windows device configuration dialog implementation. * - * Version: @(#)win_deviceconfig.c 1.0.4 2017/10/07 + * Version: @(#)win_deviceconfig.c 1.0.5 2017/10/09 * * Authors: Sarah Walker, * Miran Grca, @@ -23,6 +23,8 @@ #include "../ibm.h" #include "../config.h" #include "../device.h" +#include "../plat.h" +#include "../ui.h" #include "plat_midi.h" #define NO_UNICODE /*FIXME: not Unicode? */ #include "win.h" @@ -271,13 +273,13 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) return TRUE; } - ret = msgbox_reset(hwndMain); + ret = ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051); switch(ret) { - case IDNO: + case 1: EndDialog(hdlg, 0); return TRUE; - case IDCANCEL: + case -1: return FALSE; default: break; diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 5c5db002d..887dd8119 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -8,7 +8,7 @@ * * Several dialogs for the application. * - * Version: @(#)win_dialog.c 1.0.1 2017/10/07 + * Version: @(#)win_dialog.c 1.0.2 2017/10/09 * * Author: Miran Grca, * Fred N. van Kempen, @@ -29,7 +29,8 @@ #include #include "../ibm.h" #include "../device.h" -#include "plat_ui.h" +#include "../plat.h" +#include "../ui.h" #include "win.h" @@ -78,97 +79,80 @@ BrowseFolder(wchar_t *saved_path, wchar_t *title) int -msgbox_reset(HWND hwnd) +ui_msgbox(int flags, void *arg) { - return(MessageBox(hwnd, win_get_string(IDS_2051), - win_get_string(IDS_STRINGS), - MB_YESNOCANCEL | MB_ICONQUESTION)); + WCHAR temp[512]; + DWORD fl = 0; + WCHAR *str = NULL; + WCHAR *cap = NULL; + + switch(flags & 0x1f) { + case MBX_INFO: /* just an informational message */ + fl = (MB_OK | MB_ICONINFORMATION); + cap = plat_get_string(IDS_STRINGS); /* "86Box" */ + break; + + case MBX_ERROR: /* error message */ + if (flags & MBX_FATAL) { + fl = (MB_OK | MB_ICONERROR); + cap = plat_get_string(IDS_2050); /* "Fatal Error"*/ + } else { + fl = (MB_OK | MB_ICONWARNING); + cap = plat_get_string(IDS_2049); /* "Error" */ + } + break; + + case MBX_QUESTION: /* question */ + fl = (MB_YESNOCANCEL | MB_ICONQUESTION); + cap = plat_get_string(IDS_STRINGS); /* "86Box" */ + break; + } + + /* If ANSI string, convert it. */ + str = (WCHAR *)arg; + if (flags & MBX_ANSI) { + mbstowcs(temp, (char *)arg, strlen((char *)arg)+1); + str = temp; + } else { + /* + * It's a Unicode string. + * + * Well, no, maybe not. It could also be one of the + * strings stored in the Resources. Those are wide, + * but referenced by a numeric ID. + * + * The good news is, that strings are usually stored + * in the executable near the end of the code/rodata + * segment. This means, that *real* string pointers + * usually have a pretty high (numeric) value, much + * higher than the numeric ID's. So, we guesswork + * that if the value of 'arg' is low, its an ID.. + */ + if (((int64_t)arg) < ((int64_t)65636)) + str = plat_get_string((int)arg); + } + + /* At any rate, we do have a valid (wide) string now. */ + fl = MessageBox(hwndMain, /* our main window */ + str, /* error message etc */ + cap, /* window caption */ + fl); + + /* Convert return values to generic ones. */ + if (fl == IDNO) fl = 1; + else if (fl == IDCANCEL) fl = -1; + else fl = 0; + + return(fl); } +#if 0 int msgbox_reset_yn(HWND hwnd) { - return(MessageBox(hwnd, win_get_string(IDS_2051), - win_get_string(IDS_STRINGS), - MB_YESNO | MB_ICONQUESTION)); -} - - -int -msgbox_question(HWND hwnd, int i) -{ - return(MessageBox(hwnd, win_get_string(i), - win_get_string(IDS_STRINGS), - MB_YESNO | MB_ICONQUESTION)); -} - - -void -msgbox_info(HWND hwnd, int i) -{ - MessageBox(hwnd, win_get_string(i), win_get_string(IDS_STRINGS), - MB_OK | MB_ICONINFORMATION); -} - - -void -msgbox_info_wstr(HWND hwnd, WCHAR *wstr) -{ - MessageBox(hwnd, wstr, win_get_string(IDS_STRINGS), - MB_OK | MB_ICONINFORMATION); -} - - -void -msgbox_error(HWND hwnd, int i) -{ - MessageBox(hwnd, win_get_string(i), win_get_string(IDS_2049), - MB_OK | MB_ICONWARNING); -} - - -void -plat_msgbox_error(int i) -{ - msgbox_error(hwndMain, i); -} - - -void -msgbox_error_wstr(HWND hwnd, WCHAR *wstr) -{ - MessageBox(hwnd, wstr, win_get_string(IDS_2049), MB_OK | MB_ICONWARNING); -} - - -void -msgbox_critical(HWND hwnd, int i) -{ - MessageBox(hwnd, win_get_string(i), win_get_string(IDS_2050), - MB_OK | MB_ICONERROR); -} - - -void -msgbox_fatal(HWND hwnd, char *string) -{ - LPTSTR temp; - - temp = (LPTSTR)malloc(512); - mbstowcs(temp, string, strlen(string)+1); - - MessageBox(hwnd, temp, win_get_string(IDS_2050), MB_OK | MB_ICONERROR); - - free(temp); -} - - -void -plat_msgbox_fatal(char *string) -{ - msgbox_fatal(hwndMain, string); -} + return(MessageBox(hwnd, plat_get_string(IDS_2051), +#endif int @@ -249,12 +233,12 @@ file_dlg_mb(HWND hwnd, char *f, char *fn, int save) int file_dlg_w_st(HWND hwnd, int id, WCHAR *fn, int save) { - return(file_dlg_w(hwnd, win_get_string(id), fn, save)); + return(file_dlg_w(hwnd, plat_get_string(id), fn, save)); } int file_dlg_st(HWND hwnd, int id, char *fn, int save) { - return(file_dlg(hwnd, win_get_string(id), fn, save)); + return(file_dlg(hwnd, plat_get_string(id), fn, save)); } diff --git a/src/win/win_settings.c b/src/win/win_settings.c index af8775852..9df8979b4 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Windows 86Box Settings dialog handler. * - * Version: @(#)win_settings.c 1.0.18 2017/10/07 + * Version: @(#)win_settings.c 1.0.19 2017/10/09 * * Author: Miran Grca, * @@ -50,6 +50,8 @@ #include "../sound/snd_mpu401.h" #include "../video/video.h" #include "../video/vid_voodoo.h" +#include "../plat.h" +#include "../ui.h" #include "plat_midi.h" #include "win.h" @@ -103,6 +105,25 @@ static int settings_scsi_to_list[20], settings_list_to_scsi[20]; static int settings_network_to_list[20], settings_list_to_network[20]; + +/* Show a MessageBox dialog. This is nasty, I know. --FvK */ +static int +settings_msgbox(int type, void *arg) +{ + HWND h; + int i; + + h = hwndMain; + hwndMain = hwndParentDialog; + + i = ui_msgbox(type, arg); + + hwndMain = h; + + return(i); +} + + /* This does the initial read of global variables into the temporary ones. */ static void win_settings_init(void) { @@ -252,24 +273,15 @@ static int settings_msgbox_reset(void) if (changed) { - i = msgbox_reset(hwndParentDialog); + i = settings_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051); - if (i == IDNO) - { - return 1; - } - else if (i == IDCANCEL) - { - return 0; - } - else - { - return 2; - } - } - else -{ - return 1; + if (i == 1) return(1); /* no */ + + if (i < 0) return(0); /* cancel */ + + return(2); /* yes */ + } else { + return(1); } } @@ -348,7 +360,7 @@ static void win_settings_save(void) mem_resize(); rom_load_bios(romset); - StatusBarUpdatePanes(); + ui_sb_update_panes(); sound_realloc_buffers(); @@ -522,13 +534,13 @@ static void win_settings_machine_recalc_machine(HWND hdlg) { SendMessage(h, UDM_SETPOS, 0, temp_mem_size); h = GetDlgItem(hdlg, IDC_TEXT_MB); - SendMessage(h, WM_SETTEXT, 0, (LPARAM) win_get_string(IDS_2094)); + SendMessage(h, WM_SETTEXT, 0, (LPARAM) plat_get_string(IDS_2094)); } else { SendMessage(h, UDM_SETPOS, 0, temp_mem_size / 1024); h = GetDlgItem(hdlg, IDC_TEXT_MB); - SendMessage(h, WM_SETTEXT, 0, (LPARAM) win_get_string(IDS_2087)); + SendMessage(h, WM_SETTEXT, 0, (LPARAM) plat_get_string(IDS_2087)); } free(lptsTemp); @@ -572,11 +584,11 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM w SendMessage(h, CB_SETCURSEL, machinetolist[temp_machine], 0); h = GetDlgItem(hdlg, IDC_COMBO_WS); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_get_string(IDS_2131)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2131)); for (c = 0; c < 8; c++) { - wsprintf(lptsTemp, win_get_string(2132), c); + wsprintf(lptsTemp, plat_get_string(2132), c); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } @@ -745,12 +757,12 @@ static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wPa recalc_vid_list(hdlg); h = GetDlgItem(hdlg, IDC_COMBO_VIDEO_SPEED); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2133)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2134)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2135)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2136)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2137)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2138)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2133)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2134)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2135)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2136)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2137)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_2138)); SendMessage(h, CB_SETCURSEL, temp_video_speed, 0); h=GetDlgItem(hdlg, IDC_CHECK_VOODOO); @@ -895,7 +907,7 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa { str_id = IDS_3072 + c; - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(str_id)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(str_id)); settings_list_to_mouse[d] = c; d++; @@ -908,7 +920,7 @@ static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wPa c = 0; while (joystick_get_name(c)) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(2144 + c)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(2144 + c)); c++; } EnableWindow(h, TRUE); @@ -1061,7 +1073,7 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa { if (c == 0) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_get_string(IDS_2152)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2152)); } else { @@ -1110,7 +1122,7 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa { if (c == 0) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_get_string(IDS_2152)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2152)); } else { @@ -1295,7 +1307,7 @@ static BOOL CALLBACK win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wPa if (c == 0) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_get_string(IDS_2152)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2152)); } else { @@ -1475,11 +1487,12 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR { scsi_dev = scsi_card_getdevice(c); + if (device_is_valid(scsi_dev, machines[temp_machine].flags)) { if (c == 0) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_get_string(IDS_2152)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2152)); } else { @@ -1510,11 +1523,11 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR recalc_hdc_list(hdlg, temp_machine, 0); h=GetDlgItem(hdlg, IDC_COMBO_IDE_TER); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_5376)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_5376)); for (c = 0; c < 11; c++) { - wsprintf(lptsTemp, win_get_string(IDS_2155), valid_ide_irqs[c]); + wsprintf(lptsTemp, plat_get_string(IDS_2155), valid_ide_irqs[c]); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } @@ -1528,11 +1541,11 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR } h=GetDlgItem(hdlg, IDC_COMBO_IDE_QUA); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_5376)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_5376)); for (c = 0; c < 11; c++) { - wsprintf(lptsTemp, win_get_string(IDS_2155), valid_ide_irqs[c]); + wsprintf(lptsTemp, plat_get_string(IDS_2155), valid_ide_irqs[c]); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } @@ -1727,7 +1740,7 @@ static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM w { if (c == 0) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_get_string(2152)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(2152)); } else { @@ -1907,34 +1920,34 @@ static void add_locations(HWND hdlg) h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS); for (i = 0; i < 7; i++) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_4352 + i)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_4352 + i)); } h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL); for (i = 0; i < 8; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4097), i >> 1, i & 1); + wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } h = GetDlgItem(hdlg, IDC_COMBO_HD_ID); for (i = 0; i < 16; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4098), i); + wsprintf(lptsTemp, plat_get_string(IDS_4098), i); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN); for (i = 0; i < 8; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4098), i); + wsprintf(lptsTemp, plat_get_string(IDS_4098), i); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE); for (i = 0; i < 8; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4097), i >> 1, i & 1); + wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } @@ -2176,25 +2189,25 @@ static void win_settings_hard_disks_update_item(HWND hwndList, int i, int column switch(temp_hdd[i].bus) { case HDD_BUS_MFM: - wsprintf(szText, win_get_string(IDS_4608), temp_hdd[i].mfm_channel >> 1, temp_hdd[i].mfm_channel & 1); + wsprintf(szText, plat_get_string(IDS_4608), temp_hdd[i].mfm_channel >> 1, temp_hdd[i].mfm_channel & 1); break; case HDD_BUS_XTIDE: - wsprintf(szText, win_get_string(IDS_4609), temp_hdd[i].xtide_channel >> 1, temp_hdd[i].xtide_channel & 1); + wsprintf(szText, plat_get_string(IDS_4609), temp_hdd[i].xtide_channel >> 1, temp_hdd[i].xtide_channel & 1); break; case HDD_BUS_ESDI: - wsprintf(szText, win_get_string(IDS_4610), temp_hdd[i].esdi_channel >> 1, temp_hdd[i].esdi_channel & 1); + wsprintf(szText, plat_get_string(IDS_4610), temp_hdd[i].esdi_channel >> 1, temp_hdd[i].esdi_channel & 1); break; case HDD_BUS_IDE_PIO_ONLY: - wsprintf(szText, win_get_string(IDS_4611), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); + wsprintf(szText, plat_get_string(IDS_4611), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); break; case HDD_BUS_IDE_PIO_AND_DMA: - wsprintf(szText, win_get_string(IDS_4612), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); + wsprintf(szText, plat_get_string(IDS_4612), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); break; case HDD_BUS_SCSI: - wsprintf(szText, win_get_string(IDS_4613), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); + wsprintf(szText, plat_get_string(IDS_4613), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); break; case HDD_BUS_SCSI_REMOVABLE: - wsprintf(szText, win_get_string(IDS_4614), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); + wsprintf(szText, plat_get_string(IDS_4614), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); break; } lvI.pszText = szText; @@ -2207,25 +2220,25 @@ static void win_settings_hard_disks_update_item(HWND hwndList, int i, int column } else if (column == 2) { - wsprintf(szText, win_get_string(IDS_4098), temp_hdd[i].tracks); + wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].tracks); lvI.pszText = szText; lvI.iImage = 0; } else if (column == 3) { - wsprintf(szText, win_get_string(IDS_4098), temp_hdd[i].hpc); + wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].hpc); lvI.pszText = szText; lvI.iImage = 0; } else if (column == 4) { - wsprintf(szText, win_get_string(IDS_4098), temp_hdd[i].spt); + wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].spt); lvI.pszText = szText; lvI.iImage = 0; } else if (column == 5) { - wsprintf(szText, win_get_string(IDS_4098), (temp_hdd[i].tracks * temp_hdd[i].hpc * temp_hdd[i].spt) >> 11); + wsprintf(szText, plat_get_string(IDS_4098), (temp_hdd[i].tracks * temp_hdd[i].hpc * temp_hdd[i].spt) >> 11); lvI.pszText = szText; lvI.iImage = 0; } @@ -2260,25 +2273,25 @@ static BOOL win_settings_hard_disks_recalc_list(HWND hwndList) switch(temp_hdd[i].bus) { case HDD_BUS_MFM: - wsprintf(szText, win_get_string(IDS_4608), temp_hdd[i].mfm_channel >> 1, temp_hdd[i].mfm_channel & 1); + wsprintf(szText, plat_get_string(IDS_4608), temp_hdd[i].mfm_channel >> 1, temp_hdd[i].mfm_channel & 1); break; case HDD_BUS_XTIDE: - wsprintf(szText, win_get_string(IDS_4609), temp_hdd[i].xtide_channel >> 1, temp_hdd[i].xtide_channel & 1); + wsprintf(szText, plat_get_string(IDS_4609), temp_hdd[i].xtide_channel >> 1, temp_hdd[i].xtide_channel & 1); break; case HDD_BUS_ESDI: - wsprintf(szText, win_get_string(IDS_4610), temp_hdd[i].esdi_channel >> 1, temp_hdd[i].esdi_channel & 1); + wsprintf(szText, plat_get_string(IDS_4610), temp_hdd[i].esdi_channel >> 1, temp_hdd[i].esdi_channel & 1); break; case HDD_BUS_IDE_PIO_ONLY: - wsprintf(szText, win_get_string(IDS_4611), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); + wsprintf(szText, plat_get_string(IDS_4611), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); break; case HDD_BUS_IDE_PIO_AND_DMA: - wsprintf(szText, win_get_string(IDS_4612), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); + wsprintf(szText, plat_get_string(IDS_4612), temp_hdd[i].ide_channel >> 1, temp_hdd[i].ide_channel & 1); break; case HDD_BUS_SCSI: - wsprintf(szText, win_get_string(IDS_4613), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); + wsprintf(szText, plat_get_string(IDS_4613), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); break; case HDD_BUS_SCSI_REMOVABLE: - wsprintf(szText, win_get_string(IDS_4614), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); + wsprintf(szText, plat_get_string(IDS_4614), temp_hdd[i].scsi_id, temp_hdd[i].scsi_lun); break; } lvI.pszText = szText; @@ -2301,7 +2314,7 @@ static BOOL win_settings_hard_disks_recalc_list(HWND hwndList) } lvI.iSubItem = 2; - wsprintf(szText, win_get_string(IDS_4098), temp_hdd[i].tracks); + wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].tracks); lvI.pszText = szText; lvI.iItem = j; lvI.iImage = 0; @@ -2312,7 +2325,7 @@ static BOOL win_settings_hard_disks_recalc_list(HWND hwndList) } lvI.iSubItem = 3; - wsprintf(szText, win_get_string(IDS_4098), temp_hdd[i].hpc); + wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].hpc); lvI.pszText = szText; lvI.iItem = j; lvI.iImage = 0; @@ -2323,7 +2336,7 @@ static BOOL win_settings_hard_disks_recalc_list(HWND hwndList) } lvI.iSubItem = 4; - wsprintf(szText, win_get_string(IDS_4098), temp_hdd[i].spt); + wsprintf(szText, plat_get_string(IDS_4098), temp_hdd[i].spt); lvI.pszText = szText; lvI.iItem = j; lvI.iImage = 0; @@ -2334,7 +2347,7 @@ static BOOL win_settings_hard_disks_recalc_list(HWND hwndList) } lvI.iSubItem = 5; - wsprintf(szText, win_get_string(IDS_4098), (temp_hdd[i].tracks * temp_hdd[i].hpc * temp_hdd[i].spt) >> 11); + wsprintf(szText, plat_get_string(IDS_4098), (temp_hdd[i].tracks * temp_hdd[i].hpc * temp_hdd[i].spt) >> 11); lvI.pszText = szText; lvI.iItem = j; lvI.iImage = 0; @@ -2370,7 +2383,7 @@ static BOOL win_settings_hard_disks_init_columns(HWND hwndList) for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) { lvc.iSubItem = iCol; - lvc.pszText = win_get_string(2082 + iCol); + lvc.pszText = plat_get_string(2082 + iCol); switch(iCol) { @@ -2433,7 +2446,7 @@ static void set_edit_box_contents(HWND hdlg, int id, uint64_t val) WCHAR szText[256]; h = GetDlgItem(hdlg, id); - wsprintf(szText, win_get_string(IDS_2156), val); + wsprintf(szText, plat_get_string(IDS_2156), val); SendMessage(h, WM_SETTEXT, (WPARAM) wcslen(szText), (LPARAM) szText); } @@ -2467,15 +2480,15 @@ static int hdconf_initialize_hdt_combo(HWND hdlg) { temp_size = hdd_table[i][0] * hdd_table[i][1] * hdd_table[i][2]; size_mb = temp_size >> 11; - wsprintf(szText, win_get_string(IDS_2157), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]); + wsprintf(szText, plat_get_string(IDS_2157), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); if ((tracks == hdd_table[i][0]) && (hpc == hdd_table[i][1]) && (spt == hdd_table[i][2])) { selection = i; } } - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_4100)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_4101)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_4100)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_4101)); SendMessage(h, CB_SETCURSEL, selection, 0); return selection; } @@ -2533,7 +2546,7 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W hdd_ptr = &(temp_hdd[next_free_id]); } - SetWindowText(hdlg, win_get_string((existing & 1) ? IDS_4103 : IDS_4102)); + SetWindowText(hdlg, plat_get_string((existing & 1) ? IDS_4103 : IDS_4102)); no_update = 1; spt = (existing & 1) ? 0 : 17; @@ -2634,7 +2647,7 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W if ((wcslen(hd_file_name) == 0) && (hdd_ptr->bus != HDD_BUS_SCSI_REMOVABLE)) { hdd_ptr->bus = HDD_BUS_DISABLED; - msgbox_error(hwndParentDialog, IDS_4112); + settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4112); return TRUE; } else if ((wcslen(hd_file_name) == 0) && (hdd_ptr->bus == HDD_BUS_SCSI_REMOVABLE)) @@ -2706,7 +2719,7 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W if (size >= 0x100000000ll) { fclose(f); - msgbox_error(hwndParentDialog, IDS_4104); + settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4104); return TRUE; } @@ -2729,7 +2742,7 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W if (size > 0xffffffffffffffffll) { fclose(f); - msgbox_error(hwndParentDialog, IDS_4105); + settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4105); return TRUE; } @@ -2769,7 +2782,7 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W } fclose(f); - msgbox_info(hwndParentDialog, IDS_4113); + settings_msgbox(MBX_INFO, (wchar_t *)IDS_4113); } hd_add_ok_common: @@ -2787,7 +2800,7 @@ hd_add_ok_common: return TRUE; case IDC_CFILE: - if (!file_dlg_w(hdlg, win_get_string(IDS_4106), L"", !(existing & 1))) + if (!file_dlg_w(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1))) { if (!(existing & 1)) { @@ -2795,7 +2808,7 @@ hd_add_ok_common: if (f != NULL) { fclose(f); - if (msgbox_question(hwndMain, IDS_4111) != IDYES) + if (settings_msgbox(MBX_QUESTION, (wchar_t *)IDS_4111) != 0) /* yes */ { return FALSE; } @@ -2806,7 +2819,7 @@ hd_add_ok_common: if (f == NULL) { hdd_add_file_open_error: - msgbox_error(hwndParentDialog, (existing & 1) ? IDS_4107 : IDS_4108); + settings_msgbox(MBX_ERROR, (existing & 1) ? (wchar_t *)IDS_4107 : (wchar_t *)IDS_4108); return TRUE; } if (existing & 1) @@ -2817,7 +2830,7 @@ hdd_add_file_open_error: fread(§or_size, 1, 4, f); if (sector_size != 512) { - msgbox_error(hwndParentDialog, IDS_4109); + settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4109); fclose(f); return TRUE; } @@ -3523,7 +3536,7 @@ static BOOL win_settings_floppy_drives_recalc_list(HWND hwndList) } else { - lvI.pszText = win_get_string(IDS_5376); + lvI.pszText = plat_get_string(IDS_5376); } lvI.iItem = i; lvI.iImage = temp_fdd_types[i]; @@ -3532,7 +3545,7 @@ static BOOL win_settings_floppy_drives_recalc_list(HWND hwndList) return FALSE; lvI.iSubItem = 1; - lvI.pszText = win_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061); + lvI.pszText = plat_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061); lvI.iItem = i; lvI.iImage = 0; @@ -3542,7 +3555,7 @@ static BOOL win_settings_floppy_drives_recalc_list(HWND hwndList) } lvI.iSubItem = 2; - lvI.pszText = win_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061); + lvI.pszText = plat_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061); lvI.iItem = i; lvI.iImage = 0; @@ -3573,21 +3586,21 @@ static BOOL win_settings_cdrom_drives_recalc_list(HWND hwndList) { case CDROM_BUS_DISABLED: default: - lvI.pszText = win_get_string(fsid); + lvI.pszText = plat_get_string(fsid); lvI.iImage = 0; break; case CDROM_BUS_ATAPI_PIO_ONLY: - wsprintf(szText, win_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); + wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); lvI.pszText = szText; lvI.iImage = 1; break; case CDROM_BUS_ATAPI_PIO_AND_DMA: - wsprintf(szText, win_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); + wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); lvI.pszText = szText; lvI.iImage = 1; break; case CDROM_BUS_SCSI: - wsprintf(szText, win_get_string(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun); + wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun); lvI.pszText = szText; lvI.iImage = 1; break; @@ -3609,7 +3622,7 @@ static BOOL win_settings_floppy_drives_init_columns(HWND hwndList) lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = 0; - lvc.pszText = win_get_string(IDS_2143); + lvc.pszText = plat_get_string(IDS_2143); lvc.cx = 292; lvc.fmt = LVCFMT_LEFT; @@ -3620,7 +3633,7 @@ static BOOL win_settings_floppy_drives_init_columns(HWND hwndList) } lvc.iSubItem = 1; - lvc.pszText = win_get_string(IDS_2059); + lvc.pszText = plat_get_string(IDS_2059); lvc.cx = 50; lvc.fmt = LVCFMT_LEFT; @@ -3631,7 +3644,7 @@ static BOOL win_settings_floppy_drives_init_columns(HWND hwndList) } lvc.iSubItem = 2; - lvc.pszText = win_get_string(IDS_2170); + lvc.pszText = plat_get_string(IDS_2170); lvc.cx = 75; lvc.fmt = LVCFMT_LEFT; @@ -3650,7 +3663,7 @@ static BOOL win_settings_cdrom_drives_init_columns(HWND hwndList) lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = 0; - lvc.pszText = win_get_string(IDS_2082); + lvc.pszText = plat_get_string(IDS_2082); lvc.cx = 392; lvc.fmt = LVCFMT_LEFT; @@ -3721,7 +3734,7 @@ static void win_settings_floppy_drives_update_item(HWND hwndList, int i) } else { - lvI.pszText = win_get_string(IDS_5376); + lvI.pszText = plat_get_string(IDS_5376); } lvI.iImage = temp_fdd_types[i]; @@ -3731,7 +3744,7 @@ static void win_settings_floppy_drives_update_item(HWND hwndList, int i) } lvI.iSubItem = 1; - lvI.pszText = win_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061); + lvI.pszText = plat_get_string(temp_fdd_turbo[i] ? IDS_2060 : IDS_2061); lvI.iItem = i; lvI.iImage = 0; @@ -3741,7 +3754,7 @@ static void win_settings_floppy_drives_update_item(HWND hwndList, int i) } lvI.iSubItem = 2; - lvI.pszText = win_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061); + lvI.pszText = plat_get_string(temp_fdd_check_bpb[i] ? IDS_2060 : IDS_2061); lvI.iItem = i; lvI.iImage = 0; @@ -3769,21 +3782,21 @@ static void win_settings_cdrom_drives_update_item(HWND hwndList, int i) { case CDROM_BUS_DISABLED: default: - lvI.pszText = win_get_string(fsid); + lvI.pszText = plat_get_string(fsid); lvI.iImage = 0; break; case CDROM_BUS_ATAPI_PIO_ONLY: - wsprintf(szText, win_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); + wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); lvI.pszText = szText; lvI.iImage = 1; break; case CDROM_BUS_ATAPI_PIO_AND_DMA: - wsprintf(szText, win_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); + wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].ide_channel >> 1, temp_cdrom_drives[i].ide_channel & 1); lvI.pszText = szText; lvI.iImage = 1; break; case CDROM_BUS_SCSI: - wsprintf(szText, win_get_string(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun); + wsprintf(szText, plat_get_string(fsid), temp_cdrom_drives[i].scsi_device_id, temp_cdrom_drives[i].scsi_device_lun); lvI.pszText = szText; lvI.iImage = 1; break; @@ -3808,28 +3821,28 @@ static void cdrom_add_locations(HWND hdlg) { if ((i == CDROM_BUS_DISABLED) || (i >= CDROM_BUS_ATAPI_PIO_ONLY)) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(combo_id_to_string_id(i))); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(combo_id_to_string_id(i))); } } h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); for (i = 0; i < 16; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4098), i); + wsprintf(lptsTemp, plat_get_string(IDS_4098), i); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } h = GetDlgItem(hdlg, IDC_COMBO_CD_LUN); for (i = 0; i < 8; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4098), i); + wsprintf(lptsTemp, plat_get_string(IDS_4098), i); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); for (i = 0; i < 8; i++) { - wsprintf(lptsTemp, win_get_string(IDS_4097), i >> 1, i & 1); + wsprintf(lptsTemp, plat_get_string(IDS_4097), i >> 1, i & 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } @@ -3923,7 +3936,7 @@ static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message { if (i == 0) { - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_5376)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)plat_get_string(IDS_5376)); } else { @@ -4274,7 +4287,7 @@ static BOOL win_settings_main_insert_categories(HWND hwndList) for (i = 0; i < 9; i++) { - lvI.pszText = win_get_string(IDS_2065+i); + lvI.pszText = plat_get_string(IDS_2065+i); lvI.iItem = i; lvI.iImage = i; diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index 0d32c2cf8..3651eabeb 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -8,7 +8,7 @@ * * Implement the application's Status Bar. * - * Version: @(#)win_stbar.c 1.0.2 2017/10/07 + * Version: @(#)win_stbar.c 1.0.3 2017/10/09 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -45,16 +45,15 @@ #include "../network/network.h" #include "../video/video.h" #include "../sound/sound.h" -#include "plat_iodev.h" -#include "plat_ui.h" +#include "../plat.h" +#include "../ui.h" #include "win.h" -#include "win_cdrom_ioctl.h" HWND hwndSBAR; -static LONG_PTR OriginalStatusBarProcedure; +static LONG_PTR OriginalProcedure; static HMENU *sb_menu_handles; static HMENU menuSBAR; static WCHAR **sbTips; @@ -132,15 +131,15 @@ static void StatusBarCreateFloppySubmenu(HMENU m, int id) { AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_NEW | id, - win_get_string(IDS_2161)); + plat_get_string(IDS_2161)); AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING | id, - win_get_string(IDS_2162)); + plat_get_string(IDS_2162)); AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id, - win_get_string(IDS_2163)); + plat_get_string(IDS_2163)); AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id, - win_get_string(IDS_2164)); + plat_get_string(IDS_2164)); } @@ -151,15 +150,15 @@ StatusBarCreateCdromSubmenu(HMENU m, int id) int i; AppendMenu(m, MF_STRING, IDM_CDROM_MUTE | id, - win_get_string(IDS_2165)); + plat_get_string(IDS_2165)); AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_STRING, IDM_CDROM_EMPTY | id, - win_get_string(IDS_2166)); + plat_get_string(IDS_2166)); AppendMenu(m, MF_STRING, IDM_CDROM_RELOAD | id, - win_get_string(IDS_2167)); + plat_get_string(IDS_2167)); AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_STRING, IDM_CDROM_IMAGE | id, - win_get_string(IDS_2168)); + plat_get_string(IDS_2168)); if (host_cdrom_drive_available_num == 0) { if ((cdrom_drives[id].host_drive >= 'A') && @@ -206,23 +205,23 @@ static void StatusBarCreateRemovableDiskSubmenu(HMENU m, int id) { AppendMenu(m, MF_STRING, IDM_RDISK_EJECT | id, - win_get_string(IDS_2166)); + plat_get_string(IDS_2166)); AppendMenu(m, MF_STRING, IDM_RDISK_RELOAD | id, - win_get_string(IDS_2167)); + plat_get_string(IDS_2167)); AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_STRING, IDM_RDISK_SEND_CHANGE | id, - win_get_string(IDS_2142)); + plat_get_string(IDS_2142)); AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_STRING, IDM_RDISK_IMAGE | id, - win_get_string(IDS_2168)); + plat_get_string(IDS_2168)); AppendMenu(m, MF_STRING, IDM_RDISK_IMAGE_WP | id, - win_get_string(IDS_2169)); + plat_get_string(IDS_2169)); } /* API */ int -StatusBarFindPart(int tag) +ui_sb_find_part(int tag) { int found = -1; int i; @@ -244,7 +243,7 @@ StatusBarFindPart(int tag) /* API: update one of the icons after activity. */ void -StatusBarUpdateIcon(int tag, int active) +ui_sb_update_icon(int tag, int active) { int temp_flags = 0; int found; @@ -255,7 +254,7 @@ StatusBarUpdateIcon(int tag, int active) temp_flags |= active; - found = StatusBarFindPart(tag); + found = ui_sb_find_part(tag); if (found != -1) { if (temp_flags != (sb_icon_flags[found] & 1)) { sb_icon_flags[found] &= ~1; @@ -273,7 +272,7 @@ StatusBarUpdateIcon(int tag, int active) /* API: This is for the drive state indicator. */ void -StatusBarUpdateIconState(int tag, int state) +ui_sb_update_icon_state(int tag, int state) { int found = -1; @@ -281,7 +280,7 @@ StatusBarUpdateIconState(int tag, int state) return; } - found = StatusBarFindPart(tag); + found = ui_sb_find_part(tag); if (found != -1) { sb_icon_flags[found] &= ~256; sb_icon_flags[found] |= state ? 256 : 0; @@ -306,10 +305,10 @@ StatusBarCreateFloppyTip(int part) mbstowcs(wtext, fdd_getname(fdd_get_type(drive)), strlen(fdd_getname(fdd_get_type(drive))) + 1); if (wcslen(floppyfns[drive]) == 0) { - _swprintf(tempTip, win_get_string(IDS_2158), - drive+1, wtext, win_get_string(IDS_2057)); + _swprintf(tempTip, plat_get_string(IDS_2158), + drive+1, wtext, plat_get_string(IDS_2057)); } else { - _swprintf(tempTip, win_get_string(IDS_2158), + _swprintf(tempTip, plat_get_string(IDS_2158), drive+1, wtext, floppyfns[drive]); } @@ -317,7 +316,7 @@ StatusBarCreateFloppyTip(int part) free(sbTips[part]); sbTips[part] = NULL; } - sbTips[part] = (WCHAR *) malloc((wcslen(tempTip) << 1) + 2); + sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2); wcscpy(sbTips[part], tempTip); } @@ -333,19 +332,19 @@ StatusBarCreateCdromTip(int part) int bus = cdrom_drives[drive].bus_type; id = IDS_4352 + (bus - 1); - szText = (WCHAR *)win_get_string(id); + szText = plat_get_string(id); if (cdrom_drives[drive].host_drive == 200) { if (wcslen(cdrom_image[drive].image_path) == 0) { - _swprintf(tempTip, win_get_string(IDS_5120), drive + 1, szText, win_get_string(IDS_2057)); + _swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, plat_get_string(IDS_2057)); } else { - _swprintf(tempTip, win_get_string(IDS_5120), drive + 1, szText, cdrom_image[drive].image_path); + _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, win_get_string(IDS_2058), cdrom_drives[drive].host_drive & ~0x20); - _swprintf(tempTip, win_get_string(IDS_5120), drive + 1, szText, wtext); + _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 { - _swprintf(tempTip, win_get_string(IDS_5120), drive + 1, szText, win_get_string(IDS_2057)); + _swprintf(tempTip, plat_get_string(IDS_5120), drive+1, szText, plat_get_string(IDS_2057)); } if (sbTips[part] != NULL) { @@ -364,9 +363,9 @@ StatusBarCreateRemovableDiskTip(int part) int drive = sb_part_meanings[part] & 0x1f; if (wcslen(hdd[drive].fn) == 0) { - _swprintf(tempTip, win_get_string(IDS_4115), drive, win_get_string(IDS_2057)); + _swprintf(tempTip, plat_get_string(IDS_4115), drive, plat_get_string(IDS_2057)); } else { - _swprintf(tempTip, win_get_string(IDS_4115), drive, hdd[drive].fn); + _swprintf(tempTip, plat_get_string(IDS_4115), drive, hdd[drive].fn); } if (sbTips[part] != NULL) { @@ -387,9 +386,9 @@ StatusBarCreateDiskTip(int part) int bus = sb_part_meanings[part] & 0xf; id = IDS_4352 + (bus - 1); - szText = (WCHAR *)win_get_string(id); + szText = plat_get_string(id); - _swprintf(tempTip, win_get_string(IDS_4096), szText); + _swprintf(tempTip, plat_get_string(IDS_4096), szText); if (sbTips[part] != NULL) free(sbTips[part]); sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2); @@ -402,7 +401,7 @@ StatusBarCreateNetworkTip(int part) { WCHAR tempTip[512]; - _swprintf(tempTip, win_get_string(IDS_2069)); + _swprintf(tempTip, plat_get_string(IDS_2069)); if (sbTips[part] != NULL) free(sbTips[part]); @@ -413,7 +412,7 @@ StatusBarCreateNetworkTip(int part) /* API */ void -StatusBarUpdateTip(int meaning) +ui_sb_update_tip(int meaning) { int part = -1; int i; @@ -513,7 +512,7 @@ StatusBarCreatePopupMenu(int part) /* API: update the status bar panes. */ void -StatusBarUpdatePanes(void) +ui_sb_update_panes(void) { int i, id, hdint; int edge = 0; @@ -556,8 +555,8 @@ StatusBarUpdatePanes(void) StatusBarDestroyMenus(); StatusBarDestroyTips(); } - sb_parts = 0; + sb_parts = 0; for (i=0; iexit(id); cdrom_close(id); - image_open(id, temp_image_path); + image_open(id, temp_path); /* Signal media change to the emulated machine. */ cdrom_insert(id); CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED); @@ -899,14 +898,14 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 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); - StatusBarUpdateIconState(SB_CDROM | id, 0); + ui_sb_update_icon_state(SB_CDROM | id, 0); } else { CheckMenuItem(sb_menu_handles[part], IDM_CDROM_IMAGE | id, MF_UNCHECKED); CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED); - StatusBarUpdateIconState(SB_CDROM | id, 1); + ui_sb_update_icon_state(SB_CDROM | id, 1); } EnableMenuItem(sb_menu_handles[part], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); - StatusBarUpdateTip(SB_CDROM | id); + ui_sb_update_tip(SB_CDROM | id); config_save(); } break; @@ -914,7 +913,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_CDROM_HOST_DRIVE: id = item_params & 0x0007; letter = ((item_params >> 3) & 0x001f) + 'A'; - part = StatusBarFindPart(SB_CDROM | id); + part = ui_sb_find_part(SB_CDROM | id); if ((part == -1) || (sb_menu_handles == NULL)) { break; @@ -941,8 +940,8 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 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); - StatusBarUpdateIconState(SB_CDROM | id, 0); - StatusBarUpdateTip(SB_CDROM | id); + ui_sb_update_icon_state(SB_CDROM | id, 0); + ui_sb_update_tip(SB_CDROM | id); config_save(); break; @@ -973,18 +972,18 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) scsi_loadhd(hdd[id].scsi_id, hdd[id].scsi_lun, id); scsi_disk_insert(id); if (wcslen(hdd[id].fn) > 0) { - StatusBarUpdateIconState(SB_RDISK | id, 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 { - StatusBarUpdateIconState(SB_RDISK | id, 1); + 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); } - StatusBarUpdateTip(SB_RDISK | id); + ui_sb_update_tip(SB_RDISK | id); config_save(); } break; @@ -1004,7 +1003,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; default: - return(CallWindowProc((WNDPROC)OriginalStatusBarProcedure, + return(CallWindowProc((WNDPROC)OriginalProcedure, hwnd, message, wParam, lParam)); } @@ -1058,7 +1057,7 @@ StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst) (HMENU)idStatus, hInst, NULL); /* Replace the original procedure with ours. */ - OriginalStatusBarProcedure = GetWindowLongPtr(hwndSBAR, GWLP_WNDPROC); + OriginalProcedure = GetWindowLongPtr(hwndSBAR, GWLP_WNDPROC); SetWindowLongPtr(hwndSBAR, GWL_WNDPROC, (LONG_PTR)&StatusBarProcedure); SendMessage(hwndSBAR, SB_SETMINHEIGHT, (WPARAM)17, (LPARAM)0); @@ -1077,17 +1076,17 @@ StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst) /* Initialize the status bar and populate the icons and menus. */ sb_parts = 0; - StatusBarUpdatePanes(); + ui_sb_update_panes(); } -/* API */ +/* API (Settings) */ void -StatusBarCheckMenuItem(int tag, int id, int chk) +ui_sb_check_menu_item(int tag, int id, int chk) { int part; - part = StatusBarFindPart(tag); + part = ui_sb_find_part(tag); if ((part == -1) || (sb_menu_handles == NULL)) return; @@ -1095,13 +1094,13 @@ StatusBarCheckMenuItem(int tag, int id, int chk) } -/* API */ +/* API (Settings) */ void -StatusBarEnableMenuItem(int tag, int id, int flg) +ui_sb_enable_menu_item(int tag, int id, int flg) { int part; - part = StatusBarFindPart(tag); + part = ui_sb_find_part(tag); if ((part == -1) || (sb_menu_handles == NULL)) return; @@ -1111,12 +1110,11 @@ StatusBarEnableMenuItem(int tag, int id, int flg) /* API */ void -StatusBarSetTextW(wchar_t *wstr) +ui_sb_set_text_w(wchar_t *wstr) { int part = -1; int i; -pclog("SB_settext(%ws)", wstr); if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL)) return; for (i=0; i