diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index d9cfffadd..431f3f644 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -652,7 +652,7 @@ class EventHandler ; // The event(s) assigned to each combination event - BSPF::array2D myComboTable{Event::NoType}; + BSPF::array2D myComboTable; // Holds static strings for the remap menu (emulation and menu events) using EmulActionList = std::array; diff --git a/src/windows/SerialPortWINDOWS.cxx b/src/windows/SerialPortWINDOWS.cxx index c0e64ffa1..160a0c096 100644 --- a/src/windows/SerialPortWINDOWS.cxx +++ b/src/windows/SerialPortWINDOWS.cxx @@ -129,12 +129,13 @@ StringList SerialPortWINDOWS::portNames() &numValues, NULL, NULL, NULL, NULL); if (result == ERROR_SUCCESS) { - DWORD type = 0; - DWORD deviceNameLen = 2047; - DWORD friendlyNameLen = 31; - for (DWORD i = 0; i < numValues; ++i) { + // must be reset to work in a loop! + DWORD type = 0; + DWORD deviceNameLen = 2047; + DWORD friendlyNameLen = 31; + result = RegEnumValue(hKey, i, deviceName, &deviceNameLen, NULL, &type, (LPBYTE)friendlyName, &friendlyNameLen); @@ -145,5 +146,12 @@ StringList SerialPortWINDOWS::portNames() } RegCloseKey(hKey); + std::sort(ports.begin(), ports.end(), + [](const std::string& a, const std::string& b) + { + return a < b; + } + ); + return ports; }