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-06-26 15:28:01 +02:00
|
|
|
#include "../menu_cbs.h"
|
2020-06-27 19:33:49 +02:00
|
|
|
#include "../menu_dialog.h"
|
2016-11-06 13:05:28 +01:00
|
|
|
|
2019-01-27 11:22:16 -05:00
|
|
|
#include "../../configuration.h"
|
|
|
|
|
2017-08-15 20:20:24 -05:00
|
|
|
#ifdef HAVE_NETWORKING
|
|
|
|
#include "../../network/netplay/netplay_discovery.h"
|
|
|
|
#endif
|
|
|
|
|
2020-03-28 01:59:15 +01:00
|
|
|
#ifndef BIND_ACTION_INFO
|
|
|
|
#define BIND_ACTION_INFO(cbs, name) (cbs)->action_info = (name)
|
|
|
|
#endif
|
|
|
|
|
2018-04-11 06:11:23 +02:00
|
|
|
static int action_info_default(unsigned type, const char *label)
|
2015-02-27 03:08:30 +01:00
|
|
|
{
|
2017-09-10 22:38:03 +02:00
|
|
|
menu_displaylist_info_t info;
|
2020-03-02 20:10:24 +01:00
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
|
|
size_t selection = menu_navigation_get_selection();
|
2019-07-12 16:31:16 +02:00
|
|
|
#ifdef HAVE_AUDIOMIXER
|
2020-03-02 20:10:24 +01:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
bool audio_enable_menu = settings->bools.audio_enable_menu;
|
|
|
|
bool audio_enable_menu_notice = settings->bools.audio_enable_menu_notice;
|
2019-07-12 16:31:16 +02:00
|
|
|
#endif
|
2015-06-13 16:22:05 +02:00
|
|
|
|
2017-09-10 22:38:03 +02:00
|
|
|
menu_displaylist_info_init(&info);
|
|
|
|
|
2017-04-23 14:31:49 +02:00
|
|
|
info.list = menu_stack;
|
|
|
|
info.directory_ptr = selection;
|
|
|
|
info.enum_idx = MENU_ENUM_LABEL_INFO_SCREEN;
|
2017-09-28 02:45:03 +02:00
|
|
|
info.label = strdup(
|
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN));
|
2015-05-18 03:18:39 +02:00
|
|
|
|
2018-04-11 06:11:45 +02:00
|
|
|
if (!menu_displaylist_ctl(DISPLAYLIST_HELP, &info))
|
2017-09-10 22:57:26 +02:00
|
|
|
goto error;
|
2016-02-24 22:56:41 +01:00
|
|
|
|
2019-07-11 11:51:06 +02:00
|
|
|
#ifdef HAVE_AUDIOMIXER
|
2020-03-02 20:10:24 +01:00
|
|
|
if (audio_enable_menu && audio_enable_menu_notice)
|
2019-01-27 11:22:16 -05:00
|
|
|
audio_driver_mixer_play_menu_sound(AUDIO_MIXER_SYSTEM_SLOT_NOTICE);
|
2019-07-11 11:51:06 +02:00
|
|
|
#endif
|
2019-01-27 11:22:16 -05:00
|
|
|
|
2017-05-26 20:12:52 +02:00
|
|
|
if (!menu_displaylist_process(&info))
|
2017-09-10 22:57:26 +02:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
menu_displaylist_info_free(&info);
|
2016-02-24 23:19:53 +01:00
|
|
|
|
|
|
|
return 0;
|
2017-09-10 22:57:26 +02:00
|
|
|
|
|
|
|
error:
|
|
|
|
menu_displaylist_info_free(&info);
|
|
|
|
return -1;
|
2015-02-27 03:08:30 +01:00
|
|
|
}
|
|
|
|
|
2016-11-06 13:05:28 +01:00
|
|
|
#ifdef HAVE_CHEEVOS
|
2018-04-11 06:12:08 +02:00
|
|
|
int generic_action_ok_help(const char *path,
|
2016-11-06 13:05:28 +01:00
|
|
|
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
|
|
|
enum msg_hash_enums id, enum menu_dialog_type id2);
|
|
|
|
|
2018-04-11 06:11:23 +02:00
|
|
|
static int action_info_cheevos(unsigned type, const char *label)
|
2016-11-06 13:05:28 +01:00
|
|
|
{
|
|
|
|
unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START;
|
|
|
|
|
|
|
|
menu_dialog_set_current_id(new_id);
|
|
|
|
|
2018-04-11 06:12:08 +02:00
|
|
|
return generic_action_ok_help(NULL, label, new_id, 0, 0,
|
2017-08-15 20:20:24 -05:00
|
|
|
MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION,
|
|
|
|
MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-06-12 16:01:46 +02:00
|
|
|
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
|
2016-07-01 19:13:25 +02:00
|
|
|
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
|
2017-12-11 23:55:31 -08:00
|
|
|
if ((type >= MENU_SETTINGS_CHEEVOS_START) &&
|
2017-08-15 20:20:24 -05:00
|
|
|
(type < MENU_SETTINGS_NETPLAY_ROOMS_START))
|
2016-11-06 13:05:28 +01:00
|
|
|
{
|
|
|
|
BIND_ACTION_INFO(cbs, action_info_cheevos);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-10-11 20:26:44 +02:00
|
|
|
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
|
|
|
}
|