On Thu Feb 27 10:01:08 2025 +0000, eric pouech wrote:
> 1) concerning the mode for waiting a key,
> * ENABLE_PROCESS_INPUT is already set... default mode is 0x1f7 (so all
> flags except ENABLE_WINDOW_INPUT and ENABLE_VIRTUAL_TERMINAL_PROCESSING)
> * so IMO you just need to clear the ENABLE_LINE_INPUT flag to get key
> press without wating for end of line
> 2) for ctrl-c handling
> * likely the ctrl-c is reported through the ctrl-c handler and it's not
> clear to me if native does break the read operation in this case and
> whether we should wait on both read operation & ctrl-c event
I'll answer #2 first:
Under Windows, Ctrl-C definitely does break out of a DIR /P pause. Regarding the second part, I completely agree that the proper way to handle this would be to wait on both input and the Ctrl-C event. I have tried this. You may recall in an earlier iteration of my changes for a prior merge request, I left some code commented out which I then removed after you raised issue with it. This code was a call to WaitForMultipleObjects, waiting on both the input handle and the Ctrl-C event. The problem here which I believe I had stated at the time is that with Wine, the input handle is always signaled, even if there is no input waiting. The result was that the wait was always being satisfied immediately and DIR /P was not pausing at all. So that approach was abandoned in favor of what we have now.
#1:
This code here is based on the previous code for WCMD_Pause. That code was setting console mode flags to 0. I'm guessing that PAUSE has operated this way for many years. My changes use the new WCMD_wait_for_input for both PAUSE and DIR /P, and I did not want to break PAUSE behavior. Further, ENABLE_ECHO_INPUT is on by default, and counter to Microsoft's docs for SetConsoleMode, on Wine the character is echoed even if ENABLE_LINE_INPUT is disabled. The end result here is that DIR /P was echoing the character that the user pressed, whereas Windows does not exhibit that behavior.
All that said, based on shortcomings in Wine that I discuss above, I believe that my changes here are currently the best approach.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7400#note_96130
This is the refactoring of the tests in !7160. I submit a new seperate MR because I want to get the tests upstreamed first, otherwise making changes to tests patches needs rebasing the implementation patches. So plz review the tests MR first.
--
v2: mfreadwrite/tests: Test sample processing for writer.
mfreadwrite/tests: Test AddStream and SetInputMediaType for writer.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7332
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`.
--
v5: dinput/tests: Fix the 3-axis joystick descriptor
winebus: Get the number of haptic axes from SDL
winebus: Support creation of arbitrary number of PID axes
https://gitlab.winehq.org/wine/wine/-/merge_requests/7422
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`.
--
v4: dinput/tests: Fix the 3-axis joystick descriptor
winebus: Get the number of haptic axes from SDL
winebus: Support creation of arbitrary number of PID axes
https://gitlab.winehq.org/wine/wine/-/merge_requests/7422
--
v5: d3dx9: Link versions 42 and 43 to the corresponding d3dcompiler DLL.
d3dx9: Reimplement D3DXCompileShader() for versions before 42.
d3dcompiler: Use D3DCompile2VKD3D() from vkd3d-utils.
d3dcompiler: Use D3DPreprocess() from vkd3d-utils.
vkd3d: Import vkd3d-utils.
d3dx9/tests: Test implicit truncation warnings.
d3dx9/tests: Define D3DX_SDK_VERSION=36 for d3dx9_36.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5814
On Thu Feb 27 10:01:08 2025 +0000, Joe Souza wrote:
> OK, latest change should fix it. Key was adding ENABLE_PROCESSED_INPUT
> in the call to SetConsoleMode. However, although this now allows Ctrl-C
> to break out of dir /p prompts, the user is still required to press a
> key to exit. This seems like a bug in wine to me. I haven't tried
> similar code on Windows and I don't have time to investigate further at
> the moment.
1) concerning the mode for waiting a key,
* ENABLE_PROCESS_INPUT is already set... default mode is 0x1f7 (so all flags except ENABLE_WINDOW_INPUT and ENABLE_VIRTUAL_TERMINAL_PROCESSING)
* so IMO you just need to clear the ENABLE_LINE_INPUT flag to get key press without wating for end of line
2) for ctrl-c handling
* likely the ctrl-c is reported through the ctrl-c handler and it's not clear to me if native does break the read operation in this case and whether we should wait on both read operation & ctrl-c event
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7400#note_96106
This PR updates the behaviour of `NtQueryDirectoryFile`, bringing it in line with current Windows behaviour. The need for this update was discovered when attempting to build the Unreal Engine with MSVC under Wine. In certain cases conditional include statements do not behave as expected, due to MSVC depending on undocumented behaviour of `NtQueryDirectoryFile`.
We ran tests on multiple versions of Windows, and discovered that the behaviour has changed since the original Wine implementation, but the documentation has not. The source code for our test tool, and a set of results can be found [here](https://github.com/TensorWorks/NtQueryDirectoryFile-Test). As of Windows 8, calling `NtQueryDirectoryFile` with a re-used handle, a new mask, and setting the `RestartScan` flag to True, causes the cached results to be erased and a new scan to be performed with the updated mask. Currently, Wine performs as did earlier versions of Windows, where the changed mask is ignored, and the cache is reused. This can cause `NtQueryDirectoryFile` under Wine to falsely report that files exist, when they do not.
This PR corrects this behaviour, invalidating the cache when required. Implementing this exposed further undocumented behaviour of `NtQueryDirectoryFile`, where a search for a non-existent file will return either `STATUS_NO_MORE_FILES` or `STATUS_NO_SUCH_FILE`, depending on whether or not the handle had been previously used regardless of the value of `RestartScan`. This was reflected in a `winetest` which allowed for the response to be either `STATUS_SUCCESS` or `STATUS_NO_MORE_FILES`.
This patch also adds unit tests for the new behaviour of `NtQueryDirectoryFile`. These tests pass when running `winetest` under Windows, and under Wine with these changes in place, but they will fail under older versions of Wine. If run under older versions of Windows the test suite will detect that this functionality is not supported, and will not run the updated tests.
--
v14: ntdll.dll: Update NtQueryDirectoryFile to align with current Windows behaviour
ntdll: Test updated NtQueryDirectoryFile mask reset behaviour
https://gitlab.winehq.org/wine/wine/-/merge_requests/6904