virtual joysticks: removed ball support (Bug 5028)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h
index b31f678..c489e4d 100644
--- a/include/SDL_joystick.h
+++ b/include/SDL_joystick.h
@@ -206,7 +206,6 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_ind
*/
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
int naxes,
- int nballs,
int nbuttons,
int nhats);
@@ -226,7 +225,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
* Returns 0 on success, -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
-extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 160ac76..48e1804 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -809,11 +809,10 @@ SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return)
#endif
SDL_DYNAPI_PROC(int,SDL_isupper,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_islower,(int a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtual,(SDL_JoystickType a, int b, int c, int d, int e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtual,(SDL_JoystickType a, int b, int c, int d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_JoystickDetachVirtual,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickIsVirtual,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualAxis,(SDL_Joystick *a, int b, Sint16 c),(a,b,c),return)
-SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualBall,(SDL_Joystick *a, int b, Sint16 c, Sint16 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualButton,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_JoystickSetVirtualHat,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return)
SDL_DYNAPI_PROC(char*,SDL_GetErrorMsg,(char *a, int b),(a,b),return)
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index d3e2254..0a7daa3 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -466,14 +466,12 @@ SDL_JoystickOpen(int device_index)
int
SDL_JoystickAttachVirtual(SDL_JoystickType type,
int naxes,
- int nballs,
int nbuttons,
int nhats)
{
#if SDL_JOYSTICK_VIRTUAL
return SDL_JoystickAttachVirtualInner(type,
naxes,
- nballs,
nbuttons,
nhats);
#else
@@ -540,17 +538,6 @@ SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value)
int
-SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int axis, Sint16 xrel, Sint16 yrel)
-{
-#if SDL_JOYSTICK_VIRTUAL
- return SDL_JoystickSetVirtualBallInner(joystick, axis, xrel, yrel);
-#else
- return SDL_SetError("SDL not built with virtual-joystick support");
-#endif
-}
-
-
-int
SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value)
{
#if SDL_JOYSTICK_VIRTUAL
diff --git a/src/joystick/virtual/SDL_sysjoystick.c b/src/joystick/virtual/SDL_sysjoystick.c
index 28f8871..5329b3b 100644
--- a/src/joystick/virtual/SDL_sysjoystick.c
+++ b/src/joystick/virtual/SDL_sysjoystick.c
@@ -60,10 +60,6 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
SDL_free((void *)hwdata->axes);
hwdata->axes = NULL;
}
- if (hwdata->balls) {
- SDL_free((void *)hwdata->balls);
- hwdata->balls = NULL;
- }
if (hwdata->buttons) {
SDL_free((void *)hwdata->buttons);
hwdata->buttons = NULL;
@@ -94,7 +90,6 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
int
SDL_JoystickAttachVirtualInner(SDL_JoystickType type,
int naxes,
- int nballs,
int nbuttons,
int nhats)
{
@@ -108,7 +103,6 @@ SDL_JoystickAttachVirtualInner(SDL_JoystickType type,
}
hwdata->naxes = naxes;
- hwdata->nballs = nballs;
hwdata->nbuttons = nbuttons;
hwdata->nhats = nhats;
hwdata->name = "Virtual Joystick";
@@ -125,13 +119,6 @@ SDL_JoystickAttachVirtualInner(SDL_JoystickType type,
return SDL_OutOfMemory();
}
}
- if (nballs > 0) {
- hwdata->balls = SDL_calloc(nballs, sizeof(hwdata->balls[0]));
- if (!hwdata->balls) {
- VIRTUAL_FreeHWData(hwdata);
- return SDL_OutOfMemory();
- }
- }
if (nbuttons > 0) {
hwdata->buttons = SDL_calloc(nbuttons, sizeof(Uint8));
if (!hwdata->buttons) {
@@ -202,32 +189,6 @@ SDL_JoystickSetVirtualAxisInner(SDL_Joystick * joystick, int axis, Sint16 value)
int
-SDL_JoystickSetVirtualBallInner(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel)
-{
- joystick_hwdata *hwdata;
-
- SDL_LockJoysticks();
-
- if (!joystick || !joystick->hwdata) {
- SDL_UnlockJoysticks();
- return SDL_SetError("Invalid joystick");
- }
-
- hwdata = (joystick_hwdata *)joystick->hwdata;
- if (ball < 0 || ball >= hwdata->nbuttons) {
- SDL_UnlockJoysticks();
- return SDL_SetError("Invalid ball index");
- }
-
- hwdata->balls[ball].xrel = xrel;
- hwdata->balls[ball].yrel = yrel;
-
- SDL_UnlockJoysticks();
- return 0;
-}
-
-
-int
SDL_JoystickSetVirtualButtonInner(SDL_Joystick * joystick, int button, Uint8 value)
{
joystick_hwdata *hwdata;
@@ -364,7 +325,6 @@ VIRTUAL_JoystickOpen(SDL_Joystick * joystick, int device_index)
joystick->instance_id = hwdata->instance_id;
joystick->hwdata = hwdata;
joystick->naxes = hwdata->naxes;
- joystick->nballs = hwdata->nballs;
joystick->nbuttons = hwdata->nbuttons;
joystick->nhats = hwdata->nhats;
hwdata->opened = SDL_TRUE;
@@ -396,9 +356,6 @@ VIRTUAL_JoystickUpdate(SDL_Joystick * joystick)
for (int i = 0; i < hwdata->naxes; ++i) {
SDL_PrivateJoystickAxis(joystick, i, hwdata->axes[i]);
}
- for (int i = 0; i < hwdata->nballs; ++i) {
- SDL_PrivateJoystickBall(joystick, i, hwdata->balls[i].xrel, hwdata->balls[i].yrel);
- }
for (int i = 0; i < hwdata->nbuttons; ++i) {
SDL_PrivateJoystickButton(joystick, i, hwdata->buttons[i]);
}
diff --git a/src/joystick/virtual/SDL_sysjoystick_c.h b/src/joystick/virtual/SDL_sysjoystick_c.h
index 3b782f1..aeda5ef 100644
--- a/src/joystick/virtual/SDL_sysjoystick_c.h
+++ b/src/joystick/virtual/SDL_sysjoystick_c.h
@@ -38,11 +38,6 @@ typedef struct joystick_hwdata
SDL_JoystickGUID guid;
int naxes;
Sint16 *axes;
- int nballs;
- struct {
- Sint16 xrel;
- Sint16 yrel;
- } *balls;
int nbuttons;
Uint8 *buttons;
int nhats;
@@ -54,14 +49,12 @@ typedef struct joystick_hwdata
int SDL_JoystickAttachVirtualInner(SDL_JoystickType type,
int naxes,
- int nballs,
int nbuttons,
int nhats);
int SDL_JoystickDetachVirtualInner(int device_index);
int SDL_JoystickSetVirtualAxisInner(SDL_Joystick * joystick, int axis, Sint16 value);
-int SDL_JoystickSetVirtualBallInner(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel);
int SDL_JoystickSetVirtualButtonInner(SDL_Joystick * joystick, int button, Uint8 value);
int SDL_JoystickSetVirtualHatInner(SDL_Joystick * joystick, int hat, Uint8 value);