void CreateWorldVertexTransitionPatchedMaterial( const char *pOriginalMaterialName, const char *pPatchedMaterialName )
{
	KeyValues *kv = LoadMaterialKeyValues( pOriginalMaterialName, 0 );
	if( kv )
	{
		// change shader to Lightmappedgeneric (from worldvertextransition*)
		kv->SetName( "LightmappedGeneric" );
		// don't need no stinking $basetexture2 or any other second texture vars
		RemoveKey( kv, "$basetexture2" );
		RemoveKey( kv, "$bumpmap2" );
		RemoveKey( kv, "$bumpframe2" );
		RemoveKey( kv, "$basetexture2noenvmap" );
		RemoveKey( kv, "$blendmodulatetexture" );
		RemoveKey( kv, "$maskedblending" );
		RemoveKey( kv, "$surfaceprop2" );
		// If we didn't want a basetexture on the first texture in the blend, we don't want an envmap at all.
		KeyValues *basetexturenoenvmap = kv->FindKey( "$BASETEXTURENOENVMAP" );
		if( basetexturenoenvmap->GetInt() )
		{
			RemoveKey( kv, "$envmap" );
		}

		Warning( "Patching WVT material: %s\n", pPatchedMaterialName );
		WriteMaterialKeyValuesToPak( pPatchedMaterialName, kv );
	}
}
Ejemplo n.º 2
0
//////////////////
// Remove hook from map
//
void CSubclassWndMap::Remove(CSubclassWnd* pUnHook)
{
	HWND hwnd = pUnHook->m_hWnd;
	ASSERT(hwnd && ::IsWindow(hwnd));

	CSubclassWnd* pHook = Lookup(hwnd);
	ASSERT(pHook);
	if (pHook==pUnHook) {
		// hook to remove is the one in the hash table: replace w/next
		if (pHook->m_pNext)
			SetAt(hwnd, pHook->m_pNext);
		else {
			// This is the last hook for this window: restore wnd proc
			RemoveKey(hwnd);
#pragma warning( disable: 4311)	
			SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)pHook->m_pOldWndProc);
#pragma warning( default: 4311)	
		}
	} else {
		// Hook to remove is in the middle: just remove from linked list
		while (pHook->m_pNext!=pUnHook)
			pHook = pHook->m_pNext;
		ASSERT(pHook && pHook->m_pNext==pUnHook);
		pHook->m_pNext = pUnHook->m_pNext;
	}
}
Ejemplo n.º 3
0
//============================================================================
//		NCache::Purge : Purge the cache.
//----------------------------------------------------------------------------
void NCache::Purge(void)
{	NCacheItemList					theItems;
	NCacheItemListConstIterator		theIter;



	// Check our state
	if (!NeedsPurge())
		return;
	
	
	
	// Get the state we need
	//
	// Items are sorted with least-recently-used to the front.
	theItems = GetItems();
	
	sort(theItems, NCompareLRU());



	// Purge the cache
	for (theIter = theItems.begin(); theIter != theItems.end(); theIter++)
		{
		if (theIter->theValue->IsPurgeable())
			RemoveKey(theIter->theKey);
		
		if (!NeedsPurge())
			break;
		}
}
Ejemplo n.º 4
0
//============================================================================
//		NCache::SetValue : Set a value.
//----------------------------------------------------------------------------
void NCache::SetValue(const NCacheKey &theKey, NCacheValue *theValue)
{


	// Validate our parameters
	NN_ASSERT(theValue->GetCost() >= 0);



	// Prepare to set
	if (HasKey(theKey))
		RemoveKey(theKey);

	if (NeedsPurge())
		Purge();



	// Set the value
	mCache[theKey] = theValue;
	mCacheCost    += theValue->GetCost();

	theValue->SetAccessTime();
	theValue->Retain();
}
Ejemplo n.º 5
0
//============================================================================
//		NCache::Clear : Clear the cache.
//----------------------------------------------------------------------------
void NCache::Clear(void)
{


	// Clear the cache
	while (!mCache.empty())
		RemoveKey(mCache.begin()->first);
}
LONG ServiceRegistry::RemoveKey(String hKey, String subkey)
{
	HKEY key;
	LONG l = GetKey(hKey, key);
	if (l == ERROR_SUCCESS)
		return RemoveKey(key, subkey);
	return l;
}
nsresult
nsDOMStorageDBWrapper::RemoveKey(DOMStorageImpl* aStorage,
                                 const nsAString& aKey,
                                 bool aExcludeOfflineFromUsage,
                                 PRInt32 aKeyUsage)
{
  IMPL_FORWARDER(RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage));
}
Ejemplo n.º 8
0
BOOL CSharesInformation::DeleteAllStockFromStockType()
{
	int m_counts = GetStockTypeCount(STKTYPE);
	for (int i = m_counts - 1; i >= 0; i--)
	{
		RemoveKey(m_pData[STKTYPE][i].StockId, STKTYPE);
	}

	return TRUE;
}
Ejemplo n.º 9
0
	void SubRectAllocator::GetRect(CRect& rect, const Subtitle* s, const Align& align, int tlb, int brb)
	{
		SubRect sr(rect, s->m_layer);
		sr.rect.InflateRect(tlb, tlb, brb, brb);

		StringMapW<SubRect>::CPair* pPair = Lookup(s->m_name);

		if(pPair && pPair->m_value.rect != sr.rect) {
			RemoveKey(s->m_name);
			pPair = NULL;
		}

		if(!pPair) {
			bool vertical = s->m_direction.primary == _T("down") || s->m_direction.primary == _T("up");

			bool fOK = false;

			while(!fOK) {
				fOK = true;

				POSITION pos = GetStartPosition();
				while(pos) {
					const SubRect& sr2 = GetNextValue(pos);

					if(sr.layer == sr2.layer && !(sr.rect & sr2.rect).IsRectEmpty()) {
						if(vertical) {
							if(align.h < 0.5) {
								sr.rect.right = sr2.rect.right + sr.rect.Width();
								sr.rect.left = sr2.rect.right;
							} else {
								sr.rect.left = sr2.rect.left - sr.rect.Width();
								sr.rect.right = sr2.rect.left;
							}
						} else {
							if(align.v < 0.5) {
								sr.rect.bottom = sr2.rect.bottom + sr.rect.Height();
								sr.rect.top = sr2.rect.bottom;
							} else {
								sr.rect.top = sr2.rect.top - sr.rect.Height();
								sr.rect.bottom = sr2.rect.top;
							}
						}

						fOK = false;
					}
				}
			}

			SetAt(s->m_name, sr);

			rect = sr.rect;
			rect.DeflateRect(tlb, tlb, brb, brb);
		}
	}
