Related Wine issue: https://bugs.winehq.org/show_bug.cgi?id=52714
I'm starting work on updating/extending Linux force feedback API and one of my goals is to expose the number and an array that contains the device's ffb-enabled axes. As I'm mainly working with USB PID driver, I already have a POC of obtaining this data.
What prompted this is that currently Wine always creates virtual joysticks with two PID ffb axes. This causes issues with [Richard Burns Rally](https://github.com/ValveSoftware/Proton/issues/6702#issuecomment-267…, as this game incorrectly initializes a `CONSTANT_FORCE` effect with all the FFB axes that contain `DIDOI_FFACTUATOR` flag and then trying to update `cAxes` and `rgdwAxes` values which leads to `DIERR_INVALIDPARAM`.
Now, this flag is set by wine while enumerating virtual device's axes and while `(axis index < FFB axes)`, flag is applied. This means, that every device which has FFB functionality and at least two axes, will report FFB on `X`, `Y`.
While updated API would mean a lot of steering wheels would correctly report only 1 axis, a lot of USB PID wheels still include `X` and `Y` in their `AXES_ENABLE` and `DIRECTION` usages. This, again, would lead to broken FFB (in affected games).
On Windows, there's a possibility of overwriting some joystick capabilities with registry entries, which ends up removing `DIDOI_FFACTUATOR` flag from a selected axis. This doesn't work in Wine.
This MR allows Wine to add an arbitrary number (up to `PID_AXES_MAX`) of axes to the PID descriptor, based on the value of Haptic Axes from SDL or from Linux FF api in the future (I'm working on it). Additionally, to work around RBR and other games with similar, wrong FFB handling, I introduced a [hint](https://github.com/libsdl-org/SDL/issues/12341) to SDL that allows a dynamic overwrite of the number of haptic axes. For the Linux API, I'll figure out a nice way to override when the number of axes will be exposed.
With these changes, I was able to successfully get force feedback on my Moza Racing R9 with all axes usable. With additional traces in the dinput code, I confirmed that with one axis defined in the PID descriptor, the game created a constant force effect with just one axis and `cAxes = 1`.
--
v8: dinput/tests: Add tests for 6-axis ff joystick
winebus: Get the number of haptic axes from SDL
winebus: Support creation of arbitrary number of PID axes
winebus: Use physical->num_axes to compute effect_update report size
winebus: Store the number of FFB axes of a unix_device
winebus: Use PID_AXES_MAX in unix_private.h
dinput: Use PID_AXES_MAX in joystick_hid for axes, directions, conditions
hid: Define the max number of supported PID axes
https://gitlab.winehq.org/wine/wine/-/merge_requests/7422
These tests serve to illustrate the output sample time and duration values from their respective native MFT video decoders with respect to the following circumstances:
1. When no frame rate nor input sample timestamps are provided;
2. When a frame rate is provided but there are no sample timestamps; and
3. When a frame rate is provided, but the input sample timestamps disagree with this value
It also highlights the gap in our implementation. However, I don't believe this can be fixed without first confirming the correct output from our IMFMediaStream implementations.
--
v4: mf/tests: Test timestamps in WMV decoder.
mf/tests: Test timestamps in H264 decoder.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7563
From 2/5:
```
The PE driver then broadcasts a GUID_BLUETOOTH_AUTHENTICATION_REQUEST PnP event on the newly
added WINEBTHAUTH device,
```
That should be GUID_WINEBTH_AUTHENTICATION_REQUEST.
We also need to correctly handle IRP_MJ_PNP requests for this new device.
From 4/5:
```
+ if (!addr)
+ return wine_dbg_sprintf( "%p", addr );
```
Just "(null)" seems more idiomatic.
```
+ work = CreateThreadpoolWork( tp_auth_callback_work_proc, data, NULL );
```
Why the threadpool? Why can't we call the callback right now?
```
+ struct bluetooth_auth_listener *hreg;
```
Bikeshedding, but "hreg" seems an odd variable name; why not "listener"?
```
+static DWORD bluetooth_auth_register( BOOL reg )
+{
+ DWORD ret;
+
+ if (reg)
+ {
+ ...
+ }
+ else
+ {
+ ...
+ }
+
+ return ret;
+}
```
This is what I like to call an "anti-helper". Just make this two separate functions, and probably inline at least the unregister side as it's literally two lines.
```
+ DeviceIoControl( winebth_auth, IOCTL_WINEBTH_AUTH_REGISTER, NULL, 0, NULL, 0, &bytes, NULL );
+ ret = GetLastError();
```
Don't check GetLastError() without also checking the return of DeviceIoControl(). Most functions which update the last error don't update it on success.
From 5/5:
```
SOURCES = \
+ auth.c \
device.c \
radio.c \
sdp.c
```
I really should have said something earlier, but we don't need all these different source files with less than 500 lines in each of them, especially if it's going to necessitate an extra header for helpers.
```
+ if (hreg)
+ ok( BluetoothUnregisterAuthentication( hreg ), "BluetoothUnregisterAuthentication failed: %lu\n", GetLastError() );
+ if (hreg2)
+ ok( BluetoothUnregisterAuthentication( hreg2 ), "BluetoothUnregisterAuthentication failed: %lu\n", GetLastError() );
```
You don't need the checks, you already checked those in an earlier ok().
Also, you don't want to test GetLastError() and the call at the same time, there's no sequence point between those. This is the one point where you *do* need to assign a bool to a temporary variable.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7630#note_98631
This MR adds an initial implementation of the winsock `WSALookupsService*` methods for performing Bluetooth device discovery (`LUP_CONTAINERS`).
Pending !7472, the code will also eventually support performing device inquiry scans.
--
v14: ws2_32: Implement WSALookupServiceNext for Bluetooth device discovery.
ws2_32: Implement WSALookupServiceBegin for Bluetooth device discovery.
ws2_32/tests: Add tests for Bluetooth device discovery in WSALookupServiceBegin/Next.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7542
Some console objects currently do several unique things:
* Delegate waits onto the queue of another object. This is not really a problem
for in-process waits, since we can just return the sync object for the
delegate. However, it's also unnecessary, adds to the complexity of the server
logic, and is one out of one places where this is done.
* Make the wait state dependent on the process. This is difficult to emulate
with ntsync and would require creating separate server objects for each
process, hacking into duplicate_handle.
* Fail a wait entirely in certain circumstances. This is pretty much impossible
to emulate with in-process waits.
Although ntsync has been in development for some time, I have regrettably failed
to notice these problems until now.
Fortunately, none of these behaviours happen on modern Windows. Although I/O on
unbound handles delegates to the console of the current process, the signaled
state does not. As the tests here show, the signaled state of a handle depends
on the active console of the process in which the handle was created. If that
console no longer exists, the signaled state is no longer updated [with one
rather inexplicable exception].
Crucially, in current Windows waits never fail, and the state of an object is
the same across all process which hold handles to it. Therefore this patch
brings our behaviour to closer match current Windows.
In theory these are fds and should use default_fd_signaled(). However, the
points at which the handles are signaled are completely different, and I/O does
not trigger console handles to become signaled when it normally would. Therefore
for the time being I've kept the code using custom signaled ops.
There is one other oddity related to consoles, which is the existence of
console_add_queue(), which seeks to lazily create an input thread when a console
is first waited on. This is one out of two places, after this patch, when the
wait process is hijacked (the other being message queues). Fortunately this is
easy to handle for in-process synchronization objects, by queueing the ioctl
from the callback used to retrieve the in-process synchronization object itself.
--
v4: server: Track unbound output signaled state based on its original console.
server: Track unbound input signaled state based on its original console.
server: Allow waiting on an orphaned screen buffer.
server: Use a list of screen buffers per console.
server: Fail to create an unbound input/output when there is no console.
kernel32/tests: Add more tests for orphaned console handles.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7608