mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
Cleanups
This commit is contained in:
parent
79f1166c6e
commit
330d8dc59e
@ -81,11 +81,11 @@ struct gfx_fbo_scale
|
||||
enum gfx_scale_type type_y;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
unsigned abs_x;
|
||||
unsigned abs_y;
|
||||
bool fp_fbo;
|
||||
bool srgb_fbo;
|
||||
bool valid;
|
||||
unsigned abs_x;
|
||||
unsigned abs_y;
|
||||
};
|
||||
|
||||
struct video_shader_parameter
|
||||
@ -113,19 +113,19 @@ struct video_shader_pass
|
||||
|
||||
char alias[64];
|
||||
struct gfx_fbo_scale fbo;
|
||||
unsigned filter;
|
||||
enum gfx_wrap_type wrap;
|
||||
unsigned frame_count_mod;
|
||||
bool mipmap;
|
||||
unsigned filter;
|
||||
unsigned frame_count_mod;
|
||||
};
|
||||
|
||||
struct video_shader_lut
|
||||
{
|
||||
char id[64];
|
||||
char path[PATH_MAX_LENGTH];
|
||||
unsigned filter;
|
||||
enum gfx_wrap_type wrap;
|
||||
bool mipmap;
|
||||
unsigned filter;
|
||||
};
|
||||
|
||||
/* This is pretty big, shouldn't be put on the stack.
|
||||
@ -134,27 +134,27 @@ struct video_shader
|
||||
{
|
||||
enum rarch_shader_type type;
|
||||
|
||||
bool modern; /* Only used for XML shaders. */
|
||||
char prefix[64];
|
||||
|
||||
unsigned passes;
|
||||
struct video_shader_pass pass[GFX_MAX_SHADERS];
|
||||
|
||||
unsigned luts;
|
||||
struct video_shader_lut lut[GFX_MAX_TEXTURES];
|
||||
|
||||
struct video_shader_parameter parameters[GFX_MAX_PARAMETERS];
|
||||
unsigned num_parameters;
|
||||
|
||||
unsigned variables;
|
||||
struct state_tracker_uniform_info variable[GFX_MAX_VARIABLES];
|
||||
char script_class[512];
|
||||
char script_path[PATH_MAX_LENGTH];
|
||||
char *script; /* Dynamically allocated. Must be free'd. Only used by XML. */
|
||||
char script_class[512];
|
||||
|
||||
bool modern; /* Only used for XML shaders. */
|
||||
|
||||
unsigned passes;
|
||||
unsigned luts;
|
||||
unsigned num_parameters;
|
||||
unsigned variables;
|
||||
/* If < 0, no feedback pass is used. Otherwise,
|
||||
* the FBO after pass #N is passed a texture to next frame. */
|
||||
int feedback_pass;
|
||||
|
||||
struct video_shader_pass pass[GFX_MAX_SHADERS];
|
||||
|
||||
struct video_shader_lut lut[GFX_MAX_TEXTURES];
|
||||
|
||||
struct video_shader_parameter parameters[GFX_MAX_PARAMETERS];
|
||||
struct state_tracker_uniform_info variable[GFX_MAX_VARIABLES];
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -44,24 +44,22 @@ enum state_ram_type
|
||||
|
||||
struct state_tracker_uniform_info
|
||||
{
|
||||
char id[64];
|
||||
uint32_t addr;
|
||||
enum state_tracker_type type;
|
||||
enum state_ram_type ram_type;
|
||||
char id[64];
|
||||
uint16_t mask;
|
||||
uint16_t equal;
|
||||
uint32_t addr;
|
||||
};
|
||||
|
||||
struct state_tracker_info
|
||||
{
|
||||
const uint8_t *wram;
|
||||
|
||||
const struct state_tracker_uniform_info *info;
|
||||
unsigned info_elem;
|
||||
|
||||
const char *script;
|
||||
const char *script_class;
|
||||
bool script_is_file;
|
||||
const uint8_t *wram;
|
||||
unsigned info_elem;
|
||||
const struct state_tracker_uniform_info *info;
|
||||
};
|
||||
|
||||
struct state_tracker_uniform
|
||||
|
@ -227,7 +227,8 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||
selection = MAX(MIN(selection, (menu_entries_get_size() - 1)), 0);
|
||||
|
||||
menu_entry_get(&entry, 0, selection, NULL, false);
|
||||
ret = menu_entry_action(&entry, (unsigned)selection, (enum menu_action)action);
|
||||
ret = menu_entry_action(&entry,
|
||||
(unsigned)selection, (enum menu_action)action);
|
||||
|
||||
if (ret)
|
||||
goto end;
|
||||
|
@ -344,31 +344,31 @@ typedef struct
|
||||
char scratch_buf[PATH_MAX_LENGTH];
|
||||
char scratch2_buf[PATH_MAX_LENGTH];
|
||||
|
||||
/* path to the currently loaded database playlist file. */
|
||||
char db_playlist_file[PATH_MAX_LENGTH];
|
||||
|
||||
uint64_t state;
|
||||
|
||||
struct
|
||||
{
|
||||
char msg[1024];
|
||||
} menu_state;
|
||||
|
||||
/* path to the currently loaded database playlist file. */
|
||||
char db_playlist_file[PATH_MAX_LENGTH];
|
||||
} menu_handle_t;
|
||||
|
||||
typedef struct menu_display_ctx_draw
|
||||
{
|
||||
enum menu_display_prim_type prim_type;
|
||||
float x;
|
||||
float y;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
struct video_coords *coords;
|
||||
void *matrix_data;
|
||||
uintptr_t texture;
|
||||
enum menu_display_prim_type prim_type;
|
||||
float *color;
|
||||
const float *vertex;
|
||||
const float *tex_coord;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
uintptr_t texture;
|
||||
size_t vertex_count;
|
||||
struct video_coords *coords;
|
||||
void *matrix_data;
|
||||
struct
|
||||
{
|
||||
unsigned id;
|
||||
@ -380,12 +380,12 @@ typedef struct menu_display_ctx_draw
|
||||
|
||||
typedef struct menu_display_ctx_rotate_draw
|
||||
{
|
||||
math_matrix_4x4 *matrix;
|
||||
bool scale_enable;
|
||||
float rotation;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
float scale_z;
|
||||
bool scale_enable;
|
||||
math_matrix_4x4 *matrix;
|
||||
} menu_display_ctx_rotate_draw_t;
|
||||
|
||||
typedef struct menu_display_ctx_coord_draw
|
||||
@ -536,21 +536,21 @@ typedef struct menu_ctx_pointer
|
||||
unsigned x;
|
||||
unsigned y;
|
||||
unsigned ptr;
|
||||
menu_file_list_cbs_t *cbs;
|
||||
menu_entry_t *entry;
|
||||
unsigned action;
|
||||
int retcode;
|
||||
menu_file_list_cbs_t *cbs;
|
||||
menu_entry_t *entry;
|
||||
} menu_ctx_pointer_t;
|
||||
|
||||
typedef struct menu_ctx_bind
|
||||
{
|
||||
menu_file_list_cbs_t *cbs;
|
||||
const char *path;
|
||||
const char *label;
|
||||
unsigned type;
|
||||
size_t idx;
|
||||
uint32_t label_hash;
|
||||
size_t idx;
|
||||
int retcode;
|
||||
menu_file_list_cbs_t *cbs;
|
||||
} menu_ctx_bind_t;
|
||||
|
||||
/**
|
||||
|
@ -82,25 +82,59 @@
|
||||
|
||||
#include "../tasks/tasks_internal.h"
|
||||
|
||||
enum settings_list_type
|
||||
{
|
||||
SETTINGS_LIST_NONE = 0,
|
||||
SETTINGS_LIST_MAIN_MENU,
|
||||
SETTINGS_LIST_DRIVERS,
|
||||
SETTINGS_LIST_CORE,
|
||||
SETTINGS_LIST_CONFIGURATION,
|
||||
SETTINGS_LIST_LOGGING,
|
||||
SETTINGS_LIST_SAVING,
|
||||
SETTINGS_LIST_REWIND,
|
||||
SETTINGS_LIST_VIDEO,
|
||||
SETTINGS_LIST_AUDIO,
|
||||
SETTINGS_LIST_INPUT,
|
||||
SETTINGS_LIST_INPUT_HOTKEY,
|
||||
SETTINGS_LIST_RECORDING,
|
||||
SETTINGS_LIST_FRAME_THROTTLING,
|
||||
SETTINGS_LIST_FONT,
|
||||
SETTINGS_LIST_OVERLAY,
|
||||
SETTINGS_LIST_MENU,
|
||||
SETTINGS_LIST_MENU_FILE_BROWSER,
|
||||
SETTINGS_LIST_MULTIMEDIA,
|
||||
SETTINGS_LIST_USER_INTERFACE,
|
||||
SETTINGS_LIST_PLAYLIST,
|
||||
SETTINGS_LIST_CHEEVOS,
|
||||
SETTINGS_LIST_CORE_UPDATER,
|
||||
SETTINGS_LIST_NETPLAY,
|
||||
SETTINGS_LIST_LAKKA_SERVICES,
|
||||
SETTINGS_LIST_USER,
|
||||
SETTINGS_LIST_USER_ACCOUNTS,
|
||||
SETTINGS_LIST_USER_ACCOUNTS_CHEEVOS,
|
||||
SETTINGS_LIST_DIRECTORY,
|
||||
SETTINGS_LIST_PRIVACY
|
||||
};
|
||||
|
||||
struct bool_entry
|
||||
{
|
||||
bool *target;
|
||||
enum msg_hash_enums name_enum_idx;
|
||||
enum msg_hash_enums SHORT_enum_idx;
|
||||
bool default_value;
|
||||
enum msg_hash_enums off_enum_idx;
|
||||
enum msg_hash_enums on_enum_idx;
|
||||
bool *target;
|
||||
bool default_value;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct string_options_entry
|
||||
{
|
||||
char *target;
|
||||
size_t len;
|
||||
enum msg_hash_enums name_enum_idx;
|
||||
enum msg_hash_enums SHORT_enum_idx;
|
||||
const char *default_value;
|
||||
const char *values;
|
||||
char *target;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
@ -597,7 +631,7 @@ void menu_settings_list_current_add_range(
|
||||
float min, float max, float step,
|
||||
bool enforce_minrange_enable, bool enforce_maxrange_enable)
|
||||
{
|
||||
unsigned idx = list_info->index - 1;
|
||||
unsigned idx = list_info->index - 1;
|
||||
|
||||
(*list)[idx].min = min;
|
||||
(*list)[idx].step = step;
|
||||
@ -951,16 +985,14 @@ void setting_get_string_representation(void *data, char *s, size_t len)
|
||||
**/
|
||||
static int setting_action_start_bind_device(void *data)
|
||||
{
|
||||
uint32_t index_offset;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!setting || !settings)
|
||||
return -1;
|
||||
|
||||
index_offset = setting->index_offset;
|
||||
|
||||
configuration_set_uint(settings, settings->uints.input_joypad_map[index_offset], index_offset);
|
||||
configuration_set_uint(settings,
|
||||
settings->uints.input_joypad_map[index_offset], setting->index_offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1410,8 +1442,9 @@ static int setting_action_ok_bind_defaults(void *data, bool wraparound)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_st_float_video_refresh_rate_auto(void *data,
|
||||
char *s, size_t len)
|
||||
static void
|
||||
setting_get_string_representation_st_float_video_refresh_rate_auto(
|
||||
void *data, char *s, size_t len)
|
||||
{
|
||||
double video_refresh_rate = 0.0;
|
||||
double deviation = 0.0;
|
||||
@ -1811,7 +1844,7 @@ static void overlay_enable_toggle_change_handler(void *data)
|
||||
#ifdef HAVE_LAKKA
|
||||
static void systemd_service_toggle(const char *path, char *unit, bool enable)
|
||||
{
|
||||
int pid = fork();
|
||||
int pid = fork();
|
||||
char* args[] = {(char*)"systemctl", NULL, NULL, NULL};
|
||||
|
||||
if (enable)
|
||||
@ -1835,6 +1868,7 @@ static void ssh_enable_toggle_change_handler(void *data)
|
||||
{
|
||||
bool enable = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings && settings->bools.ssh_enable)
|
||||
enable = true;
|
||||
|
||||
@ -1846,6 +1880,7 @@ static void samba_enable_toggle_change_handler(void *data)
|
||||
{
|
||||
bool enable = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings && settings->bools.samba_enable)
|
||||
enable = true;
|
||||
|
||||
@ -1857,6 +1892,7 @@ static void bluetooth_enable_toggle_change_handler(void *data)
|
||||
{
|
||||
bool enable = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (settings && settings->bools.bluetooth_enable)
|
||||
enable = true;
|
||||
|
||||
@ -1865,40 +1901,6 @@ static void bluetooth_enable_toggle_change_handler(void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
enum settings_list_type
|
||||
{
|
||||
SETTINGS_LIST_NONE = 0,
|
||||
SETTINGS_LIST_MAIN_MENU,
|
||||
SETTINGS_LIST_DRIVERS,
|
||||
SETTINGS_LIST_CORE,
|
||||
SETTINGS_LIST_CONFIGURATION,
|
||||
SETTINGS_LIST_LOGGING,
|
||||
SETTINGS_LIST_SAVING,
|
||||
SETTINGS_LIST_REWIND,
|
||||
SETTINGS_LIST_VIDEO,
|
||||
SETTINGS_LIST_AUDIO,
|
||||
SETTINGS_LIST_INPUT,
|
||||
SETTINGS_LIST_INPUT_HOTKEY,
|
||||
SETTINGS_LIST_RECORDING,
|
||||
SETTINGS_LIST_FRAME_THROTTLING,
|
||||
SETTINGS_LIST_FONT,
|
||||
SETTINGS_LIST_OVERLAY,
|
||||
SETTINGS_LIST_MENU,
|
||||
SETTINGS_LIST_MENU_FILE_BROWSER,
|
||||
SETTINGS_LIST_MULTIMEDIA,
|
||||
SETTINGS_LIST_USER_INTERFACE,
|
||||
SETTINGS_LIST_PLAYLIST,
|
||||
SETTINGS_LIST_CHEEVOS,
|
||||
SETTINGS_LIST_CORE_UPDATER,
|
||||
SETTINGS_LIST_NETPLAY,
|
||||
SETTINGS_LIST_LAKKA_SERVICES,
|
||||
SETTINGS_LIST_USER,
|
||||
SETTINGS_LIST_USER_ACCOUNTS,
|
||||
SETTINGS_LIST_USER_ACCOUNTS_CHEEVOS,
|
||||
SETTINGS_LIST_DIRECTORY,
|
||||
SETTINGS_LIST_PRIVACY
|
||||
};
|
||||
|
||||
static bool setting_append_list_input_player_options(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
@ -2025,7 +2027,8 @@ static bool setting_append_list_input_player_options(
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_libretro_device_type;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_libretro_device;
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, (enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_LIBRETRO_DEVICE + user));
|
||||
menu_settings_list_current_add_enum_idx(list, list_info,
|
||||
(enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_LIBRETRO_DEVICE + user));
|
||||
|
||||
CONFIG_UINT_ALT(
|
||||
list, list_info,
|
||||
@ -2046,7 +2049,8 @@ static bool setting_append_list_input_player_options(
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_analog_dpad_mode;
|
||||
menu_settings_list_current_add_enum_idx(list, list_info, (enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE + user));
|
||||
menu_settings_list_current_add_enum_idx(list, list_info,
|
||||
(enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE + user));
|
||||
|
||||
CONFIG_ACTION_ALT(
|
||||
list, list_info,
|
||||
@ -2891,7 +2895,7 @@ static bool setting_append_list(
|
||||
break;
|
||||
case SETTINGS_LIST_CONFIGURATION:
|
||||
{
|
||||
unsigned i;
|
||||
uint8_t i;
|
||||
struct bool_entry bool_entries[6];
|
||||
START_GROUP(list, list_info, &group_info,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONFIGURATION_SETTINGS), parent_group);
|
||||
@ -3028,7 +3032,7 @@ static bool setting_append_list(
|
||||
break;
|
||||
case SETTINGS_LIST_SAVING:
|
||||
{
|
||||
unsigned i;
|
||||
uint8_t i;
|
||||
struct bool_entry bool_entries[11];
|
||||
|
||||
START_GROUP(list, list_info, &group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS), parent_group);
|
||||
@ -7083,20 +7087,20 @@ bool menu_setting_free(void *data)
|
||||
if (values & 1)
|
||||
switch (1 << n)
|
||||
{
|
||||
case SD_FREE_FLAG_VALUES:
|
||||
free((void*)setting->values);
|
||||
setting->values = NULL;
|
||||
break;
|
||||
case SD_FREE_FLAG_NAME:
|
||||
free((void*)setting->name);
|
||||
setting->name = NULL;
|
||||
break;
|
||||
case SD_FREE_FLAG_SHORT:
|
||||
free((void*)setting->short_description);
|
||||
setting->short_description = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case SD_FREE_FLAG_VALUES:
|
||||
free((void*)setting->values);
|
||||
setting->values = NULL;
|
||||
break;
|
||||
case SD_FREE_FLAG_NAME:
|
||||
free((void*)setting->name);
|
||||
setting->name = NULL;
|
||||
break;
|
||||
case SD_FREE_FLAG_SHORT:
|
||||
free((void*)setting->short_description);
|
||||
setting->short_description = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
@ -306,13 +306,13 @@ bool menu_shader_manager_save_preset(
|
||||
const char *basename, bool apply, bool fullpath)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
bool ret = false;
|
||||
char buffer[PATH_MAX_LENGTH];
|
||||
char config_directory[PATH_MAX_LENGTH];
|
||||
char preset_path[PATH_MAX_LENGTH];
|
||||
unsigned d, type = RARCH_SHADER_NONE;
|
||||
const char *dirs[3] = {0};
|
||||
config_file_t *conf = NULL;
|
||||
bool ret = false;
|
||||
struct video_shader *shader = menu_shader_get();
|
||||
|
||||
buffer[0] = config_directory[0] = '\0';
|
||||
@ -469,13 +469,15 @@ int menu_shader_manager_clear_num_passes(void)
|
||||
int menu_shader_manager_clear_parameter(unsigned i)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct video_shader_parameter *param = menu_shader_manager_get_parameters(i);
|
||||
struct video_shader_parameter *param =
|
||||
menu_shader_manager_get_parameters(i);
|
||||
|
||||
if (!param)
|
||||
return 0;
|
||||
|
||||
param->current = param->initial;
|
||||
param->current = MIN(MAX(param->minimum, param->current), param->maximum);
|
||||
param->current = MIN(MAX(param->minimum,
|
||||
param->current), param->maximum);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@ -484,7 +486,8 @@ int menu_shader_manager_clear_parameter(unsigned i)
|
||||
int menu_shader_manager_clear_pass_filter(unsigned i)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(i);
|
||||
struct video_shader_pass *shader_pass =
|
||||
menu_shader_manager_get_pass(i);
|
||||
|
||||
if (!shader_pass)
|
||||
return -1;
|
||||
@ -500,7 +503,8 @@ int menu_shader_manager_clear_pass_filter(unsigned i)
|
||||
void menu_shader_manager_clear_pass_scale(unsigned i)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(i);
|
||||
struct video_shader_pass *shader_pass =
|
||||
menu_shader_manager_get_pass(i);
|
||||
|
||||
if (!shader_pass)
|
||||
return;
|
||||
@ -514,7 +518,8 @@ void menu_shader_manager_clear_pass_scale(unsigned i)
|
||||
void menu_shader_manager_clear_pass_path(unsigned i)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(i);
|
||||
struct video_shader_pass *shader_pass =
|
||||
menu_shader_manager_get_pass(i);
|
||||
|
||||
if (shader_pass)
|
||||
*shader_pass->source.path = '\0';
|
||||
@ -535,7 +540,7 @@ unsigned menu_shader_manager_get_type(const void *data)
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
const struct video_shader *shader = (const struct video_shader*)data;
|
||||
/* All shader types must be the same, or we cannot use it. */
|
||||
unsigned i = 0;
|
||||
uint8_t i = 0;
|
||||
|
||||
if (!shader)
|
||||
return RARCH_SHADER_NONE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user