Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions gfx/gfx_thumbnail.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#include "../paths.h"
#include "../file_path_special.h"

#ifdef HAVE_MENU
#include "../menu/menu_driver.h"
#endif

#include "../tasks/tasks_internal.h"

#define DEFAULT_GFX_THUMBNAIL_STREAM_DELAY 16.66667f * 3
Expand Down Expand Up @@ -1987,6 +1991,7 @@ void gfx_savestate_thumbnail_get_path(
int state_slot)
{
size_t _len;
playlist_t *playlist = playlist_get_cached();

if (!s || !len)
return;
Expand All @@ -1996,6 +2001,36 @@ void gfx_savestate_thumbnail_get_path(
if (!state_name || !*state_name)
return;

#ifdef HAVE_MENU
if (playlist)
{
struct menu_state *menu_st = menu_state_get_ptr();
runloop_state_t *runloop_st = runloop_state_get_ptr();
const struct playlist_entry *entry = NULL;

if (menu_st && menu_st->driver_data)
playlist_get_index(playlist, menu_st->driver_data->rpl_entry_selection_ptr, &entry);

if (*entry->path)
{
size_t _len;
char new_path[PATH_MAX_LENGTH];
char entry_basename[PATH_MAX_LENGTH];

strlcpy(new_path, entry->path, sizeof(new_path));
path_remove_extension(new_path);

_len = strlcpy(entry_basename, path_basename(new_path), sizeof(entry_basename));

strlcpy(entry_basename + _len, ".state", sizeof(entry_basename) - _len);
fill_pathname_join_special(new_path,
runloop_st->savestate_dir, entry_basename, sizeof(new_path));

state_name = strdup(new_path);
}
}
#endif /* HAVE_MENU */

_len = strlcpy(s, state_name, len);

/* The historical implementation accumulated _len from
Expand Down
4 changes: 4 additions & 0 deletions intl/msg_hash_lbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,10 @@ MSG_HASH(
MENU_ENUM_LABEL_SAVESTATE_LIST,
MENU_ENUM_LABEL_SAVESTATE_LIST_STR
)
MSG_HASH(
MENU_ENUM_LABEL_STATE_SLOT_RUN,
MENU_ENUM_LABEL_STATE_SLOT_RUN_STR
)
MSG_HASH(
MENU_ENUM_LABEL_CORE_OPTIONS,
MENU_ENUM_LABEL_CORE_OPTIONS_STR
Expand Down
26 changes: 23 additions & 3 deletions menu/cbs/menu_cbs_cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,32 @@ static int action_cancel_contentless_core(const char *path,
{
menu_state_get_ptr()->contentless_core_ptr = 0;
menu_contentless_cores_flush_runtime();
return action_cancel_pop_default(path, label, type, idx) ;
return action_cancel_pop_default(path, label, type, idx);
}

static int action_cancel_state_slot_run(const char *path,
const char *label, unsigned type, size_t idx)
{
struct menu_state *menu_st = menu_state_get_ptr();
runloop_state_t *runloop_st = runloop_state_get_ptr();

if (!(runloop_st->flags & RUNLOOP_FLAG_CORE_RUNNING))
command_event(CMD_EVENT_UNLOAD_CORE, NULL);

menu_st->driver_data->state_slot_run = 0;

menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;

return action_cancel_pop_default(path, label, type, idx);
}

#ifdef HAVE_CHEATS
static int action_cancel_cheat_details(const char *path,
const char *label, unsigned type, size_t idx)
{
cheat_manager_copy_working_to_idx(cheat_manager_state.working_cheat.idx) ;
return action_cancel_pop_default(path, label, type, idx) ;
cheat_manager_copy_working_to_idx(cheat_manager_state.working_cheat.idx);
return action_cancel_pop_default(path, label, type, idx);
}
#endif

Expand Down Expand Up @@ -165,6 +182,9 @@ static int menu_cbs_init_bind_cancel_compare_type(
case MENU_SETTING_ACTION_CONTENTLESS_CORE_RUN:
BIND_ACTION_CANCEL(cbs, action_cancel_contentless_core);
return 0;
case MENU_SETTING_ACTION_STATE_SLOT_RUN:
BIND_ACTION_CANCEL(cbs, action_cancel_state_slot_run);
return 0;
default:
break;
}
Expand Down
5 changes: 5 additions & 0 deletions menu/cbs/menu_cbs_deferred_push.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_core_cheat_options, DISPLAYLIST_
GENERIC_DEFERRED_PUSH(deferred_push_core_input_remapping_options, DISPLAYLIST_OPTIONS_REMAPPINGS)
GENERIC_DEFERRED_PUSH(deferred_push_remap_file_manager, DISPLAYLIST_REMAP_FILE_MANAGER)
GENERIC_DEFERRED_PUSH(deferred_push_savestate_list, DISPLAYLIST_SAVESTATE_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_state_slot_run, DISPLAYLIST_STATE_SLOT_RUN)
GENERIC_DEFERRED_PUSH(deferred_push_core_options, DISPLAYLIST_CORE_OPTIONS)
GENERIC_DEFERRED_PUSH(deferred_push_core_option_override_list, DISPLAYLIST_CORE_OPTION_OVERRIDE_LIST)
GENERIC_DEFERRED_PUSH(deferred_push_disk_options, DISPLAYLIST_OPTIONS_DISK)
Expand Down Expand Up @@ -669,6 +670,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
{MENU_ENUM_LABEL_CORE_LIST, deferred_push_core_list},
{MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, deferred_push_history_list},
{MENU_ENUM_LABEL_SAVESTATE_LIST, deferred_push_savestate_list},
{MENU_ENUM_LABEL_STATE_SLOT_RUN, deferred_push_state_slot_run},
{MENU_ENUM_LABEL_CORE_OPTIONS, deferred_push_core_options},
{MENU_ENUM_LABEL_DEFERRED_CORE_OPTION_OVERRIDE_LIST, deferred_push_core_option_override_list},
{MENU_ENUM_LABEL_NETWORK_INFORMATION, deferred_push_network_information},
Expand Down Expand Up @@ -951,6 +953,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
case MENU_ENUM_LABEL_SAVESTATE_LIST:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_savestate_list);
break;
case MENU_ENUM_LABEL_STATE_SLOT_RUN:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_state_slot_run);
break;
case MENU_ENUM_LABEL_CORE_OPTIONS:
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_core_options);
break;
Expand Down
26 changes: 26 additions & 0 deletions menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -6742,6 +6742,7 @@ STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_core_manager_steam_list, ACTION_OK_
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_core_option_override_list, ACTION_OK_DL_CORE_OPTION_OVERRIDE_LIST)
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_remap_file_manager_list, ACTION_OK_DL_REMAP_FILE_MANAGER_LIST)
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_savestate_list, ACTION_OK_DL_SAVESTATE_LIST)
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_state_slot_run, ACTION_OK_DL_SAVESTATE_LIST)
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_core_options_list, ACTION_OK_DL_CORE_OPTIONS_LIST)
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_add_to_playlist_list, ACTION_OK_DL_ADD_TO_PLAYLIST)
STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_add_to_playlist_quickmenu, ACTION_OK_DL_ADD_TO_PLAYLIST_QUICKMENU)
Expand Down Expand Up @@ -8043,6 +8044,27 @@ static int action_ok_contentless_core_run(const char *path,
return 0;
}

static int action_ok_state_slot_run(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
int slot = idx - 1;
size_t new_selection_ptr = 0;

menu_entries_pop_stack(&new_selection_ptr, 0, 0);
menu_st->selection_ptr = 0;

menu_st->driver_data->state_slot_run = slot;

menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;

action_ok_playlist_entry_collection(path, label, type, idx,
menu_st->driver_data->rpl_entry_selection_ptr);
return 0;
}

static int action_ok_load_archive(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
Expand Down Expand Up @@ -9380,6 +9402,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_LOAD_DISC, action_ok_push_load_disc_list},
{MENU_ENUM_LABEL_SHADER_OPTIONS, action_ok_push_default},
{MENU_ENUM_LABEL_SAVESTATE_LIST, action_ok_push_savestate_list},
{MENU_ENUM_LABEL_STATE_SLOT_RUN, action_ok_push_state_slot_run},
{MENU_ENUM_LABEL_CORE_OPTIONS, action_ok_push_core_options_list},
{MENU_ENUM_LABEL_CORE_OPTION_OVERRIDE_LIST, action_ok_push_core_option_override_list},
{MENU_ENUM_LABEL_REMAP_FILE_MANAGER_LIST, action_ok_push_remap_file_manager_list},
Expand Down Expand Up @@ -10181,6 +10204,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
case MENU_SETTING_ACTION_CONTENTLESS_CORE_RUN:
BIND_ACTION_OK(cbs, action_ok_contentless_core_run);
break;
case MENU_SETTING_ACTION_STATE_SLOT_RUN:
BIND_ACTION_OK(cbs, action_ok_state_slot_run);
break;
default:
return -1;
}
Expand Down
21 changes: 4 additions & 17 deletions menu/cbs/menu_cbs_sublabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,16 +1955,6 @@ static int action_bind_sublabel_playlist_entry(
unsigned playlist_sublabel_runtime_type = settings->uints.playlist_sublabel_runtime_type;
bool content_runtime_log = settings->bools.content_runtime_log;
bool content_runtime_log_aggregate = settings->bools.content_runtime_log_aggregate;
const char *directory_runtime_log = settings->paths.directory_runtime_log;
const char *directory_playlist = settings->paths.directory_playlist;
enum playlist_sublabel_last_played_style_type
playlist_sublabel_last_played_style =
(enum playlist_sublabel_last_played_style_type)
settings->uints.playlist_sublabel_last_played_style;
enum playlist_sublabel_last_played_date_separator_type
menu_timedate_date_separator =
(enum playlist_sublabel_last_played_date_separator_type)
settings->uints.menu_timedate_date_separator;

if (!playlist_show_sublabels)
return 0;
Expand Down Expand Up @@ -2027,13 +2017,7 @@ static int action_bind_sublabel_playlist_entry(

/* Check whether runtime info should be loaded from log file */
if (entry->runtime_status == PLAYLIST_RUNTIME_UNKNOWN)
runtime_update_playlist(
playlist, playlist_index,
directory_runtime_log,
directory_playlist,
(playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE),
playlist_sublabel_last_played_style,
menu_timedate_date_separator);
runtime_update_playlist(playlist, playlist_index);

/* Check whether runtime info is valid */
if (entry->runtime_status == PLAYLIST_RUNTIME_VALID)
Expand Down Expand Up @@ -3368,6 +3352,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_SAVESTATE_LIST:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_savestate_list);
break;
case MENU_ENUM_LABEL_STATE_SLOT_RUN:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_load_state);
break;
case MENU_ENUM_LABEL_CORE_OPTIONS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_options);
break;
Expand Down
3 changes: 3 additions & 0 deletions menu/cbs/menu_cbs_title.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ DEFAULT_TITLE_MACRO(action_get_configurations_list, MENU_ENUM_LABEL_
DEFAULT_TITLE_MACRO(action_get_core_option_override_list, MENU_ENUM_LABEL_VALUE_CORE_OPTION_OVERRIDE_LIST)
DEFAULT_TITLE_MACRO(action_get_quick_menu_list, MENU_ENUM_LABEL_VALUE_CONTENT_SETTINGS)
DEFAULT_TITLE_MACRO(action_get_savestate_list, MENU_ENUM_LABEL_VALUE_SAVESTATE_LIST)
DEFAULT_TITLE_MACRO(action_get_state_slot_run, MENU_ENUM_LABEL_VALUE_LOAD_STATE)
DEFAULT_TITLE_MACRO(action_get_input_remapping_options_list, MENU_ENUM_LABEL_VALUE_CORE_INPUT_REMAPPING_OPTIONS)
DEFAULT_TITLE_MACRO(action_get_remap_file_manager_list, MENU_ENUM_LABEL_VALUE_REMAP_FILE_MANAGER_LIST)
DEFAULT_TITLE_MACRO(action_get_shader_options_list, MENU_ENUM_LABEL_VALUE_SHADER_OPTIONS)
Expand Down Expand Up @@ -1179,6 +1180,8 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs,
action_get_add_content_list},
{MENU_ENUM_LABEL_SAVESTATE_LIST,
action_get_savestate_list},
{MENU_ENUM_LABEL_STATE_SLOT_RUN,
action_get_state_slot_run},
{MENU_ENUM_LABEL_CORE_OPTIONS,
action_get_title_core_options_list},
{MENU_ENUM_LABEL_DEFERRED_CORE_OPTION_OVERRIDE_LIST,
Expand Down
31 changes: 10 additions & 21 deletions menu/drivers/materialui.c
Original file line number Diff line number Diff line change
Expand Up @@ -2524,6 +2524,7 @@ static void materialui_update_savestate_thumbnail_path(void *data, unsigned i)
{
unsigned _state_slot = string_to_unsigned(entry.label);
if ( _state_slot == MENU_ENUM_LABEL_STATE_SLOT
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_RUN_STR)
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_STR)
|| string_is_equal(entry.label, MENU_ENUM_LABEL_LOAD_STATE_STR)
|| string_is_equal(entry.label, MENU_ENUM_LABEL_SAVE_STATE_STR))
Expand All @@ -2533,7 +2534,8 @@ static void materialui_update_savestate_thumbnail_path(void *data, unsigned i)
int state_slot = settings->ints.state_slot;

