mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 13:14:04 +00:00
Add date/time in menu
This commit is contained in:
parent
890e86293c
commit
4ccfc1af02
@ -190,6 +190,8 @@ struct settings
|
|||||||
char driver[32];
|
char driver[32];
|
||||||
bool pause_libretro;
|
bool pause_libretro;
|
||||||
bool mouse_enable;
|
bool mouse_enable;
|
||||||
|
bool timedate_enable;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -263,6 +263,7 @@ static void glui_frame(void)
|
|||||||
size_t i;
|
size_t i;
|
||||||
char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH],
|
char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH],
|
||||||
title_msg[PATH_MAX_LENGTH];
|
title_msg[PATH_MAX_LENGTH];
|
||||||
|
char timedate[PATH_MAX_LENGTH];
|
||||||
const char *dir = NULL;
|
const char *dir = NULL;
|
||||||
const char *label = NULL;
|
const char *label = NULL;
|
||||||
unsigned menu_type = 0;
|
unsigned menu_type = 0;
|
||||||
@ -337,11 +338,20 @@ static void glui_frame(void)
|
|||||||
|
|
||||||
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
||||||
core_name, core_version);
|
core_name, core_version);
|
||||||
|
|
||||||
|
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
||||||
|
|
||||||
glui_blit_line(
|
glui_blit_line(
|
||||||
glui->margin * 2,
|
glui->margin * 2,
|
||||||
glui->margin + glui->term_height * glui->line_height
|
glui->margin + glui->term_height * glui->line_height
|
||||||
+ glui->line_height * 2, title_msg, true);
|
+ glui->line_height * 2, title_msg, true);
|
||||||
|
|
||||||
|
if (g_settings.menu.timedate_enable)
|
||||||
|
glui_blit_line(
|
||||||
|
glui->margin * 14,
|
||||||
|
glui->margin + glui->term_height * glui->line_height
|
||||||
|
+ glui->line_height * 2, timedate, true);
|
||||||
|
|
||||||
|
|
||||||
x = glui->margin;
|
x = glui->margin;
|
||||||
y = glui->margin + glui->line_height * 2;
|
y = glui->margin + glui->line_height * 2;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "../../gfx/gl_common.h"
|
#include "../../gfx/gl_common.h"
|
||||||
#include "../../gfx/video_thread_wrapper.h"
|
#include "../../gfx/video_thread_wrapper.h"
|
||||||
#include <compat/posix_string.h>
|
#include <compat/posix_string.h>
|
||||||
|
#include "shared.h"
|
||||||
|
|
||||||
#include "../../settings_data.h"
|
#include "../../settings_data.h"
|
||||||
|
|
||||||
@ -558,6 +559,7 @@ static void lakka_draw_fbo(lakka_handle_t *lakka)
|
|||||||
|
|
||||||
static void lakka_frame(void)
|
static void lakka_frame(void)
|
||||||
{
|
{
|
||||||
|
char timedate[PATH_MAX_LENGTH];
|
||||||
menu_item_t *active_item = NULL;
|
menu_item_t *active_item = NULL;
|
||||||
menu_category_t *active_category = NULL;
|
menu_category_t *active_category = NULL;
|
||||||
lakka_handle_t *lakka = NULL;
|
lakka_handle_t *lakka = NULL;
|
||||||
@ -602,6 +604,8 @@ static void lakka_frame(void)
|
|||||||
lakka_draw_arrow(lakka);
|
lakka_draw_arrow(lakka);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
||||||
|
|
||||||
if (lakka->depth == 0)
|
if (lakka->depth == 0)
|
||||||
lakka_draw_text(lakka, active_category->name,
|
lakka_draw_text(lakka, active_category->name,
|
||||||
lakka->title_margin_left, lakka->title_margin_top, 1, 1.0);
|
lakka->title_margin_left, lakka->title_margin_top, 1, 1.0);
|
||||||
@ -609,6 +613,11 @@ static void lakka_frame(void)
|
|||||||
lakka_draw_text(lakka, active_item->name,
|
lakka_draw_text(lakka, active_item->name,
|
||||||
lakka->title_margin_left, lakka->title_margin_top, 1, 1.0);
|
lakka->title_margin_left, lakka->title_margin_top, 1, 1.0);
|
||||||
|
|
||||||
|
if (g_settings.menu.timedate_enable)
|
||||||
|
lakka_draw_text(lakka, timedate,
|
||||||
|
(lakka->title_margin_left * 25) - lakka->title_margin_left,
|
||||||
|
lakka->title_margin_top, 1, 1.0);
|
||||||
|
|
||||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, false);
|
gl_set_viewport(gl, gl->win_width, gl->win_height, false, false);
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
@ -1311,6 +1320,9 @@ static bool lakka_init_lists(void *data)
|
|||||||
info->display_name);
|
info->display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)get_title;
|
||||||
|
(void)disp_set_label;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +330,7 @@ static void rgui_render(void)
|
|||||||
{
|
{
|
||||||
size_t i, end;
|
size_t i, end;
|
||||||
char title[256], title_buf[256], title_msg[64];
|
char title[256], title_buf[256], title_msg[64];
|
||||||
|
char timedate[PATH_MAX_LENGTH];
|
||||||
unsigned x, y, menu_type = 0;
|
unsigned x, y, menu_type = 0;
|
||||||
const char *dir = NULL;
|
const char *dir = NULL;
|
||||||
const char *label = NULL;
|
const char *label = NULL;
|
||||||
@ -392,6 +393,8 @@ static void rgui_render(void)
|
|||||||
if (!core_version)
|
if (!core_version)
|
||||||
core_version = "";
|
core_version = "";
|
||||||
|
|
||||||
|
disp_timedate_set_label(timedate, sizeof(timedate), 3);
|
||||||
|
|
||||||
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
||||||
core_name, core_version);
|
core_name, core_version);
|
||||||
blit_line(
|
blit_line(
|
||||||
@ -399,6 +402,12 @@ static void rgui_render(void)
|
|||||||
(RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) +
|
(RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) +
|
||||||
RGUI_TERM_START_Y + 2, title_msg, true);
|
RGUI_TERM_START_Y + 2, title_msg, true);
|
||||||
|
|
||||||
|
if (g_settings.menu.timedate_enable)
|
||||||
|
blit_line(
|
||||||
|
(RGUI_TERM_WIDTH * FONT_HEIGHT_STRIDE) + (60),
|
||||||
|
(RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) +
|
||||||
|
RGUI_TERM_START_Y + 2, timedate, true);
|
||||||
|
|
||||||
|
|
||||||
x = RGUI_TERM_START_X;
|
x = RGUI_TERM_START_X;
|
||||||
y = RGUI_TERM_START_Y;
|
y = RGUI_TERM_START_Y;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#define _DISP_SHARED_H
|
#define _DISP_SHARED_H
|
||||||
|
|
||||||
#include "../../settings_data.h"
|
#include "../../settings_data.h"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
static void get_title(const char *label, const char *dir,
|
static void get_title(const char *label, const char *dir,
|
||||||
unsigned menu_type, char *title, size_t sizeof_title)
|
unsigned menu_type, char *title, size_t sizeof_title)
|
||||||
@ -162,6 +163,30 @@ static void get_title(const char *label, const char *dir,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void disp_timedate_set_label(char *label, size_t label_size,
|
||||||
|
unsigned time_mode)
|
||||||
|
{
|
||||||
|
char datetime[PATH_MAX_LENGTH];
|
||||||
|
time_t time_;
|
||||||
|
time(&time_);
|
||||||
|
|
||||||
|
switch (time_mode)
|
||||||
|
{
|
||||||
|
case 0: /* Date and time */
|
||||||
|
strftime(label, label_size, "%Y-%m-%d %H:%M:%S", localtime(&time_));
|
||||||
|
break;
|
||||||
|
case 1: /* Date */
|
||||||
|
strftime(label, label_size, "%Y-%m-%d", localtime(&time_));
|
||||||
|
break;
|
||||||
|
case 2: /* Time */
|
||||||
|
strftime(label, label_size, "%H:%M:%S", localtime(&time_));
|
||||||
|
break;
|
||||||
|
case 3: /* Time (hours-minutes) */
|
||||||
|
strftime(label, label_size, "%H:%M", localtime(&time_));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void disp_set_label(file_list_t* list,
|
static void disp_set_label(file_list_t* list,
|
||||||
unsigned *w, unsigned type, unsigned i,
|
unsigned *w, unsigned type, unsigned i,
|
||||||
const char *label,
|
const char *label,
|
||||||
|
@ -674,7 +674,7 @@ static void xmb_list_switch_new(file_list_t *list, int dir, size_t current)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_set_title()
|
static void xmb_set_title(void)
|
||||||
{
|
{
|
||||||
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
||||||
|
|
||||||
@ -818,6 +818,7 @@ static void xmb_draw_items(file_list_t *list, file_list_t *stack,
|
|||||||
entry_label, path,
|
entry_label, path,
|
||||||
path_buf, sizeof(path_buf));
|
path_buf, sizeof(path_buf));
|
||||||
|
|
||||||
|
|
||||||
GLuint icon = 0;
|
GLuint icon = 0;
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
@ -927,7 +928,7 @@ static void xmb_draw_items(file_list_t *list, file_list_t *stack,
|
|||||||
static void xmb_frame(void)
|
static void xmb_frame(void)
|
||||||
{
|
{
|
||||||
int i, depth;
|
int i, depth;
|
||||||
char title_msg[64];
|
char title_msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH];
|
||||||
const char *core_name = NULL;
|
const char *core_name = NULL;
|
||||||
const char *core_version = NULL;
|
const char *core_version = NULL;
|
||||||
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
||||||
@ -953,6 +954,13 @@ static void xmb_frame(void)
|
|||||||
xmb_draw_text(
|
xmb_draw_text(
|
||||||
xmb->title, xmb->title_margin_left, xmb->title_margin_top, 1, 1);
|
xmb->title, xmb->title_margin_left, xmb->title_margin_top, 1, 1);
|
||||||
|
|
||||||
|
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
||||||
|
|
||||||
|
if (g_settings.menu.timedate_enable)
|
||||||
|
xmb_draw_text(
|
||||||
|
timedate, (xmb->title_margin_left * 25) - xmb->title_margin_left,
|
||||||
|
xmb->title_margin_top, 1, 1);
|
||||||
|
|
||||||
core_version = g_extern.menu.info.library_version;
|
core_version = g_extern.menu.info.library_version;
|
||||||
|
|
||||||
if (!core_version)
|
if (!core_version)
|
||||||
@ -965,6 +973,7 @@ static void xmb_frame(void)
|
|||||||
xmb_draw_text(title_msg, xmb->title_margin_left,
|
xmb_draw_text(title_msg, xmb->title_margin_left,
|
||||||
gl->win_height - xmb->title_margin_bottom, 1, 1);
|
gl->win_height - xmb->title_margin_bottom, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
xmb_draw_icon(xmb->textures[XMB_TEXTURE_ARROW].id,
|
xmb_draw_icon(xmb->textures[XMB_TEXTURE_ARROW].id,
|
||||||
xmb->x + xmb->margin_left + xmb->hspacing - xmb->icon_size/2.0 + xmb->icon_size,
|
xmb->x + xmb->margin_left + xmb->hspacing - xmb->icon_size/2.0 + xmb->icon_size,
|
||||||
xmb->margin_top + xmb->icon_size/2.0 + xmb->vspacing * xmb->active_item_factor,
|
xmb->margin_top + xmb->icon_size/2.0 + xmb->vspacing * xmb->active_item_factor,
|
||||||
|
@ -570,6 +570,9 @@
|
|||||||
# Enable mouse input inside the menu.
|
# Enable mouse input inside the menu.
|
||||||
# menu_mouse_enable = false
|
# menu_mouse_enable = false
|
||||||
|
|
||||||
|
# Shows current date and/or time inside menu.
|
||||||
|
# menu_timedate_enable = true
|
||||||
|
|
||||||
# Wrap-around toe beginning and/or end if boundary of list reached horizontally
|
# Wrap-around toe beginning and/or end if boundary of list reached horizontally
|
||||||
# menu_navigation_wraparound_horizontal_enable = false
|
# menu_navigation_wraparound_horizontal_enable = false
|
||||||
|
|
||||||
|
@ -509,6 +509,7 @@ static void config_set_defaults(void)
|
|||||||
g_settings.menu_show_start_screen = menu_show_start_screen;
|
g_settings.menu_show_start_screen = menu_show_start_screen;
|
||||||
g_settings.menu.pause_libretro = true;
|
g_settings.menu.pause_libretro = true;
|
||||||
g_settings.menu.mouse_enable = false;
|
g_settings.menu.mouse_enable = false;
|
||||||
|
g_settings.menu.timedate_enable = true;
|
||||||
g_settings.menu.navigation.wraparound.horizontal_enable = true;
|
g_settings.menu.navigation.wraparound.horizontal_enable = true;
|
||||||
g_settings.menu.navigation.wraparound.vertical_enable = true;
|
g_settings.menu.navigation.wraparound.vertical_enable = true;
|
||||||
g_settings.menu.navigation.browser.filter.supported_extensions_enable = true;
|
g_settings.menu.navigation.browser.filter.supported_extensions_enable = true;
|
||||||
@ -1100,6 +1101,7 @@ static bool config_load_file(const char *path, bool set_defaults)
|
|||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
CONFIG_GET_BOOL(menu.pause_libretro, "menu_pause_libretro");
|
CONFIG_GET_BOOL(menu.pause_libretro, "menu_pause_libretro");
|
||||||
CONFIG_GET_BOOL(menu.mouse_enable, "menu_mouse_enable");
|
CONFIG_GET_BOOL(menu.mouse_enable, "menu_mouse_enable");
|
||||||
|
CONFIG_GET_BOOL(menu.timedate_enable, "menu_timedate_enable");
|
||||||
CONFIG_GET_BOOL(menu.navigation.wraparound.horizontal_enable, "menu_navigation_wraparound_horizontal_enable");
|
CONFIG_GET_BOOL(menu.navigation.wraparound.horizontal_enable, "menu_navigation_wraparound_horizontal_enable");
|
||||||
CONFIG_GET_BOOL(menu.navigation.wraparound.vertical_enable, "menu_navigation_wraparound_vertical_enable");
|
CONFIG_GET_BOOL(menu.navigation.wraparound.vertical_enable, "menu_navigation_wraparound_vertical_enable");
|
||||||
CONFIG_GET_BOOL(menu.navigation.browser.filter.supported_extensions_enable, "menu_navigation_browser_filter_supported_extensions_enable");
|
CONFIG_GET_BOOL(menu.navigation.browser.filter.supported_extensions_enable, "menu_navigation_browser_filter_supported_extensions_enable");
|
||||||
@ -1816,6 +1818,7 @@ bool config_save_file(const char *path)
|
|||||||
config_set_string(conf,"menu_driver", g_settings.menu.driver);
|
config_set_string(conf,"menu_driver", g_settings.menu.driver);
|
||||||
config_set_bool(conf,"menu_pause_libretro", g_settings.menu.pause_libretro);
|
config_set_bool(conf,"menu_pause_libretro", g_settings.menu.pause_libretro);
|
||||||
config_set_bool(conf,"menu_mouse_enable", g_settings.menu.mouse_enable);
|
config_set_bool(conf,"menu_mouse_enable", g_settings.menu.mouse_enable);
|
||||||
|
config_set_bool(conf,"menu_timedate_enable", g_settings.menu.timedate_enable);
|
||||||
#endif
|
#endif
|
||||||
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
config_set_bool(conf, "video_vsync", g_settings.video.vsync);
|
||||||
config_set_bool(conf, "video_hard_sync", g_settings.video.hard_sync);
|
config_set_bool(conf, "video_hard_sync", g_settings.video.hard_sync);
|
||||||
|
@ -5305,6 +5305,18 @@ static bool setting_data_append_list_menu_options(
|
|||||||
general_write_handler,
|
general_write_handler,
|
||||||
general_read_handler);
|
general_read_handler);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
g_settings.menu.timedate_enable,
|
||||||
|
"menu_timedate_enable",
|
||||||
|
"Time / date enable",
|
||||||
|
true,
|
||||||
|
"OFF",
|
||||||
|
"ON",
|
||||||
|
group_info.name,
|
||||||
|
subgroup_info.name,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler);
|
||||||
|
|
||||||
END_SUB_GROUP(list, list_info);
|
END_SUB_GROUP(list, list_info);
|
||||||
|
|
||||||
END_GROUP(list, list_info);
|
END_GROUP(list, list_info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user