diff --git a/Makefile.common b/Makefile.common index 880b755841..0cec67afc1 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1228,8 +1228,7 @@ ifeq ($(HAVE_NETWORK_VIDEO), 1) endif DEFINES += -DHAVE_NETWORK_VIDEO - OBJ += gfx/drivers/network_gfx.o \ - gfx/drivers_context/network_ctx.o + OBJ += gfx/drivers/network_gfx.o endif ifeq ($(HAVE_PLAIN_DRM), 1) diff --git a/gfx/drivers/fpga_gfx.c b/gfx/drivers/fpga_gfx.c index c0c54a7875..123a968a7a 100644 --- a/gfx/drivers/fpga_gfx.c +++ b/gfx/drivers/fpga_gfx.c @@ -104,7 +104,6 @@ static void *fpga_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { const gfx_ctx_driver_t *ctx_driver = NULL; - settings_t *settings = config_get_ptr(); fpga_t *fpga = (fpga_t*)calloc(1, sizeof(*fpga)); *input = NULL; diff --git a/gfx/drivers/network_gfx.c b/gfx/drivers/network_gfx.c index 7b6feb6c1c..2602e678d7 100644 --- a/gfx/drivers/network_gfx.c +++ b/gfx/drivers/network_gfx.c @@ -64,17 +64,32 @@ static bool network_rgb32 = false; static bool network_menu_rgb32 = false; static unsigned *network_video_temp_buf = NULL; +static void gfx_ctx_network_input_driver( + const char *joypad_driver, + input_driver_t **input, void **input_data) +{ +#ifdef HAVE_UDEV + *input_data = input_udev.init(joypad_driver); + + if (*input_data) + { + *input = &input_udev; + return; + } +#endif + *input = NULL; + *input_data = NULL; +} + static void *network_gfx_init(const video_info_t *video, input_driver_t **input, void **input_data) { int fd; - gfx_ctx_input_t inp; - void *ctx_data = NULL; - const gfx_ctx_driver_t *ctx_driver = NULL; struct addrinfo *addr = NULL, *next_addr = NULL; settings_t *settings = config_get_ptr(); network_video_t *network = (network_video_t*)calloc(1, sizeof(*network)); bool video_font_enable = settings->bools.video_font_enable; + const char *joypad_driver = settings->arrays.joypad_driver; *input = NULL; *input_data = NULL; @@ -87,25 +102,8 @@ static void *network_gfx_init(const video_info_t *video, else network_video_pitch = video->width * 2; - ctx_driver = video_context_driver_init_first(network, - "network", - GFX_CTX_NETWORK_VIDEO_API, 1, 0, false, &ctx_data); - - if (!ctx_driver) - goto error; - - if (ctx_data) - network->ctx_data = ctx_data; - - network->ctx_driver = ctx_driver; - video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); - - RARCH_LOG("[network]: Found network video context: %s\n", ctx_driver->ident); - - inp.input = input; - inp.input_data = input_data; - - video_context_driver_input_driver(&inp); + gfx_ctx_network_input_driver(joypad_driver, + input, input_data); if (font_enable) font_driver_init_osd(network, @@ -160,7 +158,6 @@ try_connect: return network; error: - video_context_driver_destroy(); if (network) free(network); return NULL; @@ -170,7 +167,6 @@ static bool network_gfx_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info) { - gfx_ctx_mode_t mode; const void *frame_to_copy = frame; unsigned width = 0; unsigned height = 0; @@ -339,59 +335,37 @@ static void network_gfx_set_nonblock_state(void *a, bool b, bool c, unsigned d) static bool network_gfx_alive(void *data) { - gfx_ctx_size_t size_data; - unsigned temp_width = 0; - unsigned temp_height = 0; - bool quit = false; - bool resize = false; - network_video_t *network = (network_video_t*)data; + unsigned temp_width = 0; + unsigned temp_height = 0; + bool quit = false; + bool resize = false; + network_video_t *network = (network_video_t*)data; /* Needed because some context drivers don't track their sizes */ video_driver_get_size(&temp_width, &temp_height); - network->ctx_driver->check_window(network->ctx_data, - &quit, &resize, &temp_width, &temp_height); - if (temp_width != 0 && temp_height != 0) video_driver_set_size(temp_width, temp_height); return true; } -static bool network_gfx_focus(void *data) -{ - (void)data; - return true; -} - -static bool network_gfx_suppress_screensaver(void *data, bool enable) -{ - (void)data; - (void)enable; - return false; -} - -static bool network_gfx_has_windowed(void *data) -{ - (void)data; - return true; -} +static bool network_gfx_focus(void *data) { return true; } +static bool network_gfx_suppress_screensaver(void *data, bool enable) { return false; } +static bool network_gfx_has_windowed(void *data) { return true; } static void network_gfx_free(void *data) { network_video_t *network = (network_video_t*)data; if (network_menu_frame) - { free(network_menu_frame); - network_menu_frame = NULL; - } if (network_video_temp_buf) - { free(network_video_temp_buf); - network_video_temp_buf = NULL; - } + + network_menu_frame = NULL; + network_video_temp_buf = NULL; font_driver_free_osd(); @@ -403,21 +377,9 @@ static void network_gfx_free(void *data) } static bool network_gfx_set_shader(void *data, - enum rarch_shader_type type, const char *path) -{ - (void)data; - (void)type; - (void)path; - - return false; -} - + enum rarch_shader_type type, const char *path) { return false; } static void network_gfx_set_rotation(void *data, - unsigned rotation) -{ - (void)data; - (void)rotation; -} + unsigned rotation) { } static void network_set_texture_frame(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, @@ -434,7 +396,10 @@ static void network_set_texture_frame(void *data, network_menu_frame = NULL; } - if (!network_menu_frame || network_menu_width != width || network_menu_height != height || network_menu_pitch != pitch) + if ( !network_menu_frame || + network_menu_width != width || + network_menu_height != height || + network_menu_pitch != pitch) if (pitch && height) network_menu_frame = (unsigned char*)malloc(pitch * height); @@ -449,35 +414,12 @@ static void network_set_texture_frame(void *data, } static void network_get_video_output_size(void *data, - unsigned *width, unsigned *height) -{ - gfx_ctx_size_t size_data; - size_data.width = width; - size_data.height = height; - video_context_driver_get_video_output_size(&size_data); -} - -static void network_get_video_output_prev(void *data) -{ - video_context_driver_get_video_output_prev(); -} - -static void network_get_video_output_next(void *data) -{ - video_context_driver_get_video_output_next(); -} + unsigned *width, unsigned *height) { } +static void network_get_video_output_prev(void *data) { } +static void network_get_video_output_next(void *data) { } static void network_set_video_mode(void *data, unsigned width, unsigned height, - bool fullscreen) -{ - gfx_ctx_mode_t mode; - - mode.width = width; - mode.height = height; - mode.fullscreen = fullscreen; - - video_context_driver_set_video_mode(&mode); -} + bool fullscreen) { } static const video_poke_interface_t network_poke_interface = { NULL, diff --git a/gfx/drivers_context/network_ctx.c b/gfx/drivers_context/network_ctx.c deleted file mode 100644 index cda5b3db54..0000000000 --- a/gfx/drivers_context/network_ctx.c +++ /dev/null @@ -1,109 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * 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 . - */ - -/* network video context. */ - -#ifdef HAVE_CONFIG_H -#include "../../config.h" -#endif - -#include "../../configuration.h" -#include "../../dynamic.h" -#include "../../retroarch.h" -#include "../../verbosity.h" -#include "../../ui/ui_companion_driver.h" - -#if defined(_WIN32) && !defined(_XBOX) -#include "../common/win32_common.h" -#endif - -static enum gfx_ctx_api network_ctx_api = GFX_CTX_NONE; - -static void gfx_ctx_network_input_driver(void *data, - const char *joypad_name, - input_driver_t **input, void **input_data) -{ -#ifdef HAVE_UDEV - *input_data = input_udev.init(joypad_name); - - if (*input_data) - { - *input = &input_udev; - return; - } -#endif - *input = NULL; - *input_data = NULL; -} - -static void gfx_ctx_network_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height) { } -static bool gfx_ctx_network_set_resize(void *data, - unsigned width, unsigned height) { return false; } -static void gfx_ctx_network_get_video_size(void *data, - unsigned *width, unsigned *height) { } -static void *gfx_ctx_network_init(void *video_driver) { return (void*)"network"; } -static void gfx_ctx_network_destroy(void *data) { } -static bool gfx_ctx_network_set_video_mode(void *data, - unsigned width, unsigned height, - bool fullscreen) { return true; } -static bool gfx_ctx_network_has_focus(void *data) { return true; } -static bool gfx_ctx_network_suppress_screensaver(void *data, bool enable) { return true; } -static bool gfx_ctx_network_get_metrics(void *data, - enum display_metric_types type, float *value) { return false; } -static enum gfx_ctx_api gfx_ctx_network_get_api(void *data) { return network_ctx_api; } -static bool gfx_ctx_network_bind_api(void *data, - enum gfx_ctx_api api, unsigned major, unsigned minor) { return true; } -static void gfx_ctx_network_show_mouse(void *data, bool state) { } -static void gfx_ctx_network_swap_interval(void *data, int interval) { } -static void gfx_ctx_network_set_flags(void *data, uint32_t flags) { } -static uint32_t gfx_ctx_network_get_flags(void *data) { return 0; } -static void gfx_ctx_network_swap_buffers(void *data) { } - -const gfx_ctx_driver_t gfx_ctx_network = { - gfx_ctx_network_init, - gfx_ctx_network_destroy, - gfx_ctx_network_get_api, - gfx_ctx_network_bind_api, - gfx_ctx_network_swap_interval, - gfx_ctx_network_set_video_mode, - gfx_ctx_network_get_video_size, - NULL, /* get_refresh_rate */ - NULL, /* get_video_output_size */ - NULL, /* get_video_output_prev */ - NULL, /* get_video_output_next */ - gfx_ctx_network_get_metrics, - NULL, - NULL, /* update_title */ - gfx_ctx_network_check_window, - gfx_ctx_network_set_resize, - gfx_ctx_network_has_focus, - gfx_ctx_network_suppress_screensaver, - true, /* has_windowed */ - gfx_ctx_network_swap_buffers, - gfx_ctx_network_input_driver, - NULL, - NULL, - NULL, - gfx_ctx_network_show_mouse, - "network", - gfx_ctx_network_get_flags, - gfx_ctx_network_set_flags, - NULL, - NULL, - NULL -}; diff --git a/retroarch.c b/retroarch.c index c9c7e78749..0eba107d2c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -647,9 +647,6 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = { #endif #if defined(HAVE_VULKAN) && defined(HAVE_VULKAN_DISPLAY) &gfx_ctx_khr_display, -#endif -#ifdef HAVE_NETWORK_VIDEO - &gfx_ctx_network, #endif &gfx_ctx_null, NULL