Exemplo n.º 1
0
static void AFTER_LoadScript(KonohaContext *kctx, const char *filename)
{
	int stdlog_count = 0;
	if(stdlog2 != NULL) {
		stdlog_count = 1;
		fprintf(stdlog2, "Q.E.D.\n");   // Q.E.D.
		fclose(stdlog2);
	}
	//if(PLATAPI exitStatus != 0) return;
	if(stdlog_count != 0) {
		//filename = (filename == NULL) ? "shell" : filename;
		char proof_file[256];
		char result_file[256];
		PLATAPI snprintf_i(proof_file, sizeof(proof_file), "%s.%s_proof",  filename, GetProfile());
		PLATAPI snprintf_i(result_file, sizeof(result_file),  "%s.%s_tested", filename, GetProfile());
		FILE *fp = fopen(proof_file, "r");
		if(fp == NULL) {
			fprintf(stdout, "no proof file: %s\n", proof_file);
			((KonohaFactory *)kctx->platApi)->exitStatus = 1;
			return;
		}
		FILE *fp2 = fopen(result_file, "r");
		DBG_ASSERT(fp2 != NULL);
		int ret = check_result2(fp, fp2);
		if(ret != 0) {
			fprintf(stdout, "proof file mismatched: %s\n", proof_file);
			((KonohaFactory *)kctx->platApi)->exitStatus = 78;
		}
		else {
			((KonohaFactory *)kctx->platApi)->exitStatus = 0;
		}
		fclose(fp);
		fclose(fp2);
	}
}
Exemplo n.º 2
0
void CCSBot::Panic(CBasePlayer *pEnemy)
{
	if (IsSurprised())
		return;

	Vector2D dir(BotCOS(pev->v_angle.y), BotSIN(pev->v_angle.y));
	Vector2D perp(-dir.y, dir.x);
	Vector spot;

	if (GetProfile()->GetSkill() >= 0.5f)
	{
		Vector2D toEnemy = (pEnemy->pev->origin - pev->origin).Make2D();
		toEnemy.NormalizeInPlace();

		float along = DotProduct(toEnemy, dir);

		float c45 = 0.7071f;
		float size = 100.0f;

		real_t shift = RANDOM_FLOAT(-75.0, 75.0);

		if (along > c45)
		{
			spot.x = pev->origin.x + dir.x * size + perp.x * shift;
			spot.y = pev->origin.y + dir.y * size + perp.y * shift;
		}
		else if (along < -c45)
		{
			spot.x = pev->origin.x - dir.x * size + perp.x * shift;
			spot.y = pev->origin.y - dir.y * size + perp.y * shift;
		}
		else if (DotProduct(toEnemy, perp) > 0.0)
		{
			spot.x = pev->origin.x + perp.x * size + dir.x * shift;
			spot.y = pev->origin.y + perp.y * size + dir.y * shift;
		}
		else
		{
			spot.x = pev->origin.x - perp.x * size + dir.x * shift;
			spot.y = pev->origin.y - perp.y * size + dir.y * shift;
		}
	}
	else
	{
		const float offset = 200.0f;
		real_t side = RANDOM_FLOAT(-offset, offset) * 2.0f;

		spot.x = pev->origin.x - dir.x * offset + perp.x * side;
		spot.y = pev->origin.y - dir.y * offset + perp.y * side;
	}

	spot.z = pev->origin.z + RANDOM_FLOAT(-50.0, 50.0);

	// we are stunned for a moment
	m_surpriseDelay = RANDOM_FLOAT(0.1, 0.2);
	m_surpriseTimestamp = gpGlobals->time;

	SetLookAt("Panic", &spot, PRIORITY_HIGH, 0, 0, 5.0);
	PrintIfWatched("Aaaah!\n");
}
Exemplo n.º 3
0
/*
========================
idProfileMgr::SaveSettingsAsync
========================
*/
void idProfileMgr::SaveSettingsAsync()
{
	if( !saveGame_enable.GetBool() )
	{
		idLib::Warning( "Skipping profile save because saveGame_enable = 0" );
	}
	
	if( GetProfile() != NULL )
	{
		// Issue the async save...
		if( profileSaveProcessor->InitSaveProfile( profile, "" ) )
		{
		
		
			profileSaveProcessor->AddCompletedCallback( MakeCallback( this, &idProfileMgr::OnSaveSettingsCompleted, &profileSaveProcessor->GetParmsNonConst() ) );
			handle = session->GetSaveGameManager().ExecuteProcessor( profileSaveProcessor.get() );
			profile->SetState( idPlayerProfile::SAVING );
			
		}
	}
	else
	{
		idLib::Warning( "Not saving profile, profile is NULL." );
	}
}
void UBTAuditLog(const char *pzText, bool bNewLine)
{
	if (g_pchLogFile == LOGGING_UNASSIGNED)
	{
		try
		{
			g_pchLogFile = (char *)GetProfile().GetString("Debug", "DebugTraceXML",false);
			if (g_pchLogFile && g_pchLogFile[0])
			{
				// g_pchLogFile is valid and logging is turned ON
			}
			else
			{
				// Turn off logging and don't check the environment variable anymore (it's slow)
				g_pchLogFile = (char *)LOGGING_OFF;
			}
		}
		catch (GException &)
		{
			// If this fails once, don't try in the future
			g_pchLogFile = (char *)LOGGING_OFF;
		}
	}
	if (g_pchLogFile != LOGGING_OFF)
	{
		if (pzText && pzText[0])
		{
			GString str(pzText);
			if (bNewLine)
				str << "\n";
			str.ToFileAppend(g_pchLogFile,0);
		}
	}
}
Exemplo n.º 5
0
TInt CGprsQoSDGprsTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
							  const TDataPackage& aPackage)
