bool Game::launch() { bool ret; if (_init()) { ret = _play(); _uninit(); return ret; } else { _uninit(); _displayError(); return false; } }
void CrossDelegate::performUninit() { if (initialized_ && !setup_) { _uninit(); initialized_ = false; intern::instance = nullptr; } }
bool CRtkService::_restart() { utils_trace("Restarting %s...\n", versionString.c_str()); if(!_uninit()){ return false; } if(!_init()){ return false; } restart_time(true); return true; }
ShaderGen::~ShaderGen() { GFXDevice::getDeviceEventSignal().remove(this, &ShaderGen::_handleGFXEvent); _uninit(); }
void ShaderGen::generateShader( const MaterialFeatureData &featureData, char *vertFile, char *pixFile, F32 *pixVersion, const GFXVertexFormat *vertexFormat, const char* cacheName, Vector<GFXShaderMacro> ¯os ) { PROFILE_SCOPE( ShaderGen_GenerateShader ); mFeatureData = featureData; mVertexFormat = vertexFormat; _uninit(); _init(); char vertShaderName[256]; char pixShaderName[256]; // Note: We use a postfix of _V/_P here so that it sorts the matching // vert and pixel shaders together when listed alphabetically. dSprintf( vertShaderName, sizeof(vertShaderName), "shadergen:/%s_V.%s", cacheName, mFileEnding.c_str() ); dSprintf( pixShaderName, sizeof(pixShaderName), "shadergen:/%s_P.%s", cacheName, mFileEnding.c_str() ); dStrcpy( vertFile, vertShaderName ); dStrcpy( pixFile, pixShaderName ); // this needs to change - need to optimize down to ps v.1.1 *pixVersion = GFX->getPixelShaderVersion(); if ( !Con::getBoolVariable( "ShaderGen::GenNewShaders", true ) ) { // If we are not regenerating the shader we will return here. // But we must fill in the shader macros first! _processVertFeatures( macros, true ); _processPixFeatures( macros, true ); return; } // create vertex shader //------------------------ FileStream* s = new FileStream(); if(!s->open(vertShaderName, Torque::FS::File::Write )) { AssertFatal(false, "Failed to open Shader Stream" ); return; } mOutput = new MultiLine; mInstancingFormat.clear(); _processVertFeatures(macros); _printVertShader( *s ); delete s; ((ShaderConnector*)mComponents[C_CONNECTOR])->reset(); LangElement::deleteElements(); // create pixel shader //------------------------ s = new FileStream(); if(!s->open(pixShaderName, Torque::FS::File::Write )) { AssertFatal(false, "Failed to open Shader Stream" ); return; } mOutput = new MultiLine; _processPixFeatures(macros); _printPixShader( *s ); delete s; LangElement::deleteElements(); }
void CRtkService::Run(__uint, char **) #endif { __uint res; // report to the SCM that we're about to start utils_trace("Starting %s...\n", versionString.c_str()); ReportStatus(SERVICE_START_PENDING); signal(SIGINT, _ctrl_c); try{ if(!_init()){ throw(this); } ReportStatus(SERVICE_RUNNING); __int logCounter = 24*3600*1000/PrimaryCheckInterval; while(!bExit){ res = m_hStop.Wait(PrimaryCheckInterval); switch(res){ case WAIT_OBJECT_0: switch(m_dwStopReason){ case 0: bExit = true; break; case 1: _restart(); ReportStatus(SERVICE_RUNNING); break; case 2: break; } if(get_power_state()==PWR_RUNNING){ notify_active(); } break; case WAIT_TIMEOUT: switch(get_power_state()){ case PWR_RUNNING: notify_active(); break; case PWR_BACKUP: PrimaryWatchDogCounter--; if(PrimaryWatchDogCounter <= 0){ utils_trace("Primary site failed, resuming responsibility.\n"); switch_to_primary(); } break; } logCounter--; if(logCounter <= 0){ close_log(); open_log(); logCounter = 24*3600*1000/PrimaryCheckInterval; } break; } } _uninit(); }catch(CRtkService *){ utils_error("Aborted.\n"); } ReportStatus(SERVICE_STOPPED); }