Merged messages

This commit is contained in:
CoalaJoe 2017-01-20 17:43:02 +01:00
commit 7982aac046
81 changed files with 1464 additions and 3980 deletions

2364
diff2.diff

File diff suppressed because it is too large Load Diff

View File

@ -1028,9 +1028,10 @@ static HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
STRING DeviceName, LinkName;
char szDestinationDrive[PATH_MAX_LENGTH];
snprintf(szDestinationDrive, sizeof(szDestinationDrive), PATH_MAX_LENGTH, "\\??\\%s", szDrive);
snprintf(szDestinationDrive, sizeof(szDestinationDrive),
"\\??\\%s", szDrive);
RtlInitAnsiString(&DeviceName, szDevice);
RtlInitAnsiString(&LinkName, (CHAR)szDestinationDrive);
RtlInitAnsiString(&LinkName, (PCHAR)szDestinationDrive);
ObDeleteSymbolicLink(&LinkName);
return (HRESULT)ObCreateSymbolicLink(&LinkName, &DeviceName);
}

View File

@ -31,7 +31,6 @@
#include "../../frontend/frontend_driver.h"
#include "../../input/common/input_x11_common.h"
#include "../../verbosity.h"
#include "../../runloop.h"
#ifdef HAVE_DBUS
#include <dbus/dbus.h>
@ -323,7 +322,7 @@ void x11_suspend_screensaver(Window wnd, bool enable)
x11_suspend_screensaver_xdg_screensaver(wnd, enable);
}
static bool get_video_mode(video_frame_info_t video_info,
static bool get_video_mode(video_frame_info_t *video_info,
Display *dpy, unsigned width, unsigned height,
XF86VidModeModeInfo *mode, XF86VidModeModeInfo *desktop_mode)
{
@ -345,7 +344,7 @@ static bool get_video_mode(video_frame_info_t video_info,
/* If we use black frame insertion, we fake a 60 Hz monitor
* for 120 Hz one, etc, so try to match that. */
refresh_mod = video_info.black_frame_insertion ? 0.5f : 1.0f;
refresh_mod = video_info->black_frame_insertion ? 0.5f : 1.0f;
for (i = 0; i < num_modes; i++)
{
@ -361,7 +360,7 @@ static bool get_video_mode(video_frame_info_t video_info,
continue;
refresh = refresh_mod * m->dotclock * 1000.0f / (m->htotal * m->vtotal);
diff = fabsf(refresh - video_info.refresh_rate);
diff = fabsf(refresh - video_info->refresh_rate);
if (!ret || diff < minimum_fps_diff)
{
@ -375,7 +374,7 @@ static bool get_video_mode(video_frame_info_t video_info,
return ret;
}
bool x11_enter_fullscreen(video_frame_info_t video_info,
bool x11_enter_fullscreen(video_frame_info_t *video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode)
{
@ -634,7 +633,7 @@ bool x11_alive(void *data)
}
void x11_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width = *width;
unsigned new_height = *height;
@ -715,18 +714,16 @@ bool x11_connect(void)
return true;
}
void x11_update_window_title(void *data, video_frame_info_t video_info)
void x11_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
char title[128];
buf[0] = buf_fps[0] = '\0';
title[0] = '\0';
if (video_monitor_get_fps(video_info,
buf, sizeof(buf), buf_fps, sizeof(buf_fps)))
XStoreName(g_x11_dpy, g_x11_win, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
video_driver_get_window_title(title, sizeof(title));
if (title[0])
XStoreName(g_x11_dpy, g_x11_win, title);
}
bool x11_input_ctx_new(bool true_full)

View File

@ -45,7 +45,7 @@ void x11_save_last_used_monitor(Window win);
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win, bool enable);
bool x11_enter_fullscreen(video_frame_info_t video_info,
bool x11_enter_fullscreen(video_frame_info_t *video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode);
@ -72,7 +72,7 @@ bool x11_get_metrics(void *data,
enum display_metric_types type, float *value);
void x11_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count);
bool *resize, unsigned *width, unsigned *height);
void x11_get_video_size(void *data, unsigned *width, unsigned *height);
@ -84,7 +84,7 @@ bool x11_alive(void *data);
bool x11_connect(void);
void x11_update_window_title(void *data, video_frame_info_t video_info);
void x11_update_title(void *data, video_frame_info_t *video_info);
bool x11_input_ctx_new(bool true_full);

View File

@ -15,13 +15,20 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <retro_miscellaneous.h>
#include <caca.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../common/caca_common.h"
#include "../font_driver.h"
#include "../../driver.h"
#include "../../verbosity.h"
#include "../../menu/menu_driver.h"
#include "../common/caca_common.h"
static caca_canvas_t *caca_cv = NULL;
static caca_dither_t *caca_dither = NULL;
@ -94,7 +101,7 @@ static void *caca_gfx_init(const video_info_t *video,
static bool caca_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
size_t len = 0;
void *buffer = NULL;
@ -145,11 +152,11 @@ static bool caca_gfx_frame(void *data, const void *frame,
caca_clear_canvas(caca_cv);
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
menu_driver_frame(video_info);
#endif
if (msg)
font_driver_render_msg(NULL, msg, NULL);
font_driver_render_msg(video_info, NULL, msg, NULL);
if (draw)
{
@ -286,9 +293,11 @@ static void caca_set_texture_frame(void *data,
}
static void caca_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
font_driver_render_msg(font, msg, params);
video_frame_info_t video_info;
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
}
static const video_poke_interface_t caca_poke_interface = {

View File

@ -26,11 +26,14 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../ctr/gpu_old.h"
#include "ctr_gu.h"
#include "../../menu/menu_driver.h"
#include "../../configuration.h"
#include "../../command.h"
#include "../../driver.h"
@ -443,10 +446,14 @@ static void* ctr_init(const video_info_t* video,
return ctr;
}
#if 0
#define CTR_INSPECT_MEMORY_USAGE
#endif
static bool ctr_frame(void* data, const void* frame,
unsigned width, unsigned height,
uint64_t frame_count,
unsigned pitch, const char* msg, video_frame_info_t info)
unsigned pitch, const char* msg, video_frame_info_t *video_info)
{
uint32_t diff;
static uint64_t currentTick,lastTick;
@ -517,12 +524,16 @@ static bool ctr_frame(void* data, const void* frame,
#ifndef HAVE_THREADS
if(task_queue_ctl(TASK_QUEUE_CTL_FIND, &ctr_tasks_finder_data))
{
// ctr->vsync_event_pending = true;
#if 0
ctr->vsync_event_pending = true;
#endif
while(ctr->vsync_event_pending)
{
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
svcSleepThread(0);
// aptMainLoop();
#if 0
aptMainLoop();
#endif
}
}
#endif
@ -540,7 +551,6 @@ static bool ctr_frame(void* data, const void* frame,
frames = 0;
}
//#define CTR_INSPECT_MEMORY_USAGE
#ifdef CTR_INSPECT_MEMORY_USAGE
uint32_t ctr_get_stack_usage(void);
@ -560,12 +570,14 @@ static bool ctr_frame(void* data, const void* frame,
if(query_addr == 0x1F000000)
query_addr = 0x30000000;
}
// static u32* dummy_pointer;
// if(total_frames == 500)
// dummy_pointer = malloc(0x2000000);
// if(total_frames == 1000)
// free(dummy_pointer);
#if 0
static u32* dummy_pointer;
if(total_frames == 500)
dummy_pointer = malloc(0x2000000);
if(total_frames == 1000)
free(dummy_pointer);
#endif
printf("========================================");
printf("0x%08X 0x%08X 0x%08X\n", __heap_size, gpuCmdBufOffset, (__linear_heap_size - linearSpaceFree()));
@ -618,10 +630,12 @@ static bool ctr_frame(void* data, const void* frame,
&& (pitch > 0x40))
{
/* can copy the buffer directly with the GPU */
// GSPGPU_FlushDataCache(frame, pitch * height);
#if 0
GSPGPU_FlushDataCache(frame, pitch * height);
#endif
ctrGuSetCommandList_First(true,(void*)frame, pitch * height,0,0,0,0);
ctrGuCopyImage(true, frame, pitch / (ctr->rgb32? 4: 2), height, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, false,
ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true);
ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true);
}
else
{
@ -659,7 +673,7 @@ static bool ctr_frame(void* data, const void* frame,
ctr_check_3D_slider(ctr);
// /* ARGB --> RGBA */
/* ARGB --> RGBA */
if (ctr->rgb32)
{
GPU_SetTexEnv(0,
@ -750,17 +764,17 @@ static bool ctr_frame(void* data, const void* frame,
}
ctr->msg_rendering_enabled = true;
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
menu_driver_frame(video_info);
ctr->msg_rendering_enabled = false;
}
if (msg)
font_driver_render_msg(NULL, msg, NULL);
// font_driver_render_msg(NULL, "TEST: 123 ABC àüî", NULL);
font_driver_render_msg(video_info, NULL, msg, NULL);
#if 0
font_driver_render_msg(video_info, NULL, "TEST: 123 ABC àüî", NULL);
#endif
GPU_FinishDrawing();
GPUCMD_Finalize();
@ -781,7 +795,7 @@ static bool ctr_frame(void* data, const void* frame,
gfxTopRightFramebuffers[ctr->current_buffer_top], 240,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE);
// Swap buffers :
/* Swap buffers : */
extern GSPGPU_FramebufferInfo topFramebufferInfo;
extern u8* gfxSharedMemory;
extern u8 gfxThreadID;
@ -1092,14 +1106,16 @@ static void ctr_unload_texture(void *data, uintptr_t handle)
}
static void ctr_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
video_frame_info_t video_info;
ctr_video_t* ctr = (ctr_video_t*)data;
if (ctr && ctr->msg_rendering_enabled)
font_driver_render_msg(font, msg, params);
}
video_driver_build_info(&video_info);
if (ctr && ctr->msg_rendering_enabled)
font_driver_render_msg(&video_info, font, msg, params);
}
static const video_poke_interface_t ctr_poke_interface = {
ctr_load_texture,

View File

@ -47,6 +47,8 @@
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../core.h"
#include "../../performance_counters.h"
@ -332,14 +334,16 @@ static void d3d_viewport_info(void *data, struct video_viewport *vp)
d3d->renderchain_driver->viewport_info(d3d, vp);
}
static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
static void d3d_overlay_render(d3d_video_t *d3d, video_frame_info_t *video_info,
overlay_t *overlay)
{
struct video_viewport vp;
unsigned width, height;
void *verts;
unsigned i;
float vert[4][9];
float overlay_width, overlay_height;
unsigned width = video_info->width;
unsigned height = video_info->height;
if (!d3d || !overlay || !overlay->tex)
return;
@ -429,8 +433,6 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
{
D3DVIEWPORT vp_full;
video_driver_get_size(&width, &height);
vp_full.X = 0;
vp_full.Y = 0;
vp_full.Width = width;
@ -881,7 +883,7 @@ static bool d3d_alive(void *data)
mode.width = temp_width;
mode.height = temp_height;
video_context_driver_set_resize(&mode);
video_context_driver_set_resize(mode);
d3d_restore(d3d);
}
@ -950,14 +952,17 @@ static void d3d_apply_state_changes(void *data)
}
static void d3d_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
video_frame_info_t video_info;
d3d_video_t *d3d = (d3d_video_t*)data;
video_driver_build_info(&video_info);
if (d3d->renderchain_driver->set_font_rect && params)
d3d->renderchain_driver->set_font_rect(d3d, params);
font_driver_render_msg(NULL, msg, params);
font_driver_render_msg(&video_info, NULL, msg, params);
}
/* Delay constructor due to lack of exceptions. */
@ -1368,21 +1373,21 @@ static void d3d_get_overlay_interface(void *data,
static bool d3d_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count, unsigned pitch,
const char *msg, video_frame_info_t video_info)
const char *msg, video_frame_info_t *video_info)
{
unsigned width, height;
static struct retro_perf_counter d3d_frame = {0};
static struct
retro_perf_counter d3d_frame = {0};
unsigned i = 0;
d3d_video_t *d3d = (d3d_video_t*)data;
HWND window = win32_get_window();
unsigned width = video_info->width;
unsigned height = video_info->height;
(void)i;
if (!frame)
return true;
video_driver_get_size(&width, &height);
performance_counter_init(&d3d_frame, "d3d_frame");
performance_counter_start(&d3d_frame);
@ -1412,18 +1417,18 @@ static bool d3d_frame(void *data, const void *frame,
/* render_chain() only clears out viewport,
* clear out everything. */
D3DVIEWPORT screen_vp;
screen_vp.X = 0;
screen_vp.Y = 0;
screen_vp.MinZ = 0;
screen_vp.MaxZ = 1;
screen_vp.Width = width;
screen_vp.X = 0;
screen_vp.Y = 0;
screen_vp.MinZ = 0;
screen_vp.MaxZ = 1;
screen_vp.Width = width;
screen_vp.Height = height;
d3d_set_viewports(d3d->dev, &screen_vp);
d3d_clear(d3d->dev, 0, 0, D3DCLEAR_TARGET, 0, 1, 0);
/* Insert black frame first, so we
* can screenshot, etc. */
if (video_info.black_frame_insertion)
if (video_info->black_frame_insertion)
{
if (!d3d_swap(d3d, d3d->dev) || d3d->needs_restore)
return true;
@ -1442,14 +1447,14 @@ static bool d3d_frame(void *data, const void *frame,
if (msg)
{
struct font_params font_parms = {0};
font_driver_render_msg(NULL, msg, &font_parms);
font_driver_render_msg(video_info, NULL, msg, &font_parms);
}
#ifdef HAVE_MENU
if (d3d->menu && d3d->menu->enabled)
{
d3d_overlay_render(d3d, d3d->menu);
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
d3d_overlay_render(d3d, video_info, d3d->menu);
menu_driver_frame(video_info);
}
#endif
@ -1457,7 +1462,7 @@ static bool d3d_frame(void *data, const void *frame,
if (d3d->overlays_enabled)
{
for (i = 0; i < d3d->overlays.size(); i++)
d3d_overlay_render(d3d, &d3d->overlays[i]);
d3d_overlay_render(d3d, video_info, &d3d->overlays[i]);
}
#endif

View File

@ -59,7 +59,7 @@ static void renderchain_set_mvp(void *data, unsigned vp_width,
mvp.data = d3d;
mvp.matrix = NULL;
video_shadser_driver_set_mvp(mvp);
video_shader_driver_set_mvp(mvp);
#elif defined(HAVE_D3D8)
D3DXMATRIX p_out, p_rotate, mat;
D3DXMatrixOrthoOffCenterLH(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);

View File

@ -21,7 +21,12 @@
#include "../../config.h"
#endif
#include "../../configuration.h"
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
@ -317,8 +322,6 @@ static void dispmanx_surface_update(void *data, const void *frame,
struct dispmanx_video *_dispvars = data;
struct dispmanx_page *page = NULL;
settings_t *settings = config_get_ptr();
/* Dispmanx doesn't support more than one pending pageflip.
* It causes lockups. */
slock_lock(_dispvars->pending_mutex);
@ -430,7 +433,7 @@ static void *dispmanx_gfx_init(const video_info_t *video,
static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct dispmanx_video *_dispvars = data;
float aspect = video_driver_get_aspect_ratio();
@ -438,14 +441,14 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
if (!frame)
return true;
if (width != _dispvars->core_width || height != _dispvars->core_height || _dispvars->aspect_ratio != aspect)
if ( (width != _dispvars->core_width) ||
(height != _dispvars->core_height) ||
(_dispvars->aspect_ratio != aspect))
{
/* Sanity check. */
if (width == 0 || height == 0)
return true;
settings_t *settings = config_get_ptr();
_dispvars->core_width = width;
_dispvars->core_height = height;
_dispvars->core_pitch = pitch;
@ -464,22 +467,19 @@ static bool dispmanx_gfx_frame(void *data, const void *frame, unsigned width,
_dispvars->rgb32 ? VC_IMAGE_XRGB8888 : VC_IMAGE_RGB565,
255,
_dispvars->aspect_ratio,
settings->video.max_swapchain_images,
video_info->max_swapchain_images,
0,
&_dispvars->main_surface);
/* We need to recreate the menu surface too, if it exists already, so we
* free it and let dispmanx_set_texture_frame() recreate it as it detects it's NULL.*/
if (_dispvars->menu_active && _dispvars->menu_surface) {
if (_dispvars->menu_active && _dispvars->menu_surface)
dispmanx_surface_free(_dispvars, &_dispvars->menu_surface);
}
}
if (video_info.fps_show)
{
char buf[128];
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
}
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
/* Update main surface: locate free page, blit and flip. */
dispmanx_surface_update(_dispvars, frame, _dispvars->main_surface);

View File

@ -28,6 +28,10 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../../retroarch.h"
@ -744,11 +748,12 @@ static void *drm_gfx_init(const video_info_t *video,
static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct drm_video *_drmvars = data;
if (width != _drmvars->core_width || height != _drmvars->core_height)
if ( ( width != _drmvars->core_width) ||
(height != _drmvars->core_height))
{
/* Sanity check. */
if (width == 0 || height == 0)
@ -778,13 +783,9 @@ static bool drm_gfx_frame(void *data, const void *frame, unsigned width,
drm_plane_setup(_drmvars->main_surface);
}
if (_drmvars->menu_active)
{
char buf[128];
buf[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
}
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
/* Update main surface: locate free page, blit and flip. */
drm_surface_update(_drmvars, frame, _drmvars->main_surface);

View File

@ -35,6 +35,10 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../common/drm_common.h"
#include "../font_driver.h"
#include "../../configuration.h"
@ -1159,7 +1163,6 @@ static int exynos_render_msg(struct exynos_video *vid,
return exynos_blend_font(pdata);
}
static void *exynos_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
@ -1273,7 +1276,7 @@ static void exynos_gfx_free(void *data)
static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct exynos_video *vid = data;
struct exynos_page *page = NULL;
@ -1304,18 +1307,6 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
goto fail;
}
if (video_info.fps_show)
{
char buffer[128];
char buffer_fps[128];
buffer[0] = buffer_fps[0] = '\0';
video_monitor_get_fps(video_info, buffer, sizeof(buffer),
video_info.fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
runloop_msg_queue_push(buffer_fps, 1, 1, false);
}
/* If at this point the dimension parameters are still zero, setup some *
* fake blit parameters so that menu and font rendering work properly. */
if (vid->width == 0 || vid->height == 0)
@ -1328,6 +1319,9 @@ static bool exynos_gfx_frame(void *data, const void *frame, unsigned width,
{
if (exynos_blend_menu(vid->data, vid->menu_rotation) != 0)
goto fail;
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
}
if (msg)

View File

@ -17,10 +17,19 @@
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../menu/menu_driver.h"
#include "../common/gdi_common.h"
#if defined(_WIN32) && !defined(_XBOX)
@ -146,7 +155,7 @@ error:
static bool gdi_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
gfx_ctx_mode_t mode;
RECT rect;
@ -162,7 +171,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
return true;
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
menu_driver_frame(video_info);
#endif
if (gdi_video_width != frame_width || gdi_video_height != frame_height || gdi_video_pitch != pitch)
@ -246,7 +255,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
}
if (msg)
font_driver_render_msg(NULL, msg, NULL);
font_driver_render_msg(video_info, NULL, msg, NULL);
InvalidateRect(hwnd, NULL, false);
@ -384,9 +393,11 @@ static void gdi_set_texture_frame(void *data,
}
static void gdi_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
font_driver_render_msg(font, msg, params);
video_frame_info_t video_info;
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
}
static void gdi_get_video_output_size(void *data,

View File

@ -212,18 +212,18 @@ static void gl_overlay_tex_geom(void *data,
tex[7] = y + h;
}
static void gl_render_overlay(gl_t *gl)
static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
video_shader_ctx_info_t shader_info;
unsigned i, width, height;
unsigned i;
unsigned width = video_info->width;
unsigned height = video_info->height;
if (!gl || !gl->overlay_enable)
return;
video_driver_get_size(&width, &height);
glEnable(GL_BLEND);
if (gl->overlay_full_screen)
@ -299,32 +299,30 @@ static void gl_set_viewport_wrapper(void *data, unsigned viewport_width,
video_driver_build_info(&video_info);
gl_set_viewport(data, video_info,
gl_set_viewport(data, &video_info,
viewport_width, viewport_height, force_full, allow_rotate);
}
void gl_set_viewport(void *data, video_frame_info_t video_info,
void gl_set_viewport(void *data, video_frame_info_t *video_info,
unsigned viewport_width,
unsigned viewport_height,
bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
unsigned width, height;
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
int x = 0;
int y = 0;
float device_aspect = (float)viewport_width / viewport_height;
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
gl_t *gl = (gl_t*)data;
gl_t *gl = (gl_t*)data;
unsigned height = video_info->height;
video_driver_get_size(&width, &height);
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
video_context_driver_translate_aspect(&aspect_data);
if (video_info.scale_integer && !force_full)
if (video_info->scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp,
viewport_width, viewport_height,
@ -337,7 +335,7 @@ void gl_set_viewport(void *data, video_frame_info_t video_info,
float desired_aspect = video_driver_get_aspect_ratio();
#if defined(HAVE_MENU)
if (video_info.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (video_info->aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
@ -685,7 +683,9 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
}
static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
static INLINE void gl_copy_frame(gl_t *gl,
video_frame_info_t *video_info,
const void *frame,
unsigned width, unsigned height, unsigned pitch)
{
static struct retro_perf_counter copy_frame = {0};
@ -739,13 +739,11 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
else
#endif
{
bool use_rgba = video_driver_supports_rgba();
glPixelStorei(GL_UNPACK_ALIGNMENT,
video_pixel_get_alignment(width * gl->base_size));
/* Fallback for GLES devices without GL_BGRA_EXT. */
if (gl->base_size == 4 && use_rgba)
if (gl->base_size == 4 && video_info->use_rgba)
{
video_frame_convert_argb8888_to_abgr8888(
&gl->scaler,
@ -959,9 +957,11 @@ static void gl_set_texture_enable(void *data, bool state, bool full_screen)
}
static void gl_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
font_driver_render_msg(font, msg, params);
video_frame_info_t video_info;
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
}
static void gl_show_mouse(void *data, bool state)
@ -1013,13 +1013,14 @@ static void gl_pbo_async_readback(gl_t *gl)
}
#endif
static INLINE void gl_draw_texture(gl_t *gl)
static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
video_shader_ctx_info_t shader_info;
unsigned width, height;
GLfloat color[16];
unsigned width = video_info->width;
unsigned height = video_info->height;
color[ 0] = 1.0f;
color[ 1] = 1.0f;
@ -1041,8 +1042,6 @@ static INLINE void gl_draw_texture(gl_t *gl)
if (!gl->menu_texture)
return;
video_driver_get_size(&width, &height);
gl->coords.vertex = vertexes_flipped;
gl->coords.tex_coord = tex_coords;
gl->coords.color = color;
@ -1090,16 +1089,18 @@ static bool gl_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count,
unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
video_shader_ctx_mvp_t mvp;
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
unsigned width, height;
struct video_tex_info feedback_info;
video_shader_ctx_info_t shader_info;
static struct retro_perf_counter frame_run = {0};
static struct
retro_perf_counter frame_run = {0};
gl_t *gl = (gl_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
performance_counter_init(&frame_run, "frame_run");
performance_counter_start(&frame_run);
@ -1107,8 +1108,6 @@ static bool gl_frame(void *data, const void *frame,
if (!gl)
return false;
video_driver_get_size(&width, &height);
context_bind_hw_render(false);
#ifndef HAVE_OPENGLES
@ -1146,7 +1145,7 @@ static bool gl_frame(void *data, const void *frame,
mode.width = width;
mode.height = height;
video_context_driver_set_resize(&mode);
video_context_driver_set_resize(mode);
#ifdef HAVE_FBO
if (gl->fbo_inited)
@ -1175,7 +1174,7 @@ static bool gl_frame(void *data, const void *frame,
#endif
{
gl_update_input_size(gl, frame_width, frame_height, pitch, true);
gl_copy_frame(gl, frame, frame_width, frame_height, pitch);
gl_copy_frame(gl, video_info, frame, frame_width, frame_height, pitch);
}
/* No point regenerating mipmaps
@ -1279,18 +1278,18 @@ static bool gl_frame(void *data, const void *frame,
#if defined(HAVE_MENU)
if (gl->menu_texture_enable)
{
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
menu_driver_frame(video_info);
if (gl->menu_texture_enable)
gl_draw_texture(gl);
gl_draw_texture(gl, video_info);
}
#endif
if (msg)
font_driver_render_msg(NULL, msg, NULL);
font_driver_render_msg(video_info, NULL, msg, NULL);
#ifdef HAVE_OVERLAY
gl_render_overlay(gl);
gl_render_overlay(gl, video_info);
#endif
video_context_driver_update_window_title(video_info);
@ -1339,7 +1338,7 @@ static bool gl_frame(void *data, const void *frame,
/* Disable BFI during fast forward, slow-motion,
* and pause to prevent flicker. */
if (
video_info.black_frame_insertion
video_info->black_frame_insertion
&& !input_driver_is_nonblock_state()
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
@ -1351,7 +1350,7 @@ static bool gl_frame(void *data, const void *frame,
video_context_driver_swap_buffers(video_info);
#ifdef HAVE_GL_SYNC
if (video_info.hard_sync && gl->have_sync)
if (video_info->hard_sync && gl->have_sync)
{
static struct retro_perf_counter gl_fence = {0};
@ -1361,7 +1360,7 @@ static bool gl_frame(void *data, const void *frame,
gl->fences[gl->fence_count++] =
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
while (gl->fence_count > video_info.hard_sync_frames)
while (gl->fence_count > video_info->hard_sync_frames)
{
glClientWaitSync(gl->fences[0],
GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);

View File

@ -49,14 +49,14 @@ void gl_load_texture_data(
const void *frame, unsigned base_size);
void gl_renderchain_render(gl_t *gl,
video_frame_info_t video_info,
video_frame_info_t *video_info,
uint64_t frame_count,
const struct video_tex_info *tex_info,
const struct video_tex_info *feedback_info);
void gl_renderchain_init(gl_t *gl, unsigned fbo_width, unsigned fbo_height);
void gl_set_viewport(void *data, video_frame_info_t video_info,
void gl_set_viewport(void *data, video_frame_info_t *video_info,
unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate);
@ -70,7 +70,7 @@ void gl_renderchain_recompute_pass_sizes(gl_t *gl,
unsigned width, unsigned height,
unsigned vp_width, unsigned vp_height);
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t video_info);
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t *video_info);
void gl_check_fbo_dimensions(gl_t *gl);

View File

@ -239,7 +239,7 @@ void gl_check_fbo_dimensions(gl_t *gl)
}
}
void gl_renderchain_render(gl_t *gl,
video_frame_info_t video_info,
video_frame_info_t *video_info,
uint64_t frame_count,
const struct video_tex_info *tex_info,
const struct video_tex_info *feedback_info)
@ -249,7 +249,6 @@ void gl_renderchain_render(gl_t *gl,
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
video_shader_ctx_info_t shader_info;
unsigned width, height;
const struct video_fbo_rect *prev_rect;
struct video_tex_info *fbo_info;
struct video_tex_info fbo_tex_info[GFX_MAX_SHADERS];
@ -257,8 +256,8 @@ void gl_renderchain_render(gl_t *gl,
GLfloat xamt, yamt;
unsigned fbo_tex_info_cnt = 0;
GLfloat fbo_tex_coords[8] = {0.0f};
video_driver_get_size(&width, &height);
unsigned width = video_info->width;
unsigned height = video_info->height;
/* Render the rest of our passes. */
gl->coords.tex_coord = fbo_tex_coords;
@ -667,7 +666,7 @@ void gl_renderchain_recompute_pass_sizes(gl_t *gl,
}
}
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t video_info)
void gl_renderchain_start_render(gl_t *gl, video_frame_info_t *video_info)
{
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glBindFramebuffer(RARCH_GL_FRAMEBUFFER, gl->fbo[0]);

View File

@ -27,17 +27,22 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#include "../../menu/menu_display.h"
#endif
#ifdef HW_RVL
#include "../../memory/wii/mem2_manager.h"
#endif
#include "../font_driver.h"
#include "../drivers_font_renderer/bitmap.h"
#include "../../defines/gx_defines.h"
#include "../../configuration.h"
#include "../../driver.h"
#include "../../runloop.h"
#include "../../menu/menu_driver.h"
#include "../../menu/menu_display.h"
extern syssram* __SYS_LockSram(void);
extern u32 __SYS_UnlockSram(u32 write);
@ -1438,7 +1443,7 @@ static bool gx_frame(void *data, const void *frame,
unsigned width, unsigned height,
uint64_t frame_count, unsigned pitch,
const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
char fps_txt[128];
char fps_text_buf[128];
@ -1500,12 +1505,9 @@ static bool gx_frame(void *data, const void *frame,
if (gx->menu_texture_enable && gx->menu_data)
{
size_t fb_pitch;
unsigned fb_width, fb_height;
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
fb_pitch = menu_display_get_framebuffer_pitch();
unsigned fb_width = menu_display_get_width();
unsigned fb_height = menu_display_get_height();
size_t fb_pitch = menu_display_get_framebuffer_pitch();
convert_texture16(
gx->menu_data,
@ -1518,6 +1520,10 @@ static bool gx_frame(void *data, const void *frame,
fb_width * fb_pitch);
}
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
GX_InvalidateTexAll();
GX_SetCurrentMtx(GX_PNMTX0);
@ -1538,10 +1544,7 @@ static bool gx_frame(void *data, const void *frame,
GX_DrawDone();
video_monitor_get_fps(video_info, fps_txt, sizeof(fps_txt),
fps_text_buf, sizeof(fps_text_buf));
if (video_info.fps_show)
if (video_info->fps_show)
{
char mem1_txt[128];
char mem2_txt[128];

View File

@ -14,8 +14,9 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../video_driver.h"
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
static void *null_gfx_init(const video_info_t *video,
@ -32,7 +33,7 @@ static void *null_gfx_init(const video_info_t *video,
static bool null_gfx_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
(void)data;
(void)frame;

View File

@ -25,12 +25,16 @@
#include <ctype.h>
#include <assert.h>
#include <sys/mman.h>
#include <linux/omapfb.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#include <sys/mman.h>
#include <linux/omapfb.h>
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include <retro_inline.h>
#include <retro_assert.h>
@ -38,6 +42,8 @@
#include <gfx/video_frame.h>
#include <string/stdstring.h>
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../driver.h"
#include "../../retroarch.h"
@ -45,8 +51,6 @@
#include "../video_context_driver.h"
#include "../font_driver.h"
typedef struct omapfb_page
{
unsigned yoffset;
@ -985,7 +989,7 @@ fail:
static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
omap_video_t *vid = (omap_video_t*)data;
@ -1008,10 +1012,16 @@ static bool omap_gfx_frame(void *data, const void *frame, unsigned width,
omapfb_prepare(vid->omap);
omapfb_blit_frame(vid->omap, frame, vid->height, pitch);
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if (vid->menu.active)
omapfb_blit_frame(vid->omap, vid->menu.frame,
vid->menu.scaler.out_height,
vid->menu.scaler.out_stride);
if (msg)
omap_render_msg(vid, msg);

View File

@ -28,6 +28,12 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../defines/psp_defines.h"
#include "../../runloop.h"
@ -467,7 +473,7 @@ static void *psp_init(const video_info_t *video,
static bool psp_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
#ifdef DISPLAY_FPS
uint32_t diff;
@ -476,8 +482,6 @@ static bool psp_frame(void *data, const void *frame,
static float fps = 0.0;
#endif
static struct retro_perf_counter psp_frame_run = {0};
static char fps_txt[128] = {0};
static char fps_text_buf[128] = {0};
psp1_video_t *psp = (psp1_video_t*)data;
if (!width || !height)
@ -495,14 +499,10 @@ static bool psp_frame(void *data, const void *frame,
pspDebugScreenSetXY(0,0);
video_monitor_get_fps(video_info, fps_txt, sizeof(fps_txt),
video_info.fps_show ? fps_text_buf : NULL,
video_info.fps_show ? sizeof(fps_text_buf) : 0);
if (video_info.fps_show)
if (video_info->fps_show)
{
pspDebugScreenSetXY(68 - strlen(fps_text_buf) - 1,0);
pspDebugScreenPuts(fps_text_buf);
pspDebugScreenSetXY(68 - strlen(video_info->fps_text) - 1,0);
pspDebugScreenPuts(video_info->fps_text);
pspDebugScreenSetXY(0,1);
}
@ -567,6 +567,10 @@ static bool psp_frame(void *data, const void *frame,
performance_counter_stop(&psp_frame_run);
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if(psp->menu.active)
{
sceGuSendList(GU_TAIL, psp->menu.dList, &(psp->menu.context_storage));

View File

@ -35,13 +35,14 @@
#include "SDL.h"
#include "SDL_syswm.h"
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../performance_counters.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
#include "../font_driver.h"
typedef struct sdl2_tex
{
@ -498,12 +499,10 @@ static void check_window(sdl2_video_t *vid)
static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
char buf[128];
sdl2_video_t *vid = (sdl2_video_t*)data;
buf[0] = '\0';
char title[128];
if (vid->should_resize)
sdl_refresh_viewport(vid);
@ -525,7 +524,7 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE);
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
menu_driver_frame(video_info);
#endif
if (vid->menu.active)
@ -536,8 +535,12 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
SDL_RenderPresent(vid->renderer);
if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0))
SDL_SetWindowTitle(vid->window, buf);
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (title[0])
SDL_SetWindowTitle(vid->window, title);
return true;
}
@ -723,7 +726,7 @@ static void sdl2_poke_texture_enable(void *data, bool enable, bool full_screen)
}
static void sdl2_poke_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
sdl2_video_t *vid = (sdl2_video_t*)data;
sdl2_render_msg(vid, msg);

View File

@ -27,6 +27,10 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#ifdef HAVE_X11
#include "../common/x11_common.h"
#endif
@ -34,12 +38,14 @@
#include "SDL.h"
#include "SDL_syswm.h"
#include "../font_driver.h"
#include "../video_driver.h"
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../performance_counters.h"
#include "../video_context_driver.h"
#include "../font_driver.h"
typedef struct sdl_menu_frame
{
@ -331,16 +337,18 @@ static void sdl_gfx_check_window(sdl_video_t *vid)
static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
char buf[128];
static struct retro_perf_counter sdl_scale = {0};
sdl_video_t *vid = (sdl_video_t*)data;
char title[128];
if (!frame)
return true;
buf[0] = '\0';
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (SDL_MUSTLOCK(vid->screen))
SDL_LockSurface(vid->screen);
@ -361,6 +369,10 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
pitch);
performance_counter_stop(&sdl_scale);
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if (vid->menu.active)
SDL_BlitSurface(vid->menu.frame, NULL, vid->screen, NULL);
@ -370,8 +382,8 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
if (SDL_MUSTLOCK(vid->screen))
SDL_UnlockSurface(vid->screen);
if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0))
SDL_WM_SetCaption(buf, NULL);
if (title[0])
SDL_WM_SetCaption(title, NULL);
SDL_Flip(vid->screen);

View File

@ -28,9 +28,14 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../font_driver.h"
#define NUMPAGES 2
@ -763,7 +768,7 @@ static void sunxi_setup_scale (void *data,
static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
@ -779,13 +784,12 @@ static bool sunxi_gfx_frame(void *data, const void *frame, unsigned width,
sunxi_setup_scale(_dispvars, width, height, pitch);
}
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if (_dispvars->menu_active)
{
char buf[128];
buf[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0);
ioctl(_dispvars->sunxi_disp->fd_fb, FBIO_WAITFORVSYNC, 0);
return true;
}

View File

@ -31,12 +31,17 @@
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../../retroarch.h"
#include "../../runloop.h"
#include "../../driver.h"
#include "../../performance_counters.h"
#include "../font_driver.h"
#include "../../content.h"
#include "../../runloop.h"
#include "../../verbosity.h"
@ -281,10 +286,10 @@ static void vg_free(void *data)
free(vg);
}
static void vg_calculate_quad(vg_t *vg)
static void vg_calculate_quad(vg_t *vg, video_frame_info_t *video_info)
{
unsigned width, height;
video_driver_get_size(&width, &height);
unsigned width = video_info->width;
unsigned heigh = video_info->height;
/* set viewport for aspect ratio, taken from the OpenGL driver. */
if (vg->keep_aspect)
@ -378,25 +383,24 @@ static void vg_copy_frame(void *data, const void *frame,
static bool vg_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count, unsigned pitch, const char *msg,
video_frame_info_t video_info)
video_frame_info_t *video_info)
{
unsigned width, height;
vg_t *vg = (vg_t*)data;
static struct retro_perf_counter vg_fr = {0};
static struct retro_perf_counter vg_image = {0};
unsigned width = video_info->width;
unsigned height = video_info->height;
performance_counter_init(&vg_fr, "vg_fr");
performance_counter_start(&vg_fr);
video_driver_get_size(&width, &height);
if ( frame_width != vg->mRenderWidth
|| frame_height != vg->mRenderHeight
|| vg->should_resize)
{
vg->mRenderWidth = frame_width;
vg->mRenderHeight = frame_height;
vg_calculate_quad(vg);
vg_calculate_quad(vg, video_info);
matrix_3x3_quad_to_quad(
vg->x1, vg->y1, vg->x2, vg->y1, vg->x2, vg->y2, vg->x1, vg->y2,
/* needs to be flipped, Khronos loves their bottom-left origin */
@ -417,6 +421,10 @@ static bool vg_frame(void *data, const void *frame,
vg_copy_frame(vg, frame, frame_width, frame_height, pitch);
performance_counter_stop(&vg_image);
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
vgDrawImage(vg->mImage);
#if 0

View File

@ -16,7 +16,6 @@
#include <vita2d.h>
#include <retro_inline.h>
#include <string/stdstring.h>
#include <formats/image.h>
@ -29,6 +28,8 @@
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../common/vita2d_common.h"
#include "../../driver.h"
#include "../../runloop.h"
@ -133,54 +134,55 @@ static void vita2d_gfx_update_viewport(vita_video_t* vita);
static bool vita2d_gfx_frame(void *data, const void *frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
void *tex_p;
vita_video_t *vita = (vita_video_t *)data;
if (frame)
{
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)){
unsigned i;
unsigned int stride;
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame))
{
unsigned i;
unsigned int stride;
if ((width != vita->width || height != vita->height) && vita->texture)
{
vita2d_free_texture(vita->texture);
vita->texture = NULL;
}
if ((width != vita->width || height != vita->height) && vita->texture)
{
vita2d_free_texture(vita->texture);
vita->texture = NULL;
}
if (!vita->texture)
{
RARCH_LOG("Creating texture: %ix%i\n", width, height);
vita->width = width;
vita->height = height;
vita->texture = vita2d_create_empty_texture_format(width, height, vita->format);
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
}
tex_p = vita2d_texture_get_datap(vita->texture);
stride = vita2d_texture_get_stride(vita->texture);
if (!vita->texture)
{
RARCH_LOG("Creating texture: %ix%i\n", width, height);
vita->width = width;
vita->height = height;
vita->texture = vita2d_create_empty_texture_format(width, height, vita->format);
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
}
tex_p = vita2d_texture_get_datap(vita->texture);
stride = vita2d_texture_get_stride(vita->texture);
if (vita->format == SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB)
{
stride /= 4;
pitch /= 4;
uint32_t *tex32 = tex_p;
const uint32_t *frame32 = frame;
if (vita->format == SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB)
{
stride /= 4;
pitch /= 4;
uint32_t *tex32 = tex_p;
const uint32_t *frame32 = frame;
for (i = 0; i < height; i++)
memcpy_neon(&tex32[i*stride],&frame32[i*pitch],pitch*sizeof(uint32_t));
}
else
{
stride /= 2;
pitch /= 2;
uint16_t *tex16 = tex_p;
const uint16_t *frame16 = frame;
for (i = 0; i < height; i++)
memcpy_neon(&tex32[i*stride],&frame32[i*pitch],pitch*sizeof(uint32_t));
}
else
{
stride /= 2;
pitch /= 2;
uint16_t *tex16 = tex_p;
const uint16_t *frame16 = frame;
for (i = 0; i < height; i++)
memcpy_neon(&tex16[i*stride],&frame16[i*pitch],width*sizeof(uint16_t));
}
for (i = 0; i < height; i++)
memcpy_neon(&tex16[i*stride],&frame16[i*pitch],width*sizeof(uint16_t));
}
}
}
@ -188,9 +190,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
vita2d_gfx_update_viewport(vita);
vita2d_start_drawing();
vita2d_draw_rectangle(0,0,PSP_FB_WIDTH,PSP_FB_HEIGHT,vita2d_get_clear_color());
if (vita->texture)
{
if (vita->fullscreen)
@ -205,21 +207,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
float scalex = vita->vp.width / (float)vita->width;
float scaley = vita->vp.height / (float)vita->height;
vita2d_draw_texture_scale_rotate(vita->texture,vita->vp.x,
vita->vp.y, scalex, scaley, rad);
vita->vp.y, scalex, scaley, rad);
}
}
if (video_info.fps_show)
{
char buffer[128];
char buffer_fps[128];
buffer[0] = buffer_fps[0] = '\0';
video_monitor_get_fps(video_info, buffer, sizeof(buffer),
video_info.fps_show ? buffer_fps : NULL, sizeof(buffer_fps));
runloop_msg_queue_push(buffer_fps, 1, 1, false);
}
#ifdef HAVE_OVERLAY
if (vita->overlay_enable)
@ -228,43 +218,41 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
if (vita->menu.active)
{
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
if(vita->menu.texture){
if (vita->fullscreen)
vita2d_draw_texture_scale(vita->menu.texture,
0, 0,
PSP_FB_WIDTH / (float)vita->menu.width,
PSP_FB_HEIGHT / (float)vita->menu.height);
else
{
if (vita->menu.width > vita->menu.height)
{
float scale = PSP_FB_HEIGHT / (float)vita->menu.height;
float w = vita->menu.width * scale;
vita2d_draw_texture_scale(vita->menu.texture,
PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f,
scale, scale);
}
else
{
float scale = PSP_FB_WIDTH / (float)vita->menu.width;
float h = vita->menu.height * scale;
vita2d_draw_texture_scale(vita->menu.texture,
0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f,
scale, scale);
}
}
}
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if(vita->menu.texture){
if (vita->fullscreen)
vita2d_draw_texture_scale(vita->menu.texture,
0, 0,
PSP_FB_WIDTH / (float)vita->menu.width,
PSP_FB_HEIGHT / (float)vita->menu.height);
else
{
if (vita->menu.width > vita->menu.height)
{
float scale = PSP_FB_HEIGHT / (float)vita->menu.height;
float w = vita->menu.width * scale;
vita2d_draw_texture_scale(vita->menu.texture,
PSP_FB_WIDTH / 2.0f - w/2.0f, 0.0f,
scale, scale);
}
else
{
float scale = PSP_FB_WIDTH / (float)vita->menu.width;
float h = vita->menu.height * scale;
vita2d_draw_texture_scale(vita->menu.texture,
0.0f, PSP_FB_HEIGHT / 2.0f - h/2.0f,
scale, scale);
}
}
}
}
if(!string_is_empty(msg))
font_driver_render_msg(NULL, msg, NULL);
font_driver_render_msg(video_info, NULL, msg, NULL);
vita2d_end_drawing();
vita2d_swap_buffers();
@ -738,10 +726,11 @@ static void vita_unload_texture(void *data, uintptr_t handle)
}
static void vita_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
(void)data;
font_driver_render_msg(font, msg, params);
video_frame_info_t video_info;
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
}
static bool vita_get_current_sw_framebuffer(void *data,

View File

@ -34,6 +34,8 @@
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../common/vulkan_common.h"
#include "../../driver.h"
@ -45,7 +47,6 @@
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../font_driver.h"
#include "../video_context_driver.h"
#include "../video_coord_array.h"
@ -54,7 +55,7 @@ static void vulkan_set_viewport(void *data, unsigned viewport_width,
#ifdef HAVE_OVERLAY
static void vulkan_overlay_free(vk_t *vk);
static void vulkan_render_overlay(vk_t *vk);
static void vulkan_render_overlay(vk_t *vk, video_frame_info_t *video_info);
#endif
static void vulkan_viewport_info(void *data, struct video_viewport *vp);
@ -1463,7 +1464,7 @@ static void vulkan_readback(vk_t *vk)
VK_PIPELINE_STAGE_HOST_BIT);
}
static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info)
static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
{
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
@ -1520,10 +1521,10 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t video_info)
static bool vulkan_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
struct vk_per_frame *chain;
unsigned width, height;
VkSemaphore signal_semaphores[2];
VkClearValue clear_value;
vk_t *vk = (vk_t*)data;
static struct retro_perf_counter frame_run = {0};
@ -1534,7 +1535,8 @@ static bool vulkan_frame(void *data, const void *frame,
static struct retro_perf_counter swapbuffers = {0};
static struct retro_perf_counter queue_submit = {0};
bool waits_for_semaphores = false;
VkSemaphore signal_semaphores[2];
unsigned width = video_info->width;
unsigned height = video_info->height;
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
@ -1554,8 +1556,6 @@ static bool vulkan_frame(void *data, const void *frame,
performance_counter_init(&end_cmd, "end_command");
performance_counter_start(&frame_run);
video_driver_get_size(&width, &height);
/* Bookkeeping on start of frame. */
chain = &vk->swapchain[frame_index];
vk->chain = chain;
@ -1738,7 +1738,7 @@ static bool vulkan_frame(void *data, const void *frame,
#if defined(HAVE_MENU)
if (vk->menu.enable)
{
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
menu_driver_frame(video_info);
if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE)
{
@ -1775,11 +1775,11 @@ static bool vulkan_frame(void *data, const void *frame,
#endif
if (msg)
font_driver_render_msg(NULL, msg, NULL);
font_driver_render_msg(video_info, NULL, msg, NULL);
#ifdef HAVE_OVERLAY
if (vk->overlay.enable)
vulkan_render_overlay(vk);
vulkan_render_overlay(vk, video_info);
#endif
performance_counter_stop(&build_cmd);
@ -1922,7 +1922,7 @@ static bool vulkan_frame(void *data, const void *frame,
gfx_ctx_mode_t mode;
mode.width = width;
mode.height = height;
video_context_driver_set_resize(&mode);
video_context_driver_set_resize(mode);
vk->should_resize = false;
}
@ -1931,7 +1931,7 @@ static bool vulkan_frame(void *data, const void *frame,
/* Disable BFI during fast forward, slow-motion,
* and pause to prevent flicker. */
if (
video_info.black_frame_insertion
video_info->black_frame_insertion
&& !input_driver_is_nonblock_state()
&& !runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
@ -2141,10 +2141,11 @@ static void vulkan_set_texture_enable(void *data, bool state, bool full_screen)
}
static void vulkan_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
(void)data;
font_driver_render_msg(font, msg, params);
video_frame_info_t video_info;
video_driver_build_info(&video_info);
font_driver_render_msg(&video_info, font, msg, params);
}
#endif
@ -2394,17 +2395,17 @@ static void vulkan_overlay_set_alpha(void *data,
}
}
static void vulkan_render_overlay(vk_t *vk)
static void vulkan_render_overlay(vk_t *vk, video_frame_info_t *video_info)
{
unsigned width, height;
unsigned i;
struct video_viewport vp;
unsigned width = video_info->width;
unsigned height = video_info->height;
if (!vk)
return;
video_driver_get_size(&width, &height);
vp = vk->vp;
vp = vk->vp;
vulkan_set_viewport(vk, width, height, vk->overlay.full_screen, false);
for (i = 0; i < vk->overlay.count; i++)

View File

@ -13,14 +13,23 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <coreinit/screen.h>
#include <coreinit/cache.h>
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "performance_counters.h"
#include <string.h>
#include <coreinit/screen.h>
#include <coreinit/cache.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "gx2.h"
#include "system/memory.h"
#include "system/wiiu.h"
@ -28,6 +37,8 @@
#include "wiiu_dbg.h"
#include "../font_driver.h"
#define _X 0x00
#define _Y 0x01
#define _Z 0x02
@ -127,16 +138,16 @@ static wiiu_set_position(position_t* position, GX2ColorBuffer* draw_buffer, floa
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, position, 4 * sizeof(*position));
}
static void wiiu_set_tex_coords(tex_coord_t* tex_coord, GX2Texture* texture, float u0, float v0, float u1, float v1)
static void wiiu_set_tex_coords(tex_coord_t* tex_coord, GX2Texture* texture, float u0, float v0, float u1, float v1, unsigned rotation)
{
tex_coord[0].u = u0 / texture->surface.width;
tex_coord[0].v = (v1 / texture->surface.height);
tex_coord[1].u = u1 / texture->surface.width;
tex_coord[1].v = (v1 / texture->surface.height);
tex_coord[2].u = u1 / texture->surface.width;
tex_coord[2].v = (v0 / texture->surface.height);
tex_coord[3].u = u0 / texture->surface.width;
tex_coord[3].v = (v0 / texture->surface.height);
tex_coord[((0 + rotation) % 4)].u = u0 / texture->surface.width;
tex_coord[((0 + rotation) % 4)].v = (v1 / texture->surface.height);
tex_coord[((1 + rotation) % 4)].u = u1 / texture->surface.width;
tex_coord[((1 + rotation) % 4)].v = (v1 / texture->surface.height);
tex_coord[((2 + rotation) % 4)].u = u1 / texture->surface.width;
tex_coord[((2 + rotation) % 4)].v = (v0 / texture->surface.height);
tex_coord[((3 + rotation) % 4)].u = u0 / texture->surface.width;
tex_coord[((3 + rotation) % 4)].v = (v0 / texture->surface.height);
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, tex_coord, 4 * sizeof(*tex_coord));
}
@ -396,7 +407,7 @@ static void* wiiu_gfx_init(const video_info_t* video,
wiiu->tex_coord = MEM2_alloc(4 * sizeof(*wiiu->tex_coord), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0,
wiiu->texture.surface.width, wiiu->texture.surface.height);
wiiu->texture.surface.width, wiiu->texture.surface.height, wiiu->rotation);
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position);
GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord), sizeof(*wiiu->tex_coord), wiiu->tex_coord);
@ -407,7 +418,7 @@ static void* wiiu_gfx_init(const video_info_t* video,
wiiu->menu.tex_coord = MEM2_alloc(4 * sizeof(*wiiu->menu.tex_coord), GX2_VERTEX_BUFFER_ALIGNMENT);
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0,
wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height);
wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0);
/* init frame texture */
memset(&wiiu->texture, 0, sizeof(GX2Texture));
@ -550,7 +561,7 @@ static void wiiu_gfx_free(void* data)
static bool wiiu_gfx_frame(void* data, const void* frame,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char* msg, video_frame_info_t video_info)
unsigned pitch, const char* msg, video_frame_info_t *video_info)
{
(void)msg;
int i;
@ -656,7 +667,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->texture.surface.image,
wiiu->texture.surface.imageSize);
wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height);
wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height, wiiu->rotation);
}
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position);
@ -668,6 +679,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if (wiiu->menu.enable)
{
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position), sizeof(*wiiu->menu.position), wiiu->menu.position);
@ -821,8 +836,8 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->menu.texture.surface.image,
wiiu->menu.texture.surface.imageSize);
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height);
// wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height);
wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height, 0);
// wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0);
}
static void wiiu_gfx_set_texture_enable(void* data, bool state, bool full_screen)

View File

@ -26,6 +26,8 @@
#include "../../config.h"
#endif
#include "../font_driver.h"
#include "../../driver.h"
#include "../../runloop.h"
@ -192,7 +194,7 @@ static void *xenon360_gfx_init(const video_info_t *video, const input_driver_t *
}
static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, unsigned height,
uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t video_info)
uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
gl_t *vid = data;
@ -230,6 +232,10 @@ static bool xenon360_gfx_frame(void *data, const void *frame, unsigned width, un
Xe_SetShader(vid->gl_device, SHADER_TYPE_PIXEL, vid->g_pPixelTexturedShader, 0);
Xe_SetShader(vid->gl_device, SHADER_TYPE_VERTEX, vid->g_pVertexShader, 0);
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
// Draw
Xe_DrawPrimitive(vid->gl_device, XE_PRIMTYPE_TRIANGLELIST, 0, 1);

View File

@ -32,6 +32,8 @@
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../common/x11_common.h"
typedef struct xshm
@ -94,7 +96,7 @@ static void *xshm_gfx_init(const video_info_t *video,
static bool xshm_gfx_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
xshm_t* xshm = (xshm_t*)data;
int y;
@ -104,6 +106,10 @@ static bool xshm_gfx_frame(void *data, const void *frame, unsigned width,
memcpy((uint8_t*)xshm->shmInfo.shmaddr + sizeof(uint32_t)*xshm->width*y,
(uint8_t*)frame + pitch*y, pitch);
}
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
XShmPutImage(xshm->display, xshm->wndw, xshm->gc, xshm->image,
0, 0, 0, 0, xshm->width, xshm->height, False);

View File

@ -30,10 +30,19 @@
#include <retro_inline.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../frontend/frontend_driver.h"
#include "../../verbosity.h"
#include "../font_driver.h"
#include "../common/x11_common.h"
@ -414,6 +423,7 @@ static void *xv_init(const video_info_t *video,
XWindowAttributes target;
video_frame_info_t video_info;
char buf[128] = {0};
char title[128] = {0};
XSetWindowAttributes attributes = {0};
XVisualInfo visualtemplate = {0};
unsigned width = 0;
@ -530,8 +540,10 @@ static void *xv_init(const video_info_t *video,
video_driver_build_info(&video_info);
if (video_monitor_get_fps(video_info, buf, sizeof(buf), NULL, 0))
XStoreName(g_x11_dpy, g_x11_win, buf);
video_driver_get_window_title(title, sizeof(title));
if (title[0])
XStoreName(g_x11_dpy, g_x11_win, title);
x11_set_window_attr(g_x11_dpy, g_x11_win);
@ -784,7 +796,7 @@ static void xv_render_msg(xv_t *xv, const char *msg,
static bool xv_frame(void *data, const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
XWindowAttributes target;
xv_t *xv = (xv_t*)data;
@ -802,6 +814,10 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
xv->vp.full_width = target.width;
xv->vp.full_height = target.height;
#ifdef HAVE_MENU
menu_driver_frame(video_info);
#endif
if (msg)
xv_render_msg(xv, msg, width << 1, height << 1);
@ -811,7 +827,7 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
true);
XSync(g_x11_dpy, False);
x11_update_window_title(NULL, video_info);
x11_update_title(NULL, video_info);
return true;
}

View File

@ -230,14 +230,12 @@ static void android_gfx_ctx_get_video_size(void *data,
}
static void android_gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width = 0;
unsigned new_height = 0;
android_ctx_data_t *and = (android_ctx_data_t*)data;
(void)frame_count;
*quit = false;
switch (android_api)
@ -314,21 +312,8 @@ static bool android_gfx_ctx_set_resize(void *data,
return false;
}
static void android_gfx_ctx_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool android_gfx_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -436,12 +421,6 @@ static bool android_gfx_ctx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool android_gfx_ctx_has_windowed(void *data)
{
(void)data;
return false;
}
static void dpi_get_density(char *s, size_t len)
{
system_property_get("getprop", "ro.sf.lcd_density", s);
@ -493,7 +472,7 @@ dpi_fallback:
return true;
}
static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void android_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
android_ctx_data_t *and = (android_ctx_data_t*)data;
@ -618,12 +597,12 @@ const gfx_ctx_driver_t gfx_ctx_android = {
NULL, /* get_video_output_next */
android_gfx_ctx_get_metrics,
NULL,
android_gfx_ctx_update_window_title,
NULL, /* update_title */
android_gfx_ctx_check_window,
android_gfx_ctx_set_resize,
android_gfx_ctx_has_focus,
android_gfx_ctx_suppress_screensaver,
android_gfx_ctx_has_windowed,
NULL, /* has_windowed */
android_gfx_ctx_swap_buffers,
android_gfx_ctx_input_driver,
android_gfx_ctx_get_proc_address,

View File

@ -29,7 +29,6 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include "../../runloop.h"
#include "../video_context_driver.h"
typedef int CGSConnectionID;
@ -78,11 +77,10 @@ static void gfx_ctx_cgl_get_video_size(void *data, unsigned *width, unsigned *he
}
static void gfx_ctx_cgl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
(void)frame_count;
unsigned new_width = 0;
unsigned new_height = 0;
*quit = false;
@ -95,37 +93,15 @@ static void gfx_ctx_cgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_cgl_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_cgl_data_t *cgl = (gfx_ctx_cgl_data_t*)data;
CGLFlushDrawable(cgl->glCtx);
}
static bool gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_cgl_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_cgl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -195,12 +171,6 @@ static bool gfx_ctx_cgl_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_cgl_has_windowed(void *data)
{
(void)data;
return false;
}
static bool gfx_ctx_cgl_bind_api(void *data, enum gfx_ctx_api api,
unsigned major, unsigned minor)
{
@ -364,12 +334,12 @@ const gfx_ctx_driver_t gfx_ctx_cgl = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_cgl_update_window_title,
NULL, /* update_title */
gfx_ctx_cgl_check_window,
gfx_ctx_cgl_set_resize,
NULL, /* set_resize */
gfx_ctx_cgl_has_focus,
gfx_ctx_cgl_suppress_screensaver,
gfx_ctx_cgl_has_windowed,
NULL, /* has_windowed */
gfx_ctx_cgl_swap_buffers,
gfx_ctx_cgl_input_driver,
gfx_ctx_cgl_get_proc_address,

View File

@ -330,7 +330,7 @@ static void cocoagl_gfx_ctx_show_mouse(void *data, bool state)
}
static bool cocoagl_gfx_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height, bool fullscreen)
{
#if defined(HAVE_COCOA)
@ -416,28 +416,27 @@ static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned
*height = CGRectGetHeight(size) * screenscale;
}
static void cocoagl_gfx_ctx_update_window_title(void *data, video_frame_info_t video_info)
#if defined(HAVE_COCOA)
static void cocoagl_gfx_ctx_update_title(void *data, video_frame_info_t *video_info)
{
#if defined(HAVE_COCOA)
ui_window_cocoa_t view;
const ui_window_t *window = NULL;
#endif
static char buf_fps[128] = {0};
static char buf[128] = {0};
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
#if defined(HAVE_COCOA)
window = ui_companion_driver_get_window_ptr();
const ui_window_t *window = ui_companion_driver_get_window_ptr();
view.data = (CocoaView*)nsview_get_ptr();
if (window && *buf)
window->set_title(&view, buf);
#endif
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (window)
{
char title[128];
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (title[0])
window->set_title(&view, title);
}
}
#endif
static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
float *value)
@ -526,18 +525,14 @@ static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable)
return false;
}
#if !defined(HAVE_COCOATOUCH)
static bool cocoagl_gfx_ctx_has_windowed(void *data)
{
(void)data;
#if defined(HAVE_COCOATOUCH)
return false;
#else
return true;
#endif
}
#endif
static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void cocoagl_gfx_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
if (!(--g_fast_forward_skips < 0))
return;
@ -564,10 +559,9 @@ CFStringRef)BOXSTRING(symbol_name)
}
static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
(void)frame_count;
*quit = false;
@ -580,14 +574,6 @@ static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
}
}
static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void cocoagl_gfx_ctx_input_driver(void *data,
const char *name,
const input_driver_t **input, void **input_data)
@ -631,12 +617,20 @@ const gfx_ctx_driver_t gfx_ctx_cocoagl = {
NULL, /* get_video_output_next */
cocoagl_gfx_ctx_get_metrics,
NULL,
cocoagl_gfx_ctx_update_window_title,
#if defined(HAVE_COCOA)
cocoagl_gfx_ctx_update_title,
#else
NULL, /* update_title */
#endif
cocoagl_gfx_ctx_check_window,
cocoagl_gfx_ctx_set_resize,
NULL, /* set_resize */
cocoagl_gfx_ctx_has_focus,
cocoagl_gfx_ctx_suppress_screensaver,
#if defined(HAVE_COCOATOUCH)
NULL,
#else
cocoagl_gfx_ctx_has_windowed,
#endif
cocoagl_gfx_ctx_swap_buffers,
cocoagl_gfx_ctx_input_driver,
cocoagl_gfx_ctx_get_proc_address,

View File

@ -29,7 +29,6 @@
#include "../drivers/d3d.h"
#include "../common/win32_common.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../../ui/ui_companion_driver.h"
@ -76,7 +75,7 @@ static bool gfx_ctx_d3d_set_resize(void *data, unsigned new_width, unsigned new_
return true;
}
static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t *video_info)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
@ -84,25 +83,11 @@ static void gfx_ctx_d3d_swap_buffers(void *data, video_frame_info_t video_info)
d3d_swap(d3d, d3dr);
}
static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buffer_fps[128];
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buffer_fps[0] = '\0';
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buffer_fps, sizeof(buffer_fps)))
{
#ifndef _XBOX
window->set_title(&main_window, buf);
#endif
}
if (video_info.fps_show)
{
#ifdef _XBOX
if (video_info->fps_show)
{
MEMORYSTATUS stat;
char mem[128];
@ -111,10 +96,24 @@ static void gfx_ctx_d3d_update_title(void *data, video_frame_info_t video_info)
GlobalMemoryStatus(&stat);
snprintf(mem, sizeof(mem), "|| MEM: %.2f/%.2fMB",
stat.dwAvailPhys/(1024.0f*1024.0f), stat.dwTotalPhys/(1024.0f*1024.0f));
strlcat(buffer_fps, mem, sizeof(buffer_fps));
#endif
runloop_msg_queue_push(buffer_fps, 1, 1, false);
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
}
#else
const ui_window_t *window = ui_companion_driver_get_window_ptr();
if (window)
{
char title[128];
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (title[0])
window->set_title(&main_window, title);
}
#endif
}
static void gfx_ctx_d3d_show_mouse(void *data, bool state)
@ -126,7 +125,7 @@ static void gfx_ctx_d3d_show_mouse(void *data, bool state)
static void gfx_ctx_d3d_check_window(void *data, bool *quit,
bool *resize, unsigned *width,
unsigned *height, unsigned frame_count)
unsigned *height)
{
win32_check_window(quit, resize, width, height);
}
@ -141,16 +140,14 @@ static bool gfx_ctx_d3d_suppress_screensaver(void *data, bool enable)
return win32_suppress_screensaver(data, enable);
}
#ifndef _XBOX
static bool gfx_ctx_d3d_has_windowed(void *data)
{
(void)data;
#ifdef _XBOX
return false;
#else
return true;
#endif
}
#endif
static bool gfx_ctx_d3d_bind_api(void *data,
enum gfx_ctx_api api, unsigned major, unsigned minor)
@ -197,7 +194,7 @@ static void gfx_ctx_d3d_input_driver(void *data,
}
static bool gfx_ctx_d3d_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -347,7 +344,11 @@ const gfx_ctx_driver_t gfx_ctx_d3d = {
gfx_ctx_d3d_set_resize,
gfx_ctx_d3d_has_focus,
gfx_ctx_d3d_suppress_screensaver,
#ifdef _XBOX
NULL,
#else
gfx_ctx_d3d_has_windowed,
#endif
gfx_ctx_d3d_swap_buffers,
gfx_ctx_d3d_input_driver,
NULL,

View File

@ -36,7 +36,6 @@
#include <streams/file_stream.h>
#include "../../verbosity.h"
#include "../../runloop.h"
#include "../../frontend/frontend_driver.h"
#include "../common/drm_common.h"
@ -138,10 +137,9 @@ static void gfx_ctx_drm_swap_interval(void *data, unsigned interval)
}
static void gfx_ctx_drm_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
(void)data;
(void)frame_count;
(void)width;
(void)height;
@ -225,7 +223,7 @@ static bool gfx_ctx_drm_queue_flip(void)
return false;
}
static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)data;
@ -253,37 +251,13 @@ static void gfx_ctx_drm_swap_buffers(void *data, video_frame_info_t video_info)
waiting_for_flip = gfx_ctx_drm_queue_flip();
/* Triple-buffered page flips */
if (video_info.max_swapchain_images >= 3 &&
if (video_info->max_swapchain_images >= 3 &&
gbm_surface_has_free_buffers(g_gbm_surface))
return;
gfx_ctx_drm_wait_flip(true);
}
static bool gfx_ctx_drm_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_drm_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push( buf_fps, 1, 1, false);
}
static void gfx_ctx_drm_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -617,7 +591,7 @@ error:
#endif
static bool gfx_ctx_drm_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -634,7 +608,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
/* If we use black frame insertion,
* we fake a 60 Hz monitor for 120 Hz one,
* etc, so try to match that. */
refresh_mod = video_info.black_frame_insertion
refresh_mod = video_info->black_frame_insertion
? 0.5f : 1.0f;
/* Find desired video mode, and use that.
@ -660,7 +634,7 @@ static bool gfx_ctx_drm_set_video_mode(void *data,
continue;
diff = fabsf(refresh_mod * g_drm_connector->modes[i].vrefresh
- video_info.refresh_rate);
- video_info->refresh_rate);
if (!g_drm_mode || diff < minimum_fps_diff)
{
@ -765,12 +739,6 @@ static bool gfx_ctx_drm_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_drm_has_windowed(void *data)
{
(void)data;
return false;
}
static bool gfx_ctx_drm_bind_api(void *video_driver,
enum gfx_ctx_api api, unsigned major, unsigned minor)
{
@ -889,12 +857,12 @@ const gfx_ctx_driver_t gfx_ctx_drm = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_drm_update_window_title,
NULL, /* update_window_title */
gfx_ctx_drm_check_window,
gfx_ctx_drm_set_resize,
NULL, /* set_resize */
gfx_ctx_drm_has_focus,
gfx_ctx_drm_suppress_screensaver,
gfx_ctx_drm_has_windowed,
NULL, /* has_windowed */
gfx_ctx_drm_swap_buffers,
gfx_ctx_drm_input_driver,
gfx_ctx_drm_get_proc_address,

View File

@ -52,7 +52,7 @@ static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval)
}
static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
int input_width;
int input_height;
@ -60,7 +60,6 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
(void)data;
(void)frame_count;
emscripten_get_canvas_size(&input_width, &input_height, &is_fullscreen);
*width = (unsigned)input_width;
@ -75,34 +74,12 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
*quit = false;
}
static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_emscripten_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
/* no-op in emscripten, no way to force swap/wait for VSync in browsers */
}
static bool gfx_ctx_emscripten_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_emscripten_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_emscripten_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -189,7 +166,7 @@ error:
}
static bool gfx_ctx_emscripten_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -330,9 +307,9 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
gfx_ctx_emscripten_translate_aspect,
gfx_ctx_emscripten_update_window_title,
NULL, /* update_title */
gfx_ctx_emscripten_check_window,
gfx_ctx_emscripten_set_resize,
NULL, /* set_resize */
gfx_ctx_emscripten_has_focus,
gfx_ctx_emscripten_suppress_screensaver,
gfx_ctx_emscripten_has_windowed,

View File

@ -34,7 +34,6 @@
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../../runloop.h"
#include "../../verbosity.h"
#include "../video_context_driver.h"
@ -65,7 +64,7 @@ static void setup_gdi_pixel_format(HDC hdc)
}
static void gfx_ctx_gdi_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
win32_check_window(quit, resize, width, height);
}
@ -87,19 +86,17 @@ static bool gfx_ctx_gdi_set_resize(void *data,
return false;
}
static void gfx_ctx_gdi_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_gdi_update_window_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
const ui_window_t *window = ui_companion_driver_get_window_ptr();
char title[128];
buf[0] = buf_fps[0] = '\0';
title[0] = '\0';
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
window->set_title(&main_window, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
video_driver_get_window_title(title, sizeof(title));
if (window && title[0])
window->set_title(&main_window, title);
}
static void gfx_ctx_gdi_get_video_size(void *data,
@ -190,7 +187,7 @@ static void gfx_ctx_gdi_destroy(void *data)
}
static bool gfx_ctx_gdi_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -287,7 +284,7 @@ static uint32_t gfx_ctx_gdi_get_flags(void *data)
return flags;
}
static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_gdi_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;

View File

@ -25,9 +25,8 @@ static void gfx_ctx_null_swap_interval(void *data, unsigned interval)
}
static void gfx_ctx_null_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
(void)frame_count;
(void)data;
(void)quit;
(void)width;
@ -35,25 +34,11 @@ static void gfx_ctx_null_check_window(void *data, bool *quit,
(void)resize;
}
static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_null_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
}
static bool gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_null_update_window_title(void *data, video_frame_info_t video_info)
{
(void)data;
(void)video_info;
}
static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
@ -62,7 +47,7 @@ static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *h
}
static bool gfx_ctx_null_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -101,12 +86,6 @@ static bool gfx_ctx_null_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_null_has_windowed(void *data)
{
(void)data;
return true;
}
static bool gfx_ctx_null_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)data;
@ -161,12 +140,12 @@ const gfx_ctx_driver_t gfx_ctx_null = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_null_update_window_title,
NULL, /* update_title */
gfx_ctx_null_check_window,
gfx_ctx_null_set_resize,
NULL, /* set_resize */
gfx_ctx_null_has_focus,
gfx_ctx_null_suppress_screensaver,
gfx_ctx_null_has_windowed,
NULL, /* has_windowed */
gfx_ctx_null_swap_buffers,
gfx_ctx_null_input_driver,
NULL,

