Allow screenshots while paused.

This commit is contained in:
Themaister 2011-10-23 12:38:11 +02:00
parent 77a2723bb0
commit 4856d0cac3
2 changed files with 25 additions and 12 deletions

View File

@ -303,8 +303,6 @@ struct global
char sha256[64 + 1]; char sha256[64 + 1];
bool do_screenshot;
#ifdef HAVE_XML #ifdef HAVE_XML
cheat_manager_t *cheat; cheat_manager_t *cheat;
#endif #endif

35
ssnes.c
View File

@ -85,13 +85,23 @@ static void set_fast_forward_button(bool new_button_state, bool new_hold_button_
old_hold_button_state = new_hold_button_state; old_hold_button_state = new_hold_button_state;
} }
static void take_screenshot(const uint16_t *frame, unsigned width, unsigned height) static void video_cached_frame(void);
static void take_screenshot(void)
{ {
if (!(*g_settings.screenshot_directory)) if (!(*g_settings.screenshot_directory))
return; return;
bool ret = screenshot_dump(g_settings.screenshot_directory, frame, bool ret = false;
width, height, (height == 448 || height == 478) ? 1024 : 2048); if (g_extern.frame_cache.data)
{
const uint16_t *data = g_extern.frame_cache.data;
unsigned width = g_extern.frame_cache.width;
unsigned height = g_extern.frame_cache.height;
ret = screenshot_dump(g_settings.screenshot_directory,
data,
width, height,
(height == 448 || height == 478) ? 1024 : 2048);
}
const char *msg = NULL; const char *msg = NULL;
if (ret) if (ret)
@ -106,7 +116,14 @@ static void take_screenshot(const uint16_t *frame, unsigned width, unsigned heig
} }
msg_queue_clear(g_extern.msg_queue); msg_queue_clear(g_extern.msg_queue);
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
if (g_extern.is_paused)
{
msg_queue_push(g_extern.msg_queue, msg, 1, 1);
video_cached_frame();
}
else
msg_queue_push(g_extern.msg_queue, msg, 1, 180);
} }
// libsnes: 0.065 // libsnes: 0.065
@ -130,9 +147,6 @@ static void video_frame(const uint16_t *data, unsigned width, unsigned height)
} }
} }
if (g_extern.do_screenshot)
take_screenshot(data, width, height);
// Slightly messy code, // Slightly messy code,
// but we really need to do processing before blocking on VSync for best possible scheduling. // but we really need to do processing before blocking on VSync for best possible scheduling.
#ifdef HAVE_FFMPEG #ifdef HAVE_FFMPEG
@ -1650,7 +1664,9 @@ static void check_screenshot(void)
{ {
static bool old_pressed = false; static bool old_pressed = false;
bool pressed = driver.input->key_pressed(driver.input_data, SSNES_SCREENSHOT); bool pressed = driver.input->key_pressed(driver.input_data, SSNES_SCREENSHOT);
g_extern.do_screenshot = pressed && !old_pressed; if (pressed && !old_pressed)
take_screenshot();
old_pressed = pressed; old_pressed = pressed;
} }
@ -1671,6 +1687,7 @@ static void check_dsp_config(void)
static void do_state_checks(void) static void do_state_checks(void)
{ {
check_screenshot();
if (!g_extern.netplay) if (!g_extern.netplay)
{ {
check_pause(); check_pause();
@ -1714,8 +1731,6 @@ static void do_state_checks(void)
if (!g_extern.audio_data.dsp_plugin) if (!g_extern.audio_data.dsp_plugin)
#endif #endif
check_input_rate(); check_input_rate();
check_screenshot();
} }
static void fill_title_buf(void) static void fill_title_buf(void)