Пример #1
0
bool VAApiWriter::set()
{
#ifdef HAVE_VPP
	allowVDPAU = sets().getBool( "AllowVDPAUinVAAPI" );
	VAProcDeinterlacingType _vpp_deint_type;
	switch ( sets().getInt( "VAAPIDeintMethod" ) )
	{
		case 0:
			_vpp_deint_type = VAProcDeinterlacingNone;
			break;
		case 2:
			_vpp_deint_type = VAProcDeinterlacingMotionCompensated;
			break;
		default:
			_vpp_deint_type = VAProcDeinterlacingMotionAdaptive;
	}
	const bool reload_vpp = ok && use_vpp && vpp_deint_type != _vpp_deint_type;
	vpp_deint_type = _vpp_deint_type;
	if ( reload_vpp )
	{
		clr_vpp();
		init_vpp();
	}
#endif
	return true;
}
Пример #2
0
void retro_reset(void)
{
   init_cpu();
   init_roms();
   init_vpp();
   clearscr();
}
Пример #3
0
/*============================================================================*/
void init_system()
{
	int i, j, k;
	#ifdef __O2EM_DEBUG__
	printf("%s()\n", __func__);
	#endif
	last_line = 0;
	dbstick1 = 0x00;
	dbstick2 = 0x00;
	mstate = 0;
	master_clk = 0;
	h_clk = 0;
	line_count = 0;
	itimer = 0;
	clk_counter = 0;

	init_roms();
	init_rams();

	for (i = 0; i < MAXLINES; i++)
		AudioVector[i] = ColorVector[i] = 0;

	for (i = 0; i < MAXLINES + 2 * MAXSNAP; i++)
		for (j = 0; j < 256; j++)
			for (k = 0; k < 2; k++)
				snapedlines[i][j][k]=0;

	if (app_data.stick[0] == 2 || app_data.stick[1] == 2) {
		#ifdef __O2EM_DEBUG__
		printf("%s() install_joystick()\n", __func__);
		#endif
		i = install_joystick(JOY_TYPE_AUTODETECT);
		if (i || (num_joysticks < 1)) {
			fprintf(stderr, "Error: no joystick detected\n");
			o2em_clean_quit(EXIT_FAILURE);
		}
	}
	for (i = 0; i < KEY_MAX; i++)
		key2[i] = 0;
	key2vcnt = 0;

	if (app_data.euro)
		setvideomode(1);
	else
		setvideomode(0);

	do_kluges();
	init_vpp();
	clear_collision();
	#ifdef __O2EM_DEBUG__
	printf("end of %s()\n", __func__);
	#endif
}
Пример #4
0
void init_system(void){
	int i,j,k;

	last_line=0;
	dbstick1=0x00;
	dbstick2=0x00;
	mstate=0;
	master_clk=0;
	h_clk=0;
	line_count=0;
	itimer=0;
	clk_counter=0;
	init_roms();
	for(i=0; i<256; i++) {
		VDCwrite[i]=0;
		extRAM[i]=0;
	}
	for(i=0; i<64; i++) {
		intRAM[i]=0;
	}
	for (i=0; i<MAXLINES; i++) AudioVector[i] = ColorVector[i] = 0;
	
	for (i=0; i<MAXLINES+2*MAXSNAP; i++)
		for (j=0; j<256; j++)
			for (k=0; k<2; k++)
				snapedlines[i][j][k]=0;

	if (app_data.stick[0] == 2 || app_data.stick[1] == 2) {
		i = install_joystick(JOY_TYPE_AUTODETECT);
		if (i || (num_joysticks<1)) {
			fprintf(stderr,"Error: no joystick detected\n");
			exit(EXIT_FAILURE);
		}
	}
	for (i=0; i<128; i++) key2[i] = 0;
	key2vcnt=0;
	if (app_data.euro)
		setvideomode(1);
	else
		setvideomode(0);
	do_kluges();
	init_vpp();
	clear_collision();
}
Пример #5
0
void handle_key(void){
	if (NeedsPoll) poll_keyboard();


	if (key[syskeys[0]] || key[KEY_ESC]) {
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[0]] || key[KEY_ESC]);
		key_done=1;
	}

if (key[syskeys[1]]) {
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[1]]);

		mute_audio();
		mute_voice();
		abaut();

		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();

			if (key[KEY_ALT] && key[KEY_ENTER]) {
				app_data.fullscreen = app_data.fullscreen ? 0 : 1;
				grmode();
				abaut();
				do {
					rest(5);
					if (NeedsPoll) poll_keyboard();
				} while (key[KEY_ENTER]);
			}		

		} while ((!key[syskeys[1]]) && (!key[KEY_ESC]) && (!key[syskeys[0]]));
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[1]]);
		
		init_sound_stream();
	}		