View File

@ -74,10 +74,9 @@ error:
}
static void gfx_ctx_khr_display_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
(void)frame_count;
*resize = khr->vk.need_new_swapchain;
@ -110,21 +109,8 @@ static bool gfx_ctx_khr_display_set_resize(void *data,
return false;
}
static void gfx_ctx_khr_display_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_khr_display_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -184,12 +170,6 @@ static bool gfx_ctx_khr_display_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_khr_display_has_windowed(void *data)
{
(void)data;
return false;
}
static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_interval)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
@ -201,7 +181,7 @@ static void gfx_ctx_khr_display_set_swap_interval(void *data, unsigned swap_inte
}
}
static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_khr_display_swap_buffers(void *data, video_frame_info_t *video_info)
{
khr_display_ctx_data_t *khr = (khr_display_ctx_data_t*)data;
vulkan_present(&khr->vk, khr->vk.context.current_swapchain_index);
@ -243,12 +223,12 @@ const gfx_ctx_driver_t gfx_ctx_khr_display = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_khr_display_update_window_title,
NULL, /* update_title */
gfx_ctx_khr_display_check_window,
gfx_ctx_khr_display_set_resize,
gfx_ctx_khr_display_has_focus,
gfx_ctx_khr_display_suppress_screensaver,
gfx_ctx_khr_display_has_windowed,
NULL, /* has_windowed */
gfx_ctx_khr_display_swap_buffers,
gfx_ctx_khr_display_input_driver,
gfx_ctx_khr_display_get_proc_address,

View File

@ -131,12 +131,10 @@ error:
}
static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
(void)frame_count;
gfx_ctx_mali_fbdev_get_video_size(data, &new_width, &new_height);
if (new_width != *width || new_height != *height)
@ -149,30 +147,8 @@ static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_mali_fbdev_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_mali_fbdev_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -254,12 +230,6 @@ static bool gfx_ctx_mali_fbdev_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_mali_fbdev_has_windowed(void *data)
{
(void)data;
return false;
}
static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_interval)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
@ -269,7 +239,7 @@ static void gfx_ctx_mali_fbdev_set_swap_interval(void *data, unsigned swap_inter
#endif
}
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_mali_fbdev_swap_buffers(void *data, video_frame_info_t *video_info)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
@ -319,12 +289,12 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_mali_fbdev_update_window_title,
NULL, /* update_title */
gfx_ctx_mali_fbdev_check_window,
gfx_ctx_mali_fbdev_set_resize,
NULL, /* set_resize */
gfx_ctx_mali_fbdev_has_focus,
gfx_ctx_mali_fbdev_suppress_screensaver,
gfx_ctx_mali_fbdev_has_windowed,
NULL, /* has_windowed */
gfx_ctx_mali_fbdev_swap_buffers,
gfx_ctx_mali_fbdev_input_driver,
gfx_ctx_mali_fbdev_get_proc_address,

