mirror of https://github.com/stella-emu/stella.git
fixed Windows serial port names list
This commit is contained in:
parent
12ccc2d15c
commit
e2b8e0f2a9
|
@ -652,7 +652,7 @@ class EventHandler
|
|||
;
|
||||
|
||||
// The event(s) assigned to each combination event
|
||||
BSPF::array2D<Event::Type, COMBO_SIZE, EVENTS_PER_COMBO> myComboTable{Event::NoType};
|
||||
BSPF::array2D<Event::Type, COMBO_SIZE, EVENTS_PER_COMBO> myComboTable;
|
||||
|
||||
// Holds static strings for the remap menu (emulation and menu events)
|
||||
using EmulActionList = std::array<ActionList, EMUL_ACTIONLIST_SIZE>;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue