From 10fae8c34b4a2ee7783a8f692428df309900dc27 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 20 Mar 2025 11:02:33 -0700
Subject: [PATCH] Fixed Android build warnings
---
src/haptic/SDL_haptic.c | 2 +-
src/haptic/hidapi/SDL_hidapihaptic.c | 5 +++--
src/haptic/{ => hidapi}/SDL_hidapihaptic.h | 4 ++--
src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c | 9 ++++-----
src/render/vulkan/VULKAN_PixelShader_Advanced.h | 2 +-
src/render/vulkan/VULKAN_PixelShader_Colors.h | 2 +-
src/render/vulkan/VULKAN_PixelShader_Textures.h | 2 +-
src/render/vulkan/VULKAN_VertexShader.h | 2 +-
8 files changed, 14 insertions(+), 14 deletions(-)
rename src/haptic/{ => hidapi}/SDL_hidapihaptic.h (97%)
diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c
index 8a771213ece0c..1c945252ddd4a 100644
--- a/src/haptic/SDL_haptic.c
+++ b/src/haptic/SDL_haptic.c
@@ -22,7 +22,7 @@
#include "SDL_syshaptic.h"
#ifdef SDL_JOYSTICK_HIDAPI
-#include "SDL_hidapihaptic.h"
+#include "hidapi/SDL_hidapihaptic.h"
#endif
#include "SDL_haptic_c.h"
#include "../joystick/SDL_joystick_c.h" // For SDL_IsJoystickValid
diff --git a/src/haptic/hidapi/SDL_hidapihaptic.c b/src/haptic/hidapi/SDL_hidapihaptic.c
index eec71a34dd652..309145b8a2be0 100644
--- a/src/haptic/hidapi/SDL_hidapihaptic.c
+++ b/src/haptic/hidapi/SDL_hidapihaptic.c
@@ -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
\ No newline at end of file
+#endif //SDL_JOYSTICK_HIDAPI
diff --git a/src/haptic/SDL_hidapihaptic.h b/src/haptic/hidapi/SDL_hidapihaptic.h
similarity index 97%
rename from src/haptic/SDL_hidapihaptic.h
rename to src/haptic/hidapi/SDL_hidapihaptic.h
index ad5679097de57..cc82291ebe453 100644
--- a/src/haptic/SDL_hidapihaptic.h
+++ b/src/haptic/hidapi/SDL_hidapihaptic.h
@@ -26,7 +26,7 @@
#ifndef SDL_hidapihaptic_h_
#define SDL_hidapihaptic_h_
-bool SDL_HIDAPI_HapticInit();
+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);
@@ -45,4 +45,4 @@ 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_
\ No newline at end of file
+#endif //SDL_hidapihaptic_h_
diff --git a/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c b/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c
index 0ff1544e17d34..944bcc3a07eda 100644
--- a/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c
+++ b/src/haptic/hidapi/SDL_hidapihaptic_lg4ff.c
@@ -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
\ No newline at end of file
+#endif //SDL_JOYSTICK_HIDAPI
diff --git a/src/render/vulkan/VULKAN_PixelShader_Advanced.h b/src/render/vulkan/VULKAN_PixelShader_Advanced.h
index 172c91e1c2969..171e10cd8e1fb 100644
--- a/src/render/vulkan/VULKAN_PixelShader_Advanced.h
+++ b/src/render/vulkan/VULKAN_PixelShader_Advanced.h
@@ -1,6 +1,6 @@
// 1115.0.0
#pragma once
-const uint32_t VULKAN_PixelShader_Advanced[] = {
+static const uint32_t VULKAN_PixelShader_Advanced[] = {
0x07230203,0x00010000,0x0008000b,0x000004a8,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x000001f6,0x000001f9,0x000001fd,
diff --git a/src/render/vulkan/VULKAN_PixelShader_Colors.h b/src/render/vulkan/VULKAN_PixelShader_Colors.h
index dcba93e4448c9..a7cc6d9318159 100644
--- a/src/render/vulkan/VULKAN_PixelShader_Colors.h
+++ b/src/render/vulkan/VULKAN_PixelShader_Colors.h
@@ -1,6 +1,6 @@
// 1115.0.0
#pragma once
-const uint32_t VULKAN_PixelShader_Colors[] = {
+static const uint32_t VULKAN_PixelShader_Colors[] = {
0x07230203,0x00010000,0x0008000b,0x000000a1,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000048,0x0000004c,0x00030010,
diff --git a/src/render/vulkan/VULKAN_PixelShader_Textures.h b/src/render/vulkan/VULKAN_PixelShader_Textures.h
index dae322e38157c..31cfef05a21c5 100644
--- a/src/render/vulkan/VULKAN_PixelShader_Textures.h
+++ b/src/render/vulkan/VULKAN_PixelShader_Textures.h
@@ -1,6 +1,6 @@
// 1115.0.0
#pragma once
-const uint32_t VULKAN_PixelShader_Textures[] = {
+static const uint32_t VULKAN_PixelShader_Textures[] = {
0x07230203,0x00010000,0x0008000b,0x000000a8,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000004b,0x0000004e,0x00000052,
diff --git a/src/render/vulkan/VULKAN_VertexShader.h b/src/render/vulkan/VULKAN_VertexShader.h
index 8a1c6ea29919e..45acc39a05e3c 100644
--- a/src/render/vulkan/VULKAN_VertexShader.h
+++ b/src/render/vulkan/VULKAN_VertexShader.h
@@ -1,6 +1,6 @@
// 1115.0.0
#pragma once
-const uint32_t VULKAN_VertexShader[] = {
+static const uint32_t VULKAN_VertexShader[] = {
0x07230203,0x00010000,0x0008000b,0x000000af,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000003f,0x00000043,0x00000047,