diff --git a/cheat_manager.c b/cheat_manager.c
index 8ad497771d..b3eb45251e 100644
--- a/cheat_manager.c
+++ b/cheat_manager.c
@@ -45,6 +45,7 @@
 #include "msg_hash.h"
 #include "configuration.h"
 #include "retroarch.h"
+#include "runloop.h"
 #include "dynamic.h"
 #include "core.h"
 #include "verbosity.h"
@@ -693,17 +694,17 @@ static bool cheat_manager_get_game_specific_filename(
 {
    char s1[PATH_MAX_LENGTH];
    struct retro_system_info system_info;
-   global_t *global        = global_get_ptr();
-   const char *core_name   = NULL;
-   const char *game_name   = NULL;
+   runloop_state_t *runloop_st = runloop_state_get_ptr();
+   const char *core_name       = NULL;
+   const char *game_name       = NULL;
 
-   s1[0]                   = '\0';
+   s1[0]                       = '\0';
 
-   if (!global || !core_get_system_info(&system_info))
+   if (!core_get_system_info(&system_info))
       return false;
 
    core_name = system_info.library_name;
-   game_name = path_basename_nocompression(global->name.cheatfile);
+   game_name = path_basename_nocompression(runloop_st->name.cheatfile);
 
    if (string_is_empty(path_cheat_database) ||
          string_is_empty(core_name) ||
diff --git a/command.c b/command.c
index 22cda2500e..27823f200e 100644
--- a/command.c
+++ b/command.c
@@ -1037,13 +1037,13 @@ bool command_event_resize_windowed_scale(settings_t *settings,
 
 bool command_event_save_auto_state(
       bool savestate_auto_save,
-      global_t *global,
       const enum rarch_core_type current_core_type)
 {
+   runloop_state_t *runloop_st = runloop_state_get_ptr();
    bool ret                    = false;
    char savestate_name_auto[PATH_MAX_LENGTH];
 
-   if (!global || !savestate_auto_save)
+   if (!savestate_auto_save)
       return false;
    if (current_core_type == CORE_TYPE_DUMMY)
       return false;
@@ -1058,7 +1058,8 @@ bool command_event_save_auto_state(
 
    savestate_name_auto[0]      = '\0';
 
-   fill_pathname_noext(savestate_name_auto, global->name.savestate,
+   fill_pathname_noext(savestate_name_auto,
+         runloop_st->name.savestate,
          ".auto", sizeof(savestate_name_auto));
 
    ret = content_save_state((const char*)savestate_name_auto, true, true);
@@ -1099,9 +1100,10 @@ void command_event_init_cheats(
 }
 #endif
 
-void command_event_load_auto_state(global_t *global)
+void command_event_load_auto_state(void)
 {
    char savestate_name_auto[PATH_MAX_LENGTH];
+   runloop_state_t *runloop_st     = runloop_state_get_ptr();
    bool ret                        = false;
 #ifdef HAVE_CHEEVOS
    if (rcheevos_hardcore_active())
@@ -1114,7 +1116,7 @@ void command_event_load_auto_state(global_t *global)
 
    savestate_name_auto[0] = '\0';
 
-   fill_pathname_noext(savestate_name_auto, global->name.savestate,
+   fill_pathname_noext(savestate_name_auto, runloop_st->name.savestate,
          ".auto", sizeof(savestate_name_auto));
 
    if (!path_is_valid(savestate_name_auto))
@@ -1130,9 +1132,7 @@ void command_event_load_auto_state(global_t *global)
          );
 }
 
-void command_event_set_savestate_auto_index(
-      settings_t *settings,
-      const global_t *global)
+void command_event_set_savestate_auto_index(settings_t *settings)
 {
    size_t i;
    char state_dir[PATH_MAX_LENGTH];
@@ -1140,21 +1140,22 @@ void command_event_set_savestate_auto_index(
 
    struct string_list *dir_list      = NULL;
    unsigned max_idx                  = 0;
+   runloop_state_t *runloop_st       = runloop_state_get_ptr();
    bool savestate_auto_index         = settings->bools.savestate_auto_index;
    bool show_hidden_files            = settings->bools.show_hidden_files;
 
-   if (!global || !savestate_auto_index)
+   if (!savestate_auto_index)
       return;
 
    state_dir[0] = state_base[0]      = '\0';
 
-   /* Find the file in the same directory as global->savestate_name
+   /* Find the file in the same directory as runloop_st->savestate_name
     * with the largest numeral suffix.
     *
     * E.g. /foo/path/content.state, will try to find
     * /foo/path/content.state%d, where %d is the largest number available.
     */
-   fill_pathname_basedir(state_dir, global->name.savestate,
+   fill_pathname_basedir(state_dir, runloop_st->name.savestate,
          sizeof(state_dir));
 
    dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN, NULL,
@@ -1163,7 +1164,7 @@ void command_event_set_savestate_auto_index(
    if (!dir_list)
       return;
 
-   fill_pathname_base(state_base, global->name.savestate,
+   fill_pathname_base(state_base, runloop_st->name.savestate,
          sizeof(state_base));
 
    for (i = 0; i < dir_list->size; i++)
@@ -1197,7 +1198,6 @@ void command_event_set_savestate_auto_index(
 }
 
 void command_event_set_savestate_garbage_collect(
-      const global_t *global,
       unsigned max_to_keep,
       bool show_hidden_files
       )
@@ -1205,6 +1205,7 @@ void command_event_set_savestate_garbage_collect(
    size_t i, cnt = 0;
    char state_dir[PATH_MAX_LENGTH];
    char state_base[PATH_MAX_LENGTH];
+   runloop_state_t *runloop_st       = runloop_state_get_ptr();
 
    struct string_list *dir_list      = NULL;
    unsigned min_idx                  = UINT_MAX;
@@ -1215,7 +1216,7 @@ void command_event_set_savestate_garbage_collect(
 
    /* Similar to command_event_set_savestate_auto_index(),
     * this will find the lowest numbered save-state */
-   fill_pathname_basedir(state_dir, global->name.savestate,
+   fill_pathname_basedir(state_dir, runloop_st->name.savestate,
          sizeof(state_dir));
 
    dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN, NULL,
@@ -1224,7 +1225,7 @@ void command_event_set_savestate_garbage_collect(
    if (!dir_list)
       return;
 
-   fill_pathname_base(state_base, global->name.savestate,
+   fill_pathname_base(state_base, runloop_st->name.savestate,
          sizeof(state_base));
 
    for (i = 0; i < dir_list->size; i++)
@@ -1466,7 +1467,6 @@ bool command_event_main_state(unsigned cmd)
    retro_ctx_size_info_t info;
    char msg[128];
    char state_path[16384];
-   const global_t *global      = global_get_ptr();
    settings_t *settings        = config_get_ptr();
    bool ret                    = false;
    bool push_msg               = true;
@@ -1500,7 +1500,7 @@ bool command_event_main_state(unsigned cmd)
 
                /* Clean up excess savestates if necessary */
                if (savestate_auto_index && (savestate_max_keep > 0))
-                  command_event_set_savestate_garbage_collect(global,
+                  command_event_set_savestate_garbage_collect(
                         settings->uints.savestate_max_keep,
                         settings->bools.show_hidden_files
                         );
diff --git a/command.h b/command.h
index ec7849960f..ddb9a2dcf9 100644
--- a/command.h
+++ b/command.h
@@ -339,7 +339,6 @@ bool command_event_resize_windowed_scale(settings_t *settings,
 
 bool command_event_save_auto_state(
       bool savestate_auto_save,
-      global_t *global,
       const enum rarch_core_type current_core_type);
 
 /**
@@ -363,14 +362,12 @@ void command_event_set_volume(
 void command_event_init_controllers(rarch_system_info_t *info,
       settings_t *settings, unsigned num_active_users);
 
-void command_event_load_auto_state(global_t *global);
+void command_event_load_auto_state(void);
 
 void command_event_set_savestate_auto_index(
-      settings_t *settings,
-      const global_t *global);
+      settings_t *settings);
 
 void command_event_set_savestate_garbage_collect(
-      const global_t *global,
       unsigned max_to_keep,
       bool show_hidden_files
       );
diff --git a/configuration.c b/configuration.c
index d0ff149599..3e3952851f 100644
--- a/configuration.c
+++ b/configuration.c
@@ -3211,6 +3211,7 @@ static bool config_load_file(global_t *global,
    char *save                                      = NULL;
    char *override_username                         = NULL;
    const char *path_config                         = NULL;
+   runloop_state_t *runloop_st                     = runloop_state_get_ptr();
    int bool_settings_size                          = sizeof(settings->bools)  / sizeof(settings->bools.placeholder);
    int float_settings_size                         = sizeof(settings->floats) / sizeof(settings->floats.placeholder);
    int int_settings_size                           = sizeof(settings->ints)   / sizeof(settings->ints.placeholder);
@@ -3665,15 +3666,12 @@ static bool config_load_file(global_t *global,
       {
          dir_set(RARCH_DIR_SAVEFILE, tmp_str);
 
-         if (global)
-         {
-            strlcpy(global->name.savefile, tmp_str,
-                  sizeof(global->name.savefile));
-            fill_pathname_dir(global->name.savefile,
-                  path_get(RARCH_PATH_BASENAME),
-                  FILE_PATH_SRM_EXTENSION,
-                  sizeof(global->name.savefile));
-         }
+         strlcpy(runloop_st->name.savefile, tmp_str,
+               sizeof(runloop_st->name.savefile));
+         fill_pathname_dir(runloop_st->name.savefile,
+               path_get(RARCH_PATH_BASENAME),
+               FILE_PATH_SRM_EXTENSION,
+               sizeof(runloop_st->name.savefile));
       }
       else
          RARCH_WARN("[Config]: 'savefile_directory' is not a directory, ignoring ...\n");
@@ -3688,15 +3686,12 @@ static bool config_load_file(global_t *global,
       {
          dir_set(RARCH_DIR_SAVESTATE, tmp_str);
 
-         if (global)
-         {
-            strlcpy(global->name.savestate, tmp_str,
-                  sizeof(global->name.savestate));
-            fill_pathname_dir(global->name.savestate,
-                  path_get(RARCH_PATH_BASENAME),
-                  ".state",
-                  sizeof(global->name.savestate));
-         }
+         strlcpy(runloop_st->name.savestate, tmp_str,
+               sizeof(runloop_st->name.savestate));
+         fill_pathname_dir(runloop_st->name.savestate,
+               path_get(RARCH_PATH_BASENAME),
+               ".state",
+               sizeof(runloop_st->name.savestate));
       }
       else
          RARCH_WARN("[Config]: 'savestate_directory' is not a directory, ignoring ...\n");
@@ -5025,7 +5020,7 @@ bool input_remapping_load_file(void *data, const char *path)
    unsigned i, j;
    config_file_t *conf                              = (config_file_t*)data;
    settings_t *settings                             = config_st;
-   global_t *global                                 = global_get_ptr();
+   runloop_state_t *runloop_st                      = runloop_state_get_ptr();
    char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][8] = {
       "b", "y", "select", "start",
       "up", "down", "left", "right",
@@ -5035,12 +5030,12 @@ bool input_remapping_load_file(void *data, const char *path)
    if (!conf || string_is_empty(path))
       return false;
 
-   if (!string_is_empty(global->name.remapfile))
+   if (!string_is_empty(runloop_st->name.remapfile))
    {
       input_remapping_deinit();
       input_remapping_set_defaults(false);
    }
-   global->name.remapfile = strdup(path);
+   runloop_st->name.remapfile = strdup(path);
 
    for (i = 0; i < MAX_USERS; i++)
    {
diff --git a/gfx/video_driver.c b/gfx/video_driver.c
index 3db9a32714..5ce3dfb705 100644
--- a/gfx/video_driver.c
+++ b/gfx/video_driver.c
@@ -426,10 +426,6 @@ void *video_driver_get_ptr(void)
    return VIDEO_DRIVER_GET_PTR_INTERNAL(video_st);
 }
 
-void *video_driver_get_data(void)
-{
-   return video_driver_st.data;
-}
 
 video_driver_t *hw_render_context_driver(
       enum retro_hw_context_type type, int major, int minor)
@@ -1212,11 +1208,6 @@ bool video_display_server_get_flags(gfx_ctx_flags_t *flags)
    return true;
 }
 
-bool video_driver_started_fullscreen(void)
-{
-   video_driver_state_t *video_st                 = &video_driver_st;
-   return video_st->started_fullscreen;
-}
 
 bool video_driver_is_threaded(void)
 {
diff --git a/gfx/video_driver.h b/gfx/video_driver.h
index 4466229e01..6c1163132d 100644
--- a/gfx/video_driver.h
+++ b/gfx/video_driver.h
@@ -1056,8 +1056,6 @@ void *video_driver_get_ptr(void);
 
 video_driver_state_t *video_state_get_ptr(void);
 
-void *video_driver_get_data(void);
-
 bool video_driver_set_rotation(unsigned rotation);
 
 bool video_driver_set_video_mode(unsigned width,
@@ -1299,8 +1297,6 @@ float video_driver_get_refresh_rate(void);
 bool video_driver_has_widgets(void);
 #endif
 
-bool video_driver_started_fullscreen(void);
-
 bool video_driver_is_threaded(void);
 
 bool video_context_driver_get_flags(gfx_ctx_flags_t *flags);
diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c
index dbdbd2303d..41320387fd 100644
--- a/gfx/video_thread_wrapper.c
+++ b/gfx/video_thread_wrapper.c
@@ -23,6 +23,7 @@
 #include <features/features_cpu.h>
 #include <string/stdstring.h>
 
+#include "video_driver.h"
 #include "video_thread_wrapper.h"
 #include "font_driver.h"
 
@@ -1343,8 +1344,8 @@ bool video_thread_font_init(const void **font_driver, void **font_handle,
       bool is_threaded)
 {
    thread_packet_t pkt;
-   thread_video_t *thr            = (thread_video_t*)
-      video_driver_get_data();
+   video_driver_state_t *video_st = video_state_get_ptr();
+   thread_video_t *thr            = video_st ? (thread_video_t*)video_st->data : NULL;
 
    if (!thr)
       return false;
@@ -1368,7 +1369,8 @@ unsigned video_thread_texture_load(void *data,
       custom_command_method_t func)
 {
    thread_packet_t pkt;
-   thread_video_t *thr  = (thread_video_t*)video_driver_get_data();
+   video_driver_state_t *video_st = video_state_get_ptr();
+   thread_video_t *thr            = video_st ? (thread_video_t*)video_st->data : NULL;
 
    if (!thr)
       return 0;
diff --git a/input/input_driver.c b/input/input_driver.c
index 8a55a31798..749b913701 100644
--- a/input/input_driver.c
+++ b/input/input_driver.c
@@ -5113,57 +5113,57 @@ const hid_driver_t *input_hid_init_first(void)
 void input_remapping_cache_global_config(void)
 {
    unsigned i;
-   settings_t *settings        = config_get_ptr();
-   global_t *global            = global_get_ptr();
+   settings_t *settings           = config_get_ptr();
+   input_driver_state_t *input_st = &input_driver_st;
 
    for (i = 0; i < MAX_USERS; i++)
    {
-      global->old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i];
-      global->old_libretro_device[i]  = settings->uints.input_libretro_device[i];
+      input_st->old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i];
+      input_st->old_libretro_device[i]  = settings->uints.input_libretro_device[i];
    }
 
-   global->old_analog_dpad_mode_set = true;
-   global->old_libretro_device_set  = true;
+   input_st->old_analog_dpad_mode_set = true;
+   input_st->old_libretro_device_set  = true;
 }
 
 void input_remapping_enable_global_config_restore(void)
 {
-   global_t *global               = global_get_ptr();
-   global->remapping_cache_active = true;
+   input_driver_state_t *input_st   = &input_driver_st;
+   input_st->remapping_cache_active = true;
 }
 
 void input_remapping_restore_global_config(bool clear_cache)
 {
    unsigned i;
-   settings_t *settings        = config_get_ptr();
-   global_t *global            = global_get_ptr();
+   settings_t *settings           = config_get_ptr();
+   input_driver_state_t *input_st = &input_driver_st;
 
-   if (!global->remapping_cache_active)
+   if (!input_st->remapping_cache_active)
       goto end;
 
    for (i = 0; i < MAX_USERS; i++)
    {
-      if (global->old_analog_dpad_mode_set &&
+      if (input_st->old_analog_dpad_mode_set &&
           (settings->uints.input_analog_dpad_mode[i] !=
-               global->old_analog_dpad_mode[i]))
+               input_st->old_analog_dpad_mode[i]))
          configuration_set_uint(settings,
                settings->uints.input_analog_dpad_mode[i],
-               global->old_analog_dpad_mode[i]);
+               input_st->old_analog_dpad_mode[i]);
 
-      if (global->old_libretro_device_set &&
+      if (input_st->old_libretro_device_set &&
           (settings->uints.input_libretro_device[i] !=
-               global->old_libretro_device[i]))
+               input_st->old_libretro_device[i]))
          configuration_set_uint(settings,
                settings->uints.input_libretro_device[i],
-               global->old_libretro_device[i]);
+               input_st->old_libretro_device[i]);
    }
 
 end:
    if (clear_cache)
    {
-      global->old_analog_dpad_mode_set = false;
-      global->old_libretro_device_set  = false;
-      global->remapping_cache_active   = false;
+      input_st->old_analog_dpad_mode_set = false;
+      input_st->old_libretro_device_set  = false;
+      input_st->remapping_cache_active     = false;
    }
 }
 
@@ -5214,11 +5214,10 @@ void input_remapping_update_port_map(void)
 
 void input_remapping_deinit(void)
 {
-   global_t *global                        = global_get_ptr();
    runloop_state_t *runloop_st             = runloop_state_get_ptr();
-   if (global->name.remapfile)
-      free(global->name.remapfile);
-   global->name.remapfile                  = NULL;
+   if (runloop_st->name.remapfile)
+      free(runloop_st->name.remapfile);
+   runloop_st->name.remapfile              = NULL;
    runloop_st->remaps_core_active          = false;
    runloop_st->remaps_content_dir_active   = false;
    runloop_st->remaps_game_active          = false;
diff --git a/input/input_driver.h b/input/input_driver.h
index 7471ff7fbe..fed67d30bd 100644
--- a/input/input_driver.h
+++ b/input/input_driver.h
@@ -415,6 +415,8 @@ typedef struct
    input_mapper_t mapper;          /* uint32_t alignment */
    input_device_info_t input_device_info[MAX_INPUT_DEVICES]; /* unsigned alignment */
    input_mouse_info_t input_mouse_info[MAX_INPUT_DEVICES];
+   unsigned old_analog_dpad_mode[MAX_USERS];
+   unsigned old_libretro_device[MAX_USERS];
    unsigned osk_last_codepoint;
    unsigned osk_last_codepoint_len;
    unsigned input_hotkey_block_counter;
@@ -437,6 +439,9 @@ typedef struct
    bool grab_mouse_state;
    bool analog_requested[MAX_USERS];
    bool keyboard_mapping_blocked;
+   bool old_analog_dpad_mode_set;
+   bool old_libretro_device_set;
+   bool remapping_cache_active;
    retro_bits_512_t keyboard_mapping_bits;    /* bool alignment */
    input_game_focus_state_t game_focus_state; /* bool alignment */
 } input_driver_state_t;
diff --git a/input/input_remapping.h b/input/input_remapping.h
index 285c53127a..5cfafd7677 100644
--- a/input/input_remapping.h
+++ b/input/input_remapping.h
@@ -84,7 +84,7 @@ void input_remapping_restore_global_config(bool clear_cache);
 void input_remapping_update_port_map(void);
 
 /**
- * Frees global->name.remapfile and sets these runloop_state flags to false: 
+ * Frees runloop_st->name.remapfile and sets these runloop_state flags to false: 
  * remaps_core_active, remaps_content_dir_active, and remaps_game_active.
  */
 void input_remapping_deinit(void);
diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c
index ae3bb30554..c5daf8f39c 100644
--- a/menu/cbs/menu_cbs_get_value.c
+++ b/menu/cbs/menu_cbs_get_value.c
@@ -142,12 +142,12 @@ static void menu_action_setting_disp_set_label_remap_file_load(
       const char *path,
       char *s2, size_t len2)
 {
-   global_t *global = global_get_ptr();
+   runloop_state_t *runloop_st = runloop_state_get_ptr();
 
    *w = 19;
    strlcpy(s2, path, len2);
-   if (global && !string_is_empty(global->name.remapfile))
-      fill_pathname_base(s, global->name.remapfile,
+   if (!string_is_empty(runloop_st->name.remapfile))
+      fill_pathname_base(s, runloop_st->name.remapfile,
             len);
 }
 
diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c
index 08b145a134..b707fc4ae9 100644
--- a/menu/cbs/menu_cbs_ok.c
+++ b/menu/cbs/menu_cbs_ok.c
@@ -5179,8 +5179,8 @@ static int action_ok_add_to_favorites(const char *path,
     * > If content path is empty, cannot do anything... */
    if (!string_is_empty(content_path))
    {
-      global_t *global                 = global_get_ptr();
-      struct retro_system_info *system = &runloop_state_get_ptr()->system.info;
+      runloop_state_t *runloop_st      = runloop_state_get_ptr();
+      struct retro_system_info *system = &runloop_st->system.info;
       struct string_list *str_list     = NULL;
       const char *crc32                = NULL;
       const char *db_name              = NULL;
@@ -5203,9 +5203,9 @@ static int action_ok_add_to_favorites(const char *path,
       /* Determine playlist parameters */
 
       /* > content_label */
-      if (global)
-         if (!string_is_empty(global->name.label))
-            strlcpy(content_label, global->name.label, sizeof(content_label));
+      if (!string_is_empty(runloop_st->name.label))
+         strlcpy(content_label, runloop_st->name.label,
+               sizeof(content_label));
 
       /* Label is empty - use file name instead */
       if (string_is_empty(content_label))
diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c
index fedeb0a5c9..8d14778ad7 100644
--- a/menu/drivers/xmb.c
+++ b/menu/drivers/xmb.c
@@ -380,7 +380,7 @@ typedef struct xmb_handle
    /* Cached texts showing current entry index / current list size */
    char entry_index_str[32];
 
-   /* These have to be huge, because global->name.savestate
+   /* These have to be huge, because runloop_st->name.savestate
     * has a hard-coded size of 8192...
     * (the extra space here is required to silence compiler
     * warnings...) */
@@ -1179,21 +1179,18 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
              string_is_equal(entry.label, "savestate"))
          {
             char path[8204];
-            global_t *global = global_get_ptr();
+            runloop_state_t *runloop_st = runloop_state_get_ptr();
 
             path[0] = '\0';
 
-            if (global)
-            {
-               if (state_slot > 0)
-                  snprintf(path, sizeof(path), "%s%d",
-                        global->name.savestate, state_slot);
-               else if (state_slot < 0)
-                  fill_pathname_join_delim(path,
-                        global->name.savestate, "auto", '.', sizeof(path));
-               else
-                  strlcpy(path, global->name.savestate, sizeof(path));
-            }
+            if (state_slot > 0)
+               snprintf(path, sizeof(path), "%s%d",
+                     runloop_st->name.savestate, state_slot);
+            else if (state_slot < 0)
+               fill_pathname_join_delim(path,
+                     runloop_st->name.savestate, "auto", '.', sizeof(path));
+            else
+               strlcpy(path, runloop_st->name.savestate, sizeof(path));
 
             strlcat(path, FILE_PATH_PNG_EXTENSION, sizeof(path));
 
diff --git a/menu/menu_driver.h b/menu/menu_driver.h
index 1067ee7b7c..896bbd0b50 100644
--- a/menu/menu_driver.h
+++ b/menu/menu_driver.h
@@ -433,6 +433,12 @@ struct menu_state
    retro_time_t input_last_time_us;
    menu_input_t input_state;               /* retro_time_t alignment */
 
+   retro_time_t prev_start_time;
+   retro_time_t noop_press_time;
+   retro_time_t noop_start_time;
+   retro_time_t action_start_time;
+   retro_time_t action_press_time;
+
    struct menu_bind_state input_binds;     /* uint64_t alignment */
 
    menu_handle_t *driver_data;
@@ -466,6 +472,8 @@ struct menu_state
    /* int16_t alignment */
    menu_input_pointer_hw_state_t input_pointer_hw_state;
 
+   enum menu_action prev_action;
+
    /* When generating a menu list in menu_displaylist_build_list(),
     * the entry with a label matching 'pending_selection' will
     * be selected automatically */
diff --git a/menu/menu_setting.c b/menu/menu_setting.c
index 880ff10690..1eee1503b1 100644
--- a/menu/menu_setting.c
+++ b/menu/menu_setting.c
@@ -727,29 +727,25 @@ static void setting_get_string_representation_uint_as_enum(
 
 static float recalc_step_based_on_length_of_action(rarch_setting_t *setting)
 {
-   float       step = setting->step;
-   global_t *global = global_get_ptr();
-
-   if (global)
-   {
-      retro_time_t action_press_time = global->menu.action_press_time;
-      if      (action_press_time  > _21_SECONDS)
-         step = setting->step * 1000000.0f;
-      else if (action_press_time  > _18_SECONDS)
-         step = setting->step * 100000.0f;
-      else if (action_press_time  > _15_SECONDS)
-         step = setting->step * 10000.0f;
-      else if (action_press_time  > _12_SECONDS)
-         step = setting->step * 1000.0f;
-      else if (action_press_time  > _9_SECONDS)
-         step = setting->step * 100.0f;
-      else if (action_press_time  > _6_SECONDS)
-         step = setting->step * 10.0f;
-      else if (action_press_time  > _3_SECONDS)
-         step = setting->step * 5.0f;
-      else
-         step = setting->step;
-   }
+   float                     step = setting->step;
+   struct menu_state *menu_st     = menu_state_get_ptr();
+   retro_time_t action_press_time = menu_st->action_press_time;
+   if      (action_press_time  > _21_SECONDS)
+      step = setting->step * 1000000.0f;
+   else if (action_press_time  > _18_SECONDS)
+      step = setting->step * 100000.0f;
+   else if (action_press_time  > _15_SECONDS)
+      step = setting->step * 10000.0f;
+   else if (action_press_time  > _12_SECONDS)
+      step = setting->step * 1000.0f;
+   else if (action_press_time  > _9_SECONDS)
+      step = setting->step * 100.0f;
+   else if (action_press_time  > _6_SECONDS)
+      step = setting->step * 10.0f;
+   else if (action_press_time  > _3_SECONDS)
+      step = setting->step * 5.0f;
+   else
+      step = setting->step;
    return step < setting->step ? setting->step : step;
 }
 
diff --git a/retroarch.c b/retroarch.c
index 9f3fe3de24..44ace29a4c 100644
--- a/retroarch.c
+++ b/retroarch.c
@@ -249,6 +249,13 @@
 #include "lakka.h"
 #endif
 
+#define SHADER_FILE_WATCH_DELAY_MSEC 500
+
+#define QUIT_DELAY_USEC 3 * 1000000 /* 3 seconds */
+
+#define DEFAULT_NETWORK_GAMEPAD_PORT 55400
+#define UDP_FRAME_PACKETS 16
+
 /* Custom forward declarations */
 static bool recording_init(settings_t *settings,
       struct rarch_state *p_rarch);
@@ -544,6 +551,12 @@ static const void *find_driver_nonempty(
    return NULL;
 }
 
+#ifdef _WIN32
+#define PERF_LOG_FMT "[PERF]: Avg (%s): %I64u ticks, %I64u runs.\n"
+#else
+#define PERF_LOG_FMT "[PERF]: Avg (%s): %llu ticks, %llu runs.\n"
+#endif
+
 static void log_counters(
       struct retro_perf_counter **counters, unsigned num)
 {
@@ -933,7 +946,6 @@ static void path_set_redirect(struct rarch_state *p_rarch,
    char content_dir_name[PATH_MAX_LENGTH];
    char new_savefile_dir[PATH_MAX_LENGTH];
    char new_savestate_dir[PATH_MAX_LENGTH];
-   global_t   *global                          = global_get_ptr();
    const char *old_savefile_dir                = p_rarch->dir_savefile;
    const char *old_savestate_dir               = p_rarch->dir_savestate;
    runloop_state_t *runloop_st                 = &runloop_state;
@@ -1073,60 +1085,60 @@ static void path_set_redirect(struct rarch_state *p_rarch,
          RARCH_LOG("Saving save states in content directory is set. This overrides other save state file directory settings.\n");
    }
 
-   if (global && system && !string_is_empty(system->library_name))
+   if (system && !string_is_empty(system->library_name))
    {
       bool savefile_is_dir  = path_is_directory(new_savefile_dir);
       bool savestate_is_dir = path_is_directory(new_savestate_dir);
       if (savefile_is_dir)
-         strlcpy(global->name.savefile, new_savefile_dir,
-               sizeof(global->name.savefile));
+         strlcpy(runloop_st->name.savefile, new_savefile_dir,
+               sizeof(runloop_st->name.savefile));
       else
-         savefile_is_dir    = path_is_directory(global->name.savefile);
+         savefile_is_dir    = path_is_directory(runloop_st->name.savefile);
 
       if (savestate_is_dir)
-         strlcpy(global->name.savestate, new_savestate_dir,
-               sizeof(global->name.savestate));
+         strlcpy(runloop_st->name.savestate, new_savestate_dir,
+               sizeof(runloop_st->name.savestate));
       else
-         savestate_is_dir   = path_is_directory(global->name.savestate);
+         savestate_is_dir   = path_is_directory(runloop_st->name.savestate);
 
       if (savefile_is_dir)
       {
-         fill_pathname_dir(global->name.savefile,
+         fill_pathname_dir(runloop_st->name.savefile,
                !string_is_empty(runloop_st->runtime_content_path_basename)
                ? runloop_st->runtime_content_path_basename
                : system->library_name,
                FILE_PATH_SRM_EXTENSION,
-               sizeof(global->name.savefile));
+               sizeof(runloop_st->name.savefile));
          RARCH_LOG("[Overrides]: %s \"%s\".\n",
                msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO),
-               global->name.savefile);
+               runloop_st->name.savefile);
       }
 
       if (savestate_is_dir)
       {
-         fill_pathname_dir(global->name.savestate,
+         fill_pathname_dir(runloop_st->name.savestate,
                !string_is_empty(runloop_st->runtime_content_path_basename)
                ? runloop_st->runtime_content_path_basename
                : system->library_name,
                FILE_PATH_STATE_EXTENSION,
-               sizeof(global->name.savestate));
+               sizeof(runloop_st->name.savestate));
          RARCH_LOG("[Overrides]: %s \"%s\".\n",
                msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO),
-               global->name.savestate);
+               runloop_st->name.savestate);
       }
 
 #ifdef HAVE_CHEATS
-      if (path_is_directory(global->name.cheatfile))
+      if (path_is_directory(runloop_st->name.cheatfile))
       {
-         fill_pathname_dir(global->name.cheatfile,
+         fill_pathname_dir(runloop_st->name.cheatfile,
                !string_is_empty(runloop_st->runtime_content_path_basename)
                ? runloop_st->runtime_content_path_basename
                : system->library_name,
                FILE_PATH_CHT_EXTENSION,
-               sizeof(global->name.cheatfile));
+               sizeof(runloop_st->name.cheatfile));
          RARCH_LOG("[Overrides]: %s \"%s\".\n",
                msg_hash_to_str(MSG_REDIRECTING_CHEATFILE_TO),
-               global->name.cheatfile);
+               runloop_st->name.cheatfile);
       }
 #endif
    }
@@ -1183,9 +1195,9 @@ void path_set_special(char **argv, unsigned num_content)
    unsigned i;
    char str[PATH_MAX_LENGTH];
    union string_list_elem_attr attr;
+   bool is_dir                         = false;
    struct string_list subsystem_paths  = {0};
    runloop_state_t         *runloop_st = runloop_state_get_ptr();
-   global_t   *global                  = global_get_ptr();
    const char *savestate_dir           = runloop_st->savestate_dir;
 
 
@@ -1213,26 +1225,23 @@ void path_set_special(char **argv, unsigned num_content)
 
    /* We defer SRAM path updates until we can resolve it.
     * It is more complicated for special content types. */
-   if (global)
+   is_dir = path_is_directory(savestate_dir);
+
+   if (is_dir)
+      strlcpy(runloop_st->name.savestate, savestate_dir,
+            sizeof(runloop_st->name.savestate));
+   else
+      is_dir   = path_is_directory(runloop_st->name.savestate);
+
+   if (is_dir)
    {
-      bool is_dir = path_is_directory(savestate_dir);
-
-      if (is_dir)
-         strlcpy(global->name.savestate, savestate_dir,
-               sizeof(global->name.savestate));
-      else
-         is_dir   = path_is_directory(global->name.savestate);
-
-      if (is_dir)
-      {
-         fill_pathname_dir(global->name.savestate,
-               str,
-               ".state",
-               sizeof(global->name.savestate));
-         RARCH_LOG("%s \"%s\".\n",
-               msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO),
-               global->name.savestate);
-      }
+      fill_pathname_dir(runloop_st->name.savestate,
+            str,
+            ".state",
+            sizeof(runloop_st->name.savestate));
+      RARCH_LOG("%s \"%s\".\n",
+            msg_hash_to_str(MSG_REDIRECTING_SAVESTATE_TO),
+            runloop_st->name.savestate);
    }
 }
 
@@ -1240,7 +1249,6 @@ static bool path_init_subsystem(void)
 {
    unsigned i, j;
    const struct retro_subsystem_info *info = NULL;
-   global_t   *global                      = global_get_ptr();
    runloop_state_t             *runloop_st = &runloop_state;
    rarch_system_info_t             *system = &runloop_st->system;
    bool subsystem_path_empty               = path_is_empty(RARCH_PATH_SUBSYSTEM);
@@ -1305,26 +1313,24 @@ static bool path_init_subsystem(void)
       }
    }
 
-   if (global)
-   {
-      /* Let other relevant paths be inferred from the main SRAM location. */
-      if (!retroarch_override_setting_is_set(
-               RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
-         fill_pathname_noext(global->name.savefile,
-               runloop_st->runtime_content_path_basename,
-               ".srm",
-               sizeof(global->name.savefile));
+   /* Let other relevant paths be inferred 
+      from the main SRAM location. */
+   if (!retroarch_override_setting_is_set(
+            RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
+      fill_pathname_noext(runloop_st->name.savefile,
+            runloop_st->runtime_content_path_basename,
+            ".srm",
+            sizeof(runloop_st->name.savefile));
 
-      if (path_is_directory(global->name.savefile))
-      {
-         fill_pathname_dir(global->name.savefile,
-               runloop_st->runtime_content_path_basename,
-               ".srm",
-               sizeof(global->name.savefile));
-         RARCH_LOG("%s \"%s\".\n",
-               msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO),
-               global->name.savefile);
-      }
+   if (path_is_directory(runloop_st->name.savefile))
+   {
+      fill_pathname_dir(runloop_st->name.savefile,
+            runloop_st->runtime_content_path_basename,
+            ".srm",
+            sizeof(runloop_st->name.savefile));
+      RARCH_LOG("%s \"%s\".\n",
+            msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO),
+            runloop_st->name.savefile);
    }
 
    return true;
@@ -1347,13 +1353,13 @@ static void path_init_savefile(runloop_state_t *runloop_st)
    command_event(CMD_EVENT_AUTOSAVE_INIT, NULL);
 }
 
-static void path_init_savefile_internal(global_t *global)
+static void path_init_savefile_internal(runloop_state_t *runloop_st)
 {
    path_deinit_savefile();
    path_init_savefile_new();
 
    if (!path_init_subsystem())
-      path_init_savefile_rtc(global->name.savefile);
+      path_init_savefile_rtc(runloop_st->name.savefile);
 }
 
 void runloop_path_fill_names(void)
@@ -1362,40 +1368,35 @@ void runloop_path_fill_names(void)
 #ifdef HAVE_BSV_MOVIE
    input_driver_state_t *input_st = input_state_get_ptr();
 #endif
-   global_t            *global    = global_get_ptr();
 
-   path_init_savefile_internal(global);
+   path_init_savefile_internal(runloop_st);
 
 #ifdef HAVE_BSV_MOVIE
-   if (global)
-      strlcpy(input_st->bsv_movie_state.movie_path,
-            global->name.savefile,
-            sizeof(input_st->bsv_movie_state.movie_path));
+   strlcpy(input_st->bsv_movie_state.movie_path,
+         runloop_st->name.savefile,
+         sizeof(input_st->bsv_movie_state.movie_path));
 #endif
 
    if (string_is_empty(runloop_st->runtime_content_path_basename))
       return;
 
-   if (global)
-   {
-      if (string_is_empty(global->name.ups))
-         fill_pathname_noext(global->name.ups,
-               runloop_st->runtime_content_path_basename,
-               ".ups",
-               sizeof(global->name.ups));
+   if (string_is_empty(runloop_st->name.ups))
+      fill_pathname_noext(runloop_st->name.ups,
+            runloop_st->runtime_content_path_basename,
+            ".ups",
+            sizeof(runloop_st->name.ups));
 
-      if (string_is_empty(global->name.bps))
-         fill_pathname_noext(global->name.bps,
-               runloop_st->runtime_content_path_basename,
-               ".bps",
-               sizeof(global->name.bps));
+   if (string_is_empty(runloop_st->name.bps))
+      fill_pathname_noext(runloop_st->name.bps,
+            runloop_st->runtime_content_path_basename,
+            ".bps",
+            sizeof(runloop_st->name.bps));
 
-      if (string_is_empty(global->name.ips))
-         fill_pathname_noext(global->name.ips,
-               runloop_st->runtime_content_path_basename,
-               ".ips",
-               sizeof(global->name.ips));
-   }
+   if (string_is_empty(runloop_st->name.ips))
+      fill_pathname_noext(runloop_st->name.ips,
+            runloop_st->runtime_content_path_basename,
+            ".ips",
+            sizeof(runloop_st->name.ips));
 }
 
 char *path_get_ptr(enum rarch_path_type type)
@@ -1503,30 +1504,26 @@ size_t path_get_realsize(enum rarch_path_type type)
    return 0;
 }
 
-static void runloop_path_set_names(runloop_state_t *runloop_st,
-      global_t *global)
+static void runloop_path_set_names(runloop_state_t *runloop_st)
 {
-   if (global)
-   {
-      if (!retroarch_override_setting_is_set(
-               RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
-         fill_pathname_noext(global->name.savefile,
-               runloop_st->runtime_content_path_basename,
-               ".srm", sizeof(global->name.savefile));
+   if (!retroarch_override_setting_is_set(
+            RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
+      fill_pathname_noext(runloop_st->name.savefile,
+            runloop_st->runtime_content_path_basename,
+            ".srm", sizeof(runloop_st->name.savefile));
 
-      if (!retroarch_override_setting_is_set(
-               RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
-         fill_pathname_noext(global->name.savestate,
-               runloop_st->runtime_content_path_basename,
-               ".state", sizeof(global->name.savestate));
+   if (!retroarch_override_setting_is_set(
+            RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
+      fill_pathname_noext(runloop_st->name.savestate,
+            runloop_st->runtime_content_path_basename,
+            ".state", sizeof(runloop_st->name.savestate));
 
 #ifdef HAVE_CHEATS
-      if (!string_is_empty(runloop_st->runtime_content_path_basename))
-         fill_pathname_noext(global->name.cheatfile,
-               runloop_st->runtime_content_path_basename,
-               ".cht", sizeof(global->name.cheatfile));
+   if (!string_is_empty(runloop_st->runtime_content_path_basename))
+      fill_pathname_noext(runloop_st->name.cheatfile,
+            runloop_st->runtime_content_path_basename,
+            ".cht", sizeof(runloop_st->name.cheatfile));
 #endif
-   }
 }
 
 bool path_set(enum rarch_path_type type, const char *path)
@@ -1545,7 +1542,7 @@ bool path_set(enum rarch_path_type type, const char *path)
          break;
       case RARCH_PATH_NAMES:
          runloop_path_set_basename(runloop_st, path);
-         runloop_path_set_names(runloop_st, global_get_ptr());
+         runloop_path_set_names(runloop_st);
          path_set_redirect(p_rarch, config_get_ptr());
          break;
       case RARCH_PATH_CORE:
@@ -1691,15 +1688,15 @@ void ram_state_to_file(void)
 
 bool retroarch_get_current_savestate_path(char *path, size_t len)
 {
-   const global_t *global      = global_get_ptr();
+   runloop_state_t *runloop_st = &runloop_state;
    settings_t *settings        = config_get_ptr();
    int state_slot              = settings ? settings->ints.state_slot : 0;
    const char *name_savestate  = NULL;
 
-   if (!path || !global)
+   if (!path)
       return false;
 
-   name_savestate = global->name.savestate;
+   name_savestate              = runloop_st->name.savestate;
    if (string_is_empty(name_savestate))
       return false;
 
@@ -3243,7 +3240,6 @@ static bool event_init_content(
    bool cheevos_hardcore_mode_enable            =
       settings->bools.cheevos_hardcore_mode_enable;
 #endif
-   global_t   *global                           = global_get_ptr();
    const enum rarch_core_type current_core_type = runloop_st->current_core_type;
 
    content_get_status(&contentless, &is_inited);
@@ -3263,14 +3259,14 @@ static bool event_init_content(
     * interface, otherwise fill all content-related
     * paths */
    if (contentless)
-      path_init_savefile_internal(global);
+      path_init_savefile_internal(runloop_st);
    else
       runloop_path_fill_names();
 
    if (!content_init())
       return false;
 
-   command_event_set_savestate_auto_index(settings, global);
+   command_event_set_savestate_auto_index(settings);
 
    if (!event_load_save_files(runloop_st->is_sram_load_disabled))
       RARCH_LOG("[SRAM]: %s\n",
@@ -3286,8 +3282,8 @@ static bool event_init_content(
 #ifdef HAVE_CHEEVOS
    if (!cheevos_enable || !cheevos_hardcore_mode_enable)
 #endif
-      if (global && settings->bools.savestate_auto_load)
-         command_event_load_auto_state(global);
+      if (settings->bools.savestate_auto_load)
+         command_event_load_auto_state();
 
 #ifdef HAVE_BSV_MOVIE
    bsv_movie_deinit(input_st);
@@ -4147,8 +4143,9 @@ bool command_event(enum event_command cmd, void *data)
                   settings->bools.content_runtime_log_aggregate,
                   settings->paths.directory_runtime_log,
                   settings->paths.directory_playlist);
-            command_event_save_auto_state(settings->bools.savestate_auto_save,
-                  global, runloop_st->current_core_type);
+            command_event_save_auto_state(
+                  settings->bools.savestate_auto_save,
+                  runloop_st->current_core_type);
 
 #ifdef HAVE_CONFIGFILE
             if (runloop_st->overrides_active)
@@ -5846,12 +5843,19 @@ static void global_free(struct rarch_state *p_rarch)
    path_clear_all();
    dir_clear_all();
 
+   if (!string_is_empty(runloop_st->name.remapfile))
+      free(runloop_st->name.remapfile);
+   runloop_st->name.remapfile = NULL;
+   *runloop_st->name.ups                 = '\0';
+   *runloop_st->name.bps                 = '\0';
+   *runloop_st->name.ips                 = '\0';
+   *runloop_st->name.savefile            = '\0';
+   *runloop_st->name.savestate           = '\0';
+   *runloop_st->name.cheatfile           = '\0';
+   *runloop_st->name.label               = '\0';
+
    if (global)
-   {
-      if (!string_is_empty(global->name.remapfile))
-         free(global->name.remapfile);
       memset(global, 0, sizeof(struct global));
-   }
    retroarch_override_setting_free_state();
 }
 
@@ -12183,7 +12187,7 @@ static void do_runahead(
 
          if (suspended_frame)
          {
-            RUNAHEAD_RESUME_VIDEO(video_st);
+            video_st->active        = video_st->runahead_is_active;
             audio_st->suspended     = false;
          }
 
@@ -12220,7 +12224,7 @@ static void do_runahead(
       /* run main core with video suspended */
       video_st->active     = false;
       core_run();
-      RUNAHEAD_RESUME_VIDEO(video_st);
+      video_st->active     = video_st->runahead_is_active;
 
       if (     runloop_st->input_is_dirty
             || runloop_st->runahead_force_input_dirty)
@@ -12244,15 +12248,17 @@ static void do_runahead(
             video_st->active             = false;
             audio_st->suspended          = true;
             audio_st->hard_disable       = true;
-            RUNAHEAD_RUN_SECONDARY(runloop_st);
+            runloop_st->runahead_secondary_core_available =
+               secondary_core_run_use_last_input();
             audio_st->hard_disable       = false;
             audio_st->suspended          = false;
-            RUNAHEAD_RESUME_VIDEO(video_st);
+            video_st->active             = video_st->runahead_is_active;
          }
       }
       audio_st->suspended                = true;
       audio_st->hard_disable             = true;
-      RUNAHEAD_RUN_SECONDARY(runloop_st);
+      runloop_st->runahead_secondary_core_available =
+secondary_core_run_use_last_input();
       audio_st->hard_disable             = false;
       audio_st->suspended                = false;
 #endif
@@ -12302,6 +12308,14 @@ static retro_time_t runloop_core_runtime_tick(
    return frame_time;
 }
 
+#define _PSUPP_BUF(buf, var, name, desc) \
+   strlcat(buf, "  ", sizeof(buf)); \
+   strlcat(buf, name, sizeof(buf)); \
+   strlcat(buf, ":\n\t\t", sizeof(buf)); \
+   strlcat(buf, desc, sizeof(buf)); \
+   strlcat(buf, ": ", sizeof(buf)); \
+   strlcat(buf, var ? "yes\n" : "no\n", sizeof(buf))
+
 static void retroarch_print_features(void)
 {
    char buf[2048];
@@ -12551,6 +12565,39 @@ static void retroarch_print_help(const char *arg0)
    }
 }
 
+/* Descriptive names for options without short variant.
+ *
+ * Please keep the name in sync with the option name.
+ * Order does not matter. */
+enum
+{
+   RA_OPT_MENU = 256, /* must be outside the range of a char */
+   RA_OPT_STATELESS,
+   RA_OPT_CHECK_FRAMES,
+   RA_OPT_PORT,
+   RA_OPT_SPECTATE,
+   RA_OPT_NICK,
+   RA_OPT_COMMAND,
+   RA_OPT_APPENDCONFIG,
+   RA_OPT_BPS,
+   RA_OPT_IPS,
+   RA_OPT_NO_PATCH,
+   RA_OPT_RECORDCONFIG,
+   RA_OPT_SUBSYSTEM,
+   RA_OPT_SIZE,
+   RA_OPT_FEATURES,
+   RA_OPT_VERSION,
+   RA_OPT_EOF_EXIT,
+   RA_OPT_LOG_FILE,
+   RA_OPT_MAX_FRAMES,
+   RA_OPT_MAX_FRAMES_SCREENSHOT,
+   RA_OPT_MAX_FRAMES_SCREENSHOT_PATH,
+   RA_OPT_SET_SHADER,
+   RA_OPT_ACCESSIBILITY,
+   RA_OPT_LOAD_MENU_ON_ERROR
+};
+
+
 /**
  * retroarch_parse_input_and_config:
  * @argc                 : Count of (commandline) arguments.
@@ -12691,9 +12738,9 @@ static bool retroarch_parse_input_and_config(
    p_rarch->rarch_ups_pref               = false;
    p_rarch->rarch_ips_pref               = false;
    p_rarch->rarch_bps_pref               = false;
-   *global->name.ups                     = '\0';
-   *global->name.bps                     = '\0';
-   *global->name.ips                     = '\0';
+   *runloop_st->name.ups                 = '\0';
+   *runloop_st->name.bps                 = '\0';
+   *runloop_st->name.ips                 = '\0';
 #endif
 #ifdef HAVE_CONFIGFILE
    runloop_st->overrides_active          = false;
@@ -12753,15 +12800,15 @@ static bool retroarch_parse_input_and_config(
 #endif
 
             case 's':
-               strlcpy(global->name.savefile, optarg,
-                     sizeof(global->name.savefile));
+               strlcpy(runloop_st->name.savefile, optarg,
+                     sizeof(runloop_st->name.savefile));
                retroarch_override_setting_set(
                      RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL);
                break;
 
             case 'S':
-               strlcpy(global->name.savestate, optarg,
-                     sizeof(global->name.savestate));
+               strlcpy(runloop_st->name.savestate, optarg,
+                     sizeof(runloop_st->name.savestate));
                retroarch_override_setting_set(
                      RARCH_OVERRIDE_SETTING_STATE_PATH, NULL);
                break;
@@ -13079,8 +13126,8 @@ static bool retroarch_parse_input_and_config(
 
             case RA_OPT_BPS:
 #ifdef HAVE_PATCH
-               strlcpy(global->name.bps, optarg,
-                     sizeof(global->name.bps));
+               strlcpy(runloop_st->name.bps, optarg,
+                     sizeof(runloop_st->name.bps));
                p_rarch->rarch_bps_pref = true;
                retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_BPS_PREF, NULL);
 #endif
@@ -13088,8 +13135,8 @@ static bool retroarch_parse_input_and_config(
 
             case 'U':
 #ifdef HAVE_PATCH
-               strlcpy(global->name.ups, optarg,
-                     sizeof(global->name.ups));
+               strlcpy(runloop_st->name.ups, optarg,
+                     sizeof(runloop_st->name.ups));
                p_rarch->rarch_ups_pref = true;
                retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_UPS_PREF, NULL);
 #endif
@@ -13097,8 +13144,8 @@ static bool retroarch_parse_input_and_config(
 
             case RA_OPT_IPS:
 #ifdef HAVE_PATCH
-               strlcpy(global->name.ips, optarg,
-                     sizeof(global->name.ips));
+               strlcpy(runloop_st->name.ips, optarg,
+                     sizeof(runloop_st->name.ips));
                p_rarch->rarch_ips_pref = true;
                retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_IPS_PREF, NULL);
 #endif
@@ -13261,12 +13308,12 @@ static bool retroarch_parse_input_and_config(
 
    /* Copy SRM/state dirs used, so they can be reused on reentrancy. */
    if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
-         path_is_directory(global->name.savefile))
-      dir_set(RARCH_DIR_SAVEFILE, global->name.savefile);
+         path_is_directory(runloop_st->name.savefile))
+      dir_set(RARCH_DIR_SAVEFILE, runloop_st->name.savefile);
 
    if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
-         path_is_directory(global->name.savestate))
-      dir_set(RARCH_DIR_SAVESTATE, global->name.savestate);
+         path_is_directory(runloop_st->name.savestate))
+      dir_set(RARCH_DIR_SAVESTATE, runloop_st->name.savestate);
 
    return verbosity_enabled;
 }
@@ -14195,7 +14242,6 @@ bool retroarch_main_quit(void)
    runloop_state_t *runloop_st   = &runloop_state;
    video_driver_state_t*video_st = video_state_get_ptr();
    settings_t *settings          = config_get_ptr();
-   global_t            *global   = global_get_ptr();
 #ifdef HAVE_DISCORD
    discord_state_t *discord_st   = discord_state_get_ptr();
    if (discord_st->inited)
@@ -14225,7 +14271,6 @@ bool retroarch_main_quit(void)
    {
       command_event_save_auto_state(
             settings->bools.savestate_auto_save,
-            global,
             runloop_st->current_core_type);
 
       /* If any save states are in progress, wait
@@ -14446,6 +14491,35 @@ static void runloop_apply_fastmotion_override(runloop_state_t *runloop_st, setti
                   fastforward_ratio_current);
 }
 
+#define HOTKEY_CHECK(cmd1, cmd2, cond, cond2) \
+   { \
+      static bool old_pressed                   = false; \
+      bool pressed                              = BIT256_GET(current_bits, cmd1); \
+      if (pressed && !old_pressed) \
+         if (cond) \
+            command_event(cmd2, cond2); \
+      old_pressed                               = pressed; \
+   }
+
+#define HOTKEY_CHECK3(cmd1, cmd2, cmd3, cmd4, cmd5, cmd6) \
+   { \
+      static bool old_pressed                   = false; \
+      static bool old_pressed2                  = false; \
+      static bool old_pressed3                  = false; \
+      bool pressed                              = BIT256_GET(current_bits, cmd1); \
+      bool pressed2                             = BIT256_GET(current_bits, cmd3); \
+      bool pressed3                             = BIT256_GET(current_bits, cmd5); \
+      if (pressed && !old_pressed) \
+         command_event(cmd2, (void*)(intptr_t)0); \
+      else if (pressed2 && !old_pressed2) \
+         command_event(cmd4, (void*)(intptr_t)0); \
+      else if (pressed3 && !old_pressed3) \
+         command_event(cmd6, (void*)(intptr_t)0); \
+      old_pressed                               = pressed; \
+      old_pressed2                              = pressed2; \
+      old_pressed3                              = pressed3; \
+   }
+
 static enum runloop_state_enum runloop_check_state(
       struct rarch_state *p_rarch,
       settings_t *settings,
@@ -14829,7 +14903,6 @@ static enum runloop_state_enum runloop_check_state(
       struct menu_state *menu_st    = menu_state_get_ptr();
       bool focused                  = false;
       input_bits_t trigger_input    = current_bits;
-      global_t *global              = global_get_ptr();
       unsigned screensaver_timeout  = settings->uints.menu_screensaver_timeout;
 
       /* Get current time */
@@ -14846,45 +14919,42 @@ static enum runloop_state_enum runloop_check_state(
       focused                   = focused &&
          !p_rarch->main_ui_companion_is_on_foreground;
 
-      if (global)
+      if (action == old_action)
       {
-         if (action == old_action)
-         {
-            retro_time_t press_time           = current_time;
+	      retro_time_t press_time           = current_time;
 
-            if (action == MENU_ACTION_NOOP)
-               global->menu.noop_press_time   = press_time - global->menu.noop_start_time;
-            else
-               global->menu.action_press_time = press_time - global->menu.action_start_time;
-         }
-         else
-         {
-            if (action == MENU_ACTION_NOOP)
-            {
-               global->menu.noop_start_time      = current_time;
-               global->menu.noop_press_time      = 0;
+	      if (action == MENU_ACTION_NOOP)
+		      menu_st->noop_press_time   = press_time - menu_st->noop_start_time;
+	      else
+		      menu_st->action_press_time = press_time - menu_st->action_start_time;
+      }
+      else
+      {
+	      if (action == MENU_ACTION_NOOP)
+	      {
+		      menu_st->noop_start_time      = current_time;
+		      menu_st->noop_press_time      = 0;
 
-               if (global->menu_prev_action == old_action)
-                  global->menu.action_start_time = global->menu.prev_start_time;
-               else
-                  global->menu.action_start_time = current_time;
-            }
-            else
-            {
-               if (  global->menu_prev_action == action &&
-                     global->menu.noop_press_time < 200000) /* 250ms */
-               {
-                  global->menu.action_start_time = global->menu.prev_start_time;
-                  global->menu.action_press_time = current_time - global->menu.action_start_time;
-               }
-               else
-               {
-                  global->menu.prev_start_time   = current_time;
-                  global->menu_prev_action       = action;
-                  global->menu.action_press_time = 0;
-               }
-            }
-         }
+		      if (menu_st->prev_action == old_action)
+			      menu_st->action_start_time = menu_st->prev_start_time;
+		      else
+			      menu_st->action_start_time = current_time;
+	      }
+	      else
+	      {
+		      if (  menu_st->prev_action == action &&
+				      menu_st->noop_press_time < 200000) /* 250ms */
+		      {
+			      menu_st->action_start_time = menu_st->prev_start_time;
+			      menu_st->action_press_time = current_time - menu_st->action_start_time;
+		      }
+		      else
+		      {
+			      menu_st->prev_start_time   = current_time;
+			      menu_st->prev_action       = action;
+			      menu_st->action_press_time = 0;
+		      }
+	      }
       }
 
       /* Check whether menu screensaver should be enabled */
@@ -15459,10 +15529,9 @@ static enum runloop_state_enum runloop_check_state(
 
          if (!timer.timer_begin)
          {
-            uint64_t current_usec = cpu_features_get_time_usec();
-            RARCH_TIMER_BEGIN_NEW_TIME_USEC(timer,
-                  current_usec,
-                  SHADER_FILE_WATCH_DELAY_MSEC * 1000);
+            timer.timeout_us  = SHADER_FILE_WATCH_DELAY_MSEC * 1000;
+            timer.current     = cpu_features_get_time_usec();
+            timer.timeout_end = timer.current + timer.timeout_us;
             timer.timer_begin = true;
             timer.timer_end   = false;
          }
@@ -15478,12 +15547,16 @@ static enum runloop_state_enum runloop_check_state(
        */
       if (need_to_apply)
       {
-         RARCH_TIMER_TICK(timer, current_time);
+         timer.current        = current_time; 
+         timer.timeout_us     = timer.timeout_end - timer.current;
 
-         if (!timer.timer_end && RARCH_TIMER_HAS_EXPIRED(timer))
+         if (     !timer.timer_end 
+               &&  timer.timeout_us <= 0)
          {
-            RARCH_TIMER_END(timer);
-            need_to_apply = false;
+            timer.timer_end   = true;
+            timer.timer_begin = false;
+            timer.timeout_end = 0;
+            need_to_apply     = false;
             command_event(CMD_EVENT_SHADERS_APPLY_CHANGES, NULL);
          }
       }
@@ -15494,21 +15567,24 @@ static enum runloop_state_enum runloop_check_state(
    {
       if (!runloop_st->shader_delay_timer.timer_begin)
       {
-         uint64_t current_usec = cpu_features_get_time_usec();
-         RARCH_TIMER_BEGIN_NEW_TIME_USEC(
-               runloop_st->shader_delay_timer,
-               current_usec,
-               settings->uints.video_shader_delay * 1000);
-         runloop_st->shader_delay_timer.timer_begin = true;
-         runloop_st->shader_delay_timer.timer_end   = false;
+         runloop_st->shader_delay_timer.timeout_us     = settings->uints.video_shader_delay * 1000;
+         runloop_st->shader_delay_timer.current        = cpu_features_get_time_usec();
+         runloop_st->shader_delay_timer.timeout_end    = runloop_st->shader_delay_timer.current 
+                                                       + runloop_st->shader_delay_timer.timeout_us;
+         runloop_st->shader_delay_timer.timer_begin    = true;
+         runloop_st->shader_delay_timer.timer_end      = false;
       }
       else
       {
-         RARCH_TIMER_TICK(runloop_st->shader_delay_timer, current_time);
+         runloop_st->shader_delay_timer.current        = current_time;
+         runloop_st->shader_delay_timer.timeout_us     = runloop_st->shader_delay_timer.timeout_end 
+                                                       - runloop_st->shader_delay_timer.current;
 
-         if (RARCH_TIMER_HAS_EXPIRED(runloop_st->shader_delay_timer))
+         if (runloop_st->shader_delay_timer.timeout_us <= 0)
          {
-            RARCH_TIMER_END(runloop_st->shader_delay_timer);
+            runloop_st->shader_delay_timer.timer_end   = true;
+            runloop_st->shader_delay_timer.timer_begin = false;
+            runloop_st->shader_delay_timer.timeout_end = 0;
 
             {
                const char *preset          = retroarch_get_shader_preset();
diff --git a/retroarch_data.h b/retroarch_data.h
index efc04a34d8..39d6a6d7fd 100644
--- a/retroarch_data.h
+++ b/retroarch_data.h
@@ -1,19 +1,3 @@
-#define RARCH_TIMER_TICK(_timer, current_time) \
-   _timer.current    = current_time; \
-   _timer.timeout_us = (_timer.timeout_end - _timer.current) \
-
-#define RARCH_TIMER_END(_timer) \
-   _timer.timer_end   = true; \
-   _timer.timer_begin = false; \
-   _timer.timeout_end = 0
-
-#define RARCH_TIMER_BEGIN_NEW_TIME_USEC(_timer, current_usec, timeout_usec) \
-   _timer.timeout_us  = timeout_usec; \
-   _timer.current     = current_usec; \
-   _timer.timeout_end = _timer.current + _timer.timeout_us
-
-#define RARCH_TIMER_HAS_EXPIRED(_timer) ((_timer.timeout_us <= 0))
-
 #define DRIVERS_CMD_ALL \
       ( DRIVER_AUDIO_MASK \
       | DRIVER_VIDEO_MASK \
@@ -53,71 +37,6 @@
 #define DEFAULT_EXT ""
 #endif
 
-#define SHADER_FILE_WATCH_DELAY_MSEC 500
-
-#define QUIT_DELAY_USEC 3 * 1000000 /* 3 seconds */
-
-#define DEBUG_INFO_FILENAME "debug_info.txt"
-
-#define DEFAULT_NETWORK_GAMEPAD_PORT 55400
-#define UDP_FRAME_PACKETS 16
-
-#ifdef HAVE_BSV_MOVIE
-#define BSV_MOVIE_IS_EOF() || (input_st->bsv_movie_state.movie_end && \
-input_st->bsv_movie_state.eof_exit)
-#else
-#define BSV_MOVIE_IS_EOF()
-#endif
-
-#if HAVE_DYNAMIC
-#define RUNAHEAD_RUN_SECONDARY(runloop_st) \
-   if (!secondary_core_run_use_last_input()) \
-      runloop_st->runahead_secondary_core_available = false
-#endif
-
-#define RUNAHEAD_RESUME_VIDEO(video_st) \
-   if (video_st->runahead_is_active) \
-      video_st->active = true; \
-   else \
-      video_st->active = false
-
-#define _PSUPP_BUF(buf, var, name, desc) \
-   strlcat(buf, "  ", sizeof(buf)); \
-   strlcat(buf, name, sizeof(buf)); \
-   strlcat(buf, ":\n\t\t", sizeof(buf)); \
-   strlcat(buf, desc, sizeof(buf)); \
-   strlcat(buf, ": ", sizeof(buf)); \
-   strlcat(buf, var ? "yes\n" : "no\n", sizeof(buf))
-
-#define HOTKEY_CHECK(cmd1, cmd2, cond, cond2) \
-   { \
-      static bool old_pressed                   = false; \
-      bool pressed                              = BIT256_GET(current_bits, cmd1); \
-      if (pressed && !old_pressed) \
-         if (cond) \
-            command_event(cmd2, cond2); \
-      old_pressed                               = pressed; \
-   }
-
-#define HOTKEY_CHECK3(cmd1, cmd2, cmd3, cmd4, cmd5, cmd6) \
-   { \
-      static bool old_pressed                   = false; \
-      static bool old_pressed2                  = false; \
-      static bool old_pressed3                  = false; \
-      bool pressed                              = BIT256_GET(current_bits, cmd1); \
-      bool pressed2                             = BIT256_GET(current_bits, cmd3); \
-      bool pressed3                             = BIT256_GET(current_bits, cmd5); \
-      if (pressed && !old_pressed) \
-         command_event(cmd2, (void*)(intptr_t)0); \
-      else if (pressed2 && !old_pressed2) \
-         command_event(cmd4, (void*)(intptr_t)0); \
-      else if (pressed3 && !old_pressed3) \
-         command_event(cmd6, (void*)(intptr_t)0); \
-      old_pressed                               = pressed; \
-      old_pressed2                              = pressed2; \
-      old_pressed3                              = pressed3; \
-   }
-
 #ifdef HAVE_DYNAMIC
 #define SYMBOL(x) do { \
    function_t func = dylib_proc(lib_handle_local, #x); \
@@ -214,12 +133,6 @@ input_st->bsv_movie_state.eof_exit)
 #endif
 #endif
 
-#ifdef _WIN32
-#define PERF_LOG_FMT "[PERF]: Avg (%s): %I64u ticks, %I64u runs.\n"
-#else
-#define PERF_LOG_FMT "[PERF]: Avg (%s): %llu ticks, %llu runs.\n"
-#endif
-
 /* DRIVERS */
 static bluetooth_driver_t bluetooth_null = {
    NULL, /* init */
@@ -351,39 +264,6 @@ static const camera_driver_t *camera_drivers[] = {
 };
 
 /* MAIN GLOBAL VARIABLES */
-
-/* Descriptive names for options without short variant.
- *
- * Please keep the name in sync with the option name.
- * Order does not matter. */
-enum
-{
-   RA_OPT_MENU = 256, /* must be outside the range of a char */
-   RA_OPT_STATELESS,
-   RA_OPT_CHECK_FRAMES,
-   RA_OPT_PORT,
-   RA_OPT_SPECTATE,
-   RA_OPT_NICK,
-   RA_OPT_COMMAND,
-   RA_OPT_APPENDCONFIG,
-   RA_OPT_BPS,
-   RA_OPT_IPS,
-   RA_OPT_NO_PATCH,
-   RA_OPT_RECORDCONFIG,
-   RA_OPT_SUBSYSTEM,
-   RA_OPT_SIZE,
-   RA_OPT_FEATURES,
-   RA_OPT_VERSION,
-   RA_OPT_EOF_EXIT,
-   RA_OPT_LOG_FILE,
-   RA_OPT_MAX_FRAMES,
-   RA_OPT_MAX_FRAMES_SCREENSHOT,
-   RA_OPT_MAX_FRAMES_SCREENSHOT_PATH,
-   RA_OPT_SET_SHADER,
-   RA_OPT_ACCESSIBILITY,
-   RA_OPT_LOAD_MENU_ON_ERROR
-};
-
 struct rarch_state
 {
    struct global              g_extern;         /* retro_time_t alignment */
diff --git a/retroarch_types.h b/retroarch_types.h
index b98cf8be0d..17764d9012 100644
--- a/retroarch_types.h
+++ b/retroarch_types.h
@@ -332,28 +332,6 @@ typedef struct rarch_resolution
 
 typedef struct global
 {
-#ifdef HAVE_MENU
-   struct
-   {
-      retro_time_t prev_start_time;
-      retro_time_t noop_press_time;
-      retro_time_t noop_start_time;
-      retro_time_t action_start_time;
-      retro_time_t action_press_time;
-   } menu;
-#endif
-   struct
-   {
-      char *remapfile;
-      char savefile[8192];
-      char savestate[8192];
-      char cheatfile[8192];
-      char ups[8192];
-      char bps[8192];
-      char ips[8192];
-      char label[8192];
-   } name;
-
    /* Recording. */
    struct
    {
@@ -393,15 +371,7 @@ typedef struct global
       bool softfilter_enable;
 
    } console;
-   unsigned old_analog_dpad_mode[MAX_USERS];
-   unsigned old_libretro_device[MAX_USERS];
-   bool old_analog_dpad_mode_set;
-   bool old_libretro_device_set;
-   bool remapping_cache_active;
    /* Settings and/or global states specific to menus */
-#ifdef HAVE_MENU
-   enum menu_action menu_prev_action;
-#endif
    bool launched_from_cli;
    bool cli_load_menu_on_error;
 } global_t;
diff --git a/runloop.h b/runloop.h
index 55d5672eab..d80fb9b81a 100644
--- a/runloop.h
+++ b/runloop.h
@@ -242,6 +242,18 @@ struct runloop
    char savefile_dir[PATH_MAX_LENGTH];
    char savestate_dir[PATH_MAX_LENGTH];
 
+   struct
+   {
+      char *remapfile;
+      char savefile[8192];
+      char savestate[8192];
+      char cheatfile[8192];
+      char ups[8192];
+      char bps[8192];
+      char ips[8192];
+      char label[8192];
+   } name;
+
    bool is_inited;
    bool missing_bios;
    bool force_nonblock;
@@ -288,6 +300,13 @@ struct runloop
 
 typedef struct runloop runloop_state_t;
 
+#ifdef HAVE_BSV_MOVIE
+#define BSV_MOVIE_IS_EOF() || (input_st->bsv_movie_state.movie_end && \
+input_st->bsv_movie_state.eof_exit)
+#else
+#define BSV_MOVIE_IS_EOF()
+#endif
+
 /* Time to exit out of the main loop?
  * Reasons for exiting:
  * a) Shutdown environment callback was invoked.
diff --git a/tasks/task_content.c b/tasks/task_content.c
index 3361b21536..d8d7576985 100644
--- a/tasks/task_content.c
+++ b/tasks/task_content.c
@@ -1535,6 +1535,7 @@ static void task_push_to_history_list(
 {
    bool            contentless = false;
    bool            is_inited   = false;
+   runloop_state_t *runloop_st = runloop_state_get_ptr();
 
    content_get_status(&contentless, &is_inited);
 
@@ -1570,7 +1571,6 @@ static void task_push_to_history_list(
          const char *db_name        = NULL;
          playlist_t *playlist_hist  = g_defaults.content_history;
          settings_t *settings       = config_get_ptr();
-         global_t *global           = global_get_ptr();
 
          switch (path_is_media_type(tmp))
          {
@@ -1641,8 +1641,8 @@ static void task_push_to_history_list(
             }
          }
 
-         if (global && !string_is_empty(global->name.label))
-            label = global->name.label;
+         if (!string_is_empty(runloop_st->name.label))
+            label = runloop_st->name.label;
 
          if (
               settings && settings->bools.history_list_enable 
@@ -1770,7 +1770,6 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
    content_state_t                 *p_content = content_state_get_ptr();
    bool ret                                   = true;
    char *error_string                         = NULL;
-   global_t *global                           = global_get_ptr();
    settings_t *settings                       = config_get_ptr();
    runloop_state_t *runloop_st                = runloop_state_get_ptr();
    rarch_system_info_t *sys_info              = &runloop_st->system;
@@ -1801,15 +1800,12 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
    content_ctx.subsystem.data                 = NULL;
    content_ctx.subsystem.size                 = 0;
 
-   if (global)
-   {
-      if (!string_is_empty(global->name.ips))
-         content_ctx.name_ips                 = strdup(global->name.ips);
-      if (!string_is_empty(global->name.bps))
-         content_ctx.name_bps                 = strdup(global->name.bps);
-      if (!string_is_empty(global->name.ups))
-         content_ctx.name_ups                 = strdup(global->name.ups);
-   }
+   if (!string_is_empty(runloop_st->name.ips))
+      content_ctx.name_ips                 = strdup(runloop_st->name.ips);
+   if (!string_is_empty(runloop_st->name.bps))
+      content_ctx.name_bps                 = strdup(runloop_st->name.bps);
+   if (!string_is_empty(runloop_st->name.ups))
+      content_ctx.name_ups                 = strdup(runloop_st->name.ups);
 
    if (!string_is_empty(path_dir_system))
       content_ctx.directory_system            = strdup(path_dir_system);
@@ -1868,7 +1864,6 @@ bool task_push_load_content_from_playlist_from_menu(
    content_state_t                 *p_content = content_state_get_ptr();
    bool ret                                   = true;
    char *error_string                         = NULL;
-   global_t *global                           = global_get_ptr();
    settings_t *settings                       = config_get_ptr();
    runloop_state_t *runloop_st                = runloop_state_get_ptr();
    rarch_system_info_t *sys_info              = &runloop_st->system;
@@ -1898,19 +1893,16 @@ bool task_push_load_content_from_playlist_from_menu(
    content_ctx.subsystem.data                 = NULL;
    content_ctx.subsystem.size                 = 0;
 
-   if (global)
-   {
-      if (!string_is_empty(global->name.ips))
-         content_ctx.name_ips                 = strdup(global->name.ips);
-      if (!string_is_empty(global->name.bps))
-         content_ctx.name_bps                 = strdup(global->name.bps);
-      if (!string_is_empty(global->name.ups))
-         content_ctx.name_ups                 = strdup(global->name.ups);
-      if (label)
-         strlcpy(global->name.label, label, sizeof(global->name.label));
-      else
-         global->name.label[0] = '\0';
-   }
+   if (!string_is_empty(runloop_st->name.ips))
+      content_ctx.name_ips                 = strdup(runloop_st->name.ips);
+   if (!string_is_empty(runloop_st->name.bps))
+      content_ctx.name_bps                 = strdup(runloop_st->name.bps);
+   if (!string_is_empty(runloop_st->name.ups))
+      content_ctx.name_ups                 = strdup(runloop_st->name.ups);
+   if (label)
+      strlcpy(runloop_st->name.label, label, sizeof(runloop_st->name.label));
+   else
+      runloop_st->name.label[0] = '\0';
 
    if (!string_is_empty(path_dir_system))
       content_ctx.directory_system            = strdup(path_dir_system);
@@ -2011,7 +2003,6 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
    content_state_t                 *p_content = content_state_get_ptr();
    bool ret                                   = true;
    char *error_string                         = NULL;
-   global_t *global                           = global_get_ptr();
    settings_t *settings                       = config_get_ptr();
    runloop_state_t *runloop_st                = runloop_state_get_ptr();
    const char *path_dir_system                = settings->paths.directory_system;
@@ -2041,15 +2032,12 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
    content_ctx.subsystem.data                 = NULL;
    content_ctx.subsystem.size                 = 0;
 
-   if (global)
-   {
-      if (!string_is_empty(global->name.ips))
-         content_ctx.name_ips                 = strdup(global->name.ips);
-      if (!string_is_empty(global->name.bps))
-         content_ctx.name_bps                 = strdup(global->name.bps);
-      if (!string_is_empty(global->name.ups))
-         content_ctx.name_ups                 = strdup(global->name.ups);
-   }
+   if (!string_is_empty(runloop_st->name.ips))
+      content_ctx.name_ips                 = strdup(runloop_st->name.ips);
+   if (!string_is_empty(runloop_st->name.bps))
+      content_ctx.name_bps                 = strdup(runloop_st->name.bps);
+   if (!string_is_empty(runloop_st->name.ups))
+      content_ctx.name_ups                 = strdup(runloop_st->name.ups);
 
    if (!string_is_empty(path_dir_system))
       content_ctx.directory_system            = strdup(path_dir_system);
@@ -2144,7 +2132,6 @@ bool task_push_load_content_with_new_core_from_menu(
    content_state_t                 *p_content = content_state_get_ptr();
    bool ret                                   = true;
    char *error_string                         = NULL;
-   global_t *global                           = global_get_ptr();
    settings_t *settings                       = config_get_ptr();
    runloop_state_t *runloop_st                = runloop_state_get_ptr();
    bool check_firmware_before_loading         = settings->bools.check_firmware_before_loading;
@@ -2184,17 +2171,14 @@ bool task_push_load_content_with_new_core_from_menu(
    content_ctx.subsystem.data                 = NULL;
    content_ctx.subsystem.size                 = 0;
 
-   if (global)
-   {
-      if (!string_is_empty(global->name.ips))
-         content_ctx.name_ips                 = strdup(global->name.ips);
-      if (!string_is_empty(global->name.bps))
-         content_ctx.name_bps                 = strdup(global->name.bps);
-      if (!string_is_empty(global->name.ups))
-         content_ctx.name_ups                 = strdup(global->name.ups);
+   if (!string_is_empty(runloop_st->name.ips))
+      content_ctx.name_ips                 = strdup(runloop_st->name.ips);
+   if (!string_is_empty(runloop_st->name.bps))
+      content_ctx.name_bps                 = strdup(runloop_st->name.bps);
+   if (!string_is_empty(runloop_st->name.ups))
+      content_ctx.name_ups                 = strdup(runloop_st->name.ups);
 
-      global->name.label[0]                   = '\0';
-   }
+   runloop_st->name.label[0]                   = '\0';
 
    if (!string_is_empty(path_dir_system))
       content_ctx.directory_system            = strdup(path_dir_system);
@@ -2266,7 +2250,6 @@ static bool task_load_content_internal(
    content_state_t                 *p_content = content_state_get_ptr();
    bool ret                                   = false;
    char *error_string                         = NULL;
-   global_t *global                           = global_get_ptr();
    runloop_state_t *runloop_st                = runloop_state_get_ptr();
    rarch_system_info_t *sys_info              = &runloop_st->system;
    settings_t *settings                       = config_get_ptr();
@@ -2314,15 +2297,12 @@ static bool task_load_content_internal(
       content_ctx.subsystem.size              = sys_info->subsystem.size;
    }
 
-   if (global)
-   {
-      if (!string_is_empty(global->name.ips))
-         content_ctx.name_ips                 = strdup(global->name.ips);
-      if (!string_is_empty(global->name.bps))
-         content_ctx.name_bps                 = strdup(global->name.bps);
-      if (!string_is_empty(global->name.ups))
-         content_ctx.name_ups                 = strdup(global->name.ups);
-   }
+   if (!string_is_empty(runloop_st->name.ips))
+      content_ctx.name_ips                 = strdup(runloop_st->name.ips);
+   if (!string_is_empty(runloop_st->name.bps))
+      content_ctx.name_bps                 = strdup(runloop_st->name.bps);
+   if (!string_is_empty(runloop_st->name.ups))
+      content_ctx.name_ups                 = strdup(runloop_st->name.ups);
 
    if (!string_is_empty(path_dir_system))
       content_ctx.directory_system            = strdup(path_dir_system);
@@ -2389,6 +2369,7 @@ bool task_push_load_content_with_new_core_from_companion_ui(
       void *user_data)
 {
    global_t *global            = global_get_ptr();
+   runloop_state_t *runloop_st = runloop_state_get_ptr();
    content_state_t  *p_content = content_state_get_ptr();
 
    path_set(RARCH_PATH_CONTENT, fullpath);
@@ -2411,13 +2392,10 @@ bool task_push_load_content_with_new_core_from_companion_ui(
 
    global->launched_from_cli = false;
 
-   if (global)
-   {
-      if (label)
-         strlcpy(global->name.label, label, sizeof(global->name.label));
-      else
-         global->name.label[0] = '\0';
-   }
+   if (label)
+      strlcpy(runloop_st->name.label, label, sizeof(runloop_st->name.label));
+   else
+      runloop_st->name.label[0] = '\0';
 
    /* Load content */
    if (!task_load_content_internal(content_info, true, false, true))
@@ -2772,7 +2750,6 @@ bool content_init(void)
 
    bool ret                                   = true;
    char *error_string                         = NULL;
-   global_t *global                           = global_get_ptr();
    runloop_state_t *runloop_st                = runloop_state_get_ptr();
    rarch_system_info_t *sys_info              = &runloop_st->system;
    settings_t *settings                       = config_get_ptr();
@@ -2804,15 +2781,12 @@ bool content_init(void)
    content_ctx.subsystem.data                 = NULL;
    content_ctx.subsystem.size                 = 0;
 
-   if (global)
-   {
-      if (!string_is_empty(global->name.ips))
-         content_ctx.name_ips                 = strdup(global->name.ips);
-      if (!string_is_empty(global->name.bps))
-         content_ctx.name_bps                 = strdup(global->name.bps);
-      if (!string_is_empty(global->name.ups))
-         content_ctx.name_ups                 = strdup(global->name.ups);
-   }
+   if (!string_is_empty(runloop_st->name.ips))
+      content_ctx.name_ips                 = strdup(runloop_st->name.ips);
+   if (!string_is_empty(runloop_st->name.bps))
+      content_ctx.name_bps                 = strdup(runloop_st->name.bps);
+   if (!string_is_empty(runloop_st->name.ups))
+      content_ctx.name_ups                 = strdup(runloop_st->name.ups);
 
    if (sys_info)
    {
diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp
index 2536fbfd54..ead4a7ef63 100644
--- a/ui/drivers/ui_qt.cpp
+++ b/ui/drivers/ui_qt.cpp
@@ -4947,6 +4947,8 @@ static void ui_companion_qt_toggle(void *data, bool force)
 
    if (ui_companion_toggle || force)
    {
+      video_driver_state_t *video_st = video_state_get_ptr();
+
       if (mouse_grabbed)
          command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL);
       video_driver_show_mouse();
@@ -4958,7 +4960,8 @@ static void ui_companion_qt_toggle(void *data, bool force)
       win_handle->qtWindow->raise();
       win_handle->qtWindow->show();
 
-      if (video_driver_started_fullscreen())
+      if (   video_st
+          && video_st->started_fullscreen)
          win_handle->qtWindow->lower();
 
       if (!already_started)