Ivo Ivanov : joy.cpl: Allow devices as steering wheels, that only support single-axis effects.
Alexandre Julliard
julliard at winehq.org
Fri Nov 19 15:45:32 CST 2021
Module: wine
Branch: master
Commit: c2235c44c5f8fedaad775c69b9a475725874bbc7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c2235c44c5f8fedaad775c69b9a475725874bbc7
Author: Ivo Ivanov <logos128 at gmail.com>
Date: Fri Nov 19 09:39:42 2021 +0100
joy.cpl: Allow devices as steering wheels, that only support single-axis effects.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51873
Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/joy.cpl/main.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index c96efb17aa3..a1308606f98 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -790,6 +790,7 @@ static BOOL CALLBACK ff_effects_callback(const DIEFFECTINFOW *pdei, void *pvRef)
DIEFFECT dieffect;
DWORD axes[2] = {DIJOFS_X, DIJOFS_Y};
int direction[2] = {0, 0};
+ int num_axes = 2;
struct Joystick *joystick = pvRef;
DIRAMPFORCE rforce;
DICONSTANTFORCE cforce;
@@ -811,8 +812,8 @@ static BOOL CALLBACK ff_effects_callback(const DIEFFECTINFOW *pdei, void *pvRef)
dieffect.dwSize = sizeof(dieffect);
dieffect.dwFlags = DIEFF_CARTESIAN|DIEFF_OBJECTOFFSETS;
dieffect.dwDuration = FF_PLAY_TIME;
+ dieffect.dwGain = DI_FFNOMINALMAX;
- dieffect.cAxes = 2;
dieffect.rgdwAxes = axes;
dieffect.rglDirection = direction;
@@ -865,8 +866,14 @@ static BOOL CALLBACK ff_effects_callback(const DIEFFECTINFOW *pdei, void *pvRef)
dieffect.dwFlags |= DIEP_TYPESPECIFICPARAMS;
}
- hr = IDirectInputDevice2_CreateEffect(
- joystick->device, &pdei->guid, &dieffect, &joystick->effects[joystick->cur_effect].effect, NULL);
+ do
+ {
+ dieffect.cAxes = num_axes--;
+ hr = IDirectInputDevice2_CreateEffect(
+ joystick->device, &pdei->guid, &dieffect, &joystick->effects[joystick->cur_effect].effect, NULL);
+ }
+ while (FAILED(hr) && num_axes);
+
if (FAILED(hr))
{
FIXME("Failed to create effect with type %s, hr %#x\n", debugstr_guid(&pdei->guid), hr);
More information about the wine-cvs
mailing list