Move cfg_vals from settings_list, expand settings_dumper

cfg_vals aren't needed for most settings

F_TABLE_SETTING, F_CHOICE_SETTING, F_BOOL_SETTING

can use cfg_vals but only a few custom settings use it otherwise
for these settings we define F_HAS_CFGVALS and use the setting union instead (as these all use UNUSED)

noticed that settings_dumper missed most cfg values so didn't show text setting values

saves ~300 bytes

Change-Id: Ie504c8cfe2a6cf471117c3afe5cf9a770a7f1784
This commit is contained in:
William Wilgus 2024-11-10 13:50:17 -05:00
parent 3e95b13b7a
commit 7288d9e5d2
10 changed files with 128 additions and 79 deletions

View file

@ -477,7 +477,7 @@ static void val_to_selection(const struct settings_list *setting, int oldvalue,
bool option_screen(const struct settings_list *setting,
struct viewport parent[NB_SCREENS],
bool use_temp_var, unsigned char* option_title)
bool use_temp_var, const unsigned char* option_title)
{
int action;
bool done = false;
@ -490,7 +490,7 @@ bool option_screen(const struct settings_list *setting,
int var_type = setting->flags&F_T_MASK;
void (*function)(int) = NULL;
char *title;
const char *title = NULL;
if (var_type == F_T_INT || var_type == F_T_UINT)
{
variable = use_temp_var ? &temp_var: (int*)setting->setting;
@ -508,8 +508,11 @@ bool option_screen(const struct settings_list *setting,
gui_synclist_init(&lists, value_setting_get_name_cb,
(void*)setting, false, 1, parent);
if (setting->lang_id == -1)
title = (char*)setting->cfg_vals;
else
{
title = setting_get_cfgvals(setting);
}
if (!title)
title = P2STR(option_title);
gui_synclist_set_title(&lists, title, Icon_Questionmark);

View file

@ -32,7 +32,7 @@ enum {
bool option_screen(const struct settings_list *setting,
struct viewport parent[NB_SCREENS],
bool use_temp_var, unsigned char* option_title);
bool use_temp_var, const unsigned char* option_title);
#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) || defined(HAVE_TOUCHSCREEN)
void option_select_next_val(const struct settings_list *setting,

View file

@ -1606,7 +1606,7 @@ static int touchregion_setup_setting(struct skin_element *element, int param_no,
break;
case F_T_INT:
case F_T_UINT:
if (setting->cfg_vals == NULL)
if (setting_get_cfgvals(s->setting) == NULL)
{
touchsetting->value.number = atoi(text);
}

View file

@ -1447,7 +1447,7 @@ const char *get_token_value(struct gui_wps *gwps,
* on 16 bits ...
* but this is pretty useless anyway */
numeric_ret = *(int*)s->setting + 1;
else if (s->cfg_vals == NULL)
else if (setting_get_cfgvals(s->setting) == NULL)
/* %?St|name|<1st choice|2nd choice|...> */
numeric_ret = (*(int*)s->setting-s->int_setting->min)
/s->int_setting->step + 1;