mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-29 11:10:27 +00:00
Merge pull request #6756 from Dwedit/runahead-messages
Runahead error messages
This commit is contained in:
commit
72a77884fa
@ -601,6 +601,9 @@ static const unsigned run_ahead_frames = 1;
|
||||
/* When using the Run Ahead feature, use a secondary instance of the core. */
|
||||
static const bool run_ahead_secondary_instance = true;
|
||||
|
||||
/* Hide warning messages when using the Run Ahead feature. */
|
||||
static const bool run_ahead_hide_warnings = false;
|
||||
|
||||
/* Enable stdin/network command interface. */
|
||||
static const bool network_cmd_enable = false;
|
||||
static const uint16_t network_cmd_port = 55355;
|
||||
|
@ -1225,6 +1225,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, rewind_enable, false);
|
||||
SETTING_BOOL("run_ahead_enabled", &settings->bools.run_ahead_enabled, true, false, false);
|
||||
SETTING_BOOL("run_ahead_secondary_instance", &settings->bools.run_ahead_secondary_instance, true, false, false);
|
||||
SETTING_BOOL("run_ahead_hide_warnings", &settings->bools.run_ahead_hide_warnings, true, false, false);
|
||||
SETTING_BOOL("audio_sync", &settings->bools.audio_sync, true, audio_sync, false);
|
||||
SETTING_BOOL("video_shader_enable", &settings->bools.video_shader_enable, true, shader_enable, false);
|
||||
SETTING_BOOL("video_shader_watch_files", &settings->bools.video_shader_watch_files, true, video_shader_watch_files, false);
|
||||
|
@ -237,6 +237,7 @@ typedef struct settings
|
||||
bool rewind_enable;
|
||||
bool run_ahead_enabled;
|
||||
bool run_ahead_secondary_instance;
|
||||
bool run_ahead_hide_warnings;
|
||||
bool pause_nonactive;
|
||||
bool block_sram_overwrite;
|
||||
bool savestate_auto_index;
|
||||
|
@ -999,6 +999,8 @@ MSG_HASH(MENU_ENUM_LABEL_RUN_AHEAD_ENABLED,
|
||||
"run_ahead_enabled")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE,
|
||||
"run_ahead_secondary_instance")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS,
|
||||
"run_ahead_hide_warnings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RUN_AHEAD_FRAMES,
|
||||
"run_ahead_frames")
|
||||
MSG_HASH(MENU_ENUM_LABEL_SORT_SAVEFILES_ENABLE,
|
||||
|
@ -1454,7 +1454,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_ENABLED,
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_FRAMES,
|
||||
"Number of Frames to Run Ahead")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_SECONDARY_INSTANCE,
|
||||
"Runahead Use Second Instance")
|
||||
"RunAhead Use Second Instance")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_AHEAD_HIDE_WARNINGS,
|
||||
"RunAhead Hide Warnings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVEFILES_ENABLE,
|
||||
"Sort Saves In Folders")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_SORT_SAVESTATES_ENABLE,
|
||||
@ -2760,6 +2762,10 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_RUN_AHEAD_SECONDARY_INSTANCE,
|
||||
"Use a second instance of the RetroArch core to run ahead. Prevents audio problems due to loading state."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_RUN_AHEAD_HIDE_WARNINGS,
|
||||
"Hides the warning message that appears when using RunAhead and the core does not support savestates."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_REWIND_ENABLE,
|
||||
"Enable rewinding. This will take a performance hit when playing."
|
||||
@ -3472,6 +3478,14 @@ MSG_HASH(MSG_GAME_REMAP_FILE_LOADED,
|
||||
"Game remap file loaded.")
|
||||
MSG_HASH(MSG_CORE_REMAP_FILE_LOADED,
|
||||
"Core remap file loaded.")
|
||||
MSG_HASH(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES,
|
||||
"RunAhead has been disabled because this core does not support save states.")
|
||||
MSG_HASH(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE,
|
||||
"Failed to save state. RunAhead has been disabled.")
|
||||
MSG_HASH(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE,
|
||||
"Failed to load state. RunAhead has been disabled.")
|
||||
MSG_HASH(MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE,
|
||||
"Failed to create second instance. RunAhead will now use only one instance.")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST,
|
||||
"Automatically add content to playlist")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_AUTOMATICALLY_ADD_CONTENT_TO_PLAYLIST,
|
||||
|
@ -199,6 +199,7 @@ default_sublabel_macro(action_bind_sublabel_fastforward_ratio, MENU_
|
||||
default_sublabel_macro(action_bind_sublabel_slowmotion_ratio, MENU_ENUM_SUBLABEL_SLOWMOTION_RATIO)
|
||||
default_sublabel_macro(action_bind_sublabel_run_ahead_enabled, MENU_ENUM_SUBLABEL_RUN_AHEAD_ENABLED)
|
||||
default_sublabel_macro(action_bind_sublabel_run_ahead_secondary_instance, MENU_ENUM_SUBLABEL_RUN_AHEAD_SECONDARY_INSTANCE)
|
||||
default_sublabel_macro(action_bind_sublabel_run_ahead_hide_warnings, MENU_ENUM_SUBLABEL_RUN_AHEAD_HIDE_WARNINGS)
|
||||
default_sublabel_macro(action_bind_sublabel_run_ahead_frames, MENU_ENUM_SUBLABEL_RUN_AHEAD_FRAMES)
|
||||
default_sublabel_macro(action_bind_sublabel_rewind, MENU_ENUM_SUBLABEL_REWIND_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_rewind_granularity, MENU_ENUM_SUBLABEL_REWIND_GRANULARITY)
|
||||
@ -1319,6 +1320,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_run_ahead_secondary_instance);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_run_ahead_hide_warnings);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_RUN_AHEAD_FRAMES:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_run_ahead_frames);
|
||||
break;
|
||||
|
@ -6275,6 +6275,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
MENU_ENUM_LABEL_RUN_AHEAD_SECONDARY_INSTANCE,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
count++;
|
||||
|
||||
if (count == 0)
|
||||
menu_entries_append_enum(info->list,
|
||||
|
@ -4689,7 +4689,7 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 1, 6, 1, true, true);
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.run_ahead_secondary_instance,
|
||||
@ -4707,6 +4707,22 @@ static bool setting_append_list(
|
||||
);
|
||||
#endif
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.run_ahead_hide_warnings,
|
||||
MENU_ENUM_LABEL_RUN_AHEAD_HIDE_WARNINGS,
|
||||
MENU_ENUM_LABEL_VALUE_RUN_AHEAD_HIDE_WARNINGS,
|
||||
false,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_ADVANCED
|
||||
);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.menu_throttle_framerate,
|
||||
|
@ -410,7 +410,10 @@ enum msg_hash_enums
|
||||
MSG_CONFIG_OVERRIDE_LOADED,
|
||||
MSG_GAME_REMAP_FILE_LOADED,
|
||||
MSG_CORE_REMAP_FILE_LOADED,
|
||||
|
||||
MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES,
|
||||
MSG_RUNAHEAD_FAILED_TO_SAVE_STATE,
|
||||
MSG_RUNAHEAD_FAILED_TO_LOAD_STATE,
|
||||
MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE,
|
||||
MENU_LABEL(ADD_TO_MIXER),
|
||||
MENU_LABEL(ADD_TO_MIXER_AND_PLAY),
|
||||
MENU_LABEL(ADD_TO_MIXER_AND_COLLECTION),
|
||||
@ -1296,6 +1299,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(SLOWMOTION_RATIO),
|
||||
MENU_LABEL(RUN_AHEAD_ENABLED),
|
||||
MENU_LABEL(RUN_AHEAD_SECONDARY_INSTANCE),
|
||||
MENU_LABEL(RUN_AHEAD_HIDE_WARNINGS),
|
||||
MENU_LABEL(RUN_AHEAD_FRAMES),
|
||||
MENU_LABEL(TURBO),
|
||||
|
||||
|
@ -40,7 +40,7 @@ static void* InputListElementConstructor(void)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void input_state_destory(void)
|
||||
static void input_state_destroy(void)
|
||||
{
|
||||
mylist_destroy(&input_state_list);
|
||||
}
|
||||
@ -158,7 +158,7 @@ void remove_input_state_hook(void)
|
||||
retro_ctx.state_cb = input_state_callback_original;
|
||||
current_core.retro_set_input_state(retro_ctx.state_cb);
|
||||
input_state_callback_original = NULL;
|
||||
input_state_destory();
|
||||
input_state_destroy();
|
||||
}
|
||||
|
||||
if (retro_reset_callback_original)
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "../dynamic.h"
|
||||
#include "../audio/audio_driver.h"
|
||||
#include "../gfx/video_driver.h"
|
||||
#include "../configuration.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
static bool runahead_create(void);
|
||||
static bool runahead_save_state(void);
|
||||
@ -28,8 +30,8 @@ static void unset_fast_savestate(void);
|
||||
static void set_hard_disable_audio(void);
|
||||
static void unset_hard_disable_audio(void);
|
||||
|
||||
/* TODO/FIXME - shouldn't this be signed size_t? */
|
||||
static size_t runahead_save_state_size = -1;
|
||||
static size_t runahead_save_state_size = 0;
|
||||
static bool runahead_save_state_size_known = false;
|
||||
|
||||
/* Save State List for Run Ahead */
|
||||
static MyList *runahead_save_state_list;
|
||||
@ -46,7 +48,7 @@ static void *runahead_save_state_alloc(void)
|
||||
savestate->data_const = NULL;
|
||||
savestate->size = 0;
|
||||
|
||||
if (runahead_save_state_size > 0 && runahead_save_state_size != -1)
|
||||
if (runahead_save_state_size > 0 && runahead_save_state_size_known)
|
||||
{
|
||||
savestate->data = malloc(runahead_save_state_size);
|
||||
savestate->data_const = savestate->data;
|
||||
@ -68,6 +70,7 @@ static void runahead_save_state_free(void *state)
|
||||
static void runahead_save_state_list_init(size_t saveStateSize)
|
||||
{
|
||||
runahead_save_state_size = saveStateSize;
|
||||
runahead_save_state_size_known = true;
|
||||
mylist_create(&runahead_save_state_list, 16,
|
||||
runahead_save_state_alloc, runahead_save_state_free);
|
||||
}
|
||||
@ -176,7 +179,8 @@ static uint64_t runahead_last_frame_count = 0;
|
||||
|
||||
static void runahead_clear_variables(void)
|
||||
{
|
||||
runahead_save_state_size = -1;
|
||||
runahead_save_state_size = 0;
|
||||
runahead_save_state_size_known = false;
|
||||
runahead_video_driver_is_active = true;
|
||||
runahead_available = true;
|
||||
runahead_secondary_core_available = true;
|
||||
@ -216,12 +220,15 @@ void run_ahead(int runahead_count, bool useSecondary)
|
||||
return;
|
||||
}
|
||||
|
||||
if (runahead_save_state_size == -1)
|
||||
if (!runahead_save_state_size_known)
|
||||
{
|
||||
if (!runahead_create())
|
||||
{
|
||||
/* RunAhead has been disabled because the core
|
||||
* does not support savestates. */
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!settings->bools.run_ahead_hide_warnings)
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_CORE_DOES_NOT_SUPPORT_SAVESTATES), 0, 2 * 60, true);
|
||||
}
|
||||
core_run();
|
||||
runahead_force_input_dirty = true;
|
||||
return;
|
||||
@ -258,25 +265,34 @@ void run_ahead(int runahead_count, bool useSecondary)
|
||||
|
||||
if (frame_number == 0)
|
||||
{
|
||||
/* RunAhead has been disabled due
|
||||
* to save state failure */
|
||||
if (!runahead_save_state())
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE), 0, 3 * 60, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (last_frame)
|
||||
{
|
||||
/* RunAhead has been disabled due
|
||||
* to load state failure */
|
||||
if (!runahead_load_state())
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE), 0, 3 * 60, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_DYNAMIC
|
||||
bool okay = false;
|
||||
if (!secondary_core_ensure_exists())
|
||||
{
|
||||
runahead_secondary_core_available = false;
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE), 0, 3 * 60, true);
|
||||
core_run();
|
||||
runahead_force_input_dirty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
/* run main core with video suspended */
|
||||
runahead_suspend_video();
|
||||
@ -285,45 +301,36 @@ void run_ahead(int runahead_count, bool useSecondary)
|
||||
|
||||
if (input_is_dirty || runahead_force_input_dirty)
|
||||
{
|
||||
unsigned frame_count;
|
||||
|
||||
input_is_dirty = false;
|
||||
|
||||
if (!runahead_save_state())
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_SAVE_STATE), 0, 3 * 60, true);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Could not create a secondary core.
|
||||
* RunAhead wll only use the main core now. */
|
||||
if (!runahead_load_state_secondary())
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RUNAHEAD_FAILED_TO_LOAD_STATE), 0, 3 * 60, true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (frame_count = 0; frame_count <
|
||||
(unsigned)(runahead_count - 1); frame_count++)
|
||||
for (frame_number = 0; frame_number < runahead_count - 1; frame_number++)
|
||||
{
|
||||
runahead_suspend_video();
|
||||
runahead_suspend_audio();
|
||||
set_hard_disable_audio();
|
||||
okay = runahead_run_secondary();
|
||||
runahead_run_secondary();
|
||||
unset_hard_disable_audio();
|
||||
runahead_resume_audio();
|
||||
runahead_resume_video();
|
||||
|
||||
/* Could not create a secondary core. RunAhead
|
||||
* will only use the main core now. */
|
||||
if (!okay)
|
||||
return;
|
||||
}
|
||||
}
|
||||
runahead_suspend_audio();
|
||||
set_hard_disable_audio();
|
||||
okay = runahead_run_secondary();
|
||||
runahead_run_secondary();
|
||||
unset_hard_disable_audio();
|
||||
runahead_resume_audio();
|
||||
|
||||
/* Could not create a secondary core. RunAhead
|
||||
* will only use the main core now. */
|
||||
if (!okay)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
runahead_force_input_dirty = false;
|
||||
@ -335,18 +342,21 @@ static void runahead_error(void)
|
||||
runahead_save_state_list_destroy();
|
||||
remove_hooks();
|
||||
runahead_save_state_size = 0;
|
||||
runahead_save_state_size_known = true;
|
||||
}
|
||||
|
||||
static bool runahead_create(void)
|
||||
{
|
||||
/* get savestate size and allocate buffer */
|
||||
retro_ctx_size_info_t info;
|
||||
set_fast_savestate();
|
||||
core_serialize_size(&info);
|
||||
unset_fast_savestate();
|
||||
|
||||
runahead_save_state_list_init(info.size);
|
||||
runahead_video_driver_is_active = video_driver_is_active();
|
||||
|
||||
if (runahead_save_state_size == 0 || runahead_save_state_size == -1)
|
||||
if (runahead_save_state_size == 0 || !runahead_save_state_size_known)
|
||||
{
|
||||
runahead_error();
|
||||
return false;
|
||||
@ -413,6 +423,7 @@ static bool runahead_load_state_secondary(void)
|
||||
if (!okay)
|
||||
{
|
||||
runahead_secondary_core_available = false;
|
||||
runahead_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -295,16 +295,24 @@ void secondary_core_set_variable_update(void)
|
||||
|
||||
bool secondary_core_run_no_input_polling(void)
|
||||
{
|
||||
if (!secondary_module)
|
||||
if (secondary_core_ensure_exists())
|
||||
{
|
||||
if (!secondary_core_create())
|
||||
return false;
|
||||
secondary_core.retro_run();
|
||||
return true;
|
||||
}
|
||||
secondary_core.retro_run();
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool secondary_core_deserialize(const void *buffer, int size)
|
||||
{
|
||||
if (secondary_core_ensure_exists())
|
||||
{
|
||||
return secondary_core.retro_unserialize(buffer, size);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool secondary_core_ensure_exists(void)
|
||||
{
|
||||
if (!secondary_module)
|
||||
{
|
||||
@ -314,7 +322,7 @@ bool secondary_core_deserialize(const void *buffer, int size)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return secondary_core.retro_unserialize(buffer, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
void secondary_core_destroy(void)
|
||||
|
@ -12,6 +12,7 @@ RETRO_BEGIN_DECLS
|
||||
|
||||
bool secondary_core_run_no_input_polling(void);
|
||||
bool secondary_core_deserialize(const void *buffer, int size);
|
||||
bool secondary_core_ensure_exists(void);
|
||||
void secondary_core_destroy(void);
|
||||
void set_last_core_type(enum rarch_core_type type);
|
||||
void remember_controller_port_device(long port, long device);
|
||||
|
Loading…
Reference in New Issue
Block a user