Added network configuration to wxWidgets GUI.
This commit is contained in:
parent
ec6ba93665
commit
03749ab0fb
12 changed files with 1635 additions and 547 deletions
62
src/Makefile.mingw-wx-sdl2-network
Normal file
62
src/Makefile.mingw-wx-sdl2-network
Normal file
File diff suppressed because one or more lines are too long
BIN
src/icons/16x16/network_ethernet.png
Normal file
BIN
src/icons/16x16/network_ethernet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/icons/16x16/widescreen.png
Normal file
BIN
src/icons/16x16/widescreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 664 B |
BIN
src/icons/32x32/network_ethernet.png
Normal file
BIN
src/icons/32x32/network_ethernet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 KiB |
BIN
src/icons/32x32/widescreen.png
Normal file
BIN
src/icons/32x32/widescreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
185
src/pc.xrc
185
src/pc.xrc
|
|
@ -1873,6 +1873,51 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="notebookpage">
|
||||
<label></label>
|
||||
<selected>0</selected>
|
||||
<bitmap>icons/32x32/network_ethernet.png</bitmap>
|
||||
<object class="wxPanel" name="m_panelnet">
|
||||
<style>wxTAB_TRAVERSAL</style>
|
||||
<object class="wxFlexGridSizer">
|
||||
<rows>0</rows>
|
||||
<cols>2</cols>
|
||||
<vgap>0</vgap>
|
||||
<hgap>0</hgap>
|
||||
<growablecols>1</growablecols>
|
||||
<growablerows></growablerows>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxStaticText" name="m_staticText70">
|
||||
<size>80,-1</size>
|
||||
<label>Network card :</label>
|
||||
<wrap>-1</wrap>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxComboBox" name="IDC_COMBO_NETCARD">
|
||||
<style>wxCB_DROPDOWN|wxCB_READONLY</style>
|
||||
<size>350,-1</size>
|
||||
<value></value>
|
||||
<content />
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
|
|
@ -2377,6 +2422,22 @@
|
|||
<default>0</default>
|
||||
</object>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<size>0,0</size>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxBitmapButton" name="IDC_CONFIG_HOST">
|
||||
<style>wxBU_AUTODRAW</style>
|
||||
<bitmap>icons/32x32/widescreen.png</bitmap>
|
||||
<default>0</default>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
|
|
@ -2724,4 +2785,128 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object class="wxDialog" name="HostConfig">
|
||||
<style>wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP</style>
|
||||
<size>499,175</size>
|
||||
<title>Host Configuration</title>
|
||||
<centered>1</centered>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxVERTICAL</orient>
|
||||
<object class="sizeritem">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND | wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxPanel" name="m_panel20">
|
||||
<style>wxTAB_TRAVERSAL</style>
|
||||
<object class="wxFlexGridSizer">
|
||||
<rows>0</rows>
|
||||
<cols>1</cols>
|
||||
<vgap>0</vgap>
|
||||
<hgap>0</hgap>
|
||||
<growablecols></growablecols>
|
||||
<growablerows></growablerows>
|
||||
<object class="sizeritem">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND | wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxNotebook" name="m_notebook2">
|
||||
<object class="notebookpage">
|
||||
<label></label>
|
||||
<selected>0</selected>
|
||||
<bitmap>icons/32x32/network_ethernet.png</bitmap>
|
||||
<object class="wxPanel" name="m_panel19">
|
||||
<style>wxTAB_TRAVERSAL</style>
|
||||
<object class="wxFlexGridSizer">
|
||||
<rows>0</rows>
|
||||
<cols>2</cols>
|
||||
<vgap>0</vgap>
|
||||
<hgap>0</hgap>
|
||||
<growablecols></growablecols>
|
||||
<growablerows></growablerows>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxStaticText" name="m_staticText72">
|
||||
<label>Network type :</label>
|
||||
<wrap>-1</wrap>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxComboBox" name="IDC_COMBO_NETWORK_TYPE">
|
||||
<style>wxCB_DROPDOWN|wxCB_READONLY</style>
|
||||
<size>550,-1</size>
|
||||
<value></value>
|
||||
<content />
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxStaticText" name="m_staticText73">
|
||||
<label>Network device :</label>
|
||||
<wrap>-1</wrap>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>0</option>
|
||||
<flag>wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxComboBox" name="IDC_COMBO_NETWORK_DEVICE">
|
||||
<style>wxCB_DROPDOWN|wxCB_READONLY</style>
|
||||
<size>550,-1</size>
|
||||
<value>Combo!</value>
|
||||
<content />
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<object class="wxBoxSizer">
|
||||
<orient>wxHORIZONTAL</orient>
|
||||
<object class="spacer">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<size>0,0</size>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<option>1</option>
|
||||
<flag>wxEXPAND</flag>
|
||||
<border>5</border>
|
||||
<object class="wxStdDialogButtonSizer">
|
||||
<object class="button">
|
||||
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
<label>&OK</label>
|
||||
</object>
|
||||
</object>
|
||||
<object class="button">
|
||||
<flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
|
||||
<border>5</border>
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
<label>&Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</resource>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "model.h"
|
||||
#include "mouse.h"
|
||||
#include "mem.h"
|
||||
#include "nethandler.h"
|
||||
#include "nvr.h"
|
||||
#include "sound.h"
|
||||
#include "video.h"
|
||||
|
|
@ -23,7 +24,9 @@ static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX],
|
|||
modeltolist[ROM_MAX];
|
||||
static int settings_sound_to_list[20], settings_list_to_sound[20];
|
||||
static int settings_mouse_to_list[20], settings_list_to_mouse[20];
|
||||
//static int settings_network_to_list[20], settings_list_to_network[20];
|
||||
#ifdef USE_NETWORKING
|
||||
static int settings_network_to_list[20], settings_list_to_network[20];
|
||||
#endif
|
||||
static char *hdd_names[16];
|
||||
|
||||
int has_been_inited = 0;
|
||||
|
|
@ -206,6 +209,47 @@ static void recalc_hdd_list(void* hdlg, int model, int use_selected_hdd)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_NETWORKING
|
||||
static void recalc_net_list(void *hdlg, int model)
|
||||
{
|
||||
void *h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETCARD"));
|
||||
int c = 0, d = 0;
|
||||
int set_zero = 0;
|
||||
|
||||
wx_sendmessage(h, WX_CB_RESETCONTENT, 0, 0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
char *s = network_card_getname(c);
|
||||
|
||||
if (!s[0])
|
||||
break;
|
||||
|
||||
settings_network_to_list[c] = d;
|
||||
|
||||
if (network_card_available(c))
|
||||
{
|
||||
device_t *network_dev = network_card_getdevice(c);
|
||||
|
||||
if (!network_dev || (network_dev->flags & DEVICE_MCA) == (models[model].flags & MODEL_MCA))
|
||||
{
|
||||
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)s);
|
||||
settings_list_to_network[d] = c;
|
||||
d++;
|
||||
}
|
||||
else if (c == network_card_current)
|
||||
set_zero = 1;
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
if (set_zero)
|
||||
wx_sendmessage(h, WX_CB_SETCURSEL, 0, 0);
|
||||
else
|
||||
wx_sendmessage(h, WX_CB_SETCURSEL, settings_network_to_list[network_card_current], 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int config_dlgsave(void* hdlg)
|
||||
{
|
||||
char temp_str[256];
|
||||
|
|
@ -217,6 +261,9 @@ int config_dlgsave(void* hdlg)
|
|||
int temp_dynarec;
|
||||
int temp_fda_type, temp_fdb_type;
|
||||
int temp_mouse_type;
|
||||
#ifdef USE_NETWORKING
|
||||
int temp_network_card;
|
||||
#endif
|
||||
int hdd_changed = 0;
|
||||
char s[260];
|
||||
PcemHDC hd[4];
|
||||
|
|
@ -282,13 +329,21 @@ int config_dlgsave(void* hdlg)
|
|||
if (hdd_names[c])
|
||||
hdd_changed = strncmp(hdd_names[c], hdd_controller_name, sizeof(hdd_controller_name)-1);
|
||||
|
||||
#ifdef USE_NETWORKING
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETCARD"));
|
||||
temp_network_card = settings_list_to_network[wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0)];
|
||||
#endif
|
||||
|
||||
if (temp_model != model || gfx != gfxcard || mem != mem_size ||
|
||||
fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS ||
|
||||
temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current ||
|
||||
temp_voodoo != voodoo_enabled || temp_dynarec != cpu_use_dynarec ||
|
||||
temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) ||
|
||||
temp_mouse_type != mouse_type || hdd_changed || hd_changed || cdrom_channel != new_cdrom_channel)
|
||||
temp_mouse_type != mouse_type || hdd_changed || hd_changed || cdrom_channel != new_cdrom_channel
|
||||
#ifdef USE_NETWORKING
|
||||
|| temp_network_card != network_card_current
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (!has_been_inited || confirm())
|
||||
{
|
||||
|
|
@ -306,6 +361,9 @@ int config_dlgsave(void* hdlg)
|
|||
voodoo_enabled = temp_voodoo;
|
||||
cpu_use_dynarec = temp_dynarec;
|
||||
mouse_type = temp_mouse_type;
|
||||
#ifdef USE_NETWORKING
|
||||
network_card_current = temp_network_card;
|
||||
#endif
|
||||
|
||||
fdd_set_type(0, temp_fda_type);
|
||||
fdd_set_type(1, temp_fdb_type);
|
||||
|
|
@ -416,6 +474,9 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
|
|||
int cpu_flags;
|
||||
int cpu_type;
|
||||
int temp_mouse_type;
|
||||
#ifdef USE_NETWORKING
|
||||
int temp_network_card;
|
||||
#endif
|
||||
|
||||
switch (message)
|
||||
{
|
||||
|
|
@ -633,6 +694,16 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
|
|||
|
||||
hdconf_init(hdlg);
|
||||
|
||||
#ifdef USE_NETWORKING
|
||||
recalc_net_list(hdlg, romstomodel[romset]);
|
||||
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETCARD"));
|
||||
if (network_card_has_config(network_card_current))
|
||||
wx_enablewindow(h, TRUE);
|
||||
else
|
||||
wx_enablewindow(h, FALSE);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
@ -759,6 +830,9 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
|
|||
recalc_hdd_list(hdlg, temp_model, 1);
|
||||
|
||||
recalc_snd_list(hdlg, temp_model);
|
||||
#ifdef USE_NETWORKING
|
||||
recalc_net_list(hdlg, temp_model);
|
||||
#endif
|
||||
}
|
||||
else if (wParam == WX_ID("IDC_COMBOCPUM"))
|
||||
{
|
||||
|
|
@ -891,6 +965,19 @@ int config_dlgproc(void* hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
|
|||
{
|
||||
hdconf_update(hdlg);
|
||||
}
|
||||
#ifdef USE_NETWORKING
|
||||
else if (wParam == WX_ID("IDC_COMBO_NETCARD"))
|
||||
{
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETCARD"));
|
||||
temp_network_card = settings_list_to_network[wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0)];
|
||||
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETCARD"));
|
||||
if (network_card_has_config(temp_network_card))
|
||||
wx_enablewindow(h, TRUE);
|
||||
else
|
||||
wx_enablewindow(h, FALSE);
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// case IDC_COMBOJOY:
|
||||
// if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||
|
|
@ -1024,9 +1111,6 @@ static void check_hd_type(void* hdlg, off64_t sz)
|
|||
}
|
||||
}
|
||||
|
||||
#define ID_IS(s) wParam == wx_xrcid(s)
|
||||
#define ID_RANGE(a, b) wParam >= wx_xrcid(a) && wParam <= wx_xrcid(b)
|
||||
|
||||
static void update_hdd_cdrom(void* hdlg)
|
||||
{
|
||||
void* h;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "config.h"
|
||||
#include "wx-utils.h"
|
||||
#include "paths.h"
|
||||
#include "wx-hostconfig.h"
|
||||
|
||||
static int active_config = -1;
|
||||
|
||||
|
|
@ -277,6 +278,12 @@ static int config_selection_dlgproc(void* hdlg, int message, INT_PARAM wParam, L
|
|||
if (lParam == WX_LBN_DBLCLK)
|
||||
run(hdlg);
|
||||
}
|
||||
#ifdef USE_NETWORKING
|
||||
else if (wParam == WX_ID("IDC_CONFIG_HOST"))
|
||||
{
|
||||
hostconfig_open(hdlg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
229
src/wx-hostconfig.c
Normal file
229
src/wx-hostconfig.c
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
#define BITMAP WINDOWS_BITMAP
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#undef BITMAP
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
#include "wx-utils.h"
|
||||
#include "wx-sdl2.h"
|
||||
#include "wx-hostconfig.h"
|
||||
|
||||
#include "ibm.h"
|
||||
#include "config.h"
|
||||
#include "nethandler.h"
|
||||
|
||||
static HINSTANCE net_hLib = 0;
|
||||
static char *net_lib_name = "wpcap.dll";
|
||||
static pcap_if_t *alldevs;
|
||||
static char *dev_name[20];
|
||||
|
||||
int (*_pcap_findalldevs)(pcap_if_t **, char *);
|
||||
void (*_pcap_freealldevs)(pcap_if_t *);
|
||||
pcap_t *(*_pcap_open_live)(const char *, int, int, int, char *);
|
||||
int (*_pcap_datalink)(pcap_t *);
|
||||
void (*_pcap_close)(pcap_t *);
|
||||
|
||||
#define ETH_DEV_NAME_MAX 256 /* maximum device name size */
|
||||
#define ETH_DEV_DESC_MAX 256 /* maximum device description size */
|
||||
#define ETH_MAX_DEVICE 30 /* maximum ethernet devices */
|
||||
#define ETH_PROMISC 1 /* promiscuous mode = true */
|
||||
#define ETH_MAX_PACKET 1514 /* maximum ethernet packet size */
|
||||
#define PCAP_READ_TIMEOUT -1
|
||||
|
||||
static int get_network_name(char *dev_name, char *regval)
|
||||
{
|
||||
if (dev_name[strlen( "\\Device\\NPF_" )] == '{')
|
||||
{
|
||||
char regkey[2048];
|
||||
HKEY reghnd;
|
||||
|
||||
sprintf(regkey, "SYSTEM\\CurrentControlSet\\Control\\Network\\"
|
||||
"{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", dev_name+
|
||||
strlen("\\Device\\NPF_"));
|
||||
|
||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, regkey, 0, KEY_QUERY_VALUE, ®hnd) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD reglen = 2048;
|
||||
DWORD regtype;
|
||||
|
||||
if (RegQueryValueExA(reghnd, "Name", NULL, ®type, (LPBYTE)regval, ®len) == ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey (reghnd);
|
||||
|
||||
if ((regtype != REG_SZ) || (reglen > 2048))
|
||||
return -1;
|
||||
|
||||
/*Name now in regval*/
|
||||
return 0;
|
||||
}
|
||||
RegCloseKey (reghnd);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int hostconfig_dialog_proc(void *hdlg, int message, INT_PARAM wParam, LONG_PARAM lParam)
|
||||
{
|
||||
void *h;
|
||||
pcap_if_t *dev;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WX_INITDIALOG:
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_TYPE"));
|
||||
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)"SLiRP");
|
||||
wx_sendmessage(h, WX_CB_SETCURSEL, 0, 0);
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_DEVICE"));
|
||||
wx_sendmessage(h, WX_CB_SETCURSEL, 0, 0);
|
||||
wx_enablewindow(h, FALSE);
|
||||
|
||||
net_hLib = LoadLibraryA(net_lib_name);
|
||||
|
||||
if (net_hLib)
|
||||
{
|
||||
int c = 0;
|
||||
int match = 0;
|
||||
|
||||
_pcap_findalldevs = (void *)GetProcAddress(net_hLib, "pcap_findalldevs");
|
||||
_pcap_freealldevs = (void *)GetProcAddress(net_hLib, "pcap_freealldevs");
|
||||
_pcap_open_live = (void *)GetProcAddress(net_hLib, "pcap_open_live");
|
||||
_pcap_datalink = (void *)GetProcAddress(net_hLib, "pcap_datalink");
|
||||
_pcap_close = (void *)GetProcAddress(net_hLib, "pcap_close");
|
||||
|
||||
if (_pcap_findalldevs(&alldevs, errbuf) != -1)
|
||||
{
|
||||
char *pcap_device = config_get_string(CFG_GLOBAL, NULL, "pcap_device", "nothing");
|
||||
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_DEVICE"));
|
||||
|
||||
for (dev = alldevs; dev; dev = dev->next)
|
||||
{
|
||||
pcap_t *conn = _pcap_open_live(dev->name, ETH_MAX_PACKET, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf);
|
||||
int datalink;
|
||||
|
||||
if (conn)
|
||||
{
|
||||
datalink = _pcap_datalink(conn);
|
||||
_pcap_close(conn);
|
||||
}
|
||||
|
||||
if (conn && datalink == DLT_EN10MB)
|
||||
{
|
||||
char desc[2048];
|
||||
char s[2048];
|
||||
|
||||
if ((dev->flags & PCAP_IF_LOOPBACK) || (!strcmp("any", dev->name)))
|
||||
continue;
|
||||
|
||||
if (pcap_device)
|
||||
{
|
||||
if (!strcmp(pcap_device, dev->name))
|
||||
match = c;
|
||||
}
|
||||
|
||||
dev_name[c++] = dev->name;
|
||||
if (get_network_name(dev->name, desc))
|
||||
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)dev->name);
|
||||
else
|
||||
{
|
||||
sprintf(s, "%s - %s", dev->name, desc);
|
||||
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c)
|
||||
{
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_TYPE"));
|
||||
wx_sendmessage(h, WX_CB_ADDSTRING, 0, (LONG_PARAM)"PCAP");
|
||||
|
||||
if (config_get_int(CFG_GLOBAL, NULL, "net_type", NET_SLIRP) == NET_PCAP)
|
||||
{
|
||||
wx_sendmessage(h, WX_CB_SETCURSEL, 1, 0);
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_DEVICE"));
|
||||
wx_sendmessage(h, WX_CB_SETCURSEL, match, 0);
|
||||
wx_enablewindow(h, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case WX_COMMAND:
|
||||
if (wParam == wxID_OK)
|
||||
{
|
||||
int type;
|
||||
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_TYPE"));
|
||||
type = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
|
||||
if (type) /*PCAP*/
|
||||
{
|
||||
int dev;
|
||||
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_DEVICE"));
|
||||
dev = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
|
||||
|
||||
config_set_int(CFG_GLOBAL, NULL, "net_type", NET_PCAP);
|
||||
config_set_string(CFG_GLOBAL, NULL, "pcap_device", dev_name[dev]);
|
||||
}
|
||||
else /*SLiRP*/
|
||||
{
|
||||
config_set_int(CFG_GLOBAL, NULL, "net_type", NET_SLIRP);
|
||||
config_set_string(CFG_GLOBAL, NULL, "pcap_device", "nothing");
|
||||
}
|
||||
saveconfig_global_only();
|
||||
|
||||
wx_enddialog(hdlg, 1);
|
||||
|
||||
if (net_hLib)
|
||||
{
|
||||
_pcap_freealldevs(alldevs);
|
||||
_pcap_findalldevs = NULL;
|
||||
_pcap_freealldevs = NULL;
|
||||
_pcap_open_live = NULL;
|
||||
_pcap_datalink = NULL;
|
||||
_pcap_close = NULL;
|
||||
FreeLibrary(net_hLib);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else if (wParam == wxID_CANCEL)
|
||||
{
|
||||
wx_enddialog(hdlg, 0);
|
||||
if (net_hLib)
|
||||
{
|
||||
_pcap_freealldevs(alldevs);
|
||||
_pcap_findalldevs = NULL;
|
||||
_pcap_freealldevs = NULL;
|
||||
_pcap_open_live = NULL;
|
||||
_pcap_datalink = NULL;
|
||||
_pcap_close = NULL;
|
||||
FreeLibrary(net_hLib);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else if (ID_IS("IDC_COMBO_NETWORK_TYPE"))
|
||||
{
|
||||
int type;
|
||||
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_TYPE"));
|
||||
type = wx_sendmessage(h, WX_CB_GETCURSEL, 0, 0);
|
||||
h = wx_getdlgitem(hdlg, WX_ID("IDC_COMBO_NETWORK_DEVICE"));
|
||||
if (!type)
|
||||
wx_enablewindow(h, FALSE);
|
||||
else
|
||||
wx_enablewindow(h, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int hostconfig_open(void *hwnd)
|
||||
{
|
||||
return wx_dialogbox(hwnd, "HostConfig", hostconfig_dialog_proc);
|
||||
}
|
||||
1
src/wx-hostconfig.h
Normal file
1
src/wx-hostconfig.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
int hostconfig_open(void *hwnd);
|
||||
1593
src/wx-resources.cpp
1593
src/wx-resources.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -154,3 +154,6 @@ extern void (*wx_idle_func)(void* window, void* event);
|
|||
#define IMAGE_TIFF "tiff"
|
||||
|
||||
extern int has_been_inited;
|
||||
|
||||
#define ID_IS(s) wParam == wx_xrcid(s)
|
||||
#define ID_RANGE(a, b) wParam >= wx_xrcid(a) && wParam <= wx_xrcid(b)
|
||||
|
|
|
|||
Loading…
Reference in a new issue