/* Controller Library v2.0 (header file) added analog controller support. Copyright (C) 1999 Andreas Weissl. All rights reserved. special thanx fly to Metrowerks. */ #ifndef __Joypad__ #define __Joypad__ #define PORT_ONE (0) #define PORT_TWO (1) #define PADBUFFER_BYTESIZE (34) // Controller Type IDs #define CONTYPE_NONE (0xF) #define CONTYPE_MOUSE (0x1) #define CONTYPE_NEGCON (0x2) #define CONTYPE_SPAD (0x4) #define CONTYPE_AJOY (0x5) #define CONTYPE_GCON45 (0x6) #define CONTYPE_APAD (0x7) #define CONTYPE_DSPAD (0x7) // 0x7 ANALOGUE PAD // The analogue pad uses the standard pad controls plus two additional // stick controls. #define APADup (1<<12) #define APADdown (1<<14) #define APADleft (1<<15) #define APADright (1<<13) #define APADtr (1<<4) #define APADci (1<<5) #define APADcr (1<<6) #define APADsq (1<<7) #define APADl1 (1<<2) #define APADl2 (1) #define APADr1 (1<<3) #define APADr2 (1<<1) #define APADl3 (1<<9) // Left stick pressed #define APADr3 (1<<10) // Right stick pressed #define APADstart (1<<11) #define APADselect (1<<8) // .. Stick Controllers (byte offsets) // Given ID 3 for a reason which currently isn't clear to me... #define APADr3x (4) #define APADr3y (5) #define APADl3x (6) #define APADl3y (7) #define kPADLup (1<<12) #define kPADLdown (1<<14) #define kPADLleft (1<<15) #define kPADLright (1<<13) #define kPADRup (1<< 4) #define kPADRdown (1<< 6) #define kPADRleft (1<< 7) #define kPADRright (1<< 5) #define kPADselect (1<< 8) #define kPADR1 (1<< 3) #define kPADR2 (1<< 1) #define kPADL1 (1<< 2) #define kPADL2 (1<< 0) #define kPADstart (1<<11) void InitPads (void); // Call InitPads during set-up void UpdatePads (void); // Call UpdatePads once per main loop void GetButtonsState (int *joy1, int *joy2); // Get state of buttons. You MUST CALL UpdatePads to use these functions void GetNewlyDownButtons (int *joy1, int *joy2); void GetNewlyUpButtons (int *joy1, int *joy2); unsigned char ControllerConnected (unsigned char port); unsigned char ControllerType (unsigned char port); unsigned short PadRead (unsigned char port); unsigned char PadAnalogue255 (unsigned char port, unsigned char byte); char PadAnalogue128 (unsigned char port, unsigned char byte); void GetControllerInfo (unsigned char *controller1, unsigned char *controller2); // variables (used for intern information storing) static int newlyDown1, newlyDown2, newlyUp1, newlyUp2; static int previousJoyDown1 = 0; static int previousJoyDown2 = 0; // STANDARD PAD // .. controls #define SPADup (1<<12) #define SPADdown (1<<14) #define SPADleft (1<<15) #define SPADright (1<<13) // TRiangle, CIrcle, CRoss, SQuare #define SPADtr (1<< 4) #define SPADci (1<< 5) #define SPADcr (1<< 6) #define SPADsq (1<< 7) // Shoulder left and right (1 and 2) #define SPADl1 (1<< 2) #define SPADl2 (1<< 0) #define SPADr1 (1<< 3) #define SPADr2 (1<< 1) #define SPADstart (1<<11) #define SPADselect (1<< 8) #endif // __Joypad__