2014-04-14 02:32:54 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - 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 <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <ctype.h>
|
2014-04-26 01:53:40 +02:00
|
|
|
#include "menu_common_backend.h"
|
2014-08-31 18:36:26 +02:00
|
|
|
#include "../menu_entries.h"
|
2014-04-14 02:32:54 +02:00
|
|
|
#include "../menu_navigation.h"
|
2014-04-26 02:40:38 +02:00
|
|
|
#include "../menu_input_line_cb.h"
|
2014-04-14 02:32:54 +02:00
|
|
|
|
|
|
|
#include "../../../gfx/gfx_common.h"
|
2014-08-16 18:27:06 +02:00
|
|
|
#include "../../../gfx/shader_common.h"
|
2014-04-14 02:32:54 +02:00
|
|
|
#include "../../../driver.h"
|
|
|
|
#include "../../../file_ext.h"
|
|
|
|
#include "../../../input/input_common.h"
|
2014-04-26 02:40:38 +02:00
|
|
|
#include "../../../config.def.h"
|
2014-04-14 02:32:54 +02:00
|
|
|
#include "../../../input/keyboard_line.h"
|
|
|
|
|
2014-07-16 21:17:58 +02:00
|
|
|
#include "../../../settings_data.h"
|
|
|
|
|
2014-08-31 23:07:23 +02:00
|
|
|
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
|
|
|
#define HAVE_SHADER_MANAGER
|
|
|
|
#endif
|
|
|
|
|
2014-08-30 02:25:55 +02:00
|
|
|
static void *get_last_setting(const file_list_t *list, int index,
|
|
|
|
rarch_setting_t *settings)
|
|
|
|
{
|
|
|
|
if (settings)
|
|
|
|
return (rarch_setting_t*)setting_data_find_setting(settings,
|
|
|
|
list->list[index].label);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-30 01:56:12 +02:00
|
|
|
static int menu_info_screen_iterate(unsigned action)
|
2014-05-31 05:14:04 +02:00
|
|
|
{
|
2014-07-27 04:30:06 +02:00
|
|
|
char msg[PATH_MAX];
|
2014-08-27 15:13:10 +02:00
|
|
|
rarch_setting_t *current_setting = NULL;
|
2014-07-27 04:30:06 +02:00
|
|
|
rarch_setting_t *setting_data = (rarch_setting_t *)setting_data_get_list();
|
2014-05-31 05:14:04 +02:00
|
|
|
|
2014-07-27 04:30:06 +02:00
|
|
|
if (!driver.menu || !setting_data)
|
2014-05-31 05:14:04 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
|
|
|
|
driver.menu_ctx->render();
|
|
|
|
|
2014-08-30 02:25:55 +02:00
|
|
|
current_setting = (rarch_setting_t*)get_last_setting(
|
2014-08-27 23:44:23 +02:00
|
|
|
driver.menu->selection_buf,
|
|
|
|
driver.menu->selection_ptr,
|
|
|
|
setting_data_get_list());
|
2014-08-16 06:41:07 +02:00
|
|
|
|
|
|
|
if (current_setting)
|
2014-08-27 15:13:10 +02:00
|
|
|
setting_data_get_description(current_setting, msg, sizeof(msg));
|
2014-08-16 06:41:07 +02:00
|
|
|
else
|
|
|
|
{
|
2014-08-30 02:25:55 +02:00
|
|
|
current_setting = (rarch_setting_t*)get_last_setting(
|
2014-08-28 02:17:23 +02:00
|
|
|
driver.menu->selection_buf,
|
|
|
|
driver.menu->selection_ptr,
|
|
|
|
setting_data_get_mainmenu(true));
|
|
|
|
|
|
|
|
if (current_setting)
|
|
|
|
setting_data_get_description(current_setting, msg, sizeof(msg));
|
|
|
|
else
|
2014-08-16 06:41:07 +02:00
|
|
|
{
|
2014-08-28 02:17:23 +02:00
|
|
|
switch (driver.menu->info_selection)
|
|
|
|
{
|
|
|
|
case MENU_SETTINGS_SHADER_PRESET:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Load Shader Preset. \n"
|
|
|
|
" \n"
|
|
|
|
" Load a "
|
2014-06-01 20:43:37 +02:00
|
|
|
#ifdef HAVE_CG
|
2014-08-28 02:17:23 +02:00
|
|
|
"Cg"
|
2014-06-01 20:43:37 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_GLSL
|
|
|
|
#ifdef HAVE_CG
|
2014-08-28 02:17:23 +02:00
|
|
|
"/"
|
2014-06-01 20:43:37 +02:00
|
|
|
#endif
|
2014-08-28 02:17:23 +02:00
|
|
|
"GLSL"
|
2014-06-01 20:43:37 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_HLSL
|
|
|
|
#if defined(HAVE_CG) || defined(HAVE_HLSL)
|
2014-08-28 02:17:23 +02:00
|
|
|
"/"
|
2014-06-01 20:43:37 +02:00
|
|
|
#endif
|
2014-08-28 02:17:23 +02:00
|
|
|
"HLSL"
|
2014-06-01 20:43:37 +02:00
|
|
|
#endif
|
2014-08-28 02:17:23 +02:00
|
|
|
" preset directly. \n"
|
|
|
|
"The menu shader menu is updated accordingly. \n"
|
|
|
|
" \n"
|
|
|
|
"If the CGP uses scaling methods which are not \n"
|
|
|
|
"simple, (i.e. source scaling, same scaling \n"
|
|
|
|
"factor for X/Y), the scaling factor displayed \n"
|
|
|
|
"in the menu might not be correct."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_SHADER_APPLY:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Apply Shader Changes. \n"
|
|
|
|
" \n"
|
|
|
|
"After changing shader settings, use this to \n"
|
|
|
|
"apply changes. \n"
|
|
|
|
" \n"
|
|
|
|
"Changing shader settings is a somewhat \n"
|
|
|
|
"expensive operation so it has to be \n"
|
|
|
|
"done explicitly. \n"
|
|
|
|
" \n"
|
|
|
|
"When you apply shaders, the menu shader \n"
|
|
|
|
"settings are saved to a temporary file (either \n"
|
|
|
|
"menu.cgp or menu.glslp) and loaded. The file \n"
|
|
|
|
"persists after RetroArch exits. The file is \n"
|
|
|
|
"saved to Shader Directory."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_SHADER_PASSES:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Shader Passes. \n"
|
|
|
|
" \n"
|
|
|
|
"RetroArch allows you to mix and match various \n"
|
|
|
|
"shaders with arbitrary shader passes, with \n"
|
|
|
|
"custom hardware filters and scale factors. \n"
|
|
|
|
" \n"
|
|
|
|
"This option specifies the number of shader \n"
|
|
|
|
"passes to use. If you set this to 0, and use \n"
|
|
|
|
"Apply Shader Changes, you use a 'blank' shader. \n"
|
|
|
|
" \n"
|
|
|
|
"The Default Filter option will affect the \n"
|
|
|
|
"stretching filter.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_DEVICE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Input Device. \n"
|
|
|
|
" \n"
|
|
|
|
"Picks which gamepad to use for player N. \n"
|
|
|
|
"The name of the pad is available."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_DEVICE_TYPE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Input Device Type. \n"
|
|
|
|
" \n"
|
|
|
|
"Picks which device type to use. This is \n"
|
|
|
|
"relevant for the libretro core itself."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_LEFT_X_PLUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_LEFT_X_MINUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_LEFT_Y_PLUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_LEFT_Y_MINUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_X_PLUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_X_MINUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_PLUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_MINUS:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Axis for analog stick (DualShock-esque).\n"
|
|
|
|
" \n"
|
|
|
|
"Bound as usual, however, if a real analog \n"
|
|
|
|
"axis is bound, it can be read as a true analog.\n"
|
|
|
|
" \n"
|
|
|
|
"Positive X axis is right. \n"
|
|
|
|
"Positive Y axis is down.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_SHADER_NEXT:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Applies next shader in directory.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_SHADER_PREV:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Applies previous shader in directory.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_LOAD_STATE_KEY:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Loads state.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_SAVE_STATE_KEY:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Saves state.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_STATE_SLOT_PLUS:
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_STATE_SLOT_MINUS:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- State slots.\n"
|
|
|
|
" \n"
|
|
|
|
" With slot set to 0, save state name is *.state \n"
|
|
|
|
" (or whatever defined on commandline).\n"
|
|
|
|
"When slot is != 0, path will be (path)(d), \n"
|
|
|
|
"where (d) is slot number.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_TURBO_ENABLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Turbo enable.\n"
|
|
|
|
" \n"
|
|
|
|
"Holding the turbo while pressing another \n"
|
|
|
|
"button will let the button enter a turbo \n"
|
|
|
|
"mode where the button state is modulated \n"
|
|
|
|
"with a periodic signal. \n"
|
|
|
|
" \n"
|
|
|
|
"The modulation stops when the button \n"
|
|
|
|
"itself (not turbo button) is released.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_FAST_FORWARD_HOLD_KEY:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Hold for fast-forward. Releasing button \n"
|
|
|
|
"disables fast-forward.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_QUIT_KEY:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Key to exit RetroArch cleanly."
|
2014-05-31 05:14:04 +02:00
|
|
|
#if !defined(RARCH_MOBILE) && !defined(RARCH_CONSOLE)
|
2014-08-28 02:17:23 +02:00
|
|
|
"\nKilling it in any hard way (SIGKILL, \n"
|
|
|
|
"etc) will terminate without saving\n"
|
|
|
|
"RAM, etc. On Unix-likes,\n"
|
|
|
|
"SIGINT/SIGTERM allows\n"
|
|
|
|
"a clean deinitialization."
|
2014-05-31 05:14:04 +02:00
|
|
|
#endif
|
2014-08-28 02:17:23 +02:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_REWIND:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Hold button down to rewind.\n"
|
|
|
|
" \n"
|
|
|
|
"Rewind must be enabled.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_MOVIE_RECORD_TOGGLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggle between recording and not.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_PAUSE_TOGGLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggle between paused and non-paused state.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_FRAMEADVANCE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Frame advance when content is paused.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_RESET:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Reset the content.\n");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_CHEAT_INDEX_PLUS:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Increment cheat index.\n");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_CHEAT_INDEX_MINUS:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Decrement cheat index.\n");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_CHEAT_TOGGLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggle cheat index.\n");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_SCREENSHOT:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Take screenshot.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_MUTE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Mute/unmute audio.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_NETPLAY_FLIP:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Netplay flip players.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_SLOWMOTION:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Hold for slowmotion.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_ENABLE_HOTKEY:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Enable other hotkeys.\n"
|
|
|
|
" \n"
|
|
|
|
" If this hotkey is bound to either keyboard, \n"
|
|
|
|
"joybutton or joyaxis, all other hotkeys will \n"
|
|
|
|
"be disabled unless this hotkey is also held \n"
|
|
|
|
"at the same time. \n"
|
|
|
|
" \n"
|
|
|
|
"This is useful for RETRO_KEYBOARD centric \n"
|
|
|
|
"implementations which query a large area of \n"
|
|
|
|
"the keyboard, where it is not desirable that \n"
|
|
|
|
"hotkeys get in the way.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_VOLUME_UP:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Increases audio volume.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_VOLUME_DOWN:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Decreases audio volume.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_OVERLAY_NEXT:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggles to next overlay.\n"
|
|
|
|
" \n"
|
|
|
|
"Wraps around.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_DISK_EJECT_TOGGLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggles eject for disks.\n"
|
|
|
|
" \n"
|
|
|
|
"Used for multiple-disk content.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_DISK_NEXT:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Cycles through disk images. Use after \n"
|
|
|
|
"ejecting. \n"
|
|
|
|
" \n"
|
|
|
|
" Complete by toggling eject again.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_GRAB_MOUSE_TOGGLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggles mouse grab.\n"
|
|
|
|
" \n"
|
|
|
|
"When mouse is grabbed, RetroArch hides the \n"
|
|
|
|
"mouse, and keeps the mouse pointer inside \n"
|
|
|
|
"the window to allow relative mouse input to \n"
|
|
|
|
"work better.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_BEGIN + RARCH_MENU_TOGGLE:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Toggles menu.");
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (0 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (1 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (2 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (3 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (4 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (5 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (6 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (7 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (8 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (9 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (10 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (11 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (12 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (13 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (14 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_FILTER + (15 * 3):
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Hardware filter for this pass. \n"
|
|
|
|
" \n"
|
|
|
|
"If 'Don't Care' is set, 'Default \n"
|
|
|
|
"Filter' will be used."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (0 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (1 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (2 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (3 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (4 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (5 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (6 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (7 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (8 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (9 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (10 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (11 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (12 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (13 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (14 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0 + (15 * 3):
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Path to shader. \n"
|
|
|
|
" \n"
|
|
|
|
"All shaders must be of the same \n"
|
|
|
|
"type (i.e. CG, GLSL or HLSL). \n"
|
|
|
|
" \n"
|
|
|
|
"Set Shader Directory to set where \n"
|
|
|
|
"the browser starts to look for \n"
|
|
|
|
"shaders."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (0 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (1 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (2 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (3 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (4 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (5 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (6 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (7 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (8 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (9 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (10 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (11 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (12 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (13 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (14 * 3):
|
|
|
|
case MENU_SETTINGS_SHADER_0_SCALE + (15 * 3):
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
" -- Scale for this pass. \n"
|
|
|
|
" \n"
|
|
|
|
"The scale factor accumulates, i.e. 2x \n"
|
|
|
|
"for first pass and 2x for second pass \n"
|
|
|
|
"will give you a 4x total scale. \n"
|
|
|
|
" \n"
|
|
|
|
"If there is a scale factor for last \n"
|
|
|
|
"pass, the result is stretched to \n"
|
|
|
|
"screen with the filter specified in \n"
|
|
|
|
"'Default Filter'. \n"
|
|
|
|
" \n"
|
|
|
|
"If 'Don't Care' is set, either 1x \n"
|
|
|
|
"scale or stretch to fullscreen will \n"
|
|
|
|
"be used depending if it's not the last \n"
|
|
|
|
"pass or not."
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
snprintf(msg, sizeof(msg),
|
|
|
|
"-- No info on this item available. --\n");
|
|
|
|
}
|
2014-08-16 06:41:07 +02:00
|
|
|
}
|
2014-05-31 05:14:04 +02:00
|
|
|
}
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx &&
|
|
|
|
driver.menu_ctx->render_messagebox)
|
2014-07-27 04:30:06 +02:00
|
|
|
{
|
|
|
|
if (*msg && msg[0] != '\0')
|
|
|
|
driver.menu_ctx->render_messagebox(msg);
|
|
|
|
}
|
2014-05-31 05:14:04 +02:00
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
if (action == MENU_ACTION_OK)
|
2014-09-01 06:11:06 +02:00
|
|
|
menu_entries_pop();
|
2014-08-27 15:08:21 +02:00
|
|
|
|
2014-05-31 05:14:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-30 20:23:20 +02:00
|
|
|
static int menu_start_screen_iterate(unsigned action)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
char msg[1024];
|
2014-05-30 20:23:20 +02:00
|
|
|
|
2014-05-31 22:20:27 +02:00
|
|
|
if (!driver.menu)
|
2014-05-30 20:23:20 +02:00
|
|
|
return 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
|
2014-05-30 21:51:12 +02:00
|
|
|
driver.menu_ctx->render();
|
2014-04-14 02:32:54 +02:00
|
|
|
|
|
|
|
static const unsigned binds[] = {
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_UP,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_DOWN,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_A,
|
|
|
|
RETRO_DEVICE_ID_JOYPAD_B,
|
2014-05-31 05:14:04 +02:00
|
|
|
RETRO_DEVICE_ID_JOYPAD_SELECT,
|
2014-04-14 02:32:54 +02:00
|
|
|
RARCH_MENU_TOGGLE,
|
|
|
|
RARCH_QUIT_KEY,
|
|
|
|
};
|
2014-05-31 14:36:49 +02:00
|
|
|
char desc[ARRAY_SIZE(binds)][64];
|
2014-04-14 02:32:54 +02:00
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(binds); i++)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
const struct retro_keybind *bind = (const struct retro_keybind*)
|
|
|
|
&g_settings.input.binds[0][binds[i]];
|
|
|
|
const struct retro_keybind *auto_bind = (const struct retro_keybind*)
|
|
|
|
input_get_auto_bind(0, binds[i]);
|
2014-08-14 00:49:28 +02:00
|
|
|
|
|
|
|
input_get_bind_string(desc[i], bind, auto_bind, sizeof(desc[i]));
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(msg, sizeof(msg),
|
2014-06-10 02:44:19 +02:00
|
|
|
"-- Welcome to RetroArch --\n"
|
2014-04-14 02:32:54 +02:00
|
|
|
" \n" // strtok_r doesn't split empty strings.
|
|
|
|
|
2014-06-10 02:44:19 +02:00
|
|
|
"Basic Menu controls:\n"
|
2014-04-14 02:32:54 +02:00
|
|
|
" Scroll (Up): %-20s\n"
|
|
|
|
" Scroll (Down): %-20s\n"
|
|
|
|
" Accept/OK: %-20s\n"
|
|
|
|
" Back: %-20s\n"
|
2014-05-31 05:14:04 +02:00
|
|
|
" Info: %-20s\n"
|
2014-06-10 02:44:19 +02:00
|
|
|
"Enter/Exit Menu: %-20s\n"
|
2014-04-14 02:32:54 +02:00
|
|
|
" Exit RetroArch: %-20s\n"
|
|
|
|
" \n"
|
|
|
|
|
|
|
|
"To run content:\n"
|
|
|
|
"Load a libretro core (Core).\n"
|
|
|
|
"Load a content file (Load Content). \n"
|
|
|
|
" \n"
|
|
|
|
|
|
|
|
"See Path Options to set directories\n"
|
|
|
|
"for faster access to files.\n"
|
|
|
|
" \n"
|
|
|
|
|
|
|
|
"Press Accept/OK to continue.",
|
2014-05-31 05:14:04 +02:00
|
|
|
desc[0], desc[1], desc[2], desc[3], desc[4], desc[5], desc[6]);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render_messagebox)
|
2014-05-30 21:51:12 +02:00
|
|
|
driver.menu_ctx->render_messagebox(msg);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
if (action == MENU_ACTION_OK)
|
2014-09-01 06:11:06 +02:00
|
|
|
menu_entries_pop();
|
2014-08-27 15:08:21 +02:00
|
|
|
|
2014-04-14 02:32:54 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static int menu_common_core_setting_toggle(unsigned setting, unsigned action)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
unsigned index = setting - MENU_SETTINGS_CORE_OPTION_START;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
core_option_prev(g_extern.system.core_options, index);
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
2014-08-31 04:34:51 +02:00
|
|
|
core_option_next(g_extern.system.core_options, index);
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_START:
|
|
|
|
core_option_set_default(g_extern.system.core_options, index);
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2014-05-30 21:10:15 +02:00
|
|
|
|
2014-09-01 02:47:03 +02:00
|
|
|
static void defer_decision_automatic(void)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (driver.menu)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
driver.menu->msg_force = true;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 02:47:03 +02:00
|
|
|
static void defer_decision_manual(void)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (driver.menu)
|
2014-09-01 05:50:20 +02:00
|
|
|
menu_entries_push(driver.menu->menu_stack,
|
2014-08-31 04:34:51 +02:00
|
|
|
g_settings.libretro_directory, "deferred_core_list",
|
2014-09-01 06:01:01 +02:00
|
|
|
MENU_SETTINGS_DEFERRED_CORE, driver.menu->selection_ptr);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
2014-05-30 18:22:49 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static int menu_common_setting_set_perf(unsigned setting, unsigned action,
|
|
|
|
struct retro_perf_counter **counters, unsigned offset)
|
|
|
|
{
|
|
|
|
if (counters[offset] && action == MENU_ACTION_START)
|
2014-05-30 21:51:12 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
counters[offset]->total = 0;
|
|
|
|
counters[offset]->call_cnt = 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
static void menu_common_setting_set_current_boolean(
|
|
|
|
rarch_setting_t *setting, unsigned action)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-09-01 03:38:34 +02:00
|
|
|
if (
|
|
|
|
!strcmp(setting->name, "savestate") ||
|
|
|
|
!strcmp(setting->name, "loadstate"))
|
2014-08-30 15:50:42 +02:00
|
|
|
{
|
2014-09-01 03:38:34 +02:00
|
|
|
if (action == MENU_ACTION_START)
|
|
|
|
g_settings.state_slot = 0;
|
|
|
|
else if (action == MENU_ACTION_LEFT)
|
|
|
|
{
|
|
|
|
// Slot -1 is (auto) slot.
|
|
|
|
if (g_settings.state_slot >= 0)
|
|
|
|
g_settings.state_slot--;
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
g_settings.state_slot++;
|
|
|
|
else if (action == MENU_ACTION_OK)
|
2014-08-31 04:34:51 +02:00
|
|
|
*setting->value.boolean = !(*setting->value.boolean);
|
2014-09-01 03:38:34 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_OK:
|
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
*setting->value.boolean = !(*setting->value.boolean);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
*setting->value.boolean = setting->default_value.boolean;
|
|
|
|
break;
|
|
|
|
}
|
2014-08-30 15:50:42 +02:00
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void menu_common_setting_set_current_path_selection(
|
|
|
|
rarch_setting_t *setting, const char *start_path, unsigned type,
|
|
|
|
unsigned action)
|
|
|
|
{
|
2014-04-14 02:32:54 +02:00
|
|
|
switch (action)
|
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_OK:
|
2014-09-01 05:50:20 +02:00
|
|
|
menu_entries_push(driver.menu->menu_stack,
|
2014-08-31 04:34:51 +02:00
|
|
|
start_path, "path_list", type,
|
2014-09-01 06:01:01 +02:00
|
|
|
driver.menu->selection_ptr);
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_START:
|
|
|
|
*setting->value.string = '\0';
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
static void menu_common_setting_set_current_fraction(
|
|
|
|
rarch_setting_t *setting, unsigned action)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (!strcmp(setting->name, "video_refresh_rate_auto"))
|
|
|
|
{
|
|
|
|
if (action == MENU_ACTION_START)
|
|
|
|
g_extern.measure_data.frame_time_samples_count = 0;
|
|
|
|
else if (action == MENU_ACTION_OK)
|
|
|
|
{
|
|
|
|
double refresh_rate, deviation = 0.0;
|
|
|
|
unsigned sample_points = 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver_monitor_fps_statistics(&refresh_rate,
|
|
|
|
&deviation, &sample_points))
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
driver_set_monitor_refresh_rate(refresh_rate);
|
2014-09-01 16:52:54 +02:00
|
|
|
/* Incase refresh rate update forced non-block video. */
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE);
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!strcmp(setting->name, "fastforward_ratio"))
|
|
|
|
{
|
|
|
|
bool clamp_value = false;
|
|
|
|
if (action == MENU_ACTION_START)
|
|
|
|
*setting->value.fraction = setting->default_value.fraction;
|
|
|
|
else if (action == MENU_ACTION_LEFT)
|
|
|
|
{
|
|
|
|
*setting->value.fraction -= setting->step;
|
2014-09-01 16:52:54 +02:00
|
|
|
|
|
|
|
/* Avoid potential rounding errors when going from 1.1 to 1.0. */
|
|
|
|
if (*setting->value.fraction < 0.95f)
|
2014-08-31 04:34:51 +02:00
|
|
|
*setting->value.fraction = setting->default_value.fraction;
|
2014-04-14 02:32:54 +02:00
|
|
|
else
|
2014-08-31 04:34:51 +02:00
|
|
|
clamp_value = true;
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
{
|
|
|
|
*setting->value.fraction += setting->step;
|
|
|
|
clamp_value = true;
|
|
|
|
}
|
|
|
|
if (clamp_value)
|
2014-09-01 16:52:54 +02:00
|
|
|
g_settings.fastforward_ratio =
|
|
|
|
max(min(*setting->value.fraction, setting->max), 1.0f);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
2014-09-01 16:52:54 +02:00
|
|
|
*setting->value.fraction =
|
|
|
|
*setting->value.fraction - setting->step;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->enforce_minrange)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
if (*setting->value.fraction < setting->min)
|
|
|
|
*setting->value.fraction = setting->min;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
2014-09-01 16:52:54 +02:00
|
|
|
*setting->value.fraction =
|
|
|
|
*setting->value.fraction + setting->step;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->enforce_maxrange)
|
|
|
|
{
|
|
|
|
if (*setting->value.fraction > setting->max)
|
|
|
|
*setting->value.fraction = setting->max;
|
|
|
|
}
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_START:
|
|
|
|
*setting->value.fraction = setting->default_value.fraction;
|
|
|
|
break;
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
static void menu_common_setting_set_current_unsigned_integer(
|
|
|
|
rarch_setting_t *setting, unsigned action)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (!strcmp(setting->name, "netplay_tcp_udp_port"))
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
if (action == MENU_ACTION_OK)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_key_start_line(driver.menu, "TCP/UDP Port: ",
|
|
|
|
setting->name, st_uint_callback);
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (action == MENU_ACTION_START)
|
2014-09-01 16:52:54 +02:00
|
|
|
*setting->value.unsigned_integer =
|
|
|
|
setting->default_value.unsigned_integer;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
if (*setting->value.unsigned_integer != setting->min)
|
2014-09-01 16:52:54 +02:00
|
|
|
*setting->value.unsigned_integer =
|
|
|
|
*setting->value.unsigned_integer - setting->step;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->enforce_minrange)
|
|
|
|
{
|
|
|
|
if (*setting->value.unsigned_integer < setting->min)
|
|
|
|
*setting->value.unsigned_integer = setting->min;
|
|
|
|
}
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
2014-09-01 16:52:54 +02:00
|
|
|
*setting->value.unsigned_integer =
|
|
|
|
*setting->value.unsigned_integer + setting->step;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->enforce_maxrange)
|
|
|
|
{
|
|
|
|
if (*setting->value.unsigned_integer > setting->max)
|
|
|
|
*setting->value.unsigned_integer = setting->max;
|
|
|
|
}
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_START:
|
2014-09-01 16:52:54 +02:00
|
|
|
*setting->value.unsigned_integer =
|
|
|
|
setting->default_value.unsigned_integer;
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
static void menu_common_setting_set_current_string_path(
|
|
|
|
rarch_setting_t *setting, const char *dir, const char *path)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
fill_pathname_join(setting->value.string, dir, path, setting->size);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
void menu_common_setting_set_current_string(
|
|
|
|
rarch_setting_t *setting, const char *str)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
strlcpy(setting->value.string, str, setting->size);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
static void handle_driver(const char *label, char *driver,
|
|
|
|
size_t sizeof_driver, unsigned action)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
2014-08-31 19:06:32 +02:00
|
|
|
find_prev_driver(label, driver, sizeof_driver);
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
2014-08-31 19:06:32 +02:00
|
|
|
find_next_driver(label, driver, sizeof_driver);
|
2014-04-14 02:32:54 +02:00
|
|
|
break;
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static void handle_setting(rarch_setting_t *setting,
|
|
|
|
unsigned id, unsigned action)
|
|
|
|
{
|
|
|
|
if (setting->type == ST_BOOL)
|
|
|
|
menu_common_setting_set_current_boolean(setting, action);
|
|
|
|
else if (setting->type == ST_UINT)
|
|
|
|
menu_common_setting_set_current_unsigned_integer(setting, action);
|
|
|
|
else if (setting->type == ST_FLOAT)
|
|
|
|
menu_common_setting_set_current_fraction(setting, action);
|
|
|
|
else if (setting->type == ST_DIR)
|
|
|
|
{
|
|
|
|
if (action == MENU_ACTION_START)
|
|
|
|
{
|
|
|
|
*setting->value.string = '\0';
|
|
|
|
|
|
|
|
if (setting->change_handler)
|
|
|
|
setting->change_handler(setting);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (setting->type == ST_PATH)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_common_setting_set_current_path_selection(setting,
|
|
|
|
setting->default_value.string, id, action);
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (setting->type == ST_STRING)
|
|
|
|
{
|
2014-08-31 04:42:21 +02:00
|
|
|
if (!strcmp(setting->name, "audio_device"))
|
|
|
|
{
|
|
|
|
if (action == MENU_ACTION_OK)
|
|
|
|
menu_key_start_line(driver.menu, "Audio Device Name / IP: ",
|
|
|
|
"audio_device", st_string_callback);
|
|
|
|
else if (action == MENU_ACTION_START)
|
|
|
|
*setting->value.string = '\0';
|
|
|
|
}
|
2014-08-31 04:47:57 +02:00
|
|
|
else if (!strcmp(setting->name, "netplay_nickname"))
|
|
|
|
{
|
|
|
|
if (action == MENU_ACTION_OK)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_key_start_line(driver.menu, "Username: ",
|
|
|
|
"netplay_nickname", st_string_callback);
|
2014-08-31 04:47:57 +02:00
|
|
|
else if (action == MENU_ACTION_START)
|
|
|
|
*setting->value.string = '\0';
|
|
|
|
}
|
|
|
|
#ifdef HAVE_NETPLAY
|
|
|
|
else if (!strcmp(setting->name, "netplay_ip_address"))
|
|
|
|
{
|
|
|
|
if (action == MENU_ACTION_OK)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_key_start_line(driver.menu, "IP Address: ",
|
|
|
|
"netplay_ip_address", st_string_callback);
|
2014-08-31 04:47:57 +02:00
|
|
|
else if (action == MENU_ACTION_START)
|
|
|
|
*setting->value.string = '\0';
|
|
|
|
}
|
|
|
|
#endif
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!strcmp(setting->name, "video_driver"))
|
2014-08-31 19:06:32 +02:00
|
|
|
handle_driver(setting->name, g_settings.video.driver,
|
2014-08-31 04:34:51 +02:00
|
|
|
sizeof(g_settings.video.driver), action);
|
|
|
|
else if (!strcmp(setting->name, "audio_driver"))
|
2014-08-31 19:06:32 +02:00
|
|
|
handle_driver(setting->name, g_settings.audio.driver,
|
2014-08-31 04:34:51 +02:00
|
|
|
sizeof(g_settings.audio.driver), action);
|
|
|
|
else if (!strcmp(setting->name, "audio_resampler_driver"))
|
|
|
|
{
|
|
|
|
if (action == MENU_ACTION_LEFT)
|
|
|
|
find_prev_resampler_driver();
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
find_next_resampler_driver();
|
|
|
|
}
|
|
|
|
else if (!strcmp(setting->name, "input_driver"))
|
2014-08-31 19:06:32 +02:00
|
|
|
handle_driver(setting->name, g_settings.input.driver,
|
2014-08-31 04:34:51 +02:00
|
|
|
sizeof(g_settings.input.driver), action);
|
|
|
|
else if (!strcmp(setting->name, "camera_driver"))
|
2014-08-31 19:06:32 +02:00
|
|
|
handle_driver(setting->name, g_settings.camera.driver,
|
2014-08-31 04:34:51 +02:00
|
|
|
sizeof(g_settings.camera.driver), action);
|
|
|
|
else if (!strcmp(setting->name, "location_driver"))
|
2014-08-31 19:06:32 +02:00
|
|
|
handle_driver(setting->name, g_settings.location.driver,
|
2014-08-31 04:34:51 +02:00
|
|
|
sizeof(g_settings.location.driver), action);
|
|
|
|
else if (!strcmp(setting->name, "menu_driver"))
|
2014-08-31 19:06:32 +02:00
|
|
|
handle_driver(setting->name, g_settings.menu.driver,
|
2014-08-31 04:34:51 +02:00
|
|
|
sizeof(g_settings.menu.driver), action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-01 18:36:19 +02:00
|
|
|
static int menu_setting_set(unsigned id, unsigned action)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
unsigned port = driver.menu->current_pad;
|
|
|
|
rarch_setting_t *setting = (rarch_setting_t*)get_last_setting(
|
|
|
|
driver.menu->selection_buf, driver.menu->selection_ptr,
|
|
|
|
setting_data_get_list()
|
|
|
|
);
|
|
|
|
|
2014-09-01 18:36:19 +02:00
|
|
|
if (setting)
|
2014-08-31 04:34:51 +02:00
|
|
|
handle_setting(setting, id, action);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setting = (rarch_setting_t*)get_last_setting(
|
|
|
|
driver.menu->selection_buf, driver.menu->selection_ptr,
|
|
|
|
setting_data_get_mainmenu(true)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (setting)
|
|
|
|
handle_setting(setting, id, action);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case MENU_SETTINGS_DISK_INDEX:
|
|
|
|
{
|
|
|
|
int step = 0;
|
|
|
|
|
|
|
|
if (action == MENU_ACTION_RIGHT || action == MENU_ACTION_OK)
|
|
|
|
step = 1;
|
|
|
|
else if (action == MENU_ACTION_LEFT)
|
|
|
|
step = -1;
|
|
|
|
|
|
|
|
if (step)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
const struct retro_disk_control_callback *control =
|
|
|
|
(const struct retro_disk_control_callback*)
|
|
|
|
&g_extern.system.disk_control;
|
2014-08-31 04:34:51 +02:00
|
|
|
unsigned num_disks = control->get_num_images();
|
|
|
|
unsigned current = control->get_image_index();
|
2014-09-01 16:52:54 +02:00
|
|
|
unsigned next_index = (current + num_disks + 1 + step)
|
|
|
|
% (num_disks + 1);
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_disk_control_set_eject(true, false);
|
|
|
|
rarch_disk_control_set_index(next_index);
|
|
|
|
rarch_disk_control_set_eject(false, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// controllers
|
|
|
|
case MENU_SETTINGS_BIND_PLAYER:
|
|
|
|
if (action == MENU_ACTION_START)
|
|
|
|
driver.menu->current_pad = 0;
|
|
|
|
else if (action == MENU_ACTION_LEFT)
|
|
|
|
{
|
|
|
|
if (driver.menu->current_pad != 0)
|
|
|
|
driver.menu->current_pad--;
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
{
|
|
|
|
if (driver.menu->current_pad < MAX_PLAYERS - 1)
|
|
|
|
driver.menu->current_pad++;
|
|
|
|
}
|
|
|
|
if (port != driver.menu->current_pad)
|
|
|
|
driver.menu->need_refresh = true;
|
|
|
|
port = driver.menu->current_pad;
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_DEVICE:
|
|
|
|
{
|
|
|
|
int *p = &g_settings.input.joypad_map[port];
|
|
|
|
if (action == MENU_ACTION_START)
|
|
|
|
*p = port;
|
|
|
|
else if (action == MENU_ACTION_LEFT)
|
|
|
|
(*p)--;
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
(*p)++;
|
|
|
|
|
|
|
|
if (*p < -1)
|
|
|
|
*p = -1;
|
|
|
|
else if (*p >= MAX_PLAYERS)
|
|
|
|
*p = MAX_PLAYERS - 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_ANALOG_MODE:
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
g_settings.input.analog_dpad_mode[port] = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_OK:
|
|
|
|
case MENU_ACTION_RIGHT:
|
2014-09-01 16:52:54 +02:00
|
|
|
g_settings.input.analog_dpad_mode[port] =
|
|
|
|
(g_settings.input.analog_dpad_mode[port] + 1)
|
|
|
|
% ANALOG_DPAD_LAST;
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_LEFT:
|
2014-09-01 16:52:54 +02:00
|
|
|
g_settings.input.analog_dpad_mode[port] =
|
|
|
|
(g_settings.input.analog_dpad_mode
|
|
|
|
[port] + ANALOG_DPAD_LAST - 1) % ANALOG_DPAD_LAST;
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_DEVICE_TYPE:
|
|
|
|
{
|
|
|
|
unsigned current_device, current_index, i, devices[128];
|
|
|
|
const struct retro_controller_info *desc;
|
|
|
|
unsigned types = 0;
|
|
|
|
|
|
|
|
devices[types++] = RETRO_DEVICE_NONE;
|
|
|
|
devices[types++] = RETRO_DEVICE_JOYPAD;
|
2014-09-01 16:52:54 +02:00
|
|
|
|
|
|
|
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
|
|
|
* older core which doesn't use SET_CONTROLLER_INFO. */
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!g_extern.system.num_ports)
|
|
|
|
devices[types++] = RETRO_DEVICE_ANALOG;
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
desc = port < g_extern.system.num_ports ?
|
|
|
|
&g_extern.system.ports[port] : NULL;
|
2014-08-31 04:34:51 +02:00
|
|
|
if (desc)
|
|
|
|
{
|
|
|
|
for (i = 0; i < desc->num_types; i++)
|
|
|
|
{
|
|
|
|
unsigned id = desc->types[i].id;
|
2014-09-01 16:52:54 +02:00
|
|
|
if (types < ARRAY_SIZE(devices) &&
|
|
|
|
id != RETRO_DEVICE_NONE &&
|
|
|
|
id != RETRO_DEVICE_JOYPAD)
|
2014-08-31 04:34:51 +02:00
|
|
|
devices[types++] = id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
current_device = g_settings.input.libretro_device[port];
|
|
|
|
current_index = 0;
|
|
|
|
for (i = 0; i < types; i++)
|
|
|
|
{
|
|
|
|
if (current_device == devices[i])
|
|
|
|
{
|
|
|
|
current_index = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool updated = true;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
current_device = RETRO_DEVICE_JOYPAD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_LEFT:
|
2014-09-01 16:52:54 +02:00
|
|
|
current_device = devices
|
|
|
|
[(current_index + types - 1) % types];
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
2014-09-01 16:52:54 +02:00
|
|
|
current_device = devices
|
|
|
|
[(current_index + 1) % types];
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
updated = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (updated)
|
|
|
|
{
|
|
|
|
g_settings.input.libretro_device[port] = current_device;
|
|
|
|
pretro_set_controller_port_device(port, current_device);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MENU_SETTINGS_CUSTOM_BIND_MODE:
|
2014-09-01 16:52:54 +02:00
|
|
|
if (action == MENU_ACTION_OK || action == MENU_ACTION_LEFT ||
|
|
|
|
action == MENU_ACTION_RIGHT)
|
|
|
|
driver.menu->bind_mode_keyboard =
|
|
|
|
!driver.menu->bind_mode_keyboard;
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_CUSTOM_BIND_ALL:
|
|
|
|
if (action == MENU_ACTION_OK)
|
|
|
|
{
|
|
|
|
driver.menu->binds.target = &g_settings.input.binds[port][0];
|
|
|
|
driver.menu->binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
|
|
|
driver.menu->binds.last = MENU_SETTINGS_BIND_LAST;
|
2014-09-01 16:52:54 +02:00
|
|
|
|
|
|
|
file_list_push(driver.menu->menu_stack, "", "",
|
|
|
|
driver.menu->bind_mode_keyboard ?
|
|
|
|
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD :
|
|
|
|
MENU_SETTINGS_CUSTOM_BIND,
|
|
|
|
driver.menu->selection_ptr);
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu->bind_mode_keyboard)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
driver.menu->binds.timeout_end =
|
|
|
|
rarch_get_time_usec() +
|
|
|
|
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
|
|
|
input_keyboard_wait_keys(driver.menu,
|
|
|
|
menu_custom_bind_keyboard_cb);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
menu_poll_bind_get_rested_axes(&driver.menu->binds);
|
|
|
|
menu_poll_bind_state(&driver.menu->binds);
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
|
|
|
|
if (action == MENU_ACTION_OK)
|
|
|
|
{
|
|
|
|
unsigned i;
|
2014-09-01 16:52:54 +02:00
|
|
|
struct retro_keybind *target = (struct retro_keybind*)
|
|
|
|
&g_settings.input.binds[port][0];
|
|
|
|
const struct retro_keybind *def_binds =
|
|
|
|
port ? retro_keybinds_rest : retro_keybinds_1;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
driver.menu->binds.begin = MENU_SETTINGS_BIND_BEGIN;
|
|
|
|
driver.menu->binds.last = MENU_SETTINGS_BIND_LAST;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
for (i = MENU_SETTINGS_BIND_BEGIN;
|
|
|
|
i <= MENU_SETTINGS_BIND_LAST; i++, target++)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (driver.menu->bind_mode_keyboard)
|
|
|
|
target->key = def_binds[i - MENU_SETTINGS_BIND_BEGIN].key;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
target->joykey = NO_BTN;
|
|
|
|
target->joyaxis = AXIS_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#if defined(GEKKO)
|
|
|
|
case MENU_SETTINGS_VIDEO_RESOLUTION:
|
|
|
|
if (action == MENU_ACTION_LEFT)
|
|
|
|
{
|
|
|
|
if (menu_current_gx_resolution > 0)
|
|
|
|
menu_current_gx_resolution--;
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
{
|
|
|
|
if (menu_current_gx_resolution < GX_RESOLUTIONS_LAST - 1)
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
|
|
|
if ((menu_current_gx_resolution + 1) > GX_RESOLUTIONS_640_480)
|
|
|
|
if (CONF_GetVideo() != CONF_VIDEO_PAL)
|
|
|
|
return 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
#endif
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_current_gx_resolution++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_OK)
|
|
|
|
{
|
|
|
|
if (driver.video_data)
|
2014-09-01 16:52:54 +02:00
|
|
|
gx_set_video_mode(driver.video_data, menu_gx_resolutions
|
|
|
|
[menu_current_gx_resolution][0],
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_gx_resolutions[menu_current_gx_resolution][1]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#elif defined(__CELLOS_LV2__)
|
|
|
|
case MENU_SETTINGS_VIDEO_RESOLUTION:
|
|
|
|
if (action == MENU_ACTION_LEFT)
|
|
|
|
{
|
|
|
|
if (g_extern.console.screen.resolutions.current.idx)
|
|
|
|
{
|
|
|
|
g_extern.console.screen.resolutions.current.idx--;
|
|
|
|
g_extern.console.screen.resolutions.current.id =
|
2014-09-01 16:52:54 +02:00
|
|
|
g_extern.console.screen.resolutions.list
|
|
|
|
[g_extern.console.screen.resolutions.current.idx];
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_RIGHT)
|
|
|
|
{
|
|
|
|
if (g_extern.console.screen.resolutions.current.idx + 1 <
|
|
|
|
g_extern.console.screen.resolutions.count)
|
|
|
|
{
|
|
|
|
g_extern.console.screen.resolutions.current.idx++;
|
|
|
|
g_extern.console.screen.resolutions.current.id =
|
2014-09-01 16:52:54 +02:00
|
|
|
g_extern.console.screen.resolutions.list
|
|
|
|
[g_extern.console.screen.resolutions.current.idx];
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (action == MENU_ACTION_OK)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if (g_extern.console.screen.resolutions.list[
|
|
|
|
g_extern.console.screen.resolutions.current.idx] ==
|
|
|
|
CELL_VIDEO_OUT_RESOLUTION_576)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (g_extern.console.screen.pal_enable)
|
|
|
|
g_extern.console.screen.pal60_enable = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_extern.console.screen.pal_enable = false;
|
|
|
|
g_extern.console.screen.pal60_enable = false;
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_REINIT);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
2014-08-31 23:07:23 +02:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-08-31 23:23:11 +02:00
|
|
|
case MENU_SETTINGS_SHADER_PASSES:
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
struct gfx_shader *shader = (struct gfx_shader*)
|
|
|
|
driver.menu->shader;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
if (shader && shader->passes)
|
|
|
|
shader->passes = 0;
|
|
|
|
driver.menu->need_refresh = true;
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
if (shader && shader->passes)
|
|
|
|
shader->passes--;
|
|
|
|
driver.menu->need_refresh = true;
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
|
|
|
if (shader && (shader->passes < GFX_MAX_SHADERS))
|
|
|
|
shader->passes++;
|
|
|
|
driver.menu->need_refresh = true;
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu->need_refresh)
|
|
|
|
gfx_shader_resolve_parameters(NULL, driver.menu->shader);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_SHADER_APPLY:
|
|
|
|
{
|
|
|
|
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
|
|
|
unsigned type = RARCH_SHADER_NONE;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (!driver.video || !driver.video->set_shader ||
|
|
|
|
action != MENU_ACTION_OK)
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
RARCH_LOG("Applying shader ...\n");
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend &&
|
|
|
|
driver.menu_ctx->backend->shader_manager_get_type)
|
|
|
|
type = driver.menu_ctx->backend->shader_manager_get_type(
|
|
|
|
driver.menu->shader);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (shader->passes && type != RARCH_SHADER_NONE
|
|
|
|
&& driver.menu_ctx && driver.menu_ctx->backend &&
|
|
|
|
driver.menu_ctx->backend->shader_manager_save_preset)
|
|
|
|
driver.menu_ctx->backend->shader_manager_save_preset(NULL, true);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
type = gfx_shader_parse_type("", DEFAULT_SHADER_TYPE);
|
|
|
|
if (type == RARCH_SHADER_NONE)
|
|
|
|
{
|
|
|
|
#if defined(HAVE_GLSL)
|
|
|
|
type = RARCH_SHADER_GLSL;
|
|
|
|
#elif defined(HAVE_CG) || defined(HAVE_HLSL)
|
|
|
|
type = RARCH_SHADER_CG;
|
|
|
|
#endif
|
|
|
|
}
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend &&
|
|
|
|
driver.menu_ctx->backend->shader_manager_set_preset)
|
|
|
|
driver.menu_ctx->backend->shader_manager_set_preset(
|
|
|
|
NULL, type, NULL);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
}
|
2014-08-31 23:23:11 +02:00
|
|
|
break;
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_SETTINGS_SHADER_PRESET_SAVE:
|
|
|
|
if (action == MENU_ACTION_OK)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_key_start_line(driver.menu, "Preset Filename: ",
|
|
|
|
"shader_preset_save", preset_filename_callback);
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
2014-08-31 23:23:11 +02:00
|
|
|
#endif
|
2014-08-31 04:34:51 +02:00
|
|
|
default:
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 23:53:18 +02:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
#include "menu_common_shader_backend.c"
|
|
|
|
#endif
|
|
|
|
|
2014-09-01 18:36:19 +02:00
|
|
|
static int menu_setting_ok_toggle(unsigned type,
|
2014-09-01 18:00:28 +02:00
|
|
|
const char *dir, const char *label,
|
|
|
|
unsigned action)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
2014-09-01 18:50:20 +02:00
|
|
|
if (type >= MENU_SETTINGS_BIND_BEGIN &&
|
|
|
|
type <= MENU_SETTINGS_BIND_ALL_LAST)
|
|
|
|
{
|
|
|
|
struct retro_keybind *bind = (struct retro_keybind*)
|
|
|
|
&g_settings.input.binds[driver.menu->current_pad]
|
|
|
|
[type - MENU_SETTINGS_BIND_BEGIN];
|
|
|
|
|
|
|
|
driver.menu->binds.begin = type;
|
|
|
|
driver.menu->binds.last = type;
|
|
|
|
driver.menu->binds.target = bind;
|
|
|
|
driver.menu->binds.player = driver.menu->current_pad;
|
|
|
|
file_list_push(driver.menu->menu_stack, "", "",
|
|
|
|
driver.menu->bind_mode_keyboard ?
|
|
|
|
MENU_SETTINGS_CUSTOM_BIND_KEYBOARD : MENU_SETTINGS_CUSTOM_BIND,
|
|
|
|
driver.menu->selection_ptr);
|
|
|
|
|
|
|
|
if (driver.menu->bind_mode_keyboard)
|
|
|
|
{
|
|
|
|
driver.menu->binds.timeout_end = rarch_get_time_usec() +
|
|
|
|
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
|
|
|
input_keyboard_wait_keys(driver.menu,
|
|
|
|
menu_custom_bind_keyboard_cb);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
menu_poll_bind_get_rested_axes(&driver.menu->binds);
|
|
|
|
menu_poll_bind_state(&driver.menu->binds);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (
|
2014-09-01 18:36:19 +02:00
|
|
|
!strcmp(label, "load_content") ||
|
|
|
|
!strcmp(label, "detect_core_list")
|
|
|
|
)
|
2014-09-01 18:00:28 +02:00
|
|
|
{
|
|
|
|
driver.menu->defer_core = (!strcmp(label, "detect_core_list"));
|
|
|
|
menu_entries_push(driver.menu->menu_stack,
|
|
|
|
g_settings.menu_content_directory, "", MENU_FILE_DIRECTORY,
|
|
|
|
driver.menu->selection_ptr);
|
2014-09-01 18:36:19 +02:00
|
|
|
return 0;
|
2014-09-01 18:00:28 +02:00
|
|
|
}
|
2014-09-01 18:36:19 +02:00
|
|
|
else if (
|
|
|
|
!strcmp(label, "history_list") ||
|
|
|
|
menu_common_type_is(type) == MENU_FILE_DIRECTORY)
|
|
|
|
{
|
2014-09-01 18:00:28 +02:00
|
|
|
menu_entries_push(driver.menu->menu_stack,
|
|
|
|
"", "", type, driver.menu->selection_ptr);
|
2014-09-01 18:36:19 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (
|
|
|
|
menu_common_type_is(type) == MENU_SETTINGS ||
|
|
|
|
type == MENU_SETTINGS_CORE ||
|
|
|
|
type == MENU_SETTINGS_CONFIG ||
|
|
|
|
type == MENU_SETTINGS_DISK_APPEND
|
|
|
|
)
|
|
|
|
{
|
2014-09-01 18:00:28 +02:00
|
|
|
menu_entries_push(driver.menu->menu_stack,
|
|
|
|
dir ? dir : label, "", type,
|
|
|
|
driver.menu->selection_ptr);
|
2014-09-01 18:36:19 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
2014-09-01 18:00:28 +02:00
|
|
|
{
|
|
|
|
file_list_push(driver.menu->menu_stack, "", "",
|
|
|
|
type, driver.menu->selection_ptr);
|
|
|
|
|
2014-09-01 18:09:53 +02:00
|
|
|
/* Start with something sane. */
|
2014-09-01 18:00:28 +02:00
|
|
|
rarch_viewport_t *custom = (rarch_viewport_t*)
|
|
|
|
&g_extern.console.screen.viewports.custom_vp;
|
|
|
|
|
|
|
|
if (driver.video_data && driver.video &&
|
|
|
|
driver.video->viewport_info)
|
|
|
|
driver.video->viewport_info(driver.video_data, custom);
|
|
|
|
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
|
|
|
(float)custom->width / custom->height;
|
|
|
|
|
|
|
|
g_settings.video.aspect_ratio_idx = ASPECT_RATIO_CUSTOM;
|
|
|
|
|
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO);
|
2014-09-01 18:36:19 +02:00
|
|
|
return 0;
|
2014-09-01 18:00:28 +02:00
|
|
|
}
|
2014-09-01 18:36:19 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-09-01 18:50:20 +02:00
|
|
|
static int menu_setting_start_toggle(unsigned type,
|
|
|
|
const char *dir, const char *label,
|
|
|
|
unsigned action)
|
|
|
|
{
|
|
|
|
if (type >= MENU_SETTINGS_BIND_BEGIN &&
|
|
|
|
type <= MENU_SETTINGS_BIND_ALL_LAST)
|
|
|
|
{
|
|
|
|
struct retro_keybind *bind = (struct retro_keybind*)
|
|
|
|
&g_settings.input.binds[driver.menu->current_pad]
|
|
|
|
[type - MENU_SETTINGS_BIND_BEGIN];
|
|
|
|
|
|
|
|
if (driver.menu->bind_mode_keyboard)
|
|
|
|
{
|
|
|
|
const struct retro_keybind *def_binds = driver.menu->current_pad ?
|
|
|
|
retro_keybinds_rest : retro_keybinds_1;
|
|
|
|
bind->key = def_binds[type - MENU_SETTINGS_BIND_BEGIN].key;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bind->joykey = NO_BTN;
|
|
|
|
bind->joyaxis = AXIS_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-09-01 18:36:19 +02:00
|
|
|
static int menu_setting_toggle(unsigned type,
|
|
|
|
const char *dir, const char *label,
|
|
|
|
unsigned action)
|
|
|
|
{
|
|
|
|
struct retro_perf_counter **counters = NULL;
|
|
|
|
|
|
|
|
if (action == MENU_ACTION_OK &&
|
|
|
|
menu_setting_ok_toggle(type, dir, label, action) == 0)
|
|
|
|
return 0;
|
2014-09-01 18:50:20 +02:00
|
|
|
else if (action == MENU_ACTION_START &&
|
|
|
|
menu_setting_start_toggle(type, dir, label, action) == 0)
|
|
|
|
return 0;
|
2014-09-01 18:00:28 +02:00
|
|
|
else if ((type >= MENU_SETTINGS_SHADER_FILTER) &&
|
|
|
|
(type <= MENU_SETTINGS_SHADER_LAST))
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend
|
|
|
|
&& driver.menu_ctx->backend->shader_manager_setting_toggle)
|
2014-09-01 16:52:54 +02:00
|
|
|
return driver.menu_ctx->backend->shader_manager_setting_toggle(
|
2014-09-01 18:00:28 +02:00
|
|
|
type, action);
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-09-01 18:00:28 +02:00
|
|
|
else if ((type >= MENU_SETTINGS_CORE_OPTION_START))
|
|
|
|
return menu_common_core_setting_toggle(type, action);
|
2014-09-01 18:36:19 +02:00
|
|
|
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN &&
|
|
|
|
type <= MENU_SETTINGS_PERF_COUNTERS_END)
|
|
|
|
{
|
|
|
|
counters = (struct retro_perf_counter**)perf_counters_rarch;
|
|
|
|
return menu_common_setting_set_perf(type, action, counters,
|
|
|
|
type - MENU_SETTINGS_PERF_COUNTERS_BEGIN);
|
|
|
|
}
|
|
|
|
else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN &&
|
|
|
|
type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
|
|
|
|
{
|
|
|
|
counters = (struct retro_perf_counter**)perf_counters_libretro;
|
|
|
|
return menu_common_setting_set_perf(type, action, counters,
|
|
|
|
type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN);
|
|
|
|
}
|
2014-09-01 18:00:28 +02:00
|
|
|
else if (driver.menu_ctx && driver.menu_ctx->backend)
|
2014-09-01 18:36:19 +02:00
|
|
|
return menu_setting_set(type, action);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static int menu_settings_iterate(unsigned action)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
const char *path = NULL;
|
|
|
|
const char *dir = NULL;
|
|
|
|
const char *label = NULL;
|
|
|
|
unsigned type = 0;
|
|
|
|
unsigned menu_type = 0;
|
2014-05-30 19:33:10 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!driver.menu)
|
|
|
|
return 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
driver.menu->frame_buf_pitch = driver.menu->width * 2;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (action != MENU_ACTION_REFRESH)
|
|
|
|
file_list_get_at_offset(driver.menu->selection_buf,
|
2014-09-01 17:30:19 +02:00
|
|
|
driver.menu->selection_ptr, NULL, &label, &type);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!strcmp(label, "core_list"))
|
|
|
|
dir = g_settings.libretro_directory;
|
|
|
|
else if (!strcmp(label, "configurations"))
|
|
|
|
dir = g_settings.menu_config_directory;
|
|
|
|
else if (type == MENU_SETTINGS_DISK_APPEND)
|
|
|
|
dir = g_settings.menu_content_directory;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 17:48:33 +02:00
|
|
|
if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
|
2014-08-31 04:34:51 +02:00
|
|
|
action = MENU_ACTION_NOOP;
|
|
|
|
|
|
|
|
switch (action)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_UP:
|
|
|
|
if (driver.menu->selection_ptr > 0)
|
|
|
|
menu_decrement_navigation(driver.menu);
|
|
|
|
else
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_set_navigation(driver.menu,
|
|
|
|
file_list_get_size(driver.menu->selection_buf) - 1);
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_DOWN:
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((driver.menu->selection_ptr + 1) <
|
|
|
|
file_list_get_size(driver.menu->selection_buf))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_increment_navigation(driver.menu);
|
|
|
|
else
|
|
|
|
menu_clear_navigation(driver.menu);
|
|
|
|
break;
|
2014-08-03 01:29:42 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_CANCEL:
|
2014-09-01 05:03:19 +02:00
|
|
|
menu_entries_pop();
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_SELECT:
|
2014-09-01 18:04:41 +02:00
|
|
|
file_list_get_at_offset(driver.menu->selection_buf,
|
|
|
|
driver.menu->selection_ptr, NULL, NULL,
|
|
|
|
&driver.menu->info_selection);
|
|
|
|
file_list_push(driver.menu->menu_stack, "", "info_screen",
|
|
|
|
0, driver.menu->selection_ptr);
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
{
|
2014-09-01 18:00:28 +02:00
|
|
|
int ret = menu_setting_toggle(type, dir,
|
|
|
|
label, action);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_REFRESH:
|
|
|
|
menu_clear_navigation(driver.menu);
|
|
|
|
driver.menu->need_refresh = true;
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_MESSAGE:
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
file_list_get_last(driver.menu->menu_stack, &path, &label, &menu_type);
|
|
|
|
|
2014-09-01 16:57:09 +02:00
|
|
|
if (driver.menu->need_refresh && (menu_parse_check(label, menu_type) == -1))
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
driver.menu->need_refresh = false;
|
2014-09-01 05:50:20 +02:00
|
|
|
menu_entries_push_list(driver.menu, path, label, menu_type);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->render)
|
|
|
|
driver.menu_ctx->render();
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 18:04:41 +02:00
|
|
|
/* Have to defer it so we let settings refresh. */
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu->push_start_screen)
|
|
|
|
{
|
|
|
|
driver.menu->push_start_screen = false;
|
|
|
|
file_list_push(driver.menu->menu_stack, "", "help", 0, 0);
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
2014-08-03 01:29:42 +02:00
|
|
|
|
2014-04-14 02:32:54 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static int menu_viewport_iterate(unsigned action)
|
2014-05-22 03:12:56 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
int stride_x = 1, stride_y = 1;
|
|
|
|
char msg[64];
|
|
|
|
struct retro_game_geometry *geom = NULL;
|
|
|
|
const char *base_msg = NULL;
|
|
|
|
const char *label = NULL;
|
|
|
|
unsigned menu_type = 0;
|
|
|
|
rarch_viewport_t *custom = (rarch_viewport_t*)
|
|
|
|
&g_extern.console.screen.viewports.custom_vp;
|
2014-05-22 03:12:56 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!driver.menu)
|
|
|
|
return 0;
|
2014-05-22 03:12:56 +02:00
|
|
|
|
2014-09-01 17:30:19 +02:00
|
|
|
file_list_get_last(driver.menu->menu_stack, NULL, &label, &menu_type);
|
2014-08-31 04:34:51 +02:00
|
|
|
|
|
|
|
geom = (struct retro_game_geometry*)&g_extern.system.av_info.geometry;
|
|
|
|
|
|
|
|
if (g_settings.video.scale_integer)
|
2014-07-26 05:58:52 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
stride_x = geom->base_width;
|
|
|
|
stride_y = geom->base_height;
|
2014-07-26 05:58:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_UP:
|
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->y -= stride_y;
|
|
|
|
custom->height += stride_y;
|
|
|
|
}
|
|
|
|
else if (custom->height >= (unsigned)stride_y)
|
|
|
|
custom->height -= stride_y;
|
|
|
|
|
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
|
2014-07-26 05:58:52 +02:00
|
|
|
break;
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_DOWN:
|
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->y += stride_y;
|
|
|
|
if (custom->height >= (unsigned)stride_y)
|
|
|
|
custom->height -= stride_y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
custom->height += stride_y;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
|
2014-08-02 15:16:56 +02:00
|
|
|
break;
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
{
|
|
|
|
custom->x -= stride_x;
|
|
|
|
custom->width += stride_x;
|
|
|
|
}
|
|
|
|
else if (custom->width >= (unsigned)stride_x)
|
|
|
|
custom->width -= stride_x;
|
2014-08-02 15:16:56 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
|
|
|
|
break;
|
2014-08-27 18:07:45 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
2014-08-27 18:07:45 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
custom->x += stride_x;
|
|
|
|
if (custom->width >= (unsigned)stride_x)
|
|
|
|
custom->width -= stride_x;
|
2014-08-27 18:07:45 +02:00
|
|
|
}
|
2014-08-18 12:14:53 +02:00
|
|
|
else
|
2014-08-31 04:34:51 +02:00
|
|
|
custom->width += stride_x;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
|
|
|
|
break;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_CANCEL:
|
2014-09-01 06:11:06 +02:00
|
|
|
menu_entries_pop();
|
2014-09-01 00:37:21 +02:00
|
|
|
if (!strcmp(label, "custom_viewport_2"))
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
|
|
|
file_list_push(driver.menu->menu_stack, "", "",
|
|
|
|
MENU_SETTINGS_CUSTOM_VIEWPORT,
|
|
|
|
driver.menu->selection_ptr);
|
|
|
|
}
|
|
|
|
break;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_OK:
|
2014-09-01 06:11:06 +02:00
|
|
|
menu_entries_pop();
|
2014-08-31 04:34:51 +02:00
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT
|
|
|
|
&& !g_settings.video.scale_integer)
|
|
|
|
{
|
2014-09-01 00:37:21 +02:00
|
|
|
file_list_push(driver.menu->menu_stack, "",
|
|
|
|
"custom_viewport_2", 0, driver.menu->selection_ptr);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_START:
|
|
|
|
if (!g_settings.video.scale_integer)
|
|
|
|
{
|
|
|
|
rarch_viewport_t vp;
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.video_data && driver.video &&
|
|
|
|
driver.video->viewport_info)
|
2014-08-31 04:34:51 +02:00
|
|
|
driver.video->viewport_info(driver.video_data, &vp);
|
|
|
|
|
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
2014-08-18 12:14:53 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
custom->width += custom->x;
|
|
|
|
custom->height += custom->y;
|
|
|
|
custom->x = 0;
|
|
|
|
custom->y = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
custom->width = vp.full_width - custom->x;
|
|
|
|
custom->height = vp.full_height - custom->y;
|
2014-08-18 12:14:53 +02:00
|
|
|
}
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
|
|
|
|
}
|
|
|
|
break;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_MESSAGE:
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
break;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-09-01 17:30:19 +02:00
|
|
|
file_list_get_last(driver.menu->menu_stack, NULL, &label, &menu_type);
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
|
|
|
|
driver.menu_ctx->render();
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (g_settings.video.scale_integer)
|
|
|
|
{
|
|
|
|
custom->x = 0;
|
|
|
|
custom->y = 0;
|
2014-09-01 16:52:54 +02:00
|
|
|
custom->width = ((custom->width + geom->base_width - 1) /
|
|
|
|
geom->base_width) * geom->base_width;
|
|
|
|
custom->height = ((custom->height + geom->base_height - 1) /
|
|
|
|
geom->base_height) * geom->base_height;
|
2014-08-27 15:08:21 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
base_msg = "Set scale";
|
|
|
|
snprintf(msg, sizeof(msg), "%s (%4ux%4u, %u x %u scale)",
|
|
|
|
base_msg,
|
|
|
|
custom->width, custom->height,
|
|
|
|
custom->width / geom->base_width,
|
|
|
|
custom->height / geom->base_height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT)
|
|
|
|
base_msg = "Set Upper-Left Corner";
|
2014-09-01 00:37:21 +02:00
|
|
|
else if (!strcmp(label, "custom_viewport_2"))
|
2014-08-31 04:34:51 +02:00
|
|
|
base_msg = "Set Bottom-Right Corner";
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
snprintf(msg, sizeof(msg), "%s (%d, %d : %4ux%4u)",
|
|
|
|
base_msg, custom->x, custom->y, custom->width, custom->height);
|
|
|
|
}
|
2014-08-01 07:00:32 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx &&
|
|
|
|
driver.menu_ctx->render_messagebox)
|
2014-08-31 04:34:51 +02:00
|
|
|
driver.menu_ctx->render_messagebox(msg);
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!custom->width)
|
|
|
|
custom->width = stride_x;
|
|
|
|
if (!custom->height)
|
|
|
|
custom->height = stride_y;
|
2014-07-26 05:58:52 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
|
|
|
(float)custom->width / custom->height;
|
2014-07-26 06:06:27 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_VIDEO_APPLY_STATE_CHANGES);
|
|
|
|
|
|
|
|
return 0;
|
2014-07-26 06:06:27 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
// This only makes sense for PC so far.
|
|
|
|
// Consoles use set_keybind callbacks instead.
|
|
|
|
static int menu_custom_bind_iterate(void *data, unsigned action)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
char msg[256];
|
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* Have to ignore action here. Only bind that should work here
|
|
|
|
* is Quit RetroArch or something like that. */
|
|
|
|
(void)action;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
|
|
|
|
driver.menu_ctx->render();
|
2014-08-30 16:56:45 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(msg, sizeof(msg), "[%s]\npress joypad\n(RETURN to skip)",
|
|
|
|
input_config_bind_map[
|
|
|
|
menu->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render_messagebox)
|
|
|
|
driver.menu_ctx->render_messagebox(msg);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
struct menu_bind_state binds = menu->binds;
|
|
|
|
menu_poll_bind_state(&binds);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((binds.skip && !menu->binds.skip) ||
|
|
|
|
menu_poll_find_trigger(&menu->binds, &binds))
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
binds.begin++;
|
|
|
|
if (binds.begin <= binds.last)
|
|
|
|
binds.target++;
|
|
|
|
else
|
2014-09-01 06:11:06 +02:00
|
|
|
menu_entries_pop();
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* Avoid new binds triggering things right away. */
|
2014-08-31 04:34:51 +02:00
|
|
|
menu->trigger_state = 0;
|
|
|
|
menu->old_input_state = -1ULL;
|
|
|
|
}
|
|
|
|
menu->binds = binds;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static int menu_custom_bind_iterate_keyboard(void *data, unsigned action)
|
|
|
|
{
|
|
|
|
char msg[256];
|
|
|
|
bool timed_out = false;
|
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* Have to ignore action here. */
|
|
|
|
(void)action;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx &&
|
|
|
|
driver.menu_ctx->render)
|
2014-08-31 04:34:51 +02:00
|
|
|
driver.menu_ctx->render();
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
int64_t current = rarch_get_time_usec();
|
|
|
|
int timeout = (menu->binds.timeout_end - current) / 1000000;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
snprintf(msg, sizeof(msg), "[%s]\npress keyboard\n(timeout %d seconds)",
|
2014-09-01 16:52:54 +02:00
|
|
|
input_config_bind_map[
|
|
|
|
menu->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc, timeout);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render_messagebox)
|
|
|
|
driver.menu_ctx->render_messagebox(msg);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (timeout <= 0)
|
|
|
|
{
|
|
|
|
menu->binds.begin++;
|
2014-09-01 16:52:54 +02:00
|
|
|
menu->binds.target->key = RETROK_UNKNOWN; /* Could be unsafe, but whatever. */
|
2014-08-31 04:34:51 +02:00
|
|
|
menu->binds.target++;
|
2014-09-01 16:52:54 +02:00
|
|
|
menu->binds.timeout_end = rarch_get_time_usec() +
|
|
|
|
MENU_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
|
2014-08-31 04:34:51 +02:00
|
|
|
timed_out = true;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* binds.begin is updated in keyboard_press callback. */
|
2014-08-31 04:34:51 +02:00
|
|
|
if (menu->binds.begin > menu->binds.last)
|
2014-04-14 02:32:54 +02:00
|
|
|
{
|
2014-09-01 06:11:06 +02:00
|
|
|
menu_entries_pop();
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* Avoid new binds triggering things right away. */
|
2014-08-31 04:34:51 +02:00
|
|
|
menu->trigger_state = 0;
|
|
|
|
menu->old_input_state = -1ULL;
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* We won't be getting any key events, so just cancel early. */
|
2014-08-31 04:34:51 +02:00
|
|
|
if (timed_out)
|
|
|
|
input_keyboard_wait_keys_cancel();
|
|
|
|
}
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
2014-04-14 02:32:54 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
static int menu_action_ok(const char *dir, unsigned menu_type)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
const char *label = NULL;
|
|
|
|
const char *path = NULL;
|
|
|
|
unsigned type = 0;
|
|
|
|
rarch_setting_t *setting = NULL;
|
2014-09-01 16:52:54 +02:00
|
|
|
rarch_setting_t *setting_data = (rarch_setting_t *)
|
|
|
|
setting_data_get_list();
|
2014-08-01 09:36:12 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (file_list_get_size(driver.menu->selection_buf) == 0)
|
|
|
|
return 0;
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
file_list_get_at_offset(driver.menu->selection_buf,
|
|
|
|
driver.menu->selection_ptr, &path, &label, &type);
|
2014-08-31 04:34:51 +02:00
|
|
|
|
2014-09-01 16:57:09 +02:00
|
|
|
if (menu_parse_check(label, type) == 0)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
char cat_path[PATH_MAX];
|
|
|
|
fill_pathname_join(cat_path, dir, path, sizeof(cat_path));
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-09-01 05:50:20 +02:00
|
|
|
menu_entries_push(driver.menu->menu_stack,
|
2014-09-01 06:01:01 +02:00
|
|
|
cat_path, "browser_list", type, driver.menu->selection_ptr);
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
else
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 23:07:23 +02:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-08-31 04:34:51 +02:00
|
|
|
if (menu_common_type_is(menu_type) == MENU_SETTINGS_SHADER_OPTIONS)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
if (menu_type == MENU_SETTINGS_SHADER_PRESET)
|
2014-05-24 14:13:04 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
char shader_path[PATH_MAX];
|
|
|
|
fill_pathname_join(shader_path, dir, path, sizeof(shader_path));
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->backend &&
|
|
|
|
driver.menu_ctx->backend->shader_manager_set_preset)
|
|
|
|
driver.menu_ctx->backend->shader_manager_set_preset(
|
|
|
|
driver.menu->shader,
|
|
|
|
gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
|
2014-08-31 04:34:51 +02:00
|
|
|
shader_path);
|
2014-05-24 14:13:04 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
else
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
struct gfx_shader *shader = (struct gfx_shader*)
|
|
|
|
driver.menu->shader;
|
2014-08-31 04:34:51 +02:00
|
|
|
unsigned pass = (menu_type - MENU_SETTINGS_SHADER_0) / 3;
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
fill_pathname_join(shader->pass[pass].source.path,
|
|
|
|
dir, path, sizeof(shader->pass[pass].source.path));
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-09-01 18:04:41 +02:00
|
|
|
/* This will reset any changed parameters. */
|
2014-08-31 04:34:51 +02:00
|
|
|
gfx_shader_resolve_parameters(NULL, driver.menu->shader);
|
|
|
|
}
|
|
|
|
|
2014-09-01 18:04:41 +02:00
|
|
|
/* Pop stack until we hit shader manager again. */
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_SHADER_OPTIONS);
|
|
|
|
}
|
2014-08-31 23:07:23 +02:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (menu_type == MENU_SETTINGS_DEFERRED_CORE)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
strlcpy(g_settings.libretro, path, sizeof(g_settings.libretro));
|
2014-09-01 16:52:54 +02:00
|
|
|
strlcpy(g_extern.fullpath, driver.menu->deferred_path,
|
|
|
|
sizeof(g_extern.fullpath));
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_LOAD_CONTENT);
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
return -1;
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_CORE)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
fill_pathname_join(g_settings.libretro, dir, path,
|
|
|
|
sizeof(g_settings.libretro));
|
2014-08-31 04:34:51 +02:00
|
|
|
rarch_main_command(RARCH_CMD_LOAD_CORE);
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
#if defined(HAVE_DYNAMIC)
|
2014-09-01 16:52:54 +02:00
|
|
|
/* No content needed for this core, load core immediately. */
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu->load_no_content)
|
2014-05-24 14:13:04 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
|
|
|
*g_extern.fullpath = '\0';
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
return -1;
|
2014-05-24 14:13:04 +02:00
|
|
|
}
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
/* Core selection on non-console just updates directory listing.
|
|
|
|
* Will take effect on new content load. */
|
2014-08-31 04:34:51 +02:00
|
|
|
#elif defined(RARCH_CONSOLE)
|
|
|
|
rarch_main_command(RARCH_CMD_RESTART_RETROARCH);
|
|
|
|
return -1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SETTINGS_CONFIG)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
char config[PATH_MAX];
|
|
|
|
fill_pathname_join(config, dir, path, sizeof(config));
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
if (menu_replace_config(config))
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_clear_navigation(driver.menu);
|
|
|
|
return -1;
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SETTINGS_OVERLAY_PRESET)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "input_overlay")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string_path(setting, dir, path);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_OPTIONS);
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
|
|
|
|
{
|
|
|
|
char image[PATH_MAX];
|
|
|
|
fill_pathname_join(image, dir, path, sizeof(image));
|
|
|
|
rarch_disk_control_append_image(image);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
g_extern.lifecycle_state |= 1ULL << MODE_GAME;
|
2014-08-27 15:19:28 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SETTINGS_OPEN_HISTORY)
|
2014-05-24 13:30:30 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
load_menu_content_history(driver.menu->selection_ptr);
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
return -1;
|
2014-05-24 13:30:30 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (menu_type == MENU_CONTENT_HISTORY_PATH)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "game_history_path")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string_path(setting, dir, path);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_BROWSER_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "rgui_browser_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_CONTENT_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "content_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (menu_type == MENU_ASSETS_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "assets_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SCREENSHOT_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "screenshot_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 02:52:56 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SAVEFILE_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "savefile_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_OVERLAY_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "overlay_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SETTINGS_VIDEO_SOFTFILTER)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "video_filter")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string_path(setting, dir, path);
|
|
|
|
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS_VIDEO_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SETTINGS_AUDIO_DSP_FILTER)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "audio_dsp_plugin")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string_path(setting, dir, path);
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS_AUDIO_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SAVESTATE_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "savestate_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_LIBRETRO_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "libretro_dir_path")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_CONFIG_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "rgui_config_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_LIBRETRO_INFO_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "libretro_info_path")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-08-27 18:11:31 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SHADER_DIR_PATH)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "video_shader_dir")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
|
|
|
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
2014-08-31 04:34:51 +02:00
|
|
|
else if (menu_type == MENU_FILTER_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "video_filter_dir")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_DSP_FILTER_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "audio_filter_dir")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_SYSTEM_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "system_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_AUTOCONFIG_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "joypad_autoconfig_dir")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else if (menu_type == MENU_EXTRACTION_DIR_PATH)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
if ((setting = (rarch_setting_t*)setting_data_find_setting(
|
|
|
|
setting_data, "extraction_directory")))
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_common_setting_set_current_string(setting, dir);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_flush_stack_type(MENU_SETTINGS_PATH_OPTIONS);
|
|
|
|
}
|
|
|
|
else
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu->defer_core)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
int ret = menu_defer_core(driver.menu->core_info, dir, path,
|
|
|
|
driver.menu->deferred_path,
|
|
|
|
sizeof(driver.menu->deferred_path));
|
2014-08-31 04:34:51 +02:00
|
|
|
|
|
|
|
if (ret == -1)
|
|
|
|
{
|
|
|
|
rarch_main_command(RARCH_CMD_LOAD_CORE);
|
2014-09-01 02:47:03 +02:00
|
|
|
defer_decision_automatic();
|
2014-08-31 04:34:51 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else if (ret == 0)
|
2014-09-01 02:47:03 +02:00
|
|
|
defer_decision_manual();
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
fill_pathname_join(g_extern.fullpath, dir, path,
|
|
|
|
sizeof(g_extern.fullpath));
|
2014-08-31 04:34:51 +02:00
|
|
|
g_extern.lifecycle_state |= (1ULL << MODE_LOAD_GAME);
|
|
|
|
|
|
|
|
menu_flush_stack_type(MENU_SETTINGS);
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
return -1;
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return 0;
|
2014-04-26 01:53:40 +02:00
|
|
|
}
|
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
static int menu_common_iterate(unsigned action)
|
2014-04-26 01:53:40 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
int ret = 0;
|
|
|
|
unsigned menu_type = 0;
|
2014-09-01 17:30:19 +02:00
|
|
|
const char *path = NULL;
|
2014-08-31 04:34:51 +02:00
|
|
|
const char *menu_label = NULL;
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!driver.menu)
|
2014-05-30 20:23:20 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
RARCH_ERR("Cannot iterate menu, menu handle is not initialized.\n");
|
|
|
|
return 0;
|
2014-05-30 20:23:20 +02:00
|
|
|
}
|
|
|
|
|
2014-09-01 17:30:19 +02:00
|
|
|
file_list_get_last(driver.menu->menu_stack, &path, &menu_label, &menu_type);
|
2014-04-26 01:53:40 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
|
|
|
|
driver.menu_ctx->set_texture(driver.menu);
|
2014-04-26 02:40:38 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
//RARCH_LOG("Menu label: %s\n", menu_label);
|
2014-08-30 05:09:48 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (!strcmp(menu_label, "help"))
|
|
|
|
return menu_start_screen_iterate(action);
|
|
|
|
else if (!strcmp(menu_label, "info_screen"))
|
|
|
|
return menu_info_screen_iterate(action);
|
|
|
|
else if (menu_common_type_is(menu_type) == MENU_SETTINGS)
|
|
|
|
return menu_settings_iterate(action);
|
2014-09-01 16:52:54 +02:00
|
|
|
else if (
|
|
|
|
menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
|
|
|
|
!strcmp(menu_label, "custom_viewport_2")
|
|
|
|
)
|
2014-08-31 04:34:51 +02:00
|
|
|
return menu_viewport_iterate(action);
|
|
|
|
else if (menu_type == MENU_SETTINGS_CUSTOM_BIND)
|
|
|
|
return menu_custom_bind_iterate(driver.menu, action);
|
|
|
|
else if (menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
|
|
|
|
return menu_custom_bind_iterate_keyboard(driver.menu, action);
|
2014-08-27 23:44:23 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
|
|
|
|
action = MENU_ACTION_NOOP;
|
2014-08-27 23:44:23 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
unsigned scroll_speed = (max(driver.menu->scroll_accel, 2) - 2) / 4 + 1;
|
|
|
|
unsigned fast_scroll_speed = 4 + 4 * scroll_speed;
|
2014-08-09 02:34:56 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
switch (action)
|
2014-06-01 19:59:38 +02:00
|
|
|
{
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_UP:
|
|
|
|
if (driver.menu->selection_ptr >= scroll_speed)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_set_navigation(driver.menu,
|
|
|
|
driver.menu->selection_ptr - scroll_speed);
|
2014-08-31 04:34:51 +02:00
|
|
|
else
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_set_navigation(driver.menu,
|
|
|
|
file_list_get_size(driver.menu->selection_buf) - 1);
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
2014-06-01 19:59:38 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_DOWN:
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.menu->selection_ptr + scroll_speed <
|
|
|
|
file_list_get_size(driver.menu->selection_buf))
|
|
|
|
menu_set_navigation(driver.menu,
|
|
|
|
driver.menu->selection_ptr + scroll_speed);
|
2014-08-31 04:34:51 +02:00
|
|
|
else
|
|
|
|
menu_clear_navigation(driver.menu);
|
|
|
|
break;
|
2014-08-14 00:49:28 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
if (driver.menu->selection_ptr > fast_scroll_speed)
|
2014-09-01 16:52:54 +02:00
|
|
|
menu_set_navigation(driver.menu,
|
|
|
|
driver.menu->selection_ptr - fast_scroll_speed);
|
2014-08-14 00:49:28 +02:00
|
|
|
else
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_clear_navigation(driver.menu);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_RIGHT:
|
2014-09-01 16:52:54 +02:00
|
|
|
if (driver.menu->selection_ptr + fast_scroll_speed <
|
|
|
|
file_list_get_size(driver.menu->selection_buf))
|
|
|
|
menu_set_navigation(driver.menu,
|
|
|
|
driver.menu->selection_ptr + fast_scroll_speed);
|
2014-08-14 00:49:28 +02:00
|
|
|
else
|
2014-08-31 04:34:51 +02:00
|
|
|
menu_set_navigation_last(driver.menu);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_SCROLL_UP:
|
|
|
|
menu_descend_alphabet(driver.menu, &driver.menu->selection_ptr);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_SCROLL_DOWN:
|
|
|
|
menu_ascend_alphabet(driver.menu, &driver.menu->selection_ptr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_CANCEL:
|
2014-09-01 05:03:19 +02:00
|
|
|
menu_entries_pop();
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_OK:
|
2014-09-01 17:30:19 +02:00
|
|
|
ret = menu_action_ok(path, menu_type);
|
2014-08-31 04:34:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_REFRESH:
|
|
|
|
menu_clear_navigation(driver.menu);
|
|
|
|
driver.menu->need_refresh = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MENU_ACTION_MESSAGE:
|
|
|
|
driver.menu->msg_force = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2014-06-01 19:59:38 +02:00
|
|
|
}
|
2014-08-09 03:00:52 +02:00
|
|
|
|
2014-08-31 22:49:07 +02:00
|
|
|
if (driver.menu->need_refresh)
|
2014-08-31 04:34:51 +02:00
|
|
|
{
|
2014-08-31 22:41:25 +02:00
|
|
|
if (menu_parse_and_resolve() == 0)
|
|
|
|
driver.menu->need_refresh = false;
|
2014-08-31 04:34:51 +02:00
|
|
|
}
|
2014-08-27 23:44:23 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->iterate)
|
|
|
|
driver.menu_ctx->iterate(driver.menu, action);
|
2014-08-27 23:44:23 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
|
|
|
|
driver.menu_ctx->render();
|
2014-08-27 23:44:23 +02:00
|
|
|
|
2014-08-31 04:34:51 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2014-08-09 03:00:52 +02:00
|
|
|
|
2014-08-31 04:27:23 +02:00
|
|
|
#ifdef GEKKO
|
|
|
|
static unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = {
|
|
|
|
{ 512, 192 },
|
|
|
|
{ 598, 200 },
|
|
|
|
{ 640, 200 },
|
|
|
|
{ 384, 224 },
|
|
|
|
{ 448, 224 },
|
|
|
|
{ 480, 224 },
|
|
|
|
{ 512, 224 },
|
|
|
|
{ 576, 224 },
|
|
|
|
{ 608, 224 },
|
|
|
|
{ 640, 224 },
|
|
|
|
{ 340, 232 },
|
|
|
|
{ 512, 232 },
|
|
|
|
{ 512, 236 },
|
|
|
|
{ 336, 240 },
|
|
|
|
{ 352, 240 },
|
|
|
|
{ 384, 240 },
|
|
|
|
{ 512, 240 },
|
|
|
|
{ 530, 240 },
|
|
|
|
{ 640, 240 },
|
|
|
|
{ 512, 384 },
|
|
|
|
{ 598, 400 },
|
|
|
|
{ 640, 400 },
|
|
|
|
{ 384, 448 },
|
|
|
|
{ 448, 448 },
|
|
|
|
{ 480, 448 },
|
|
|
|
{ 512, 448 },
|
|
|
|
{ 576, 448 },
|
|
|
|
{ 608, 448 },
|
|
|
|
{ 640, 448 },
|
|
|
|
{ 340, 464 },
|
|
|
|
{ 512, 464 },
|
|
|
|
{ 512, 472 },
|
|
|
|
{ 352, 480 },
|
|
|
|
{ 384, 480 },
|
|
|
|
{ 512, 480 },
|
|
|
|
{ 530, 480 },
|
|
|
|
{ 608, 480 },
|
|
|
|
{ 640, 480 },
|
|
|
|
};
|
|
|
|
|
|
|
|
static unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480;
|
|
|
|
#endif
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
static void menu_common_setting_set_label_perf(char *type_str,
|
|
|
|
size_t type_str_size, unsigned *w, unsigned type,
|
2014-06-01 23:54:26 +02:00
|
|
|
const struct retro_perf_counter **counters, unsigned offset)
|
2014-04-26 02:40:38 +02:00
|
|
|
{
|
2014-06-01 23:54:26 +02:00
|
|
|
if (counters[offset] && counters[offset]->call_cnt)
|
2014-04-26 02:40:38 +02:00
|
|
|
{
|
2014-06-01 23:54:26 +02:00
|
|
|
snprintf(type_str, type_str_size,
|
2014-06-01 22:06:52 +02:00
|
|
|
#ifdef _WIN32
|
2014-06-01 23:54:26 +02:00
|
|
|
"%I64u ticks, %I64u runs.",
|
2014-06-01 22:06:52 +02:00
|
|
|
#else
|
2014-06-01 23:54:26 +02:00
|
|
|
"%llu ticks, %llu runs.",
|
2014-06-01 22:06:52 +02:00
|
|
|
#endif
|
2014-09-01 16:52:54 +02:00
|
|
|
((unsigned long long)counters[offset]->total /
|
|
|
|
(unsigned long long)counters[offset]->call_cnt),
|
2014-06-01 23:54:26 +02:00
|
|
|
(unsigned long long)counters[offset]->call_cnt);
|
2014-06-01 19:55:53 +02:00
|
|
|
}
|
2014-06-01 23:54:26 +02:00
|
|
|
else
|
2014-06-01 19:55:53 +02:00
|
|
|
{
|
2014-06-01 23:54:26 +02:00
|
|
|
*type_str = '\0';
|
|
|
|
*w = 0;
|
2014-06-01 19:55:53 +02:00
|
|
|
}
|
2014-06-01 23:54:26 +02:00
|
|
|
}
|
|
|
|
|
2014-08-25 15:17:24 +02:00
|
|
|
static void menu_common_setting_set_label_st_bool(rarch_setting_t *setting,
|
|
|
|
char *type_str, size_t type_str_size)
|
|
|
|
{
|
2014-09-01 18:09:53 +02:00
|
|
|
if (!strcmp(setting->name, "savestate") ||
|
|
|
|
!strcmp(setting->name, "loadstate"))
|
|
|
|
{
|
|
|
|
if (g_settings.state_slot < 0)
|
|
|
|
strlcpy(type_str, "-1 (auto)", type_str_size);
|
|
|
|
else
|
|
|
|
snprintf(type_str, type_str_size, "%d", g_settings.state_slot);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strlcpy(type_str, *setting->value.boolean ? setting->boolean.on_label :
|
|
|
|
setting->boolean.off_label, type_str_size);
|
2014-08-25 15:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void menu_common_setting_set_label_st_float(rarch_setting_t *setting,
|
|
|
|
char *type_str, size_t type_str_size)
|
|
|
|
{
|
|
|
|
if (setting && !strcmp(setting->name, "video_refresh_rate_auto"))
|
|
|
|
{
|
|
|
|
double refresh_rate = 0.0;
|
|
|
|
double deviation = 0.0;
|
|
|
|
unsigned sample_points = 0;
|
|
|
|
|
|
|
|
if (driver_monitor_fps_statistics(&refresh_rate, &deviation, &sample_points))
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size, "%.3f Hz (%.1f%% dev, %u samples)",
|
|
|
|
refresh_rate, 100.0 * deviation, sample_points);
|
2014-08-25 15:17:24 +02:00
|
|
|
else
|
|
|
|
strlcpy(type_str, "N/A", type_str_size);
|
|
|
|
}
|
|
|
|
else
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size, setting->rounding_fraction,
|
|
|
|
*setting->value.fraction);
|
2014-08-25 15:17:24 +02:00
|
|
|
}
|
|
|
|
|
2014-08-24 18:33:03 +02:00
|
|
|
static void menu_common_setting_set_label_st_uint(rarch_setting_t *setting,
|
|
|
|
char *type_str, size_t type_str_size)
|
|
|
|
{
|
2014-08-25 15:17:24 +02:00
|
|
|
if (setting && !strcmp(setting->name, "video_monitor_index"))
|
|
|
|
{
|
|
|
|
if (*setting->value.unsigned_integer)
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size, "%d",
|
|
|
|
*setting->value.unsigned_integer);
|
2014-08-25 15:17:24 +02:00
|
|
|
else
|
|
|
|
strlcpy(type_str, "0 (Auto)", type_str_size);
|
|
|
|
}
|
|
|
|
else if (setting && !strcmp(setting->name, "video_rotation"))
|
2014-08-24 18:33:03 +02:00
|
|
|
strlcpy(type_str, rotation_lut[*setting->value.unsigned_integer],
|
|
|
|
type_str_size);
|
|
|
|
else if (setting && !strcmp(setting->name, "aspect_ratio_index"))
|
2014-09-01 16:52:54 +02:00
|
|
|
strlcpy(type_str,
|
|
|
|
aspectratio_lut[*setting->value.unsigned_integer].name,
|
|
|
|
type_str_size);
|
2014-08-24 19:11:17 +02:00
|
|
|
else if (setting && !strcmp(setting->name, "autosave_interval"))
|
|
|
|
{
|
|
|
|
if (*setting->value.unsigned_integer)
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size, "%u seconds",
|
|
|
|
*setting->value.unsigned_integer);
|
2014-08-24 19:11:17 +02:00
|
|
|
else
|
|
|
|
strlcpy(type_str, "OFF", type_str_size);
|
|
|
|
}
|
2014-08-25 15:06:41 +02:00
|
|
|
else if (setting && !strcmp(setting->name, "user_language"))
|
|
|
|
{
|
|
|
|
static const char *modes[] = {
|
|
|
|
"English",
|
|
|
|
"Japanese",
|
|
|
|
"French",
|
|
|
|
"Spanish",
|
|
|
|
"German",
|
|
|
|
"Italian",
|
|
|
|
"Dutch",
|
|
|
|
"Portuguese",
|
|
|
|
"Russian",
|
|
|
|
"Korean",
|
|
|
|
"Chinese (Traditional)",
|
|
|
|
"Chinese (Simplified)"
|
|
|
|
};
|
|
|
|
|
|
|
|
strlcpy(type_str, modes[g_settings.user_language], type_str_size);
|
|
|
|
}
|
2014-08-24 18:33:03 +02:00
|
|
|
else if (setting && !strcmp(setting->name, "libretro_log_level"))
|
|
|
|
{
|
2014-08-27 16:04:29 +02:00
|
|
|
static const char *modes[] = {
|
|
|
|
"0 (Debug)",
|
|
|
|
"1 (Info)",
|
|
|
|
"2 (Warning)",
|
|
|
|
"3 (Error)"
|
|
|
|
};
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
strlcpy(type_str, modes[*setting->value.unsigned_integer],
|
|
|
|
type_str_size);
|
2014-08-24 18:33:03 +02:00
|
|
|
}
|
|
|
|
else
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size, "%d",
|
|
|
|
*setting->value.unsigned_integer);
|
2014-08-24 18:33:03 +02:00
|
|
|
}
|
|
|
|
|
2014-08-27 23:44:23 +02:00
|
|
|
static void handle_setting_label(char *type_str,
|
|
|
|
size_t type_str_size, rarch_setting_t *setting)
|
|
|
|
{
|
|
|
|
if (setting->type == ST_BOOL)
|
|
|
|
menu_common_setting_set_label_st_bool(setting, type_str, type_str_size);
|
|
|
|
else if (setting->type == ST_UINT)
|
|
|
|
menu_common_setting_set_label_st_uint(setting, type_str, type_str_size);
|
|
|
|
else if (setting->type == ST_FLOAT)
|
|
|
|
menu_common_setting_set_label_st_float(setting, type_str, type_str_size);
|
|
|
|
else if (setting->type == ST_DIR)
|
2014-09-01 16:52:54 +02:00
|
|
|
strlcpy(type_str,
|
|
|
|
*setting->value.string ?
|
|
|
|
setting->value.string : setting->dir.empty_path,
|
|
|
|
type_str_size);
|
2014-08-27 23:44:23 +02:00
|
|
|
else if (setting->type == ST_PATH)
|
|
|
|
strlcpy(type_str, path_basename(setting->value.string), type_str_size);
|
|
|
|
else if (setting->type == ST_STRING)
|
|
|
|
strlcpy(type_str, setting->value.string, type_str_size);
|
|
|
|
else if (setting->type == ST_GROUP)
|
|
|
|
strlcpy(type_str, "...", type_str_size);
|
|
|
|
}
|
|
|
|
|
2014-08-20 18:00:06 +02:00
|
|
|
static void menu_common_setting_set_label(char *type_str,
|
|
|
|
size_t type_str_size, unsigned *w, unsigned type, unsigned index)
|
2014-06-01 23:54:26 +02:00
|
|
|
{
|
2014-08-20 18:00:06 +02:00
|
|
|
rarch_setting_t *setting_data = (rarch_setting_t*)setting_data_get_list();
|
|
|
|
rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
|
|
|
driver.menu->selection_buf->list[index].label);
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN
|
|
|
|
&& type <= MENU_SETTINGS_PERF_COUNTERS_END)
|
|
|
|
menu_common_setting_set_label_perf(type_str, type_str_size, w, type,
|
|
|
|
perf_counters_rarch,
|
2014-06-10 01:42:26 +02:00
|
|
|
type - MENU_SETTINGS_PERF_COUNTERS_BEGIN);
|
2014-09-01 16:52:54 +02:00
|
|
|
else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN
|
|
|
|
&& type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
|
|
|
|
menu_common_setting_set_label_perf(type_str, type_str_size, w, type,
|
|
|
|
perf_counters_libretro,
|
2014-06-10 01:42:26 +02:00
|
|
|
type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN);
|
2014-09-01 16:52:54 +02:00
|
|
|
else if (type >= MENU_SETTINGS_BIND_BEGIN &&
|
|
|
|
type <= MENU_SETTINGS_BIND_ALL_LAST)
|
2014-06-09 19:23:06 +02:00
|
|
|
{
|
2014-08-03 01:29:42 +02:00
|
|
|
const struct retro_keybind *auto_bind =
|
2014-09-01 16:52:54 +02:00
|
|
|
(const struct retro_keybind*)input_get_auto_bind(
|
|
|
|
driver.menu->current_pad,
|
2014-08-03 01:29:42 +02:00
|
|
|
type - MENU_SETTINGS_BIND_BEGIN);
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
input_get_bind_string(type_str,
|
|
|
|
&g_settings.input.binds[driver.menu->current_pad]
|
|
|
|
[type - MENU_SETTINGS_BIND_BEGIN], auto_bind, type_str_size);
|
2014-06-09 19:23:06 +02:00
|
|
|
}
|
2014-08-27 23:44:23 +02:00
|
|
|
else if (setting)
|
|
|
|
handle_setting_label(type_str, type_str_size, setting);
|
2014-06-01 19:55:53 +02:00
|
|
|
else
|
|
|
|
{
|
2014-08-27 23:44:23 +02:00
|
|
|
setting_data = (rarch_setting_t*)setting_data_get_mainmenu(true);
|
|
|
|
|
|
|
|
setting = (rarch_setting_t*)setting_data_find_setting(setting_data,
|
|
|
|
driver.menu->selection_buf->list[index].label);
|
|
|
|
|
|
|
|
if (setting)
|
2014-08-20 18:38:50 +02:00
|
|
|
{
|
2014-08-27 23:44:23 +02:00
|
|
|
if (type == MENU_SETTINGS_CONFIG)
|
|
|
|
{
|
|
|
|
if (*g_extern.config_path)
|
|
|
|
fill_pathname_base(type_str, g_extern.config_path,
|
|
|
|
type_str_size);
|
2014-08-25 15:17:24 +02:00
|
|
|
else
|
2014-08-27 23:44:23 +02:00
|
|
|
strlcpy(type_str, "<default>", type_str_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
handle_setting_label(type_str, type_str_size, setting);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
#if defined(GEKKO)
|
|
|
|
case MENU_SETTINGS_VIDEO_RESOLUTION:
|
|
|
|
strlcpy(type_str, gx_get_video_mode(), type_str_size);
|
|
|
|
break;
|
|
|
|
#elif defined(__CELLOS_LV2__)
|
|
|
|
case MENU_SETTINGS_VIDEO_RESOLUTION:
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
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]);
|
2014-08-27 23:44:23 +02:00
|
|
|
snprintf(type_str, type_str_size, "%dx%d", width, height);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case MENU_FILE_PLAIN:
|
|
|
|
strlcpy(type_str, "(FILE)", type_str_size);
|
|
|
|
*w = 6;
|
|
|
|
break;
|
|
|
|
case MENU_FILE_DIRECTORY:
|
|
|
|
strlcpy(type_str, "(DIR)", type_str_size);
|
|
|
|
*w = 5;
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_DISK_INDEX:
|
2014-06-01 19:55:53 +02:00
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
const struct retro_disk_control_callback *control =
|
|
|
|
(const struct retro_disk_control_callback*)
|
|
|
|
&g_extern.system.disk_control;
|
2014-08-27 23:44:23 +02:00
|
|
|
unsigned images = control->get_num_images();
|
|
|
|
unsigned current = control->get_image_index();
|
|
|
|
if (current >= images)
|
|
|
|
strlcpy(type_str, "No Disk", type_str_size);
|
2014-06-01 19:55:53 +02:00
|
|
|
else
|
2014-08-27 23:44:23 +02:00
|
|
|
snprintf(type_str, type_str_size, "%u", current + 1);
|
|
|
|
break;
|
2014-04-26 15:57:53 +02:00
|
|
|
}
|
2014-08-27 23:44:23 +02:00
|
|
|
case MENU_SETTINGS_CUSTOM_VIEWPORT:
|
|
|
|
case MENU_SETTINGS_DISK_OPTIONS:
|
|
|
|
case MENU_SETTINGS_SHADER_PRESET:
|
|
|
|
case MENU_SETTINGS_SHADER_PRESET_SAVE:
|
|
|
|
case MENU_SETTINGS_DISK_APPEND:
|
|
|
|
case MENU_SETTINGS_PERFORMANCE_COUNTERS_FRONTEND:
|
|
|
|
case MENU_SETTINGS_PERFORMANCE_COUNTERS_LIBRETRO:
|
|
|
|
case MENU_SETTINGS_CUSTOM_BIND_ALL:
|
|
|
|
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
|
|
|
|
strlcpy(type_str, "...", type_str_size);
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_PLAYER:
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size, "#%d",
|
|
|
|
driver.menu->current_pad + 1);
|
2014-08-27 23:44:23 +02:00
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_DEVICE:
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
int map = g_settings.input.joypad_map
|
|
|
|
[driver.menu->current_pad];
|
2014-08-27 23:44:23 +02:00
|
|
|
if (map >= 0 && map < MAX_PLAYERS)
|
|
|
|
{
|
2014-09-01 16:52:54 +02:00
|
|
|
const char *device_name =
|
|
|
|
g_settings.input.device_names[map];
|
2014-08-25 15:17:24 +02:00
|
|
|
|
2014-08-27 23:44:23 +02:00
|
|
|
if (*device_name)
|
|
|
|
strlcpy(type_str, device_name, type_str_size);
|
|
|
|
else
|
2014-09-01 16:52:54 +02:00
|
|
|
snprintf(type_str, type_str_size,
|
|
|
|
"N/A (port #%u)", map);
|
2014-08-27 23:44:23 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
strlcpy(type_str, "Disabled", type_str_size);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_ANALOG_MODE:
|
2014-06-01 19:55:53 +02:00
|
|
|
{
|
2014-08-27 23:44:23 +02:00
|
|
|
static const char *modes[] = {
|
|
|
|
"None",
|
|
|
|
"Left Analog",
|
|
|
|
"Right Analog",
|
|
|
|
"Dual Analog",
|
|
|
|
};
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
strlcpy(type_str, modes[g_settings.input.analog_dpad_mode
|
|
|
|
[driver.menu->current_pad] % ANALOG_DPAD_LAST],
|
|
|
|
type_str_size);
|
2014-08-27 23:44:23 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_BIND_DEVICE_TYPE:
|
|
|
|
{
|
|
|
|
const struct retro_controller_description *desc = NULL;
|
|
|
|
if (driver.menu->current_pad < g_extern.system.num_ports)
|
2014-09-01 16:52:54 +02:00
|
|
|
desc = libretro_find_controller_description(
|
|
|
|
&g_extern.system.ports[driver.menu->current_pad],
|
|
|
|
g_settings.input.libretro_device
|
|
|
|
[driver.menu->current_pad]);
|
2014-06-01 19:55:53 +02:00
|
|
|
|
2014-08-27 23:44:23 +02:00
|
|
|
const char *name = desc ? desc->desc : NULL;
|
|
|
|
if (!name)
|
2014-08-20 18:38:50 +02:00
|
|
|
{
|
2014-08-27 23:44:23 +02:00
|
|
|
/* Find generic name. */
|
|
|
|
|
2014-09-01 16:52:54 +02:00
|
|
|
switch (g_settings.input.libretro_device
|
|
|
|
[driver.menu->current_pad])
|
2014-08-27 23:44:23 +02:00
|
|
|
{
|
|
|
|
case RETRO_DEVICE_NONE:
|
|
|
|
name = "None";
|
|
|
|
break;
|
|
|
|
case RETRO_DEVICE_JOYPAD:
|
|
|
|
name = "RetroPad";
|
|
|
|
break;
|
|
|
|
case RETRO_DEVICE_ANALOG:
|
|
|
|
name = "RetroPad w/ Analog";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
name = "Unknown";
|
|
|
|
break;
|
|
|
|
}
|
2014-08-20 18:38:50 +02:00
|
|
|
}
|
2014-08-25 15:17:24 +02:00
|
|
|
|
2014-08-27 23:44:23 +02:00
|
|
|
strlcpy(type_str, name, type_str_size);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_SETTINGS_CUSTOM_BIND_MODE:
|
2014-09-01 16:52:54 +02:00
|
|
|
strlcpy(type_str, driver.menu->bind_mode_keyboard ?
|
|
|
|
"RetroKeyboard" : "RetroPad", type_str_size);
|
2014-08-27 23:44:23 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
*type_str = '\0';
|
|
|
|
*w = 0;
|
|
|
|
break;
|
|
|
|
}
|
2014-06-01 19:55:53 +02:00
|
|
|
}
|
2014-04-26 02:40:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-14 02:32:54 +02:00
|
|
|
const menu_ctx_driver_backend_t menu_ctx_backend_common = {
|
|
|
|
menu_common_iterate,
|
2014-08-31 23:07:23 +02:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-04-26 01:53:40 +02:00
|
|
|
menu_common_shader_manager_init,
|
|
|
|
menu_common_shader_manager_get_str,
|
|
|
|
menu_common_shader_manager_set_preset,
|
|
|
|
menu_common_shader_manager_save_preset,
|
|
|
|
menu_common_shader_manager_get_type,
|
2014-04-26 02:40:38 +02:00
|
|
|
menu_common_shader_manager_setting_toggle,
|
2014-08-31 23:07:23 +02:00
|
|
|
#else
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
#endif
|
2014-04-26 02:40:38 +02:00
|
|
|
menu_common_type_is,
|
|
|
|
menu_common_setting_set_label,
|
2014-04-14 02:32:54 +02:00
|
|
|
"menu_common",
|
|
|
|
};
|