Several RARCH_CTL switches don't belong to retroarch state but

runloop state, hence remove
This commit is contained in:
libretroadmin 2023-01-22 20:16:14 +01:00
parent b23eaba217
commit e798f99fea
6 changed files with 154 additions and 183 deletions

View File

@ -470,6 +470,7 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
core_info_t *core_info = NULL;
const char *core_path = NULL;
const char *savestate_support = NULL;
runloop_state_t *runloop_st = runloop_state_get_ptr();
bool kiosk_mode_enable = settings->bools.kiosk_mode_enable;
#if defined(HAVE_NETWORKING) && defined(HAVE_ONLINE_UPDATER)
bool menu_show_core_updater = settings->bools.menu_show_core_updater;
@ -693,12 +694,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
firmware_info.path = core_info->path;
firmware_info.directory.system = settings->paths.directory_system;
retroarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL);
update_missing_firmware = core_info_list_update_missing_firmware(&firmware_info, &set_missing_firmware);
if (set_missing_firmware)
retroarch_ctl(RARCH_CTL_SET_MISSING_BIOS, NULL);
runloop_st->missing_bios = true;
else
runloop_st->missing_bios = false;
if (update_missing_firmware)
{
@ -1237,9 +1238,10 @@ static unsigned menu_displaylist_parse_core_option_override_list(
menu_displaylist_info_t *info, settings_t *settings)
{
unsigned count = 0;
runloop_state_t *runloop_st = runloop_state_get_ptr();
uint32_t flags = runloop_get_flags();
bool core_has_options = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) &&
retroarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL);
(runloop_st->core_options);
bool game_options_active = flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE;
bool folder_options_active = flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE;
bool show_core_options_flush = settings ?
@ -12912,10 +12914,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
* index is less than the current number of menu entries
* - if not, we reset the navigation pointer */
size_t selection = menu_navigation_get_selection();
runloop_state_t *runloop_st = runloop_state_get_ptr();
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (retroarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL))
if (runloop_st->core_options)
{
bool game_specific_options = settings->bools.game_specific_options;
const char *category = info->path;

View File

@ -6405,19 +6405,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
p_rarch->flags &= ~RARCH_FLAGS_BLOCK_CONFIG_READ;
break;
#endif
case RARCH_CTL_GET_CORE_OPTION_SIZE:
{
unsigned *idx = (unsigned*)data;
if (!idx)
return false;
if (runloop_st->core_options)
*idx = (unsigned)runloop_st->core_options->size;
else
*idx = 0;
}
break;
case RARCH_CTL_HAS_CORE_OPTIONS:
return (runloop_st->core_options != NULL);
case RARCH_CTL_CORE_OPTIONS_LIST_GET:
{
core_option_manager_t **coreopts = (core_option_manager_t**)data;
@ -6427,8 +6414,8 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
}
break;
case RARCH_CTL_CORE_OPTION_UPDATE_DISPLAY:
if (runloop_st->core_options &&
runloop_st->core_options_callback.update_display)
if ( runloop_st->core_options
&& runloop_st->core_options_callback.update_display)
{
/* Note: The update_display() callback may read
* core option values via RETRO_ENVIRONMENT_GET_VARIABLE.
@ -6462,14 +6449,6 @@ bool retroarch_ctl(enum rarch_ctl_state state, void *data)
runloop_st->flags |= RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE;
break;
#endif
case RARCH_CTL_SET_MISSING_BIOS:
runloop_st->missing_bios = true;
break;
case RARCH_CTL_UNSET_MISSING_BIOS:
runloop_st->missing_bios = false;
break;
case RARCH_CTL_IS_MISSING_BIOS:
return runloop_st->missing_bios;
case RARCH_CTL_GET_PERFCNT:
{
bool **perfcnt = (bool**)data;

View File

@ -79,10 +79,6 @@ enum rarch_ctl_state
RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
#endif
RARCH_CTL_IS_MISSING_BIOS,
RARCH_CTL_SET_MISSING_BIOS,
RARCH_CTL_UNSET_MISSING_BIOS,
RARCH_CTL_SET_SHUTDOWN,
/* Runloop state */
@ -95,8 +91,6 @@ enum rarch_ctl_state
RARCH_CTL_IS_PERFCNT_ENABLE,
/* Core options */
RARCH_CTL_HAS_CORE_OPTIONS,
RARCH_CTL_GET_CORE_OPTION_SIZE,
RARCH_CTL_CORE_OPTIONS_LIST_GET,
RARCH_CTL_CORE_OPTION_PREV,
RARCH_CTL_CORE_OPTION_NEXT,

View File

@ -1856,6 +1856,7 @@ static bool firmware_update_status(
core_info_ctx_firmware_t firmware_info;
bool set_missing_firmware = false;
core_info_t *core_info = NULL;
runloop_state_t *runloop_st = runloop_state_get_ptr();
core_info_get_current_core(&core_info);
@ -1878,13 +1879,13 @@ static bool firmware_update_status(
core_info->path,
firmware_info.directory.system);
retroarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL);
core_info_list_update_missing_firmware(&firmware_info,
&set_missing_firmware);
if (set_missing_firmware)
retroarch_ctl(RARCH_CTL_SET_MISSING_BIOS, NULL);
runloop_st->missing_bios = true;
else
runloop_st->missing_bios = false;
if (
(content_ctx->flags & CONTENT_INFO_FLAG_BIOS_IS_MISSING)
@ -1934,7 +1935,7 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
#endif
if (retroarch_ctl(RARCH_CTL_IS_MISSING_BIOS, NULL))
if (runloop_st->missing_bios)
content_ctx.flags |= CONTENT_INFO_FLAG_BIOS_IS_MISSING;
content_ctx.directory_system = NULL;
content_ctx.directory_cache = NULL;
@ -2024,7 +2025,7 @@ bool task_push_load_content_from_playlist_from_menu(
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
#endif
if (retroarch_ctl(RARCH_CTL_IS_MISSING_BIOS, NULL))
if (runloop_st->missing_bios)
content_ctx.flags |= CONTENT_INFO_FLAG_BIOS_IS_MISSING;
content_ctx.directory_system = NULL;
content_ctx.directory_cache = NULL;
@ -2164,7 +2165,7 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
#endif
if (retroarch_ctl(RARCH_CTL_IS_MISSING_BIOS, NULL))
if (runloop_st->missing_bios)
content_ctx.flags |= CONTENT_INFO_FLAG_BIOS_IS_MISSING;
content_ctx.directory_system = NULL;
content_ctx.directory_cache = NULL;
@ -2287,7 +2288,7 @@ bool task_push_load_contentless_core_from_menu(
if (check_firmware_before_loading)
content_ctx.flags |= CONTENT_INFO_FLAG_CHECK_FW_BEFORE_LOADING;
if (retroarch_ctl(RARCH_CTL_IS_MISSING_BIOS, NULL))
if (runloop_st->missing_bios)
content_ctx.flags |= CONTENT_INFO_FLAG_BIOS_IS_MISSING;
if (!string_is_empty(path_dir_system))
content_ctx.directory_system = strdup(path_dir_system);
@ -2399,7 +2400,7 @@ bool task_push_load_content_with_new_core_from_menu(
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
#endif
if (retroarch_ctl(RARCH_CTL_IS_MISSING_BIOS, NULL))
if (runloop_st->missing_bios)
content_ctx.flags |= CONTENT_INFO_FLAG_BIOS_IS_MISSING;
content_ctx.directory_system = NULL;
content_ctx.directory_cache = NULL;
@ -2506,7 +2507,7 @@ static bool task_load_content_internal(
if (runloop_st->flags & RUNLOOP_FLAG_PATCH_BLOCKED)
content_ctx.flags |= CONTENT_INFO_FLAG_PATCH_IS_BLOCKED;
#endif
if (retroarch_ctl(RARCH_CTL_IS_MISSING_BIOS, NULL))
if (runloop_st->missing_bios)
content_ctx.flags |= CONTENT_INFO_FLAG_BIOS_IS_MISSING;
content_ctx.directory_system = NULL;
content_ctx.directory_cache = NULL;

View File

@ -1042,7 +1042,7 @@ void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index)
{
unsigned i, k;
QString key, val;
size_t opts = 0;
runloop_state_t *runloop_st = runloop_state_get_ptr();
QComboBox *combo_box = qobject_cast<QComboBox*>(sender());
if (!combo_box)
@ -1051,11 +1051,7 @@ void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index)
key = combo_box->itemData(index, Qt::UserRole).toString();
val = combo_box->itemText(index);
if (retroarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL))
{
retroarch_ctl(RARCH_CTL_GET_CORE_OPTION_SIZE, &opts);
if (opts)
if (runloop_st->core_options)
{
core_option_manager_t *coreopts = NULL;
@ -1063,6 +1059,8 @@ void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index)
if (coreopts)
{
size_t opts = runloop_st->core_options->size;
for (i = 0; i < opts; i++)
{
QString optKey;
@ -1087,23 +1085,19 @@ void CoreOptionsDialog::onCoreOptionComboBoxCurrentIndexChanged(int index)
}
}
}
}
void CoreOptionsDialog::buildLayout()
{
unsigned j, k;
size_t opts = 0;
QFormLayout *form = NULL;
settings_t *settings = config_get_ptr();
bool has_core_options = retroarch_ctl(RARCH_CTL_HAS_CORE_OPTIONS, NULL);
runloop_state_t *runloop_st = runloop_state_get_ptr();
bool has_core_options = (runloop_st->core_options != NULL);
size_t opts = (runloop_st->core_options) ? runloop_st->core_options->size : 0;
clearLayout();
if (has_core_options)
{
retroarch_ctl(RARCH_CTL_GET_CORE_OPTION_SIZE, &opts);
if (opts)
{
core_option_manager_t *coreopts = NULL;
@ -1113,7 +1107,7 @@ void CoreOptionsDialog::buildLayout()
{
QString contentLabel;
QString label;
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
rarch_system_info_t *system = &runloop_st->system;
/* TODO/FIXME - why have this check here? system is not used */
if (system)
@ -1121,7 +1115,7 @@ void CoreOptionsDialog::buildLayout()
if (!contentLabel.isEmpty())
{
uint32_t flags = runloop_get_flags();
uint32_t flags = runloop_st->flags;
if (flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE)
label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GAME_SPECIFIC_OPTIONS_IN_USE);
else
@ -1225,7 +1219,6 @@ void CoreOptionsDialog::buildLayout()
m_layout->addLayout(form);
}
}
}
if (!opts)
{

View File

@ -2246,6 +2246,7 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
{
int i;
QVector<QHash<QString, QString> > infoList;
runloop_state_t *runloop_st = runloop_state_get_ptr();
QHash<QString, QString> currentCore = getSelectedCore();
core_info_t *core_info = NULL;
QByteArray currentCorePathArray = currentCore["core_path"].toUtf8();
@ -2421,12 +2422,12 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
firmware_info.path = core_info->path;
firmware_info.directory.system = settings->paths.directory_system;
retroarch_ctl(RARCH_CTL_UNSET_MISSING_BIOS, NULL);
update_missing_firmware = core_info_list_update_missing_firmware(&firmware_info, &set_missing_firmware);
if (set_missing_firmware)
retroarch_ctl(RARCH_CTL_SET_MISSING_BIOS, NULL);
runloop_st->missing_bios = true;
else
runloop_st->missing_bios = false;
if (update_missing_firmware)
{