Skip to content

Commit 51b13fc

Browse files
Merge pull request #17695 from sonninnos/core-load-unload
Core load+unload fixes
2 parents 0b2b933 + ee8a641 commit 51b13fc

17 files changed

Lines changed: 134 additions & 24 deletions

intl/msg_hash_lbl.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ MSG_HASH(
693693
)
694694
MSG_HASH(
695695
MENU_ENUM_LABEL_CLOSE_CONTENT,
696-
"unload_core"
696+
"close_content"
697697
)
698698
MSG_HASH(
699699
MENU_ENUM_LABEL_COLLECTION,
@@ -827,6 +827,10 @@ MSG_HASH(
827827
MENU_ENUM_LABEL_CORE_LIST,
828828
"load_core"
829829
)
830+
MSG_HASH(
831+
MENU_ENUM_LABEL_CORE_LIST_UNLOAD,
832+
"unload_core"
833+
)
830834
MSG_HASH(
831835
MENU_ENUM_LABEL_SIDELOAD_CORE_LIST,
832836
"sideload_core"

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ MSG_HASH(
7171
MENU_ENUM_SUBLABEL_CORE_LIST,
7272
"Select which core to use."
7373
)
74+
MSG_HASH(
75+
MENU_ENUM_LABEL_VALUE_CORE_LIST_UNLOAD,
76+
"Unload Core"
77+
)
78+
MSG_HASH(
79+
MENU_ENUM_SUBLABEL_CORE_LIST_UNLOAD,
80+
"Release the loaded core."
81+
)
7482
MSG_HASH(
7583
MENU_ENUM_LABEL_HELP_CORE_LIST,
7684
"Browse for a libretro core implementation. Where the browser starts depends on your Core Directory path. If blank, it will start in root.\nIf Core Directory is a directory, the menu will use that as top folder. If Core Directory is a full path, it will start in the folder where the file is."

menu/cbs/menu_cbs_ok.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5717,6 +5717,9 @@ int action_ok_close_content(const char *path, const char *label, unsigned type,
57175717
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;
57185718
}
57195719

5720+
/* Try to reload last core if loaded manually */
5721+
menu_state_get_ptr()->flags |= MENU_ST_FLAG_PENDING_RELOAD_CORE;
5722+
57205723
return ret;
57215724
}
57225725

menu/cbs/menu_cbs_start.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs)
798798
switch (cbs->enum_idx)
799799
{
800800
case MENU_ENUM_LABEL_CORE_LIST:
801+
case MENU_ENUM_LABEL_CORE_LIST_UNLOAD:
801802
BIND_ACTION_START(cbs, action_start_load_core);
802803
break;
803804
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET:

menu/cbs/menu_cbs_sublabel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cheevos_password, MENU_
620620
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_post_filter_record, MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD)
621621
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_start_core, MENU_ENUM_SUBLABEL_START_CORE)
622622
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_list, MENU_ENUM_SUBLABEL_CORE_LIST)
623+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_list_unload, MENU_ENUM_SUBLABEL_CORE_LIST_UNLOAD)
623624
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_download_core, MENU_ENUM_SUBLABEL_DOWNLOAD_CORE)
624625
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_update_installed_cores, MENU_ENUM_SUBLABEL_UPDATE_INSTALLED_CORES)
625626
#if defined(ANDROID)
@@ -4464,6 +4465,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
44644465
case MENU_ENUM_LABEL_CORE_LIST:
44654466
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_list);
44664467
break;
4468+
case MENU_ENUM_LABEL_CORE_LIST_UNLOAD:
4469+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_list_unload);
4470+
break;
44674471
case MENU_ENUM_LABEL_SIDELOAD_CORE_LIST:
44684472
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_sideload_core_list);
44694473
break;

menu/drivers/materialui.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11713,9 +11713,9 @@ static void materialui_list_insert(void *userdata,
1171311713
node->icon_texture_index = MUI_TEXTURE_HALT_REPLAY;
1171411714
node->icon_type = MUI_ICON_TYPE_INTERNAL;
1171511715
}
11716-
else if (
11717-
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISK_TRAY_EJECT))
11716+
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISK_TRAY_EJECT))
1171811717
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DISK_TRAY_INSERT))
11718+
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CORE_LIST_UNLOAD))
1171911719
)
1172011720
{
1172111721
node->icon_texture_index = MUI_TEXTURE_EJECT;

menu/drivers/ozone.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,7 @@ static uintptr_t ozone_entries_icon_get_texture(
18891889
case MENU_ENUM_LABEL_TAKE_SCREENSHOT:
18901890
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT:
18911891
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SCREENSHOT];
1892+
case MENU_ENUM_LABEL_CORE_LIST_UNLOAD:
18921893
case MENU_ENUM_LABEL_DELETE_ENTRY:
18931894
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_CLOSE_CONTENT:
18941895
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOSE];

menu/drivers/xmb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,6 +3322,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
33223322
case MENU_ENUM_LABEL_TAKE_SCREENSHOT:
33233323
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT:
33243324
return xmb->textures.list[XMB_TEXTURE_SCREENSHOT];
3325+
case MENU_ENUM_LABEL_CORE_LIST_UNLOAD:
33253326
case MENU_ENUM_LABEL_DELETE_ENTRY:
33263327
case MENU_ENUM_LABEL_QUICK_MENU_SHOW_CLOSE_CONTENT:
33273328
return xmb->textures.list[XMB_TEXTURE_CLOSE];

menu/menu_defines.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ enum menu_state_flags
4848
* - Does menu driver support screensaver functionality?
4949
* - Is screensaver currently active? */
5050
MENU_ST_FLAG_SCREENSAVER_SUPPORTED = (1 << 10),
51-
MENU_ST_FLAG_SCREENSAVER_ACTIVE = (1 << 11)
51+
MENU_ST_FLAG_SCREENSAVER_ACTIVE = (1 << 11),
52+
MENU_ST_FLAG_PENDING_RELOAD_CORE = (1 << 12)
5253
};
5354

5455
enum menu_scroll_mode

menu/menu_displaylist.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15075,9 +15075,18 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
1507515075
{
1507615076
if (settings->bools.menu_show_load_core)
1507715077
{
15078-
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,
15079-
MENU_ENUM_LABEL_CORE_LIST, PARSE_ACTION, false) == 0)
15080-
count++;
15078+
if (!string_is_empty(sys_info->info.library_name))
15079+
{
15080+
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,
15081+
MENU_ENUM_LABEL_CORE_LIST_UNLOAD, PARSE_ACTION, false) == 0)
15082+
count++;
15083+
}
15084+
else
15085+
{
15086+
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list,
15087+
MENU_ENUM_LABEL_CORE_LIST, PARSE_ACTION, false) == 0)
15088+
count++;
15089+
}
1508115090
}
1508215091
}
1508315092
}

0 commit comments

Comments
 (0)