View File

@ -29,7 +29,6 @@
#endif
#include "../../frontend/frontend_driver.h"
#include "../../runloop.h"
typedef struct
{
@ -113,7 +112,7 @@ static void gfx_ctx_opendingux_get_video_size(void *data,
}
static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
@ -132,30 +131,8 @@ static void gfx_ctx_opendingux_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_opendingux_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_opendingux_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_opendingux_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -226,13 +203,7 @@ static bool gfx_ctx_opendingux_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_opendingux_has_windowed(void *data)
{
(void)data;
return false;
}
static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_opendingux_swap_buffers(void *data, video_frame_info_t *video_info)
{
opendingux_ctx_data_t *viv = (opendingux_ctx_data_t*)data;
@ -292,12 +263,12 @@ const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_opendingux_update_window_title,
NULL, /* update_title */
gfx_ctx_opendingux_check_window,
gfx_ctx_opendingux_set_resize,
NULL, /* set_resize */
gfx_ctx_opendingux_has_focus,
gfx_ctx_opendingux_suppress_screensaver,
gfx_ctx_opendingux_has_windowed,
NULL, /* has_windowed */
gfx_ctx_opendingux_swap_buffers,
gfx_ctx_opendingux_input_driver,
gfx_ctx_opendingux_get_proc_address,

View File

@ -56,7 +56,6 @@ typedef struct gfx_osmesa_ctx_data
int height;
int pixsize;
int frame_count;
OSMesaContext ctx;
int socket;
int client;
@ -240,7 +239,7 @@ static void osmesa_ctx_swap_interval(void *data, unsigned interval)
}
static bool osmesa_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -308,24 +307,9 @@ static void osmesa_ctx_get_video_size(void *data,
*height = osmesa->height;
}
static void osmesa_ctx_update_window_title(void *data, video_frame_info_t video_info)
{
static char buf[128] = {0};
static char buf_fps[128] = {0};
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
if (!osmesa)
return;
video_monitor_get_fps(video_info, buf,
sizeof(buf), buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void osmesa_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width,
unsigned *height, unsigned frame_count)
static void osmesa_ctx_check_window(void *data, bool *quit,
bool *resize,unsigned *width,
unsigned *height)
{
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
@ -333,15 +317,6 @@ static void osmesa_ctx_check_window(void *data, bool *quit, bool *resize,unsigne
*height = osmesa->height;
*resize = false;
*quit = false;
osmesa->frame_count = frame_count;
}
static bool osmesa_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool osmesa_ctx_has_focus(void *data)
@ -363,7 +338,7 @@ static bool osmesa_ctx_has_windowed(void *data)
return true;
}
static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void osmesa_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_osmesa_data_t *osmesa = (gfx_ctx_osmesa_data_t*)data;
osmesa_fifo_accept(osmesa);
@ -419,9 +394,9 @@ const gfx_ctx_driver_t gfx_ctx_osmesa =
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL, /* translate_aspect */
osmesa_ctx_update_window_title,
NULL, /* update_title */
osmesa_ctx_check_window,
osmesa_ctx_set_resize,
NULL, /* set_resize */
osmesa_ctx_has_focus,
osmesa_ctx_suppress_screensaver,
osmesa_ctx_has_windowed,

View File

@ -31,7 +31,6 @@
#endif
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../defines/ps3_defines.h"
#include "../common/gl_common.h"
#include "../video_context_driver.h"
@ -149,7 +148,7 @@ static void gfx_ctx_ps3_set_swap_interval(void *data, unsigned interval)
}
static void gfx_ctx_ps3_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
gl_t *gl = data;
@ -173,13 +172,7 @@ static bool gfx_ctx_ps3_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_ps3_has_windowed(void *data)
{
(void)data;
return false;
}
static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
#ifdef HAVE_LIBDBGFONT
@ -193,27 +186,6 @@ static void gfx_ctx_ps3_swap_buffers(void *data, video_frame_info_t video_info)
#endif
}
static bool gfx_ctx_ps3_set_resize(void *data,
unsigned width, unsigned height)
{
return false;
}
static void gfx_ctx_ps3_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
(void)data;
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_ps3_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -302,15 +274,10 @@ static void *gfx_ctx_ps3_init(video_frame_info_t video_info, void *video_driver)
}
static bool gfx_ctx_ps3_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
global_t *global = global_get_ptr();
if (!global)
return false;
return true;
}
@ -438,12 +405,12 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_get_video_output_next,
NULL, /* get_metrics */
NULL,
gfx_ctx_ps3_update_window_title,
NULL, /* update_title */
gfx_ctx_ps3_check_window,
gfx_ctx_ps3_set_resize,
NULL, /* set_resize */
gfx_ctx_ps3_has_focus,
gfx_ctx_ps3_suppress_screensaver,
gfx_ctx_ps3_has_windowed,
NULL, /* has_windowed */
gfx_ctx_ps3_swap_buffers,
gfx_ctx_ps3_input_driver,
NULL,

