Fixed Iomega ZIP drive initialization mess;

Fixed (hopefully) network status bar activity indication.
This commit is contained in:
OBattler
2018-10-19 19:10:12 +02:00
parent bee77a0b6f
commit 15db405697
6 changed files with 58 additions and 37 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the Iomega ZIP drive with SCSI(-like) * Implementation of the Iomega ZIP drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage. * commands, for both ATAPI and SCSI usage.
* *
* Version: @(#)zip.c 1.0.27 2018/10/17 * Version: @(#)zip.c 1.0.28 2018/10/19
* *
* Author: Miran Grca, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* *
@@ -2739,7 +2739,7 @@ zip_identify(void *p, int ide_has_dma)
} }
static zip_t * static void
zip_drive_reset(int c) zip_drive_reset(int c)
{ {
scsi_device_t *sd; scsi_device_t *sd;
@@ -2786,8 +2786,6 @@ zip_drive_reset(int c)
ide_atapi_attach(id); ide_atapi_attach(id);
} }
} }
return zip[c];
} }
@@ -2808,7 +2806,7 @@ zip_hard_reset(void)
if ((zip_drives[c].bus_type == ZIP_BUS_ATAPI) && (zip_drives[c].ide_channel > 7)) if ((zip_drives[c].bus_type == ZIP_BUS_ATAPI) && (zip_drives[c].ide_channel > 7))
continue; continue;
zip[c] = zip_drive_reset(c); zip_drive_reset(c);
zip[c]->id = c; zip[c]->id = c;
zip[c]->drv = &zip_drives[c]; zip[c]->drv = &zip_drives[c];

View File

