Merge pull request #12355 from fuzziqersoftware/tapserver-modem-adapter

Implement tapserver-based modem adapter
This commit is contained in:
Admiral H. Curtiss
2024-03-22 02:47:06 +01:00
committed by GitHub
23 changed files with 1283 additions and 161 deletions

View File

@ -48,6 +48,32 @@ void BroadbandAdapterSettingsDialog::InitControls()
window_title = tr("Broadband Adapter MAC Address");
break;
case Type::TapServer:
case Type::ModemTapServer:
{
const bool is_modem = (m_bba_type == Type::ModemTapServer);
current_address =
QString::fromStdString(Config::Get(is_modem ? Config::MAIN_MODEM_TAPSERVER_DESTINATION :
Config::MAIN_BBA_TAPSERVER_DESTINATION));
#ifdef _WIN32
address_label = new QLabel(tr("Destination (address:port):"));
address_placeholder = QStringLiteral("");
description = new QLabel(
tr("Enter the IP address and port of the tapserver instance you want to connect to."));
#else
address_label = new QLabel(tr("Destination (UNIX socket path or address:port):"));
address_placeholder =
is_modem ? QStringLiteral(u"/tmp/dolphin-modem-tap") : QStringLiteral(u"/tmp/dolphin-tap");
description =
new QLabel(tr("The default value \"%1\" will work with a local tapserver and newserv."
" You can also enter a network location (address:port) to connect to a "
"remote tapserver.")
.arg(address_placeholder));
#endif
window_title = tr("BBA destination address");
break;
}
case Type::BuiltIn:
address_label = new QLabel(tr("Enter the DNS server to use:"));
address_placeholder = QStringLiteral("8.8.8.8");
@ -114,6 +140,12 @@ void BroadbandAdapterSettingsDialog::SaveAddress()
Config::SetBaseOrCurrent(Config::MAIN_BBA_MAC, bba_new_address);
break;
}
case Type::TapServer:
Config::SetBaseOrCurrent(Config::MAIN_BBA_TAPSERVER_DESTINATION, bba_new_address);
break;
case Type::ModemTapServer:
Config::SetBaseOrCurrent(Config::MAIN_MODEM_TAPSERVER_DESTINATION, bba_new_address);
break;
case Type::BuiltIn:
Config::SetBaseOrCurrent(Config::MAIN_BBA_BUILTIN_DNS, bba_new_address);
break;

View File

@ -15,7 +15,9 @@ public:
{
Ethernet,
XLinkKai,
BuiltIn
TapServer,
BuiltIn,
ModemTapServer
};
explicit BroadbandAdapterSettingsDialog(QWidget* target, Type bba_type);

View File

@ -149,10 +149,9 @@ void GameCubePane::CreateWidgets()
EXIDeviceType::Dummy,
EXIDeviceType::Ethernet,
EXIDeviceType::EthernetXLink,
#ifdef __APPLE__
EXIDeviceType::EthernetTapServer,
#endif
EXIDeviceType::EthernetBuiltIn,
EXIDeviceType::ModemTapServer,
})
{
m_slot_combos[ExpansionInterface::Slot::SP1]->addItem(tr(fmt::format("{:n}", device).c_str()),
@ -355,7 +354,9 @@ void GameCubePane::UpdateButton(ExpansionInterface::Slot slot)
case ExpansionInterface::Slot::SP1:
has_config = (device == ExpansionInterface::EXIDeviceType::Ethernet ||
device == ExpansionInterface::EXIDeviceType::EthernetXLink ||
device == ExpansionInterface::EXIDeviceType::EthernetBuiltIn);
device == ExpansionInterface::EXIDeviceType::EthernetTapServer ||
device == ExpansionInterface::EXIDeviceType::EthernetBuiltIn ||
device == ExpansionInterface::EXIDeviceType::ModemTapServer);
break;
}
@ -400,6 +401,21 @@ void GameCubePane::OnConfigPressed(ExpansionInterface::Slot slot)
dialog.exec();
return;
}
case ExpansionInterface::EXIDeviceType::EthernetTapServer:
{
BroadbandAdapterSettingsDialog dialog(this, BroadbandAdapterSettingsDialog::Type::TapServer);
SetQWidgetWindowDecorations(&dialog);
dialog.exec();
return;
}
case ExpansionInterface::EXIDeviceType::ModemTapServer:
{
BroadbandAdapterSettingsDialog dialog(this,
BroadbandAdapterSettingsDialog::Type::ModemTapServer);
SetQWidgetWindowDecorations(&dialog);
dialog.exec();
return;
}
case ExpansionInterface::EXIDeviceType::EthernetBuiltIn:
{
BroadbandAdapterSettingsDialog dialog(this, BroadbandAdapterSettingsDialog::Type::BuiltIn);