mirror of https://github.com/PCSX2/pcsx2.git
Config: Allow setting DNS1/2 internal instead of manual/auto
This commit is contained in:
parent
d09b49e17c
commit
145e75624d
|
@ -652,9 +652,16 @@ struct Pcsx2Config
|
|||
PCAP_Switched = 2,
|
||||
TAP = 3,
|
||||
};
|
||||
|
||||
static const char* NetApiNames[];
|
||||
|
||||
enum struct DnsMode : int
|
||||
{
|
||||
Manual = 0,
|
||||
Auto = 1,
|
||||
Internal = 2,
|
||||
};
|
||||
static const char* DnsModeNames[];
|
||||
|
||||
bool EthEnable{false};
|
||||
NetApi EthApi{NetApi::Unset};
|
||||
std::string EthDevice;
|
||||
|
@ -668,8 +675,8 @@ struct Pcsx2Config
|
|||
u8 DNS2[4]{};
|
||||
bool AutoMask{true};
|
||||
bool AutoGateway{true};
|
||||
bool AutoDNS1{true};
|
||||
bool AutoDNS2{true};
|
||||
DnsMode ModeDNS1{DnsMode::Auto};
|
||||
DnsMode ModeDNS2{DnsMode::Auto};
|
||||
|
||||
bool HddEnable{false};
|
||||
std::string HddFile;
|
||||
|
@ -699,8 +706,8 @@ struct Pcsx2Config
|
|||
|
||||
OpEqu(AutoMask) &&
|
||||
OpEqu(AutoGateway) &&
|
||||
OpEqu(AutoDNS1) &&
|
||||
OpEqu(AutoDNS2) &&
|
||||
OpEqu(ModeDNS1) &&
|
||||
OpEqu(ModeDNS2) &&
|
||||
|
||||
OpEqu(HddEnable) &&
|
||||
OpEqu(HddFile) &&
|
||||
|
|
|
@ -245,8 +245,8 @@ public:
|
|||
IPControl_SetValue(m_ps2_address, *(IP_Address*)config.PS2IP);
|
||||
m_subnet_mask .load(*(IP_Address*)config.Mask, config.AutoMask);
|
||||
m_gateway_address.load(*(IP_Address*)config.Gateway, config.AutoGateway);
|
||||
m_dns1_address .load(*(IP_Address*)config.DNS1, config.AutoDNS1);
|
||||
m_dns2_address .load(*(IP_Address*)config.DNS2, config.AutoDNS2);
|
||||
m_dns1_address .load(*(IP_Address*)config.DNS1, config.ModeDNS1 == Pcsx2Config::DEV9Options::DnsMode::Auto);
|
||||
m_dns2_address .load(*(IP_Address*)config.DNS2, config.ModeDNS2 == Pcsx2Config::DEV9Options::DnsMode::Auto);
|
||||
|
||||
m_hdd_enable->SetValue(config.HddEnable);
|
||||
wxString wxHddFile = StringUtil::UTF8StringToWxString(config.HddFile);
|
||||
|
@ -278,8 +278,13 @@ public:
|
|||
*(IP_Address*)&config.PS2IP = IPControl_GetValue(m_ps2_address);
|
||||
m_subnet_mask .save(*(IP_Address*)config.Mask, config.AutoMask);
|
||||
m_gateway_address.save(*(IP_Address*)config.Gateway, config.AutoGateway);
|
||||
m_dns1_address .save(*(IP_Address*)config.DNS1, config.AutoDNS1);
|
||||
m_dns2_address .save(*(IP_Address*)config.DNS2, config.AutoDNS2);
|
||||
|
||||
bool autoDNS1;
|
||||
bool autoDNS2;
|
||||
m_dns1_address.save(*(IP_Address*)config.DNS1, autoDNS1);
|
||||
m_dns2_address.save(*(IP_Address*)config.DNS2, autoDNS2);
|
||||
config.ModeDNS1 = autoDNS1 ? Pcsx2Config::DEV9Options::DnsMode::Auto : Pcsx2Config::DEV9Options::DnsMode::Manual;
|
||||
config.ModeDNS2 = autoDNS2 ? Pcsx2Config::DEV9Options::DnsMode::Auto : Pcsx2Config::DEV9Options::DnsMode::Manual;
|
||||
|
||||
config.HddEnable = m_hdd_enable->GetValue();
|
||||
config.HddFile = StringUtil::wxStringToUTF8String(m_hdd_file->GetPath());
|
||||
|
|
|
@ -69,13 +69,31 @@ namespace InternalServers
|
|||
else
|
||||
gateway = *(IP_Address*)EmuConfig.DEV9.Gateway;
|
||||
|
||||
if (!EmuConfig.DEV9.AutoDNS1)
|
||||
dns1 = *(IP_Address*)EmuConfig.DEV9.DNS1;
|
||||
switch (EmuConfig.DEV9.ModeDNS1)
|
||||
{
|
||||
case Pcsx2Config::DEV9Options::DnsMode::Manual:
|
||||
dns1 = *(IP_Address*)EmuConfig.DEV9.DNS1;
|
||||
break;
|
||||
case Pcsx2Config::DEV9Options::DnsMode::Internal:
|
||||
dns1 = {192, 0, 2, 1};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!EmuConfig.DEV9.AutoDNS2)
|
||||
dns2 = *(IP_Address*)EmuConfig.DEV9.DNS2;
|
||||
switch (EmuConfig.DEV9.ModeDNS2)
|
||||
{
|
||||
case Pcsx2Config::DEV9Options::DnsMode::Manual:
|
||||
dns2 = *(IP_Address*)EmuConfig.DEV9.DNS2;
|
||||
break;
|
||||
case Pcsx2Config::DEV9Options::DnsMode::Internal:
|
||||
dns2 = {192, 0, 2, 1};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AutoDNS(adapter, EmuConfig.DEV9.AutoDNS1, EmuConfig.DEV9.AutoDNS2);
|
||||
AutoDNS(adapter, EmuConfig.DEV9.ModeDNS1 != Pcsx2Config::DEV9Options::DnsMode::Manual, EmuConfig.DEV9.ModeDNS2 != Pcsx2Config::DEV9Options::DnsMode::Manual);
|
||||
AutoBroadcast(ps2IP, netmask);
|
||||
}
|
||||
|
||||
|
|
|
@ -699,6 +699,12 @@ const char* Pcsx2Config::DEV9Options::NetApiNames[] = {
|
|||
"TAP",
|
||||
nullptr};
|
||||
|
||||
const char* Pcsx2Config::DEV9Options::DnsModeNames[] = {
|
||||
"Manual",
|
||||
"Auto",
|
||||
"Internal",
|
||||
nullptr};
|
||||
|
||||
Pcsx2Config::DEV9Options::DEV9Options()
|
||||
{
|
||||
HddFile = "DEV9hdd.raw";
|
||||
|
@ -744,8 +750,8 @@ void Pcsx2Config::DEV9Options::LoadSave(SettingsWrapper& wrap)
|
|||
|
||||
SettingsWrapEntry(AutoMask);
|
||||
SettingsWrapEntry(AutoGateway);
|
||||
SettingsWrapEntry(AutoDNS1);
|
||||
SettingsWrapEntry(AutoDNS2);
|
||||
SettingsWrapEnumEx(ModeDNS1, "ModeDNS1", DnsModeNames);
|
||||
SettingsWrapEnumEx(ModeDNS2, "ModeDNS2", DnsModeNames);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue