Ejemplo n.º 1
0
void QBlitterWidget::render()
    {
	__DEBUG_IN
    __DEBUG2("Rendering.. QThread::currentThreadId():", QThread::currentThreadId());
	
	if( !iDSA )
		{
		__DEBUG1("NO DSA, returning");
		return;
		}
    if (IsActive())
    	{
		__DEBUG1("DSA Still active, cancel");
    	Cancel();
    	}
    
    TAcceleratedBitmapInfo bitmapInfo;
    iDSBitmap->BeginUpdate(bitmapInfo);        
    
    bitmapdata = (TUint8*) bitmapInfo.iAddress;
    bitmapBlit( (TUint8*) g_screenptr, bitmapdata);
    
    iDSBitmap->EndUpdate(iStatus);
    
    //this is required for SE Satio, Vivaz, and S^3 phones
    iDSA->ScreenDevice()->Update();
    
    SetActive();
    __DEBUG_OUT
    }
Ejemplo n.º 2
0
void QBlitterWidget::render()
    {
	__DEBUG_IN
	
    __DEBUG2("Rendering.. QThread::currentThreadId():", QThread::currentThreadId());
	
	if( !iDSA )
		{
		__DEBUG1("NO DSA, returning");
		return;
		}
    if (IsActive())
    	{
		__DEBUG1("DSA Still active, cancel");
		return;
    	//Cancel();
    	}
    
    TAcceleratedBitmapInfo bitmapInfo;
    iDSBitmap->BeginUpdate(bitmapInfo);        
    
    bitmapdata = (TUint8*) bitmapInfo.iAddress;
    bitmapBlit( (TUint8*) BaseAddress, bitmapdata);
    
    iDSBitmap->EndUpdate(iStatus);
    SetActive();
    
    __DEBUG_OUT
    }
Ejemplo n.º 3
0
void EndIHexLine(FILE *dstFile,int addr,int lineLen)
{
	__DEBUG1(">EndIHexLine: ");
	gGenHexSum-=lineLen; // subtract byte count.
	gGenHexSum-=(addr>>8)&0xff; // sub upper byte.
	gGenHexSum-=addr&0xff; // sub lower byte.
	// Record type is 0, so won't affect sum.
	fprintf(dstFile,":%02X%04X00%s%02X\n",lineLen,
				addr&~0xf,gGenHexData,gGenHexSum&0xff);
	gGenHexSum=0;
	strcpy(gGenHexData,""); // reset the data.
	__DEBUG1("<EndIHexLine\n");
}
Ejemplo n.º 4
0
void gpsp4Qt::paintEvent(QPaintEvent *)
{
    __DEBUG_IN
    __DEBUG2("QThread::currentThreadId():", QThread::currentThreadId());

    QPainter painter;
    painter.begin(this);


    if ( (m_buf == NULL) || (m_stretch != m_settings.iStretch) )
        m_stretch = m_settings.iStretch;
    {   QRect fullrect(0,0,width(), height() );
        painter.fillRect(fullrect, QColor(0x11, 0x11, 0x11 ));
    }

    if (m_buf != NULL)
    {
        __DEBUG1("Creating QRectF");
        int newWidth = width();
        int left = 0;
        if(m_stretch == TGPSPSettings::EMedium ){
            // 536 x 360 res
            left = 52;
            newWidth = 533;
        }
        QRect target(left, SCREEN_TOP, newWidth, height() );

        __DEBUG1("Drawing image");
        painter.drawImage(target, *m_buf);
        __DEBUG1("Ending QPainter");
    }

    //Draw pad
    painter.drawPixmap(tl_point, m_tlGraphics);
    painter.drawPixmap( dpad_point, m_dpadGraphics);
    painter.drawPixmap(tr_point, m_trGraphics);
    painter.drawPixmap( buttons_point, m_buttonsGraphics);
    painter.drawPixmap( menu_point, m_menuGraphics);
    painter.drawPixmap( start_select_point, m_startSelectGraphics);

    if( m_settings.iShowFPS )
        {
        painter.setPen ( Qt::green );
        //TODO
       // painter.drawText ( showFPS_point, QString::number(g_fps) );
        }

    painter.end();
    __DEBUG_OUT
}
Ejemplo n.º 5
0
void GenHexByte(FILE *gDstFile, char ch)
{
	__DEBUG1(">GenHexByte\n");
	printf("%c",ch);
	char digs[3];
	sprintf(digs,"%02X",ch);
	strcat(gGenHexData,digs);
	gGenHexSum-=ch;
	gGenHexAddress++;
	if(gGenHexAddress%25==0)
		printf("\n");
	if((gGenHexAddress&0xf)==0) {	// need to generate a new record.
		EndIHexLine(gDstFile,gGenHexAddress-16,16);
	}
	__DEBUG1("<GenHexByte\n");
}
Ejemplo n.º 6
0
void EmuSettings::loadSettings()
	{
	__DEBUG_IN
	QSettings settings;
	int version = settings.value("gpsp_version").toInt();
	if( version != KSettingsVersion )
		{
		__DEBUG1("No version was set, creating default settings");
		setDefaultSettings();
		savecurrentSettings();
		return;
		}
	gpspsettings.iVersion = version;

	for(int i=0;i<10;i++)
		{
	    QString keyval = "gpsp_kebind";
	    keyval.append( QString::number(i) );
	    gpspsettings.iScanKeyTable[i] = settings.value(keyval).toUInt();
		}
	gpspsettings.iLastROM = settings.value("gpsp_lastrom").toString();
	gpspsettings.iBios = settings.value("gpsp_bios").toString();
	gpspsettings.iShowFPS = settings.value("gpsp_showfps").toBool();
	gpspsettings.ikeepAspectRatio = settings.value("gpsp_aspectratio").toBool();
	gpspsettings.iFrameSkip = settings.value("gpsp_frameskip").toInt();
	gpspsettings.iAudioOn = settings.value("gpsp_audioOn").toBool();
	gpspsettings.iVolume = settings.value("gpsp_volume").toInt();
	gpspsettings.iLastSlot = settings.value("gpsp_lastslot").toInt();
	gpspsettings.iScreenSettings = settings.value("gpsp_screensettings").toInt();
	__DEBUG_OUT
	}
