Added network configuration to wxWidgets GUI.
This commit is contained in:
parent
ec6ba93665
commit
03749ab0fb
12 changed files with 1635 additions and 547 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue