2012-04-21 23:13:50 +02:00
/* RetroArch - A frontend for libretro.
2013-01-01 01:37:37 +01:00
* Copyright ( C ) 2010 - 2013 - Hans - Kristian Arntzen
* Copyright ( C ) 2011 - 2013 - Daniel De Matteis
2012-01-10 23:33:44 +01:00
*
2012-04-21 23:13:50 +02:00
* RetroArch is free software : you can redistribute it and / or modify it under the terms
2012-01-10 23:33:44 +01:00
* 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 .
*
2012-04-21 23:13:50 +02:00
* RetroArch is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ;
2012-01-10 23:33:44 +01:00
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE . See the GNU General Public License for more details .
*
2012-04-21 23:31:57 +02:00
* You should have received a copy of the GNU General Public License along with RetroArch .
2012-01-10 23:33:44 +01:00
* If not , see < http : //www.gnu.org/licenses/>.
*/
2013-01-09 17:49:43 +01:00
# include "rmenu.h"
# include "utils/file_browser.h"
2012-08-03 17:54:22 +02:00
# if defined(__CELLOS_LV2__)
2012-03-03 17:23:00 +01:00
# include <sdk_version.h>
2012-01-10 23:33:44 +01:00
2013-03-25 22:31:09 +01:00
# if (CELL_SDK_VERSION > 0x340000)
2012-03-03 17:23:00 +01:00
# include <sysutil/sysutil_bgmplayback.h>
# endif
2012-08-03 17:54:22 +02:00
# endif
2012-07-28 15:54:35 +02:00
# include "../../console/rarch_console.h"
2012-08-03 17:54:22 +02:00
2012-08-05 17:18:19 +02:00
# include "../../gfx/image.h"
2013-03-09 03:20:33 +01:00
# include "../../gfx/gfx_common.h"
2012-06-20 08:25:23 +02:00
# include "../../gfx/gfx_context.h"
2012-08-03 17:54:22 +02:00
2012-06-20 08:25:23 +02:00
# include "../../file.h"
2013-01-13 05:52:00 +01:00
# include "../../driver.h"
2012-06-20 08:25:23 +02:00
# include "../../general.h"
2012-01-10 23:33:44 +01:00
2013-04-10 11:20:28 +02:00
# ifdef HAVE_SHADER_MANAGER
# include "../../gfx/shader_parse.h"
2013-04-13 21:40:48 +02:00
# define EXT_SHADERS "cg"
# define EXT_CGP_PRESETS "cgp"
2013-04-10 00:47:14 +02:00
# endif
2013-04-10 09:34:46 +02:00
# ifdef _XBOX1
2013-04-10 11:20:28 +02:00
# define JPEG_FORMATS ""
# else
# define JPEG_FORMATS "|jpg|JPG|JPEG|jpeg"
2013-04-10 09:34:46 +02:00
# endif
2012-02-20 22:34:11 +01:00
2013-04-10 11:20:28 +02:00
# define EXT_IMAGES "png|PNG"JPEG_FORMATS
# define EXT_INPUT_PRESETS "cfg|CFG"
2013-04-10 09:34:46 +02:00
struct texture_image * menu_texture ;
# ifdef HAVE_MENU_PANEL
struct texture_image * menu_panel ;
2013-04-10 04:26:18 +02:00
# endif
2013-03-10 15:23:34 +01:00
const char drive_mappings [ ] [ 32 ] = {
# if defined(_XBOX1)
" C: " ,
" D: " ,
" E: " ,
" F: " ,
" G: "
# elif defined(__CELLOS_LV2__)
" /app_home/ " ,
" /dev_hdd0/ " ,
" /dev_hdd1/ " ,
" /host_root/ "
# endif
} ;
2013-05-05 17:21:15 +02:00
# if defined(_XBOX1)
# define TICKER_LABEL_CHARS_MAX_PER_LINE 16
# else
# define TICKER_LABEL_CHARS_MAX_PER_LINE 25
# endif
2013-03-10 15:23:34 +01:00
# if defined__CELLOS_LV2__
2013-04-14 14:59:36 +02:00
size_t drive_mapping_idx = 1 ;
2013-03-10 15:23:34 +01:00
# elif defined(_XBOX1)
2013-04-14 14:59:36 +02:00
size_t drive_mapping_idx = 2 ;
2013-03-10 15:23:34 +01:00
# else
2013-04-14 14:59:36 +02:00
size_t drive_mapping_idx = 0 ;
2013-03-10 15:23:34 +01:00
# endif
static const char * menu_drive_mapping_previous ( void )
{
2013-03-25 22:31:09 +01:00
if ( drive_mapping_idx > 0 )
2013-03-10 15:23:34 +01:00
drive_mapping_idx - - ;
return drive_mappings [ drive_mapping_idx ] ;
}
static const char * menu_drive_mapping_next ( void )
{
size_t arr_size = sizeof ( drive_mappings ) / sizeof ( drive_mappings [ 0 ] ) ;
2013-03-25 22:31:09 +01:00
if ( ( drive_mapping_idx + 1 ) < arr_size )
2013-03-10 15:23:34 +01:00
drive_mapping_idx + + ;
2013-03-25 22:31:09 +01:00
2013-03-10 15:23:34 +01:00
return drive_mappings [ drive_mapping_idx ] ;
}
2013-03-10 15:52:36 +01:00
# if defined(_XBOX1)
# define HARDCODE_FONT_SIZE 21
2013-04-10 01:34:40 +02:00
# define FONT_SIZE_VARIABLE FONT_SIZE
2013-03-10 15:52:36 +01:00
2013-04-07 05:20:19 +02:00
# define POSITION_X 60
# define POSITION_X_CENTER (POSITION_X + 350)
# define POSITION_Y_START 80
# define Y_POSITION 430
2013-03-10 15:52:36 +01:00
# define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT)
# define POSITION_Y_INCREMENT 20
2013-04-10 01:34:40 +02:00
# define COMMENT_POSITION_Y (Y_POSITION - ((POSITION_Y_INCREMENT / 2) * 3))
# define COMMENT_TWO_POSITION_Y (Y_POSITION - ((POSITION_Y_INCREMENT / 2) * 1))
# define CORE_MSG_POSITION_X FONT_SIZE
# define CORE_MSG_POSITION_Y (MSG_PREV_NEXT_Y_POSITION + 0.01f)
# define CORE_MSG_FONT_SIZE FONT_SIZE
2013-03-10 15:52:36 +01:00
# define MSG_QUEUE_X_POSITION POSITION_X
2013-04-07 05:20:19 +02:00
# define MSG_QUEUE_Y_POSITION (Y_POSITION - ((POSITION_Y_INCREMENT / 2) * 7) + 5)
2013-03-10 15:52:36 +01:00
# define MSG_QUEUE_FONT_SIZE HARDCODE_FONT_SIZE
# define MSG_PREV_NEXT_Y_POSITION 24
2013-04-07 05:20:19 +02:00
# define CURRENT_PATH_Y_POSITION (POSITION_Y_START - ((POSITION_Y_INCREMENT / 2)))
2013-03-10 15:52:36 +01:00
# define CURRENT_PATH_FONT_SIZE 21
2013-03-10 16:29:08 +01:00
# define FONT_SIZE 21
# define NUM_ENTRY_PER_PAGE 12
2013-03-10 15:52:36 +01:00
# elif defined(__CELLOS_LV2__)
# define HARDCODE_FONT_SIZE 0.91f
2013-04-10 01:34:40 +02:00
# define FONT_SIZE_VARIABLE g_settings.video.font_size
2013-03-10 15:52:36 +01:00
# define POSITION_X 0.09f
# define POSITION_X_CENTER 0.5f
# define POSITION_Y_START 0.17f
# define POSITION_Y_INCREMENT 0.035f
# define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT)
2013-04-10 01:34:40 +02:00
# define COMMENT_TWO_POSITION_Y 0.91f
# define COMMENT_POSITION_Y 0.82f
# define CORE_MSG_POSITION_X 0.3f
# define CORE_MSG_POSITION_Y 0.06f
# define CORE_MSG_FONT_SIZE COMMENT_POSITION_Y
2013-03-10 15:52:36 +01:00
# define MSG_QUEUE_X_POSITION g_settings.video.msg_pos_x
# define MSG_QUEUE_Y_POSITION 0.76f
# define MSG_QUEUE_FONT_SIZE 1.03f
# define MSG_PREV_NEXT_Y_POSITION 0.03f
# define CURRENT_PATH_Y_POSITION 0.15f
2013-04-10 01:34:40 +02:00
# define CURRENT_PATH_FONT_SIZE (g_settings.video.font_size)
2013-03-10 15:52:36 +01:00
# define NUM_ENTRY_PER_PAGE 15
# endif
2013-04-16 01:10:20 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-04-17 23:31:49 +02:00
static void shader_manager_get_str_filter ( char * type_str ,
size_t sizeof_type_str , unsigned pass )
{
switch ( rgui - > shader . pass [ pass ] . filter )
{
case RARCH_FILTER_LINEAR :
strlcpy ( type_str , " Linear " , sizeof_type_str ) ;
break ;
case RARCH_FILTER_NEAREST :
strlcpy ( type_str , " Nearest " , sizeof_type_str ) ;
break ;
case RARCH_FILTER_UNSPEC :
strlcpy ( type_str , " Don't care " , sizeof_type_str ) ;
break ;
}
}
2013-04-16 01:10:20 +02:00
# endif
2013-03-25 20:41:53 +01:00
2013-04-17 23:31:49 +02:00
/*============================================================
MENU STACK
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
2013-03-25 20:41:53 +01:00
static unsigned char menu_stack_enum_array [ 10 ] ;
static unsigned stack_idx = 0 ;
2013-04-13 21:40:48 +02:00
static unsigned shader_choice_set_shader_slot = 0 ;
2013-04-13 22:07:20 +02:00
static unsigned setting_page_number = 0 ;
2013-03-25 20:41:53 +01:00
2013-04-13 21:40:48 +02:00
static void menu_stack_pop ( unsigned menu_type )
2013-03-25 20:41:53 +01:00
{
2013-04-13 21:40:48 +02:00
switch ( menu_type )
{
case LIBRETRO_CHOICE :
case INGAME_MENU_CORE_OPTIONS :
2013-04-29 05:17:22 +02:00
case INGAME_MENU_LOAD_GAME_HISTORY :
2013-05-05 20:10:06 +02:00
case INGAME_MENU_CUSTOM_RATIO :
2013-04-13 21:40:48 +02:00
case INGAME_MENU_SCREENSHOT :
2013-04-19 17:53:01 +02:00
rgui - > frame_buf_show = true ;
2013-04-13 21:40:48 +02:00
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS :
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS :
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS :
2013-05-05 00:27:26 +02:00
case INGAME_MENU_INPUT_OPTIONS :
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_INGAME_MENU_SETTING ;
2013-04-19 17:53:01 +02:00
rgui - > frame_buf_show = true ;
2013-04-13 21:40:48 +02:00
break ;
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_VIDEO_SETTING ;
2013-05-05 21:11:34 +02:00
break ;
2013-04-28 15:00:37 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-04-13 21:40:48 +02:00
case CGP_CHOICE :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_SHADERMAN_SETTING ;
2013-04-13 21:40:48 +02:00
break ;
# endif
default :
break ;
}
setting_page_number = 0 ;
2013-04-17 23:31:49 +02:00
if ( rgui - > browser - > prev_dir . directory_path [ 0 ] ! = ' \0 ' )
2013-04-12 12:25:36 +02:00
{
2013-04-17 23:31:49 +02:00
memcpy ( & rgui - > browser - > current_dir , & rgui - > browser - > prev_dir , sizeof ( * ( & rgui - > browser - > current_dir ) ) ) ;
filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_RESET_CURRENT_DIR ) ;
rgui - > browser - > current_dir . ptr = rgui - > browser - > prev_dir . ptr ;
strlcpy ( rgui - > browser - > current_dir . path , rgui - > browser - > prev_dir . path ,
sizeof ( rgui - > browser - > current_dir . path ) ) ;
memset ( & rgui - > browser - > prev_dir , 0 , sizeof ( * ( & rgui - > browser - > prev_dir ) ) ) ;
2013-04-12 12:25:36 +02:00
}
2013-03-25 22:31:09 +01:00
if ( stack_idx > 1 )
2013-03-25 20:41:53 +01:00
stack_idx - - ;
}
2013-04-13 21:40:48 +02:00
static void menu_stack_push ( unsigned menu_type , bool prev_dir )
2013-03-25 20:41:53 +01:00
{
2013-04-13 21:40:48 +02:00
switch ( menu_type )
{
case INGAME_MENU :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_INGAME_MENU_SETTING ;
2013-04-13 21:40:48 +02:00
break ;
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_VIDEO_SETTING ;
2013-04-13 21:40:48 +02:00
break ;
2013-05-05 21:16:34 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_SHADERMAN_SETTING ;
2013-05-05 21:11:34 +02:00
break ;
2013-05-05 21:16:34 +02:00
# endif
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_AUDIO_SETTING ;
2013-05-05 04:42:06 +02:00
break ;
2013-05-05 00:27:26 +02:00
case INGAME_MENU_INPUT_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_CONTROLS_SETTING_PAGE_1 ;
2013-05-05 00:27:26 +02:00
break ;
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_PATH_SETTING ;
2013-05-05 03:41:41 +02:00
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS :
2013-09-26 14:45:13 +02:00
rgui - > selection_ptr = FIRST_SETTING ;
2013-04-13 21:40:48 +02:00
break ;
default :
break ;
}
setting_page_number = 0 ;
2013-04-12 12:25:36 +02:00
if ( prev_dir )
{
2013-04-17 23:31:49 +02:00
memcpy ( & rgui - > browser - > prev_dir , & rgui - > browser - > current_dir , sizeof ( * ( & rgui - > browser - > prev_dir ) ) ) ;
rgui - > browser - > prev_dir . ptr = rgui - > browser - > current_dir . ptr ;
2013-04-12 12:25:36 +02:00
}
2013-04-13 21:40:48 +02:00
menu_stack_enum_array [ stack_idx ] = menu_type ;
2013-03-25 20:41:53 +01:00
stack_idx + + ;
}
2012-12-17 05:30:28 +01:00
/*============================================================
2013-02-17 22:02:42 +01:00
EVENT CALLBACKS ( AND RELATED )
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
2012-12-17 05:30:28 +01:00
2013-03-25 21:55:42 +01:00
static void display_menubar ( uint8_t menu_type )
2012-06-28 21:49:40 +02:00
{
2013-03-25 17:47:24 +01:00
char title [ 32 ] ;
2013-03-11 20:05:05 +01:00
char msg [ 128 ] ;
font_params_t font_parms = { 0 } ;
2012-08-01 16:47:37 +02:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = CURRENT_PATH_Y_POSITION ;
font_parms . scale = CURRENT_PATH_FONT_SIZE ;
2013-03-11 20:05:05 +01:00
font_parms . color = WHITE ;
2013-03-25 21:55:42 +01:00
switch ( menu_type )
2013-03-25 17:47:24 +01:00
{
2013-04-13 21:40:48 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-03-25 17:47:24 +01:00
case SHADER_CHOICE :
strlcpy ( title , " Shaders " , sizeof ( title ) ) ;
break ;
2013-04-13 21:40:48 +02:00
case CGP_CHOICE :
strlcpy ( title , " CGP " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
2013-04-13 21:40:48 +02:00
# endif
2013-03-25 17:47:24 +01:00
case BORDER_CHOICE :
strlcpy ( title , " Borders " , sizeof ( title ) ) ;
break ;
case LIBRETRO_CHOICE :
strlcpy ( title , " Libretro " , sizeof ( title ) ) ;
break ;
case INPUT_PRESET_CHOICE :
strlcpy ( title , " Input " , sizeof ( title ) ) ;
break ;
case PATH_SAVESTATES_DIR_CHOICE :
case PATH_DEFAULT_ROM_DIR_CHOICE :
# ifdef HAVE_XML
case PATH_CHEATS_DIR_CHOICE :
# endif
case PATH_SRAM_DIR_CHOICE :
case PATH_SYSTEM_DIR_CHOICE :
strlcpy ( title , " Path " , sizeof ( title ) ) ;
break ;
case INGAME_MENU :
2013-05-04 22:29:22 +02:00
strlcpy ( title , " Menu " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
2013-04-07 08:30:30 +02:00
case INGAME_MENU_CORE_OPTIONS :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Core " , sizeof ( title ) ) ;
2013-04-07 08:30:30 +02:00
break ;
2013-04-29 05:17:22 +02:00
case INGAME_MENU_LOAD_GAME_HISTORY :
strlcpy ( title , " History " , sizeof ( title ) ) ;
break ;
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS :
2013-05-05 00:27:26 +02:00
case INGAME_MENU_VIDEO_OPTIONS_MODE :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Video " , sizeof ( title ) ) ;
2013-04-10 11:20:28 +02:00
break ;
2013-05-05 21:16:34 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS :
case INGAME_MENU_SHADER_OPTIONS_MODE :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Shader " , sizeof ( title ) ) ;
2013-05-05 21:11:34 +02:00
break ;
2013-05-05 21:16:34 +02:00
# endif
2013-05-05 00:27:26 +02:00
case INGAME_MENU_INPUT_OPTIONS :
case INGAME_MENU_INPUT_OPTIONS_MODE :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Input " , sizeof ( title ) ) ;
2013-05-05 00:27:26 +02:00
break ;
2013-05-05 20:10:06 +02:00
case INGAME_MENU_CUSTOM_RATIO :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Resize " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
case INGAME_MENU_SCREENSHOT :
2013-05-04 22:29:22 +02:00
strlcpy ( title , " Menu " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
case FILE_BROWSER_MENU :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Game " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS :
case INGAME_MENU_SETTINGS_MODE :
strlcpy ( title , " Settings " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS :
case INGAME_MENU_AUDIO_OPTIONS_MODE :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Audio " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS :
case INGAME_MENU_PATH_OPTIONS_MODE :
2013-06-03 01:23:02 +02:00
strlcpy ( title , " Path " , sizeof ( title ) ) ;
2013-03-25 17:47:24 +01:00
break ;
}
2013-03-25 21:55:42 +01:00
switch ( menu_type )
2012-06-29 15:43:09 +02:00
{
2013-04-13 21:40:48 +02:00
# ifdef HAVE_SHADER_MANAGER
2012-07-31 03:28:40 +02:00
case SHADER_CHOICE :
2013-04-13 21:40:48 +02:00
case CGP_CHOICE :
# endif
2012-07-31 03:28:40 +02:00
case BORDER_CHOICE :
case LIBRETRO_CHOICE :
case INPUT_PRESET_CHOICE :
case PATH_SAVESTATES_DIR_CHOICE :
case PATH_DEFAULT_ROM_DIR_CHOICE :
2012-08-04 07:24:15 +02:00
# ifdef HAVE_XML
2012-07-31 03:28:40 +02:00
case PATH_CHEATS_DIR_CHOICE :
2012-08-04 07:24:15 +02:00
# endif
2012-07-31 03:28:40 +02:00
case PATH_SRAM_DIR_CHOICE :
2012-08-05 17:53:01 +02:00
case PATH_SYSTEM_DIR_CHOICE :
2012-06-29 15:43:09 +02:00
case FILE_BROWSER_MENU :
2013-04-17 23:31:49 +02:00
snprintf ( msg , sizeof ( msg ) , " PATH: %s " , rgui - > browser - > current_dir . directory_path ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2012-06-29 15:43:09 +02:00
break ;
}
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = CORE_MSG_POSITION_X ;
font_parms . y = CORE_MSG_POSITION_Y ;
font_parms . scale = CORE_MSG_FONT_SIZE ;
2013-03-11 20:05:05 +01:00
font_parms . color = WHITE ;
2012-08-18 23:47:33 +02:00
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-04-22 22:25:57 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , rgui - > info . library_name , & font_parms ) ;
2012-08-18 23:47:33 +02:00
# ifdef __CELLOS_LV2__
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-03-11 20:05:05 +01:00
font_parms . y = 0.05f ;
font_parms . scale = 1.4f ;
font_parms . color = WHITE ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-03-25 17:47:24 +01:00
driver . video_poke - > set_osd_msg ( driver . video_data , title , & font_parms ) ;
2013-03-11 20:05:05 +01:00
font_parms . x = 0.80f ;
font_parms . y = 0.015f ;
font_parms . scale = 0.82f ;
font_parms . color = WHITE ;
snprintf ( msg , sizeof ( msg ) , " v%s " , PACKAGE_VERSION ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2012-08-03 18:51:56 +02:00
# endif
2012-06-28 21:49:40 +02:00
}
2013-03-25 03:07:58 +01:00
static void browser_render ( void * data )
2012-06-28 21:49:40 +02:00
{
2013-04-17 23:31:49 +02:00
unsigned file_count = rgui - > browser - > list - > size ;
2013-03-18 18:05:15 +01:00
unsigned current_index = 0 ;
unsigned page_number = 0 ;
unsigned page_base = 0 ;
unsigned i ;
2013-04-10 01:34:40 +02:00
float y_increment = POSITION_Y_START ;
2013-03-11 20:05:05 +01:00
font_params_t font_parms = { 0 } ;
2012-06-28 21:49:40 +02:00
2013-04-17 23:31:49 +02:00
current_index = rgui - > browser - > current_dir . ptr ;
2013-04-10 01:34:40 +02:00
page_number = current_index / NUM_ENTRY_PER_PAGE ;
page_base = page_number * NUM_ENTRY_PER_PAGE ;
2012-06-28 21:49:40 +02:00
2013-04-10 01:34:40 +02:00
font_parms . scale = FONT_SIZE_VARIABLE ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
for ( i = page_base ; i < file_count & & i < page_base + NUM_ENTRY_PER_PAGE ; + + i )
2012-06-28 21:49:40 +02:00
{
2013-03-18 18:05:15 +01:00
char fname_tmp [ 128 ] ;
2013-04-17 23:31:49 +02:00
fill_pathname_base ( fname_tmp , rgui - > browser - > list - > elems [ i ] . data , sizeof ( fname_tmp ) ) ;
2013-04-10 01:34:40 +02:00
y_increment + = POSITION_Y_INCREMENT ;
2012-08-03 18:51:56 +02:00
2013-04-10 09:34:46 +02:00
# ifdef HAVE_MENU_PANEL
2012-08-03 18:51:56 +02:00
//check if this is the currently selected file
2013-04-17 23:31:49 +02:00
if ( strcmp ( rgui - > browser - > current_dir . path , rgui - > browser - > list - > elems [ i ] . data ) = = 0 )
2013-04-10 09:34:46 +02:00
menu_panel - > y = y_increment ;
# endif
2012-08-03 18:51:56 +02:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = y_increment ;
2013-04-17 23:31:49 +02:00
font_parms . color = i = = current_index ? RED : rgui - > browser - > list - > elems [ i ] . attr . b ? GREEN : WHITE ;
2013-03-11 20:05:05 +01:00
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , fname_tmp , & font_parms ) ;
2012-06-28 21:49:40 +02:00
}
}
2013-04-10 15:57:36 +02:00
2013-09-26 22:34:06 +02:00
static int select_file ( void * data , uint64_t action )
2012-01-31 14:34:43 +01:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-03-18 18:05:15 +01:00
char extensions [ 128 ] ;
char comment [ 128 ] ;
char path [ PATH_MAX ] ;
2013-04-12 12:25:36 +02:00
bool pop_menu_stack = false ;
2013-03-11 20:05:05 +01:00
font_params_t font_parms = { 0 } ;
2012-12-17 05:30:28 +01:00
2013-04-17 23:31:49 +02:00
switch ( rgui - > menu_type )
2012-04-14 04:38:40 +02:00
{
2013-04-13 21:40:48 +02:00
# ifdef HAVE_SHADER_MANAGER
2012-04-14 04:38:40 +02:00
case SHADER_CHOICE :
2012-08-02 17:09:41 +02:00
strlcpy ( extensions , EXT_SHADERS , sizeof ( extensions ) ) ;
2013-03-18 18:31:14 +01:00
strlcpy ( comment , " INFO - Select a shader. " , sizeof ( comment ) ) ;
2012-08-02 17:09:41 +02:00
break ;
2013-04-13 21:40:48 +02:00
case CGP_CHOICE :
2012-08-02 17:09:41 +02:00
strlcpy ( extensions , EXT_CGP_PRESETS , sizeof ( extensions ) ) ;
2013-04-10 11:20:28 +02:00
strlcpy ( comment , " INFO - Select a CGP file. " , sizeof ( comment ) ) ;
2012-08-02 17:09:41 +02:00
break ;
2013-04-13 21:40:48 +02:00
# endif
2012-04-14 04:38:40 +02:00
case INPUT_PRESET_CHOICE :
2012-08-02 17:09:41 +02:00
strlcpy ( extensions , EXT_INPUT_PRESETS , sizeof ( extensions ) ) ;
2013-03-18 18:31:14 +01:00
strlcpy ( comment , " INFO - Select an input preset. " , sizeof ( comment ) ) ;
2012-08-02 17:09:41 +02:00
break ;
2012-04-14 04:38:40 +02:00
case BORDER_CHOICE :
2012-08-02 17:09:41 +02:00
strlcpy ( extensions , EXT_IMAGES , sizeof ( extensions ) ) ;
2013-03-18 18:31:14 +01:00
strlcpy ( comment , " INFO - Select a border image file. " , sizeof ( comment ) ) ;
2012-08-02 17:09:41 +02:00
break ;
2012-04-22 01:45:55 +02:00
case LIBRETRO_CHOICE :
2012-08-02 17:09:41 +02:00
strlcpy ( extensions , EXT_EXECUTABLES , sizeof ( extensions ) ) ;
2013-03-18 18:31:14 +01:00
strlcpy ( comment , " INFO - Select a Libretro core. " , sizeof ( comment ) ) ;
2012-08-02 17:09:41 +02:00
break ;
2012-04-14 04:38:40 +02:00
}
2012-01-31 14:34:43 +01:00
2013-09-26 22:34:06 +02:00
switch ( action )
2012-07-31 05:04:47 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_OK :
if ( filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_PATH_ISDIR ) )
filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_OK ) ;
else
2012-08-02 17:09:41 +02:00
{
2013-09-26 22:34:06 +02:00
strlcpy ( path , rgui - > browser - > current_dir . path , sizeof ( path ) ) ;
2013-04-10 11:20:28 +02:00
2013-09-26 22:34:06 +02:00
switch ( rgui - > menu_type )
{
# ifdef HAVE_SHADER_MANAGER
case SHADER_CHOICE :
strlcpy ( rgui - > shader . pass [ shader_choice_set_shader_slot ] . source . cg , path ,
sizeof ( rgui - > shader . pass [ shader_choice_set_shader_slot ] . source . cg ) ) ;
break ;
case CGP_CHOICE :
2013-04-14 15:43:02 +02:00
{
2013-09-26 22:34:06 +02:00
config_file_t * conf = NULL ;
strlcpy ( g_settings . video . shader_path , path , sizeof ( g_settings . video . shader_path ) ) ;
conf = config_file_new ( path ) ;
if ( conf )
gfx_shader_read_conf_cgp ( conf , & rgui - > shader ) ;
config_file_free ( conf ) ;
if ( video_set_shader_func ( RARCH_SHADER_CG , path ) )
g_settings . video . shader_enable = true ;
else
{
RARCH_ERR ( " Setting CGP failed. \n " ) ;
g_settings . video . shader_enable = false ;
}
2013-04-14 15:43:02 +02:00
}
2013-09-26 22:34:06 +02:00
break ;
2012-08-03 18:27:38 +02:00
# endif
2013-09-26 22:34:06 +02:00
case INPUT_PRESET_CHOICE :
strlcpy ( g_extern . input_config_path , path , sizeof ( g_extern . input_config_path ) ) ;
config_read_keybinds ( path ) ;
break ;
case BORDER_CHOICE :
if ( menu_texture )
2013-04-10 09:59:29 +02:00
{
2013-09-26 22:34:06 +02:00
# ifdef _XBOX
if ( menu_texture - > vertex_buf )
{
menu_texture - > vertex_buf - > Release ( ) ;
menu_texture - > vertex_buf = NULL ;
}
if ( menu_texture - > pixels )
{
menu_texture - > pixels - > Release ( ) ;
menu_texture - > pixels = NULL ;
}
2013-04-10 09:34:46 +02:00
# else
2013-09-26 22:34:06 +02:00
free ( menu_texture - > pixels ) ;
menu_texture - > pixels = NULL ;
2013-04-10 09:34:46 +02:00
# endif
2013-09-26 22:34:06 +02:00
menu_texture = ( struct texture_image * ) calloc ( 1 , sizeof ( * menu_texture ) ) ;
}
texture_image_load ( path , menu_texture ) ;
strlcpy ( g_extern . menu_texture_path , path , sizeof ( g_extern . menu_texture_path ) ) ;
2013-04-13 22:43:59 +02:00
2013-09-26 22:34:06 +02:00
if ( driver . video_poke & & driver . video_poke - > set_texture_frame )
driver . video_poke - > set_texture_frame ( driver . video_data , menu_texture - > pixels ,
true , menu_texture - > width , menu_texture - > height , 1.0f ) ;
break ;
case LIBRETRO_CHOICE :
rarch_environment_cb ( RETRO_ENVIRONMENT_SET_LIBRETRO_PATH , ( void * ) path ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_EXITSPAWN ) ;
return - 1 ;
}
2012-11-19 04:09:16 +01:00
2013-09-26 22:34:06 +02:00
pop_menu_stack = true ;
}
break ;
case RGUI_ACTION_CANCEL :
2013-04-12 12:25:36 +02:00
pop_menu_stack = true ;
2013-09-26 22:34:06 +02:00
break ;
2012-07-31 05:04:47 +02:00
}
2013-04-12 12:25:36 +02:00
if ( pop_menu_stack )
2013-04-17 23:31:49 +02:00
menu_stack_pop ( rgui - > menu_type ) ;
2012-01-31 14:34:43 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = COMMENT_POSITION_Y ;
font_parms . scale = HARDCODE_FONT_SIZE ;
2013-03-11 20:05:05 +01:00
font_parms . color = WHITE ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , comment , & font_parms ) ;
2013-04-17 23:31:49 +02:00
display_menubar ( rgui - > menu_type ) ;
browser_render ( rgui - > browser ) ;
2012-12-17 01:30:38 +01:00
2013-01-11 03:58:43 +01:00
return 0 ;
2012-01-31 14:34:43 +01:00
}
2013-09-26 22:34:06 +02:00
static int select_directory ( void * data , uint64_t action )
2012-01-31 14:34:43 +01:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-03-11 20:05:05 +01:00
font_params_t font_parms = { 0 } ;
2012-12-17 05:30:28 +01:00
2013-03-18 18:05:15 +01:00
char path [ PATH_MAX ] ;
char msg [ 256 ] ;
2012-08-01 17:22:10 +02:00
bool ret = true ;
2012-01-31 14:34:43 +01:00
2013-04-17 23:31:49 +02:00
bool is_dir = filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_PATH_ISDIR ) ;
2013-04-12 12:25:36 +02:00
bool pop_menu_stack = false ;
2013-04-20 00:47:21 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2012-07-31 05:04:47 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_OK :
# if 1
if ( is_dir )
ret = filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_OK ) ;
# else
/* TODO - extra conditional needed here to recognize if user pressed <Use this directory> entry */
if ( is_dir )
{
strlcpy ( path , rgui - > browser - > current_dir . path , sizeof ( path ) ) ;
2012-11-19 04:09:16 +01:00
2013-09-26 22:34:06 +02:00
switch ( rgui - > menu_type )
{
case PATH_SAVESTATES_DIR_CHOICE :
strlcpy ( g_extern . savestate_dir , path , sizeof ( g_extern . savestate_dir ) ) ;
break ;
case PATH_SRAM_DIR_CHOICE :
strlcpy ( g_extern . savefile_dir , path , sizeof ( g_extern . savefile_dir ) ) ;
break ;
case PATH_DEFAULT_ROM_DIR_CHOICE :
strlcpy ( g_settings . rgui_browser_directory , path , sizeof ( g_settings . rgui_browser_directory ) ) ;
break ;
# ifdef HAVE_XML
case PATH_CHEATS_DIR_CHOICE :
strlcpy ( g_settings . cheat_database , path , sizeof ( g_settings . cheat_database ) ) ;
break ;
# endif
case PATH_SYSTEM_DIR_CHOICE :
strlcpy ( g_settings . system_directory , path , sizeof ( g_settings . system_directory ) ) ;
break ;
}
pop_menu_stack = true ;
}
break ;
# endif
case RGUI_ACTION_CANCEL :
strlcpy ( path , default_paths . port_dir , sizeof ( path ) ) ;
2013-04-17 23:31:49 +02:00
switch ( rgui - > menu_type )
2012-08-02 17:09:41 +02:00
{
2012-04-14 04:38:40 +02:00
case PATH_SAVESTATES_DIR_CHOICE :
2013-04-29 05:44:32 +02:00
strlcpy ( g_extern . savestate_dir , path , sizeof ( g_extern . savestate_dir ) ) ;
2012-08-02 17:09:41 +02:00
break ;
case PATH_SRAM_DIR_CHOICE :
2013-04-29 05:44:32 +02:00
strlcpy ( g_extern . savefile_dir , path , sizeof ( g_extern . savefile_dir ) ) ;
2012-08-02 17:09:41 +02:00
break ;
case PATH_DEFAULT_ROM_DIR_CHOICE :
2013-04-18 18:33:03 +02:00
strlcpy ( g_settings . rgui_browser_directory , path , sizeof ( g_settings . rgui_browser_directory ) ) ;
2012-08-02 17:09:41 +02:00
break ;
2012-08-04 07:24:15 +02:00
# ifdef HAVE_XML
2012-08-02 17:09:41 +02:00
case PATH_CHEATS_DIR_CHOICE :
strlcpy ( g_settings . cheat_database , path , sizeof ( g_settings . cheat_database ) ) ;
break ;
2012-08-04 07:24:15 +02:00
# endif
2012-08-05 17:53:01 +02:00
case PATH_SYSTEM_DIR_CHOICE :
strlcpy ( g_settings . system_directory , path , sizeof ( g_settings . system_directory ) ) ;
break ;
2012-08-02 17:09:41 +02:00
}
2013-04-12 12:25:36 +02:00
pop_menu_stack = true ;
2013-09-26 22:34:06 +02:00
break ;
2012-04-14 04:38:40 +02:00
}
2013-04-12 12:25:36 +02:00
if ( pop_menu_stack )
2013-04-17 23:31:49 +02:00
menu_stack_pop ( rgui - > menu_type ) ;
2013-04-12 12:25:36 +02:00
2013-03-25 22:31:09 +01:00
if ( ! ret )
2013-03-23 19:34:38 +01:00
msg_queue_push ( g_extern . msg_queue , " ERROR - Failed to open directory. " , 1 , 180 ) ;
2012-08-01 17:22:10 +02:00
2013-03-18 18:05:15 +01:00
struct platform_bind key_label_y = { 0 } ;
2013-03-14 21:55:10 +01:00
strlcpy ( key_label_y . desc , " Unknown " , sizeof ( key_label_y . desc ) ) ;
key_label_y . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_Y ;
if ( driver . input - > set_keybinds )
driver . input - > set_keybinds ( & key_label_y , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = COMMENT_POSITION_Y ;
2013-04-13 19:13:00 +02:00
font_parms . scale = HARDCODE_FONT_SIZE ;
2013-03-11 20:05:05 +01:00
font_parms . color = WHITE ;
2013-03-11 21:42:02 +01:00
2013-04-13 19:13:00 +02:00
snprintf ( msg , sizeof ( msg ) , " INFO - Select a dir as path by pressing \n [%s]. " , key_label_y . desc ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2012-12-17 00:32:16 +01:00
2013-04-17 23:31:49 +02:00
display_menubar ( rgui - > menu_type ) ;
browser_render ( rgui - > browser ) ;
2012-12-17 01:30:38 +01:00
2013-01-11 03:58:43 +01:00
return 0 ;
2012-01-31 14:34:43 +01:00
}
2013-09-26 22:34:06 +02:00
static void set_keybind_digital ( unsigned default_retro_joypad_id , uint64_t action )
2012-02-29 09:15:59 +01:00
{
2013-03-14 15:01:36 +01:00
if ( ! driver . input - > set_keybinds )
return ;
2013-03-14 02:24:57 +01:00
unsigned keybind_action = KEYBINDS_ACTION_NONE ;
2012-04-11 02:42:27 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_DECREMENT_BIND ) ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_INCREMENT_BIND ) ;
break ;
case RGUI_ACTION_START :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_SET_DEFAULT_BIND ) ;
break ;
}
2012-04-13 04:31:18 +02:00
2013-03-14 15:01:36 +01:00
if ( keybind_action )
2013-05-04 16:13:58 +02:00
driver . input - > set_keybinds ( driver . input_data , NULL , rgui - > current_pad ,
2013-03-14 15:01:36 +01:00
default_retro_joypad_id , keybind_action ) ;
2012-02-29 09:15:59 +01:00
}
2012-12-17 06:44:28 +01:00
# if defined(HAVE_OSKUTIL)
2012-08-03 03:24:36 +02:00
# ifdef __CELLOS_LV2__
2012-03-01 14:22:16 +01:00
2012-12-17 06:44:28 +01:00
static bool osk_callback_enter_rsound ( void * data )
{
2013-01-17 10:40:35 +01:00
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_OSK_ENTRY_SUCCESS ) )
2012-04-14 04:38:40 +02:00
{
2013-01-17 10:40:35 +01:00
RARCH_LOG ( " OSK - Applying input data. \n " ) ;
char tmp_str [ 256 ] ;
2013-05-05 16:12:06 +02:00
int num = wcstombs ( tmp_str , rgui - > oskutil_handle . text_buf , sizeof ( tmp_str ) ) ;
2013-01-17 10:40:35 +01:00
tmp_str [ num ] = 0 ;
2013-03-18 03:49:54 +01:00
strlcpy ( g_settings . audio . device , tmp_str , sizeof ( g_settings . audio . device ) ) ;
2013-01-17 10:40:35 +01:00
goto do_exit ;
2012-04-14 04:38:40 +02:00
}
2013-01-17 10:40:35 +01:00
else if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_OSK_ENTRY_FAIL ) )
goto do_exit ;
2012-12-17 06:44:28 +01:00
return false ;
2013-01-17 10:40:35 +01:00
do_exit :
2013-07-27 20:12:46 +02:00
g_extern . lifecycle_mode_state & = ~ ( ( 1ULL < < MODE_OSK_ENTRY_SUCCESS ) |
2013-01-17 10:40:35 +01:00
( 1ULL < < MODE_OSK_ENTRY_FAIL ) ) ;
return true ;
2012-12-17 06:44:28 +01:00
}
static bool osk_callback_enter_rsound_init ( void * data )
{
2013-05-05 16:12:06 +02:00
oskutil_write_initial_message ( & rgui - > oskutil_handle , L " 192.168.1.1 " ) ;
oskutil_write_message ( & rgui - > oskutil_handle , L " Enter IP address for the RSound Server. " ) ;
oskutil_start ( & rgui - > oskutil_handle ) ;
2012-12-17 06:44:28 +01:00
return true ;
}
static bool osk_callback_enter_filename ( void * data )
{
2013-01-17 10:40:35 +01:00
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_OSK_ENTRY_SUCCESS ) )
2012-04-14 04:38:40 +02:00
{
2013-01-17 10:40:35 +01:00
RARCH_LOG ( " OSK - Applying input data. \n " ) ;
char tmp_str [ 256 ] ;
char filepath [ PATH_MAX ] ;
2013-05-05 16:12:06 +02:00
int num = wcstombs ( tmp_str , rgui - > oskutil_handle . text_buf , sizeof ( tmp_str ) ) ;
2013-01-17 10:40:35 +01:00
tmp_str [ num ] = 0 ;
2013-04-17 23:31:49 +02:00
switch ( rgui - > osk_param )
2012-04-14 04:38:40 +02:00
{
case CONFIG_FILE :
break ;
2012-08-02 17:09:41 +02:00
case SHADER_PRESET_FILE :
2013-05-19 23:09:57 +02:00
{
snprintf ( filepath , sizeof ( filepath ) , " %s/%s.cgp " , g_settings . video . shader_dir , tmp_str ) ;
RARCH_LOG ( " [osk_callback_enter_filename]: filepath is: %s. \n " , filepath ) ;
config_file_t * conf = config_file_new ( NULL ) ;
if ( ! conf )
return false ;
gfx_shader_write_conf_cgp ( conf , & rgui - > shader ) ;
config_file_write ( conf , filepath ) ;
config_file_free ( conf ) ;
}
2012-08-02 17:09:41 +02:00
break ;
case INPUT_PRESET_FILE :
2013-01-17 10:40:35 +01:00
snprintf ( filepath , sizeof ( filepath ) , " %s/%s.cfg " , default_paths . input_presets_dir , tmp_str ) ;
RARCH_LOG ( " [osk_callback_enter_filename]: filepath is: %s. \n " , filepath ) ;
config_save_keybinds ( filepath ) ;
2012-08-02 17:09:41 +02:00
break ;
2012-04-14 04:38:40 +02:00
}
2012-03-01 14:22:16 +01:00
2013-01-17 10:40:35 +01:00
goto do_exit ;
2012-04-14 04:38:40 +02:00
}
2013-01-17 10:40:35 +01:00
else if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_OSK_ENTRY_FAIL ) )
goto do_exit ;
2012-03-01 14:22:16 +01:00
2012-12-17 06:44:28 +01:00
return false ;
2013-01-17 10:40:35 +01:00
do_exit :
2013-07-27 20:12:46 +02:00
g_extern . lifecycle_mode_state & = ~ ( ( 1ULL < < MODE_OSK_ENTRY_SUCCESS ) |
2013-01-17 10:40:35 +01:00
( 1ULL < < MODE_OSK_ENTRY_FAIL ) ) ;
return true ;
2012-12-17 06:44:28 +01:00
}
2012-03-01 14:22:16 +01:00
2012-12-17 06:44:28 +01:00
static bool osk_callback_enter_filename_init ( void * data )
{
2013-05-05 16:12:06 +02:00
oskutil_write_initial_message ( & rgui - > oskutil_handle , L " example " ) ;
oskutil_write_message ( & rgui - > oskutil_handle , L " Enter filename for preset " ) ;
oskutil_start ( & rgui - > oskutil_handle ) ;
2012-12-17 06:44:28 +01:00
return true ;
2012-03-01 14:22:16 +01:00
}
2012-12-17 06:44:28 +01:00
# endif
2012-08-03 03:24:36 +02:00
# endif
2012-07-31 16:06:34 +02:00
2013-04-24 16:08:18 +02:00
static void rgui_init_textures ( void )
{
# ifdef HAVE_MENU_PANEL
texture_image_load ( " D: \\ Media \\ menuMainRomSelectPanel.png " , menu_panel ) ;
# endif
texture_image_load ( g_extern . menu_texture_path , menu_texture ) ;
if ( driver . video_poke & & driver . video_poke - > set_texture_frame )
driver . video_poke - > set_texture_frame ( driver . video_data , menu_texture - > pixels ,
true , menu_texture - > width , menu_texture - > height , 1.0f ) ;
}
2013-04-10 13:17:01 +02:00
2013-09-26 22:34:06 +02:00
static int set_setting_action ( uint8_t menu_type , unsigned switchvalue , uint64_t action )
2012-01-16 04:07:02 +01:00
{
2013-04-10 13:17:01 +02:00
switch ( switchvalue )
2012-07-30 17:19:05 +02:00
{
2012-08-03 03:24:36 +02:00
# ifdef __CELLOS_LV2__
2012-11-19 04:09:16 +01:00
case SETTING_CHANGE_RESOLUTION :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-01-17 12:17:02 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_RIGHT :
settings_set ( 1ULL < < S_RESOLUTION_NEXT ) ;
break ;
case RGUI_ACTION_LEFT :
settings_set ( 1ULL < < S_RESOLUTION_PREVIOUS ) ;
break ;
case RGUI_ACTION_OK :
if ( g_extern . console . screen . resolutions . list [ g_extern . console . screen . resolutions . current . idx ] = = CELL_VIDEO_OUT_RESOLUTION_576 )
2013-01-17 12:17:02 +01:00
{
2013-09-26 22:34:06 +02:00
if ( g_extern . console . screen . pal_enable )
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_VIDEO_PAL_ENABLE ) ;
2013-01-17 12:17:02 +01:00
}
else
{
2013-09-26 22:34:06 +02:00
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_VIDEO_PAL_ENABLE ) ;
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_VIDEO_PAL_TEMPORAL_ENABLE ) ;
2013-01-17 12:17:02 +01:00
}
2013-09-26 22:34:06 +02:00
2013-01-17 12:17:02 +01:00
driver . video - > restart ( ) ;
2013-04-24 16:08:18 +02:00
rgui_init_textures ( ) ;
2013-09-26 22:34:06 +02:00
break ;
2013-01-17 12:17:02 +01:00
}
2013-09-26 22:34:06 +02:00
break ;
case SETTING_PAL60_MODE :
switch ( action )
2013-01-17 12:17:02 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_PAL_ENABLE ) )
{
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_PAL_TEMPORAL_ENABLE ) )
{
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_VIDEO_PAL_TEMPORAL_ENABLE ) ;
}
else
{
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_VIDEO_PAL_TEMPORAL_ENABLE ) ;
}
2013-04-24 16:08:18 +02:00
2013-09-26 22:34:06 +02:00
driver . video - > restart ( ) ;
rgui_init_textures ( ) ;
}
break ;
case RGUI_ACTION_START :
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_PAL_ENABLE ) )
{
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_VIDEO_PAL_TEMPORAL_ENABLE ) ;
driver . video - > restart ( ) ;
rgui_init_textures ( ) ;
}
break ;
2013-01-17 12:17:02 +01:00
}
break ;
2013-04-10 04:57:49 +02:00
# endif
2013-02-01 07:42:36 +01:00
case SETTING_EMU_SKIN :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-02-01 07:42:36 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( BORDER_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , EXT_IMAGES , default_paths . border_dir ) ;
break ;
case RGUI_ACTION_START :
if ( ! texture_image_load ( default_paths . menu_border_file , menu_texture ) )
{
RARCH_ERR ( " Failed to load texture image for menu. \n " ) ;
return false ;
}
break ;
2013-02-01 07:42:36 +01:00
}
break ;
2012-11-19 04:09:16 +01:00
case SETTING_FONT_SIZE :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( g_settings . video . font_size > 0 )
g_settings . video . font_size - = 0.01f ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( ( g_settings . video . font_size < 2.0f ) )
g_settings . video . font_size + = 0.01f ;
break ;
case RGUI_ACTION_START :
g_settings . video . font_size = 1.0f ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2013-04-28 15:00:37 +02:00
case SETTING_ASPECT_RATIO :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
settings_set ( 1ULL < < S_ASPECT_RATIO_DECREMENT ) ;
2013-03-10 02:58:55 +01:00
2013-09-26 22:34:06 +02:00
if ( driver . video_poke - > set_aspect_ratio )
driver . video_poke - > set_aspect_ratio ( driver . video_data , g_settings . video . aspect_ratio_idx ) ;
break ;
case RGUI_ACTION_RIGHT :
settings_set ( 1ULL < < S_ASPECT_RATIO_INCREMENT ) ;
2013-03-10 02:58:55 +01:00
2013-09-26 22:34:06 +02:00
if ( driver . video_poke - > set_aspect_ratio )
driver . video_poke - > set_aspect_ratio ( driver . video_data , g_settings . video . aspect_ratio_idx ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_ASPECT_RATIO ) ;
2013-03-10 02:58:55 +01:00
2013-09-26 22:34:06 +02:00
if ( driver . video_poke - > set_aspect_ratio )
driver . video_poke - > set_aspect_ratio ( driver . video_data , g_settings . video . aspect_ratio_idx ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
case SETTING_HW_TEXTURE_FILTER :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_HW_TEXTURE_FILTER ) ;
2013-03-10 02:58:55 +01:00
2013-09-26 22:34:06 +02:00
if ( driver . video_poke - > set_filtering )
driver . video_poke - > set_filtering ( driver . video_data , 1 , g_settings . video . smooth ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_HW_TEXTURE_FILTER ) ;
2013-03-10 02:58:55 +01:00
2013-09-26 22:34:06 +02:00
if ( driver . video_poke - > set_filtering )
driver . video_poke - > set_filtering ( driver . video_data , 1 , g_settings . video . smooth ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-08-07 18:26:52 +02:00
# ifdef _XBOX1
case SETTING_FLICKER_FILTER :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( g_extern . console . screen . flicker_filter_index > 0 )
g_extern . console . screen . flicker_filter_index - - ;
break ;
case RGUI_ACTION_RIGHT :
if ( g_extern . console . screen . flicker_filter_index < 5 )
g_extern . console . screen . flicker_filter_index + + ;
break ;
case RGUI_ACTION_START :
g_extern . console . screen . flicker_filter_index = 0 ;
break ;
2012-11-19 04:09:16 +01:00
}
2012-08-07 18:26:52 +02:00
break ;
case SETTING_SOFT_DISPLAY_FILTER :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-01-11 19:44:13 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_SOFT_FILTER_ENABLE ) )
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_VIDEO_SOFT_FILTER_ENABLE ) ;
else
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_VIDEO_SOFT_FILTER_ENABLE ) ;
break ;
case RGUI_ACTION_START :
2013-01-12 03:13:03 +01:00
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_VIDEO_SOFT_FILTER_ENABLE ) ;
2013-09-26 22:34:06 +02:00
break ;
2013-01-11 19:44:13 +01:00
}
2012-08-07 18:26:52 +02:00
break ;
2012-08-03 18:27:38 +02:00
# endif
2013-01-13 05:52:00 +01:00
case SETTING_REFRESH_RATE :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-01-13 05:52:00 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
settings_set ( 1ULL < < S_REFRESH_RATE_DECREMENT ) ;
driver_set_monitor_refresh_rate ( g_settings . video . refresh_rate ) ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_REFRESH_RATE_INCREMENT ) ;
driver_set_monitor_refresh_rate ( g_settings . video . refresh_rate ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_REFRESH_RATE ) ;
driver_set_monitor_refresh_rate ( g_settings . video . refresh_rate ) ;
break ;
2013-01-13 05:52:00 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_TRIPLE_BUFFERING :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_TRIPLE_BUFFERING ) ;
2012-11-19 04:09:16 +01:00
2013-01-07 17:48:45 +01:00
driver . video - > restart ( ) ;
2013-04-24 16:08:18 +02:00
rgui_init_textures ( ) ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_TRIPLE_BUFFERING ) ;
if ( ! ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_TRIPLE_BUFFERING_ENABLE ) ) )
{
driver . video - > restart ( ) ;
rgui_init_textures ( ) ;
}
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_SOUND_MODE :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( g_extern . console . sound . mode ! = SOUND_MODE_NORMAL )
g_extern . console . sound . mode - - ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( g_extern . console . sound . mode < ( SOUND_MODE_LAST - 1 ) )
g_extern . console . sound . mode + + ;
break ;
case RGUI_ACTION_UP :
case RGUI_ACTION_DOWN :
2012-08-03 18:27:38 +02:00
# ifdef HAVE_RSOUND
2013-09-26 22:34:06 +02:00
if ( g_extern . console . sound . mode ! = SOUND_MODE_RSOUND )
rarch_rsound_stop ( ) ;
else
rarch_rsound_start ( g_settings . audio . device ) ;
2012-08-03 18:27:38 +02:00
# endif
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_START :
g_extern . console . sound . mode = SOUND_MODE_NORMAL ;
2012-08-03 18:27:38 +02:00
# ifdef HAVE_RSOUND
2013-09-26 22:34:06 +02:00
rarch_rsound_stop ( ) ;
2012-08-03 18:27:38 +02:00
# endif
2013-09-26 22:34:06 +02:00
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-08-03 03:24:36 +02:00
# ifdef HAVE_RSOUND
2012-10-15 06:24:39 +02:00
case SETTING_RSOUND_SERVER_IP_ADDRESS :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
2012-12-17 06:44:28 +01:00
# ifdef HAVE_OSKUTIL
2013-09-26 22:34:06 +02:00
rgui - > osk_init = osk_callback_enter_rsound_init ;
rgui - > osk_callback = osk_callback_enter_rsound ;
2012-12-17 06:44:28 +01:00
# endif
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_START :
strlcpy ( g_settings . audio . device , " 0.0.0.0 " , sizeof ( g_settings . audio . device ) ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-08-03 03:24:36 +02:00
# endif
2012-10-15 06:24:39 +02:00
case SETTING_EMU_SHOW_DEBUG_INFO_MSG :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_INFO_DEBUG_MSG_TOGGLE ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_INFO_DEBUG_MSG ) ;
break ;
}
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_EMU_SHOW_INFO_MSG :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_INFO_MSG_TOGGLE ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_INFO_MSG ) ;
break ;
}
2012-11-19 04:09:16 +01:00
break ;
2013-05-26 00:32:39 +02:00
case SETTING_REWIND_ENABLED :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_REWIND ) ;
2012-11-19 04:09:16 +01:00
2013-09-26 22:34:06 +02:00
if ( g_settings . rewind_enable )
rarch_init_rewind ( ) ;
else
rarch_deinit_rewind ( ) ;
break ;
case RGUI_ACTION_START :
if ( g_settings . rewind_enable )
{
g_settings . rewind_enable = false ;
rarch_deinit_rewind ( ) ;
}
break ;
2013-03-18 03:49:54 +01:00
}
2012-11-19 04:09:16 +01:00
break ;
2013-05-26 00:32:39 +02:00
case SETTING_REWIND_GRANULARITY :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-01-19 08:54:03 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( g_settings . rewind_granularity > 1 )
g_settings . rewind_granularity - - ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
g_settings . rewind_granularity + + ;
break ;
case RGUI_ACTION_START :
g_settings . rewind_granularity = 1 ;
break ;
2013-01-19 08:54:03 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_EMU_AUDIO_MUTE :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_AUDIO_MUTE ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_AUDIO_MUTE ) ;
break ;
}
2012-11-19 04:09:16 +01:00
break ;
2012-08-22 16:59:12 +02:00
# ifdef _XBOX1
case SETTING_EMU_AUDIO_SOUND_VOLUME_LEVEL :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
g_extern . console . sound . volume_level = ! g_extern . console . sound . volume_level ;
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_INFO_DRAW ) )
msg_queue_push ( g_extern . msg_queue , " INFO - You need to restart RetroArch. " , 1 , 180 ) ;
break ;
case RGUI_ACTION_START :
g_extern . console . sound . volume_level = 0 ;
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_INFO_DRAW ) )
msg_queue_push ( g_extern . msg_queue , " INFO - You need to restart RetroArch. " , 1 , 180 ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-08-22 16:59:12 +02:00
# endif
2012-10-15 06:24:39 +02:00
case SETTING_ENABLE_CUSTOM_BGM :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
2013-03-25 22:31:09 +01:00
# if (CELL_SDK_VERSION > 0x340000)
2013-09-26 22:34:06 +02:00
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) )
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) ;
else
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) ;
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) )
cellSysutilEnableBgmPlayback ( ) ;
else
cellSysutilDisableBgmPlayback ( ) ;
2012-03-03 17:23:00 +01:00
# endif
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_START :
2013-03-25 22:31:09 +01:00
# if (CELL_SDK_VERSION > 0x340000)
2013-09-26 22:34:06 +02:00
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) ;
2012-03-03 17:23:00 +01:00
# endif
2013-09-26 22:34:06 +02:00
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_PATH_DEFAULT_ROM_DIRECTORY :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( PATH_DEFAULT_ROM_DIR_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , " empty " , default_paths . filesystem_root_dir ) ;
break ;
case RGUI_ACTION_START :
strlcpy ( g_settings . rgui_browser_directory ,
default_paths . filesystem_root_dir , sizeof ( g_settings . rgui_browser_directory ) ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_PATH_SAVESTATES_DIRECTORY :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( PATH_SAVESTATES_DIR_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , " empty " , default_paths . filesystem_root_dir ) ;
break ;
case RGUI_ACTION_START :
strlcpy ( g_extern . savestate_dir , default_paths . savestate_dir , sizeof ( g_extern . savestate_dir ) ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_PATH_SRAM_DIRECTORY :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( PATH_SRAM_DIR_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , " empty " , default_paths . filesystem_root_dir ) ;
break ;
case RGUI_ACTION_START :
strlcpy ( g_extern . savefile_dir , default_paths . sram_dir , sizeof ( g_extern . savefile_dir ) ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-08-04 07:24:15 +02:00
# ifdef HAVE_XML
2012-10-15 06:24:39 +02:00
case SETTING_PATH_CHEATS :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( PATH_CHEATS_DIR_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rmenu - > browser , " empty " , default_paths . filesystem_root_dir ) ;
break ;
case RGUI_ACTION_START :
strlcpy ( g_settings . cheat_database , default_paths . port_dir , sizeof ( g_settings . cheat_database ) ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-08-04 07:24:15 +02:00
# endif
2012-10-15 06:24:39 +02:00
case SETTING_PATH_SYSTEM :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( PATH_SYSTEM_DIR_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , " empty " , default_paths . system_dir ) ;
break ;
case RGUI_ACTION_START :
strlcpy ( g_settings . system_directory , default_paths . system_dir , sizeof ( g_settings . system_directory ) ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_SCHEME :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
case RGUI_ACTION_START :
menu_stack_push ( INPUT_PRESET_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , EXT_INPUT_PRESETS , default_paths . input_presets_dir ) ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_NUMBER :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( rgui - > current_pad ! = 0 )
rgui - > current_pad - - ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( rgui - > current_pad < 6 )
rgui - > current_pad + + ;
break ;
case RGUI_ACTION_START :
rgui - > current_pad = 0 ;
break ;
2012-11-19 04:09:16 +01:00
}
break ;
2012-10-15 06:24:39 +02:00
case SETTING_DPAD_EMULATION :
2013-09-26 22:34:06 +02:00
switch ( action )
2012-11-19 04:09:16 +01:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( driver . input - > set_keybinds )
2013-03-14 02:24:57 +01:00
{
2013-09-26 22:34:06 +02:00
unsigned keybind_action = 0 ;
2012-11-19 04:09:16 +01:00
2013-09-26 22:34:06 +02:00
switch ( g_settings . input . dpad_emulation [ rgui - > current_pad ] )
{
case ANALOG_DPAD_NONE :
break ;
case ANALOG_DPAD_LSTICK :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_SET_ANALOG_DPAD_NONE ) ;
break ;
case ANALOG_DPAD_RSTICK :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK ) ;
break ;
default :
break ;
}
2013-03-14 02:24:57 +01:00
2013-09-26 22:34:06 +02:00
if ( keybind_action )
driver . input - > set_keybinds ( driver . input_data , g_settings . input . device [ rgui - > current_pad ] , rgui - > current_pad , 0 , keybind_action ) ;
2013-03-14 02:24:57 +01:00
}
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( driver . input - > set_keybinds )
{
unsigned keybind_action = 0 ;
2013-03-14 02:24:57 +01:00
2013-09-26 22:34:06 +02:00
switch ( g_settings . input . dpad_emulation [ rgui - > current_pad ] )
{
case ANALOG_DPAD_NONE :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK ) ;
break ;
case ANALOG_DPAD_LSTICK :
keybind_action = ( 1ULL < < KEYBINDS_ACTION_SET_ANALOG_DPAD_RSTICK ) ;
break ;
case ANALOG_DPAD_RSTICK :
break ;
}
2012-11-19 04:09:16 +01:00
2013-09-26 22:34:06 +02:00
if ( keybind_action )
driver . input - > set_keybinds ( driver . input_data , g_settings . input . device [ rgui - > current_pad ] , rgui - > current_pad , 0 , keybind_action ) ;
}
break ;
case RGUI_ACTION_START :
if ( driver . input - > set_keybinds )
2013-05-04 16:13:58 +02:00
driver . input - > set_keybinds ( driver . input_data , g_settings . input . device [ rgui - > current_pad ] , rgui - > current_pad , 0 , ( 1ULL < < KEYBINDS_ACTION_SET_ANALOG_DPAD_LSTICK ) ) ;
2013-09-26 22:34:06 +02:00
break ;
}
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_UP :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_UP , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_DOWN :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_DOWN , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_LEFT :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_LEFT , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_RIGHT :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_RIGHT , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_A :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_A , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_B :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_B , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_X :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_X , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_Y :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_Y , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_SELECT :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_SELECT , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_START :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_START , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_L , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_R , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2 :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_L2 , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2 :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_R2 , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3 :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_L3 , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3 :
2013-09-26 22:34:06 +02:00
set_keybind_digital ( RETRO_DEVICE_ID_JOYPAD_R3 , action ) ;
2012-11-19 04:09:16 +01:00
break ;
2012-12-17 06:44:28 +01:00
# ifdef HAVE_OSKUTIL
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
case RGUI_ACTION_START :
rgui - > osk_param = INPUT_PRESET_FILE ;
rgui - > osk_init = osk_callback_enter_filename_init ;
rgui - > osk_callback = osk_callback_enter_filename ;
break ;
2012-12-17 06:44:28 +01:00
}
2012-11-19 04:09:16 +01:00
break ;
2012-08-03 18:27:38 +02:00
# endif
2012-10-15 06:24:39 +02:00
case SETTING_CONTROLS_DEFAULT_ALL :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
case RGUI_ACTION_START :
if ( driver . input - > set_keybinds )
driver . input - > set_keybinds ( driver . input_data , g_settings . input . device [ rgui - > current_pad ] , rgui - > current_pad , 0 ,
( 1ULL < < KEYBINDS_ACTION_SET_DEFAULT_BINDS ) ) ;
break ;
}
2012-11-19 04:09:16 +01:00
break ;
2013-04-01 09:18:30 +02:00
case INGAME_MENU_LOAD_STATE :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-01 09:18:30 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_OK :
rarch_load_state ( ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_GAME ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
return - 1 ;
case RGUI_ACTION_LEFT :
rarch_state_slot_decrease ( ) ;
break ;
case RGUI_ACTION_RIGHT :
rarch_state_slot_increase ( ) ;
break ;
2013-04-01 09:18:30 +02:00
}
break ;
case INGAME_MENU_SAVE_STATE :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-01 09:18:30 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_OK :
rarch_save_state ( ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_GAME ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
return - 1 ;
case RGUI_ACTION_LEFT :
rarch_state_slot_decrease ( ) ;
break ;
case RGUI_ACTION_RIGHT :
rarch_state_slot_increase ( ) ;
break ;
2013-04-01 09:18:30 +02:00
}
break ;
2013-04-28 15:00:37 +02:00
case SETTING_ROTATION :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-01 09:18:30 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
settings_set ( 1ULL < < S_ROTATION_DECREMENT ) ;
video_set_rotation_func ( ( g_extern . system . rotation + g_settings . video . rotation ) % 4 ) ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
settings_set ( 1ULL < < S_ROTATION_INCREMENT ) ;
video_set_rotation_func ( ( g_extern . system . rotation + g_settings . video . rotation ) % 4 ) ;
break ;
case RGUI_ACTION_START :
settings_set ( 1ULL < < S_DEF_ROTATION ) ;
video_set_rotation_func ( ( g_extern . system . rotation + g_settings . video . rotation ) % 4 ) ;
break ;
2013-04-01 09:18:30 +02:00
}
break ;
case INGAME_MENU_FRAME_ADVANCE :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_OK :
case RGUI_ACTION_SCROLL_DOWN :
case RGUI_ACTION_SCROLL_UP :
g_extern . lifecycle_state | = ( 1ULL < < RARCH_FRAMEADVANCE ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
settings_set ( 1ULL < < S_FRAME_ADVANCE ) ;
return - 1 ;
2013-04-01 09:18:30 +02:00
}
break ;
2013-05-05 00:27:26 +02:00
case SETTING_CUSTOM_VIEWPORT :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-05-05 20:10:06 +02:00
menu_stack_push ( INGAME_MENU_CUSTOM_RATIO , false ) ;
2013-04-01 09:18:30 +02:00
break ;
2013-04-07 08:30:30 +02:00
case INGAME_MENU_CORE_OPTIONS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-12 12:25:36 +02:00
menu_stack_push ( INGAME_MENU_CORE_OPTIONS , false ) ;
2013-04-07 08:30:30 +02:00
break ;
2013-04-29 05:17:22 +02:00
case INGAME_MENU_LOAD_GAME_HISTORY_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-29 05:17:22 +02:00
menu_stack_push ( INGAME_MENU_LOAD_GAME_HISTORY , false ) ;
break ;
2013-04-01 09:18:30 +02:00
case INGAME_MENU_SCREENSHOT_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-12 12:25:36 +02:00
menu_stack_push ( INGAME_MENU_SCREENSHOT , false ) ;
2013-04-01 09:18:30 +02:00
break ;
2013-04-01 09:38:16 +02:00
case INGAME_MENU_RETURN_TO_GAME :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-01 09:18:30 +02:00
{
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_GAME ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
return - 1 ;
}
break ;
2013-04-01 09:38:16 +02:00
case INGAME_MENU_CHANGE_GAME :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-27 15:42:33 +02:00
menu_stack_push ( FILE_BROWSER_MENU , false ) ;
2013-04-01 09:38:16 +02:00
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-05-05 04:42:06 +02:00
menu_stack_push ( INGAME_MENU_SETTINGS , false ) ;
2013-04-27 03:50:42 +02:00
break ;
2013-04-01 09:18:30 +02:00
case INGAME_MENU_RESET :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-01 09:18:30 +02:00
{
rarch_game_reset ( ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_GAME ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
return - 1 ;
}
break ;
case INGAME_MENU_CHANGE_LIBRETRO_CORE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-01 09:18:30 +02:00
{
2013-04-12 12:25:36 +02:00
menu_stack_push ( LIBRETRO_CHOICE , true ) ;
2013-04-17 23:31:49 +02:00
filebrowser_set_root_and_ext ( rgui - > browser , EXT_EXECUTABLES , default_paths . core_dir ) ;
2013-04-01 09:18:30 +02:00
}
break ;
# ifdef HAVE_MULTIMAN
case INGAME_MENU_RETURN_TO_MULTIMAN :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-01 09:18:30 +02:00
{
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_GAME ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_EXITSPAWN ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_EXITSPAWN_MULTIMAN ) ;
return - 1 ;
}
break ;
# endif
case INGAME_MENU_QUIT_RETROARCH :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-01 09:18:30 +02:00
{
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_GAME ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
return - 1 ;
}
break ;
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-04-28 15:00:37 +02:00
menu_stack_push ( INGAME_MENU_VIDEO_OPTIONS , false ) ;
2013-04-10 13:17:01 +02:00
break ;
2013-05-05 21:16:34 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-05-05 21:11:34 +02:00
menu_stack_push ( INGAME_MENU_SHADER_OPTIONS , false ) ;
break ;
2013-05-05 21:16:34 +02:00
# endif
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-05-05 04:42:06 +02:00
menu_stack_push ( INGAME_MENU_AUDIO_OPTIONS , false ) ;
break ;
2013-05-05 00:27:26 +02:00
case INGAME_MENU_INPUT_OPTIONS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-05-05 00:27:26 +02:00
menu_stack_push ( INGAME_MENU_INPUT_OPTIONS , false ) ;
break ;
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS_MODE :
2013-09-26 22:34:06 +02:00
if ( action = = RGUI_ACTION_OK )
2013-05-05 03:41:41 +02:00
menu_stack_push ( INGAME_MENU_PATH_OPTIONS , false ) ;
break ;
2013-04-29 17:08:24 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-04-10 13:17:01 +02:00
case SHADERMAN_LOAD_CGP :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-14 15:43:02 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
menu_stack_push ( CGP_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , EXT_CGP_PRESETS , g_settings . video . shader_dir ) ;
break ;
case RGUI_ACTION_START :
g_settings . video . shader_path [ 0 ] = ' \0 ' ;
video_set_shader_func ( RARCH_SHADER_CG , NULL ) ;
g_settings . video . shader_enable = false ;
break ;
2013-04-14 15:43:02 +02:00
}
2013-04-10 13:17:01 +02:00
break ;
case SHADERMAN_SAVE_CGP :
# ifdef HAVE_OSKUTIL
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
rgui - > osk_param = SHADER_PRESET_FILE ;
rgui - > osk_init = osk_callback_enter_filename_init ;
rgui - > osk_callback = osk_callback_enter_filename ;
break ;
2013-04-10 13:17:01 +02:00
}
# endif
break ;
2013-04-10 15:57:36 +02:00
case SHADERMAN_SHADER_PASSES :
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
if ( rgui - > shader . passes )
rgui - > shader . passes - - ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( rgui - > shader . passes < RGUI_MAX_SHADERS )
rgui - > shader . passes + + ;
break ;
case RGUI_ACTION_START :
2013-04-17 23:31:49 +02:00
rgui - > shader . passes = 0 ;
2013-09-26 22:34:06 +02:00
break ;
}
2013-04-10 15:57:36 +02:00
break ;
2013-04-10 13:17:01 +02:00
case SHADERMAN_AUTOSTART_CGP_ON_STARTUP :
break ;
2013-04-10 15:57:36 +02:00
case SHADERMAN_SHADER_0 :
case SHADERMAN_SHADER_1 :
case SHADERMAN_SHADER_2 :
case SHADERMAN_SHADER_3 :
case SHADERMAN_SHADER_4 :
case SHADERMAN_SHADER_5 :
case SHADERMAN_SHADER_6 :
case SHADERMAN_SHADER_7 :
{
uint8_t index = ( switchvalue - SHADERMAN_SHADER_0 ) / 3 ;
2013-04-17 23:31:49 +02:00
struct gfx_shader_pass * pass = & rgui - > shader . pass [ index ] ;
2013-04-10 15:57:36 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-10 15:57:36 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
shader_choice_set_shader_slot = index ;
menu_stack_push ( SHADER_CHOICE , true ) ;
filebrowser_set_root_and_ext ( rgui - > browser , EXT_SHADERS , g_settings . video . shader_dir ) ;
break ;
case RGUI_ACTION_START :
* pass - > source . cg = ' \0 ' ;
break ;
2013-04-10 15:57:36 +02:00
}
}
break ;
case SHADERMAN_SHADER_0_FILTER :
case SHADERMAN_SHADER_1_FILTER :
case SHADERMAN_SHADER_2_FILTER :
case SHADERMAN_SHADER_3_FILTER :
case SHADERMAN_SHADER_4_FILTER :
case SHADERMAN_SHADER_5_FILTER :
case SHADERMAN_SHADER_6_FILTER :
case SHADERMAN_SHADER_7_FILTER :
{
uint8_t index = ( switchvalue - SHADERMAN_SHADER_0 ) / 3 ;
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-10 15:57:36 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_LEFT :
case RGUI_ACTION_OK :
{
unsigned delta = ( action = = RGUI_ACTION_LEFT ) ? 2 : 1 ;
rgui - > shader . pass [ index ] . filter = ( enum gfx_filter_type ) ( ( rgui - > shader . pass [ index ] . filter + delta ) % 3 ) ;
}
break ;
case RGUI_ACTION_START :
rgui - > shader . pass [ index ] . filter = RARCH_FILTER_UNSPEC ;
break ;
2013-04-10 15:57:36 +02:00
}
}
break ;
case SHADERMAN_SHADER_0_SCALE :
case SHADERMAN_SHADER_1_SCALE :
case SHADERMAN_SHADER_2_SCALE :
case SHADERMAN_SHADER_3_SCALE :
case SHADERMAN_SHADER_4_SCALE :
case SHADERMAN_SHADER_5_SCALE :
case SHADERMAN_SHADER_6_SCALE :
case SHADERMAN_SHADER_7_SCALE :
{
uint8_t index = ( switchvalue - SHADERMAN_SHADER_0 ) / 3 ;
2013-04-17 23:31:49 +02:00
unsigned scale = rgui - > shader . pass [ index ] . fbo . scale_x ;
2013-04-10 15:57:36 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-10 15:57:36 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
if ( scale )
{
rgui - > shader . pass [ index ] . fbo . scale_x = rgui - > shader . pass [ index ] . fbo . scale_y = scale - 1 ;
rgui - > shader . pass [ index ] . fbo . valid = scale - 1 ;
}
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
if ( scale < 5 )
{
rgui - > shader . pass [ index ] . fbo . scale_x = rgui - > shader . pass [ index ] . fbo . scale_y = scale + 1 ;
rgui - > shader . pass [ index ] . fbo . valid = scale + 1 ;
}
break ;
case RGUI_ACTION_START :
rgui - > shader . pass [ index ] . fbo . scale_x = rgui - > shader . pass [ index ] . fbo . scale_y = 0 ;
rgui - > shader . pass [ index ] . fbo . valid = false ;
break ;
2013-04-10 15:57:36 +02:00
}
}
break ;
case SHADERMAN_APPLY_CHANGES :
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-10 15:57:36 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
case RGUI_ACTION_START :
{
bool ret = false ;
char cgp_path [ PATH_MAX ] ;
2013-04-10 15:57:36 +02:00
2013-09-26 22:34:06 +02:00
if ( rgui - > shader . passes )
{
const char * shader_dir = * g_settings . video . shader_dir ?
g_settings . video . shader_dir : g_settings . system_directory ;
fill_pathname_join ( cgp_path , shader_dir , " rgui.cgp " , sizeof ( cgp_path ) ) ;
config_file_t * conf = config_file_new ( NULL ) ;
if ( ! conf )
return 0 ;
gfx_shader_write_conf_cgp ( conf , & rgui - > shader ) ;
config_file_write ( conf , cgp_path ) ;
config_file_free ( conf ) ;
}
else
cgp_path [ 0 ] = ' \0 ' ;
2013-04-14 15:43:02 +02:00
2013-09-26 22:34:06 +02:00
ret = video_set_shader_func ( RARCH_SHADER_CG , ( cgp_path [ 0 ] ! = ' \0 ' ) ? cgp_path : NULL ) ;
2013-04-10 15:57:36 +02:00
2013-09-26 22:34:06 +02:00
if ( ret )
g_settings . video . shader_enable = true ;
else
{
RARCH_ERR ( " Setting RGUI CGP failed. \n " ) ;
g_settings . video . shader_enable = false ;
}
}
break ;
2013-04-10 15:57:36 +02:00
}
break ;
2013-04-10 13:17:01 +02:00
# endif
2012-07-30 17:19:05 +02:00
}
2013-01-11 03:58:43 +01:00
return 0 ;
2012-01-16 04:07:02 +01:00
}
2012-01-10 23:33:44 +01:00
2013-09-26 22:34:06 +02:00
static int select_setting ( void * data , uint64_t action )
2012-06-19 03:44:17 +02:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-05-05 20:10:06 +02:00
static uint8_t first_setting = FIRST_SETTING ;
2013-04-13 22:07:20 +02:00
uint8_t items_pages [ SETTING_LAST_LAST ] = { 0 } ;
2013-03-25 18:36:15 +01:00
uint8_t max_settings = 0 ;
2013-03-25 17:47:24 +01:00
2013-03-11 20:05:05 +01:00
font_params_t font_parms = { 0 } ;
2012-12-17 05:30:28 +01:00
2013-01-11 03:58:43 +01:00
int ret = 0 ;
2012-12-17 05:30:28 +01:00
2013-04-17 23:31:49 +02:00
switch ( rgui - > menu_type )
2013-03-25 17:47:24 +01:00
{
2013-04-06 23:49:28 +02:00
case INGAME_MENU :
first_setting = FIRST_INGAME_MENU_SETTING ;
max_settings = MAX_NO_OF_INGAME_MENU_SETTINGS ;
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS :
2013-05-05 20:10:06 +02:00
first_setting = FIRST_SETTING ;
max_settings = MAX_NO_OF_SETTINGS ;
2013-05-05 04:42:06 +02:00
break ;
2013-05-05 00:27:26 +02:00
case INGAME_MENU_INPUT_OPTIONS :
first_setting = FIRST_CONTROLS_SETTING_PAGE_1 ;
max_settings = MAX_NO_OF_CONTROLS_SETTINGS ;
break ;
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS :
first_setting = FIRST_PATH_SETTING ;
max_settings = MAX_NO_OF_PATH_SETTINGS ;
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS :
first_setting = FIRST_AUDIO_SETTING ;
max_settings = MAX_NO_OF_AUDIO_SETTINGS ;
break ;
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS :
2013-05-05 20:10:06 +02:00
first_setting = FIRST_VIDEO_SETTING ;
2013-05-05 21:11:34 +02:00
max_settings = MAX_NO_OF_VIDEO_SETTINGS ;
break ;
2013-05-05 21:16:34 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS :
first_setting = FIRST_SHADERMAN_SETTING ;
2013-04-17 23:31:49 +02:00
switch ( rgui - > shader . passes )
2013-04-10 15:57:36 +02:00
{
case 0 :
2013-05-05 21:11:34 +02:00
max_settings = MAX_NO_OF_SHADERMAN_SETTINGS ;
2013-04-10 15:57:36 +02:00
break ;
case 1 :
max_settings = SHADERMAN_SHADER_0_SCALE + 1 ;
break ;
case 2 :
max_settings = SHADERMAN_SHADER_1_SCALE + 1 ;
break ;
case 3 :
max_settings = SHADERMAN_SHADER_2_SCALE + 1 ;
break ;
case 4 :
max_settings = SHADERMAN_SHADER_3_SCALE + 1 ;
break ;
case 5 :
max_settings = SHADERMAN_SHADER_4_SCALE + 1 ;
break ;
case 6 :
max_settings = SHADERMAN_SHADER_5_SCALE + 1 ;
break ;
case 7 :
max_settings = SHADERMAN_SHADER_6_SCALE + 1 ;
break ;
case 8 :
max_settings = SHADERMAN_SHADER_7_SCALE + 1 ;
break ;
}
2013-04-28 15:00:37 +02:00
break ;
2013-05-05 21:16:34 +02:00
# endif
2013-03-25 17:47:24 +01:00
}
2013-04-10 01:34:40 +02:00
float y_increment = POSITION_Y_START ;
2013-03-25 18:36:15 +01:00
uint8_t i = 0 ;
uint8_t j = 0 ;
uint8_t item_page = 0 ;
2013-03-26 08:15:48 +01:00
2013-03-25 17:47:24 +01:00
for ( i = first_setting ; i < max_settings ; i + + )
2012-08-19 18:03:50 +02:00
{
2013-04-13 18:47:42 +02:00
char fname [ PATH_MAX ] ;
char text [ PATH_MAX ] ;
char comment [ PATH_MAX ] ;
char setting_text [ PATH_MAX ] ;
( void ) fname ;
switch ( i )
{
# ifdef __CELLOS_LV2__
case SETTING_CHANGE_RESOLUTION :
{
unsigned width = gfx_ctx_get_resolution_width ( g_extern . console . screen . resolutions . list [ g_extern . console . screen . resolutions . current . idx ] ) ;
unsigned height = gfx_ctx_get_resolution_height ( g_extern . console . screen . resolutions . list [ g_extern . console . screen . resolutions . current . idx ] ) ;
strlcpy ( text , " Resolution " , sizeof ( text ) ) ;
strlcpy ( comment , " INFO - Change the display resolution. " , sizeof ( comment ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , " %dx%d " , width , height ) ;
}
break ;
case SETTING_PAL60_MODE :
strlcpy ( text , " PAL60 Mode " , sizeof ( text ) ) ;
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_PAL_TEMPORAL_ENABLE ) )
{
strlcpy ( setting_text , " ON " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - [PAL60 Mode is set to 'ON'. \n converts frames from 60Hz to 50Hz. " , sizeof ( comment ) ) ;
}
else
{
strlcpy ( setting_text , " OFF " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - [PAL60 Mode is set to 'OFF'. \n frames are not converted. " , sizeof ( comment ) ) ;
}
break ;
# endif
case SETTING_EMU_SKIN :
fill_pathname_base ( fname , g_extern . menu_texture_path , sizeof ( fname ) ) ;
strlcpy ( text , " Menu Skin " , sizeof ( text ) ) ;
strlcpy ( setting_text , fname , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Select a skin for the menu. " , sizeof ( comment ) ) ;
break ;
case SETTING_FONT_SIZE :
strlcpy ( text , " Font Size " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , " %f " , g_settings . video . font_size ) ;
strlcpy ( comment , " INFO - Increase or decrease the [Font Size]. " , sizeof ( comment ) ) ;
break ;
case SETTING_HW_TEXTURE_FILTER :
2013-04-28 15:00:37 +02:00
strlcpy ( text , " Default Filter " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
if ( g_settings . video . smooth )
{
2013-04-28 15:00:37 +02:00
strlcpy ( setting_text , " Linear " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Default Filter is set to Linear. " ,
2013-04-13 18:47:42 +02:00
sizeof ( comment ) ) ;
}
else
{
2013-04-28 15:00:37 +02:00
strlcpy ( setting_text , " Nearest " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Default Filter is set to Nearest. " ,
2013-04-13 18:47:42 +02:00
sizeof ( comment ) ) ;
}
break ;
# ifdef _XBOX1
case SETTING_FLICKER_FILTER :
strlcpy ( text , " Flicker Filter " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , " %d " , g_extern . console . screen . flicker_filter_index ) ;
strlcpy ( comment , " INFO - Toggle the [Flicker Filter]. " , sizeof ( comment ) ) ;
break ;
case SETTING_SOFT_DISPLAY_FILTER :
strlcpy ( text , " Soft Display Filter " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_SOFT_FILTER_ENABLE ) ) ? " ON " : " OFF " ) ;
strlcpy ( comment , " INFO - Toggle the [Soft Display Filter]. " , sizeof ( comment ) ) ;
break ;
# endif
case SETTING_REFRESH_RATE :
strlcpy ( text , " Refresh rate " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , " %fHz " , g_settings . video . refresh_rate ) ;
strlcpy ( comment , " INFO - Adjust or decrease [Refresh Rate]. " , sizeof ( comment ) ) ;
break ;
case SETTING_TRIPLE_BUFFERING :
strlcpy ( text , " Triple Buffering " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_TRIPLE_BUFFERING_ENABLE ) ) ? " ON " : " OFF " ) ;
snprintf ( comment , sizeof ( comment ) , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_VIDEO_TRIPLE_BUFFERING_ENABLE ) ) ? " INFO - [Triple Buffering] is set to 'ON'. " : " INFO - [Triple Buffering] is set to 'OFF'. " ) ;
break ;
case SETTING_SOUND_MODE :
strlcpy ( text , " Sound Output " , sizeof ( text ) ) ;
switch ( g_extern . console . sound . mode )
{
case SOUND_MODE_NORMAL :
strlcpy ( comment , " INFO - [Sound Output] is set to 'Normal'. " , sizeof ( comment ) ) ;
strlcpy ( setting_text , " Normal " , sizeof ( setting_text ) ) ;
break ;
# ifdef HAVE_RSOUND
case SOUND_MODE_RSOUND :
strlcpy ( comment , " INFO - [Sound Output] is set to 'RSound'. " , sizeof ( comment ) ) ;
strlcpy ( setting_text , " RSound " , sizeof ( setting_text ) ) ;
break ;
# endif
# ifdef HAVE_HEADSET
case SOUND_MODE_HEADSET :
strlcpy ( comment , " INFO - [Sound Output] is set to USB/Bluetooth Headset. " , sizeof ( comment ) ) ;
strlcpy ( setting_text , " USB/Bluetooth Headset " , sizeof ( setting_text ) ) ;
break ;
# endif
default :
break ;
}
break ;
# ifdef HAVE_RSOUND
case SETTING_RSOUND_SERVER_IP_ADDRESS :
strlcpy ( text , " RSound Server IP Address " , sizeof ( text ) ) ;
strlcpy ( setting_text , g_settings . audio . device , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Enter the IP Address of the [RSound Audio Server]. IP address \n must be an IPv4 32-bits address, eg: '192.168.1.7'. " , sizeof ( comment ) ) ;
break ;
# endif
case SETTING_EMU_SHOW_DEBUG_INFO_MSG :
2013-05-05 17:38:20 +02:00
strlcpy ( text , " Debug Info Messages " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
snprintf ( setting_text , sizeof ( setting_text ) , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_FPS_DRAW ) ) ? " ON " : " OFF " ) ;
strlcpy ( comment , " INFO - Show onscreen debug messages. " , sizeof ( comment ) ) ;
break ;
case SETTING_EMU_SHOW_INFO_MSG :
2013-05-05 17:38:20 +02:00
strlcpy ( text , " Info Messages " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
snprintf ( setting_text , sizeof ( setting_text ) , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_INFO_DRAW ) ) ? " ON " : " OFF " ) ;
strlcpy ( comment , " INFO - Show onscreen info messages in the menu. " , sizeof ( comment ) ) ;
break ;
2013-05-26 00:32:39 +02:00
case SETTING_REWIND_ENABLED :
2013-05-04 23:26:39 +02:00
strlcpy ( text , " Rewind " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
if ( g_settings . rewind_enable )
{
strlcpy ( setting_text , " ON " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - [Rewind] feature is set to 'ON'. " ,
sizeof ( comment ) ) ;
}
else
{
strlcpy ( setting_text , " OFF " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - [Rewind] feature is set to 'OFF'. " ,
sizeof ( comment ) ) ;
}
break ;
2013-05-26 00:32:39 +02:00
case SETTING_REWIND_GRANULARITY :
2013-05-04 23:26:39 +02:00
strlcpy ( text , " Rewind Granularity " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
snprintf ( setting_text , sizeof ( setting_text ) , " %d " , g_settings . rewind_granularity ) ;
strlcpy ( comment , " INFO - Set the amount of frames to 'rewind'. " , sizeof ( comment ) ) ;
break ;
case SETTING_EMU_AUDIO_MUTE :
strlcpy ( text , " Mute Audio " , sizeof ( text ) ) ;
if ( g_extern . audio_data . mute )
{
strlcpy ( comment , " INFO - the game audio will be muted. " , sizeof ( comment ) ) ;
strlcpy ( setting_text , " ON " , sizeof ( setting_text ) ) ;
}
else
{
strlcpy ( comment , " INFO - game audio will be on. " , sizeof ( comment ) ) ;
strlcpy ( setting_text , " OFF " , sizeof ( setting_text ) ) ;
}
break ;
# ifdef _XBOX1
case SETTING_EMU_AUDIO_SOUND_VOLUME_LEVEL :
strlcpy ( text , " Volume Level " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , g_extern . console . sound . volume_level ? " Loud " : " Normal " ) ;
if ( g_extern . audio_data . mute )
strlcpy ( comment , " INFO - Volume level is set to Loud. " , sizeof ( comment ) ) ;
else
strlcpy ( comment , " INFO - Volume level is set to Normal. " , sizeof ( comment ) ) ;
break ;
# endif
case SETTING_ENABLE_CUSTOM_BGM :
strlcpy ( text , " Custom BGM Option " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) ) ? " ON " : " OFF " ) ;
snprintf ( comment , sizeof ( comment ) , " INFO - [Custom BGM] is set to '%s'. " , ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_AUDIO_CUSTOM_BGM_ENABLE ) ) ? " ON " : " OFF " ) ;
break ;
case SETTING_PATH_DEFAULT_ROM_DIRECTORY :
2013-05-05 17:38:20 +02:00
strlcpy ( text , " Browser Directory " , sizeof ( text ) ) ;
2013-04-18 18:33:03 +02:00
strlcpy ( setting_text , g_settings . rgui_browser_directory , sizeof ( setting_text ) ) ;
2013-05-04 21:17:47 +02:00
strlcpy ( comment , " INFO - Set the default startup browser directory path. " , sizeof ( comment ) ) ;
2013-04-13 18:47:42 +02:00
break ;
case SETTING_PATH_SAVESTATES_DIRECTORY :
strlcpy ( text , " Savestate Directory " , sizeof ( text ) ) ;
2013-04-29 05:44:32 +02:00
strlcpy ( setting_text , g_extern . savestate_dir , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " INFO - Directory where savestates will be saved to. " , sizeof ( comment ) ) ;
break ;
case SETTING_PATH_SRAM_DIRECTORY :
2013-05-04 23:26:39 +02:00
strlcpy ( text , " Savefile Directory " , sizeof ( text ) ) ;
2013-04-29 05:44:32 +02:00
strlcpy ( setting_text , g_extern . savefile_dir , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " INFO - Set the default SaveRAM directory path. " , sizeof ( comment ) ) ;
break ;
# ifdef HAVE_XML
case SETTING_PATH_CHEATS :
strlcpy ( text , " Cheatfile Directory " , sizeof ( text ) ) ;
strlcpy ( setting_text , g_settings . cheat_database , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Set the default Cheatfile directory path. " , sizeof ( comment ) ) ;
break ;
# endif
case SETTING_PATH_SYSTEM :
strlcpy ( text , " System Directory " , sizeof ( text ) ) ;
strlcpy ( setting_text , g_settings . system_directory , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Set the default [System directory] path. " , sizeof ( comment ) ) ;
break ;
case SETTING_CONTROLS_SCHEME :
2013-06-03 01:18:09 +02:00
strlcpy ( text , " Load Controls Preset " , sizeof ( text ) ) ;
snprintf ( comment , sizeof ( comment ) , " INFO - Controls preset [%s] is selected. " , g_extern . input_config_path ) ;
2013-05-05 16:29:32 +02:00
strlcpy ( setting_text , g_extern . input_config_path , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
break ;
case SETTING_CONTROLS_NUMBER :
2013-05-04 23:26:39 +02:00
strlcpy ( text , " Player " , sizeof ( text ) ) ;
snprintf ( comment , sizeof ( comment ) , " Player %d is currently selected. " , rgui - > current_pad + 1 ) ;
2013-05-04 16:13:58 +02:00
snprintf ( setting_text , sizeof ( setting_text ) , " %d " , rgui - > current_pad + 1 ) ;
2013-04-13 18:47:42 +02:00
break ;
case SETTING_DPAD_EMULATION :
strlcpy ( text , " D-Pad Emulation " , sizeof ( text ) ) ;
2013-05-04 16:13:58 +02:00
switch ( g_settings . input . dpad_emulation [ rgui - > current_pad ] )
2013-04-13 18:47:42 +02:00
{
case ANALOG_DPAD_NONE :
2013-05-04 16:13:58 +02:00
snprintf ( comment , sizeof ( comment ) , " [%s] from Controller %d is mapped to D-pad. " , " None " , rgui - > current_pad + 1 ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " None " , sizeof ( setting_text ) ) ;
break ;
case ANALOG_DPAD_LSTICK :
2013-05-04 16:13:58 +02:00
snprintf ( comment , sizeof ( comment ) , " [%s] from Controller %d is mapped to D-pad. " , " Left Stick " , rgui - > current_pad + 1 ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " Left Stick " , sizeof ( setting_text ) ) ;
break ;
case ANALOG_DPAD_RSTICK :
2013-05-04 16:13:58 +02:00
snprintf ( comment , sizeof ( comment ) , " [%s] from Controller %d is mapped to D-pad. " , " Right Stick " , rgui - > current_pad + 1 ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " Right Stick " , sizeof ( setting_text ) ) ;
break ;
}
break ;
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_B :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_Y :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_SELECT :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_START :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_UP :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_DOWN :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_LEFT :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_RIGHT :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_A :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_X :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2 :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2 :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3 :
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3 :
{
unsigned id = i - FIRST_CONTROL_BIND ;
struct platform_bind key_label ;
strlcpy ( key_label . desc , " Unknown " , sizeof ( key_label . desc ) ) ;
2013-05-04 16:13:58 +02:00
key_label . joykey = g_settings . input . binds [ rgui - > current_pad ] [ id ] . joykey ;
2013-04-13 18:47:42 +02:00
if ( driver . input - > set_keybinds )
driver . input - > set_keybinds ( & key_label , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
2013-05-04 16:13:58 +02:00
strlcpy ( text , g_settings . input . binds [ rgui - > current_pad ] [ id ] . desc , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
snprintf ( comment , sizeof ( comment ) , " INFO - [%s] is mapped to action: \n [%s]. " , text , key_label . desc ) ;
strlcpy ( setting_text , key_label . desc , sizeof ( setting_text ) ) ;
}
break ;
case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS :
2013-06-03 01:50:59 +02:00
strlcpy ( text , " Save Controls Preset " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Save the [Custom Controls] settings to file. " , sizeof ( comment ) ) ;
break ;
case SETTING_CONTROLS_DEFAULT_ALL :
strlcpy ( text , " DEFAULTS " , sizeof ( text ) ) ;
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Set all Controls settings to defaults. " , sizeof ( comment ) ) ;
break ;
case INGAME_MENU_LOAD_STATE :
strlcpy ( text , " Load State " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , " %d " , g_extern . state_slot ) ;
strlcpy ( comment , " Load from current state slot. " , sizeof ( comment ) ) ;
break ;
case INGAME_MENU_SAVE_STATE :
strlcpy ( text , " Save State " , sizeof ( text ) ) ;
snprintf ( setting_text , sizeof ( setting_text ) , " %d " , g_extern . state_slot ) ;
strlcpy ( comment , " Save to current state slot. " , sizeof ( comment ) ) ;
break ;
2013-04-28 15:00:37 +02:00
case SETTING_ASPECT_RATIO :
2013-04-13 18:47:42 +02:00
strlcpy ( text , " Aspect Ratio " , sizeof ( text ) ) ;
strlcpy ( setting_text , aspectratio_lut [ g_settings . video . aspect_ratio_idx ] . name , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Change the aspect ratio of the screen. " , sizeof ( comment ) ) ;
break ;
2013-04-28 15:00:37 +02:00
case SETTING_ROTATION :
2013-04-13 18:47:42 +02:00
strlcpy ( text , " Rotation " , sizeof ( text ) ) ;
2013-09-22 11:45:04 +02:00
strlcpy ( setting_text , rotation_lut [ g_settings . video . rotation ] , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " Change orientation of the screen. " , sizeof ( comment ) ) ;
break ;
2013-05-05 00:27:26 +02:00
case SETTING_CUSTOM_VIEWPORT :
2013-04-29 04:55:49 +02:00
strlcpy ( text , " Custom Ratio " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " Allows you to resize the screen. " , sizeof ( comment ) ) ;
break ;
case INGAME_MENU_CORE_OPTIONS_MODE :
2013-04-29 04:55:49 +02:00
strlcpy ( text , " Core Options " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " Set core-specific options. " , sizeof ( comment ) ) ;
break ;
2013-05-05 21:16:34 +02:00
# ifdef HAVE_SHADER_MANAGER
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS_MODE :
strlcpy ( text , " Shader Options " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Set and manage shader options. " , sizeof ( comment ) ) ;
break ;
2013-05-05 21:16:34 +02:00
# endif
2013-04-29 05:17:22 +02:00
case INGAME_MENU_LOAD_GAME_HISTORY_MODE :
strlcpy ( text , " Load Game (History) " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Select a game from the history list. " , sizeof ( comment ) ) ;
break ;
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS_MODE :
2013-04-29 04:55:49 +02:00
strlcpy ( text , " Video Options " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
2013-04-28 15:00:37 +02:00
strlcpy ( comment , " Set and manage video options. " , sizeof ( comment ) ) ;
2013-04-13 18:47:42 +02:00
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS_MODE :
strlcpy ( text , " Audio Options " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Set and manage audio options. " , sizeof ( comment ) ) ;
break ;
2013-05-05 02:58:48 +02:00
case INGAME_MENU_INPUT_OPTIONS_MODE :
strlcpy ( text , " Input Options " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Set and manage input options. " , sizeof ( comment ) ) ;
break ;
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS_MODE :
strlcpy ( text , " Path Options " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Set and manage path options. " , sizeof ( comment ) ) ;
break ;
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS_MODE :
strlcpy ( text , " Settings " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Set and manage various settings. " , sizeof ( comment ) ) ;
break ;
2013-04-13 18:47:42 +02:00
case INGAME_MENU_FRAME_ADVANCE :
strlcpy ( text , " Frame Advance " , sizeof ( text ) ) ;
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Press a button to step one frame. " , sizeof ( comment ) ) ;
break ;
case INGAME_MENU_SCREENSHOT_MODE :
2013-05-05 04:48:06 +02:00
strlcpy ( text , " Take Screenshot " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Take a screenshot. " , sizeof ( comment ) ) ;
break ;
case INGAME_MENU_RESET :
2013-04-23 23:22:50 +02:00
strlcpy ( text , " Restart Game " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Reset the game. " , sizeof ( comment ) ) ;
break ;
case INGAME_MENU_RETURN_TO_GAME :
2013-04-23 23:22:50 +02:00
strlcpy ( text , " Resume Game " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
2013-04-23 23:22:50 +02:00
strlcpy ( comment , " Resume the currently loaded game. " , sizeof ( comment ) ) ;
2013-04-13 18:47:42 +02:00
break ;
case INGAME_MENU_CHANGE_GAME :
2013-04-29 04:55:49 +02:00
strlcpy ( text , " Load Game " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
2013-04-23 23:22:50 +02:00
strlcpy ( comment , " Select a game to be loaded. " , sizeof ( comment ) ) ;
2013-04-13 18:47:42 +02:00
break ;
case INGAME_MENU_CHANGE_LIBRETRO_CORE :
2013-04-29 04:55:49 +02:00
strlcpy ( text , " Core " , sizeof ( text ) ) ;
strlcpy ( setting_text , " ... " , sizeof ( setting_text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " Choose another libretro core. " , sizeof ( comment ) ) ;
break ;
# ifdef HAVE_MULTIMAN
case INGAME_MENU_RETURN_TO_MULTIMAN :
strlcpy ( text , " Return to multiMAN " , sizeof ( text ) ) ;
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Quit RetroArch and return to multiMAN. " , sizeof ( comment ) ) ;
break ;
# endif
case INGAME_MENU_QUIT_RETROARCH :
strlcpy ( text , " Quit RetroArch " , sizeof ( text ) ) ;
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " Quit RetroArch. " , sizeof ( comment ) ) ;
break ;
default :
break ;
# ifdef HAVE_SHADER_MANAGER
case SHADERMAN_LOAD_CGP :
2013-05-04 23:39:12 +02:00
strlcpy ( text , " Load Shader Preset " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Select a CGP file. " , sizeof ( comment ) ) ;
break ;
case SHADERMAN_AUTOSTART_CGP_ON_STARTUP :
strlcpy ( text , " Autostart CGP at startup " , sizeof ( text ) ) ;
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Auto-load at startup the current shader settings. " , sizeof ( comment ) ) ;
break ;
case SHADERMAN_SAVE_CGP :
2013-05-04 23:39:12 +02:00
strlcpy ( text , " Save Shader Preset " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Save current shader settings to a CGP file. " , sizeof ( comment ) ) ;
break ;
case SHADERMAN_SHADER_PASSES :
2013-05-04 16:13:58 +02:00
strlcpy ( text , " Shader Passes " , sizeof ( text ) ) ;
2013-04-17 23:31:49 +02:00
snprintf ( setting_text , sizeof ( setting_text ) , " %u " , rgui - > shader . passes ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( comment , " INFO - Set the amount of shader passes. " , sizeof ( comment ) ) ;
break ;
case SHADERMAN_APPLY_CHANGES :
2013-05-04 16:13:58 +02:00
strlcpy ( text , " Apply Shader Changes " , sizeof ( text ) ) ;
2013-04-13 18:47:42 +02:00
strlcpy ( setting_text , " " , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Apply the changes made below. " , sizeof ( comment ) ) ;
break ;
case SHADERMAN_SHADER_0 :
case SHADERMAN_SHADER_1 :
case SHADERMAN_SHADER_2 :
case SHADERMAN_SHADER_3 :
case SHADERMAN_SHADER_4 :
case SHADERMAN_SHADER_5 :
case SHADERMAN_SHADER_6 :
case SHADERMAN_SHADER_7 :
{
char type_str [ 256 ] ;
uint8_t index = ( i - SHADERMAN_SHADER_0 ) / 3 ;
2013-04-17 23:31:49 +02:00
if ( * rgui - > shader . pass [ index ] . source . cg )
2013-04-13 18:47:42 +02:00
fill_pathname_base ( type_str ,
2013-04-17 23:31:49 +02:00
rgui - > shader . pass [ index ] . source . cg , sizeof ( type_str ) ) ;
2013-04-13 18:47:42 +02:00
else
strlcpy ( type_str , " N/A " , sizeof ( type_str ) ) ;
snprintf ( text , sizeof ( text ) , " Shader #%d " , index ) ;
strlcpy ( setting_text , type_str , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Select the shader. " , sizeof ( comment ) ) ;
}
break ;
case SHADERMAN_SHADER_0_FILTER :
case SHADERMAN_SHADER_1_FILTER :
case SHADERMAN_SHADER_2_FILTER :
case SHADERMAN_SHADER_3_FILTER :
case SHADERMAN_SHADER_4_FILTER :
case SHADERMAN_SHADER_5_FILTER :
case SHADERMAN_SHADER_6_FILTER :
case SHADERMAN_SHADER_7_FILTER :
{
char type_str [ 256 ] ;
uint8_t index = ( i - SHADERMAN_SHADER_0 ) / 3 ;
snprintf ( text , sizeof ( text ) , " Shader #%d filter " , index ) ;
shader_manager_get_str_filter ( type_str , sizeof ( type_str ) , index ) ;
strlcpy ( setting_text , type_str , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Select the filtering. " , sizeof ( comment ) ) ;
}
break ;
case SHADERMAN_SHADER_0_SCALE :
case SHADERMAN_SHADER_1_SCALE :
case SHADERMAN_SHADER_2_SCALE :
case SHADERMAN_SHADER_3_SCALE :
case SHADERMAN_SHADER_4_SCALE :
case SHADERMAN_SHADER_5_SCALE :
case SHADERMAN_SHADER_6_SCALE :
case SHADERMAN_SHADER_7_SCALE :
{
char type_str [ 256 ] ;
uint8_t index = ( i - SHADERMAN_SHADER_0 ) / 3 ;
2013-04-17 23:31:49 +02:00
unsigned scale = rgui - > shader . pass [ index ] . fbo . scale_x ;
2013-04-13 18:47:42 +02:00
snprintf ( text , sizeof ( text ) , " Shader #%d scale " , index ) ;
if ( ! scale )
strlcpy ( type_str , " Don't care " , sizeof ( type_str ) ) ;
else
snprintf ( type_str , sizeof ( type_str ) , " %ux " , scale ) ;
strlcpy ( setting_text , type_str , sizeof ( setting_text ) ) ;
strlcpy ( comment , " INFO - Select the scaling factor of this pass. " , sizeof ( comment ) ) ;
}
break ;
# endif
}
2012-08-19 18:03:50 +02:00
2013-05-05 17:03:57 +02:00
char setting_text_buf [ 256 ] ;
2013-09-26 14:45:13 +02:00
menu_ticker_line ( setting_text_buf , TICKER_LABEL_CHARS_MAX_PER_LINE , g_extern . frame_count / 15 , setting_text , i = = rgui - > selection_ptr ) ;
2013-05-05 17:03:57 +02:00
2013-04-10 01:34:40 +02:00
if ( ! ( j < NUM_ENTRY_PER_PAGE ) )
2012-08-19 18:03:50 +02:00
{
2012-08-20 18:44:24 +02:00
j = 0 ;
2013-03-25 18:36:15 +01:00
item_page + + ;
2012-08-19 18:03:50 +02:00
}
2012-08-20 18:44:24 +02:00
2013-03-26 15:15:07 +01:00
items_pages [ i ] = item_page ;
2012-08-20 18:44:24 +02:00
j + + ;
2012-06-28 21:03:14 +02:00
2013-04-13 21:40:48 +02:00
if ( item_page ! = setting_page_number )
2013-03-26 15:06:08 +01:00
continue ;
2013-03-26 00:23:05 +01:00
2013-04-10 01:34:40 +02:00
y_increment + = POSITION_Y_INCREMENT ;
2013-03-26 00:23:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = y_increment ;
font_parms . scale = FONT_SIZE_VARIABLE ;
2013-09-26 14:45:13 +02:00
font_parms . color = ( i = = rgui - > selection_ptr ) ? YELLOW : WHITE ;
2013-03-26 00:23:05 +01:00
2013-03-26 15:06:08 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-04-13 18:47:42 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , text , & font_parms ) ;
2013-03-26 00:23:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-26 15:06:08 +01:00
font_parms . color = WHITE ;
2013-03-26 00:23:05 +01:00
2013-03-26 15:06:08 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-05-05 17:03:57 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , setting_text_buf , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-09-26 14:45:13 +02:00
if ( i ! = rgui - > selection_ptr )
2013-03-26 15:06:08 +01:00
continue ;
2013-03-11 21:42:02 +01:00
2013-04-10 09:34:46 +02:00
# ifdef HAVE_MENU_PANEL
menu_panel - > y = y_increment ;
2013-04-10 04:26:18 +02:00
# endif
2013-03-11 21:42:02 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = COMMENT_POSITION_Y ;
font_parms . scale = HARDCODE_FONT_SIZE ;
2013-03-26 15:06:08 +01:00
font_parms . color = WHITE ;
2012-08-18 23:47:33 +02:00
2013-03-26 15:06:08 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-04-13 18:47:42 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , comment , & font_parms ) ;
2013-03-26 15:06:08 +01:00
}
2012-08-18 23:47:33 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2013-04-06 23:49:28 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_UP :
if ( rgui - > selection_ptr = = first_setting )
rgui - > selection_ptr = max_settings - 1 ;
else
rgui - > selection_ptr - - ;
2013-04-06 23:49:28 +02:00
2013-09-26 22:34:06 +02:00
if ( items_pages [ rgui - > selection_ptr ] ! = setting_page_number )
setting_page_number = items_pages [ rgui - > selection_ptr ] ;
break ;
case RGUI_ACTION_DOWN :
rgui - > selection_ptr + + ;
2013-03-11 20:05:05 +01:00
2013-09-26 22:34:06 +02:00
if ( rgui - > selection_ptr > = max_settings )
rgui - > selection_ptr = first_setting ;
if ( items_pages [ rgui - > selection_ptr ] ! = setting_page_number )
setting_page_number = items_pages [ rgui - > selection_ptr ] ;
break ;
case RGUI_ACTION_CANCEL :
if ( rgui - > menu_type = = INGAME_MENU )
{
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_GAME ) ;
return - 1 ;
}
2013-03-26 08:15:48 +01:00
2013-09-26 22:34:06 +02:00
menu_stack_pop ( rgui - > menu_type ) ;
break ;
2012-04-14 04:38:40 +02:00
}
2012-01-10 23:33:44 +01:00
2013-09-26 22:34:06 +02:00
ret = set_setting_action ( rgui - > menu_type , rgui - > selection_ptr , action ) ;
2013-03-26 08:15:48 +01:00
if ( ret ! = 0 )
return ret ;
2013-04-17 23:31:49 +02:00
display_menubar ( rgui - > menu_type ) ;
2013-03-26 08:15:48 +01:00
2013-01-11 03:58:43 +01:00
return 0 ;
2012-01-10 23:33:44 +01:00
}
2013-09-26 22:34:06 +02:00
static int select_rom ( void * data , uint64_t action )
2012-06-19 03:44:17 +02:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-03-11 20:05:05 +01:00
font_params_t font_parms = { 0 } ;
2012-12-17 05:30:28 +01:00
char msg [ 128 ] ;
2013-03-18 18:05:15 +01:00
struct platform_bind key_label_b = { 0 } ;
2013-03-14 21:55:10 +01:00
strlcpy ( key_label_b . desc , " Unknown " , sizeof ( key_label_b . desc ) ) ;
key_label_b . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_B ;
if ( driver . input - > set_keybinds )
driver . input - > set_keybinds ( & key_label_b , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
2012-08-01 17:22:10 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2012-04-14 05:24:09 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_OK :
if ( filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_PATH_ISDIR ) )
{
bool ret = filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_OK ) ;
2012-08-01 17:22:10 +02:00
2013-09-26 22:34:06 +02:00
if ( ! ret )
{
RARCH_ERR ( " Failed to open directory. \n " ) ;
msg_queue_push ( g_extern . msg_queue , " ERROR - Failed to open directory. " , 1 , 180 ) ;
}
}
else
2013-06-02 22:32:06 +02:00
{
2013-09-26 22:34:06 +02:00
strlcpy ( g_extern . fullpath ,
rgui - > browser - > current_dir . path , sizeof ( g_extern . fullpath ) ) ;
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_LOAD_GAME ) ;
return - 1 ;
2013-06-02 22:32:06 +02:00
}
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_MAPPING_PREVIOUS :
{
const char * drive_map = menu_drive_mapping_previous ( ) ;
if ( drive_map ! = NULL )
filebrowser_set_root_and_ext ( rgui - > browser , rgui - > browser - > current_dir . extensions , drive_map ) ;
}
break ;
case RGUI_ACTION_MAPPING_NEXT :
{
const char * drive_map = menu_drive_mapping_next ( ) ;
if ( drive_map ! = NULL )
filebrowser_set_root_and_ext ( rgui - > browser , rgui - > browser - > current_dir . extensions , drive_map ) ;
}
break ;
case RGUI_ACTION_CANCEL :
menu_stack_pop ( rgui - > menu_type ) ;
break ;
2012-12-17 01:02:45 +01:00
}
2012-08-01 17:22:10 +02:00
2013-04-17 23:31:49 +02:00
if ( filebrowser_iterate ( rgui - > browser , FILEBROWSER_ACTION_PATH_ISDIR ) )
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " INFO - Press [%s] to enter the directory. " , key_label_b . desc ) ;
2012-07-30 01:35:11 +02:00
else
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " INFO - Press [%s] to load the game. " , key_label_b . desc ) ;
2012-08-02 01:59:05 +02:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = COMMENT_POSITION_Y ;
font_parms . scale = HARDCODE_FONT_SIZE ;
2013-03-11 20:05:05 +01:00
font_parms . color = WHITE ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2012-04-14 05:24:09 +02:00
2013-04-17 23:31:49 +02:00
display_menubar ( rgui - > menu_type ) ;
browser_render ( rgui - > browser ) ;
2012-12-17 01:30:38 +01:00
2013-01-11 03:58:43 +01:00
return 0 ;
2012-01-10 23:33:44 +01:00
}
2013-09-26 22:34:06 +02:00
static int ingame_menu_resize ( void * data , uint64_t action )
2012-06-28 14:10:05 +02:00
{
2013-04-17 23:31:49 +02:00
( void ) data ;
2013-03-11 20:05:05 +01:00
font_params_t font_parms = { 0 } ;
2012-12-17 05:30:28 +01:00
2012-07-31 03:26:00 +02:00
DEVICE_CAST device_ptr = ( DEVICE_CAST ) driver . video_data ;
2012-06-28 14:10:05 +02:00
2012-10-15 06:24:39 +02:00
g_settings . video . aspect_ratio_idx = ASPECT_RATIO_CUSTOM ;
2013-03-10 02:58:55 +01:00
if ( driver . video_poke - > set_aspect_ratio )
driver . video_poke - > set_aspect_ratio ( driver . video_data , g_settings . video . aspect_ratio_idx ) ;
2012-06-28 14:10:05 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2012-08-07 16:26:12 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_LEFT :
2012-10-15 06:24:39 +02:00
g_extern . console . screen . viewports . custom_vp . x - = 1 ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_RIGHT :
g_extern . console . screen . viewports . custom_vp . x + = 1 ;
break ;
case RGUI_ACTION_UP :
g_extern . console . screen . viewports . custom_vp . y + = 1 ;
break ;
case RGUI_ACTION_DOWN :
2012-10-15 06:24:39 +02:00
g_extern . console . screen . viewports . custom_vp . y - = 1 ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_SCROLL_UP :
g_extern . console . screen . viewports . custom_vp . width - = 1 ;
break ;
case RGUI_ACTION_SCROLL_DOWN :
g_extern . console . screen . viewports . custom_vp . width + = 1 ;
break ;
case RGUI_ACTION_START :
g_extern . console . screen . viewports . custom_vp . x = 0 ;
g_extern . console . screen . viewports . custom_vp . y = 0 ;
g_extern . console . screen . viewports . custom_vp . width = device_ptr - > win_width ;
g_extern . console . screen . viewports . custom_vp . height = device_ptr - > win_height ;
break ;
case RGUI_ACTION_CANCEL :
menu_stack_pop ( rgui - > menu_type ) ;
break ;
2012-08-07 16:26:12 +02:00
}
2012-06-28 14:10:05 +02:00
2013-04-19 17:53:01 +02:00
if ( rgui - > frame_buf_show )
2012-06-28 14:10:05 +02:00
{
2013-04-29 04:55:49 +02:00
char viewport [ 32 ] ;
2013-03-18 18:05:15 +01:00
char msg [ 128 ] ;
struct platform_bind key_label_b = { 0 } ;
struct platform_bind key_label_a = { 0 } ;
struct platform_bind key_label_y = { 0 } ;
struct platform_bind key_label_x = { 0 } ;
struct platform_bind key_label_l1 = { 0 } ;
struct platform_bind key_label_l2 = { 0 } ;
struct platform_bind key_label_r1 = { 0 } ;
struct platform_bind key_label_r2 = { 0 } ;
struct platform_bind key_label_dpad_left = { 0 } ;
struct platform_bind key_label_dpad_right = { 0 } ;
struct platform_bind key_label_dpad_up = { 0 } ;
struct platform_bind key_label_dpad_down = { 0 } ;
2013-03-14 21:55:10 +01:00
strlcpy ( key_label_b . desc , " Unknown " , sizeof ( key_label_b . desc ) ) ;
key_label_b . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_B ;
strlcpy ( key_label_a . desc , " Unknown " , sizeof ( key_label_a . desc ) ) ;
key_label_a . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_A ;
strlcpy ( key_label_x . desc , " Unknown " , sizeof ( key_label_x . desc ) ) ;
key_label_x . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_X ;
strlcpy ( key_label_y . desc , " Unknown " , sizeof ( key_label_y . desc ) ) ;
key_label_y . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_Y ;
strlcpy ( key_label_l1 . desc , " Unknown " , sizeof ( key_label_l1 . desc ) ) ;
key_label_l1 . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_L ;
strlcpy ( key_label_r1 . desc , " Unknown " , sizeof ( key_label_r1 . desc ) ) ;
key_label_r1 . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_R ;
strlcpy ( key_label_l2 . desc , " Unknown " , sizeof ( key_label_l2 . desc ) ) ;
key_label_l2 . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_L2 ;
strlcpy ( key_label_r2 . desc , " Unknown " , sizeof ( key_label_r2 . desc ) ) ;
key_label_r2 . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_R2 ;
strlcpy ( key_label_dpad_left . desc , " Unknown " , sizeof ( key_label_dpad_left . desc ) ) ;
key_label_dpad_left . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_LEFT ;
strlcpy ( key_label_dpad_right . desc , " Unknown " , sizeof ( key_label_dpad_left . desc ) ) ;
key_label_dpad_right . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_RIGHT ;
strlcpy ( key_label_dpad_up . desc , " Unknown " , sizeof ( key_label_dpad_up . desc ) ) ;
key_label_dpad_up . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_UP ;
strlcpy ( key_label_dpad_down . desc , " Unknown " , sizeof ( key_label_dpad_down . desc ) ) ;
key_label_dpad_down . joykey = 1ULL < < RETRO_DEVICE_ID_JOYPAD_DOWN ;
if ( driver . input - > set_keybinds )
{
driver . input - > set_keybinds ( & key_label_l1 , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_r1 , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_l2 , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_r2 , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_b , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_a , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_y , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_x , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_dpad_left , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
driver . input - > set_keybinds ( & key_label_dpad_right , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
2013-03-15 02:26:34 +01:00
driver . input - > set_keybinds ( & key_label_dpad_up , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
2013-03-14 21:55:10 +01:00
driver . input - > set_keybinds ( & key_label_dpad_down , 0 , 0 , 0 , ( 1ULL < < KEYBINDS_ACTION_GET_BIND_LABEL ) ) ;
}
2013-04-17 23:31:49 +02:00
display_menubar ( rgui - > menu_type ) ;
2012-06-29 14:40:50 +02:00
2013-06-03 01:42:35 +02:00
char viewport_buf [ 256 ] ;
2013-04-29 04:55:49 +02:00
snprintf ( viewport , sizeof ( viewport ) , " Viewport X: #%d Y: %d (%dx%d) " , g_extern . console . screen . viewports . custom_vp . x , g_extern . console . screen . viewports . custom_vp . y , g_extern . console . screen . viewports . custom_vp . width ,
g_extern . console . screen . viewports . custom_vp . height ) ;
2013-06-03 01:42:35 +02:00
menu_ticker_line ( viewport_buf , TICKER_LABEL_CHARS_MAX_PER_LINE , g_extern . frame_count / 15 , viewport , true ) ;
2012-06-28 14:10:05 +02:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = POSITION_Y_BEGIN ;
font_parms . scale = HARDCODE_FONT_SIZE ;
2013-06-03 01:42:35 +02:00
font_parms . color = WHITE ;
2012-06-28 14:10:05 +02:00
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-06-03 01:42:35 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , viewport_buf , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_dpad_left . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 4 ) ;
2013-03-11 20:05:05 +01:00
font_parms . color = WHITE ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 4 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport X-- " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_dpad_right . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 5 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport X++ " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_dpad_up . desc ) ;
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 6 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport Y++ " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_dpad_down . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 7 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport Y-- " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_l1 . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 8 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport W-- " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_r1 . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 9 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport W++ " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_l2 . desc ) ;
2012-06-28 14:10:05 +02:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 10 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport H++ " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_r2 . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 11 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Viewport H-- " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_x . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 12 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Reset To Defaults " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_y . desc ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 13 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " - Show Game " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " [%s] " , key_label_a . desc ) ;
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-27 18:09:47 +02:00
font_parms . y = POSITION_Y_BEGIN + ( POSITION_Y_INCREMENT * 14 ) ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-04-27 18:37:05 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2013-03-11 20:05:05 +01:00
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
2013-04-27 18:37:05 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , " - Go back " , & font_parms ) ;
2012-06-28 14:10:05 +02:00
2013-03-14 21:55:10 +01:00
snprintf ( msg , sizeof ( msg ) , " Press [%s] to reset to defaults. " , key_label_x . desc ) ;
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = COMMENT_POSITION_Y ;
2013-03-11 21:42:02 +01:00
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , msg , & font_parms ) ;
2012-06-28 14:10:05 +02:00
}
2012-12-17 00:32:16 +01:00
2013-01-11 03:58:43 +01:00
return 0 ;
2012-06-28 14:10:05 +02:00
}
2013-09-26 22:34:06 +02:00
static int ingame_menu_history_options ( void * data , uint64_t action )
2013-04-29 05:17:22 +02:00
{
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
size_t history_size = rom_history_size ( rgui - > history ) ;
static unsigned hist_opt_selected = 0 ;
float y_increment = POSITION_Y_START ;
y_increment + = POSITION_Y_INCREMENT ;
font_params_t font_parms = { 0 } ;
font_parms . x = POSITION_X ;
font_parms . y = y_increment ;
font_parms . scale = CURRENT_PATH_FONT_SIZE ;
font_parms . color = WHITE ;
if ( history_size )
{
size_t opts = history_size ;
2013-06-02 22:57:35 +02:00
for ( size_t i = 0 ; i < opts ; i + + )
2013-04-29 05:17:22 +02:00
{
const char * path = NULL ;
const char * core_path = NULL ;
const char * core_name = NULL ;
rom_history_get_index ( rgui - > history , i ,
& path , & core_path , & core_name ) ;
char path_short [ PATH_MAX ] ;
fill_pathname ( path_short , path_basename ( path ) , " " , sizeof ( path_short ) ) ;
char fill_buf [ PATH_MAX ] ;
snprintf ( fill_buf , sizeof ( fill_buf ) , " %s (%s) " ,
path_short , core_name ) ;
/* not on same page? */
if ( ( i / NUM_ENTRY_PER_PAGE ) ! = ( hist_opt_selected / NUM_ENTRY_PER_PAGE ) )
continue ;
2013-06-02 22:57:35 +02:00
2013-04-29 05:17:22 +02:00
# ifdef HAVE_MENU_PANEL
//check if this is the currently selected option
if ( i = = hist_opt_selected )
menu_panel - > y = font_parms . y ;
# endif
font_parms . x = POSITION_X ;
font_parms . color = ( hist_opt_selected = = i ) ? YELLOW : WHITE ;
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data ,
fill_buf , & font_parms ) ;
2013-06-02 22:57:35 +02:00
font_parms . y + = POSITION_Y_INCREMENT ;
2013-04-29 05:17:22 +02:00
}
2013-09-26 22:34:06 +02:00
}
else if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " No history available. " , & font_parms ) ;
2013-04-29 05:17:22 +02:00
2013-09-26 22:34:06 +02:00
display_menubar ( rgui - > menu_type ) ;
switch ( action )
{
case RGUI_ACTION_OK :
case RGUI_ACTION_START :
2013-04-29 05:17:22 +02:00
load_menu_game_history ( hist_opt_selected ) ;
return - 1 ;
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_UP :
2013-04-29 05:17:22 +02:00
if ( hist_opt_selected = = 0 )
hist_opt_selected = history_size - 1 ;
else
hist_opt_selected - - ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_DOWN :
2013-04-29 05:17:22 +02:00
hist_opt_selected + + ;
if ( hist_opt_selected > = history_size )
hist_opt_selected = 0 ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_CANCEL :
menu_stack_pop ( rgui - > menu_type ) ;
break ;
2013-04-29 05:17:22 +02:00
}
return 0 ;
}
2013-09-26 22:34:06 +02:00
static int ingame_menu_core_options ( void * data , uint64_t action )
2013-04-07 08:30:30 +02:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-04-07 19:21:20 +02:00
static unsigned core_opt_selected = 0 ;
2013-04-10 01:34:40 +02:00
float y_increment = POSITION_Y_START ;
2013-04-07 19:21:20 +02:00
2013-04-10 01:34:40 +02:00
y_increment + = POSITION_Y_INCREMENT ;
2013-04-07 08:30:30 +02:00
font_params_t font_parms = { 0 } ;
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
font_parms . y = y_increment ;
font_parms . scale = CURRENT_PATH_FONT_SIZE ;
2013-04-07 08:30:30 +02:00
font_parms . color = WHITE ;
if ( g_extern . system . core_options )
{
2013-04-07 19:21:20 +02:00
size_t opts = core_option_size ( g_extern . system . core_options ) ;
2013-04-10 01:34:40 +02:00
for ( size_t i = 0 ; i < opts ; i + + , font_parms . y + = POSITION_Y_INCREMENT )
2013-04-07 19:21:20 +02:00
{
2013-04-09 08:53:56 +02:00
char type_str [ 256 ] ;
2013-04-14 12:52:39 +02:00
2013-04-09 08:53:56 +02:00
/* not on same page? */
if ( ( i / NUM_ENTRY_PER_PAGE ) ! = ( core_opt_selected / NUM_ENTRY_PER_PAGE ) )
continue ;
2013-04-14 12:52:39 +02:00
# ifdef HAVE_MENU_PANEL
//check if this is the currently selected option
if ( i = = core_opt_selected )
menu_panel - > y = font_parms . y ;
# endif
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X ;
2013-04-07 19:21:20 +02:00
font_parms . color = ( core_opt_selected = = i ) ? YELLOW : WHITE ;
if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data ,
core_option_get_desc ( g_extern . system . core_options , i ) , & font_parms ) ;
2013-04-10 01:34:40 +02:00
font_parms . x = POSITION_X_CENTER ;
2013-04-07 19:21:20 +02:00
font_parms . color = WHITE ;
2013-04-09 08:53:56 +02:00
strlcpy ( type_str , core_option_get_val ( g_extern . system . core_options , i ) , sizeof ( type_str ) ) ;
2013-04-07 19:21:20 +02:00
if ( driver . video_poke - > set_osd_msg )
2013-04-09 08:53:56 +02:00
driver . video_poke - > set_osd_msg ( driver . video_data , type_str , & font_parms ) ;
2013-04-07 19:21:20 +02:00
}
2013-09-26 22:34:06 +02:00
}
else if ( driver . video_poke - > set_osd_msg )
driver . video_poke - > set_osd_msg ( driver . video_data , " No options available. " , & font_parms ) ;
2013-04-09 08:53:56 +02:00
2013-09-26 22:34:06 +02:00
display_menubar ( rgui - > menu_type ) ;
2013-04-09 08:53:56 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
{
case RGUI_ACTION_LEFT :
core_option_prev ( g_extern . system . core_options , core_opt_selected ) ;
break ;
case RGUI_ACTION_RIGHT :
case RGUI_ACTION_OK :
2013-04-09 08:53:56 +02:00
core_option_next ( g_extern . system . core_options , core_opt_selected ) ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_START :
2013-04-09 08:53:56 +02:00
core_option_set_default ( g_extern . system . core_options , core_opt_selected ) ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_UP :
2013-04-09 09:58:26 +02:00
if ( core_opt_selected = = 0 )
core_opt_selected = core_option_size ( g_extern . system . core_options ) - 1 ;
else
core_opt_selected - - ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_DOWN :
2013-04-09 09:58:26 +02:00
core_opt_selected + + ;
2013-04-09 08:53:56 +02:00
2013-04-09 09:58:26 +02:00
if ( core_opt_selected > = core_option_size ( g_extern . system . core_options ) )
core_opt_selected = 0 ;
2013-09-26 22:34:06 +02:00
break ;
case RGUI_ACTION_CANCEL :
menu_stack_pop ( rgui - > menu_type ) ;
break ;
2013-04-09 08:53:56 +02:00
}
2013-04-13 19:13:00 +02:00
2013-04-07 08:30:30 +02:00
return 0 ;
}
2013-09-26 22:34:06 +02:00
static int ingame_menu_screenshot ( void * data , uint64_t action )
2012-06-28 14:10:05 +02:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-04-19 17:53:01 +02:00
rgui - > frame_buf_show = false ;
2012-07-30 16:24:28 +02:00
2013-09-26 22:34:06 +02:00
switch ( action )
2013-05-05 15:20:45 +02:00
{
2013-09-26 22:34:06 +02:00
case RGUI_ACTION_CANCEL :
menu_stack_pop ( rgui - > menu_type ) ;
break ;
# ifdef HAVE_SCREENSHOTS
case RGUI_ACTION_OK :
{
const uint16_t * data = ( const uint16_t * ) g_extern . frame_cache . data ;
unsigned width = g_extern . frame_cache . width ;
unsigned height = g_extern . frame_cache . height ;
int pitch = g_extern . frame_cache . pitch ;
// Negative pitch is needed as screenshot takes bottom-up,
// but we use top-down.
screenshot_dump ( g_settings . screenshot_directory ,
data + ( height - 1 ) * ( pitch > > 1 ) ,
width , height , - pitch , false ) ;
}
break ;
2013-05-05 15:20:45 +02:00
# endif
2013-09-26 22:34:06 +02:00
}
2012-12-17 00:32:16 +01:00
2013-01-11 03:58:43 +01:00
return 0 ;
2012-06-28 14:10:05 +02:00
}
2013-04-19 17:34:46 +02:00
int rgui_input_postprocess ( void * data , uint64_t old_state )
2012-12-17 05:30:28 +01:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-03-18 18:05:15 +01:00
bool quit = false ;
bool resize = false ;
unsigned width ;
unsigned height ;
unsigned frame_count ;
2013-04-17 21:11:13 +02:00
int ret = 0 ;
2013-03-18 18:05:15 +01:00
2013-01-11 03:58:43 +01:00
DEVICE_CAST device_ptr = ( DEVICE_CAST ) driver . video_data ;
2012-12-17 05:30:28 +01:00
2013-04-27 14:52:12 +02:00
if ( ( rgui - > trigger_state & ( 1ULL < < DEVICE_NAV_MENU ) ) & &
2013-04-27 15:07:59 +02:00
g_extern . main_is_init )
2012-12-17 05:30:28 +01:00
{
2013-05-05 15:20:45 +02:00
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
2013-04-27 14:52:12 +02:00
g_extern . lifecycle_mode_state | = ( 1ULL < < MODE_GAME ) ;
ret = - 1 ;
2013-01-11 03:58:43 +01:00
}
frame_count = 0 ;
device_ptr - > ctx_driver - > check_window ( & quit , & resize , & width , & height , frame_count ) ;
if ( quit )
2013-04-17 21:11:13 +02:00
ret = - 1 ;
2013-01-11 03:58:43 +01:00
2013-05-05 15:20:45 +02:00
if ( g_extern . lifecycle_mode_state & ( 1ULL < < MODE_MENU_INGAME_EXIT ) )
2013-04-17 21:11:13 +02:00
{
2013-04-17 23:31:49 +02:00
menu_stack_pop ( rgui - > menu_type ) ;
2013-05-05 15:20:45 +02:00
g_extern . lifecycle_mode_state & = ~ ( 1ULL < < MODE_MENU_INGAME_EXIT ) ;
2013-04-17 21:11:13 +02:00
}
return ret ;
2012-12-17 05:30:28 +01:00
}
2013-09-26 22:34:06 +02:00
static int rgui_iterate ( void * data , unsigned action )
2013-04-16 01:10:20 +02:00
{
2013-09-19 14:49:07 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) data ;
2013-04-17 23:31:49 +02:00
rgui - > menu_type = menu_stack_enum_array [ stack_idx - 1 ] ;
2013-04-19 17:53:01 +02:00
if ( rgui - > need_refresh )
{
menu_stack_push ( INGAME_MENU , false ) ;
rgui - > need_refresh = false ;
}
2013-04-16 01:10:20 +02:00
# ifdef HAVE_OSKUTIL
2013-04-17 23:31:49 +02:00
if ( rgui - > osk_init ! = NULL )
2013-04-16 01:10:20 +02:00
{
2013-04-17 23:31:49 +02:00
if ( rgui - > osk_init ( rgui ) )
rgui - > osk_init = NULL ;
2013-04-16 01:10:20 +02:00
}
2013-04-17 23:31:49 +02:00
if ( rgui - > osk_callback ! = NULL )
2013-04-16 01:10:20 +02:00
{
2013-04-17 23:31:49 +02:00
if ( rgui - > osk_callback ( rgui ) )
rgui - > osk_callback = NULL ;
2013-04-16 01:10:20 +02:00
}
# endif
2013-04-06 17:44:07 +02:00
2013-09-27 02:39:39 +02:00
filebrowser_update ( rgui - > browser , action , rgui - > browser - > current_dir . extensions ) ;
2013-04-17 23:31:49 +02:00
switch ( rgui - > menu_type )
2013-04-16 01:10:20 +02:00
{
2013-05-05 20:10:06 +02:00
case INGAME_MENU_CUSTOM_RATIO :
2013-09-26 22:34:06 +02:00
return ingame_menu_resize ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
case INGAME_MENU_CORE_OPTIONS :
2013-09-26 22:34:06 +02:00
return ingame_menu_core_options ( rgui , action ) ;
2013-04-29 05:17:22 +02:00
case INGAME_MENU_LOAD_GAME_HISTORY :
2013-09-26 22:34:06 +02:00
return ingame_menu_history_options ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
case INGAME_MENU_SCREENSHOT :
2013-09-26 22:34:06 +02:00
return ingame_menu_screenshot ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
case FILE_BROWSER_MENU :
2013-09-26 22:34:06 +02:00
return select_rom ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
case LIBRETRO_CHOICE :
# ifdef HAVE_SHADER_MANAGER
case CGP_CHOICE :
case SHADER_CHOICE :
# endif
case INPUT_PRESET_CHOICE :
case BORDER_CHOICE :
2013-09-26 22:34:06 +02:00
return select_file ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
case PATH_DEFAULT_ROM_DIR_CHOICE :
case PATH_SAVESTATES_DIR_CHOICE :
case PATH_SRAM_DIR_CHOICE :
# ifdef HAVE_XML
case PATH_CHEATS_DIR_CHOICE :
# endif
case PATH_SYSTEM_DIR_CHOICE :
2013-09-26 22:34:06 +02:00
return select_directory ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
case INGAME_MENU :
2013-05-05 04:42:06 +02:00
case INGAME_MENU_SETTINGS :
2013-04-28 15:00:37 +02:00
case INGAME_MENU_VIDEO_OPTIONS :
2013-05-05 21:11:34 +02:00
case INGAME_MENU_SHADER_OPTIONS :
2013-05-05 04:42:06 +02:00
case INGAME_MENU_AUDIO_OPTIONS :
2013-05-05 00:27:26 +02:00
case INGAME_MENU_INPUT_OPTIONS :
2013-05-05 03:41:41 +02:00
case INGAME_MENU_PATH_OPTIONS :
2013-09-26 22:34:06 +02:00
return select_setting ( rgui , action ) ;
2013-04-16 01:10:20 +02:00
}
2013-04-17 23:31:49 +02:00
RARCH_WARN ( " Menu type %d not implemented, exiting... \n " , rgui - > menu_type ) ;
2013-04-16 01:10:20 +02:00
return - 1 ;
}
2013-04-24 16:08:18 +02:00
2013-09-19 15:01:17 +02:00
static void * rgui_init ( void )
2013-03-25 20:19:43 +01:00
{
2013-04-17 23:31:49 +02:00
rgui_handle_t * rgui = ( rgui_handle_t * ) calloc ( 1 , sizeof ( * rgui ) ) ;
2013-04-16 01:10:20 +02:00
2013-04-17 21:11:13 +02:00
menu_texture = ( struct texture_image * ) calloc ( 1 , sizeof ( * menu_texture ) ) ;
# ifdef HAVE_MENU_PANEL
menu_panel = ( struct texture_image * ) calloc ( 1 , sizeof ( * menu_panel ) ) ;
# endif
2013-04-24 16:08:18 +02:00
rgui_init_textures ( ) ;
2013-04-17 21:11:13 +02:00
2013-04-16 01:27:43 +02:00
2013-04-23 01:55:00 +02:00
# ifdef HAVE_OSKUTIL
2013-05-05 16:12:06 +02:00
oskutil_params * osk = & rgui - > oskutil_handle ;
2013-04-23 01:55:00 +02:00
oskutil_init ( osk , 0 ) ;
# endif
2013-04-17 23:31:49 +02:00
return rgui ;
2013-04-16 01:10:20 +02:00
}
2013-09-19 15:01:17 +02:00
static void rgui_free ( void * data )
2013-04-16 01:10:20 +02:00
{
2013-04-17 21:11:13 +02:00
# ifdef _XBOX1
# ifdef HAVE_MENU_PANEL
if ( menu_panel - > vertex_buf )
{
menu_panel - > vertex_buf - > Release ( ) ;
menu_panel - > vertex_buf = NULL ;
}
if ( menu_panel - > pixels )
{
menu_panel - > pixels - > Release ( ) ;
menu_panel - > pixels = NULL ;
}
# endif
if ( menu_texture - > vertex_buf )
{
menu_texture - > vertex_buf - > Release ( ) ;
menu_texture - > vertex_buf = NULL ;
}
if ( menu_texture - > pixels )
{
menu_texture - > pixels - > Release ( ) ;
menu_texture - > pixels = NULL ;
}
# else
# ifdef HAVE_MENU_PANEL
if ( menu_panel )
{
free ( menu_panel - > pixels ) ;
menu_panel - > pixels = NULL ;
}
# endif
if ( menu_texture )
{
free ( menu_texture - > pixels ) ;
menu_texture - > pixels = NULL ;
}
# endif
2013-04-16 01:10:20 +02:00
}
2013-09-19 14:49:07 +02:00
const menu_ctx_driver_t menu_ctx_rmenu = {
rgui_iterate ,
rgui_init ,
rgui_free ,
" rmenu " ,
} ;