mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 18:40:49 +00:00
Move menu_context.c code into driver.c
This commit is contained in:
parent
f3cae240e0
commit
aadb940da8
2
Makefile
2
Makefile
@ -95,7 +95,7 @@ ifneq ($(findstring Linux,$(OS)),)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_RGUI), 1)
|
ifeq ($(HAVE_RGUI), 1)
|
||||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||||
DEFINES += -DHAVE_MENU
|
DEFINES += -DHAVE_MENU
|
||||||
ifeq ($(HAVE_LAKKA), 1)
|
ifeq ($(HAVE_LAKKA), 1)
|
||||||
OBJ += frontend/menu/disp/lakka.o
|
OBJ += frontend/menu/disp/lakka.o
|
||||||
|
@ -70,7 +70,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(HAVE_RGUI), 1)
|
ifeq ($(HAVE_RGUI), 1)
|
||||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
||||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_SDL), 1)
|
ifeq ($(HAVE_SDL), 1)
|
||||||
|
@ -114,7 +114,7 @@ JLIBS =
|
|||||||
|
|
||||||
ifeq ($(HAVE_RGUI), 1)
|
ifeq ($(HAVE_RGUI), 1)
|
||||||
DEFINES += -DHAVE_RGUI -DHAVE_MENU
|
DEFINES += -DHAVE_RGUI -DHAVE_MENU
|
||||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_SDL), 1)
|
ifeq ($(HAVE_SDL), 1)
|
||||||
|
87
driver.c
87
driver.c
@ -1647,5 +1647,92 @@ void uninit_video_input(void)
|
|||||||
compute_monitor_fps_statistics();
|
compute_monitor_fps_statistics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||||
|
#if defined(HAVE_RMENU)
|
||||||
|
&menu_ctx_rmenu,
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_RMENU_XUI)
|
||||||
|
&menu_ctx_rmenu_xui,
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_RGUI)
|
||||||
|
&menu_ctx_rgui,
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_LAKKA)
|
||||||
|
&menu_ctx_lakka,
|
||||||
|
#endif
|
||||||
|
NULL // zero length array is not valid
|
||||||
|
};
|
||||||
|
|
||||||
|
const void *menu_ctx_find_driver(const char *ident)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for (i = 0; menu_ctx_drivers[i]; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(menu_ctx_drivers[i]->ident, ident) == 0)
|
||||||
|
return menu_ctx_drivers[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int find_menu_driver_index(const char *driver)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for (i = 0; menu_ctx_drivers[i]; i++)
|
||||||
|
if (strcasecmp(driver, menu_ctx_drivers[i]->ident) == 0)
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void find_prev_menu_driver(void)
|
||||||
|
{
|
||||||
|
int i = find_menu_driver_index(g_settings.menu.driver);
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i - 1]->ident, sizeof(g_settings.menu.driver));
|
||||||
|
driver.menu_ctx = (menu_ctx_driver_t*)menu_ctx_drivers[i - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
RARCH_WARN("Couldn't find any previous menu driver (current one: \"%s\").\n", g_settings.menu.driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
void find_next_menu_driver(void)
|
||||||
|
{
|
||||||
|
int i = find_menu_driver_index(g_settings.menu.driver);
|
||||||
|
if (i >= 0 && menu_ctx_drivers[i + 1])
|
||||||
|
{
|
||||||
|
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i + 1]->ident, sizeof(g_settings.menu.driver));
|
||||||
|
driver.menu_ctx = (menu_ctx_driver_t*)menu_ctx_drivers[i + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
RARCH_WARN("Couldn't find any next menu driver (current one: \"%s\").\n", g_settings.menu.driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool menu_ctx_init_first(const void **driver_data, void **data)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
const menu_ctx_driver_t **driver = (const menu_ctx_driver_t**)driver_data;
|
||||||
|
|
||||||
|
if (!menu_ctx_drivers[0])
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (i = 0; menu_ctx_drivers[i]; i++)
|
||||||
|
{
|
||||||
|
void *h = menu_ctx_drivers[i]->init();
|
||||||
|
|
||||||
|
if (h)
|
||||||
|
{
|
||||||
|
*driver = menu_ctx_drivers[i];
|
||||||
|
*data = (void*)h;
|
||||||
|
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i]->ident, sizeof(g_settings.menu.driver));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
driver_t driver;
|
driver_t driver;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "../menu_common.h"
|
#include "../menu_common.h"
|
||||||
#include "../menu_context.h"
|
|
||||||
#include "../file_list.h"
|
#include "../file_list.h"
|
||||||
#include "../../../general.h"
|
#include "../../../general.h"
|
||||||
#include "../../../gfx/gfx_common.h"
|
#include "../../../gfx/gfx_common.h"
|
||||||
|
@ -1,105 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
||||||
*
|
|
||||||
* 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 "menu_common.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "../../config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
|
||||||
#if defined(HAVE_RMENU)
|
|
||||||
&menu_ctx_rmenu,
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_RMENU_XUI)
|
|
||||||
&menu_ctx_rmenu_xui,
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_RGUI)
|
|
||||||
&menu_ctx_rgui,
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_LAKKA)
|
|
||||||
&menu_ctx_lakka,
|
|
||||||
#endif
|
|
||||||
NULL // zero length array is not valid
|
|
||||||
};
|
|
||||||
|
|
||||||
const void *menu_ctx_find_driver(const char *ident)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
for (i = 0; menu_ctx_drivers[i]; i++)
|
|
||||||
{
|
|
||||||
if (strcmp(menu_ctx_drivers[i]->ident, ident) == 0)
|
|
||||||
return menu_ctx_drivers[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int find_menu_driver_index(const char *driver)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
for (i = 0; menu_ctx_drivers[i]; i++)
|
|
||||||
if (strcasecmp(driver, menu_ctx_drivers[i]->ident) == 0)
|
|
||||||
return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void find_prev_menu_driver(void)
|
|
||||||
{
|
|
||||||
int i = find_menu_driver_index(g_settings.menu.driver);
|
|
||||||
if (i > 0)
|
|
||||||
{
|
|
||||||
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i - 1]->ident, sizeof(g_settings.menu.driver));
|
|
||||||
driver.menu_ctx = (menu_ctx_driver_t*)menu_ctx_drivers[i - 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
RARCH_WARN("Couldn't find any previous menu driver (current one: \"%s\").\n", g_settings.menu.driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
void find_next_menu_driver(void)
|
|
||||||
{
|
|
||||||
int i = find_menu_driver_index(g_settings.menu.driver);
|
|
||||||
if (i >= 0 && menu_ctx_drivers[i + 1])
|
|
||||||
{
|
|
||||||
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i + 1]->ident, sizeof(g_settings.menu.driver));
|
|
||||||
driver.menu_ctx = (menu_ctx_driver_t*)menu_ctx_drivers[i + 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
RARCH_WARN("Couldn't find any next menu driver (current one: \"%s\").\n", g_settings.menu.driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool menu_ctx_init_first(const void **driver_data, void **data)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
const menu_ctx_driver_t **driver = (const menu_ctx_driver_t**)driver_data;
|
|
||||||
|
|
||||||
if (!menu_ctx_drivers[0])
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (i = 0; menu_ctx_drivers[i]; i++)
|
|
||||||
{
|
|
||||||
void *h = menu_ctx_drivers[i]->init();
|
|
||||||
|
|
||||||
if (h)
|
|
||||||
{
|
|
||||||
*driver = menu_ctx_drivers[i];
|
|
||||||
*data = (void*)h;
|
|
||||||
strlcpy(g_settings.menu.driver, menu_ctx_drivers[i]->ident, sizeof(g_settings.menu.driver));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -577,7 +577,6 @@ MENU
|
|||||||
#include "../frontend/menu/menu_input_line_cb.c"
|
#include "../frontend/menu/menu_input_line_cb.c"
|
||||||
#include "../frontend/menu/menu_common.c"
|
#include "../frontend/menu/menu_common.c"
|
||||||
#include "../frontend/menu/menu_navigation.c"
|
#include "../frontend/menu/menu_navigation.c"
|
||||||
#include "../frontend/menu/menu_context.c"
|
|
||||||
#include "../frontend/menu/menu_settings.c"
|
#include "../frontend/menu/menu_settings.c"
|
||||||
#include "../frontend/menu/history.c"
|
#include "../frontend/menu/history.c"
|
||||||
#include "../frontend/menu/file_list.c"
|
#include "../frontend/menu/file_list.c"
|
||||||
|
@ -222,7 +222,6 @@
|
|||||||
<ClCompile Include="..\..\frontend\menu\menu_input_line_cb.c" />
|
<ClCompile Include="..\..\frontend\menu\menu_input_line_cb.c" />
|
||||||
<ClCompile Include="..\..\frontend\menu\menu_navigation.c" />
|
<ClCompile Include="..\..\frontend\menu\menu_navigation.c" />
|
||||||
<ClCompile Include="..\..\frontend\menu\menu_settings.c" />
|
<ClCompile Include="..\..\frontend\menu\menu_settings.c" />
|
||||||
<ClCompile Include="..\..\frontend\menu\menu_context.c" />
|
|
||||||
<ClCompile Include="..\..\frontend\info\core_info.c" />
|
<ClCompile Include="..\..\frontend\info\core_info.c" />
|
||||||
<ClCompile Include="..\..\gfx\d3d9\d3d.cpp" />
|
<ClCompile Include="..\..\gfx\d3d9\d3d.cpp" />
|
||||||
<ClCompile Include="..\..\gfx\context\d3d_ctx.cpp" />
|
<ClCompile Include="..\..\gfx\context\d3d_ctx.cpp" />
|
||||||
|
@ -38,9 +38,6 @@
|
|||||||
<ClCompile Include="..\..\frontend\menu\menu_common.c">
|
<ClCompile Include="..\..\frontend\menu\menu_common.c">
|
||||||
<Filter>frontend\menu</Filter>
|
<Filter>frontend\menu</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\frontend\menu\menu_context.c">
|
|
||||||
<Filter>frontend\menu</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\frontend\menu\menu_settings.c">
|
<ClCompile Include="..\..\frontend\menu\menu_settings.c">
|
||||||
<Filter>frontend\menu</Filter>
|
<Filter>frontend\menu</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user