Ejemplo n.º 10
0
void CCAttrMap::RemoveAttribute(CCRuntimeClass* pAttrClass)
{
	NodeAttribute* pOldAttr = NULL;
	if( Lookup( pAttrClass, (void*&)pOldAttr ) )
	{
		if (pOldAttr)
			delete pOldAttr;

		// We need to Remove and Delete the existing Stroke Colour Attr
		RemoveKey( pAttrClass );
	}
}
Ejemplo n.º 11
0
NodeAttribute * CCAttrMap::ReplaceAttribute(NodeAttribute *pNewAttr)
{
	void* pOldAttr = NULL;
	if( Lookup( pNewAttr->GetAttributeType(), pOldAttr ) )
	{
		// We need to Remove and Delete the existing Stroke Colour Attr
		RemoveKey( pNewAttr->GetAttributeType() );
	}
	
	// Add the new attr into the attr map
	SetAt( pNewAttr->GetAttributeType(), (void*)pNewAttr );	

	return (NodeAttribute *)pOldAttr;
}
Ejemplo n.º 12
0
//
// Remove clone clusters that contain only one region
//
bool CCSRegionsMap::removeSingletons()
{
    CCSRegions* pRegions = NULL;
    UINT key;
    POSITION pos = GetStartPosition();
    while (pos)  {
        GetNextAssoc(pos, key, pRegions);
        if (pRegions->GetSize() < 2) {
            RemoveKey(key);
            delete pRegions;
            pRegions = NULL;
        }
    }
    return true;
}
void CConnections::Remove(LPCTSTR sKey)
{
	CConnection* pConnection =NULL;
	
	if (Lookup(sKey,pConnection)) {

		pConnection->Delete();

		if (!RemoveKey(sKey)) {
				ASSERT(FALSE);
			}
	
	}


}
BOOL CWorldConnList::RemoveConnection(IVWCommConnection *pCommConnection)
{
	ConnectionInfo cinfo;

	if (Lookup(pCommConnection, cinfo))		
	{
		SAFERELEASE(cinfo.pWorld);		
		SAFERELEASE(cinfo.pVWComm);
		
		RemoveKey(pCommConnection);

		SAFERELEASE(pCommConnection);

		return TRUE;
	}
	else
		return FALSE;	
}
Ejemplo n.º 15
0
bool plKeysAndValues::AddValue(const std::string & key, const std::string & value, KAddValueMode mode)
{
    switch (mode)
    {
    case kFailIfExists:
        if (HasKey(key))
            return false;
        break;
    case kReplaceIfExists:
        if (HasKey(key))
            RemoveKey(key);
        break;
    default:
        break;
    }
    fKeys[key.c_str()].push_front(value.c_str());
    return true;
}
Ejemplo n.º 16
0
void CCAttrMap::DeleteAttributes()
{
	CCRuntimeClass	   *pType;
	void			   *pVal;

	// iterating all (key, value) pairs
	for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); )
	{
		// Get attr at position Pos
		GetNextAssoc( Pos, pType, pVal );

		if (pVal != NULL)
		{
			RemoveKey(pType);
			// Must cast to NodeAttribute before deleting, otherwise wrong destructor gets called
			delete (NodeAttribute*)pVal;
		}
	}
}
Ejemplo n.º 17
0
void CCAttrMap::RemoveGeometryLinkedAttrs()
{
	INT32 curr = 0;

	do
	{
		CCRuntimeClass *pType = (CCRuntimeClass *)GeometryLinkedAttributeClasses[curr];
		void		   *pVal;
				
		if( Lookup( pType, pVal ) )
		{
			if (pVal != NULL)
			{
				RemoveKey( pType );
				delete (NodeAttribute*)pVal;
			}
		}

		curr++;
	}
	while(curr<NumGLAs);
}
Ejemplo n.º 18
0
UINT WINAPI RemoveSmartCardConfiguration(MSIHANDLE hInstall)
{
	HRESULT hr = S_OK;
	UINT er = ERROR_SUCCESS;

	hr = WcaInitialize(hInstall, "RemoveSmartCardConfiguration");
	ExitOnFailure(hr, "Failed to initialize");

	WcaLog(LOGMSG_STANDARD, "Initialized.");

	/* clean a smart card database. As today the x64 setup doesn't handle x86 installation on x64 machine */
	RemoveKey(SC_DATABASE);
	/* when this happens, just uncomment the following line:
#ifdef _M_X64
	RemoveKey(X86onX64_SC_DATABASE);
#endif
	*/

	/* never fails or only if the msi uninstall didn't work. If the uninstall custom action trigger a failure, the user is unable to uninstall the software */
LExit:
	er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
	return WcaFinalize(er);
}
Ejemplo n.º 19
0
//////////////////
// Remove hook from map
//
void COXHookWndMap::Remove(COXHookWnd* pUnHook)
{
	HWND hWnd=pUnHook->m_hWndHooked;
	ASSERT(hWnd && ::IsWindow(hWnd));

	COXHookWnd* pHook=Lookup(hWnd);
	ASSERT(pHook);
	if(pHook==pUnHook) 
	{
		// hook to remove is the one in the hash table: replace with next
		if(pHook->m_pNext)
		{
			SetAt(hWnd,pHook->m_pNext);
		}
		else 
		{
			// This is the last hook for this window: restore wnd proc
			RemoveKey(hWnd);
#pragma warning (disable: 4244)
			SetWindowLongPtr(hWnd,GWL_WNDPROC,(LONG_PTR)pHook->m_pOldWndProc);
			// Note - SetWindowLongPtr takes a long, not a long_ptr.  
			// Surely we don't want to truncate a pointer to a function here ?
#pragma warning (default: 4244)
		}
	} 
	else 
	{
		// Hook to remove is in the middle: just remove from linked list
		while(pHook->m_pNext!=pUnHook)
		{
			pHook=pHook->m_pNext;
		}
		ASSERT(pHook && pHook->m_pNext==pUnHook);
		pHook->m_pNext=pUnHook->m_pNext;
	}

}
Ejemplo n.º 20
0
// Required for all GLA's
// NB must only be called on attrmaps with copied attributes
// DO NOT CALL on maps with 'live' attributes - ie pointers to attrs in the tree
// (eg a mpa made by MakeAppliedAttrMap(pInk))
void CCAttrMap::PostBlendInit(Path* pPath, CCRuntimeClass* pCreatorClass)
{
	INT32 curr = 0;

	// NB this function is called on a Blended attr map
	// The Blend() function should return false if it doesn't want to be in the blended attr map
	// ie default GLAs shouldn't be in here!

	do
	{
		CCRuntimeClass *pType = (CCRuntimeClass *)GeometryLinkedAttributeClasses[curr];
		void		   *pVal;
				
		if( Lookup( pType, pVal ) )
		{
			if (pVal != NULL)
			{
				NodeAttribute * pAttr = (NodeAttribute *)pVal;

				// call the attributes routine to initialise itself
				if(!pAttr->PostDynCreateInit(this, pPath, pCreatorClass))
				{
					// make sure the node is not going to try and render itself
					TRACEUSER( "Ilan", wxT("Dynamically created attribute failed to post init itself. Removing attribute from map.\n") );
					// NB map must contain copied attrs
					RemoveKey( pType );
					// Must cast to NodeAttribute before deleting, otherwise wrong destructor gets called
					delete (NodeAttribute*)pVal;
				}
			}
		}

		curr++;
	}
	while(curr<NumGLAs);
}
Ejemplo n.º 21
0
BOOL CSharesInformation::DeleteOneStockInfo(CString strStockCode, int nKind)
{
	return RemoveKey(strStockCode.GetBuffer(0), nKind);
}
Ejemplo n.º 22
0
//Removes key and it's value 
BOOL CIniEx::RemoveKey(CString Key)
{
	return RemoveKey(_T(""),Key);
}
Ejemplo n.º 23
0
nsresult
nsDOMStorageDBWrapper::RemoveKey(DOMStorageImpl* aStorage,
                                 const nsAString& aKey)
{
  IMPL_FORWARDER(RemoveKey(aStorage, aKey));
}