/**
 * ExtFunc is called by the server when it has an "extended", i.e. non-core ETel request 
 * for the TSY to process.
 * A request handle, request type and request data are passed to the TSY.
 */
	{
	LOGTEXT(_L8("CGprsQoSDGprsTsy: ExtFunc() method"));

	switch (aIpc)
		{
		case EPacketQoSSetProfileParams:
			return SetProfile(aTsyReqHandle, aPackage.Des1n());
		case EPacketQoSSetProfileParamsCancel:
			return SetProfileCancel(aTsyReqHandle);
		case EPacketQoSGetProfileParams:
			return GetProfile(aTsyReqHandle, aPackage.Des1n());
		case EPacketQoSGetProfileParamsCancel:
			return GetProfileCancel(aTsyReqHandle);
		case EPacketQoSNotifyProfileChanged:
			return NotifyProfileChanged(aTsyReqHandle, aPackage.Des1n());
		case EPacketQoSNotifyProfileChangedCancel:
			return NotifyProfileChangedCancel(aTsyReqHandle);
		case EPacketQoSGetProfileCaps:
			return GetProfileCaps(aTsyReqHandle, aPackage.Des1n());
		case EPacketQoSGetProfileCapsCancel:
			return GetProfileCapsCancel(aTsyReqHandle);
		default:
			return KErrNotSupported;
		}
	}
