RetroArch/menu/cbs/menu_cbs_sublabel.c

150 lines
4.5 KiB
C
Raw Normal View History

2016-10-20 15:57:35 +02:00
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2016 - 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 <compat/strl.h>
#include <file/file_path.h>
#include "../menu_driver.h"
#include "../menu_cbs.h"
#include "../menu_navigation.h"
#include "../../file_path_special.h"
#ifndef BIND_ACTION_SUBLABEL
#define BIND_ACTION_SUBLABEL(cbs, name) \
cbs->action_sublabel = name; \
cbs->action_sublabel_ident = #name;
#endif
static int action_bind_sublabel_generic(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
return 0;
}
2016-10-20 16:10:20 +02:00
static int action_bind_sublabel_video_settings_list(
2016-10-20 15:57:35 +02:00
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
2016-10-20 16:10:20 +02:00
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS), len);
2016-10-20 15:57:35 +02:00
return 0;
}
2016-10-20 17:45:35 +02:00
static int action_bind_sublabel_suspend_screensaver_enable(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE), len);
return 0;
}
2016-10-20 16:19:14 +02:00
static int action_bind_sublabel_audio_settings_list(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_AUDIO_SETTINGS), len);
return 0;
}
2016-10-20 19:42:42 +02:00
static int action_bind_sublabel_max_swapchain_images(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_VIDEO_MAX_SWAPCHAIN_IMAGES), len);
return 0;
}
static int action_bind_sublabel_online_updater(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_ONLINE_UPDATER), len);
return 0;
}
2016-10-20 19:28:45 +02:00
static int action_bind_sublabel_fps_show(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_FPS_SHOW), len);
return 0;
}
2016-10-20 19:50:25 +02:00
static int action_bind_sublabel_netplay_settings(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_NETPLAY), len);
return 0;
}
2016-10-20 15:57:35 +02:00
int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
{
if (!cbs)
return -1;
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_generic);
if (cbs->enum_idx != MSG_UNKNOWN)
{
switch (cbs->enum_idx)
{
2016-10-20 19:50:25 +02:00
case MENU_ENUM_LABEL_NETPLAY:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_netplay_settings);
break;
2016-10-20 19:42:42 +02:00
case MENU_ENUM_LABEL_ONLINE_UPDATER:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_online_updater);
break;
case MENU_ENUM_LABEL_VIDEO_MAX_SWAPCHAIN_IMAGES:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_max_swapchain_images);
break;
2016-10-20 19:28:45 +02:00
case MENU_ENUM_LABEL_FPS_SHOW:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_fps_show);
break;
2016-10-20 16:10:20 +02:00
case MENU_ENUM_LABEL_VIDEO_SETTINGS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_settings_list);
2016-10-20 15:57:35 +02:00
break;
2016-10-20 16:19:14 +02:00
case MENU_ENUM_LABEL_AUDIO_SETTINGS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_settings_list);
break;
2016-10-20 17:45:35 +02:00
case MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_suspend_screensaver_enable);
break;
2016-10-20 15:57:35 +02:00
default:
case MSG_UNKNOWN:
2016-10-20 16:10:20 +02:00
return -1;
2016-10-20 15:57:35 +02:00
}
}
2016-10-20 16:10:20 +02:00
return 0;
2016-10-20 15:57:35 +02:00
}