| 1 | /* ************************************************************************* * |
| 2 | SDL-Ball - DX-Ball/Breakout remake with openGL and SDL for Linux |
| 3 | Copyright (C) 2008 Jimmy Christensen ( dusted at dusted dot dk ) |
| 4 | |
| 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * ************************************************************************* */ |
| 18 | |
| 19 | #include <unistd.h> |
| 20 | |
| 21 | class controllerClasscxx . . $ controllerClass# { |
| 22 | private: |
| 23 | paddle_classcxx . . $ paddle_class# *paddlecxx . . $ controllerClass#paddle.; |
| 24 | bulletsClasscxx . . $ bulletsClass# *bulletcxx . . $ controllerClass#bullet.; |
| 25 | ballManagercxx . . $ ballManager# *bMancxx . . $ controllerClass#bMan.; |
| 26 | #define ITEMSELECTTIMEcxx . . $ `input.cpp:26:11`! 300 /* Milliseconds before changing item */ |
| 27 | int shotTimecxx . . $ controllerClass#shotTime., itemSelectTimecxx . . $ controllerClass#itemSelectTime.; |
| 28 | float accelcxx . . $ controllerClass#accel.; |
| 29 | SDL_Joystick *joystickcxx . . $ controllerClass#joystick.; |
| 30 | Sint16cxx . . $ Sint16# joystickxcxx . . $ controllerClass#joystickx.; |
| 31 | Sint16cxx . . $ Sint16# joystickycxx . . $ controllerClass#joysticky.; |
| 32 | Uint8cxx . . $ Uint8# joystickbtnAcxx . . $ controllerClass#joystickbtnA., joystickbtnBcxx . . $ controllerClass#joystickbtnB.; |
| 33 | bool joyBtnALockcxx . . $ controllerClass#joyBtnALock.; //TODO: implement this in the rest of the joystick functions (current only using it in cal) |
| 34 | GLfloat joystickLeftXcxx . . $ controllerClass#joystickLeftX.; //There are two because the calibrated values differ |
| 35 | GLfloat joystickRightXcxx . . $ controllerClass#joystickRightX.; |
| 36 | int calMincxx . . $ controllerClass#calMin., calMaxcxx . . $ controllerClass#calMax., calLowJittercxx . . $ controllerClass#calLowJitter., calHighJittercxx . . $ controllerClass#calHighJitter.; |
| 37 | |
| 38 | #ifdef WITH_WIIUSE |
| 39 | wiimote** wiimotes; |
| 40 | float motePitch; |
| 41 | GLfloat moteAccel; |
| 42 | #endif |
| 43 | |
| 44 | public: |
| 45 | controllerClasscxx . . $ controllerClass#controllerClass(e6d24cdab6e8da6e).(paddle_classcxx . . $ paddle_class# *pc, bulletsClasscxx . . $ bulletsClass# *bu, ballManagercxx . . $ ballManager# *bm); |
| 46 | ~cxx . . $ controllerClass#`~controllerClass`(ced63f7c635d850d).controllerClasscxx . . $ controllerClass#(); |
| 47 | void movePaddlecxx . . $ controllerClass#movePaddle(9364e6e7bff7660).(GLfloat px); |
| 48 | void btnPresscxx . . $ controllerClass#btnPress(49f6e7a06ebc5aa8).(); |
| 49 | bool getcxx . . $ controllerClass#get(c9857a73d68e59ba).(); |
| 50 | void calibratecxx . . $ controllerClass#calibrate(49f6e7a06ebc5aa8).(); |
| 51 | #ifdef WITH_WIIUSE |
| 52 | bool connectMote(); |
| 53 | #endif |
| 54 | }; |
| 55 | |
| 56 | controllerClasscxx . . $ controllerClass#::controllerClasscxx . . $ controllerClass#controllerClass(e6d24cdab6e8da6e).(paddle_classcxx . . $ paddle_class# *pc, bulletsClasscxx . . $ bulletsClass# *bu, ballManagercxx . . $ ballManager# *bm) |
| 57 | { |
| 58 | paddlecxx . . $ controllerClass#paddle. = pc; |
| 59 | bulletcxx . . $ controllerClass#bullet. = bu; |
| 60 | bMancxx . . $ controllerClass#bMan. = bm; |
| 61 | shotTimecxx . . $ controllerClass#shotTime.=200; |
| 62 | itemSelectTimecxx . . $ controllerClass#itemSelectTime.=0; |
| 63 | |
| 64 | //Try to open a joystick. |
| 65 | if(settingcxx . . $ setting..joyEnabledcxx . . $ settings#joyEnabled. && SDL_NumJoysticks() > 0) |
| 66 | { |
| 67 | joystickLeftXcxx . . $ controllerClass#joystickLeftX. = settingcxx . . $ setting..controlMaxSpeedcxx . . $ settings#controlMaxSpeed. / settingcxx . . $ setting..JoyCalMincxx . . $ settings#JoyCalMin.; |
| 68 | joystickRightXcxx . . $ controllerClass#joystickRightX. = settingcxx . . $ setting..controlMaxSpeedcxx . . $ settings#controlMaxSpeed. / settingcxx . . $ setting..JoyCalMaxcxx . . $ settings#JoyCalMax.; |
| 69 | joystickcxx . . $ controllerClass#joystick. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 70 | joystickcxx . . $ controllerClass#joystick. = SDL_JoystickOpen(0); |
| 71 | if(SDL_JoystickOpened(0)) |
| 72 | { |
| 73 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Using joystick: '"<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).SDL_JoystickName(0)<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7)."' as "<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).(settingcxx . . $ setting..joyIsDigitalcxx . . $ settings#joyIsDigital. ? "digital":"analog")<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7)."."<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 74 | SDL_JoystickEventState( SDL_ENABLEcxx . . $ `<external>/11062667682718636558/SDL_events.h:237:9`! ); |
| 75 | } else { |
| 76 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Failed to open joystick: '"<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).SDL_JoystickName(0)<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7)."'"<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | #ifdef WITH_WIIUSE |
| 81 | var.wiiConnect=0; |
| 82 | moteAccel = setting.controlMaxSpeed / 90.0; |
| 83 | #endif |
| 84 | |
| 85 | } |
| 86 | |
| 87 | controllerClasscxx . . $ controllerClass#::~cxx . . $ controllerClass#`~controllerClass`(ced63f7c635d850d).controllerClasscxx . . $ controllerClass#() |
| 88 | { |
| 89 | SDL_JoystickClose(0); |
| 90 | |
| 91 | #ifdef WITH_WIIUSE |
| 92 | if(var.wiiConnect) |
| 93 | { |
| 94 | wiiuse_cleanup(wiimotes, MAX_WIIMOTES); |
| 95 | } |
| 96 | #endif |
| 97 | } |
| 98 | |
| 99 | void controllerClasscxx . . $ controllerClass#::movePaddlecxx . . $ controllerClass#movePaddle(9364e6e7bff7660).(GLfloat px) |
| 100 | { |
| 101 | if(!varcxx . . $ var..pausedcxx . . $ vars#paused.) |
| 102 | { |
| 103 | paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx. = px; |
| 104 | if(paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx. > 1.66-paddlecxx . . $ controllerClass#paddle.->widthcxx . . $ object#width.-0.06) |
| 105 | { |
| 106 | paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx.=1.66-paddlecxx . . $ controllerClass#paddle.->widthcxx . . $ object#width.-0.06; |
| 107 | } |
| 108 | else if(paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx. < -1.66+paddlecxx . . $ controllerClass#paddle.->widthcxx . . $ object#width.+0.06) |
| 109 | { |
| 110 | paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx.=-1.66+paddlecxx . . $ controllerClass#paddle.->widthcxx . . $ object#width.+0.06; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void controllerClasscxx . . $ controllerClass#::btnPresscxx . . $ controllerClass#btnPress(49f6e7a06ebc5aa8).() |
| 116 | { |
| 117 | if(varcxx . . $ var..titleScreenShowcxx . . $ vars#titleScreenShow.) |
| 118 | { |
| 119 | varcxx . . $ var..titleScreenShowcxx . . $ vars#titleScreenShow.=0; |
| 120 | SDL_WarpMouse(varcxx . . $ var..halfresxcxx . . $ vars#halfresx.,0); |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | struct poscxx . . $ pos# p; |
| 125 | if(shotTimecxx . . $ controllerClass#shotTime. > 150) |
| 126 | { |
| 127 | shotTimecxx . . $ controllerClass#shotTime.=0; |
| 128 | if(!varcxx . . $ var..menucxx . . $ vars#menu. && !varcxx . . $ var..pausedcxx . . $ vars#paused.) |
| 129 | { |
| 130 | bMancxx . . $ controllerClass#bMan.->ungluecxx . . $ ballManager#unglue(49f6e7a06ebc5aa8).(); |
| 131 | varcxx . . $ var..startedPlayingcxx . . $ vars#startedPlaying.=1; |
| 132 | if(playercxx . . $ player..powerupcxx . . $ player_struct#powerup.[PO_GUNcxx . . $ `main.cpp:92:9`!]) |
| 133 | { |
| 134 | p.xcxx . . $ pos#x. = paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx.-paddlecxx . . $ controllerClass#paddle.->widthcxx . . $ object#width./1.5; |
| 135 | p.ycxx . . $ pos#y. = paddlecxx . . $ controllerClass#paddle.->posycxx . . $ object#posy.; |
| 136 | bulletcxx . . $ controllerClass#bullet.->shootcxx . . $ bulletsClass#shoot(4257ac68cdd0a6fa).(p); |
| 137 | p.xcxx . . $ pos#x. = paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx.+paddlecxx . . $ controllerClass#paddle.->widthcxx . . $ object#width./1.5; |
| 138 | bulletcxx . . $ controllerClass#bullet.->shootcxx . . $ bulletsClass#shoot(4257ac68cdd0a6fa).(p); |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | bool controllerClasscxx . . $ controllerClass#::getcxx . . $ controllerClass#get(c9857a73d68e59ba).() |
| 145 | { |
| 146 | Uint8cxx . . $ Uint8# *keyStates; |
| 147 | Uint8cxx . . $ Uint8# keyDown[3]; //Need this since its not a good idea to write to keyStates for some reason |
| 148 | shotTimecxx . . $ controllerClass#shotTime. += globalTickscxx . . $ globalTicks.; |
| 149 | SDL_PumpEvents(); |
| 150 | keyStates = SDL_GetKeyState( NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! ); |
| 151 | keyDown[0] = keyStates[settingcxx . . $ setting..keyLeftcxx . . $ settings#keyLeft.]; |
| 152 | keyDown[1] = keyStates[settingcxx . . $ setting..keyRightcxx . . $ settings#keyRight.]; |
| 153 | keyDown[2] = keyStates[settingcxx . . $ setting..keyShootcxx . . $ settings#keyShoot.]; |
| 154 | |
| 155 | itemSelectTimecxx . . $ controllerClass#itemSelectTime. += globalTickscxx . . $ globalTicks.; |
| 156 | //Read joystick here so we can override keypresses if the joystick is digital |
| 157 | //We shouldn't need to check if the joystick is enabled, since it won't be opened if its not enabled anyway. |
| 158 | if(settingcxx . . $ setting..joyEnabledcxx . . $ settings#joyEnabled. && SDL_JoystickOpened(0)) |
| 159 | { |
| 160 | joystickxcxx . . $ controllerClass#joystickx. = SDL_JoystickGetAxis(joystickcxx . . $ controllerClass#joystick., 0); |
| 161 | joystickycxx . . $ controllerClass#joysticky. = SDL_JoystickGetAxis(joystickcxx . . $ controllerClass#joystick., 1); |
| 162 | joystickbtnAcxx . . $ controllerClass#joystickbtnA. = SDL_JoystickGetButton(joystickcxx . . $ controllerClass#joystick., 0); |
| 163 | joystickbtnBcxx . . $ controllerClass#joystickbtnB. = SDL_JoystickGetButton(joystickcxx . . $ controllerClass#joystick., 1); |
| 164 | |
| 165 | |
| 166 | if(joystickbtnAcxx . . $ controllerClass#joystickbtnA.) |
| 167 | { |
| 168 | keyDown[2] = 1; |
| 169 | } |
| 170 | if(joystickbtnBcxx . . $ controllerClass#joystickbtnB. && itemSelectTimecxx . . $ controllerClass#itemSelectTime. > ITEMSELECTTIMEcxx . . $ `input.cpp:26:11`!) |
| 171 | { |
| 172 | itemSelectTimecxx . . $ controllerClass#itemSelectTime.=0; |
| 173 | gVarcxx . . $ gVar..shopBuyItemcxx . . $ gameVars#shopBuyItem.=1; |
| 174 | } |
| 175 | |
| 176 | if(settingcxx . . $ setting..joyIsDigitalcxx . . $ settings#joyIsDigital.) |
| 177 | { |
| 178 | if(joystickxcxx . . $ controllerClass#joystickx. < -200) |
| 179 | { |
| 180 | keyDown[0]=1; |
| 181 | } else if(joystickxcxx . . $ controllerClass#joystickx. > 200) |
| 182 | { |
| 183 | keyDown[1]=1; |
| 184 | } |
| 185 | if(joystickycxx . . $ controllerClass#joysticky. < -200 && itemSelectTimecxx . . $ controllerClass#itemSelectTime. > ITEMSELECTTIMEcxx . . $ `input.cpp:26:11`!) |
| 186 | { |
| 187 | itemSelectTimecxx . . $ controllerClass#itemSelectTime.=0; |
| 188 | gVarcxx . . $ gVar..shopNextItemcxx . . $ gameVars#shopNextItem. = 1; |
| 189 | } else if(joystickycxx . . $ controllerClass#joysticky. > 200 && itemSelectTimecxx . . $ controllerClass#itemSelectTime. > ITEMSELECTTIMEcxx . . $ `input.cpp:26:11`!) |
| 190 | { |
| 191 | itemSelectTimecxx . . $ controllerClass#itemSelectTime.=0; |
| 192 | gVarcxx . . $ gVar..shopPrevItemcxx . . $ gameVars#shopPrevItem. = 1; |
| 193 | } |
| 194 | |
| 195 | } else { |
| 196 | GLfloat x = 0.0; //This is the actual traveling speed of the paddle |
| 197 | if(joystickxcxx . . $ controllerClass#joystickx. > settingcxx . . $ setting..JoyCalHighJittercxx . . $ settings#JoyCalHighJitter.) |
| 198 | { |
| 199 | x = joystickRightXcxx . . $ controllerClass#joystickRightX. * joystickxcxx . . $ controllerClass#joystickx.; |
| 200 | } else if(joystickxcxx . . $ controllerClass#joystickx. < settingcxx . . $ setting..JoyCalLowJittercxx . . $ settings#JoyCalLowJitter.) |
| 201 | { |
| 202 | x = -(joystickLeftXcxx . . $ controllerClass#joystickLeftX. * joystickxcxx . . $ controllerClass#joystickx.); |
| 203 | } |
| 204 | |
| 205 | if(joystickycxx . . $ controllerClass#joysticky. < settingcxx . . $ setting..JoyCalLowJittercxx . . $ settings#JoyCalLowJitter. && itemSelectTimecxx . . $ controllerClass#itemSelectTime. > ITEMSELECTTIMEcxx . . $ `input.cpp:26:11`!) |
| 206 | { |
| 207 | itemSelectTimecxx . . $ controllerClass#itemSelectTime.=0; |
| 208 | gVarcxx . . $ gVar..shopNextItemcxx . . $ gameVars#shopNextItem. = 1; |
| 209 | } else if(joystickycxx . . $ controllerClass#joysticky. > settingcxx . . $ setting..JoyCalHighJittercxx . . $ settings#JoyCalHighJitter. && itemSelectTimecxx . . $ controllerClass#itemSelectTime. > ITEMSELECTTIMEcxx . . $ `input.cpp:26:11`!) |
| 210 | { |
| 211 | itemSelectTimecxx . . $ controllerClass#itemSelectTime.=0; |
| 212 | gVarcxx . . $ gVar..shopPrevItemcxx . . $ gameVars#shopPrevItem. = 1; |
| 213 | } |
| 214 | //Move the paddle: |
| 215 | movePaddlecxx . . $ controllerClass#movePaddle(9364e6e7bff7660).( paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx. += (x*globalMilliTickscxx . . $ globalMilliTicks.) ); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | #ifdef WITH_WIIUSE |
| 220 | if(var.wiiConnect) |
| 221 | { |
| 222 | if (wiiuse_poll(wiimotes, MAX_WIIMOTES)) { |
| 223 | switch(wiimotes[0]->event) |
| 224 | { |
| 225 | case WIIUSE_EVENT: |
| 226 | if(IS_PRESSED(wiimotes[0], WIIMOTE_BUTTON_TWO)) |
| 227 | { |
| 228 | keyDown[2]=1; |
| 229 | } else if(IS_PRESSED(wiimotes[0], WIIMOTE_BUTTON_ONE) && itemSelectTime > ITEMSELECTTIME) |
| 230 | { |
| 231 | gVar.shopBuyItem = 1; |
| 232 | itemSelectTime=0; |
| 233 | }else if(IS_PRESSED(wiimotes[0], WIIMOTE_BUTTON_UP) && itemSelectTime > ITEMSELECTTIME) |
| 234 | { |
| 235 | itemSelectTime=0; |
| 236 | gVar.shopPrevItem = 1; |
| 237 | }else if(IS_PRESSED(wiimotes[0], WIIMOTE_BUTTON_DOWN) && itemSelectTime > ITEMSELECTTIME) |
| 238 | { |
| 239 | itemSelectTime=0; |
| 240 | gVar.shopNextItem = 1; |
| 241 | } else if(WIIUSE_USING_ACC(wiimotes[0])) |
| 242 | { |
| 243 | motePitch = wiimotes[0]->orient.pitch; |
| 244 | motePitch *=-1; |
| 245 | } |
| 246 | |
| 247 | break; |
| 248 | case WIIUSE_DISCONNECT: |
| 249 | case WIIUSE_UNEXPECTED_DISCONNECT: |
| 250 | var.wiiConnect=0; |
| 251 | cout << "WiiMote disconnected." << endl; |
| 252 | wiiuse_cleanup(wiimotes, MAX_WIIMOTES); |
| 253 | break; |
| 254 | } |
| 255 | } |
| 256 | if(motePitch < -0.2 || motePitch > 0.2) |
| 257 | { |
| 258 | movePaddle( paddle->posx += ( moteAccel*motePitch)*globalMilliTicks ); |
| 259 | } |
| 260 | } |
| 261 | #endif |
| 262 | |
| 263 | //React to keystates here, this way, if joyisdig it will press keys |
| 264 | if(keyDown[0]) |
| 265 | { |
| 266 | accelcxx . . $ controllerClass#accel.+=globalMilliTickscxx . . $ globalMilliTicks.*settingcxx . . $ setting..controlAccelcxx . . $ settings#controlAccel.; |
| 267 | if(accelcxx . . $ controllerClass#accel. > settingcxx . . $ setting..controlMaxSpeedcxx . . $ settings#controlMaxSpeed.) |
| 268 | accelcxx . . $ controllerClass#accel.=settingcxx . . $ setting..controlMaxSpeedcxx . . $ settings#controlMaxSpeed.; |
| 269 | movePaddlecxx . . $ controllerClass#movePaddle(9364e6e7bff7660).( paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx. - ( accelcxx . . $ controllerClass#accel.*globalMilliTickscxx . . $ globalMilliTicks.) ); |
| 270 | } else if(keyDown[1]) |
| 271 | { |
| 272 | accelcxx . . $ controllerClass#accel.+=globalMilliTickscxx . . $ globalMilliTicks.*settingcxx . . $ setting..controlAccelcxx . . $ settings#controlAccel.; |
| 273 | if(accelcxx . . $ controllerClass#accel. > settingcxx . . $ setting..controlMaxSpeedcxx . . $ settings#controlMaxSpeed.) |
| 274 | accelcxx . . $ controllerClass#accel.=settingcxx . . $ setting..controlMaxSpeedcxx . . $ settings#controlMaxSpeed.; |
| 275 | movePaddlecxx . . $ controllerClass#movePaddle(9364e6e7bff7660).( paddlecxx . . $ controllerClass#paddle.->posxcxx . . $ object#posx. + ( accelcxx . . $ controllerClass#accel.*globalMilliTickscxx . . $ globalMilliTicks.) ); |
| 276 | } else { |
| 277 | accelcxx . . $ controllerClass#accel. = settingcxx . . $ setting..controlStartSpeedcxx . . $ settings#controlStartSpeed.; |
| 278 | } |
| 279 | |
| 280 | if(keyDown[2]) |
| 281 | { |
| 282 | btnPresscxx . . $ controllerClass#btnPress(49f6e7a06ebc5aa8).(); |
| 283 | return(1); |
| 284 | } else { |
| 285 | return(0); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | void controllerClasscxx . . $ controllerClass#::calibratecxx . . $ controllerClass#calibrate(49f6e7a06ebc5aa8).() |
| 290 | { |
| 291 | |
| 292 | Sint16cxx . . $ Sint16# x=0; |
| 293 | if(SDL_JoystickOpened(0)) |
| 294 | { |
| 295 | |
| 296 | x = SDL_JoystickGetAxis(joystickcxx . . $ controllerClass#joystick., 0); |
| 297 | |
| 298 | if(SDL_JoystickGetButton(joystickcxx . . $ controllerClass#joystick., 0)) |
| 299 | { |
| 300 | if(!joyBtnALockcxx . . $ controllerClass#joyBtnALock. && varcxx . . $ var..menuJoyCalStagecxx . . $ vars#menuJoyCalStage. != 5) |
| 301 | { |
| 302 | varcxx . . $ var..menuJoyCalStagecxx . . $ vars#menuJoyCalStage.++; |
| 303 | joyBtnALockcxx . . $ controllerClass#joyBtnALock.=1; |
| 304 | } |
| 305 | } else { |
| 306 | joyBtnALockcxx . . $ controllerClass#joyBtnALock.=0; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | switch(varcxx . . $ var..menuJoyCalStagecxx . . $ vars#menuJoyCalStage.) |
| 311 | { |
| 312 | case 0: |
| 313 | calMincxx . . $ controllerClass#calMin.=0; |
| 314 | calMaxcxx . . $ controllerClass#calMax.=0; |
| 315 | calLowJittercxx . . $ controllerClass#calLowJitter.=0; |
| 316 | calHighJittercxx . . $ controllerClass#calHighJitter.=0; |
| 317 | break; |
| 318 | case 1: |
| 319 | if(x < calLowJittercxx . . $ controllerClass#calLowJitter.) |
| 320 | calLowJittercxx . . $ controllerClass#calLowJitter.=x; |
| 321 | else if(x > calHighJittercxx . . $ controllerClass#calHighJitter.) |
| 322 | calHighJittercxx . . $ controllerClass#calHighJitter.=x; |
| 323 | break; |
| 324 | case 2: |
| 325 | if(x < calMincxx . . $ controllerClass#calMin.) |
| 326 | calMincxx . . $ controllerClass#calMin.=x; |
| 327 | break; |
| 328 | case 3: |
| 329 | if(x > calMaxcxx . . $ controllerClass#calMax.) |
| 330 | calMaxcxx . . $ controllerClass#calMax.=x; |
| 331 | break; |
| 332 | case 4: |
| 333 | settingcxx . . $ setting..JoyCalMincxx . . $ settings#JoyCalMin.=calMincxx . . $ controllerClass#calMin.; |
| 334 | settingcxx . . $ setting..JoyCalMaxcxx . . $ settings#JoyCalMax.=calMaxcxx . . $ controllerClass#calMax.; |
| 335 | settingcxx . . $ setting..JoyCalLowJittercxx . . $ settings#JoyCalLowJitter.=calLowJittercxx . . $ controllerClass#calLowJitter.; |
| 336 | settingcxx . . $ setting..JoyCalHighJittercxx . . $ settings#JoyCalHighJitter.=calHighJittercxx . . $ controllerClass#calHighJitter.; |
| 337 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Joystick calibration report:" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 338 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "calMin: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). calMincxx . . $ controllerClass#calMin. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9). <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "calMax: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). calMaxcxx . . $ controllerClass#calMax. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 339 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "lowJit: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). calLowJittercxx . . $ controllerClass#calLowJitter. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9). <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "higJit: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). calHighJittercxx . . $ controllerClass#calHighJitter. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 340 | varcxx . . $ var..menuJoyCalStagecxx . . $ vars#menuJoyCalStage.++; |
| 341 | writeSettingscxx . . $ writeSettings(49f6e7a06ebc5aa8).(); |
| 342 | break; |
| 343 | #ifdef WITH_WIIUSE |
| 344 | case -1: //We do this to make it draw a frame before freezing (searching) |
| 345 | var.menuJoyCalStage--; |
| 346 | break; |
| 347 | case -2: |
| 348 | wiimotes = wiiuse_init(MAX_WIIMOTES); |
| 349 | if(wiiuse_find(wiimotes, MAX_WIIMOTES, 4)) |
| 350 | { |
| 351 | var.wiiConnect=1; |
| 352 | } else { |
| 353 | var.wiiConnect=0; |
| 354 | } |
| 355 | if(var.wiiConnect) |
| 356 | { |
| 357 | var.wiiConnect=0; |
| 358 | if(wiiuse_connect(wiimotes, MAX_WIIMOTES)) |
| 359 | { |
| 360 | var.wiiConnect=1; |
| 361 | wiiuse_set_leds(wiimotes[0], WIIMOTE_LED_1); |
| 362 | wiiuse_rumble(wiimotes[0], 1); |
| 363 | usleep(500000); |
| 364 | wiiuse_rumble(wiimotes[0], 0); |
| 365 | wiiuse_motion_sensing(wiimotes[0], 1); |
| 366 | } |
| 367 | var.menuJoyCalStage=-3; |
| 368 | } else { |
| 369 | var.menuJoyCalStage=-4; |
| 370 | } |
| 371 | break; |
| 372 | #endif |
| 373 | } |
| 374 | } |
| 375 |