From 18917db2a7f874bd23ecb9c1de0403c5e490e933 Mon Sep 17 00:00:00 2001 From: waltje Date: Sun, 21 Oct 2018 04:03:10 -0400 Subject: [PATCH] Fixes for several UI issues. More warnings fixed (thanks, Clang.) --- src/devices/ports/game_dev.c | 4 +-- src/devices/printer/prt_cpmap.c | 6 ++-- src/devices/scsi/scsi_ncr5380.c | 4 +-- src/devices/video/vid_cl54xx.c | 4 ++- src/devices/video/vid_et4000w32.c | 10 ++++++- src/win/win_settings_input.h | 47 +++++++++++++++++++++++-------- src/win/win_settings_network.h | 43 +++++++++++++++++----------- src/win/win_settings_periph.h | 42 ++++++++++++--------------- src/win/win_settings_ports.h | 22 +++++++++------ 9 files changed, 113 insertions(+), 69 deletions(-) diff --git a/src/devices/ports/game_dev.c b/src/devices/ports/game_dev.c index 6a59964..36502aa 100644 --- a/src/devices/ports/game_dev.c +++ b/src/devices/ports/game_dev.c @@ -8,7 +8,7 @@ * * Handle all the various gameport devices. * - * Version: @(#)game_dev.c 1.0.2 2018/05/06 + * Version: @(#)game_dev.c 1.0.3 2018/10/20 * * Authors: Fred N. van Kempen, * Sarah Walker, @@ -57,7 +57,7 @@ extern const gamedev_t js_tm_fcs; static const gamedev_t gamedev_none = { - "Disabled", + "None", NULL, NULL, NULL, NULL, NULL, NULL, diff --git a/src/devices/printer/prt_cpmap.c b/src/devices/printer/prt_cpmap.c index 1ae3bc5..ef6fe02 100644 --- a/src/devices/printer/prt_cpmap.c +++ b/src/devices/printer/prt_cpmap.c @@ -8,7 +8,7 @@ * * Various ASCII to Unicode maps, for the various codepages. * - * Version: @(#)prt_cpmap.c 1.0.2 2018/10/05 + * Version: @(#)prt_cpmap.c 1.0.3 2018/10/20 * * Authors: Michael Drüing, * Fred N. van Kempen, @@ -567,7 +567,7 @@ static const struct { { 864, cp864Map }, { 865, cp865Map }, { 866, cp866Map }, - { -1, NULL } + { 0, NULL } }; @@ -577,7 +577,7 @@ select_codepage(uint16_t code) { int i; - for (i = 0; maps[i].code != -1; i++) + for (i = 0; maps[i].code != 0; i++) if (maps[i].code == code) return(maps[i].map); if (code == 0) diff --git a/src/devices/scsi/scsi_ncr5380.c b/src/devices/scsi/scsi_ncr5380.c index 85a30ae..e8c6241 100644 --- a/src/devices/scsi/scsi_ncr5380.c +++ b/src/devices/scsi/scsi_ncr5380.c @@ -11,7 +11,7 @@ * * NOTE: This code now only supports targets at LUN=0 !! * - * Version: @(#)scsi_ncr5380.c 1.0.12 2018/10/16 + * Version: @(#)scsi_ncr5380.c 1.0.13 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -359,7 +359,7 @@ ncr_callback(void *priv) DEBUG("NCR: select - target ID = %i\n", ncr->target_id); /*Once the device has been found and selected, mark it as busy*/ - if ((ncr->target_id != -1) && + if ((ncr->target_id != 0xff) && scsi_device_present(&scsi_devices[ncr->target_id][ncr->target_lun])) { ncr->cur_bus |= BUS_BSY; DEBUG("DEBUG: device found at ID %i\n", ncr->target_id); diff --git a/src/devices/video/vid_cl54xx.c b/src/devices/video/vid_cl54xx.c index 1e239c1..bd65c0a 100644 --- a/src/devices/video/vid_cl54xx.c +++ b/src/devices/video/vid_cl54xx.c @@ -9,7 +9,7 @@ * Emulation of select Cirrus Logic cards (CL-GD 5428, * CL-GD 5429, 5430, 5434 and 5436 are supported). * - * Version: @(#)vid_cl54xx.c 1.0.20 2018/10/08 + * Version: @(#)vid_cl54xx.c 1.0.21 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -2026,7 +2026,9 @@ gd54xx_start_blit(uint32_t cpu_dat, int count, gd54xx_t *gd54xx, svga_t *svga) switch (gd54xx->blt.rop) { case 0x00: dst = 0; break; case 0x05: dst = src & dst; break; +#if 0 /* Does NOT DO anything! */ case 0x06: dst = dst; break; +#endif case 0x09: dst = src & ~dst; break; case 0x0b: dst = ~ dst; break; case 0x0d: dst = src; break; diff --git a/src/devices/video/vid_et4000w32.c b/src/devices/video/vid_et4000w32.c index 61c9efc..68d9c85 100644 --- a/src/devices/video/vid_et4000w32.c +++ b/src/devices/video/vid_et4000w32.c @@ -12,7 +12,7 @@ * * FIXME: Note the madness on line 1163, fix that somehow? --FvK * - * Version: @(#)vid_et4000w32.c 1.0.15 2018/10/08 + * Version: @(#)vid_et4000w32.c 1.0.16 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -812,10 +812,14 @@ void et4000w32_decx(int c, et4000w32p_t *et4000) et4000->acl.pattern_x -= c; et4000->acl.source_x -= c; et4000->acl.mix_addr -= c; +#if 0 /* pattern_x is unsigned */ if (et4000->acl.pattern_x < 0) et4000->acl.pattern_x += et4000w32_max_x[et4000->acl.internal.pattern_wrap & 7]; +#endif +#if 0 /* source_x is unsigned */ if (et4000->acl.source_x < 0) et4000->acl.source_x += et4000w32_max_x[et4000->acl.internal.source_wrap & 7]; +#endif } void et4000w32_incy(et4000w32p_t *et4000) { @@ -843,17 +847,21 @@ void et4000w32_decy(et4000w32p_t *et4000) et4000->acl.mix_addr -= et4000->acl.internal.mix_off + 1; et4000->acl.dest_addr -= et4000->acl.internal.dest_off + 1; et4000->acl.pattern_y--; +#if 0 /* pattern_y is unsigned */ if (et4000->acl.pattern_y < 0 && !(et4000->acl.internal.pattern_wrap & 0x40)) { et4000->acl.pattern_y = et4000w32_wrap_y[(et4000->acl.internal.pattern_wrap >> 4) & 7] - 1; et4000->acl.pattern_addr = et4000->acl.pattern_back + (et4000w32_wrap_x[et4000->acl.internal.pattern_wrap & 7] * (et4000w32_wrap_y[(et4000->acl.internal.pattern_wrap >> 4) & 7] - 1)); } +#endif et4000->acl.source_y--; +#if 0 /* source_y is unsigned */ if (et4000->acl.source_y < 0 && !(et4000->acl.internal.source_wrap & 0x40)) { et4000->acl.source_y = et4000w32_wrap_y[(et4000->acl.internal.source_wrap >> 4) & 7] - 1; et4000->acl.source_addr = et4000->acl.source_back + (et4000w32_wrap_x[et4000->acl.internal.source_wrap & 7] *(et4000w32_wrap_y[(et4000->acl.internal.source_wrap >> 4) & 7] - 1));; } +#endif } static void et4000w32_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et4000w32p_t *et4000) diff --git a/src/win/win_settings_input.h b/src/win/win_settings_input.h index 7bb9128..ee08911 100644 --- a/src/win/win_settings_input.h +++ b/src/win/win_settings_input.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_input.h 1.0.8 2018/09/29 + * Version: @(#)win_settings_input.h 1.0.9 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -76,18 +76,36 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_INITDIALOG: h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); - d = 0; - for (c = 0; c < mouse_get_ndev(); c++) { - mouse_to_list[c] = d; - if (mouse_valid(c, temp_machine)) { + c = d = 0; + for (;;) { + stransi = mouse_get_internal_name(c); + if (stransi == NULL) break; + + /* Skip devices that are unavailable. */ + if (! mouse_valid(c, temp_machine)) { + c++; + continue; + } + + if (c == 0) { + SendMessage(h, CB_ADDSTRING, 0, win_string(IDS_NONE)); + } else if (c == 1) { + if (! (machines[temp_machine].flags&MACHINE_MOUSE)) { + /* Skip "Internal" if machine doesn't have one. */ + c++; + continue; + } + SendMessage(h, CB_ADDSTRING, 0, win_string(IDS_INTERNAL)); + } else { stransi = mouse_get_name(c); mbstowcs(temp, stransi, sizeof_w(temp)); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); - - list_to_mouse[d] = c; - d++; } + + mouse_to_list[c] = d; + list_to_mouse[d] = c; + c++; d++; } SendMessage(h, CB_SETCURSEL, mouse_to_list[temp_mouse], 0); @@ -100,9 +118,16 @@ input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); c = 0; - while ((stransi = gamedev_get_name(c)) != NULL) { - mbstowcs(temp, stransi, sizeof_w(temp)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + for (;;) { + stransi = gamedev_get_name(c); + if (stransi == NULL) break; + + if (c == 0) { + SendMessage(h, CB_ADDSTRING, 0, win_string(IDS_NONE)); + } else { + mbstowcs(temp, stransi, sizeof_w(temp)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + } c++; } SendMessage(h, CB_SETCURSEL, temp_joystick, 0); diff --git a/src/win/win_settings_network.h b/src/win/win_settings_network.h index 4da1959..831e945 100644 --- a/src/win/win_settings_network.h +++ b/src/win/win_settings_network.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_network.h 1.0.7 2018/10/16 + * Version: @(#)win_settings_network.h 1.0.8 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -102,7 +102,7 @@ network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: h = GetDlgItem(hdlg, IDC_COMBO_NET_TYPE); //FIXME: take strings from network.c table.. --FvK - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)L"None"); + SendMessage(h, CB_ADDSTRING, 0, win_string(IDS_DISABLED)); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)L"PCap"); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)L"SLiRP"); SendMessage(h, CB_SETCURSEL, temp_net_type, 0); @@ -115,9 +115,16 @@ network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) h = GetDlgItem(hdlg, IDC_COMBO_PCAP); for (c = 0; c < network_ndev; c++) { - mbstowcs(temp, network_devs[c].description, sizeof_w(temp)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + if (c == 0) { + /* Translate "None". */ + SendMessage(h, CB_ADDSTRING, 0, + win_string(IDS_NONE)); + } else { + mbstowcs(temp, network_devs[c].description, sizeof_w(temp)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + } } + SendMessage(h, CB_SETCURSEL, network_card_to_id(temp_host_dev), 0); /*NIC config*/ @@ -125,29 +132,31 @@ network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) c = d = 0; while (1) { stransi = network_card_get_internal_name(c); - if (stransi == NULL) - break; + if (stransi == NULL) break; dev = network_card_getdevice(c); - if (dev == NULL) { - /* Translate "None". */ - wcscpy(temp, get_string(IDS_NONE)); - } else if (network_card_available(c) && - device_is_valid(dev, machines[temp_machine].flags)) { - sprintf(tempA, "[%s] %s", - device_get_bus_name(dev), - network_card_getname(c)); - mbstowcs(temp, tempA, sizeof_w(temp)); - } else { + if (!network_card_available(c) || + !device_is_valid(dev, machines[temp_machine].flags)) { c++; continue; } - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + if (c == 0) { + /* Translate "None". */ + SendMessage(h, CB_ADDSTRING, 0, + win_string(IDS_NONE)); + } else { + sprintf(tempA, "[%s] %s", + device_get_bus_name(dev), + network_card_getname(c)); + mbstowcs(temp, tempA, sizeof_w(temp)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + } nic_to_list[c] = d; list_to_nic[d++] = c++; } + SendMessage(h, CB_SETCURSEL, nic_to_list[temp_net_card], 0); EnableWindow(h, d ? TRUE : FALSE); diff --git a/src/win/win_settings_periph.h b/src/win/win_settings_periph.h index 54e649b..5d72078 100644 --- a/src/win/win_settings_periph.h +++ b/src/win/win_settings_periph.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_periph.h 1.0.13 2018/09/29 + * Version: @(#)win_settings_periph.h 1.0.14 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -44,7 +44,8 @@ static int scsi_to_list[20], list_to_scsi[20]; -static const char *hdc_names[16]; +static int hdc_to_list[20], + list_to_hdc[20]; /* Populate the HDC combo. */ @@ -62,10 +63,9 @@ recalc_scsi_list(HWND hdlg) SendMessage(h, CB_RESETCONTENT, 0, 0); c = d = 0; - while (1) { + for (;;) { stransi = scsi_card_get_internal_name(c); - if (stransi == NULL) - break; + if (stransi == NULL) break; dev = scsi_card_getdevice(c); @@ -109,11 +109,11 @@ recalc_hdc_list(HWND hdlg) h = GetDlgItem(hdlg, IDC_COMBO_HDC); SendMessage(h, CB_RESETCONTENT, 0, 0); +INFO("LIST: active=%d (%s)\n", temp_hdc_type, hdc_get_name(temp_hdc_type)); c = d = 0; - while (1) { + for (;;) { stransi = hdc_get_internal_name(c); - if (stransi == NULL) - break; + if (stransi == NULL) break; dev = hdc_get_device(c); @@ -123,8 +123,6 @@ recalc_hdc_list(HWND hdlg) continue; } - hdc_names[d] = stransi; - if (c == 0) { SendMessage(h, CB_ADDSTRING, 0, win_string(IDS_NONE)); } else if (c == 1) { @@ -145,15 +143,13 @@ recalc_hdc_list(HWND hdlg) SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); } - c++; - d++; + hdc_to_list[c] = d; + list_to_hdc[d] = c; +INFO("[%d]=%d\n", c, hdc_to_list[c], d, list_to_hdc[d]); + c++; d++; } - if (temp_hdc_type != -1 && temp_hdc_type < d) - SendMessage(h, CB_SETCURSEL, temp_hdc_type, 0); - else - SendMessage(h, CB_SETCURSEL, 0, 0); - + SendMessage(h, CB_SETCURSEL, hdc_to_list[temp_hdc_type], 0); EnableWindow(h, d ? TRUE : FALSE); } @@ -290,7 +286,7 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_COMBO_HDC: h = GetDlgItem(hdlg, IDC_COMBO_HDC); - temp_hdc_type = hdc_get_from_internal_name(hdc_names[SendMessage(h, CB_GETCURSEL, 0, 0)]); + temp_hdc_type = list_to_hdc[SendMessage(h, CB_GETCURSEL, 0, 0)]; h = GetDlgItem(hdlg, IDC_CONFIGURE_HDC); if (hdc_has_config(temp_hdc_type)) @@ -301,7 +297,7 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case IDC_CONFIGURE_HDC: h = GetDlgItem(hdlg, IDC_COMBO_HDC); - temp_hdc_type = hdc_get_from_internal_name(hdc_names[SendMessage(h, CB_GETCURSEL, 0, 0)]); + temp_hdc_type = list_to_hdc[SendMessage(h, CB_GETCURSEL, 0, 0)]; temp_deviceconfig |= dlg_devconf(hdlg, hdc_get_device(temp_hdc_type)); break; @@ -376,13 +372,11 @@ peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_SAVE_CFG: h = GetDlgItem(hdlg, IDC_COMBO_HDC); c = SendMessage(h, CB_GETCURSEL, 0, 0); - if (hdc_names[c]) - temp_hdc_type = hdc_get_from_internal_name(hdc_names[c]); - else - temp_hdc_type = 0; + temp_hdc_type = list_to_hdc[c]; h = GetDlgItem(hdlg, IDC_COMBO_SCSI); - temp_scsi_card = list_to_scsi[SendMessage(h, CB_GETCURSEL, 0, 0)]; + c = SendMessage(h, CB_GETCURSEL, 0, 0); + temp_scsi_card = list_to_scsi[c]; h = GetDlgItem(hdlg, IDC_CHECK_BUGGER); temp_bugger = SendMessage(h, BM_GETCHECK, 0, 0); diff --git a/src/win/win_settings_ports.h b/src/win/win_settings_ports.h index a2cfa48..7422ee4 100644 --- a/src/win/win_settings_ports.h +++ b/src/win/win_settings_ports.h @@ -8,7 +8,7 @@ * * Implementation of the Settings dialog. * - * Version: @(#)win_settings_ports.h 1.0.4 2018/04/29 + * Version: @(#)win_settings_ports.h 1.0.5 2018/10/20 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -64,20 +64,26 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) for (i = 0; i < PARALLEL_MAX; i++) { /* Populate the "devices" list and select one. */ h = GetDlgItem(hdlg, IDC_COMBO_PARALLEL1+i); - c = d = 0; - while (1) { - stransi = parallel_device_get_name(c); - if (stransi == NULL) - break; - mbstowcs(temp, stransi, sizeof_w(temp)); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + c = d = 0; + for (;;) { + stransi = parallel_device_get_internal_name(c); + if (stransi == NULL) break; + + if (c == 0) { + SendMessage(h, CB_ADDSTRING, 0, win_string(IDS_NONE)); + } else { + stransi = parallel_device_get_name(c); + mbstowcs(temp, stransi, sizeof_w(temp)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)temp); + } /* Currently selected device? */ if (temp_parallel_device[i] == c) d = c; c++; } + SendMessage(h, CB_SETCURSEL, d, 0); /* Enable or disable this port. */