From 36e0ff8268ca136069baecfaf374ce18f9a8a75e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 9 Sep 2017 01:10:00 +0200 Subject: [PATCH] Rearrange variables --- gfx/common/gl_common.h | 159 +++++++++++++++++++++----------------- gfx/video_driver.h | 73 ++++++++--------- menu/menu_displaylist.h | 23 +++--- menu/menu_driver.h | 2 +- menu/menu_entries.h | 57 +++++--------- menu/menu_setting.c | 6 +- menu/widgets/menu_entry.h | 4 +- menu/widgets/menu_list.c | 4 +- menu/widgets/menu_list.h | 14 ++-- retroarch.h | 3 +- setting_list.h | 33 ++++---- 11 files changed, 190 insertions(+), 188 deletions(-) diff --git a/gfx/common/gl_common.h b/gfx/common/gl_common.h index bf2858d8ca..949fd99c4e 100644 --- a/gfx/common/gl_common.h +++ b/gfx/common/gl_common.h @@ -36,42 +36,20 @@ RETRO_BEGIN_DECLS +#define MAX_FENCES 4 + typedef struct gl { - int version_major; - int version_minor; + GLenum internal_fmt; + GLenum texture_type; /* RGB565 or ARGB */ + GLenum texture_fmt; + GLenum wrap_mode; bool vsync; - GLuint texture[GFX_MAX_TEXTURES]; - unsigned tex_index; /* For use with PREV. */ - unsigned textures; - struct video_tex_info tex_info; - struct video_tex_info prev_info[GFX_MAX_TEXTURES]; - GLuint tex_mag_filter; - GLuint tex_min_filter; bool tex_mipmap; - - void *empty_buf; - - void *conv_buffer; - struct scaler_ctx scaler; - #ifdef HAVE_FBO - /* Render-to-texture, multipass shaders. */ - GLuint fbo[GFX_MAX_SHADERS]; - GLuint fbo_texture[GFX_MAX_SHADERS]; - struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS]; - struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS]; - int fbo_pass; bool fbo_inited; - bool fbo_feedback_enable; - unsigned fbo_feedback_pass; - GLuint fbo_feedback; - GLuint fbo_feedback_texture; - - GLuint hw_render_fbo[GFX_MAX_TEXTURES]; - GLuint hw_render_depth[GFX_MAX_TEXTURES]; bool hw_render_fbo_init; bool hw_render_depth_init; bool has_srgb_fbo_gles3; @@ -84,27 +62,6 @@ typedef struct gl bool quitting; bool fullscreen; bool keep_aspect; - unsigned rotation; - - struct video_viewport vp; - unsigned vp_out_width; - unsigned vp_out_height; - unsigned last_width[GFX_MAX_TEXTURES]; - unsigned last_height[GFX_MAX_TEXTURES]; - unsigned tex_w, tex_h; - math_matrix_4x4 mvp, mvp_no_rot; - - struct video_coords coords; - const float *vertex_ptr; - const float *white_color_ptr; - - GLuint pbo; - - GLenum internal_fmt; - GLenum texture_type; /* RGB565 or ARGB */ - GLenum texture_fmt; - GLenum wrap_mode; - unsigned base_size; /* 2 or 4 */ #ifdef HAVE_OPENGLES bool support_unpack_row_length; #else @@ -113,43 +70,105 @@ typedef struct gl bool have_full_npot_support; bool egl_images; - video_info_t video_info; - #ifdef HAVE_OVERLAY - unsigned overlays; bool overlay_enable; bool overlay_full_screen; +#endif +#ifdef HAVE_MENU + bool menu_texture_enable; + bool menu_texture_full_screen; +#endif +#ifdef HAVE_GL_SYNC + bool have_sync; +#endif +#ifdef HAVE_GL_ASYNC_READBACK + bool pbo_readback_valid[4]; + bool pbo_readback_enable; +#endif + + int version_major; + int version_minor; + int fbo_pass; + + GLuint texture[GFX_MAX_TEXTURES]; + GLuint tex_mag_filter; + GLuint tex_min_filter; +#ifdef HAVE_FBO + GLuint fbo[GFX_MAX_SHADERS]; + GLuint fbo_texture[GFX_MAX_SHADERS]; + GLuint hw_render_fbo[GFX_MAX_TEXTURES]; + GLuint hw_render_depth[GFX_MAX_TEXTURES]; + GLuint fbo_feedback; + GLuint fbo_feedback_texture; +#endif + GLuint pbo; +#ifdef HAVE_OVERLAY GLuint *overlay_tex; +#endif +#ifdef HAVE_GL_ASYNC_READBACK + GLuint pbo_readback[4]; +#endif +#if defined(HAVE_MENU) + GLuint menu_texture; +#endif + GLuint vao; + + unsigned tex_index; /* For use with PREV. */ + unsigned textures; +#ifdef HAVE_FBO + unsigned fbo_feedback_pass; +#endif + unsigned rotation; + unsigned vp_out_width; + unsigned vp_out_height; + unsigned tex_w; + unsigned tex_h; + unsigned last_width[GFX_MAX_TEXTURES]; + unsigned last_height[GFX_MAX_TEXTURES]; + unsigned base_size; /* 2 or 4 */ +#ifdef HAVE_OVERLAY + unsigned overlays; +#endif +#ifdef HAVE_GL_ASYNC_READBACK + unsigned pbo_readback_index; +#endif +#ifdef HAVE_GL_SYNC + unsigned fence_count; +#endif + +#if defined(HAVE_MENU) + float menu_texture_alpha; +#endif + + void *empty_buf; + void *conv_buffer; + void *readback_buffer_screenshot; + const float *vertex_ptr; + const float *white_color_ptr; +#ifdef HAVE_OVERLAY float *overlay_vertex_coord; float *overlay_tex_coord; float *overlay_color_coord; #endif + struct video_tex_info tex_info; + struct video_tex_info prev_info[GFX_MAX_TEXTURES]; +#ifdef HAVE_FBO + struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS]; + struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS]; +#endif #ifdef HAVE_GL_ASYNC_READBACK - /* PBOs used for asynchronous viewport readbacks. */ - GLuint pbo_readback[4]; - bool pbo_readback_valid[4]; - bool pbo_readback_enable; - unsigned pbo_readback_index; struct scaler_ctx pbo_readback_scaler; #endif - void *readback_buffer_screenshot; - -#if defined(HAVE_MENU) - GLuint menu_texture; - bool menu_texture_enable; - bool menu_texture_full_screen; - float menu_texture_alpha; -#endif + struct video_viewport vp; + math_matrix_4x4 mvp, mvp_no_rot; + struct video_coords coords; + struct scaler_ctx scaler; + video_info_t video_info; #ifdef HAVE_GL_SYNC -#define MAX_FENCES 4 - bool have_sync; GLsync fences[MAX_FENCES]; - unsigned fence_count; #endif - - GLuint vao; } gl_t; bool gl_load_luts(const struct video_shader *generic_shader, diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 9d6fe4787b..1bf7965e5e 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -139,21 +139,21 @@ enum shader_program_type struct shader_program_info { - void *data; + bool is_file; const char *vertex; const char *fragment; const char *combined; unsigned idx; - bool is_file; + void *data; }; struct uniform_info { - unsigned type; /* shader uniform type */ bool enabled; int32_t location; int32_t count; + unsigned type; /* shader uniform type */ struct { @@ -252,18 +252,17 @@ typedef struct shader_backend typedef struct video_shader_ctx_init { enum rarch_shader_type shader_type; + const char *path; const shader_backend_t *shader; + void *data; struct { bool core_context_enabled; } gl; - void *data; - const char *path; } video_shader_ctx_init_t; typedef struct video_shader_ctx_params { - void *data; unsigned width; unsigned height; unsigned tex_width; @@ -271,11 +270,12 @@ typedef struct video_shader_ctx_params unsigned out_width; unsigned out_height; unsigned frame_counter; + unsigned fbo_info_cnt; + void *data; const void *info; const void *prev_info; const void *feedback_info; const void *fbo_info; - unsigned fbo_info_cnt; } video_shader_ctx_params_t; typedef struct video_shader_ctx_coords @@ -335,6 +335,18 @@ typedef void (*gfx_ctx_proc_t)(void); typedef struct video_info { + /* Launch in fullscreen mode instead of windowed mode. */ + bool fullscreen; + + /* Start with V-Sync enabled. */ + bool vsync; + + /* If true, the output image should have the aspect ratio + * as set in aspect_ratio. */ + bool force_aspect; + + bool font_enable; + /* Width of window. * If fullscreen mode is requested, * a width of 0 means the resolution of the @@ -347,19 +359,27 @@ typedef struct video_info */ unsigned height; - /* Launch in fullscreen mode instead of windowed mode. */ - bool fullscreen; - - /* Start with V-Sync enabled. */ - bool vsync; - - /* If true, the output image should have the aspect ratio - * as set in aspect_ratio. */ - bool force_aspect; - unsigned swap_interval; - bool font_enable; +#ifdef GEKKO + bool vfilter; +#endif + + /* If true, applies bilinear filtering to the image, + * otherwise nearest filtering. */ + bool smooth; + + bool is_threaded; + + /* Use 32bit RGBA rather than native RGB565/XBGR1555. + * + * XRGB1555 format is 16-bit and has byte ordering: 0RRRRRGGGGGBBBBB, + * in native endian. + * + * ARGB8888 is AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB, native endian. + * Alpha channel should be disregarded. + * */ + bool rgb32; #ifdef GEKKO /* TODO - we can't really have driver system-specific @@ -370,15 +390,8 @@ typedef struct video_info /* Wii-specific settings. Ignored for everything else. */ unsigned viwidth; - bool vfilter; #endif - /* If true, applies bilinear filtering to the image, - * otherwise nearest filtering. */ - bool smooth; - - bool is_threaded; - /* * input_scale defines the maximum size of the picture that will * ever be used with the frame callback. @@ -389,16 +402,6 @@ typedef struct video_info * Maximum input size: RARCH_SCALE_BASE * input_scale */ unsigned input_scale; - - /* Use 32bit RGBA rather than native RGB565/XBGR1555. - * - * XRGB1555 format is 16-bit and has byte ordering: 0RRRRRGGGGGBBBBB, - * in native endian. - * - * ARGB8888 is AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB, native endian. - * Alpha channel should be disregarded. - * */ - bool rgb32; #ifndef RARCH_INTERNAL uintptr_t parent; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 3a6d4d0664..3a63a98a48 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -167,49 +167,46 @@ enum menu_displaylist_ctl_state typedef struct menu_displaylist_info { + enum msg_hash_enums enum_idx; /* should the displaylist be sorted by alphabet? */ bool need_sort; bool need_refresh; bool need_entries_refresh; bool need_push; - /* should we clear the displaylist before we push * entries onto it? */ bool need_clear; - bool push_builtin_cores; - /* Should a 'download core' entry be pushed onto the list? * This will be set to true in case there are no currently * installed cores. */ bool download_core; - /* does the navigation index need to be cleared to 0 (first entry) ? */ bool need_navigation_clear; - file_list_t *list; - file_list_t *menu_list; + char path[PATH_MAX_LENGTH]; char path_b[PATH_MAX_LENGTH]; char path_c[PATH_MAX_LENGTH]; - char label[255]; - uint32_t label_hash; char exts[PATH_MAX_LENGTH]; + char label[255]; unsigned type; unsigned type_default; - size_t directory_ptr; unsigned flags; - enum msg_hash_enums enum_idx; + uint32_t label_hash; + size_t directory_ptr; + file_list_t *list; + file_list_t *menu_list; rarch_setting_t *setting; } menu_displaylist_info_t; typedef struct menu_displaylist_ctx_parse_entry { - void *data; - menu_displaylist_info_t *info; - const char *info_label; enum msg_hash_enums enum_idx; enum menu_displaylist_parse_type parse_type; bool add_empty_entry; + const char *info_label; + void *data; + menu_displaylist_info_t *info; } menu_displaylist_ctx_parse_entry_t; typedef struct menu_displaylist_ctx_entry diff --git a/menu/menu_driver.h b/menu/menu_driver.h index ba7af08853..e372230de3 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -357,7 +357,6 @@ typedef struct typedef struct menu_display_ctx_draw { - enum menu_display_prim_type prim_type; float x; float y; float *color; @@ -369,6 +368,7 @@ typedef struct menu_display_ctx_draw size_t vertex_count; struct video_coords *coords; void *matrix_data; + enum menu_display_prim_type prim_type; struct { unsigned id; diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 1cdbad3bfb..758faad60b 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -54,80 +54,63 @@ enum menu_entries_ctl_state typedef struct menu_file_list_cbs { - rarch_setting_t *setting; enum msg_hash_enums enum_idx; + const char *action_iterate_ident; + const char *action_deferred_push_ident; + const char *action_select_ident; + const char *action_get_title_ident; + const char *action_ok_ident; + const char *action_cancel_ident; + const char *action_scan_ident; + const char *action_right_ident; + const char *action_start_ident; + const char *action_info_ident; + const char *action_content_list_switch_ident; + const char *action_left_ident; + const char *action_refresh_ident; + const char *action_up_ident; + const char *action_label_ident; + const char *action_sublabel_ident; + const char *action_down_ident; + const char *action_get_value_ident; + + rarch_setting_t *setting; int (*action_iterate)(const char *label, unsigned action); - const char *action_iterate_ident; - int (*action_deferred_push)(menu_displaylist_info_t *info); - const char *action_deferred_push_ident; - int (*action_select)(const char *path, const char *label, unsigned type, size_t idx); - const char *action_select_ident; - int (*action_get_title)(const char *path, const char *label, unsigned type, char *s, size_t len); - const char *action_get_title_ident; - int (*action_ok)(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx); - const char *action_ok_ident; - int (*action_cancel)(const char *path, const char *label, unsigned type, size_t idx); - const char *action_cancel_ident; - int (*action_scan)(const char *path, const char *label, unsigned type, size_t idx); - const char *action_scan_ident; - int (*action_start)(unsigned type, const char *label); - const char *action_start_ident; - int (*action_info)(unsigned type, const char *label); - const char *action_info_ident; - int (*action_content_list_switch)(void *data, void *userdata, const char *path, const char *label, unsigned type); - const char *action_content_list_switch_ident; - int (*action_left)(unsigned type, const char *label, bool wraparound); - const char *action_left_ident; - int (*action_right)(unsigned type, const char *label, bool wraparound); - const char *action_right_ident; - int (*action_refresh)(file_list_t *list, file_list_t *menu_list); - const char *action_refresh_ident; - int (*action_up)(unsigned type, const char *label); - const char *action_up_ident; - int (*action_label)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len); - const char *action_label_ident; - int (*action_sublabel)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len); - const char *action_sublabel_ident; - int (*action_down)(unsigned type, const char *label); - const char *action_down_ident; - void (*action_get_value)(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, char *s, size_t len, const char *entry_label, const char *path, char *path_buf, size_t path_buf_size); - const char *action_get_value_ident; - } menu_file_list_cbs_t; size_t menu_entries_get_end(void); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index c360d0d7c1..372ad628ac 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -118,13 +118,13 @@ enum settings_list_type struct bool_entry { + bool default_value; + bool *target; + uint32_t flags; enum msg_hash_enums name_enum_idx; enum msg_hash_enums SHORT_enum_idx; 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 diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 01e6180a1f..af8b8b5b8b 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -45,16 +45,16 @@ enum menu_entry_type typedef struct menu_entry { + enum msg_hash_enums enum_idx; char path[255]; char label[255]; char sublabel[255]; char rich_label[255]; char value[255]; - size_t entry_idx; - enum msg_hash_enums enum_idx; unsigned idx; unsigned type; unsigned spacing; + size_t entry_idx; } menu_entry_t; enum menu_entry_type menu_entry_get_type(uint32_t i); diff --git a/menu/widgets/menu_list.c b/menu/widgets/menu_list.c index 5cd4d14292..3606475a93 100644 --- a/menu/widgets/menu_list.c +++ b/menu/widgets/menu_list.c @@ -23,10 +23,10 @@ struct menu_list { - file_list_t **menu_stack; size_t menu_stack_size; - file_list_t **selection_buf; size_t selection_buf_size; + file_list_t **menu_stack; + file_list_t **selection_buf; }; void menu_list_free_list(file_list_t *list) diff --git a/menu/widgets/menu_list.h b/menu/widgets/menu_list.h index 3776abd349..dc11a65783 100644 --- a/menu/widgets/menu_list.h +++ b/menu/widgets/menu_list.h @@ -36,18 +36,18 @@ enum menu_list_type typedef struct menu_ctx_list { - file_list_t *list; - size_t list_size; - const char *path; - char *fullpath; - const char *label; - size_t idx; - unsigned entry_type; enum menu_list_type type; + const char *path; + char *fullpath; + const char *label; + unsigned entry_type; unsigned action; + size_t idx; size_t selection; size_t size; + size_t list_size; void *entry; + file_list_t *list; } menu_ctx_list_t; typedef struct menu_list menu_list_t; diff --git a/retroarch.h b/retroarch.h index faf8b5a1df..2ae46f113e 100644 --- a/retroarch.h +++ b/retroarch.h @@ -195,7 +195,6 @@ enum runloop_action struct rarch_main_wrap { - int argc; char **argv; const char *content_path; const char *sram_path; @@ -204,8 +203,8 @@ struct rarch_main_wrap const char *libretro_path; bool verbose; bool no_content; - bool touched; + int argc; }; typedef struct rarch_resolution diff --git a/setting_list.h b/setting_list.h index 88d40519f9..fc6e2019ea 100644 --- a/setting_list.h +++ b/setting_list.h @@ -90,16 +90,12 @@ struct rarch_setting_group_info struct rarch_setting { - enum msg_hash_enums enum_idx; - enum msg_hash_enums enum_value_idx; - enum setting_type type; - - bool dont_use_enum_idx_representation; - - uint32_t size; + bool dont_use_enum_idx_representation; + bool enforce_minrange; + bool enforce_maxrange; + const char *rounding_fraction; const char *name; - uint32_t name_hash; const char *short_description; const char *group; const char *subgroup; @@ -109,6 +105,12 @@ struct rarch_setting uint8_t index; uint8_t index_offset; + unsigned bind_type; + uint32_t size; + uint32_t name_hash; + + float step; + double min; double max; @@ -130,10 +132,10 @@ struct rarch_setting union { bool boolean; + const char *string; int integer; unsigned int unsigned_integer; float fraction; - const char *string; const struct retro_keybind *keybind; } default_value; @@ -142,10 +144,10 @@ struct rarch_setting union { bool *boolean; + char *string; int *integer; unsigned int *unsigned_integer; float *fraction; - char *string; struct retro_keybind *keybind; } target; } value; @@ -175,12 +177,11 @@ struct rarch_setting const char *on_label; } boolean; - unsigned bind_type; - enum setting_type browser_selection_type; - float step; - const char *rounding_fraction; - bool enforce_minrange; - bool enforce_maxrange; + enum setting_type browser_selection_type; + enum msg_hash_enums enum_idx; + enum msg_hash_enums enum_value_idx; + enum setting_type type; + }; struct rarch_setting_info