Skip to content

Commit

Permalink
Added config file override for DreamcastControllerUsb Serial Device
Browse files Browse the repository at this point in the history
  • Loading branch information
kosekmi authored and flyinghead committed Jan 27, 2025
1 parent b70c279 commit 3410472
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/sdl/dreamconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,18 @@ void DreamConn::connect()

serial_handler = asio::serial_port(io_context);

// select first available serial device
std::string serial_device = getFirstSerialDevice();
std::string serial_device = "";

// use user-configured serial device if available, fallback to first available
if (cfgLoadStr("input", "DreamcastControllerUsbSerialDevice", "default") != "default") {
serial_device = cfgLoadStr("input", "DreamcastControllerUsbSerialDevice", "default");
INFO_LOG(INPUT, "DreamcastController[%d] connecting to user-configured serial device: %s", bus, serial_device.c_str());
}
else
{
serial_device = getFirstSerialDevice();
INFO_LOG(INPUT, "DreamcastController[%d] connecting to autoselected serial device: %s", bus, serial_device.c_str());
}

serial_handler.open(serial_device, ec);

Expand Down

0 comments on commit 3410472

Please sign in to comment.