mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Create menu_driver_ctl
This commit is contained in:
parent
c8d8176c0c
commit
783881941a
4
driver.c
4
driver.c
@ -373,7 +373,7 @@ void init_drivers(int flags)
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* By default, we want the menu to persist through driver reinits. */
|
||||
driver->menu_data_own = true;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_OWN_DRIVER, NULL);
|
||||
#endif
|
||||
|
||||
if (flags & (DRIVER_VIDEO | DRIVER_AUDIO))
|
||||
@ -441,7 +441,7 @@ void uninit_drivers(int flags)
|
||||
{
|
||||
menu_driver_context_destroy();
|
||||
|
||||
if (!driver->menu_data_own)
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_OWNS_DRIVER, NULL))
|
||||
{
|
||||
menu_free(driver->menu);
|
||||
driver->menu = NULL;
|
||||
|
3
driver.h
3
driver.h
@ -219,9 +219,6 @@ typedef struct driver
|
||||
* set this to true at the end of its 'init' function. */
|
||||
bool camera_data_own;
|
||||
bool location_data_own;
|
||||
#ifdef HAVE_MENU
|
||||
bool menu_data_own;
|
||||
#endif
|
||||
} driver_t;
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,9 @@
|
||||
#include "../runloop.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../menu/menu_driver.h"
|
||||
#endif
|
||||
|
||||
#define MAX_ARGS 32
|
||||
|
||||
@ -52,9 +55,8 @@ void main_exit(void *args)
|
||||
if (global->inited.main)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
driver_t *driver = driver_get_ptr();
|
||||
/* Do not want menu context to live any more. */
|
||||
driver->menu_data_own = false;
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UNSET_OWN_DRIVER, NULL);
|
||||
#endif
|
||||
rarch_main_deinit();
|
||||
}
|
||||
|
@ -373,3 +373,24 @@ int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
{
|
||||
static bool menu_driver_data_own = false;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case RARCH_MENU_CTL_SET_OWN_DRIVER:
|
||||
menu_driver_data_own = true;
|
||||
break;
|
||||
case RARCH_MENU_CTL_UNSET_OWN_DRIVER:
|
||||
menu_driver_data_own = false;
|
||||
break;
|
||||
case RARCH_MENU_CTL_OWNS_DRIVER:
|
||||
return menu_driver_data_own;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -62,6 +62,14 @@ typedef enum
|
||||
MENU_HELP_LAST
|
||||
} menu_help_type_t;
|
||||
|
||||
enum rarch_menu_ctl_state
|
||||
{
|
||||
RARCH_MENU_CTL_NONE = 0,
|
||||
RARCH_MENU_CTL_SET_OWN_DRIVER,
|
||||
RARCH_MENU_CTL_UNSET_OWN_DRIVER,
|
||||
RARCH_MENU_CTL_OWNS_DRIVER
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *userdata;
|
||||
@ -234,6 +242,8 @@ int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
||||
/* HACK */
|
||||
extern unsigned int rdb_entry_start_game_selection_ptr;
|
||||
|
||||
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user