1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

video_frame_info - start passing flags

This commit is contained in:
libretroadmin 2023-08-16 19:17:04 +02:00
parent 538aa5235c
commit bc41e0fdf4
43 changed files with 810 additions and 823 deletions

View File

@ -122,10 +122,10 @@ static void caca_font_render_msg(
align = TEXT_ALIGN_LEFT;
}
if ( !font->caca
if ( !font->caca
|| !font->caca->cv
|| !font->caca->display
|| !font->caca->cv
|| !font->caca->cv
|| !font->caca->display)
return;
@ -165,7 +165,7 @@ font_renderer_t caca_font = {
NULL /* get_line_metrics */
};
/*
/*
* VIDEO DRIVER
*/
static void caca_create(caca_t *caca)
@ -239,7 +239,7 @@ static bool caca_frame(void *data, const void *frame,
bool draw = true;
caca_t *caca = (caca_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame || !frame_width || !frame_height)

View File

@ -99,7 +99,7 @@ static void ctr_render_overlay(ctr_video_t *ctr);
static void ctr_set_bottom_screen_enable(bool enabled, bool idle);
/*
* DISPLAY DRIVER
* DISPLAY DRIVER
*/
static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
@ -132,7 +132,7 @@ static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
GPUCMD_AddWrite(GPUREG_GSH_BOOLUNIFORM, 0);
ctrGuSetVertexShaderFloatUniform(0, (float*)&scale_vector, 1);
if ((ctr->vertex_cache.size - (ctr->vertex_cache.current
if ((ctr->vertex_cache.size - (ctr->vertex_cache.current
- ctr->vertex_cache.buffer)) < 1)
ctr->vertex_cache.current = ctr->vertex_cache.buffer;
@ -182,8 +182,8 @@ static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
VIRT_TO_PHYS(texture->data),
texture->width,
texture->height,
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
| GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
| GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
| GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE)
| GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
GPU_RGBA8);
@ -191,8 +191,8 @@ static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
GPU_SetViewport(NULL,
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240
? CTR_TOP_FRAMEBUFFER_WIDTH * 2
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240
? CTR_TOP_FRAMEBUFFER_WIDTH * 2
: CTR_TOP_FRAMEBUFFER_WIDTH);
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
@ -226,7 +226,7 @@ gfx_display_ctx_driver_t gfx_display_ctx_ctr = {
};
/*
* FONT DRIVER
* FONT DRIVER
*/
static void* ctr_font_init(void* data, const char* font_path,
@ -285,14 +285,14 @@ static void* ctr_font_init(void* data, const char* font_path,
CTR_SET_SCALE_VECTOR(
vec_top,
CTR_TOP_FRAMEBUFFER_WIDTH,
CTR_TOP_FRAMEBUFFER_WIDTH,
CTR_TOP_FRAMEBUFFER_HEIGHT,
font->texture.width,
font->texture.height);
CTR_SET_SCALE_VECTOR(
vec_bottom,
CTR_BOTTOM_FRAMEBUFFER_WIDTH,
CTR_BOTTOM_FRAMEBUFFER_WIDTH,
CTR_BOTTOM_FRAMEBUFFER_HEIGHT,
font->texture.width,
font->texture.height);
@ -376,7 +376,7 @@ static void ctr_font_render_line(
break;
case TEXT_ALIGN_CENTER:
x += width / 2 -
x += width / 2 -
ctr_font_get_message_width(font, msg, msg_len, scale) / 2;
break;
}
@ -633,7 +633,7 @@ font_renderer_t ctr_font =
};
/*
* VIDEO DRIVER
* VIDEO DRIVER
*/
static INLINE void ctr_check_3D_slider(ctr_video_t* ctr, ctr_video_mode_enum video_mode)
@ -835,7 +835,7 @@ static const char *ctr_texture_path(unsigned id)
static char texture_path[PATH_MAX_LENGTH];
char state_path[PATH_MAX_LENGTH];
if (!runloop_get_current_savestate_path(state_path,
if (!runloop_get_current_savestate_path(state_path,
sizeof(state_path)))
return NULL;
@ -851,7 +851,7 @@ static const char *ctr_texture_path(unsigned id)
}
return NULL;
}
}
static void ctr_update_state_date(void *data)
{
@ -884,7 +884,7 @@ static bool ctr_update_state_date_from_file(void *data)
#else
if (sdmc_getmtime( state_path + 5, &mtime) != 0)
goto error;
#endif
#endif
ctr->state_data_exist = true;
@ -896,7 +896,7 @@ static bool ctr_update_state_date_from_file(void *data)
#endif
snprintf(ctr->state_date, sizeof(ctr->state_date), "%02d/%02d/%d",
t->tm_mon + 1, t->tm_mday, t->tm_year + 1900);
return true;
error:
@ -936,14 +936,14 @@ static void ctr_state_thumbnail_geom(void *data)
o->frame_coords->v1 = texture->active_height;
x_offset = 184;
y_offset = 46 +
y_offset = 46 +
(target_height - texture->active_height * scale) / 2;
o->frame_coords->x0 = x_offset;
o->frame_coords->y0 = y_offset;
o->frame_coords->x1 = o->frame_coords->x0
o->frame_coords->x1 = o->frame_coords->x0
+ texture->active_width * scale;
o->frame_coords->y1 = o->frame_coords->y0
o->frame_coords->y1 = o->frame_coords->y0
+ texture->active_height * scale;
vec = &o->scale_vector;
@ -1058,7 +1058,7 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
hidTouchRead(&state_tmp_touch);
if (!state_tmp)
{
if ( !ctr->bottom_check_idle
if ( !ctr->bottom_check_idle
&& !ctr->bottom_is_idle)
{
ctr->idle_timestamp = svcGetSystemTick();
@ -1115,12 +1115,12 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
else if ((state_tmp_touch.px > 8)
&& (state_tmp_touch.px < 164)
&& (state_tmp_touch.py > 99)
&& (state_tmp_touch.py < 230))
&& (state_tmp_touch.py < 230))
{
struct ctr_bottom_texture_data *o =
&ctr->bottom_textures[CTR_TEXTURE_STATE_THUMBNAIL];
ctr_texture_t *texture =
ctr_texture_t *texture =
(ctr_texture_t *) o->texture;
if (texture)
@ -1139,11 +1139,11 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
texture->active_height = ctr->frame_coords->v1;
texture->data = linearAlloc(
ctr->texture_width * ctr->texture_height *
ctr->texture_width * ctr->texture_height *
(ctr->rgb32? 4:2));
memcpy(texture->data, ctr->texture_swizzled,
ctr->texture_width * ctr->texture_height *
memcpy(texture->data, ctr->texture_swizzled,
ctr->texture_width * ctr->texture_height *
(ctr->rgb32? 4:2));
ctr_state_thumbnail_geom(ctr);
@ -1179,7 +1179,7 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
&& (state_tmp_touch.px < 311)
&& (state_tmp_touch.py > 9)
&& (state_tmp_touch.py < 230)
&& ctr->state_data_exist)
&& ctr->state_data_exist)
{
if (!command_event(CMD_EVENT_LOAD_STATE_FROM_RAM, NULL))
command_event(CMD_EVENT_LOAD_STATE, NULL);
@ -1204,7 +1204,7 @@ static void bottom_menu_control(void* data, bool lcd_bottom)
save_state_to_file(ctr);
ctr->state_slot = config_slot;
o =
o =
&ctr->bottom_textures[CTR_TEXTURE_STATE_THUMBNAIL];
texture = (ctr_texture_t *)o->texture;
@ -1338,8 +1338,8 @@ static void ctr_render_bottom_screen(void *data)
VIRT_TO_PHYS(texture->data),
texture->width,
texture->height,
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
| GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
| GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
| GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE)
| GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
colorType);
@ -1362,7 +1362,7 @@ static void ctr_render_bottom_screen(void *data)
{
params.x = 0.266f;
params.y = 0.64f;
font_driver_render_msg_bottom(ctr,
font_driver_render_msg_bottom(ctr,
msg_hash_to_str(
MSG_3DS_BOTTOM_MENU_NO_STATE_THUMBNAIL),
&params);
@ -1372,14 +1372,14 @@ static void ctr_render_bottom_screen(void *data)
{
params.x = 0.266f;
params.y = 0.64f;
font_driver_render_msg_bottom(ctr,
font_driver_render_msg_bottom(ctr,
msg_hash_to_str(
MSG_3DS_BOTTOM_MENU_NO_STATE_DATA),
&params);
}
/* draw bottom menu */
o =
o =
&ctr->bottom_textures[CTR_TEXTURE_BOTTOM_MENU];
texture = (ctr_texture_t *)o->texture;
@ -1387,9 +1387,9 @@ static void ctr_render_bottom_screen(void *data)
VIRT_TO_PHYS(texture->data),
texture->width,
texture->height,
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR)
| GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
| GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE)
| GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE)
| GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
GPU_RGBA8);
@ -1603,7 +1603,7 @@ static void ctr_lcd_aptHook(APT_HookType hook, void* param)
ctr_set_parallax_layer(*(float*)0x1FF81080 != 0.0);
ctr_set_bottom_screen_enable(true, ctr->bottom_is_idle);
save_state_to_file(ctr);
break;
break;
case APTHOOK_ONRESTORE:
case APTHOOK_ONWAKEUP:
ctr_set_bottom_screen_enable(false, ctr->bottom_is_idle);
@ -1886,7 +1886,7 @@ static bool ctr_frame(void* data, const void* frame,
unsigned custom_vp_width = video_info->custom_vp_width;
unsigned custom_vp_height = video_info->custom_vp_height;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
@ -1943,7 +1943,7 @@ static bool ctr_frame(void* data, const void* frame,
/* If we are running at the display refresh rate,
* then all is well - just wait on the *current* VBlank0
* event and carry on.
*
*
* If we are running at below the display refresh rate,
* then we have problems: frame updates will happen
* entirely out of sync with VBlank0 events. To elaborate,
@ -1952,7 +1952,7 @@ static bool ctr_frame(void* data, const void* frame,
* 'oh good - let's render the current frame', but the next
* VBlank0 will occur in less time than it takes to draw the
* current frame, resulting in 'overlap' and screen tearing.
*
*
* This seems to be a consequence of using the GPU directly.
* Other 3DS homebrew typically uses the ctrulib function
* gfxSwapBuffers(), which ensures an immediate buffer
@ -1960,19 +1960,19 @@ static bool ctr_frame(void* data, const void* frame,
* instead, we use a variant of the ctrulib function
* gfxSwapBuffersGpu(), which seems to send a notification,
* and the swap happens when it happens...
*
*
* I don't know how to fix this 'properly' (probably needs
* some low level rewriting, maybe switching to an implementation
* based on citro3d), but I can at least implement a hack/workaround
* that allows 50Hz content to be run without tearing. This involves
* the following:
*
*
* If content frame rate is more than 10% lower than the 3DS
* display refresh rate, don't wait on the *current* VBlank0
* event (because it is 'tainted'), but instead wait on the
* *next* VBlank0 event (which will ensure we have enough time
* to write/flush the display buffers).
*
*
* This fixes screen tearing, but it has a significant impact on
* performance...
* */
@ -2173,8 +2173,8 @@ static bool ctr_frame(void* data, const void* frame,
GPU_SetViewport(NULL,
VIRT_TO_PHYS(ctr->drawbuffers.top.left),
0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT,
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240
? CTR_TOP_FRAMEBUFFER_WIDTH * 2
ctr->video_mode == CTR_VIDEO_MODE_2D_800X240
? CTR_TOP_FRAMEBUFFER_WIDTH * 2
: CTR_TOP_FRAMEBUFFER_WIDTH);
if (ctr->video_mode == CTR_VIDEO_MODE_3D)
@ -2270,7 +2270,7 @@ static bool ctr_frame(void* data, const void* frame,
#endif
#ifndef CONSOLE_LOG
if ( ctr_bottom_screen_enabled
if ( ctr_bottom_screen_enabled
&& (flags & RUNLOOP_FLAG_CORE_RUNNING))
{
if (!ctr->bottom_is_idle)
@ -2360,7 +2360,7 @@ static bool ctr_frame(void* data, const void* frame,
{
gfxScreenSwapBuffers(GFX_BOTTOM,false);
}
#endif
#endif
#else
topFramebufferInfo.
active_framebuf = ctr->current_buffer_top;
@ -2611,7 +2611,7 @@ static uintptr_t ctr_load_texture(void *video_data, void *data,
ctr_texture_t *texture = NULL;
ctr_video_t *ctr = (ctr_video_t*)video_data;
struct texture_image *image = (struct texture_image*)data;
int size = image->width
int size = image->width
* image->height * sizeof(uint32_t);
if ((size * 3) > linearSpaceFree())
@ -2647,13 +2647,13 @@ static uintptr_t ctr_load_texture(void *video_data, void *data,
{
((uint32_t*)texture->data)[ctrgu_swizzle_coords(i, j,
texture->width)] =
((*src << 8) & 0xFF000000)
((*src << 8) & 0xFF000000)
| ((*src << 8) & 0x00FF0000)
| ((*src << 8) & 0x0000FF00)
| ((*src >> 24) & 0x000000FF);
src++;
}
GSPGPU_FlushDataCache(texture->data, texture->width
GSPGPU_FlushDataCache(texture->data, texture->width
* texture->height * sizeof(uint32_t));
}
else
@ -2662,7 +2662,7 @@ static uintptr_t ctr_load_texture(void *video_data, void *data,
uint32_t *src = NULL;
uint32_t *dst = NULL;
tmpdata = linearAlloc(image->width
tmpdata = linearAlloc(image->width
* image->height * sizeof(uint32_t));
if (!tmpdata)
{
@ -2676,8 +2676,8 @@ static uintptr_t ctr_load_texture(void *video_data, void *data,
for (i = 0; i < image->width * image->height; i++)
{
*dst =
((*src << 8) & 0xFF000000)
*dst =
((*src << 8) & 0xFF000000)
| ((*src << 8) & 0x00FF0000)
| ((*src << 8) & 0x0000FF00)
| ((*src >> 24) & 0x000000FF);
@ -2818,8 +2818,8 @@ static bool ctr_overlay_load(void *data,
for (j = 0; j < images[i].width * images[i].height; j++)
{
*dst =
((*src << 8) & 0xFF000000)
*dst =
((*src << 8) & 0xFF000000)
| ((*src << 8) & 0x00FF0000)
| ((*src << 8) & 0x0000FF00)
| ((*src >> 24) & 0x000000FF);

View File

@ -2166,7 +2166,7 @@ static bool d3d10_gfx_frame(
*osd_params = (struct font_params*)
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -2789,7 +2789,7 @@ static bool d3d11_gfx_frame(
unsigned video_height = video_info->height;
bool statistics_show = video_info->statistics_show;
struct font_params* osd_params = (struct font_params*)&video_info->osd_stat_params;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -3210,7 +3210,7 @@ static bool d3d12_gfx_frame(
unsigned video_height = video_info->height;
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -1865,7 +1865,7 @@ static bool d3d8_frame(void *data, const void *frame,
bool statistics_show = video_info->statistics_show;
unsigned black_frame_insertion = video_info->black_frame_insertion;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame)

View File

@ -2032,7 +2032,7 @@ static bool d3d9_cg_frame(void *data, const void *frame,
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -1616,7 +1616,7 @@ static bool d3d9_hlsl_frame(void *data, const void *frame,
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
bool overlay_behind_menu = video_info->overlay_behind_menu;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -438,14 +438,14 @@ static bool dispmanx_frame(void *data, const void *frame, unsigned width,
struct dispmanx_video *_dispvars = data;
float aspect = video_driver_get_aspect_ratio();
unsigned max_swapchain_images = video_info->max_swapchain_images;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
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)

View File

@ -746,11 +746,11 @@ static bool drm_frame(void *data, const void *frame, unsigned width,
{
struct drm_video *_drmvars = data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
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)
@ -770,7 +770,7 @@ static bool drm_frame(void *data, const void *frame, unsigned width,
pitch,
_drmvars->rgb32 ? 4 : 2,
_drmvars->rgb32 ? DRM_FORMAT_XRGB8888 : DRM_FORMAT_RGB565,
255,
255,
_drmvars->current_aspect,
3,
0,

View File

@ -905,7 +905,7 @@ static int exynos_blit_frame(
const void *frame,
unsigned src_pitch)
{
const enum exynos_buffer_type
const enum exynos_buffer_type
buf_type = defaults[EXYNOS_IMAGE_FRAME].buf_type;
const unsigned size = src_pitch * pdata->blit_params[5];
struct g2d_image *src = pdata->src[EXYNOS_IMAGE_FRAME];
@ -1282,8 +1282,7 @@ static bool exynos_frame(void *data, const void *frame, unsigned width,
struct exynos_video *vid = data;
struct exynos_page *page = NULL;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
/* Check if neither menu nor core framebuffer is to be displayed. */
if (!vid->menu_active && !frame)
return true;

View File

@ -1,423 +1,423 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2017 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#define NUMBER_OF_WRITE_FRAMES 1 /* XPAR_AXIVDMA_0_NUM_FSTORES */
#define STORAGE_SIZE NUMBER_OF_WRITE_FRAMES * ((1920*1080)<<2)
#define FRAME_SIZE (STORAGE_SIZE / NUMBER_OF_WRITE_FRAMES)
#define FB_WIDTH 1920
#define FB_HEIGHT 1080
typedef struct RegOp
{
void *ptr;
int fd;
int only_mmap;
int only_munmap;
} RegOp;
typedef struct fpga
{
RegOp regOp; /* ptr alignment */
volatile unsigned *framebuffer;
unsigned char *menu_frame;
unsigned menu_width;
unsigned menu_height;
unsigned menu_pitch;
unsigned video_width;
unsigned video_height;
unsigned video_pitch;
unsigned video_bits;
unsigned menu_bits;
bool rgb32;
} fpga_t;
static unsigned int get_memory_size(void)
{
unsigned int size;
/* this file holds the memory range needed to map the framebuffer into
* kernel address space, it is specified in the device tree
*/
FILE *size_fp = fopen("/sys/class/uio/uio0/maps/map0/size", "r");
if (!size_fp)
{
RARCH_ERR("unable to open the uio size file\n");
exit(1);
}
fscanf(size_fp, "0x%08X", &size);
fclose(size_fp);
return size;
}
static void do_mmap_op(RegOp *regOp)
{
if (regOp->only_munmap == 0)
{
regOp->fd = open("/dev/uio0", O_RDWR);
if (regOp->fd < 1)
return;
regOp->ptr = mmap(NULL, get_memory_size(),
PROT_READ|PROT_WRITE, MAP_SHARED, regOp->fd, 0);
if (regOp->ptr == MAP_FAILED)
{
RARCH_ERR("could not mmap() memory\n");
exit(1);
}
}
if (regOp->only_mmap == 0)
{
if (munmap(regOp->ptr, get_memory_size()) == -1)
{
RARCH_ERR("could not munmap() memory\n");
exit(1);
}
close(regOp->fd);
}
return;
}
static void fpga_create(fpga_t *fpga)
{
memset(&fpga->regOp, 0, sizeof(fpga->regOp));
fpga->regOp.only_mmap = 1;
do_mmap_op(&fpga->regOp);
fpga->framebuffer = ((volatile unsigned*)fpga->regOp.ptr);
}
static void *fpga_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
fpga_t *fpga = (fpga_t*)calloc(1, sizeof(*fpga));
*input = NULL;
*input_data = NULL;
fpga->video_width = video->width;
fpga->video_height = video->height;
fpga->rgb32 = video->rgb32;
fpga->video_bits = video->rgb32 ? 32 : 16;
if (video->rgb32)
fpga->video_pitch = video->width * 4;
else
fpga->video_pitch = video->width * 2;
fpga_create(fpga);
return fpga;
error:
if (fpga)
free(fpga);
return NULL;
}
static bool fpga_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 void *frame_to_copy = frame;
unsigned width = 0;
unsigned height = 0;
bool draw = true;
fpga_t *fpga = (fpga_t*)data;
unsigned bits = fpga->video_bits;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
#endif
if (!frame || !frame_width || !frame_height)
return true;
#ifdef HAVE_MENU
menu_driver_frame(menu_is_alive, video_info);
#endif
if ( fpga->video_width != frame_width ||
fpga->video_height != frame_height ||
fpga->video_pitch != pitch)
{
if (frame_width > 4 && frame_height > 4)
{
fpga->video_width = frame_width;
fpga->video_height = frame_height;
fpga->video_pitch = pitch;
}
}
#ifdef HAVE_MENU
if (fpga->menu_frame && menu_is_alive)
{
frame_to_copy = fpga->menu_frame;
width = fpga->menu_width;
height = fpga->menu_height;
pitch = fpga->menu_pitch;
bits = fpga->menu_bits;
}
else
#endif
{
width = fpga->video_width;
height = fpga->video_height;
pitch = fpga->video_pitch;
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
draw = false;
#ifdef HAVE_MENU
if (menu_is_alive)
draw = false;
#endif
}
if (draw)
{
if (bits == 16)
{
if (frame_to_copy == fpga->menu_frame)
{
/* RGBX4444 color bits for RGUI */
unsigned x, y;
for (y = 0; y < FB_HEIGHT; y++)
{
for (x = 0; x < FB_WIDTH; x++)
{
/* scale incoming frame to fit the screen */
unsigned scaled_x = (width * x) / FB_WIDTH;
unsigned scaled_y = (height * y) / FB_HEIGHT;
unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x];
/* convert RGBX444 to XRGB8888 */
unsigned r = ((pixel & 0xF000) >> 12);
unsigned g = ((pixel & 0x0F00) >> 8);
unsigned b = ((pixel & 0x00F0) >> 4);
fpga->framebuffer[FB_WIDTH * y + x] = (r << 20) | (b << 12) | (g << 4);
}
}
}
else
{
/* RGB565 color bits for core */
unsigned x, y;
for (y = 0; y < FB_HEIGHT; y++)
{
for (x = 0; x < FB_WIDTH; x++)
{
/* scale incoming frame to fit the screen */
unsigned scaled_x = (width * x) / FB_WIDTH;
unsigned scaled_y = (height * y) / FB_HEIGHT;
unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x];
/* convert RGB565 to XRBG8888 */
unsigned r = ((pixel & 0xF800) >> 11);
unsigned g = ((pixel & 0x07E0) >> 5);
unsigned b = ((pixel & 0x001F) >> 0);
fpga->framebuffer[FB_WIDTH * y + x] = (r << 19) | (b << 11) | (g << 2);
}
}
}
}
#if 0
else
{
/* TODO/FIXME: handle 32-bit core output */
}
#endif
}
return true;
}
static void fpga_set_nonblock_state(void *a, bool b, bool c, unsigned d) { }
static bool fpga_alive(void *data) { return true; }
static bool fpga_focus(void *data) { return true; }
static bool fpga_suppress_screensaver(void *data, bool enable) { return false; }
static bool fpga_has_windowed(void *data) { return true; }
static void fpga_free(void *data)
{
fpga_t *fpga = (fpga_t*)data;
if (!fpga)
return;
if (fpga->menu_frame)
free(fpga->menu_frame);
fpga->menu_frame = NULL;
free(fpga);
fpga->regOp.only_mmap = 0;
fpga->regOp.only_munmap = 1;
do_mmap_op(&fpga->regOp);
}
/* TODO/FIXME - implement */
static bool fpga_set_shader(void *data,
enum rarch_shader_type type, const char *path) { return false; }
static void fpga_set_rotation(void *data,
unsigned rotation) { }
static void fpga_set_texture_frame(void *data,
const void *frame, bool rgb32, unsigned width, unsigned height,
float alpha)
{
fpga_t *fpga = (fpga_t*)data;
unsigned pitch = width * 2;
if (fpga->rgb32)
pitch = width * 4;
if (fpga->menu_frame)
free(fpga->menu_frame);
fpga->menu_frame = NULL;
if ( !fpga->menu_frame ||
fpga->menu_width != width ||
fpga->menu_height != height ||
fpga->menu_pitch != pitch)
if (pitch && height)
fpga->menu_frame = (unsigned char*)malloc(pitch * height);
if (fpga->menu_frame && frame && pitch && height)
{
memcpy(fpga->menu_frame, frame, pitch * height);
fpga->menu_width = width;
fpga->menu_height = height;
fpga->menu_pitch = pitch;
fpga->menu_bits = fpga->rgb32 ? 32 : 16;
}
}
/* TODO/FIXME - implement */
static void fpga_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font) { }
static void fpga_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len) { }
static void fpga_get_video_output_prev(void *data) { }
static void fpga_get_video_output_next(void *data) { }
static void fpga_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen) { }
static const video_poke_interface_t fpga_poke_interface = {
NULL, /* get_flags */
NULL, /* load_texture */
NULL, /* unload_texture */
fpga_set_video_mode,
NULL, /* get_refresh_rate */
NULL, /* set_filtering */
fpga_get_video_output_size,
fpga_get_video_output_prev,
fpga_get_video_output_next,
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
NULL, /* set_aspect_ratio */
NULL, /* apply_state_changes */
#ifdef HAVE_MENU
fpga_set_texture_frame,
NULL, /* set_texture_enable */
fpga_set_osd_msg,
NULL, /* show_mouse */
#else
NULL, /* set_texture_frame */
NULL, /* set_texture_enable */
NULL, /* set_osd_msg */
NULL, /* show_mouse */
#endif
NULL, /* grab_mouse_toggle */
NULL, /* get_current_shader */
NULL, /* get_current_software_framebuffer */
NULL, /* get_hw_render_interface */
NULL, /* set_hdr_max_nits */
NULL, /* set_hdr_paper_white_nits */
NULL, /* set_hdr_contrast */
NULL /* set_hdr_expand_gamut */
};
static void fpga_get_poke_interface(void *data,
const video_poke_interface_t **iface)
{
(void)data;
*iface = &fpga_poke_interface;
}
/* TODO/FIXME - implement */
static void fpga_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
video_driver_t video_fpga = {
fpga_init,
fpga_frame,
fpga_set_nonblock_state,
fpga_alive,
fpga_focus,
fpga_suppress_screensaver,
fpga_has_windowed,
fpga_set_shader,
fpga_free,
"fpga",
fpga_set_viewport,
fpga_set_rotation,
NULL, /* viewport_info */
NULL, /* read_viewport */
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
NULL, /* get_overlay_interface */
#endif
fpga_get_poke_interface,
NULL, /* wrap_type_to_enum */
#ifdef HAVE_GFX_WIDGETS
NULL /* gfx_widgets_enabled */
#endif
};
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2017 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
#endif
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#define NUMBER_OF_WRITE_FRAMES 1 /* XPAR_AXIVDMA_0_NUM_FSTORES */
#define STORAGE_SIZE NUMBER_OF_WRITE_FRAMES * ((1920*1080)<<2)
#define FRAME_SIZE (STORAGE_SIZE / NUMBER_OF_WRITE_FRAMES)
#define FB_WIDTH 1920
#define FB_HEIGHT 1080
typedef struct RegOp
{
void *ptr;
int fd;
int only_mmap;
int only_munmap;
} RegOp;
typedef struct fpga
{
RegOp regOp; /* ptr alignment */
volatile unsigned *framebuffer;
unsigned char *menu_frame;
unsigned menu_width;
unsigned menu_height;
unsigned menu_pitch;
unsigned video_width;
unsigned video_height;
unsigned video_pitch;
unsigned video_bits;
unsigned menu_bits;
bool rgb32;
} fpga_t;
static unsigned int get_memory_size(void)
{
unsigned int size;
/* this file holds the memory range needed to map the framebuffer into
* kernel address space, it is specified in the device tree
*/
FILE *size_fp = fopen("/sys/class/uio/uio0/maps/map0/size", "r");
if (!size_fp)
{
RARCH_ERR("unable to open the uio size file\n");
exit(1);
}
fscanf(size_fp, "0x%08X", &size);
fclose(size_fp);
return size;
}
static void do_mmap_op(RegOp *regOp)
{
if (regOp->only_munmap == 0)
{
regOp->fd = open("/dev/uio0", O_RDWR);
if (regOp->fd < 1)
return;
regOp->ptr = mmap(NULL, get_memory_size(),
PROT_READ|PROT_WRITE, MAP_SHARED, regOp->fd, 0);
if (regOp->ptr == MAP_FAILED)
{
RARCH_ERR("could not mmap() memory\n");
exit(1);
}
}
if (regOp->only_mmap == 0)
{
if (munmap(regOp->ptr, get_memory_size()) == -1)
{
RARCH_ERR("could not munmap() memory\n");
exit(1);
}
close(regOp->fd);
}
return;
}
static void fpga_create(fpga_t *fpga)
{
memset(&fpga->regOp, 0, sizeof(fpga->regOp));
fpga->regOp.only_mmap = 1;
do_mmap_op(&fpga->regOp);
fpga->framebuffer = ((volatile unsigned*)fpga->regOp.ptr);
}
static void *fpga_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
fpga_t *fpga = (fpga_t*)calloc(1, sizeof(*fpga));
*input = NULL;
*input_data = NULL;
fpga->video_width = video->width;
fpga->video_height = video->height;
fpga->rgb32 = video->rgb32;
fpga->video_bits = video->rgb32 ? 32 : 16;
if (video->rgb32)
fpga->video_pitch = video->width * 4;
else
fpga->video_pitch = video->width * 2;
fpga_create(fpga);
return fpga;
error:
if (fpga)
free(fpga);
return NULL;
}
static bool fpga_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 void *frame_to_copy = frame;
unsigned width = 0;
unsigned height = 0;
bool draw = true;
fpga_t *fpga = (fpga_t*)data;
unsigned bits = fpga->video_bits;
#ifdef HAVE_MENU
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame || !frame_width || !frame_height)
return true;
#ifdef HAVE_MENU
menu_driver_frame(menu_is_alive, video_info);
#endif
if ( (fpga->video_width != frame_width)
|| (fpga->video_height != frame_height)
|| (fpga->video_pitch != pitch))
{
if (frame_width > 4 && frame_height > 4)
{
fpga->video_width = frame_width;
fpga->video_height = frame_height;
fpga->video_pitch = pitch;
}
}
#ifdef HAVE_MENU
if (fpga->menu_frame && menu_is_alive)
{
frame_to_copy = fpga->menu_frame;
width = fpga->menu_width;
height = fpga->menu_height;
pitch = fpga->menu_pitch;
bits = fpga->menu_bits;
}
else
#endif
{
width = fpga->video_width;
height = fpga->video_height;
pitch = fpga->video_pitch;
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
draw = false;
#ifdef HAVE_MENU
if (menu_is_alive)
draw = false;
#endif
}
if (draw)
{
if (bits == 16)
{
if (frame_to_copy == fpga->menu_frame)
{
/* RGBX4444 color bits for RGUI */
unsigned x, y;
for (y = 0; y < FB_HEIGHT; y++)
{
for (x = 0; x < FB_WIDTH; x++)
{
/* scale incoming frame to fit the screen */
unsigned scaled_x = (width * x) / FB_WIDTH;
unsigned scaled_y = (height * y) / FB_HEIGHT;
unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x];
/* convert RGBX444 to XRGB8888 */
unsigned r = ((pixel & 0xF000) >> 12);
unsigned g = ((pixel & 0x0F00) >> 8);
unsigned b = ((pixel & 0x00F0) >> 4);
fpga->framebuffer[FB_WIDTH * y + x] = (r << 20) | (b << 12) | (g << 4);
}
}
}
else
{
/* RGB565 color bits for core */
unsigned x, y;
for (y = 0; y < FB_HEIGHT; y++)
{
for (x = 0; x < FB_WIDTH; x++)
{
/* scale incoming frame to fit the screen */
unsigned scaled_x = (width * x) / FB_WIDTH;
unsigned scaled_y = (height * y) / FB_HEIGHT;
unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x];
/* convert RGB565 to XRBG8888 */
unsigned r = ((pixel & 0xF800) >> 11);
unsigned g = ((pixel & 0x07E0) >> 5);
unsigned b = ((pixel & 0x001F) >> 0);
fpga->framebuffer[FB_WIDTH * y + x] = (r << 19) | (b << 11) | (g << 2);
}
}
}
}
#if 0
else
{
/* TODO/FIXME: handle 32-bit core output */
}
#endif
}
return true;
}
static void fpga_set_nonblock_state(void *a, bool b, bool c, unsigned d) { }
static bool fpga_alive(void *data) { return true; }
static bool fpga_focus(void *data) { return true; }
static bool fpga_suppress_screensaver(void *data, bool enable) { return false; }
static bool fpga_has_windowed(void *data) { return true; }
static void fpga_free(void *data)
{
fpga_t *fpga = (fpga_t*)data;
if (!fpga)
return;
if (fpga->menu_frame)
free(fpga->menu_frame);
fpga->menu_frame = NULL;
free(fpga);
fpga->regOp.only_mmap = 0;
fpga->regOp.only_munmap = 1;
do_mmap_op(&fpga->regOp);
}
/* TODO/FIXME - implement */
static bool fpga_set_shader(void *data,
enum rarch_shader_type type, const char *path) { return false; }
static void fpga_set_rotation(void *data,
unsigned rotation) { }
static void fpga_set_texture_frame(void *data,
const void *frame, bool rgb32, unsigned width, unsigned height,
float alpha)
{
fpga_t *fpga = (fpga_t*)data;
unsigned pitch = width * 2;
if (fpga->rgb32)
pitch = width * 4;
if (fpga->menu_frame)
free(fpga->menu_frame);
fpga->menu_frame = NULL;
if ( !fpga->menu_frame ||
fpga->menu_width != width ||
fpga->menu_height != height ||
fpga->menu_pitch != pitch)
if (pitch && height)
fpga->menu_frame = (unsigned char*)malloc(pitch * height);
if (fpga->menu_frame && frame && pitch && height)
{
memcpy(fpga->menu_frame, frame, pitch * height);
fpga->menu_width = width;
fpga->menu_height = height;
fpga->menu_pitch = pitch;
fpga->menu_bits = fpga->rgb32 ? 32 : 16;
}
}
/* TODO/FIXME - implement */
static void fpga_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font) { }
static void fpga_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len) { }
static void fpga_get_video_output_prev(void *data) { }
static void fpga_get_video_output_next(void *data) { }
static void fpga_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen) { }
static const video_poke_interface_t fpga_poke_interface = {
NULL, /* get_flags */
NULL, /* load_texture */
NULL, /* unload_texture */
fpga_set_video_mode,
NULL, /* get_refresh_rate */
NULL, /* set_filtering */
fpga_get_video_output_size,
fpga_get_video_output_prev,
fpga_get_video_output_next,
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
NULL, /* set_aspect_ratio */
NULL, /* apply_state_changes */
#ifdef HAVE_MENU
fpga_set_texture_frame,
NULL, /* set_texture_enable */
fpga_set_osd_msg,
NULL, /* show_mouse */
#else
NULL, /* set_texture_frame */
NULL, /* set_texture_enable */
NULL, /* set_osd_msg */
NULL, /* show_mouse */
#endif
NULL, /* grab_mouse_toggle */
NULL, /* get_current_shader */
NULL, /* get_current_software_framebuffer */
NULL, /* get_hw_render_interface */
NULL, /* set_hdr_max_nits */
NULL, /* set_hdr_paper_white_nits */
NULL, /* set_hdr_contrast */
NULL /* set_hdr_expand_gamut */
};
static void fpga_get_poke_interface(void *data,
const video_poke_interface_t **iface)
{
(void)data;
*iface = &fpga_poke_interface;
}
/* TODO/FIXME - implement */
static void fpga_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate) { }
video_driver_t video_fpga = {
fpga_init,
fpga_frame,
fpga_set_nonblock_state,
fpga_alive,
fpga_focus,
fpga_suppress_screensaver,
fpga_has_windowed,
fpga_set_shader,
fpga_free,
"fpga",
fpga_set_viewport,
fpga_set_rotation,
NULL, /* viewport_info */
NULL, /* read_viewport */
NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY
NULL, /* get_overlay_interface */
#endif
fpga_get_poke_interface,
NULL, /* wrap_type_to_enum */
#ifdef HAVE_GFX_WIDGETS
NULL /* gfx_widgets_enabled */
#endif
};

View File

@ -597,7 +597,7 @@ static bool gdi_frame(void *data, const void *frame,
unsigned bits = gdi->video_bits;
HWND hwnd = win32_get_window();
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
/* FIXME: Force these settings off as they interfere with the rendering */
@ -612,9 +612,9 @@ static bool gdi_frame(void *data, const void *frame,
menu_driver_frame(menu_is_alive, video_info);
#endif
if ( gdi->video_width != frame_width ||
gdi->video_height != frame_height ||
gdi->video_pitch != pitch)
if ( (gdi->video_width != frame_width)
|| (gdi->video_height != frame_height)
|| (gdi->video_pitch != pitch))
{
if (frame_width > 4 && frame_height > 4)
{

View File

@ -15,13 +15,13 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
/* OpenGL 1.x driver.
/* OpenGL 1.x driver.
*
* Minimum version : OpenGL 1.1 (1997)
*
* We are targeting a minimum of OpenGL 1.1 and the Microsoft
* We are targeting a minimum of OpenGL 1.1 and the Microsoft
* "GDI Generic" * software GL implementation.
* Any additional features added for later 1.x versions should only be
* Any additional features added for later 1.x versions should only be
* enabled if they are detected at runtime. */
#include <stddef.h>
@ -260,7 +260,7 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw,
sizeof(float) * 2);
vertices3[i * 3 + 2] = 0.0f;
}
glVertexPointer(3, GL_FLOAT, 0, vertices3);
glVertexPointer(3, GL_FLOAT, 0, vertices3);
}
#else
glVertexPointer(2, GL_FLOAT, 0, draw->coords->vertex);
@ -503,7 +503,7 @@ static void gl1_raster_font_draw_vertices(
vertices3[i*3+2] = 0.0f;
}
}
glVertexPointer(3, GL_FLOAT, 0, vertices3);
glVertexPointer(3, GL_FLOAT, 0, vertices3);
#else
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
#endif
@ -1171,7 +1171,7 @@ static void *gl1_init(const video_info_t *video,
memcpy(gl1->tex_info.coord, gl1_tex_coords, sizeof(gl1->tex_info.coord));
gl1->vertex_ptr = hwr->bottom_left_origin
? gl1_vertexes
? gl1_vertexes
: gl1_vertexes_flipped;
gl1->textures = 4;
gl1->white_color_ptr = gl1_white_color;
@ -1347,14 +1347,14 @@ static void gl1_draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, i
float norm_width = (1.0f / (float)pot_width) * (float)width;
float norm_height = (1.0f / (float)pot_height) * (float)height;
float texcoords[] = {
0.0f, 0.0f,
0.0f, 0.0f,
0.0f, 0.0f,
0.0f, 0.0f
};
texcoords[1] = texcoords[5] = norm_height;
texcoords[4] = texcoords[6] = norm_width;
@ -1447,17 +1447,17 @@ static void gl1_draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, i
if (gl1->rotation && tex == gl1->tex)
glRotatef(gl1->rotation, 0.0f, 0.0f, 1.0f);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glColorPointer(4, GL_FLOAT, 0, colors);
glVertexPointer(3, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
@ -1500,7 +1500,7 @@ static bool gl1_frame(void *data, const void *frame,
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
@ -1539,7 +1539,7 @@ static bool gl1_frame(void *data, const void *frame,
&& (frame_width < width && frame_height < height))
)
draw = false;
do_swap = frame || draw;
if ( (gl1->video_width != frame_width)
@ -1554,7 +1554,7 @@ static bool gl1_frame(void *data, const void *frame,
pot_width = GET_POT(frame_width);
pot_height = GET_POT(frame_height);
if (draw)
{
if (gl1->video_buf)
@ -1606,7 +1606,7 @@ static bool gl1_frame(void *data, const void *frame,
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (frame_to_copy)
gl1_draw_tex(gl1, pot_width, pot_height,
width, height, gl1->tex, frame_to_copy);
@ -1730,22 +1730,22 @@ static bool gl1_frame(void *data, const void *frame,
video_info->black_frame_insertion
&& !video_info->input_driver_nonblock_state
&& !video_info->runloop_is_slowmotion
&& !video_info->runloop_is_paused
&& !video_info->runloop_is_paused
&& !(gl1->flags & GL1_FLAG_MENU_TEXTURE_ENABLE))
{
int n;
for (n = 0; n < (int)video_info->black_frame_insertion; ++n)
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT);
if (gl1->ctx_driver->swap_buffers)
gl1->ctx_driver->swap_buffers(gl1->ctx_data);
}
}
#endif
}
}
#endif
/* check if we are fast forwarding or in menu,
/* check if we are fast forwarding or in menu,
if we are ignore hard sync */
if ( hard_sync
&& !video_info->input_driver_nonblock_state
@ -1962,9 +1962,9 @@ static void gl1_set_texture_frame(void *data,
if (gl1->menu_frame)
free(gl1->menu_frame);
/* FIXME? We have to assume the pitch has no
* extra padding in it because that will
* mess up the POT calculation when we don't
/* FIXME? We have to assume the pitch has no
* extra padding in it because that will
* mess up the POT calculation when we don't
* know how many bpp there are. */
gl1->menu_frame = (unsigned char*)malloc(pitch * height);
}
@ -2062,20 +2062,20 @@ static void gl1_load_texture_data(
glTexImage2D(GL_TEXTURE_2D,
0,
(use_rgba || !rgb32)
? GL_RGBA
(use_rgba || !rgb32)
? GL_RGBA
: RARCH_GL1_INTERNAL_FORMAT32,
width,
height,
0,
(use_rgba || !rgb32)
? GL_RGBA
(use_rgba || !rgb32)
? GL_RGBA
: RARCH_GL1_TEXTURE_TYPE32,
#ifdef MSB_FIRST
GL_UNSIGNED_INT_8_8_8_8_REV,
#else
rgb32
? RARCH_GL1_FORMAT32
? RARCH_GL1_FORMAT32
: GL_UNSIGNED_BYTE,
#endif
frame);
@ -2155,7 +2155,7 @@ static void gl1_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
gl1->flags |= (GL1_FLAG_KEEP_ASPECT | GL1_FLAG_SHOULD_RESIZE);
}
static void gl1_unload_texture(void *data,
static void gl1_unload_texture(void *data,
bool threaded, uintptr_t id)
{
GLuint glid;

View File

@ -3440,7 +3440,7 @@ static bool gl2_frame(void *data, const void *frame,
&video_info->osd_stat_params;
const char *stat_text = video_info->stat_text;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -2519,7 +2519,7 @@ static bool gl3_frame(void *data, const void *frame,
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
bool input_driver_nonblock_state = video_info->input_driver_nonblock_state;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -375,7 +375,7 @@ static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw,
v = wiiu->vertex_cache.v + wiiu->vertex_cache.current;
v->pos.x = draw->x;
v->pos.y = wiiu->color_buffer.surface.height -
v->pos.y = wiiu->color_buffer.surface.height -
draw->y - draw->height;
v->pos.width = draw->width;
v->pos.height = draw->height;
@ -410,7 +410,7 @@ static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw,
GX2SetVertexUniformBlock(sprite_shader.vs.uniformBlocks[1].offset,
sprite_shader.vs.uniformBlocks[1].size,
wiiu->ubo_tex);
GX2SetAttribBuffer(0, wiiu->vertex_cache.size
GX2SetAttribBuffer(0, wiiu->vertex_cache.size
* sizeof(*wiiu->vertex_cache.v),
sizeof(*wiiu->vertex_cache.v),
wiiu->vertex_cache.v);
@ -555,7 +555,7 @@ static void* gx2_font_init(void* data, const char* font_path,
font->texture.surface.alignment);
for (i = 0; (i < font->atlas->height) && (i < font->texture.surface.height); i++)
memcpy((uint8_t*)font->texture.surface.image
memcpy((uint8_t*)font->texture.surface.image
+ (i * font->texture.surface.pitch),
font->atlas->buffer + (i * font->atlas->width),
font->atlas->width);
@ -702,7 +702,7 @@ static void gx2_font_render_line(
if (font->atlas->dirty)
{
for (i = 0; (i < font->atlas->height) && (i < font->texture.surface.height); i++)
memcpy(font->texture.surface.image
memcpy(font->texture.surface.image
+ (i * font->texture.surface.pitch),
font->atlas->buffer + (i * font->atlas->width),
font->atlas->width);
@ -748,7 +748,7 @@ static void gx2_font_render_message(
size_t msg_len = delim ? (delim - msg) : strlen(msg);
/* Draw the line */
if ((wiiu->vertex_cache.current + (msg_len * 4)
if ((wiiu->vertex_cache.current + (msg_len * 4)
<= wiiu->vertex_cache.size))
gx2_font_render_line(wiiu,
font,
@ -1310,7 +1310,7 @@ static void *gx2_init(const video_info_t *video,
gx2_fake_context.get_flags = gx2_get_flags;
video_context_driver_set(&gx2_fake_context);
video_context_driver_set(&gx2_fake_context);
shader_preset = video_shader_get_current_shader_preset();
type = video_shader_parse_type(shader_preset);
@ -1655,7 +1655,7 @@ static bool wiiu_init_frame_textures(wiiu_video_t *wiiu, unsigned width, unsigne
#if 0
wiiu->pass[i].texture.surface.mipLevels = 1;
#endif
wiiu->pass[i].texture.surface.format =
wiiu->pass[i].texture.surface.format =
(pass->fbo.flags & FBO_SCALE_FLAG_FP_FBO)
? GX2_SURFACE_FORMAT_FLOAT_R32_G32_B32_A32
: (pass->fbo.flags & FBO_SCALE_FLAG_SRGB_FBO)
@ -1880,7 +1880,7 @@ static bool gx2_frame(void *data, const void *frame,
uint32_t i;
wiiu_video_t *wiiu = (wiiu_video_t *) data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
@ -2204,11 +2204,11 @@ static bool gx2_frame(void *data, const void *frame,
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
wiiu->vertex_cache.v,
wiiu->vertex_cache.current
wiiu->vertex_cache.current
* sizeof(*wiiu->vertex_cache.v));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER,
wiiu->vertex_cache_tex.v,
wiiu->vertex_cache_tex.current
wiiu->vertex_cache_tex.current
* sizeof(*wiiu->vertex_cache_tex.v));
if (wiiu->menu.enable)
@ -2300,7 +2300,7 @@ static uintptr_t gx2_load_texture(void *video_data, void *data,
texture->surface.imageSize, texture->surface.alignment);
for (i = 0; (i < image->height) && (i < texture->surface.height); i++)
memcpy((uint32_t *)texture->surface.image
memcpy((uint32_t *)texture->surface.image
+ (i * texture->surface.pitch),
image->pixels + (i * image->width),
image->width * sizeof(image->pixels));
@ -2312,7 +2312,7 @@ static uintptr_t gx2_load_texture(void *video_data, void *data,
return (uintptr_t)texture;
}
static void gx2_unload_texture(void *data,
static void gx2_unload_texture(void *data,
bool threaded, uintptr_t handle)
{
GX2Texture *texture = (GX2Texture *)handle;

View File

@ -463,8 +463,8 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
while (gx_is_valid_yorigin(gx_mode.viYOrigin+(gx->yOriginPos+1)))
gx->yOriginPos++;
gx_mode.xfbMode = (modetype == VI_INTERLACE)
? VI_XFBMODE_DF
gx_mode.xfbMode = (modetype == VI_INTERLACE)
? VI_XFBMODE_DF
: VI_XFBMODE_SF;
gx_mode.field_rendering = GX_FALSE;
gx_mode.aa = GX_FALSE;
@ -671,9 +671,9 @@ static void init_texture(gx_video_t *gx, unsigned width, unsigned height,
fb_pitch = p_disp->framebuf_pitch;
GX_InitTexObj(fb_ptr, g_tex.data, width, height,
(gx->rgb32)
? GX_TF_RGBA8
: gx->menu_texture_enable
(gx->rgb32)
? GX_TF_RGBA8
: gx->menu_texture_enable
? GX_TF_RGB5A3
: GX_TF_RGB565,
GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -1072,7 +1072,7 @@ static void gx_resize(gx_video_t *gx,
|| (overscan_corr_bottom > 0))
{
float current_aspect = (float)width / (float)height;
int new_height = height -
int new_height = height -
(overscan_corr_top +
overscan_corr_bottom);
int new_width = (int)((new_height * current_aspect) + 0.5f);
@ -1247,7 +1247,7 @@ static void gx_set_rotation(void *data, unsigned orientation)
if (!gx)
return;
gx->orientation = orientation;
gx->should_resize = true;
}
@ -1465,7 +1465,7 @@ static bool gx_overlay_load(void *data,
static void gx_overlay_enable(void *data, bool state)
{
gx_video_t *gx = (gx_video_t*)data;
if (gx)
gx->overlay_enable = state;
}
@ -1473,7 +1473,7 @@ static void gx_overlay_enable(void *data, bool state)
static void gx_overlay_full_screen(void *data, bool enable)
{
gx_video_t *gx = (gx_video_t*)data;
if (gx)
gx->overlay_full_screen = enable;
}
@ -1492,7 +1492,7 @@ static void gx_render_overlay(void *data)
gx_video_t *gx = (gx_video_t*)data;
if (!gx)
return;
GX_SetCurrentMtx(GX_PNMTX1);
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
@ -1589,7 +1589,7 @@ static bool gx_frame(void *data, const void *frame,
bool video_smooth = settings->bools.video_smooth;
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
bool fps_show = video_info->fps_show;

View File

@ -1062,7 +1062,7 @@ font_renderer_t metal_raster_font = {
- (void)_drawMenu:(video_frame_info_t *)video_info
{
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
if (!_menu.enabled)
return;

View File

@ -171,7 +171,7 @@ static bool network_gfx_frame(void *data, const void *frame,
bool draw = true;
network_video_t *network = (network_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame || !frame_width || !frame_height)
@ -233,8 +233,8 @@ static bool network_gfx_frame(void *data, const void *frame,
network_video_temp_buf = (unsigned*)
malloc(
network->screen_width
* network->screen_height
network->screen_width
* network->screen_height
* sizeof(unsigned));
}
@ -257,14 +257,14 @@ static bool network_gfx_frame(void *data, const void *frame,
unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x];
/* convert RGBX4444 to RGBX8888 */
unsigned r = ((pixel & 0xF000) << 8)
unsigned r = ((pixel & 0xF000) << 8)
| ((pixel & 0xF000) << 4);
unsigned g = ((pixel & 0x0F00) << 4)
unsigned g = ((pixel & 0x0F00) << 4)
| ((pixel & 0x0F00) << 0);
unsigned b = ((pixel & 0x00F0) << 0)
unsigned b = ((pixel & 0x00F0) << 0)
| ((pixel & 0x00F0) >> 4);
network_video_temp_buf[network->screen_width * y + x]
network_video_temp_buf[network->screen_width * y + x]
= 0xFF000000 | b | g | r;
}
}

View File

@ -547,10 +547,13 @@ static bool oga_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)
{
oga_video_t *vid = (oga_video_t*)data;
oga_framebuf_t* page = vid->pages[vid->cur_page];
oga_video_t *vid = (oga_video_t*)data;
oga_framebuf_t* page = vid->pages[vid->cur_page];
oga_surface_t *page_surface = page->surface;
float aspect_ratio = video_driver_get_aspect_ratio();
float aspect_ratio = video_driver_get_aspect_ratio();
#ifdef HAVE_MENU
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (unlikely(!frame || width == 0 || height == 0))
return true;
@ -569,7 +572,22 @@ static bool oga_frame(void *data, const void *frame, unsigned width,
rga_clear_surface(page_surface, 0);
if (likely(!video_info->menu_is_alive))
#ifdef HAVE_MENU
if (menu_is_alive)
{
oga_rect_t r;
menu_driver_frame(true, video_info);
width = vid->menu_surface->width;
height = vid->menu_surface->height;
aspect_ratio = (float)width / height;
oga_calc_bounds(&r, vid->drm_width, vid->drm_height, width, height, aspect_ratio, vid->display_ar);
oga_blit(vid->menu_surface, 0, 0, width, height,
page_surface, r.y, r.x, r.h, r.w, HAL_TRANSFORM_ROT_270, vid->scale_mode, 0);
}
else
#endif
{
uint8_t* src = (uint8_t*)frame;
uint8_t* dst = (uint8_t*)vid->frame_surface->map;
@ -581,7 +599,8 @@ static bool oga_frame(void *data, const void *frame, unsigned width,
int dst_pitch = vid->frame_surface->pitch;
int yy = height;
while (yy > 0) {
while (yy > 0)
{
memcpy(dst, src, pitch);
src += pitch;
dst += dst_pitch;
@ -593,22 +612,6 @@ static bool oga_frame(void *data, const void *frame, unsigned width,
oga_blit(vid->frame_surface, 0, 0, width, height,
page_surface, r.y, r.x, r.h, r.w, vid->rotation, vid->scale_mode, blend);
}
#ifdef HAVE_MENU
else
{
menu_driver_frame(true, video_info);
width = vid->menu_surface->width;
height = vid->menu_surface->height;
aspect_ratio = (float)width / height;
oga_rect_t r;
oga_calc_bounds(&r, vid->drm_width, vid->drm_height, width, height, aspect_ratio, vid->display_ar);
oga_blit(vid->menu_surface, 0, 0, width, height,
page_surface, r.y, r.x, r.h, r.w, HAL_TRANSFORM_ROT_270, vid->scale_mode, 0);
}
#endif
if (msg)
{

View File

@ -979,7 +979,7 @@ static bool omap_frame(void *data, const void *frame, unsigned width,
{
omap_video_t *vid = (omap_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame)
@ -1019,7 +1019,7 @@ static bool omap_frame(void *data, const void *frame, unsigned width,
return true;
}
static void omap_set_nonblock_state(void *data, bool state,
static void omap_set_nonblock_state(void *data, bool state,
bool adaptive_vsync_enabled, unsigned swap_interval)
{
omap_video_t *vid;

View File

@ -429,7 +429,7 @@ static void *psp_init(const video_info_t *video,
else
{
u16 i;
video_driver_state_t *video_st = video_state_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
uint16_t* LUT_r_local = (uint16_t*)(SCEGU_VRAM_BP_2);
uint16_t* LUT_b_local = (uint16_t*)(SCEGU_VRAM_BP_2) + (1 << 5);
@ -550,9 +550,9 @@ 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)
{
psp1_video_t *psp = (psp1_video_t*)data;
psp1_video_t *psp = (psp1_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!width || !height)
@ -566,7 +566,7 @@ static bool psp_frame(void *data, const void *frame,
if (!psp->hw_render)
sceGuSync(0, 0); /* let the core decide when to sync when HW_RENDER */
if (msg)
if (msg)
{
pspDebugScreenSetBase(psp->draw_buffer);
pspDebugScreenSetXY(0,0);

View File

@ -698,7 +698,7 @@ static void rsx_font_render_message(rsx_t *rsx,
}
static void rsx_font_setup_viewport(
rsx_t *rsx, rsx_font_t *font,
rsx_t *rsx, rsx_font_t *font,
unsigned width, unsigned height,
bool full_screen)
{
@ -787,7 +787,7 @@ static void rsx_font_render_msg(
rsx_font_setup_viewport(rsx, font, width, height, full_screen);
if ( !string_is_empty(msg)
&& font->font_data
&& font->font_data
&& font->font_driver)
{
if (drop_x || drop_y)
@ -902,11 +902,11 @@ static void rsx_load_texture_data(rsx_t* rsx, rsx_texture_t *texture,
texbuffer = (u8*)texture->data;
memcpy(texbuffer, data, height * pitch);
texture->tex.format = (rgb32
texture->tex.format = (rgb32
? GCM_TEXTURE_FORMAT_A8R8G8B8 :
(menu)
? GCM_TEXTURE_FORMAT_A4R4G4B4
: GCM_TEXTURE_FORMAT_R5G6B5)
? GCM_TEXTURE_FORMAT_A4R4G4B4
: GCM_TEXTURE_FORMAT_R5G6B5)
| GCM_TEXTURE_FORMAT_LIN;
texture->tex.mipmap = 1;
texture->tex.dimension = GCM_TEXTURE_DIMS_2D;
@ -1094,7 +1094,7 @@ static const gfx_ctx_driver_t* rsx_get_context(rsx_t* rsx)
enum gfx_ctx_api api = GFX_CTX_RSX_API;
rsx->shared_context_use = (video_shared_context && (hwr->context_type != RETRO_HW_CONTEXT_NONE));
if ((runloop_get_flags() & RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT)
&& (hwr->context_type != RETRO_HW_CONTEXT_NONE))
rsx->shared_context_use = true;
@ -1102,7 +1102,7 @@ static const gfx_ctx_driver_t* rsx_get_context(rsx_t* rsx)
gfx_ctx = video_context_driver_init_first(rsx,
settings->arrays.video_context_driver,
api, 1, 0, rsx->shared_context_use, &ctx_data);
if (ctx_data)
rsx->ctx_data = ctx_data;
@ -1204,7 +1204,7 @@ static gcmContextData *rsx_init_screen(rsx_t* gcm)
if (!host_addr)
goto error;
/* Initialise Reality, which sets up the
/* Initialise Reality, which sets up the
* command buffer and shared I/O memory */
#ifdef NV40TCL_RENDER_ENABLE
/* There was an API breakage on 2020-07-10, let's
@ -1254,7 +1254,7 @@ static gcmContextData *rsx_init_screen(rsx_t* gcm)
gcm->depth_pitch = res.width * sizeof(u32);
gcm->depth_buffer = (u32 *)rsxMemalign(64, (res.height * gcm->depth_pitch)); /* Beware, if was (res.height * gcm->depth_pitch) * 2 */
rsxAddressToOffset(gcm->depth_buffer, &gcm->depth_offset);
gcmResetFlipStatus();
@ -2163,7 +2163,7 @@ static bool rsx_frame(void* data, const void* frame,
bool statistics_show = video_info->statistics_show;
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
@ -2195,10 +2195,10 @@ static bool rsx_frame(void* data, const void* frame,
rsx_load_texture_data(gcm,
&gcm->texture[gcm->tex_index],
frame, width, height, pitch, gcm->rgb32, false,
gcm->smooth
? TEXTURE_FILTER_LINEAR
gcm->smooth
? TEXTURE_FILTER_LINEAR
: TEXTURE_FILTER_NEAREST);
/* TODO/FIXME - pipeline ID being used here is RSX_SHADER_MENU,
/* TODO/FIXME - pipeline ID being used here is RSX_SHADER_MENU,
* shouldn't this be RSX_SHADER_STOCK_BLEND instead? */
rsx_set_texture(gcm, &gcm->texture[gcm->tex_index]);
rsx_draw_vertices(gcm);
@ -2211,7 +2211,7 @@ static bool rsx_frame(void* data, const void* frame,
menu_driver_frame(menu_is_alive, video_info);
if (gcm->menu_texture.data)
{
/* TODO/FIXME - pipeline ID being used here
/* TODO/FIXME - pipeline ID being used here
* is RSX_SHADER_STOCK_BLEND, shouldn't
* this be RSX_SHADER_MENU instead? */
rsx_set_menu_texture(gcm, &gcm->menu_texture);

View File

@ -476,9 +476,9 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
char title[128];
sdl2_video_t *vid = (sdl2_video_t*)data;
sdl2_video_t *vid = (sdl2_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (vid->flags & SDL2_FLAG_SHOULD_RESIZE)

View File

@ -422,9 +422,9 @@ static void *sdl_dingux_gfx_init(const video_info_t *video,
settings->uints.video_dingux_ipu_filter_type;
const char *input_drv_name = settings->arrays.input_driver;
const char *joypad_drv_name = settings->arrays.input_joypad_driver;
uint32_t surface_flags = (video->vsync) ?
(SDL_HWSURFACE | SDL_TRIPLEBUF | SDL_FULLSCREEN) :
(SDL_HWSURFACE | SDL_FULLSCREEN);
uint32_t surface_flags = (video->vsync)
? (SDL_HWSURFACE | SDL_TRIPLEBUF | SDL_FULLSCREEN)
: (SDL_HWSURFACE | SDL_FULLSCREEN);
/* Initialise graphics subsystem, if required */
if (sdl_subsystem_flags == 0)
@ -445,13 +445,15 @@ static void *sdl_dingux_gfx_init(const video_info_t *video,
dingux_ipu_set_downscaling_enable(true);
dingux_ipu_set_scaling_mode(ipu_keep_aspect, ipu_integer_scaling);
dingux_ipu_set_filter_type(ipu_filter_type);
vid->ff_frame_time_min = 16667;
#if defined(DINGUX_BETA)
/* Get current refresh rate */
refresh_rate_valid = dingux_get_video_refresh_rate(&current_refresh_rate);
refresh_rate_valid = dingux_get_video_refresh_rate(&current_refresh_rate);
/* Check if refresh rate needs to be updated */
if (!refresh_rate_valid ||
(current_refresh_rate != target_refresh_rate))
if ( !refresh_rate_valid
|| (current_refresh_rate != target_refresh_rate))
hw_refresh_rate = dingux_set_video_refresh_rate(target_refresh_rate);
else
{
@ -475,19 +477,9 @@ static void *sdl_dingux_gfx_init(const video_info_t *video,
}
vid->refresh_rate = target_refresh_rate;
switch (target_refresh_rate)
{
case DINGUX_REFRESH_RATE_50HZ:
vid->ff_frame_time_min = 20000;
break;
default:
vid->ff_frame_time_min = 16667;
break;
}
if (target_refresh_rate == DINGUX_REFRESH_RATE_50HZ)
vid->ff_frame_time_min = 20000;
driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &hw_refresh_rate);
#else
vid->ff_frame_time_min = 16667;
#endif
vid->screen = SDL_SetVideoMode(
@ -524,8 +516,8 @@ static void *sdl_dingux_gfx_init(const video_info_t *video,
vid->osd_font = bitmapfont_get_lut();
if (!vid->osd_font ||
vid->osd_font->glyph_max <
if ( !vid->osd_font
|| vid->osd_font->glyph_max <
(SDL_DINGUX_NUM_FONT_GLYPHS - 1))
{
RARCH_ERR("[SDL1]: Failed to init OSD font\n");
@ -621,9 +613,9 @@ static void sdl_dingux_set_output(
{
unsigned sanitized_width;
unsigned sanitized_height;
uint32_t surface_flags = (vid->vsync) ?
(SDL_HWSURFACE | SDL_TRIPLEBUF | SDL_FULLSCREEN) :
(SDL_HWSURFACE | SDL_FULLSCREEN);
uint32_t surface_flags = (vid->vsync)
? (SDL_HWSURFACE | SDL_TRIPLEBUF | SDL_FULLSCREEN)
: (SDL_HWSURFACE | SDL_FULLSCREEN);
/* Cache set parameters */
vid->frame_width = width;
@ -765,6 +757,9 @@ static bool sdl_dingux_gfx_frame(void *data, const void *frame,
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
sdl_dingux_video_t* vid = (sdl_dingux_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
/* Return early if:
* - Input sdl_dingux_video_t struct is NULL
@ -796,7 +791,7 @@ static bool sdl_dingux_gfx_frame(void *data, const void *frame,
}
#ifdef HAVE_MENU
menu_driver_frame(video_info->menu_is_alive, video_info);
menu_driver_frame(menu_is_alive, video_info);
#endif
if (likely(!vid->menu_active))
@ -804,9 +799,9 @@ static bool sdl_dingux_gfx_frame(void *data, const void *frame,
/* Update video mode if we were in the menu on
* the previous frame, or width/height have changed */
if (unlikely(
vid->was_in_menu ||
(vid->frame_width != width) ||
(vid->frame_height != height)))
vid->was_in_menu
|| (vid->frame_width != width)
|| (vid->frame_height != height)))
sdl_dingux_set_output(vid, width, height, vid->rgb32);
/* Must always lock SDL surface before
@ -878,11 +873,8 @@ static bool sdl_dingux_gfx_frame(void *data, const void *frame,
static void sdl_dingux_set_texture_enable(void *data, bool state, bool full_screen)
{
sdl_dingux_video_t *vid = (sdl_dingux_video_t*)data;
if (unlikely(!vid))
return;
vid->menu_active = state;
if (vid)
vid->menu_active = state;
}
static void sdl_dingux_set_texture_frame(void *data, const void *frame, bool rgb32,
@ -891,10 +883,10 @@ static void sdl_dingux_set_texture_frame(void *data, const void *frame, bool rgb
sdl_dingux_video_t *vid = (sdl_dingux_video_t*)data;
if (unlikely(
!vid ||
rgb32 ||
(width > SDL_DINGUX_MENU_WIDTH) ||
(height > SDL_DINGUX_MENU_HEIGHT)))
!vid
|| rgb32
|| (width > SDL_DINGUX_MENU_WIDTH)
|| (height > SDL_DINGUX_MENU_HEIGHT)))
return;
memcpy(vid->menu_texture, frame, width * height * sizeof(uint16_t));
@ -972,21 +964,13 @@ static bool sdl_dingux_gfx_alive(void *data)
return !vid->quitting;
}
static bool sdl_dingux_gfx_focus(void *data)
{
return true;
}
static bool sdl_dingux_gfx_focus(void *data) { return true; }
static bool sdl_dingux_gfx_has_windowed(void *data) { return false; }
static bool sdl_dingux_gfx_suppress_screensaver(void *data, bool enable)
{
return false;
}
static bool sdl_dingux_gfx_has_windowed(void *data)
{
return false;
}
static void sdl_dingux_gfx_viewport_info(void *data, struct video_viewport *vp)
{
sdl_dingux_video_t *vid = (sdl_dingux_video_t*)data;
@ -1050,15 +1034,15 @@ static void sdl_dingux_apply_state_changes(void *data)
return;
/* Update IPU scaling mode, if required */
if ((vid->keep_aspect != ipu_keep_aspect) ||
(vid->integer_scaling != ipu_integer_scaling))
if ( (vid->keep_aspect != ipu_keep_aspect)
|| (vid->integer_scaling != ipu_integer_scaling))
{
unsigned sanitized_width;
unsigned sanitized_height;
unsigned current_width = vid->frame_width;
unsigned current_height = vid->frame_height;
unsigned screen_width = vid->screen->w;
unsigned screen_height = vid->screen->h;
unsigned sanitized_width;
unsigned sanitized_height;
dingux_ipu_set_scaling_mode(ipu_keep_aspect, ipu_integer_scaling);
vid->keep_aspect = ipu_keep_aspect;
@ -1071,17 +1055,14 @@ static void sdl_dingux_apply_state_changes(void *data)
current_width, current_height,
&sanitized_width, &sanitized_height);
if ((screen_width != sanitized_width) ||
(screen_height != sanitized_height))
if ( (screen_width != sanitized_width)
|| (screen_height != sanitized_height))
sdl_dingux_set_output(vid,
current_width, current_height, vid->rgb32);
}
}
static uint32_t sdl_dingux_get_flags(void *data)
{
return 0;
}
static uint32_t sdl_dingux_get_flags(void *data) { return 0; }
static const video_poke_interface_t sdl_dingux_poke_interface = {
sdl_dingux_get_flags,

View File

@ -187,7 +187,7 @@ static void sdl_render_msg(
if (glyph_height > max_height)
glyph_height = max_height;
out = (uint32_t*)buffer->pixels + base_y
out = (uint32_t*)buffer->pixels + base_y
* (buffer->pitch >> 2) + base_x;
for (y = 0; y < glyph_height; y++, src += atlas->width, out += buffer->pitch >> 2)
@ -203,7 +203,7 @@ static void sdl_render_msg(
unsigned out_r = (r * (256 - blend) + vid->font_r * blend) >> 8;
unsigned out_g = (g * (256 - blend) + vid->font_g * blend) >> 8;
unsigned out_b = (b * (256 - blend) + vid->font_b * blend) >> 8;
out[x] = (out_r << rshift) |
out[x] = (out_r << rshift) |
(out_g << gshift) |
(out_b << bshift);
}
@ -363,9 +363,9 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
char title[128];
sdl_video_t *vid = (sdl_video_t*)data;
sdl_video_t *vid = (sdl_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!vid)
@ -397,12 +397,12 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
vid->screen->pitch,
width,
height,
pitch);
pitch);
if (SDL_MUSTLOCK(vid->screen))
SDL_UnlockSurface(vid->screen);
if (msg)
sdl_render_msg(vid, vid->screen,
msg, vid->screen->w, vid->screen->h, vid->screen->format,

View File

@ -1069,6 +1069,9 @@ static bool sdl_rs90_gfx_frame(void *data, const void *frame,
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
sdl_rs90_video_t* vid = (sdl_rs90_video_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
/* Return early if:
* - Input sdl_rs90_video_t struct is NULL
@ -1100,7 +1103,7 @@ static bool sdl_rs90_gfx_frame(void *data, const void *frame,
}
#ifdef HAVE_MENU
menu_driver_frame(video_info->menu_is_alive, video_info);
menu_driver_frame(menu_is_alive, video_info);
#endif
if (likely(!vid->menu_active))

View File

@ -326,7 +326,7 @@ static bool sixel_gfx_frame(void *data, const void *frame,
bool draw = true;
sixel_t *sixel = (sixel_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame || !frame_width || !frame_height)

View File

@ -772,7 +772,7 @@ static bool sunxi_frame(void *data, const void *frame, unsigned width,
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (_dispvars->src_width != width || _dispvars->src_height != height)

View File

@ -55,7 +55,7 @@
#include "../../tasks/tasks_internal.h"
#endif
/*
/*
* DISPLAY DRIVER
*/
@ -90,7 +90,7 @@ gfx_display_ctx_driver_t gfx_display_ctx_switch = {
NULL /* scissor_end */
};
/*
/*
* FONT DRIVER
*/
@ -363,7 +363,7 @@ font_renderer_t switch_font =
switch_font_get_line_metrics
};
/*
/*
* VIDEO DRIVER
*/
@ -670,9 +670,9 @@ static bool switch_frame(void *data, const void *frame,
uint32_t *out_buffer = NULL;
bool ffwd_mode = video_info->input_driver_nonblock_state;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
struct font_params
struct font_params
*osd_params = (struct font_params *)&video_info->osd_stat_params;
bool statistics_show = video_info->statistics_show;
@ -686,8 +686,8 @@ static bool switch_frame(void *data, const void *frame,
return true;
}
if ( sw->should_resize ||
width != sw->last_width ||
if ( sw->should_resize ||
width != sw->last_width ||
height != sw->last_height)
{
switch_update_viewport(sw, video_info);
@ -701,8 +701,8 @@ static bool switch_frame(void *data, const void *frame,
sw->scaler.in_width = width;
sw->scaler.in_height = height;
sw->scaler.in_stride = pitch;
sw->scaler.in_fmt = sw->rgb32
? SCALER_FMT_ARGB8888
sw->scaler.in_fmt = sw->rgb32
? SCALER_FMT_ARGB8888
: SCALER_FMT_RGB565;
if (!sw->smooth)

View File

@ -411,10 +411,10 @@ static bool vg_frame(void *data, const void *frame,
unsigned width = video_info->width;
unsigned height = video_info->height;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if ( frame_width != vg->mRenderWidth
if ( frame_width != vg->mRenderWidth
|| frame_height != vg->mRenderHeight
|| vg->should_resize)
{

View File

@ -220,7 +220,7 @@ static bool vga_gfx_frame(void *data, const void *frame,
bool draw = true;
vga_t *vga = (vga_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
if (!frame || !frame_width || !frame_height)
@ -230,9 +230,9 @@ static bool vga_gfx_frame(void *data, const void *frame,
menu_driver_frame(menu_is_alive, video_info);
#endif
if ( vga->vga_video_width != frame_width ||
vga->vga_video_height != frame_height ||
vga->vga_video_pitch != pitch)
if ( (vga->vga_video_width != frame_width)
|| (vga->vga_video_height != frame_height)
|| (vga->vga_video_pitch != pitch))
{
if (frame_width > 4 && frame_height > 4)
{

View File

@ -624,21 +624,18 @@ static bool vita2d_frame(void *data, const void *frame,
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
void *tex_p;
vita_video_t *vita = (vita_video_t *)data;
vita_video_t *vita = (vita_video_t *)data;
unsigned temp_width = PSP_FB_WIDTH;
unsigned temp_height = PSP_FB_HEIGHT;
vita2d_video_mode_data video_mode_data = {0};
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;
bool widgets_active = video_info->widgets_active;
#endif
bool statistics_show = video_info->statistics_show;
struct font_params
*osd_params = (struct font_params*)
&video_info->osd_stat_params;
bool statistics_show = video_info->statistics_show;
struct font_params *osd_params = (struct font_params*)&video_info->osd_stat_params;
if (frame)
{

View File

@ -4072,7 +4072,7 @@ static bool vulkan_frame(void *data, const void *frame,
struct font_params *osd_params = (struct font_params*)
&video_info->osd_stat_params;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
#ifdef HAVE_GFX_WIDGETS
bool widgets_active = video_info->widgets_active;

View File

@ -200,16 +200,14 @@ static bool xenon360_frame(void *data,
unsigned stride_in, stride_out, copy_size;
xenos_t *xenos = (xenos_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
DrawVerticeFormats *Rect = NULL;
ScreenUv[UV_TOP] = ((float) (width) / (float) XE_W)*2;
ScreenUv[UV_LEFT] = ((float) (height) / (float) XE_H)*2;
Rect = Xe_VB_Lock(xenos->device, xenos->vb,
DrawVerticeFormats *Rect = Xe_VB_Lock(xenos->device, xenos->vb,
0, 3 * sizeof(DrawVerticeFormats), XE_LOCK_WRITE);
ScreenUv[UV_TOP] = ((float)(width) / (float)XE_W) * 2;
ScreenUv[UV_LEFT] = ((float)(height) / (float)XE_H) * 2;
/* Bottom left */
Rect[1].v = ScreenUv[UV_LEFT];
Rect[2].u = ScreenUv[UV_TOP];

View File

@ -117,7 +117,7 @@ static void *xshm_init(const video_info_t *video,
if (input && input_data)
{
settings_t *settings = config_get_ptr();
void *xinput = input_driver_init_wrap(&input_x,
void *xinput = input_driver_init_wrap(&input_x,
settings->arrays.input_joypad_driver);
if (xinput)
{
@ -141,7 +141,7 @@ static bool xshm_frame(void *data, const void *frame, unsigned width,
unsigned y;
xshm_t *xshm = (xshm_t*)data;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
#endif
for (y = 0; y < height; y++)

View File

@ -1017,19 +1017,18 @@ static bool xv_frame(void *data, const void *frame, unsigned width,
XWindowAttributes target;
xv_t *xv = (xv_t*)data;
bool rgb32 = video_info->use_rgba;
#ifdef HAVE_MENU
bool menu_is_alive = video_info->menu_is_alive;
bool menu_is_alive = (video_info->menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false;
menu_driver_frame(menu_is_alive, video_info);
if (menu_is_alive && xv->tex_frame)
{
frame = xv->tex_frame;
width = xv->tex_width;
frame = xv->tex_frame;
width = xv->tex_width;
height = xv->tex_height;
pitch = xv->tex_pitch;
rgb32 = xv->tex_rgb32;
pitch = xv->tex_pitch;
rgb32 = xv->tex_rgb32;
}
#endif

View File

@ -32,6 +32,10 @@
#include "gfx_widgets.h"
#include "font_driver.h"
#ifdef HAVE_MENU
#include "../menu/menu_defines.h"
#endif
#include "../configuration.h"
#include "../file_path_special.h"
#include "../msg_hash.h"
@ -44,7 +48,7 @@
#define MSG_QUEUE_FONT_SIZE (BASE_FONT_SIZE * 0.69f)
/* Icons */
static const char
static const char
*gfx_widgets_icons_names[MENU_WIDGETS_ICON_LAST] = {
"menu_pause.png",
"menu_frameskip.png",
@ -111,7 +115,7 @@ static float gfx_display_get_widget_pixel_scale(
float menu_widget_scale_factor_fullscreen = settings->floats.menu_widget_scale_factor;
float menu_widget_scale_factor_windowed = settings->floats.menu_widget_scale_factor_windowed;
float menu_widget_scale_factor = fullscreen
? menu_widget_scale_factor_fullscreen
? menu_widget_scale_factor_fullscreen
: menu_widget_scale_factor_windowed;
#endif
float menu_scale_factor = menu_widget_scale_factor;
@ -265,13 +269,13 @@ void gfx_widgets_msg_queue_push(
else
{
/* Compute rect width, wrap if necessary */
/* Single line text > two lines text > two lines
/* Single line text > two lines text > two lines
* text with expanded width */
size_t title_length = strlen(title);
char *msg = NULL;
size_t msg_len = 0;
unsigned width = menu_is_alive
? p_dispwidget->msg_queue_default_rect_width_menu_alive
unsigned width = menu_is_alive
? p_dispwidget->msg_queue_default_rect_width_menu_alive
: p_dispwidget->msg_queue_default_rect_width;
unsigned text_width = font_driver_get_message_width(
p_dispwidget->gfx_widget_fonts.msg_queue.font,
@ -308,7 +312,7 @@ void gfx_widgets_msg_queue_push(
msg_widget->msg = msg;
msg_widget->msg_len = strlen(msg);
msg_widget->width = width +
msg_widget->width = width +
p_dispwidget->simple_widget_padding / 2;
}
@ -429,7 +433,7 @@ static void gfx_widgets_msg_queue_move(dispgfx_widget_t *p_dispwidget)
int i;
float y = 0;
/* there should always be one and only one unfolded message */
disp_widget_msg_t *unfold = NULL;
disp_widget_msg_t *unfold = NULL;
#ifdef HAVE_THREADS
slock_lock(p_dispwidget->current_msgs_lock);
@ -442,7 +446,7 @@ static void gfx_widgets_msg_queue_move(dispgfx_widget_t *p_dispwidget)
if (!msg || (msg->flags & DISPWIDG_FLAG_DYING))
continue;
y += p_dispwidget->msg_queue_height
y += p_dispwidget->msg_queue_height
/ (msg->task_ptr ? 2 : 1) + p_dispwidget->msg_queue_spacing;
if (!(msg->flags & DISPWIDG_FLAG_UNFOLDED))
@ -483,8 +487,8 @@ static void gfx_widgets_msg_queue_free(
/* remove the reference the task has of ourself
only if the task is not finished already
(finished tasks are freed before the widget) */
if ( !(msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
&& !(msg->flags & DISPWIDG_FLAG_TASK_ERROR)
if ( !(msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
&& !(msg->flags & DISPWIDG_FLAG_TASK_ERROR)
&& !(msg->flags & DISPWIDG_FLAG_TASK_CANCELLED))
msg->task_ptr->frontend_userdata = NULL;
@ -566,7 +570,7 @@ static void gfx_widgets_msg_queue_kill(
entry.tag = (uintptr_t)msg;
entry.userdata = NULL;
entry.subject = &msg->offset_y;
entry.target_value = msg->offset_y -
entry.target_value = msg->offset_y -
p_dispwidget->msg_queue_height / 4;
gfx_animation_push(&entry);
@ -741,7 +745,7 @@ static void gfx_widgets_font_init(
bool is_threaded, char *font_path, float font_size)
{
int glyph_width = 0;
float scaled_size = font_size *
float scaled_size = font_size *
p_dispwidget->last_scale_factor;
/* Free existing font */
@ -836,7 +840,7 @@ static void gfx_widgets_layout(
if (p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS)
{
#if 0
p_dispwidget->msg_queue_icon_size_y = p_dispwidget->msg_queue_height
p_dispwidget->msg_queue_icon_size_y = p_dispwidget->msg_queue_height
* 1.2347826087f; /* original image is 280x284 */
p_dispwidget->msg_queue_icon_size_x = 0.98591549295f * p_dispwidget->msg_queue_icon_size_y;
#else
@ -867,7 +871,7 @@ static void gfx_widgets_layout(
p_dispwidget->msg_queue_task_text_start_x = p_dispwidget->msg_queue_task_rect_start_x + p_dispwidget->msg_queue_height / 2;
if (!p_dispwidget->gfx_widgets_icons_textures[MENU_WIDGETS_ICON_HOURGLASS])
p_dispwidget->msg_queue_task_text_start_x -=
p_dispwidget->msg_queue_task_text_start_x -=
p_dispwidget->gfx_widget_fonts.msg_queue.glyph_width * 2.0f;
p_dispwidget->msg_queue_regular_text_start = p_dispwidget->msg_queue_rect_start_x;
@ -878,7 +882,7 @@ static void gfx_widgets_layout(
p_dispwidget->msg_queue_default_rect_width_menu_alive = p_dispwidget
->gfx_widget_fonts.msg_queue.glyph_width * 40.0f;
p_dispwidget->msg_queue_default_rect_width = p_dispwidget->last_video_width
p_dispwidget->msg_queue_default_rect_width = p_dispwidget->last_video_width
- p_dispwidget->msg_queue_regular_text_start - (2 * p_dispwidget->simple_widget_padding);
p_dispwidget->divider_width_1px = 1;
@ -1026,8 +1030,8 @@ void gfx_widgets_iterate(
if (!msg_widget)
continue;
if (msg_widget->task_ptr
&& ((msg_widget->flags & DISPWIDG_FLAG_TASK_FINISHED)
if (msg_widget->task_ptr
&& ((msg_widget->flags & DISPWIDG_FLAG_TASK_FINISHED)
|| (msg_widget->flags & DISPWIDG_FLAG_TASK_CANCELLED)))
if (!(msg_widget->flags & DISPWIDG_FLAG_EXPIRATION_TIMER_STARTED))
gfx_widgets_start_msg_expiration_timer(msg_widget, TASK_FINISHED_DURATION);
@ -1046,10 +1050,10 @@ static int gfx_widgets_draw_indicator(
dispgfx_widget_t *p_dispwidget,
gfx_display_t *p_disp,
gfx_display_ctx_driver_t *dispctx,
void *userdata,
void *userdata,
unsigned video_width,
unsigned video_height,
uintptr_t icon, int y, int top_right_x_advance,
uintptr_t icon, int y, int top_right_x_advance,
enum msg_hash_enums msg)
{
unsigned width;
@ -1101,7 +1105,7 @@ static int gfx_widgets_draw_indicator(
width = font_driver_get_message_width(
p_dispwidget->gfx_widget_fonts.regular.font,
txt,
strlen(txt), 1.0f)
strlen(txt), 1.0f)
+ p_dispwidget->simple_widget_padding * 2;
gfx_display_draw_quad(
@ -1117,9 +1121,9 @@ static int gfx_widgets_draw_indicator(
gfx_widgets_draw_text(&p_dispwidget->gfx_widget_fonts.regular,
txt,
top_right_x_advance - width
top_right_x_advance - width
+ p_dispwidget->simple_widget_padding,
y + (height / 2.0f) +
y + (height / 2.0f) +
p_dispwidget->gfx_widget_fonts.regular.line_centre_offset,
video_width, video_height,
0xFFFFFFFF, TEXT_ALIGN_LEFT,
@ -1139,11 +1143,11 @@ static void gfx_widgets_draw_task_msg(
unsigned video_height)
{
/* Color of first progress bar in a task message */
static float msg_queue_task_progress_1[16] =
static float msg_queue_task_progress_1[16] =
COLOR_HEX_TO_FLOAT(0x397869, 1.0f);
/* Color of second progress bar in a task message
/* Color of second progress bar in a task message
* (for multiple tasks with same message) */
static float msg_queue_task_progress_2[16] =
static float msg_queue_task_progress_2[16] =
COLOR_HEX_TO_FLOAT(0x317198, 1.0f);
unsigned text_color;
unsigned bar_width;
@ -1164,9 +1168,9 @@ static void gfx_widgets_draw_task_msg(
if (msg->msg_new)
draw_msg_new = !string_is_equal(msg->msg_new, msg->msg);
task_percentage_offset =
p_dispwidget->gfx_widget_fonts.msg_queue.glyph_width
* ((msg->flags & DISPWIDG_FLAG_TASK_ERROR) ? 12 : 5)
task_percentage_offset =
p_dispwidget->gfx_widget_fonts.msg_queue.glyph_width
* ((msg->flags & DISPWIDG_FLAG_TASK_ERROR) ? 12 : 5)
+ p_dispwidget->simple_widget_padding * 1.25f; /*11 = STRLEN_CONST("Task failed") + 1 */
if (msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
@ -1178,8 +1182,8 @@ static void gfx_widgets_draw_task_msg(
snprintf(task_percentage, sizeof(task_percentage),
"%i%%", msg->task_progress);
rect_width = p_dispwidget->simple_widget_padding
+ msg->width
rect_width = p_dispwidget->simple_widget_padding
+ msg->width
+ task_percentage_offset;
bar_width = rect_width * msg->task_progress/100.0f;
text_color = COLOR_TEXT_ALPHA(0xFFFFFF00, (unsigned)(msg->alpha*255.0f));
@ -1214,7 +1218,7 @@ static void gfx_widgets_draw_task_msg(
/* Progress bar */
if ( !(msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
&& (msg->task_progress >= 0)
&& (msg->task_progress >= 0)
&& (msg->task_progress <= 100))
{
if (msg->task_count == 1)
@ -1254,7 +1258,7 @@ static void gfx_widgets_draw_task_msg(
p_dispwidget->msg_queue_height / 2,
p_dispwidget->gfx_widgets_icons_textures[
(msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
? MENU_WIDGETS_ICON_CHECK
? MENU_WIDGETS_ICON_CHECK
: MENU_WIDGETS_ICON_HOURGLASS],
p_dispwidget->msg_queue_task_hourglass_x,
video_height - msg->offset_y,
@ -1267,9 +1271,9 @@ static void gfx_widgets_draw_task_msg(
dispctx->blend_end(userdata);
/* Text */
text_y_base = video_height
- msg->offset_y
+ p_dispwidget->msg_queue_height / 4.0f
text_y_base = video_height
- msg->offset_y
+ p_dispwidget->msg_queue_height / 4.0f
+ p_dispwidget->gfx_widget_fonts.msg_queue.line_centre_offset;
if (draw_msg_new)
@ -1285,8 +1289,8 @@ static void gfx_widgets_draw_task_msg(
gfx_widgets_draw_text(&p_dispwidget->gfx_widget_fonts.msg_queue,
msg->msg_new,
p_dispwidget->msg_queue_task_text_start_x,
text_y_base
- p_dispwidget->msg_queue_height / 2.0f
text_y_base
- p_dispwidget->msg_queue_height / 2.0f
+ msg->msg_transition_animation,
video_width, video_height,
text_color,
@ -1316,7 +1320,7 @@ static void gfx_widgets_draw_task_msg(
text_color = COLOR_TEXT_ALPHA(0xFFFFFF00, (unsigned)(msg->alpha/2*255.0f));
gfx_widgets_draw_text(&p_dispwidget->gfx_widget_fonts.msg_queue,
task_percentage,
p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x + rect_width -
p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x + rect_width -
p_dispwidget->gfx_widget_fonts.msg_queue.glyph_width,
text_y_base,
video_width, video_height,
@ -1353,7 +1357,7 @@ static void gfx_widgets_draw_regular_msg(
last_alpha = msg->alpha;
}
if ( !(msg->flags & DISPWIDG_FLAG_UNFOLDED)
if ( !(msg->flags & DISPWIDG_FLAG_UNFOLDED)
|| (msg->flags & DISPWIDG_FLAG_UNFOLDING))
{
gfx_widgets_flush_text(video_width, video_height,
@ -1367,8 +1371,8 @@ static void gfx_widgets_draw_regular_msg(
userdata,
video_width, video_height,
p_dispwidget->msg_queue_scissor_start_x, 0,
(p_dispwidget->msg_queue_scissor_start_x + msg->width -
p_dispwidget->simple_widget_padding * 2)
(p_dispwidget->msg_queue_scissor_start_x + msg->width -
p_dispwidget->simple_widget_padding * 2)
* msg->unfold, video_height);
}
@ -1418,7 +1422,7 @@ static void gfx_widgets_draw_regular_msg(
TEXT_ALIGN_LEFT,
true);
if ( !(msg->flags & DISPWIDG_FLAG_UNFOLDED)
if ( !(msg->flags & DISPWIDG_FLAG_UNFOLDED)
|| (msg->flags & DISPWIDG_FLAG_UNFOLDING))
{
gfx_widgets_flush_text(video_width, video_height, &p_dispwidget->gfx_widget_fonts.regular);
@ -1486,15 +1490,21 @@ void gfx_widgets_frame(void *data)
bool widgets_is_fastforwarding = video_info->widgets_is_fast_forwarding;
bool widgets_is_rewinding = video_info->widgets_is_rewinding;
bool runloop_is_slowmotion = video_info->runloop_is_slowmotion;
bool menu_screensaver_active = video_info->menu_screensaver_active;
bool notifications_hidden = video_info->notifications_hidden ||
video_info->msg_queue_delay;
#ifdef HAVE_MENU
bool menu_screensaver_active = (video_info->menu_st_flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE) ? true : false;
#endif
bool notifications_hidden = video_info->notifications_hidden || video_info->msg_queue_delay;
int top_right_x_advance = video_width;
p_dispwidget->gfx_widgets_frame_count++;
/* If menu screensaver is active or notifications are hidden, draw nothing */
if (menu_screensaver_active || notifications_hidden)
#ifdef HAVE_MENU
/* If menu screensaver is active, draw nothing */
if (menu_screensaver_active)
return;
#endif
/* If notifications are hidden, draw nothing */
if (notifications_hidden)
return;
if (video_st->current_video && video_st->current_video->set_viewport)
@ -1666,8 +1676,8 @@ void gfx_widgets_frame(void *data)
video_height,
p_dispwidget->gfx_widgets_icons_textures[
MENU_WIDGETS_ICON_PAUSED],
(fps_show
? p_dispwidget->simple_widget_height
(fps_show
? p_dispwidget->simple_widget_height
: 0),
top_right_x_advance,
MSG_PAUSED);
@ -1910,7 +1920,7 @@ static void gfx_widgets_context_reset(
NULL,
NULL);
if ( p_dispwidget->msg_queue_icon
if ( p_dispwidget->msg_queue_icon
&& p_dispwidget->msg_queue_icon_outline
&& p_dispwidget->msg_queue_icon_rect)
p_dispwidget->flags |= DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS;
@ -2124,8 +2134,8 @@ bool gfx_widgets_ai_service_overlay_load(
if (p_dispwidget->ai_service_overlay_state == 0)
{
if (!gfx_display_reset_textures_list_buffer(
&p_dispwidget->ai_service_overlay_texture,
TEXTURE_FILTER_MIPMAP_LINEAR,
&p_dispwidget->ai_service_overlay_texture,
TEXTURE_FILTER_MIPMAP_LINEAR,
(void *) buffer, buffer_len, image_type,
&p_dispwidget->ai_service_overlay_width,
&p_dispwidget->ai_service_overlay_height))

View File

@ -2609,8 +2609,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->memory_update_interval = settings->uints.memory_update_interval;
#ifdef HAVE_MENU
video_info->menu_is_alive = (menu_st->flags & MENU_ST_FLAG_ALIVE) ? true : false;
video_info->menu_screensaver_active = (menu_st->flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE) ? true : false;
video_info->menu_st_flags = menu_st->flags;
video_info->menu_footer_opacity = settings->floats.menu_footer_opacity;
video_info->menu_header_opacity = settings->floats.menu_header_opacity;
video_info->materialui_color_theme = settings->uints.menu_materialui_color_theme;
@ -2627,8 +2626,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->overlay_behind_menu = settings->bools.input_overlay_behind_menu;
video_info->libretro_running = (runloop_st->current_core.flags & RETRO_CORE_FLAG_GAME_LOADED) ? true : false;
#else
video_info->menu_is_alive = false;
video_info->menu_screensaver_active = false;
video_info->menu_st_flags = 0;
video_info->menu_footer_opacity = 0.0f;
video_info->menu_header_opacity = 0.0f;
video_info->materialui_color_theme = 0;
@ -3428,7 +3426,7 @@ void video_driver_frame(const void *data, unsigned width,
* that the next frame update is captured) */
if ( video_info.input_driver_nonblock_state
&& video_info.fastforward_frameskip
&& !(video_info.menu_is_alive
&& !((video_info.menu_st_flags & MENU_ST_FLAG_ALIVE)
|| (last_frame_duped && !!data)))
{
retro_time_t frame_time_accumulator_prev = frame_time_accumulator;
@ -3739,7 +3737,7 @@ void video_driver_frame(const void *data, unsigned width,
msg_entry.category,
msg_entry.prio,
false,
video_info.menu_is_alive
(video_info.menu_st_flags & MENU_ST_FLAG_ALIVE) ? true : false
);
}
/* ...otherwise, just output message via
@ -3901,7 +3899,8 @@ void video_driver_frame(const void *data, unsigned width,
if (video_st->current_video->frame(
video_st->data, data, width, height,
video_st->frame_count, (unsigned)pitch,
video_info.menu_screensaver_active || video_info.notifications_hidden ? "" : video_driver_msg,
((video_info.menu_st_flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE) > 0)
|| video_info.notifications_hidden ? "" : video_driver_msg,
&video_info))
video_st->flags |= VIDEO_FLAG_ACTIVE;
else
@ -3916,7 +3915,7 @@ void video_driver_frame(const void *data, unsigned width,
|| video_info.memory_show
|| video_info.core_status_msg_show
)
&& !video_info.menu_screensaver_active
&& !((video_info.menu_st_flags & MENU_ST_FLAG_SCREENSAVER_ACTIVE))
&& !video_info.notifications_hidden
)
{

View File

@ -450,6 +450,8 @@ typedef struct video_frame_info
bool full_screen;
} osd_stat_params;
uint16_t menu_st_flags;
char stat_text[1024];
bool widgets_active;
@ -483,8 +485,6 @@ typedef struct video_frame_info
bool runloop_is_slowmotion;
bool runloop_is_paused;
bool fastforward_frameskip;
bool menu_is_alive;
bool menu_screensaver_active;
bool msg_bgcolor_enable;
bool crt_switch_hires_menu;
bool hdr_enable;

View File

@ -25,6 +25,54 @@ RETRO_BEGIN_DECLS
#define MENU_SETTINGS_AUDIO_MIXER_MAX_STREAMS (AUDIO_MIXER_MAX_SYSTEM_STREAMS-1)
enum menu_state_flags
{
MENU_ST_FLAG_ALIVE = (1 << 0),
MENU_ST_FLAG_IS_BINDING = (1 << 1),
MENU_ST_FLAG_INP_DLG_KB_DISPLAY = (1 << 2),
/* When enabled, on next iteration the 'Quick Menu'
* list will be pushed onto the stack */
MENU_ST_FLAG_PENDING_QUICK_MENU = (1 << 3),
MENU_ST_FLAG_PREVENT_POPULATE = (1 << 4),
/* The menu driver owns the userdata */
MENU_ST_FLAG_DATA_OWN = (1 << 5),
/* Flagged when menu entries need to be refreshed */
MENU_ST_FLAG_ENTRIES_NEED_REFRESH = (1 << 6),
MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH = (1 << 7),
/* 'Close Content'-hotkey menu resetting */
MENU_ST_FLAG_PENDING_CLOSE_CONTENT = (1 << 8),
/* Flagged when a core calls RETRO_ENVIRONMENT_SHUTDOWN,
* requiring the menu to be flushed on the next iteration */
MENU_ST_FLAG_PENDING_ENV_SHUTDOWN_FLUSH = (1 << 9),
/* Screensaver status
* - Does menu driver support screensaver functionality?
* - Is screensaver currently active? */
MENU_ST_FLAG_SCREENSAVER_SUPPORTED = (1 << 10),
MENU_ST_FLAG_SCREENSAVER_ACTIVE = (1 << 11)
};
enum menu_scroll_mode
{
MENU_SCROLL_PAGE = 0,
MENU_SCROLL_START_LETTER
};
enum contentless_core_runtime_status
{
CONTENTLESS_CORE_RUNTIME_UNKNOWN = 0,
CONTENTLESS_CORE_RUNTIME_MISSING,
CONTENTLESS_CORE_RUNTIME_VALID
};
enum action_iterate_type
{
ITERATE_TYPE_DEFAULT = 0,
ITERATE_TYPE_HELP,
ITERATE_TYPE_INFO,
ITERATE_TYPE_BIND
};
enum menu_image_type
{
MENU_IMAGE_NONE = 0,
@ -309,7 +357,7 @@ enum xmb_shader_pipeline
XMB_SHADER_PIPELINE_SNOW,
XMB_SHADER_PIPELINE_BOKEH,
XMB_SHADER_PIPELINE_SNOWFLAKE
#endif
#endif
};
enum rgui_thumbnail_scaler

View File

@ -308,53 +308,6 @@ enum menu_settings_type
MENU_SETTINGS_LAST
};
enum menu_state_flags
{
MENU_ST_FLAG_ALIVE = (1 << 0),
MENU_ST_FLAG_IS_BINDING = (1 << 1),
MENU_ST_FLAG_INP_DLG_KB_DISPLAY = (1 << 2),
/* When enabled, on next iteration the 'Quick Menu'
* list will be pushed onto the stack */
MENU_ST_FLAG_PENDING_QUICK_MENU = (1 << 3),
MENU_ST_FLAG_PREVENT_POPULATE = (1 << 4),
/* The menu driver owns the userdata */
MENU_ST_FLAG_DATA_OWN = (1 << 5),
/* Flagged when menu entries need to be refreshed */
MENU_ST_FLAG_ENTRIES_NEED_REFRESH = (1 << 6),
MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH = (1 << 7),
/* 'Close Content'-hotkey menu resetting */
MENU_ST_FLAG_PENDING_CLOSE_CONTENT = (1 << 8),
/* Flagged when a core calls RETRO_ENVIRONMENT_SHUTDOWN,
* requiring the menu to be flushed on the next iteration */
MENU_ST_FLAG_PENDING_ENV_SHUTDOWN_FLUSH = (1 << 9),
/* Screensaver status
* - Does menu driver support screensaver functionality?
* - Is screensaver currently active? */
MENU_ST_FLAG_SCREENSAVER_SUPPORTED = (1 << 10),
MENU_ST_FLAG_SCREENSAVER_ACTIVE = (1 << 11)
};
enum menu_scroll_mode
{
MENU_SCROLL_PAGE = 0,
MENU_SCROLL_START_LETTER
};
enum contentless_core_runtime_status
{
CONTENTLESS_CORE_RUNTIME_UNKNOWN = 0,
CONTENTLESS_CORE_RUNTIME_MISSING,
CONTENTLESS_CORE_RUNTIME_VALID
};
enum action_iterate_type
{
ITERATE_TYPE_DEFAULT = 0,
ITERATE_TYPE_HELP,
ITERATE_TYPE_INFO,
ITERATE_TYPE_BIND
};
struct menu_list
{
file_list_t **menu_stack;
@ -798,12 +751,9 @@ size_t menu_driver_get_thumbnail_system(void *data, char *s, size_t len);
extern const menu_ctx_driver_t *menu_ctx_drivers[];
extern menu_ctx_driver_t menu_ctx_ozone;
extern menu_ctx_driver_t menu_ctx_xui;
extern menu_ctx_driver_t menu_ctx_rgui;
extern menu_ctx_driver_t menu_ctx_mui;
extern menu_ctx_driver_t menu_ctx_xmb;
extern menu_ctx_driver_t menu_ctx_stripes;
RETRO_END_DECLS