示例#1
0
void initLCD(void)
{
    uint16_t x;
    uint8_t i=0;
    delay16b(60000);
    SET_RESET;
    delay16b(60000);

    CLR_RESET;
    SET_CS;
    SET_COMMAND;
    delay16b(2540);

    while(init_sequence[i] != 0x00){
        waitForLo(&SPI->SR, 0x80);  /* Wait while SPI is busy transmitting data */
        SPI->DR = init_sequence[i];
        i++;
    }

    gotoX(0);
    gotoY(0);
    for(i = 0; i < 6; i++){
        gotoY(i);
        for(x=0; x < 84; x++){
            writeData(0);
            LCD_RAM[x][i] = 0;
        }
    }
}
示例#2
0
void refreshSnakeTile(uint8_t x, uint8_t y)
{
    uint8_t i;
    uint8_t lcd_tmp_x = x<<2;
    uint8_t lcd_tmp_y = y>>1;
    gotoX(lcd_tmp_x);
    gotoY(lcd_tmp_y);
    for(i = 0; i < 5; i++)
        writeDataFast(LCD_RAM[lcd_tmp_x + i][lcd_tmp_y]);
}
示例#3
0
void refreshBlock(uint8_t x, uint8_t y)
{
    gotoX(x);
    gotoY(y);
    writeDataFast(LCD_RAM[LCD_X][LCD_Y]);
}
/*
715, 	"%wsWindows %ws"
716, 	"%ws Build %ws"
717, 	"Evaluation copy."
718, 	"For testing purposes only."
723, 	"%wsMicrosoft (R) Windows (R) (Build %ws: %ws)"
737, 	"This copy of Windows is not genuine"
738, 	"Test Mode"
*/
BOOL GetWatermarkFromMuiFile(LPTSTR pszFile)
{
	_tcprintf(_T("File name:\t%s\n"), pszFile);

	if (!PathFileExists(pszFile))
	{
		_tcprintf(_T("File not found!\n"));
		return FALSE;
	}


	//
	// Check file version, we need to get the language ID of the mui file.
	//

	MYVERSIONINFO	vi;

	ZeroMemory(&vi, sizeof(MYVERSIONINFO));
	vi.dwSize = sizeof(MYVERSIONINFO);
	if (!GetDllFileVersion(pszFile, &vi))
	{
		_tcprintf(_T("Fail to get file version info!\n")); 
		return FALSE;
	}

	_tcprintf(_T("File version:\t%s\n"), vi.szShortVersion);


	//
	// Load mui file to memory
	//

	HINSTANCE		hInstLib  = NULL;

	hInstLib = LoadLibraryEx(pszFile, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
	if( NULL == hInstLib )
	{
		_tcprintf(_T("Fail to open file user32.dll.mui!\n")); 
		return FALSE;
	}


	//
	// Get file type
	//

	PIMAGE_DOS_HEADER	pDOSHeader	= (PIMAGE_DOS_HEADER)((DWORD_PTR)hInstLib - 1);
	PIMAGE_NT_HEADERS	pNTHeader	= (PIMAGE_NT_HEADERS) (pDOSHeader->e_lfanew + (DWORD_PTR)pDOSHeader);
	
	_tcprintf(_T("File type:\t"));
	switch (pNTHeader->FileHeader.Machine)
	{
	case IMAGE_FILE_MACHINE_I386:
		_tcprintf(_T("x86"));
		break;
	case IMAGE_FILE_MACHINE_AMD64:
		_tcprintf(_T("x64"));
		break;
	case IMAGE_FILE_MACHINE_IA64:
		_tcprintf(_T("ia64"));
		break;

	default:
		_tcprintf(_T("Unknown\nThis is not a valid file.\n"));

		FreeLibrary(hInstLib);
		return FALSE;
	}

	UINT		uStringID;
	UINT		uStringIDS[]	= {715, 716, 717, 718, 738, 723, 737};
	BOOL		bHasPatched		= FALSE;
	UINT		i				= 0;
	UINT		uMatchingString	= 0;

	// Create string info lists
	SINGLE_LIST_ENTRY	StringsHead;
	PSINGLE_LIST_ENTRY	psLink;
	PRES_STRING_INFO	pStrInfo;

	StringsHead.Next = NULL;

	_tcprintf(_T("\n\n   ID  String                                                Offset  Len Mod"));
	_tcprintf(  _T("\n-----  ----------------------------------------------------  ------  --- ---"));

	for (i=0; i < sizeof(uStringIDS)/sizeof(UINT); i++)
	{
		// Add a entry
		pStrInfo	= (PRES_STRING_INFO)MALLOC(sizeof(RES_STRING_INFO));
		ZeroMemory(pStrInfo, sizeof(RES_STRING_INFO));
		
		pStrInfo->uStringID	= uStringIDS[i];

		LoadStringExx(hInstLib, (WORD)vi.wLangID, pStrInfo);

		if (lstrlen(pStrInfo->pszText) > 0)
		{
			uMatchingString++;
		}

		_tcprintf(_T("\n%5d  %s"), pStrInfo->uStringID, pStrInfo->pszText);
		gotoX(61);
		_tcprintf(_T("0x%4X  %3d"), pStrInfo->dwFileOffset, pStrInfo->dwBytes);

		PushEntryList(&StringsHead, &(pStrInfo->link));

	} // for(i)


	// importance
	FreeLibrary(hInstLib);

	_tcprintf(_T("\n\n"));


	if ( (uMatchingString > 0) && (StringsHead.Next != NULL) )
	{
		_tcprintf(_T("Do you want to patch this file?\n"));
		_tcprintf(_T(" (Y=Yes  /  N=No)\n:"));

		int	iChoice	= getchar();

		if ( (iChoice == _T('y')) || (iChoice == _T('Y')) )
		{
			TCHAR	szFileBackup[MAX_PATH];

			StringCbCopy(szFileBackup, sizeof(szFileBackup), pszFile);
			StringCbCat(szFileBackup, sizeof(szFileBackup), _T(".backup"));

			// make a backup
			CopyFile(pszFile, szFileBackup, FALSE);

			// In real life, if you want to patch \windows\system32\en-us\user32.dll.mui,
			// because the file is in using, you must copy a temp file to do ZeroWatermarkFromMuiFile().
			// Last, using MoveFileEx() to replace the file.

			if (ZeroWatermarkFromMuiFile(pszFile, &StringsHead))
			{
				_tcprintf(_T("\nPatch OK!\n"));
			}
			else
			{
				_tcprintf(_T("\nFail to patch.\n"));
			}


		} // choice y
	}
	else
	{
		_tcprintf(_T("Watermark string is not found, no need to patch.\n"));
	}


	//
	// Removes all string infos, free memory
	//
	psLink	= PopEntryList(&StringsHead);
	while(psLink)
	{
		pStrInfo	= CONTAINING_RECORD(psLink, RES_STRING_INFO, link);

		// free memory
		if (pStrInfo->pszText)
			FREE((LPVOID)(pStrInfo->pszText));

		FREE((LPVOID)pStrInfo);

		// Removes the first entry
		psLink	= PopEntryList(&StringsHead);

	} // while(psLink)


	return TRUE;

} // GetWatermarkFromMuiFile
示例#5
0
void DvbStream::moveRotor( int switchPos, ChannelDesc *chan, int hiband, bool dvr )
{
	int i, j, index=-1;
	double angle=0.0, oldAngle=0.0;
	int rotor=0;
	int voltage18 = ( (chan->tp.pol=='H')||(chan->tp.pol=='h') );
	int ci = 4 * switchPos + 2 * hiband + (voltage18 ? 1 : 0);
	QString msg;

	fprintf( stderr, "Driving rotor to %s\n", chan->tp.source.ascii() );
	for ( i=0; i<(int)dvbDevice->lnb[switchPos].source.count(); i++ ) {
		if ( dvbDevice->lnb[switchPos].source[i]==chan->tp.source ) {
			index = i;
			break;
		}
	}
	angle = getSourceAngle( chan->tp.source );
	if ( dvbDevice->lnb[switchPos].rotorType==1 ) {
		fprintf( stderr, "Rotor: gotoX=%f\n", angle );
		gotoX( angle );
	}
	else {
		int pos = dvbDevice->lnb[switchPos].position[index];
		fprintf( stderr, "Rotor: gotoN=%d\n", pos );
		rotorCommand( 9, pos );
	}
	if ( dvbDevice->lnb[switchPos].currentSource.isEmpty() ) {
		rotor = 10;
		msg =  i18n("Moving rotor from unknown position...");
	}
	else {
		oldAngle = getSourceAngle( dvbDevice->lnb[switchPos].currentSource );
		fprintf( stderr, "old rotor pos: %f °\n", oldAngle );
		fprintf( stderr, "new rotor pos: %f °\n", angle );
		angle = fabs(angle-oldAngle);
		fprintf( stderr, "Rotation angle: %f °\n", angle );
		if ( voltage18 )
			rotor = (int)(angle*dvbDevice->lnb[switchPos].speed18v)+1;
		else
			rotor = (int)(angle*dvbDevice->lnb[switchPos].speed13v)+1;
		 msg = i18n("Moving rotor...");
	}
	fprintf( stderr, "Rotation time: %d sec.\n", rotor );
	
	if ( !dvr ) {
		for ( j=0; j<(rotor*2); j++ ) {
			usleep( 500000 );
		}
	}
	else {
		QProgressDialog progress( msg, i18n("Cancel"), rotor*2, 0, "progress", true );
		for ( j=0; j<(rotor*2); j++ ) {
			progress.setProgress( j );
			qApp->processEvents();
			if ( progress.wasCanceled() )
				break;
			usleep( 500000 );
		}
		progress.setProgress( rotor*2 );
		qApp->processEvents();
	}

	if ( (ci/2)%2 ) {
		usleep(15*1000);
		if ( ioctl(fdFrontend, FE_SET_TONE, SEC_TONE_ON) )
			perror("FE_SET_TONE failed");
	}
}