comparison src/joystick/mint/SDL_sysjoystick.c @ 2043:adf732f1f016

Formatting update
author Sam Lantinga <slouken@libsdl.org>
date Sun, 24 Sep 2006 15:56:55 +0000
parents 8640d90b0406
children fc56a720cdba
comparison
equal deleted inserted replaced
2042:3908e1f808e1 2043:adf732f1f016
200 (cookie_mch == MCH_ARANYM << 16)) { 200 (cookie_mch == MCH_ARANYM << 16)) {
201 atarijoysticks[IKBD_JOY1].enabled = (SDL_AtariIkbd_enabled != 0); 201 atarijoysticks[IKBD_JOY1].enabled = (SDL_AtariIkbd_enabled != 0);
202 } 202 }
203 if ((cookie_mch == MCH_STE << 16) || (cookie_mch == MCH_F30 << 16)) { 203 if ((cookie_mch == MCH_STE << 16) || (cookie_mch == MCH_F30 << 16)) {
204 atarijoysticks[PORTA_PAD0].enabled = 204 atarijoysticks[PORTA_PAD0].enabled =
205 atarijoysticks[PORTA_PAD1].enabled = 205 atarijoysticks[PORTA_PAD1].enabled =
206 atarijoysticks[PORTA_PAD2].enabled = 206 atarijoysticks[PORTA_PAD2].enabled =
207 atarijoysticks[PORTA_PAD3].enabled = 207 atarijoysticks[PORTA_PAD3].enabled =
208 atarijoysticks[PORTB_PAD0].enabled = 208 atarijoysticks[PORTB_PAD0].enabled =
209 atarijoysticks[PORTB_PAD1].enabled = 209 atarijoysticks[PORTB_PAD1].enabled =
210 atarijoysticks[PORTB_PAD2].enabled = 210 atarijoysticks[PORTB_PAD2].enabled =
211 atarijoysticks[PORTB_PAD3].enabled = SDL_TRUE; 211 atarijoysticks[PORTB_PAD3].enabled = SDL_TRUE;
212 } 212 }
213 if (!atarijoysticks[IKBD_JOY1].enabled) { 213 if (!atarijoysticks[IKBD_JOY1].enabled) {
214 atarijoysticks[XBIOS_JOY1].enabled = (SDL_AtariXbios_enabled != 0); 214 atarijoysticks[XBIOS_JOY1].enabled = (SDL_AtariXbios_enabled != 0);
215 } 215 }
216 216
430 case PORTB_PAD3: 430 case PORTB_PAD3:
431 { 431 {
432 int numjoypad, i; 432 int numjoypad, i;
433 433
434 numjoypad = 0; 434 numjoypad = 0;
435 switch(numjoystick) { 435 switch (numjoystick) {
436 case PORTA_PAD0: 436 case PORTA_PAD0:
437 numjoypad = 0; break; 437 numjoypad = 0;
438 break;
438 case PORTA_PAD1: 439 case PORTA_PAD1:
439 numjoypad = 1; break; 440 numjoypad = 1;
441 break;
440 case PORTA_PAD2: 442 case PORTA_PAD2:
441 numjoypad = 2; break; 443 numjoypad = 2;
444 break;
442 case PORTA_PAD3: 445 case PORTA_PAD3:
443 numjoypad = 3; break; 446 numjoypad = 3;
447 break;
444 case PORTB_PAD0: 448 case PORTB_PAD0:
445 numjoypad = 4; break; 449 numjoypad = 4;
450 break;
446 case PORTB_PAD1: 451 case PORTB_PAD1:
447 numjoypad = 5; break; 452 numjoypad = 5;
453 break;
448 case PORTB_PAD2: 454 case PORTB_PAD2:
449 numjoypad = 6; break; 455 numjoypad = 6;
456 break;
450 case PORTB_PAD3: 457 case PORTB_PAD3:
451 numjoypad = 7; break; 458 numjoypad = 7;
452 } 459 break;
460 }
453 461
454 curstate = jp_joypads[numjoypad]; 462 curstate = jp_joypads[numjoypad];
455 if (curstate != prevstate) { 463 if (curstate != prevstate) {
456 hatstate = SDL_HAT_CENTERED; 464 hatstate = SDL_HAT_CENTERED;
457 if (curstate & (1 << JP_LEFT)) { 465 if (curstate & (1 << JP_LEFT)) {
645 Uint16 dummy2[4]; 653 Uint16 dummy2[4];
646 Uint16 lightpens[2]; 654 Uint16 lightpens[2];
647 }; 655 };
648 #define JOYPAD_IO ((*(volatile struct JOYPAD_IO_S *)JOYPAD_IO_BASE)) 656 #define JOYPAD_IO ((*(volatile struct JOYPAD_IO_S *)JOYPAD_IO_BASE))
649 657
650 static const Uint16 joypad_masks[8*4]={ 658 static const Uint16 joypad_masks[8 * 4] = {
651 0xfffe, 0xfffd, 0xfffb, 0xfff7, 659 0xfffe, 0xfffd, 0xfffb, 0xfff7,
652 0xfff0, 0xfff1, 0xfff2, 0xfff3, 660 0xfff0, 0xfff1, 0xfff2, 0xfff3,
653 0xfff4, 0xfff5, 0xfff6, 0xfff8, 661 0xfff4, 0xfff5, 0xfff6, 0xfff8,
654 0xfff9, 0xfffa, 0xfffc, 0xffff, 662 0xfff9, 0xfffa, 0xfffc, 0xffff,
655 0xffef, 0xffdf, 0xffbf, 0xff7f, 663 0xffef, 0xffdf, 0xffbf, 0xff7f,
683 tmp = (JOYPAD_IO.paddles[2] & 255); 691 tmp = (JOYPAD_IO.paddles[2] & 255);
684 jp_paddles[2] = (tmp << 8) | tmp; 692 jp_paddles[2] = (tmp << 8) | tmp;
685 tmp = (JOYPAD_IO.paddles[3] & 255); 693 tmp = (JOYPAD_IO.paddles[3] & 255);
686 jp_paddles[3] = (tmp << 8) | tmp; 694 jp_paddles[3] = (tmp << 8) | tmp;
687 695
688 /* Update joypads on teamtap port A */ 696 /* Update joypads on teamtap port A */
689 for (i=0; i<4; i++) { 697 for (i = 0; i < 4; i++) {
690 jp_joypads[i] = 0; 698 jp_joypads[i] = 0;
691 for (j=0; j<4; j++) { 699 for (j = 0; j < 4; j++) {
692 JOYPAD_IO.directions = joypad_masks[(i*4)+j]; 700 JOYPAD_IO.directions = joypad_masks[(i * 4) + j];
693 701
694 cur_fire = (~(JOYPAD_IO.fires) & 3)<<16; 702 cur_fire = (~(JOYPAD_IO.fires) & 3) << 16;
695 cur_dir = (~(JOYPAD_IO.directions)>>8) & 15; 703 cur_dir = (~(JOYPAD_IO.directions) >> 8) & 15;
696 704
697 jp_joypads[i] |= cur_fire<<(j*2); 705 jp_joypads[i] |= cur_fire << (j * 2);
698 jp_joypads[i] |= cur_dir<<(j*4); 706 jp_joypads[i] |= cur_dir << (j * 4);
699 } 707 }
700 } 708 }
701 709
702 /* Update joypads on teamtap port B */ 710 /* Update joypads on teamtap port B */
703 for (i=4; i<8; i++) { 711 for (i = 4; i < 8; i++) {
704 jp_joypads[i] = 0; 712 jp_joypads[i] = 0;
705 for (j=0; j<4; j++) { 713 for (j = 0; j < 4; j++) {
706 JOYPAD_IO.directions = joypad_masks[(i*4)+j]; 714 JOYPAD_IO.directions = joypad_masks[(i * 4) + j];
707 715
708 cur_fire = (~(JOYPAD_IO.fires) & 0xc)<<14; 716 cur_fire = (~(JOYPAD_IO.fires) & 0xc) << 14;
709 cur_dir = (~(JOYPAD_IO.directions)>>12) & 15; 717 cur_dir = (~(JOYPAD_IO.directions) >> 12) & 15;
710 718
711 jp_joypads[i] |= cur_fire<<(j*2); 719 jp_joypads[i] |= cur_fire << (j * 2);
712 jp_joypads[i] |= cur_dir<<(j*4); 720 jp_joypads[i] |= cur_dir << (j * 4);
713 } 721 }
714 } 722 }
715 723
716 JOYPAD_IO.directions=0xffff; 724 JOYPAD_IO.directions = 0xffff;
717 } 725 }
718 726
719 #endif /* SDL_JOYSTICK_MINT */ 727 #endif /* SDL_JOYSTICK_MINT */
720 /* vi: set ts=4 sw=4 expandtab: */ 728 /* vi: set ts=4 sw=4 expandtab: */