diff --git a/apple/common/RAGameView.m b/apple/common/RAGameView.m index ce738f5d20..d493d43b40 100644 --- a/apple/common/RAGameView.m +++ b/apple/common/RAGameView.m @@ -379,12 +379,11 @@ void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height) void apple_gfx_ctx_update_window_title(void) { -#ifdef OSX static char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; bool got_text = gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); static const char* const text = buf; // < Can't access buf directly in the block - +#ifdef OSX if (got_text) { // NOTE: This could go bad if buf is updated again before this completes. @@ -394,10 +393,9 @@ void apple_gfx_ctx_update_window_title(void) g_view.window.title = @(text); }); } - +#endif if (fps_draw) msg_queue_push(g_extern.msg_queue, buf_fps, 1, 1); -#endif } bool apple_gfx_ctx_has_focus(void) diff --git a/frontend/menu/menu_settings.c b/frontend/menu/menu_settings.c index a8b389f79b..64615a543b 100644 --- a/frontend/menu/menu_settings.c +++ b/frontend/menu/menu_settings.c @@ -206,14 +206,9 @@ int menu_set_settings(unsigned setting, unsigned action) break; case RGUI_SETTINGS_DEBUG_TEXT: if (action == RGUI_ACTION_START) - g_extern.lifecycle_mode_state &= ~(1ULL << MODE_FPS_DRAW); + g_settings.fps_show = false; else if (action == RGUI_ACTION_LEFT || RGUI_ACTION_RIGHT) - { - if (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) - g_extern.lifecycle_mode_state &= ~(1ULL << MODE_FPS_DRAW); - else - g_extern.lifecycle_mode_state |= (1ULL << MODE_FPS_DRAW); - } + g_settings.fps_show = !g_settings.fps_show; break; case RGUI_SETTINGS_DISK_INDEX: { @@ -1131,7 +1126,7 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w, snprintf(type_str, type_str_size, "%.3f", g_settings.audio.rate_control_delta); break; case RGUI_SETTINGS_DEBUG_TEXT: - snprintf(type_str, type_str_size, (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) ? "ON" : "OFF"); + snprintf(type_str, type_str_size, (g_settings.fps_show) ? "ON" : "OFF"); break; case RGUI_BROWSER_DIR_PATH: strlcpy(type_str, *g_settings.rgui_browser_directory ? g_settings.rgui_browser_directory : "", type_str_size); diff --git a/frontend/menu/rmenu_xui.cpp b/frontend/menu/rmenu_xui.cpp index 4c0a836ffe..ef084b804e 100644 --- a/frontend/menu/rmenu_xui.cpp +++ b/frontend/menu/rmenu_xui.cpp @@ -399,7 +399,7 @@ static void init_menulist(unsigned menu_id) XuiListInsertItems(m_menulist, SETTING_EMU_SHOW_INFO_MSG, 1); XuiListSetText(m_menulist, SETTING_EMU_SHOW_INFO_MSG, (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW)) ? L"Info Messages: ON" : L"Info Messages: OFF"); XuiListInsertItems(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, 1); - XuiListSetText(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) ? L"Debug Info Messages: ON" : L"Debug Info messages: OFF"); + XuiListSetText(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, (g_settings.fps_show) ? L"Show Framerate: ON" : L"Show Framerate: OFF"); break; case INGAME_MENU_MAIN_MODE: XuiListInsertItems(m_menulist, INGAME_MENU_CHANGE_LIBRETRO_CORE, 1); @@ -724,7 +724,7 @@ HRESULT CRetroArchSettings::OnControlNavigate(XUIMessageControlNavigate *pContro break; case SETTING_EMU_SHOW_DEBUG_INFO_MSG: menu_set_settings(RGUI_SETTINGS_DEBUG_TEXT, action); - XuiListSetText(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) ? L"Debug Info messages: ON" : L"Debug Info messages: OFF"); + XuiListSetText(m_menulist, SETTING_EMU_SHOW_DEBUG_INFO_MSG, g_settings.fps_show ? L"Show Framerate: ON" : L"Show Framerate: OFF"); break; default: break; diff --git a/general.h b/general.h index f0e246c129..b19058b634 100644 --- a/general.h +++ b/general.h @@ -114,7 +114,6 @@ enum menu_enums MODE_MENU_HD, MODE_MENU_PREINIT, MODE_INFO_DRAW, - MODE_FPS_DRAW, MODE_EXTLAUNCH_MULTIMAN, MODE_EXITSPAWN, MODE_EXITSPAWN_START_GAME, @@ -288,6 +287,7 @@ struct settings char rgui_config_directory[PATH_MAX]; bool rgui_show_start_screen; #endif + bool fps_show; }; enum rarch_game_type diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index 198dd09f85..b87c45a41b 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -197,7 +197,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/bbqnx_ctx.c b/gfx/context/bbqnx_ctx.c index f8a07df390..13941a10f8 100644 --- a/gfx/context/bbqnx_ctx.c +++ b/gfx/context/bbqnx_ctx.c @@ -323,7 +323,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/drm_egl_ctx.c b/gfx/context/drm_egl_ctx.c index 9abec0f7df..fe7759644d 100644 --- a/gfx/context/drm_egl_ctx.c +++ b/gfx/context/drm_egl_ctx.c @@ -216,7 +216,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/emscriptenegl_ctx.c b/gfx/context/emscriptenegl_ctx.c index ec650bf64a..38341e64a6 100644 --- a/gfx/context/emscriptenegl_ctx.c +++ b/gfx/context/emscriptenegl_ctx.c @@ -83,7 +83,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/glx_ctx.c b/gfx/context/glx_ctx.c index 488129a64e..533dbaffc8 100644 --- a/gfx/context/glx_ctx.c +++ b/gfx/context/glx_ctx.c @@ -166,7 +166,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; if (gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps))) XStoreName(g_dpy, g_win, buf); diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 43df50e836..d1ea16c19a 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -189,7 +189,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) { } static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/vc_egl_ctx.c b/gfx/context/vc_egl_ctx.c index dfdef5a7f7..f39b0c3482 100644 --- a/gfx/context/vc_egl_ctx.c +++ b/gfx/context/vc_egl_ctx.c @@ -110,7 +110,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/wgl_ctx.c b/gfx/context/wgl_ctx.c index 49360994ee..8ed7cd7526 100644 --- a/gfx/context/wgl_ctx.c +++ b/gfx/context/wgl_ctx.c @@ -278,7 +278,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; if (gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps))) SetWindowText(g_hwnd, buf); diff --git a/gfx/context/xdk_ctx.c b/gfx/context/xdk_ctx.c index 379f806579..2af16d9171 100644 --- a/gfx/context/xdk_ctx.c +++ b/gfx/context/xdk_ctx.c @@ -84,7 +84,7 @@ extern unsigned font_x, font_y; static void gfx_ctx_xdk_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps)); if (fps_draw) diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index 0dda2fef17..82b8d54292 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -180,7 +180,7 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128], buf_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; if (gfx_get_fps(buf, sizeof(buf), fps_draw ? buf_fps : NULL, sizeof(buf_fps))) XStoreName(g_dpy, g_win, buf); diff --git a/gfx/d3d9/d3d9.cpp b/gfx/d3d9/d3d9.cpp index 46ce79bc9b..ef6a680d3e 100644 --- a/gfx/d3d9/d3d9.cpp +++ b/gfx/d3d9/d3d9.cpp @@ -1007,7 +1007,7 @@ void D3DVideo::deinit_font() void D3DVideo::update_title() { char buffer[128], buffer_fps[128]; - bool fps_draw = g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; if (gfx_get_fps(buffer, sizeof(buffer), fps_draw ? buffer_fps : NULL, sizeof(buffer_fps))) { std::string title = buffer; diff --git a/gx/gx_video.c b/gx/gx_video.c index 7d2e4d9a48..e5b0c8cc7c 100644 --- a/gx/gx_video.c +++ b/gx/gx_video.c @@ -944,7 +944,7 @@ static bool gx_frame(void *data, const void *frame, } char fps_txt[128], fps_text_buf[128]; - bool fps_draw = lifecycle_mode_state & (1ULL << MODE_FPS_DRAW); + bool fps_draw = g_settings.fps_show; gfx_get_fps(fps_txt, sizeof(fps_txt), fps_draw ? fps_text_buf : NULL, sizeof(fps_text_buf)); if (fps_draw) diff --git a/settings.c b/settings.c index fe26dcdc33..116056725f 100644 --- a/settings.c +++ b/settings.c @@ -734,6 +734,8 @@ bool config_load_file(const char *path) if (!*g_settings.libretro) CONFIG_GET_PATH(libretro, "libretro_path"); + CONFIG_GET_BOOL(fps_show, "fps_show"); + CONFIG_GET_PATH(libretro_info_path, "libretro_info_path"); CONFIG_GET_PATH(core_options_path, "core_options_path"); @@ -1046,6 +1048,7 @@ bool config_save_file(const char *path) RARCH_LOG("Saving config at path: \"%s\"\n", path); + config_set_bool(conf, "fps_show", g_settings.fps_show); config_set_string(conf, "libretro_path", g_settings.libretro); config_set_string(conf, "libretro_info_path", g_settings.libretro_info_path); config_set_string(conf, "cheat_database_path", g_settings.cheat_database); @@ -1330,12 +1333,7 @@ void settings_set(uint64_t settings) g_settings.video.refresh_rate += 0.01f; if (settings & (1ULL << S_INFO_DEBUG_MSG_TOGGLE)) - { - if (g_extern.lifecycle_mode_state & (1ULL << MODE_FPS_DRAW)) - g_extern.lifecycle_mode_state &= ~(1ULL << MODE_FPS_DRAW); - else - g_extern.lifecycle_mode_state |= (1ULL << MODE_FPS_DRAW); - } + g_settings.fps_show = !g_settings.fps_show; if (settings & (1ULL << S_INFO_MSG_TOGGLE)) { @@ -1376,7 +1374,7 @@ void settings_set(uint64_t settings) g_settings.video.refresh_rate = refresh_rate; if (settings & (1ULL << S_DEF_INFO_DEBUG_MSG)) - g_extern.lifecycle_mode_state &= ~(1ULL << MODE_FPS_DRAW); + g_settings.fps_show = false; if (settings & (1ULL << S_DEF_INFO_MSG)) g_extern.lifecycle_mode_state |= (1ULL << MODE_INFO_DRAW);