mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 07:05:08 +00:00
joy.cpl: Read the effect parameters instead of storing them.
The direction and axis arrays are also not pointing to valid memory anymore.
This commit is contained in:
parent
85790d8379
commit
d9bd1c49bb
|
@ -71,7 +71,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(joycpl);
|
||||||
struct Effect
|
struct Effect
|
||||||
{
|
{
|
||||||
IDirectInputEffect *effect;
|
IDirectInputEffect *effect;
|
||||||
DIEFFECT params;
|
|
||||||
DIEFFECTINFOW info;
|
DIEFFECTINFOW info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -217,7 +216,6 @@ static BOOL CALLBACK enum_effects( const DIEFFECTINFOW *info, void *context )
|
||||||
}
|
}
|
||||||
|
|
||||||
joystick->effects[joystick->cur_effect].effect = effect;
|
joystick->effects[joystick->cur_effect].effect = effect;
|
||||||
joystick->effects[joystick->cur_effect].params = params;
|
|
||||||
joystick->effects[joystick->cur_effect].info = *info;
|
joystick->effects[joystick->cur_effect].info = *info;
|
||||||
joystick->cur_effect += 1;
|
joystick->cur_effect += 1;
|
||||||
|
|
||||||
|
@ -906,21 +904,29 @@ static DWORD WINAPI ff_input_thread(void *param)
|
||||||
int i;
|
int i;
|
||||||
struct Joystick *joy = &data->joysticks[data->chosen_joystick];
|
struct Joystick *joy = &data->joysticks[data->chosen_joystick];
|
||||||
int chosen_effect = joy->chosen_effect;
|
int chosen_effect = joy->chosen_effect;
|
||||||
DIEFFECT *dieffect;
|
|
||||||
DWORD flags = DIEP_AXES | DIEP_DIRECTION | DIEP_NORESTART;
|
DWORD flags = DIEP_AXES | DIEP_DIRECTION | DIEP_NORESTART;
|
||||||
|
LONG direction[3] = {0};
|
||||||
|
DWORD axes[3] = {0};
|
||||||
|
DIEFFECT params =
|
||||||
|
{
|
||||||
|
.dwSize = sizeof(DIEFFECT),
|
||||||
|
.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS,
|
||||||
|
.rglDirection = direction,
|
||||||
|
.rgdwAxes = axes,
|
||||||
|
.cAxes = 3,
|
||||||
|
};
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
Sleep(TEST_POLL_TIME);
|
Sleep(TEST_POLL_TIME);
|
||||||
|
|
||||||
/* Skip this if we have no effects */
|
/* Skip this if we have no effects */
|
||||||
if (joy->num_effects == 0 || chosen_effect < 0) continue;
|
if (joy->num_effects == 0 || chosen_effect < 0 || !joy->effects[chosen_effect].effect) continue;
|
||||||
|
|
||||||
poll_input(joy, &state);
|
poll_input(joy, &state);
|
||||||
|
|
||||||
/* Set ff parameters and draw the axis */
|
IDirectInputEffect_GetParameters( joy->effects[chosen_effect].effect, ¶ms, flags );
|
||||||
dieffect = &joy->effects[chosen_effect].params;
|
params.rgdwAxes[0] = state.lX;
|
||||||
dieffect->rgdwAxes[0] = state.lX;
|
params.rgdwAxes[1] = state.lY;
|
||||||
dieffect->rgdwAxes[1] = state.lY;
|
|
||||||
|
|
||||||
r.left = FF_AXIS_X + state.lX;
|
r.left = FF_AXIS_X + state.lX;
|
||||||
r.top = FF_AXIS_Y + state.lY;
|
r.top = FF_AXIS_Y + state.lY;
|
||||||
|
@ -932,7 +938,7 @@ static DWORD WINAPI ff_input_thread(void *param)
|
||||||
for (i=0; i < TEST_MAX_BUTTONS; i++)
|
for (i=0; i < TEST_MAX_BUTTONS; i++)
|
||||||
if (state.rgbButtons[i])
|
if (state.rgbButtons[i])
|
||||||
{
|
{
|
||||||
IDirectInputEffect_SetParameters(joy->effects[chosen_effect].effect, dieffect, flags);
|
IDirectInputEffect_SetParameters( joy->effects[chosen_effect].effect, ¶ms, flags );
|
||||||
IDirectInputEffect_Start(joy->effects[chosen_effect].effect, 1, 0);
|
IDirectInputEffect_Start(joy->effects[chosen_effect].effect, 1, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue