[PATCH 3/4] joy.cpl: Consistently use the 32 buttons limit from DIJOYSTATE.

Cláudio Sampaio patola at gmail.com
Thu Oct 14 04:48:07 CDT 2021


Will that allow to later increase this limit, which is easily violated by
popular devices like the Logitech X52 Pro and some other HOTAS devices?

On Thu, Oct 14, 2021 at 9:40 AM Rémi Bernon <rbernon at codeweavers.com> wrote:

> From: Ivo Ivanov <logos128 at gmail.com>
>
> Based on a patch from Ivo Ivanov <logos128 at gmail.com>.
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51873
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>  dlls/joy.cpl/main.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
> index 1498021db66..4431669eee8 100644
> --- a/dlls/joy.cpl/main.c
> +++ b/dlls/joy.cpl/main.c
> @@ -414,7 +414,7 @@ static INT_PTR CALLBACK list_dlgproc(HWND hwnd, UINT
> msg, WPARAM wparam, LPARAM
>   * Joystick testing functions
>   *
>   */
> -static void dump_joy_state(DIJOYSTATE* st, int num_buttons)
> +static void dump_joy_state(DIJOYSTATE* st)
>  {
>      int i;
>      TRACE("Ax (% 5d,% 5d,% 5d)\n", st->lX,st->lY, st->lZ);
> @@ -423,7 +423,7 @@ static void dump_joy_state(DIJOYSTATE* st, int
> num_buttons)
>      TRACE("Pov (% 5d,% 5d,% 5d,% 5d)\n", st->rgdwPOV[0], st->rgdwPOV[1],
> st->rgdwPOV[2], st->rgdwPOV[3]);
>
>      TRACE("Buttons ");
> -    for(i=0; i < num_buttons; i++)
> +    for(i=0; i < TEST_MAX_BUTTONS; i++)
>          TRACE("  %c",st->rgbButtons[i] ? 'x' : 'o');
>      TRACE("\n");
>  }
> @@ -474,10 +474,10 @@ static DWORD WINAPI input_thread(void *param)
>
>          poll_input(&data->joysticks[data->chosen_joystick], &state);
>
> -        dump_joy_state(&state,
> data->joysticks[data->chosen_joystick].num_buttons);
> +        dump_joy_state(&state);
>
>          /* Indicate pressed buttons */
> -        for (i = 0; i <
> data->joysticks[data->chosen_joystick].num_buttons; i++)
> +        for (i = 0; i < TEST_MAX_BUTTONS; i++)
>              SendMessageW(data->graphics.buttons[i], BM_SETSTATE,
> !!state.rgbButtons[i], 0);
>
>          /* Indicate axis positions, axes showing are hardcoded for now */
> @@ -766,7 +766,7 @@ static DWORD WINAPI ff_input_thread(void *param)
>
>          SetWindowPos(data->graphics.ff_axis, 0, r.left, r.top, 0, 0,
> SWP_NOZORDER | SWP_NOSIZE);
>
> -        for (i=0; i < joy->num_buttons; i++)
> +        for (i=0; i < TEST_MAX_BUTTONS; i++)
>              if (state.rgbButtons[i])
>              {
>
>  IDirectInputEffect_SetParameters(joy->effects[chosen_effect].effect,
> dieffect, flags);
> --
> 2.33.0
>
>
>

-- 
Cláudio "Patola" Sampaio
Wrocław, Polska
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20211014/573ab19e/attachment.htm>


More information about the wine-devel mailing list