mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-09-07 16:54:28 +00:00
Enable Basilisk II to work even if slirp_init() failed. Disable ethernet
emulation in that case, don't exit(1).
This commit is contained in:
parent
e308e5441b
commit
2bc79fd857
@ -224,7 +224,11 @@ bool ether_init(void)
|
|||||||
#ifdef HAVE_SLIRP
|
#ifdef HAVE_SLIRP
|
||||||
// Initialize slirp library
|
// Initialize slirp library
|
||||||
if (net_if_type == NET_IF_SLIRP) {
|
if (net_if_type == NET_IF_SLIRP) {
|
||||||
slirp_init();
|
if (slirp_init() < 0) {
|
||||||
|
sprintf(str, GetString(STR_SLIRP_NO_DNS_FOUND_WARN));
|
||||||
|
WarningAlert(str);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Open slirp output pipe
|
// Open slirp output pipe
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
@ -49,6 +49,7 @@ user_string_def platform_strings[] = {
|
|||||||
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
|
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
|
||||||
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
|
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
|
||||||
{STR_TUN_TAP_CONFIG_WARN, "Cannot configure TUN/TAP device (%s). Ethernet will not be available."},
|
{STR_TUN_TAP_CONFIG_WARN, "Cannot configure TUN/TAP device (%s). Ethernet will not be available."},
|
||||||
|
{STR_SLIRP_NO_DNS_FOUND_WARN, "Cannot get DNS address. Ethernet will not be available."},
|
||||||
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
|
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
|
||||||
{STR_SCSI_DEVICE_NOT_SCSI_WARN, "%s doesn't seem to comply to the Generic SCSI API. SCSI Manager access to this device will be disabled."},
|
{STR_SCSI_DEVICE_NOT_SCSI_WARN, "%s doesn't seem to comply to the Generic SCSI API. SCSI Manager access to this device will be disabled."},
|
||||||
{STR_NO_AUDIO_DEV_WARN, "Cannot open %s (%s). Audio output will be disabled."},
|
{STR_NO_AUDIO_DEV_WARN, "Cannot open %s (%s). Audio output will be disabled."},
|
||||||
|
@ -40,6 +40,7 @@ enum {
|
|||||||
STR_NO_SHEEP_NET_DRIVER_WARN,
|
STR_NO_SHEEP_NET_DRIVER_WARN,
|
||||||
STR_SHEEP_NET_ATTACH_WARN,
|
STR_SHEEP_NET_ATTACH_WARN,
|
||||||
STR_TUN_TAP_CONFIG_WARN,
|
STR_TUN_TAP_CONFIG_WARN,
|
||||||
|
STR_SLIRP_NO_DNS_FOUND_WARN,
|
||||||
STR_SCSI_DEVICE_OPEN_WARN,
|
STR_SCSI_DEVICE_OPEN_WARN,
|
||||||
STR_SCSI_DEVICE_NOT_SCSI_WARN,
|
STR_SCSI_DEVICE_NOT_SCSI_WARN,
|
||||||
STR_NO_AUDIO_DEV_WARN,
|
STR_NO_AUDIO_DEV_WARN,
|
||||||
|
@ -13,7 +13,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void slirp_init(void);
|
int slirp_init(void);
|
||||||
|
|
||||||
void slirp_select_fill(int *pnfds,
|
void slirp_select_fill(int *pnfds,
|
||||||
fd_set *readfds, fd_set *writefds, fd_set *xfds);
|
fd_set *readfds, fd_set *writefds, fd_set *xfds);
|
||||||
|
@ -123,7 +123,7 @@ void slirp_cleanup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void slirp_init(void)
|
int slirp_init(void)
|
||||||
{
|
{
|
||||||
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
|
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
|
||||||
|
|
||||||
@ -147,12 +147,11 @@ void slirp_init(void)
|
|||||||
getouraddr();
|
getouraddr();
|
||||||
inet_aton("127.0.0.1", &loopback_addr);
|
inet_aton("127.0.0.1", &loopback_addr);
|
||||||
|
|
||||||
if (get_dns_addr(&dns_addr) < 0) {
|
if (get_dns_addr(&dns_addr) < 0)
|
||||||
fprintf(stderr, "Could not get DNS address\n");
|
return -1;
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
inet_aton(CTL_SPECIAL, &special_addr);
|
inet_aton(CTL_SPECIAL, &special_addr);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED)
|
#define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED)
|
||||||
|
Loading…
Reference in New Issue
Block a user