From 3ec21b292ce2fc1f33c734e442d713976884ffc8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 15 Aug 2020 01:18:23 +0200 Subject: [PATCH] Reorder structs, alignment --- gfx/widgets/gfx_widget_achievement_popup.c | 19 ++--- gfx/widgets/gfx_widget_generic_message.c | 2 +- gfx/widgets/gfx_widget_libretro_message.c | 11 ++- .../gfx_widget_load_content_animation.c | 74 +++++++++---------- gfx/widgets/gfx_widget_progress_message.c | 64 ++++++++-------- libretro-common/include/lists/file_list.h | 2 +- 6 files changed, 81 insertions(+), 91 deletions(-) diff --git a/gfx/widgets/gfx_widget_achievement_popup.c b/gfx/widgets/gfx_widget_achievement_popup.c index f59d70f57f..d58b460bfe 100644 --- a/gfx/widgets/gfx_widget_achievement_popup.c +++ b/gfx/widgets/gfx_widget_achievement_popup.c @@ -34,20 +34,17 @@ struct gfx_widget_achievement_popup_state { - gfx_timer_t timer; - float unfold; - float y; - - unsigned width; - unsigned height; - - cheevo_popup queue[CHEEVO_QUEUE_SIZE]; - int queue_read_index; - int queue_write_index; - #ifdef HAVE_THREADS slock_t* queue_lock; #endif + cheevo_popup queue[CHEEVO_QUEUE_SIZE]; /* ptr alignment */ + int queue_read_index; + int queue_write_index; + unsigned width; + unsigned height; + gfx_timer_t timer; /* float alignment */ + float unfold; + float y; }; typedef struct gfx_widget_achievement_popup_state gfx_widget_achievement_popup_state_t; diff --git a/gfx/widgets/gfx_widget_generic_message.c b/gfx/widgets/gfx_widget_generic_message.c index 0033ecfeed..0e01717d49 100644 --- a/gfx/widgets/gfx_widget_generic_message.c +++ b/gfx/widgets/gfx_widget_generic_message.c @@ -22,7 +22,7 @@ struct gfx_widget_generic_message_state { - gfx_timer_t timer; + gfx_timer_t timer; /* float alignment */ float alpha; char message[256]; }; diff --git a/gfx/widgets/gfx_widget_libretro_message.c b/gfx/widgets/gfx_widget_libretro_message.c index 4c8074e109..1d909a06ce 100644 --- a/gfx/widgets/gfx_widget_libretro_message.c +++ b/gfx/widgets/gfx_widget_libretro_message.c @@ -22,20 +22,19 @@ struct gfx_widget_libretro_message_state { - gfx_timer_t timer; - char message[512]; - unsigned width; + gfx_timer_t timer; /* float alignment */ float alpha; + char message[512]; }; typedef struct gfx_widget_libretro_message_state gfx_widget_libretro_message_state_t; static gfx_widget_libretro_message_state_t p_w_libretro_message_st = { - 0.0f, - {'\0'}, 0, - 0.0f + 0.0f, + 0.0f, + {'\0'} }; static gfx_widget_libretro_message_state_t* gfx_widget_libretro_message_get_state(void) diff --git a/gfx/widgets/gfx_widget_load_content_animation.c b/gfx/widgets/gfx_widget_load_content_animation.c index 075d663b4d..3fba4ec6f9 100644 --- a/gfx/widgets/gfx_widget_load_content_animation.c +++ b/gfx/widgets/gfx_widget_load_content_animation.c @@ -50,36 +50,27 @@ enum gfx_widget_load_content_animation_status struct gfx_widget_load_content_animation_state { - enum gfx_widget_load_content_animation_status status; - gfx_timer_t timer; - float alpha; - float slide_offset; - - char content_name[512]; - char system_name[512]; - char icon_directory[PATH_MAX_LENGTH]; - char icon_file[PATH_MAX_LENGTH]; - uintptr_t icon_texture; - bool has_icon; - + unsigned bg_shadow_height; + unsigned margin_shadow_width; + unsigned icon_size; + unsigned content_name_color; + unsigned system_name_color; unsigned content_name_width; unsigned system_name_width; unsigned bg_width; unsigned bg_height; + + gfx_timer_t timer; /* float alignment */ float bg_x; float bg_y; - - unsigned bg_shadow_height; + float alpha; + float slide_offset; float bg_shadow_top_y; float bg_shadow_bottom_y; - - unsigned margin_shadow_width; float margin_shadow_left_x; float margin_shadow_right_x; - - unsigned icon_size; float icon_x_start; float icon_x_end; float icon_y; @@ -101,44 +92,41 @@ struct gfx_widget_load_content_animation_state float margin_shadow_right_color[16]; float icon_color[16]; - unsigned content_name_color; - unsigned system_name_color; + enum gfx_widget_load_content_animation_status status; + + char content_name[512]; + char system_name[512]; + char icon_directory[PATH_MAX_LENGTH]; + char icon_file[PATH_MAX_LENGTH]; + + bool has_icon; }; typedef struct gfx_widget_load_content_animation_state gfx_widget_load_content_animation_state_t; static gfx_widget_load_content_animation_state_t p_w_load_content_animation_st = { - GFX_WIDGET_LOAD_CONTENT_IDLE, /* status */ - 0.0f, /* timer */ - 0.0f, /* alpha */ - 0.0f, /* slide_offset */ - - {'\0'}, /* content_name */ - {'\0'}, /* system_name */ - {'\0'}, /* icon_directory */ - {'\0'}, /* icon_file */ - 0, /* icon_texture */ - false, /* has_icon */ - + 0, /* bg_shadow_height */ + 0, /* margin_shadow_width */ + 0, /* icon_size */ + 0xE0E0E0FF, /* content_name_color */ + 0xCFCFCFFF, /* system_name_color */ 0, /* content_name_width */ 0, /* system_name_width */ 0, /* bg_width */ 0, /* bg_height */ + + 0.0f, /* timer */ 0.0f, /* bg_x */ 0.0f, /* bg_y */ - - 0, /* bg_shadow_height */ + 0.0f, /* alpha */ + 0.0f, /* slide_offset */ 0.0f, /* bg_shadow_top_y */ 0.0f, /* bg_shadow_bottom_y */ - - 0, /* margin_shadow_width */ 0.0f, /* margin_shadow_left_x */ 0.0f, /* margin_shadow_right_x */ - - 0, /* icon_size */ 0.0f, /* icon_x_start */ 0.0f, /* icon_x_end */ 0.0f, /* icon_y */ @@ -160,8 +148,14 @@ static gfx_widget_load_content_animation_state_t p_w_load_content_animation_st = COLOR_HEX_TO_FLOAT(0x000000, 0.0f), /* margin_shadow_right_color */ COLOR_HEX_TO_FLOAT(0xE0E0E0, 1.0f), /* icon_color */ - 0xE0E0E0FF, /* content_name_color */ - 0xCFCFCFFF, /* system_name_color */ + GFX_WIDGET_LOAD_CONTENT_IDLE, /* status */ + + {'\0'}, /* content_name */ + {'\0'}, /* system_name */ + {'\0'}, /* icon_directory */ + {'\0'}, /* icon_file */ + + false /* has_icon */ }; gfx_widget_load_content_animation_state_t *gfx_widget_load_content_animation_get_ptr(void) diff --git a/gfx/widgets/gfx_widget_progress_message.c b/gfx/widgets/gfx_widget_progress_message.c index 1616370643..5b40e338f1 100644 --- a/gfx/widgets/gfx_widget_progress_message.c +++ b/gfx/widgets/gfx_widget_progress_message.c @@ -24,72 +24,72 @@ struct gfx_widget_progress_message_state { - gfx_timer_t timer; - float alpha; - bool active; - unsigned widget_width; unsigned widget_height; - float widget_x; - float widget_y; - unsigned text_width; - float text_x; - float text_y; - unsigned bar_bg_width; unsigned bar_bg_height; - float bar_bg_x; - float bar_bg_y; unsigned bar_max_width; unsigned bar_height; - float bar_x; - float bar_y; unsigned priority; - int8_t progress; - char message[256]; + gfx_timer_t timer; /* float alignment */ + float alpha; + float widget_x; + float widget_y; + float text_x; + float text_y; + float bar_bg_x; + float bar_bg_y; + float bar_x; + float bar_y; float bar_bg_color[16]; float bar_color[16]; float bar_disabled_color[16]; + + int8_t progress; + char message[256]; + bool active; }; typedef struct gfx_widget_progress_message_state gfx_widget_progress_message_state_t; static gfx_widget_progress_message_state_t p_w_progress_message_st = { - 0.0f, /* timer */ - 0.0f, /* alpha */ - false, /* active */ - 0, /* widget_width */ 0, /* widget_height */ - 0.0f, /* widget_x */ - 0.0f, /* widget_y */ - 0, /* text_width */ - 0.0f, /* text_x */ - 0.0f, /* text_y */ - 0, /* bar_bg_width */ 0, /* bar_bg_height */ - 0.0f, /* float bar_bg_x */ - 0.0f, /* float bar_bg_y */ 0, /* bar_max_width */ 0, /* bar_height */ - 0.0f, /* bar_x */ - 0.0f, /* bar_y */ 0, /* priority */ - -1, /* progress */ - {'\0'}, /* message */ + + 0.0f, /* timer */ + 0.0f, /* alpha */ + 0.0f, /* widget_x */ + 0.0f, /* widget_y */ + + 0.0f, /* text_x */ + 0.0f, /* text_y */ + + 0.0f, /* bar_bg_x */ + 0.0f, /* bar_bg_y */ + + 0.0f, /* bar_x */ + 0.0f, /* bar_y */ COLOR_HEX_TO_FLOAT(0x3A3A3A, 1.0f), /* bar_bg_color */ COLOR_HEX_TO_FLOAT(0x198AC6, 1.0f), /* bar_color */ COLOR_HEX_TO_FLOAT(0x000000, 1.0f), /* bar_disabled_color */ + + -1, /* progress */ + {'\0'}, /* message */ + false, /* active */ }; gfx_widget_progress_message_state_t *gfx_widget_progress_message_get_ptr(void) diff --git a/libretro-common/include/lists/file_list.h b/libretro-common/include/lists/file_list.h index 5a486929ae..f1d99369b3 100644 --- a/libretro-common/include/lists/file_list.h +++ b/libretro-common/include/lists/file_list.h @@ -39,9 +39,9 @@ struct item_file char *path; char *label; char *alt; - unsigned type; size_t directory_ptr; size_t entry_idx; + unsigned type; }; typedef struct file_list