From e35ed84de96d2dcf42c71dc9e4769ae25cc81641 Mon Sep 17 00:00:00 2001
From: twinaphex <libretro@gmail.com>
Date: Sun, 21 Mar 2021 11:46:27 +0100
Subject: [PATCH] (Menu) Cut down on config_get_ptr calls

---
 menu/drivers/ozone/ozone.c         | 100 ++++++++++++++++++-----------
 menu/drivers/ozone/ozone.h         |  34 ++++++++--
 menu/drivers/ozone/ozone_entries.c |   6 +-
 menu/drivers/ozone/ozone_sidebar.c |  34 ++++++----
 menu/drivers/xmb.c                 |   6 +-
 5 files changed, 117 insertions(+), 63 deletions(-)

diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c
index b081184647..6c11b6a992 100644
--- a/menu/drivers/ozone/ozone.c
+++ b/menu/drivers/ozone/ozone.c
@@ -305,14 +305,14 @@ static bool ozone_is_current_entry_settings(size_t current_selection)
 }
 
 static enum menu_action ozone_parse_menu_entry_action(
-      ozone_handle_t *ozone, enum menu_action action)
+      ozone_handle_t *ozone, settings_t *settings,
+      enum menu_action action)
 {
    uintptr_t tag;
    int new_selection;
    enum menu_action new_action   = action;
    file_list_t *selection_buf    = NULL;
    unsigned horizontal_list_size = 0;
-   settings_t *settings;
    bool menu_navigation_wraparound_enable;
    bool is_current_entry_settings;
    size_t selection;
@@ -359,7 +359,6 @@ static enum menu_action ozone_parse_menu_entry_action(
    selection                  = menu_navigation_get_selection();
    selection_total            = menu_entries_get_size();
 
-   settings                            = config_get_ptr();
    menu_navigation_wraparound_enable   = settings->bools.menu_navigation_wraparound_enable;
 
    /* Don't wiggle left or right if the current entry is a setting. This is
@@ -471,7 +470,7 @@ static enum menu_action ozone_parse_menu_entry_action(
             break;
          }
 
-         ozone_go_to_sidebar(ozone, tag);
+         ozone_go_to_sidebar(ozone, settings, tag);
 
          new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE;
          break;
@@ -495,7 +494,7 @@ static enum menu_action ozone_parse_menu_entry_action(
             break;
          }
 
-         ozone_leave_sidebar(ozone, tag);
+         ozone_leave_sidebar(ozone, settings, tag);
 
          new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_LABEL;
          break;
@@ -503,7 +502,7 @@ static enum menu_action ozone_parse_menu_entry_action(
          ozone->cursor_mode = false;
          if (ozone->cursor_in_sidebar)
          {
-            ozone_leave_sidebar(ozone, tag);
+            ozone_leave_sidebar(ozone, settings, tag);
             new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_LABEL;
             break;
          }
@@ -534,7 +533,7 @@ static enum menu_action ozone_parse_menu_entry_action(
 
          if (menu_entries_get_stack_size(0) == 1)
          {
-            ozone_go_to_sidebar(ozone, tag);
+            ozone_go_to_sidebar(ozone, settings, tag);
             new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE;
          }
          break;
@@ -619,9 +618,11 @@ static int ozone_menu_entry_action(
    menu_entry_t new_entry;
    ozone_handle_t *ozone       = (ozone_handle_t*)userdata;
    menu_entry_t *entry_ptr     = entry;
+   settings_t *settings        = config_get_ptr();
    size_t selection            = i;
    /* Process input action */
-   enum menu_action new_action = ozone_parse_menu_entry_action(ozone, action);
+   enum menu_action new_action = ozone_parse_menu_entry_action(ozone, settings,
+         action);
    /* Check whether current selection has changed
     * (due to automatic on screen entry selection...) */
    size_t new_selection        = menu_navigation_get_selection();
@@ -747,7 +748,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
    gfx_thumbnail_set_fade_duration(-1.0f);
    gfx_thumbnail_set_fade_missing(false);
 
-   ozone_sidebar_update_collapse(ozone, false);
+   ozone_sidebar_update_collapse(ozone, settings, false);
 
    ozone->system_tab_end                        = 0;
    ozone->tabs[ozone->system_tab_end]           = OZONE_SYSTEM_TAB_MAIN;
@@ -791,7 +792,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
 
    file_list_initialize(&ozone->horizontal_list);
 
-   ozone_init_horizontal_list(ozone);
+   ozone_init_horizontal_list(ozone, settings);
 
    /* Theme */
    if (settings->bools.menu_use_preferred_system_color_theme)
@@ -1056,7 +1057,10 @@ static void ozone_cache_footer_labels(ozone_handle_t *ozone)
 }
 
 /* Determines the size of all menu elements */
-static void ozone_set_layout(ozone_handle_t *ozone, bool is_threaded)
+static void ozone_set_layout(
+      ozone_handle_t *ozone, 
+      settings_t *settings,
+      bool is_threaded)
 {
    char s1[PATH_MAX_LENGTH];
    char font_path[PATH_MAX_LENGTH];
@@ -1198,7 +1202,7 @@ static void ozone_set_layout(ozone_handle_t *ozone, bool is_threaded)
     * > ozone_refresh_sidebars() cancels any existing
     *   animations and 'force updates' the affected
     *   variables with newly scaled values */
-   ozone_refresh_sidebars(ozone, ozone->last_height);
+   ozone_refresh_sidebars(ozone, settings, ozone->last_height);
 
    /* Entry dimensions must be recalculated after
     * updating menu layout */
@@ -1209,12 +1213,13 @@ static void ozone_context_reset(void *data, bool is_threaded)
 {
    unsigned i;
    ozone_handle_t *ozone = (ozone_handle_t*) data;
+   settings_t *settings  = config_get_ptr();
 
    if (ozone)
    {
       ozone->has_all_assets = true;
 
-      ozone_set_layout(ozone, is_threaded);
+      ozone_set_layout(ozone, settings, is_threaded);
 
       /* Textures init */
       for (i = 0; i < OZONE_TEXTURE_LAST; i++)
@@ -1724,6 +1729,7 @@ static void ozone_render(void *data,
    ozone_handle_t *ozone            = (ozone_handle_t*)data;
    gfx_display_t *p_disp            = disp_get_ptr();
    gfx_animation_t          *p_anim = anim_get_ptr();
+   settings_t             *settings = config_get_ptr();
    if (!ozone)
       return;
 
@@ -1741,13 +1747,13 @@ static void ozone_render(void *data,
 
       /* Note: We don't need a full context reset here
        * > Just rescale layout, and reset frame time counter */
-      ozone_set_layout(ozone, video_driver_is_threaded());
+      ozone_set_layout(ozone, settings, video_driver_is_threaded());
       video_driver_monitor_reset();
    }
 
    if (ozone->need_compute)
    {
-      ozone_compute_entries_position(ozone, entries_end);
+      ozone_compute_entries_position(ozone, settings, entries_end);
       ozone->need_compute = false;
    }
 
@@ -1870,11 +1876,11 @@ static void ozone_render(void *data,
          if (ozone->pointer_in_sidebar &&
              !ozone->last_pointer_in_sidebar &&
              !ozone->cursor_in_sidebar)
-            ozone_go_to_sidebar(ozone, animation_tag);
+            ozone_go_to_sidebar(ozone, settings, animation_tag);
          else if (!ozone->pointer_in_sidebar &&
                   ozone->last_pointer_in_sidebar &&
                   ozone->cursor_in_sidebar)
-            ozone_leave_sidebar(ozone, animation_tag);
+            ozone_leave_sidebar(ozone, settings, animation_tag);
       }
 
       /* Update scrolling - must be done first, otherwise
@@ -2015,9 +2021,7 @@ static void ozone_render(void *data,
 
                   /* If we are currently in the sidebar, leave it */
                   if (ozone->cursor_in_sidebar)
-                  {
-                     ozone_leave_sidebar(ozone, animation_tag);
-                  }
+                     ozone_leave_sidebar(ozone, settings, animation_tag);
                   /* If this is a playlist, must update thumbnails */
                   else if (ozone->is_playlist && (ozone->depth == 1))
                   {
@@ -2103,6 +2107,7 @@ static void ozone_draw_header(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
@@ -2114,7 +2119,6 @@ static void ozone_draw_header(
    gfx_animation_ctx_ticker_smooth_t ticker_smooth;
    static const char* const ticker_spacer = OZONE_TICKER_SPACER;
    unsigned ticker_x_offset  = 0;
-   settings_t *settings      = config_get_ptr();
    unsigned timedate_offset  = 0;
    bool use_smooth_ticker    = settings->bools.menu_ticker_smooth;
    float scale_factor        = ozone->last_scale_factor;
@@ -2961,7 +2965,11 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
          );
 
    /* Header, footer */
-   ozone_draw_header(ozone, p_disp, p_anim,
+   ozone_draw_header(
+         ozone,
+         p_disp,
+         p_anim,
+         settings,
          userdata,
          video_width,
          video_height,
@@ -2981,6 +2989,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
             ozone,
             p_disp,
             p_anim,
+            settings,
             userdata,
             video_width,
             video_height,
@@ -3002,6 +3011,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
          ozone,
          p_disp,
          p_anim,
+         settings,
          userdata,
          video_width,
          video_height,
@@ -3019,6 +3029,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
             ozone,
             p_disp,
             p_anim,
+            settings,
             userdata,
             video_width,
             video_height,
@@ -3035,6 +3046,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
       ozone_draw_thumbnail_bar(ozone,
             p_disp,
             p_anim,
+            settings,
             userdata,
             video_width,
             video_height,
@@ -3191,7 +3203,7 @@ static void ozone_animation_end(void *userdata)
    ozone->animations.cursor_alpha   = 1.0f;
 }
 
-static void ozone_list_open(ozone_handle_t *ozone)
+static void ozone_list_open(ozone_handle_t *ozone, settings_t *settings)
 {
    struct gfx_animation_ctx_entry entry;
    uintptr_t sidebar_tag        = (uintptr_t)&ozone->sidebar_offset;
@@ -3212,7 +3224,7 @@ static void ozone_list_open(ozone_handle_t *ozone)
    gfx_animation_push(&entry);
 
    /* Sidebar animation */
-   ozone_sidebar_update_collapse(ozone, true);
+   ozone_sidebar_update_collapse(ozone, settings, true);
 
    if (ozone->depth == 1)
    {
@@ -3244,8 +3256,10 @@ static void ozone_list_open(ozone_handle_t *ozone)
    }
 }
 
-static void ozone_populate_entries(void *data, const char *path, const char *label, unsigned k)
+static void ozone_populate_entries(void *data,
+      const char *path, const char *label, unsigned k)
 {
+   settings_t *settings  = NULL;
    ozone_handle_t *ozone = (ozone_handle_t*) data;
 
    int new_depth;
@@ -3254,6 +3268,8 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
    if (!ozone)
       return;
 
+   settings              = config_get_ptr();
+
    ozone_set_header(ozone);
 
    if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL))
@@ -3301,7 +3317,7 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
                {
                   gfx_animation_kill_by_tag(&animation_tag);
                   ozone->empty_playlist = true;
-                  ozone_go_to_sidebar(ozone, animation_tag);
+                  ozone_go_to_sidebar(ozone, settings, animation_tag);
                }
             }
 
@@ -3328,11 +3344,9 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
    ozone->is_quick_menu       = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS)) ||
                                 string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_SETTINGS));
 
-   if (ozone->categories_selection_ptr == ozone->categories_active_idx_old)
-   {
-      if (animate)
-         ozone_list_open(ozone);
-   }
+   if (animate)
+      if (ozone->categories_selection_ptr == ozone->categories_active_idx_old)
+         ozone_list_open(ozone, settings);
 
    /* Thumbnails
     * > Note: Leave current thumbnails loaded when
@@ -3372,13 +3386,16 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
 
 static void ozone_toggle(void *userdata, bool menu_on)
 {
+   settings_t *settings  = NULL;
    bool tmp              = false;
    ozone_handle_t *ozone = (ozone_handle_t*) userdata;
 
    if (!ozone)
       return;
 
-   tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL);
+   settings              = config_get_ptr();
+   tmp                   = !menu_entries_ctl(
+         MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL);
 
    if (tmp)
       menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
@@ -3391,7 +3408,7 @@ static void ozone_toggle(void *userdata, bool menu_on)
       ozone->sidebar_offset = 0.0f;
    }
 
-   ozone_sidebar_update_collapse(ozone, false);
+   ozone_sidebar_update_collapse(ozone, settings, false);
 }
 
 static bool ozone_menu_init_list(void *data)
@@ -3600,8 +3617,10 @@ static int ozone_environ_cb(enum menu_environ_cb type, void *data, void *userdat
       case MENU_ENVIRON_RESET_HORIZONTAL_LIST:
          if (!ozone)
             return -1;
-
-         ozone_refresh_horizontal_list(ozone);
+         {
+            settings_t *settings              = config_get_ptr();
+            ozone_refresh_horizontal_list(ozone, settings);
+         }
          break;
       default:
          return -1;
@@ -3676,6 +3695,7 @@ static int ozone_pointer_up(void *userdata,
    uintptr_t sidebar_tag             = (uintptr_t)selection_buf;
    size_t selection                  = menu_navigation_get_selection();
    size_t entries_end                = menu_entries_get_size();
+   settings_t *settings              = config_get_ptr();
 
    if (!ozone)
       return -1;
@@ -3735,7 +3755,7 @@ static int ozone_pointer_up(void *userdata,
                         selection, MENU_ACTION_SELECT);
 
                /* If we currently in the sidebar, leave it */
-               ozone_leave_sidebar(ozone, sidebar_tag);
+               ozone_leave_sidebar(ozone, settings, sidebar_tag);
             }
             else
             {
@@ -3749,7 +3769,7 @@ static int ozone_pointer_up(void *userdata,
 
                /* If we are currently in the sidebar, leave it */
                if (ozone->cursor_in_sidebar)
-                  ozone_leave_sidebar(ozone, sidebar_tag);
+                  ozone_leave_sidebar(ozone, settings, sidebar_tag);
                /* If this is a playlist and the selection
                 * has changed, must update thumbnails */
                else if (ozone->is_playlist &&
@@ -3778,9 +3798,11 @@ static int ozone_pointer_up(void *userdata,
          {
             /* If cursor is not in sidebar, return to sidebar */
             if (!ozone->cursor_in_sidebar)
-               ozone_go_to_sidebar(ozone, sidebar_tag);
+               ozone_go_to_sidebar(ozone, settings, sidebar_tag);
             /* Otherwise, select current category */
-            else if (ozone->pointer_categories_selection != ozone->categories_selection_ptr)
+            else if (
+                     ozone->pointer_categories_selection 
+                  != ozone->categories_selection_ptr)
             {
                unsigned horizontal_list_size = (unsigned)ozone->horizontal_list.size;
 
diff --git a/menu/drivers/ozone/ozone.h b/menu/drivers/ozone/ozone.h
index 9266a36ec7..fb4d6e0f8a 100644
--- a/menu/drivers/ozone/ozone.h
+++ b/menu/drivers/ozone/ozone.h
@@ -30,6 +30,8 @@ typedef struct ozone_handle ozone_handle_t;
 #include "../../gfx/gfx_thumbnail_path.h"
 #include "../../gfx/gfx_thumbnail.h"
 
+#include "../../configuration.h"
+
 #define ANIMATION_PUSH_ENTRY_DURATION  166
 #define ANIMATION_CURSOR_DURATION      133
 #define ANIMATION_CURSOR_PULSE         500
@@ -327,6 +329,7 @@ void ozone_draw_entries(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
@@ -341,6 +344,7 @@ void ozone_draw_sidebar(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
@@ -358,13 +362,19 @@ unsigned ozone_get_sidebar_height(ozone_handle_t *ozone);
 
 unsigned ozone_get_selected_sidebar_y_position(ozone_handle_t *ozone);
 
-void ozone_leave_sidebar(ozone_handle_t *ozone, uintptr_t tag);
+void ozone_leave_sidebar(ozone_handle_t *ozone,
+      settings_t *settings,
+      uintptr_t tag);
 
-void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag);
+void ozone_go_to_sidebar(ozone_handle_t *ozone,
+      settings_t *settings,
+      uintptr_t tag);
 
-void ozone_refresh_horizontal_list(ozone_handle_t *ozone);
+void ozone_refresh_horizontal_list(ozone_handle_t *ozone,
+      settings_t *settings);
 
-void ozone_init_horizontal_list(ozone_handle_t *ozone);
+void ozone_init_horizontal_list(ozone_handle_t *ozone,
+      settings_t *settings);
 
 void ozone_context_destroy_horizontal_list(ozone_handle_t *ozone);
 
@@ -378,13 +388,22 @@ void ozone_free_list_nodes(file_list_t *list, bool actiondata);
 
 bool ozone_is_playlist(ozone_handle_t *ozone, bool depth);
 
-void ozone_compute_entries_position(ozone_handle_t *ozone, size_t entries_end);
+void ozone_compute_entries_position(
+      ozone_handle_t *ozone,
+      settings_t *settings,
+      size_t entries_end);
 
 void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node_t *node);
 
-void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation);
+void ozone_sidebar_update_collapse(
+      ozone_handle_t *ozone,
+      settings_t *settings,
+      bool allow_animation);
 
-void ozone_refresh_sidebars(ozone_handle_t *ozone, unsigned video_height);
+void ozone_refresh_sidebars(
+      ozone_handle_t *ozone,
+      settings_t *settings,
+      unsigned video_height);
 
 void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist, bool allow_animation);
 
@@ -392,6 +411,7 @@ void ozone_draw_thumbnail_bar(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
diff --git a/menu/drivers/ozone/ozone_entries.c b/menu/drivers/ozone/ozone_entries.c
index 79e8351cb8..da20d675e2 100644
--- a/menu/drivers/ozone/ozone_entries.c
+++ b/menu/drivers/ozone/ozone_entries.c
@@ -325,6 +325,7 @@ void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node
 
 void ozone_compute_entries_position(
       ozone_handle_t *ozone,
+      settings_t *settings,
       size_t entries_end)
 {
    /* Compute entries height and adjust scrolling if needed */
@@ -334,7 +335,6 @@ void ozone_compute_entries_position(
    file_list_t *selection_buf    = NULL;
    int entry_padding             = ozone_get_entries_padding(ozone, false);
    float scale_factor            = ozone->last_scale_factor;
-   settings_t          *settings = config_get_ptr();
    bool menu_show_sublabels      = settings->bools.menu_show_sublabels;
 
    menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
@@ -478,6 +478,7 @@ void ozone_draw_entries(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
@@ -492,7 +493,6 @@ void ozone_draw_entries(
    size_t i;
    float bottom_boundary;
    unsigned video_info_height, video_info_width;
-   settings_t    *settings           = config_get_ptr();
    bool menu_show_sublabels          = settings->bools.menu_show_sublabels;
    bool use_smooth_ticker            = settings->bools.menu_ticker_smooth;
    enum gfx_animation_ticker_type 
@@ -921,6 +921,7 @@ void ozone_draw_thumbnail_bar(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
@@ -1144,7 +1145,6 @@ void ozone_draw_thumbnail_bar(
       gfx_animation_ctx_ticker_smooth_t ticker_smooth;
       static const char* const ticker_spacer = OZONE_TICKER_SPACER;
       unsigned ticker_x_offset               = 0;
-      settings_t *settings                   = config_get_ptr();
       bool scroll_content_metadata           = settings->bools.ozone_scroll_content_metadata;
       bool use_smooth_ticker                 = settings->bools.menu_ticker_smooth;
       enum gfx_animation_ticker_type 
diff --git a/menu/drivers/ozone/ozone_sidebar.c b/menu/drivers/ozone/ozone_sidebar.c
index db03a646f2..1fa8c64356 100644
--- a/menu/drivers/ozone/ozone_sidebar.c
+++ b/menu/drivers/ozone/ozone_sidebar.c
@@ -160,6 +160,7 @@ void ozone_draw_sidebar(
       ozone_handle_t *ozone,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       void *userdata,
       unsigned video_width,
       unsigned video_height,
@@ -176,7 +177,6 @@ void ozone_draw_sidebar(
    static const char* const
       ticker_spacer                  = OZONE_TICKER_SPACER;
    unsigned ticker_x_offset          = 0;
-   settings_t *settings              = config_get_ptr();
    uint32_t text_alpha               = ozone->animations.sidebar_text_alpha 
       * 255.0f;
    bool use_smooth_ticker            = settings->bools.menu_ticker_smooth;
@@ -490,7 +490,8 @@ console_iterate:
             video_width, video_height);
 }
 
-void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag)
+void ozone_go_to_sidebar(ozone_handle_t *ozone, settings_t *settings,
+      uintptr_t tag)
 {
    struct gfx_animation_ctx_entry entry;
 
@@ -511,10 +512,12 @@ void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag)
 
    gfx_animation_push(&entry);
 
-   ozone_sidebar_update_collapse(ozone, true);
+   ozone_sidebar_update_collapse(ozone, settings, true);
 }
 
-void ozone_leave_sidebar(ozone_handle_t *ozone, uintptr_t tag)
+void ozone_leave_sidebar(ozone_handle_t *ozone,
+      settings_t *settings,
+      uintptr_t tag)
 {
    struct gfx_animation_ctx_entry entry;
 
@@ -540,7 +543,7 @@ void ozone_leave_sidebar(ozone_handle_t *ozone, uintptr_t tag)
 
    gfx_animation_push(&entry);
 
-   ozone_sidebar_update_collapse(ozone, true);
+   ozone_sidebar_update_collapse(ozone, settings, true);
 }
 
 unsigned ozone_get_selected_sidebar_y_position(ozone_handle_t *ozone)
@@ -557,11 +560,13 @@ unsigned ozone_get_sidebar_height(ozone_handle_t *ozone)
          (ozone->horizontal_list.size > 0 ? ozone->dimensions.sidebar_entry_padding_vertical + ozone->dimensions.spacer_1px : 0);
 }
 
-void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation)
+void ozone_sidebar_update_collapse(
+      ozone_handle_t *ozone,
+      settings_t *settings,
+      bool allow_animation)
 {
    /* Collapse sidebar if needed */
    struct gfx_animation_ctx_entry entry;
-   settings_t *settings      = config_get_ptr();
    bool is_playlist          = ozone_is_playlist(ozone, false);
    uintptr_t tag             = (uintptr_t)&ozone->sidebar_collapsed;
    bool collapse_sidebar     = settings->bools.ozone_collapse_sidebar;
@@ -685,9 +690,11 @@ void ozone_sidebar_goto(ozone_handle_t *ozone, unsigned new_selection)
       ozone_change_tab(ozone, ozone_system_tabs_idx[ozone->tabs[new_selection]], ozone_system_tabs_type[ozone->tabs[new_selection]]);
 }
 
-void ozone_refresh_sidebars(ozone_handle_t *ozone, unsigned video_height)
+void ozone_refresh_sidebars(
+      ozone_handle_t *ozone,
+      settings_t *settings,
+      unsigned video_height)
 {
-   settings_t *settings                 = config_get_ptr();
    uintptr_t collapsed_tag              = (uintptr_t)&ozone->sidebar_collapsed;
    uintptr_t offset_tag                 = (uintptr_t)&ozone->sidebar_offset;
    uintptr_t thumbnail_tag              = (uintptr_t)&ozone->show_thumbnail_bar;
@@ -771,12 +778,12 @@ void ozone_change_tab(ozone_handle_t *ozone,
    menu_driver_deferred_push_content_list(selection_buf);
 }
 
-void ozone_init_horizontal_list(ozone_handle_t *ozone)
+void ozone_init_horizontal_list(ozone_handle_t *ozone,
+      settings_t *settings)
 {
    menu_displaylist_info_t info;
    size_t list_size;
    size_t i;
-   settings_t *settings              = config_get_ptr();
    const char *dir_playlist          = settings->paths.directory_playlist;
    bool menu_content_show_playlists  = settings->bools.menu_content_show_playlists;
    bool ozone_truncate_playlist_name = settings->bools.ozone_truncate_playlist_name;
@@ -863,7 +870,8 @@ void ozone_init_horizontal_list(ozone_handle_t *ozone)
       file_list_sort_on_alt(&ozone->horizontal_list);
 }
 
-void ozone_refresh_horizontal_list(ozone_handle_t *ozone)
+void ozone_refresh_horizontal_list(ozone_handle_t *ozone,
+      settings_t *settings)
 {
    ozone_context_destroy_horizontal_list(ozone);
    ozone_free_list_nodes(&ozone->horizontal_list, false);
@@ -872,7 +880,7 @@ void ozone_refresh_horizontal_list(ozone_handle_t *ozone)
    menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
 
    file_list_initialize(&ozone->horizontal_list);
-   ozone_init_horizontal_list(ozone);
+   ozone_init_horizontal_list(ozone, settings);
 
    ozone_context_reset_horizontal_list(ozone);
 }
diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c
index da45f694b1..9cdbc5eb26 100644
--- a/menu/drivers/xmb.c
+++ b/menu/drivers/xmb.c
@@ -3032,6 +3032,7 @@ static int xmb_draw_item(
       gfx_display_t   *p_disp,
       gfx_animation_t *p_anim,
       gfx_display_ctx_driver_t *dispctx,
+      settings_t *settings,
       unsigned video_width,
       unsigned video_height,
       bool xmb_shadows_enable,
@@ -3059,7 +3060,6 @@ static int xmb_draw_item(
    bool do_draw_text                   = false;
    unsigned ticker_limit               = 35 * scale_mod[0];
    unsigned line_ticker_width          = 45 * scale_mod[3];
-   settings_t *settings                = config_get_ptr();
    xmb_node_t *   node                 = (xmb_node_t*)list->list[i].userdata;
    bool use_smooth_ticker              = settings->bools.menu_ticker_smooth;
    enum gfx_animation_ticker_type
@@ -3480,6 +3480,7 @@ static void xmb_draw_items(
       void *userdata,
       gfx_display_t *p_disp,
       gfx_animation_t *p_anim,
+      settings_t *settings,
       unsigned video_width,
       unsigned video_height,
       bool xmb_shadows_enable,
@@ -3542,6 +3543,7 @@ static void xmb_draw_items(
             p_disp,
             p_anim,
             dispctx,
+            settings,
             video_width,
             video_height,
             xmb_shadows_enable,
@@ -5238,6 +5240,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
          userdata,
          p_disp,
          p_anim,
+         settings,
          video_width,
          video_height,
          xmb_shadows_enable,
@@ -5257,6 +5260,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
          userdata,
          p_disp,
          p_anim,
+         settings,
          video_width,
          video_height,
          xmb_shadows_enable,