mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Create just one screenshot function
This commit is contained in:
parent
fad523ea3e
commit
86a222e0e6
@ -1899,7 +1899,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
settings->state_slot++;
|
||||
break;
|
||||
case CMD_EVENT_TAKE_SCREENSHOT:
|
||||
if (!take_screenshot())
|
||||
if (!take_screenshot(path_get(RARCH_PATH_BASENAME), false))
|
||||
return false;
|
||||
break;
|
||||
case CMD_EVENT_UNLOAD_CORE:
|
||||
|
@ -990,7 +990,7 @@ static void save_state_cb(void *task_data,
|
||||
char *path = strdup(state->path);
|
||||
|
||||
if (settings->savestate_thumbnail_enable)
|
||||
take_savestate_screenshot(path);
|
||||
take_screenshot(path, true);
|
||||
|
||||
free(path);
|
||||
}
|
||||
|
@ -369,38 +369,10 @@ static bool take_screenshot_choice(const char *name_base, bool savestate)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* take_screenshot:
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool take_screenshot(void)
|
||||
bool take_screenshot(const char *name_base, bool silence)
|
||||
{
|
||||
char *name_base = strdup(path_get(RARCH_PATH_BASENAME));
|
||||
bool is_paused = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);
|
||||
bool ret = take_screenshot_choice(name_base, false);
|
||||
const char *msg_screenshot = ret
|
||||
? msg_hash_to_str(MSG_TAKING_SCREENSHOT) :
|
||||
msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT);
|
||||
const char *msg = msg_screenshot;
|
||||
|
||||
free(name_base);
|
||||
|
||||
runloop_msg_queue_push(msg, 1, is_paused ? 1 : 180, true);
|
||||
|
||||
if (is_paused)
|
||||
{
|
||||
if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
|
||||
video_driver_cached_frame();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool take_savestate_screenshot(const char *name_base)
|
||||
{
|
||||
bool is_paused = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);
|
||||
bool ret = take_screenshot_choice(name_base, true);
|
||||
bool ret = take_screenshot_choice(name_base, silence);
|
||||
|
||||
if (is_paused)
|
||||
{
|
||||
|
@ -155,9 +155,7 @@ bool content_push_to_history_playlist(
|
||||
const char *core_name,
|
||||
const char *core_path);
|
||||
|
||||
/* TODO/FIXME - turn this into actual task */
|
||||
bool take_screenshot(void);
|
||||
bool take_savestate_screenshot(const char *path);
|
||||
bool take_screenshot(const char *path, bool silence);
|
||||
|
||||
bool event_load_save_files(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user