SDL: Fixed warning C4244: 'function': conversion from 'Uint16' to 'Uint8', possible loss of data

From 8582bdaab8690bd7b507277723d9342de7c6558b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 10 May 2024 16:09:11 -0700
Subject: [PATCH] Fixed warning C4244: 'function': conversion from 'Uint16' to
 'Uint8', possible loss of data

---
 src/joystick/virtual/SDL_virtualjoystick.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/joystick/virtual/SDL_virtualjoystick.c b/src/joystick/virtual/SDL_virtualjoystick.c
index 6165badde4d43..edbc157c87abd 100644
--- a/src/joystick/virtual/SDL_virtualjoystick.c
+++ b/src/joystick/virtual/SDL_virtualjoystick.c
@@ -715,27 +715,27 @@ static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
     }
 
     if (hwdata->changes & AXES_CHANGED) {
-        for (Uint16 i = 0; i < hwdata->desc.naxes; ++i) {
+        for (Uint8 i = 0; i < hwdata->desc.naxes; ++i) {
             SDL_SendJoystickAxis(timestamp, joystick, i, hwdata->axes[i]);
         }
     }
     if (hwdata->changes & BALLS_CHANGED) {
-        for (Uint16 i = 0; i < hwdata->desc.nballs; ++i) {
+        for (Uint8 i = 0; i < hwdata->desc.nballs; ++i) {
             SDL_JoystickBallData *ball = &hwdata->balls[i];
             if (ball->dx || ball->dy) {
-                SDL_SendJoystickBall(timestamp, joystick, i, ball->dx, ball->dy);
+                SDL_SendJoystickBall(timestamp, joystick, i, (Sint16)ball->dx, (Sint16)ball->dy);
                 ball->dx = 0;
                 ball->dy = 0;
             }
         }
     }
     if (hwdata->changes & BUTTONS_CHANGED) {
-        for (Uint16 i = 0; i < hwdata->desc.nbuttons; ++i) {
+        for (Uint8 i = 0; i < hwdata->desc.nbuttons; ++i) {
             SDL_SendJoystickButton(timestamp, joystick, i, hwdata->buttons[i]);
         }
     }
     if (hwdata->changes & HATS_CHANGED) {
-        for (Uint16 i = 0; i < hwdata->desc.nhats; ++i) {
+        for (Uint8 i = 0; i < hwdata->desc.nhats; ++i) {
             SDL_SendJoystickHat(timestamp, joystick, i, hwdata->hats[i]);
         }
     }