From cc8b458ee3bd1f8e724bbea64e8f2d2a9012f72f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 12 Sep 2018 20:01:56 +0200 Subject: [PATCH] Add menu_display_switch.c --- griffin/griffin.c | 4 + menu/drivers_display/menu_display_switch.c | 104 +++++++++++++++++++++ menu/menu_driver.c | 4 + menu/menu_driver.h | 2 + 4 files changed, 114 insertions(+) create mode 100644 menu/drivers_display/menu_display_switch.c diff --git a/griffin/griffin.c b/griffin/griffin.c index b2131b38ed..118c307fc6 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1215,6 +1215,10 @@ MENU #include "../menu/drivers_display/menu_display_wiiu.c" #endif +#if defined(HAVE_LIBNX) +#include "../menu/drivers_display/menu_display_switch.c" +#endif + #ifdef HAVE_CACA #include "../menu/drivers_display/menu_display_caca.c" #endif diff --git a/menu/drivers_display/menu_display_switch.c b/menu/drivers_display/menu_display_switch.c new file mode 100644 index 0000000000..585ba98d3b --- /dev/null +++ b/menu/drivers_display/menu_display_switch.c @@ -0,0 +1,104 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2018 - m4xw + * + * 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 . + */ +#include + +#include +#include + +#include "../../gfx/font_driver.h" +#include "../../gfx/video_driver.h" + +#include "../menu_driver.h" + +static void *menu_display_switch_get_default_mvp(video_frame_info_t *video_info) +{ + return NULL; +} + +static void menu_display_switch_blend_begin(video_frame_info_t *video_info) +{ +} + +static void menu_display_switch_blend_end(video_frame_info_t *video_info) +{ +} + +static void menu_display_switch_draw(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info) +{ +} + +static void menu_display_switch_draw_pipeline( + menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) +{ +} + +static void menu_display_switch_viewport(menu_display_ctx_draw_t *draw, + video_frame_info_t *video_info) +{ +} + +static void menu_display_switch_restore_clear_color(void) +{ +} + +static void menu_display_switch_clear_color( + menu_display_ctx_clearcolor_t *clearcolor, + video_frame_info_t *video_info) +{ + (void)clearcolor; +} + +static bool menu_display_switch_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_SWITCH); + return *handle; +} + +static const float *menu_display_switch_get_default_vertices(void) +{ + static float dummy[16] = {0.0f}; + return &dummy[0]; +} + +static const float *menu_display_switch_get_default_tex_coords(void) +{ + static float dummy[16] = {0.0f}; + return &dummy[0]; +} + +menu_display_ctx_driver_t menu_display_ctx_switch = { + menu_display_switch_draw, + menu_display_switch_draw_pipeline, + menu_display_switch_viewport, + menu_display_switch_blend_begin, + menu_display_switch_blend_end, + menu_display_switch_restore_clear_color, + menu_display_switch_clear_color, + menu_display_switch_get_default_mvp, + menu_display_switch_get_default_vertices, + menu_display_switch_get_default_tex_coords, + menu_display_switch_font_init_first, + MENU_VIDEO_DRIVER_SWITCH, + "menu_display_switch", + false +}; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index effc75d61a..0ae873fc26 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -325,6 +325,10 @@ static bool menu_display_check_compatibility( if (string_is_equal(video_driver, "vga")) return true; break; + case MENU_VIDEO_DRIVER_SWITCH: + if (string_is_equal(video_driver, "switch")) + return true; + break; } return false; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index c802d8e812..b040f3aed4 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -318,6 +318,7 @@ enum menu_display_driver_type MENU_VIDEO_DRIVER_CACA, MENU_VIDEO_DRIVER_SIXEL, MENU_VIDEO_DRIVER_GDI, + MENU_VIDEO_DRIVER_SWITCH, MENU_VIDEO_DRIVER_VGA }; @@ -818,6 +819,7 @@ 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_switch; extern menu_display_ctx_driver_t menu_display_ctx_sixel; extern menu_display_ctx_driver_t menu_display_ctx_null;