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; }
/* 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; }
static void apply_renderer(void) { switch (currentConfig.renderer) { case RT_16BIT: PicoIn.opt &= ~POPT_ALT_RENDERER; PicoDrawSetOutFormat(PDF_RGB555, 0); PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2); break; case RT_8BIT_ACC: PicoIn.opt &= ~POPT_ALT_RENDERER; PicoDrawSetOutFormat(PDF_8BIT, 0); PicoDrawSetOutBuf(Pico.est.Draw2FB + 8, 328); break; case RT_8BIT_FAST: PicoIn.opt |= POPT_ALT_RENDERER; PicoDrawSetOutFormat(PDF_NONE, 0); break; } if (PicoIn.AHW & PAHW_32X) PicoDrawSetOutBuf(g_screen_ptr, g_screen_ppitch * 2); }
void retro_init(void) { struct retro_log_callback log; int level; level = 0; environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level); if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) log_cb = log.log; else log_cb = NULL; environ_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &disk_control); #ifdef _3DS ctr_svchack_successful = ctr_svchack_init(); #endif PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80 | POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_MCD_GFX | POPT_EN_32X|POPT_EN_PWM | POPT_ACC_SPRITES|POPT_DIS_32C_BORDER; #ifdef __arm__ #ifdef _3DS if (ctr_svchack_successful) #endif PicoOpt |= POPT_EN_DRC; #endif PsndRate = 44100; PicoAutoRgnOrder = 0x184; // US, EU, JP vout_width = 320; vout_height = 240; #ifdef _3DS vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80); #else vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); #endif PicoInit(); PicoDrawSetOutFormat(PDF_RGB555, 0); PicoDrawSetOutBuf(vout_buf, vout_width * 2); //PicoMessage = plat_status_msg_busy_next; PicoMCDopenTray = disk_tray_open; PicoMCDcloseTray = disk_tray_close; update_variables(); }
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; }