mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-24 05:31:15 +00:00
(UI Companion) Start creating UI companion interface
This commit is contained in:
parent
070147187d
commit
4c2b301efb
@ -94,6 +94,8 @@ endif
|
||||
OBJ += frontend/frontend.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
ui/ui_companion_driver.o \
|
||||
ui/drivers/ui_null.o \
|
||||
libretro_version_1.o \
|
||||
retroarch.o \
|
||||
runloop.o \
|
||||
|
2
driver.h
2
driver.h
@ -27,6 +27,7 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "frontend/frontend_driver.h"
|
||||
#include "ui/ui_companion_driver.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
|
||||
@ -190,6 +191,7 @@ enum
|
||||
typedef struct driver
|
||||
{
|
||||
const frontend_ctx_driver_t *frontend_ctx;
|
||||
const ui_companion_driver_t *ui_companion;
|
||||
const audio_driver_t *audio;
|
||||
const video_driver_t *video;
|
||||
const void *video_context;
|
||||
|
@ -634,6 +634,13 @@ FRONTEND
|
||||
|
||||
#include "../core_info.c"
|
||||
|
||||
/*============================================================
|
||||
UI
|
||||
============================================================ */
|
||||
#include "../ui/ui_companion_driver.c"
|
||||
|
||||
#include "../ui/drivers/ui_null.c"
|
||||
|
||||
/*============================================================
|
||||
MAIN
|
||||
============================================================ */
|
||||
|
40
ui/drivers/ui_null.c
Normal file
40
ui/drivers/ui_null.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2015 - Ali Bouhlel
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include "../ui_companion_driver.h"
|
||||
|
||||
static void ui_companion_null_deinit(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void ui_companion_null_init(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const ui_companion_driver_t ui_companion_null = {
|
||||
ui_companion_null_init,
|
||||
ui_companion_null_deinit,
|
||||
NULL,
|
||||
NULL,
|
||||
"null",
|
||||
};
|
77
ui/ui_companion_driver.c
Normal file
77
ui/ui_companion_driver.c
Normal file
@ -0,0 +1,77 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ui_companion_driver.h"
|
||||
#include "../driver.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||
&ui_companion_null,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* ui_companion_find_driver:
|
||||
* @ident : Identifier name of driver to find.
|
||||
*
|
||||
* Finds driver with @ident. Does not initialize.
|
||||
*
|
||||
* Returns: pointer to driver if successful, otherwise NULL.
|
||||
**/
|
||||
const ui_companion_driver_t *ui_companion_find_driver(const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; ui_companion_drivers[i]; i++)
|
||||
{
|
||||
if (strcmp(ui_companion_drivers[i]->ident, ident) == 0)
|
||||
return ui_companion_drivers[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* ui_companion_init_first:
|
||||
*
|
||||
* Finds first suitable driver and initialize.
|
||||
*
|
||||
* Returns: pointer to first suitable driver, otherwise NULL.
|
||||
**/
|
||||
const ui_companion_driver_t *ui_companion_init_first(void)
|
||||
{
|
||||
unsigned i;
|
||||
const ui_companion_driver_t *ui_companion = NULL;
|
||||
|
||||
for (i = 0; ui_companion_drivers[i]; i++)
|
||||
{
|
||||
ui_companion = ui_companion_drivers[i];
|
||||
break;
|
||||
}
|
||||
|
||||
return ui_companion;
|
||||
}
|
||||
|
||||
const ui_companion_driver_t *ui_companion_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return NULL;
|
||||
return driver->ui_companion;
|
||||
}
|
68
ui/ui_companion_driver.h
Normal file
68
ui/ui_companion_driver.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __UI_COMPANION_DRIVER_H
|
||||
#define __UI_COMPANION_DRIVER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ui_companion_driver
|
||||
{
|
||||
void (*init)(void *data);
|
||||
void (*deinit)(void *data);
|
||||
void (*toggle_companion_ui)(void);
|
||||
void (*notify_content_loaded)(void);
|
||||
|
||||
const char *ident;
|
||||
} ui_companion_driver_t;
|
||||
|
||||
extern const ui_companion_driver_t ui_companion_null;
|
||||
|
||||
/**
|
||||
* ui_companion_find_driver:
|
||||
* @ident : Identifier name of driver to find.
|
||||
*
|
||||
* Finds driver with @ident. Does not initialize.
|
||||
*
|
||||
* Returns: pointer to driver if successful, otherwise NULL.
|
||||
**/
|
||||
const ui_companion_driver_t *ui_companion_find_driver(const char *ident);
|
||||
|
||||
const ui_companion_driver_t *ui_companion_get_ptr(void);
|
||||
|
||||
/**
|
||||
* ui_companion_init_first:
|
||||
*
|
||||
* Finds first suitable driver and initialize.
|
||||
*
|
||||
* Returns: pointer to first suitable driver, otherwise NULL.
|
||||
**/
|
||||
const ui_companion_driver_t *ui_companion_init_first(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user