Search
lxdream.org :: lxdream/src/maple/controller.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/maple/controller.c
changeset 736:a02d1475ccfd
prev724:f2bc1c7cca14
next770:429ff505c450
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/maple/controller.c Sun Jul 06 03:17:32 2008 +0000
1.2 +++ b/src/maple/controller.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -43,26 +43,26 @@
1.4 struct maple_device_class controller_class = { "Sega Controller", controller_new };
1.5
1.6 static struct controller_device base_controller = {
1.7 - { MAPLE_DEVICE_TAG, &controller_class, CONTROLLER_IDENT, CONTROLLER_VERSION,
1.8 - controller_get_config, controller_attach, controller_detach, controller_destroy,
1.9 - controller_clone, NULL, NULL, controller_get_cond, NULL, NULL, NULL },
1.10 - {0x0000FFFF, 0x80808080},
1.11 - {{ "dpad left", N_("Dpad left"), CONFIG_TYPE_KEY },
1.12 - { "dpad right", N_("Dpad right"), CONFIG_TYPE_KEY },
1.13 - { "dpad up", N_("Dpad up"), CONFIG_TYPE_KEY },
1.14 - { "dpad down", N_("Dpad down"), CONFIG_TYPE_KEY },
1.15 - { "analog left", N_("Analog left"), CONFIG_TYPE_KEY },
1.16 - { "analog right", N_("Analog right"), CONFIG_TYPE_KEY },
1.17 - { "analog up", N_("Analog up"), CONFIG_TYPE_KEY },
1.18 - { "analog down", N_("Analog down"), CONFIG_TYPE_KEY },
1.19 - { "button X", N_("Button X"), CONFIG_TYPE_KEY },
1.20 - { "button Y", N_("Button Y"), CONFIG_TYPE_KEY },
1.21 - { "button A", N_("Button A"), CONFIG_TYPE_KEY },
1.22 - { "button B", N_("Button B"), CONFIG_TYPE_KEY },
1.23 - { "trigger left", N_("Trigger left"), CONFIG_TYPE_KEY },
1.24 - { "trigger right", N_("Trigger right"), CONFIG_TYPE_KEY },
1.25 - { "start", N_("Start button"), CONFIG_TYPE_KEY },
1.26 - { NULL, CONFIG_TYPE_NONE }} };
1.27 + { MAPLE_DEVICE_TAG, &controller_class, CONTROLLER_IDENT, CONTROLLER_VERSION,
1.28 + controller_get_config, controller_attach, controller_detach, controller_destroy,
1.29 + controller_clone, NULL, NULL, controller_get_cond, NULL, NULL, NULL },
1.30 + {0x0000FFFF, 0x80808080},
1.31 + {{ "dpad left", N_("Dpad left"), CONFIG_TYPE_KEY },
1.32 + { "dpad right", N_("Dpad right"), CONFIG_TYPE_KEY },
1.33 + { "dpad up", N_("Dpad up"), CONFIG_TYPE_KEY },
1.34 + { "dpad down", N_("Dpad down"), CONFIG_TYPE_KEY },
1.35 + { "analog left", N_("Analog left"), CONFIG_TYPE_KEY },
1.36 + { "analog right", N_("Analog right"), CONFIG_TYPE_KEY },
1.37 + { "analog up", N_("Analog up"), CONFIG_TYPE_KEY },
1.38 + { "analog down", N_("Analog down"), CONFIG_TYPE_KEY },
1.39 + { "button X", N_("Button X"), CONFIG_TYPE_KEY },
1.40 + { "button Y", N_("Button Y"), CONFIG_TYPE_KEY },
1.41 + { "button A", N_("Button A"), CONFIG_TYPE_KEY },
1.42 + { "button B", N_("Button B"), CONFIG_TYPE_KEY },
1.43 + { "trigger left", N_("Trigger left"), CONFIG_TYPE_KEY },
1.44 + { "trigger right", N_("Trigger right"), CONFIG_TYPE_KEY },
1.45 + { "start", N_("Start button"), CONFIG_TYPE_KEY },
1.46 + { NULL, CONFIG_TYPE_NONE }} };
1.47
1.48 #define CONTROLLER(x) ((controller_device_t)(x))
1.49
1.50 @@ -89,43 +89,43 @@
1.51 {
1.52 controller_device_t dev = (controller_device_t)mdev;
1.53 if( isKeyDown ) {
1.54 - switch( value ) {
1.55 - case JOY_LEFT:
1.56 - dev->condition[1] &= ~JOY_X_AXIS;
1.57 - break;
1.58 - case JOY_RIGHT:
1.59 - dev->condition[1] |= JOY_X_AXIS;
1.60 - break;
1.61 - case JOY_UP:
1.62 - dev->condition[1] &= ~JOY_Y_AXIS;
1.63 - break;
1.64 - case JOY_DOWN:
1.65 - dev->condition[1] |= JOY_Y_AXIS;
1.66 - break;
1.67 - case BUTTON_LEFT_TRIGGER:
1.68 - case BUTTON_RIGHT_TRIGGER:
1.69 - dev->condition[0] |= value;
1.70 - break;
1.71 - default:
1.72 - dev->condition[0] &= ~value;
1.73 - }
1.74 + switch( value ) {
1.75 + case JOY_LEFT:
1.76 + dev->condition[1] &= ~JOY_X_AXIS;
1.77 + break;
1.78 + case JOY_RIGHT:
1.79 + dev->condition[1] |= JOY_X_AXIS;
1.80 + break;
1.81 + case JOY_UP:
1.82 + dev->condition[1] &= ~JOY_Y_AXIS;
1.83 + break;
1.84 + case JOY_DOWN:
1.85 + dev->condition[1] |= JOY_Y_AXIS;
1.86 + break;
1.87 + case BUTTON_LEFT_TRIGGER:
1.88 + case BUTTON_RIGHT_TRIGGER:
1.89 + dev->condition[0] |= value;
1.90 + break;
1.91 + default:
1.92 + dev->condition[0] &= ~value;
1.93 + }
1.94 } else {
1.95 - switch(value ) {
1.96 - case JOY_LEFT:
1.97 - case JOY_RIGHT:
1.98 - dev->condition[1] = (dev->condition[1] & ~JOY_X_AXIS)| JOY_X_AXIS_CENTER;
1.99 - break;
1.100 - case JOY_UP:
1.101 - case JOY_DOWN:
1.102 - dev->condition[1] = (dev->condition[1] & ~JOY_Y_AXIS)| JOY_Y_AXIS_CENTER;
1.103 - break;
1.104 - case BUTTON_LEFT_TRIGGER:
1.105 - case BUTTON_RIGHT_TRIGGER:
1.106 - dev->condition[0] &= ~value;
1.107 - break;
1.108 - default:
1.109 - dev->condition[0] |= value;
1.110 - }
1.111 + switch(value ) {
1.112 + case JOY_LEFT:
1.113 + case JOY_RIGHT:
1.114 + dev->condition[1] = (dev->condition[1] & ~JOY_X_AXIS)| JOY_X_AXIS_CENTER;
1.115 + break;
1.116 + case JOY_UP:
1.117 + case JOY_DOWN:
1.118 + dev->condition[1] = (dev->condition[1] & ~JOY_Y_AXIS)| JOY_Y_AXIS_CENTER;
1.119 + break;
1.120 + case BUTTON_LEFT_TRIGGER:
1.121 + case BUTTON_RIGHT_TRIGGER:
1.122 + dev->condition[0] &= ~value;
1.123 + break;
1.124 + default:
1.125 + dev->condition[0] |= value;
1.126 + }
1.127 }
1.128 }
1.129
.