void tool::source::Column::Maximum(SizeType value) { if (IsDebug()) { __Info("Column Maximum = %zu", value); } m_maximum = value; }
HRESULT CIoSupport::Shutdown() { #ifdef _XBOX // fails assertion on debug bios (symptom lockup unless running dr watson) // so you can continue past the failed assertion). if (IsDebug()) return E_FAIL; KeRaiseIrqlToDpcLevel(); HalInitiateShutdown(); #endif return S_OK; }
void Simulator::Process(NMEAInfo &basic) { assert(is_simulator()); Touch(basic); basic.location = FindLatitudeLongitude(basic.location, basic.track, basic.ground_speed); // use this to test FLARM parsing/display if (IsDebug() && !IsAltair()) GenerateFLARMTraffic(basic); }
// todo(jonahr): Eventually could add support for all conditions/operating // systems, but these are the ones in use for now void validateConfigBase(const GPUTestConfig &config) { EXPECT_EQ(IsWindows(), config.getConditions()[GPUTestConfig::kConditionWin]); EXPECT_EQ(IsOSX(), config.getConditions()[GPUTestConfig::kConditionMac]); EXPECT_EQ(IsLinux(), config.getConditions()[GPUTestConfig::kConditionLinux]); EXPECT_EQ(IsAndroid(), config.getConditions()[GPUTestConfig::kConditionAndroid]); EXPECT_EQ(IsNexus5X(), config.getConditions()[GPUTestConfig::kConditionNexus5X]); EXPECT_EQ(IsPixel2(), config.getConditions()[GPUTestConfig::kConditionPixel2]); EXPECT_EQ(IsIntel(), config.getConditions()[GPUTestConfig::kConditionIntel]); EXPECT_EQ(IsAMD(), config.getConditions()[GPUTestConfig::kConditionAMD]); EXPECT_EQ(IsNVIDIA(), config.getConditions()[GPUTestConfig::kConditionNVIDIA]); EXPECT_EQ(IsDebug(), config.getConditions()[GPUTestConfig::kConditionDebug]); EXPECT_EQ(IsRelease(), config.getConditions()[GPUTestConfig::kConditionRelease]); }
void WaveTrace( char const *wavname, char const *funcname ) { if ( IsX360() && !IsDebug() ) { return; } static CUtlSymbolTable s_WaveTrace; // Make sure we only show the message once if ( UTL_INVAL_SYMBOL == s_WaveTrace.Find( wavname ) ) { DevMsg( "%s directly referenced wave %s (should use game_sounds.txt system instead)\n", funcname, wavname ); s_WaveTrace.AddString( wavname ); } }
void tool::source::Column::Newline(const SizeType& column, std::string string) { if (column > m_maximum) { __Error("Check Column Failed: columns greater than %zu (Column = %zu) " ", file %s, line %zu, string \"%s\"", m_maximum, column, m_read.Pathname().c_str(), m_line, string.c_str()); } else { if (IsDebug()) { __Info("line %zu, column %zu, string \"%s\"", m_line, column, string.c_str()); } } ++m_line; }
// 追跡リストからオブジェクトを削除する void TrackDeleteObj(UINT64 addr) { TRACKING_OBJECT *o; // 引数チェック if (addr == 0) { return; } if (IsMemCheck() == false) { // リリースモードでは追跡しない return; } if (disable_tracking) { return; } LockTrackingList(); { o = SearchTrackingList(addr); if (o == NULL) { UnlockTrackingList(); if (IsDebug()) { printf("TrackDeleteObj: 0x%x is not Object!!\n", (void *)addr); } return; } DeleteTrackingList(o, true); } UnlockTrackingList(); }
// Remove the object from the tracking list void TrackDeleteObj(UINT64 addr) { TRACKING_OBJECT *o; // Validate arguments if (addr == 0) { return; } if (IsMemCheck() == false) { // Don't track in the release mode return; } if (disable_tracking) { return; } LockTrackingList(); { o = SearchTrackingList(addr); if (o == NULL) { UnlockTrackingList(); if (IsDebug()) { printf("TrackDeleteObj: 0x%x is not Object!!\n", (void *)addr); } return; } DeleteTrackingList(o, true); } UnlockTrackingList(); }
// Load a static copy buffer (g_temppaintbuffer) with the requested number of samples, // with the first sample(s) in the buffer always set up as the last sample(s) of the previous load. // Return a pointer to the head of the copy buffer. // This ensures that interpolating pitch shifters always have the previous sample to reference. // pChannel: sound's channel data // sample_load_request: number of samples to load from source data // pSamplesLoaded: returns the actual number of samples loaded (should always = sample_load_request) // copyBuf: req'd by GetOutputData, used by some Mixers // Returns: NULL ptr to data if no samples available, otherwise always fills remainder of copy buffer with // 0 to pad remainder. // NOTE: DO NOT MODIFY THIS ROUTINE (KELLYB) char *CAudioMixerWave::LoadMixBuffer( channel_t *pChannel, int sample_load_request, int *pSamplesLoaded, char copyBuf[AUDIOSOURCE_COPYBUF_SIZE] ) { int samples_loaded; char *pSample = NULL; char *pData = NULL; int cCopySamps = 0; // save index of last sample loaded (updated in GetOutputData) int sample_loaded_index = m_sample_loaded_index; // get data from source (copyBuf is expected to be available for use) samples_loaded = GetOutputData( (void **)&pData, sample_load_request, copyBuf ); if ( !samples_loaded && sample_load_request ) { // none available, bail out // 360 might not be able to get samples due to latency of loop seek // could also be the valid EOF for non-loops (caller keeps polling for data, until no more) AssertOnce( IsX360() || !m_pData->Source().IsLooped() ); *pSamplesLoaded = 0; return NULL; } int samplesize = GetMixSampleSize(); char *pCopy = (char *)g_temppaintbuffer; if ( IsX360() || IsDebug() ) { // for safety, 360 always validates sample request, due to new xma audio code and possible logic flaws // PC can expect number of requested samples to be within tolerances due to exisiting aged code // otherwise buffer overruns cause hard to track random crashes if ( ( ( sample_load_request + 1 ) * samplesize ) > ( TEMP_COPY_BUFFER_SIZE * sizeof( portable_samplepair_t ) ) ) { // make sure requested samples will fit in temp buffer. // if this assert fails, then pitch is too high (ie: > 2.0) or the sample counters have diverged. // NOTE: to prevent this, pitch should always be capped in MixDataToDevice (but isn't nor are the sample counters). DevWarning( "LoadMixBuffer: sample load request %d exceeds buffer sizes\n", sample_load_request ); Assert( 0 ); *pSamplesLoaded = 0; return NULL; } } // copy all samples from pData to copy buffer, set 0th sample to saved previous sample - this ensures // interpolation pitch shift routines always have a previous sample to reference. // copy previous sample(s) to head of copy buffer pCopy // In some cases, we'll need the previous 2 samples. This occurs when // Rate < 1.0 - in example below, sample 4.86 - 6.48 requires samples 4-7 (previous samples saved are 4 & 5) /* Example: rate = 0.81, sampleCount = 3 (ie: # of samples to return ) _____load 3______ ____load 3_______ __load 2__ 0 1 2 3 4 5 6 7 sample_index (whole samples) ^ ^ ^ ^ ^ ^ ^ ^ ^ | | | | | | | | | 0 0.81 1.68 2.43 3.24 4.05 4.86 5.67 6.48 m_fsample_index (rate*sample) _______________ ________________ ________________ ^ ^ ^ ^ | | | | m_sample_loaded_index | | m_sample_loaded_index | | m_fsample_index---- ----m_fsample_index [return 3 samp] [return 3 samp] [return 3 samp] */ pSample = &(pChannel->sample_prev[0]); // determine how many saved samples we need to copy to head of copy buffer (0,1 or 2) // so that pitch interpolation will correctly reference samples. // NOTE: pitch interpolators always reference the sample before and after the indexed sample. // cCopySamps = sample_max_loaded - floor(m_fsample_index); if ( sample_loaded_index < 0 || (floor(m_fsample_index) > sample_loaded_index)) { // no samples previously loaded, or // next sample index is entirely within the next block of samples to be loaded, // so we won't need any samples from the previous block. (can occur when rate > 2.0) cCopySamps = 0; } else if ( m_fsample_index < sample_loaded_index ) { // next sample index is entirely within the previous block of samples loaded, // so we'll need the last 2 samples loaded. (can occur when rate < 1.0) Assert ( ceil(m_fsample_index + 0.00000001) == sample_loaded_index ); cCopySamps = 2; } else { // next sample index is between the next block and the previously loaded block, // so we'll need the last sample loaded. (can occur when 1.0 < rate < 2.0) Assert( floor(m_fsample_index) == sample_loaded_index ); cCopySamps = 1; } Assert( cCopySamps >= 0 && cCopySamps <= 2 ); // point to the sample(s) we are to copy if ( cCopySamps ) { pSample = cCopySamps == 1 ? pSample + samplesize : pSample; Q_memcpy( pCopy, pSample, samplesize * cCopySamps ); pCopy += samplesize * cCopySamps; } // don't overflow copy buffer Assert ( (PAINTBUFFER_MEM_SIZE * sizeof( portable_samplepair_t )) > ( ( samples_loaded + 1 ) * samplesize ) ); // copy loaded samples from pData into pCopy // and update pointer to free space in copy buffer if ( ( samples_loaded * samplesize ) != 0 && !pData ) { char const *pWavName = ""; CSfxTable *source = pChannel->sfx; if ( source ) { pWavName = source->getname(); } Warning( "CAudioMixerWave::LoadMixBuffer: '%s' samples_loaded * samplesize = %i but pData == NULL\n", pWavName, ( samples_loaded * samplesize ) ); *pSamplesLoaded = 0; return NULL; } Q_memcpy( pCopy, pData, samples_loaded * samplesize ); pCopy += samples_loaded * samplesize; // if we loaded fewer samples than we wanted to, and we're not // delaying, load more samples or, if we run out of samples from non-looping source, // pad copy buffer. if ( samples_loaded < sample_load_request ) { // retry loading source data until 0 bytes returned, or we've loaded enough data. // if we hit 0 bytes, fill remaining space in copy buffer with 0 and exit int samples_load_extra; int samples_loaded_retry = -1; for ( int k = 0; (k < 10000 && samples_loaded_retry && samples_loaded < sample_load_request); k++ ) { // how many more samples do we need to satisfy load request samples_load_extra = sample_load_request - samples_loaded; samples_loaded_retry = GetOutputData( (void**)&pData, samples_load_extra, copyBuf ); // copy loaded samples from pData into pCopy if ( samples_loaded_retry ) { if ( ( samples_loaded_retry * samplesize ) != 0 && !pData ) { Warning( "CAudioMixerWave::LoadMixBuffer: samples_loaded_retry * samplesize = %i but pData == NULL\n", ( samples_loaded_retry * samplesize ) ); *pSamplesLoaded = 0; return NULL; } Q_memcpy( pCopy, pData, samples_loaded_retry * samplesize ); pCopy += samples_loaded_retry * samplesize; samples_loaded += samples_loaded_retry; } } } // if we still couldn't load the requested samples, fill rest of copy buffer with 0 if ( samples_loaded < sample_load_request ) { // should always be able to get as many samples as we request from looping sound sources AssertOnce ( IsX360() || !m_pData->Source().IsLooped() ); // these samples are filled with 0, not loaded. // non-looping source hit end of data, fill rest of g_temppaintbuffer with 0 int samples_zero_fill = sample_load_request - samples_loaded; Q_memset( pCopy, 0, samples_zero_fill * samplesize ); pCopy += samples_zero_fill * samplesize; samples_loaded += samples_zero_fill; } if ( samples_loaded >= 2 ) { // always save last 2 samples from copy buffer to channel // (we'll need 0,1 or 2 samples as start of next buffer for interpolation) Assert( sizeof( pChannel->sample_prev ) >= samplesize*2 ); pSample = pCopy - samplesize*2; Q_memcpy( &(pChannel->sample_prev[0]), pSample, samplesize*2 ); } // this routine must always return as many samples loaded (or zeros) as requested. Assert( samples_loaded == sample_load_request ); *pSamplesLoaded = samples_loaded; return (char *)g_temppaintbuffer; }
static void SignalDebugData( struct TDebug *obj ) { int thread; char debtype; struct TCreateProcessEvent cpe; struct TCreateThreadEvent cte; struct TLoadDllEvent lde; struct TExceptionEvent ee; int ExitCode; int handle; struct TDebugThread *newt; RdosWaitMilli( 5 ); debtype = RdosGetDebugEvent( obj->FHandle, &thread ); switch (debtype) { case EVENT_EXCEPTION: RdosGetDebugEventData( obj->FHandle, &ee ); HandleException( obj, &ee, thread ); break; case EVENT_CREATE_THREAD: RdosGetDebugEventData( obj->FHandle, &cte ); HandleCreateThread( obj, &cte ); obj->FThreadChanged = TRUE; break; case EVENT_CREATE_PROCESS: RdosGetDebugEventData( obj->FHandle, &cpe ); HandleCreateProcess( obj, &cpe ); break; case EVENT_TERMINATE_THREAD: HandleTerminateThread( obj, thread ); obj->FThreadChanged = TRUE; if( !obj->CurrentThread ) { obj->CurrentThread = obj->ThreadList; while( obj->CurrentThread && !IsDebug( obj->CurrentThread ) ) obj->CurrentThread = obj->CurrentThread->Next; if (!obj->CurrentThread) obj->CurrentThread = obj->ThreadList; } break; case EVENT_TERMINATE_PROCESS: RdosGetDebugEventData( obj->FHandle, &ExitCode ); HandleTerminateProcess( obj, ExitCode); obj->FInstalled = FALSE; RdosSetSignal( obj->UserSignal ); break; case EVENT_LOAD_DLL: RdosGetDebugEventData( obj->FHandle, &lde ); HandleLoadDll( obj, &lde ); obj->FModuleChanged = TRUE; break; case EVENT_FREE_DLL: RdosGetDebugEventData( obj->FHandle, &handle ); HandleFreeDll( obj, handle ); obj->FModuleChanged = TRUE; break; } RdosClearDebugEvent( obj->FHandle ); if( debtype == EVENT_EXCEPTION ) { if( obj->CurrentThread ) { DeactivateBreaks( obj->CurrentThread, obj->BreakList); if( thread != obj->CurrentThread->ThreadID ) { newt = LockThread( obj, thread ); if( newt ) { obj->CurrentThread = newt; obj->FThreadChanged = TRUE; } UnlockThread( obj ); } } RdosSetSignal( obj->UserSignal ); } else RdosContinueDebugEvent( obj->FHandle, thread ); }
/* * recursively parse '<'tc_action'>' * note that array "action" grows during recursive parse. */ static int tc_action_parser(char *ifname, char **cpp, struct tc_action *action) { char *cp, *start, *end; char type[MAX_WORD], w[MAX_WORD]; int depth, i; struct tb_profile profile[2]; /* * find a possibly nested pair of '<' and '>', * make them pointed by 'start' and 'end'. */ start = strchr(*cpp, '<'); if (start == NULL) { LOG(LOG_ERR, 0, "conditioner action missing"); return (0); } depth = 1; cp = start + 1; do { end = strpbrk(cp, "<>"); if (end == NULL) { LOG(LOG_ERR, 0, "conditioner action delimiter mismatch"); return (0); } if (*end == '<') depth++; else if (*end == '>') depth--; cp = end + 1; } while (depth > 0); *end = '\0'; *cpp = end + 1; cp = start + 1; if (IsDebug(DEBUG_ALTQ)) { printf("tc_action_parser: [%s]\n", cp); } if (!next_word(&cp, type)) { LOG(LOG_ERR, 0, "missing conditioner action type"); return (0); } /* * action type specific process */ if (EQUAL(type, "conditioner")) { if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing conditioner name"); return (0); } action->tca_code = TCACODE_HANDLE; action->tca_handle = cdnr_name2handle(ifname, w); if (action->tca_handle == CDNR_NULL_HANDLE) { LOG(LOG_ERR, 0, "wrong conditioner name %s", w); return (0); } } else if (EQUAL(type, "pass")) { action->tca_code = TCACODE_PASS; } else if (EQUAL(type, "drop")) { action->tca_code = TCACODE_DROP; } else if (EQUAL(type, "mark")) { if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing dscp"); return (0); } action->tca_code = TCACODE_MARK; action->tca_dscp = (u_int8_t)strtol(w, NULL, 0); } else if (EQUAL(type, "tbmeter")) { if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing tb profile"); return (0); } profile[0].rate = atobps(w); if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing tb profile"); return (0); } profile[0].depth = atobytes(w); if (tc_action_parser(ifname, &cp, &action[1]) == 0) return (0); if (tc_action_parser(ifname, &cp, &action[2]) == 0) return (0); if (qcmd_cdnr_add_tbmeter(action, ifname, NULL, &profile[0], &action[1], &action[2]) != 0) return (0); } else if (EQUAL(type, "trtcm")) { int coloraware = 0; /* default is color-blind */ for (i=0; i<2; i++) { if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing tb profile"); return (0); } profile[i].rate = atobps(w); if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing tb profile"); return (0); } profile[i].depth = atobytes(w); } if (tc_action_parser(ifname, &cp, &action[1]) == 0) return (0); if (tc_action_parser(ifname, &cp, &action[2]) == 0) return (0); if (tc_action_parser(ifname, &cp, &action[3]) == 0) return (0); if (next_word(&cp, w)) { if (EQUAL(w, "coloraware")) coloraware = 1; else if (EQUAL(w, "colorblind")) coloraware = 0; } if (qcmd_cdnr_add_trtcm(action, ifname, NULL, &profile[0], &profile[1], &action[1], &action[2], &action[3], coloraware) != 0) return (0); } else if (EQUAL(type, "tswtcm")) { u_int32_t cmtd_rate, peak_rate, avg_interval; if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing cmtd rate"); return (0); } cmtd_rate = atobps(w); if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing peak rate"); return (0); } peak_rate = atobps(w); if (!next_word(&cp, w)) { LOG(LOG_ERR, 0, "missing avg interval"); return (0); } avg_interval = (u_int32_t)strtoul(w, NULL, 0); if (tc_action_parser(ifname, &cp, &action[1]) == 0) return (0); if (tc_action_parser(ifname, &cp, &action[2]) == 0) return (0); if (tc_action_parser(ifname, &cp, &action[3]) == 0) return (0); if (qcmd_cdnr_add_tswtcm(action, ifname, NULL, cmtd_rate, peak_rate, avg_interval, &action[1], &action[2], &action[3]) != 0) return (0); } else { LOG(LOG_ERR, 0, "unkown action type %s"); return (0); } *end = '>'; /* restore the end delimiter */ return (1); }
bool ModuleBase::Init(int32 nArgc, char* argv[]) { InitLog( nArgc, argv); MyLog::message("Begin ModuleBase::Init ModuleName[%s], Version[%s]", m_strModuelName.c_str(), "0.0.1"); m_bDebug = GameUtil::GetCommandOpt("--Debug", nArgc, argv); MyLog::message("IsDebug=[%s]", IsDebug() ? "True" : "False"); std::stringstream strArgs; std::string strConfig; for (int32 i = 0; i < nArgc; ++i) { char* sArg = argv[i]; strArgs<<" "<<sArg; if( strcmp( sArg, "-Path") == 0) { MyPath::SetMainPath( argv[i+1] ); MyLog::message("Path:%s", argv[i+1]); } else if( (strcmp( sArg, "-StartConfig") == 0) || (strcmp( sArg, "-Config") == 0)) { strConfig = argv[i+1]; } else if( strcmp( sArg, "-Section") == 0) { std::string strSection = argv[i+1]; ConfigManager::SetCustomSection( strSection ); } } MyLog::message("Start Args[%s]", strArgs.str().c_str()); // set config file working directory std::string strPath = MyPath::MainPath(); strPath += "Data/Config/"; ConfigManager::SetMainPath(strPath); if (strConfig.length() > 0) { std::string strPath = ConfigManager::MainPath() + strConfig; ConfigManager::LoadConfig( strPath.c_str(), true); } // load argv argument ConfigManager::LoadStartConfig( nArgc, argv); // load log config MyLog::FillConfig(); // load srv config ServerConfig::FillConfig(); // set console width & height Console::SetBufferSize( ServerConfig::nConsoleW, ServerConfig::nConsoleH); // init server db std::string strDBFile; strDBFile = MyPath::MainPath(); strDBFile += "Data/Server.db"; DBLoader::SetDBFile( strDBFile.c_str() ); // load argument define MyLog::message("Begin LoadModule[BaseServer]"); Templates.AddTemplate( "ParamDefManager", ParamDefManager::Instance()); Templates.Load("BaseServer"); MyLog::message("End LoadModule[BaseServer]"); CreateDogPool(); OnConfigLoaded(); AppendLoadTemplate(); #if DOG WatchDog::Instance().Start(); #endif MyLog::message("End ModuleBase::Init() ModuleName[%s]", m_strModuelName.c_str()); return true; }