Skip to content

Commit b6505b7

Browse files
committed
[lib-sdl] FIx analog joystick events.
Also reduced sensetivity for mouse emulation.
1 parent 9ea75a4 commit b6505b7

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/SDL/src/joystick/dc/SDL_sysjoystick.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,8 @@ static void joyUpdate(SDL_Joystick *joystick) {
222222
count_cond = !(count & 0x1);
223223
if (cond->joyx!=0 || cond->joyy!=0 || count_cond) {
224224
{
225-
register unsigned s= __sdl_dc_mouse_shift+1;
226-
mx = (cond->joyx) >> s;
227-
my = (cond->joyy) >> s;
225+
mx = cond->joyx / 6;
226+
my = cond->joyy / 6;
228227
}
229228

230229
if (count_cond) {
@@ -245,29 +244,29 @@ static void joyUpdate(SDL_Joystick *joystick) {
245244

246245
//Check Joystick Axis P1
247246
//"joyx", "joyy", "joy2x", and "joy2y" are all zero based
248-
if (cond->joyx != prev_joyx) {
247+
if (cond->joyx != prev_joyx || cond->joyx != 0) {
249248
SDL_PrivateJoystickAxis(joystick, 0, cond->joyx);
250249
}
251250

252-
if (cond->joyy != prev_joyy) {
251+
if (cond->joyy != prev_joyy || cond->joyy != 0) {
253252
SDL_PrivateJoystickAxis(joystick, 1, cond->joyy);
254253
}
255254

256255
//Check L and R triggers
257256
//In this case, do not flip the PRESSED/RELEASED!
258-
if (cond->rtrig != prev_rtrig) {
257+
if (cond->rtrig != prev_rtrig || cond->rtrig != 0) {
259258
SDL_PrivateJoystickAxis(joystick, 2, cond->rtrig);
260259
}
261260

262-
if (cond->ltrig != prev_ltrig) {
261+
if (cond->ltrig != prev_ltrig || cond->ltrig != 0) {
263262
SDL_PrivateJoystickAxis(joystick, 3, cond->ltrig);
264263
}
265264
//Check Joystick Axis P2
266-
if (cond->joy2x != prev_joy2x) {
265+
if (cond->joy2x != prev_joy2x || cond->joy2x != 0) {
267266
SDL_PrivateJoystickAxis(joystick, 4, cond->joy2x);
268267
}
269268

270-
if (cond->joy2y != prev_joy2y) {
269+
if (cond->joy2y != prev_joy2y || cond->joy2y != 0) {
271270
SDL_PrivateJoystickAxis(joystick, 5, cond->joy2y);
272271
}
273272

lib/SDL/src/video/dc/SDL_dcvideo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void SDL_DC_Default60Hz(SDL_bool value)
8787
#include <GL/glu.h>
8888
#endif
8989

90-
unsigned int __sdl_dc_mouse_shift=1;
90+
// unsigned int __sdl_dc_mouse_shift=1;
9191

9292

9393
/* Initialization/Query functions */

0 commit comments

Comments
 (0)