static float vout_aspect = 0.0;
static int vout_ghosting = 0;
+static bool libretro_update_av_info = false;
+static bool libretro_update_geometry = false;
+
#if defined(RENDER_GSKIT_PS2)
#define VOUT_8BIT_WIDTH 328
#define VOUT_8BIT_HEIGHT 256
void emu_video_mode_change(int start_line, int line_count, int start_col, int col_count)
{
- struct retro_system_av_info av_info;
-
vm_current_start_line = start_line;
vm_current_line_count = line_count;
vm_current_start_col = start_col;
#endif
Pico.m.dirtyPal = 1;
- // Update the geometry
- retro_get_system_av_info(&av_info);
- environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info);
+ /* Notify frontend of geometry update */
+ libretro_update_geometry = true;
}
void emu_32x_startup(void)
init_frameskip();
+ /* Initialisation routines may have 'triggered'
+ * a libretro AV info or geometry update; this
+ * happens automatically after retro_load_game(),
+ * so disable the relevant flags here to avoid
+ * redundant updates on the first call of
+ * retro_run() */
+ libretro_update_av_info = false;
+ libretro_update_geometry = false;
+
return true;
}
vout_aspect = VOUT_PAR;
}
+ /* Notify frontend of geometry update */
if (vout_aspect != old_vout_aspect)
- {
- // Update the geometry
- struct retro_system_av_info av_info;
- retro_get_system_av_info(&av_info);
- environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info);
- }
+ libretro_update_geometry = true;
var.value = NULL;
var.key = "picodrive_sprlim";
var.value = NULL;
var.key = "picodrive_sound_rate";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
- new_sound_rate = atoi(var.value);
if (!strcmp(var.value, "native"))
- new_sound_rate = YM2612_NATIVE_RATE();
+ new_sound_rate = YM2612_NATIVE_RATE();
+ else
+ new_sound_rate = atoi(var.value);
if (new_sound_rate != PicoIn.sndRate) {
/* Update the sound rate */
PicoIn.sndRate = new_sound_rate;
PsndRerate(!first_run);
- struct retro_system_av_info av_info;
- retro_get_system_av_info(&av_info);
- environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &av_info);
+ libretro_update_av_info = true;
}
}
PicoFrame();
+ /* Check whether frontend needs to be notified
+ * of timing/geometry changes */
+ if (libretro_update_av_info || libretro_update_geometry) {
+ struct retro_system_av_info av_info;
+ retro_get_system_av_info(&av_info);
+ environ_cb(libretro_update_av_info ?
+ RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO :
+ RETRO_ENVIRONMENT_SET_GEOMETRY,
+ &av_info);
+ libretro_update_av_info = false;
+ libretro_update_geometry = false;
+ }
+
/* If frame was skipped, call video_cb() with
* a NULL buffer and return immediately */
if (PicoIn.skipFrame) {