save LAN settings

This commit is contained in:
Arisotura 2019-02-21 03:06:37 +01:00
parent 023a1ba200
commit f9822cdd44
3 changed files with 25 additions and 1 deletions

View File

@ -54,6 +54,8 @@ int DirectBoot;
int Threaded3D; int Threaded3D;
int SocketBindAnyAddr; int SocketBindAnyAddr;
char LANDevice[128];
int DirectLAN;
int SavestateRelocSRAM; int SavestateRelocSRAM;
@ -125,6 +127,8 @@ ConfigEntry ConfigFile[] =
{"Threaded3D", 0, &Threaded3D, 1, NULL, 0}, {"Threaded3D", 0, &Threaded3D, 1, NULL, 0},
{"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0}, {"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0},
{"LANDevice", 1, LANDevice, 0, "", 127},
{"DirectLAN", 0, &DirectLAN, 0, NULL, 0},
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 0, NULL, 0}, {"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 0, NULL, 0},

View File

@ -59,6 +59,8 @@ extern int DirectBoot;
extern int Threaded3D; extern int Threaded3D;
extern int SocketBindAnyAddr; extern int SocketBindAnyAddr;
extern char LANDevice[128];
extern int DirectLAN;
extern int SavestateRelocSRAM; extern int SavestateRelocSRAM;

View File

@ -53,6 +53,7 @@ void UpdateAdapterInfo()
{ {
int sel = uiComboboxSelected(cmAdapterList); int sel = uiComboboxSelected(cmAdapterList);
if (sel < 0 || sel >= LAN::NumAdapters) return; if (sel < 0 || sel >= LAN::NumAdapters) return;
if (LAN::NumAdapters < 1) return;
LAN::AdapterData* adapter = &LAN::Adapters[sel]; LAN::AdapterData* adapter = &LAN::Adapters[sel];
char tmp[64]; char tmp[64];
@ -98,6 +99,19 @@ void OnCancel(uiButton* btn, void* blarg)
void OnOk(uiButton* btn, void* blarg) void OnOk(uiButton* btn, void* blarg)
{ {
Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr); Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr);
Config::DirectLAN = uiCheckboxChecked(cbDirectLAN);
int sel = uiComboboxSelected(cmAdapterList);
if (sel < 0 || sel >= LAN::NumAdapters) sel = 0;
if (LAN::NumAdapters < 1)
{
Config::LANDevice[0] = '\0';
}
else
{
strncpy(Config::LANDevice, LAN::Adapters[sel].DeviceName, 127);
Config::LANDevice[127] = '\0';
}
Config::Save(); Config::Save();
@ -193,11 +207,15 @@ void Open()
LAN::AdapterData* adapter = &LAN::Adapters[i]; LAN::AdapterData* adapter = &LAN::Adapters[i];
uiComboboxAppend(cmAdapterList, adapter->FriendlyName); uiComboboxAppend(cmAdapterList, adapter->FriendlyName);
if (!strncmp(adapter->DeviceName, Config::LANDevice, 128))
sel = i;
} }
// TODO: select the right one!
uiComboboxSetSelected(cmAdapterList, sel); uiComboboxSetSelected(cmAdapterList, sel);
UpdateAdapterInfo(); UpdateAdapterInfo();
uiCheckboxSetChecked(cbDirectLAN, Config::DirectLAN);
uiControlShow(uiControl(win)); uiControlShow(uiControl(win));
} }