Create RARCH_DISPLAY_CTL_SET_TITLE_BUF

This commit is contained in:
twinaphex 2016-03-04 19:38:15 +01:00
parent 2d158b809c
commit 90fbc6330c
4 changed files with 26 additions and 21 deletions

View File

@ -33,6 +33,7 @@
#include "../libretro_version_1.h"
#include "../system.h"
#include "../command_event.h"
#include "../msg_hash.h"
#ifdef HAVE_MENU
#include "../menu/menu_hash.h"
@ -95,6 +96,7 @@ typedef struct video_pixel_scaler
static uintptr_t video_driver_display;
static uintptr_t video_driver_window;
static enum rarch_display_type video_driver_display_type;
static char video_driver_title_buf[64];
static uint64_t video_driver_frame_count;
@ -971,9 +973,6 @@ bool video_monitor_get_fps(char *buf, size_t size,
static retro_time_t curr_time;
static retro_time_t fps_time;
retro_time_t new_time = retro_get_time_usec();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
*buf = '\0';
@ -993,7 +992,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
curr_time = new_time;
snprintf(buf, size, "%s || FPS: %6.1f || Frames: " U64_SIGN,
system->title_buf, last_fps,
video_driver_title_buf, last_fps,
(unsigned long long)video_driver_frame_count);
ret = true;
}
@ -1006,7 +1005,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
}
curr_time = fps_time = new_time;
strlcpy(buf, system->title_buf, size);
strlcpy(buf, video_driver_title_buf, size);
if (buf_fps)
strlcpy(buf_fps, "N/A", size_fps);
@ -1744,6 +1743,25 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
return false;
current_video->viewport_info(video_driver_data, (struct video_viewport*)data);
break;
case RARCH_DISPLAY_CTL_SET_TITLE_BUF:
{
struct retro_system_info info;
core_ctl(CORE_CTL_RETRO_GET_SYSTEM_INFO, &info);
strlcpy(video_driver_title_buf,
msg_hash_to_str(MSG_PROGRAM),
sizeof(video_driver_title_buf));
strlcat(video_driver_title_buf,
" ", sizeof(video_driver_title_buf));
strlcat(video_driver_title_buf,
info.library_name,
sizeof(video_driver_title_buf));
strlcat(video_driver_title_buf,
" ", sizeof(video_driver_title_buf));
strlcat(video_driver_title_buf,
info.library_version,
sizeof(video_driver_title_buf));
}
break;
case RARCH_DISPLAY_CTL_NONE:
default:
break;

View File

@ -158,7 +158,8 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_GPU_RECORD_DEINIT,
RARCH_DISPLAY_CTL_GET_CURRENT_SOFTWARE_FRAMEBUFFER,
RARCH_DISPLAY_CTL_GET_HW_RENDER_INTERFACE,
RARCH_DISPLAY_CTL_VIEWPORT_INFO
RARCH_DISPLAY_CTL_VIEWPORT_INFO,
RARCH_DISPLAY_CTL_SET_TITLE_BUF
};
typedef struct video_info

View File

@ -452,19 +452,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if (!runloop_system.info.library_version)
runloop_system.info.library_version = "v0";
strlcpy(runloop_system.title_buf,
msg_hash_to_str(MSG_PROGRAM),
sizeof(runloop_system.title_buf));
strlcat(runloop_system.title_buf,
" ", sizeof(runloop_system.title_buf));
strlcat(runloop_system.title_buf,
runloop_system.info.library_name,
sizeof(runloop_system.title_buf));
strlcat(runloop_system.title_buf,
" ", sizeof(runloop_system.title_buf));
strlcat(runloop_system.title_buf,
runloop_system.info.library_version,
sizeof(runloop_system.title_buf));
video_driver_ctl(RARCH_DISPLAY_CTL_SET_TITLE_BUF, NULL);
strlcpy(runloop_system.valid_extensions,
runloop_system.info.valid_extensions ?

View File

@ -32,8 +32,6 @@ extern "C" {
typedef struct rarch_system_info
{
char title_buf[64];
struct retro_system_info info;
unsigned rotation;