Created
June 4, 2013 21:38
-
-
Save fendent/5709835 to your computer and use it in GitHub Desktop.
Some definitions for the XBox 360 Rock Band Stage Kit OS X drivers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __CONTROLSTRUCT_H__ | |
#define __CONTROLSTRUCT_H__ | |
typedef UInt8 XBox360_Byte; | |
typedef UInt16 XBox360_Short; | |
typedef SInt16 XBox360_SShort; | |
#define Xbox360_Prepare(x,t) {memset(&x,0,sizeof(x));x.header.command=t;x.header.size=sizeof(x);} | |
#define PACKED __attribute__((__packed__)) | |
// Common structure format | |
typedef struct { | |
XBox360_Byte command; | |
XBox360_Byte size; | |
} PACKED XBOX360_PACKET; | |
// Analog stick format | |
typedef struct { | |
XBox360_SShort x,y; | |
} PACKED XBOX360_HAT; | |
// Structure describing the report had back from the controller | |
typedef struct { | |
XBOX360_PACKET header; | |
XBox360_Short buttons; | |
XBox360_Byte trigL,trigR; | |
XBOX360_HAT left,right; | |
XBox360_Byte reserved[6]; | |
} PACKED XBOX360_IN_REPORT; | |
// Structure describing the command to change LED status | |
typedef struct { | |
XBOX360_PACKET header; | |
XBox360_Byte pattern; | |
} PACKED XBOX360_OUT_LED; | |
// Structure describing the command to change rumble motor status | |
typedef struct { | |
XBOX360_PACKET header; | |
XBox360_Byte reserved1; | |
XBox360_Byte big,little; | |
XBox360_Byte reserved[3]; | |
} PACKED XBOX360_OUT_RUMBLE; | |
typedef struct { | |
XBOX360_PACKET header; | |
XBox360_Byte value; | |
} PACKED XBOX360_OUT_INIT; | |
// Enumeration of command types | |
enum { | |
// In | |
inReport = 0, | |
// Out | |
outRumble = 0, | |
outLed = 1, | |
outInit = 2 | |
}; | |
// Button bits | |
enum { | |
btnHatRight = 0x8000, | |
btnHatLeft = 0x4000, | |
btnBack = 0x2000, | |
btnStart = 0x1000, | |
btnDigiRight = 0x0800, | |
btnDigiLeft = 0x0400, | |
btnDigiDown = 0x0200, | |
btnDigiUp = 0x0100, | |
btnY = 0x0080, | |
btnX = 0x0040, | |
btnB = 0x0020, | |
btnA = 0x0010, | |
btnReserved1 = 0x0008, // Unused? | |
btnXbox = 0x0004, | |
btnShoulderRight = 0x0002, | |
btnShoulderLeft = 0x0001 | |
}; | |
// LED values | |
enum { | |
ledOff = 0x00, | |
ledBlinkingAll = 0x01, | |
ledFlashOn1 = 0x02, | |
ledFlashOn2 = 0x03, | |
ledFlashOn3 = 0x04, | |
ledFlashOn4 = 0x05, | |
ledOn1 = 0x06, | |
ledOn2 = 0x07, | |
ledOn3 = 0x08, | |
ledOn4 = 0x09, | |
ledRotating = 0x0a, | |
ledBlinking = 0x0b, // Blinking of previously enabled LED (e.g. from 0x01-0x09) | |
ledBlinkingSlow = 0x0c, // As above | |
ldAlternating = 0x0d // 1+4, 2+3, then back to previous after a short time | |
}; | |
// Fog & Strobe Values (00 xx) | |
enum { | |
fogOn = 0x01, | |
fogOff = 0x02, | |
strobeSlow = 0x03, | |
strobeMedium = 0x04, | |
strobeFast = 0x05, | |
strobeFastest = 0x06, | |
strobeOff = 0x07 | |
}; | |
// LED Placement [PP] (0xPP 0xCC) | |
enum { | |
ledAllOff = 0x00, | |
led1 = 0x01, | |
led2 = 0x02, | |
led3 = 0x03, | |
led4 = 0x04, | |
led5 = 0x05, | |
led6 = 0x06, | |
led7 = 0x07, | |
led8 = 0x08 | |
}; | |
// LED Colours [CC] (0xPP 0xCC) | |
enum { | |
ledBlue = 0x20, | |
ledGreen = 0x40, | |
ledYellow = 0x60, | |
ledRed = 0x80 | |
}; | |
#endif // __CONTROLSTRUCT_H__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment