Esempio n. 1
0
uint32_t FWadCollection::LumpNameHash (const char *s)
{
	const uint32_t *table = GetCRCTable ();;
	uint32_t hash = 0xffffffff;
	int i;

	for (i = 8; i > 0 && *s; --i, ++s)
	{
		hash = CRC1 (hash, *s, table);
	}
	return hash ^ 0xffffffff;
}
Esempio n. 2
0
static int ModelFrameHash(FSpriteModelFrame * smf)
{
	const uint32_t *table = GetCRCTable ();
	uint32_t hash = 0xffffffff;

	const char * s = (const char *)(&smf->type);	// this uses type, sprite and frame for hashing
	const char * se= (const char *)(&smf->hashnext);

	for (; s<se; s++)
	{
		hash = CRC1 (hash, *s, table);
	}
	return hash ^ 0xffffffff;
}
Esempio n. 3
0
void handle_data(unsigned char temp)
{
	short a=0,b=0;
	if(temp==0x01)succflag=1;

	
	//if(1==count&&temp==0x14)
	//{sendcastflag=1;}
	if(1==count&&(temp==0x14||temp==0x15))
	{
		succflag=0;count=0;return;
	}
	#if SELECT==2009						   //????zyz
	if(1==count&&(temp==0x14||temp==0x11))
	{
		succflag=0;count=0;return;
	}
	#endif
	//if(1==count&&(temp==0x11||temp==0x12))LED_ON
	if (count>(size_array-10))
	{
		for (a=0;a<size_array;a++)
		rdatatemp[a]=0;
		succflag=0;
		count=0;
	}
	

	if(succflag)
	{
		rdatatemp[count]=temp;
		
		
		if (rdatatemp[count]==0x03)
		{

			
		
			
			
			m_save=CRC1(rdatatemp,count-2);
			m_crc=rdatatemp[count-1];////////////12 27¸Ä
			m_crc<<=8;
			m_crc|=rdatatemp[count-2];
			if(m_save!=m_crc||m_crc==0)
			{
				for (a=0;a<=count;a++)
				rdatatemp[a]=0;
			}
			
			#if SELECT==2006||SELECT==2010						   //????zyz
			
			if(rdatatemp[0]==0x01)
			for ( a=0;a<=count;a++)
			rdata[a]=rdatatemp[a];

			
			#endif
			#if SELECT==2009				   //????zyz
			
			if(rdatatemp[1]==0x22)
			{
				if(rdata[0]==0)
				{for ( a=0;a<=count;a++)
					{
						rdata[a]=rdatatemp[a];
					}
				rx0x11=0;}
			}
			#endif
			
			if(rdatatemp[1]==0x12)
			{
				b=0;
				if(rdatacache[0][0]!=0)
				for (b=0;b<cachelen;b++)
				{
					if(rdatacache[b][0]==0)
					break;
				}
				if(b>=flag_oyx)
				flag_oyx=b;
				for ( a=0;a<=count;a++)
				rdatacache[b][a]=rdatatemp[a];
				
			}
			
			

			
			
			
			count=-1;
			succflag=0;

			for (a=0;a<=count;a++)
			rdatatemp[a]=0;
		}
		if (rxflag==1)      				          //????
		switch(rdatatemp[count])
		{
			case 0x81: rdatatemp[count-1]=0x01;count--;rxflag=0;break;
			case 0x83: rdatatemp[count-1]=0x03;count--;rxflag=0;break;
			case 0x90: rdatatemp[count-1]=0x10;count--;rxflag=3;break;
			default:rxflag=0;break;
		}
		if (rdatatemp[count]==0x10&&rxflag!=3)
		rxflag=1;     //??????
		else rxflag=0;
		count++;
		//?????
	}
	// LED_OFF
}