From 416085980fd4c5eae83312a57ae9b0caa6184a79 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 19 Mar 2025 19:46:16 +0100 Subject: [PATCH] dcnet: empty modem buffer on init. Allow hostname override in emu.cfg --- core/network/dcnet.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/network/dcnet.cpp b/core/network/dcnet.cpp index d2535dbe9..e09db00a6 100644 --- a/core/network/dcnet.cpp +++ b/core/network/dcnet.cpp @@ -25,6 +25,9 @@ #include "hw/bba/bba.h" #include "cfg/option.h" #include "stdclass.h" +#ifndef LIBRETRO +#include "cfg/cfg.h" +#endif #include #include @@ -481,17 +484,24 @@ void DCNetThread::run() port = "7655"; else port = "7654"; + std::string hostname = "dcnet.flyca.st"; +#ifndef LIBRETRO + hostname = cfgLoadStr("network", "DCNetServer", hostname); +#endif asio::ip::tcp::resolver resolver(*io_context); asio::error_code ec; - auto it = resolver.resolve("dcnet.flyca.st", port, ec); + auto it = resolver.resolve(hostname, port, ec); if (ec) throw FlycastException(ec.message()); asio::ip::tcp::endpoint endpoint = *it.begin(); - if (config::EmulateBBA) + if (config::EmulateBBA) { ethSocket = std::make_unique(*io_context, endpoint); - else + } + else { + toModem.clear(); pppSocket = std::make_unique(*io_context, endpoint); + } io_context->run(); } catch (const FlycastException& e) { ERROR_LOG(NETWORK, "DCNet connection error: %s", e.what());