filename | src/maple/controller.c |
changeset | 1010:a506a2f66180 |
prev | 850:28782ebbd01d |
next | 1034:7044e01148f0 |
author | nkeynes |
date | Tue Jun 02 23:16:26 2009 +0000 (14 years ago) |
permissions | -rw-r--r-- |
last change | "MythTV" patch from Wahrhaft, thanks!: * Add support for LIRC input devices * Add hotkey input support * Add command-line option for immediate fullscreen |
file | annotate | diff | log | raw |
1.1 --- a/src/maple/controller.c Mon Sep 08 07:56:33 2008 +00001.2 +++ b/src/maple/controller.c Tue Jun 02 23:16:26 2009 +00001.3 @@ -41,12 +41,15 @@1.4 #define BUTTON_RIGHT_TRIGGER 0x00FF0000 /* Bitmask */1.6 /* Second word of controller condition (bitmasks) */1.7 -#define JOY_X_AXIS 0x000000FF1.8 -#define JOY_Y_AXIS 0x0000FF001.9 +#define JOY_X_AXIS_MASK 0x000000FF1.10 +#define JOY_Y_AXIS_MASK 0x0000FF001.11 #define JOY_X_AXIS_CENTER 0x000000801.12 #define JOY_Y_AXIS_CENTER 0x000080001.13 -#define JOY2_X_AXIS 0x00FF0000 /* not on standard controller */1.14 -#define JOY2_Y_AXIS 0xFF000000 /* not on standard controller */1.15 +#define JOY2_X_AXIS_MASK 0x00FF0000 /* not on standard controller */1.16 +#define JOY2_Y_AXIS_MASK 0xFF000000 /* not on standard controller */1.17 +1.18 +#define JOY_X_AXIS(x) ((x)&0xFF)1.19 +#define JOY_Y_AXIS(y) (((y)&0xFF)<<8)1.21 /* The following bits are used by the emulator for flags but don't actually1.22 * appear in the hardware1.23 @@ -148,16 +151,20 @@1.24 if( isKeyDown ) {1.25 switch( value ) {1.26 case JOY_LEFT:1.27 - dev->condition[1] &= ~JOY_X_AXIS;1.28 + dev->condition[1] &= ~JOY_X_AXIS_MASK;1.29 + dev->condition[1] |= JOY_X_AXIS(0x7F - pressure);1.30 break;1.31 case JOY_RIGHT:1.32 - dev->condition[1] |= JOY_X_AXIS;1.33 + dev->condition[1] &= ~JOY_X_AXIS_MASK;1.34 + dev->condition[1] |= JOY_X_AXIS(0x80 + pressure);1.35 break;1.36 case JOY_UP:1.37 - dev->condition[1] &= ~JOY_Y_AXIS;1.38 + dev->condition[1] &= ~JOY_Y_AXIS_MASK;1.39 + dev->condition[1] |= JOY_Y_AXIS(0x7F - pressure);1.40 break;1.41 case JOY_DOWN:1.42 - dev->condition[1] |= JOY_Y_AXIS;1.43 + dev->condition[1] &= ~JOY_Y_AXIS_MASK;1.44 + dev->condition[1] |= JOY_Y_AXIS(0x80 + pressure);1.45 break;1.46 case BUTTON_LEFT_TRIGGER:1.47 case BUTTON_RIGHT_TRIGGER:1.48 @@ -170,11 +177,11 @@1.49 switch(value ) {1.50 case JOY_LEFT:1.51 case JOY_RIGHT:1.52 - dev->condition[1] = (dev->condition[1] & ~JOY_X_AXIS)| JOY_X_AXIS_CENTER;1.53 + dev->condition[1] = (dev->condition[1] & ~JOY_X_AXIS_MASK)| JOY_X_AXIS_CENTER;1.54 break;1.55 case JOY_UP:1.56 case JOY_DOWN:1.57 - dev->condition[1] = (dev->condition[1] & ~JOY_Y_AXIS)| JOY_Y_AXIS_CENTER;1.58 + dev->condition[1] = (dev->condition[1] & ~JOY_Y_AXIS_MASK)| JOY_Y_AXIS_CENTER;1.59 break;1.60 case BUTTON_LEFT_TRIGGER:1.61 case BUTTON_RIGHT_TRIGGER:
.