mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(UI companion) Some further improvements
This commit is contained in:
parent
4c2b301efb
commit
f8a31effb0
3
driver.h
3
driver.h
@ -212,9 +212,8 @@ typedef struct driver
|
|||||||
void *location_data;
|
void *location_data;
|
||||||
void *resampler_data;
|
void *resampler_data;
|
||||||
void *recording_data;
|
void *recording_data;
|
||||||
#ifdef HAVE_NETPLAY
|
|
||||||
void *netplay_data;
|
void *netplay_data;
|
||||||
#endif
|
void *ui_companion_data;
|
||||||
|
|
||||||
bool audio_active;
|
bool audio_active;
|
||||||
bool video_active;
|
bool video_active;
|
||||||
|
@ -91,6 +91,7 @@ void main_exit(args_type() args)
|
|||||||
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 frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||||
|
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||||
|
|
||||||
global->system.shutdown = false;
|
global->system.shutdown = false;
|
||||||
|
|
||||||
@ -123,6 +124,12 @@ void main_exit(args_type() args)
|
|||||||
|
|
||||||
rarch_main_free();
|
rarch_main_free();
|
||||||
|
|
||||||
|
if (ui)
|
||||||
|
{
|
||||||
|
if (ui->deinit)
|
||||||
|
ui->deinit(driver->ui_companion_data);
|
||||||
|
}
|
||||||
|
|
||||||
if (frontend)
|
if (frontend)
|
||||||
{
|
{
|
||||||
if (frontend->shutdown)
|
if (frontend->shutdown)
|
||||||
@ -333,6 +340,9 @@ returntype main_entry(signature())
|
|||||||
&global->system.info);
|
&global->system.info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (driver)
|
||||||
|
driver->ui_companion = (ui_companion_driver_t*)ui_companion_init_first();
|
||||||
|
|
||||||
#if defined(HAVE_MAIN_LOOP)
|
#if defined(HAVE_MAIN_LOOP)
|
||||||
while (rarch_main_iterate() != -1);
|
while (rarch_main_iterate() != -1);
|
||||||
|
|
||||||
|
@ -16,19 +16,33 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
#include "../ui_companion_driver.h"
|
#include "../ui_companion_driver.h"
|
||||||
|
|
||||||
|
typedef struct ui_companion_null
|
||||||
|
{
|
||||||
|
void *empty;
|
||||||
|
} ui_companion_null_t;
|
||||||
|
|
||||||
static void ui_companion_null_deinit(void *data)
|
static void ui_companion_null_deinit(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
ui_companion_null_t *handle = (ui_companion_null_t*)data;
|
||||||
|
|
||||||
|
if (handle)
|
||||||
|
free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_companion_null_init(void *data)
|
static void *ui_companion_null_init(void)
|
||||||
{
|
{
|
||||||
(void)data;
|
ui_companion_null_t *handle = (ui_companion_null_t*)calloc(1, sizeof(*handle));
|
||||||
|
|
||||||
|
if (!handle)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ui_companion_driver_t ui_companion_null = {
|
const ui_companion_driver_t ui_companion_null = {
|
||||||
|
@ -57,15 +57,11 @@ const ui_companion_driver_t *ui_companion_find_driver(const char *ident)
|
|||||||
const ui_companion_driver_t *ui_companion_init_first(void)
|
const ui_companion_driver_t *ui_companion_init_first(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
const ui_companion_driver_t *ui_companion = NULL;
|
|
||||||
|
|
||||||
for (i = 0; ui_companion_drivers[i]; i++)
|
for (i = 0; ui_companion_drivers[i]; i++)
|
||||||
{
|
return ui_companion_drivers[i];
|
||||||
ui_companion = ui_companion_drivers[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ui_companion;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ui_companion_driver_t *ui_companion_get_ptr(void)
|
const ui_companion_driver_t *ui_companion_get_ptr(void)
|
||||||
|
@ -30,7 +30,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct ui_companion_driver
|
typedef struct ui_companion_driver
|
||||||
{
|
{
|
||||||
void (*init)(void *data);
|
void *(*init)(void);
|
||||||
void (*deinit)(void *data);
|
void (*deinit)(void *data);
|
||||||
void (*toggle_companion_ui)(void);
|
void (*toggle_companion_ui)(void);
|
||||||
void (*notify_content_loaded)(void);
|
void (*notify_content_loaded)(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user