Ticket #79: guitar.diff
| File guitar.diff, 2.6 kB (added by folg, 3 years ago) |
|---|
-
trunk/libcwiid/cwiid_internal.h
125 125 #define CLIFF_IR_BLOCK_2 "\x63\x03" 126 126 127 127 /* Extension Decode */ 128 #define DECODE(a) (((a ^ 0x17)+0x17)&0xFF) 128 //#define DECODE(a) (((a ^ 0x17)+0x17)&0xFF) 129 #define DECODE(a) (a) 129 130 130 131 /* Write Sequences */ 131 132 enum write_seq_type { -
trunk/libcwiid/thread.c
192 192 193 193 if (status_mesg->ext_type == CWIID_EXT_UNKNOWN) { 194 194 if (wiimote->state.ext_type == CWIID_EXT_NONE) { 195 buf = 0x 00;195 buf = 0x55; 196 196 /* Initialize extension register space */ 197 if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400 40, 1, &buf)) {197 if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400F0, 1, &buf)) { 198 198 cwiid_err(wiimote, "Extension initialization error"); 199 199 status_mesg->ext_type = CWIID_EXT_UNKNOWN; 200 200 } 201 /* Read extension ID */202 else if (cwiid_read(wiimote, CWIID_RW_REG | CWIID_RW_DECODE,203 0xA400FE, 1, &buf)) {204 cwiid_err(wiimote, "Read error (extension error)");205 status_mesg->ext_type = CWIID_EXT_UNKNOWN;206 }207 201 else { 208 switch (buf) { 209 case EXT_NONE: 210 case EXT_PARTIAL: 211 status_mesg->ext_type = CWIID_EXT_NONE; 212 break; 213 case EXT_NUNCHUK: 214 status_mesg->ext_type = CWIID_EXT_NUNCHUK; 215 break; 216 case EXT_CLASSIC: 217 status_mesg->ext_type = CWIID_EXT_CLASSIC; 218 break; 219 default: 202 buf=0x00; 203 if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400FB, 1, &buf)) { 204 cwiid_err(wiimote, "Extension initialization error"); 220 205 status_mesg->ext_type = CWIID_EXT_UNKNOWN; 221 break;222 206 } 207 /* Read extension ID */ 208 else if (cwiid_read(wiimote, CWIID_RW_REG | CWIID_RW_DECODE, 209 0xA400FE, 1, &buf)) { 210 cwiid_err(wiimote, "Read error (extension error)"); 211 status_mesg->ext_type = CWIID_EXT_UNKNOWN; 212 } 213 else { 214 switch (buf) { 215 case EXT_NONE: 216 case EXT_PARTIAL: 217 status_mesg->ext_type = CWIID_EXT_NONE; 218 break; 219 case EXT_NUNCHUK: 220 status_mesg->ext_type = CWIID_EXT_NUNCHUK; 221 break; 222 case EXT_CLASSIC: 223 status_mesg->ext_type = CWIID_EXT_CLASSIC; 224 break; 225 default: 226 status_mesg->ext_type = CWIID_EXT_UNKNOWN; 227 break; 228 } 229 } 223 230 } 224 231 } 225 232 else {