Ejemplo n.º 7
0
void EmuSettings::loadSettings()
	{
	__DEBUG_IN
	QSettings settings;
	int version = settings.value("gpsp_version").toInt();
	if( version != KSettingsVersion )
		{
		__DEBUG1("No version was set, creating default settings");
		setDefaultSettings();
		savecurrentSettings();
		return;
		}
	gpspsettings.iVersion = version;

	for(int i=0;i<10;i++)
		{
	    QString keyval = "gpsp_kebind";
	    keyval.append( QString::number(i) );
	    gpspsettings.iScanKeyTable[i] = settings.value(keyval).toUInt();
		}
	gpspsettings.iLastROM = settings.value("gpsp_lastrom").toString();
	gpspsettings.iBios = settings.value("gpsp_bios").toString();
	gpspsettings.iShowFPS = settings.value("gpsp_showfps").toBool();
	gpspsettings.iAudioOn = settings.value("gpsp_audioOn").toBool();
	gpspsettings.iVolume = settings.value("gpsp_volume").toInt();
	gpspsettings.iLastSlot = settings.value("gpsp_lastslot").toInt();
        gpspsettings.iDpadSettings = settings.value("gpsp_dpadsettings").toInt();
        gpspsettings.iButtonOpacity = settings.value("gpsp_ButtonOpacity").toInt();
        gpspsettings.iStretch = settings.value("gpsp_Stretch").toInt();
        gpspsettings.iButtonSettings = settings.value("gpsp_ButtonSettings").toInt();
	__DEBUG_OUT
	}