Exemplo n.º 6
0
void ProfileDlg::OnExportProfile() 
{
	CString name;
	int sel = m_profiles.GetCurSel();
	if(sel<0) return;
	
	CString tmp;
	tmp.LoadString(IDS_PROFILE_FILEDIALOG);
	CFileDialog fd( FALSE, _T("xpas"), name, OFN_ENABLESIZING, tmp + " (*.xpas)|*.xpas||", this);
	tmp.LoadString(IDS_PROFILE_SAVE);
	fd.m_ofn.lpstrTitle = tmp;
	if(fd.DoModal() == IDOK)
	{
		CFile file(fd.GetPathName(), CFile::modeCreate|CFile::modeWrite);
		m_profiles.GetLBText(sel, name);
		SettingVec vec = GetProfile(name);
		
		CArchive* ar=new CArchive(&file,CArchive::store);
		for(int i=0; i<vec.size(); ++i)
		{
			
			*ar<<vec[i].settingID<<vec[i].checked;
		}
		ar->Close();
		if(ar) delete ar;
		file.Close();
	}
	
}
GProfile &GetErrorProfile()
{
	if (g_strErrorFile.IsEmpty())
	{
		if (g_pzStaticErrMap)
		{
			g_strErrorFile = "Static Load";
			g_pstrErrorFileContents = new GString(g_pzStaticErrMap,strlen(g_pzStaticErrMap));
		}
		else
		{
			const char *pzErrFile = GetProfile().GetString("System", "Errors", 0);
			if (pzErrFile && pzErrFile[0])
			{
				g_pstrErrorFileContents = new GString();
				if (!g_pstrErrorFileContents->FromFile(pzErrFile,0))
				{
					pzErrFile = 0;
				}
				g_strErrorFile = pzErrFile;
			}
			// if the error file could not be found, default to a minimal error file
			if (!pzErrFile)
			{
				g_pstrErrorFileContents = new GString();
				(*g_pstrErrorFileContents) = "[Exception]\nSubSystem=0\n[Profile]\nSubSystem=1\n0=[%s.%s]Error Description File Not loaded.\n1=[%s]Error Description File Not loaded.  Call SetErrorDescriptions().\n";
				g_strErrorFile = "Static";
			}
		}
	}
	static GProfile ErrorProfile(g_pstrErrorFileContents->StrVal(), (int)g_pstrErrorFileContents->Length(), 0);
	return ErrorProfile;
}
void __stdcall CopyProfileSettings()
{
	ProfileTag* p = GetProfile(g_ProfileSettings.m_Group, g_ProfileSettings.m_Profile);
	ProfileTarget* t = GetProfileTarget(g_ProfileSettings.m_Group, g_ProfileSettings.m_Profile, g_ProfileSettings.m_Target);

	StringCchCopy(g_enc_opt.m_Format, 64, p->m_Format);
	StringCchCopy(g_enc_opt.m_Target, 64, t->m_Name);
	
	g_enc_opt.m_VideoDisable = g_ProfileSettings.m_VCodec == -1;
	g_enc_opt.m_AudioDisable = g_ProfileSettings.m_ACodec == -1;

	if (g_enc_opt.m_VideoDisable == 0)
	{
		StringCchCopy(g_enc_opt.m_VideoCodec, 64, t->m_Video.m_Codec[g_ProfileSettings.m_VCodec].m_Codec);
		g_enc_opt.m_VideoBitrate = t->m_Video.m_BitRate[g_ProfileSettings.m_VBitRate];
		g_enc_opt.m_FrameNum = t->m_Video.m_FrameRate[g_ProfileSettings.m_FrameRate].m_Num;
		g_enc_opt.m_FrameDen = t->m_Video.m_FrameRate[g_ProfileSettings.m_FrameRate].m_Den;
		g_enc_opt.m_VideoWidth = g_ProfileSettings.m_ResCustom.m_Width;
		g_enc_opt.m_VideoHeight = g_ProfileSettings.m_ResCustom.m_Height;
	}
	
	if (g_enc_opt.m_AudioDisable == 0)
	{
		StringCchCopy(g_enc_opt.m_AudioCodec, 64, t->m_Audio.m_Codec[g_ProfileSettings.m_ACodec].m_Codec);
		g_enc_opt.m_AudioBitrate = t->m_Audio.m_BitRate[g_ProfileSettings.m_ABitRate];
		g_enc_opt.m_AudioSampleRate = t->m_Audio.m_SampleRate[g_ProfileSettings.m_SampleRate];
		g_enc_opt.m_AudioChannels = t->m_Audio.m_Channel[g_ProfileSettings.m_Channel];
	}

}
Exemplo n.º 9
0
	bool TunnelPool::SelectPeers (std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers, bool isInbound)
	{
		if (m_ExplicitPeers) return SelectExplicitPeers (peers, isInbound);
		auto prevHop = i2p::context.GetSharedRouterInfo ();	
		int numHops = isInbound ? m_NumInboundHops : m_NumOutboundHops;
		if (i2p::transport::transports.GetNumPeers () > 25)
		{
			auto r = i2p::transport::transports.GetRandomPeer ();
			if (r && !r->GetProfile ()->IsBad ())
			{
				prevHop = r;
				peers.push_back (r->GetRouterIdentity ());
				numHops--;
			}
		}
		
		for (int i = 0; i < numHops; i++)
		{
			auto hop = SelectNextHop (prevHop);
			if (!hop)
			{
				LogPrint (eLogError, "Tunnels: Can't select next hop for ", prevHop->GetIdentHashBase64 ());
				return false;
			}	
			prevHop = hop;
			peers.push_back (hop->GetRouterIdentity ());
		}		
		return true;
	}	
