Пример #1
0
static void vidResetMode(void)
{
	giz_screen = fb_lock(1);

	if (PicoOpt&0x10) {
	} else if (currentConfig.EmuOpt&0x80) {
		PicoDrawSetOutFormat(PDF_RGB555, 0);
		PicoDrawSetCallbacks(EmuScanBegin16, NULL);
	} else {
		PicoDrawSetOutFormat(PDF_NONE, 0);
		PicoDrawSetCallbacks(EmuScanBegin8, NULL);
	}
	if ((PicoOpt&0x10) || !(currentConfig.EmuOpt&0x80)) {
		// setup pal for 8-bit modes
		localPal[0xc0] = 0x0600;
		localPal[0xd0] = 0xc000;
		localPal[0xe0] = 0x0000; // reserved pixels for OSD
		localPal[0xf0] = 0xffff;
	}
	Pico.m.dirtyPal = 1;

	memset32(giz_screen, 0, 321*240*2/4);
	if (currentConfig.EmuOpt&0x8000) {
		fb_unlock();
		giz_screen = fb_lock(0);
		memset32(giz_screen, 0, 321*240*2/4);
	}
	fb_unlock();
	giz_screen = NULL;
}
Пример #2
0
/* forced frame to front buffer */
void pemu_forced_frame(int no_scale, int do_emu)
{
	int po_old = PicoOpt;
	int eo_old = currentConfig.EmuOpt;

	PicoOpt &= ~0x10;
	PicoOpt |= POPT_ACC_SPRITES;
	if (!no_scale)
		PicoOpt |= POPT_EN_SOFTSCALE;
	currentConfig.EmuOpt |= 0x80;

	if (giz_screen == NULL)
		giz_screen = fb_lock(1);

	PicoDrawSetOutFormat(PDF_RGB555, 0);
	PicoDrawSetCallbacks(EmuScanBegin16, NULL);
	Pico.m.dirtyPal = 1;
	PicoFrameDrawOnly();

	fb_unlock();
	giz_screen = NULL;

	PicoOpt = po_old;
	currentConfig.EmuOpt = eo_old;
}
Пример #3
0
void pemu_forced_frame(int no_scale, int do_emu)
{
	PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2);
	PicoDrawSetCallbacks(NULL, NULL);
	Pico.m.dirtyPal = 1;

	emu_cmn_forced_frame(no_scale, do_emu);

	g_menubg_src_ptr = g_screen_ptr;
}
Пример #4
0
void emu_video_mode_change(int start_line, int line_count, int is_32cols)
{
	int scalex = 320, scaley = 240;
	int ln_offs = 0;

	if (doing_bg_frame)
		return;

	osd_fps_x = OSD_FPS_X;
	osd_y = 232;

	/* set up hwscaling here */
	PicoOpt &= ~POPT_DIS_32C_BORDER;
	if (is_32cols && currentConfig.scaling == EOPT_SCALE_HW) {
		scalex = 256;
		PicoOpt |= POPT_DIS_32C_BORDER;
		osd_fps_x = OSD_FPS_X - 64;
	}

	if (currentConfig.vscaling == EOPT_SCALE_HW) {
		ln_offs = start_line;
		scaley = line_count;
		osd_y = start_line + line_count - 8;
	}

	gp2x_video_RGB_setscaling(ln_offs, scalex, scaley);

	/* line doubling */
	if (currentConfig.vscaling == EOPT_SCALE_SW && line_count < 240) {
		ld_lines = ld_left = line_count / (240 - line_count);
		PicoDrawSetCallbacks(EmuScanBegin16_ld, EmuScanEnd16_ld);
	}

	// clear whole screen in all buffers
	if (!is_16bit_mode())
		gp2x_memset_all_buffers(0, 0xe0, 320*240);
	else
		gp2x_memset_all_buffers(0, 0, 320*240*2);
}
Пример #5
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;
}