Required by Cyberpunk 2077 for 4.0 audio setups (`PKEY_AudioEndpoint_PhysicalSpeakers` is `SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT`) as it then dereferences the device path property (`{b3f8fa53-0004-438e-9003-51a46e139bfc},2`) without checking if is is non-NULL.
The patches use `{1}.ROOT\MEDIA%04u` which is used on Windows for virtual audio devices (e.g. the ones created Voicemeeter Banana).
-- v2: winealsa.drv: Set device path for all devices. winepulse.drv: Set device path for all devices.
From: Arkadiusz Hiler ahiler@codeweavers.com
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com --- dlls/winepulse.drv/pulse.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 0e504b6b6dd..42d73db45f9 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -2207,27 +2207,26 @@ static BOOL get_device_path(PhysDevice *dev, struct get_prop_value_params *param { const GUID *guid = params->guid; UINT serial_number; - const char *fmt; char path[128]; int len;
+ /* As hardly any audio devices have serial numbers, Windows instead + appears to use a persistent random number. We emulate this here + by instead using the last 8 hex digits of the GUID. */ + serial_number = (guid->Data4[4] << 24) | (guid->Data4[5] << 16) | (guid->Data4[6] << 8) | guid->Data4[7]; + switch (dev->bus_type) { case phys_device_bus_pci: - fmt = "{1}.HDAUDIO\FUNC_01&VEN_%04X&DEV_%04X\%u&%08X"; + len = sprintf(path, "{1}.HDAUDIO\FUNC_01&VEN_%04X&DEV_%04X\%u&%08X", dev->vendor_id, dev->product_id, dev->index, serial_number); break; case phys_device_bus_usb: - fmt = "{1}.USB\VID_%04X&PID_%04X\%u&%08X"; + len = sprintf(path, "{1}.USB\VID_%04X&PID_%04X\%u&%08X", dev->vendor_id, dev->product_id, dev->index, serial_number); break; default: - return FALSE; + len = sprintf(path, "{1}.ROOT\MEDIA\%04u", dev->index); + break; }
- /* As hardly any audio devices have serial numbers, Windows instead - appears to use a persistent random number. We emulate this here - by instead using the last 8 hex digits of the GUID. */ - serial_number = (guid->Data4[4] << 24) | (guid->Data4[5] << 16) | (guid->Data4[6] << 8) | guid->Data4[7]; - - len = sprintf(path, fmt, dev->vendor_id, dev->product_id, dev->index, serial_number); ntdll_umbstowcs(path, len + 1, params->wstr, ARRAY_SIZE(params->wstr));
params->vt = VT_LPWSTR;
From: Arkadiusz Hiler ahiler@codeweavers.com
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com --- dlls/winealsa.drv/alsa.c | 74 ++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 41 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index b91606603a2..8439262428f 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -2318,21 +2318,21 @@ static NTSTATUS get_prop_value(void *args)
if(IsEqualPropertyKey(*prop, devicepath_key)) { + enum AudioDeviceConnectionType connection = AudioDeviceConnectionType_Unknown; + USHORT vendor_id = 0, product_id = 0; char uevent[MAX_PATH]; - FILE *fuevent; + FILE *fuevent = NULL; int card, device; + UINT serial_number; + char buf[128]; + int len;
- /* only implemented for identifiable devices, i.e. not "default" */ - if(!sscanf(name, "plughw:%u,%u", &card, &device)){ - params->result = E_NOTIMPL; - return STATUS_SUCCESS; + if(sscanf(name, "plughw:%u,%u", &card, &device)){ + sprintf(uevent, "/sys/class/sound/card%u/device/uevent", card); + fuevent = fopen(uevent, "r"); } - sprintf(uevent, "/sys/class/sound/card%u/device/uevent", card); - fuevent = fopen(uevent, "r");
if(fuevent){ - enum AudioDeviceConnectionType connection = AudioDeviceConnectionType_Unknown; - USHORT vendor_id = 0, product_id = 0; char line[256];
while (fgets(line, sizeof(line), fuevent)) { @@ -2365,41 +2365,33 @@ static NTSTATUS get_prop_value(void *args) }
fclose(fuevent); + }
- if(connection == AudioDeviceConnectionType_USB || connection == AudioDeviceConnectionType_PCI){ - UINT serial_number; - char buf[128]; - int len; - - /* As hardly any audio devices have serial numbers, Windows instead - appears to use a persistent random number. We emulate this here - by instead using the last 8 hex digits of the GUID. */ - serial_number = (guid->Data4[4] << 24) | (guid->Data4[5] << 16) | (guid->Data4[6] << 8) | guid->Data4[7]; - - if(connection == AudioDeviceConnectionType_USB) - sprintf(buf, "{1}.USB\VID_%04X&PID_%04X\%u&%08X", - vendor_id, product_id, device, serial_number); - else /* AudioDeviceConnectionType_PCI */ - sprintf(buf, "{1}.HDAUDIO\FUNC_01&VEN_%04X&DEV_%04X\%u&%08X", - vendor_id, product_id, device, serial_number); - - len = strlen(buf) + 1; - if(*params->buffer_size < len * sizeof(WCHAR)){ - params->result = E_NOT_SUFFICIENT_BUFFER; - *params->buffer_size = len * sizeof(WCHAR); - return STATUS_SUCCESS; - } - out->vt = VT_LPWSTR; - out->pwszVal = params->buffer; - ntdll_umbstowcs(buf, len, out->pwszVal, len); - params->result = S_OK; - return STATUS_SUCCESS; - } - }else{ - WARN("Could not open %s for reading\n", uevent); - params->result = E_NOTIMPL; + /* As hardly any audio devices have serial numbers, Windows instead + appears to use a persistent random number. We emulate this here + by instead using the last 8 hex digits of the GUID. */ + serial_number = (guid->Data4[4] << 24) | (guid->Data4[5] << 16) | (guid->Data4[6] << 8) | guid->Data4[7]; + + if(connection == AudioDeviceConnectionType_USB) + sprintf(buf, "{1}.USB\VID_%04X&PID_%04X\%u&%08X", + vendor_id, product_id, device, serial_number); + else if (connection == AudioDeviceConnectionType_PCI) + sprintf(buf, "{1}.HDAUDIO\FUNC_01&VEN_%04X&DEV_%04X\%u&%08X", + vendor_id, product_id, device, serial_number); + else + sprintf(buf, "{1}.ROOT\MEDIA\%04u", serial_number & 0x1FF); + + len = strlen(buf) + 1; + if(*params->buffer_size < len * sizeof(WCHAR)){ + params->result = E_NOT_SUFFICIENT_BUFFER; + *params->buffer_size = len * sizeof(WCHAR); return STATUS_SUCCESS; } + out->vt = VT_LPWSTR; + out->pwszVal = params->buffer; + ntdll_umbstowcs(buf, len, out->pwszVal, len); + params->result = S_OK; + return STATUS_SUCCESS; } else if (flow != eCapture && IsEqualPropertyKey(*prop, PKEY_AudioEndpoint_PhysicalSpeakers)) { unsigned int num_speakers, card, device; char hwname[255];
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=117775
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: po/ar.po:68 error: patch failed: po/ast.po:67 error: patch failed: po/bg.po:67 error: patch failed: po/ca.po:66 error: patch failed: po/cs.po:71 error: patch failed: po/da.po:70 error: patch failed: po/de.po:65 error: patch failed: po/el.po:64 error: patch failed: po/en.po:64 error: patch failed: po/en_US.po:64 error: patch failed: po/eo.po:75 error: patch failed: po/es.po:65 error: patch failed: po/fa.po:62 error: patch failed: po/fi.po:63 error: patch failed: po/fr.po:64 error: patch failed: po/he.po:76 error: patch failed: po/hi.po:61 error: patch failed: po/hr.po:70 error: patch failed: po/hu.po:70 error: patch failed: po/it.po:75 error: patch failed: po/ja.po:65 error: patch failed: po/ko.po:63 error: patch failed: po/lt.po:66 error: patch failed: po/ml.po:65 error: patch failed: po/nb_NO.po:65 error: patch failed: po/nl.po:64 error: patch failed: po/or.po:61 error: patch failed: po/pa.po:61 error: patch failed: po/pl.po:69 error: patch failed: po/pt_BR.po:65 error: patch failed: po/pt_PT.po:81 error: patch failed: po/rm.po:62 error: patch failed: po/ro.po:70 error: patch failed: po/ru.po:71 error: patch failed: po/si.po:72 error: patch failed: po/sk.po:75 error: patch failed: po/sl.po:75 error: patch failed: po/sr_RS@cyrillic.po:70 error: patch failed: po/sr_RS@latin.po:70 error: patch failed: po/sv.po:71 error: patch failed: po/ta.po:63 error: patch failed: po/te.po:61 error: patch failed: po/th.po:65 error: patch failed: po/tr.po:72 error: patch failed: po/uk.po:63 error: patch failed: po/wa.po:63 error: patch failed: po/wine.pot:56 error: patch failed: po/zh_CN.po:62 error: patch failed: po/zh_TW.po:62 error: patch failed: programs/regedit/edit.c:86 error: patch failed: programs/regedit/framewnd.c:158 error: patch failed: programs/regedit/listview.c:245 error: patch failed: programs/regedit/regedit.rc:48 error: patch failed: programs/regedit/resource.h:146 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: po/ar.po:68 error: patch failed: po/ast.po:67 error: patch failed: po/bg.po:67 error: patch failed: po/ca.po:66 error: patch failed: po/cs.po:71 error: patch failed: po/da.po:70 error: patch failed: po/de.po:65 error: patch failed: po/el.po:64 error: patch failed: po/en.po:64 error: patch failed: po/en_US.po:64 error: patch failed: po/eo.po:75 error: patch failed: po/es.po:65 error: patch failed: po/fa.po:62 error: patch failed: po/fi.po:63 error: patch failed: po/fr.po:64 error: patch failed: po/he.po:76 error: patch failed: po/hi.po:61 error: patch failed: po/hr.po:70 error: patch failed: po/hu.po:70 error: patch failed: po/it.po:75 error: patch failed: po/ja.po:65 error: patch failed: po/ko.po:63 error: patch failed: po/lt.po:66 error: patch failed: po/ml.po:65 error: patch failed: po/nb_NO.po:65 error: patch failed: po/nl.po:64 error: patch failed: po/or.po:61 error: patch failed: po/pa.po:61 error: patch failed: po/pl.po:69 error: patch failed: po/pt_BR.po:65 error: patch failed: po/pt_PT.po:81 error: patch failed: po/rm.po:62 error: patch failed: po/ro.po:70 error: patch failed: po/ru.po:71 error: patch failed: po/si.po:72 error: patch failed: po/sk.po:75 error: patch failed: po/sl.po:75 error: patch failed: po/sr_RS@cyrillic.po:70 error: patch failed: po/sr_RS@latin.po:70 error: patch failed: po/sv.po:71 error: patch failed: po/ta.po:63 error: patch failed: po/te.po:61 error: patch failed: po/th.po:65 error: patch failed: po/tr.po:72 error: patch failed: po/uk.po:63 error: patch failed: po/wa.po:63 error: patch failed: po/wine.pot:56 error: patch failed: po/zh_CN.po:62 error: patch failed: po/zh_TW.po:62 error: patch failed: programs/regedit/edit.c:86 error: patch failed: programs/regedit/framewnd.c:158 error: patch failed: programs/regedit/listview.c:245 error: patch failed: programs/regedit/regedit.rc:48 error: patch failed: programs/regedit/resource.h:146 Task: Patch failed to apply
On Tue Jun 28 13:53:45 2022 +0000, Arek Hiler wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/325/diffs?diff_id=3536&start_sha=954f0526a68115214677e66c1bf8f8fbdfa6bce8#fe57e8f6c5922cbec0bd8abda9ed5f8e82a50895_2383_2382)
accidental leftover from testing, removed
This merge request was approved by Andrew Eikum.