2012-05-29 01:27:45 +02:00
/* RetroArch - A frontend for libretro.
* Copyright ( C ) 2010 - 2012 - Hans - Kristian Arntzen
* Copyright ( C ) 2011 - 2012 - Daniel De Matteis
*
* RetroArch is free software : you can redistribute it and / or modify it under the terms
* of the GNU General Public License as published by the Free Software Found -
* ation , either version 3 of the License , or ( at your option ) any later version .
*
* RetroArch is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE . See the GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along with RetroArch .
* If not , see < http : //www.gnu.org/licenses/>.
*/
# include <stdio.h>
# include <stdlib.h>
# include <stddef.h>
# include <string.h>
# include "../general.h"
# include "console_settings.h"
void rarch_settings_change ( unsigned setting )
{
switch ( setting )
{
2012-05-29 18:03:58 +02:00
case S_ASPECT_RATIO_DECREMENT :
if ( g_console . aspect_ratio_index > 0 )
g_console . aspect_ratio_index - - ;
break ;
case S_ASPECT_RATIO_INCREMENT :
2012-05-29 19:00:13 +02:00
if ( g_console . aspect_ratio_index < LAST_ASPECT_RATIO )
2012-05-29 18:03:58 +02:00
g_console . aspect_ratio_index + + ;
break ;
2012-05-29 02:05:23 +02:00
case S_FRAME_ADVANCE :
g_console . frame_advance_enable = true ;
g_console . menu_enable = false ;
g_console . mode_switch = MODE_EMULATION ;
break ;
2012-05-29 01:37:09 +02:00
case S_HW_TEXTURE_FILTER :
g_settings . video . smooth = ! g_settings . video . smooth ;
break ;
case S_HW_TEXTURE_FILTER_2 :
2012-05-29 02:05:23 +02:00
g_settings . video . second_pass_smooth = ! g_settings . video . second_pass_smooth ;
2012-05-29 01:37:09 +02:00
break ;
2012-05-29 01:27:45 +02:00
case S_OVERSCAN_DECREMENT :
g_console . overscan_amount - = 0.01f ;
2012-05-29 02:05:23 +02:00
g_console . overscan_enable = true ;
if ( g_console . overscan_amount = = 0.0f )
2012-05-29 01:27:45 +02:00
g_console . overscan_enable = false ;
break ;
case S_OVERSCAN_INCREMENT :
2012-05-29 02:05:23 +02:00
g_console . overscan_amount + = 0.01f ;
g_console . overscan_enable = true ;
if ( g_console . overscan_amount = = 0.0f )
2012-05-29 01:27:45 +02:00
g_console . overscan_enable = 0 ;
2012-05-29 02:17:35 +02:00
break ;
2012-05-29 04:16:38 +02:00
case S_QUIT :
g_console . menu_enable = false ;
2012-05-29 04:39:54 +02:00
g_console . ingame_menu_enable = false ;
g_console . mode_switch = MODE_EXIT ;
2012-05-29 04:16:38 +02:00
break ;
2012-05-29 02:32:34 +02:00
case S_RETURN_TO_DASHBOARD :
2012-05-29 02:17:35 +02:00
g_console . menu_enable = false ;
g_console . initialize_rarch_enable = false ;
g_console . mode_switch = MODE_EXIT ;
2012-05-29 01:27:45 +02:00
break ;
2012-05-29 02:32:34 +02:00
case S_RETURN_TO_GAME :
2012-05-29 02:05:23 +02:00
g_console . frame_advance_enable = false ;
//g_console.ingame_menu_item = 0;
g_console . menu_enable = false ;
g_console . mode_switch = MODE_EMULATION ;
break ;
2012-05-29 02:48:13 +02:00
case S_RETURN_TO_LAUNCHER :
g_console . return_to_launcher = true ;
2012-05-29 03:49:19 +02:00
g_console . menu_enable = false ;
g_console . mode_switch = MODE_EXIT ;
2012-05-29 02:48:13 +02:00
break ;
2012-05-29 02:33:06 +02:00
case S_RETURN_TO_MENU :
g_console . menu_enable = false ;
g_console . ingame_menu_item = 0 ;
g_console . mode_switch = MODE_MENU ;
break ;
2012-05-29 03:35:59 +02:00
case S_REWIND :
g_settings . rewind_enable = ! g_settings . rewind_enable ;
break ;
2012-05-29 01:27:45 +02:00
case S_ROTATION_DECREMENT :
if ( g_console . screen_orientation > ORIENTATION_NORMAL )
g_console . screen_orientation - - ;
break ;
case S_ROTATION_INCREMENT :
if ( ( g_console . screen_orientation + 1 ) < ORIENTATION_END )
g_console . screen_orientation + + ;
break ;
case S_SAVESTATE_DECREMENT :
2012-05-29 02:05:23 +02:00
if ( g_extern . state_slot ! = 0 )
2012-05-29 01:27:45 +02:00
g_extern . state_slot - - ;
break ;
case S_SAVESTATE_INCREMENT :
2012-05-29 02:05:23 +02:00
g_extern . state_slot + + ;
2012-05-29 01:27:45 +02:00
break ;
case S_SCALE_ENABLED :
2012-05-29 02:05:23 +02:00
g_console . fbo_enabled = ! g_console . fbo_enabled ;
2012-05-29 01:27:45 +02:00
break ;
case S_SCALE_FACTOR_DECREMENT :
2012-05-29 02:05:23 +02:00
g_settings . video . fbo_scale_x - = 1.0f ;
g_settings . video . fbo_scale_y - = 1.0f ;
2012-05-29 01:27:45 +02:00
break ;
case S_SCALE_FACTOR_INCREMENT :
2012-05-29 02:05:23 +02:00
g_settings . video . fbo_scale_x + = 1.0f ;
g_settings . video . fbo_scale_y + = 1.0f ;
2012-05-29 01:27:45 +02:00
break ;
case S_THROTTLE :
2012-05-29 02:05:23 +02:00
g_console . throttle_enable = ! g_console . throttle_enable ;
2012-05-29 01:27:45 +02:00
break ;
case S_TRIPLE_BUFFERING :
2012-05-29 02:05:23 +02:00
g_console . triple_buffering_enable = ! g_console . triple_buffering_enable ;
2012-05-29 01:27:45 +02:00
break ;
}
}
void rarch_settings_default ( unsigned setting )
{
switch ( setting )
{
2012-05-29 18:03:58 +02:00
case S_DEF_ASPECT_RATIO :
g_console . aspect_ratio_index = ASPECT_RATIO_4_3 ;
break ;
2012-05-29 01:37:09 +02:00
case S_DEF_HW_TEXTURE_FILTER :
g_settings . video . smooth = 1 ;
break ;
case S_DEF_HW_TEXTURE_FILTER_2 :
2012-05-29 02:05:23 +02:00
g_settings . video . second_pass_smooth = 1 ;
2012-05-29 01:37:09 +02:00
break ;
2012-05-29 01:27:45 +02:00
case S_DEF_OVERSCAN :
g_console . overscan_amount = 0.0f ;
2012-05-29 02:05:23 +02:00
g_console . overscan_enable = false ;
2012-05-29 01:27:45 +02:00
break ;
case S_DEF_THROTTLE :
2012-05-29 02:05:23 +02:00
g_console . throttle_enable = true ;
2012-05-29 01:27:45 +02:00
break ;
case S_DEF_TRIPLE_BUFFERING :
2012-05-29 02:05:23 +02:00
g_console . triple_buffering_enable = true ;
2012-05-29 01:27:45 +02:00
break ;
case S_DEF_SAVE_STATE :
2012-05-29 02:05:23 +02:00
g_extern . state_slot = 0 ;
2012-05-29 01:27:45 +02:00
break ;
case S_DEF_SCALE_ENABLED :
2012-05-29 02:05:23 +02:00
g_console . fbo_enabled = true ;
g_settings . video . fbo_scale_x = 2.0f ;
g_settings . video . fbo_scale_y = 2.0f ;
2012-05-29 01:27:45 +02:00
break ;
case S_DEF_SCALE_FACTOR :
2012-05-29 02:05:23 +02:00
g_settings . video . fbo_scale_x = 2.0f ;
g_settings . video . fbo_scale_y = 2.0f ;
2012-05-29 01:27:45 +02:00
break ;
}
}
2012-05-29 16:45:37 +02:00
void rarch_settings_msg ( unsigned setting , unsigned delay )
{
char str [ PATH_MAX ] ;
msg_queue_clear ( g_extern . msg_queue ) ;
switch ( setting )
{
case S_MSG_CACHE_PARTITION :
snprintf ( str , sizeof ( str ) , " INFO - All the contents of the ZIP files you have selected in the filebrowser \n are extracted to this partition. " ) ;
break ;
2012-05-29 18:03:58 +02:00
case S_MSG_CHANGE_CONTROLS :
2012-05-29 16:45:37 +02:00
snprintf ( str , sizeof ( str ) , " INFO - Press LEFT/RIGHT to change the controls, and press \n [RetroPad Start] to reset a button to default values. " ) ;
2012-05-29 18:03:58 +02:00
break ;
case S_MSG_EXTRACTED_ZIPFILE :
snprintf ( str , sizeof ( str ) , " INFO - ZIP file successfully extracted to cache partition. " ) ;
2012-05-29 16:45:37 +02:00
break ;
case S_MSG_NOT_IMPLEMENTED :
snprintf ( str , sizeof ( str ) , " TODO - Not yet implemented. " ) ;
break ;
case S_MSG_RESIZE_SCREEN :
snprintf ( str , sizeof ( str ) , " INFO - Resize the screen by moving around the two analog sticks. \n Press [RetroPad X] to reset to default values, and [RetroPad A] to go back. \n To select the resized screen mode, set Aspect Ratio to: 'Custom'. " ) ;
break ;
case S_MSG_RESTART_RARCH :
snprintf ( str , sizeof ( str ) , " INFO - You need to restart RetroArch for this change to take effect. " ) ;
break ;
case S_MSG_SELECT_LIBRETRO_CORE :
snprintf ( str , sizeof ( str ) , " INFO - Select a Libretro core from the menu by pressing [RetroPad B]. " ) ;
break ;
case S_MSG_SELECT_SHADER :
snprintf ( str , sizeof ( str ) , " INFO - Select a shader from the menu by pressing [RetroPad A]. " ) ;
break ;
case S_MSG_SHADER_LOADING_SUCCEEDED :
snprintf ( str , sizeof ( str ) , " INFO - Shader successfully loaded. " ) ;
break ;
}
msg_queue_push ( g_extern . msg_queue , str , 1 , delay ) ;
2012-05-29 19:51:35 +02:00
}
# ifdef _XBOX
void rarch_settings_create_menu_item_label ( wchar_t * strwbuf , unsigned setting , size_t size )
{
char str [ PATH_MAX ] ;
switch ( setting )
{
case S_LBL_ASPECT_RATIO :
snprintf ( str , sizeof ( str ) , " Aspect Ratio: %s " , aspectratio_lut [ g_console . aspect_ratio_index ] . name ) ;
break ;
}
rarch_convert_char_to_wchar ( strwbuf , str , size ) ;
}
# endif