// Dummy portThreadCreate // As there are no real thread no real execution will be done // In the same way the thread cannot be eliminated // // Return 0 if OK int32_t portThreadCreate(int32_t nth, void *pointer) { consolePrintf("Dummy portThreadCreate%s",BREAK); consolePrintf("Don't create any real thread%s",BREAK); return 0; // OK }
//-------------------------------------------------------------------------------- void ShaderProgram::loadShaderProgram() { if( m_vertex != nullptr && m_fragment != nullptr ) { m_programID = glCreateProgram(); consolePrintf( "Program created" ); glAttachShader( m_programID, m_vertex->getShaderID() ); glAttachShader( m_programID, m_fragment->getShaderID() ); consolePrintf( "Shaders attached" ); glBindAttribLocation( m_programID, 0, "aPosition" ); glBindAttribLocation( m_programID, 1, "aNormal" ); glBindAttribLocation( m_programID, 2, "aColor" ); glBindAttribLocation( m_programID, 3, "aTexCoord0" ); glBindAttribLocation( m_programID, 4, "aTangent" ); glBindAttribLocation( m_programID, 5, "aBitangent" ); glLinkProgram( m_programID ); GLint linked = GL_FALSE; glGetProgramiv( m_programID, GL_LINK_STATUS, &linked ); if( linked != GL_TRUE ) { handleProgramLinkError( m_programID ); } } }
void handleKey(char k) { switch(k) { case '\b': case 127: if(cmdLen > 0) { consolePrintf("\b \b"); cmdLen--; } break; case '\r': case '\n': consolePrintf("\r"); cmdBuffer[cmdLen++] = '\0'; sendCommand(cmdBuffer); cmdLen = 0; usleep(1E6/20); break; default: if(cmdLen < buflen) { cmdBuffer[cmdLen++] = k; consolePrintf("%c", k); } break; } }
static void expbrdPrintData(ExpbrdData *data) { consolePrintf(" -Header:%X\n", data->header); consolePrintf(" -Pins :0x%X\n", *(unsigned int*)&data->usedPins); consolePrintf(" -Vid :%X\n", data->vid); consolePrintf(" -Pid :%X\n", data->pid); consolePrintf(" -crc :%X\n", data->crc); }
void memReadProcess() { uint8_t memId = p.data[0]; uint8_t readLen = p.data[5]; uint32_t memAddr; uint8_t status = 0; memcpy(&memAddr, &p.data[1], 4); MEM_DEBUG("Packet is MEM READ\n"); p.header = CRTP_HEADER(CRTP_PORT_MEM, READ_CH); // Dont' touch the first 5 bytes, they will be the same. if (memId == EEPROM_ID) { if (memAddr + readLen <= EEPROM_SIZE && eepromReadBuffer(&p.data[6], memAddr, readLen)) status = 0; else status = EIO; } else if (memId == LEDMEM_ID) { if (memAddr + readLen <= sizeof(ledringmem) && memcpy(&p.data[6], &(ledringmem[memAddr]), readLen)) status = 0; else status = EIO; } else { memId = memId - NBR_STATIC_MEM; if (memAddr + readLen <= OW_MAX_SIZE && owRead(memId, memAddr, readLen, &p.data[6])) status = 0; else status = EIO; } #if 0 { int i; for (i = 0; i < readLen; i++) consolePrintf("%X ", p.data[i+6]); consolePrintf("\nStatus %i\n", status); } #endif p.data[5] = status; if (status == 0) p.size = 6 + readLen; else p.size = 6; crtpSendPacket(&p); }
//--------------------------------------------------------------------------------- SpriteAnimation::SpriteAnimation( const std::string& animationFile ) : m_frameRate( 0.0f ) , m_isLoop( false ) , m_material( "" ) , m_isPlaying( false ) , m_lastFrameTime( 0.0f ) , m_currentFrameNumber( 0 ) { XMLParser parser( animationFile.c_str(), false ); XMLDocument& doc = parser.getDocument(); if( !doc.Error() ) { consolePrintf( "Loading animation: %s", animationFile.c_str() ); XMLNode* animation = doc.FirstChildElement( "Animation" ); parser.validateXMLAttributes( animation, "frameRate,material", "isLooping,startPlaying" ); parser.validateXMLChildElements( animation, "Frame", "" ); float frameRate = parser.getXMLAttributeAsFloat( animation, "frameRate", 0.0f ); bool isLooping = parser.getXMLAttributeAsBool( animation, "isLooping", false ); bool startPlaying = parser.getXMLAttributeAsBool( animation, "startPlaying", false ); std::string material = parser.getXMLAttributeAsString( animation, "material", "" ); m_frameRate = frameRate; m_isLoop = isLooping; m_material = material; XMLNode* frame; for( frame = animation->FirstChildElement( "Frame" ); frame != nullptr; frame = frame->NextSiblingElement( "Frame" ) ) { parser.validateXMLChildElements( frame, "TexCoords", "Material" ); XMLNode* texCoords = frame->FirstChildElement( "TexCoords" ); XMLNode* material = frame->FirstChildElement( "Material" ); parser.validateXMLAttributes( texCoords, "topLeft,width,height", "" ); vec2f topLeft = parser.getXMLAttributeAsVec2( texCoords, "topLeft", vec2f() ); float width = parser.getXMLAttributeAsFloat( texCoords, "width", 1.0f ); float height = parser.getXMLAttributeAsFloat( texCoords, "height", 1.0f ); std::string materialName; if( material != nullptr ) { parser.validateXMLAttributes( material, "name", "" ); materialName = parser.getXMLAttributeAsString( material, "name", "" ); } AddFrame( topLeft, width, height, materialName ); } if( startPlaying ) { Play(); } consolePrintf( "Successfully loaded animation: %s", animationFile.c_str() ); } }
//-------------------------------------------------------------------------------- ShaderProgram* ShaderProgram::createOrGetShaderProgram( const std::string& shaderName, const std::string& vertexFile, const std::string& fragFile ) { Shader* vertex = Shader::createOrGetShader( vertexFile, GL_VERTEX_SHADER ); Shader* frag = Shader::createOrGetShader( fragFile, GL_FRAGMENT_SHADER ); consolePrintf( "Looking for shader" ); std::map< std::string, ShaderProgram* >::iterator iter = sm_programs.find( shaderName ); //ShaderProgram*& program = sm_programs[ shaderName ]; if( iter == sm_programs.end() ) { consolePrintf( "Creating new shader" ); iter = sm_programs.insert( std::pair< std::string, ShaderProgram* >( shaderName, new ShaderProgram( shaderName, vertex, frag ) ) ).first; } return nullptr; }
// Cancel the process number obtained from // the top of the stack int32_t threadKill(ContextType *context,int32_t value) { UNUSED(value); int32_t nth; // Try to get the thread number if (PstackPop(context,&nth)) return 0; // Check number range if ((nth<1)||(nth>MAX_THREADS)) { if (SHOW_ERROR(context)) runtimeErrorMessage(context,"Invalid thread number"); return 0; } // Check if this thread is active if (FThreads[nth-1].status==FTS_NONE) { if (SHOW_ERROR(context)) consoleErrorMessage(context,"This thread is not running"); return 0; } // Set abort bit (FThreads[nth-1].context.Flags)|=CFLAG_ABORT; // Show info if enabled if (SHOW_INFO(context)) consolePrintf("Thread [%d] set to abort%s",nth,BREAK); return 0; }
void drawAutoComplete() { // Clear the auto complete area at the bottom of the screen. for (int y = 12; y < 24; y++) { for (int x = 0; x < 32; x++) { baseAddress[y * 32 + x] = 0; } } if ((autoCompleteCount == 0) || (typingTimeout > 0)) { // When there's no completions on the bottom of the screen, it acts like a mouse pad // so this text indicates that drawText(11, 18, "MOUSE AREA", true); } else { consolePrintf("time: %d\n", typingTimeout); // Otherwise, draw autocompletions if one isn't being entered and there are // some available. for (int r = 0; r < autoCompleteCount; r++) { int y = 12 + (r % 6) * 2; int x = 0 + ((r / 6) * 16); drawText(x, y, autoCompleteWord[r], selectedCompletion == r); } } }
//------------------------------------------------------------------------------- void GameApp::initialize() { m_isInitialized = true; consolePrintf( "Creating renderer" ); m_renderer = new Renderer( m_screenWidth, m_screenHeight, m_fov, 0.1f, 100000.0f ); m_renderer->loadRendereringDataFiles(); if( m_renderer != nullptr ) { m_debugCamera = new Camera( "DebugCamera", vec3f(), Camera::PH_ORTHOGRAPHIC, mat4f::ortho( 0.0f, (float)m_screenWidth, (float)m_screenHeight, 0.0f, 1.0f, -1.0f ) ); } executeStartUpCmds( "xml/StartupCmds.xml" ); m_mainFontParams.set( "fontName", std::string( "mainFont_72" ) ); m_mainFontParams.set( "fontHeight", 20.0f ); m_mainFontParams.set( "color", color::GREEN ); m_mainFontParams.set( "posRel", std::string( "TOPLEFT" ) ); m_mainFontParams.set( "camera", m_debugCamera ); matStackf modelStack; modelStack.translate( 0.0f, (float)m_screenHeight - 108, 0.0f ); m_memoryVisualizerParams.set( "modelMatrix", modelStack.top() ); //m_spinningCube = spawn( "random actor", MeshFactory::generate2DOrthoRectangle( 20.0f, 20.0f ) ); //m_spinningCube->setPosition( vec3f( m_screenWidth / 2, m_screenHeight / 2, 0.0f ) ); }
void DSOptionsDialog::updateConfigManager() { ConfMan.setBool("lefthanded", _leftHandedCheckbox->getState(), "ds"); ConfMan.setBool("unscaled", _unscaledCheckbox->getState(), "ds"); // ConfMan.setBool("twohundredpercent", _twoHundredPercentCheckbox->getState(), "ds"); ConfMan.setBool("22khzaudio", _highQualityAudioCheckbox->getState(), "ds"); ConfMan.setBool("disablepoweroff", _disablePowerOff->getState(), "ds"); #ifdef ALLOW_CPU_SCALER ConfMan.setBool("cpu_scaler", _cpuScaler->getState(), "ds"); #endif ConfMan.setInt("xoffset", _touchX->getValue(), "ds"); ConfMan.setInt("yoffset", _touchY->getValue(), "ds"); ConfMan.setBool("showcursor", _showCursorCheckbox->getState(), "ds"); ConfMan.setBool("snaptoborder", _snapToBorderCheckbox->getState(), "ds"); ConfMan.setBool("touchpad", _touchPadStyle->getState(), "ds"); ConfMan.setBool("screentaps", _screenTaps->getState(), "ds"); ConfMan.setInt("sensitivity", _sensitivity->getValue(), "ds"); ConfMan.setInt("gamma", _gammaCorrection->getValue(), "ds"); u32 zoomLevel = 150; if (_100PercentCheckbox->getState()) { zoomLevel = 100; } else if (_150PercentCheckbox->getState()) { zoomLevel = 150; } else if (_200PercentCheckbox->getState()) { zoomLevel = 200; } consolePrintf("Saved zoom: %d\n", zoomLevel); ConfMan.setInt("topscreenzoom", zoomLevel, "ds"); DS::setOptions(); }
int LDExporter::doExport( LDLModel * /*pTopLdlModel*/, TREModel * /*pTopTreModel*/) { consolePrintf("Programmer error: LDExporter::doExport called.\n"); return 1; }
void consoleNotef(const char *format, ...) { consolePrintf("-- "); va_list args; va_start(args, format); consolevPrintf(format, args); va_end(args); }
ZipFile::ZipFile() { // Locate a zip file in cartridge memory space // consolePrintf("ZIP file check..."); char *p = (char *) ZF_SEARCH_START; bool found = false; _zipFile = NULL; while ((p != (char *) ZF_SEARCH_END) && (!found)) { // Zip file header is: 0x504B0304 if ( (*p == 0x50) && (*(p + 1) == 0x4B) && (*(p + 2) == 0x03) && (*(p + 3) == 0x04) ) { // Found header! found = true; _zipFile = p; } if (!found) p += ZF_SEARCH_STRIDE; } if (_zipFile) { consolePrintf("ZIP File found Ok!\n"); } else { // consolePrintf("Not in use!\n"); return; } changeToRoot(); restartFile(); if (_currentFile->compSize != (u32) getFileSize()) { consolePrintf("Error: ZIP file contains compression!\n"); } _allFilesVisible = false; }
// List the current process status int32_t threadList(ContextType *context,int32_t value) { UNUSED(value); int32_t i,found=0; // Check if verbose level allows if (NO_RESPONSE(context)) return 0; CBK; // Line break LOCK_TLIST // Protect list from concurrent access for(i=0;i<MAX_THREADS;i++) if (FThreads[i].status!=FTS_NONE) { found=1; consolePrintf(" %d : ",i+1); showWordName(FThreads[i].position); // Show priority consolePrintf(" Prio[%d] ",FThreads[i].priority); // Show status information switch (FThreads[i].status) { case FTS_RUNNNING: if (FThreads[i].context.Flags&CFLAG_ABORT) {consolePrintf(" Aborting%s",BREAK);} else {consolePrintf(" Running%s",BREAK); } break; } } UNLOCK_TLIST // Unprotect list from concurrent access if (!found) consolePrintf("No active threads%s",BREAK); return 0; }
void logDisplay() { if(receivingLog) { logDump(logFile, &logInfo, logStorage, logTotal); logClose(); if(logTotal > 0) consolePrintf("\n"); consoleNotef("LOG DUMP COMPLETED\n"); } logTotal = 0; }
// Indicates if there is anything running in the background int32_t anythingBackground(void) { int32_t i, any=0; for (i=0;i<MAX_THREADS;i++) { if (FThreads[i].status!=FTS_NONE) { if (SHOW_INFO((&MainContext))) {consolePrintf("Thread [%d] is active%s",i+1,BREAK);} any=1; } } return any; }
void MSMap::SpawnNewObstacle( Camera* camera, const aabb2f& playerBox ) { RandNumGen::seed( (unsigned int)TimeUtils::GetAbsoluteTime( TimeUtils::MILLI ) ); int obstacleIdx = RandNumGen::randInRangeInt( 0, m_obstacleBlueprints.size() ); Obstacle* blueprint = m_obstacleBlueprints[ obstacleIdx ]; int layerToSpawnOn = RandNumGen::randInRangeInt( 0, (int)m_currentObstaclesOnMap.size() ); if( blueprint != nullptr ) { consolePrintf( "Spawning obstacle" ); vec3f spawnPos = m_playerSpawn; spawnPos.x = playerBox.getCenter().x + m_mapSize.x - m_mapOffsetFromPlayerPos.x; spawnPos.y = ( layerToSpawnOn - (int)m_currentObstaclesOnMap.size() / 2 ) * m_verticalOffsetBetweenLayers + spawnPos.y; Obstacle* newObstacle = new Obstacle( blueprint->material, blueprint->boundingBox ); newObstacle->boundingBox.setPositionFromCenter( spawnPos.xy() ); newObstacle->mesh = GenerateMeshFromAABB2( newObstacle->boundingBox, newObstacle->material ); m_currentObstaclesOnMap[layerToSpawnOn].push_back( newObstacle ); } }
// Cancel all running background threads int32_t threadKillAll(ContextType *context,int32_t value) { UNUSED(value); int32_t i; // Search all threads for(i=0;i<MAX_THREADS;i++) if (FThreads[i].status==FTS_RUNNNING) { // Set abort bit (FThreads[i].context.Flags)|=CFLAG_ABORT; // Show info if enabled if (SHOW_INFO(context)) consolePrintf("Thread [%d] set to abort%s",i+1,BREAK); } return 0; }
static void saveMessage(const String& filename) { debugPrintf("Saved %s\n", filename.c_str()); logPrintf("Saved %s\n", filename.c_str()); consolePrintf("Saved %s\n", filename.c_str()); }
void MSMap::AddRandomObstacle( Obstacle* obstacle ) { m_obstacleBlueprints.push_back( obstacle ); consolePrintf( "Spawning obstacle blueprint" ); }
ucstring LDExporter::getTypeDescription(void) const { consolePrintf("Programmer error: LDExporter::getTypeDescription called.\n"); return _UC(""); }
std::string LDExporter::getExtension(void) const { consolePrintf("Programmer error: LDExporter::getExtension called.\n"); return ""; }
int LDExporter::doExport(TREModel * /*pTopModel*/) { consolePrintf("Programmer error: LDExporter::doExport called.\n"); return 1; }
bool owTest() { uint8_t nOwMem = 0; uint8_t nOwIter = 0; OwSerialNum sn; if (owScan(&nOwMem)) { DEBUG_PRINT("Found %d.\n", nOwMem); } else { DEBUG_PRINT("Scan [FAILED].\n"); } for (nOwIter = 0; nOwIter < nOwMem; nOwIter++) { if (owGetinfo(nOwIter, &sn)) { DEBUG_PRINT("Serial 0x%X %X %X %X %X %X %X %X.\n", sn.type, sn.id[0], sn.id[1], sn.id[2], sn.id[3], sn.id[4], sn.id[5], sn.crc); } else { DEBUG_PRINT("Mem:%d Getinfo [FAILED].\n", nOwIter); } } #ifdef OW_READ_TEST { static uint8_t testbuf[129]; if (owRead(0, 0, OW_MAX_SIZE, testbuf)) { for (nOwIter = 0; nOwIter < OW_MAX_SIZE; nOwIter++) { consolePrintf("%X ", testbuf[nOwIter]); testbuf[nOwIter] = nOwIter; } consolePrintf("\n"); } } #endif #ifdef OW_WRITE_TEST if (owWrite(0, 0, sizeof(bqData), bqData)) { DEBUG_PRINT("Write [OK].\n"); } else { DEBUG_PRINT("Write [FAIL].\n"); } // if (owWrite(1, 0, sizeof(dummyData2), dummyData2)) // { // DEBUG_PRINT("Write [OK].\n"); // } // else // { // DEBUG_PRINT("Write [FAIL].\n"); // } #endif return true; }
void ModelContainerView::addGrid ( int iMap, int x, int y ) { generateMoveMapForTile (iMap, x, y); consolePrintf("Loaded %d-%d\n",x,y); }
//------------------------------------------------------------ void MonkyException::printToCompilerOutputConsole( const char* error ) { //OutputDebugStringA( error ); consolePrintf( error ); }
int LDExporter::runInternal(LDExporter *pExporter) { int retValue; if (pExporter != NULL) { std::string filename = getFilename(); if (filename.size() > 0) { LDLMainModel *pMainModel = new LDLMainModel; if (pMainModel->load(filename.c_str())) { char *cameraGlobe = stringForKey("CameraGlobe", NULL, false); LDLCamera camera; LDLAutoCamera *pAutoCamera = new LDLAutoCamera; pMainModel->getBoundingBox(pExporter->m_boundingMin, pExporter->m_boundingMax); pExporter->m_center = (pExporter->m_boundingMin + pExporter->m_boundingMax) / 2.0f; pExporter->m_radius = pMainModel->getMaxRadius(pExporter->m_center, true); pAutoCamera->setModel(pMainModel); pAutoCamera->setModelCenter(pExporter->m_center); pAutoCamera->setRotationMatrix(m_rotationMatrix); pAutoCamera->setCamera(camera); pAutoCamera->setCameraGlobe(cameraGlobe); //pAutoCamera->setDistanceMultiplier(distanceMultiplier); // Width and height are only needed for aspect ratio, not // absolute size. pAutoCamera->setWidth(m_width); pAutoCamera->setHeight(m_height); pAutoCamera->setFov(m_fov); pAutoCamera->setScanConditionalControlPoints(false); pAutoCamera->zoomToFit(); pExporter->m_camera = pAutoCamera->getCamera(); pAutoCamera->release(); retValue = pExporter->doExport(pMainModel); } else { #ifdef TC_NO_UNICODE consolePrintf(ls(_UC("ErrorLoadingModel")), filename.c_str()); #else // TC_NO_UNICODE std::wstring wfilename; stringtowstring(wfilename, filename); consolePrintf(ls(_UC("LDXErrorLoadingModel")), wfilename.c_str()); #endif // TC_NO_UNICODE retValue = 1; } TCObject::release(pMainModel); } else { consolePrintf(ls(_UC("LDXNoFilename"))); retValue = 1; } } else { consolePrintf(ls(_UC("LDXUnknownOutputType"))); retValue = 1; } return retValue; }