From fd9339616254d71526244a44edf51d85d5d961de Mon Sep 17 00:00:00 2001 From: TomCh Date: Sat, 17 Aug 2024 21:20:00 +0100 Subject: [PATCH] Uthernet I/II: Activate DEV SELECT I/O even if NIC interface is not valid (PR #1324) --- source/Uthernet1.cpp | 10 +++------- source/Uthernet2.cpp | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/source/Uthernet1.cpp b/source/Uthernet1.cpp index d24e64ad..4c66a548 100644 --- a/source/Uthernet1.cpp +++ b/source/Uthernet1.cpp @@ -1013,17 +1013,13 @@ void Uthernet1::InitializeIO(LPBYTE pCxRomPeripheral) { const std::string interfaceName = PCapBackend::GetRegistryInterface(m_slot); networkBackend = GetFrame().CreateNetworkBackend(interfaceName); - if (networkBackend->isValid()) - { - RegisterIoHandler(m_slot, TfeIo, TfeIo, TfeIoCxxx, TfeIoCxxx, this, NULL); - } - else + if (!networkBackend->isValid()) { // Interface doesn't exist or user picked an interface that isn't Ethernet! - // . So setup as a "null" card: I/O reads from floating bus & writes go to null - RegisterIoHandler(m_slot, IO_Null, IO_Null, TfeIoCxxx, TfeIoCxxx, this, NULL); GetFrame().FrameMessageBox("Uthernet interface isn't valid!\nReconfigure the Interface via 'Ethernet Settings'.", "Uthernet Interface", MB_ICONEXCLAMATION | MB_SETFOREGROUND); } + + RegisterIoHandler(m_slot, TfeIo, TfeIo, TfeIoCxxx, TfeIoCxxx, this, NULL); } void Uthernet1::Reset(const bool powerCycle) diff --git a/source/Uthernet2.cpp b/source/Uthernet2.cpp index 31645268..ab0d13f6 100644 --- a/source/Uthernet2.cpp +++ b/source/Uthernet2.cpp @@ -1470,17 +1470,13 @@ void Uthernet2::InitializeIO(LPBYTE pCxRomPeripheral) { const std::string interfaceName = PCapBackend::GetRegistryInterface(m_slot); myNetworkBackend = GetFrame().CreateNetworkBackend(interfaceName); - if (myNetworkBackend->isValid()) - { - RegisterIoHandler(m_slot, u2_C0, u2_C0, IO_Null, IO_Null, this, nullptr); - } - else + if (!myNetworkBackend->isValid()) { // Interface doesn't exist or user picked an interface that isn't Ethernet! - // . So setup as a "null" card: I/O reads from floating bus & writes go to null - RegisterIoHandler(m_slot, IO_Null, IO_Null, IO_Null, IO_Null, this, nullptr); GetFrame().FrameMessageBox("Uthernet II interface isn't valid!\nReconfigure the Interface via 'Ethernet Settings'.", "Uthernet Interface", MB_ICONEXCLAMATION | MB_SETFOREGROUND); } + + RegisterIoHandler(m_slot, u2_C0, u2_C0, IO_Null, IO_Null, this, nullptr); } void Uthernet2::getMACAddress(const uint32_t address, const MACAddress * & mac)