Exemplo n.º 10
0
int CClientUserProfile::ApiChangeBackpack(__int64 InventoryID)
{
	r3d_assert(SelectedCharID >= 0 && SelectedCharID < wiUserProfile::MAX_LOADOUT_SLOTS);
	wiCharDataFull& w = ProfileData.ArmorySlots[SelectedCharID];
	r3d_assert(w.LoadoutID > 0);

	// no need to validate InventoryID - server will do that
	char strInventoryID[128];
	sprintf(strInventoryID, "%I64d", InventoryID);

	CWOBackendReq req(this, "api_CharBackpack.aspx");
	req.AddParam("CharID", w.LoadoutID);
	req.AddParam("op",     16);		// inventory operation code
	req.AddParam("v1",     strInventoryID);	// value 1
	req.AddParam("v2",     0);
	req.AddParam("v3",     0);
	if(!req.Issue())
	{
		r3dOutToLog("ApiChangeBackpack failed: %d", req.resultCode_);
		return req.resultCode_;
	}

	// reread profile, as inventory/backpack is changed
	GetProfile();
	
	return 0;
}
Exemplo n.º 11
0
int CClientUserProfile::ApiChangeOutfit(int headIdx, int bodyIdx, int legsIdx)
{
    r3d_assert(SelectedCharID >= 0 && SelectedCharID < wiUserProfile::MAX_LOADOUT_SLOTS);
    wiCharDataFull& w = ProfileData.ArmorySlots[SelectedCharID];
    r3d_assert(w.LoadoutID > 0);

    char headStr[128], bodyStr[128], legsStr[128];
    sprintf(headStr, "%d", headIdx);
    sprintf(bodyStr, "%d", bodyIdx);
    sprintf(legsStr, "%d", legsIdx);

    CWOBackendReq req(this, "api_CharOutfit.aspx");
    req.AddParam("CharID", w.LoadoutID);
    req.AddParam("HeadIdx",     headStr);
    req.AddParam("BodyIdx",     bodyStr);
    req.AddParam("LegsIdx",     legsStr);
    if(!req.Issue())
    {
        r3dOutToLog("ApiChangeOutfit failed: %d", req.resultCode_);
        return req.resultCode_;
    }

    GetProfile(w.LoadoutID);
    // Here needs to be added something that properly updates
    // your survivors, otherwise when you swap survivor and back
    // the new outfit is not applied in the menu :S
    
    return 0;
}
Exemplo n.º 12
0
bool UBTAuditLogIsEnabled()
{
	if (g_pchLogFile == LOGGING_OFF)
		return false;
	if (g_pchLogFile == LOGGING_UNASSIGNED)
	{
		try
		{
			g_pchLogFile = (char *)GetProfile().GetString("Debug", "DebugTraceXML",false);
			if (g_pchLogFile && g_pchLogFile[0])
			{
				// g_pchLogFile is valid and logging is turned ON
			}
			else
			{
				// Turn off logging and don't check the environment variable anymore (it's slow)
				g_pchLogFile = (char *)LOGGING_OFF;
			}
		}
		catch (GException &)
		{
		}
	}
	if (g_pchLogFile == (char *)LOGGING_OFF)
		return false;
	return true;
}
Exemplo n.º 13
0
void EffectNoiseRemoval::ProcessSamples(sampleCount len, float *buffer)
{
   int i;

   while(len && mOutSampleCount < mInSampleCount) {
      int avail = wxMin(len, mWindowSize - mInputPos);
      for(i = 0; i < avail; i++)
         mInWaveBuffer[mInputPos + i] = buffer[i];
      buffer += avail;
      len -= avail;
      mInputPos += avail;

      if (mInputPos == mWindowSize) {
         FillFirstHistoryWindow();
         if (mDoProfile)
            GetProfile();
         else
            RemoveNoise();
         RotateHistoryWindows();

         // Rotate halfway for overlap-add
         for(i = 0; i < mWindowSize / 2; i++) {
            mInWaveBuffer[i] = mInWaveBuffer[i + mWindowSize / 2];
         }
         mInputPos = mWindowSize / 2;
      }
   }
}
Exemplo n.º 14
0
/**
 * Prepare bot for action
 */
