diff --git a/src/osdep/gui/PanelIOPorts.cpp b/src/osdep/gui/PanelIOPorts.cpp index ca1c2efe3..73520ec7e 100644 --- a/src/osdep/gui/PanelIOPorts.cpp +++ b/src/osdep/gui/PanelIOPorts.cpp @@ -64,7 +64,18 @@ class IOActionListener : public gcn::ActionListener else { const auto port_name = serial_ports_list.getElementAt(selected); - _sntprintf(changed_prefs.sername, 256, "%s", port_name.c_str()); + if (port_name == "Amiberry inter-process serial port") + { + _sntprintf(changed_prefs.sername, 256, "%s", SERIAL_INTERNAL); + } + else if (port_name == "Amiberry loopback serial port") + { + _sntprintf(changed_prefs.sername, 256, "%s", SERIAL_LOOPBACK); + } + else + { + _sntprintf(changed_prefs.sername, 256, "%s", port_name.c_str()); + } changed_prefs.use_serial = true; } } @@ -154,16 +165,30 @@ void InitPanelIO(const config_category& category) serial_ports_list.clear(); serial_ports_list.add("none"); for(const auto& i : serial_ports) { - serial_ports_list.add(i); + if (i != "Amiberry inter-process serial port") + { + std::string tmp = i; + if (!shmem_serial_state()) + shmem_serial_create(); + switch (shmem_serial_state()) + { + case 1: + tmp += " [Master]"; + break; + case 2: + tmp += " [Slave]"; + break; + } + serial_ports_list.add(tmp); + } + else + serial_ports_list.add(i); } - // Add TCP ports also - serial_ports_list.add("TCP://0.0.0.0:1234"); - serial_ports_list.add("TCP://0.0.0.0:1234/wait"); midi_in_ports_list.clear(); midi_in_ports_list.add("none"); for(const auto& i : midi_in_ports) { - midi_in_ports_list.add(i.c_str()); + midi_in_ports_list.add(i); } midi_out_ports_list.clear(); diff --git a/src/parser.cpp b/src/parser.cpp index 3f9d1800d..989673ee2 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -519,6 +519,7 @@ int enumserialports (void) } else { + serial_ports.clear(); for (int i = 0; port_list[i] != nullptr; i++) { cnt++; @@ -530,6 +531,16 @@ int enumserialports (void) /* Free the array created by sp_list_ports(). */ sp_free_port_list(port_list); } + + serial_ports.emplace_back("Amiberry inter-process serial port"); + cnt++; + serial_ports.emplace_back("Amiberry loopback serial port"); + cnt++; + serial_ports.emplace_back("TCP://0.0.0.0:1234"); + cnt++; + serial_ports.emplace_back("TCP://0.0.0.0:1234/wait"); + cnt++; + write_log(_T("Port enumeration end\n")); return cnt; }