Beispiel #1
0
int main(int argc, char *argv[])
{
    //char szBuf[1024*1024]={0};
    //read(0, szBuf, 1024*1024);    
    //printf("\nmd5=[%s]\n", GetMd5(szBuf).c_str());
    
    std::string s = argv[1];
    printf("orig:[%s], md5:[%s]\n", s.c_str(), GetMd5Sum(s).c_str());   
    
    //printf("\nmd5=[%s]\n", GetFileMd5(argv[1]).c_str());
    
    return 0;
}
Beispiel #2
0
void RecordedRomTest::SaveFrame(uint16_t* ppuFrameBuffer)
{
	uint8_t md5Hash[16];
	GetMd5Sum(md5Hash, ppuFrameBuffer, PPU::PixelCount * sizeof(uint16_t));

	if(memcmp(_previousHash, md5Hash, 16) == 0 && _currentCount < 255) {
		_currentCount++;
	} else {
		uint8_t* hash = new uint8_t[16];
		memcpy(hash, md5Hash, 16);
		_screenshotHashes.push_back(hash);
		if(_currentCount > 0) {
			_repetitionCount.push_back(_currentCount);
		}
		_currentCount = 1;

		memcpy(_previousHash, md5Hash, 16);

		_signal.Signal();
	}
}
Beispiel #3
0
void RecordedRomTest::ValidateFrame(uint16_t* ppuFrameBuffer)
{
	uint8_t md5Hash[16];
	GetMd5Sum(md5Hash, ppuFrameBuffer, PPU::PixelCount * sizeof(uint16_t));

	if(_currentCount == 0) {
		_currentCount = _repetitionCount.front();
		_repetitionCount.pop_front();
		_screenshotHashes.pop_front();
	}
	_currentCount--;

	if(memcmp(_screenshotHashes.front(), md5Hash, 16) != 0) {
		_badFrameCount++;
		Debugger::BreakIfDebugging();
	} 
	
	if (_currentCount == 0 && _repetitionCount.empty()) {
		//End of test
		_runningTest = false;
		_signal.Signal();
	}
}