From d51b32f662327be62cb7d4924faf30f36d5d95be Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 19 Oct 2019 20:53:17 +0200 Subject: [PATCH] Implement AI Service Pause --- config.def.h | 2 ++ configuration.c | 1 + configuration.h | 1 + intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.h | 4 ++++ menu/cbs/menu_cbs_sublabel.c | 4 ++++ menu/menu_displaylist.c | 1 + menu/menu_setting.c | 15 +++++++++++++++ msg_hash.h | 1 + 9 files changed, 31 insertions(+) diff --git a/config.def.h b/config.def.h index 68ec0d0db3..effd49a690 100644 --- a/config.def.h +++ b/config.def.h @@ -1120,6 +1120,8 @@ static char default_discord_app_id[] = "475456035851599874"; #define DEFAULT_AI_SERVICE_ENABLE true +#define DEFAULT_AI_SERVICE_PAUSE false + #define DEFAULT_AI_SERVICE_MODE 1 #define DEFAULT_AI_SERVICE_URL "http://localhost:4404/" diff --git a/configuration.c b/configuration.c index 4cb0569a74..5db9f819d9 100644 --- a/configuration.c +++ b/configuration.c @@ -1663,6 +1663,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_LOG_TO_FILE); SETTING_BOOL("log_to_file_timestamp", &settings->bools.log_to_file_timestamp, true, DEFAULT_LOG_TO_FILE_TIMESTAMP, false); SETTING_BOOL("ai_service_enable", &settings->bools.ai_service_enable, DEFAULT_AI_SERVICE_ENABLE, false, false); + SETTING_BOOL("ai_service_pause", &settings->bools.ai_service_pause, true, DEFAULT_AI_SERVICE_PAUSE, false); *size = count; diff --git a/configuration.h b/configuration.h index a933cb9c32..b163d1edd7 100644 --- a/configuration.h +++ b/configuration.h @@ -380,6 +380,7 @@ typedef struct settings bool scan_without_core_match; bool ai_service_enable; + bool ai_service_pause; } bools; struct diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index bce97101db..aa24b37f5b 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -2095,3 +2095,5 @@ MSG_HASH(MENU_ENUM_LABEL_LOCALAP_ENABLE, #endif MSG_HASH(MENU_ENUM_LABEL_DRIVER_SWITCH_ENABLE, "driver_switch_enable") +MSG_HASH(MENU_ENUM_LABEL_AI_SERVICE_PAUSE, + "ai_service_pause") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7acfd9e756..41f9caef4b 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -9733,3 +9733,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_DRIVER_SWITCH_ENABLE, "Allow cores to switch the video driver") MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SWITCH_ENABLE, "Allow cores to force switch to a different video driver than is currently loaded.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AI_SERVICE_PAUSE, + "AI Service Pause Toggle") +MSG_HASH(MENU_ENUM_SUBLABEL_AI_SERVICE_PAUSE, + "Pauses core while screen is translated.") diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 7142571e2d..0bd2558ccc 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -129,6 +129,7 @@ default_sublabel_macro(action_bind_sublabel_logging_settings_list, MENU_ default_sublabel_macro(action_bind_sublabel_user_interface_settings_list, MENU_ENUM_SUBLABEL_USER_INTERFACE_SETTINGS) default_sublabel_macro(action_bind_sublabel_ai_service_settings_list, MENU_ENUM_SUBLABEL_AI_SERVICE_SETTINGS) default_sublabel_macro(action_bind_sublabel_ai_service_mode, MENU_ENUM_SUBLABEL_AI_SERVICE_MODE) +default_sublabel_macro(action_bind_sublabel_ai_service_pause, MENU_ENUM_SUBLABEL_AI_SERVICE_PAUSE) default_sublabel_macro(action_bind_sublabel_ai_service_target_lang, MENU_ENUM_SUBLABEL_AI_SERVICE_TARGET_LANG) default_sublabel_macro(action_bind_sublabel_ai_service_source_lang, MENU_ENUM_SUBLABEL_AI_SERVICE_SOURCE_LANG) default_sublabel_macro(action_bind_sublabel_ai_service_url, MENU_ENUM_SUBLABEL_AI_SERVICE_URL) @@ -2718,6 +2719,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_AI_SERVICE_MODE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ai_service_mode); break; + case MENU_ENUM_LABEL_AI_SERVICE_PAUSE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ai_service_pause); + break; case MENU_ENUM_LABEL_AI_SERVICE_ENABLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ai_service_enable); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 512fc2c5e0..4c0389c4e5 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3827,6 +3827,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct {MENU_ENUM_LABEL_AI_SERVICE_MODE, PARSE_ONLY_UINT, true }, {MENU_ENUM_LABEL_AI_SERVICE_URL, PARSE_ONLY_STRING, true }, {MENU_ENUM_LABEL_AI_SERVICE_ENABLE, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_AI_SERVICE_PAUSE, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_AI_SERVICE_SOURCE_LANG, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_AI_SERVICE_TARGET_LANG, PARSE_ONLY_UINT, true}, }; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index b420e98c5f..6bcaf11323 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -13418,6 +13418,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.ai_service_pause, + MENU_ENUM_LABEL_AI_SERVICE_PAUSE, + MENU_ENUM_LABEL_VALUE_AI_SERVICE_PAUSE, + DEFAULT_AI_SERVICE_PAUSE, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + CONFIG_UINT( list, list_info, &settings->uints.ai_service_source_lang, diff --git a/msg_hash.h b/msg_hash.h index 55978ef341..31f6f64223 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1720,6 +1720,7 @@ enum msg_hash_enums MENU_LABEL(AI_SERVICE_SOURCE_LANG), MENU_LABEL(AI_SERVICE_URL), MENU_LABEL(AI_SERVICE_ENABLE), + MENU_LABEL(AI_SERVICE_PAUSE), MENU_LABEL(ON), MENU_LABEL(OFF),