mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Do the screenshot in the savestate callback
This commit is contained in:
parent
24a689c274
commit
2cc4bef3aa
@ -1683,8 +1683,6 @@ static void command_event_main_state(unsigned cmd)
|
|||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case CMD_EVENT_SAVE_STATE:
|
case CMD_EVENT_SAVE_STATE:
|
||||||
if (settings->savestate_thumbnail_enable)
|
|
||||||
take_savestate_screenshot(path);
|
|
||||||
content_save_state(path, true, false);
|
content_save_state(path, true, false);
|
||||||
push_msg = false;
|
push_msg = false;
|
||||||
break;
|
break;
|
||||||
|
@ -504,6 +504,8 @@ static void undo_save_state_cb(void *task_data,
|
|||||||
static void task_save_handler_finished(retro_task_t *task,
|
static void task_save_handler_finished(retro_task_t *task,
|
||||||
save_task_state_t *state)
|
save_task_state_t *state)
|
||||||
{
|
{
|
||||||
|
save_task_state_t *task_data = NULL;
|
||||||
|
|
||||||
task->finished = true;
|
task->finished = true;
|
||||||
|
|
||||||
filestream_close(state->file);
|
filestream_close(state->file);
|
||||||
@ -511,6 +513,11 @@ static void task_save_handler_finished(retro_task_t *task,
|
|||||||
if (!task->error && task->cancelled)
|
if (!task->error && task->cancelled)
|
||||||
task->error = strdup("Task canceled");
|
task->error = strdup("Task canceled");
|
||||||
|
|
||||||
|
task_data = (save_task_state_t*)calloc(1, sizeof(*task_data));
|
||||||
|
memcpy(task_data, state, sizeof(*state));
|
||||||
|
|
||||||
|
task->task_data = task_data;
|
||||||
|
|
||||||
if (state->data)
|
if (state->data)
|
||||||
{
|
{
|
||||||
if (state->undo_save && state->data == undo_save_buf.data)
|
if (state->undo_save && state->data == undo_save_buf.data)
|
||||||
@ -970,6 +977,24 @@ error:
|
|||||||
free(load_data);
|
free(load_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* save_state_cb:
|
||||||
|
*
|
||||||
|
* Called after the save state is done. Takes a screenshot if needed.
|
||||||
|
**/
|
||||||
|
static void save_state_cb(void *task_data,
|
||||||
|
void *user_data, const char *error)
|
||||||
|
{
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
save_task_state_t *state = (save_task_state_t*)task_data;
|
||||||
|
char *path = strdup(state->path);
|
||||||
|
|
||||||
|
if (settings->savestate_thumbnail_enable)
|
||||||
|
take_savestate_screenshot(path);
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task_push_save_state:
|
* task_push_save_state:
|
||||||
* @path : file path of the save state
|
* @path : file path of the save state
|
||||||
@ -995,6 +1020,7 @@ static void task_push_save_state(const char *path, void *data, size_t size, bool
|
|||||||
task->type = TASK_TYPE_BLOCKING;
|
task->type = TASK_TYPE_BLOCKING;
|
||||||
task->state = state;
|
task->state = state;
|
||||||
task->handler = task_save_handler;
|
task->handler = task_save_handler;
|
||||||
|
task->callback = save_state_cb;
|
||||||
task->title = strdup(msg_hash_to_str(MSG_SAVING_STATE));
|
task->title = strdup(msg_hash_to_str(MSG_SAVING_STATE));
|
||||||
task->mute = state->mute;
|
task->mute = state->mute;
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ static bool screenshot_dump(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
task->type = TASK_TYPE_NONE;
|
task->type = TASK_TYPE_BLOCKING;
|
||||||
task->state = state;
|
task->state = state;
|
||||||
task->handler = task_screenshot_handler;
|
task->handler = task_screenshot_handler;
|
||||||
if (!savestate)
|
if (!savestate)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user