コード例 #1
0
ファイル: OnlineSession.cpp プロジェクト: baddymaster/se
void OnlineSession::secondDAccess(string filename, double& diskTime){


	b_index_t* blockIndices = new b_index_t[numBlocks*BLOW_UP];
	prSubset.get(blockIndices, numBlocks*BLOW_UP);

	byte* dataBlocksBytes = new byte[numBlocks*BLOW_UP*BLOCK_SIZE];
	clock_t start = clock();
	readD(blockIndices, numBlocks*BLOW_UP, dataBlocksBytes);
	diskTime += (double)(clock()-start)/CLOCKS_PER_SEC;

//	size_t filesize;

	for(int i = 0; i < numBlocks*BLOW_UP - SIZE_MIN; i++){
		/* After reading the final file block i.e. one that have data less than MAX_BLOCK_DATA_SIZE the loop can be broken
		 * but only for read. For update we need to process all the blocks */
		DataBlock block(blockIndices[i+SIZE_MIN]);
		block.parse(&dataBlocksBytes[(i+SIZE_MIN)*BLOCK_SIZE]);
		blocks.push_back(block);
		if(block.fidMatchCheck(fid)){
			fileBlocks.push_back(block);
			updatedFileBlocksIndices.push_back(i+SIZE_MIN);
			}
		}

	delete[] blockIndices;
	delete[] dataBlocksBytes;
}
コード例 #2
0
bool L2Game_CharacterDelete::parse( L2_VERSION ver )
{
	ver = L2_VERSION_T1;
	if( getPacketType() != 0x0D ) return false;
	p_charSlot = readD();
	return true;
}
コード例 #3
0
ファイル: OnlineSession.cpp プロジェクト: baddymaster/se
void OnlineSession::updateAccess(string filename, double& diskTime){
	b_index_t blockIndices[SIZE_MIN];
	prSubset.get(blockIndices, SIZE_MIN);

	byte firstBlock[BLOCK_SIZE*2];
	clock_t start = clock();
	readD(blockIndices, 2, firstBlock);
	diskTime += (double)(clock()-start)/CLOCKS_PER_SEC;

	DataBlock block(blockIndices[0]);
	block.parse(firstBlock);
	blocks.push_back(block);
	
	DataBlock block1(blockIndices[1]);
	block.parse(firstBlock+BLOCK_SIZE);
	blocks.push_back(block1);


	size_t filesize = *(size_t*)(&firstBlock);
	int lastBlock = (b_index_t)(ceil((double)filesize/(double)MAX_BLOCK_DATA_SIZE))+1;

	b_index_t blockIndicesComplete[prSubset.getSize()];
	prSubset.get(blockIndicesComplete, prSubset.getSize());

	blocks[1].update(fid, firstBlock, MAX_BLOCK_DATA_SIZE);
	
	byte blockToWrite[BLOCK_SIZE];
	blocks[1].getEncrypted(blockToWrite);

//	DataBlock lblock(blockIndicesComplete[lastBlock-1]);
	fileBlocks.push_back(block1);
}
コード例 #4
0
ファイル: Timer0A.c プロジェクト: glockwork/EE445L
//Timer A: Outputs the 2 sin waves (1 for each instrument)
void Timer0A_Handler(void){
	unsigned int newPortDValues;
  unsigned int newPortBValues;

	TIMER0_ICR_R = TIMER_ICR_TATOCINT;// acknowledge timer0A timeout
	TIMER0_TAILR_R = interrupt_cycles_a - 1; //TIMER0_TAILR_R + periodShift;
	
	newPortDValues = readD();
	newPortBValues = 0;//readB();

	//read ports
	//for each bit, if the value is different, send through zigbee 

}
コード例 #5
0
ファイル: OnlineSession.cpp プロジェクト: baddymaster/se
void OnlineSession::firstDAccess(string filename, double& diskTime){
	
	b_index_t blockIndices[SIZE_MIN];
	prSubset.get(blockIndices, SIZE_MIN);

	byte dataBlocksBytes[SIZE_MIN*BLOCK_SIZE];
	clock_t start = clock();
	readD(blockIndices, SIZE_MIN, dataBlocksBytes);
	diskTime += (double)(clock()-start)/CLOCKS_PER_SEC;
//	printhex(dataBlocksBytes, SIZE_MIN*BLOCK_SIZE, "DATA BYTES");

//	size_t filesize;

	bool fileBlockExists = false;

	for(int i = 0; i < SIZE_MIN; i++){
		/* After reading the final file block i.e. one that have data less than MAX_BLOCK_DATA_SIZE the loop can be broken
		 * but only for read. For update we need to process all the blocks */
		DataBlock block(blockIndices[i]);
		block.parse(&dataBlocksBytes[i*BLOCK_SIZE]);
		blocks.push_back(block);
		if(block.fidMatchCheck(fid)){
			if(!fileBlockExists){
			//	printhex(&dataBlocksBytes[i*BLOCK_SIZE], BLOCK_SIZE, "FIRST BLOCK");
				filesize = *(size_t*)(&dataBlocksBytes[i*BLOCK_SIZE]);
				numBlocks = (b_index_t)(ceil((double)filesize/(double)MAX_BLOCK_DATA_SIZE));
				fileBlockExists = true;
			}
			fileBlocks.push_back(block);
			updatedFileBlocksIndices.push_back(i);
			}
		}
//	cout << "Filesize is " << filesize << endl;
//	cout << "numBlocks x BLOW_UP " << numBlocks*BLOW_UP << endl;
//	cout << "SIZE_MIN " << SIZE_MIN << endl;
}
コード例 #6
0
ファイル: ControlledCalc.cpp プロジェクト: davehummel/tredbot
		float readF(){
			return (float) readD();
		}
コード例 #7
0
ファイル: ControlledCalc.cpp プロジェクト: davehummel/tredbot
		uint32_t readT(){
			return (uint32_t) readD();
		}
コード例 #8
0
ファイル: ControlledCalc.cpp プロジェクト: davehummel/tredbot
		int32_t readL(){
			return (int32_t) readD();
		}
コード例 #9
0
ファイル: ControlledCalc.cpp プロジェクト: davehummel/tredbot
		int16_t readI(){
			return (int16_t) readD();
		}
コード例 #10
0
ファイル: ControlledCalc.cpp プロジェクト: davehummel/tredbot
		uint16_t readU(){
			return (uint16_t) readD();
		}
コード例 #11
0
ファイル: ControlledCalc.cpp プロジェクト: davehummel/tredbot
		uint8_t readB(){
			return (uint8_t) readD();
		}
コード例 #12
0
bool L2Game_NewCharacterSuccess::read_nextCharacterTemplate( struct L2Game_NewCharacterTemplate *t )
{
	if( !t ) return false;
	// each template is 80 bytes length (20Ds)
	if( !canReadBytes( 80 ) ) return false;
	// read
	t->race      = readD();
	t->classID   = readD();
	readD(); // 0x46
	t->base_STR  = readD();
	readD(); // 0x0A
	readD(); // 0x46
	t->base_DEX  = readD();
	readD(); // 0x0A
	readD(); // 0x46
	t->base_CON  = readD();
	readD(); // 0x0A
	readD(); // 0x46
	t->base_INT  = readD();
	readD(); // 0x0A
	readD(); // 0x46
	t->base_WIT  = readD();
	readD(); // 0x0A
	readD(); // 0x46
	t->base_MEN  = readD();
	readD(); // 0x0A
	return true;
}