Fixed Android build warnings

This commit is contained in:
Sam Lantinga
2025-03-20 11:02:33 -07:00
parent bf7b9b020e
commit 10fae8c34b
8 changed files with 14 additions and 14 deletions

View File

@@ -22,6 +22,7 @@
#ifdef SDL_JOYSTICK_HIDAPI
#include "SDL_hidapihaptic.h"
#include "SDL_hidapihaptic_c.h"
#include "SDL3/SDL_mutex.h"
#include "SDL3/SDL_error.h"
@@ -44,7 +45,7 @@ static SDL_HIDAPI_HapticDriver *drivers[] = {
NULL
};
bool SDL_HIDAPI_HapticInit()
bool SDL_HIDAPI_HapticInit(void)
{
haptic_list_head = NULL;
haptic_list_mutex = SDL_CreateMutex();
@@ -302,4 +303,4 @@ bool SDL_HIDAPI_HapticStopAll(SDL_Haptic *haptic)
return device->driver->StopEffects(device);
}
#endif //SDL_JOYSTICK_HIDAPI
#endif //SDL_JOYSTICK_HIDAPI

View File

@@ -0,0 +1,48 @@
/*
Simple DirectMedia Layer
Copyright (C) 2025 Katharine Chui <katharine.chui@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
All hid command sent and effect rendering are ported from https://github.com/berarma/new-lg4ff
*/
#ifndef SDL_hidapihaptic_h_
#define SDL_hidapihaptic_h_
bool SDL_HIDAPI_HapticInit(void);
bool SDL_HIDAPI_HapticIsHidapi(SDL_Haptic *haptic);
bool SDL_HIDAPI_JoystickIsHaptic(SDL_Joystick *joystick);
bool SDL_HIDAPI_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick);
bool SDL_HIDAPI_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick);
void SDL_HIDAPI_HapticClose(SDL_Haptic *haptic);
void SDL_HIDAPI_HapticQuit(void);
int SDL_HIDAPI_HapticNewEffect(SDL_Haptic *haptic, const SDL_HapticEffect *base);
bool SDL_HIDAPI_HapticUpdateEffect(SDL_Haptic *haptic, int id, const SDL_HapticEffect *data);
bool SDL_HIDAPI_HapticRunEffect(SDL_Haptic *haptic, int id, Uint32 iterations);
bool SDL_HIDAPI_HapticStopEffect(SDL_Haptic *haptic, int id);
void SDL_HIDAPI_HapticDestroyEffect(SDL_Haptic *haptic, int id);
bool SDL_HIDAPI_HapticGetEffectStatus(SDL_Haptic *haptic, int id);
bool SDL_HIDAPI_HapticSetGain(SDL_Haptic *haptic, int gain);
bool SDL_HIDAPI_HapticSetAutocenter(SDL_Haptic *haptic, int autocenter);
bool SDL_HIDAPI_HapticPause(SDL_Haptic *haptic);
bool SDL_HIDAPI_HapticResume(SDL_Haptic *haptic);
bool SDL_HIDAPI_HapticStopAll(SDL_Haptic *haptic);
#endif //SDL_hidapihaptic_h_

View File

@@ -214,7 +214,6 @@ static Uint16 to_linux_direction(SDL_HapticDirection *src)
tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
return (Uint16)tmp;
}
break;
case SDL_HAPTIC_STEERING_AXIS:
return 0x4000;
default:
@@ -799,15 +798,15 @@ static int lg4ff_timer(struct lg4ff_device *device)
}
}
parameters[0].level = (Sint64)parameters[0].level * gain / 0xffff;
parameters[0].level = (Sint32)((Sint64)parameters[0].level * gain / 0xffff);
parameters[1].clip = parameters[1].clip * device->spring_level / 100;
parameters[2].clip = parameters[2].clip * device->damper_level / 100;
parameters[3].clip = parameters[3].clip * device->friction_level / 100;
ffb_level = abs32(parameters[0].level);
for (i = 1; i < 4; i++) {
parameters[i].k1 = (Sint64)parameters[i].k1 * gain / 0xffff;
parameters[i].k2 = (Sint64)parameters[i].k2 * gain / 0xffff;
parameters[i].k1 = (Sint32)((Sint64)parameters[i].k1 * gain / 0xffff);
parameters[i].k2 = (Sint32)((Sint64)parameters[i].k2 * gain / 0xffff);
parameters[i].clip = parameters[i].clip * gain / 0xffff;
ffb_level = (Sint32)(ffb_level + parameters[i].clip * 0x7fff / 0xffff);
}
@@ -1262,4 +1261,4 @@ SDL_HIDAPI_HapticDriver SDL_HIDAPI_HapticDriverLg4ff = {
};
#endif //SDL_HAPTIC_HIDAPI_LG4FF
#endif //SDL_JOYSTICK_HIDAPI
#endif //SDL_JOYSTICK_HIDAPI