/* State slot dropdown */
if (_state_slot == MENU_ENUM_LABEL_STATE_SLOT)
if ( _state_slot == MENU_ENUM_LABEL_STATE_SLOT
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_RUN_STR))
state_slot = i - 1;

gfx_savestate_thumbnail_get_path(path, sizeof(path),
Expand Down Expand Up @@ -3685,17 +3687,6 @@ static bool materialui_render_process_entry_playlist_desktop(
settings_t *settings = config_get_ptr();
bool content_runtime_log = settings->bools.content_runtime_log;
bool content_runtime_log_aggregate = settings->bools.content_runtime_log_aggregate;
const char *directory_runtime_log = settings->paths.directory_runtime_log;
const char *directory_playlist = settings->paths.directory_playlist;
unsigned runtime_type = settings->uints.playlist_sublabel_runtime_type;
enum playlist_sublabel_last_played_style_type
runtime_last_played_style =
(enum playlist_sublabel_last_played_style_type)
settings->uints.playlist_sublabel_last_played_style;
enum playlist_sublabel_last_played_date_separator_type
runtime_date_separator =
(enum playlist_sublabel_last_played_date_separator_type)
settings->uints.menu_timedate_date_separator;
float fade_duration = gfx_thumb_get_ptr()->fade_duration;
const struct playlist_entry *entry = NULL;
const char *core_name = NULL;
Expand Down Expand Up @@ -3729,13 +3720,7 @@ static bool materialui_render_process_entry_playlist_desktop(
if (content_runtime_log || content_runtime_log_aggregate)
{
if (entry->runtime_status == PLAYLIST_RUNTIME_UNKNOWN)
runtime_update_playlist(
mui->playlist, playlist_idx,
directory_runtime_log,
directory_playlist,
(runtime_type == PLAYLIST_RUNTIME_PER_CORE),
runtime_last_played_style,
runtime_date_separator);
runtime_update_playlist(mui->playlist, playlist_idx);

if (entry->runtime_str && *entry->runtime_str)
runtime_str = entry->runtime_str;
Expand Down Expand Up @@ -5901,7 +5886,6 @@ static bool materialui_is_savestate_list(materialui_handle_t *mui)
MENU_ENTRY_INITIALIZE(entry);
entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED;
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);

return
( string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_STR)
|| string_is_equal(entry.label, MENU_ENUM_LABEL_LOAD_STATE_STR)
Expand All @@ -5916,7 +5900,10 @@ static bool materialui_is_savestate_slot(materialui_handle_t *mui)
MENU_ENTRY_INITIALIZE(entry);
entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED;
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
return string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT;
return
( string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_RUN_STR)
);
}

/* Used for savestate layout list displays.
Expand Down Expand Up @@ -9877,6 +9864,7 @@ static void materialui_populate_entries(void *data, const char *path,

if ( settings->bools.savestate_thumbnail_enable
&& ( string_is_equal(label, MENU_ENUM_LABEL_SAVESTATE_LIST_STR)
|| string_is_equal(label, MENU_ENUM_LABEL_STATE_SLOT_RUN_STR)
|| string_to_unsigned(path) == MENU_ENUM_LABEL_STATE_SLOT))
{
mui->flags |= MUI_FLAG_IS_SAVESTATE_LIST;
Expand Down Expand Up @@ -11780,6 +11768,7 @@ static void materialui_list_insert(void *userdata,
node->icon_type = MUI_ICON_TYPE_INTERNAL;
}
else if ( string_is_equal(label, MENU_ENUM_LABEL_LOAD_STATE_STR)
|| (string_is_equal(label, MENU_ENUM_LABEL_STATE_SLOT_RUN_STR) && type != MENU_SETTING_ACTION_STATE_SLOT_RUN)
|| string_is_equal(label, MENU_ENUM_LABEL_OVERRIDE_FILE_LOAD_STR)
|| string_is_equal(label, MENU_ENUM_LABEL_CHEAT_FILE_LOAD_STR)
|| string_is_equal(label, MENU_ENUM_LABEL_CHEAT_FILE_LOAD_APPEND_STR)
Expand Down
Loading
Loading