Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preemptive Frames: Relax savestate requirement to 'serialized' #14896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions intl/msg_hash_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -3846,7 +3846,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_PREEMPT_UNSUPPORTED,
"Current core is incompatible with preemptive frames due to lack of deterministic save state support."
"Current core is incompatible with preemptive frames due to lack of serialized save state support."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PREEMPT_ENABLE,
Expand Down Expand Up @@ -14140,7 +14140,7 @@ MSG_HASH(
)
MSG_HASH(
MSG_PREEMPT_CORE_DOES_NOT_SUPPORT_PREEMPT,
"Preemptive Frames unavailable because this core lacks deterministic save state support."
"Preemptive Frames unavailable because this core lacks serialized save state support."
)
MSG_HASH(
MSG_PREEMPT_FAILED_TO_ALLOCATE,
Expand Down
60 changes: 31 additions & 29 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -9269,6 +9269,7 @@ unsigned menu_displaylist_build_list(
#ifdef HAVE_RUNAHEAD
bool runahead_supported = true;
bool runahead_enabled = settings->bools.run_ahead_enabled;
bool preempt_supported = true;
bool preempt_enabled = settings->bools.preemptive_frames_enable;
#endif
menu_displaylist_build_info_selective_t build_list[] = {
Expand Down Expand Up @@ -9329,32 +9330,34 @@ unsigned menu_displaylist_build_list(
#ifdef HAVE_RUNAHEAD
if ( (flags & RUNLOOP_FLAG_CORE_RUNNING)
&& !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
{
runahead_supported = core_info_current_supports_runahead();
preempt_supported = core_info_current_supports_rewind();
}

if (runahead_supported)
for (i = 0; i < ARRAY_SIZE(build_list); i++)
{
for (i = 0; i < ARRAY_SIZE(build_list); i++)
switch (build_list[i].enum_idx)
{
switch (build_list[i].enum_idx)
{
case MENU_ENUM_LABEL_RUN_AHEAD_ENABLED:
case MENU_ENUM_LABEL_PREEMPT_ENABLE:
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_RUN_AHEAD_FRAMES:
case MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE:
case MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS:
if (runahead_enabled)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_PREEMPT_FRAMES:
case MENU_ENUM_LABEL_PREEMPT_HIDE_WARNINGS:
if (preempt_enabled)
build_list[i].checked = true;
break;
default:
break;
}
case MENU_ENUM_LABEL_RUN_AHEAD_ENABLED:
build_list[i].checked = runahead_supported;
break;
case MENU_ENUM_LABEL_RUN_AHEAD_FRAMES:
case MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE:
case MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS:
if (runahead_supported)
build_list[i].checked = runahead_enabled;
break;
case MENU_ENUM_LABEL_PREEMPT_ENABLE:
build_list[i].checked = preempt_supported;
break;
case MENU_ENUM_LABEL_PREEMPT_FRAMES:
case MENU_ENUM_LABEL_PREEMPT_HIDE_WARNINGS:
if (preempt_supported)
build_list[i].checked = preempt_enabled;
break;
default:
break;
}
}
#endif
Expand All @@ -9370,21 +9373,20 @@ unsigned menu_displaylist_build_list(
}

#ifdef HAVE_RUNAHEAD
if (!runahead_supported)
{
if (menu_entries_append(list,
if (!runahead_supported &&
menu_entries_append(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_UNSUPPORTED),
msg_hash_to_str(MENU_ENUM_LABEL_RUN_AHEAD_UNSUPPORTED),
MENU_ENUM_LABEL_RUN_AHEAD_UNSUPPORTED,
FILE_TYPE_NONE, 0, 0, NULL))
count++;
if (menu_entries_append(list,
count++;
if (!preempt_supported &&
menu_entries_append(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PREEMPT_UNSUPPORTED),
msg_hash_to_str(MENU_ENUM_LABEL_PREEMPT_UNSUPPORTED),
MENU_ENUM_LABEL_PREEMPT_UNSUPPORTED,
FILE_TYPE_NONE, 0, 0, NULL))
count++;
}
count++;
#endif
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_GAMEMODE_ENABLE, PARSE_ONLY_BOOL, false) == 0)
Expand Down
7 changes: 4 additions & 3 deletions menu/menu_setting.c
Original file line number Diff line number Diff line change
Expand Up @@ -8764,9 +8764,10 @@ static void preempt_change_handler(rarch_setting_t *setting)
{
/* Disable runahead and inform user */
settings->bools.run_ahead_enabled = false;
runloop_msg_queue_push(
msg_hash_to_str(MSG_RUNAHEAD_DISABLED), 1, 100, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
if (core_info_current_supports_runahead())
runloop_msg_queue_push(
msg_hash_to_str(MSG_RUNAHEAD_DISABLED), 1, 100, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}

if ((preempt_enabled != !!preempt) && !netplay_enabled)
Expand Down
4 changes: 2 additions & 2 deletions runahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,8 @@ bool preempt_init(void *data)
|| !(runloop_st->current_core.flags & RETRO_CORE_FLAG_GAME_LOADED))
return false;

/* Check if supported - same requirements as runahead */
if (!core_info_current_supports_runahead())
/* Check if supported - same requirements as rewind */
if (!core_info_current_supports_rewind())
{
failed_str = msg_hash_to_str(MSG_PREEMPT_CORE_DOES_NOT_SUPPORT_PREEMPT);
goto error;
Expand Down