bool CCFBot::Initialize( const BotProfile *profile, int team )
{
	// extend
	BaseClass::Initialize( profile, team );

	// CF bot initialization
	m_diedLastRound = false;
	m_morale = POSITIVE;			// starting a new round makes everyone a little happy

	m_combatRange = RandomFloat( 325.0f, 425.0f );

	// set initial safe time guess for this map
	m_safeTime = 15.0f + 5.0f * GetProfile()->GetAggression();

	m_name[0] = '\000';

	ResetValues();

	m_desiredTeam = team;

	if (GetTeamNumber() <= LAST_SHARED_TEAM)
	{
		ChangeTeam(m_desiredTeam);
	}

	Buy();

	return true;
}
Exemplo n.º 15
0
/*
========================
idLocalUser::SetStatFloat
========================
*/
void idLocalUser::SetStatFloat( int s, float v )
{
	idPlayerProfile* profile = GetProfile();
	if( profile != NULL )
	{
		return profile->StatSetFloat( s, v );
	}
}
Exemplo n.º 16
0
void FragmentShaderCg::RestoreDeviceData(uint8 **ppBackup)
{
	// Restore data
	if (*ppBackup) {
		// The string class takes over the control of the string memory and also deletes it
		SetSourceCode(String(reinterpret_cast<char*>(*ppBackup), false), GetProfile(), m_sArguments, m_sEntry);
	}
}
Exemplo n.º 17
0
/*
========================
idLocalUser::GetStatInt
========================
*/
int	idLocalUser::GetStatInt( int s ) { 
	const idPlayerProfile * profile = GetProfile();

	if ( profile != NULL && s >= 0 ) {
		return profile->StatGetInt( s );
	}

	return 0; 
}
Exemplo n.º 18
0
/*
========================
idLocalUser::GetStatFloat
========================
*/
float idLocalUser::GetStatFloat( int s ) {
	const idPlayerProfile * profile = GetProfile();

	if ( profile != NULL ) {
		return profile->StatGetFloat( s );
	}

	return 0.0f;
}
Exemplo n.º 19
0
static FILE *GetLogFile(void)
{
    if(stdlog2 == NULL) {
        char result_file[256];
        if(filename2 == NULL) return stdout;
#if defined(_MSC_VER)
        _snprintf(result_file, sizeof(result_file), "%s.%s_tested", filename2, GetProfile());
#else
        snprintf(result_file, sizeof(result_file), "%s.%s_tested", filename2, GetProfile());
#endif
        stdlog2 = fopen(result_file, "w");
        if(stdlog2 == NULL) {
            fprintf(stdout, "cannot open logfile: %s (%s)\n", result_file, strerror(errno));
            exit(1);
        }
    }
    return stdlog2;
}
Exemplo n.º 20
0
	std::shared_ptr<const i2p::data::RouterInfo> TunnelPool::SelectNextHop (std::shared_ptr<const i2p::data::RouterInfo> prevHop) const
	{
		bool isExploratory = (i2p::tunnel::tunnels.GetExploratoryPool () == shared_from_this ());
		auto hop = isExploratory ? i2p::data::netdb.GetRandomRouter (prevHop): 
			i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop);

		if (!hop || hop->GetProfile ()->IsBad ())
			hop = i2p::data::netdb.GetRandomRouter ();
		return hop;	
	}	
