mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 17:04:34 +00:00
(Lakka) Allow editing some boolean, uint and float settings
This commit is contained in:
parent
7f6084fca4
commit
8b01b78123
@ -33,8 +33,6 @@
|
||||
#include "../../../config.def.h"
|
||||
#include "../../../input/keyboard_line.h"
|
||||
|
||||
#include "../../../settings_data.h"
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
||||
#define HAVE_SHADER_MANAGER
|
||||
#endif
|
||||
@ -209,7 +207,7 @@ static int menu_common_setting_set_perf(unsigned setting, unsigned action,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void menu_common_setting_set_current_boolean(
|
||||
void menu_common_setting_set_current_boolean(
|
||||
rarch_setting_t *setting, unsigned action)
|
||||
{
|
||||
if (
|
||||
@ -269,7 +267,7 @@ static void menu_common_setting_set_current_path_selection(
|
||||
setting->change_handler(setting);
|
||||
}
|
||||
|
||||
static void menu_common_setting_set_current_fraction(
|
||||
void menu_common_setting_set_current_fraction(
|
||||
rarch_setting_t *setting, unsigned action)
|
||||
{
|
||||
if (!strcmp(setting->name, "video_refresh_rate_auto"))
|
||||
@ -351,7 +349,7 @@ static void menu_common_setting_set_current_fraction(
|
||||
setting->change_handler(setting);
|
||||
}
|
||||
|
||||
static void menu_common_setting_set_current_unsigned_integer(
|
||||
void menu_common_setting_set_current_unsigned_integer(
|
||||
rarch_setting_t *setting, unsigned id, unsigned action)
|
||||
{
|
||||
if (id == MENU_FILE_LINEFEED)
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define _MENU_COMMON_BACKEND_H
|
||||
|
||||
#include "../menu_common.h"
|
||||
#include "../../../settings_data.h"
|
||||
|
||||
#ifndef GFX_MAX_PARAMETERS
|
||||
#define GFX_MAX_PARAMETERS 64
|
||||
@ -72,4 +73,11 @@ enum
|
||||
};
|
||||
#endif
|
||||
|
||||
void menu_common_setting_set_current_boolean(
|
||||
rarch_setting_t *setting, unsigned action);
|
||||
void menu_common_setting_set_current_fraction(
|
||||
rarch_setting_t *setting, unsigned action);
|
||||
void menu_common_setting_set_current_unsigned_integer(
|
||||
rarch_setting_t *setting, unsigned id, unsigned action);
|
||||
|
||||
#endif
|
||||
|
@ -268,6 +268,7 @@ static int menu_lakka_iterate(unsigned action)
|
||||
{
|
||||
menu_category_t *active_category;
|
||||
menu_item_t *active_item;
|
||||
menu_subitem_t * active_subitem;
|
||||
|
||||
if (!driver.menu)
|
||||
{
|
||||
@ -277,18 +278,36 @@ static int menu_lakka_iterate(unsigned action)
|
||||
|
||||
active_category = NULL;
|
||||
active_item = NULL;
|
||||
active_subitem = NULL;
|
||||
|
||||
active_category = (menu_category_t*)&categories[menu_active_category];
|
||||
|
||||
if (active_category)
|
||||
active_item = (menu_item_t*)&active_category->items[active_category->active_item];
|
||||
|
||||
if (active_item)
|
||||
active_subitem = (menu_subitem_t*)&active_item->subitems[active_item->active_subitem];
|
||||
|
||||
if (!active_category || !active_item)
|
||||
return 0;
|
||||
|
||||
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
|
||||
driver.menu_ctx->set_texture(driver.menu);
|
||||
|
||||
if (action && depth == 1 && menu_active_category == 0
|
||||
&& active_subitem->setting)
|
||||
{
|
||||
if (active_subitem->setting->type == ST_BOOL)
|
||||
menu_common_setting_set_current_boolean(
|
||||
active_subitem->setting, action);
|
||||
else if (active_subitem->setting->type == ST_UINT)
|
||||
menu_common_setting_set_current_unsigned_integer(
|
||||
active_subitem->setting, 0, action);
|
||||
else if (active_subitem->setting->type == ST_FLOAT)
|
||||
menu_common_setting_set_current_fraction(
|
||||
active_subitem->setting, action);
|
||||
}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
@ -351,7 +370,7 @@ static int menu_lakka_iterate(unsigned action)
|
||||
break;
|
||||
|
||||
case MENU_ACTION_OK:
|
||||
if (depth == 1)
|
||||
if (depth == 1 && menu_active_category > 0)
|
||||
{
|
||||
switch (active_item->active_subitem)
|
||||
{
|
||||
|
@ -536,9 +536,12 @@ static void lakka_draw_subitems(int i, int j)
|
||||
}
|
||||
}
|
||||
|
||||
if (subitem->value)
|
||||
if (subitem->setting)
|
||||
{
|
||||
lakka_draw_text(subitem->value,
|
||||
char val[256];
|
||||
setting_data_get_string_representation(subitem->setting, val,
|
||||
sizeof(val));
|
||||
lakka_draw_text(val,
|
||||
margin_left + hspacing * (i+2.25) +
|
||||
all_categories_x + label_margin_left + 400,
|
||||
margin_top + subitem->y + label_margin_top,
|
||||
@ -783,8 +786,7 @@ void lakka_init_settings(void)
|
||||
subitem->y = kk ? vspacing * (kk + under_item_offset)
|
||||
: vspacing * active_item_factor;
|
||||
|
||||
setting_data_get_string_representation(&setting, subitem->value,
|
||||
sizeof(subitem->value));
|
||||
subitem->setting = &setting_data[k];
|
||||
|
||||
kk++;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ typedef struct
|
||||
float alpha;
|
||||
float zoom;
|
||||
float y;
|
||||
char value[256];
|
||||
rarch_setting_t *setting;
|
||||
} menu_subitem_t;
|
||||
|
||||
typedef struct
|
||||
|
Loading…
x
Reference in New Issue
Block a user