mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 02:43:03 +00:00
initial libcaca video driver
This commit is contained in:
parent
b551da1fda
commit
ba54f20626
@ -713,6 +713,16 @@ ifeq ($(HAVE_KMS), 1)
|
||||
LIBS += $(GBM_LIBS) $(DRM_LIBS) $(EGL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CACA), 1)
|
||||
DEFINES += -DHAVE_CACA
|
||||
OBJ += gfx/drivers/caca_gfx.o gfx/drivers_font/caca_font.o
|
||||
LIBS += -lcaca
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/drivers_display/menu_display_caca.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_PLAIN_DRM), 1)
|
||||
OBJ += gfx/drivers/drm_gfx.o
|
||||
CFLAGS += -I/usr/include/libdrm
|
||||
|
36
gfx/common/caca_common.h
Normal file
36
gfx/common/caca_common.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* copyright (c) 2011-2015 - Daniel De Matteis
|
||||
* copyright (c) 2016 - 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __CACA_COMMON_H
|
||||
#define __CACA_COMMON_H
|
||||
|
||||
struct caca_canvas;
|
||||
struct caca_dither;
|
||||
struct caca_display;
|
||||
|
||||
typedef struct caca_canvas caca_canvas_t;
|
||||
typedef struct caca_dither caca_dither_t;
|
||||
typedef struct caca_display caca_display_t;
|
||||
|
||||
typedef struct caca
|
||||
{
|
||||
caca_canvas_t **caca_cv;
|
||||
caca_dither_t **caca_dither;
|
||||
caca_display_t **caca_display;
|
||||
} caca_t;
|
||||
|
||||
#endif
|
355
gfx/drivers/caca_gfx.c
Normal file
355
gfx/drivers/caca_gfx.c
Normal file
@ -0,0 +1,355 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* Copyright (C) 2016 - 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 <retro_miscellaneous.h>
|
||||
#include <caca.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../menu/menu_driver.h"
|
||||
#include "../common/caca_common.h"
|
||||
|
||||
static caca_canvas_t *caca_cv = NULL;
|
||||
static caca_dither_t *caca_dither = NULL;
|
||||
static caca_display_t *caca_display = NULL;
|
||||
static unsigned char *caca_menu_frame = NULL;
|
||||
static unsigned caca_menu_width = 0;
|
||||
static unsigned caca_menu_height = 0;
|
||||
static unsigned caca_menu_pitch = 0;
|
||||
static unsigned caca_video_width = 0;
|
||||
static unsigned caca_video_height = 0;
|
||||
static unsigned caca_video_pitch = 0;
|
||||
static bool caca_rgb32 = 0;
|
||||
|
||||
static void caca_gfx_free(void *data);
|
||||
|
||||
static void caca_gfx_create()
|
||||
{
|
||||
caca_display = caca_create_display(NULL);
|
||||
caca_cv = caca_get_canvas(caca_display);
|
||||
|
||||
if(!caca_video_width || !caca_video_height)
|
||||
{
|
||||
caca_video_width = caca_get_canvas_width(caca_cv);
|
||||
caca_video_height = caca_get_canvas_height(caca_cv);
|
||||
}
|
||||
|
||||
if (caca_rgb32)
|
||||
caca_dither = caca_create_dither(32, caca_video_width, caca_video_height, caca_video_pitch,
|
||||
0x00ff0000, 0xff00, 0xff, 0x0);
|
||||
else
|
||||
caca_dither = caca_create_dither(16, caca_video_width, caca_video_height, caca_video_pitch,
|
||||
0xf800, 0x7e0, 0x1f, 0x0);
|
||||
|
||||
video_driver_set_size(&caca_video_width, &caca_video_height);
|
||||
}
|
||||
|
||||
static void *caca_gfx_init(const video_info_t *video,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
caca_t *caca = (caca_t*)calloc(1, sizeof(*caca));
|
||||
|
||||
caca->caca_cv = &caca_cv;
|
||||
caca->caca_dither = &caca_dither;
|
||||
caca->caca_display = &caca_display;
|
||||
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
|
||||
caca_video_width = video->width;
|
||||
caca_video_height = video->height;
|
||||
caca_rgb32 = video->rgb32;
|
||||
|
||||
if (video->rgb32)
|
||||
caca_video_pitch = video->width * 4;
|
||||
else
|
||||
caca_video_pitch = video->width * 2;
|
||||
|
||||
caca_gfx_create();
|
||||
|
||||
if (!caca_cv || !caca_dither || !caca_display)
|
||||
{
|
||||
/* TODO: handle errors */
|
||||
}
|
||||
|
||||
if (settings->video.font_enable)
|
||||
font_driver_init_osd(NULL, false, FONT_DRIVER_RENDER_CACA);
|
||||
|
||||
return caca;
|
||||
}
|
||||
|
||||
static bool caca_gfx_frame(void *data, const void *frame,
|
||||
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
{
|
||||
size_t len = 0;
|
||||
void *buffer = NULL;
|
||||
const void *frame_to_copy = frame;
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
bool draw = true;
|
||||
|
||||
(void)data;
|
||||
(void)frame;
|
||||
(void)frame_width;
|
||||
(void)frame_height;
|
||||
(void)pitch;
|
||||
(void)msg;
|
||||
|
||||
if (!frame || !frame_width || !frame_height)
|
||||
return true;
|
||||
|
||||
if (caca_video_width != frame_width || caca_video_height != frame_height || caca_video_pitch != pitch)
|
||||
{
|
||||
if (frame_width > 4 && frame_height > 4)
|
||||
{
|
||||
caca_video_width = frame_width;
|
||||
caca_video_height = frame_height;
|
||||
caca_video_pitch = pitch;
|
||||
caca_gfx_free(NULL);
|
||||
caca_gfx_create();
|
||||
}
|
||||
}
|
||||
|
||||
if (!caca_cv)
|
||||
return true;
|
||||
|
||||
if (caca_menu_frame)
|
||||
frame_to_copy = caca_menu_frame;
|
||||
|
||||
width = caca_get_canvas_width(caca_cv);
|
||||
height = caca_get_canvas_height(caca_cv);
|
||||
|
||||
if (frame_to_copy == frame && frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
|
||||
draw = false;
|
||||
|
||||
caca_clear_canvas(caca_cv);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
|
||||
if (draw)
|
||||
{
|
||||
caca_dither_bitmap(caca_cv, 0, 0,
|
||||
width,
|
||||
height,
|
||||
caca_dither, frame_to_copy);
|
||||
|
||||
buffer = caca_export_canvas_to_memory(caca_cv, "caca", &len);
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
if (len)
|
||||
caca_refresh_display(caca_display);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void caca_gfx_set_nonblock_state(void *data, bool toggle)
|
||||
{
|
||||
(void)data;
|
||||
(void)toggle;
|
||||
}
|
||||
|
||||
static bool caca_gfx_alive(void *data)
|
||||
{
|
||||
(void)data;
|
||||
video_driver_set_size(&caca_video_width, &caca_video_height);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool caca_gfx_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool caca_gfx_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool caca_gfx_has_windowed(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void caca_gfx_free(void *data)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
if (caca_display)
|
||||
{
|
||||
caca_free_display(caca_display);
|
||||
caca_display = NULL;
|
||||
}
|
||||
|
||||
if (caca_dither)
|
||||
{
|
||||
caca_free_dither(caca_dither);
|
||||
caca_dither = NULL;
|
||||
}
|
||||
|
||||
if (caca_menu_frame)
|
||||
{
|
||||
free(caca_menu_frame);
|
||||
caca_menu_frame = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static bool caca_gfx_set_shader(void *data,
|
||||
enum rarch_shader_type type, const char *path)
|
||||
{
|
||||
(void)data;
|
||||
(void)type;
|
||||
(void)path;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void caca_gfx_set_rotation(void *data,
|
||||
unsigned rotation)
|
||||
{
|
||||
(void)data;
|
||||
(void)rotation;
|
||||
}
|
||||
|
||||
static void caca_gfx_viewport_info(void *data,
|
||||
struct video_viewport *vp)
|
||||
{
|
||||
(void)data;
|
||||
(void)vp;
|
||||
}
|
||||
|
||||
static bool caca_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
{
|
||||
(void)data;
|
||||
(void)buffer;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void caca_set_texture_frame(void *data,
|
||||
const void *frame, bool rgb32, unsigned width, unsigned height,
|
||||
float alpha)
|
||||
{
|
||||
unsigned pitch = width * 2;
|
||||
|
||||
if (rgb32)
|
||||
pitch = width * 4;
|
||||
|
||||
if (caca_menu_frame)
|
||||
{
|
||||
free(caca_menu_frame);
|
||||
caca_menu_frame = NULL;
|
||||
}
|
||||
|
||||
if (!caca_menu_frame || caca_menu_width != width || caca_menu_height != height || caca_menu_pitch != pitch)
|
||||
if (pitch && height)
|
||||
caca_menu_frame = (unsigned char*)malloc(pitch * height);
|
||||
|
||||
if (caca_menu_frame && frame && pitch && height)
|
||||
memcpy(caca_menu_frame, frame, pitch * height);
|
||||
}
|
||||
|
||||
static void caca_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
{
|
||||
font_driver_render_msg(font, msg, params);
|
||||
}
|
||||
|
||||
static const video_poke_interface_t caca_poke_interface = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#ifdef HAVE_FBO
|
||||
NULL,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#if defined(HAVE_MENU)
|
||||
caca_set_texture_frame,
|
||||
NULL,
|
||||
caca_set_osd_msg,
|
||||
NULL,
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
|
||||
NULL,
|
||||
#ifdef HAVE_MENU
|
||||
NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
static void caca_gfx_get_poke_interface(void *data,
|
||||
const video_poke_interface_t **iface)
|
||||
{
|
||||
(void)data;
|
||||
*iface = &caca_poke_interface;
|
||||
}
|
||||
|
||||
void caca_gfx_set_viewport(void *data, unsigned viewport_width,
|
||||
unsigned viewport_height, bool force_full, bool allow_rotate)
|
||||
{
|
||||
}
|
||||
|
||||
video_driver_t video_caca = {
|
||||
caca_gfx_init,
|
||||
caca_gfx_frame,
|
||||
caca_gfx_set_nonblock_state,
|
||||
caca_gfx_alive,
|
||||
caca_gfx_focus,
|
||||
caca_gfx_suppress_screensaver,
|
||||
caca_gfx_has_windowed,
|
||||
caca_gfx_set_shader,
|
||||
caca_gfx_free,
|
||||
"caca",
|
||||
caca_gfx_set_viewport,
|
||||
caca_gfx_set_rotation,
|
||||
caca_gfx_viewport_info,
|
||||
caca_gfx_read_viewport,
|
||||
NULL, /* read_frame_raw */
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
caca_gfx_get_poke_interface,
|
||||
};
|
139
gfx/drivers_font/caca_font.c
Normal file
139
gfx/drivers_font/caca_font.c
Normal file
@ -0,0 +1,139 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* Copyright (C) 2016 - 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 <stdlib.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <caca.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../font_driver.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../common/caca_common.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const font_renderer_driver_t *caca_font_driver;
|
||||
void *caca_font_data;
|
||||
caca_t *caca;
|
||||
} caca_raster_t;
|
||||
|
||||
static void *caca_init_font(void *data,
|
||||
const char *font_path, float font_size)
|
||||
{
|
||||
caca_raster_t *font = (caca_raster_t*)calloc(1, sizeof(*font));
|
||||
|
||||
if (!font)
|
||||
return NULL;
|
||||
|
||||
font->caca = (caca_t*)data;
|
||||
|
||||
font_size = 1;
|
||||
|
||||
if (!font_renderer_create_default((const void**)&font->caca_font_driver,
|
||||
&font->caca_font_data, font_path, font_size))
|
||||
{
|
||||
RARCH_WARN("Couldn't initialize font renderer.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
static void caca_render_free_font(void *data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int caca_get_message_width(void *data, const char *msg,
|
||||
unsigned msg_len, float scale)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct font_glyph *caca_font_get_glyph(
|
||||
void *data, uint32_t code)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void caca_render_msg(void *data, const char *msg,
|
||||
const void *userdata)
|
||||
{
|
||||
caca_raster_t *font = (caca_raster_t*)data;
|
||||
float x, y;
|
||||
unsigned width, height;
|
||||
unsigned newX, newY;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct font_params *params = (const struct font_params*)userdata;
|
||||
|
||||
if (!font || string_is_empty(msg))
|
||||
return;
|
||||
|
||||
if (params)
|
||||
{
|
||||
x = params->x;
|
||||
y = params->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = settings->video.msg_pos_x;
|
||||
y = settings->video.msg_pos_y;
|
||||
}
|
||||
|
||||
if (!font->caca || !font->caca->caca_cv || !font->caca->caca_display ||
|
||||
!*font->caca->caca_cv || !*font->caca->caca_display)
|
||||
return;
|
||||
|
||||
width = caca_get_canvas_width(*font->caca->caca_cv);
|
||||
height = caca_get_canvas_height(*font->caca->caca_cv);
|
||||
|
||||
newX = x * width;
|
||||
newY = height - (y * height);
|
||||
|
||||
if (strlen(msg) + newX > width)
|
||||
newX -= strlen(msg) + newX - width;
|
||||
|
||||
caca_put_str(*font->caca->caca_cv, newX, newY, msg);
|
||||
|
||||
caca_refresh_display(*font->caca->caca_display);
|
||||
}
|
||||
|
||||
static void caca_font_flush_block(void* data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void caca_font_bind_block(void* data, void* userdata)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
font_renderer_t caca_font = {
|
||||
caca_init_font,
|
||||
caca_render_free_font,
|
||||
caca_render_msg,
|
||||
"caca font",
|
||||
caca_font_get_glyph, /* get_glyph */
|
||||
caca_font_bind_block, /* bind_block */
|
||||
caca_font_flush_block, /* flush */
|
||||
caca_get_message_width /* get_message_width */
|
||||
};
|
@ -149,6 +149,35 @@ static bool gl_font_init_first(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CACA
|
||||
static const font_renderer_t *caca_font_backends[] = {
|
||||
&caca_font,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static bool caca_font_init_first(
|
||||
const void **font_driver, void **font_handle,
|
||||
void *video_data, const char *font_path, float font_size)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; caca_font_backends[i]; i++)
|
||||
{
|
||||
void *data = caca_font_backends[i]->init(
|
||||
video_data, font_path, font_size);
|
||||
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
*font_driver = caca_font_backends[i];
|
||||
*font_handle = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VULKAN
|
||||
static const font_renderer_t *vulkan_font_backends[] = {
|
||||
&vulkan_raster_font,
|
||||
@ -267,6 +296,11 @@ static bool font_init_first(
|
||||
case FONT_DRIVER_RENDER_CTR:
|
||||
return ctr_font_init_first(font_driver, font_handle,
|
||||
video_data, font_path, font_size);
|
||||
#endif
|
||||
#ifdef HAVE_CACA
|
||||
case FONT_DRIVER_RENDER_CACA:
|
||||
return caca_font_init_first(font_driver, font_handle,
|
||||
video_data, font_path, font_size);
|
||||
#endif
|
||||
case FONT_DRIVER_RENDER_DONT_CARE:
|
||||
/* TODO/FIXME - lookup graphics driver's 'API' */
|
||||
|
@ -31,7 +31,8 @@ enum font_driver_render_api
|
||||
FONT_DRIVER_RENDER_DIRECT3D_API,
|
||||
FONT_DRIVER_RENDER_VITA2D,
|
||||
FONT_DRIVER_RENDER_CTR,
|
||||
FONT_DRIVER_RENDER_VULKAN_API
|
||||
FONT_DRIVER_RENDER_VULKAN_API,
|
||||
FONT_DRIVER_RENDER_CACA
|
||||
};
|
||||
|
||||
enum text_alignment
|
||||
@ -162,6 +163,7 @@ extern font_renderer_t d3d_win32_font;
|
||||
extern font_renderer_t vita2d_vita_font;
|
||||
extern font_renderer_t ctr_font;
|
||||
extern font_renderer_t vulkan_raster_font;
|
||||
extern font_renderer_t caca_font;
|
||||
|
||||
extern font_renderer_driver_t stb_font_renderer;
|
||||
extern font_renderer_driver_t stb_unicode_font_renderer;
|
||||
|
@ -223,6 +223,9 @@ static const video_driver_t *video_drivers[] = {
|
||||
#endif
|
||||
#ifdef HAVE_XSHM
|
||||
&video_xshm,
|
||||
#endif
|
||||
#ifdef HAVE_CACA
|
||||
&video_caca,
|
||||
#endif
|
||||
&video_null,
|
||||
NULL,
|
||||
|
@ -512,6 +512,7 @@ extern video_driver_t video_dispmanx;
|
||||
extern video_driver_t video_sunxi;
|
||||
extern video_driver_t video_drm;
|
||||
extern video_driver_t video_xshm;
|
||||
extern video_driver_t video_caca;
|
||||
extern video_driver_t video_null;
|
||||
|
||||
extern const void *frame_cache_data;
|
||||
|
@ -396,6 +396,10 @@ FONTS
|
||||
#include "../gfx/drivers_font/ctr_font.c"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CACA)
|
||||
#include "../gfx/drivers_font/caca_font.c"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_VULKAN)
|
||||
#include "../gfx/drivers_font/vulkan_raster_font.c"
|
||||
@ -973,6 +977,10 @@ MENU
|
||||
#include "../menu/drivers_display/menu_display_ctr.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CACA
|
||||
#include "../menu/drivers_display/menu_display_caca.c"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -498,6 +498,9 @@ static int16_t udev_input_state(void *data, const struct retro_keybind **binds,
|
||||
int16_t ret;
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
|
||||
if (!udev)
|
||||
return 0;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
|
101
menu/drivers_display/menu_display_caca.c
Normal file
101
menu/drivers_display/menu_display_caca.c
Normal file
@ -0,0 +1,101 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* Copyright (C) 2016 - 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 <time.h>
|
||||
|
||||
#include <queues/message_queue.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../config.def.h"
|
||||
#include "../../gfx/font_driver.h"
|
||||
#include "../../gfx/video_context_driver.h"
|
||||
|
||||
#include "../menu_display.h"
|
||||
|
||||
static void *menu_display_caca_get_default_mvp(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void menu_display_caca_blend_begin(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_display_caca_blend_end(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_display_caca_draw(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_caca_draw_pipeline(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_caca_viewport(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_caca_restore_clear_color(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_display_caca_clear_color(menu_display_ctx_clearcolor_t *clearcolor)
|
||||
{
|
||||
(void)clearcolor;
|
||||
}
|
||||
|
||||
static bool menu_display_caca_font_init_first(
|
||||
void **font_handle, void *video_data,
|
||||
const char *font_path, float font_size)
|
||||
{
|
||||
font_data_t **handle = (font_data_t**)font_handle;
|
||||
*handle = font_driver_init_first(video_data,
|
||||
font_path, font_size, true, FONT_DRIVER_RENDER_CACA);
|
||||
return *handle;
|
||||
}
|
||||
|
||||
static const float *menu_display_caca_get_default_vertices(void)
|
||||
{
|
||||
static float dummy[16] = {0.0f};
|
||||
return &dummy[0];
|
||||
}
|
||||
|
||||
static const float *menu_display_caca_get_default_tex_coords(void)
|
||||
{
|
||||
static float dummy[16] = {0.0f};
|
||||
return &dummy[0];
|
||||
}
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_caca = {
|
||||
menu_display_caca_draw,
|
||||
menu_display_caca_draw_pipeline,
|
||||
menu_display_caca_viewport,
|
||||
menu_display_caca_blend_begin,
|
||||
menu_display_caca_blend_end,
|
||||
menu_display_caca_restore_clear_color,
|
||||
menu_display_caca_clear_color,
|
||||
menu_display_caca_get_default_mvp,
|
||||
menu_display_caca_get_default_vertices,
|
||||
menu_display_caca_get_default_tex_coords,
|
||||
menu_display_caca_font_init_first,
|
||||
MENU_VIDEO_DRIVER_CACA,
|
||||
"menu_display_caca",
|
||||
};
|
@ -79,6 +79,9 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
|
||||
#endif
|
||||
#ifdef _3DS
|
||||
&menu_display_ctx_ctr,
|
||||
#endif
|
||||
#ifdef HAVE_CACA
|
||||
&menu_display_ctx_caca,
|
||||
#endif
|
||||
&menu_display_ctx_null,
|
||||
NULL,
|
||||
@ -135,6 +138,10 @@ static bool menu_display_check_compatibility(
|
||||
if (string_is_equal(video_driver, "ctr"))
|
||||
return true;
|
||||
break;
|
||||
case MENU_VIDEO_DRIVER_CACA:
|
||||
if (string_is_equal(video_driver, "caca"))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -92,7 +92,8 @@ enum menu_display_driver_type
|
||||
MENU_VIDEO_DRIVER_VULKAN,
|
||||
MENU_VIDEO_DRIVER_DIRECT3D,
|
||||
MENU_VIDEO_DRIVER_VITA2D,
|
||||
MENU_VIDEO_DRIVER_CTR
|
||||
MENU_VIDEO_DRIVER_CTR,
|
||||
MENU_VIDEO_DRIVER_CACA
|
||||
};
|
||||
|
||||
typedef struct menu_display_ctx_clearcolor
|
||||
@ -283,6 +284,7 @@ extern menu_display_ctx_driver_t menu_display_ctx_vulkan;
|
||||
extern menu_display_ctx_driver_t menu_display_ctx_d3d;
|
||||
extern menu_display_ctx_driver_t menu_display_ctx_vita2d;
|
||||
extern menu_display_ctx_driver_t menu_display_ctx_ctr;
|
||||
extern menu_display_ctx_driver_t menu_display_ctx_caca;
|
||||
extern menu_display_ctx_driver_t menu_display_ctx_null;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user