Adjusts the report for any settings specified by the user
| 153 | |
| 154 | // Adjusts the report for any settings specified by the user |
| 155 | void Wireless360Controller::fiddleReport(unsigned char *data, int length) |
| 156 | { |
| 157 | XBOX360_IN_REPORT *report=(XBOX360_IN_REPORT*)data; |
| 158 | if(invertLeftX) report->left.x=~report->left.x; |
| 159 | if(!invertLeftY) report->left.y=~report->left.y; |
| 160 | if(invertRightX) report->right.x=~report->right.x; |
| 161 | if(!invertRightY) report->right.y=~report->right.y; |
| 162 | if(deadzoneLeft!=0) { |
| 163 | if(relativeLeft) { |
| 164 | if((getAbsolute(report->left.x)<deadzoneLeft)&&(getAbsolute(report->left.y)<deadzoneLeft)) { |
| 165 | report->left.x=0; |
| 166 | report->left.y=0; |
| 167 | } |
| 168 | else if(deadOffLeft) { |
| 169 | const UInt16 max16=32767; |
| 170 | float maxVal=max16-deadzoneLeft; |
| 171 | float valX=getAbsolute(report->left.x); |
| 172 | if (valX>deadzoneLeft) { |
| 173 | if (report->left.x<0) { |
| 174 | report->left.x=max16*(valX-deadzoneLeft)/maxVal; |
| 175 | report->left.x=~report->left.x; |
| 176 | } else { |
| 177 | report->left.x=max16*(valX-deadzoneLeft)/maxVal; |
| 178 | } |
| 179 | } else { |
| 180 | report->left.x=0; |
| 181 | } |
| 182 | float valY=getAbsolute(report->left.y); |
| 183 | if (valY>deadzoneLeft) { |
| 184 | if (report->left.y<0) { |
| 185 | report->left.y=max16*(valY-deadzoneLeft)/maxVal; |
| 186 | report->left.y=~report->left.y; |
| 187 | } else { |
| 188 | report->left.y=max16*(valY-deadzoneLeft)/maxVal; |
| 189 | } |
| 190 | } else { |
| 191 | report->left.y=0; |
| 192 | } |
| 193 | } |
| 194 | } else { |
| 195 | if(getAbsolute(report->left.x)<deadzoneLeft) |
| 196 | report->left.x=0; |
| 197 | else if (deadOffLeft) |
| 198 | { |
| 199 | const UInt16 max16=32767; |
| 200 | float maxVal=max16-deadzoneLeft; |
| 201 | if (report->left.x<0) { |
| 202 | float valX=getAbsolute(report->left.x); |
| 203 | report->left.x=max16*(valX-deadzoneLeft)/maxVal; |
| 204 | report->left.x=~report->left.x; |
| 205 | } else { |
| 206 | float valX=getAbsolute(report->left.x); |
| 207 | report->left.x=max16*(valX-deadzoneLeft)/maxVal; |
| 208 | } |
| 209 | } |
| 210 | if(getAbsolute(report->left.y)<deadzoneLeft) |
| 211 | report->left.y=0; |
| 212 | else if (deadOffLeft) |
nothing calls this directly
no test coverage detected