View File

@ -284,14 +284,11 @@ static void gfx_ctx_qnx_get_video_size(void *data,
}
static void gfx_ctx_qnx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
(void)data;
(void)frame_count;
*quit = false;
#ifdef HAVE_EGL
@ -310,30 +307,8 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
*quit = true;
}
static bool gfx_ctx_qnx_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_qnx_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_qnx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -375,12 +350,6 @@ static bool gfx_ctx_qnx_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_qnx_has_windowed(void *data)
{
(void)data;
return false;
}
static int dpi_get_density(qnx_ctx_data_t *qnx)
{
int screen_dpi[2];
@ -444,7 +413,7 @@ static void gfx_ctx_qnx_set_swap_interval(void *data, unsigned swap_interval)
#endif
}
static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_qnx_swap_buffers(void *data, video_frame_info_t *video_info)
{
qnx_ctx_data_t *qnx = (qnx_ctx_data_t*)data;
@ -493,12 +462,12 @@ const gfx_ctx_driver_t gfx_ctx_qnx = {
NULL, /* get_video_output_next */
gfx_ctx_qnx__get_metrics,
NULL,
gfx_ctx_qnx_update_window_title,
NULL, /* update_title */
gfx_ctx_qnx_check_window,
gfx_ctx_qnx_set_resize,
NULL, /* set_resize */
gfx_ctx_qnx_has_focus,
gfx_ctx_qnx_suppress_screensaver,
gfx_ctx_qnx_has_windowed,
NULL, /* has_windowed */
gfx_ctx_qnx_swap_buffers,
gfx_ctx_qnx_input_driver,
gfx_ctx_qnx_get_proc_address,

View File

@ -25,7 +25,6 @@
#endif
#include "../../configuration.h"
#include "../../runloop.h"
#include "../common/gl_common.h"
static enum gfx_ctx_api sdl_api = GFX_CTX_OPENGL_API;
@ -42,7 +41,6 @@ typedef struct gfx_ctx_sdl_data
bool g_full;
bool g_resized;
int g_frame_count;
#ifdef HAVE_SDL2
SDL_Window *g_win;
SDL_GLContext g_ctx;
@ -163,7 +161,7 @@ static void sdl_ctx_swap_interval(void *data, unsigned interval)
}
static bool sdl_ctx_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -177,7 +175,7 @@ static bool sdl_ctx_set_video_mode(void *data,
if (fullscreen)
{
if (video_info.windowed_fullscreen)
if (video_info->windowed_fullscreen)
fsflag = SDL_WINDOW_FULLSCREEN_DESKTOP;
else
fsflag = SDL_WINDOW_FULLSCREEN;
@ -192,7 +190,7 @@ static bool sdl_ctx_set_video_mode(void *data,
}
else
{
unsigned display = video_info.monitor_index;
unsigned display = video_info->monitor_index;
sdl->g_win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
SDL_WINDOWPOS_UNDEFINED_DISPLAY(display),
@ -268,31 +266,27 @@ static void sdl_ctx_get_video_size(void *data,
}
}
static void sdl_ctx_update_window_title(void *data, video_frame_info_t video_info)
static void sdl_ctx_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
char title[128];
buf[0] = buf_fps[0] = '\0';
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
{
#ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
if (sdl)
SDL_SetWindowTitle(sdl->g_win, buf);
#else
SDL_WM_SetCaption(buf, NULL);
#endif
}
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (sdl && title[0])
SDL_SetWindowTitle(sdl->g_win, title);
#else
if (title[0])
SDL_WM_SetCaption(title, NULL);
#endif
}
static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *width,
unsigned *height, unsigned frame_count)
unsigned *height)
{
SDL_Event event;
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
@ -340,16 +334,6 @@ static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *
*resize = true;
sdl->g_resized = false;
}
sdl->g_frame_count = frame_count;
}
static bool sdl_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool sdl_ctx_has_focus(void *data)
@ -379,7 +363,7 @@ static bool sdl_ctx_has_windowed(void *data)
return true;
}
static void sdl_ctx_swap_buffers(void *data, video_frame_info_t video_info)
static void sdl_ctx_swap_buffers(void *data, video_frame_info_t *video_info)
{
#ifdef HAVE_SDL2
gfx_ctx_sdl_data_t *sdl = (gfx_ctx_sdl_data_t*)data;
@ -435,9 +419,9 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL, /* translate_aspect */
sdl_ctx_update_window_title,
sdl_ctx_update_title,
sdl_ctx_check_window,
sdl_ctx_set_resize,
NULL, /* set_resize */
sdl_ctx_has_focus,
sdl_ctx_suppress_screensaver,
sdl_ctx_has_windowed,

View File

@ -86,10 +86,9 @@ static INLINE bool gfx_ctx_vc_egl_query_extension(vc_ctx_data_t *vc, const char
}
static void gfx_ctx_vc_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
(void)data;
(void)frame_count;
(void)width;
(void)height;
@ -97,27 +96,6 @@ static void gfx_ctx_vc_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_vc_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static void gfx_ctx_vc_get_video_size(void *data,
unsigned *width, unsigned *height)
{
@ -319,7 +297,7 @@ static void gfx_ctx_vc_set_swap_interval(void *data, unsigned swap_interval)
}
static bool gfx_ctx_vc_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -471,12 +449,6 @@ static bool gfx_ctx_vc_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_vc_has_windowed(void *data)
{
(void)data;
return false;
}
static float gfx_ctx_vc_translate_aspect(void *data,
unsigned width, unsigned height)
{
@ -608,7 +580,7 @@ error:
return false;
}
static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_vc_swap_buffers(void *data, video_frame_info_t *video_info)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
@ -659,12 +631,12 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
gfx_ctx_vc_translate_aspect,
gfx_ctx_vc_update_window_title,
NULL, /* update_title */
gfx_ctx_vc_check_window,
gfx_ctx_vc_set_resize,
NULL, /* set_resize */
gfx_ctx_vc_has_focus,
gfx_ctx_vc_suppress_screensaver,
gfx_ctx_vc_has_windowed,
NULL, /* has_windowed */
gfx_ctx_vc_swap_buffers,
gfx_ctx_vc_input_driver,
gfx_ctx_vc_get_proc_address,

View File

@ -29,7 +29,6 @@
#endif
#include "../../frontend/frontend_driver.h"
#include "../../runloop.h"
typedef struct
{
@ -117,7 +116,7 @@ static void gfx_ctx_vivante_get_video_size(void *data,
}
static void gfx_ctx_vivante_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
@ -136,30 +135,8 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit,
*quit = (bool)frontend_driver_get_signal_handler_state();
}
static bool gfx_ctx_vivante_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_vivante_update_window_title(void *data, video_frame_info_t video_info)
{
char buf[128];
char buf_fps[128];
buf[0] = buf_fps[0] = '\0';
video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
}
static bool gfx_ctx_vivante_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -231,12 +208,6 @@ static bool gfx_ctx_vivante_suppress_screensaver(void *data, bool enable)
return false;
}
static bool gfx_ctx_vivante_has_windowed(void *data)
{
(void)data;
return false;
}
static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval)
{
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
@ -246,7 +217,7 @@ static void gfx_ctx_vivante_set_swap_interval(void *data, unsigned swap_interval
#endif
}
static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_vivante_swap_buffers(void *data, video_frame_info_t *video_info)
{
vivante_ctx_data_t *viv = (vivante_ctx_data_t*)data;
@ -297,12 +268,12 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
NULL, /* get_video_output_next */
NULL, /* get_metrics */
NULL,
gfx_ctx_vivante_update_window_title,
NULL, /* update_title */
gfx_ctx_vivante_check_window,
gfx_ctx_vivante_set_resize,
NULL, /* set_resize */
gfx_ctx_vivante_has_focus,
gfx_ctx_vivante_suppress_screensaver,
gfx_ctx_vivante_has_windowed,
NULL, /* has_windowed */
gfx_ctx_vivante_swap_buffers,
gfx_ctx_vivante_input_driver,
gfx_ctx_vivante_get_proc_address,

View File

@ -643,14 +643,11 @@ static void flush_wayland_fd(gfx_ctx_wayland_data_t *wl)
}
static void gfx_ctx_wl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height,
unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
unsigned new_width, new_height;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
(void)frame_count;
flush_wayland_fd(wl);
new_width = *width;
@ -719,20 +716,17 @@ static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
return true;
}
static void gfx_ctx_wl_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_wl_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
char title[128];
buf[0] = buf_fps[0] = '\0';
title[0] = '\0';
if (video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
wl_shell_surface_set_title(wl->shell_surf, buf);
video_driver_get_window_title(title, sizeof(title));
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
if (wl && title[0])
wl_shell_surface_set_title(wl->shell_surf, title);
}
@ -1075,7 +1069,7 @@ static void gfx_ctx_wl_set_swap_interval(void *data, unsigned swap_interval)
}
static bool gfx_ctx_wl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -1557,7 +1551,7 @@ static void *gfx_ctx_wl_get_context_data(void *data)
}
#endif
static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_wl_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
@ -1676,7 +1670,7 @@ const gfx_ctx_driver_t gfx_ctx_wayland = {
NULL, /* get_video_output_next */
gfx_ctx_wl_get_metrics,
NULL,
gfx_ctx_wl_update_window_title,
gfx_ctx_wl_update_title,
gfx_ctx_wl_check_window,
gfx_ctx_wl_set_resize,
gfx_ctx_wl_has_focus,

View File

@ -41,7 +41,6 @@
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../../runloop.h"
#include "../video_context_driver.h"
#include "../common/win32_common.h"
@ -312,7 +311,7 @@ static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval)
}
static void gfx_ctx_wgl_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
win32_check_window(quit, resize, width, height);
@ -331,7 +330,7 @@ static void gfx_ctx_wgl_check_window(void *data, bool *quit,
}
}
static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_wgl_swap_buffers(void *data, video_frame_info_t *video_info)
{
(void)data;
@ -386,19 +385,21 @@ static bool gfx_ctx_wgl_set_resize(void *data,
return false;
}
static void gfx_ctx_wgl_update_window_title(void *data, video_frame_info_t video_info)
static void gfx_ctx_wgl_update_title(void *data, video_frame_info_t *video_info)
{
char buf[128];
char buf_fps[128];
const ui_window_t *window = ui_companion_driver_get_window_ptr();
buf[0] = buf_fps[0] = '\0';
if (window)
{
char title[128];
if (window && video_monitor_get_fps(video_info, buf, sizeof(buf),
buf_fps, sizeof(buf_fps)))
window->set_title(&main_window, buf);
if (video_info.fps_show)
runloop_msg_queue_push(buf_fps, 1, 1, false);
title[0] = '\0';
video_driver_get_window_title(title, sizeof(title));
if (title[0])
window->set_title(&main_window, title);
}
}
static void gfx_ctx_wgl_get_video_size(void *data,
@ -525,7 +526,7 @@ static void gfx_ctx_wgl_destroy(void *data)
}
static bool gfx_ctx_wgl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -687,7 +688,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
NULL, /* get_video_output_next */
gfx_ctx_wgl_get_metrics,
NULL,
gfx_ctx_wgl_update_window_title,
gfx_ctx_wgl_update_title,
gfx_ctx_wgl_check_window,
gfx_ctx_wgl_set_resize,
gfx_ctx_wgl_has_focus,

View File

@ -302,7 +302,7 @@ static void gfx_ctx_x_swap_interval(void *data, unsigned interval)
}
}
static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t *video_info)
{
gfx_ctx_x_data_t *x = (gfx_ctx_x_data_t*)data;
@ -347,9 +347,9 @@ static void gfx_ctx_x_swap_buffers(void *data, video_frame_info_t video_info)
}
static void gfx_ctx_x_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
bool *resize, unsigned *width, unsigned *height)
{
x11_check_window(data, quit, resize, width, height, frame_count);
x11_check_window(data, quit, resize, width, height);
switch (x_api)
{
@ -545,7 +545,7 @@ error:
}
static bool gfx_ctx_x_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -565,7 +565,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
if (!x)
return false;
windowed_full = video_info.windowed_fullscreen;
windowed_full = video_info->windowed_fullscreen;
true_full = false;
switch (x_api)
@ -613,8 +613,8 @@ static bool gfx_ctx_x_set_video_mode(void *data,
RARCH_ERR("[GLX]: Entering true fullscreen failed. Will attempt windowed mode.\n");
}
if (video_info.monitor_index)
g_x11_screen = video_info.monitor_index - 1;
if (video_info->monitor_index)
g_x11_screen = video_info->monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || g_x11_screen != 0)
@ -660,9 +660,8 @@ static bool gfx_ctx_x_set_video_mode(void *data,
break;
}
x11_set_window_attr(g_x11_dpy, g_x11_win);
x11_update_window_title(NULL, video_info);
x11_update_title(NULL, video_info);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
@ -789,7 +788,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
{
bool quit, resize;
unsigned width = 0, height = 0;
x11_check_window(x, &quit, &resize, &width, &height, 0);
x11_check_window(x, &quit, &resize, &width, &height);
/* Use XCB surface since it's the most supported WSI.
* We can obtain the XCB connection directly from X11. */
@ -1081,7 +1080,7 @@ const gfx_ctx_driver_t gfx_ctx_x = {
NULL, /* get_video_output_next */
x11_get_metrics,
NULL,
x11_update_window_title,
x11_update_title,
gfx_ctx_x_check_window,
gfx_ctx_x_set_resize,
x11_has_focus,

View File

@ -91,15 +91,6 @@ EGL_BLUE_SIZE, 1, \
EGL_ALPHA_SIZE, 0, \
EGL_DEPTH_SIZE, 0
static bool gfx_ctx_xegl_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void *gfx_ctx_xegl_init(video_frame_info_t video_info, void *video_driver)
{
#ifdef HAVE_EGL
@ -257,7 +248,7 @@ static EGLint *xegl_fill_attribs(xegl_ctx_data_t *xegl, EGLint *attr)
static void gfx_ctx_xegl_set_swap_interval(void *data, unsigned swap_interval);
static bool gfx_ctx_xegl_set_video_mode(void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
bool fullscreen)
{
@ -298,7 +289,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
ButtonPressMask | ButtonReleaseMask | KeyReleaseMask;
swa.override_redirect = fullscreen ? True : False;
if (fullscreen && !video_info.windowed_fullscreen)
if (fullscreen && !video_info->windowed_fullscreen)
{
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &xegl->desktop_mode))
{
@ -309,8 +300,8 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
RARCH_ERR("[X/EGL]: Entering true fullscreen failed. Will attempt windowed mode.\n");
}
if (video_info.monitor_index)
g_x11_screen = video_info.monitor_index - 1;
if (video_info->monitor_index)
g_x11_screen = video_info->monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || g_x11_screen != 0)
@ -352,7 +343,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
goto error;
x11_set_window_attr(g_x11_dpy, g_x11_win);
x11_update_window_title(NULL, video_info);
x11_update_title(NULL, video_info);
if (fullscreen)
x11_show_mouse(g_x11_dpy, g_x11_win, false);
@ -490,7 +481,7 @@ static void gfx_ctx_xegl_show_mouse(void *data, bool state)
x11_show_mouse(g_x11_dpy, g_x11_win, state);
}
static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t video_info)
static void gfx_ctx_xegl_swap_buffers(void *data, video_frame_info_t *video_info)
{
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
@ -591,9 +582,9 @@ const gfx_ctx_driver_t gfx_ctx_x_egl =
NULL, /* get_video_output_next */
x11_get_metrics,
NULL,
x11_update_window_title,
x11_update_title,
x11_check_window,
gfx_ctx_xegl_set_resize,
NULL, /* set_resize */
x11_has_focus,
gfx_ctx_xegl_suppress_screensaver,
gfx_ctx_xegl_has_windowed,

View File

@ -24,7 +24,6 @@
#endif
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../common/caca_common.h"
@ -74,7 +73,8 @@ static const struct font_glyph *caca_font_get_glyph(
return NULL;
}
static void caca_render_msg(void *data, const char *msg,
static void caca_render_msg(video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
float x, y;
@ -93,10 +93,8 @@ static void caca_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
}
if (!font->caca || !font->caca->caca_cv || !font->caca->caca_display ||
@ -117,7 +115,8 @@ static void caca_render_msg(void *data, const char *msg,
caca_refresh_display(*font->caca->caca_display);
}
static void caca_font_flush_block(void* data)
static void caca_font_flush_block(unsigned width, unsigned height,
void* data)
{
(void)data;
}

View File

@ -27,13 +27,15 @@
#include "../drivers/ctr_gu.h"
#include "../../ctr/gpu_old.h"
#include "../../configuration.h"
#include "../../verbosity.h"
/* FIXME: this is just a workaround to avoid
* using ctrGuCopyImage, since it seems to cause
* a freeze/blackscreen when used here. */
//#define FONT_TEXTURE_IN_VRAM
#if 0
#define FONT_TEXTURE_IN_VRAM
#endif
typedef struct
{
@ -148,33 +150,31 @@ static int ctr_font_get_message_width(void* data, const char* msg,
}
static void ctr_font_render_line(
ctr_font_t* font, const char* msg, unsigned msg_len,
float scale, const unsigned int color, float pos_x,
float pos_y, unsigned text_align)
video_frame_info_t *video_info,
ctr_font_t* font, const char* msg, unsigned msg_len,
float scale, const unsigned int color, float pos_x,
float pos_y, unsigned text_align)
{
int x, y, delta_x, delta_y;
unsigned width, height;
unsigned i;
ctr_vertex_t* v = NULL;
ctr_video_t* ctr = (ctr_video_t*)video_driver_get_ptr(false);
ctr_vertex_t* v;
video_driver_get_size(&width, &height);
x = roundf(pos_x * width);
y = roundf((1.0f - pos_y) * height);
delta_x = 0;
delta_y = 0;
unsigned width = video_info->width;
unsigned height = video_info->height;
int x = roundf(pos_x * width);
int y = roundf((1.0f - pos_y) * height);
int delta_x = 0;
int delta_y = 0;
switch (text_align)
{
case TEXT_ALIGN_RIGHT:
x -= ctr_font_get_message_width(font, msg, msg_len, scale);
break;
case TEXT_ALIGN_RIGHT:
x -= ctr_font_get_message_width(font, msg, msg_len, scale);
break;
case TEXT_ALIGN_CENTER:
x -= ctr_font_get_message_width(font, msg, msg_len, scale) / 2;
break;
case TEXT_ALIGN_CENTER:
x -= ctr_font_get_message_width(font, msg, msg_len, scale) / 2;
break;
}
if ((ctr->vertex_cache.size - (ctr->vertex_cache.current - ctr->vertex_cache.buffer)) < msg_len)
@ -227,7 +227,8 @@ static void ctr_font_render_line(
return;
ctrGuSetVertexShaderFloatUniform(0, (float*)&font->scale_vector, 1);
GSPGPU_FlushDataCache(ctr->vertex_cache.current, (v - ctr->vertex_cache.current) * sizeof(ctr_vertex_t));
GSPGPU_FlushDataCache(ctr->vertex_cache.current,
(v - ctr->vertex_cache.current) * sizeof(ctr_vertex_t));
ctrGuSetAttributeBuffers(2,
VIRT_TO_PHYS(ctr->vertex_cache.current),
CTRGU_ATTRIBFMT(GPU_SHORT, 4) << 0 |
@ -241,18 +242,25 @@ static void ctr_font_render_line(
GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_R, GPU_TEVOP_RGB_SRC_ALPHA, 0),
GPU_MODULATE, GPU_MODULATE,
color);
// printf("%s\n", msg);
// DEBUG_VAR(color);
// GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_R, 0, 0), GPU_REPLACE, GPU_REPLACE, 0);
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(font->texture.data), font->texture.width, font->texture.height,
GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST) |
GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
GPU_L8);
#if 0
printf("%s\n", msg);
DEBUG_VAR(color);
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0,
GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_R, 0, 0), GPU_REPLACE, GPU_REPLACE, 0);
#endif
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(font->texture.data),
font->texture.width, font->texture.height,
GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST) |
GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
GPU_L8);
GPU_SetViewport(NULL,
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
ctr->video_mode == CTR_VIDEO_MODE_800x240 ? CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH);
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
ctr->video_mode == CTR_VIDEO_MODE_800x240
? CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH);
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, v - ctr->vertex_cache.current);
@ -265,36 +273,40 @@ static void ctr_font_render_line(
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, v - ctr->vertex_cache.current);
}
// v = font->vertices;
// v->x0 = 0;
// v->y0 = 0;
// v->u0 = 0;
// v->v0 = 0;
// v->x1 = font->texture.width;
// v->y1 = font->texture.height;
// v->u1 = font->texture.width;
// v->v1 = font->texture.height;
// GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
#if 0
v = font->vertices;
v->x0 = 0;
v->y0 = 0;
v->u0 = 0;
v->v0 = 0;
v->x1 = font->texture.width;
v->y1 = font->texture.height;
v->u1 = font->texture.width;
v->v1 = font->texture.height;
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
#endif
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
// DEBUG_VAR(v - font->vertices);
// v = font->vertices;
// printf("OSDMSG: %s\n", msg);
// printf("vertex : (%i,%i,%i,%i) - (%i,%i,%i,%i)\n",
// v->x0, v->y0, v->x1, v->y1,
// v->u0, v->v0, v->u1, v->v1);
// printf("%s\n", msg);
#if 0
DEBUG_VAR(v - font->vertices);
v = font->vertices;
printf("OSDMSG: %s\n", msg);
printf("vertex : (%i,%i,%i,%i) - (%i,%i,%i,%i)\n",
v->x0, v->y0, v->x1, v->y1,
v->u0, v->v0, v->u1, v->v1);
printf("%s\n", msg);
#endif
ctr->vertex_cache.current = v;
}
static void ctr_font_render_message(
ctr_font_t* font, const char* msg, float scale,
const unsigned int color, float pos_x, float pos_y,
unsigned text_align)
video_frame_info_t *video_info,
ctr_font_t* font, const char* msg, float scale,
const unsigned int color, float pos_x, float pos_y,
unsigned text_align)
{
int lines = 0;
float line_height;
@ -305,7 +317,7 @@ static void ctr_font_render_message(
/* If the font height is not supported just draw as usual */
if (!font->font_driver->get_line_height)
{
ctr_font_render_line(font, msg, strlen(msg),
ctr_font_render_line(video_info, font, msg, strlen(msg),
scale, color, pos_x, pos_y, text_align);
return;
}
@ -320,7 +332,7 @@ static void ctr_font_render_message(
if (delim)
{
unsigned msg_len = delim - msg;
ctr_font_render_line(font, msg, msg_len,
ctr_font_render_line(video_info, font, msg, msg_len,
scale, color, pos_x, pos_y - (float)lines * line_height,
text_align);
msg += msg_len + 1;
@ -329,7 +341,7 @@ static void ctr_font_render_message(
else
{
unsigned msg_len = strlen(msg);
ctr_font_render_line(font, msg, msg_len,
ctr_font_render_line(video_info, font, msg, msg_len,
scale, color, pos_x, pos_y - (float)lines * line_height,
text_align);
break;
@ -337,23 +349,24 @@ static void ctr_font_render_message(
}
}
static void ctr_font_render_msg(void* data, const char* msg,
const void* userdata)
static void ctr_font_render_msg(
video_frame_info_t *video_info,
void* data, const char* msg,
const void* userdata)
{
float x, y, scale, drop_mod, drop_alpha;
unsigned width, height;
int drop_x, drop_y;
unsigned max_glyphs;
enum text_alignment text_align;
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
ctr_font_t * font = (ctr_font_t*)data;
const struct font_params* params = (const struct font_params*)userdata;
unsigned width = video_info->width;
unsigned height = video_info->height;
if (!font || !msg || !*msg)
return;
video_driver_get_size(&width, &height);
if (params)
{
x = params->x;
@ -372,16 +385,14 @@ static void ctr_font_render_msg(void* data, const char* msg,
}
else
{
settings_t* settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
scale = 1.0f;
text_align = TEXT_ALIGN_LEFT;
r = (settings->video.msg_color_r * 255);
g = (settings->video.msg_color_g * 255);
b = (settings->video.msg_color_b * 255);
r = (video_info->font_msg_color_r * 255);
g = (video_info->font_msg_color_g * 255);
b = (video_info->font_msg_color_b * 255);
alpha = 255;
color = COLOR_ABGR(r, g, b, alpha);
@ -404,12 +415,12 @@ static void ctr_font_render_msg(void* data, const char* msg,
alpha_dark = alpha * drop_alpha;
color_dark = COLOR_ABGR(r_dark, g_dark, b_dark, alpha_dark);
ctr_font_render_message(font, msg, scale, color_dark,
ctr_font_render_message(video_info, font, msg, scale, color_dark,
x + scale * drop_x / width, y +
scale * drop_y / height, text_align);
}
ctr_font_render_message(font, msg, scale,
ctr_font_render_message(video_info, font, msg, scale,
color, x, y, text_align);
}
@ -427,7 +438,7 @@ static const struct font_glyph* ctr_font_get_glyph(
return font->font_driver->get_glyph((void*)font->font_driver, code);
}
static void ctr_font_flush_block(void* data)
static void ctr_font_flush_block(unsigned width, unsigned height, void* data)
{
(void)data;
}

View File

@ -93,7 +93,7 @@ static void d3dfonts_w32_free_font(void *data)
d3dfonts = NULL;
}
static void d3dfonts_w32_render_msg(void *data, const char *msg,
static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data, const char *msg,
const void *userdata)
{
const struct font_params *params = (const struct font_params*)userdata;

View File

@ -79,23 +79,23 @@ static const struct font_glyph *gdi_font_get_glyph(
return NULL;
}
static void gdi_render_msg(void *data, const char *msg,
static void gdi_render_msg(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
gdi_raster_t *font = (gdi_raster_t*)data;
float x, y;
unsigned width = 0, height = 0;
unsigned newX, newY, len;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
HDC hdc;
HWND hwnd = win32_get_window();
float x, y;
gdi_raster_t *font = (gdi_raster_t*)data;
unsigned newX, newY, len;
const struct font_params *params = (const struct font_params*)userdata;
HWND hwnd = win32_get_window();
unsigned width = video_info->width;
unsigned height = video_info->height;
if (!font || string_is_empty(msg))
return;
video_driver_get_size(&width, &height);
if (params)
{
x = params->x;
@ -103,25 +103,25 @@ static void gdi_render_msg(void *data, const char *msg,
}
else
{
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
}
if (!font->gdi)
return;
len = utf8len(msg);
len = utf8len(msg);
newX = x * width;
newY = height - (y * height);
hdc = GetDC(hwnd);
hdc = GetDC(hwnd);
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, RGB(255,255,255));
TextOut(hdc, newX, newY, msg, len);
ReleaseDC(hwnd, hdc);
}
static void gdi_font_flush_block(void* data)
static void gdi_font_flush_block(unsigned width, unsigned height, void* data)
{
(void)data;
}

View File

@ -25,8 +25,6 @@
#include "../video_shader_driver.h"
#include "../video_context_driver.h"
#include "../../configuration.h"
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
#define gl_raster_font_emit(c, vx, vy) do { \
@ -390,13 +388,11 @@ static void gl_raster_font_render_message(
}
}
static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
static void gl_raster_font_setup_viewport(unsigned width, unsigned height,
gl_raster_t *font, bool full_screen)
{
unsigned width, height;
video_shader_ctx_info_t shader_info;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, full_screen, false);
glEnable(GL_BLEND);
@ -412,19 +408,18 @@ static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
video_shader_driver_use(shader_info);
}
static void gl_raster_font_restore_viewport(gl_t *gl, bool full_screen)
static void gl_raster_font_restore_viewport(unsigned width, unsigned height,
gl_t *gl, bool full_screen)
{
unsigned width, height;
video_driver_get_size(&width, &height);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glDisable(GL_BLEND);
video_driver_set_viewport(width, height, full_screen, true);
}
static void gl_raster_font_render_msg(void *data, const char *msg,
static void gl_raster_font_render_msg(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
GLfloat x, y, scale, drop_mod, drop_alpha;
@ -434,6 +429,8 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
bool full_screen = false ;
gl_t *gl = NULL;
gl_raster_t *font = (gl_raster_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
const struct font_params *params = (const struct font_params*)userdata;
if (!font || string_is_empty(msg))
@ -467,16 +464,15 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
scale = 1.0f;
full_screen = true;
text_align = TEXT_ALIGN_LEFT;
color[0] = settings->video.msg_color_r;
color[1] = settings->video.msg_color_g;
color[2] = settings->video.msg_color_b;
color[0] = video_info->font_msg_color_r;
color[1] = video_info->font_msg_color_g;
color[2] = video_info->font_msg_color_b;
color[3] = 1.0f;
drop_x = -2;
@ -488,7 +484,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
if (font && font->block)
font->block->fullscreen = full_screen;
else
gl_raster_font_setup_viewport(font, full_screen);
gl_raster_font_setup_viewport(width, height, font, full_screen);
if (drop_x || drop_y)
{
@ -507,7 +503,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
gl_raster_font_render_message(font, msg, scale, color, x, y, text_align);
if (!font->block)
gl_raster_font_restore_viewport(gl, false);
gl_raster_font_restore_viewport(width, height, gl, false);
}
static const struct font_glyph *gl_raster_font_get_glyph(
@ -522,7 +518,8 @@ static const struct font_glyph *gl_raster_font_get_glyph(
return font->font_driver->get_glyph((void*)font->font_driver, code);
}
static void gl_raster_font_flush_block(void *data)
static void gl_raster_font_flush_block(unsigned width, unsigned height,
void *data)
{
gl_raster_t *font = (gl_raster_t*)data;
video_font_raster_block_t *block = font ? font->block : NULL;
@ -530,9 +527,9 @@ static void gl_raster_font_flush_block(void *data)
if (!font || !block || !block->carr.coords.vertices)
return;
gl_raster_font_setup_viewport(font, block->fullscreen);
gl_raster_font_setup_viewport(width, height, font, block->fullscreen);
gl_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords);
gl_raster_font_restore_viewport(font->gl, block->fullscreen);
gl_raster_font_restore_viewport(width, height, font->gl, block->fullscreen);
}
static void gl_raster_font_bind_block(void *data, void *userdata)

View File

@ -63,7 +63,9 @@ static void libdbg_font_free_font(void *data)
DbgFontExit();
}
static void libdbg_font_render_msg(void *data, const char *msg,
static void libdbg_font_render_msg(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
float x, y, scale;
@ -81,8 +83,7 @@ static void libdbg_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
x = video_info->font_msg_pos_x;
y = 0.90f;
scale = 1.04f;
color = SILVER;

View File

@ -22,7 +22,6 @@
#include "../font_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
typedef struct
@ -140,20 +139,18 @@ static int vita2d_font_get_message_width(void *data, const char *msg,
}
static void vita2d_font_render_line(
video_frame_info_t *video_info,
vita_font_t *font, const char *msg, unsigned msg_len,
float scale, const unsigned int color, float pos_x,
float pos_y, unsigned text_align)
{
int x, y, delta_x, delta_y;
unsigned width, height;
unsigned i;
video_driver_get_size(&width, &height);
x = roundf(pos_x * width);
y = roundf((1.0f - pos_y) * height);
delta_x = 0;
delta_y = 0;
unsigned width = video_info->width;
unsigned height = video_info->height;
int x = roundf(pos_x * width);
int y = roundf((1.0f - pos_y) * height);
int delta_x = 0;
int delta_y = 0;
switch (text_align)
{
@ -222,6 +219,7 @@ static void vita2d_font_render_line(
}
static void vita2d_font_render_message(
video_frame_info_t *video_info,
vita_font_t *font, const char *msg, float scale,
const unsigned int color, float pos_x, float pos_y,
unsigned text_align)
@ -235,7 +233,7 @@ static void vita2d_font_render_message(
/* If the font height is not supported just draw as usual */
if (!font->font_driver->get_line_height)
{
vita2d_font_render_line(font, msg, strlen(msg),
vita2d_font_render_line(video_info, font, msg, strlen(msg),
scale, color, pos_x, pos_y, text_align);
return;
}
@ -248,7 +246,7 @@ static void vita2d_font_render_message(
const char *delim = strchr(msg, '\n');
unsigned msg_len = (delim) ? (delim - msg) : strlen(msg);
vita2d_font_render_line(font, msg, msg_len,
vita2d_font_render_line(video_info, font, msg, msg_len,
scale, color, pos_x, pos_y - (float)lines * line_height,
text_align);
@ -261,23 +259,24 @@ static void vita2d_font_render_message(
}
}
static void vita2d_font_render_msg(void *data, const char *msg,
static void vita2d_font_render_msg(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
float x, y, scale, drop_mod, drop_alpha;
unsigned width, height;
int drop_x, drop_y;
unsigned max_glyphs;
enum text_alignment text_align;
unsigned color, color_dark, r, g, b, alpha, r_dark, g_dark, b_dark, alpha_dark;
vita_font_t *font = (vita_font_t *)data;
const struct font_params *params = (const struct font_params*)userdata;
unsigned width = video_info->width;
unsigned height = video_info->height;
if (!font || !msg || !*msg)
return;
video_driver_get_size(&width, &height);
if (params)
{
x = params->x;
@ -296,16 +295,14 @@ static void vita2d_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
scale = 1.0f;
text_align = TEXT_ALIGN_LEFT;
r = (settings->video.msg_color_r * 255);
g = (settings->video.msg_color_g * 255);
b = (settings->video.msg_color_b * 255);
r = (video_info->font_msg_color_r * 255);
g = (video_info->font_msg_color_g * 255);
b = (video_info->font_msg_color_b * 255);
alpha = 255;
color = RGBA8(r,g,b,alpha);
@ -328,12 +325,12 @@ static void vita2d_font_render_msg(void *data, const char *msg,
alpha_dark = alpha * drop_alpha;
color_dark = RGBA8(r_dark,g_dark,b_dark,alpha_dark);
vita2d_font_render_message(font, msg, scale, color_dark,
vita2d_font_render_message(video_info, font, msg, scale, color_dark,
x + scale * drop_x / width, y +
scale * drop_y / height, text_align);
}
vita2d_font_render_message(font, msg, scale,
vita2d_font_render_message(video_info, font, msg, scale,
color, x, y, text_align);
}
@ -347,7 +344,8 @@ static const struct font_glyph *vita2d_font_get_glyph(
return font->font_driver->get_glyph((void*)font->font_driver, code);
}
static void vita2d_font_flush_block(void *data)
static void vita2d_font_flush_block(unsigned width, unsigned height,
void *data)
{
(void)data;
}

View File

@ -21,8 +21,6 @@
#include "../font_driver.h"
#include "../../configuration.h"
typedef struct
{
vk_t *vk;
@ -236,10 +234,9 @@ static void vulkan_raster_font_render_message(
}
static void vulkan_raster_font_setup_viewport(
unsigned width, unsigned height,
vulkan_raster_t *font, bool full_screen)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, full_screen, false);
}
@ -258,7 +255,9 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
vulkan_draw_triangles(font->vk, &call);
}
static void vulkan_raster_font_render_msg(void *data, const char *msg,
static void vulkan_raster_font_render_msg(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
float color[4], color_dark[4];
@ -269,6 +268,8 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
float x, y, scale, drop_mod, drop_alpha;
vk_t *vk = NULL;
vulkan_raster_t *font = (vulkan_raster_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
const struct font_params *params = (const struct font_params*)userdata;
if (!font || !msg || !*msg)
@ -299,17 +300,15 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
scale = 1.0f;
full_screen = true;
text_align = TEXT_ALIGN_LEFT;
color[0] = settings->video.msg_color_r;
color[1] = settings->video.msg_color_g;
color[2] = settings->video.msg_color_b;
color[0] = video_info->font_msg_color_r;
color[1] = video_info->font_msg_color_g;
color[2] = video_info->font_msg_color_b;
color[3] = 1.0f;
drop_x = -2;
@ -318,7 +317,7 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
drop_alpha = 1.0f;
}
vulkan_raster_font_setup_viewport(font, full_screen);
vulkan_raster_font_setup_viewport(width, height, font, full_screen);
max_glyphs = strlen(msg);
if (drop_x || drop_y)
@ -360,7 +359,8 @@ static const struct font_glyph *vulkan_raster_font_get_glyph(
return font->font_driver->get_glyph((void*)font->font_driver, code);
}
static void vulkan_raster_font_flush_block(void *data)
static void vulkan_raster_font_flush_block(unsigned width, unsigned height,
void *data)
{
(void)data;
}

View File

@ -63,7 +63,9 @@ static void xfonts_free_font(void *data)
font = NULL;
}
static void xfonts_render_msg(void *data, const char *msg,
static void xfonts_render_msg(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *userdata)
{
wchar_t str[PATH_MAX_LENGTH];
@ -78,10 +80,8 @@ static void xfonts_render_msg(void *data, const char *msg,
}
else
{
settings_t *settings = config_get_ptr();
x = settings->video.msg_pos_x;
y = settings->video.msg_pos_y;
x = video_info->font_msg_pos_x;
y = video_info->font_msg_pos_y;
}
xfonts->d3d->dev->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &xfonts->surf);

View File

@ -18,7 +18,7 @@
#include <string/stdstring.h>
#include "../d3d/d3d.h"
#include "../drivers/d3d.h"
#include "../font_driver.h"
#include "../drivers/d3d_shaders/font.hlsl.d3d9.h"
@ -803,7 +803,9 @@ static void xdk360_draw_text(xdk360_video_font_t *font,
d3dr->EndVertices();
}
static void xdk360_render_msg(void *data, const char *str_msg,
static void xdk360_render_msg(
video_frame_info_t *video_info,
void *data, const char *str_msg,
const void *userdata)
{
float x, y;

View File

@ -23,7 +23,7 @@
#include "shader_hlsl.h"
#include "../video_shader_parse.h"
#include "../d3d/d3d.h"
#include "../drivers/d3d.h"
#include "../../managers/state_manager.h"
#include "../drivers/d3d_shaders/opaque.hlsl.d3d9.h"
@ -63,8 +63,8 @@ struct hlsl_shader_data
void hlsl_set_proj_matrix(void *data, XMMATRIX rotation_value)
{
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data;
if (hlsl_data)
hlsl_data->prg[hlsl_data->active_idx].mvp_val = rotation_value;
if (hlsl)
hlsl->prg[hlsl->active_idx].mvp_val = rotation_value;
}
static void hlsl_set_uniform_parameter(
@ -126,12 +126,12 @@ static void hlsl_set_params(void *data, void *shader_data,
const void *_feedback_info,
const void *_fbo_info, unsigned fbo_info_cnt)
{
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
const struct video_tex_info *info = (const struct video_tex_info*)_info;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
const struct video_tex_info *info = (const struct video_tex_info*)_info;
const struct video_tex_info *prev_info = (const struct video_tex_info*)_prev_info;
const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info;
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)shader_data;
const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info;
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)shader_data;
if (!hlsl)
return;
@ -165,15 +165,15 @@ static bool hlsl_compile_program(
void *program_data,
struct shader_program_info *program_info)
{
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data;
d3d_video_t *d3d = (d3d_video_t*)hlsl->d3d;
struct shader_program_hlsl_data *program = (struct shader_program_hlsl_data*)program_data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
HRESULT ret, ret_fp, ret_vp;
ID3DXBuffer *listing_f = NULL;
ID3DXBuffer *listing_v = NULL;
ID3DXBuffer *code_f = NULL;
ID3DXBuffer *code_v = NULL;
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data;
d3d_video_t *d3d = (d3d_video_t*)hlsl->d3d;
struct shader_program_hlsl_data *program = (struct shader_program_hlsl_data*)program_data;
LPDIRECT3DDEVICE d3d_device_ptr = (LPDIRECT3DDEVICE)d3d->dev;
ID3DXBuffer *listing_f = NULL;
ID3DXBuffer *listing_v = NULL;
ID3DXBuffer *code_f = NULL;
ID3DXBuffer *code_v = NULL;
if (!program)
program = &hlsl->prg[idx];
@ -274,7 +274,7 @@ static bool hlsl_load_shader(hlsl_shader_data_t *hlsl,
hlsl->d3d = (d3d_video_t*)data;
if (!hlsl_compile_program(hlsl, data, i + 1, &hlsl->prg[i + 1], &program_info))
if (!hlsl_compile_program(hlsl, i + 1, &hlsl->prg[i + 1], &program_info))
return false;
return true;
@ -304,7 +304,7 @@ static bool hlsl_load_plain(hlsl_shader_data_t *hlsl, void *data, const char *pa
path, sizeof(hlsl->cg_shader->pass[0].source.path));
hlsl->d3d = (d3d_video_t*)data;
if (!hlsl_compile_program(hlsl, data, 1, &hlsl->prg[1], &progarm_info))
if (!hlsl_compile_program(hlsl, 1, &hlsl->prg[1], &program_info))
return false;
}
else
@ -454,9 +454,7 @@ static void hlsl_use(void *data, void *shader_data, unsigned idx, bool set_activ
if (hlsl_data && hlsl_data->prg[idx].vprg && hlsl_data->prg[idx].fprg)
{
if (set_active)
{
hlsl_data->active_idx = idx;
}
d3d_set_vertex_shader(d3dr, idx, hlsl_data->prg[idx].vprg);
#ifdef _XBOX
@ -534,6 +532,7 @@ const shader_backend_t hlsl_backend = {
hlsl_deinit,
hlsl_set_params,
hlsl_set_uniform_parameter,
NULL, /* compile_program */
hlsl_use,
hlsl_num,
hlsl_filter_type,

View File

@ -346,12 +346,14 @@ static bool font_init_first(
return false;
}
void font_driver_render_msg(void *font_data,
const char *msg, const struct font_params *params)
void font_driver_render_msg(
video_frame_info_t *video_info,
void *font_data,
const char *msg, const void *params)
{
font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver);
if (font && font->renderer && font->renderer->render_msg)
font->renderer->render_msg(font->renderer_data, msg, params);
font->renderer->render_msg(video_info, font->renderer_data, msg, params);
}
void font_driver_bind_block(void *font_data, void *block)
@ -362,11 +364,11 @@ void font_driver_bind_block(void *font_data, void *block)
font->renderer->bind_block(font->renderer_data, block);
}
void font_driver_flush(void *font_data)
void font_driver_flush(unsigned width, unsigned height, void *font_data)
{
font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver);
if (font && font->renderer && font->renderer->flush)
font->renderer->flush(font->renderer_data);
font->renderer->flush(width, height, font->renderer_data);
}
int font_driver_get_message_width(void *font_data,

View File

@ -22,6 +22,8 @@
#include <boolean.h>
#include <retro_common_api.h>
#include "video_driver.h"
RETRO_BEGIN_DECLS
enum font_driver_render_api
@ -100,13 +102,15 @@ typedef struct font_renderer
{
void *(*init)(void *data, const char *font_path, float font_size);
void (*free)(void *data);
void (*render_msg)(void *data, const char *msg,
void (*render_msg)(
video_frame_info_t *video_info,
void *data, const char *msg,
const void *params);
const char *ident;
const struct font_glyph *(*get_glyph)(void *data, uint32_t code);
void (*bind_block)(void *data, void *block);
void (*flush)(void *data);
void (*flush)(unsigned width, unsigned height, void *data);
int (*get_message_width)(void *data, const char *msg, unsigned msg_len_full, float scale);
} font_renderer_t;
@ -140,13 +144,14 @@ typedef struct
int font_renderer_create_default(const void **driver,
void **handle, const char *font_path, unsigned font_size);
void font_driver_render_msg(void *font_data, const char *msg, const struct font_params *params);
void font_driver_render_msg(video_frame_info_t *video_info,
void *font_data, const char *msg, const void *params);
void font_driver_bind_block(void *font_data, void *block);
int font_driver_get_message_width(void *font_data, const char *msg, unsigned len, float scale);
void font_driver_flush(void *font_data);
void font_driver_flush(unsigned width, unsigned height, void *font_data);
void font_driver_free(void *font_data);

View File

@ -282,7 +282,7 @@ bool video_context_driver_check_window(gfx_ctx_size_t *size_data)
size_data->quit,
size_data->resize,
size_data->width,
size_data->height, (unsigned int)video_driver_get_frame_count());
size_data->height);
return true;
}
@ -456,22 +456,12 @@ bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info)
video_driver_build_info(&video_info);
if (!current_video_context->set_video_mode(
video_context_data, video_info, mode_info->width,
video_context_data, &video_info, mode_info->width,
mode_info->height, mode_info->fullscreen))
return false;
return true;
}
bool video_context_driver_set_resize(gfx_ctx_mode_t *mode_info)
{
if (!current_video_context)
return false;
if (!current_video_context->set_resize(
video_context_data, mode_info->width, mode_info->height))
return false;
return true;
}
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info)
{
if (!current_video_context || !current_video_context->get_video_size)

View File

@ -78,7 +78,7 @@ typedef struct gfx_ctx_driver
void (*swap_interval)(void *data, unsigned);
/* Sets video mode. Creates a window, etc. */
bool (*set_video_mode)(void*, video_frame_info_t video_info, unsigned, unsigned, bool);
bool (*set_video_mode)(void*, video_frame_info_t *video_info, unsigned, unsigned, bool);
/* Gets current window size.
* If not initialized yet, it returns current screen size. */
@ -101,12 +101,12 @@ typedef struct gfx_ctx_driver
float (*translate_aspect)(void*, unsigned, unsigned);
/* Asks driver to update window title (FPS, etc). */
void (*update_window_title)(void*, video_frame_info_t video_info);
void (*update_window_title)(void*, video_frame_info_t *video_info);
/* Queries for resize and quit events.
* Also processes events. */
void (*check_window)(void*, bool*, bool*,
unsigned*, unsigned*, unsigned);
unsigned*, unsigned*);
/* Acknowledge a resize event. This is needed for some APIs.
* Most backends will ignore this. */
@ -123,7 +123,7 @@ typedef struct gfx_ctx_driver
/* Swaps buffers. VBlank sync depends on
* earlier calls to swap_interval. */
void (*swap_buffers)(void*, video_frame_info_t video_info);
void (*swap_buffers)(void*, video_frame_info_t *video_info);
/* Most video backends will want to use a certain input driver.
* Checks for it here. */
@ -302,6 +302,10 @@ void video_context_driver_destroy(void);
#define video_context_driver_focus() ((video_context_data && current_video_context->has_focus && current_video_context->has_focus(video_context_data)) ? true : false)
#define video_context_driver_set_resize(mode_info) \
if (current_video_context && current_video_context->set_resize) \
current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height)
bool video_context_driver_get_video_output_size(gfx_ctx_size_t *size_data);
bool video_context_driver_swap_interval(unsigned *interval);
@ -314,8 +318,6 @@ bool video_context_driver_get_ident(gfx_ctx_ident_t *ident);
bool video_context_driver_set_video_mode(gfx_ctx_mode_t *mode_info);
bool video_context_driver_set_resize(gfx_ctx_mode_t *mode_info);
bool video_context_driver_get_video_size(gfx_ctx_mode_t *mode_info);
bool video_context_driver_get_context_data(void *data);
@ -334,7 +336,7 @@ bool video_context_driver_translate_aspect(gfx_ctx_aspect_t *aspect);
bool video_context_driver_input_driver(gfx_ctx_input_t *inp);
#define video_context_driver_has_windowed() ((video_context_data && current_video_context->has_windowed(video_context_data)) ? true : false)
#define video_context_driver_has_windowed() ((video_context_data && current_video_context->has_windowed && current_video_context->has_windowed(video_context_data)) ? true : false)
void video_context_driver_free(void);

View File

@ -137,6 +137,8 @@ static unsigned video_driver_height = 0;
static enum rarch_display_type video_driver_display_type = RARCH_DISPLAY_NONE;
static char video_driver_title_buf[64] = {0};
static char video_driver_window_title[128] = {0};
static bool video_driver_window_title_update = true;
static retro_time_t video_driver_frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_COUNT];
static uint64_t video_driver_frame_time_count = 0;
@ -898,11 +900,10 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
return true;
}
void video_driver_set_osd_msg(const char *msg,
const struct font_params *params, void *font)
void video_driver_set_osd_msg(const char *msg, const void *data, void *font)
{
if (video_driver_poke && video_driver_poke->set_osd_msg)
video_driver_poke->set_osd_msg(video_driver_data, msg, params, font);
video_driver_poke->set_osd_msg(video_driver_data, msg, data, font);
}
void video_driver_set_texture_enable(bool enable, bool fullscreen)
@ -971,18 +972,22 @@ void video_driver_cached_frame_get(const void **data, unsigned *width,
void video_driver_get_size(unsigned *width, unsigned *height)
{
video_driver_threaded_lock();
if (width)
*width = video_driver_width;
if (height)
*height = video_driver_height;
video_driver_threaded_unlock();
}
void video_driver_set_size(unsigned *width, unsigned *height)
{
video_driver_threaded_lock();
if (width)
video_driver_width = *width;
if (height)
video_driver_height = *height;
video_driver_threaded_unlock();
}
/**
@ -1057,89 +1062,6 @@ bool video_monitor_fps_statistics(double *refresh_rate,
}
/**
* video_monitor_get_fps:
* @buf : string suitable for Window title
* @size : size of buffer.
* @buf_fps : string of raw FPS only (optional).
* @size_fps : size of raw FPS buffer.
*
* Get the amount of frames per seconds.
*
* Returns: true if framerate per seconds could be obtained,
* otherwise false.
*
**/
bool video_monitor_get_fps(
video_frame_info_t video_info,
char *buf, size_t size,
char *buf_fps, size_t size_fps)
{
static retro_time_t curr_time;
static retro_time_t fps_time;
retro_time_t new_time = cpu_features_get_time_usec();
uint64_t frame_count = 0;
video_driver_threaded_lock();
frame_count = video_driver_frame_count;
video_driver_threaded_unlock();
*buf = '\0';
if (frame_count)
{
static float last_fps;
bool ret = false;
unsigned write_index = video_driver_frame_time_count++ &
(MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
video_driver_frame_time_samples[write_index] = new_time - fps_time;
fps_time = new_time;
if ((frame_count % FPS_UPDATE_INTERVAL) == 0)
{
char frames_text[64];
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
curr_time = new_time;
fill_pathname_noext(buf,
video_driver_title_buf,
" || ",
size);
if (video_info.fps_show)
{
char fps_text[64];
snprintf(fps_text, sizeof(fps_text), " FPS: %6.1f || ", last_fps);
strlcat(buf, fps_text, size);
}
strlcat(buf, "Frames: ", size);
snprintf(frames_text, sizeof(frames_text), STRING_REP_UINT64,
(unsigned long long)frame_count);
strlcat(buf, frames_text, size);
ret = true;
}
if (buf_fps && video_info.fps_show)
snprintf(buf_fps, size_fps, "FPS: %6.1f || %s: " STRING_REP_UINT64,
last_fps,
msg_hash_to_str(MSG_FRAMES),
(unsigned long long)frame_count);
return ret;
}
curr_time = fps_time = new_time;
strlcpy(buf, video_driver_title_buf, size);
if (buf_fps)
strlcpy(buf_fps, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), size_fps);
return true;
}
float video_driver_get_aspect_ratio(void)
{
@ -1153,7 +1075,7 @@ void video_driver_set_aspect_ratio_value(float value)
static bool video_driver_frame_filter(
const void *data,
video_frame_info_t video_info,
video_frame_info_t *video_info,
unsigned width, unsigned height,
size_t pitch,
unsigned *output_width, unsigned *output_height,
@ -1174,7 +1096,7 @@ static bool video_driver_frame_filter(
data, width, height, pitch);
performance_counter_stop(&softfilter_process);
if (video_info.post_filter_record && recording_data)
if (video_info->post_filter_record && recording_data)
recording_dump_frame(video_driver_state_buffer,
*output_width, *output_height, *output_pitch);
@ -2086,6 +2008,96 @@ unsigned video_pixel_get_alignment(unsigned pitch)
return 8;
}
/**
* video_monitor_get_fps:
*
* Get the amount of frames per seconds.
*
* Returns: true if framerate per seconds could be obtained,
* otherwise false.
*
**/
static bool video_monitor_get_fps(video_frame_info_t *video_info)
{
static retro_time_t curr_time;
static retro_time_t fps_time;
retro_time_t new_time = cpu_features_get_time_usec();
if (video_info->frame_count)
{
static float last_fps;
bool ret = false;
unsigned write_index = video_driver_frame_time_count++ &
(MEASURE_FRAME_TIME_SAMPLES_COUNT - 1);
video_driver_frame_time_samples[write_index] = new_time - fps_time;
fps_time = new_time;
if ((video_info->frame_count % FPS_UPDATE_INTERVAL) == 0)
{
char frames_text[64];
fill_pathname_noext(video_driver_window_title,
video_driver_title_buf,
" || ",
sizeof(video_driver_window_title));
if (video_info->fps_show)
{
last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL);
snprintf(video_info->fps_text,
sizeof(video_info->fps_text),
" FPS: %6.1f || ", last_fps);
strlcat(video_driver_window_title,
video_info->fps_text,
sizeof(video_driver_window_title));
}
curr_time = new_time;
strlcat(video_driver_window_title,
"Frames: ",
sizeof(video_driver_window_title));
snprintf(frames_text,
sizeof(frames_text),
STRING_REP_UINT64,
(unsigned long long)video_info->frame_count);
strlcat(video_driver_window_title,
frames_text,
sizeof(video_driver_window_title));
ret = true;
video_driver_window_title_update = true;
}
if (video_info->fps_show)
snprintf(
video_info->fps_text,
sizeof(video_info->fps_text),
"FPS: %6.1f || %s: " STRING_REP_UINT64,
last_fps,
msg_hash_to_str(MSG_FRAMES),
(unsigned long long)video_info->frame_count);
return ret;
}
curr_time = fps_time = new_time;
strlcpy(video_driver_window_title,
video_driver_title_buf,
sizeof(video_driver_window_title));
strlcpy(video_info->fps_text,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
sizeof(video_info->fps_text));
video_driver_window_title_update = true;
return true;
}
/**
* video_driver_frame:
* @data : pointer to data of the video frame.
@ -2104,7 +2116,6 @@ void video_driver_frame(const void *data, unsigned width,
unsigned output_width = 0;
unsigned output_height = 0;
unsigned output_pitch = 0;
uint64_t frame_count = 0;
const char *msg = NULL;
if (!video_driver_active)
@ -2127,10 +2138,21 @@ void video_driver_frame(const void *data, unsigned width,
performance_counter_stop(&video_frame_conv);
video_driver_cached_frame_set(data, width, height, pitch);
if (data)
frame_cache_data = data;
frame_cache_width = width;
frame_cache_height = height;
frame_cache_pitch = pitch;
video_driver_build_info(&video_info);
video_driver_threaded_lock();
video_info.frame_count = video_driver_frame_count;
video_driver_frame_count++;
video_driver_threaded_unlock();
video_monitor_get_fps(&video_info);
/* Slightly messy code,
* but we really need to do processing before blocking on VSync
* for best possible scheduling.
@ -2146,7 +2168,7 @@ void video_driver_frame(const void *data, unsigned width,
recording_dump_frame(data, width, height, pitch);
if (data && video_driver_state_filter &&
video_driver_frame_filter(data, video_info, width, height, pitch,
video_driver_frame_filter(data, &video_info, width, height, pitch,
&output_width, &output_height, &output_pitch))
{
data = video_driver_state_buffer;
@ -2161,16 +2183,14 @@ void video_driver_frame(const void *data, unsigned width,
&& video_info.font_enable && msg)
strlcpy(video_driver_msg, msg, sizeof(video_driver_msg));
video_driver_threaded_lock();
frame_count = video_driver_frame_count;
video_driver_frame_count++;
video_driver_threaded_unlock();
if (!current_video || !current_video->frame(
video_driver_data, data, width, height,
frame_count,
pitch, video_driver_msg, video_info))
video_info.frame_count,
pitch, video_driver_msg, &video_info))
video_driver_active = false;
if (video_info.fps_show)
runloop_msg_queue_push(video_info.fps_text, 1, 1, false);
}
void video_driver_display_type_set(enum rarch_display_type type)
@ -2229,7 +2249,9 @@ bool video_driver_texture_unload(uintptr_t *id)
void video_driver_build_info(video_frame_info_t *video_info)
{
settings_t *settings = config_get_ptr();
settings_t *settings = NULL;
video_driver_threaded_lock();
settings = config_get_ptr();
video_info->refresh_rate = settings->video.refresh_rate;
video_info->black_frame_insertion =
settings->video.black_frame_insertion;
@ -2245,6 +2267,51 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->monitor_index = settings->video.monitor_index;
video_info->shared_context = settings->video.shared_context;
video_info->font_enable = settings->video.font_enable;
video_info->font_msg_pos_x = settings->video.msg_pos_x;
video_info->font_msg_pos_y = settings->video.msg_pos_y;
video_info->font_msg_color_r = settings->video.msg_color_r;
video_info->font_msg_color_g = settings->video.msg_color_g;
video_info->font_msg_color_b = settings->video.msg_color_b;
video_info->frame_count = 0;
video_info->fps_text[0] = '\0';
video_info->width = video_driver_width;
video_info->height = video_driver_height;
video_info->use_rgba = video_driver_supports_rgba();
video_info->libretro_running = false;
#ifdef HAVE_MENU
video_info->menu_footer_opacity = settings->menu.footer.opacity;
video_info->menu_header_opacity = settings->menu.header.opacity;
video_info->materialui_color_theme = settings->menu.materialui.menu_color_theme;
video_info->menu_shader_pipeline = settings->menu.xmb.shader_pipeline;
video_info->xmb_theme = settings->menu.xmb.theme;
video_info->xmb_color_theme = settings->menu.xmb.menu_color_theme;
video_info->timedate_enable = settings->menu.timedate_enable;
video_info->battery_level_enable = settings->menu.battery_level_enable;
video_info->xmb_shadows_enable = settings->menu.xmb.shadows_enable;
video_info->xmb_alpha_factor = settings->menu.xmb.alpha_factor;
video_info->menu_wallpaper_opacity = settings->menu.wallpaper.opacity;
if (!settings->menu.pause_libretro)
video_info->libretro_running = (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL));
#else
video_info->menu_footer_opacity = 0.0f;
video_info->menu_header_opacity = 0.0f;
video_info->materialui_color_theme = 0;
video_info->menu_shader_pipeline = 0;
video_info->xmb_color_theme = 0;
video_info->xmb_theme = 0;
video_info->timedate_enable = false;
video_info->battery_level_enable = false;
video_info->xmb_shadows_enable = false;
video_info->xmb_alpha_factor = 0.0f;
video_info->menu_wallpaper_opacity = 0.0f;
#endif
video_driver_threaded_unlock();
}
/**
@ -2300,3 +2367,12 @@ bool video_driver_translate_coord_viewport(
return true;
}
void video_driver_get_window_title(char *buf, unsigned len)
{
if (buf && video_driver_window_title_update)
{
strlcpy(buf, video_driver_window_title, len);
video_driver_window_title_update = false;
}
}

View File

@ -32,7 +32,6 @@
#include "../input/input_overlay.h"
#endif
#include "font_driver.h"
#include "video_defines.h"
#include "video_filter.h"
#include "video_shader_parse.h"
@ -87,6 +86,7 @@ typedef struct video_info
typedef struct video_frame_info
{
float menu_wallpaper_opacity;
float refresh_rate;
bool shared_context;
bool black_frame_insertion;
@ -101,6 +101,33 @@ typedef struct video_frame_info
bool fullscreen;
unsigned monitor_index;
bool font_enable;
char fps_text[128];
uint64_t frame_count;
unsigned width;
unsigned height;
float font_msg_pos_x;
float font_msg_pos_y;
float font_msg_color_r;
float font_msg_color_g;
float font_msg_color_b;
bool use_rgba;
bool libretro_running;
float menu_header_opacity;
float menu_footer_opacity;
bool xmb_shadows_enable;
float xmb_alpha_factor;
unsigned xmb_theme;
unsigned xmb_color_theme;
unsigned menu_shader_pipeline;
unsigned materialui_color_theme;
bool battery_level_enable;
bool timedate_enable;
} video_frame_info_t;
/* Optionally implemented interface to poke more
@ -136,7 +163,7 @@ typedef struct video_poke_interface
/* Enable or disable rendering. */
void (*set_texture_enable)(void *data, bool enable, bool full_screen);
void (*set_osd_msg)(void *data, const char *msg,
const struct font_params *params, void *font);
const void *params, void *font);
void (*show_mouse)(void *data, bool state);
void (*grab_mouse_toggle)(void *data);
@ -163,7 +190,7 @@ typedef struct video_viewport
typedef bool (*video_driver_frame_t)(void *data,
const void *frame, unsigned width,
unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info);
unsigned pitch, const char *msg, video_frame_info_t *video_info);
typedef struct video_driver
{
@ -242,7 +269,7 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
#define video_driver_has_windowed() (false)
#else
#define video_driver_has_windowed() (current_video->has_windowed(video_driver_data))
#define video_driver_has_windowed() (current_video->has_windowed && current_video->has_windowed(video_driver_data))
#endif
#define video_driver_cached_frame_has_valid_framebuffer() (frame_cache_data ? (frame_cache_data == RETRO_HW_FRAME_BUFFER_VALID) : false)
@ -370,7 +397,7 @@ bool video_driver_get_video_output_size(
unsigned *width, unsigned *height);
void video_driver_set_osd_msg(const char *msg,
const struct font_params *params, void *font);
const void *params, void *font);
void video_driver_set_texture_enable(bool enable, bool full_screen);
@ -462,25 +489,6 @@ void video_monitor_set_refresh_rate(float hz);
bool video_monitor_fps_statistics(double *refresh_rate,
double *deviation, unsigned *sample_points);
/**
* video_monitor_get_fps:
* @video_info : information about the video frame
* @buf : string suitable for Window title
* @size : size of buffer.
* @buf_fps : string of raw FPS only (optional).
* @size_fps : size of raw FPS buffer.
*
* Get the amount of frames per seconds.
*
* Returns: true if framerate per seconds could be obtained,
* otherwise false.
*
**/
bool video_monitor_get_fps(
video_frame_info_t video_info,
char *buf, size_t size,
char *buf_fps, size_t size_fps);
unsigned video_pixel_get_alignment(unsigned pitch);
const video_poke_interface_t *video_driver_get_poke(void);
@ -543,6 +551,8 @@ void video_driver_build_info(video_frame_info_t *video_info);
void video_driver_reinit(void);
void video_driver_get_window_title(char *buf, unsigned len);
extern video_driver_t video_gl;
extern video_driver_t video_vulkan;
extern video_driver_t video_psp1;

View File

@ -619,7 +619,7 @@ static void video_thread_loop(void *data)
thr->frame.buffer, thr->frame.width, thr->frame.height,
thr->frame.count,
thr->frame.pitch, *thr->frame.msg ? thr->frame.msg : NULL,
video_info);
&video_info);
}
slock_unlock(thr->frame.lock);
@ -706,7 +706,7 @@ static bool video_thread_has_windowed(void *data)
static bool video_thread_frame(void *data, const void *frame_,
unsigned width, unsigned height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t video_info)
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
unsigned copy_stride;
static struct retro_perf_counter thr_frame = {0};
@ -741,7 +741,7 @@ static bool video_thread_frame(void *data, const void *frame_,
{
retro_time_t target_frame_time = (retro_time_t)
roundf(1000000 / video_info.refresh_rate);
roundf(1000000 / video_info->refresh_rate);
retro_time_t target = thr->last_time + target_frame_time;
/* Ideally, use absolute time, but that is only a good idea on POSIX. */
@ -1193,7 +1193,7 @@ static void thread_set_texture_enable(void *data, bool state, bool full_screen)
}
static void thread_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
const void *params, void *font)
{
thread_video_t *thr = (thread_video_t*)data;

View File

@ -23,6 +23,7 @@
#include <retro_common_api.h>
#include "video_driver.h"
#include "font_driver.h"
RETRO_BEGIN_DECLS

View File

@ -933,7 +933,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DIRECTORY_SETTINGS,
MSG_HASH(MENU_ENUM_SUBLABEL_DRIVER_SETTINGS,
"Ändere Treiber für dieses System.")
MSG_HASH(MENU_ENUM_SUBLABEL_FRAME_THROTTLE_SETTINGS,
"Ändere die Einstellungen für Rückspulen, Zeitraffer, und Zeitlupe.") // This does not sound like a correct sentence. Suggestions are appreciated.
"Ändere die Einstellungen für Rückspulen, Zeitraffer, und Zeitlupe.") /* This does not sound like a correct sentence. Suggestions are appreciated. */
MSG_HASH(MENU_ENUM_SUBLABEL_FPS_SHOW,
"Zeigt die aktuelle Bildwiederholrate auf dem Bildschirm an.")
MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST,
@ -957,7 +957,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETWORK_SETTINGS,
MSG_HASH(MENU_ENUM_SUBLABEL_ONLINE_UPDATER,
"Lade Add-Ons, Komponenten und Inhalte für RetroArch herunter.")
MSG_HASH(MENU_ENUM_SUBLABEL_ONSCREEN_DISPLAY_SETTINGS,
"Ändere die Einstellungen des Display-Overlays, Bildschirmtastatur und Bildschirmbenachrichtigung.") // There is no Translation for display overlay.
"Ändere die Einstellungen des Display-Overlays, Bildschirmtastatur und Bildschirmbenachrichtigung.") /* There is no Translation for display overlay. */
MSG_HASH(MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE,
"Pause gameplay when window focus is lost.")
MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_SETTINGS,

View File

@ -30,7 +30,7 @@
#include <retro_common_api.h>
#include <retro_inline.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(_XBOX)
#if (_MSC_VER > 1310)
#include <intrin.h>
#endif

View File

@ -270,26 +270,28 @@ static void mui_draw_tab(mui_handle_t *mui,
&tab_color[0]);
}
static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned id)
static void mui_render_keyboard(mui_handle_t *mui,
video_frame_info_t *video_info,
const char *grid[], unsigned id)
{
int ptr_width, ptr_height;
unsigned i, width, height;
float dark[16]= {
unsigned i;
unsigned width = video_info->width;
unsigned height = video_info->height;
float dark[16] = {
0.00, 0.00, 0.00, 0.85,
0.00, 0.00, 0.00, 0.85,
0.00, 0.00, 0.00, 0.85,
0.00, 0.00, 0.00, 0.85,
};
float white[16]= {
float white[16] = {
1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00,
};
video_driver_get_size(&width, &height);
menu_display_draw_quad(0, height/2.0, width, height/2.0,
width, height,
&dark[0]);
@ -327,17 +329,16 @@ static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned
}
/* Returns the OSK key at a given position */
static int mui_osk_ptr_at_pos(void *data, int x, int y)
static int mui_osk_ptr_at_pos(void *data, int x, int y,
unsigned width, unsigned height)
{
unsigned i;
int ptr_width, ptr_height;
unsigned i, width, height;
mui_handle_t *mui = (mui_handle_t*)data;
if (!mui)
return -1;
video_driver_get_size(&width, &height);
ptr_width = width / 11;
ptr_height = height / 10;
@ -364,7 +365,7 @@ static void mui_draw_tab_begin(mui_handle_t *mui,
{
float scale_factor = menu_display_get_dpi();
mui->tabs_height = scale_factor / 3;
mui->tabs_height = scale_factor / 3;
/* tabs background */
menu_display_draw_quad(0, height - mui->tabs_height, width,
@ -395,16 +396,17 @@ static void mui_draw_tab_end(mui_handle_t *mui,
&active_tab_marker_color[0]);
}
static float mui_content_height()
static float mui_content_height(void)
{
unsigned i;
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
float sum = 0;
unsigned i = 0;
for (; i < menu_entries_get_end(); i++)
float sum = 0;
for (i = 0; i < menu_entries_get_end(); i++)
{
mui_node_t *node = (mui_node_t*)
menu_entries_get_userdata_at_offset(list, i);
sum += node->line_height;
mui_node_t *node = (mui_node_t*)
menu_entries_get_userdata_at_offset(list, i);
sum += node->line_height;
}
return sum;
}
@ -412,38 +414,31 @@ static float mui_content_height()
static void mui_draw_scrollbar(mui_handle_t *mui,
unsigned width, unsigned height, float *coord_color)
{
unsigned header_height;
float content_height, total_height,
scrollbar_height, scrollbar_margin, y;
if (!mui)
return;
header_height = menu_display_get_header_height();
content_height = mui_content_height();
total_height = height - header_height - mui->tabs_height;
scrollbar_margin = mui->scrollbar_width;
scrollbar_height = total_height / (content_height / total_height);
y = total_height * mui->scroll_y / content_height;
unsigned header_height = menu_display_get_header_height();
float content_height = mui_content_height();
float total_height = height - header_height - mui->tabs_height;
float scrollbar_margin = mui->scrollbar_width;
float scrollbar_height = total_height / (content_height / total_height);
float y = total_height * mui->scroll_y / content_height;
/* apply a margin on the top and bottom of the scrollbar for aestetic */
scrollbar_height -= scrollbar_margin * 2;
y += scrollbar_margin;
scrollbar_height -= scrollbar_margin * 2;
y += scrollbar_margin;
if (content_height >= total_height)
{
/* if the scrollbar is extremely short, display it as a square */
if (scrollbar_height <= mui->scrollbar_width)
scrollbar_height = mui->scrollbar_width;
if (content_height < total_height)
return;
menu_display_draw_quad( width - mui->scrollbar_width - scrollbar_margin,
header_height + y,
mui->scrollbar_width,
scrollbar_height,
width, height,
coord_color);
}
/* if the scrollbar is extremely short, display it as a square */
if (scrollbar_height <= mui->scrollbar_width)
scrollbar_height = mui->scrollbar_width;
menu_display_draw_quad(
width - mui->scrollbar_width - scrollbar_margin,
header_height + y,
mui->scrollbar_width,
scrollbar_height,
width, height,
coord_color);
}
static void mui_get_message(void *data, const char *message)
@ -457,10 +452,13 @@ static void mui_get_message(void *data, const char *message)
}
static void mui_render_messagebox(mui_handle_t *mui,
video_frame_info_t *video_info,
const char *message, float *body_bg_color, uint32_t font_color)
{
unsigned i, width, height, y_position;
unsigned i, y_position;
int x, y, line_height, longest = 0, longest_width = 0;
unsigned width = video_info->width;
unsigned height = video_info->height;
struct string_list *list = (struct string_list*)
string_split(message, "\n");
@ -469,8 +467,6 @@ static void mui_render_messagebox(mui_handle_t *mui,
if (list->elems == 0)
goto end;
video_driver_get_size(&width, &height);
line_height = mui->font->size * 1.2;
y_position = height / 2;
@ -515,27 +511,30 @@ static void mui_render_messagebox(mui_handle_t *mui,
}
if (menu_input_dialog_get_display_kb())
mui_render_keyboard(mui, menu_event_get_osk_grid(), menu_event_get_osk_ptr());
mui_render_keyboard(mui,
video_info,
menu_event_get_osk_grid(), menu_event_get_osk_ptr());
end:
string_list_free(list);
}
static unsigned count_lines(const char *str)
static unsigned mui_count_lines(const char *str)
{
unsigned c = 0;
unsigned c = 0;
unsigned lines = 1;
for (c = 0; str[c]; c++)
lines += (str[c] == '\n');
return lines;
}
static void compute_entries_box(mui_handle_t* mui, int width)
static void mui_compute_entries_box(mui_handle_t* mui, int width)
{
size_t usable_width = width - (mui->margin * 2);
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
float sum = 0;
unsigned i = 0;
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
float sum = 0;
unsigned i = 0;
for (; i < menu_entries_get_end(); i++)
{
@ -550,7 +549,7 @@ static void compute_entries_box(mui_handle_t* mui, int width)
if (menu_entry_get_sublabel(i, sublabel_str, sizeof(sublabel_str)))
{
word_wrap(sublabel_str, sublabel_str, (int)(usable_width / mui->glyph_width2));
lines = count_lines(sublabel_str);
lines = mui_count_lines(sublabel_str);
}
scale_factor = menu_display_get_dpi();
@ -562,20 +561,20 @@ static void compute_entries_box(mui_handle_t* mui, int width)
static void mui_render(void *data)
{
size_t i = 0;
menu_animation_ctx_delta_t delta;
float delta_time;
unsigned bottom, width, height, header_height;
size_t i = 0;
mui_handle_t *mui = (mui_handle_t*)data;
settings_t *settings = config_get_ptr();
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
if (!mui)
return;
video_driver_get_size(&width, &height);
compute_entries_box(mui, width);
mui_compute_entries_box(mui, width);
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
@ -800,7 +799,9 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node,
);
}
static void mui_render_menu_list(mui_handle_t *mui,
static void mui_render_menu_list(
video_frame_info_t *video_info,
mui_handle_t *mui,
unsigned width, unsigned height,
uint32_t font_normal_color,
uint32_t font_hover_color,
@ -809,9 +810,8 @@ static void mui_render_menu_list(mui_handle_t *mui,
float sum = 0;
unsigned header_height = 0;
size_t i = 0;
uint64_t frame_count = 0;
file_list_t *list = NULL;
frame_count = video_driver_get_frame_count();
uint64_t frame_count = video_info->frame_count;
if (!menu_display_get_update_pending())
return;
@ -924,7 +924,8 @@ static int mui_get_core_title(char *s, size_t len)
return 0;
}
static void mui_draw_bg(menu_display_ctx_draw_t *draw)
static void mui_draw_bg(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
menu_display_blend_begin();
@ -933,12 +934,12 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw)
draw->pipeline.id = 0;
draw->pipeline.active = false;
menu_display_draw_bg(draw, false);
menu_display_draw_bg(draw, video_info, false);
menu_display_draw(draw);
menu_display_blend_end();
}
static void mui_frame(void *data)
static void mui_frame(void *data, video_frame_info_t *video_info)
{
float black_bg[16] = {
0, 0, 0, 0.75,
@ -1028,18 +1029,17 @@ static void mui_frame(void *data)
float header_bg_color_real[16] = {0};
file_list_t *list = NULL;
mui_node_t *node = NULL;
unsigned width = 0;
unsigned height = 0;
unsigned width = video_info->width;
unsigned height = video_info->height;
unsigned ticker_limit = 0;
unsigned i = 0;
unsigned header_height = 0;
size_t selection = 0;
size_t title_margin = 0;
mui_handle_t *mui = (mui_handle_t*)data;
uint64_t frame_count = video_driver_get_frame_count();
settings_t *settings = config_get_ptr();
uint64_t frame_count = video_info->frame_count;
bool background_rendered = false;
bool libretro_running = menu_display_libretro_running();
bool libretro_running = video_info->libretro_running;
/* Default is blue theme */
float *header_bg_color = NULL;
@ -1058,7 +1058,7 @@ static void mui_frame(void *data)
msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0';
switch (settings->menu.materialui.menu_color_theme)
switch (video_info->materialui_color_theme)
{
case MATERIALUI_THEME_BLUE:
hex32_to_rgba_normalized(0x2196F3, blue_500, 1.00);
@ -1207,12 +1207,10 @@ static void mui_frame(void *data)
break;
}
menu_display_set_alpha(header_bg_color_real, settings->menu.header.opacity);
menu_display_set_alpha(footer_bg_color_real, settings->menu.footer.opacity);
menu_display_set_alpha(header_bg_color_real, video_info->menu_header_opacity);
menu_display_set_alpha(footer_bg_color_real, video_info->menu_footer_opacity);
video_driver_get_size(&width, &height);
menu_display_set_viewport();
menu_display_set_viewport(video_info->width, video_info->height);
header_height = menu_display_get_header_height();
if (libretro_running)
@ -1228,10 +1226,7 @@ static void mui_frame(void *data)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_libretro_running() && draw.texture)
draw.color = &white_bg[0];
mui_draw_bg(&draw);
mui_draw_bg(&draw, video_info);
}
else
{
@ -1254,10 +1249,10 @@ static void mui_frame(void *data)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_libretro_running() && draw.texture)
draw.color = &white_bg[0];
if (draw.texture)
draw.color = &white_bg[0];
mui_draw_bg(&draw);
mui_draw_bg(&draw, video_info);
/* Restore opacity of transposed white background */
menu_display_set_alpha(white_transp_bg, 0.90);
@ -1293,6 +1288,7 @@ static void mui_frame(void *data)
menu_display_font_bind_block(mui->font2, &mui->raster_block2);
mui_render_menu_list(
video_info,
mui,
width,
height,
@ -1301,8 +1297,8 @@ static void mui_frame(void *data)
&active_tab_marker_color[0]
);
menu_display_font_flush_block(mui->font);
menu_display_font_flush_block(mui->font2);
menu_display_font_flush_block(video_info->width, video_info->height, mui->font);
menu_display_font_flush_block(video_info->width, video_info->height, mui->font2);
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
/* header */
@ -1405,13 +1401,13 @@ static void mui_frame(void *data)
menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]);
snprintf(msg, sizeof(msg), "%s\n%s", label, str);
mui_render_messagebox(mui, msg, &body_bg_color[0], font_hover_color);
mui_render_messagebox(mui, video_info, msg, &body_bg_color[0], font_hover_color);
}
if (!string_is_empty(mui->box_message))
{
menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]);
mui_render_messagebox(mui, mui->box_message, &body_bg_color[0], font_hover_color);
mui_render_messagebox(mui, video_info, mui->box_message, &body_bg_color[0], font_hover_color);
mui->box_message[0] = '\0';
}
@ -1426,7 +1422,7 @@ static void mui_frame(void *data)
height);
menu_display_restore_clear_color();
menu_display_unset_viewport();
menu_display_unset_viewport(video_info->width, video_info->height);
}
static void mui_layout(mui_handle_t *mui)
@ -1661,7 +1657,6 @@ static void mui_context_reset(void *data)
if (!mui || !settings)
return;
mui_layout(mui);
mui_context_bg_destroy(mui);
menu_display_allocate_white_texture();

View File

@ -145,6 +145,9 @@ static void xmb_init_ribbon(nk_menu_handle_t * xmb)
static void *nk_menu_init(void **userdata)
{
#if 1
unsigned i;
#endif
settings_t *settings = config_get_ptr();
nk_menu_handle_t *nk = NULL;
menu_handle_t *menu = (menu_handle_t*)
@ -169,16 +172,18 @@ static void *nk_menu_init(void **userdata)
"nuklear", sizeof(nk->assets_directory));
nk_menu_init_device(nk);
/* for demo puposes only, opens all windows */
/* for demo purposes only, opens all windows */
#if 1
for (int i=0; i < NK_WND_LAST; i++)
for (i = 0; i < NK_WND_LAST; i++)
nk->window[i].open = true;
#else
nk->window[NK_WND_MAIN].open = true;
#endif
xmb_init_ribbon(nk);
return menu;
error:
if (menu)
free(menu);
return NULL;
@ -250,6 +255,7 @@ static void nk_menu_get_message(void *data, const char *message)
static void nk_draw_bg(
nk_menu_handle_t *nk,
video_frame_info_t *video_info,
unsigned width,
unsigned height,
float alpha,
@ -273,7 +279,7 @@ static void nk_draw_bg(
draw.pipeline.id = 0;
menu_display_blend_begin();
menu_display_set_viewport();
menu_display_set_viewport(video_info->width, video_info->height);
draw.pipeline.id = VIDEO_SHADER_MENU_5;
draw.pipeline.active = false;
@ -302,18 +308,24 @@ static void nk_menu_main(nk_menu_handle_t *nk)
}
static void nk_menu_frame(void *data)
static void nk_menu_frame(void *data, video_frame_info_t *video_info)
{
float white_bg[16]= {
unsigned ticker_limit, i;
float coord_black[16], coord_white[16];
nk_menu_handle_t *nk = (nk_menu_handle_t*)data;
settings_t *settings = config_get_ptr();
unsigned width = video_info->width;
unsigned height = video_info->height;
bool libretro_running = video_info->libretro_running;
float white_bg[16] = {
0.98, 0.98, 0.98, 1,
0.98, 0.98, 0.98, 1,
0.98, 0.98, 0.98, 1,
0.98, 0.98, 0.98, 1,
};
float coord_black[16], coord_white[16];
for (int i = 0; i < 16; i++)
for (i = 0; i < 16; i++)
{
coord_black[i] = 0;
coord_white[i] = 1.0f;
@ -322,18 +334,10 @@ static void nk_menu_frame(void *data)
menu_display_set_alpha(coord_black, 0.75);
menu_display_set_alpha(coord_white, 0.75);
unsigned width, height, ticker_limit, i;
nk_menu_handle_t *nk = (nk_menu_handle_t*)data;
settings_t *settings = config_get_ptr();
bool libretro_running = menu_display_libretro_running();
if (!nk)
return;
video_driver_get_size(&width, &height);
menu_display_set_viewport();
menu_display_set_viewport(video_info->width, video_info->height);
nk_input_begin(&nk->ctx);
nk_menu_input_gamepad(nk);
@ -350,7 +354,7 @@ static void nk_menu_frame(void *data)
nk_input_end(&nk->ctx);
nk_menu_main(nk);
nk_draw_bg(nk, width, height, 0.5, nk->textures.bg, coord_black, coord_white);
nk_draw_bg(nk, video_info, width, height, 0.5, nk->textures.bg, coord_black, coord_white);
nk_common_device_draw(&device, &nk->ctx, width, height, NK_ANTI_ALIASING_ON);
menu_display_draw_cursor(
@ -363,7 +367,7 @@ static void nk_menu_frame(void *data)
height);
menu_display_restore_clear_color();
menu_display_unset_viewport();
menu_display_unset_viewport(video_info->width, video_info->height);
}
static void nk_menu_free(void *data)

View File

@ -62,6 +62,7 @@ typedef struct
unsigned last_height;
float scroll_y;
bool mouse_show;
unsigned int frame_count;
} rgui_t;
static uint16_t *rgui_framebuf_data = NULL;
@ -381,6 +382,12 @@ static void rgui_blit_cursor(void)
rgui_color_rect(fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF);
}
static void rgui_frame(void *data, video_frame_info_t *video_info)
{
rgui_t *rgui = (rgui_t*)data;
rgui->frame_count = video_info->frame_count;
}
static void rgui_render(void *data)
{
menu_animation_ctx_ticker_t ticker;
@ -394,11 +401,9 @@ static void rgui_render(void *data)
char title_msg[64];
char msg[255];
bool msg_force = false;
uint64_t frame_count = 0;
settings_t *settings = config_get_ptr();
rgui_t *rgui = (rgui_t*)data;
frame_count = video_driver_get_frame_count();
uint64_t frame_count = rgui ? rgui->frame_count : 0;
msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0';
@ -874,7 +879,7 @@ menu_ctx_driver_t menu_ctx_rgui = {
rgui_set_message,
generic_menu_iterate,
rgui_render,
NULL,
rgui_frame,
rgui_init,
rgui_free,
NULL,

View File

@ -421,11 +421,9 @@ static const char *xmb_thumbnails_ident(void)
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF);
}
static float *xmb_gradient_ident(void)
static float *xmb_gradient_ident(video_frame_info_t *video_info)
{
settings_t *settings = config_get_ptr();
switch (settings->menu.xmb.menu_color_theme)
switch (video_info->xmb_color_theme)
{
case XMB_THEME_DARK_PURPLE:
return &gradient_dark_purple[0];
@ -706,11 +704,15 @@ static void xmb_messagebox(void *data, const char *message)
strlcpy(xmb->box_message, message, sizeof(xmb->box_message));
}
static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned id)
static void xmb_render_keyboard(xmb_handle_t *xmb,
video_frame_info_t *video_info,
const char *grid[], unsigned id)
{
unsigned i;
int ptr_width, ptr_height;
unsigned i, width, height;
float dark[16]= {
unsigned width = video_info->width;
unsigned height = video_info->height;
float dark[16] = {
0.00, 0.00, 0.00, 0.85,
0.00, 0.00, 0.00, 0.85,
0.00, 0.00, 0.00, 0.85,
@ -724,8 +726,6 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned
1.00, 1.00, 1.00, 1.00,
};
video_driver_get_size(&width, &height);
menu_display_draw_quad(0, height/2.0, width, height/2.0,
width, height,
&dark[0]);
@ -765,18 +765,16 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned
}
/* Returns the OSK key at a given position */
static int xmb_osk_ptr_at_pos(void *data, int x, int y)
static int xmb_osk_ptr_at_pos(void *data, int x, int y, unsigned width, unsigned height)
{
unsigned i;
int ptr_width, ptr_height;
unsigned i, width, height;
xmb_handle_t *xmb = (xmb_handle_t*)data;
if (!xmb)
return -1;
video_driver_get_size(&width, &height);
ptr_width = width / 11;
ptr_width = width / 11;
ptr_height = height / 10;
if (ptr_width >= ptr_height)
@ -798,19 +796,14 @@ static int xmb_osk_ptr_at_pos(void *data, int x, int y)
static void xmb_render_messagebox_internal(
menu_display_frame_info_t menu_disp_info,
video_frame_info_t *video_info,
xmb_handle_t *xmb, const char *message)
{
int x, y, longest = 0, longest_width = 0;
unsigned i, y_position;
unsigned width, height;
struct string_list *list = NULL;
if (!xmb)
return;
video_driver_get_size(&width, &height);
list = string_split(message, "\n");
int x, y, longest = 0, longest_width = 0;
unsigned width = video_info->width;
unsigned height = video_info->height;
struct string_list *list = string_split(message, "\n");
if (!list)
return;
@ -856,6 +849,7 @@ static void xmb_render_messagebox_internal(
if (menu_input_dialog_get_display_kb())
xmb_render_keyboard(xmb,
video_info,
menu_event_get_osk_grid(),
menu_event_get_osk_ptr());
@ -2064,6 +2058,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
}
static void xmb_draw_items(
video_frame_info_t *video_info,
menu_display_frame_info_t menu_disp_info,
xmb_handle_t *xmb,
file_list_t *list, file_list_t *stack,
@ -2073,10 +2068,9 @@ static void xmb_draw_items(
size_t i;
math_matrix_4x4 mymat;
menu_display_ctx_rotate_draw_t rotate_draw;
uint64_t frame_count = 0;
xmb_node_t *core_node = NULL;
size_t end = 0;
frame_count = video_driver_get_frame_count();
uint64_t frame_count = video_info->frame_count;
if (!list || !list->size)
return;
@ -2402,17 +2396,18 @@ static void xmb_render(void *data)
menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
}
static bool xmb_shader_pipeline_active(settings_t *settings)
static bool xmb_shader_pipeline_active(video_frame_info_t *video_info)
{
if (!string_is_equal(menu_driver_ident(), "xmb"))
return false;
if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER)
if (video_info->menu_shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER)
return false;
return true;
}
static void xmb_draw_bg(
xmb_handle_t *xmb,
video_frame_info_t *video_info,
unsigned width,
unsigned height,
float alpha,
@ -2421,13 +2416,12 @@ static void xmb_draw_bg(
float *coord_white)
{
menu_display_ctx_draw_t draw;
settings_t *settings = config_get_ptr();
#if 0
RARCH_LOG("DRAW BG %d %d \n",width,height);
#endif
bool running = menu_display_libretro_running();
bool running = video_info->libretro_running;
draw.x = 0;
draw.y = 0;
@ -2440,28 +2434,28 @@ static void xmb_draw_bg(
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
draw.pipeline.active = xmb_shader_pipeline_active(settings);
draw.pipeline.active = xmb_shader_pipeline_active(video_info);
menu_display_blend_begin();
menu_display_set_viewport();
menu_display_set_viewport(video_info->width, video_info->height);
#ifdef HAVE_SHADERPIPELINE
if (settings->menu.xmb.shader_pipeline > XMB_SHADER_PIPELINE_WALLPAPER
if (video_info->menu_shader_pipeline > XMB_SHADER_PIPELINE_WALLPAPER
&&
(settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER))
(video_info->xmb_color_theme != XMB_THEME_WALLPAPER))
{
draw.color = xmb_gradient_ident();
draw.color = xmb_gradient_ident(video_info);
if (running)
menu_display_set_alpha(draw.color, coord_black[3]);
else
menu_display_set_alpha(draw.color, coord_white[3]);
menu_display_draw_gradient(&draw);
menu_display_draw_gradient(&draw, video_info);
draw.pipeline.id = VIDEO_SHADER_MENU_2;
switch (settings->menu.xmb.shader_pipeline)
switch (video_info->menu_shader_pipeline)
{
case XMB_SHADER_PIPELINE_RIBBON:
draw.pipeline.id = VIDEO_SHADER_MENU;
@ -2486,16 +2480,16 @@ static void xmb_draw_bg(
{
uintptr_t texture = draw.texture;
if (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER)
draw.color = xmb_gradient_ident();
if (video_info->xmb_color_theme != XMB_THEME_WALLPAPER)
draw.color = xmb_gradient_ident(video_info);
if (running)
menu_display_set_alpha(draw.color, coord_black[3]);
else
menu_display_set_alpha(draw.color, coord_white[3]);
if (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER)
menu_display_draw_gradient(&draw);
if (video_info->xmb_color_theme != XMB_THEME_WALLPAPER)
menu_display_draw_gradient(&draw, video_info);
{
bool add_opacity = false;
@ -2505,10 +2499,10 @@ static void xmb_draw_bg(
if (!running && draw.texture)
draw.color = &coord_white[0];
if (settings->menu.xmb.menu_color_theme == XMB_THEME_WALLPAPER)
if (video_info->xmb_color_theme == XMB_THEME_WALLPAPER)
add_opacity = true;
menu_display_draw_bg(&draw, add_opacity);
menu_display_draw_bg(&draw, video_info, add_opacity);
}
}
@ -2553,35 +2547,34 @@ static void xmb_draw_dark_layer(
menu_display_blend_end();
}
static void xmb_frame(void *data)
static void xmb_frame(void *data, video_frame_info_t *video_info)
{
size_t selection;
size_t percent_width = 0;
math_matrix_4x4 mymat;
unsigned i, width, height;
unsigned i;
float item_color[16], coord_black[16], coord_white[16];
menu_display_ctx_rotate_draw_t rotate_draw;
char msg[1024];
char title_msg[255];
char title_truncated[255];
menu_display_frame_info_t menu_disp_info;
unsigned width = video_info->width;
unsigned height = video_info->height;
bool render_background = false;
file_list_t *selection_buf = NULL;
file_list_t *menu_stack = NULL;
settings_t *settings = config_get_ptr();
xmb_handle_t *xmb = (xmb_handle_t*)data;
if (!xmb)
return;
menu_disp_info.shadows_enable = settings->menu.xmb.shadows_enable;
menu_disp_info.shadows_enable = video_info->xmb_shadows_enable;
msg[0] = '\0';
title_msg[0] = '\0';
title_truncated[0] = '\0';
video_driver_get_size(&width, &height);
menu_display_font_bind_block(xmb->font, &xmb->raster_block);
menu_display_font_bind_block(xmb->font2, &xmb->raster_block2);
@ -2596,11 +2589,12 @@ static void xmb_frame(void *data)
}
menu_display_set_alpha(coord_black, MIN(
(float)settings->menu.xmb.alpha_factor/100, xmb->alpha));
(float)video_info->xmb_alpha_factor/100, xmb->alpha));
menu_display_set_alpha(coord_white, xmb->alpha);
xmb_draw_bg(
xmb,
video_info,
width,
height,
xmb->alpha,
@ -2639,7 +2633,7 @@ static void xmb_frame(void *data)
/* Clock image */
menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f));
if (settings->menu.battery_level_enable)
if (video_info->battery_level_enable)
{
char msg[12];
static retro_time_t last_time = 0;
@ -2692,34 +2686,34 @@ static void xmb_frame(void *data)
}
}
if (settings->menu.timedate_enable && coord_white[3] != 0)
{
int x_pos = 0;
if (percent_width)
x_pos = percent_width + (xmb->icon.size / 2.5);
xmb_draw_icon(
menu_disp_info,
xmb->icon.size,
&mymat,
xmb->textures.list[XMB_TEXTURE_CLOCK],
width - xmb->icon.size - x_pos,
xmb->icon.size,width,
height,
1,
0,
1,
&coord_white[0],
xmb->shadow_offset);
}
if (settings->menu.timedate_enable)
if (video_info->timedate_enable)
{
menu_display_ctx_datetime_t datetime;
char timedate[255];
int x_pos = 0;
if (coord_white[3] != 0)
{
int x_pos = 0;
if (percent_width)
x_pos = percent_width + (xmb->icon.size / 2.5);
xmb_draw_icon(
menu_disp_info,
xmb->icon.size,
&mymat,
xmb->textures.list[XMB_TEXTURE_CLOCK],
width - xmb->icon.size - x_pos,
xmb->icon.size,width,
height,
1,
0,
1,
&coord_white[0],
xmb->shadow_offset);
}
timedate[0] = '\0';
datetime.s = timedate;
@ -2813,7 +2807,9 @@ static void xmb_frame(void *data)
menu_display_blend_end();
/* Vertical icons */
xmb_draw_items(menu_disp_info,
xmb_draw_items(
video_info,
menu_disp_info,
xmb,
xmb->selection_buf_old,
xmb->menu_stack_old,
@ -2828,6 +2824,7 @@ static void xmb_frame(void *data)
menu_stack = menu_entries_get_menu_stack_ptr(0);
xmb_draw_items(
video_info,
menu_disp_info,
xmb,
selection_buf,
@ -2838,8 +2835,8 @@ static void xmb_frame(void *data)
width,
height);
menu_display_font_flush_block(xmb->font);
menu_display_font_flush_block(xmb->font2);
menu_display_font_flush_block(video_info->width, video_info->height, xmb->font);
menu_display_font_flush_block(video_info->width, video_info->height, xmb->font2);
if (xmb->savestate_thumbnail)
xmb_draw_thumbnail(menu_disp_info,
@ -2882,7 +2879,7 @@ static void xmb_frame(void *data)
{
xmb_draw_dark_layer(xmb, width, height);
xmb_render_messagebox_internal(menu_disp_info, xmb, msg);
xmb_render_messagebox_internal(menu_disp_info, video_info, xmb, msg);
}
/* Cursor image */
@ -2899,7 +2896,7 @@ static void xmb_frame(void *data)
height);
}
menu_display_unset_viewport();
menu_display_unset_viewport(video_info->width, video_info->height);
}
static void xmb_layout_ps3(xmb_handle_t *xmb, int width)

View File

@ -38,12 +38,15 @@
#include "../menu_navigation.h"
#include "../menu_setting.h"
#include "../menu_display.h"
#include "../widgets/menu_input_dialog.h"
#include "../../gfx/video_driver.h"
#include "../../gfx/video_context_driver.h"
#include "../../configuration.h"
#include "../../runloop.h"
#include "../../gfx/d3d/d3d.h"
#include "../../gfx/drivers/d3d.h"
#define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1)
@ -63,7 +66,7 @@ HXUIOBJ m_background;
HXUIOBJ m_back;
HXUIOBJ root_menu;
HXUIOBJ current_menu;
static msg_queue_t *xui_msg_queue;
static msg_queue_t *xui_msg_queue = NULL;
class CRetroArch : public CXuiModule
{
@ -160,7 +163,7 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
if (XuiHandleIsValid(m_menutitlebottom))
{
char str[PATH_MAX_LENGTH] = {0};
char str[PATH_MAX_LENGTH] = {0};
if (menu_entries_get_core_title(str, sizeof(str)) == 0)
{
@ -292,7 +295,7 @@ static void* xui_init(void **userdata)
video_info.rgb32 = false;
d3d_make_d3dpp(d3d, &video_info, &d3dpp);
hr = app.InitShared(d3d->dev, &d3dpp,
(PFN_XUITEXTURELOADER)XuiTextureLoader);
@ -341,7 +344,7 @@ static void* xui_init(void **userdata)
}
video_driver_set_texture_frame(NULL,
true, 0, 0, 1.0f);
true, 0, 0, 1.0f);
xui_msg_queue = msg_queue_new(16);
@ -371,7 +374,7 @@ static void xui_render_message(const char *msg)
if (!d3d)
return;
list = string_split(msg, "\n");
if (!list)
@ -399,7 +402,7 @@ end:
string_list_free(list);
}
static void xui_frame(void *data)
static void xui_frame(void *data, video_frame_info_t *video_info)
{
XUIMessage msg;
XUIMessageRender msgRender;
@ -408,7 +411,7 @@ static void xui_frame(void *data)
const char *message = NULL;
D3DVIEWPORT vp_full = {0};
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false);
if (!d3d)
return;
@ -417,7 +420,7 @@ static void xui_frame(void *data)
if (!d3dr)
return;
menu_display_set_viewport();
menu_display_set_viewport(video_info->width, video_info->height);
app.RunFrame();
XuiTimersRun();
@ -445,7 +448,7 @@ static void xui_frame(void *data)
XuiRenderEnd( app.GetDC() );
menu_display_unset_viewport();
menu_display_unset_viewport(video_info->width, video_info->height);
}
static void blit_line(int x, int y, const char *message, bool green)
@ -455,9 +458,9 @@ static void blit_line(int x, int y, const char *message, bool green)
static void xui_render_background(void)
{
if (menu_display_libretro_running())
XuiElementSetShow(m_background, FALSE);
else
XuiElementSetShow(m_background, TRUE);
XuiElementSetShow(m_background, FALSE);
else
XuiElementSetShow(m_background, TRUE);
}
static void xui_render_messagebox(void *data, const char *message)
@ -525,11 +528,11 @@ static void xui_set_list_text(int index, const wchar_t* leftText,
static void xui_render(void *data)
{
size_t end, i, selection;
char title[PATH_MAX_LENGTH] = {0};
const char *dir = NULL;
size_t end, i, selection;
char title[PATH_MAX_LENGTH] = {0};
const char *dir = NULL;
const char *label = NULL;
unsigned menu_type = 0;
unsigned menu_type = 0;
uint64_t *frame_count = video_driver_get_frame_count_ptr();
unsigned fb_width = menu_display_get_width();
bool msg_force = menu_display_get_msg_force();
@ -539,33 +542,33 @@ static void xui_render(void *data)
&& menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)
&& !msg_force
)
return;
return;
menu_display_unset_framebuffer_dirty_flag();
menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
xui_render_background();
xui_render_background();
if (XuiHandleIsValid(m_menutitle))
{
if (XuiHandleIsValid(m_menutitle))
{
menu_entries_get_title(title, sizeof(title));
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitle, strw_buffer);
menu_animation_ticker_str(title, RXUI_TERM_WIDTH(fb_width) - 3,
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitle, strw_buffer);
menu_animation_ticker_str(title, RXUI_TERM_WIDTH(fb_width) - 3,
(unsigned int)*frame_count / 15, title, true);
}
}
if (XuiHandleIsValid(m_menutitle))
{
if (XuiHandleIsValid(m_menutitle))
{
if (menu_entries_get_core_title(title, sizeof(title)) == 0)
{
mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
}
}
}
end = menu_entries_get_end();
for (i = 0; i < end; i++)
end = menu_entries_get_end();
for (i = 0; i < end; i++)
{
char entry_path[PATH_MAX_LENGTH] = {0};
char entry_value[PATH_MAX_LENGTH] = {0};
@ -583,20 +586,21 @@ static void xui_render(void *data)
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
XuiListSetCurSelVisible(m_menulist, selection);
XuiListSetCurSelVisible(m_menulist, selection);
if (menu_input_dialog_get_display_kb())
{
char msg[1024] = {0};
{
char msg[1024] = {0};
const char *str = menu_input_dialog_get_buffer();
const char *label = menu_input_dialog_get_label_buffer();
snprintf(msg, sizeof(msg), "%s\n%s", label, str);
xui_render_messagebox(msg);
}
xui_render_messagebox(NULL, msg);
}
}
static void xui_populate_entries(const char *path,
static void xui_populate_entries(void *data,
const char *path,
const char *label, unsigned i)
{
size_t selection;
@ -645,7 +649,8 @@ static void xui_list_insert(void *data,
XuiListSetText(m_menulist, list_size, buf);
}
static void xui_list_free(file_list_t *list, size_t idx,
static void xui_list_free(
file_list_t *list, size_t idx,
size_t list_size)
{
int x = XuiListGetItemCount( m_menulist );
@ -671,7 +676,7 @@ static void xui_list_set_selection(void *data, file_list_t *list)
file_list_get_directory_ptr(list));
}
static int xui_environ(enum menu_environ_cb type, void *data)
static int xui_environ(enum menu_environ_cb type, void *data, void *userdata)
{
switch (type)
{
@ -691,10 +696,10 @@ menu_ctx_driver_t menu_ctx_xui = {
xui_frame,
xui_init,
xui_free,
NULL,
NULL,
NULL, /* context_reset */
NULL, /* context_destroy */
xui_populate_entries,
NULL,
NULL, /* toggle */
xui_navigation_clear,
xui_navigation_set_visible,
xui_navigation_set_visible,
@ -704,19 +709,23 @@ menu_ctx_driver_t menu_ctx_xui = {
xui_navigation_alphabet,
generic_menu_init_list,
xui_list_insert,
NULL, /* list_prepend */
xui_list_free,
xui_list_clear,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, /* list_cache */
NULL, /* list_push */
NULL, /* list_get_selection */
NULL, /* list_get_size */
NULL, /* list_get_entry */
xui_list_set_selection,
NULL,
NULL,
NULL, /* bind_init */
NULL, /* load_image */
"xui",
xui_environ,
NULL,
NULL,
NULL
NULL, /* pointer_tap */
NULL, /* update_thumbnail_path */
NULL, /* update_thumbnail_image */
NULL, /* osk_ptr_at_pos */
NULL, /* update_savestate_thumbnail_path */
NULL /* update_savestate_thumbnail_image */
};

View File

@ -311,19 +311,19 @@ static bool zarch_zui_button(zui_t *zui, int x1, int y1, const char *label)
+ zarch_zui_strwidth(zui->font, label, 1.0) + 24, y1 + 64, label);
}
static bool zarch_zui_list_item(zui_t *zui, struct zui_tabbed *tab, int x1, int y1,
static bool zarch_zui_list_item(video_frame_info_t *video_info,
zui_t *zui, struct zui_tabbed *tab, int x1, int y1,
const char *label, unsigned item_id, const char *entry, bool selected)
{
menu_animation_ctx_ticker_t ticker;
unsigned ticker_size;
char title_buf[PATH_MAX_LENGTH];
uint64_t frame_count = NULL;
unsigned id = zarch_zui_hash(zui, label);
int x2 = x1 + zui->width - 290 - 40;
int y2 = y1 + 50;
bool active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
const float *bg = zui_bg_panel;
frame_count = video_driver_get_frame_count();
uint64_t frame_count = video_info->frame_count;
title_buf[0] = '\0';
@ -500,7 +500,9 @@ static bool zarch_zui_gamepad_input(zui_t *zui,
return false;
}
static int zarch_zui_render_lay_root_recent(zui_t *zui, struct zui_tabbed *tabbed)
static int zarch_zui_render_lay_root_recent(
video_frame_info_t *video_info,
zui_t *zui, struct zui_tabbed *tabbed)
{
if (zarch_zui_tab(zui, tabbed, "Recent", 0))
{
@ -524,7 +526,9 @@ static int zarch_zui_render_lay_root_recent(zui_t *zui, struct zui_tabbed *tabbe
menu_entry_get_rich_label(i, rich_label, sizeof(rich_label));
menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value));
if (zarch_zui_list_item(zui, tabbed, 0,
if (zarch_zui_list_item(
video_info,
zui, tabbed, 0,
tabbed->tabline_size + j * ZUI_ITEM_SIZE_PX,
rich_label, i, entry_value, gamepad_index == (signed)i))
{
@ -563,7 +567,9 @@ static void zarch_zui_render_lay_root_load_set_new_path(zui_t *zui,
zui->load_dlist = NULL;
}
static int zarch_zui_render_lay_root_load(zui_t *zui,
static int zarch_zui_render_lay_root_load(
video_frame_info_t *video_info,
zui_t *zui,
struct zui_tabbed *tabbed)
{
char parent_dir[PATH_MAX_LENGTH];
@ -605,7 +611,9 @@ static int zarch_zui_render_lay_root_load(zui_t *zui,
fill_pathname_parent_dir(parent_dir,
zui->load_cwd, sizeof(parent_dir));
if (!string_is_empty(parent_dir) &&
zarch_zui_list_item(zui, tabbed, 0,
zarch_zui_list_item(
video_info,
zui, tabbed, 0,
tabbed->tabline_size + 73, " ..", 0, NULL, false /* TODO/FIXME */))
{
zarch_zui_render_lay_root_load_set_new_path(zui, parent_dir);
@ -651,7 +659,9 @@ static int zarch_zui_render_lay_root_load(zui_t *zui,
if (path_is_directory(path))
strncat(label, "/", sizeof(label)-1);
if (zarch_zui_list_item(zui, tabbed, 0,
if (zarch_zui_list_item(
video_info,
zui, tabbed, 0,
tabbed->tabline_size + 73 + j * ZUI_ITEM_SIZE_PX,
label, i, NULL, gamepad_index == (signed)(i-skip)))
{
@ -709,7 +719,8 @@ static int zarch_zui_render_lay_root_downloads(
return 0;
}
static int zarch_zui_render_lay_root(zui_t *zui)
static int zarch_zui_render_lay_root(video_frame_info_t *video_info,
zui_t *zui)
{
char item[PATH_MAX_LENGTH];
static struct zui_tabbed tabbed = {~0U};
@ -719,9 +730,9 @@ static int zarch_zui_render_lay_root(zui_t *zui)
tabbed.width = zui->width - 290 - 40;
zui->next_selection_set = false;
if (zarch_zui_render_lay_root_recent(zui, &tabbed))
if (zarch_zui_render_lay_root_recent(video_info, zui, &tabbed))
return 0;
if (zarch_zui_render_lay_root_load (zui, &tabbed))
if (zarch_zui_render_lay_root_load(video_info, zui, &tabbed))
return 0;
if (zarch_zui_render_lay_root_collections(zui, &tabbed))
return 0;
@ -792,7 +803,8 @@ static void zarch_zui_draw_cursor(float x, float y)
{
}
static int zarch_zui_render_pick_core(zui_t *zui)
static int zarch_zui_render_pick_core(video_frame_info_t *video_info,
zui_t *zui)
{
static struct zui_tabbed tabbed = {~0U};
unsigned i, j = 0;
@ -814,7 +826,9 @@ static int zarch_zui_render_pick_core(zui_t *zui)
if (!zui->pick_supported)
{
zarch_zui_list_item(zui, &tabbed, 0, ZUI_ITEM_SIZE_PX,
zarch_zui_list_item(
video_info,
zui, &tabbed, 0, ZUI_ITEM_SIZE_PX,
"Content unsupported", 0, NULL, false /* TODO/FIXME */);
return 1;
}
@ -828,7 +842,9 @@ static int zarch_zui_render_pick_core(zui_t *zui)
if (j > 10)
break;
if (zarch_zui_list_item(zui, &tabbed, 0, ZUI_ITEM_SIZE_PX + j * ZUI_ITEM_SIZE_PX,
if (zarch_zui_list_item(
video_info,
zui, &tabbed, 0, ZUI_ITEM_SIZE_PX + j * ZUI_ITEM_SIZE_PX,
zui->pick_cores[i].display_name, i, NULL, false))
{
int ret = zarch_zui_load_content(zui, i);
@ -846,7 +862,7 @@ static int zarch_zui_render_pick_core(zui_t *zui)
return 0;
}
static void zarch_frame(void *data)
static void zarch_frame(void *data, video_frame_info_t *video_info)
{
unsigned i;
float coord_color[16];
@ -862,7 +878,7 @@ static void zarch_frame(void *data)
video_driver_get_size(&zui->width, &zui->height);
menu_display_set_viewport();
menu_display_set_viewport(video_info->width, video_info->height);
for (i = 0; i < 16; i++)
{
@ -899,7 +915,7 @@ static void zarch_frame(void *data)
case LAY_HOME:
if (zarch_zui_render_sidebar(zui))
return;
if (zarch_zui_render_lay_root(zui))
if (zarch_zui_render_lay_root(video_info, zui))
return;
break;
case LAY_SETTINGS:
@ -908,7 +924,7 @@ static void zarch_frame(void *data)
case LAY_PICK_CORE:
if (zarch_zui_render_sidebar(zui))
return;
if (zarch_zui_render_pick_core(zui))
if (zarch_zui_render_pick_core(video_info, zui))
return;
break;
}
@ -954,20 +970,21 @@ static void zarch_frame(void *data)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_libretro_running() && draw.texture)
draw.color = &coord_color2[0];
if (!video_info->libretro_running && draw.texture)
draw.color = &coord_color2[0];
menu_display_blend_begin();
draw.x = 0;
draw.y = 0;
menu_display_draw_bg(&draw, false);
menu_display_draw_bg(&draw, video_info, false);
menu_display_draw(&draw);
menu_display_blend_end();
zui->rendering = false;
menu_display_font_flush_block((font_data_t*)zui->font);
menu_display_unset_viewport();
menu_display_font_flush_block(video_info->width, video_info->height,
(font_data_t*)zui->font);
menu_display_unset_viewport(video_info->width, video_info->height);
}
static void *zarch_init(void **userdata)

View File

@ -240,9 +240,10 @@ void menu_display_font_bind_block(font_data_t *font, void *block)
font_driver_bind_block(font, block);
}
bool menu_display_font_flush_block(font_data_t *font)
bool menu_display_font_flush_block(unsigned width, unsigned height,
font_data_t *font)
{
font_driver_flush(font);
font_driver_flush(width, height, font);
font_driver_bind_block(font, NULL);
return true;
}
@ -397,17 +398,13 @@ bool menu_display_get_update_pending(void)
return false;
}
void menu_display_set_viewport(void)
void menu_display_set_viewport(unsigned width, unsigned height)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, true, false);
}
void menu_display_unset_viewport(void)
void menu_display_unset_viewport(unsigned width, unsigned height)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, false, true);
}
@ -498,7 +495,8 @@ void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw)
menu_disp->draw_pipeline(draw);
}
void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wallpaper)
void menu_display_draw_bg(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info, bool add_opacity_to_wallpaper)
{
static struct video_coords coords;
const float *new_vertex = NULL;
@ -522,14 +520,11 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal
draw->coords = &coords;
if (!menu_display_libretro_running() && !draw->pipeline.active)
if (!video_info->libretro_running && !draw->pipeline.active)
add_opacity_to_wallpaper = true;
if (add_opacity_to_wallpaper)
{
settings_t *settings = config_get_ptr();
menu_display_set_alpha(draw->color, settings->menu.wallpaper.opacity);
}
menu_display_set_alpha(draw->color, video_info->menu_wallpaper_opacity);
if (!draw->texture)
draw->texture = menu_display_white_texture;
@ -537,13 +532,14 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
}
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw)
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
draw->texture = 0;
draw->x = 0;
draw->y = 0;
menu_display_draw_bg(draw, false);
menu_display_draw_bg(draw, video_info, false);
menu_display_draw(draw);
}

View File

@ -26,6 +26,7 @@
#include <gfx/math/matrix_4x4.h>
#include "../file_path_special.h"
#include "../gfx/font_driver.h"
#include "../gfx/video_context_driver.h"
#include "../gfx/video_coord_array.h"
@ -199,7 +200,7 @@ void menu_display_blend_end(void);
void menu_display_font_free(font_data_t *font);
font_data_t *menu_display_font_main_init(menu_display_ctx_font_t *font);
void menu_display_font_bind_block(font_data_t *font, void *block);
bool menu_display_font_flush_block(font_data_t *font);
bool menu_display_font_flush_block(unsigned width, unsigned height, font_data_t *font);
void menu_display_framebuffer_deinit(void);
@ -227,8 +228,8 @@ void menu_display_set_msg_force(bool state);
bool menu_display_get_font_data_init(void);
void menu_display_set_font_data_init(bool state);
bool menu_display_get_update_pending(void);
void menu_display_set_viewport(void);
void menu_display_unset_viewport(void);
void menu_display_set_viewport(unsigned width, unsigned height);
void menu_display_unset_viewport(unsigned width, unsigned height);
bool menu_display_get_framebuffer_dirty_flag(void);
void menu_display_set_framebuffer_dirty_flag(void);
void menu_display_unset_framebuffer_dirty_flag(void);
@ -239,8 +240,13 @@ void menu_display_clear_color(menu_display_ctx_clearcolor_t *color);
void menu_display_draw(menu_display_ctx_draw_t *draw);
void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw);
void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity);
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw);
void menu_display_draw_bg(
menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info,
bool add_opacity);
void menu_display_draw_gradient(
menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info);
void menu_display_draw_quad(int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height,
float *color);

View File

@ -302,6 +302,15 @@ const char *menu_driver_ident(void)
return menu_driver_ctx->ident;
}
void menu_driver_frame(video_frame_info_t *video_info)
{
if (!menu_driver_alive)
return;
if (menu_driver_ctx->frame)
menu_driver_ctx->frame(menu_userdata, video_info);
}
/**
* menu_update_libretro_info:
*
@ -484,12 +493,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_data->state = 0;
break;
case RARCH_MENU_CTL_FRAME:
if (!menu_driver_alive)
return false;
if (menu_driver_ctx->frame)
menu_driver_ctx->frame(menu_userdata);
break;
case RARCH_MENU_CTL_SET_PREVENT_POPULATE:
menu_driver_prevent_populate = true;
break;
@ -883,14 +886,17 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
break;
case RARCH_MENU_CTL_OSK_PTR_AT_POS:
{
unsigned width = 0;
unsigned height = 0;
menu_ctx_pointer_t *point = (menu_ctx_pointer_t*)data;
if (!menu_driver_ctx || !menu_driver_ctx->osk_ptr_at_pos)
{
point->retcode = 0;
return false;
}
video_driver_get_size(&width, &height);
point->retcode = menu_driver_ctx->osk_ptr_at_pos(menu_userdata,
point->x, point->y);
point->x, point->y, width, height);
}
break;
case RARCH_MENU_CTL_BIND_INIT:

View File

@ -99,7 +99,6 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_BLIT_RENDER,
RARCH_MENU_CTL_RENDER,
RARCH_MENU_CTL_RENDER_MESSAGEBOX,
RARCH_MENU_CTL_FRAME,
RARCH_MENU_CTL_SET_PREVENT_POPULATE,
RARCH_MENU_CTL_UNSET_PREVENT_POPULATE,
RARCH_MENU_CTL_IS_PREVENT_POPULATE,
@ -238,7 +237,7 @@ typedef struct menu_ctx_driver
void (*render_messagebox)(void *data, const char *msg);
int (*iterate)(void *data, void *userdata, enum menu_action action);
void (*render)(void *data);
void (*frame)(void *data);
void (*frame)(void *data, video_frame_info_t *video_info);
void* (*init)(void**);
void (*free)(void*);
void (*context_reset)(void *data);
@ -277,7 +276,7 @@ typedef struct menu_ctx_driver
menu_entry_t *entry, unsigned action);
void (*update_thumbnail_path)(void *data, unsigned i);
void (*update_thumbnail_image)(void *data);
int (*osk_ptr_at_pos)(void *data, int x, int y);
int (*osk_ptr_at_pos)(void *data, int x, int y, unsigned width, unsigned height);
void (*update_savestate_thumbnail_path)(void *data, unsigned i);
void (*update_savestate_thumbnail_image)(void *data);
} menu_ctx_driver_t;
@ -390,6 +389,8 @@ bool menu_driver_is_binding_state(void);
void menu_driver_set_binding_state(bool on);
void menu_driver_frame(video_frame_info_t *video_info);
extern menu_ctx_driver_t menu_ctx_xui;
extern menu_ctx_driver_t menu_ctx_rgui;
extern menu_ctx_driver_t menu_ctx_mui;