Ejemplo n.º 8
0
void loadStyleSheet()
{
    QFile file(":/style/summelistyle.qss");
    if(!file.open(QFile::ReadOnly))
        {
		__DEBUG1("Unable to open file");
        }
    QString styleSheet = QLatin1String(file.readAll());
    qApp->setStyleSheet(styleSheet);
}
Ejemplo n.º 9
0
void T2E2WhiteSpace(int *buffLen,int *buffMarker,int *fileNum, char *dstFileRoot)
{
	char prevWhiteSpace;
	tBool foundCr=kFalse;
	int maxWhite=kMaxWhiteLoopCheck;
	do {
		int oldBuffLen=strlen(gBlockBuff);
		prevWhiteSpace=GetWhiteSpace(gBlockBuff+oldBuffLen);
		if(prevWhiteSpace=='\t' && *gWordBuff=='(') { // ignore Tab EOL comment.
			gBlockBuff[oldBuffLen]='\0'; // if after tab.
			do {
				int buffPos=strlen(gBlockBuff);
				GetTok(gBlockBuff+buffPos,')',0);
				__DEBUG2("Cmt:[%s]",gBlockBuff+buffPos);
			}while(gTerminator!=')' && !feof(gSrcFile));
		}
		__DEBUG2("Whi:[%s,",gBlockBuff+oldBuffLen);
		__DEBUG2("%d,",oldBuffLen);
		__DEBUG2("%d]",*gWordBuff);
		*buffLen=strlen(gBlockBuff);
		if(*buffLen>=kMaxLineLen) { // end of block during whitespace.
			T2E2ConvertBuff(buffLen,buffMarker,fileNum,dstFileRoot);
		}
		foundCr=CrCheck();
		if(oldBuffLen==0)
			gBlockBuff[oldBuffLen]='\0'; // white space doesn't contribute at start.
		else if(gInColon==kFalse && foundCr && maxWhite==kMaxWhiteLoopCheck) {
			*buffMarker=*buffLen; // mark the current possible cut-off point.
			*buffLen=*buffLen+1;
			gCanDelGap=kTrue;
			__DEBUG1(" $$$ ");
		}
		if(*gWordBuff=='\014')
			__DEBUG1(" PBreak ");
	}while(--maxWhite>0 && *gWordBuff<=' ' && *gWordBuff!='\014' && !feof(gSrcFile));
	if(*gWordBuff=='\014')
		__DEBUG1(" PBreak2 ");
	if(maxWhite<=0) {
		__DEBUG1("Too much whitespace!");
		exit(1);
	}
}
Ejemplo n.º 10
0
// returns a pointer to buffer for next frame,
// to be used when iSoundBuffers are used directly
TInt8 *CAntAudio::NextFrameL()
{
#ifdef OUTPUT_TO_FILE	
    return (TUint8*) iSoundBuffers[iEmptyBufQ[0]]->Ptr();
#endif
    if( (iEmptyBufQ.Count() < 2) )
    {
        __DEBUG1("CAntAudio: NextFrame is NULL");
        return NULL;
    }
    return (TInt8*) iSoundBuffers[iEmptyBufQ[0]]->Ptr();
}
Ejemplo n.º 11
0
void gpsp4Qt::render()
{
    __DEBUG_IN
    __DEBUG2("Rendering.. QThread::currentThreadId():", QThread::currentThreadId());

    if (m_buf != NULL)
    {
        delete m_buf;
        m_buf = NULL;
    }

    __DEBUG1("creating buffer")
    m_buf = new QImage( (uchar*)g_screenptr, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, GBA_BYTES_PER_LINE, QImage::Format_RGB16);

    if ( m_buttonOpacity != m_settings.iButtonOpacity )
    {
        m_buttonOpacity = m_settings.iButtonOpacity;
        LoadButtons();
    }
    __DEBUG1("calling repaint")
    repaint();
    __DEBUG_OUT
}
Ejemplo n.º 12
0
void T2E2ConvertBuff(int *buffLen, int *buffMarker, int *fileNum, char *dstFileRoot)
{
	if(*buffMarker>0) {	// output current one and start new one.
		GenNewFile(dstFileRoot, *fileNum,*buffMarker);
		ConvertBuff(gBlockBuff,*buffMarker);
		memmove(gBlockBuff,gBlockBuff+gDelGap,*buffLen-gDelGap+1);
	}
	else {
		__DEBUG1("Buffer Conversion Fault.");
	}
	gDelGap=*buffMarker=0;
	gCanDelGap=kFalse;
	*fileNum=*fileNum+1;
}
Ejemplo n.º 13
0
void AntSnesQt::render(int width, int height)
{
    __DEBUG_IN
    __DEBUG2("Rendering.. QThread::currentThreadId():", QThread::currentThreadId());

    __DEBUG4("rendering: ", width, "x", height)
    if (buf != NULL)
    {
        delete buf;
        buf = NULL;
    }

    __DEBUG1("creating buffer")
    buf = new QImage(GFX.Screen, width, height, GFX.RealPitch, QImage::Format_RGB16);

    if ( buttonOpacity != iAntSettings.iButtonOpacity )
    {
        buttonOpacity = iAntSettings.iButtonOpacity;
        LoadButtons();
    }
    __DEBUG1("calling repaint")
    repaint();
    __DEBUG_OUT
}
Ejemplo n.º 14
0
void AntSnesQt::paintEvent(QPaintEvent *)
{
    __DEBUG_IN
    __DEBUG2("QThread::currentThreadId():", QThread::currentThreadId());

    QPainter painter;
    painter.begin(this);

    if ( (buf == NULL) || (stretch != iAntSettings.iStretch) ) 
        stretch = iAntSettings.iStretch;
    {   QRect fullrect(0,0,SCREEN_WIDTH, SCREEN_HEIGHT );
        painter.fillRect(fullrect, QColor(0x11, 0x11, 0x11 ));
    }
    
    if (buf != NULL)
    {
        __DEBUG1("Creating QRectF");
        int newWidth = width();
        int left = 0; 
        if ( stretch == TAntSettings::AntKeepAspectRatio ) {
            newWidth = (buf->width() / buf->height()) * SCREEN_HEIGHT;
            left = (SCREEN_WIDTH - newWidth) >> 1;
        }
Ejemplo n.º 15
0
int ConvertBuff(char *buff, int len)
{
	int ix;
	static char buffCopy[512],*buffPr;
	strncpy((buffPr=buffCopy),buff,len);
	buffCopy[len]='\0'; // terminate it.
	while(*buffPr!='\0') {	// convert back for printing purposes.
		if(*buffPr=='\015')
			*buffPr='\012'; // convert to LF, not Windows or Classic Mac compatible!
		buffPr++;
	}
	__DEBUG1("Block Contents:\n");
	printf("\"%s\n\"\n",buffCopy);
	gGenHexAddress=gGenHexSum=0;
	strcpy(gGenHexData,""); // reset the data.	
	fprintf(gDstFile,":02000004008179\n");	// initialisation record.
	for(ix=0;ix<len /* want to add '\0' too */ ;ix++) {
		GenHexByte(gDstFile,buff[ix]); // generate a hex byte for this character.
	}
	GenHexByte(gDstFile,0); // terminate with a 0.
	if((gGenHexAddress&0xf)!=0)	// need to generate a new record.
		EndIHexLine(gDstFile,gGenHexAddress&~15,gGenHexAddress&15); // finish off the block!
	fprintf(gDstFile,":00000001FF\n");	// termination record.
}
Ejemplo n.º 16
0
int T2E2PaddedOneScreen(FILE *srcFile, int firstChar)
{
	int parseState=kParseInBlank;
	int ch=0;
	tBool crShouldPad=kFalse;
	fprintf(gDstFile,":02000004008179\n");	// initialisation record.
	__DEBUG1(">T2E2 a\n");
	gGenHexAddress=gGenHexSum=0;
	strcpy(gGenHexData,""); // reset the data.	
	while(gGenHexAddress<=kFIGnitionBlockLen && ch!=EOF) {
		ch= gGenHexAddress==0 ? firstChar : gGenHexAddress==kFIGnitionBlockLen ? EOF : fgetc(srcFile);
		__DEBUG1(">T2E2 b\n");
		if(parseState&kParseInBlank) {
			if(ch=='\n' || ch==EOF) { // need to pad out to 25 chars.
				__DEBUG1(">T2E2 d\n");
				while((gGenHexAddress%kFIGnitionScreenLineLen)!=0 || crShouldPad) {
					GenHexByte(gDstFile,' '); // Pad with a space.
					crShouldPad=kFalse;
				}
				if (gGenHexAddress<kFIGnitionBlockLen)
					crShouldPad=kTrue;
			}
			else {
				if(ch!=' ') {
					// start processing a word.
					parseState=(parseState&~kParseInBlank)|kParseInWord;
					crShouldPad=kFalse;
					gT2E2CatCh[0]=(char)ch;
					strcat(gT2E2CurrentWord,gT2E2CatCh); // cat the new char.
				}
				GenHexByte(gDstFile,(char)ch); // generate the hex char.
			}
		}
		else if(parseState&kParseInWord) {
			// @TODO, need to check for combinations of states.
			__DEBUG1(">T2E2 c\n");
			if(ch=='\n' || ch==EOF) { // need to pad out to 25 chars.
				__DEBUG1(">T2E2 d\n");
				while((gGenHexAddress%kFIGnitionScreenLineLen)!=0 || crShouldPad) {
					GenHexByte(gDstFile,' '); // Pad with a space.
					crShouldPad=kFalse;
				}
				if (gGenHexAddress<kFIGnitionBlockLen)
					crShouldPad=kTrue;
			}
			else {
				__DEBUG2(">T2E2 e %d\n",ch);
				GenHexByte(gDstFile,(char)ch); // generate the hex char.
				__DEBUG1("<T2E2 e\n");
				crShouldPad=kFalse;
			}
			if(ch!=' ' && ch!='\n' && ch!=EOF) {
				__DEBUG1(">T2E2 f\n");
				gT2E2CatCh[0]=(char)ch;
				strcat(gT2E2CurrentWord,gT2E2CatCh); // cat the new char.
			}
			if(ch==' ' || ch=='\n' || ch==EOF) { // space terminates a word, so process it.
				char lastCh;
				__DEBUG1(">T2E2 g\n");
				lastCh=gT2E2CurrentWord[strlen(gT2E2CurrentWord)-1];
				if(strcmp(gT2E2CurrentWord,":")==0) { // colon def.
					__DEBUG1("In Colon!");
					parseState |= kParseInColon; // we're in a colon def now.
				}
				if(strcmp(gT2E2CurrentWord,";")==0 ) { 
					if((parseState&(kParseInColon|kParseInQuote|
							kParseInComment))==kParseInColon) { 
						// finished colon def if it's not in a comment or quote.
						__DEBUG1("Parse State is OK!");
						parseState &= ~kParseInColon; // we're out of a colon def.
					}
					else
						__DEBUG2("Parse State was:%d",parseState);
				}
				if(strcmp(gT2E2CurrentWord,".\"")==0) { // dot quote.
					parseState |= kParseInQuote; // we're in quotes.
				}
				if(strcmp(gT2E2CurrentWord,"(")==0) { // Comment.
					parseState |= kParseInComment; // we're in a comment.
					//printf("Start Comment %d",parseState);
				}
				parseState=(parseState&~kParseInWord)|kParseInBlank; // done word.
				strcpy(gT2E2CurrentWord,""); // reset current word.
			}
		}
		if((parseState&kParseInComment) && ch==')') { // end of comment
			parseState &= ~kParseInComment;
			parseState=(parseState&~kParseInWord)|kParseInBlank; // done word.
			strcpy(gT2E2CurrentWord,""); // reset current word.
			//printf("End Comment %d",parseState);
		}
		if((parseState&kParseInQuote) && ch=='\"') { // done quote.
			parseState &= ~kParseInQuote; // we've finished quotes.
			parseState=(parseState&~kParseInWord)|kParseInBlank; // done word.
			strcpy(gT2E2CurrentWord,""); // reset current word.
			__DEBUG2("End Comment %d",parseState);
		}
	}
	__DEBUG1(">T2E2 x\n");
	if(parseState & kParseInColon) {
		printf("In Colon Def at end of screen!!!");
	}
	__DEBUG1(">T2E2 y\n");
	while(gGenHexAddress<500)
		GenHexByte(gDstFile,' '); // Pad with a space.
	EndIHexLine(gDstFile,gGenHexAddress&~0xf,gGenHexAddress&0xf); // finish record.
	fprintf(gDstFile,":00000001FF\n");	// termination record.
}
Ejemplo n.º 17
0
int T2E2Ragged(FILE *srcFile,char *dstFileRoot)
{
	int buffLen,fileNum=0;
	//tBool gInColon=kFalse,foundCr=kFalse;
	int buffMarker=0;
	char prevWhiteSpace;
	gScreenLineLen=16;
	__DEBUG1(">T2E2Token\n");
	do {
		T2E2WhiteSpace(&buffLen,&buffMarker,&fileNum,dstFileRoot);
		if(gCanDelGap) {
			gDelGap=buffLen;
			gCanDelGap=kFalse;
		}
		GetTok(gToken,' ',kForthNameChars);
		__DEBUG2("Tok:[%s]",gToken);
		/*
		if(gTokIndent>0)
			strncat(gBlockBuff,"                              ",gTokIndent);
		*/
		tParseFlags tok=DictMatch(gToken);
		if(tok!=kTokIdPageBreak)
			strcat(gBlockBuff,gToken);
		//__DEBUG2("Blk:[%s]",gBlockBuff);
		switch(tok) {
		case kTokIdGeneric:
			break;
		case kTokIdColon:
			if(gInColon==kTrue)
				printf("Colon in Colon at: %s\n",gBlockBuff); // error location?
			gInColon=kTrue;
			break;
		case kTokIdExit:
		case kTokIdLocalExit:
			if(gInColon==kFalse)
				printf("Double exit at: %s\n",gBlockBuff);
			gInColon=kFalse;
			break;
		case kTokIdDotQuote:
			T2E2WhiteSpace(&buffLen,&buffMarker,&fileNum,dstFileRoot);
			GetTok(gBlockBuff+strlen(gBlockBuff),'\"',511);
			__DEBUG2("Str:[%s\"]",gToken);
			strcat(gBlockBuff,"\"");
			break;
		case kTokIdComment: {
			int buffPos0=strlen(gBlockBuff);
			do {
				int buffPos=strlen(gBlockBuff);
				GetTok(gBlockBuff+buffPos,')',prevWhiteSpace=='\t'?0:511);
			}while(*gWordBuff=='\0' && !feof(gSrcFile));
			__DEBUG2("Rem:[%s)]",gBlockBuff+buffPos0);
			FilterCr(gBlockBuff+buffPos0,' ');
			if(prevWhiteSpace!='\t')
				strcat(gBlockBuff,")");
			}
			break;
		/*
		case kTokIdPageBreak:
			T2E2ConvertBuff(&buffLen,&buffMarker,&fileNum,dstFileRoot);
			break;
		*/
		}
		buffLen=strlen(gBlockBuff);
		if(buffLen>=kMaxLineLen || tok==kTokIdPageBreak) { // end of block.
			T2E2ConvertBuff(&buffLen,&buffMarker,&fileNum,dstFileRoot);
		}
		/*
		foundCr=CrCheck();
		if(foundCr==kFalse)
			strcat(gBlockBuff," "); // add a space at the end if no CR.
		else if(gInColon==kFalse && foundCr)
			buffMarker=buffLen; // mark the current possible cut-off point.
		*/
	}while(!feof(gSrcFile));
	T2E2ConvertBuff(&buffLen,&buffMarker,&fileNum,dstFileRoot);
	if(gSrcFile!=NULL)
		fclose(gSrcFile);
	if(gDstFile!=NULL)
		fclose(gDstFile);
}
Ejemplo n.º 18
0
quint32 buttonwidget::getSnesKey( int x, int y )
	{
	quint32 key = 0;
	__DEBUG3("buttonwidget, x pos, y pos", x, y);
        if( y < 45 )
            {
            //right button pressed
            __DEBUG1("buttonwidget, TR WAS PRESSED");
            key = SNES_TR_MASK;
            }
        else if ((y > BUTTONS_CENTER_TOP ) && (y < BUTTONS_CENTER_BOTTOM ) && (x > BUTTONS_CENTER_LEFT )
                && (x < BUTTONS_CENTER_RIGHT ))
        {
            // Inside center circle of dpad
        }
        else if ( y > BUTTONS_TOP )
            {
            //Calculate distance from the center
            qreal rx = x - KCenter_x;
            qreal ry = y - KCenter_y;

            qreal r = qAtan2(ry,rx);
            r = (r * 180 )/ KPi; //convert radians to degrees

            //lets use full circle instead of negative angles
            if (r < 0)
                    {
                    r = 360 + r;
                    }

            qint32 angle = qRound(r);
            __DEBUG2("buttonwidget, angle is ", angle );

            //360 degrees is divided into 8 sectors.
            if (angle > 337 || angle < 68)
                    {
                    //right key was pressed
                    __DEBUG1("buttonwidget, A WAS PRESSED");
                    key = SNES_A_MASK;
                    }
            else if (angle >= 68 && angle < 158)
                    {
                    //Down key was pressed
                    __DEBUG1("buttonwidget, B WAS PRESSED");
                    key = SNES_B_MASK;
                    }
            else if (angle >= 158 && angle < 248)
                    {
                    //Left key was pressed
                    __DEBUG1("buttonwidget, Y WAS PRESSED");
                    key =  SNES_Y_MASK;
                    }
            else if (angle >= 248 && angle < 337)
                    {
                    //up key was pressed
                    __DEBUG1("buttonwidget, X WAS PRESSED");
                    key =  SNES_X_MASK;
                    }
            }

	
	return key;
	}
Ejemplo n.º 19
0
/*
 * it seems that it takes about 600ms to get an update after buttonpress
 * */
void QRemoteControlKeys::MrccatoCommand(TRemConCoreApiOperationId aOperationId, 
	TRemConCoreApiButtonAction aButtonAct)
	{
	 QKeyEvent *event = NULL;
	TRequestStatus status;
       switch( aOperationId )
       {
       case ERemConCoreApiPausePlayFunction:
           {
           switch (aButtonAct)
               {
               case ERemConCoreApiButtonPress:
                   // Play/Pause button pressed 
            	   __DEBUG1("ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonPress");
            	    event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KPlayButtonPress, Qt::NoModifier,
															KPlayButtonPress, KPlayButtonPress,Qt::NoModifier);
                   break;
               case ERemConCoreApiButtonRelease:
            	   __DEBUG1("ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonRelease");
              	    event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KPlayButtonPress, Qt::NoModifier,
           															KPlayButtonPress, KPlayButtonPress,Qt::NoModifier);
            	   // Play/Pause button released
                   break;
               case ERemConCoreApiButtonClick:
            	   __DEBUG1("ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonClick");
                   // Play/Pause button clicked
            	   playtimer->start(KTimeOut);
            	   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KPlayButtonPress, Qt::NoModifier,
            	 															KPlayButtonPress, KPlayButtonPress,Qt::NoModifier);
                   break;
               default:
                   // Play/Pause unknown action
                   break;
               }                               
           break;
           }   
         
       case ERemConCoreApiStop:
           {
           switch (aButtonAct)
               {
        	   case ERemConCoreApiButtonPress:
        		   __DEBUG1("ERemConCoreApiStop, ERemConCoreApiButtonPress");
        		   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KStopButtonPress, Qt::NoModifier,
        				   KStopButtonPress, KStopButtonPress,Qt::NoModifier);
                  break;
               case ERemConCoreApiButtonRelease:
            	   __DEBUG1("ERemConCoreApiStop, ERemConCoreApiButtonRelease");
            	   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KStopButtonPress, Qt::NoModifier,
            	           				   KStopButtonPress, KStopButtonPress,Qt::NoModifier);
                  break;
               case ERemConCoreApiButtonClick:
            	   __DEBUG1("ERemConCoreApiStop, ERemConCoreApiButtonClick");
            	   stoptimer->start(KTimeOut);
            	   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KStopButtonPress, Qt::NoModifier,
            	           				   KStopButtonPress, KStopButtonPress,Qt::NoModifier);
                   break;   
               default:
                     
                break; 
               }
           break;
           }
       case ERemConCoreApiRewind:
           {
           switch (aButtonAct)
               {
        	   case ERemConCoreApiButtonPress:
        		   __DEBUG1("ERemConCoreApiRewind, ERemConCoreApiButtonPress");      
        		   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KBackwardButtonPress, Qt::NoModifier,
        		              			 KBackwardButtonPress, KBackwardButtonPress,Qt::NoModifier);
                  break;
               case ERemConCoreApiButtonRelease:
            	   __DEBUG1("ERemConCoreApiRewind, ERemConCoreApiButtonRelease");  
         		   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KBackwardButtonPress, Qt::NoModifier,
                		              			 KBackwardButtonPress, KBackwardButtonPress,Qt::NoModifier);
                  break;
               case ERemConCoreApiButtonClick:
            	   __DEBUG1("ERemConCoreApiRewind, ERemConCoreApiButtonClick");  
            	   backwardtimer->start(KTimeOut);
         		   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KBackwardButtonPress, Qt::NoModifier,
                		              			 KBackwardButtonPress, KBackwardButtonPress,Qt::NoModifier);
               default:
                break; 
               }
           break;
           }    
       case ERemConCoreApiFastForward:
           {
           switch (aButtonAct)
               {
        	   case ERemConCoreApiButtonPress:
        		   __DEBUG1("ERemConCoreApiFastForward, ERemConCoreApiButtonPress");   
        		   //event = new QKeyEvent ( QEvent::KeyPress, KForwardButtonPress,  Qt::NoModifier);
        		   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KForwardButtonPress, Qt::NoModifier,
        				   KForwardButtonPress, KForwardButtonPress,Qt::NoModifier);
                  break;
               case ERemConCoreApiButtonRelease:
            	   __DEBUG1("ERemConCoreApiFastForward, ERemConCoreApiButtonRelease");  
            	   //event = new QKeyEvent ( QEvent::KeyRelease, KForwardButtonPress,  Qt::NoModifier);
            	   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KForwardButtonPress, Qt::NoModifier,
            	        				   KForwardButtonPress, KForwardButtonPress,Qt::NoModifier);
                  break;
               case ERemConCoreApiButtonClick:
            	   __DEBUG1("ERemConCoreApiFastForward, ERemConCoreApiButtonClick"); 
            	   forwardtimer->start(KTimeOut);
            	  // event = new QKeyEvent ( QEvent::KeyPress, KForwardButtonPress,  Qt::NoModifier);
            	   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KForwardButtonPress, Qt::NoModifier,
            	        				   KForwardButtonPress, KForwardButtonPress,Qt::NoModifier);
               default:      
                break; 
               }
           break;
           }       
       case ERemConCoreApiVolumeUp:
           {   
           switch (aButtonAct)
               {
           	   case ERemConCoreApiButtonPress:
				   __DEBUG1("ERemConCoreApiVolumeUp, ERemConCoreApiButtonPress");   
				   //event = new QKeyEvent ( QEvent::KeyPress, KVolUpButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KVolUpButtonPress, Qt::NoModifier,
						   KVolUpButtonPress, KVolUpButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonRelease:
				   __DEBUG1("ERemConCoreApiVolumeUp, ERemConCoreApiButtonRelease");  
				   //event = new QKeyEvent ( QEvent::KeyRelease, KVolUpButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KVolUpButtonPress, Qt::NoModifier,
				 						   KVolUpButtonPress, KVolUpButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonClick:
				   __DEBUG1("ERemConCoreApiVolumeUp, ERemConCoreApiButtonClick"); 
				   voluptimer->start(KTimeOut);
				   //event = new QKeyEvent ( QEvent::KeyPress, KVolUpButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KVolUpButtonPress, Qt::NoModifier,
				 						   KVolUpButtonPress, KVolUpButtonPress,Qt::NoModifier);
			   default:      
				break; 
               }
           break;
           }       
       case ERemConCoreApiVolumeDown:
           {
           switch (aButtonAct)
               {
          	   case ERemConCoreApiButtonPress:
				   __DEBUG1("ERemConCoreApiVolumeDown, ERemConCoreApiButtonPress");   
				   //event = new QKeyEvent ( QEvent::KeyPress, KVolDownButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KVolDownButtonPress, Qt::NoModifier,
						   KVolDownButtonPress, KVolDownButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonRelease:
				   __DEBUG1("ERemConCoreApiVolumeDown, ERemConCoreApiButtonRelease");  
				   //event = new QKeyEvent ( QEvent::KeyRelease, KVolDownButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KVolDownButtonPress, Qt::NoModifier,
									   KVolDownButtonPress, KVolDownButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonClick:
				   __DEBUG1("ERemConCoreApiVolumeDown, ERemConCoreApiButtonClick"); 
				   voldowntimer->start(KTimeOut);
				  // event = new QKeyEvent ( QEvent::KeyPress, KVolDownButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KVolDownButtonPress, Qt::NoModifier,
									   KVolDownButtonPress, KVolDownButtonPress,Qt::NoModifier);
			   default:      
				break; 
               }
           break;
           }  
       case ERemConCoreApiBackward:
           {
           switch (aButtonAct)
               {
          	   case ERemConCoreApiButtonPress:
				   __DEBUG1("ERemConCoreApiBackward, ERemConCoreApiButtonPress");   
				   //event = new QKeyEvent ( QEvent::KeyPress, KBackwardButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KBackwardButtonPress, Qt::NoModifier,
						   KBackwardButtonPress, KBackwardButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonRelease:
				   __DEBUG1("ERemConCoreApiBackward, ERemConCoreApiButtonRelease");  
				   //event = new QKeyEvent ( QEvent::KeyRelease, KBackwardButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KBackwardButtonPress, Qt::NoModifier,
						   KBackwardButtonPress, KBackwardButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonClick:
				   __DEBUG1("ERemConCoreApiBackward, ERemConCoreApiButtonClick"); 
				   backwardtimer->start(KTimeOut);
				   //event = new QKeyEvent ( QEvent::KeyPress, KBackwardButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KBackwardButtonPress, Qt::NoModifier,
						   KBackwardButtonPress, KBackwardButtonPress,Qt::NoModifier);
			   default:      
				break; 
               }
           break;
           }       
       case ERemConCoreApiForward:
           {
           switch (aButtonAct)
               {
          	   case ERemConCoreApiButtonPress:
				   __DEBUG1("ERemConCoreApiForward, ERemConCoreApiButtonPress");   
				  // event = new QKeyEvent ( QEvent::KeyPress, KForwardButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KForwardButtonPress, Qt::NoModifier,
						   KForwardButtonPress, KForwardButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonRelease:
				   __DEBUG1("ERemConCoreApiForward, ERemConCoreApiButtonRelease");  
				  // event = new QKeyEvent ( QEvent::KeyRelease, KForwardButtonPress,  Qt::NoModifier);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyRelease, KForwardButtonPress, Qt::NoModifier,
				  						   KForwardButtonPress, KForwardButtonPress,Qt::NoModifier);
				  break;
			   case ERemConCoreApiButtonClick:
				   __DEBUG1("ERemConCoreApiForward, ERemConCoreApiButtonClick"); 
				   forwardtimer->start(KTimeOut);
				   event =  QKeyEvent::createExtendedKeyEvent( QEvent::KeyPress, KForwardButtonPress, Qt::NoModifier,
				  						   KForwardButtonPress, KForwardButtonPress,Qt::NoModifier);
				   
			   default:      
				break; 
               }
           break;
           }
       	
       default:
           break;
       }
       //complete key event
       QCoreApplication::postEvent (receiver, event);
       CompleteMediaKeyEvent( aOperationId );
	}