mirror of
https://github.com/86Box/86Box.git
synced 2025-01-22 09:11:50 -05:00
Finish merge.
This commit is contained in:
parent
7343b7972c
commit
6bb5942ad1
14 changed files with 429 additions and 69 deletions
12
sonar-project.properties
Normal file
12
sonar-project.properties
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
sonar.projectKey=86Box_86Box
|
||||||
|
sonar.organization=86box
|
||||||
|
|
||||||
|
# This is the name and version displayed in the SonarCloud UI.
|
||||||
|
#sonar.projectName=86Box
|
||||||
|
#sonar.projectVersion=1.0
|
||||||
|
|
||||||
|
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
|
||||||
|
#sonar.sources=.
|
||||||
|
|
||||||
|
# Encoding of the source code. Default is default system encoding
|
||||||
|
#sonar.sourceEncoding=UTF-8
|
|
@ -30,7 +30,6 @@
|
||||||
#include <86box/pit.h>
|
#include <86box/pit.h>
|
||||||
#include <86box/device.h>
|
#include <86box/device.h>
|
||||||
#include <86box/port_92.h>
|
#include <86box/port_92.h>
|
||||||
#include <86box/usb.h>
|
|
||||||
#include <86box/hdc.h>
|
#include <86box/hdc.h>
|
||||||
#include <86box/hdc_ide.h>
|
#include <86box/hdc_ide.h>
|
||||||
#include <86box/chipset.h>
|
#include <86box/chipset.h>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/* Network provider types. */
|
/* Network provider types. */
|
||||||
#define NET_TYPE_NONE 0 /* networking disabled */
|
#define NET_TYPE_NONE 0 /* use the null network driver */
|
||||||
#define NET_TYPE_SLIRP 1 /* use the SLiRP port forwarder */
|
#define NET_TYPE_SLIRP 1 /* use the SLiRP port forwarder */
|
||||||
#define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */
|
#define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */
|
||||||
#define NET_TYPE_VDE 3 /* use the VDE plug API */
|
#define NET_TYPE_VDE 3 /* use the VDE plug API */
|
||||||
|
@ -57,6 +57,7 @@
|
||||||
/* Queue size must be a power of 2 */
|
/* Queue size must be a power of 2 */
|
||||||
#define NET_QUEUE_LEN 16
|
#define NET_QUEUE_LEN 16
|
||||||
#define NET_QUEUE_LEN_MASK (NET_QUEUE_LEN - 1)
|
#define NET_QUEUE_LEN_MASK (NET_QUEUE_LEN - 1)
|
||||||
|
#define NET_QUEUE_COUNT 3
|
||||||
#define NET_CARD_MAX 4
|
#define NET_CARD_MAX 4
|
||||||
#define NET_HOST_INTF_MAX 64
|
#define NET_HOST_INTF_MAX 64
|
||||||
|
|
||||||
|
@ -125,6 +126,7 @@ typedef struct netdrv_t {
|
||||||
extern const netdrv_t net_pcap_drv;
|
extern const netdrv_t net_pcap_drv;
|
||||||
extern const netdrv_t net_slirp_drv;
|
extern const netdrv_t net_slirp_drv;
|
||||||
extern const netdrv_t net_vde_drv;
|
extern const netdrv_t net_vde_drv;
|
||||||
|
extern const netdrv_t net_null_drv;
|
||||||
|
|
||||||
struct _netcard_t {
|
struct _netcard_t {
|
||||||
const device_t *device;
|
const device_t *device;
|
||||||
|
@ -132,7 +134,7 @@ struct _netcard_t {
|
||||||
struct netdrv_t host_drv;
|
struct netdrv_t host_drv;
|
||||||
NETRXCB rx;
|
NETRXCB rx;
|
||||||
NETSETLINKSTATE set_link_state;
|
NETSETLINKSTATE set_link_state;
|
||||||
netqueue_t queues[3];
|
netqueue_t queues[NET_QUEUE_COUNT];
|
||||||
netpkt_t queued_pkt;
|
netpkt_t queued_pkt;
|
||||||
mutex_t *tx_mutex;
|
mutex_t *tx_mutex;
|
||||||
mutex_t *rx_mutex;
|
mutex_t *rx_mutex;
|
||||||
|
@ -150,9 +152,9 @@ typedef struct {
|
||||||
} netdev_t;
|
} netdev_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int has_slirp: 1;
|
int has_slirp;
|
||||||
int has_pcap: 1;
|
int has_pcap;
|
||||||
int has_vde: 1;
|
int has_vde;
|
||||||
} network_devmap_t;
|
} network_devmap_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,29 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct usb_t usb_t;
|
typedef struct usb_t usb_t;
|
||||||
|
typedef struct usb_device_t usb_device_t;
|
||||||
|
|
||||||
|
enum usb_pid
|
||||||
|
{
|
||||||
|
USB_PID_OUT = 0xE1,
|
||||||
|
USB_PID_IN = 0x69,
|
||||||
|
USB_PID_SETUP = 0x2D
|
||||||
|
};
|
||||||
|
|
||||||
|
enum usb_errors
|
||||||
|
{
|
||||||
|
USB_ERROR_NO_ERROR = 0,
|
||||||
|
USB_ERROR_NAK = 1,
|
||||||
|
USB_ERROR_OVERRUN = 2,
|
||||||
|
USB_ERROR_UNDERRUN = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum usb_bus_types
|
||||||
|
{
|
||||||
|
USB_BUS_OHCI = 0,
|
||||||
|
USB_BUS_UHCI,
|
||||||
|
USB_BUS_MAX
|
||||||
|
};
|
||||||
|
|
||||||
/* USB device creation parameters struct */
|
/* USB device creation parameters struct */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -50,14 +73,18 @@ typedef struct usb_t
|
||||||
uint32_t ohci_mem_base, irq_level;
|
uint32_t ohci_mem_base, irq_level;
|
||||||
mem_mapping_t ohci_mmio_mapping;
|
mem_mapping_t ohci_mmio_mapping;
|
||||||
pc_timer_t ohci_frame_timer;
|
pc_timer_t ohci_frame_timer;
|
||||||
pc_timer_t ohci_interrupt_desc_poll_timer;
|
|
||||||
pc_timer_t ohci_port_reset_timer[2];
|
pc_timer_t ohci_port_reset_timer[2];
|
||||||
uint8_t ohci_interrupt_counter : 5;
|
uint8_t ohci_interrupt_counter : 3;
|
||||||
|
usb_device_t* ohci_devices[2];
|
||||||
|
usb_device_t* uhci_devices[2];
|
||||||
|
uint8_t ohci_usb_buf[4096];
|
||||||
|
uint8_t ohci_initial_start;
|
||||||
|
|
||||||
usb_params_t* usb_params;
|
usb_params_t* usb_params;
|
||||||
} usb_t;
|
} usb_t;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
/* Base USB descriptor struct. */
|
/* Base USB descriptor struct. */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -65,6 +92,66 @@ typedef struct
|
||||||
uint8_t bDescriptorType;
|
uint8_t bDescriptorType;
|
||||||
} usb_desc_base_t;
|
} usb_desc_base_t;
|
||||||
|
|
||||||
|
enum usb_desc_setup_req_types
|
||||||
|
{
|
||||||
|
USB_SETUP_TYPE_DEVICE = 0x0,
|
||||||
|
USB_SETUP_TYPE_INTERFACE = 0x1,
|
||||||
|
USB_SETUP_TYPE_ENDPOING = 0x2,
|
||||||
|
USB_SETUP_TYPE_OTHER = 0x3,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define USB_SETUP_TYPE_MAX 0x1F
|
||||||
|
|
||||||
|
#define USB_SETUP_DEV_TO_HOST 0x80
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t bmRequestType;
|
||||||
|
uint8_t bRequest;
|
||||||
|
uint16_t wValue;
|
||||||
|
uint16_t wIndex;
|
||||||
|
uint16_t wLength;
|
||||||
|
} usb_desc_setup_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
usb_desc_base_t base;
|
||||||
|
uint8_t bEndpointAddress;
|
||||||
|
uint8_t bmAttributes;
|
||||||
|
uint16_t wMaxPacketSize;
|
||||||
|
uint8_t bInterval;
|
||||||
|
} usb_desc_endpoint_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
usb_desc_base_t base;
|
||||||
|
|
||||||
|
uint16_t bcdHID;
|
||||||
|
uint8_t bCountryCode;
|
||||||
|
uint8_t bNumDescriptors;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint16_t wDescriptorLength;
|
||||||
|
} usb_desc_hid_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
usb_desc_base_t base;
|
||||||
|
|
||||||
|
uint8_t bInterfaceNumber;
|
||||||
|
uint8_t bAlternateSetting;
|
||||||
|
uint8_t bNumEndpoints;
|
||||||
|
uint8_t bInterfaceClass;
|
||||||
|
uint8_t bInterfaceSubClass;
|
||||||
|
uint8_t bInterfaceProtocol;
|
||||||
|
uint8_t iInterface;
|
||||||
|
} usb_desc_interface_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
usb_desc_base_t base;
|
||||||
|
uint16_t bString[];
|
||||||
|
} usb_desc_string_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
usb_desc_base_t base;
|
usb_desc_base_t base;
|
||||||
|
@ -76,43 +163,49 @@ typedef struct
|
||||||
uint8_t bmAttributes;
|
uint8_t bmAttributes;
|
||||||
uint8_t bMaxPower;
|
uint8_t bMaxPower;
|
||||||
} usb_desc_conf_t;
|
} usb_desc_conf_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
usb_desc_base_t base;
|
||||||
|
|
||||||
|
uint16_t bcdUSB;
|
||||||
|
uint8_t bDeviceClass;
|
||||||
|
uint8_t bDeviceSubClass;
|
||||||
|
uint8_t bDeviceProtocol;
|
||||||
|
uint8_t bMaxPacketSize;
|
||||||
|
uint16_t idVendor;
|
||||||
|
uint16_t idProduct;
|
||||||
|
uint16_t bcdDevice;
|
||||||
|
uint8_t iManufacturer;
|
||||||
|
uint8_t iProduct;
|
||||||
|
uint8_t iSerialNumber;
|
||||||
|
uint8_t bNumConfigurations;
|
||||||
|
} usb_desc_device_t;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t HccaInterrruptTable[32];
|
|
||||||
uint16_t HccaFrameNumber;
|
|
||||||
uint16_t HccaPad1;
|
|
||||||
uint32_t HccaDoneHead;
|
|
||||||
uint32_t Reserved[29];
|
|
||||||
} usb_hcca_t;
|
|
||||||
|
|
||||||
/* USB endpoint device struct. Incomplete and unused. */
|
/* USB endpoint device struct. Incomplete and unused. */
|
||||||
typedef struct
|
typedef struct usb_device_t
|
||||||
{
|
{
|
||||||
uint16_t vendor_id;
|
usb_desc_device_t device_desc;
|
||||||
uint16_t device_id;
|
struct {
|
||||||
|
usb_desc_conf_t conf_desc;
|
||||||
|
usb_desc_base_t* other_descs[16];
|
||||||
|
} conf_desc_items;
|
||||||
|
|
||||||
/* Reads from endpoint. Non-zero value indicates error. */
|
/* General-purpose function for I/O. Non-zero value indicates error. */
|
||||||
uint8_t (*device_in)(void* priv, uint8_t* data, uint32_t len);
|
uint8_t (*device_process)(void* priv, uint8_t* data, uint32_t *len, uint8_t pid_token, uint8_t endpoint, uint8_t underrun_not_allowed);
|
||||||
/* Writes to endpoint. Non-zero value indicates error. */
|
/* Device reset. */
|
||||||
uint8_t (*device_out)(void* priv, uint8_t* data, uint32_t len);
|
|
||||||
/* Process setup packets. */
|
|
||||||
uint8_t (*device_setup)(void* priv, uint8_t* data);
|
|
||||||
/* Device reset */
|
|
||||||
void (*device_reset)(void* priv);
|
void (*device_reset)(void* priv);
|
||||||
|
/* Get address. */
|
||||||
|
uint8_t (*device_get_address)(void* priv);
|
||||||
|
|
||||||
void* priv;
|
void* priv;
|
||||||
} usb_device_t;
|
} usb_device_t;
|
||||||
|
|
||||||
enum usb_bus_types
|
|
||||||
{
|
|
||||||
USB_BUS_OHCI = 0,
|
|
||||||
USB_BUS_UHCI = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
extern const device_t usb_device;
|
extern const device_t usb_device;
|
||||||
|
extern usb_t* usb_device_inst;
|
||||||
|
|
||||||
/* Functions. */
|
/* Functions. */
|
||||||
extern void uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable);
|
extern void uhci_update_io_mapping(usb_t *dev, uint8_t base_l, uint8_t base_h, int enable);
|
||||||
|
|
|
@ -303,7 +303,7 @@ const machine_t machines[] = {
|
||||||
.ram = {
|
.ram = {
|
||||||
.min = 128,
|
.min = 128,
|
||||||
.max = 640,
|
.max = 640,
|
||||||
.step = 128
|
.step = 64
|
||||||
},
|
},
|
||||||
.nvrmask = 0,
|
.nvrmask = 0,
|
||||||
.kbc_device = NULL, /* TODO: No specific kbd_device yet */
|
.kbc_device = NULL, /* TODO: No specific kbd_device yet */
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#
|
#
|
||||||
set(net_sources)
|
set(net_sources)
|
||||||
list(APPEND net_sources network.c net_pcap.c net_slirp.c net_dp8390.c net_3c501.c
|
list(APPEND net_sources network.c net_pcap.c net_slirp.c net_dp8390.c net_3c501.c
|
||||||
net_3c503.c net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c net_event.c)
|
net_3c503.c net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c net_event.c net_null.c)
|
||||||
|
|
||||||
option(SLIRP_EXTERNAL "Link against the system-provided libslirp library" OFF)
|
option(SLIRP_EXTERNAL "Link against the system-provided libslirp library" OFF)
|
||||||
mark_as_advanced(SLIRP_EXTERNAL)
|
mark_as_advanced(SLIRP_EXTERNAL)
|
||||||
|
|
224
src/network/net_null.c
Normal file
224
src/network/net_null.c
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Null network driver
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Authors: cold-brewed
|
||||||
|
*
|
||||||
|
* Copyright 2023 The 86Box development team
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# include <windows.h>
|
||||||
|
# include <winsock2.h>
|
||||||
|
#else
|
||||||
|
# include <poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HAVE_STDARG_H
|
||||||
|
#include <86box/86box.h>
|
||||||
|
#include <86box/device.h>
|
||||||
|
#include <86box/thread.h>
|
||||||
|
#include <86box/timer.h>
|
||||||
|
#include <86box/network.h>
|
||||||
|
#include <86box/net_event.h>
|
||||||
|
|
||||||
|
enum {
|
||||||
|
NET_EVENT_STOP = 0,
|
||||||
|
NET_EVENT_TX,
|
||||||
|
NET_EVENT_RX,
|
||||||
|
NET_EVENT_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Special define for the windows portion. Because we are not interested
|
||||||
|
* in NET_EVENT_RX for the null driver, we only need to poll up to
|
||||||
|
* NET_EVENT_TX. NET_EVENT_RX gives us a different NET_EVENT_MAX
|
||||||
|
* excluding NET_EVENT_RX. */
|
||||||
|
#define NET_EVENT_TX_MAX NET_EVENT_RX
|
||||||
|
|
||||||
|
#define NULL_PKT_BATCH NET_QUEUE_LEN
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t mac_addr[6];
|
||||||
|
netcard_t *card;
|
||||||
|
thread_t *poll_tid;
|
||||||
|
net_evt_t tx_event;
|
||||||
|
net_evt_t stop_event;
|
||||||
|
netpkt_t pkt;
|
||||||
|
netpkt_t pktv[NULL_PKT_BATCH];
|
||||||
|
} net_null_t;
|
||||||
|
|
||||||
|
#ifdef ENABLE_NET_NULL_LOG
|
||||||
|
int net_null_do_log = ENABLE_NET_NULL_LOG;
|
||||||
|
|
||||||
|
static void
|
||||||
|
net_null_log(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
if (net_null_do_log) {
|
||||||
|
va_start(ap, fmt);
|
||||||
|
pclog_ex(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define net_null_log(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
static void
|
||||||
|
net_null_thread(void *priv)
|
||||||
|
{
|
||||||
|
net_null_t *net_null = (net_null_t *) priv;
|
||||||
|
|
||||||
|
net_null_log("Null Network: polling started.\n");
|
||||||
|
|
||||||
|
HANDLE events[NET_EVENT_TX_MAX];
|
||||||
|
events[NET_EVENT_STOP] = net_event_get_handle(&net_null->stop_event);
|
||||||
|
events[NET_EVENT_TX] = net_event_get_handle(&net_null->tx_event);
|
||||||
|
|
||||||
|
bool run = true;
|
||||||
|
|
||||||
|
while (run) {
|
||||||
|
int ret = WaitForMultipleObjects(NET_EVENT_TX_MAX, events, FALSE, INFINITE);
|
||||||
|
|
||||||
|
switch (ret - WAIT_OBJECT_0) {
|
||||||
|
case NET_EVENT_STOP:
|
||||||
|
net_event_clear(&net_null->stop_event);
|
||||||
|
run = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NET_EVENT_TX:
|
||||||
|
net_event_clear(&net_null->tx_event);
|
||||||
|
int packets = network_tx_popv(net_null->card, net_null->pktv, NULL_PKT_BATCH);
|
||||||
|
for (int i = 0; i < packets; i++) {
|
||||||
|
net_null_log("Null Network: Ignoring TX packet (%d bytes)\n", net_null->pktv[i].len);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
net_null_log("Null Network: Unknown event.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
net_null_log("Null Network: polling stopped.\n");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static void
|
||||||
|
net_null_thread(void *priv)
|
||||||
|
{
|
||||||
|
net_null_t *net_null = (net_null_t *) priv;
|
||||||
|
|
||||||
|
net_null_log("Null Network: polling started.\n");
|
||||||
|
|
||||||
|
struct pollfd pfd[NET_EVENT_MAX];
|
||||||
|
pfd[NET_EVENT_STOP].fd = net_event_get_fd(&net_null->stop_event);
|
||||||
|
pfd[NET_EVENT_STOP].events = POLLIN | POLLPRI;
|
||||||
|
|
||||||
|
pfd[NET_EVENT_TX].fd = net_event_get_fd(&net_null->tx_event);
|
||||||
|
pfd[NET_EVENT_TX].events = POLLIN | POLLPRI;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
poll(pfd, NET_EVENT_MAX, -1);
|
||||||
|
|
||||||
|
if (pfd[NET_EVENT_STOP].revents & POLLIN) {
|
||||||
|
net_event_clear(&net_null->stop_event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pfd[NET_EVENT_TX].revents & POLLIN) {
|
||||||
|
net_event_clear(&net_null->tx_event);
|
||||||
|
|
||||||
|
int packets = network_tx_popv(net_null->card, net_null->pktv, NULL_PKT_BATCH);
|
||||||
|
for (int i = 0; i < packets; i++) {
|
||||||
|
net_null_log("Null Network: Ignoring TX packet (%d bytes)\n", net_null->pktv[i].len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
net_null_log("Null Network: polling stopped.\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *
|
||||||
|
net_null_init(const netcard_t *card, const uint8_t *mac_addr, void *priv)
|
||||||
|
{
|
||||||
|
net_null_log("Null Network: Init\n");
|
||||||
|
|
||||||
|
net_null_t *net_null = calloc(1, sizeof(net_null_t));
|
||||||
|
net_null->card = (netcard_t *) card;
|
||||||
|
memcpy(net_null->mac_addr, mac_addr, sizeof(net_null->mac_addr));
|
||||||
|
|
||||||
|
for (int i = 0; i < NULL_PKT_BATCH; i++) {
|
||||||
|
net_null->pktv[i].data = calloc(1, NET_MAX_FRAME);
|
||||||
|
}
|
||||||
|
net_null->pkt.data = calloc(1, NET_MAX_FRAME);
|
||||||
|
|
||||||
|
net_event_init(&net_null->tx_event);
|
||||||
|
net_event_init(&net_null->stop_event);
|
||||||
|
net_null->poll_tid = thread_create(net_null_thread, net_null);
|
||||||
|
|
||||||
|
return net_null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
net_null_in_available(void *priv)
|
||||||
|
{
|
||||||
|
net_null_t *net_null = (net_null_t *) priv;
|
||||||
|
net_event_set(&net_null->tx_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
net_null_close(void *priv)
|
||||||
|
{
|
||||||
|
if (!priv)
|
||||||
|
return;
|
||||||
|
|
||||||
|
net_null_t *net_null = (net_null_t *) priv;
|
||||||
|
|
||||||
|
net_null_log("Null Network: closing.\n");
|
||||||
|
|
||||||
|
/* Tell the thread to terminate. */
|
||||||
|
net_event_set(&net_null->stop_event);
|
||||||
|
|
||||||
|
/* Wait for the thread to finish. */
|
||||||
|
net_null_log("Null Network: waiting for thread to end...\n");
|
||||||
|
thread_wait(net_null->poll_tid);
|
||||||
|
net_null_log("Null Network: thread ended\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < NULL_PKT_BATCH; i++) {
|
||||||
|
free(net_null->pktv[i].data);
|
||||||
|
}
|
||||||
|
free(net_null->pkt.data);
|
||||||
|
|
||||||
|
net_event_close(&net_null->tx_event);
|
||||||
|
net_event_close(&net_null->stop_event);
|
||||||
|
|
||||||
|
free(net_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const netdrv_t net_null_drv = {
|
||||||
|
&net_null_in_available,
|
||||||
|
&net_null_init,
|
||||||
|
&net_null_close,
|
||||||
|
NULL
|
||||||
|
};
|
|
@ -280,7 +280,7 @@ void *net_vde_init(const netcard_t *card, const uint8_t *mac_addr, void *priv) {
|
||||||
// TODO: Once there is a solution for the mentioned crash, this should be removed
|
// TODO: Once there is a solution for the mentioned crash, this should be removed
|
||||||
// and/or replaced by proper error handling code.
|
// and/or replaced by proper error handling code.
|
||||||
//-
|
//-
|
||||||
fatal("Could not open the specified VDE socket (%s). Please fix your networking configuration.", socket_name);
|
// fatal("Could not open the specified VDE socket (%s). Please fix your networking configuration.", socket_name);
|
||||||
// It makes no sense to issue this warning since the program will crash anyway...
|
// It makes no sense to issue this warning since the program will crash anyway...
|
||||||
// ui_msgbox_header(MBX_WARNING, (wchar_t *) IDS_2167, (wchar_t *) IDS_2168);
|
// ui_msgbox_header(MBX_WARNING, (wchar_t *) IDS_2167, (wchar_t *) IDS_2168);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -123,7 +123,7 @@ netcard_conf_t net_cards_conf[NET_CARD_MAX];
|
||||||
uint16_t net_card_current = 0;
|
uint16_t net_card_current = 0;
|
||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
network_devmap_t network_devmap;
|
network_devmap_t network_devmap = {0};
|
||||||
int network_ndev;
|
int network_ndev;
|
||||||
netdev_t network_devs[NET_HOST_INTF_MAX];
|
netdev_t network_devs[NET_HOST_INTF_MAX];
|
||||||
|
|
||||||
|
@ -442,13 +442,12 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
|
||||||
card->card_num = net_card_current;
|
card->card_num = net_card_current;
|
||||||
card->byte_period = NET_PERIOD_10M;
|
card->byte_period = NET_PERIOD_10M;
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < NET_QUEUE_COUNT; i++) {
|
||||||
network_queue_init(&card->queues[i]);
|
network_queue_init(&card->queues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (net_cards_conf[net_card_current].net_type) {
|
switch (net_cards_conf[net_card_current].net_type) {
|
||||||
case NET_TYPE_SLIRP:
|
case NET_TYPE_SLIRP:
|
||||||
default:
|
|
||||||
card->host_drv = net_slirp_drv;
|
card->host_drv = net_slirp_drv;
|
||||||
card->host_drv.priv = card->host_drv.init(card, mac, NULL);
|
card->host_drv.priv = card->host_drv.init(card, mac, NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -463,18 +462,45 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
|
||||||
card->host_drv.priv = card->host_drv.init(card, mac, net_cards_conf[net_card_current].host_dev_name);
|
card->host_drv.priv = card->host_drv.init(card, mac, net_cards_conf[net_card_current].host_dev_name);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
default:
|
||||||
|
card->host_drv.priv = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use null driver on:
|
||||||
|
// * No specific driver selected (card->host_drv.priv is set to null above)
|
||||||
|
// * Failure to init a specific driver (in which case card->host_drv.priv is null)
|
||||||
if (!card->host_drv.priv) {
|
if (!card->host_drv.priv) {
|
||||||
thread_close_mutex(card->tx_mutex);
|
|
||||||
thread_close_mutex(card->rx_mutex);
|
if(net_cards_conf[net_card_current].net_type != NET_TYPE_NONE) {
|
||||||
for (int i = 0; i < 3; i++) {
|
// We're here because of a failure
|
||||||
network_queue_clear(&card->queues[i]);
|
// Placeholder to display a msgbox about falling back to null
|
||||||
|
ui_msgbox(MBX_ERROR | MBX_ANSI, "Network driver initialization failed. Falling back to NULL driver.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init null driver
|
||||||
|
card->host_drv = net_null_drv;
|
||||||
|
card->host_drv.priv = card->host_drv.init(card, mac, NULL);
|
||||||
|
// Set link state to disconnected by default
|
||||||
|
network_connect(card->card_num, 0);
|
||||||
|
ui_sb_update_icon_state(SB_NETWORK | card->card_num, 1);
|
||||||
|
|
||||||
|
// If null fails, something is very wrong
|
||||||
|
// Clean up and fatal
|
||||||
|
if(!card->host_drv.priv) {
|
||||||
|
thread_close_mutex(card->tx_mutex);
|
||||||
|
thread_close_mutex(card->rx_mutex);
|
||||||
|
for (int i = 0; i < NET_QUEUE_COUNT; i++) {
|
||||||
|
network_queue_clear(&card->queues[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(card->queued_pkt.data);
|
||||||
|
free(card);
|
||||||
|
// Placeholder - insert the error message
|
||||||
|
fatal("Error initializing the network device: Null driver initialization failed");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(card->queued_pkt.data);
|
|
||||||
free(card);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_add(&card->timer, network_rx_queue, card, 0);
|
timer_add(&card->timer, network_rx_queue, card, 0);
|
||||||
|
@ -491,7 +517,7 @@ netcard_close(netcard_t *card)
|
||||||
|
|
||||||
thread_close_mutex(card->tx_mutex);
|
thread_close_mutex(card->tx_mutex);
|
||||||
thread_close_mutex(card->rx_mutex);
|
thread_close_mutex(card->rx_mutex);
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < NET_QUEUE_COUNT; i++) {
|
||||||
network_queue_clear(&card->queues[i]);
|
network_queue_clear(&card->queues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +667,7 @@ network_dev_to_id(char *devname)
|
||||||
int
|
int
|
||||||
network_dev_available(int id)
|
network_dev_available(int id)
|
||||||
{
|
{
|
||||||
int available = (net_cards_conf[id].device_num > 0) && (net_cards_conf[id].net_type != NET_TYPE_NONE);
|
int available = (net_cards_conf[id].device_num > 0);
|
||||||
|
|
||||||
if ((net_cards_conf[id].net_type == NET_TYPE_PCAP && (network_dev_to_id(net_cards_conf[id].host_dev_name) <= 0)))
|
if ((net_cards_conf[id].net_type == NET_TYPE_PCAP && (network_dev_to_id(net_cards_conf[id].host_dev_name) <= 0)))
|
||||||
available = 0;
|
available = 0;
|
||||||
|
|
|
@ -849,7 +849,7 @@ MediaMenu::nicUpdateMenu(int i)
|
||||||
if (!netMenus.contains(i))
|
if (!netMenus.contains(i))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString netType = tr("None");
|
QString netType = tr("Null Driver");
|
||||||
switch (net_cards_conf[i].net_type) {
|
switch (net_cards_conf[i].net_type) {
|
||||||
case NET_TYPE_SLIRP:
|
case NET_TYPE_SLIRP:
|
||||||
netType = "SLiRP";
|
netType = "SLiRP";
|
||||||
|
|
|
@ -40,9 +40,10 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||||
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
|
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
|
||||||
|
|
||||||
int netType = net_type_cbox->currentData().toInt();
|
int netType = net_type_cbox->currentData().toInt();
|
||||||
bool adaptersEnabled = netType == NET_TYPE_SLIRP
|
bool adaptersEnabled = netType == NET_TYPE_NONE
|
||||||
|| NET_TYPE_VDE
|
|| netType == NET_TYPE_SLIRP
|
||||||
|| (netType == NET_TYPE_PCAP && intf_cbox->currentData().toInt() > 0);
|
|| netType == NET_TYPE_VDE
|
||||||
|
|| (netType == NET_TYPE_PCAP && intf_cbox->currentData().toInt() > 0);
|
||||||
|
|
||||||
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
|
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
|
||||||
nic_cbox->setEnabled(adaptersEnabled);
|
nic_cbox->setEnabled(adaptersEnabled);
|
||||||
|
@ -133,7 +134,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
|
||||||
cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
|
cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
|
||||||
model = cbox->model();
|
model = cbox->model();
|
||||||
removeRows = model->rowCount();
|
removeRows = model->rowCount();
|
||||||
Models::AddEntry(model, tr("None"), NET_TYPE_NONE);
|
Models::AddEntry(model, tr("Null Driver"), NET_TYPE_NONE);
|
||||||
Models::AddEntry(model, "SLiRP", NET_TYPE_SLIRP);
|
Models::AddEntry(model, "SLiRP", NET_TYPE_SLIRP);
|
||||||
|
|
||||||
if (network_ndev > 1) {
|
if (network_ndev > 1) {
|
||||||
|
|
|
@ -669,7 +669,8 @@ NETOBJ := network.o \
|
||||||
net_dp8390.o net_3c501.o \
|
net_dp8390.o net_3c501.o \
|
||||||
net_3c503.o net_ne2000.o \
|
net_3c503.o net_ne2000.o \
|
||||||
net_pcnet.o net_wd8003.o \
|
net_pcnet.o net_wd8003.o \
|
||||||
net_plip.o net_event.o
|
net_plip.o net_event.o \
|
||||||
|
net_null.o
|
||||||
|
|
||||||
PRINTOBJ := png.o prt_cpmap.o \
|
PRINTOBJ := png.o prt_cpmap.o \
|
||||||
prt_escp.o prt_text.o prt_ps.o
|
prt_escp.o prt_text.o prt_ps.o
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#define CFG_BTN_WIDTH 46
|
#define CFG_BTN_WIDTH 46
|
||||||
#define CFG_BTN_HEIGHT 14
|
#define CFG_BTN_HEIGHT 14
|
||||||
#define CFG_PANE_LTEXT_PRI_WIDTH 85
|
#define CFG_PANE_LTEXT_PRI_WIDTH 85
|
||||||
|
#define CFG_PANE_LTEXT_PRI_WIDTH_2 170
|
||||||
|
#define CFG_PANE_LTEXT_PRI_WIDTH_3 255
|
||||||
#define CFG_PANE_LTEXT_HEIGHT 10
|
#define CFG_PANE_LTEXT_HEIGHT 10
|
||||||
#define CFG_COMBO_BTN_WIDTH 212
|
#define CFG_COMBO_BTN_WIDTH 212
|
||||||
#define CFG_COMBO_NOBTN_WIDTH CFG_COMBO_BTN_WIDTH + CFG_BTN_WIDTH + 8
|
#define CFG_COMBO_NOBTN_WIDTH CFG_COMBO_BTN_WIDTH + CFG_BTN_WIDTH + 8
|
||||||
|
@ -405,10 +407,10 @@ BEGIN
|
||||||
LTEXT STR_PCAP, IDT_PCAP,
|
LTEXT STR_PCAP, IDT_PCAP,
|
||||||
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
|
||||||
LTEXT STR_NET, IDT_NET,
|
LTEXT STR_NET, IDT_NET,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_2 + 20, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET1_TYPE,
|
COMBOBOX IDC_COMBO_NET1_TYPE,
|
||||||
CFG_HMARGIN, 28, 32, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN, 28, 48, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_PCAP1,
|
COMBOBOX IDC_COMBO_PCAP1,
|
||||||
|
@ -416,13 +418,13 @@ BEGIN
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET1,
|
COMBOBOX IDC_COMBO_NET1,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 28, 110, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_2 + 20, 28, 110, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET1,
|
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET1,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 27, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_3 + 50, 27, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET2_TYPE,
|
COMBOBOX IDC_COMBO_NET2_TYPE,
|
||||||
CFG_HMARGIN, 49, 32, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN, 49, 48, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_PCAP2,
|
COMBOBOX IDC_COMBO_PCAP2,
|
||||||
|
@ -430,13 +432,13 @@ BEGIN
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET2,
|
COMBOBOX IDC_COMBO_NET2,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 49, 110, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_2 + 20, 49, 110, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET2,
|
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET2,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 48, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_3 + 50, 48, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET3_TYPE,
|
COMBOBOX IDC_COMBO_NET3_TYPE,
|
||||||
CFG_HMARGIN, 70, 32, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN, 70, 48, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_PCAP3,
|
COMBOBOX IDC_COMBO_PCAP3,
|
||||||
|
@ -444,13 +446,13 @@ BEGIN
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET3,
|
COMBOBOX IDC_COMBO_NET3,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 70, 110, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_2 + 20, 70, 110, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET3,
|
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET3,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 69, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_3 + 50, 69, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET4_TYPE,
|
COMBOBOX IDC_COMBO_NET4_TYPE,
|
||||||
CFG_HMARGIN, 91, 32, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN, 91, 48, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_PCAP4,
|
COMBOBOX IDC_COMBO_PCAP4,
|
||||||
|
@ -458,10 +460,10 @@ BEGIN
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
COMBOBOX IDC_COMBO_NET4,
|
COMBOBOX IDC_COMBO_NET4,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 91, 110, CFG_COMBO_HEIGHT,
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_2 + 20, 91, 110, CFG_COMBO_HEIGHT,
|
||||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET4,
|
PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET4,
|
||||||
CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 90, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH_3 + 50, 90, CFG_BTN_WIDTH, CFG_BTN_HEIGHT
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
|
@ -2062,7 +2062,7 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||||
|
|
||||||
for (uint8_t i = 0; i < NET_CARD_MAX; i++) {
|
for (uint8_t i = 0; i < NET_CARD_MAX; i++) {
|
||||||
settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"None");
|
settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"Null Driver");
|
||||||
settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"SLiRP");
|
settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"SLiRP");
|
||||||
settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"PCap");
|
settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"PCap");
|
||||||
settings_set_cur_sel(hdlg, IDC_COMBO_NET1_TYPE + i, temp_net_type[i]);
|
settings_set_cur_sel(hdlg, IDC_COMBO_NET1_TYPE + i, temp_net_type[i]);
|
||||||
|
|
Loading…
Reference in a new issue