mirror of
https://github.com/libretro/RetroArch
synced 2025-03-06 04:13:52 +00:00
Move ui_companion_driver code all to ui_companion_driver.c
This commit is contained in:
parent
ddff980161
commit
29dcf06a2e
@ -405,11 +405,7 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
|||||||
|
|
||||||
static void frontend_darwin_load_content(void)
|
static void frontend_darwin_load_content(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
ui_companion_driver_notify_content_loaded();
|
||||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
|
||||||
|
|
||||||
if (ui && ui->notify_content_loaded)
|
|
||||||
ui->notify_content_loaded(driver->ui_companion_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int frontend_darwin_get_rating(void)
|
static int frontend_darwin_get_rating(void)
|
||||||
|
@ -45,7 +45,6 @@ void main_exit(void *args)
|
|||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
|
||||||
|
|
||||||
event_command(EVENT_CMD_MENU_SAVE_CURRENT_CONFIG);
|
event_command(EVENT_CMD_MENU_SAVE_CURRENT_CONFIG);
|
||||||
|
|
||||||
@ -70,11 +69,7 @@ void main_exit(void *args)
|
|||||||
|
|
||||||
rarch_main_free();
|
rarch_main_free();
|
||||||
|
|
||||||
if (ui)
|
ui_companion_driver_deinit();
|
||||||
{
|
|
||||||
if (ui->deinit)
|
|
||||||
ui->deinit(driver->ui_companion_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
frontend_driver_shutdown(false);
|
frontend_driver_shutdown(false);
|
||||||
|
|
||||||
@ -248,15 +243,12 @@ int rarch_main(int argc, char *argv[], void *data)
|
|||||||
void *args = (void*)data;
|
void *args = (void*)data;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
settings_t *settings = NULL;
|
settings_t *settings = NULL;
|
||||||
driver_t *driver = NULL;
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
global_t *global = NULL;
|
global_t *global = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rarch_main_alloc();
|
rarch_main_alloc();
|
||||||
|
|
||||||
driver = driver_get_ptr();
|
|
||||||
|
|
||||||
frontend_driver_init_first(args);
|
frontend_driver_init_first(args);
|
||||||
rarch_main_new();
|
rarch_main_new();
|
||||||
|
|
||||||
@ -292,14 +284,7 @@ int rarch_main(int argc, char *argv[], void *data)
|
|||||||
system ? &system->info : NULL);
|
system ? &system->info : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (driver)
|
ui_companion_driver_init_first();
|
||||||
driver->ui_companion = (ui_companion_driver_t*)ui_companion_init_first();
|
|
||||||
|
|
||||||
if (driver->ui_companion && driver->ui_companion->toggle)
|
|
||||||
{
|
|
||||||
if (settings->ui.companion_start_on_boot)
|
|
||||||
driver->ui_companion->toggle(driver->ui_companion_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef HAVE_MAIN
|
#ifndef HAVE_MAIN
|
||||||
do
|
do
|
||||||
|
@ -38,17 +38,14 @@ static int generic_shader_action_parameter_right(
|
|||||||
struct video_shader *shader, struct video_shader_parameter *param,
|
struct video_shader *shader, struct video_shader_parameter *param,
|
||||||
unsigned type, const char *label, bool wraparound)
|
unsigned type, const char *label, bool wraparound)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
|
||||||
|
|
||||||
if (!shader)
|
if (!shader)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
param->current += param->step;
|
param->current += param->step;
|
||||||
param->current = min(max(param->minimum, param->current), param->maximum);
|
param->current = min(max(param->minimum, param->current), param->maximum);
|
||||||
|
|
||||||
if (ui->notify_refresh && ui_companion_is_on_foreground())
|
if (ui_companion_is_on_foreground())
|
||||||
ui->notify_refresh(driver->ui_companion_data);
|
ui_companion_driver_notify_refresh();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,8 +350,6 @@ static int playlist_association_right(unsigned type, const char *label,
|
|||||||
int core_setting_right(unsigned type, const char *label,
|
int core_setting_right(unsigned type, const char *label,
|
||||||
bool wraparound)
|
bool wraparound)
|
||||||
{
|
{
|
||||||
driver_t * driver = driver_get_ptr();
|
|
||||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
|
||||||
unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START;
|
unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START;
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
|
|
||||||
@ -362,8 +357,8 @@ int core_setting_right(unsigned type, const char *label,
|
|||||||
|
|
||||||
core_option_next(system->core_options, idx);
|
core_option_next(system->core_options, idx);
|
||||||
|
|
||||||
if (ui->notify_refresh && ui_companion_is_on_foreground())
|
if (ui_companion_is_on_foreground())
|
||||||
ui->notify_refresh(driver->ui_companion_data);
|
ui_companion_driver_notify_refresh();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3198,15 +3198,11 @@ void menu_displaylist_push_list_process(menu_displaylist_info_t *info)
|
|||||||
if (info->need_push)
|
if (info->need_push)
|
||||||
{
|
{
|
||||||
const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *menu_driver = menu_ctx_driver_get_ptr();
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
|
||||||
|
|
||||||
if (menu_driver->populate_entries)
|
if (menu_driver->populate_entries)
|
||||||
menu_driver->populate_entries(info->path, info->label, info->type);
|
menu_driver->populate_entries(info->path, info->label, info->type);
|
||||||
|
|
||||||
if (ui && driver)
|
ui_companion_driver_notify_list_loaded(info->list, info->menu_list);
|
||||||
ui->notify_list_loaded(driver->ui_companion_data,
|
|
||||||
info->list, info->menu_list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
|
||||||
|
#include "../configuration.h"
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -106,3 +107,57 @@ void ui_companion_event_command(enum event_command action)
|
|||||||
if (driver && ui && ui->event_command)
|
if (driver && ui && ui->event_command)
|
||||||
ui->event_command(driver->ui_companion_data, action);
|
ui->event_command(driver->ui_companion_data, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ui_companion_driver_deinit(void)
|
||||||
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||||
|
if (!ui)
|
||||||
|
return;
|
||||||
|
if (ui->deinit)
|
||||||
|
ui->deinit(driver->ui_companion_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_companion_driver_init_first(void)
|
||||||
|
{
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
if (driver)
|
||||||
|
driver->ui_companion = (ui_companion_driver_t*)ui_companion_init_first();
|
||||||
|
|
||||||
|
if (driver->ui_companion && driver->ui_companion->toggle)
|
||||||
|
{
|
||||||
|
if (settings->ui.companion_start_on_boot)
|
||||||
|
driver->ui_companion->toggle(driver->ui_companion_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_companion_driver_notify_refresh(void)
|
||||||
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||||
|
if (!ui)
|
||||||
|
return;
|
||||||
|
if (ui->notify_refresh)
|
||||||
|
ui->notify_refresh(driver->ui_companion_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_companion_driver_notify_list_loaded(file_list_t *list, file_list_t *menu_list)
|
||||||
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||||
|
if (!ui)
|
||||||
|
return;
|
||||||
|
if (ui->notify_list_loaded)
|
||||||
|
ui->notify_list_loaded(driver->ui_companion_data, list, menu_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_companion_driver_notify_content_loaded(void)
|
||||||
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||||
|
if (!ui)
|
||||||
|
return;
|
||||||
|
if (ui->notify_content_loaded)
|
||||||
|
ui->notify_content_loaded(driver->ui_companion_data);
|
||||||
|
}
|
||||||
|
@ -74,12 +74,22 @@ const ui_companion_driver_t *ui_companion_get_ptr(void);
|
|||||||
**/
|
**/
|
||||||
const ui_companion_driver_t *ui_companion_init_first(void);
|
const ui_companion_driver_t *ui_companion_init_first(void);
|
||||||
|
|
||||||
|
void ui_companion_driver_init_first(void);
|
||||||
|
|
||||||
bool ui_companion_is_on_foreground(void);
|
bool ui_companion_is_on_foreground(void);
|
||||||
|
|
||||||
void ui_companion_set_foreground(unsigned enable);
|
void ui_companion_set_foreground(unsigned enable);
|
||||||
|
|
||||||
void ui_companion_event_command(enum event_command action);
|
void ui_companion_event_command(enum event_command action);
|
||||||
|
|
||||||
|
void ui_companion_driver_deinit(void);
|
||||||
|
|
||||||
|
void ui_companion_driver_notify_refresh(void);
|
||||||
|
|
||||||
|
void ui_companion_driver_notify_list_loaded(file_list_t *list, file_list_t *menu_list);
|
||||||
|
|
||||||
|
void ui_companion_driver_notify_content_loaded(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user