Saves 'Show Framerate' setting to config file now too

This commit is contained in:
twinaphex 2013-10-11 01:19:54 +02:00
parent a35e708335
commit 849cfb680e
17 changed files with 26 additions and 35 deletions

View File

@ -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)

View File

@ -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 : "<default>", type_str_size);

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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);