Exemplo n.º 21
0
std::shared_ptr<const i2p::data::RouterInfo> TunnelPool::SelectNextHop(
    std::shared_ptr<const i2p::data::RouterInfo> prevHop) const {
  // TODO(unassigned): implement it better
  bool isExploratory = (m_LocalDestination == &i2p::context);
  auto hop = isExploratory ?
    i2p::data::netdb.GetRandomRouter(prevHop) :
    i2p::data::netdb.GetHighBandwidthRandomRouter(prevHop);
  if (!hop || hop->GetProfile ()->IsBad())
    hop = i2p::data::netdb.GetRandomRouter();
  return hop;
}
Exemplo n.º 22
0
//-----------------------------------------------------------------------------
Profile* ProfileManager::GetDefaultUserProfile(const ProfileDeviceKey& deviceKey)
{
	const char* userName = GetDefaultUser(deviceKey);

    Profile* profile = GetProfile(deviceKey, userName);

    if (!profile)
    {
        profile = GetDefaultProfile(deviceKey.HmdType);
    }

    return profile;
}
Exemplo n.º 23
0
void KickUserJob::makeJob()
{
    QList<UserInfoTOPtr> usersList = GetProfile()->getUserDatabase()->getUserList();
    QDateTime now = GGChatBot::getDateTime();

    int inactiveTime;

    foreach(UserInfoTOPtr user, usersList)
    {
        if(user->getOnChannel())
        {
            inactiveTime = INACTIVE_TIME;

            // it not working on special users
            if(user->getUserFlags() >= GGChatBot::OP_USER_FLAG)
                continue;

            if(user->getUserFlags() == GGChatBot::VOICE_USER_FLAG)
                inactiveTime = INACTIVE_VOICE_TIME;

            if(user->getNick().startsWith("Ktos", Qt::CaseInsensitive))
            {
                inactiveTime = INACTIVE_NONICK_TIME;
            }

            if(user->getLastSeen().secsTo(now) > inactiveTime)
            {
                // kick user
                GGChatBot::UserNick userNick = GetProfile()->getUserDatabase()->makeUserNick(user);
                QString msg = QString("%1 wylatuje z czatu. Nie spac, zwiedzac!").arg(userNick.nick);
                GetProfile()->getSession()->sendMessage(msg);
                qDebug() << msg;
                msg = QString("Zostales automatycznie wylogowany z powodu braku aktywnosci przez %1 minut. Aby powrocic wpisz: /start").arg(inactiveTime/ONE_MINUTE_IN_SECONDS);
                GetProfile()->getSession()->sendMessageTo(user->getUin(), msg);
                user->setOnChannel(false);
            }
        }
    }
}
Exemplo n.º 24
0
int CClientUserProfile::ApiLearnSkill(uint32_t skillid, int CharID)
{
	CWOBackendReq req(this, "api_SrvSkills.aspx");
	req.AddParam("func", "add");
	req.AddParam("CharID", CharID);
	req.AddParam("SkillID", skillid);
	if(!req.Issue())
	{
		return 50;
	}
	GetProfile();
	return skillid;
}
Exemplo n.º 25
0
int CClientUserProfile::ApiConvertGCToGD(int currentvalue,int convertvalue)
{
	CWOBackendReq req(this, "api_ConvertM.aspx");
	req.AddParam("CustomerID", CustomerID);
	req.AddParam("Var1", currentvalue);
	req.AddParam("Var2", convertvalue);
	if(!req.Issue())
	{
		return 50;
	}
	GetProfile();
	return 0;
}
void PoissonSubstitutionProcess::UpdateZip(int i)	{
		double total = 0;
		double* pi = GetProfile(i);
		for (int k=0; k<GetOrbitSize(i); k++)	{
			int n = GetStateFromZip(i,k);
			zipstat[i][k] = 0;
			zipstat[i][k] = pi[GetStateFromZip(i,k)];
			total += zipstat[i][k];
		}
		if (GetZipSize(i) > GetOrbitSize(i))	{
			zipstat[i][GetOrbitSize(i)] = 1-total;
		}
}
Exemplo n.º 27
0
static sBool sCompileDX9(sCompileResult &result, sInt stype, sInt dtype, sInt flags, const sChar8 *src, sInt len, const sChar8 *name)
{
#if sCOMP_DX9_ENABLE
  ID3DXBuffer *bytecode;

  sRelease(result.D3D9.CTable);
  sRelease(result.D3D9.Errors);

  sU32 d3dflags = 0;
  if(flags&sSCF_DEBUG)
    d3dflags |= D3DXSHADER_DEBUG;
  //if (sGetShellSwitch(L"n"))
  //  flags |= D3DXSHADER_SKIPOPTIMIZATION; // only use in case of emergency

  const sChar8 *profile8 = GetProfile(dtype);
  sChar profile[16];
  sCopyString(profile,profile8,16);

  // use old compiler for generating shader model 1_* code
#ifdef D3DXSHADER_USE_LEGACY_D3DX9_31_DLL
  if(sMatchWildcard(L"ps_1_*",profile))
    d3dflags |= D3DXSHADER_USE_LEGACY_D3DX9_31_DLL;
#endif

  if(D3DXCompileShader(src,len,0,0,name,profile8,d3dflags,&bytecode,&result.D3D9.Errors,&result.D3D9.CTable)!=D3D_OK)
    result.Valid = sFALSE;
  else
    result.Valid = sTRUE;

  // print errors and warnings
  if(result.D3D9.Errors)
  {
    ID3DXBuffer *buffer = result.D3D9.Errors;
    //sInt size = buffer->GetBufferSize();
    sCopyString(result.Errors,(sChar8*)buffer->GetBufferPointer(),result.Errors.Size());
  }

  if(!result.Valid)
  {
    sRelease(bytecode);
    return sFALSE;
  }

  // get source code
  sAddShaderBlob(result.ShaderBlobs,dtype,bytecode->GetBufferSize(),(const sU8*)bytecode->GetBufferPointer());
  return result.Valid;
#else
  return sFALSE;
#endif // sCOMP_DX9_ENABLE
}
Exemplo n.º 28
0
static FILE *GetLogFile(void)
{
	if(stdlog2 == NULL) {
		if(filename2 == NULL) return stdout;
		char result_file[256];
		snprintf(result_file, sizeof(result_file), "%s.%s_tested", filename2, GetProfile());
		stdlog2 = fopen(result_file, "w");
		if(stdlog2 == NULL) {
			fprintf(stdout, "cannot open logfile: %s\n", result_file);
			exit(1);
		}
	}
	return stdlog2;
}
Exemplo n.º 29
0
std::string BBMBPS::getFullProfile()
{
    Json::FastWriter writer;
    Json::Value root;

    root["displayName"] = GetProfile(BBM_DISPLAY_NAME);
    root["status"] = GetProfile(BBM_STATUS);
    root["statusMessage"] = GetProfile(BBM_STATUS_MESSAGE);
    root["personalMessage"] = GetProfile(BBM_PERSONAL_MESSAGE);
    root["ppid"] = GetProfile(BBM_PPID);
    root["handle"] = GetProfile(BBM_HANDLE);
    root["appVersion"] = GetProfile(BBM_APP_VERSION);
    root["bbmsdkVersion"] = GetProfile(BBM_SDK_VERSION);

    return writer.write(root);
}
Exemplo n.º 30
0
void UBTAuditLogEx(const char *szFile, const char *pzText, bool bNewLine, bool push)
{
	if (g_pchLogFile == LOGGING_UNASSIGNED)
	{
		try
		{
			g_pchLogFile = (char *)GetProfile().GetString("Debug", "DebugTraceXML",false);
			if (g_pchLogFile && g_pchLogFile[0])
			{
				// g_pchLogFile is valid and logging is turned ON
			}
			else
			{
				// Turn off logging and don't check the environment variable anymore (it's slow)
				g_pchLogFile = (char *)LOGGING_OFF;
			}
		}
		catch (GException &)
		{
		}
	}

	if (g_pchLogFile != LOGGING_OFF)
	{
		// trace out the xml being sent to the server
//		fstream fsOut(g_pchLogFile,  ios::out | ios::app);
		GString strOut;

		for (int i = 0; i < nIndent; i++)
			strOut << "   ";

		strOut << '(' << szFile << ')';

		if (push)
			strOut << " push: ";
		else
			strOut << " pop : ";

		if (pzText)
			strOut << pzText;
		else
			strOut << "(null)";

		if (bNewLine)
			strOut << "\n";
		strOut.ToFileAppend(g_pchLogFile);
	}
}