Null video driver should work now

This commit is contained in:
twinaphex 2020-02-03 06:49:59 +01:00
parent 5ff4ee96e4
commit 6b0a62d6ff
7 changed files with 83 additions and 145 deletions

View File

@ -1127,10 +1127,6 @@ ifeq ($(HAVE_CACA), 1)
OBJ += gfx/drivers/caca_gfx.o gfx/drivers_font/caca_font.o
LIBS += $(CACA_LIBS)
DEF_FLAGS += $(CACA_CFLAGS)
ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/drivers_display/menu_display_caca.o
endif
endif
ifeq ($(HAVE_SIXEL), 1)

View File

@ -1334,10 +1334,6 @@ MENU
#include "../menu/drivers_display/menu_display_switch.c"
#endif
#ifdef HAVE_CACA
#include "../menu/drivers_display/menu_display_caca.c"
#endif
#ifdef DJGPP
#include "../menu/drivers_display/menu_display_vga.c"
#endif

View File

@ -1,107 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2016-2019 - 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 "../../retroarch.h"
#include "../menu_driver.h"
static void *menu_display_caca_get_default_mvp(video_frame_info_t *video_info)
{
return NULL;
}
static void menu_display_caca_blend_begin(video_frame_info_t *video_info)
{
}
static void menu_display_caca_blend_end(video_frame_info_t *video_info)
{
}
static void menu_display_caca_draw(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
}
static void menu_display_caca_draw_pipeline(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
}
static void menu_display_caca_viewport(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
}
static void menu_display_caca_restore_clear_color(void)
{
}
static void menu_display_caca_clear_color(menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info)
{
(void)clearcolor;
}
static bool menu_display_caca_font_init_first(
void **font_handle, void *video_data,
const char *font_path, float font_size,
bool is_threaded)
{
font_data_t **handle = (font_data_t**)font_handle;
*handle = font_driver_init_first(video_data,
font_path, font_size, true,
is_threaded,
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,
"caca",
false,
NULL,
NULL
};

View File

@ -274,7 +274,6 @@ enum menu_display_driver_type
MENU_VIDEO_DRIVER_VITA2D,
MENU_VIDEO_DRIVER_CTR,
MENU_VIDEO_DRIVER_WIIU,
MENU_VIDEO_DRIVER_CACA,
MENU_VIDEO_DRIVER_SIXEL,
MENU_VIDEO_DRIVER_GDI,
MENU_VIDEO_DRIVER_SWITCH,

View File

@ -187,18 +187,54 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
NULL
};
static menu_display_ctx_driver_t menu_display_ctx_null = {
NULL, /* draw */
NULL, /* draw_pipeline */
NULL, /* viewport */
NULL, /* blend_begin */
NULL, /* blend_end */
NULL, /* restore_clear_color */
NULL, /* clear_color */
NULL, /* get_default_mvp */
NULL, /* get_default_vertices */
NULL, /* get_default_tex_coords */
NULL, /* font_init_first */
static void *menu_display_null_get_default_mvp(video_frame_info_t *video_info) { return NULL; }
static void menu_display_null_blend_begin(video_frame_info_t *video_info) { }
static void menu_display_null_blend_end(video_frame_info_t *video_info) { }
static void menu_display_null_draw(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info) { }
static void menu_display_null_draw_pipeline(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info) { }
static void menu_display_null_viewport(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info) { }
static void menu_display_null_restore_clear_color(void) { }
static void menu_display_null_clear_color(menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info) { }
static bool menu_display_null_font_init_first(
void **font_handle, void *video_data,
const char *font_path, float font_size,
bool is_threaded)
{
font_data_t **handle = (font_data_t**)font_handle;
*handle = font_driver_init_first(video_data,
font_path, font_size, true,
is_threaded,
FONT_DRIVER_RENDER_DONT_CARE);
return *handle;
}
static const float *menu_display_null_get_default_vertices(void)
{
static float dummy[16] = {0.0f};
return &dummy[0];
}
static const float *menu_display_null_get_default_tex_coords(void)
{
static float dummy[16] = {0.0f};
return &dummy[0];
}
menu_display_ctx_driver_t menu_display_ctx_null = {
menu_display_null_draw,
menu_display_null_draw_pipeline,
menu_display_null_viewport,
menu_display_null_blend_begin,
menu_display_null_blend_end,
menu_display_null_restore_clear_color,
menu_display_null_clear_color,
menu_display_null_get_default_mvp,
menu_display_null_get_default_vertices,
menu_display_null_get_default_tex_coords,
menu_display_null_font_init_first,
MENU_VIDEO_DRIVER_GENERIC,
"null",
false,
@ -258,9 +294,6 @@ static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
#ifdef HAVE_SIXEL
&menu_display_ctx_sixel,
#endif
#ifdef HAVE_CACA
&menu_display_ctx_caca,
#endif
#ifdef HAVE_FPGA
&menu_display_ctx_fpga,
#endif
@ -1648,10 +1681,6 @@ static bool menu_display_check_compatibility(
if (string_is_equal(video_driver, "sixel"))
return true;
break;
case MENU_VIDEO_DRIVER_CACA:
if (string_is_equal(video_driver, "caca"))
return true;
break;
case MENU_VIDEO_DRIVER_GDI:
if (string_is_equal(video_driver, "gdi"))
return true;

View File

@ -733,7 +733,6 @@ extern menu_display_ctx_driver_t menu_display_ctx_d3d12;
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_wiiu;
extern menu_display_ctx_driver_t menu_display_ctx_caca;
extern menu_display_ctx_driver_t menu_display_ctx_gdi;
extern menu_display_ctx_driver_t menu_display_ctx_vga;
extern menu_display_ctx_driver_t menu_display_ctx_fpga;

View File

@ -365,16 +365,42 @@ static const audio_driver_t *audio_drivers[] = {
NULL,
};
static void video_null_free(void *data) { }
static void *video_null_init(const video_info_t *video,
input_driver_t **input, void **input_data)
{
*input = NULL;
*input_data = NULL;
return (void*)-1;
}
static bool video_null_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)
{
return true;
}
static void video_null_set_nonblock_state(void *data, bool toggle) { }
static bool video_null_alive(void *data) { return true; }
static bool video_null_focus(void *data) { return true; }
static bool video_null_has_windowed(void *data) { return true; }
static bool video_null_suppress_screensaver(void *data, bool enable) { return false; }
static bool video_null_set_shader(void *data,
enum rarch_shader_type type, const char *path) { return false; }
static video_driver_t video_null = {
NULL, /* init */
NULL, /* frame */
NULL, /* set_nonblock_state */
NULL, /* alive */
NULL, /* focus */
NULL, /* suppress_screensaver */
NULL, /* has_windowed */
NULL, /* set_shader */
NULL, /* free */
video_null_init,
video_null_frame,
video_null_set_nonblock_state,
video_null_alive,
video_null_focus,
video_null_suppress_screensaver,
video_null_has_windowed,
video_null_set_shader,
video_null_free,
"null",
NULL, /* set_viewport */
NULL, /* set_rotation */