From 98bd74d388851679659c87e433882cb704061190 Mon Sep 17 00:00:00 2001 From: M4xw Date: Wed, 27 Apr 2022 01:26:39 +0200 Subject: [PATCH] Cleanup --- frontend/drivers/platform_steam.c | 84 +++++++++++++++---------------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/frontend/drivers/platform_steam.c b/frontend/drivers/platform_steam.c index 039b5417b2..31609b534d 100644 --- a/frontend/drivers/platform_steam.c +++ b/frontend/drivers/platform_steam.c @@ -22,53 +22,54 @@ #include -/* Referenced in platform_unix.c */ -extern frontend_ctx_driver_t frontend_ctx_unix; +/* Statics */ +static frontend_ctx_driver_t *frontend_ctx_parent; + /* Forward Declare */ frontend_ctx_driver_t frontend_ctx_steam; static void frontend_steam_init(void *data) { - /* Copy vtab from frontend_ctx_unix to frontend_ctx_steam */ + /* Copy vtab from frontend_ctx_parent to frontend_ctx_steam */ #if (defined(__linux__) || defined(__unix__)) - frontend_ctx_steam.environment_get = frontend_ctx_unix.environment_get; - frontend_ctx_steam.init = frontend_ctx_unix.init; - /* deinit is overwritten later */ - /* frontend_ctx_steam.deinit = frontend_ctx_unix.deinit; */ - frontend_ctx_steam.exitspawn = frontend_ctx_unix.exitspawn; - frontend_ctx_steam.exec = frontend_ctx_unix.exec; - frontend_ctx_steam.set_fork = frontend_ctx_unix.set_fork; - frontend_ctx_steam.shutdown = frontend_ctx_unix.shutdown; - frontend_ctx_steam.get_name = frontend_ctx_unix.get_name; - frontend_ctx_steam.get_os = frontend_ctx_unix.get_os; - frontend_ctx_steam.get_rating = frontend_ctx_unix.get_rating; - frontend_ctx_steam.content_loaded = frontend_ctx_unix.content_loaded; - frontend_ctx_steam.get_architecture = frontend_ctx_unix.get_architecture; - frontend_ctx_steam.get_powerstate = frontend_ctx_unix.get_powerstate; - frontend_ctx_steam.parse_drive_list = frontend_ctx_unix.parse_drive_list; - frontend_ctx_steam.get_total_mem = frontend_ctx_unix.get_total_mem; - frontend_ctx_steam.get_free_mem = frontend_ctx_unix.get_free_mem; - frontend_ctx_steam.install_signal_handler = frontend_ctx_unix.install_signal_handler; - frontend_ctx_steam.get_signal_handler_state = frontend_ctx_unix.get_signal_handler_state; - frontend_ctx_steam.set_signal_handler_state = frontend_ctx_unix.set_signal_handler_state; - frontend_ctx_steam.destroy_signal_handler_state = frontend_ctx_unix.destroy_signal_handler_state; - frontend_ctx_steam.attach_console = frontend_ctx_unix.attach_console; - frontend_ctx_steam.detach_console = frontend_ctx_unix.detach_console; - frontend_ctx_steam.get_lakka_version = frontend_ctx_unix.get_lakka_version; - frontend_ctx_steam.set_screen_brightness = frontend_ctx_unix.set_screen_brightness; - frontend_ctx_steam.watch_path_for_changes = frontend_ctx_unix.watch_path_for_changes; - frontend_ctx_steam.check_for_path_changes = frontend_ctx_unix.check_for_path_changes; - frontend_ctx_steam.set_sustained_performance_mode = frontend_ctx_unix.set_sustained_performance_mode; - frontend_ctx_steam.get_cpu_model_name = frontend_ctx_unix.get_cpu_model_name; - frontend_ctx_steam.get_user_language = frontend_ctx_unix.get_user_language; - frontend_ctx_steam.is_narrator_running = frontend_ctx_unix.is_narrator_running; - frontend_ctx_steam.accessibility_speak = frontend_ctx_unix.accessibility_speak; - frontend_ctx_steam.set_gamemode = frontend_ctx_unix.set_gamemode; - frontend_ctx_steam.get_video_driver = frontend_ctx_unix.get_video_driver; + frontend_ctx_parent = frontend_ctx_find_driver("unix"); #endif + /* Things we don't implement */ + frontend_ctx_steam.environment_get = frontend_ctx_parent->environment_get; + frontend_ctx_steam.exitspawn = frontend_ctx_parent->exitspawn; + frontend_ctx_steam.exec = frontend_ctx_parent->exec; + frontend_ctx_steam.set_fork = frontend_ctx_parent->set_fork; + frontend_ctx_steam.shutdown = frontend_ctx_parent->shutdown; + frontend_ctx_steam.get_name = frontend_ctx_parent->get_name; + frontend_ctx_steam.get_os = frontend_ctx_parent->get_os; + frontend_ctx_steam.get_rating = frontend_ctx_parent->get_rating; + frontend_ctx_steam.content_loaded = frontend_ctx_parent->content_loaded; + frontend_ctx_steam.get_architecture = frontend_ctx_parent->get_architecture; + frontend_ctx_steam.get_powerstate = frontend_ctx_parent->get_powerstate; + frontend_ctx_steam.parse_drive_list = frontend_ctx_parent->parse_drive_list; + frontend_ctx_steam.get_total_mem = frontend_ctx_parent->get_total_mem; + frontend_ctx_steam.get_free_mem = frontend_ctx_parent->get_free_mem; + frontend_ctx_steam.install_signal_handler = frontend_ctx_parent->install_signal_handler; + frontend_ctx_steam.get_signal_handler_state = frontend_ctx_parent->get_signal_handler_state; + frontend_ctx_steam.set_signal_handler_state = frontend_ctx_parent->set_signal_handler_state; + frontend_ctx_steam.destroy_signal_handler_state = frontend_ctx_parent->destroy_signal_handler_state; + frontend_ctx_steam.attach_console = frontend_ctx_parent->attach_console; + frontend_ctx_steam.detach_console = frontend_ctx_parent->detach_console; + frontend_ctx_steam.get_lakka_version = frontend_ctx_parent->get_lakka_version; + frontend_ctx_steam.set_screen_brightness = frontend_ctx_parent->set_screen_brightness; + frontend_ctx_steam.watch_path_for_changes = frontend_ctx_parent->watch_path_for_changes; + frontend_ctx_steam.check_for_path_changes = frontend_ctx_parent->check_for_path_changes; + frontend_ctx_steam.set_sustained_performance_mode = frontend_ctx_parent->set_sustained_performance_mode; + frontend_ctx_steam.get_cpu_model_name = frontend_ctx_parent->get_cpu_model_name; + frontend_ctx_steam.get_user_language = frontend_ctx_parent->get_user_language; + frontend_ctx_steam.is_narrator_running = frontend_ctx_parent->is_narrator_running; + frontend_ctx_steam.accessibility_speak = frontend_ctx_parent->accessibility_speak; + frontend_ctx_steam.set_gamemode = frontend_ctx_parent->set_gamemode; + frontend_ctx_steam.get_video_driver = frontend_ctx_parent->get_video_driver; + /* Invoke Parent Init */ - frontend_ctx_steam.init(data); + frontend_ctx_parent->init(data); /* Init Mist backend */ steam_init(); @@ -79,12 +80,7 @@ static void frontend_steam_deinit(void *data) /* Deinit Mist backend */ steam_deinit(); - /* Assign */ -#if (defined(__linux__) || defined(__unix__)) - frontend_ctx_steam.deinit = frontend_ctx_unix.deinit; -#endif - - frontend_ctx_steam.deinit(data); + frontend_ctx_parent->deinit(data); } /* Entries will be assigned to the parent frontend drivers & their init routines will be ran */