mirror of https://github.com/PCSX2/pcsx2.git
Config: Integrate internal DNS host list on Qt
This commit is contained in:
parent
145e75624d
commit
5db9a738c5
|
@ -365,7 +365,6 @@ set(pcsx2DEV9Sources
|
||||||
DEV9/PacketReader/NetLib.cpp
|
DEV9/PacketReader/NetLib.cpp
|
||||||
DEV9/smap.cpp
|
DEV9/smap.cpp
|
||||||
DEV9/DEV9.cpp
|
DEV9/DEV9.cpp
|
||||||
DEV9/DEV9Config.cpp
|
|
||||||
DEV9/flash.cpp
|
DEV9/flash.cpp
|
||||||
DEV9/pcap_io.cpp
|
DEV9/pcap_io.cpp
|
||||||
DEV9/net.cpp
|
DEV9/net.cpp
|
||||||
|
@ -376,7 +375,6 @@ set(pcsx2DEV9Headers
|
||||||
DEV9/ATA/ATA.h
|
DEV9/ATA/ATA.h
|
||||||
DEV9/ATA/HddCreate.h
|
DEV9/ATA/HddCreate.h
|
||||||
DEV9/DEV9.h
|
DEV9/DEV9.h
|
||||||
DEV9/DEV9Config.h
|
|
||||||
DEV9/InternalServers/DHCP_Server.cpp
|
DEV9/InternalServers/DHCP_Server.cpp
|
||||||
DEV9/InternalServers/DNS_Logger.h
|
DEV9/InternalServers/DNS_Logger.h
|
||||||
DEV9/InternalServers/DNS_Server.h
|
DEV9/InternalServers/DNS_Server.h
|
||||||
|
@ -402,6 +400,10 @@ set(pcsx2DEV9Headers
|
||||||
if(NOT PCSX2_CORE)
|
if(NOT PCSX2_CORE)
|
||||||
list(APPEND pcsx2DEV9Sources
|
list(APPEND pcsx2DEV9Sources
|
||||||
DEV9/ConfigUI.cpp
|
DEV9/ConfigUI.cpp
|
||||||
|
DEV9/DEV9Config.cpp
|
||||||
|
)
|
||||||
|
list(APPEND pcsx2DEV9Sources
|
||||||
|
DEV9/DEV9Config.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -662,6 +662,29 @@ struct Pcsx2Config
|
||||||
};
|
};
|
||||||
static const char* DnsModeNames[];
|
static const char* DnsModeNames[];
|
||||||
|
|
||||||
|
#ifdef PCSX2_CORE
|
||||||
|
struct HostEntry
|
||||||
|
{
|
||||||
|
std::string Url;
|
||||||
|
std::string Desc;
|
||||||
|
u8 Address[4]{};
|
||||||
|
bool Enabled;
|
||||||
|
|
||||||
|
bool operator==(const HostEntry& right) const
|
||||||
|
{
|
||||||
|
return OpEqu(Url) &&
|
||||||
|
OpEqu(Desc) &&
|
||||||
|
(*(int*)Address == *(int*)right.Address) &&
|
||||||
|
OpEqu(Enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const HostEntry& right) const
|
||||||
|
{
|
||||||
|
return !this->operator==(right);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
bool EthEnable{false};
|
bool EthEnable{false};
|
||||||
NetApi EthApi{NetApi::Unset};
|
NetApi EthApi{NetApi::Unset};
|
||||||
std::string EthDevice;
|
std::string EthDevice;
|
||||||
|
@ -678,6 +701,10 @@ struct Pcsx2Config
|
||||||
DnsMode ModeDNS1{DnsMode::Auto};
|
DnsMode ModeDNS1{DnsMode::Auto};
|
||||||
DnsMode ModeDNS2{DnsMode::Auto};
|
DnsMode ModeDNS2{DnsMode::Auto};
|
||||||
|
|
||||||
|
#ifdef PCSX2_CORE
|
||||||
|
std::vector<HostEntry> EthHosts;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool HddEnable{false};
|
bool HddEnable{false};
|
||||||
std::string HddFile;
|
std::string HddFile;
|
||||||
|
|
||||||
|
@ -709,6 +736,10 @@ struct Pcsx2Config
|
||||||
OpEqu(ModeDNS1) &&
|
OpEqu(ModeDNS1) &&
|
||||||
OpEqu(ModeDNS2) &&
|
OpEqu(ModeDNS2) &&
|
||||||
|
|
||||||
|
#ifdef PCSX2_CORE
|
||||||
|
OpEqu(EthHosts) &&
|
||||||
|
#endif
|
||||||
|
|
||||||
OpEqu(HddEnable) &&
|
OpEqu(HddEnable) &&
|
||||||
OpEqu(HddFile) &&
|
OpEqu(HddFile) &&
|
||||||
OpEqu(HddSizeSectors);
|
OpEqu(HddSizeSectors);
|
||||||
|
|
|
@ -199,7 +199,9 @@ void DEV9shutdown()
|
||||||
s32 DEV9open()
|
s32 DEV9open()
|
||||||
{
|
{
|
||||||
DevCon.WriteLn("DEV9: DEV9open");
|
DevCon.WriteLn("DEV9: DEV9open");
|
||||||
|
#ifndef PCSX2_CORE
|
||||||
LoadDnsHosts();
|
LoadDnsHosts();
|
||||||
|
#endif
|
||||||
DevCon.WriteLn("DEV9: open r+: %s", EmuConfig.DEV9.HddFile.c_str());
|
DevCon.WriteLn("DEV9: open r+: %s", EmuConfig.DEV9.HddFile.c_str());
|
||||||
|
|
||||||
fs::path hddPath = GetHDDPath();
|
fs::path hddPath = GetHDDPath();
|
||||||
|
|
|
@ -55,6 +55,7 @@ bool rx_fifo_can_rx();
|
||||||
#define HDD_MIN_GB 40
|
#define HDD_MIN_GB 40
|
||||||
#define HDD_MAX_GB 120
|
#define HDD_MAX_GB 120
|
||||||
|
|
||||||
|
#ifndef PCSX2_CORE
|
||||||
struct ConfigHost
|
struct ConfigHost
|
||||||
{
|
{
|
||||||
std::string Url;
|
std::string Url;
|
||||||
|
@ -68,8 +69,8 @@ struct ConfigDEV9
|
||||||
std::vector<ConfigHost> EthHosts;
|
std::vector<ConfigHost> EthHosts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EXTERN ConfigDEV9 config;
|
EXTERN ConfigDEV9 config;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,12 +143,19 @@ namespace InternalServers
|
||||||
void DNS_Server::LoadHostList()
|
void DNS_Server::LoadHostList()
|
||||||
{
|
{
|
||||||
hosts.clear();
|
hosts.clear();
|
||||||
for (size_t i = 0; i < config.EthHosts.size(); i++)
|
#ifndef PCSX2_CORE
|
||||||
|
for (const ConfigHost& entry : config.EthHosts)
|
||||||
{
|
{
|
||||||
ConfigHost entry = config.EthHosts[i];
|
|
||||||
if (entry.Enabled)
|
if (entry.Enabled)
|
||||||
hosts.insert_or_assign(entry.Url, *(IP_Address*)entry.Address);
|
hosts.insert_or_assign(entry.Url, *(IP_Address*)entry.Address);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
for (const Pcsx2Config::DEV9Options::HostEntry& entry : EmuConfig.DEV9.EthHosts)
|
||||||
|
{
|
||||||
|
if (entry.Enabled)
|
||||||
|
hosts.insert_or_assign(entry.Url, *(IP_Address*)entry.Address);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
UDP_Packet* DNS_Server::Recv()
|
UDP_Packet* DNS_Server::Recv()
|
||||||
|
|
|
@ -754,6 +754,47 @@ void Pcsx2Config::DEV9Options::LoadSave(SettingsWrapper& wrap)
|
||||||
SettingsWrapEnumEx(ModeDNS2, "ModeDNS2", DnsModeNames);
|
SettingsWrapEnumEx(ModeDNS2, "ModeDNS2", DnsModeNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PCSX2_CORE
|
||||||
|
if (wrap.IsLoading())
|
||||||
|
EthHosts.clear();
|
||||||
|
|
||||||
|
int hostCount = static_cast<int>(EthHosts.size());
|
||||||
|
{
|
||||||
|
SettingsWrapSection("DEV9/Eth/Hosts");
|
||||||
|
SettingsWrapEntryEx(hostCount, "Count");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < hostCount; i++)
|
||||||
|
{
|
||||||
|
std::string section = "DEV9/Eth/Hosts/Host" + std::to_string(i);
|
||||||
|
SettingsWrapSection(section.c_str());
|
||||||
|
|
||||||
|
HostEntry entry;
|
||||||
|
if (wrap.IsSaving())
|
||||||
|
entry = EthHosts[i];
|
||||||
|
|
||||||
|
SettingsWrapEntryEx(entry.Url, "Url");
|
||||||
|
SettingsWrapEntryEx(entry.Desc, "Desc");
|
||||||
|
|
||||||
|
std::string addrStr = "0.0.0.0";
|
||||||
|
if (wrap.IsSaving())
|
||||||
|
addrStr = SaveIPHelper(entry.Address);
|
||||||
|
SettingsWrapEntryEx(addrStr, "Address");
|
||||||
|
if (wrap.IsLoading())
|
||||||
|
LoadIPHelper(entry.Address, addrStr);
|
||||||
|
|
||||||
|
SettingsWrapEntryEx(entry.Enabled, "Enabled");
|
||||||
|
|
||||||
|
if (wrap.IsLoading())
|
||||||
|
{
|
||||||
|
EthHosts.push_back(entry);
|
||||||
|
|
||||||
|
if (EthLogDNS && entry.Enabled)
|
||||||
|
Console.WriteLn("DEV9: Host entry %i: url %s mapped to %s", i, entry.Url.c_str(), addrStr.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
SettingsWrapSection("DEV9/Hdd");
|
SettingsWrapSection("DEV9/Hdd");
|
||||||
SettingsWrapEntry(HddEnable);
|
SettingsWrapEntry(HddEnable);
|
||||||
|
|
|
@ -151,7 +151,6 @@
|
||||||
<ClCompile Include="DEV9\ATA\ATA_State.cpp" />
|
<ClCompile Include="DEV9\ATA\ATA_State.cpp" />
|
||||||
<ClCompile Include="DEV9\ATA\ATA_Transfer.cpp" />
|
<ClCompile Include="DEV9\ATA\ATA_Transfer.cpp" />
|
||||||
<ClCompile Include="DEV9\ATA\HddCreate.cpp" />
|
<ClCompile Include="DEV9\ATA\HddCreate.cpp" />
|
||||||
<ClCompile Include="DEV9\DEV9Config.cpp" />
|
|
||||||
<ClCompile Include="DEV9\DEV9.cpp" />
|
<ClCompile Include="DEV9\DEV9.cpp" />
|
||||||
<ClCompile Include="DEV9\flash.cpp" />
|
<ClCompile Include="DEV9\flash.cpp" />
|
||||||
<ClCompile Include="DEV9\InternalServers\DHCP_Server.cpp" />
|
<ClCompile Include="DEV9\InternalServers\DHCP_Server.cpp" />
|
||||||
|
@ -452,7 +451,6 @@
|
||||||
<ClInclude Include="DebugTools\SymbolMap.h" />
|
<ClInclude Include="DebugTools\SymbolMap.h" />
|
||||||
<ClInclude Include="DEV9\ATA\ATA.h" />
|
<ClInclude Include="DEV9\ATA\ATA.h" />
|
||||||
<ClInclude Include="DEV9\ATA\HddCreate.h" />
|
<ClInclude Include="DEV9\ATA\HddCreate.h" />
|
||||||
<ClInclude Include="DEV9\DEV9Config.h" />
|
|
||||||
<ClInclude Include="DEV9\DEV9.h" />
|
<ClInclude Include="DEV9\DEV9.h" />
|
||||||
<ClInclude Include="DEV9\InternalServers\DHCP_Server.h" />
|
<ClInclude Include="DEV9\InternalServers\DHCP_Server.h" />
|
||||||
<ClInclude Include="DEV9\InternalServers\DNS_Logger.h" />
|
<ClInclude Include="DEV9\InternalServers\DNS_Logger.h" />
|
||||||
|
|
|
@ -863,9 +863,6 @@
|
||||||
<ClCompile Include="DEV9\ATA\HddCreate.cpp">
|
<ClCompile Include="DEV9\ATA\HddCreate.cpp">
|
||||||
<Filter>System\Ps2\DEV9\ATA</Filter>
|
<Filter>System\Ps2\DEV9\ATA</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="DEV9\DEV9Config.cpp">
|
|
||||||
<Filter>System\Ps2\DEV9</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="DEV9\DEV9.cpp">
|
<ClCompile Include="DEV9\DEV9.cpp">
|
||||||
<Filter>System\Ps2\DEV9</Filter>
|
<Filter>System\Ps2\DEV9</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -1607,9 +1604,6 @@
|
||||||
<ClInclude Include="DEV9\ATA\HddCreate.h">
|
<ClInclude Include="DEV9\ATA\HddCreate.h">
|
||||||
<Filter>System\Ps2\DEV9\ATA</Filter>
|
<Filter>System\Ps2\DEV9\ATA</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="DEV9\DEV9Config.h">
|
|
||||||
<Filter>System\Ps2\DEV9</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="DEV9\DEV9.h">
|
<ClInclude Include="DEV9\DEV9.h">
|
||||||
<Filter>System\Ps2\DEV9</Filter>
|
<Filter>System\Ps2\DEV9</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
Loading…
Reference in New Issue