char* getChipVersion() { int retry = 10; char *ret = NULL; while(retry-- > 0){ if(property_get(CHIP_PROP, chip_version, NULL)){ chip_version[PROPERTY_VALUE_MAX - 1] = '\0'; if(0 == checkSupport(chip_version)){ chip_version[0] = 'm'; chip_version[1] = 't'; ret = chip_version; ALOGD("Get the correct chip version %s\n", chip_version); break; } } usleep(500000); } if(NULL == chip_version) ALOGD("Can't get the correct chip version %s.\n", chip_version); else ALOGD("Get chip Version %s.\n", chip_version); return ret; }
bool Foam::MeshedSurfaceProxy<Face>::canWriteType ( const word& ext, const bool verbose ) { return checkSupport(writeTypes(), ext, verbose, "writing"); }
bool Foam::edgeMesh::canWriteType ( const word& ext, const bool verbose ) { return checkSupport ( writeTypes(), ext, verbose, "writing" ); }
bool Foam::edgeMesh::canReadType ( const word& ext, const bool verbose ) { return checkSupport ( readTypes(), ext, verbose, "reading" ); }
bool Foam::UnsortedMeshedSurface<Face>::canReadType ( const word& ext, const bool verbose ) { return checkSupport ( readTypes() | ParentType::readTypes(), ext, verbose, "reading" ); }
SoundcardDialog::SoundcardDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SoundcardDialog) { ui->setupUi(this); // populate comboboxes PaDeviceIndex count = Pa_GetDeviceCount(); for(PaDeviceIndex idx=0; idx<count; idx++) { const PaDeviceInfo *info = Pa_GetDeviceInfo(idx); QString deviceName = PA_Helper::getDeviceString(idx); if (info->maxInputChannels > 0) { ui->inputComboBox->addItem(deviceName, QVariant(idx)); } if (info->maxOutputChannels > 0) { ui->outputComboBox->addItem(deviceName, QVariant(idx)); } } checkSupport(); }
void SoundcardDialog::on_outputComboBox_currentIndexChanged(int index) { checkSupport(); }
bool CglGMI::cleanCut(double* cutElem, int* cutIndex, int& cutNz, double& cutRhs, const double* xbar) { CglGMIParam::CleaningProcedure cleanProc = param.getCLEAN_PROC(); if (cleanProc == CglGMIParam::CP_CGLLANDP1) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } relaxRhs(cutRhs); removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_CGLLANDP1 */ else if (cleanProc == CglGMIParam::CP_CGLLANDP2) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } relaxRhs(cutRhs); if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 1) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_CGLLANDP2 */ else if (cleanProc == CglGMIParam::CP_CGLREDSPLIT) { if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 3) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } relaxRhs(cutRhs); } /* end of cleaning procedure CP_CGLREDSPLIT */ else if (cleanProc == CglGMIParam::CP_INTEGRAL_CUTS) { removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 0) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_INTEGRAL_CUTS */ else if (cleanProc == CglGMIParam::CP_CGLLANDP1_INT) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } // scale cut so that it becomes integral, if possible if (!scaleCut(cutElem, cutIndex, cutNz, cutRhs, 0)) { if (param.getENFORCE_SCALING()){ #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } else { // If cannot scale to integral and not enforcing, relax rhs // (as per CglLandP cleaning procedure) relaxRhs(cutRhs); } } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedure CP_CGLLANDP1_INT */ else if (cleanProc == CglGMIParam::CP_CGLLANDP1_SCALEMAX || cleanProc == CglGMIParam::CP_CGLLANDP1_SCALERHS) { if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } if (// Try to scale cut, but do not discard if cannot scale ((cleanProc == CglGMIParam::CP_CGLLANDP1_SCALEMAX && !scaleCut(cutElem, cutIndex, cutNz, cutRhs, 1)) || (cleanProc == CglGMIParam::CP_CGLLANDP1_SCALERHS && !scaleCut(cutElem, cutIndex, cutNz, cutRhs, 2))) && param.getENFORCE_SCALING()) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad scaling\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { scaleFail++; } #endif return false; } relaxRhs(cutRhs); removeSmallCoefficients(cutElem, cutIndex, cutNz, cutRhs); if (!checkSupport(cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: too large support\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { suppFail++; } #endif return false; } if (!checkDynamism(cutElem, cutIndex, cutNz)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad dynamism\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { dynFail++; } #endif return false; } if (!checkViolation(cutElem, cutIndex, cutNz, cutRhs, xbar)) { #if defined GMI_TRACE_CLEAN printf("CglGMI::cleanCut(): cut discarded: bad violation (final check)\n"); #endif #if defined TRACK_REJECT || defined TRACK_REJECT_SIMPLE if (trackRejection) { violFail++; } #endif return false; } } /* end of cleaning procedures CP_CGLLANDP1_SCALEMAX and CG_CGLLANDP1_SCALERHS */ return true; }
static void updatePlayerPosition(float lag) { if(levelAdvanceFalling) { float interHeight = (float)(_BRICK_HEIGHT * (_INTER_ROW_COUNT)); voff += _PLAYER_FALL_SPEED * lag; if(voff >= interHeight) { voff = 0.0; levelAdvanceFalling = false; vy = 0; level++; bcg_Cleanup(&bcg); bcg = bcgNext; bcg_Relativize(&bcg); if((level + 1) < _LEVEL_COUNT) bcgNext = bcg_Create(level_GetOffset(level + 1) - (float)_MAP_OFFSET_Y, level + 1); } return; } if(player->sclass != scidLastDrill || player->aended) newAnimation = scidPlayerStand[playerDirection]; bool hasSupport; Direction leanOutDirection; int i; goingUpTimer += lag; for(i = 0; i < DIR_COUNT; ++i) if(input_IsDirPressed(i)) playerDirection = i; /* check if player has support */ hasSupport = checkSupport(vx, vy, &leanOutDirection); if(!hasSupport) { voff += (float)_PLAYER_FALL_SPEED * lag; if(voff >= (float)_BRICK_HEIGHT) { vy++; voff -= (float)_BRICK_HEIGHT; if(checkSupport(vx, vy + 1, &leanOutDirection)) /* if gained support reset voff */ voff = 0.0; } newAnimation = scidPlayerFall; /* cancel slipping move if player lost his support */ slipping = false; return; } /* process player slipping move */ if(slipping) { /* What if player suddenly gains support or his way is blocked by a falling brick? Simple - it can't happen because that would mean he was smashed. */ hoff += lag * _PLAYER_SLIP_SPEED * (float)directionDelta[slipDirection][0]; if(hoff >= (float)_BRICK_WIDTH) { hoff -= (float)_BRICK_WIDTH; vx++; } if(hoff < 0.0) { hoff += (float)_BRICK_WIDTH; vx--; } return; } /* climbing bricks */ if(goingUpTrigger && goingUpTimer >= _DELAY_BEFORE_CLIMB) { goingUpTrigger = false; goingUp = true; } if(!input_IsDirPressed(goingUpDirection)) goingUp = false; if(goingUp) { int cvx = vx + directionDelta[goingUpDirection][0]; if(level_IsSolid(cvx, vy - 1) || level_IsSolid(vx, vy - 1) || !level_IsSolid(cvx, vy)) goingUp = false; } if(goingUp) { voff -= _PLAYER_FALL_SPEED * lag; if(voff <= -(float)_BRICK_HEIGHT) { goingUp = false; voff = 0.0; vy--; hoff += (float)directionDelta[goingUpDirection][0] * _PLAYER_SPEED * lag; } } else if(voff < 0.0) { voff += _PLAYER_FALL_SPEED * lag; if(voff > 0.0) voff = 0.0; } /* check keystates and update position/animation accordingly */ if(input_IsKeyPressed(KEY_DRILL)) { newAnimation = scidPlayerDrill[playerDirection]; scidLastDrill = newAnimation; if(!drillSched) { drillSched = true; drillDelayTimer = 0.0; return; } } if(drillSched) drillDelayTimer += lag; if(drillSched && drillDelayTimer >= _PLAYER_DRILL_DELAY) { drillSched = false; if(vy == (mapHeight - 1) && voff == 0.0 && playerDirection == DIR_DOWN) { advanceLevel(vx); return; } /* exact point where the brick was hit */ float hx, hy; bool destroyed = false; if(voff < _HIT_DISTANCE_THRESHOLD) { if(playerDirection > DIR_RIGHT) { destroyed = drillField(vx, vy + directionDelta[playerDirection][1]); hx = (float)(vx * _BRICK_WIDTH) + hoff; hy = (float)(vy * _BRICK_HEIGHT); if(playerDirection == DIR_DOWN) hy += (float)_BRICK_HEIGHT; } if(playerDirection == DIR_LEFT && hoff < (float)(_HIT_DISTANCE_THRESHOLD + _PLAYER_WIDTH2)) { destroyed = drillField(vx - 1, vy); hx = (float)(vx * _BRICK_WIDTH); hy = (float)(vy * _BRICK_HEIGHT + _BRICK_HEIGHT / 2); } if(playerDirection == DIR_RIGHT && ((float)(_BRICK_WIDTH - _PLAYER_WIDTH2) - hoff) < (float)(_HIT_DISTANCE_THRESHOLD)) { destroyed = drillField(vx + 1, vy); hx = (float)((vx + 1) * _BRICK_WIDTH); hy = (float)(vy * _BRICK_HEIGHT + _BRICK_HEIGHT / 2); } if(destroyed) { addDrillParticles(hx, hy, playerDirection); /* Cause player to slip off the brick he is standing off if he is leaning out towards newly created empty space. This will prevent those moments of confusion when player destroys a brick beneath and doesn't fall because he has additional support. */ if(playerDirection == DIR_DOWN && leanOutDirection != DIR_NONE) { slipping = true; if(leanOutDirection == DIR_LEFT) slipDirection = DIR_RIGHT; else slipDirection = DIR_LEFT; } } } return; } bool goUp = false; if(playerDirection == DIR_LEFT && input_IsDirPressed(DIR_LEFT)) { hoff -= lag * _PLAYER_SPEED; if(hoff < (float)_PLAYER_WIDTH2 && level_IsSolid(vx - 1, vy)) { hoff = (float)_PLAYER_WIDTH2; if(!level_IsSolid(vx - 1, vy - 1)) goUp = true; } else newAnimation = scidPlayerWalk[DIR_LEFT]; } if(playerDirection == DIR_RIGHT && input_IsDirPressed(DIR_RIGHT)) { hoff += lag * _PLAYER_SPEED; if(hoff > (float)(_BRICK_WIDTH - _PLAYER_WIDTH2) && level_IsSolid(vx + 1, vy)) { hoff = (float)(_BRICK_WIDTH - _PLAYER_WIDTH2); if(!level_IsSolid(vx + 1, vy - 1)) goUp = true; } else newAnimation = scidPlayerWalk[DIR_RIGHT]; } if(hoff < 0.0) { hoff += (float)_BRICK_WIDTH; vx--; } if(hoff >= (float)_BRICK_WIDTH) { hoff -= (float)_BRICK_WIDTH; vx++; } if(goUp && !level_IsSolid(vx, vy - 1) && !goingUp && !goingUpTrigger) { goingUp = false; goingUpTrigger = true; goingUpShift = 0.0; goingUpDirection = playerDirection; goingUpTimer = 0.0; } }