if (key[syskeys[5]])
	{
		if (savestate(app_data.statefile)==0)
		{
			display_msg("Savefile saved.",5);
		}
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[5]]);

	}

	/* LOAD STATE */
	if (key[syskeys[6]])
	{
		int stateError;
		if ((stateError=loadstate(app_data.statefile))==0)
		{
			display_msg("Savefile loaded.",5);
		}
		else if (stateError>=199)
		{
			if (stateError==199) display_msg("Wrong ROM-File for Savefile.",5);
			else if (stateError==200+ROM_O2) display_msg("Wrong BIOS for Savefile: O2ROM needed.",5);
			else if (stateError==200+ROM_G7400) display_msg("Wrong BIOS for Savefile: G7400 ROM needed.",5);
			else if (stateError==200+ROM_C52) display_msg("Wrong BIOS for Savefile: C52 ROM needed.",5);
			else if (stateError==200+ROM_JOPAC) display_msg("Wrong BIOS for Savefile: JOPAC ROM needed.",5);
			else display_msg("Wrong BIOS for Savefile: UNKNOWN ROM needed.",5);
		}
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[6]]);
	}

	if (key[syskeys[2]]) key_debug=1;

	if (key[syskeys[3]]) {
		init_cpu();
		init_roms();
		init_vpp();
		clearscr();
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[3]]);
	}

    /* SET HIGHSCORE */
	if (key[syskeys[7]])
	{
		set_score(app_data.scoretype, app_data.scoreaddress, app_data.default_highscore);
	}


	if (key[syskeys[4]]) {
		BITMAP *bmp;
		PALETTE pal;
		char *p;
		static char name[1024];
		static int scshot_counter = 0;

		if (strlen(app_data.scshot)>0){
			if ((p=strchr(app_data.scshot,'@'))) {
				*p = 0;
				sprintf(name, "%s%02d%s", app_data.scshot, scshot_counter++, p+1);
				*p = '@';
			} else {
				strcpy(name, app_data.scshot);
			}
			get_palette(pal);
			bmp = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H);
			save_bitmap(name, bmp, pal);
			destroy_bitmap(bmp);
			do {
				rest(5);
				if (NeedsPoll) poll_keyboard();
			} while (key[syskeys[4]]);
		}
	}

	// switch joystick
	if (key[syskeys[8]]) {
		joyswitch = joyswitch ? 0 : 1;

		set_defjoykeys(0,joyswitch);
		set_defjoykeys(1,joyswitch ? 0 : 1);
		int tmp = app_data.stick[0];
		app_data.stick[0] = app_data.stick[1];
		app_data.stick[1] = tmp;

		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[syskeys[8]]);

	}

	if (key[KEY_ALT] && key[KEY_ENTER]) {
		app_data.fullscreen = app_data.fullscreen ? 0 : 1;
		grmode();
		do {
			rest(5);
			if (NeedsPoll) poll_keyboard();
		} while (key[KEY_ENTER]);
	}		

}
Пример #6
0
bool VAApiWriter::HWAccellInit( int W, int H, const char *codec_name )
{
	VAProfile p = ( VAProfile )-1; //VAProfileNone
	if ( !qstrcmp( codec_name, "h264" ) )
	{
		if ( profileList.contains( VAProfileH264High ) )
			p = VAProfileH264High;
		else if ( profileList.contains( VAProfileH264Main ) )
			p = VAProfileH264Main;
		else if ( profileList.contains( VAProfileH264Baseline ) )
			p = VAProfileH264Baseline;
	}
	else if ( !qstrcmp( codec_name, "mpeg2video" ) )
	{
		if ( profileList.contains( VAProfileMPEG2Main ) )
			p = VAProfileMPEG2Main;
		else if ( profileList.contains( VAProfileMPEG2Simple ) )
			p = VAProfileMPEG2Simple;
	}
	else if ( !qstrcmp( codec_name, "mpeg4" ) )
	{
		if ( profileList.contains( VAProfileMPEG4Main ) )
			p = VAProfileMPEG4Main;
		else if ( profileList.contains( VAProfileMPEG4Simple ) )
			p = VAProfileMPEG4Simple;
	}
	else if ( !qstrcmp( codec_name, "vc1" ) )
	{
		if ( profileList.contains( VAProfileVC1Advanced ) )
			p = VAProfileVC1Advanced;
		else if ( profileList.contains( VAProfileVC1Main ) )
			p = VAProfileVC1Main;
		else if ( profileList.contains( VAProfileVC1Simple ) )
			p = VAProfileVC1Simple;
	}
	else if ( !qstrcmp( codec_name, "h263" ) && profileList.contains( VAProfileH263Baseline ) )
		p = VAProfileH263Baseline;

	if ( !ok || profile != p || outW != W || outH != H )
	{
		clr();

		profile = p;
		outW = W;
		outH = H;

		if ( !vaCreateSurfaces( surfaces, surfacesCount ) )
			return false;
		surfacesCreated = true;

		if ( !vaCreateConfigAndContext() )
			return false;

		for ( int i = 0 ; i < surfacesCount ; i++ )
			surfacesQueue.enqueue( surfaces[ i ] );


		unsigned numSubpicFmts = vaMaxNumSubpictureFormats( VADisp );
		VAImageFormat subpicFmtList[ numSubpicFmts ];
		unsigned subpic_flags[ numSubpicFmts ];
		if ( vaQuerySubpictureFormats( VADisp, subpicFmtList, subpic_flags, &numSubpicFmts ) == VA_STATUS_SUCCESS )
		{
			for ( unsigned i = 0 ; i < numSubpicFmts ; ++i )
				if ( !qstrncmp( ( const char * )&subpicFmtList[ i ].fourcc, "BGRA", 4 ) )
				{
					subpict_dest_is_screen_coord = subpic_flags[ i ] & VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD;
					rgbImgFmt = new VAImageFormat( subpicFmtList[ i ] );
					break;
				}
		}

		init_vpp();

		if ( isXvBA )
		{
			QWidget::destroy();
			QWidget::create();
		}

		ok = true;
	}
	else
	{
#ifdef HAVE_VPP
		forward_reference = VA_INVALID_SURFACE;
		vpp_second = false;
#endif
		if ( isVDPAU )
		{
			if ( context )
			{
				vaDestroyContext( VADisp, context );
				context = 0;
			}
			if ( config )
			{
				vaDestroyConfig( VADisp, config );
				config = 0;
			}
			if ( !vaCreateConfigAndContext() )
				return false;
		}
	}

	return ok;
}