RetroArch/menu/cbs/menu_cbs_info.c

90 lines
2.6 KiB
C
Raw Normal View History

2015-02-27 03:08:30 +01:00
/* RetroArch - A frontend for libretro.
2017-01-22 13:40:32 +01:00
* Copyright (C) 2011-2017 - Daniel De Matteis
2015-02-27 03:08:30 +01:00
*
* 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/>.
*/
2015-06-13 19:12:10 +02:00
#include <compat/strl.h>
2015-12-06 17:55:27 +01:00
#include "../menu_driver.h"
2015-12-09 09:53:43 +01:00
#include "../menu_navigation.h"
2015-06-26 15:28:01 +02:00
#include "../menu_cbs.h"
2015-02-27 03:08:30 +01:00
2016-11-06 13:05:28 +01:00
#include "../widgets/menu_dialog.h"
#ifndef BIND_ACTION_INFO
#define BIND_ACTION_INFO(cbs, name) \
cbs->action_info = name; \
cbs->action_info_ident = #name;
#endif
2015-05-31 22:40:26 +02:00
static int action_info_default(unsigned type, const char *label)
2015-02-27 03:08:30 +01:00
{
2015-09-25 18:46:12 +02:00
size_t selection = 0;
2015-05-18 03:18:39 +02:00
menu_displaylist_info_t info = {0};
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
2015-06-13 16:22:05 +02:00
2015-09-25 18:46:12 +02:00
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return 0;
2015-06-13 16:22:05 +02:00
info.list = menu_stack;
2015-09-25 18:46:12 +02:00
info.directory_ptr = selection;
2016-06-17 23:47:23 +02:00
info.enum_idx = MENU_ENUM_LABEL_INFO_SCREEN;
2015-06-19 04:40:43 +02:00
strlcpy(info.label,
msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN),
2015-06-19 04:40:43 +02:00
sizeof(info.label));
2015-05-18 03:18:39 +02:00
2016-02-24 23:19:53 +01:00
if (!menu_displaylist_ctl(DISPLAYLIST_HELP, &info))
return -1;
2016-02-24 23:19:53 +01:00
if (!menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info))
return -1;
return 0;
2015-02-27 03:08:30 +01:00
}
2016-11-06 13:05:28 +01:00
#ifdef HAVE_CHEEVOS
int generic_action_ok_help(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx,
enum msg_hash_enums id, enum menu_dialog_type id2);
static int action_info_cheevos(unsigned type, const char *label)
{
unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START;
menu_dialog_set_current_id(new_id);
return generic_action_ok_help(NULL, label, new_id, 0, 0,
MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION,
MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION);
}
#endif
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
2015-02-27 03:08:30 +01:00
{
if (!cbs)
2015-06-07 18:36:10 +02:00
return -1;
2015-02-27 03:08:30 +01:00
2016-11-06 13:05:28 +01:00
#ifdef HAVE_CHEEVOS
if ((type >= MENU_SETTINGS_CHEEVOS_START))
{
BIND_ACTION_INFO(cbs, action_info_cheevos);
return 0;
}
#endif
BIND_ACTION_INFO(cbs, action_info_default);
2015-06-07 18:36:10 +02:00
return -1;
2015-02-27 03:08:30 +01:00
}