Esempio n. 1
0
/* Wait for correct synchronization */
INLINE void update_timing (void)
{
	static unsigned long prev=0;
	unsigned long curr=gp2x_timer_read_real();
	unsigned long interval=(((unsigned long)((frameskip+1)*1000)) * gp2x_timer_read_scale())/((unsigned long)(gp2x_fps));

	/* now wait until it's time to update the screen */
	if ((curr-prev)<interval) {
		/* Auto-Frameskip -> frameskip-- */
		if (gp2x_frameskip_auto && frameskip>0)
			frameskip--;
		if (gp2x_vsync!=-1) {
			while ((curr - prev) < interval) {
				curr = gp2x_timer_read_real();
			}
		}
	} else if ((curr-prev)>(interval)) {
		/* Auto-Frameskip -> frameskip++ */
		if (gp2x_frameskip_auto && frameskip<gp2x_frameskip)
			frameskip++;
	}
	prev = gp2x_timer_read_real();
	if (gp2x_vsync==1)
		gp2x_video_wait_vsync(); /* Wait VSync */
}
Esempio n. 2
0
/* Update the display. */
void osd_update_display(void)
{
#if defined(GP2X) || defined(PSP)
	/* Update Timing */
	update_timing();
#endif

#ifdef PSP
	/* Wait VSync */
	if (gp2x_vsync==1)
		gp2x_video_wait_vsync();
#endif
	/* Manage the palette */
	if (dirtypalette)
		update_palette();

	/* Update Display */
	p_update_display();

#ifdef GP2X
	/* Show FPS Counter */
	if (gp2x_showfps)
		frame_counter(); 
#endif
	
#ifdef GP2X
	/* Double Buffer Video Flip */
	if (gp2x_double_buffer)
		gp2x_video_flip();
#endif
}
Esempio n. 3
0
static void vid_reset_mode(void)
{
	int gp2x_mode = 16;
	int renderer = get_renderer();

	PicoOpt &= ~POPT_ALT_RENDERER;
	emu_scan_begin = NULL;
	emu_scan_end = NULL;

	switch (renderer) {
	case RT_16BIT:
		PicoDrawSetOutFormat(PDF_RGB555, 0);
		PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
		break;
	case RT_8BIT_ACC:
		PicoDrawSetOutFormat(PDF_8BIT, 0);
		PicoDrawSetOutBuf(g_screen_ptr, g_screen_width);
		gp2x_mode = 8;
		break;
	case RT_8BIT_FAST:
		PicoOpt |= POPT_ALT_RENDERER;
		PicoDrawSetOutFormat(PDF_NONE, 0);
		vidcpyM2 = vidcpy_m2;
		gp2x_mode = 8;
		break;
	default:
		printf("bad renderer\n");
		break;
	}

	if (PicoAHW & PAHW_32X) {
		// Wiz 16bit is an exception, uses line rendering due to rotation mess
		if (renderer == RT_16BIT && (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)) {
			PicoDrawSetOutFormat(PDF_RGB555, 1);
		}
		else {
			PicoDrawSetOutFormat(PDF_NONE, 0);
		}
		PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
		gp2x_mode = 16;
	}

	if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) {
		if ((PicoAHW & PAHW_32X) || renderer == RT_16BIT) {
			emu_scan_begin = EmuScanBegin16_rot;
			emu_scan_end = EmuScanEnd16_rot;
		}
		else if (renderer == RT_8BIT_ACC) {
			emu_scan_begin = EmuScanBegin8_rot;
			emu_scan_end = EmuScanEnd8_rot;
		}
		else if (renderer == RT_8BIT_FAST)
			vidcpyM2 = vidcpy_m2_rot;
	}

	PicoDrawSetCallbacks(emu_scan_begin, emu_scan_end);

	if (is_16bit_mode())
		osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text16_rot : emu_osd_text16;
	else
		osd_text = (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX) ? osd_text8_rot : osd_text8;

	gp2x_video_wait_vsync();
	if (!is_16bit_mode()) {
		// setup pal for 8-bit modes
		localPal[0xc0] = 0x0000c000; // MCD LEDs
		localPal[0xd0] = 0x00c00000;
		localPal[0xe0] = 0x00000000; // reserved pixels for OSD
		localPal[0xf0] = 0x00ffffff;
		gp2x_video_setpalette(localPal, 0x100);
		gp2x_memset_all_buffers(0, 0xe0, 320*240);
	}
	else
		gp2x_memset_all_buffers(0, 0, 320*240*2);

	if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)
		gp2x_mode = -gp2x_mode;

	gp2x_video_changemode(gp2x_mode, Pico.m.pal);

	Pico.m.dirtyPal = 1;

	PicoOpt &= ~POPT_EN_SOFTSCALE;
	if (currentConfig.scaling == EOPT_SCALE_SW)
		PicoOpt |= POPT_EN_SOFTSCALE;

	// palette converters for 8bit modes
	make_local_pal = (PicoAHW & PAHW_SMS) ? make_local_pal_sms : make_local_pal_md;
}
Esempio n. 4
0
void plat_video_wait_vsync(void)
{
	gp2x_video_wait_vsync();
}