comparison src/joystick/mint/SDL_sysjoystick.c @ 507:7853b6af5957

Atari joystick fixes contributed by Patrice Mandin
author Sam Lantinga <slouken@libsdl.org>
date Sat, 05 Oct 2002 16:27:29 +0000
parents 9c6613983e85
children 0ce5a68278fd
comparison
equal deleted inserted replaced
506:f097dba83975 507:7853b6af5957
349 if (curstate != prevstate) { 349 if (curstate != prevstate) {
350 /* X axis */ 350 /* X axis */
351 if ((curstate & (IKBD_JOY_LEFT|IKBD_JOY_RIGHT)) != (prevstate & (IKBD_JOY_LEFT|IKBD_JOY_RIGHT))) { 351 if ((curstate & (IKBD_JOY_LEFT|IKBD_JOY_RIGHT)) != (prevstate & (IKBD_JOY_LEFT|IKBD_JOY_RIGHT))) {
352 curaxis=0; 352 curaxis=0;
353 if (curstate & IKBD_JOY_LEFT) { 353 if (curstate & IKBD_JOY_LEFT) {
354 curaxis=-128; 354 curaxis=0x8000;
355 } else if (curstate & IKBD_JOY_RIGHT) { 355 } else if (curstate & IKBD_JOY_RIGHT) {
356 curaxis=127; 356 curaxis=0x7fff;
357 } 357 }
358 SDL_PrivateJoystickAxis(joystick,0,curaxis); 358 SDL_PrivateJoystickAxis(joystick,0,curaxis);
359 } 359 }
360 /* Y axis */ 360 /* Y axis */
361 if ((curstate & (IKBD_JOY_UP|IKBD_JOY_DOWN)) != (prevstate & (IKBD_JOY_UP|IKBD_JOY_DOWN))) { 361 if ((curstate & (IKBD_JOY_UP|IKBD_JOY_DOWN)) != (prevstate & (IKBD_JOY_UP|IKBD_JOY_DOWN))) {
362 curaxis=0; 362 curaxis=0;
363 if (curstate & IKBD_JOY_UP) { 363 if (curstate & IKBD_JOY_UP) {
364 curaxis=-128; 364 curaxis=0x8000;
365 } else if (curstate & IKBD_JOY_DOWN) { 365 } else if (curstate & IKBD_JOY_DOWN) {
366 curaxis=127; 366 curaxis=0x7fff;
367 } 367 }
368 SDL_PrivateJoystickAxis(joystick,1,curaxis); 368 SDL_PrivateJoystickAxis(joystick,1,curaxis);
369 } 369 }
370 /* Button */ 370 /* Button */
371 if ((curstate & IKBD_JOY_FIRE) && !(prevstate & IKBD_JOY_FIRE)) { 371 if ((curstate & IKBD_JOY_FIRE) && !(prevstate & IKBD_JOY_FIRE)) {
391 if (curstate!=prevstate) { 391 if (curstate!=prevstate) {
392 /* X axis */ 392 /* X axis */
393 if ((curstate & ((1<<JP_LEFT)|(1<<JP_RIGHT))) != (prevstate & ((1<<JP_LEFT)|(1<<JP_RIGHT)))) { 393 if ((curstate & ((1<<JP_LEFT)|(1<<JP_RIGHT))) != (prevstate & ((1<<JP_LEFT)|(1<<JP_RIGHT)))) {
394 curaxis=0; 394 curaxis=0;
395 if (curstate & (1<<JP_LEFT)) { 395 if (curstate & (1<<JP_LEFT)) {
396 curaxis=-128; 396 curaxis=0x8000;
397 } else if (curstate & (1<<JP_RIGHT)) { 397 } else if (curstate & (1<<JP_RIGHT)) {
398 curaxis=127; 398 curaxis=0x7fff;
399 } 399 }
400 SDL_PrivateJoystickAxis(joystick,0,curaxis); 400 SDL_PrivateJoystickAxis(joystick,0,curaxis);
401 } 401 }
402 /* Y axis */ 402 /* Y axis */
403 if ((curstate & ((1<<JP_UP)|(1<<JP_DOWN))) != (prevstate & ((1<<JP_UP)|(1<<JP_DOWN)))) { 403 if ((curstate & ((1<<JP_UP)|(1<<JP_DOWN))) != (prevstate & ((1<<JP_UP)|(1<<JP_DOWN)))) {
404 curaxis=0; 404 curaxis=0;
405 if (curstate & (1<<JP_UP)) { 405 if (curstate & (1<<JP_UP)) {
406 curaxis=-128; 406 curaxis=0x8000;
407 } else if (curstate & (1<<JP_DOWN)) { 407 } else if (curstate & (1<<JP_DOWN)) {
408 curaxis=127; 408 curaxis=0x7fff;
409 } 409 }
410 SDL_PrivateJoystickAxis(joystick,1,curaxis); 410 SDL_PrivateJoystickAxis(joystick,1,curaxis);
411 } 411 }
412 /* Buttons */ 412 /* Buttons */
413 for (i=0;i<JP_NUM_BUTTONS;i++) { 413 for (i=0;i<JP_NUM_BUTTONS;i++) {
444 if (curstate != prevstate) { 444 if (curstate != prevstate) {
445 /* X axis */ 445 /* X axis */
446 if ((curstate & (PORT_JS_LEFT|PORT_JS_RIGHT)) != (prevstate & (PORT_JS_LEFT|PORT_JS_RIGHT))) { 446 if ((curstate & (PORT_JS_LEFT|PORT_JS_RIGHT)) != (prevstate & (PORT_JS_LEFT|PORT_JS_RIGHT))) {
447 curaxis=0; 447 curaxis=0;
448 if (curstate & PORT_JS_LEFT) { 448 if (curstate & PORT_JS_LEFT) {
449 curaxis=-128; 449 curaxis=0x8000;
450 } else if (curstate & PORT_JS_RIGHT) { 450 } else if (curstate & PORT_JS_RIGHT) {
451 curaxis=127; 451 curaxis=0x7fff;
452 } 452 }
453 SDL_PrivateJoystickAxis(joystick,0,curaxis); 453 SDL_PrivateJoystickAxis(joystick,0,curaxis);
454 } 454 }
455 /* Y axis */ 455 /* Y axis */
456 if ((curstate & (PORT_JS_UP|PORT_JS_DOWN)) != (prevstate & (PORT_JS_UP|PORT_JS_DOWN))) { 456 if ((curstate & (PORT_JS_UP|PORT_JS_DOWN)) != (prevstate & (PORT_JS_UP|PORT_JS_DOWN))) {
457 curaxis=0; 457 curaxis=0;
458 if (curstate & PORT_JS_UP) { 458 if (curstate & PORT_JS_UP) {
459 curaxis=-128; 459 curaxis=0x8000;
460 } else if (curstate & PORT_JS_DOWN) { 460 } else if (curstate & PORT_JS_DOWN) {
461 curaxis=127; 461 curaxis=0x7fff;
462 } 462 }
463 SDL_PrivateJoystickAxis(joystick,1,curaxis); 463 SDL_PrivateJoystickAxis(joystick,1,curaxis);
464 } 464 }
465 /* Button */ 465 /* Button */
466 if ((curstate & PORT_JS_FIRE) && !(prevstate & PORT_JS_FIRE)) { 466 if ((curstate & PORT_JS_FIRE) && !(prevstate & PORT_JS_FIRE)) {
481 curstate |= (jp_lightpens[1]>>1)<<15; 481 curstate |= (jp_lightpens[1]>>1)<<15;
482 curstate |= (jp_fires & 3)<<30; 482 curstate |= (jp_fires & 3)<<30;
483 483
484 if (curstate != prevstate) { 484 if (curstate != prevstate) {
485 /* X axis */ 485 /* X axis */
486 SDL_PrivateJoystickAxis(joystick,0,(jp_lightpens[0]>>8)-128); 486 SDL_PrivateJoystickAxis(joystick,0,jp_lightpens[0] ^ 0x8000);
487 /* Y axis */ 487 /* Y axis */
488 SDL_PrivateJoystickAxis(joystick,1,(jp_lightpens[1]>>8)-128); 488 SDL_PrivateJoystickAxis(joystick,1,jp_lightpens[1] ^ 0x8000);
489 /* Buttons */ 489 /* Buttons */
490 for (i=0;i<2;i++) { 490 for (i=0;i<2;i++) {
491 int button; 491 int button;
492 492
493 button=1<<(30+i); 493 button=1<<(30+i);
515 curstate |= (jp_paddles[numpaddle+1]>>1)<<15; 515 curstate |= (jp_paddles[numpaddle+1]>>1)<<15;
516 curstate |= ((jp_fires>>numpaddle) & 3)<<30; 516 curstate |= ((jp_fires>>numpaddle) & 3)<<30;
517 517
518 if (curstate != prevstate) { 518 if (curstate != prevstate) {
519 /* X axis */ 519 /* X axis */
520 SDL_PrivateJoystickAxis(joystick,0,(jp_paddles[numpaddle]>>8)-128); 520 SDL_PrivateJoystickAxis(joystick,0,jp_paddles[numpaddle] ^ 0x8000);
521 /* Y axis */ 521 /* Y axis */
522 SDL_PrivateJoystickAxis(joystick,1,(jp_paddles[numpaddle+1]>>8)-128); 522 SDL_PrivateJoystickAxis(joystick,1,jp_paddles[numpaddle+1] ^ 0x8000);
523 /* Buttons */ 523 /* Buttons */
524 for (i=0;i<2;i++) { 524 for (i=0;i<2;i++) {
525 int button; 525 int button;
526 526
527 button=1<<(30+i); 527 button=1<<(30+i);