mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Savestate thumbnails
This commit is contained in:
parent
70053afd03
commit
367dcef0b1
@ -1683,6 +1683,7 @@ static void command_event_main_state(unsigned cmd)
|
||||
switch (cmd)
|
||||
{
|
||||
case CMD_EVENT_SAVE_STATE:
|
||||
take_savestate_screenshot(path);
|
||||
content_save_state(path, true, false);
|
||||
push_msg = false;
|
||||
break;
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "../../configuration.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../playlist.h"
|
||||
#include "../../runloop.h"
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
||||
@ -837,6 +838,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i)
|
||||
char *tmp = NULL;
|
||||
char *scrub_char_pointer = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
||||
playlist_t *playlist = NULL;
|
||||
const char *core_name = NULL;
|
||||
@ -872,6 +874,33 @@ static void xmb_update_thumbnail_path(void *data, unsigned i)
|
||||
}
|
||||
}
|
||||
|
||||
if (string_is_equal(entry.label, "state_slot"))
|
||||
{
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
if (settings->state_slot > 0)
|
||||
snprintf(path, sizeof(path), "%s%d",
|
||||
global->name.savestate, settings->state_slot);
|
||||
else if (settings->state_slot < 0)
|
||||
fill_pathname_join_delim(path,
|
||||
global->name.savestate, "auto", '.', sizeof(path));
|
||||
else
|
||||
strlcpy(path, global->name.savestate, sizeof(path));
|
||||
|
||||
strlcat(path, file_path_str(FILE_PATH_PNG_EXTENSION), sizeof(path));
|
||||
|
||||
if (path_file_exists(path))
|
||||
{
|
||||
strlcpy(xmb->thumbnail_file_path, path,
|
||||
sizeof(xmb->thumbnail_file_path));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmb->thumbnail_file_path[0] = '\0';
|
||||
xmb->thumbnail = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fill_pathname_join(
|
||||
xmb->thumbnail_file_path,
|
||||
settings->directory.thumbnails,
|
||||
@ -974,9 +1003,7 @@ static void xmb_selection_pointer_changed(
|
||||
{
|
||||
ia = xmb->items.active.alpha;
|
||||
iz = xmb->items.active.zoom;
|
||||
|
||||
depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
|
||||
if (!string_is_equal(xmb_thumbnails_ident(), "OFF") && depth == 1)
|
||||
if (!string_is_equal(xmb_thumbnails_ident(), "OFF"))
|
||||
{
|
||||
xmb_update_thumbnail_path(xmb, i);
|
||||
xmb_update_thumbnail_image(xmb);
|
||||
|
@ -655,11 +655,21 @@ static int setting_handler(rarch_setting_t *setting, unsigned action)
|
||||
break;
|
||||
case MENU_ACTION_LEFT:
|
||||
if (setting->action_left)
|
||||
return setting->action_left(setting, true);
|
||||
{
|
||||
int ret = setting->action_left(setting, false);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case MENU_ACTION_RIGHT:
|
||||
if (setting->action_right)
|
||||
return setting->action_right(setting, false);
|
||||
{
|
||||
int ret = setting->action_right(setting, false);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case MENU_ACTION_SELECT:
|
||||
if (setting->action_select)
|
||||
|
@ -191,7 +191,7 @@ static bool screenshot_dump(
|
||||
state->frame = frame;
|
||||
state->userbuf = userbuf;
|
||||
|
||||
if (settings->auto_screenshot_filename)
|
||||
if (false)
|
||||
fill_str_dated_filename(state->shotname, path_basename(name_base),
|
||||
IMG_EXT, sizeof(state->shotname));
|
||||
else
|
||||
@ -382,3 +382,17 @@ bool take_screenshot(void)
|
||||
|
||||
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);
|
||||
|
||||
if (is_paused)
|
||||
{
|
||||
if (!runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
|
||||
video_driver_cached_frame();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -146,6 +146,7 @@ bool content_push_to_history_playlist(
|
||||
|
||||
/* TODO/FIXME - turn this into actual task */
|
||||
bool take_screenshot(void);
|
||||
bool take_savestate_screenshot(const char *path);
|
||||
|
||||
bool event_load_save_files(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user