.travis.yml 0000664 0001750 0001750 00000004173 13272753522 012550 0 ustar sergio sergio # Use 'generic' to be able to override CC/CXX for clang
language: generic
matrix:
include:
- compiler: mingw-x86
addons:
apt:
packages:
- g++-mingw-w64-i686
- mingw-w64-i686-dev
script:
- CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: mingw-x64
addons:
apt:
packages:
- g++-mingw-w64-x86-64
- mingw-w64-x86-64-dev
script:
- CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: gcc
- compiler: clang
addons:
# Install a more recent clang than the default
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env: COMPILER_NAME=clang-3.8 CXX=clang++-3.8 CC=clang-3.8
- os: osx
osx_image: xcode7.3
script:
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
script:
- ./configure
- make
env:
global:
- MAKEFLAGS="-j2"
- secure: "qc91ReC3OlzSh2gFaSH6TYzC2qIQvgA2AZff6J13eaH8xijAhuMzttZ0rMQJ0DWCIhPeUb0kIzVyaGoe4MwPALzpw1C1AznIWiZJ53HN+hWCOcS/af7YVPk6HPySnwqrS+Wv3AIIvIKFV2mxv21F/JbT/N+pArlRrp904Xj+KPo="
addons:
apt:
packages:
- curl
- pkg-config
- libglu1-mesa-dev
- freeglut3-dev
- mesa-common-dev
- libsdl1.2-dev
- libsdl-image1.2-dev
- libsdl-mixer1.2-dev
- libsdl-ttf2.0-dev
- libusb-1.0-0-dev
coverity_scan:
project:
name: "RetroArch"
description: "RetroArch is the official reference frontend for the libretro API."
notification_email: libretro@gmail.com
build_command_prepend: "./configure; make clean"
build_command: "make"
branch_pattern: coverity_scan
notifications:
email: false
.project 0000664 0001750 0001750 00000000313 13272753522 012076 0 ustar sergio sergio
RetroArch_
.gitignore 0000664 0001750 0001750 00000004122 13272753522 012421 0 ustar sergio sergio *.o
*.bmpobj
*.binobj
*.so
*.dll
*.a
*.elf
*.dol
*.map
*.swp
.tmp
.tmp.c
.tmp.cxx
config.log
/.project
/.externalToolBuilders/
/retroarch
/retroarch.cfg
/retroarch.exe
/retroarch_debug.exe
/config.h
/config.mk
/tools/retroarch-joyconfig
/tools/retroarch-joyconfig.exe
*.ncb
*.sdf
*.opensdf
*.suo
Debug
Release
ipch
*.user
/bootstrap/gx/wii/app_booter/app_booter.bin
*.zip
RetroArch-w32/
RetroArch-w64/
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
apple/tmp
apple/*.mobileprovision
apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
menu/driverspzarch.c
/Cg/
/GL/
/SDL/
/ffmpeg/
/freetype2/
/ft2build.h
/iconv.h
/libxml2/
/phoenix/
/python/
/rsound.h
.pc
/media/shaders_glsl/
/obj-w32/
# Wii U
*.depend
*.rpx
*.last
wiiu/wut/elf2rpl/elf2rpl
/pkg/wiiu/retroarch
/pkg/wiiu/wiiu
/pkg/wiiu/rpx
/wiiu-devel.properties
# 3ds
/.lst
*.3dsx
*.cia
*.3ds
*.bnr
*.smdh
/retroarch_3ds.core
/retroarch_3ds.icn
/retroarch_3ds_salamander.icn
# Ctags
/tags
# CLion
/cmake-build-debug/
# Android
/pkg/android/phoenix/obj/
/pkg/android/phoenix/assets/
/pkg/android/phoenix/libs/
/pkg/android/phoenix/bin/
/pkg/android/phoenix/gen/
/pkg/android/phoenix/local.properties
# Cloned by libretro-fetch.sh
/media/assets/
/media/autoconfig/
/media/overlays/
/media/shaders_cg/
/media/libretrodb/
pkg/apple/iOS/build/
pkg/apple/iOS/modules/
obj-unix/
.vagrant/
/pkg/msvc/Release Cg/*.exe
/pkg/msvc/Release Cg/*.iobj
/pkg/msvc/Release Cg/*.ipdb
/pkg/msvc/Release Cg/*.pdb
/pkg/msvc/Release Cg/*.lpl
/pkg/msvc/Release Cg/*.cfg
/pkg/msvc/*.db
/pkg/msvc/.vs
/pkg/msvc/*/.vs
/pkg/msvc/msvc-2010/Release Cg/RetroArc.27FF7CE1.tlog/*.tlog
/pkg/msvc/msvc-2010/Release Cg/RetroArc.27FF7CE1.tlog/*.lastbuildstate
/pkg/msvc/msvc-2010/Release Cg/*.log
/pkg/msvc/msvc-2010/Release Cg/*.obj
/pkg/msvc/msvc-2010/Release Cg/*.res
/pkg/msvc/msvc-2010/Release Cg/*.pdb
retroarch.cfg
Makefile.local
# Emscripten artifacts
retroarch.js
retroarch.js.mem
*.bc
*.wasm
# only ignore .js files in the repo root
/*.js
.editorconfig 0000664 0001750 0001750 00000000557 13272753522 013116 0 ustar sergio sergio # EditorConfig: http://EditorConfig.org
# Top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# 3 space indentation
[*.{c,h,js,css,html}]
indent_style = space
indent_size = 3
# Tab indentation
[Makefile*]
indent_style = tab
wiiu-devel.properties.template 0000664 0001750 0001750 00000000343 13272753522 016434 0 ustar sergio sergio #
# To use this file:
# 1. Copy this file to wiiu-devel.properties
# 2. Fill in the variables below with your IP address and desired
# port number.
#
PC_DEVELOPMENT_IP_ADDRESS=
PC_DEVELOPMENT_TCP_PORT=4405
WIIU_IP_ADDRESS=
version_git.h 0000664 0001750 0001750 00000002052 13272753522 013132 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - 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 .
*/
#ifndef RARCH_VERSION_GIT_H__
#define RARCH_VERSION_GIT_H__
#include
RETRO_BEGIN_DECLS
/* Put this in a separate file so we don't have to rebuilt
* retroarch.c every single build. */
extern const char retroarch_git_version[];
RETRO_END_DECLS
#endif
version_git.c 0000664 0001750 0001750 00000001620 13272753522 013125 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - 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 .
*/
#include "version_git.h"
#define STR_(x) #x
#define STR(x) STR_(x)
const char retroarch_git_version[] = STR(GIT_VERSION);
version.h 0000664 0001750 0001750 00000001551 13272753522 012272 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - 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 .
*/
#ifndef RARCH_VERSION_H__
#define RARCH_VERSION_H__
#include "version.all"
#endif
version.dtd 0000664 0001750 0001750 00000000033 13272753522 012610 0 ustar sergio sergio
version.all 0000664 0001750 0001750 00000000616 13272753522 012614 0 ustar sergio sergio # /* this file is a polyglot: it's valid C, Makefile and shell */
# /* this reduces the number of files to update when changing the version */
# /* files to change to update version: */
# /* - this one, obviously */
# /* - version.dtd */
# /* - pkg/snap/snapcraft.yaml (including the github url) */
#if 0
RARCH_VERSION="1.7.3"
#endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "1.7.3"
#endif
verbosity.h 0000664 0001750 0001750 00000006776 13272753522 012651 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - 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 .
*/
#ifndef __RARCH_VERBOSITY_H
#define __RARCH_VERBOSITY_H
#include
#include
#include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
RETRO_BEGIN_DECLS
bool verbosity_is_enabled(void);
void verbosity_enable(void);
void verbosity_disable(void);
bool *verbosity_get_ptr(void);
void *retro_main_log_file(void);
void retro_main_log_file_deinit(void);
void retro_main_log_file_init(const char *path);
#if defined(HAVE_LOGGER)
void logger_init (void);
void logger_shutdown (void);
void logger_send (const char *__format,...);
void logger_send_v(const char *__format, va_list args);
#ifdef IS_SALAMANDER
#define RARCH_LOG(...) do { \
logger_send("RetroArch Salamander: " __VA_ARGS__); \
} while(0)
#define RARCH_LOG_V(tag, fmt, vp) do { \
logger_send("RetroArch Salamander: " tag); \
logger_send_v(fmt, vp); \
} while (0)
#define RARCH_LOG_OUTPUT(...) do { \
logger_send("[OUTPUT] " __VA_ARGS__); \
} while(0)
#define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \
logger_send("[OUTPUT] " tag); \
logger_send_v(fmt, vp); \
} while (0)
#define RARCH_ERR(...) do { \
logger_send("[ERROR] " __VA_ARGS__); \
} while(0)
#define RARCH_ERR_V(tag, fmt, vp) do { \
logger_send("[ERROR] " tag); \
logger_send_v(fmt, vp); \
} while (0)
#define RARCH_WARN(...) do { \
logger_send("[WARN] " __VA_ARGS__); \
} while(0)
#define RARCH_WARN_V(tag, fmt, vp) do { \
logger_send("[WARN] " tag); \
logger_send_v(fmt, vp); \
} while (0)
#else /* IS_SALAMANDER */
#define RARCH_LOG(...) do { \
logger_send("" __VA_ARGS__); \
} while(0)
#define RARCH_LOG_V(tag, fmt, vp) do { \
logger_send("" tag); \
logger_send_v(fmt, vp); \
} while (0)
#define RARCH_ERR(...) do { \
logger_send("[ERROR] " __VA_ARGS__); \
} while(0)
#define RARCH_ERR_V(tag, fmt, vp) do { \
logger_send("[ERROR] " tag); \
logger_send_v(fmt, vp); \
} while (0)
#define RARCH_WARN(...) do { \
logger_send("[WARN] " __VA_ARGS__); \
} while(0)
#define RARCH_WARN_V(tag, fmt, vp) do { \
logger_send("[WARN] :: " tag); \
logger_send_v(fmt, vp); \
} while (0)
#define RARCH_LOG_OUTPUT(...) do { \
logger_send("[OUTPUT] " __VA_ARGS__); \
} while(0)
#define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \
logger_send("[OUTPUT] " tag); \
logger_send_v(fmt, vp); \
} while (0)
#endif
#define RARCH_LOG_BUFFER(...) do { } while(0)
#else /* HAVE_LOGGER */
void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap);
void RARCH_LOG(const char *fmt, ...);
void RARCH_LOG_BUFFER(uint8_t *buffer, size_t size);
void RARCH_LOG_OUTPUT(const char *msg, ...);
void RARCH_WARN(const char *fmt, ...);
void RARCH_ERR(const char *fmt, ...);
#define RARCH_LOG_OUTPUT_V RARCH_LOG_V
#define RARCH_WARN_V RARCH_LOG_V
#define RARCH_ERR_V RARCH_LOG_V
#endif /* HAVE_LOGGER */
RETRO_END_DECLS
#endif
verbosity.c 0000664 0001750 0001750 00000015067 13272753522 012635 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - 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 .
*/
#ifdef _XBOX1
#include
#endif
#ifdef __MACH__
#include
#if TARGET_IPHONE_SIMULATOR
#include
#else
#include
#endif
#endif
#include
#include
#ifdef _MSC_VER
#include
#endif
#ifdef ANDROID
#include
#endif
#include
#include
#include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef RARCH_INTERNAL
#include "frontend/frontend_driver.h"
#endif
#include "file_path_special.h"
#include "verbosity.h"
#ifdef HAVE_QT
#include "ui/ui_companion_driver.h"
#endif
/* If this is non-NULL. RARCH_LOG and friends
* will write to this file. */
static FILE *log_file_fp = NULL;
static void* log_file_buf = NULL;
static bool main_verbosity = false;
static bool log_file_initialized = false;
void verbosity_enable(void)
{
main_verbosity = true;
#ifdef RARCH_INTERNAL
if (!log_file_initialized)
frontend_driver_attach_console();
#endif
}
void verbosity_disable(void)
{
main_verbosity = false;
#ifdef RARCH_INTERNAL
if (!log_file_initialized)
frontend_driver_detach_console();
#endif
}
bool verbosity_is_enabled(void)
{
return main_verbosity;
}
bool *verbosity_get_ptr(void)
{
return &main_verbosity;
}
void *retro_main_log_file(void)
{
return log_file_fp;
}
void retro_main_log_file_init(const char *path)
{
if (log_file_initialized)
return;
log_file_fp = stderr;
if (path == NULL)
return;
log_file_fp = (FILE*)fopen_utf8(path, "wb");
log_file_initialized = true;
/* TODO: this is only useful for a few platforms, find which and add ifdef */
log_file_buf = calloc(1, 0x4000);
setvbuf(log_file_fp, (char*)log_file_buf, _IOFBF, 0x4000);
}
void retro_main_log_file_deinit(void)
{
if (log_file_fp && log_file_fp != stderr)
fclose(log_file_fp);
if (log_file_buf) free(log_file_buf);
log_file_fp = NULL;
log_file_buf = NULL;
}
#if !defined(HAVE_LOGGER)
void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
{
#if TARGET_OS_IPHONE
#if TARGET_IPHONE_SIMULATOR
vprintf(fmt, ap);
#else
static aslclient asl_client;
static int asl_initialized = 0;
if (!asl_initialized)
{
asl_client = asl_open(
file_path_str(FILE_PATH_PROGRAM_NAME),
"com.apple.console",
ASL_OPT_STDERR | ASL_OPT_NO_DELAY);
asl_initialized = 1;
}
aslmsg msg = asl_new(ASL_TYPE_MSG);
asl_set(msg, ASL_KEY_READ_UID, "-1");
if (tag)
asl_log(asl_client, msg, ASL_LEVEL_NOTICE, "%s", tag);
asl_vlog(asl_client, msg, ASL_LEVEL_NOTICE, fmt, ap);
asl_free(msg);
#endif
#elif defined(_XBOX1)
{
/* FIXME: Using arbitrary string as fmt argument is unsafe. */
char msg_new[1024];
char buffer[1024];
msg_new[0] = buffer[0] = '\0';
snprintf(msg_new, sizeof(msg_new), "%s: %s %s",
file_path_str(FILE_PATH_PROGRAM_NAME),
tag ? tag : "",
fmt);
wvsprintf(buffer, msg_new, ap);
OutputDebugStringA(buffer);
}
#elif defined(ANDROID)
{
int prio = ANDROID_LOG_INFO;
if (tag)
{
if (string_is_equal(file_path_str(FILE_PATH_LOG_WARN), tag))
prio = ANDROID_LOG_WARN;
else if (string_is_equal(file_path_str(FILE_PATH_LOG_ERROR), tag))
prio = ANDROID_LOG_ERROR;
}
__android_log_vprint(prio,
file_path_str(FILE_PATH_PROGRAM_NAME),
fmt,
ap);
}
#else
{
#ifdef HAVE_QT
char buffer[1024];
#endif
#ifdef HAVE_FILE_LOGGER
FILE *fp = (FILE*)retro_main_log_file();
#else
FILE *fp = stderr;
#endif
#ifdef HAVE_QT
buffer[0] = '\0';
vsnprintf(buffer, sizeof(buffer), fmt, ap);
if (fp)
{
fprintf(fp, "%s %s", tag ? tag : file_path_str(FILE_PATH_LOG_INFO), buffer);
fflush(fp);
}
ui_companion_driver_log_msg(buffer);
#else
if (fp)
{
fprintf(fp, "%s ",
tag ? tag : file_path_str(FILE_PATH_LOG_INFO));
vfprintf(fp, fmt, ap);
fflush(fp);
}
#endif
}
#endif
}
void RARCH_LOG_BUFFER(uint8_t *data, size_t size)
{
unsigned i, offset;
int padding = size % 16;
uint8_t buf[16];
RARCH_LOG("== %d-byte buffer ==================\n", size);
for(i = 0, offset = 0; i < size; i++)
{
buf[offset] = data[i];
offset++;
if (offset == 16)
{
offset = 0;
RARCH_LOG("%02x%02x%02x%02x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7],
buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
}
}
if(padding)
{
for(i = padding; i < 16; i++)
buf[i] = 0xff;
RARCH_LOG("%02x%02x%02x%02x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7],
buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
}
RARCH_LOG("==================================\n");
}
void RARCH_LOG(const char *fmt, ...)
{
va_list ap;
if (!verbosity_is_enabled())
return;
va_start(ap, fmt);
RARCH_LOG_V(file_path_str(FILE_PATH_LOG_INFO), fmt, ap);
va_end(ap);
}
void RARCH_LOG_OUTPUT(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
RARCH_LOG_OUTPUT_V(file_path_str(FILE_PATH_LOG_INFO), msg, ap);
va_end(ap);
}
void RARCH_WARN(const char *fmt, ...)
{
va_list ap;
if (!verbosity_is_enabled())
return;
va_start(ap, fmt);
RARCH_WARN_V(file_path_str(FILE_PATH_LOG_WARN), fmt, ap);
va_end(ap);
}
void RARCH_ERR(const char *fmt, ...)
{
va_list ap;
if (!verbosity_is_enabled())
return;
va_start(ap, fmt);
RARCH_ERR_V(file_path_str(FILE_PATH_LOG_ERROR), fmt, ap);
va_end(ap);
}
#endif
setting_list.h 0000664 0001750 0001750 00000031473 13272753522 013323 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - 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 .
*/
#ifndef __SETTING_LIST_H
#define __SETTING_LIST_H
#include
#include
#include "command.h"
#include "msg_hash.h"
RETRO_BEGIN_DECLS
enum setting_type
{
ST_NONE = 0,
ST_ACTION,
ST_BOOL,
ST_INT,
ST_UINT,
ST_FLOAT,
ST_PATH,
ST_DIR,
ST_STRING,
ST_STRING_OPTIONS,
ST_HEX,
ST_BIND,
ST_GROUP,
ST_SUB_GROUP,
ST_END_GROUP,
ST_END_SUB_GROUP
};
enum setting_flags
{
SD_FLAG_NONE = 0,
SD_FLAG_PATH_DIR = (1 << 0),
SD_FLAG_PATH_FILE = (1 << 1),
SD_FLAG_ALLOW_EMPTY = (1 << 2),
SD_FLAG_HAS_RANGE = (1 << 3),
SD_FLAG_ALLOW_INPUT = (1 << 4),
SD_FLAG_IS_DRIVER = (1 << 5),
SD_FLAG_EXIT = (1 << 6),
SD_FLAG_CMD_APPLY_AUTO = (1 << 7),
SD_FLAG_BROWSER_ACTION = (1 << 8),
SD_FLAG_ADVANCED = (1 << 9),
SD_FLAG_LAKKA_ADVANCED = (1 << 10)
};
enum settings_free_flags
{
SD_FREE_FLAG_VALUES = (1 << 0),
SD_FREE_FLAG_NAME = (1 << 1),
SD_FREE_FLAG_SHORT = (1 << 2)
};
typedef struct rarch_setting rarch_setting_t;
typedef struct rarch_setting_info rarch_setting_info_t;
typedef struct rarch_setting_group_info rarch_setting_group_info_t;
typedef void (*change_handler_t )(void *data);
typedef int (*action_left_handler_t )(void *data, bool wraparound);
typedef int (*action_right_handler_t )(void *data, bool wraparound);
typedef int (*action_up_handler_t )(void *data);
typedef int (*action_down_handler_t )(void *data);
typedef int (*action_start_handler_t )(void *data);
typedef int (*action_cancel_handler_t )(void *data);
typedef int (*action_ok_handler_t )(void *data, bool wraparound);
typedef int (*action_select_handler_t )(void *data, bool wraparound);
typedef void (*get_string_representation_t )(void *data, char *s, size_t len);
struct rarch_setting_group_info
{
const char *name;
};
struct rarch_setting
{
enum setting_type browser_selection_type;
enum msg_hash_enums enum_idx;
enum msg_hash_enums enum_value_idx;
enum setting_type type;
bool dont_use_enum_idx_representation;
bool enforce_minrange;
bool enforce_maxrange;
uint8_t index;
uint8_t index_offset;
unsigned bind_type;
uint32_t size;
float step;
uint64_t flags;
uint64_t free_flags;
double min;
double max;
const char *rounding_fraction;
const char *name;
const char *short_description;
const char *group;
const char *subgroup;
const char *parent_group;
const char *values;
change_handler_t change_handler;
change_handler_t read_handler;
action_start_handler_t action_start;
action_left_handler_t action_left;
action_right_handler_t action_right;
action_up_handler_t action_up;
action_down_handler_t action_down;
action_cancel_handler_t action_cancel;
action_ok_handler_t action_ok;
action_select_handler_t action_select;
get_string_representation_t get_string_representation;
union
{
bool boolean;
const char *string;
int integer;
unsigned int unsigned_integer;
float fraction;
const struct retro_keybind *keybind;
} default_value;
struct
{
union
{
bool *boolean;
char *string;
int *integer;
unsigned int *unsigned_integer;
float *fraction;
struct retro_keybind *keybind;
} target;
} value;
union
{
bool boolean;
int integer;
unsigned int unsigned_integer;
float fraction;
} original_value;
struct
{
const char *empty_path;
} dir;
struct
{
enum event_command idx;
bool triggered;
} cmd_trigger;
struct
{
const char *off_label;
const char *on_label;
} boolean;
};
struct rarch_setting_info
{
int index;
int size;
};
bool START_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
rarch_setting_group_info_t *group_info,
const char *name, const char *parent_group);
bool END_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
const char *parent_group);
bool START_SUB_GROUP(rarch_setting_t **list,
rarch_setting_info_t *list_info, const char *name,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group);
bool END_SUB_GROUP(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
const char *parent_group);
bool CONFIG_ACTION_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
const char *name, const char *SHORT,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group);
bool CONFIG_ACTION(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group);
bool CONFIG_BOOL_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
bool *target,
const char *name, const char *SHORT,
bool default_value,
enum msg_hash_enums off_enum_idx,
enum msg_hash_enums on_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler,
change_handler_t read_handler,
uint32_t flags);
bool CONFIG_BOOL(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
bool *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
bool default_value,
enum msg_hash_enums off_enum_idx,
enum msg_hash_enums on_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler,
change_handler_t read_handler,
uint32_t flags);
bool CONFIG_INT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
int *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_UINT_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned int *target,
const char *name, const char *SHORT,
unsigned int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_UINT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned int *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
unsigned int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_FLOAT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
float *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
float default_value, const char *rounding,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_PATH(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_DIR(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value,
enum msg_hash_enums empty_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_STRING(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_STRING_OPTIONS(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value, const char *values,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
bool CONFIG_HEX(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned int *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
unsigned int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler);
/* Please strdup() NAME and SHORT */
bool CONFIG_BIND(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
struct retro_keybind *target,
uint32_t player, uint32_t player_offset,
const char *name, const char *SHORT,
const struct retro_keybind *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group);
bool CONFIG_BIND_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
struct retro_keybind *target,
uint32_t player, uint32_t player_offset,
const char *name, const char *SHORT,
const struct retro_keybind *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group);
/**
* setting_set_with_string_representation:
* @setting : pointer to setting
* @value : value for the setting (string)
*
* Set a settings' value with a string. It is assumed
* that the string has been properly formatted.
**/
int setting_set_with_string_representation(
rarch_setting_t* setting, const char *value);
unsigned setting_get_bind_type(rarch_setting_t *setting);
int setting_string_action_start_generic(void *data);
int setting_generic_action_ok_default(void *data, bool wraparound);
int setting_generic_action_start_default(void *data);
void settings_data_list_current_add_flags(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned values);
void settings_data_list_current_add_free_flags(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned values);
#define setting_get_type(setting) ((setting) ? setting->type : ST_NONE)
RETRO_END_DECLS
#endif
setting_list.c 0000664 0001750 0001750 00000203244 13272753522 013313 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - 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 .
*/
#include
#include
#include
#include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "input/input_driver.h"
#include "config.def.keybinds.h"
#ifdef HAVE_MENU
#include "menu/menu_driver.h"
#include "menu/widgets/menu_input_dialog.h"
#include "menu/widgets/menu_input_bind_dialog.h"
#endif
#include "configuration.h"
#include "config.def.h"
#include "setting_list.h"
bool settings_list_append(rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
if (!list || !*list || !list_info)
return false;
if (list_info->index == list_info->size)
{
list_info->size *= 2;
*list = (rarch_setting_t*)
realloc(*list, sizeof(rarch_setting_t) * list_info->size);
if (!*list)
return false;
}
return true;
}
unsigned setting_get_bind_type(rarch_setting_t *setting)
{
if (!setting)
return 0;
return setting->bind_type;
}
static int setting_bind_action_ok(void *data, bool wraparound)
{
(void)wraparound; /* TODO/FIXME - handle this */
#ifdef HAVE_MENU
/* TODO - get rid of menu dependency */
if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_SINGLE, data))
return -1;
#endif
return 0;
}
static int setting_int_action_right_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
double max = 0.0f;
if (!setting)
return -1;
max = setting->max;
(void)wraparound; /* TODO/FIXME - handle this */
*setting->value.target.integer =
*setting->value.target.integer + setting->step;
if (setting->enforce_maxrange)
{
if (*setting->value.target.integer > max)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_MENU
double min = setting->min;
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.integer = min;
else
#endif
*setting->value.target.integer = max;
}
}
return 0;
}
#ifdef HAVE_MENU
static int setting_bind_action_start(void *data)
{
unsigned bind_type;
struct retro_keybind *keybind = NULL;
rarch_setting_t *setting = (rarch_setting_t*)data;
struct retro_keybind *def_binds = (struct retro_keybind *)retro_keybinds_1;
if (!setting)
return -1;
keybind = (struct retro_keybind*)setting->value.target.keybind;
if (!keybind)
return -1;
keybind->joykey = NO_BTN;
keybind->joyaxis = AXIS_NONE;
if (setting->index_offset)
def_binds = (struct retro_keybind*)retro_keybinds_rest;
bind_type = setting_get_bind_type(setting);
keybind->key = def_binds[bind_type - MENU_SETTINGS_BIND_BEGIN].key;
keybind->mbutton = NO_BTN;
return 0;
}
#endif
static void setting_get_string_representation_hex(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
snprintf(s, len, "%08x",
*setting->value.target.unsigned_integer);
}
static void setting_get_string_representation_uint(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
snprintf(s, len, "%u",
*setting->value.target.unsigned_integer);
}
static int setting_uint_action_left_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
double min = 0.0f;
bool overflowed = false;
if (!setting)
return -1;
min = setting->min;
(void)wraparound; /* TODO/FIXME - handle this */
overflowed = setting->step > *setting->value.target.unsigned_integer;
if (!overflowed)
*setting->value.target.unsigned_integer = *setting->value.target.unsigned_integer - setting->step;
if (setting->enforce_minrange)
{
if (overflowed || *setting->value.target.unsigned_integer < min)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_MENU
double max = setting->max;
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.unsigned_integer = max;
else
#endif
*setting->value.target.unsigned_integer = min;
}
}
return 0;
}
static int setting_uint_action_right_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
double max = 0.0f;
if (!setting)
return -1;
max = setting->max;
(void)wraparound; /* TODO/FIXME - handle this */
*setting->value.target.unsigned_integer =
*setting->value.target.unsigned_integer + setting->step;
if (setting->enforce_maxrange)
{
if (*setting->value.target.unsigned_integer > max)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_MENU
double min = setting->min;
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.unsigned_integer = min;
else
#endif
*setting->value.target.unsigned_integer = max;
}
}
return 0;
}
int setting_generic_action_ok_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
(void)wraparound; /* TODO/FIXME - handle this */
if (setting->cmd_trigger.idx != CMD_EVENT_NONE)
setting->cmd_trigger.triggered = true;
return 0;
}
static void setting_get_string_representation_int(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
snprintf(s, len, "%d", *setting->value.target.integer);
}
/**
* setting_set_with_string_representation:
* @setting : pointer to setting
* @value : value for the setting (string)
*
* Set a settings' value with a string. It is assumed
* that the string has been properly formatted.
**/
int setting_set_with_string_representation(rarch_setting_t* setting,
const char* value)
{
double min, max;
uint64_t flags;
if (!setting || !value)
return -1;
min = setting->min;
max = setting->max;
flags = setting->flags;
switch (setting_get_type(setting))
{
case ST_INT:
sscanf(value, "%d", setting->value.target.integer);
if (flags & SD_FLAG_HAS_RANGE)
{
if (setting->enforce_minrange && *setting->value.target.integer < min)
*setting->value.target.integer = min;
if (setting->enforce_maxrange && *setting->value.target.integer > max)
{
#ifdef HAVE_MENU
settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.integer = min;
else
#endif
*setting->value.target.integer = max;
}
}
break;
case ST_UINT:
sscanf(value, "%u", setting->value.target.unsigned_integer);
if (flags & SD_FLAG_HAS_RANGE)
{
if (setting->enforce_minrange && *setting->value.target.unsigned_integer < min)
*setting->value.target.unsigned_integer = min;
if (setting->enforce_maxrange && *setting->value.target.unsigned_integer > max)
{
#ifdef HAVE_MENU
settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.unsigned_integer = min;
else
#endif
*setting->value.target.unsigned_integer = max;
}
}
break;
case ST_FLOAT:
sscanf(value, "%f", setting->value.target.fraction);
if (flags & SD_FLAG_HAS_RANGE)
{
if (setting->enforce_minrange && *setting->value.target.fraction < min)
*setting->value.target.fraction = min;
if (setting->enforce_maxrange && *setting->value.target.fraction > max)
{
#ifdef HAVE_MENU
settings_t *settings = config_get_ptr();
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.fraction = min;
else
#endif
*setting->value.target.fraction = max;
}
}
break;
case ST_PATH:
case ST_DIR:
case ST_STRING:
case ST_STRING_OPTIONS:
case ST_ACTION:
strlcpy(setting->value.target.string, value, setting->size);
break;
case ST_BOOL:
if (string_is_equal(value, "true"))
*setting->value.target.boolean = true;
else if (string_is_equal(value, "false"))
*setting->value.target.boolean = false;
break;
default:
break;
}
if (setting->change_handler)
setting->change_handler(setting);
return 0;
}
static int setting_fraction_action_left_default(
void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
double min = 0.0f;
if (!setting)
return -1;
min = setting->min;
(void)wraparound; /* TODO/FIXME - handle this */
*setting->value.target.fraction = *setting->value.target.fraction - setting->step;
if (setting->enforce_minrange)
{
if (*setting->value.target.fraction < min)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_MENU
double max = setting->max;
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.fraction = max;
else
#endif
*setting->value.target.fraction = min;
}
}
return 0;
}
static int setting_fraction_action_right_default(
void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
double max = 0.0f;
if (!setting)
return -1;
max = setting->max;
(void)wraparound; /* TODO/FIXME - handle this */
*setting->value.target.fraction =
*setting->value.target.fraction + setting->step;
if (setting->enforce_maxrange)
{
if (*setting->value.target.fraction > max)
{
#ifdef HAVE_MENU
settings_t *settings = config_get_ptr();
double min = setting->min;
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.fraction = min;
else
#endif
*setting->value.target.fraction = max;
}
}
return 0;
}
/**
* setting_reset_setting:
* @setting : pointer to setting
*
* Reset a setting's value to its defaults.
**/
static void setting_reset_setting(rarch_setting_t* setting)
{
if (!setting)
return;
switch (setting_get_type(setting))
{
case ST_BOOL:
*setting->value.target.boolean = setting->default_value.boolean;
break;
case ST_INT:
*setting->value.target.integer = setting->default_value.integer;
break;
case ST_UINT:
*setting->value.target.unsigned_integer = setting->default_value.unsigned_integer;
break;
case ST_FLOAT:
*setting->value.target.fraction = setting->default_value.fraction;
break;
case ST_BIND:
*setting->value.target.keybind = *setting->default_value.keybind;
break;
case ST_STRING:
case ST_STRING_OPTIONS:
case ST_PATH:
case ST_DIR:
if (setting->default_value.string)
{
if (setting_get_type(setting) == ST_STRING)
setting_set_with_string_representation(setting, setting->default_value.string);
else
fill_pathname_expand_special(setting->value.target.string,
setting->default_value.string, setting->size);
}
break;
default:
break;
}
if (setting->change_handler)
setting->change_handler(setting);
}
int setting_generic_action_start_default(void *data)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
setting_reset_setting(setting);
return 0;
}
static void setting_get_string_representation_default(void *data,
char *s, size_t len)
{
(void)data;
strlcpy(s, "...", len);
}
/**
* setting_get_string_representation_st_bool:
* @setting : pointer to setting
* @s : string for the type to be represented on-screen as
* a label.
* @len : size of @s
*
* Set a settings' label value. The setting is of type ST_BOOL.
**/
static void setting_get_string_representation_st_bool(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
strlcpy(s, *setting->value.target.boolean ? setting->boolean.on_label :
setting->boolean.off_label, len);
}
/**
* setting_get_string_representation_st_float:
* @setting : pointer to setting
* @s : string for the type to be represented on-screen as
* a label.
* @len : size of @s
*
* Set a settings' label value. The setting is of type ST_FLOAT.
**/
static void setting_get_string_representation_st_float(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
snprintf(s, len, setting->rounding_fraction,
*setting->value.target.fraction);
}
static void setting_get_string_representation_st_dir(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
strlcpy(s,
*setting->value.target.string ?
setting->value.target.string : setting->dir.empty_path,
len);
}
static void setting_get_string_representation_st_path(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
fill_short_pathname_representation(s, setting->value.target.string, len);
}
static void setting_get_string_representation_st_string(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting)
strlcpy(s, setting->value.target.string, len);
}
static void setting_get_string_representation_st_bind(void *data,
char *s, size_t len)
{
unsigned index_offset;
rarch_setting_t *setting = (rarch_setting_t*)data;
const struct retro_keybind* keybind = NULL;
const struct retro_keybind* auto_bind = NULL;
if (!setting)
return;
index_offset = setting->index_offset;
keybind = (const struct retro_keybind*)setting->value.target.keybind;
auto_bind = (const struct retro_keybind*)
input_config_get_bind_auto(index_offset, keybind->id);
input_config_get_bind_string(s, keybind, auto_bind, len);
}
static int setting_action_action_ok(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
(void)wraparound; /* TODO/FIXME - handle this */
if (setting->cmd_trigger.idx != CMD_EVENT_NONE)
command_event(setting->cmd_trigger.idx, NULL);
return 0;
}
/**
* setting_action_setting:
* @name : Name of setting.
* @short_description : Short description of setting.
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
*
* Initializes a setting of type ST_ACTION.
*
* Returns: setting of type ST_ACTION.
**/
static rarch_setting_t setting_action_setting(const char* name,
const char* short_description,
const char *group, const char *subgroup,
const char *parent_group,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_ACTION;
result.size = 0;
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = NULL;
result.read_handler = NULL;
result.action_start = NULL;
result.action_left = NULL;
result.action_right = NULL;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_action_action_ok;
result.action_select = setting_action_action_ok;
result.get_string_representation = &setting_get_string_representation_default;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_group_setting:
* @type : type of settting.
* @name : name of setting.
*
* Initializes a setting of type ST_GROUP.
*
* Returns: setting of type ST_GROUP.
**/
static rarch_setting_t setting_group_setting(enum setting_type type, const char* name,
const char *parent_group)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = type;
result.size = 0;
result.name = name;
result.short_description = name;
result.group = NULL;
result.subgroup = NULL;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = NULL;
result.read_handler = NULL;
result.action_start = NULL;
result.action_left = NULL;
result.action_right = NULL;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = NULL;
result.action_select = NULL;
result.get_string_representation = &setting_get_string_representation_default;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = false;
return result;
}
/**
* setting_float_setting:
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of float setting.
* @default_value : Default value (in float).
* @rounding : Rounding (for float-to-string representation).
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a setting of type ST_FLOAT.
*
* Returns: setting of type ST_FLOAT.
**/
static rarch_setting_t setting_float_setting(const char* name,
const char* short_description, float* target, float default_value,
const char *rounding, const char *group, const char *subgroup,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_FLOAT;
result.size = sizeof(float);
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = change_handler;
result.read_handler = read_handler;
result.action_start = setting_generic_action_start_default;
result.action_left = setting_fraction_action_left_default;
result.action_right = setting_fraction_action_right_default;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_generic_action_ok_default;
result.action_select = setting_generic_action_ok_default;
result.get_string_representation = &setting_get_string_representation_st_float;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = rounding;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.fraction = target;
result.original_value.fraction = *target;
result.default_value.fraction = default_value;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_uint_setting:
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of unsigned integer setting.
* @default_value : Default value (in unsigned integer format).
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a setting of type ST_UINT.
*
* Returns: setting of type ST_UINT.
**/
static rarch_setting_t setting_uint_setting(const char* name,
const char* short_description, unsigned int* target,
unsigned int default_value,
const char *group, const char *subgroup, const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_UINT;
result.size = sizeof(unsigned int);
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = change_handler;
result.read_handler = read_handler;
result.action_start = setting_generic_action_start_default;
result.action_left = setting_uint_action_left_default;
result.action_right = setting_uint_action_right_default;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_generic_action_ok_default;
result.action_select = setting_generic_action_ok_default;
result.get_string_representation = &setting_get_string_representation_uint;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.unsigned_integer = target;
result.original_value.unsigned_integer = *target;
result.default_value.unsigned_integer = default_value;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_hex_setting:
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of unsigned integer setting.
* @default_value : Default value (in unsigned integer format).
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a setting of type ST_HEX.
*
* Returns: setting of type ST_HEX.
**/
static rarch_setting_t setting_hex_setting(const char* name,
const char* short_description, unsigned int* target,
unsigned int default_value,
const char *group, const char *subgroup, const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_HEX;
result.size = sizeof(unsigned int);
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = change_handler;
result.read_handler = read_handler;
result.action_start = setting_generic_action_start_default;
result.action_left = NULL;
result.action_right = NULL;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_generic_action_ok_default;
result.action_select = setting_generic_action_ok_default;
result.get_string_representation = &setting_get_string_representation_hex;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.unsigned_integer = target;
result.original_value.unsigned_integer = *target;
result.default_value.unsigned_integer = default_value;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_bind_setting:
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of bind setting.
* @idx : Index of bind setting.
* @idx_offset : Index offset of bind setting.
* @default_value : Default value (in bind format).
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
*
* Initializes a setting of type ST_BIND.
*
* Returns: setting of type ST_BIND.
**/
static rarch_setting_t setting_bind_setting(const char* name,
const char* short_description, struct retro_keybind* target,
uint32_t idx, uint32_t idx_offset,
const struct retro_keybind* default_value,
const char *group, const char *subgroup,
const char *parent_group,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_BIND;
result.size = 0;
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = idx;
result.index_offset = idx_offset;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = NULL;
result.read_handler = NULL;
#ifdef HAVE_MENU
result.action_start = setting_bind_action_start;
#else
result.action_start = NULL;
#endif
result.action_left = NULL;
result.action_right = NULL;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_bind_action_ok;
result.action_select = setting_bind_action_ok;
result.get_string_representation = &setting_get_string_representation_st_bind;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.keybind = target;
result.default_value.keybind = default_value;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
static int setting_int_action_left_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
double min = 0.0f;
if (!setting)
return -1;
min = setting->min;
(void)wraparound; /* TODO/FIXME - handle this */
*setting->value.target.integer = *setting->value.target.integer - setting->step;
if (setting->enforce_minrange)
{
if (*setting->value.target.integer < min)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_MENU
double max = setting->max;
if (settings && settings->bools.menu_navigation_wraparound_enable)
*setting->value.target.integer = max;
else
#endif
*setting->value.target.integer = min;
}
}
return 0;
}
static int setting_bool_action_ok_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
(void)wraparound; /* TODO/FIXME - handle this */
setting_set_with_string_representation(setting,
*setting->value.target.boolean ? "false" : "true");
return 0;
}
static int setting_bool_action_toggle_default(void *data, bool wraparound)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
(void)wraparound; /* TODO/FIXME - handle this */
setting_set_with_string_representation(setting,
*setting->value.target.boolean ? "false" : "true");
return 0;
}
int setting_string_action_start_generic(void *data)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
setting->value.target.string[0] = '\0';
return 0;
}
/**
* setting_string_setting:
* @type : type of setting.
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of string setting.
* @size : Size of string setting.
* @default_value : Default value (in string format).
* @empty : TODO/FIXME: ???
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a string setting (of type @type).
*
* Returns: String setting of type @type.
**/
static rarch_setting_t setting_string_setting(enum setting_type type,
const char* name, const char* short_description, char* target,
unsigned size, const char* default_value, const char *empty,
const char *group, const char *subgroup, const char *parent_group,
change_handler_t change_handler,
change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = type;
result.size = size;
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = change_handler;
result.read_handler = read_handler;
result.action_start = NULL;
result.action_left = NULL;
result.action_right = NULL;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = NULL;
result.action_select = NULL;
result.get_string_representation = &setting_get_string_representation_st_string;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.dir.empty_path = empty;
result.value.target.string = target;
result.default_value.string = default_value;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
switch (type)
{
case ST_DIR:
result.action_start = setting_string_action_start_generic;
result.browser_selection_type = ST_DIR;
result.get_string_representation = &setting_get_string_representation_st_dir;
break;
case ST_PATH:
result.action_start = setting_string_action_start_generic;
result.browser_selection_type = ST_PATH;
result.get_string_representation = &setting_get_string_representation_st_path;
break;
default:
break;
}
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_string_setting_options:
* @type : type of settting.
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of bind setting.
* @size : Size of string setting.
* @default_value : Default value.
* @empty : N/A.
* @values : Values, separated by a delimiter.
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a string options list setting.
*
* Returns: string option list setting.
**/
static rarch_setting_t setting_string_setting_options(enum setting_type type,
const char* name, const char* short_description, char* target,
unsigned size, const char* default_value,
const char *empty, const char *values,
const char *group, const char *subgroup, const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result = setting_string_setting(type, name,
short_description, target, size, default_value, empty, group,
subgroup, parent_group, change_handler, read_handler,
dont_use_enum_idx);
result.parent_group = parent_group;
result.values = values;
return result;
}
/**
* setting_subgroup_setting:
* @type : type of settting.
* @name : name of setting.
* @parent_name : group that the subgroup setting belongs to.
*
* Initializes a setting of type ST_SUBGROUP.
*
* Returns: setting of type ST_SUBGROUP.
**/
static rarch_setting_t setting_subgroup_setting(enum setting_type type,
const char* name, const char *parent_name, const char *parent_group,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = type;
result.size = 0;
result.name = name;
result.short_description = name;
result.group = parent_name;
result.parent_group = parent_group;
result.values = NULL;
result.subgroup = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = NULL;
result.read_handler = NULL;
result.action_start = NULL;
result.action_left = NULL;
result.action_right = NULL;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = NULL;
result.action_select = NULL;
result.get_string_representation = &setting_get_string_representation_default;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_bool_setting:
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of bool setting.
* @default_value : Default value (in bool format).
* @off : String value for "Off" label.
* @on : String value for "On" label.
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a setting of type ST_BOOL.
*
* Returns: setting of type ST_BOOL.
**/
static rarch_setting_t setting_bool_setting(const char* name,
const char* short_description, bool* target, bool default_value,
const char *off, const char *on,
const char *group, const char *subgroup, const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_BOOL;
result.size = sizeof(bool);
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = change_handler;
result.read_handler = read_handler;
result.action_start = setting_generic_action_start_default;
result.action_left = setting_bool_action_toggle_default;
result.action_right = setting_bool_action_toggle_default;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_bool_action_ok_default;
result.action_select = setting_generic_action_ok_default;
result.get_string_representation = &setting_get_string_representation_st_bool;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.boolean = target;
result.original_value.boolean = *target;
result.default_value.boolean = default_value;
result.boolean.off_label = off;
result.boolean.on_label = on;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
/**
* setting_int_setting:
* @name : name of setting.
* @short_description : Short description of setting.
* @target : Target of signed integer setting.
* @default_value : Default value (in signed integer format).
* @group : Group that the setting belongs to.
* @subgroup : Subgroup that the setting belongs to.
* @change_handler : Function callback for change handler function pointer.
* @read_handler : Function callback for read handler function pointer.
*
* Initializes a setting of type ST_INT.
*
* Returns: setting of type ST_INT.
**/
static rarch_setting_t setting_int_setting(const char* name,
const char* short_description, int* target,
int default_value,
const char *group, const char *subgroup, const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler,
bool dont_use_enum_idx)
{
rarch_setting_t result;
result.enum_idx = MSG_UNKNOWN;
result.type = ST_INT;
result.size = sizeof(int);
result.name = name;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
result.parent_group = parent_group;
result.values = NULL;
result.index = 0;
result.index_offset = 0;
result.min = 0.0;
result.max = 0.0;
result.flags = 0;
result.free_flags = 0;
result.change_handler = change_handler;
result.read_handler = read_handler;
result.action_start = setting_generic_action_start_default;
result.action_left = setting_int_action_left_default;
result.action_right = setting_int_action_right_default;
result.action_up = NULL;
result.action_down = NULL;
result.action_cancel = NULL;
result.action_ok = setting_generic_action_ok_default;
result.action_select = setting_generic_action_ok_default;
result.get_string_representation = &setting_get_string_representation_int;
result.bind_type = 0;
result.browser_selection_type = ST_NONE;
result.step = 0.0f;
result.rounding_fraction = NULL;
result.enforce_minrange = false;
result.enforce_maxrange = false;
result.value.target.integer = target;
result.original_value.integer = *target;
result.default_value.integer = default_value;
result.cmd_trigger.idx = CMD_EVENT_NONE;
result.cmd_trigger.triggered = false;
result.dont_use_enum_idx_representation = dont_use_enum_idx;
return result;
}
bool CONFIG_BOOL_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
bool *target,
const char *name, const char *SHORT,
bool default_value,
enum msg_hash_enums off_enum_idx,
enum msg_hash_enums on_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler,
change_handler_t read_handler,
uint32_t flags)
{
rarch_setting_t value = setting_bool_setting(name, SHORT, target,
default_value,
msg_hash_to_str(off_enum_idx), msg_hash_to_str(on_enum_idx),
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler, true);
if (!settings_list_append(list, list_info))
return false;
(*list)[list_info->index++] = value;
if (flags != SD_FLAG_NONE)
settings_data_list_current_add_flags(list, list_info, flags);
return true;
}
bool CONFIG_BOOL(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
bool *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
bool default_value,
enum msg_hash_enums off_enum_idx,
enum msg_hash_enums on_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler,
change_handler_t read_handler,
uint32_t flags)
{
rarch_setting_t value = setting_bool_setting(
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target,
default_value,
msg_hash_to_str(off_enum_idx),
msg_hash_to_str(on_enum_idx),
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler, false);
if (!settings_list_append(list, list_info))
return false;
(*list)[list_info->index++] = value;
if (flags != SD_FLAG_NONE)
settings_data_list_current_add_flags(list, list_info, flags);
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_INT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
int *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_int_setting(
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, default_value,
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler,
false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_UINT_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned int *target,
const char *name, const char *SHORT,
unsigned int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_uint_setting(name, SHORT, target, default_value,
group_info->name,
subgroup_info->name, parent_group, change_handler, read_handler,
true);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
return true;
}
bool CONFIG_UINT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned int *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
unsigned int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_uint_setting (
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, default_value,
group_info->name,
subgroup_info->name, parent_group,
change_handler, read_handler,
false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_FLOAT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
float *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
float default_value, const char *rounding,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_float_setting(msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx), target, default_value, rounding,
group_info->name, subgroup_info->name, parent_group, change_handler, read_handler,
false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_PATH(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_string_setting(ST_PATH,
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, (unsigned)len, default_value, "",
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler,
false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY);
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_DIR(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value,
enum msg_hash_enums empty_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_string_setting(ST_DIR,
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, (unsigned)len, default_value,
msg_hash_to_str(empty_enum_idx),
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler,
false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
settings_data_list_current_add_flags(
list,
list_info,
SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION);
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_STRING(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_string_setting(ST_STRING,
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, (unsigned)len, default_value, "",
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler, false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool CONFIG_STRING_OPTIONS(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
char *target, size_t len,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
const char *default_value, const char *values,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_string_setting_options(ST_STRING_OPTIONS,
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, (unsigned)len, default_value, "", values,
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler, false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
/* Request values to be freed later */
settings_data_list_current_add_free_flags(list, list_info, SD_FREE_FLAG_VALUES);
return true;
}
bool CONFIG_HEX(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned int *target,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
unsigned int default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group,
change_handler_t change_handler, change_handler_t read_handler)
{
rarch_setting_t value = setting_hex_setting(
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
target, default_value,
group_info->name, subgroup_info->name, parent_group,
change_handler, read_handler, false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
/* Please strdup() NAME and SHORT */
bool CONFIG_BIND(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
struct retro_keybind *target,
uint32_t player, uint32_t player_offset,
const char *name, const char *SHORT,
const struct retro_keybind *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group)
{
rarch_setting_t value = setting_bind_setting(name, SHORT, target,
player, player_offset, default_value,
group_info->name, subgroup_info->name, parent_group,
false);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
/* Request name and short description to be freed later */
settings_data_list_current_add_free_flags(list, list_info, SD_FREE_FLAG_NAME | SD_FREE_FLAG_SHORT);
return true;
}
bool CONFIG_BIND_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
struct retro_keybind *target,
uint32_t player, uint32_t player_offset,
const char *name, const char *SHORT,
const struct retro_keybind *default_value,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group)
{
rarch_setting_t value = setting_bind_setting(name, SHORT, target,
player, player_offset, default_value,
group_info->name, subgroup_info->name, parent_group,
true);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
/* Request name and short description to be freed later */
settings_data_list_current_add_free_flags(list, list_info, SD_FREE_FLAG_NAME | SD_FREE_FLAG_SHORT);
return true;
}
bool CONFIG_ACTION_ALT(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
const char *name, const char *SHORT,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group)
{
rarch_setting_t value = setting_action_setting(name, SHORT,
group_info->name, subgroup_info->name, parent_group,
true);
if (!settings_list_append(list, list_info))
return false;
(*list)[list_info->index++] = value;
return true;
}
bool CONFIG_ACTION(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
enum msg_hash_enums name_enum_idx,
enum msg_hash_enums SHORT_enum_idx,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group)
{
rarch_setting_t value = setting_action_setting(
msg_hash_to_str(name_enum_idx),
msg_hash_to_str(SHORT_enum_idx),
group_info->name,
subgroup_info->name, parent_group,
false);
if (!settings_list_append(list, list_info))
return false;
(*list)[list_info->index++] = value;
#ifdef HAVE_MENU
menu_settings_list_current_add_enum_idx(list, list_info, name_enum_idx);
menu_settings_list_current_add_enum_value_idx(list, list_info, SHORT_enum_idx);
#endif
return true;
}
bool START_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
rarch_setting_group_info_t *group_info,
const char *name, const char *parent_group)
{
rarch_setting_t value = setting_group_setting (ST_GROUP, name, parent_group);
group_info->name = name;
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
return true;
}
bool END_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
const char *parent_group)
{
rarch_setting_t value = setting_group_setting (ST_END_GROUP, 0, parent_group);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
return true;
}
bool START_SUB_GROUP(rarch_setting_t **list,
rarch_setting_info_t *list_info, const char *name,
rarch_setting_group_info_t *group_info,
rarch_setting_group_info_t *subgroup_info,
const char *parent_group)
{
rarch_setting_t value = setting_subgroup_setting (ST_SUB_GROUP,
name, group_info->name, parent_group, false);
subgroup_info->name = name;
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
return true;
}
bool END_SUB_GROUP(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
const char *parent_group)
{
rarch_setting_t value = setting_group_setting (ST_END_SUB_GROUP, 0, parent_group);
if (!(settings_list_append(list, list_info)))
return false;
(*list)[list_info->index++] = value;
return true;
}
#ifdef HAVE_MENU
static void menu_input_st_string_cb(void *userdata, const char *str)
{
if (str && *str)
{
rarch_setting_t *setting = NULL;
const char *label = menu_input_dialog_get_label_setting_buffer();
if (!string_is_empty(label))
setting = menu_setting_find(label);
if (setting)
{
setting_set_with_string_representation(setting, str);
menu_setting_generic(setting, false);
}
}
menu_input_dialog_end();
}
static void menu_input_st_uint_cb(void *userdata, const char *str)
{
if (str && *str)
{
const char *label = menu_input_dialog_get_label_setting_buffer();
rarch_setting_t *setting = menu_setting_find(label);
setting_set_with_string_representation(setting, str);
}
menu_input_dialog_end();
}
static void menu_input_st_hex_cb(void *userdata, const char *str)
{
if (str && *str)
{
const char *label = menu_input_dialog_get_label_setting_buffer();
rarch_setting_t *setting = menu_setting_find(label);
if (setting)
{
unsigned *ptr = (unsigned*)setting_get_ptr(setting);
if (str[0] == '#')
str++;
if (ptr)
*ptr = (unsigned)strtoul(str, NULL, 16);
}
}
menu_input_dialog_end();
}
static int setting_generic_action_ok_linefeed(void *data, bool wraparound)
{
menu_input_ctx_line_t line;
input_keyboard_line_complete_t cb = NULL;
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return -1;
(void)wraparound;
switch (setting_get_type(setting))
{
case ST_UINT:
cb = menu_input_st_uint_cb;
break;
case ST_HEX:
cb = menu_input_st_hex_cb;
break;
case ST_STRING:
case ST_STRING_OPTIONS:
cb = menu_input_st_string_cb;
break;
default:
break;
}
line.label = setting->short_description;
line.label_setting = setting->name;
line.type = 0;
line.idx = 0;
line.cb = cb;
if (!menu_input_dialog_start(&line))
return -1;
return 0;
}
#endif
static void setting_add_special_callbacks(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned values)
{
unsigned idx = list_info->index - 1;
if (values & SD_FLAG_ALLOW_INPUT)
{
#ifdef HAVE_MENU
(*list)[idx].action_ok = setting_generic_action_ok_linefeed;
(*list)[idx].action_select = setting_generic_action_ok_linefeed;
#else
(*list)[idx].action_ok = NULL;
(*list)[idx].action_select = NULL;
#endif
switch ((*list)[idx].type)
{
case ST_UINT:
(*list)[idx].action_cancel = NULL;
break;
case ST_HEX:
(*list)[idx].action_cancel = NULL;
break;
case ST_STRING:
(*list)[idx].action_start = setting_string_action_start_generic;
(*list)[idx].action_cancel = NULL;
break;
default:
break;
}
}
}
void settings_data_list_current_add_flags(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned values)
{
(*list)[list_info->index - 1].flags |= values;
setting_add_special_callbacks(list, list_info, values);
}
void settings_data_list_current_add_free_flags(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
unsigned values)
{
(*list)[list_info->index - 1].free_flags |= values;
}
retroarch-mingw-build.sh 0000775 0001750 0001750 00000010443 13272753522 015200 0 ustar sergio sergio #!/bin/sh
###############
# Build script which builds and packages RetroArch for MinGW 32/64-bit.
# Preferably build on Linux with a cross chain ... :D
##########
####
## Tweak these to suit your environment.
## Not defining the variable will avoid building that target.
## Set MINGW32_BASE and/or MINGW64_BASE to set toolchain prefix:
## E.g.: i486-mingw32-gcc would get prefix "i486-mingw32".
BUILD_32BIT=yes
BUILD_64BIT=yes
BUILD_PHOENIX_GUI=yes
if [ ! -z "$NOBUILD_32BIT" ]; then
BUILD_32BIT=no
fi
if [ ! -z "$NOBUILD_64BIT" ]; then
BUILD_64BIT=no
fi
if [ ! -z "$NOBUILD_PHOENIX_GUI" ]; then
BUILD_PHOENIX_GUI=no
fi
########
die()
{
echo "$@"
exit 1
}
message()
{
echo ""
echo "================================"
echo "$@"
echo "================================"
echo ""
}
if [ -z "$MAKE" ]; then
if uname -s | grep -i MINGW32 > /dev/null 2>&1; then
MAKE=mingw32-make
else
if type gmake > /dev/null 2>&1; then
MAKE=gmake
else
MAKE=make
fi
fi
fi
if [ ! -f "`which zip`" ]; then
echo "Cannot find 'zip'. Cannot package, quitting ..."
exit 1
fi
if [ ! -f "`which unzip`" ]; then
echo "Cannot find 'unzip'. Cannot unpack, quitting ..."
exit 1
fi
if [ ! -f "`which wget`" ]; then
echo "Cannot find 'wget'. Cannot unpack, quitting ..."
exit 1
fi
do_phoenix_build()
{
message "Build Phoenix GUI"
### Build Phoenix GUI
if [ ! -d "Phoenix" ]; then
git clone git://github.com/Themaister/RetroArch-Phoenix.git Phoenix
cd Phoenix
else
cd Phoenix
git pull origin master
fi
"${MAKE}" -f Makefile.win clean || die "Failed to clean ..."
"${MAKE}" -f Makefile.win CC="$C_COMPILER" CXX="$CXX_COMPILER" WINDRES="$WINDRES" -j4 all || die "Failed to build ..."
touch retroarch-phoenix.cfg
cp retroarch-phoenix.cfg retroarch-phoenix.exe ../ || die "Failed to copy ..."
cd ..
}
do_build()
{
RetroArch_DIR="$1"
LIBZIPNAME="$2"
BUILDTYPE="$3"
if [ ! -d "$RetroArch_DIR" ]; then
git clone git://github.com/libretro/RetroArch.git "$RetroArch_DIR"
cd "$RetroArch_DIR"
else
cd "$RetroArch_DIR"
git pull origin master
fi
if [ ! -f "$LIBZIPNAME" ]; then
"${MAKE}" -f Makefile.win libs_${BUILDTYPE} || die "Failed to extract"
fi
"${MAKE}" -f Makefile.win clean || die "Failed to clean ..."
"${MAKE}" -f Makefile.win CC="$C_COMPILER" CXX="$CXX_COMPILER" WINDRES="$WINDRES" -j4 all SLIM=1 || die "Failed to build ..."
"${MAKE}" -f Makefile.win CC="$C_COMPILER" CXX="$CXX_COMPILER" WINDRES="$WINDRES" dist_${BUILDTYPE} SLIM=1 || die "Failed to dist ..."
if [ -z "`find . | grep "retroarch-win"`" ]; then
die "Did not find build ..."
fi
if [ "$BUILD_PHOENIX_GUI" = "yes" ]; then
do_phoenix_build
fi
ZIP_BASE="`find . | grep "retroarch-win" | head -n1`"
ZIP_SLIM="`echo $ZIP_BASE | sed -e 's|\.zip|-slim.zip|'`"
ZIP_FULL="`echo $ZIP_BASE | sed -e 's|\.zip|-full.zip|'`"
if [ "$BUILD_PHOENIX_GUI" = "yes" ]; then
zip "$ZIP_BASE" retroarch-phoenix.exe retroarch-phoenix.cfg
fi
mv -v "$ZIP_BASE" "../$ZIP_SLIM" || die "Failed to move final build ..."
"${MAKE}" -f Makefile.win clean || die "Failed to clean ..."
"${MAKE}" -f Makefile.win CC="$C_COMPILER" CXX="$CXX_COMPILER" WINDRES="$WINDRES" HAVE_D3D9=1 -j4 all || die "Failed to build ..."
"${MAKE}" -f Makefile.win CC="$C_COMPILER" CXX="$CXX_COMPILER" WINDRES="$WINDRES" HAVE_D3D9=1 dist_${BUILDTYPE} || die "Failed to dist ..."
if [ "$BUILD_PHOENIX_GUI" = "yes" ]; then
zip "$ZIP_BASE" retroarch-phoenix.exe retroarch-phoenix.cfg
fi
cp -v "$ZIP_BASE" "../$ZIP_FULL" || die "Failed to move final build ..."
mv -v "$ZIP_BASE" ..
zip "../$ZIP_BASE" *.dll retroarch-redist-version || die "Failed to build full/redist ..."
cd ..
}
if [ "$BUILD_32BIT" = yes ]; then
message "Building for 32-bit!"
C_COMPILER="${MINGW32_BASE}-gcc"
CXX_COMPILER="${MINGW32_BASE}-g++"
WINDRES=${MINGW32_BASE}-windres
do_build "RetroArch-w32" "RetroArch-win32-libs.zip" "x86"
fi
if [ "$BUILD_64BIT" = yes ]; then
message "Building for 64-bit!"
C_COMPILER=${MINGW64_BASE}-gcc
CXX_COMPILER=${MINGW64_BASE}-g++
WINDRES=${MINGW64_BASE}-windres
do_build "RetroArch-w64" "RetroArch-win64-libs.zip" "x86_64"
fi
message "Built successfully! :)"
retroarch-android-debug.diff 0000664 0001750 0001750 00000003120 13272753522 015753 0 ustar sergio sergio diff --git a/pkg/android/phoenix/AndroidManifest.xml b/pkg/android/phoenix/AndroidManifest.xml
index ce2114c..12d8fbb 100644
--- a/pkg/android/phoenix/AndroidManifest.xml
+++ b/pkg/android/phoenix/AndroidManifest.xml
@@ -21,7 +21,8 @@
android:label="RetroArch"
android:hasCode="true"
android:isGame="true"
- android:banner="@drawable/banner">
+ android:banner="@drawable/banner"
+ android:debuggable="true">
diff --git a/pkg/android/phoenix/build.xml b/pkg/android/phoenix/build.xml
index 9698a04..6b2c101 100644
--- a/pkg/android/phoenix/build.xml
+++ b/pkg/android/phoenix/build.xml
@@ -96,7 +96,7 @@
+ replace="\1true\2"/>
diff --git a/pkg/android/phoenix/jni/Application.mk b/pkg/android/phoenix/jni/Application.mk
index b179dbf..84ade89 100644
--- a/pkg/android/phoenix/jni/Application.mk
+++ b/pkg/android/phoenix/jni/Application.mk
@@ -1,3 +1,5 @@
+APP_OPTIM := debug
+
ifeq ($(GLES),3)
ifndef NDK_GL_HEADER_VER
APP_PLATFORM := android-18
retroarch.h 0000664 0001750 0001750 00000020663 13272753522 012603 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see .
*/
#ifndef __RETROARCH_H
#define __RETROARCH_H
#include
#include
#include
#include
#include
#include "core_type.h"
#include "core.h"
RETRO_BEGIN_DECLS
enum rarch_ctl_state
{
RARCH_CTL_NONE = 0,
/* Initialize all drivers. */
RARCH_CTL_INIT,
/* Deinitializes RetroArch. */
RARCH_CTL_MAIN_DEINIT,
RARCH_CTL_IS_INITED,
RARCH_CTL_IS_DUMMY_CORE,
RARCH_CTL_PREINIT,
RARCH_CTL_DESTROY,
RARCH_CTL_IS_BPS_PREF,
RARCH_CTL_UNSET_BPS_PREF,
RARCH_CTL_IS_PATCH_BLOCKED,
RARCH_CTL_SET_PATCH_BLOCKED,
RARCH_CTL_UNSET_PATCH_BLOCKED,
RARCH_CTL_IS_UPS_PREF,
RARCH_CTL_UNSET_UPS_PREF,
RARCH_CTL_IS_IPS_PREF,
RARCH_CTL_UNSET_IPS_PREF,
RARCH_CTL_IS_SRAM_USED,
RARCH_CTL_SET_SRAM_ENABLE,
RARCH_CTL_SET_SRAM_ENABLE_FORCE,
RARCH_CTL_UNSET_SRAM_ENABLE,
RARCH_CTL_IS_SRAM_LOAD_DISABLED,
RARCH_CTL_IS_SRAM_SAVE_DISABLED,
/* Block config read */
RARCH_CTL_SET_BLOCK_CONFIG_READ,
RARCH_CTL_UNSET_BLOCK_CONFIG_READ,
RARCH_CTL_IS_BLOCK_CONFIG_READ,
/* Username */
RARCH_CTL_HAS_SET_USERNAME,
RARCH_CTL_USERNAME_SET,
RARCH_CTL_USERNAME_UNSET,
RARCH_CTL_SET_FRAME_LIMIT,
RARCH_CTL_TASK_INIT,
RARCH_CTL_FRAME_TIME_FREE,
RARCH_CTL_SET_FRAME_TIME_LAST,
RARCH_CTL_SET_FRAME_TIME,
RARCH_CTL_IS_IDLE,
RARCH_CTL_SET_IDLE,
RARCH_CTL_GET_WINDOWED_SCALE,
RARCH_CTL_SET_WINDOWED_SCALE,
RARCH_CTL_IS_OVERRIDES_ACTIVE,
RARCH_CTL_SET_OVERRIDES_ACTIVE,
RARCH_CTL_UNSET_OVERRIDES_ACTIVE,
RARCH_CTL_IS_REMAPS_CORE_ACTIVE,
RARCH_CTL_SET_REMAPS_CORE_ACTIVE,
RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE,
RARCH_CTL_IS_REMAPS_GAME_ACTIVE,
RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE,
RARCH_CTL_IS_MISSING_BIOS,
RARCH_CTL_SET_MISSING_BIOS,
RARCH_CTL_UNSET_MISSING_BIOS,
RARCH_CTL_IS_GAME_OPTIONS_ACTIVE,
RARCH_CTL_IS_NONBLOCK_FORCED,
RARCH_CTL_SET_NONBLOCK_FORCED,
RARCH_CTL_UNSET_NONBLOCK_FORCED,
RARCH_CTL_SET_LIBRETRO_PATH,
RARCH_CTL_IS_PAUSED,
RARCH_CTL_SET_PAUSED,
RARCH_CTL_SET_CORE_SHUTDOWN,
RARCH_CTL_SET_SHUTDOWN,
RARCH_CTL_IS_SHUTDOWN,
/* Runloop state */
RARCH_CTL_STATE_FREE,
/* Performance counters */
RARCH_CTL_GET_PERFCNT,
RARCH_CTL_SET_PERFCNT_ENABLE,
RARCH_CTL_UNSET_PERFCNT_ENABLE,
RARCH_CTL_IS_PERFCNT_ENABLE,
/* Key event */
RARCH_CTL_FRONTEND_KEY_EVENT_GET,
RARCH_CTL_KEY_EVENT_GET,
RARCH_CTL_DATA_DEINIT,
/* Core options */
RARCH_CTL_HAS_CORE_OPTIONS,
RARCH_CTL_GET_CORE_OPTION_SIZE,
RARCH_CTL_IS_CORE_OPTION_UPDATED,
RARCH_CTL_CORE_OPTIONS_LIST_GET,
RARCH_CTL_CORE_OPTION_PREV,
RARCH_CTL_CORE_OPTION_NEXT,
RARCH_CTL_CORE_OPTIONS_GET,
RARCH_CTL_CORE_OPTIONS_INIT,
RARCH_CTL_CORE_OPTIONS_DEINIT,
/* System info */
RARCH_CTL_SYSTEM_INFO_INIT,
RARCH_CTL_SYSTEM_INFO_FREE,
/* HTTP server */
RARCH_CTL_HTTPSERVER_INIT,
RARCH_CTL_HTTPSERVER_DESTROY
};
enum rarch_capabilities
{
RARCH_CAPABILITIES_NONE = 0,
RARCH_CAPABILITIES_CPU,
RARCH_CAPABILITIES_COMPILER
};
enum rarch_override_setting
{
RARCH_OVERRIDE_SETTING_NONE = 0,
RARCH_OVERRIDE_SETTING_LIBRETRO,
RARCH_OVERRIDE_SETTING_VERBOSITY,
RARCH_OVERRIDE_SETTING_LIBRETRO_DIRECTORY,
RARCH_OVERRIDE_SETTING_SAVE_PATH,
RARCH_OVERRIDE_SETTING_STATE_PATH,
RARCH_OVERRIDE_SETTING_NETPLAY_MODE,
RARCH_OVERRIDE_SETTING_NETPLAY_IP_ADDRESS,
RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT,
RARCH_OVERRIDE_SETTING_NETPLAY_STATELESS_MODE,
RARCH_OVERRIDE_SETTING_NETPLAY_CHECK_FRAMES,
RARCH_OVERRIDE_SETTING_UPS_PREF,
RARCH_OVERRIDE_SETTING_BPS_PREF,
RARCH_OVERRIDE_SETTING_IPS_PREF,
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE,
RARCH_OVERRIDE_SETTING_LAST
};
enum runloop_action
{
RUNLOOP_ACTION_NONE = 0,
RUNLOOP_ACTION_AUTOSAVE
};
struct rarch_main_wrap
{
char **argv;
const char *content_path;
const char *sram_path;
const char *state_path;
const char *config_path;
const char *libretro_path;
bool verbose;
bool no_content;
bool touched;
int argc;
};
typedef struct rarch_resolution
{
unsigned idx;
unsigned id;
} rarch_resolution_t;
/* All run-time- / command line flag-related globals go here. */
typedef struct global
{
struct
{
char savefile[8192];
char savestate[8192];
char cheatfile[8192];
char ups[8192];
char bps[8192];
char ips[8192];
char label[8192];
char *remapfile;
} name;
/* Recording. */
struct
{
bool use_output_dir;
char path[8192];
char config[8192];
char output_dir[8192];
char config_dir[8192];
unsigned width;
unsigned height;
size_t gpu_width;
size_t gpu_height;
} record;
/* Settings and/or global state that is specific to
* a console-style implementation. */
struct
{
bool flickerfilter_enable;
bool softfilter_enable;
struct
{
bool pal_enable;
bool pal60_enable;
unsigned char soft_filter_index;
unsigned gamma_correction;
unsigned int flicker_filter_index;
struct
{
bool check;
unsigned count;
uint32_t *list;
rarch_resolution_t current;
rarch_resolution_t initial;
} resolutions;
} screen;
} console;
} global_t;
bool rarch_ctl(enum rarch_ctl_state state, void *data);
int retroarch_get_capabilities(enum rarch_capabilities type,
char *s, size_t len);
void retroarch_override_setting_set(enum rarch_override_setting enum_idx, void *data);
void retroarch_override_setting_unset(enum rarch_override_setting enum_idx, void *data);
bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data);
bool retroarch_validate_game_options(char *s, size_t len, bool mkdir);
bool retroarch_is_forced_fullscreen(void);
void retroarch_unset_forced_fullscreen(void);
void retroarch_set_current_core_type(enum rarch_core_type type, bool explicitly_set);
void retroarch_set_shader_preset(const char* preset);
void retroarch_unset_shader_preset(void);
char* retroarch_get_shader_preset(void);
/**
* retroarch_fail:
* @error_code : Error code.
* @error : Error message to show.
*
* Sanely kills the program.
**/
void retroarch_fail(int error_code, const char *error);
/**
* retroarch_main_init:
* @argc : Count of (commandline) arguments.
* @argv : (Commandline) arguments.
*
* Initializes the program.
*
* Returns: 1 (true) on success, otherwise false (0) if there was an error.
**/
bool retroarch_main_init(int argc, char *argv[]);
bool retroarch_main_quit(void);
global_t *global_get_ptr(void);
/**
* runloop_iterate:
*
* Run Libretro core in RetroArch for one frame.
*
* Returns: 0 on successful run,
* Returns 1 if we have to wait until button input in order
* to wake up the loop.
* Returns -1 if we forcibly quit out of the
* RetroArch iteration loop.
**/
int runloop_iterate(unsigned *sleep_ms);
void runloop_msg_queue_push(const char *msg, unsigned prio,
unsigned duration, bool flush);
bool runloop_msg_queue_pull(const char **ret);
void runloop_get_status(bool *is_paused, bool *is_idle, bool *is_slowmotion,
bool *is_perfcnt_enable);
void runloop_set(enum runloop_action action);
void runloop_unset(enum runloop_action action);
void rarch_menu_running(void);
void rarch_menu_running_finished(void);
bool retroarch_is_on_main_thread(void);
rarch_system_info_t *runloop_get_system_info(void);
#ifdef HAVE_THREADS
void runloop_msg_queue_lock(void);
void runloop_msg_queue_unlock(void);
#endif
#ifdef HAVE_DYNAMIC
bool retroarch_core_set_on_cmdline(void);
#endif
RETRO_END_DECLS
#endif
retroarch.desktop 0000664 0001750 0001750 00000000635 13272753522 014022 0 ustar sergio sergio [Desktop Entry]
Version=1.0
Name=RetroArch
GenericName=RetroArch
Type=Application
Comment=Frontend for emulators, game engines and media players
Comment[ru]=ГрафичеÑкий Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ð´Ð»Ñ ÑмулÑторов, игровых движков и медиаплееров
Icon=retroarch
Exec=retroarch
Terminal=false
StartupNotify=false
Keywords=multi;engine;emulator;xmb;
Categories=Game;Emulator;
retroarch.cfg 0000664 0001750 0001750 00000070210 13272753522 013104 0 ustar sergio sergio ## Skeleton config file for RetroArch
# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ...
# This will be overridden by explicit command line options.
# savefile_directory =
# Save all save states (*.state) to this directory.
# This will be overridden by explicit command line options.
# savestate_directory =
# If set to a directory, content which is temporarily extracted
# will be extracted to this directory.
# cache_directory =
# Save all downloaded files to this directory.
# core_assets_directory =
# Save all remapped controls to this directory.
# input_remapping_directory =
# Save all playlists/collections to this directory.
# playlist_directory =
# If set to a directory, the content history playlist will be saved
# to this directory.
# content_history_dir =
# Saved queries are stored to this directory.
# cursor_directory =
# Automatically saves a savestate at the end of RetroArch's lifetime.
# The path is $SRAM_PATH.auto.
# RetroArch will automatically load any savestate with this path on startup if savestate_auto_load is set.
# savestate_auto_save = false
# savestate_auto_load = true
# Load libretro from a dynamic location for dynamically built RetroArch.
# This option is mandatory.
# Path to a libretro implementation.
# libretro_path = "/path/to/libretro.so"
# A directory for where to search for libretro core implementations.
# libretro_directory =
# A directory for where to search for libretro core information.
# libretro_info_path =
# Sets log level for libretro cores (GET_LOG_INTERFACE).
# If a log level issued by a libretro core is below libretro_log_level, it is ignored.
# DEBUG logs are always ignored unless verbose mode is activated (--verbose).
# DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3.
# libretro_log_level = 0
# Enable or disable verbosity level of frontend.
# log_verbosity = false
# If this option is enabled, every content file loaded in RetroArch will be
# automatically added to a history list.
# history_list_enable = true
# Enable performance counters
# perfcnt_enable = false
# Path to core options config file.
# This config file is used to expose core-specific options.
# It will be written to by RetroArch.
# A default path will be assigned if not set.
# core_options_path =
# Path to content history file.
# RetroArch keeps track of all content loaded in the menu and from CLI directly for convenient quick loading.
# A default path will be assigned if not set.
# content_history_path =
# Path to music content history file (optional).
# RetroArch keeps track of all music content loaded in the menu and from CLI directly for convenient quick loading.
# A default path will be assigned if not set.
# content_music_history_path =
# Path to image content history file (optional).
# RetroArch keeps track of all image content loaded in the menu and from CLI directly for convenient quick loading.
# A default path will be assigned if not set.
# content_image_history_path =
# Path to video content history file (optional).
# RetroArch keeps track of all video content loaded in the menu and from CLI directly for convenient quick loading.
# A default path will be assigned if not set.
# content_video_history_path =
# Number of entries that will be kept in content history file.
# content_history_size = 100
# Sets the "system" directory.
# Implementations can query for this directory to load BIOSes, system-specific configs, etc.
# system_directory =
# Sets start directory for menu file browser.
# rgui_browser_directory =
# Content directory. Interacts with RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY.
# Usually set by developers who bundle libretro/RetroArch apps to point to assets.
# content_directory =
# Assets directory. This location is queried by default when menu interfaces try to look for
# loadable assets, etc.
# assets_directory =
# Dynamic wallpapers directory. The place to store the wallpapers dynamically
# loaded by the menu depending on context.
# dynamic_wallpapers_directory =
# Thumbnails directory. To store thumbnail files.
# thumbnails_directory =
# Sets start directory for menu config browser.
# rgui_config_directory =
# Show startup screen in menu.
# Is automatically set to false when seen for the first time.
# This is only updated in config if config_save_on_exit is set to true, however.
# rgui_show_start_screen = true
# Flushes config to disk on exit. Useful for menu as settings can be modified.
# Overwrites the config. #include's and comments are not preserved.
# config_save_on_exit = true
# Shows hidden files and folders in directory listings.
# show_hidden_files = false
#### Video
# Video driver to use. "gl", "xvideo", "sdl", "d3d"
# video_driver = "gl"
# Which context implementation to use.
# Possible ones for desktop are: glx, x-egl, kms-egl, sdl-gl, wgl.
# By default, tries to use first suitable driver.
# video_context_driver =
# Windowed x resolution scale and y resolution scale
# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale)
# video_scale = 3.0
# Fullscreen resolution. Resolution of 0 uses the resolution of the desktop.
# video_fullscreen_x = 0
# video_fullscreen_y = 0
# Start in fullscreen. Can be changed at runtime.
# video_fullscreen = false
# If fullscreen, prefer using a windowed fullscreen mode.
# video_windowed_fullscreen = true
# Percentage of opacity to use for the window (100 is completely opaque).
# video_window_opacity = 100
# Whether to enable the default window decorations like border, titlebar etc.
# video_window_show_decorations = true
# Which monitor to prefer. 0 (default) means no particular monitor is preferred, 1 and up (1 being first monitor),
# suggests RetroArch to use that particular monitor.
# video_monitor_index = 0
# Forcibly disable composition. Only works in Windows Vista/7 for now.
# video_disable_composition = false
# Video vsync.
# video_vsync = true
# Interval at which a Vsync swap is performed.
# 1 is normal, 2 is doubled frames, 3 is tripled frames, etc.
# video_swap_interval = 1
# Max amount of swapchain images.
# Single buffering = 1, Double buffering = 2, 3 = Triple buffering
# video_max_swapchain_images = 3
# Forcibly disable sRGB FBO support. Some Intel OpenGL drivers on Windows
# have video problems with sRGB FBO support enabled.
# video_force_srgb_disable = false
# Attempts to hard-synchronize CPU and GPU. Can reduce latency at cost of performance.
# video_hard_sync = false
# Sets how many frames CPU can run ahead of GPU when using video_hard_sync.
# Maximum is 3.
# video_hard_sync_frames = 0
# Sets how many milliseconds to delay after VSync before running the core.
# Can reduce latency at cost of higher risk of stuttering.
# Maximum is 15.
# video_frame_delay = 0
# Inserts a black frame inbetween frames.
# Useful for 120 Hz monitors who want to play 60 Hz material with eliminated ghosting.
# video_refresh_rate should still be configured as if it is a 60 Hz monitor (divide refresh rate by 2).
# video_black_frame_insertion = false
# Use threaded video driver. Using this might improve performance at possible cost of latency and more video stuttering.
# video_threaded = false
# Use a shared context for HW rendered libretro cores.
# Avoids having to assume HW state changes inbetween frames.
# video_shared_context = false
# Smoothens picture with bilinear filtering. Should be disabled if using pixel shaders.
# video_smooth = true
# Forces rendering area to stay equal to content aspect ratio or as defined in video_aspect_ratio.
# video_force_aspect = true
# Only scales video in integer steps.
# The base size depends on system-reported geometry and aspect ratio.
# If video_force_aspect is not set, X/Y will be integer scaled independently.
# video_scale_integer = false
# Index of the aspect ratio selection in the menu.
# 19 = Config, 20 = 1:1 PAR, 21 = Core Provided, 22 = Custom Aspect Ratio
# aspect_ratio_index = 19
# A floating point value for video aspect ratio (width / height).
# If this is not set, aspect ratio is assumed to be automatic.
# Behavior then is defined by video_aspect_ratio_auto.
# video_aspect_ratio =
# If this is true and video_aspect_ratio is not set,
# aspect ratio is decided by libretro implementation.
# If this is false, 1:1 PAR will always be assumed if video_aspect_ratio is not set.
# video_aspect_ratio_auto = false
# Forces cropping of overscanned frames.
# Exact behavior of this option is implementation specific.
# video_crop_overscan = true
# Path to shader. Shader can be either Cg, CGP (Cg preset) or GLSL, GLSLP (GLSL preset)
# video_shader = "/path/to/shader.{cg,cgp,glsl,glslp}"
# Load video_shader on startup.
# Other shaders can still be loaded later in runtime.
# video_shader_enable = false
# Defines a directory where shaders (Cg, CGP, GLSL) are kept for easy access.
# video_shader_dir =
# CPU-based video filter. Path to a dynamic library.
# video_filter =
# Defines a directory where CPU-based video filters are kept.
# video_filter_dir =
# Path to a font used for rendering messages. This path must be defined to enable fonts.
# Do note that the _full_ path of the font is necessary!
# video_font_path =
# Size of the font rendered in points.
# video_font_size = 32
# Enable usage of OSD messages.
# video_font_enable = true
# Offset for where messages will be placed on screen. Values are in range 0.0 to 1.0 for both x and y values.
# [0.0, 0.0] maps to the lower left corner of the screen.
# video_message_pos_x = 0.05
# video_message_pos_y = 0.05
# Color for message. The value is treated as a hexadecimal value.
# It is a regular RGB hex number, i.e. red is "ff0000".
# video_message_color = ffffff
# Background color for OSD messages. Red/Green/Blue values are from 0 to 255 and opacity is 0.0 to 1.0.
video_message_bgcolor_enable = false
video_message_bgcolor_red = 0
video_message_bgcolor_green = 0
video_message_bgcolor_blue = 0
video_message_bgcolor_opacity = 1.0
# Video refresh rate of your monitor.
# Used to calculate a suitable audio input rate.
# video_refresh_rate = 59.94
# Allows libretro cores to set rotation modes.
# Setting this to false will honor, but ignore this request.
# This is useful for vertically oriented content where one manually rotates the monitor.
# video_allow_rotate = true
# Forces a certain rotation of the screen.
# The rotation is added to rotations which the libretro core sets (see video_allow_rotate).
# The angle is * 90 degrees counter-clockwise.
# video_rotation = 0
#### Audio
# Enable audio.
# audio_enable = true
# Mutes audio.
# audio_mute_enable = false
# Mutes audio mixer volume globally.
# audio_mixer_mute_enable = false
# Audio output samplerate.
# audio_out_rate = 48000
# Audio resampler backend. Which audio resampler to use.
# Default will use "sinc".
# audio_resampler =
# Audio driver backend. Depending on configuration possible candidates are: alsa, pulse, oss, jack, rsound, roar, openal, sdl, xaudio.
# audio_driver =
# Override the default audio device the audio_driver uses. This is driver dependant. E.g. ALSA wants a PCM device, OSS wants a path (e.g. /dev/dsp), Jack wants portnames (e.g. system:playback1,system:playback_2), and so on ...
# audio_device =
# Audio DSP plugin that processes audio before it's sent to the driver. Path to a dynamic library.
# audio_dsp_plugin =
# Directory where DSP plugins are kept.
# audio_filter_dir =
# Will sync (block) on audio. Recommended.
# audio_sync = true
# Desired audio latency in milliseconds. Might not be honored if driver can't provide given latency.
# audio_latency = 64
# Enable audio rate control.
# audio_rate_control = true
# Controls audio rate control delta. Defines how much input rate can be adjusted dynamically.
# Input rate = in_rate * (1.0 +/- audio_rate_control_delta)
# audio_rate_control_delta = 0.005
# Controls maximum audio timing skew. Defines the maximum change in input rate.
# Input rate = in_rate * (1.0 +/- max_timing_skew)
# audio_max_timing_skew = 0.05
# Audio volume. Volume is expressed in dB.
# 0 dB is normal volume. No gain will be applied.
# Gain can be controlled in runtime with input_volume_up/input_volume_down.
# audio_volume = 0.0
# Audio mixer volume. Volume is expressed in dB.
# 0 dB is normal volume. No gain will be applied.
# audio_mixer_volume = 0.0
#### Overlay
# Defines a directory where overlays are kept for easy access.
# overlay_directory =
# Enable the overlay.
# input_overlay_enable = true
# Hide the current overlay from appearing inside the menu.
# input_overlay_hide_in_menu = true
# Path to input overlay.
# input_overlay =
# Opacity of all the UI elements of the overlay.
# input_overlay_opacity = 1.0
# Scale of all UI elements of the overlay.
# input_overlay_scale = 1.0
#### Input
# Input driver. Depending on video driver, it might force a different input driver.
# input_driver = sdl
# Joypad driver. (Valid: linuxraw, sdl, dinput)
# input_joypad_driver =
# Path to input remapping file.
# input_remapping_path =
# Input bind timer timeout.
# Amount of seconds to wait until proceeding to the next bind. Default: 5, minimum: 1
# input_bind_timeout = 1
# If enabled, overrides the input binds with the remapped binds set for the current core.
# input_remap_binds_enable = true
# Maximum amount of users supported by RetroArch.
# input_max_users = 16
# Keyboard layout for input driver if applicable (udev/evdev for now).
# Syntax is either just layout (e.g. "no"), or a layout and variant separated with colon ("no:nodeadkeys").
# input_keyboard_layout =
# Defines axis threshold. Possible values are [0.0, 1.0]
# input_axis_threshold = 0.5
# Enable input auto-detection. Will attempt to autoconfigure
# joypads, Plug-and-Play style.
# input_autodetect_enable = true
# Show the input descriptors set by the core instead of the
# default ones.
# input_descriptor_label_show = true
# Hide input descriptors that were not set by the core.
# input_descriptor_hide_unbound = false
# Influence how input polling is done inside RetroArch.
# 0 : Early - Input polling is performed before call to retro_run.
# 1 : Normal - Input polling is performed when retro_input_poll is
# requested.
# 2 : Late - Input polling is performed on first call to retro_input_state
# per frame
#
# Setting it to 0 or 2 can result in less latency depending on
# your configuration.
#
# When netplay is enabled, the default polling behavior (1) will
# be used regardless of the value set here.
# input_poll_type_behavior = 1
# Directory for joypad autoconfigs.
# If a joypad is plugged in, that joypad will be autoconfigured if a config file
# corresponding to that joypad is present in joypad_autoconfig_dir.
# Input binds which are made explicit (input_playerN_*_btn/axis) will take priority over autoconfigs.
# Autoconfigs can be created with retroarch-joyconfig, manually, or with a frontend.
# Requires input_autodetect_enable to be enabled.
# joypad_autoconfig_dir =
# Sets which libretro device is used for a user.
# Devices are indentified with a number.
# This is normally saved by the menu.
# Device IDs are found in libretro.h.
# These settings are overridden by explicit command-line arguments which refer to input devices.
# None: 0
# Joypad (RetroPad): 1
# Mouse: 2
# Keyboard: 3
# Generic Lightgun: 4
# Joypad w/ Analog (RetroPad + Analog sticks): 5
# Multitap (SNES specific): 257
# Super Scope (SNES specific): 260
# Justifier (SNES specific): 516
# Justifiers (SNES specific): 772
# input_libretro_device_p1 =
# input_libretro_device_p2 =
# input_libretro_device_p3 =
# input_libretro_device_p4 =
# input_libretro_device_p5 =
# input_libretro_device_p6 =
# input_libretro_device_p7 =
# input_libretro_device_p8 =
# Keyboard input. Will recognize letters ("a" to "z") and the following special keys (where "kp_"
# is for keypad keys):
#
# left, right, up, down, enter, kp_enter, tab, insert, del, end, home,
# rshift, shift, ctrl, alt, space, escape, add, subtract, kp_plus, kp_minus,
# f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12,
# num0, num1, num2, num3, num4, num5, num6, num7, num8, num9, pageup, pagedown,
# keypad0, keypad1, keypad2, keypad3, keypad4, keypad5, keypad6, keypad7, keypad8, keypad9,
# period, capslock, numlock, backspace, multiply, divide, print_screen, scroll_lock,
# tilde, backquote, pause, quote, comma, minus, slash, semicolon, equals, leftbracket,
# backslash, rightbracket, kp_period, kp_equals, rctrl, ralt
#
# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely,
# rather than relying on a default.
# input_player1_a = "x"
# input_player1_b = "z"
# input_player1_y = "a"
# input_player1_x = "s"
# input_player1_start = "enter"
# input_player1_select = "rshift"
# input_player1_l = "q"
# input_player1_r = "w"
# input_player1_left = "left"
# input_player1_right = "right"
# input_player1_up = "up"
# input_player1_down = "down"
# input_player1_l2 =
# input_player1_r2 =
# input_player1_l3 =
# input_player1_r3 =
# Two analog sticks (DualShock-esque).
# Bound as usual, however, if a real analog axis is bound,
# it can be read as a true analog.
# Positive X axis is right, Positive Y axis is down.
# input_player1_l_x_plus =
# input_player1_l_x_minus =
# input_player1_l_y_plus =
# input_player1_l_y_minus =
# input_player1_r_x_plus =
# input_player1_r_x_minus =
# input_player1_r_y_plus =
# input_player1_r_y_minus =
# If desired, it is possible to override which joypads are being used for user 1 through 8.
# First joypad available is 0.
# input_player1_joypad_index = 0
# input_player2_joypad_index = 1
# input_player3_joypad_index = 2
# input_player4_joypad_index = 3
# input_player5_joypad_index = 4
# input_player6_joypad_index = 5
# input_player7_joypad_index = 6
# input_player8_joypad_index = 7
# Input device buttons.
# Figure these out by using RetroArch-Phoenix or retroarch-joyconfig.
# You can use joypad hats with hnxx, where n is the hat, and xx is a string representing direction.
# E.g. "h0up"
# input_player1_a_btn =
# input_player1_b_btn =
# input_player1_y_btn =
# input_player1_x_btn =
# input_player1_start_btn =
# input_player1_select_btn =
# input_player1_l_btn =
# input_player1_r_btn =
# input_player1_left_btn =
# input_player1_right_btn =
# input_player1_up_btn =
# input_player1_down_btn =
# input_player1_l2_btn =
# input_player1_r2_btn =
# input_player1_l3_btn =
# input_player1_r3_btn =
# Menu buttons.
# menu_search_btn =
# menu_info_btn =
# menu_default_btn =
# menu_scroll_down_btn =
# menu_scroll_up_btn =
# Swap buttons for OK/Cancel
# menu_swap_ok_cancel_buttons = false
# Axis for RetroArch D-Pad.
# Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number.
# Do note that every other input option has the corresponding _btn and _axis binds as well; they are omitted here for clarity.
# input_player1_left_axis =
# input_player1_right_axis =
# input_player1_up_axis =
# input_player1_down_axis =
# Holding the turbo while pressing another button will let the button enter a turbo mode
# where the button state is modulated with a periodic signal.
# The modulation stops when the button itself (not turbo button) is released.
# input_player1_turbo =
# Describes the period and how long of that period a turbo-enabled button should behave.
# Numbers are described in frames.
# input_turbo_period = 6
# input_turbo_duty_cycle = 3
# This goes all the way to user 8 (*_player2_*, *_player3_*, etc), but omitted for clarity.
# All input binds have corresponding binds for keyboard (none), joykeys (_btn) and joyaxes (_axis) as well.
# Toggles fullscreen.
# input_toggle_fullscreen = f
# Saves state.
# input_save_state = f2
# Loads state.
# input_load_state = f4
# State slots. With slot set to 0, save state name is *.state (or whatever defined on commandline).
# When slot is != 0, path will be $path%d, where %d is slot number.
# input_state_slot_increase = f7
# input_state_slot_decrease = f6
# Toggles between fast-forwarding and normal speed.
# input_toggle_fast_forward = space
# Hold for fast-forward. Releasing button disables fast-forward.
# input_hold_fast_forward = l
# Key to exit RetroArch cleanly.
# Killing it in any hard way (SIGKILL, etc) will terminate RetroArch without saving RAM, etc.
# On Unix-likes, SIGINT/SIGTERM allows a clean deinitialization.
# input_exit_emulator = escape
# Applies next and previous shader in directory.
# input_shader_next = m
# input_shader_prev = n
# Hold button down to rewind. Rewinding must be enabled.
# input_rewind = r
# Toggle between recording and not.
# input_movie_record_toggle = o
# Toggle between paused and non-paused state
# input_pause_toggle = p
# Frame advance when content is paused
# input_frame_advance = k
# Reset the content.
# input_reset = h
# Cheats.
# input_cheat_index_plus = y
# input_cheat_index_minus = t
# input_cheat_toggle = u
# Mute/unmute audio
# input_audio_mute = f9
# Take screenshot
# input_screenshot = f8
# Netplay flip users.
# input_netplay_flip_players = i
# Hold for slowmotion.
# input_slowmotion = e
# Enable other hotkeys.
# If this hotkey is bound to either keyboard, joybutton or joyaxis,
# all other hotkeys will be disabled unless this hotkey is also held at the same time.
# This is useful for RETRO_KEYBOARD centric implementations
# which query a large area of the keyboard, where it is not desirable
# that hotkeys get in the way.
# Alternatively, all hotkeys for keyboard could be disabled by the user.
# input_enable_hotkey_btn =
# Increases audio volume.
# input_volume_up = kp_plus
# Decreases audio volume.
# input_volume_down = kp_minus
# Toggles to next overlay. Wraps around.
# input_overlay_next =
# Toggles eject for disks. Used for multiple-disk content.
# input_disk_eject_toggle =
# Cycles through disk images. Use after ejecting.
# Complete by toggling eject again.
# input_disk_next =
# Toggles menu.
# input_menu_toggle = f1
# RetroPad button combination to toggle menu
# 0 = none, 1 = L + R + Y + D-Pad Down, 2 = L3 + R3, 3 = Start + Select
# input_menu_toggle_gamepad_combo = 0
# allow any RetroPad to control the menu
# all_users_control_menu = false
# Toggles mouse grab. When mouse is grabbed, RetroArch hides the mouse,
# and keeps the mouse pointer inside the window to allow relative mouse input
# to work better.
# input_grab_mouse_toggle = f11
#### Menu
# Menu driver to use. "rgui", "lakka", etc.
# menu_driver = "rgui"
# If disabled, will hide 'Online Updater' inside the menu.
# menu_show_online_updater = true
# If disabled, will hide the ability to update cores (and core info files) inside the menu.
# menu_show_core_updater = true
# If disabled, the libretro core will keep running in the background when we
# are in the menu.
# menu_pause_libretro = false
# If disabled, we use separate controls for menu operation.
# menu_unified_controls = false
# Enable mouse controls inside the menu.
# menu_mouse_enable = false
# Enable touch controls inside the menu.
# menu_pointer_enable = false
# Shows current date and/or time inside menu.
# menu_timedate_enable = true
# Shows current battery level inside menu.
# menu_battery_level_enable = true
# Shows current core inside menu.
# menu_core_enable = true
# Path to an image to set as menu wallpaper.
# menu_wallpaper =
# Dynamically load a new wallpaper depending on context.
# menu_dynamic_wallpaper_enable = false
# Type of thumbnail to display. 0 = none, 1 = snaps, 2 = titles, 3 = boxarts
# menu_thumbnails = 0
# menu_left_thumbnails = 0
# Wrap-around to beginning and/or end if boundary of list is reached horizontally or vertically.
# menu_navigation_wraparound_enable = false
# Filter files being shown in filebrowser by supported extensions.
# menu_navigation_browser_filter_supported_extensions_enable = true
# Collapse subgroup settings into main group to create one big listing of settings
# per category.
# menu_collapse_subgroups_enable = false
#### Core
#
# Prevent libretro cores from closing RetroArch on exit by loading a dummy core.
# load_dummy_on_core_shutdown = "true"
# Check for firmware requirement(s) before loading a content.
# check_firmware_before_loading = "false"
#### User Interface
# Suspends the screensaver if set to true. Is a hint that does not necessarily have to be honored
# by video driver.
# suspend_screensaver_enable = true
# Start UI companion driver's interface on boot (if available).
# ui_companion_start_on_boot = true
# Toggle companion UI on startup (currently only used to show the WIMP UI)
# ui_companion_toggle = false
# Only init the WIMP UI for this session if this is enabled
# desktop_menu_enable = true
#### Camera
# Override the default camera device the camera driver uses. This is driver dependant.
# camera_device =
# Override the default privacy permission for cores that want to access camera services. Is "false" by default.
# camera_allow = false
#### Location
# Override the default privacy permission for cores that want to access location services. Is "false" by default.
# location_allow = false
#### Core Updater
# URL to core update directory on buildbot.
# core_updater_buildbot_url = "http://buildbot.libretro.com"
# URL to assets update directory on buildbot.
# core_updater_buildbot_assets_url = "http://buildbot.libretro.com/assets/"
# After downloading, automatically extract archives that the downloads are contained inside.
# core_updater_auto_extract_archive = true
#### Network
# When being client over netplay, use keybinds for user 1.
# netplay_client_swap_input = false
# The username of the person running RetroArch. This will be used for playing online, for instance.
# netplay_nickname =
# The amount of delay frames to use for netplay. Increasing this value will increase
# performance, but introduce more latency.
# netplay_delay_frames = 0
# Netplay mode for the current user.
# false is Server, true is Client.
# netplay_mode = false
# Enable or disable spectator mode for the user during netplay.
# netplay_spectator_mode_enable = false
# The IP Address of the host to connect to.
# netplay_ip_address =
# The port of the host IP Address. Can be either a TCP or UDP port.
# netplay_ip_port = 55435
# Force game hosting to go through a man-in-the-middle server to get around firewalls and NAT/UPnP problems.
# netplay_use_mitm_server = false
# The requested MITM server to use.
# netplay_mitm_server = "nyc"
#### Misc
# Enable rewinding. This will take a performance hit when playing, so it is disabled by default.
# rewind_enable = false
# Rewinding buffer size in megabytes. Bigger rewinding buffer means you can rewind longer.
# The buffer should be approx. 20MB per minute of buffer time.
# rewind_buffer_size = 20
# Rewind granularity. When rewinding defined number of frames, you can rewind several frames at a time, increasing the rewinding speed.
# rewind_granularity = 1
# Pause gameplay when window focus is lost.
# pause_nonactive = true
# Autosaves the non-volatile SRAM at a regular interval. This is disabled by default unless set otherwise.
# The interval is measured in seconds. A value of 0 disables autosave.
# autosave_interval =
# Path to content database directory.
# content_database_path =
# Path to cheat database directory.
# cheat_database_path =
# Directory to dump screenshots to.
# screenshot_directory =
# Records video after CPU video filter.
# video_post_filter_record = false
# Records output of GPU shaded material if available.
# video_gpu_record = false
# Screenshots output of GPU shaded material if available.
# video_gpu_screenshot = true
# Watch content shader files for changes and auto-apply as necessary.
# video_shader_watch_files = false
# Block SRAM from being overwritten when loading save states.
# Might potentially lead to buggy games.
# block_sram_overwrite = false
# When saving a savestate, save state index is automatically increased before
# it is saved.
# Also, when loading content, the index will be set to the highest existing index.
# There is no upper bound on the index.
# savestate_auto_index = false
# Slowmotion ratio. When slowmotion, content will slow down by factor.
# slowmotion_ratio = 3.0
# The maximum rate at which content will be run when using fast forward. (E.g. 5.0 for 60 fps content => 300 fps cap).
# RetroArch will go to sleep to ensure that the maximum rate will not be exceeded.
# Do not rely on this cap to be perfectly accurate.
# If this is set at 0, then fastforward ratio is unlimited (no FPS cap)
# fastforward_ratio = 0.0
# Enable stdin/network command interface.
# network_cmd_enable = false
# network_cmd_port = 55355
# stdin_cmd_enable = false
retroarch.c 0000664 0001750 0001750 00000322460 13272753522 012576 0 ustar sergio sergio /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2012-2015 - Michael Lelli
* Copyright (C) 2015-2017 - Andrés Suárez
*
* 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 .
*/
#ifdef _WIN32
#ifdef _XBOX
#include
#else
#define WIN32_LEAN_AND_MEAN
#include
#endif
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include