@@ -8,7 +8,7 @@
* *
* Handle WinPcap library processing. * Handle WinPcap library processing.
* *
* Version: @(#)net_pcap.c 1.0.7 2018/10/19 * Version: @(#)net_pcap.c 1.0.8 2018/10/19
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -55,7 +55,7 @@
#include "../device.h" #include "../device.h"
#include "../plat.h" #include "../plat.h"
#include "../plat_dynld.h" #include "../plat_dynld.h"
// #include "../ui.h" #include "../ui.h"
#include "network.h" #include "network.h"
@@ -187,7 +187,7 @@ poll_thread(void *arg)
/* Wait for the next packet to arrive. */ /* Wait for the next packet to arrive. */
data = (uint8_t *)f_pcap_next((void *)pcap, &h); data = (uint8_t *)f_pcap_next((void *)pcap, &h);
if (data != NULL) { if (data != NULL) {
// ui_sb_update_icon(SB_NETWORK, 1); ui_sb_update_icon(SB_NETWORK, 1);
/* Received MAC. */ /* Received MAC. */
mac_cmp32[0] = *(uint32_t *)(data+6); mac_cmp32[0] = *(uint32_t *)(data+6);
@@ -208,7 +208,7 @@ poll_thread(void *arg)
/* If we did not get anything, wait a while. */ /* If we did not get anything, wait a while. */
if (data == NULL) { if (data == NULL) {
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
thread_wait_event(evt, 10); thread_wait_event(evt, 10);
} }
@@ -324,7 +324,7 @@ net_pcap_close(void)
{ {
void *pc; void *pc;
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
if (pcap == NULL) return; if (pcap == NULL) return;
@@ -381,7 +381,7 @@ net_pcap_reset(const netcard_t *card, uint8_t *mac)
char filter_exp[255]; char filter_exp[255];
struct bpf_program fp; struct bpf_program fp;
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
/* Open a PCAP live channel. */ /* Open a PCAP live channel. */
if ((pcap = f_pcap_open_live(network_host, /* interface name */ if ((pcap = f_pcap_open_live(network_host, /* interface name */
@@ -431,7 +431,7 @@ net_pcap_in(uint8_t *bufp, int len)
{ {
if (pcap == NULL) return; if (pcap == NULL) return;
// ui_sb_update_icon(SB_NETWORK, 1); ui_sb_update_icon(SB_NETWORK, 1);
network_busy(1); network_busy(1);
@@ -439,5 +439,5 @@ net_pcap_in(uint8_t *bufp, int len)
network_busy(0); network_busy(0);
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
} }

View File

@@ -8,7 +8,7 @@
* *
* Handle SLiRP library processing. * Handle SLiRP library processing.
* *
* Version: @(#)net_slirp.c 1.0.6 2018/10/19 * Version: @(#)net_slirp.c 1.0.7 2018/10/19
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -56,7 +56,7 @@
#include "../86box.h" #include "../86box.h"
#include "../device.h" #include "../device.h"
#include "../plat.h" #include "../plat.h"
// #include "../ui.h" #include "../ui.h"
#include "network.h" #include "network.h"
@@ -150,7 +150,7 @@ poll_thread(void *arg)
if (QueuePeek(slirpq) != 0) { if (QueuePeek(slirpq) != 0) {
/* Grab a packet from the queue. */ /* Grab a packet from the queue. */
// ui_sb_update_icon(SB_NETWORK, 1); ui_sb_update_icon(SB_NETWORK, 1);
qp = QueueDelete(slirpq); qp = QueueDelete(slirpq);
slirp_log("SLiRP: inQ:%d got a %dbyte packet @%08lx\n", slirp_log("SLiRP: inQ:%d got a %dbyte packet @%08lx\n",
@@ -176,7 +176,7 @@ poll_thread(void *arg)
/* If we did not get anything, wait a while. */ /* If we did not get anything, wait a while. */
if (!data_valid) { if (!data_valid) {
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
thread_wait_event(evt, 10); thread_wait_event(evt, 10);
} }
@@ -218,7 +218,7 @@ net_slirp_init(void)
int int
net_slirp_reset(const netcard_t *card, uint8_t *mac) net_slirp_reset(const netcard_t *card, uint8_t *mac)
{ {
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
/* Save the callback info. */ /* Save the callback info. */
poll_card = card; poll_card = card;
@@ -237,7 +237,7 @@ net_slirp_close(void)
{ {
queueADT sl; queueADT sl;
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
if (slirpq == NULL) return; if (slirpq == NULL) return;
@@ -273,7 +273,7 @@ net_slirp_in(uint8_t *pkt, int pkt_len)
{ {
if (slirpq == NULL) return; if (slirpq == NULL) return;
// ui_sb_update_icon(SB_NETWORK, 1); ui_sb_update_icon(SB_NETWORK, 1);
network_busy(1); network_busy(1);
@@ -281,7 +281,7 @@ net_slirp_in(uint8_t *pkt, int pkt_len)
network_busy(0); network_busy(0);
// ui_sb_update_icon(SB_NETWORK, 0); ui_sb_update_icon(SB_NETWORK, 0);
} }

View File

@@ -8,7 +8,7 @@
* *
* Main emulator module where most things are controlled. * Main emulator module where most things are controlled.
* *
* Version: @(#)pc.c 1.0.85 2018/10/17 * Version: @(#)pc.c 1.0.86 2018/10/19
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -712,6 +712,8 @@ pc_send_cae(void)
void void
pc_reset_hard_close(void) pc_reset_hard_close(void)
{ {
ui_sb_set_not_ready();
suppress_overscan = 0; suppress_overscan = 0;
nvr_save(); nvr_save();

View File

@@ -8,7 +8,7 @@
* *
* Define the various UI functions. * Define the various UI functions.
* *
* Version: @(#)ui.h 1.0.14 2018/04/24 * Version: @(#)ui.h 1.0.15 2018/10/19
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -53,6 +53,7 @@ extern void ui_check_menu_item(int id, int checked);
extern wchar_t *ui_window_title(wchar_t *s); extern wchar_t *ui_window_title(wchar_t *s);
extern void ui_status_update(void); extern void ui_status_update(void);
extern int ui_sb_find_part(int tag); extern int ui_sb_find_part(int tag);
extern void ui_sb_set_not_ready(void);
extern void ui_sb_update_panes(void); extern void ui_sb_update_panes(void);
extern void ui_sb_update_tip(int meaning); 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_check_menu_item(int tag, int id, int chk);

View File

@@ -8,7 +8,7 @@
* *
* Implement the application's Status Bar. * Implement the application's Status Bar.
* *
* Version: @(#)win_stbar.c 1.0.21 2018/10/17 * Version: @(#)win_stbar.c 1.0.22 2018/10/19
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -197,10 +197,10 @@ ui_sb_update_icon(int tag, int active)
{ {
uint8_t found = 0xff; uint8_t found = 0xff;
if (!update_icons) if (!update_icons || !sb_ready)
return; return;
if (((tag & 0xf0) >= SB_TEXT) || !sb_ready) if (((tag & 0xf0) >= SB_TEXT))
return; return;
found = sb_map[tag]; found = sb_map[tag];
@@ -220,7 +220,7 @@ ui_sb_update_icon_state(int tag, int state)
{ {
uint8_t found = 0xff; uint8_t found = 0xff;
if (((tag & 0xf0) >= SB_HDD) || !sb_ready) if (!sb_ready || ((tag & 0xf0) >= SB_HDD))
return; return;
found = sb_map[tag]; found = sb_map[tag];
@@ -374,7 +374,8 @@ ui_sb_update_tip(int meaning)
{ {
uint8_t part = 0xff; uint8_t part = 0xff;
if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL)) return; if (!sb_ready || (sb_parts == 0) || (sb_part_meanings == NULL))
return;
part = sb_map[meaning]; part = sb_map[meaning];
@@ -467,6 +468,14 @@ StatusBarCreatePopupMenu(int part)
} }
/* API: mark the status bar as not ready. */
void
ui_sb_set_not_ready(void)
{
sb_ready = 0;
}
/* API: update the status bar panes. */ /* API: update the status bar panes. */
void void
ui_sb_update_panes(void) ui_sb_update_panes(void)
@@ -477,7 +486,8 @@ ui_sb_update_panes(void)
int c_ide, c_scsi; int c_ide, c_scsi;
int do_net; int do_net;
sb_ready = 0; if (sb_ready)
sb_ready = 0;
hdint = (machines[machine].flags & MACHINE_HDC) ? 1 : 0; hdint = (machines[machine].flags & MACHINE_HDC) ? 1 : 0;
c_mfm = hdd_count(HDD_BUS_MFM); c_mfm = hdd_count(HDD_BUS_MFM);
@@ -753,10 +763,12 @@ ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
fdd_close(id); fdd_close(id);
ui_writeprot[id] = wp; ui_writeprot[id] = wp;
fdd_load(id, file_name); fdd_load(id, file_name);
ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1); if (sb_ready) {
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED)); ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_FLOPPY | id); EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_FLOPPY | id);
}
config_save(); config_save();
} }
@@ -768,10 +780,12 @@ ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
zip_drives[id].ui_writeprot = wp; zip_drives[id].ui_writeprot = wp;
zip_load(zip[id], file_name); zip_load(zip[id], file_name);
zip_insert(zip[id]); zip_insert(zip[id]);
ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1); if (sb_ready) {
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED)); ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED)); EnableMenuItem(sb_menu_handles[part], IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_ZIP | id); EnableMenuItem(sb_menu_handles[part], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED));
ui_sb_update_tip(SB_ZIP | id);
}
config_save(); config_save();
} }
@@ -1063,6 +1077,9 @@ ui_sb_check_menu_item(int tag, int id, int chk)
{ {
uint8_t part; uint8_t part;
if (!sb_ready)
return;
part = sb_map[tag]; part = sb_map[tag];
if ((part == 0xff) || (sb_menu_handles == NULL)) if ((part == 0xff) || (sb_menu_handles == NULL))
return; return;
@@ -1077,6 +1094,9 @@ ui_sb_enable_menu_item(int tag, int id, int flg)
{ {
uint8_t part; uint8_t part;
if (!sb_ready)
return;
part = sb_map[tag]; part = sb_map[tag];
if ((part == 0xff) || (sb_menu_handles == NULL)) if ((part == 0xff) || (sb_menu_handles == NULL))
return; return;