[GameMode] Improve error handling (#13362)
This commit is contained in:
parent
1582856b43
commit
688c652673
|
@ -3726,7 +3726,14 @@ static bool config_load_file(global_t *global,
|
|||
if (!config_entry_exists(conf, "user_language"))
|
||||
msg_hash_set_uint(MSG_HASH_USER_LANGUAGE, frontend_driver_get_user_language());
|
||||
|
||||
frontend_driver_set_gamemode(settings->bools.gamemode_enable);
|
||||
if (frontend_driver_has_gamemode() &&
|
||||
!frontend_driver_set_gamemode(settings->bools.gamemode_enable) &&
|
||||
settings->bools.gamemode_enable)
|
||||
{
|
||||
RARCH_WARN("[Config]: GameMode unsupported - disabling...\n");
|
||||
configuration_set_bool(settings,
|
||||
settings->bools.gamemode_enable, false);
|
||||
}
|
||||
|
||||
/* If this is the first run of an existing installation
|
||||
* after the independent favourites playlist size limit was
|
||||
|
|
|
@ -1996,22 +1996,25 @@ static void android_app_destroy(struct android_app *android_app)
|
|||
static bool frontend_unix_set_gamemode(bool on)
|
||||
{
|
||||
#ifdef FERAL_GAMEMODE
|
||||
const int gamemode_status = gamemode_query_status();
|
||||
int gamemode_status = gamemode_query_status();
|
||||
bool gamemode_active = (gamemode_status == 2);
|
||||
|
||||
if (gamemode_status < 0)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
RARCH_WARN("[GameMode]: GameMode cannot be enabled on this system (\"%s.\") "
|
||||
"https://github.com/FeralInteractive/gamemode needs to be installed.\n",
|
||||
gamemode_error_string());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gamemode_active == on)
|
||||
return true;
|
||||
|
||||
if (on)
|
||||
{
|
||||
if (gamemode_status != 2 && gamemode_request_start() != 0)
|
||||
if (gamemode_request_start() != 0)
|
||||
{
|
||||
RARCH_WARN("[GameMode]: Failed to enter GameMode: %s.\n", gamemode_error_string());
|
||||
return false;
|
||||
|
@ -2019,15 +2022,17 @@ static bool frontend_unix_set_gamemode(bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (gamemode_status == 2 && gamemode_request_end() != 0)
|
||||
if (gamemode_request_end() != 0)
|
||||
{
|
||||
RARCH_WARN("[GameMode]: Failed to exit GameMode: %s.\n", gamemode_error_string());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
(void)on;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -590,6 +590,13 @@ enum retro_language frontend_driver_get_user_language(void)
|
|||
return RETRO_LANGUAGE_ENGLISH;
|
||||
}
|
||||
|
||||
bool frontend_driver_has_gamemode(void)
|
||||
{
|
||||
frontend_state_t *frontend_st = &frontend_driver_st;
|
||||
frontend_ctx_driver_t *frontend = frontend_st->current_frontend_ctx;
|
||||
return frontend && frontend->set_gamemode;
|
||||
}
|
||||
|
||||
bool frontend_driver_set_gamemode(bool on)
|
||||
{
|
||||
frontend_state_t *frontend_st = &frontend_driver_st;
|
||||
|
|
|
@ -232,6 +232,8 @@ const char* frontend_driver_get_cpu_model_name(void);
|
|||
|
||||
enum retro_language frontend_driver_get_user_language(void);
|
||||
|
||||
bool frontend_driver_has_gamemode(void);
|
||||
|
||||
bool frontend_driver_set_gamemode(bool on);
|
||||
|
||||
frontend_state_t *frontend_state_get_ptr(void);
|
||||
|
|
|
@ -12329,6 +12329,22 @@ MSG_HASH(
|
|||
MSG_CORE_INFO_CACHE_UNSUPPORTED,
|
||||
"Cannot write to core info directory - core info cache will be disabled"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_FOUND_ENTRY_STATE_IN,
|
||||
"Found entry state in"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_LOADING_ENTRY_STATE_FROM,
|
||||
"Loading entry state from"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_FAILED_TO_ENTER_GAMEMODE,
|
||||
"Failed to enter GameMode"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_FAILED_TO_ENTER_GAMEMODE_LINUX,
|
||||
"Failed to enter GameMode - ensure GameMode daemon is installed/running"
|
||||
)
|
||||
|
||||
/* Lakka */
|
||||
|
||||
|
@ -12907,11 +12923,3 @@ MSG_HASH(
|
|||
"Scan Finished.<br><br>\nIn order for content to be correctly scanned, you must:\n<ul><li>have a compatible core already downloaded</li>\n<li>have \"Core Info Files\" updated via Online Updater</li>\n<li>have \"Databases\" updated via Online Updater</li>\n<li>restart RetroArch if any of the above was just done</li></ul>\nFinally, the content must match existing databases from <a href=\"https://docs.libretro.com/guides/roms-playlists-thumbnails/#sources\">here</a>. If it is still not working, consider <a href=\"https://www.github.com/libretro/RetroArch/issues\">submitting a bug report</a>."
|
||||
)
|
||||
#endif
|
||||
MSG_HASH(
|
||||
MSG_FOUND_ENTRY_STATE_IN,
|
||||
"Found entry state in"
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_LOADING_ENTRY_STATE_FROM,
|
||||
"Loading entry state from"
|
||||
)
|
||||
|
|
|
@ -7595,7 +7595,28 @@ static void general_write_handler(rarch_setting_t *setting)
|
|||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_GAMEMODE_ENABLE:
|
||||
frontend_driver_set_gamemode(config_get_ptr()->bools.gamemode_enable);
|
||||
if (frontend_driver_has_gamemode())
|
||||
{
|
||||
bool on = *setting->value.target.boolean;
|
||||
|
||||
if (!frontend_driver_set_gamemode(on) && on)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* If we failed to enable game mode, display
|
||||
* a notification and force disable the feature */
|
||||
runloop_msg_queue_push(
|
||||
#ifdef __linux__
|
||||
msg_hash_to_str(MSG_FAILED_TO_ENTER_GAMEMODE_LINUX),
|
||||
#else
|
||||
msg_hash_to_str(MSG_FAILED_TO_ENTER_GAMEMODE),
|
||||
#endif
|
||||
1, 180, true,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
configuration_set_bool(settings,
|
||||
settings->bools.gamemode_enable, false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR:
|
||||
core_set_poll_type(*setting->value.target.integer);
|
||||
|
@ -17276,7 +17297,7 @@ static bool setting_append_list(
|
|||
#endif
|
||||
#endif
|
||||
|
||||
if (frontend_get_ptr()->set_gamemode)
|
||||
if (frontend_driver_has_gamemode())
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.gamemode_enable,
|
||||
|
|
|
@ -501,6 +501,8 @@ enum msg_hash_enums
|
|||
MSG_CORE_INFO_CACHE_UNSUPPORTED,
|
||||
MSG_LOADING_ENTRY_STATE_FROM,
|
||||
MSG_FOUND_ENTRY_STATE_IN,
|
||||
MSG_FAILED_TO_ENTER_GAMEMODE,
|
||||
MSG_FAILED_TO_ENTER_GAMEMODE_LINUX,
|
||||
|
||||
MENU_LABEL(MENU_XMB_ANIMATION_HORIZONTAL_HIGHLIGHT),
|
||||
MENU_LABEL(MENU_XMB_ANIMATION_MOVE_UP_DOWN),
|
||||
|
|
Loading…
Reference in New Issue