Merge github:libretro/RetroArch

This commit is contained in:
gblues 2018-01-19 20:54:33 -08:00
commit f4685447cc
136 changed files with 5979 additions and 4617 deletions

7
.gitignore vendored
View File

@ -133,3 +133,10 @@ obj-unix/
/pkg/msvc/msvc-2010/Release Cg/*.pdb
retroarch.cfg
Makefile.local
# Emscripten artifacts
retroarch.js
retroarch.js.mem
*.bc
*.wasm

View File

@ -5,26 +5,33 @@
- 3DS: Now reports memory and battery state.
- AUDIO: Added 'Audio Resampler Quality' setting to Audio Settings. Setting this higher will increase sound quality at the expense of sound latency and/or performance. Setting this value lower will improve sound latency/performance at the expense of sound quality. Only has an effect if the Sinc resampler is used, and you have to restart the game for changes to take effect.
- CHEEVOS: Fix unofficial achievements not being loaded.
- CHEEVOS: Show the menu entries when no achievements are found even if hardcore mode is enabled.
- CHEEVOS: Show savestate menu entries when no achievements are found even if hardcore mode is enabled.
- CHEEVOS: Support Neo Geo Pocket.
- COMMON: Bugfix for issue related to 'Windows mouse pointer visible when running MESS or MAME cores'.
- COMMON: Fix bug 'Last item in a Playlist is ignored'.
- COMMON: New LED API. Driver implemented for Raspberry Pi, proof of concept implemented for core MAME 2003.
- D3D8: Direct3D 8 can now work on systems that have Direct3D 8 installed.
- D3D9: Add menu support for MaterialUI/XMB.
- DINPUT: don't reinitialize input driver on network events / media insertion / network drive connection
- INPUT: show friendly names when available under input binds and system information
- INPUT: show the config name when available under system information
- GUI: Allow changing menu font color.
- GUI: Menu visibility options for RGUI and MaterialUI.
- GUI/XMB: Add Monochrome Inverted icon theme.
- GUI/XMB: Allow changing menu scale to 200%.
- KEYMAPPER: prevent a condition that caused input_menu_toggle to stop working when a RETRO_DEVICE_KEYBOARD type device is enabled
- GL: ignore hard gpu sync when fast-forwarding
- LOCALIZATION: Update Italian translation.
- LOCALIZATION: Update Japanese translation.
- LOCALIZATION: Update Spanish translation.
- NSW: Initial Nintendo Switch port, based on libtransistor SDK.
- SOLARIS: Initial port.
- PS3: Enable Cheevos.
- PSP: Enable threading support through pthreads.
- SHIELD ATV: Allow the remote / gamepad takeover hack to work with the 2017 gamepad
- WINDOWS: Improved Unicode support (for cores/directory creation and 7zip archives).
- WINDOWS: Show progress meter on taskbar for downloads (Windows 7 and up).
- WINDOWS: WS_EX_LAYERED drastically decreases performance, so only set it when needed ( transparency in windowed mode).
- WINDOWS: WS_EX_LAYERED drastically decreases performance, so only set it when needed (transparency in windowed mode).
- WIIU: Overlay support.
- WIIU: Transparency support in menu + overlays.
- WIIU: New HID pad support.

View File

@ -37,12 +37,6 @@ ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -static-libgcc -lwinmm
endif
ifneq ($(findstring SunOS,$(OS)),)
INSTALL = ginstall
else
INSTALL = install
endif
include Makefile.common
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
@ -203,13 +197,20 @@ install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(MAN_DIR)/man6 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
$(INSTALL) -m755 $(TARGET) $(DESTDIR)$(BIN_DIR)
$(INSTALL) -m755 tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
$(INSTALL) -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
$(INSTALL) -m644 retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
$(INSTALL) -m644 docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6
$(INSTALL) -m644 docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6
$(INSTALL) -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
cp $(TARGET) $(DESTDIR)$(BIN_DIR)
cp tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
cp retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)
cp retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
cp docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6
cp docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6
cp media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
chmod 755 $(DESTDIR)$(BIN_DIR)/$(TARGET)
chmod 755 $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
chmod 644 $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
chmod 644 $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop
chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
chmod 644 $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
@if test -d media/assets; then \
echo "Installing media assets..."; \
mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb; \

View File

@ -554,6 +554,7 @@ endif
ifeq ($(HAVE_EMSCRIPTEN), 1)
OBJ += frontend/drivers/platform_emscripten.o \
input/drivers/rwebinput_input.o \
input/drivers_joypad/rwebpad_joypad.o \
audio/drivers/rwebaudio.o \
camera/drivers/rwebcam.o
endif

View File

@ -46,7 +46,7 @@ ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DHAVE_SOCKET_LEGACY
DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DHAVE_SOCKET_LEGACY -DHAVE_THREADS
#-DHAVE_SSL -DMBEDTLS_SSL_DEBUG_ALL
#ssl is currently incompatible with griffin due to use of the "static" flag on repeating functions that will conflict when included in one file
else
@ -69,6 +69,7 @@ else
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
HAVE_SOCKET_LEGACY = 1
HAVE_THREADS = 1
HAVE_SSL = 1
include Makefile.common

View File

@ -1,6 +1,6 @@
TARGET := retroarch.js
EOPT = USE_ZLIB=1 USE_SDL=2 # Emscripten specific options
EOPT = USE_ZLIB=1 # Emscripten specific options
EOPTS = $(addprefix -s $(EMPTY), $(EOPT)) # Add '-s ' to each option
PTHREAD = 0
@ -18,31 +18,28 @@ HAVE_RPNG = 1
HAVE_EMSCRIPTEN = 1
HAVE_RGUI = 1
HAVE_SDL = 0
HAVE_SDL2 = 1
HAVE_SDL2 = 0
HAVE_ZLIB = 1
WANT_ZLIB = 1
HAVE_SHADERPIPELINE = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
MEMORY = 536870912
# XXX: setting this to 1/2 currently crashes Firefox nightly
PRECISE_F32 = 2
PRECISE_F32 = 1
OBJDIR := obj-emscripten
ifneq ($(NATIVE_ZLIB),)
WANT_ZLIB = 0
endif
ifeq ($(HAVE_SDL2), 1)
DEFINES += -DHAVE_SDL2
endif
#if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS:
LIBS := -s USE_SDL=2 -s USE_ZLIB=1
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) \
LIBS := -s USE_ZLIB=1
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 -s BINARYEN_TRAP_MODE=\"clamp\" \
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
--js-library emscripten/library_rwebaudio.js \
--js-library emscripten/library_rwebinput.js \
--js-library emscripten/library_rwebcam.js
ifneq ($(PTHREAD), 0)
LDFLAGS += -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2
@ -50,7 +47,12 @@ endif
ifeq ($(ASYNC), 1)
LDFLAGS += -s ASYNCIFY=$(ASYNC)
endif
endif
ifeq ($(HAVE_SDL2), 1)
LIBS += -s USE_SDL=2
DEFINES += -DHAVE_SDL2
endif
include Makefile.common
@ -65,7 +67,7 @@ ifeq ($(DEBUG), 1)
LDFLAGS += -O0 -g
CFLAGS += -O0 -g
else
LDFLAGS += -O2
LDFLAGS += -O2 -s WASM=1
# WARNING: some optimizations can break some cores (ex: LTO breaks tyrquake)
LDFLAGS += -s PRECISE_F32=$(PRECISE_F32)
ifeq ($(LTO), 1)
@ -74,48 +76,29 @@ else
CFLAGS += -O2
endif
CFLAGS += -DHAVE_RPNG -Wall -Wno-unused-result -Wno-unused-variable -I. -Ilibretro-common/include -std=gnu99 -s USE_ZLIB=1 \
CFLAGS += -DHAVE_RPNG -Wall -I. -Ilibretro-common/include -std=gnu99 -s USE_ZLIB=1 \
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_take_screenshot']"
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
all: $(TARGET)
$(TARGET): $(OBJ)
$(TARGET): $(RARCH_OBJ) $(libretro)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LD) -o $@ $(OBJ) $(libretro) $(LIBS) $(LDFLAGS)
$(Q)$(LD) -o $@ $(RARCH_OBJ) $(libretro) $(LIBS) $(LDFLAGS)
%.o: %.c
$(OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
%.o: %.cpp
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
clean:
rm -f *.o
rm -f deps/libz/*.o
rm -f frontend/*.o
rm -f menu/*.o
rm -f menu/disp/*.o
rm -f audio/*.o
rm -f compat/*.o
rm -f compat/rxml/*.o
rm -f conf/*.o
rm -f gfx/scaler/*.o
rm -f gfx/*.o
rm -f gfx/d3d/*.o
rm -f gfx/drivers_context/*.o
rm -f gfx/math/*.o
rm -f gfx/drivers_font/*.o
rm -f gfx/drivers_font_renderer/*.o
rm -f gfx/py_state/*.o
rm -f gfx/rpng/*.o
rm -f gfx/glsym/*.o
rm -f record/*.o
rm -f input/*.o
rm -f tools/*.o
rm -f libretro-common/*/*.o
rm -rf $(OBJDIR)
rm -f $(TARGET)
rm -f *.d
.PHONY: all clean

View File

@ -618,20 +618,20 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
double direction = (double)delta_mid / half_size;
double adjust = 1.0 + audio_driver_rate_control_delta * direction;
#if 0
RARCH_LOG_OUTPUT("[Audio]: Audio buffer is %u%% full\n",
(unsigned)(100 - (avail * 100) / audio_driver_buffer_size));
#endif
audio_driver_free_samples_buf
[write_idx] = avail;
audio_source_ratio_current =
audio_source_ratio_original * adjust;
#if 0
RARCH_LOG_OUTPUT("[Audio]: New rate: %lf, Orig rate: %lf\n",
audio_source_ratio_current,
audio_source_ratio_original);
if (verbosity_is_enabled())
{
RARCH_LOG_OUTPUT("[Audio]: Audio buffer is %u%% full\n",
(unsigned)(100 - (avail * 100) / audio_driver_buffer_size));
RARCH_LOG_OUTPUT("[Audio]: New rate: %lf, Orig rate: %lf\n",
audio_source_ratio_current,
audio_source_ratio_original);
}
#endif
}
@ -862,13 +862,16 @@ bool audio_driver_find_driver(void)
current_audio = (const audio_driver_t*)audio_driver_find_handle(i);
else
{
unsigned d;
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
settings->arrays.audio_driver);
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
for (d = 0; audio_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", audio_driver_find_ident(d));
RARCH_WARN("Going to default to first audio driver...\n");
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
settings->arrays.audio_driver);
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
for (d = 0; audio_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", audio_driver_find_ident(d));
RARCH_WARN("Going to default to first audio driver...\n");
}
current_audio = (const audio_driver_t*)audio_driver_find_handle(0);

View File

@ -370,7 +370,7 @@ static void *alsa_device_list_new(void *data)
/* description of device IOID - input / output identifcation
* ("Input" or "Output"), NULL means both) */
if (!io || (string_is_equal_fast(io, "Output", 6)))
if (!io || (string_is_equal(io, "Output")))
string_list_append(s, name, attr);
if (name)

View File

@ -370,7 +370,7 @@ static void *alsa_device_list_new(void *data)
/* description of device IOID - input / output identifcation
* ("Input" or "Output"), NULL means both) */
if (!io || (string_is_equal_fast(io,"Output", 6)))
if (!io || string_is_equal(io,"Output"))
string_list_append(s, name, attr);
if (name)

View File

@ -20,6 +20,7 @@
#include <pulse/pulseaudio.h>
#include <boolean.h>
#include <retro_miscellaneous.h>
#include <retro_endianness.h>
#include "../audio_driver.h"

View File

@ -157,14 +157,17 @@ bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
camera_driver = (const camera_driver_t*)camera_driver_find_handle(i);
else
{
unsigned d;
RARCH_ERR("Couldn't find any camera driver named \"%s\"\n",
settings->arrays.camera_driver);
RARCH_LOG_OUTPUT("Available camera drivers are:\n");
for (d = 0; camera_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", camera_driver_find_ident(d));
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any camera driver named \"%s\"\n",
settings->arrays.camera_driver);
RARCH_LOG_OUTPUT("Available camera drivers are:\n");
for (d = 0; camera_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", camera_driver_find_ident(d));
RARCH_WARN("Going to default to first camera driver...\n");
RARCH_WARN("Going to default to first camera driver...\n");
}
camera_driver = (const camera_driver_t*)camera_driver_find_handle(0);

File diff suppressed because it is too large Load Diff

View File

@ -5,23 +5,6 @@
Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/
*/
/* Use at the beginning of the coroutine, you must have declared a variable coro_t* coro */
#define CORO_ENTER() \
{ \
CORO_again: ; \
switch ( coro->step ) { \
case CORO_BEGIN: ;
/* Use to define labels which are targets to GOTO and GOSUB */
#define CORO_SUB( x ) \
case x: ;
/* Use at the end of the coroutine */
#define CORO_LEAVE() \
} \
} \
do { return 0; } while ( 0 )
/* Go to the x label */
#define CORO_GOTO( x ) \
do { \
@ -54,11 +37,6 @@ Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/
case __LINE__: ; \
} while ( 0 )
#define CORO_STOP() \
do { \
return 0; \
} while ( 0 )
/* The coroutine entry point, never use 0 as a label */
#define CORO_BEGIN 0
@ -66,18 +44,46 @@ Released under the CC0: https://creativecommons.org/publicdomain/zero/1.0/
#define CORO_SETUP( x ) \
do { \
( x )->step = CORO_BEGIN; \
( x )->sp = 0; \
( x )->sp = 0; \
} while ( 0 )
#define CORO_VAR( x ) ( coro->x )
/* A coroutine */
typedef struct
{
CORO_VARS
int step, sp;
int stack[ 8 ];
}
coro_t;
/* co-routine specific variables */
char badge_name[16];
char url[256];
char badge_basepath[PATH_MAX_LENGTH];
char badge_fullpath[PATH_MAX_LENGTH];
unsigned char hash[16];
bool round;
unsigned gameid;
unsigned i;
unsigned j;
unsigned k;
size_t bytes;
size_t count;
size_t offset;
size_t len;
size_t size;
MD5_CTX md5;
cheevos_nes_header_t header;
retro_time_t t0;
struct retro_system_info sysinfo;
void *data;
char *json;
const char *path;
const char *ext;
intfstream_t *stream;
cheevo_t *cheevo;
settings_t *settings;
struct http_connection_t *conn;
struct http_t *http;
const cheevo_t *cheevo_end;
/* co-routine general variables */
int step, sp;
int stack[ 8 ];
} coro_t;
#endif /* CORO_H */

View File

@ -69,7 +69,7 @@ static const bool def_playlist_entry_rename = true;
static const unsigned int def_user_language = 0;
#if (defined(_WIN32) && !defined(_XBOX)) || (defined(__linux) && !defined(ANDROID) && !defined(HAVE_LAKKA)) || (defined(__MACH__) && !defined(IOS))
#if (defined(_WIN32) && !defined(_XBOX)) || (defined(__linux) && !defined(ANDROID) && !defined(HAVE_LAKKA)) || (defined(__MACH__) && !defined(IOS)) || defined(EMSCRIPTEN)
static const bool def_mouse_enable = true;
#else
static const bool def_mouse_enable = false;

View File

@ -224,6 +224,7 @@ enum joypad_driver_enum
JOYPAD_DOS,
JOYPAD_HID,
JOYPAD_QNX,
JOYPAD_RWEBPAD,
JOYPAD_NULL
};
@ -454,6 +455,8 @@ static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_DOS;
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_HID;
#elif defined(__QNX__)
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_QNX;
#elif defined(EMSCRIPTEN)
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_RWEBPAD;
#else
static enum joypad_driver_enum JOYPAD_DEFAULT_DRIVER = JOYPAD_NULL;
#endif
@ -783,9 +786,9 @@ const char *config_get_default_input(void)
case INPUT_COCOA:
return "cocoa";
case INPUT_QNX:
return "qnx_input";
return "qnx_input";
case INPUT_RWEBINPUT:
return "rwebinput";
return "rwebinput";
case INPUT_DOS:
return "dos";
case INPUT_NULL:
@ -846,6 +849,8 @@ const char *config_get_default_joypad(void)
return "hid";
case JOYPAD_QNX:
return "qnx";
case JOYPAD_RWEBPAD:
return "rwebpad";
case JOYPAD_DOS:
return "dos";
case JOYPAD_NULL:
@ -2233,15 +2238,15 @@ static bool check_shader_compatibility(enum file_path_enum enum_idx)
{
settings_t *settings = config_get_ptr();
if (string_is_equal_fast(settings->arrays.video_driver, "vulkan", 6))
if (string_is_equal(settings->arrays.video_driver, "vulkan"))
{
if (enum_idx != FILE_PATH_SLANGP_EXTENSION)
return false;
return true;
}
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2) ||
string_is_equal_fast(settings->arrays.video_driver, "d3d", 3)
if (string_is_equal(settings->arrays.video_driver, "gl") ||
string_is_equal(settings->arrays.video_driver, "d3d")
)
{
if (enum_idx == FILE_PATH_SLANGP_EXTENSION)
@ -2711,7 +2716,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!string_is_empty(settings->paths.directory_screenshot))
{
if (string_is_equal_fast(settings->paths.directory_screenshot, "default", 7))
if (string_is_equal(settings->paths.directory_screenshot, "default"))
*settings->paths.directory_screenshot = '\0';
else if (!path_is_directory(settings->paths.directory_screenshot))
{
@ -2736,36 +2741,35 @@ static bool config_load_file(const char *path, bool set_defaults,
}
#endif
if (string_is_equal_fast(settings->paths.path_menu_wallpaper, "default", 7))
if (string_is_equal(settings->paths.path_menu_wallpaper, "default"))
*settings->paths.path_menu_wallpaper = '\0';
if (string_is_equal_fast(settings->paths.directory_video_shader, "default", 7))
if (string_is_equal(settings->paths.directory_video_shader, "default"))
*settings->paths.directory_video_shader = '\0';
if (string_is_equal_fast(settings->paths.directory_video_filter, "default", 7))
if (string_is_equal(settings->paths.directory_video_filter, "default"))
*settings->paths.directory_video_filter = '\0';
if (string_is_equal_fast(settings->paths.directory_audio_filter, "default", 7))
if (string_is_equal(settings->paths.directory_audio_filter, "default"))
*settings->paths.directory_audio_filter = '\0';
if (string_is_equal_fast(settings->paths.directory_core_assets, "default", 7))
if (string_is_equal(settings->paths.directory_core_assets, "default"))
*settings->paths.directory_core_assets = '\0';
if (string_is_equal_fast(settings->paths.directory_assets, "default", 7))
if (string_is_equal(settings->paths.directory_assets, "default"))
*settings->paths.directory_assets = '\0';
if (string_is_equal_fast(settings->paths.directory_dynamic_wallpapers, "default", 7))
if (string_is_equal(settings->paths.directory_dynamic_wallpapers, "default"))
*settings->paths.directory_dynamic_wallpapers = '\0';
if (string_is_equal_fast(settings->paths.directory_thumbnails, "default", 7))
if (string_is_equal(settings->paths.directory_thumbnails, "default"))
*settings->paths.directory_thumbnails = '\0';
if (string_is_equal_fast(settings->paths.directory_playlist, "default", 7))
if (string_is_equal(settings->paths.directory_playlist, "default"))
*settings->paths.directory_playlist = '\0';
#ifdef HAVE_MENU
if (string_is_equal_fast(settings->paths.directory_menu_content, "default", 7))
if (string_is_equal(settings->paths.directory_menu_content, "default"))
*settings->paths.directory_menu_content = '\0';
if (string_is_equal_fast(settings->paths.directory_menu_config, "default", 7))
if (string_is_equal(settings->paths.directory_menu_config, "default"))
*settings->paths.directory_menu_config = '\0';
#endif
#ifdef HAVE_OVERLAY
if (string_is_equal_fast(settings->paths.directory_overlay, "default", 7))
if (string_is_equal(settings->paths.directory_overlay, "default"))
*settings->paths.directory_overlay = '\0';
#endif
if (string_is_equal_fast(settings->paths.directory_system, "default", 7))
if (string_is_equal(settings->paths.directory_system, "default"))
*settings->paths.directory_system = '\0';
if (settings->floats.slowmotion_ratio < 1.0f)
@ -2786,7 +2790,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
config_get_path(conf, "savefile_directory", tmp_str, path_size))
{
if (string_is_equal_fast(tmp_str, "default", 7))
if (string_is_equal(tmp_str, "default"))
dir_set(RARCH_DIR_SAVEFILE, g_defaults.dirs[DEFAULT_DIR_SRAM]);
else if (path_is_directory(tmp_str))
@ -2812,7 +2816,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
config_get_path(conf, "savestate_directory", tmp_str, path_size))
{
if (string_is_equal_fast(tmp_str, "default", 7))
if (string_is_equal(tmp_str, "default"))
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dirs[DEFAULT_DIR_SAVESTATE]);
else if (path_is_directory(tmp_str))
{

674
cores/libretro-mpv/LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

159
cores/libretro-mpv/Makefile Normal file
View File

@ -0,0 +1,159 @@
STATIC_LINKING := 0
AR := ar
DEBUG := 0
TARGET_NAME := mpv
PREFIX := /usr
LIBDIR := $(PREFIX)/lib
LIBRETRO_DIR := libretro
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -s),)
EXE_EXT = .exe
platform = win
else ifneq ($(findstring MINGW,$(shell uname -s)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
platform = osx
ifeq ($(shell uname -p),powerpc)
arch = ppc
else
arch = intel
endif
else ifneq ($(findstring win,$(shell uname -s)),)
platform = win
endif
else ifneq (,$(findstring armv,$(platform)))
override platform += unix
else ifneq (,$(findstring rpi3,$(platform)))
override platform += unix
endif
ifeq ($(ARCHFLAGS),)
ifeq ($(archs),ppc)
ARCHFLAGS = -arch ppc -arch ppc64
else
ARCHFLAGS = -arch i386 -arch x86_64
endif
endif
ifeq ($(platform), osx)
ifndef ($(NOUNIVERSAL))
CFLAGS += $(ARCHFLAGS)
LFLAGS += $(ARCHFLAGS)
endif
endif
ifeq ($(STATIC_LINKING), 1)
EXT := a
endif
ifneq (,$(findstring unix,$(platform)))
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
DEFINES := -DIOS
CC = cc -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
CFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CFLAGS += -miphoneos-version-min=5.0
endif #ifneq ios
else ifneq (,$(findstring qnx,$(platform)))
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifeq ($(platform), vita)
TARGET := $(TARGET_NAME)_vita.a
CC = arm-vita-eabi-gcc
AR = arm-vita-eabi-ar
CFLAGS += -Wl,-q -Wall -O3
STATIC_LINKING = 1
else
CC = gcc
TARGET := $(TARGET_NAME)_libretro.dll
SHARED := -shared -static-libgcc -static-libstdc++ \
-Wl,--version-script=link.T -Wl,--no-undefined
endif
ifneq (,$(findstring gles,$(platform)))
CFLAGS += -DHAVE_OPENGLES
endif
ifneq (,$(findstring qnx,$(platform)))
CFLAGS += -Wc,-std=c99
else
CFLAGS += -std=gnu99
endif
# Locale support should be enabled by default, as it's most common.
ifneq ($(locale),false)
CFLAGS += -DHAVE_LOCALE
endif
# Always have some debugging information.
CFLAGS += -g
ifeq ($(DEBUG), 1)
CFLAGS += -Og
else
CFLAGS += -Ofast
endif
CFLAGS += -I../../libretro-common/include
OBJECTS := mpv-libretro.o
LDFLAGS += -lmpv
CFLAGS += -Wall -pedantic
all: $(TARGET)
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
$(CC) $(fpic) $(SHARED) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
endif
%.o: %.c
$(CC) $(CFLAGS) $(fpic) -c -o $@ $<
clean:
rm -f $(OBJECTS) $(TARGET)
install:
install -D -m 755 $(TARGET) $(DESTDIR)$(LIBDIR)/$(LIBRETRO_DIR)/$(TARGET)
install-snip:
install -D -s -m 755 $(TARGET) $(DESTDIR)$(LIBDIR)/$(LIBRETRO_DIR)/$(TARGET)
uninstall:
rm $(DESTDIR)$(LIBDIR)/$(LIBRETRO_DIR)/$(TARGET)
help:
@echo 'make <target> [flags]'
@echo 'Targets:'
@echo ' clean install install-snip uninstall help'
@echo 'Flags:'
@echo ' platform String containing platform details.'
@echo ' locale Support toolchain with locale support.'
@echo ' false: disable support, otherwise enabled (default).'
.PHONY: clean

View File

@ -0,0 +1,17 @@
# libretro-mpv
mpv media player as a libretro core. A proof of concept release is now available.
Aims to use features already established in mpv that are not currently available in Retroarch movieplayer.
I want to be able to use Retroarch as my movie player on my embedded devices (Raspberry Pi) and desktop using hardware acceleration without having to use Kodi or mpv directly. Thus allowing for a more integrated experience, and smaller root filesystem.
## Compiling
Retroarch must be compiled with `--disable-ffmpeg` to stop the integrated movieplayer from playing the input file.
FFmpeg (preferably master branch) must be compiled with `--enable-shared`.
mpv must be compiled with `--enable-libmpv-shared`.
Then run `make` in the mpv-libretro folder.

View File

@ -0,0 +1,4 @@
{
global: retro_*;
local: *;
};

View File

@ -0,0 +1,564 @@
/* mpv media player libretro core
* Copyright (C) 2018 Mahyar Koshkouei
*
* This program 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 Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_LOCALE
#include <locale.h>
#endif
#include <mpv/client.h>
#include <mpv/opengl_cb.h>
#include "libretro.h"
#include "version.h"
static struct retro_hw_render_callback hw_render;
static struct retro_log_callback logging;
static retro_log_printf_t log_cb;
static retro_video_refresh_t video_cb;
static retro_audio_sample_t audio_cb;
static retro_audio_sample_batch_t audio_batch_cb;
static retro_environment_t environ_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
static mpv_handle *mpv;
static mpv_opengl_cb_context *mpv_gl;
/* Keep track of the number of events in mpv queue */
static unsigned int event_waiting = 0;
/* Save the current playback time for context changes */
static int64_t *playback_time = 0;
/* filepath required globaly as mpv is reopened on context change */
static char *filepath = NULL;
static void fallback_log(enum retro_log_level level, const char *fmt, ...)
{
(void)level;
va_list va;
va_start(va, fmt);
vfprintf(stderr, fmt, va);
va_end(va);
}
static void on_mpv_events(void *mpv)
{
event_waiting++;
}
void retro_init(void)
{
return;
}
void retro_deinit(void)
{
return;
}
unsigned retro_api_version(void)
{
return RETRO_API_VERSION;
}
void retro_set_controller_port_device(unsigned port, unsigned device)
{
log_cb(RETRO_LOG_INFO, "Plugging device %u into port %u.\n", device, port);
return;
}
void retro_get_system_info(struct retro_system_info *info)
{
memset(info, 0, sizeof(*info));
info->library_name = "mpv";
info->library_version = LIBRETRO_MPV_VERSION;
info->need_fullpath = true; /* Allow MPV to load the file on its own */
info->valid_extensions = "264|265|302|669|722|3g2|3gp|aa|aa3|aac|abc|ac3|"
"acm|adf|adp|ads|adx|aea|afc|aix|al|amf|ams|ans|ape|apl|aqt|art|asc|"
"ast|avc|avi|avr|avs|bcstm|bfstm|bin|bit|bmv|brstm|cdata|cdg|cdxl|cgi|"
"cif|daud|dbm|dif|diz|dmf|dsm|dss|dtk|dts|dtshd|dv|eac3|fap|far|flac|"
"flm|flv|fsb|g722|g723_1|g729|genh|gsm|h261|h264|h265|h26l|hevc|ice|"
"idf|idx|ircam|it|itgz|itr|itz|ivr|j2k|lvf|m2a|m3u8|m4a|m4s|m4v|mac|"
"mdgz|mdl|mdr|mdz|med|mid|mj2|mjpeg|mjpg|mk3d|mka|mks|mkv|mlp|mod|mov|"
"mp2|mp3|mp4|mpa|mpc|mpeg|mpegts|mpg|mpl2|mpo|msf|mt2|mtaf|mtm|musx|"
"mvi|mxg|nfo|nist|nut|oga|ogg|ogv|okt|oma|omg|paf|pjs|psm|ptm|pvf|qcif|"
"rco|rgb|rsd|rso|rt|s3gz|s3m|s3r|s3z|sami|sb|sbg|scc|sdr2|sds|sdx|sf|"
"shn|sln|smi|son|sph|ss2|stl|stm|str|sub|sup|svag|sw|tak|tco|thd|ts|"
"tta|txt|ub|ul|ult|umx|uw|v|v210|vag|vb|vc1|viv|vob|vpk|vqe|vqf|vql|vt|"
"vtt|wav|wsd|xl|xm|xmgz|xmr|xmv|xmz|xvag|y4m|yop|yuv|yuv10";
}
void retro_get_system_av_info(struct retro_system_av_info *info)
{
float sampling_rate = 48000.0f;
struct retro_variable var = { .key = "test_aspect" };
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
var.key = "test_samplerate";
if(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
sampling_rate = strtof(var.value, NULL);
info->timing = (struct retro_system_timing) {
.fps = 60.0,
.sample_rate = sampling_rate,
};
info->geometry = (struct retro_game_geometry) {
.base_width = 256,
.base_height = 144,
.max_width = 1920,
.max_height = 1080,
.aspect_ratio = -1,
};
}
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
static const struct retro_variable vars[] = {
{ "test_samplerate", "Sample Rate; 48000|30000|20000" },
{ "test_opt0", "Test option #0; false|true" },
{ "test_opt1", "Test option #1; 0" },
{ "test_opt2", "Test option #2; 0|1|foo|3" },
{ NULL, NULL },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
if (cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &logging))
log_cb = logging.log;
else
log_cb = fallback_log;
}
static void *get_proc_address_mpv(void *fn_ctx, const char *name)
{
/* The "ISO C forbids conversion of function pointer to object pointer
* type" warning is suppressed.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
void *proc_addr = (void *) hw_render.get_proc_address(name);
#pragma GCC diagnostic pop
if(proc_addr == NULL)
log_cb(RETRO_LOG_ERROR, "Failure obtaining %s proc address\n", name);
return proc_addr;
}
static void context_reset(void)
{
const char *cmd[] = {"loadfile", filepath, NULL};
#ifdef HAVE_LOCALE
setlocale(LC_NUMERIC, "C");
#endif
mpv = mpv_create();
if(!mpv)
{
log_cb(RETRO_LOG_ERROR, "failed creating context\n");
exit(EXIT_FAILURE);
}
if(mpv_initialize(mpv) < 0)
{
log_cb(RETRO_LOG_ERROR, "mpv init failed\n");
exit(EXIT_FAILURE);
}
/* When normal mpv events are available. */
mpv_set_wakeup_callback(mpv, on_mpv_events, NULL);
if(mpv_request_log_messages(mpv, "info") < 0)
log_cb(RETRO_LOG_ERROR, "mpv logging failed\n");
/* The OpenGL API is somewhat separate from the normal mpv API. This only
* returns NULL if no OpenGL support is compiled.
*/
mpv_gl = mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
if(!mpv_gl)
{
log_cb(RETRO_LOG_ERROR, "failed to create mpv GL API handle\n");
exit(EXIT_FAILURE);
}
if(mpv_opengl_cb_init_gl(mpv_gl, NULL, get_proc_address_mpv, NULL) < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to initialize mpv GL context\n");
exit(EXIT_FAILURE);
}
/* Actually using the opengl_cb state has to be explicitly requested.
* Otherwise, mpv will create a separate platform window.
*/
if(mpv_set_option_string(mpv, "vo", "opengl-cb") < 0)
{
log_cb(RETRO_LOG_ERROR, "failed to set video output to OpenGL\n");
exit(EXIT_FAILURE);
}
if(mpv_set_option_string(mpv, "hwdec", "auto") < 0)
log_cb(RETRO_LOG_ERROR, "failed to set hwdec option\n");
if(mpv_command(mpv, cmd) != 0)
{
log_cb(RETRO_LOG_ERROR, "failed to issue mpv_command\n");
exit(EXIT_FAILURE);
}
/* Keep trying until mpv accepts the property. This is done to seek to the
* point in the file after the previous context was destroyed. If no
* context was destroyed previously, the file seeks to 0.
*
* This also seems to fix some black screen issues.
*/
while(mpv_set_property(mpv,
"playback-time", MPV_FORMAT_INT64, &playback_time) < 0)
{}
log_cb(RETRO_LOG_INFO, "Context reset.\n");
}
static void context_destroy(void)
{
mpv_get_property(mpv, "playback-time", MPV_FORMAT_INT64, &playback_time);
mpv_opengl_cb_uninit_gl(mpv_gl);
mpv_terminate_destroy(mpv);
log_cb(RETRO_LOG_INFO, "Context destroyed.\n");
}
#ifdef HAVE_OPENGLES
static bool retro_init_hw_context(void)
{
#if defined(HAVE_OPENGLES_3_1)
hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES_VERSION;
hw_render.version_major = 3;
hw_render.version_minor = 1;
#elif defined(HAVE_OPENGLES3)
hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES3;
#else
hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES2;
#endif
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
return false;
return true;
}
#else
static bool retro_init_hw_context(void)
{
hw_render.context_type = RETRO_HW_CONTEXT_OPENGL;
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
return false;
return true;
}
#endif
void retro_set_audio_sample(retro_audio_sample_t cb)
{
audio_cb = cb;
}
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
{
audio_batch_cb = cb;
}
void retro_set_input_poll(retro_input_poll_t cb)
{
input_poll_cb = cb;
}
void retro_set_input_state(retro_input_state_t cb)
{
input_state_cb = cb;
}
void retro_set_video_refresh(retro_video_refresh_t cb)
{
video_cb = cb;
}
void retro_reset(void)
{
return;
}
#if 0
static void audio_callback(void)
{
static unsigned phase;
for (unsigned i = 0; i < 30000 / 60; i++, phase++)
{
int16_t val = 0x800 * sinf(2.0f * M_PI * phase * 300.0f / 30000.0f);
audio_cb(val, val);
}
phase %= 100;
}
#endif
static void retropad_update_input(void)
{
struct Input
{
unsigned int l : 1;
unsigned int r : 1;
unsigned int a : 1;
};
struct Input current;
static struct Input last;
input_poll_cb();
/* Commands that are called on rising edge only */
/* A ternary operator is used since input_state_cb returns an int16_t, but
* we only care about whether the button is on or off which is why we store
* the value in a single bit for each button.
*
* Unsure if saving the memory is worth the extra checks, costing CPU time,
* but both are incredibly miniscule anyway.
*/
current.l = input_state_cb(0, RETRO_DEVICE_JOYPAD,
0, RETRO_DEVICE_ID_JOYPAD_L) != 0 ? 1 : 0;
current.r = input_state_cb(0, RETRO_DEVICE_JOYPAD,
0, RETRO_DEVICE_ID_JOYPAD_R) != 0 ? 1 : 0;
current.a = input_state_cb(0, RETRO_DEVICE_JOYPAD,
0, RETRO_DEVICE_ID_JOYPAD_A) != 0 ? 1 : 0;
if(current.l == 1 && last.l == 0)
mpv_command_string(mpv, "cycle audio");
if(current.r == 1 && last.r == 0)
mpv_command_string(mpv, "cycle sub");
if(current.a == 1 && last.a == 0)
mpv_command_string(mpv, "cycle pause");
/* TODO #3: Press and hold commands with small delay */
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_LEFT))
mpv_command_string(mpv, "seek -5");
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_RIGHT))
mpv_command_string(mpv, "seek 5");
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_UP))
mpv_command_string(mpv, "seek 60");
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_DOWN))
mpv_command_string(mpv, "seek -60");
/* Press and hold commands */
if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_X))
mpv_command_string(mpv, "show-progress");
/* Instead of copying the structs as though they were a union, we assign
* each variable one-by-one to avoid endian issues.
*/
last.l = current.l;
last.r = current.r;
last.a = current.a;
}
void retro_run(void)
{
/* We only need to update the base video size once, and we do it here since
* the input file is not processed during the first
* retro_get_system_av_info() call.
*/
static bool updated_video_dimensions = false;
static int64_t width, height;
if(updated_video_dimensions == false)
{
mpv_get_property(mpv, "dwidth", MPV_FORMAT_INT64, &width);
mpv_get_property(mpv, "dheight", MPV_FORMAT_INT64, &height);
struct retro_game_geometry geometry = {
.base_width = width,
.base_height = height,
/* max_width and max_height are ignored */
.max_width = width,
.max_height = height,
/* Aspect ratio calculated automatically from base dimensions */
.aspect_ratio = -1,
};
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &geometry);
updated_video_dimensions = true;
}
/* Print out mpv logs */
if(event_waiting > 0)
{
while(1)
{
mpv_event *mp_event = mpv_wait_event(mpv, 0);
if(mp_event->event_id == MPV_EVENT_NONE)
break;
log_cb(RETRO_LOG_INFO, "mpv: ");
if(mp_event->event_id == MPV_EVENT_LOG_MESSAGE)
{
struct mpv_event_log_message *msg =
(struct mpv_event_log_message *)mp_event->data;
log_cb(RETRO_LOG_INFO, "[%s] %s: %s",
msg->prefix, msg->level, msg->text);
}
else
log_cb(RETRO_LOG_INFO, "%s\n", mpv_event_name(mp_event->event_id));
}
event_waiting = 0;
}
retropad_update_input();
/* TODO #2: Implement an audio callback feature in to libmpv */
/* audio_callback(); */
mpv_opengl_cb_draw(mpv_gl, hw_render.get_current_framebuffer(), width, height);
video_cb(RETRO_HW_FRAME_BUFFER_VALID, width, height, 0);
return;
}
/* No save-state support */
size_t retro_serialize_size(void)
{
return 0;
}
bool retro_serialize(void *data_, size_t size)
{
return true;
}
bool retro_unserialize(const void *data_, size_t size)
{
return true;
}
bool retro_load_game(const struct retro_game_info *info)
{
/* Supported on most systems. */
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
struct retro_input_descriptor desc[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Pause/Play" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Show Progress" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Seek -5 seconds" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Seek +60 seconds" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Seek -60 seconds" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Seek +5 seconds" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Cycle Audio Track" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "Cycle Subtitle Track" },
{ 0 },
};
/* Copy the file path to a global variable as we need it in context_reset()
* where mpv is initialised.
*/
filepath = strdup(info->path);
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
/* Not bothered if this fails. Assuming the default is selected anyway. */
if(!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
log_cb(RETRO_LOG_ERROR, "XRGB8888 is not supported.\n");
/* Try RGB565 */
fmt = RETRO_PIXEL_FORMAT_RGB565;
environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt);
}
if(!retro_init_hw_context())
{
log_cb(RETRO_LOG_ERROR, "HW Context could not be initialized\n");
return false;
}
return true;
}
bool retro_load_game_special(unsigned type, const struct retro_game_info *info,
size_t num)
{
return false;
}
void retro_unload_game(void)
{
free(filepath);
filepath = NULL;
return;
}
unsigned retro_get_region(void)
{
return RETRO_REGION_NTSC;
}
void *retro_get_memory_data(unsigned id)
{
return NULL;
}
size_t retro_get_memory_size(unsigned id)
{
return 0;
}
void retro_cheat_reset(void)
{
return;
}
void retro_cheat_set(unsigned index, bool enabled, const char *code)
{
return;
}

View File

@ -0,0 +1,3 @@
#ifndef LIBRETRO_MPV_VERSION
#define LIBRETRO_MPV_VERSION "0.2.alpha"
#endif

View File

@ -84,7 +84,7 @@
#elif defined(HAVE_D3D9)
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)
#elif defined(HAVE_D3D8)
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW | D3DFVF_TEX1)
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_DIFFUSE)
#endif
#endif

View File

@ -249,7 +249,7 @@ for f in `ls -v *_${platform}.${EXT}`; do
mkdir -p ../pkg/3ds/3ds/${name}_libretro
mv -f ../retroarch_3ds.3dsx ../pkg/3ds/3ds/${name}_libretro/${name}_libretro.3dsx
mv -f ../retroarch_3ds.smdh ../pkg/3ds/3ds/${name}_libretro/${name}_libretro.smdh
mv -f ../retroarch_3ds.xml ../pkg/3ds/3ds/${name}_libretro/${name}_libretro.xml
mv -f ../retroarch_3ds.xml ../pkg/3ds/3ds/${name}_libretro/${name}_libretro.xml 2> /dev/null
elif [ $PLATFORM = "unix" ] ; then
mv -f ../retroarch ../pkg/${platform}/${name}_libretro.elf
elif [ $PLATFORM = "ngc" ] ; then
@ -259,7 +259,7 @@ for f in `ls -v *_${platform}.${EXT}`; do
elif [ $PLATFORM = "emscripten" ] ; then
mkdir -p ../pkg/emscripten/
mv -f ../${name}_libretro.js ../pkg/emscripten/${name}_libretro.js
mv -f ../${name}_libretro.js.mem ../pkg/emscripten/${name}_libretro.js.mem
mv -f ../${name}_libretro.wasm ../pkg/emscripten/${name}_libretro.wasm
if [ $pthread != 0 ] ; then
mv -f ../pthread-main.js ../pkg/emscripten/pthread-main.js
fi

View File

@ -223,7 +223,7 @@ bool driver_find_next(const char *label, char *s, size_t len)
{
int i = driver_find_index(label, s);
if (i >= 0 && string_is_not_equal_fast(s, "null", 4))
if (i >= 0 && string_is_not_equal(s, "null"))
{
find_driver_nonempty(label, i + 1, s, len);
return true;

View File

@ -682,6 +682,9 @@ static void rarch_log_libretro(enum retro_log_level level,
if ((unsigned)level < settings->uints.libretro_log_level)
return;
if (!verbosity_is_enabled())
return;
va_start(vp, fmt);
switch (level)

View File

@ -23,13 +23,14 @@ var LibraryRWebAudio = {
getCurrentPerfTime: function() {
if (RA.startTime) return (window['performance']['now']() - RA.startTime) / 1000;
else throw 'getCurrentPerfTime() called before start time set';
else return 0;
},
process: function(queueBuffers) {
var currentTime = RA.getCurrentPerfTime();
for (var i = 0; i < RA.bufIndex; i++) {
if (RA.buffers[i].endTime < currentTime) {
if (RA.buffers[i].endTime !== 0 && RA.buffers[i].endTime < currentTime) {
RA.buffers[i].endTime = 0;
var buf = RA.buffers.splice(i, 1);
RA.buffers[RA.numBuffers - 1] = buf[0];
i--;
@ -40,8 +41,8 @@ var LibraryRWebAudio = {
fillBuffer: function(buf, samples) {
var count = 0;
var leftBuffer = RA.buffers[RA.bufIndex].getChannelData(0);
var rightBuffer = RA.buffers[RA.bufIndex].getChannelData(1);
const leftBuffer = RA.buffers[RA.bufIndex].getChannelData(0);
const rightBuffer = RA.buffers[RA.bufIndex].getChannelData(1);
while (samples && RA.bufOffset !== RA.BUFFER_SIZE) {
leftBuffer[RA.bufOffset] = {{{ makeGetValue('buf', 'count * 8', 'float') }}};
rightBuffer[RA.bufOffset] = {{{ makeGetValue('buf', 'count * 8 + 4', 'float') }}};
@ -73,7 +74,7 @@ var LibraryRWebAudio = {
block: function() {
do {
RA.process();
} while (RA.bufIndex === RA.numBuffers - 1);
} while (RA.bufIndex === RA.numBuffers);
}
},
@ -87,7 +88,10 @@ var LibraryRWebAudio = {
RA.numBuffers = ((latency * RA.context.sampleRate) / (1000 * RA.BUFFER_SIZE))|0;
if (RA.numBuffers < 2) RA.numBuffers = 2;
for (var i = 0; i < RA.numBuffers; i++) RA.buffers[i] = RA.context.createBuffer(2, RA.BUFFER_SIZE, RA.context.sampleRate);
for (var i = 0; i < RA.numBuffers; i++) {
RA.buffers[i] = RA.context.createBuffer(2, RA.BUFFER_SIZE, RA.context.sampleRate);
RA.buffers[i].endTime = 0
}
RA.nonblock = false;
RA.startTime = 0;
@ -97,7 +101,7 @@ var LibraryRWebAudio = {
Module["pauseMainLoop"]();
return 1;
},
RWebAudioSampleRate: function() {
return RA.context.sampleRate;
},
@ -108,16 +112,17 @@ var LibraryRWebAudio = {
var count = 0;
while (samples) {
if (RA.bufIndex === RA.numBuffers) {
if (RA.nonblock) break;
else RA.block();
}
var fill = RA.fillBuffer(buf, samples);
samples -= fill;
count += fill;
buf += fill * 8;
if (RA.bufOffset === RA.BUFFER_SIZE) {
if (RA.bufIndex === RA.numBuffers - 1) {
if (RA.nonblock) break;
else RA.block();
}
RA.queueAudio();
}
}
@ -142,16 +147,21 @@ var LibraryRWebAudio = {
RWebAudioFree: function() {
RA.bufIndex = 0;
RA.bufOffset = 0;
return;
},
RWebAudioBufferSize: function() {
return RA.numBuffers * RA.BUFFER_SIZE + RA.BUFFER_SIZE;
return RA.numBuffers * RA.BUFFER_SIZE * 8;
},
RWebAudioWriteAvail: function() {
RA.process();
return ((RA.numBuffers - RA.bufIndex) * RA.BUFFER_SIZE - RA.bufOffset) * 8;
},
RWebAudioRecalibrateTime: function() {
if (RA.startTime) {
RA.startTime = window['performance']['now']() - RA.context.currentTime * 1000;
}
}
};

View File

@ -1,143 +0,0 @@
//"use strict";
var LibraryRWebInput = {
$RI__deps: ['$Browser'],
$RI: {
temp: null,
contexts: [],
stateX: 0,
stateY: 0,
currentX: 0,
currentY: 0,
canvasEventHandler: function(event) {
switch (event.type) {
case 'mouseup':
case 'mousedown':
var value;
var offset;
if (event.button === 0) offset = 40;
else if (event.button === 2) offset = 41;
else break;
if (event.type === 'mouseup') value = 0;
else value = 1;
for (var i = 0; i < RI.contexts.length; i++) {
{{{ makeSetValue('RI.contexts[i].state', 'offset', 'value', 'i8') }}};
}
break;
}
},
eventHandler: function(event) {
var i;
switch (event.type) {
case 'mousemove':
var x = 0;
var y = 0;
var newX = event['clientX'] - Module.canvas.offsetLeft;
var newY = event['clientY'] - Module.canvas.offsetTop;
if (newX < 0) {
newX = 0;
x = -Module.canvas.offsetWidth;
} else if (newX > Module.canvas.offsetWidth) {
newX = Module.canvas.offsetWidth;
x = Module.canvas.offsetWidth;
} else {
x = newX - RI.currentX;
}
if (newY < 0) {
newY = 0;
y = -Module.canvas.offsetHeight;
} else if (newY > Module.canvas.offsetHeight) {
newY = Module.canvas.offsetHeight;
y = Module.canvas.offsetHeight;
} else {
y = newY - RI.currentY;
}
RI.currentX = newX;
RI.currentY = newY;
for (i = 0; i < RI.contexts.length; i++) {
{{{ makeSetValue('RI.contexts[i].state', '32', 'x', 'i32') }}};
{{{ makeSetValue('RI.contexts[i].state', '36', 'y', 'i32') }}};
}
break;
case 'keyup':
case 'keydown':
var key = event.keyCode;
var offset = key >> 3;
var bit = 1 << (key & 7);
if (offset >= 32) throw 'key code error! bad code: ' + key;
for (i = 0; i < RI.contexts.length; i++) {
var value = {{{ makeGetValue('RI.contexts[i].state', 'offset', 'i8') }}};
if (event.type === 'keyup') value &= ~bit;
else value |= bit;
{{{ makeSetValue('RI.contexts[i].state', 'offset', 'value', 'i8') }}};
}
event.preventDefault();
break;
case 'blur':
case 'visibilitychange':
for (i = 0; i < RI.contexts.length; i++) {
_memset(RI.contexts[i].state, 0, 42);
}
break;
}
}
},
RWebInputInit: function() {
if (RI.contexts.length === 0) {
document.addEventListener('keyup', RI.eventHandler, false);
document.addEventListener('keydown', RI.eventHandler, false);
document.addEventListener('mousemove', RI.eventHandler, false);
Module.canvas.addEventListener('mouseup', RI.canvasEventHandler, false);
Module.canvas.addEventListener('mousedown', RI.canvasEventHandler, false);
document.addEventListener('blur', RI.eventHandler, false);
document.addEventListener('onvisbilitychange', RI.eventHandler, false);
}
if (RI.temp === null) RI.temp = _malloc(42);
var s = _malloc(42);
_memset(s, 0, 42);
RI.contexts.push({
state: s
});
return RI.contexts.length;
},
RWebInputPoll: function(context) {
context -= 1;
var state = RI.contexts[context].state;
_memcpy(RI.temp, state, 42);
// reset mouse movements
{{{ makeSetValue('RI.contexts[context].state', '32', '0', 'i32') }}};
{{{ makeSetValue('RI.contexts[context].state', '36', '0', 'i32') }}};
return RI.temp;
},
RWebInputDestroy: function (context) {
if (context === RI.contexts.length) {
RI.contexts.pop();
if (RI.contexts.length === 0) {
document.removeEventListener('keyup', RI.eventHandler, false);
document.removeEventListener('keydown', RI.eventHandler, false);
document.removeEventListener('mousemove', RI.eventHandler, false);
Module.canvas.removeEventListener('mouseup', RI.canvasEventHandler, false);
Module.canvas.removeEventListener('mousedown', RI.canvasEventHandler, false);
document.removeEventListener('blur', RI.eventHandler, false);
document.removeEventListener('onvisbilitychange', RI.eventHandler, false);
}
}
}
};
autoAddDeps(LibraryRWebInput, '$RI');
mergeInto(LibraryManager.library, LibraryRWebInput);

View File

@ -34,9 +34,6 @@
<input type="textbox" id="latency" size="3" maxlength="3" value="96"> <label for="latency" id="latency-label">Audio latency (ms) (increase if you hear pops at fullspeed, can only be done before loading game)</label>
</div>
<hr/>
<textarea class="emscripten" id="output" rows="8"></textarea>
<hr>
<div class="emscripten" id="controls">
Controls:<br>
<br>
@ -65,7 +62,7 @@
count = files.length;
document.getElementById("openrom").innerHTML = '';
document.getElementById("openrom").style.display = 'none';
for (var i = 0; i < files.length; i++)
for (var i = 0; i < files.length; i++)
{
filereader = new FileReader();
filereader.file_name = files[i].name;
@ -103,35 +100,30 @@
Module.FS_createDataFile('/', name, dataView, true, false);
}
var Module =
var Module =
{
noInitialRun: true,
arguments: ["-v", "--menu"],
preRun: [],
postRun: [],
print: (function()
print: (function()
{
var element = document.getElementById('output');
element.value = ''; // clear browser cache
return function(text)
return function(text)
{
text = Array.prototype.slice.call(arguments).join(' ');
element.value += text + "\n";
element.scrollTop = 99999; // focus on bottom
console.log(text);
};
})(),
printErr: function(text)
{
var text = Array.prototype.slice.call(arguments).join(' ');
var element = document.getElementById('output');
element.value += text + "\n";
element.scrollTop = 99999; // focus on bottom
var errArgs = Array.prototype.slice.call(arguments).join(' ');
console.error(errArgs);
},
canvas: document.getElementById('canvas'),
totalDependencies: 0,
monitorRunDependencies: function(left)
monitorRunDependencies: function(left)
{
this.totalDependencies = Math.max(this.totalDependencies, left);
}
@ -139,4 +131,4 @@
</script>
<script type="text/javascript" src="browserfs.js"></script>
<script type="text/javascript" src="gambatte.js"></script>
<script type="text/javascript" src="gambatte.js"></script>

View File

@ -28,10 +28,6 @@
#include <unistd.h>
#endif
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef __QNX__
#include <libgen.h>
#endif
@ -65,118 +61,6 @@
#include "paths.h"
#include "verbosity.h"
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size)
{
#if !defined(RARCH_CONSOLE)
if (*in_path == '~')
{
const char *home = getenv("HOME");
if (home)
{
size_t src_size = strlcpy(out_path, home, size);
retro_assert(src_size < size);
out_path += src_size;
size -= src_size;
in_path++;
}
}
else if ((in_path[0] == ':') &&
(
(in_path[1] == '/')
#ifdef _WIN32
|| (in_path[1] == '\\')
#endif
)
)
{
size_t src_size;
char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
application_dir[0] = '\0';
fill_pathname_application_path(application_dir,
PATH_MAX_LENGTH * sizeof(char));
path_basedir_wrapper(application_dir);
src_size = strlcpy(out_path, application_dir, size);
retro_assert(src_size < size);
free(application_dir);
out_path += src_size;
size -= src_size;
in_path += 2;
}
#endif
retro_assert(strlcpy(out_path, in_path, size) < size);
}
void fill_pathname_abbreviate_special(char *out_path,
const char *in_path, size_t size)
{
#if !defined(RARCH_CONSOLE)
unsigned i;
const char *candidates[3];
const char *notations[3];
char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
const char *home = getenv("HOME");
application_dir[0] = '\0';
/* application_dir could be zero-string. Safeguard against this.
*
* Keep application dir in front of home, moving app dir to a
* new location inside home would break otherwise. */
/* ugly hack - use application_dir pointer
* before filling it in. C89 reasons */
candidates[0] = application_dir;
candidates[1] = home;
candidates[2] = NULL;
notations [0] = ":";
notations [1] = "~";
notations [2] = NULL;
fill_pathname_application_path(application_dir,
PATH_MAX_LENGTH * sizeof(char));
path_basedir_wrapper(application_dir);
for (i = 0; candidates[i]; i++)
{
if (!string_is_empty(candidates[i]) &&
strstr(in_path, candidates[i]) == in_path)
{
size_t src_size = strlcpy(out_path, notations[i], size);
retro_assert(src_size < size);
out_path += src_size;
size -= src_size;
in_path += strlen(candidates[i]);
if (!path_char_is_slash(*in_path))
{
retro_assert(strlcpy(out_path,
path_default_slash(), size) < size);
out_path++;
size--;
}
break; /* Don't allow more abbrevs to take place. */
}
}
free(application_dir);
#endif
retro_assert(strlcpy(out_path, in_path, size) < size);
}
bool fill_pathname_application_data(char *s, size_t len)
{
#if defined(_WIN32) && !defined(_XBOX)
@ -240,103 +124,6 @@ bool fill_pathname_application_data(char *s, size_t len)
return false;
}
#if !defined(RARCH_CONSOLE)
void fill_pathname_application_path(char *s, size_t len)
{
size_t i;
#ifdef __APPLE__
CFBundleRef bundle = CFBundleGetMainBundle();
#endif
#ifdef _WIN32
DWORD ret;
wchar_t wstr[PATH_MAX_LENGTH] = {0};
#endif
#ifdef __HAIKU__
image_info info;
int32_t cookie = 0;
#endif
(void)i;
if (!len)
return;
#ifdef _WIN32
#ifdef LEGACY_WIN32
ret = GetModuleFileNameA(GetModuleHandle(NULL), s, len);
#else
ret = GetModuleFileNameW(GetModuleHandle(NULL), wstr, ARRAY_SIZE(wstr));
if (*wstr)
{
char *str = utf16_to_utf8_string_alloc(wstr);
if (str)
{
strlcpy(s, str, len);
free(str);
}
}
#endif
s[ret] = '\0';
#elif defined(__APPLE__)
if (bundle)
{
CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);
CFStringRef bundle_path = CFURLCopyPath(bundle_url);
CFStringGetCString(bundle_path, s, len, kCFStringEncodingUTF8);
CFRelease(bundle_path);
CFRelease(bundle_url);
retro_assert(strlcat(s, "nobin", len) < len);
return;
}
#elif defined(__HAIKU__)
while (get_next_image_info(0, &cookie, &info) == B_OK)
{
if (info.type == B_APP_IMAGE)
{
strlcpy(s, info.name, len);
return;
}
}
#elif defined(__QNX__)
char *buff = malloc(len);
if(_cmdname(buff))
strlcpy(s, buff, len);
free(buff);
#else
{
pid_t pid;
static const char *exts[] = { "exe", "file", "path/a.out" };
char link_path[255];
link_path[0] = *s = '\0';
pid = getpid();
/* Linux, BSD and Solaris paths. Not standardized. */
for (i = 0; i < ARRAY_SIZE(exts); i++)
{
ssize_t ret;
snprintf(link_path, sizeof(link_path), "/proc/%u/%s",
(unsigned)pid, exts[i]);
ret = readlink(link_path, s, len - 1);
if (ret >= 0)
{
s[ret] = '\0';
return;
}
}
}
RARCH_ERR("Cannot resolve application path! This should not happen.\n");
#endif
}
#endif
#ifdef HAVE_XMB
const char* xmb_theme_ident(void);
#endif
@ -626,31 +413,3 @@ void fill_short_pathname_representation_wrapper(char* out_rep,
fill_short_pathname_representation(out_rep, in_path, size);
free(path_short);
}
/**
* path_basedir:
* @path : path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
**/
void path_basedir_wrapper(char *path)
{
char *last = NULL;
if (strlen(path) < 2)
return;
#ifdef HAVE_COMPRESSION
/* We want to find the directory with the archive in basedir. */
last = (char*)path_get_archive_delim(path);
if (last)
*last = '\0';
#endif
last = find_last_slash(path);
if (last)
last[1] = '\0';
else
snprintf(path, 3, ".%s", path_default_slash());
}

View File

@ -130,15 +130,6 @@ enum application_special_type
void fill_short_pathname_representation_wrapper(char* out_rep,
const char *in_path, size_t size);
/**
* path_basedir:
* @path : path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
**/
void path_basedir_wrapper(char *path);
const char *file_path_str(enum file_path_enum enum_idx);
bool fill_pathname_application_data(char *s, size_t len);

View File

@ -16,6 +16,7 @@
*/
#include <emscripten/emscripten.h>
#include <emscripten/html5.h>
#include <string.h>
#include <file/config_file.h>
@ -38,14 +39,42 @@
#include "../../defaults.h"
#include "../../content.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../../command.h"
#include "../../tasks/tasks_internal.h"
#include "../../file_path_special.h"
void RWebAudioRecalibrateTime(void);
static unsigned emscripten_fullscreen_reinit;
static EM_BOOL emscripten_fullscreenchange_cb(int event_type,
const EmscriptenFullscreenChangeEvent *fullscreen_change_event,
void *user_data)
{
(void)event_type;
(void)fullscreen_change_event;
(void)user_data;
emscripten_fullscreen_reinit = 5;
return EM_TRUE;
}
static void emscripten_mainloop(void)
{
unsigned sleep_ms = 0;
int ret = runloop_iterate(&sleep_ms);
int ret;
RWebAudioRecalibrateTime();
if (emscripten_fullscreen_reinit != 0)
{
if (--emscripten_fullscreen_reinit == 0)
command_event(CMD_EVENT_REINIT, NULL);
}
ret = runloop_iterate(&sleep_ms);
if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms);
@ -56,7 +85,7 @@ static void emscripten_mainloop(void)
return;
main_exit(NULL);
exit(0);
emscripten_force_exit(0);
}
void cmd_savefiles(void)
@ -161,18 +190,24 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
if (!string_is_empty(dir_path))
path_mkdir(dir_path);
}
snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "rgui");
}
int main(int argc, char *argv[])
{
settings_t *settings = config_get_ptr();
EMSCRIPTEN_RESULT r;
emscripten_set_canvas_size(800, 600);
emscripten_set_canvas_element_size("#canvas", 800, 600);
emscripten_set_element_css_size("#canvas", 800.0, 600.0);
emscripten_set_main_loop(emscripten_mainloop, 0, 0);
rarch_main(argc, argv, NULL);
emscripten_set_main_loop(emscripten_mainloop,
settings->bools.video_vsync ? 0 : INT_MAX, 1);
r = emscripten_set_fullscreenchange_callback("#document", NULL, false,
emscripten_fullscreenchange_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/CTX] failed to create fullscreen callback: %d\n", r);
}
return 0;
}

View File

@ -974,7 +974,7 @@ static bool frontend_unix_powerstate_check_apm(
if (!next_string(&ptr, &str)) /* remaining battery life time units */
goto error;
else if (string_is_equal_fast(str, "min", 3))
else if (string_is_equal(str, "min"))
battery_time *= 60;
if (battery_flag == 0xFF) /* unknown state */
@ -1337,7 +1337,7 @@ static void frontend_unix_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
bool used = string_is_equal_fast(argv, "false", 5) ? false : true;
bool used = string_is_equal(argv, "false") ? false : true;
(*env)->ReleaseStringUTFChars(env, jstr, argv);

View File

@ -204,9 +204,9 @@ bool d3d_initialize_symbols(void)
#if defined(HAVE_D3D9)
#if defined(DEBUG) || defined(_DEBUG)
g_d3d_dll = dylib_load("d3d9d.dll");
#else
g_d3d_dll = dylib_load("d3d9.dll");
if(!g_d3d_dll)
#endif
g_d3d_dll = dylib_load("d3d9.dll");
#ifdef HAVE_D3DX
g_d3dx_dll = dylib_load_d3dx();
#endif
@ -221,9 +221,9 @@ bool d3d_initialize_symbols(void)
#elif defined(HAVE_D3D8)
#if defined(DEBUG) || defined(_DEBUG)
g_d3d_dll = dylib_load("d3d8d.dll");
#else
g_d3d_dll = dylib_load("d3d8.dll");
if(!g_d3d_dll)
#endif
g_d3d_dll = dylib_load("d3d8.dll");
if (!g_d3d_dll)
return false;
#endif
@ -363,9 +363,7 @@ bool d3d_get_adapter_display_mode(LPDIRECT3D d3d,
bool d3d_swap(void *data, LPDIRECT3DDEVICE dev)
{
#if defined(_XBOX1)
D3DDevice_Swap(0);
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_Present(dev);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
if (IDirect3DDevice9_Present(dev, NULL, NULL, NULL, NULL) == D3DERR_DEVICELOST)
@ -383,9 +381,7 @@ bool d3d_swap(void *data, LPDIRECT3DDEVICE dev)
void d3d_set_transform(LPDIRECT3DDEVICE dev,
D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix)
{
#if defined(_XBOX1)
D3DDevice_SetTransform(state, matrix);
#elif !defined(_XBOX360)
#if !defined(_XBOX360)
/* XBox 360 D3D9 does not support fixed-function pipeline. */
#if defined(HAVE_D3D9) && !defined(__cplusplus)
@ -431,7 +427,7 @@ bool d3d_texture_get_surface_level(LPDIRECT3DTEXTURE tex,
if (SUCCEEDED(IDirect3DTexture9_GetSurfaceLevel(tex, idx, (IDirect3DSurface9**)_ppsurface_level)))
return true;
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
if (SUCCEEDED(IDirect3DTexture8_GetSurfaceLevel(tex, idx, (LPDIRECT3DSURFACE**)_ppsurface_level)))
if (SUCCEEDED(IDirect3DTexture8_GetSurfaceLevel(tex, idx, (IDirect3DSurface8**)_ppsurface_level)))
return true;
#else
if (SUCCEEDED(tex->GetSurfaceLevel(idx, (ID3DSURFACE**)_ppsurface_level)))
@ -467,11 +463,18 @@ LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
unsigned miplevels, unsigned usage, D3DFORMAT format,
D3DPOOL pool, unsigned filter, unsigned mipfilter,
D3DCOLOR color_key, void *src_info_data,
PALETTEENTRY *palette)
PALETTEENTRY *palette, bool want_mipmap)
{
HRESULT hr;
LPDIRECT3DTEXTURE buf;
#ifndef _XBOX
#ifdef HAVE_D3D9
if (want_mipmap)
usage |= D3DUSAGE_AUTOGENMIPMAP;
#endif
#endif
#ifdef HAVE_D3DX
if (path)
return d3d_texture_new_from_file(dev,
@ -671,16 +674,14 @@ void *d3d_vertex_buffer_lock(void *vertbuf_ptr)
void *buf = NULL;
LPDIRECT3DVERTEXBUFFER vertbuf = (LPDIRECT3DVERTEXBUFFER)vertbuf_ptr;
#if defined(_XBOX1)
buf = (void*)D3DVertexBuffer_Lock2(vertbuf, 0);
#elif defined(_XBOX360)
#if defined(_XBOX360)
buf = D3DVertexBuffer_Lock(vertbuf, 0, 0, 0);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DVertexBuffer9_Lock(vertbuf, 0, sizeof(buf), &buf, 0);
IDirect3DVertexBuffer9_Lock(vertbuf, 0, 0, &buf, 0);
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
IDirect3DVertexBuffer8_Lock(vertbuf, 0, sizeof(buf), &buf, 0);
IDirect3DVertexBuffer8_Lock(vertbuf, 0, 0, (BYTE**)&buf, 0);
#else
vertbuf->Lock(0, sizeof(buf), &buf, 0);
vertbuf->Lock(0, 0, &buf, 0);
#endif
if (!buf)
@ -764,7 +765,7 @@ bool d3d_device_create_offscreen_plain_surface(
#ifndef _XBOX360
/* XBox 360 has no fixed-function pipeline. */
static void d3d_set_texture_stage_state(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value, unsigned type)
unsigned sampler, unsigned type, unsigned value)
{
#if defined(HAVE_D3D9) && !defined(__cplusplus)
if (IDirect3DDevice9_SetTextureStageState(dev, sampler, (D3DTEXTURESTAGESTATETYPE)type, value) != D3D_OK)
@ -782,10 +783,7 @@ static void d3d_set_texture_stage_state(LPDIRECT3DDEVICE dev,
void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value)
{
#if defined(_XBOX1)
D3D__DirtyFlags |= (D3DDIRTYFLAG_TEXTURE_STATE_0 << sampler);
D3D__TextureState[sampler][D3DTSS_ADDRESSU] = value;
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_SetSamplerState_AddressU_Inline(dev, sampler, value);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSU, value);
@ -799,10 +797,7 @@ void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev,
void d3d_set_sampler_address_v(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value)
{
#if defined(_XBOX1)
D3D__DirtyFlags |= (D3DDIRTYFLAG_TEXTURE_STATE_0 << sampler);
D3D__TextureState[sampler][D3DTSS_ADDRESSV] = value;
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_SetSamplerState_AddressV_Inline(dev, sampler, value);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSV, value);
@ -816,10 +811,7 @@ void d3d_set_sampler_address_v(LPDIRECT3DDEVICE dev,
void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value)
{
#if defined(_XBOX1)
D3D__DirtyFlags |= (D3DDIRTYFLAG_TEXTURE_STATE_0 << sampler);
D3D__TextureState[sampler][D3DTSS_MINFILTER] = value;
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_SetSamplerState_MinFilter(dev, sampler, value);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MINFILTER, value);
@ -833,10 +825,7 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value)
{
#if defined(_XBOX1)
D3D__DirtyFlags |= (D3DDIRTYFLAG_TEXTURE_STATE_0 << sampler);
D3D__TextureState[sampler][D3DTSS_MAGFILTER] = value;
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_SetSamplerState_MagFilter(dev, sampler, value);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MAGFILTER, value);
@ -847,6 +836,14 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
#endif
}
void d3d_set_sampler_mipfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value)
{
#if defined(HAVE_D3D9)
IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MIPFILTER, value);
#endif
}
bool d3d_begin_scene(LPDIRECT3DDEVICE dev)
{
#if defined(HAVE_D3D9) && !defined(__cplusplus)
@ -895,9 +892,7 @@ static void d3d_draw_primitive_internal(LPDIRECT3DDEVICE dev,
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
D3DPRIMITIVETYPE type, unsigned start, unsigned count)
{
#if defined(_XBOX1)
D3DDevice_DrawVertices(type, start, D3DVERTEXCOUNT(type, count));
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_DrawVertices(dev, type, start, D3DVERTEXCOUNT(type, count));
#else
if (d3d_begin_scene(dev))
@ -912,9 +907,7 @@ void d3d_clear(LPDIRECT3DDEVICE dev,
unsigned count, const D3DRECT *rects, unsigned flags,
D3DCOLOR color, float z, unsigned stencil)
{
#if defined(_XBOX1)
D3DDevice_Clear(count, rects, flags, color, z, stencil);
#elif defined(_XBOX360)
#if defined(_XBOX360)
D3DDevice_Clear(dev, count, rects, flags, color, z,
stencil, false);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
@ -984,9 +977,7 @@ bool d3d_lock_rectangle(LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags)
{
#if defined(_XBOX)
D3DTexture_LockRect(tex, level, lock_rect, rect, flags);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
#if defined(HAVE_D3D9) && !defined(__cplusplus)
if (IDirect3DTexture9_LockRect(tex, level, lock_rect, (const RECT*)rect, flags) != D3D_OK)
return false;
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
@ -1027,8 +1018,6 @@ void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp)
{
#if defined(_XBOX360)
D3DDevice_SetViewport(dev, vp);
#elif defined(_XBOX1)
D3DDevice_SetViewport(vp);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetViewport(dev, vp);
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
@ -1042,9 +1031,7 @@ void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
void *tex_data)
{
LPDIRECT3DTEXTURE tex = (LPDIRECT3DTEXTURE)tex_data;
#if defined(_XBOX1)
D3DDevice_SetTexture(sampler, tex);
#elif defined(_XBOX360)
#if defined(_XBOX360)
unsigned fetchConstant =
GPU_CONVERT_D3D_TO_HARDWARE_TEXTUREFETCHCONSTANT(sampler);
uint64_t pendingMask3 =
@ -1059,7 +1046,7 @@ void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetTexture(dev, sampler, (IDirect3DBaseTexture9*)tex);
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
IDirect3DDevice8_SetTexture(dev, sampler, tex);
IDirect3DDevice8_SetTexture(dev, sampler, (IDirect3DBaseTexture8*)tex);
#else
dev->SetTexture(sampler, tex);
#endif
@ -1099,7 +1086,7 @@ bool d3d_create_vertex_shader(LPDIRECT3DDEVICE dev, const DWORD *a, void **b)
if (!dev)
return false;
#if defined(__cplusplus)
if (dev->CreateVertexShader(a, b) != D3D_OK)
if (dev->CreateVertexShader(a, (IDirect3DVertexShader9**)b) != D3D_OK)
return false;
#else
if (IDirect3DDevice9_CreateVertexShader(dev, a,
@ -1118,7 +1105,7 @@ bool d3d_create_pixel_shader(LPDIRECT3DDEVICE dev, const DWORD *a, void **b)
if (!dev)
return false;
#if defined(__cplusplus)
if (dev->CreatePixelShader(a, b) != D3D_OK)
if (dev->CreatePixelShader(a, (IDirect3DPixelShader9**)b) != D3D_OK)
return false;
#else
if (IDirect3DDevice9_CreatePixelShader(dev, a,
@ -1175,29 +1162,72 @@ bool d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
return true;
}
bool d3d_set_vertex_shader_constantf(LPDIRECT3DDEVICE dev,
UINT start_register,const float* constant_data,
unsigned vector4f_count)
{
#if defined(HAVE_D3D9)
#ifdef __cplusplus
return (dev->SetVertexShaderConstantF(
start_register, constant_data, vector4f_count) == D3D_OK);
#else
#ifdef _XBOX
IDirect3DDevice9_SetVertexShaderConstantF(dev,
start_register, constant_data, vector4f_count);
return true;
#else
return (IDirect3DDevice9_SetVertexShaderConstantF(dev,
start_register, constant_data, vector4f_count) == D3D_OK);
#endif
#endif
#endif
return false;
}
void d3d_texture_blit(unsigned pixel_size,
LPDIRECT3DTEXTURE tex, D3DLOCKED_RECT *lr, const void *frame,
LPDIRECT3DTEXTURE tex,
D3DLOCKED_RECT *lr, const void *frame,
unsigned width, unsigned height, unsigned pitch)
{
if (d3d_lock_rectangle(tex, 0, lr, NULL, 0, 0))
{
#if defined(_XBOX360)
D3DSURFACE_DESC desc;
d3d_texture_get_level_desc(tex, 0, &desc);
XGCopySurface(lr->pBits, lr->Pitch, width, height, desc.Format, NULL,
frame, pitch, desc.Format, NULL, 0, 0);
D3DSURFACE_DESC desc;
d3d_texture_get_level_desc(tex, 0, &desc);
XGCopySurface(lr->pBits, lr->Pitch, width, height, desc.Format, NULL,
frame, pitch, desc.Format, NULL, 0, 0);
#else
unsigned y;
for (y = 0; y < height; y++)
{
const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)lr->pBits + y * lr->Pitch;
memcpy(out, in, width * pixel_size);
}
#endif
d3d_unlock_rectangle(tex);
unsigned y;
for (y = 0; y < height; y++)
{
const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)lr->pBits + y * lr->Pitch;
memcpy(out, in, width * pixel_size);
}
#endif
}
bool d3d_get_render_state(void *data, D3DRENDERSTATETYPE state, DWORD *value)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return false;
#if defined(HAVE_D3D9) && !defined(__cplusplus)
#ifdef _XBOX
IDirect3DDevice9_GetRenderState(dev, state, value);
return true;
#else
if (IDirect3DDevice9_GetRenderState(dev, state, value) == D3D_OK)
return true;
#endif
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
if (IDirect3DDevice8_GetRenderState(dev, state, value) == D3D_OK)
return true;
#else
if (dev->GetRenderState(state, value) == D3D_OK)
return true;
#endif
return false;
}
void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value)
@ -1287,16 +1317,16 @@ void d3d_disable_blend_func(void *data)
void d3d_set_vertex_declaration(void *data, void *vertex_data)
{
#if defined(HAVE_D3D9)
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
if (!dev)
return;
#ifdef _XBOX1
d3d_set_vertex_shader(dev, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
IDirect3DDevice9_SetVertexDeclaration(dev, (LPDIRECT3DVERTEXDECLARATION)vertex_data);
#elif defined(HAVE_D3D9)
#ifdef __cplusplus
dev->SetVertexDeclaration((LPDIRECT3DVERTEXDECLARATION)vertex_data);
#else
IDirect3DDevice9_SetVertexDeclaration(dev, (LPDIRECT3DVERTEXDECLARATION)vertex_data);
#endif
#endif
}

View File

@ -24,6 +24,12 @@
RETRO_BEGIN_DECLS
typedef struct d3d_texture
{
LPDIRECT3DTEXTURE data;
D3DPOOL pool;
} d3d_texture_t;
bool d3d_swap(void *data, LPDIRECT3DDEVICE dev);
LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
@ -46,7 +52,7 @@ LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev,
unsigned miplevels, unsigned usage, D3DFORMAT format,
D3DPOOL pool, unsigned filter, unsigned mipfilter,
D3DCOLOR color_key, void *src_info,
PALETTEENTRY *palette);
PALETTEENTRY *palette, bool want_mipmap);
void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no,
void *stream_vertbuf, unsigned offset_bytes,
@ -69,6 +75,9 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value);
void d3d_set_sampler_mipfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value);
bool d3d_begin_scene(LPDIRECT3DDEVICE dev);
void d3d_end_scene(LPDIRECT3DDEVICE dev);
@ -108,6 +117,9 @@ bool d3d_set_pixel_shader(LPDIRECT3DDEVICE dev, void *data);
bool d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
void *data);
bool d3d_set_vertex_shader_constantf(LPDIRECT3DDEVICE dev,
UINT start_register,const float* constant_data, unsigned vector4f_count);
void d3d_texture_blit(unsigned pixel_size,
LPDIRECT3DTEXTURE tex,
D3DLOCKED_RECT *lr, const void *frame,
@ -141,7 +153,11 @@ bool d3d_device_get_render_target(LPDIRECT3DDEVICE dev,
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
void *data);
void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value);
bool d3d_get_render_state(void *data,
D3DRENDERSTATETYPE state, DWORD *value);
void d3d_set_render_state(void *data,
D3DRENDERSTATETYPE state, DWORD value);
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
void *data);

View File

@ -460,7 +460,7 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
keydown = false;
#if _WIN32_WINNT >= 0x0501 /* XP */
if (string_is_equal_fast(config_get_ptr()->arrays.input_driver, "raw", 4))
if (string_is_equal(config_get_ptr()->arrays.input_driver, "raw"))
keycode = input_keymaps_translate_keysym_to_rk((unsigned)(wparam));
else
#endif

View File

@ -55,13 +55,6 @@
#include "../../defines/d3d_defines.h"
#include "../../verbosity.h"
#ifdef _XBOX
#ifndef HAVE_FBO
#define HAVE_FBO
#endif
#endif
static LPDIRECT3D g_pD3D;
static bool d3d_init_imports(d3d_video_t *d3d)
@ -112,9 +105,9 @@ static bool d3d_init_imports(d3d_video_t *d3d)
static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
{
struct LinkInfo link_info;
unsigned current_width, current_height, out_width, out_height;
unsigned i = 0;
struct LinkInfo link_info = {0};
(void)i;
(void)current_width;
@ -123,11 +116,10 @@ static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
(void)out_height;
/* Setup information for first pass. */
#ifndef _XBOX
link_info.pass = NULL;
link_info.tex_w = video_info->input_scale * RARCH_SCALE_BASE;
link_info.tex_h = video_info->input_scale * RARCH_SCALE_BASE;
link_info.pass = &d3d->shader.pass[0];
#endif
link_info.tex_w = link_info.tex_h =
video_info->input_scale * RARCH_SCALE_BASE;
if (!renderchain_d3d_init_first(&d3d->renderchain_driver,
&d3d->renderchain_data))
@ -219,7 +211,6 @@ static bool d3d_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
static bool d3d_init_singlepass(d3d_video_t *d3d)
{
#ifndef _XBOX
struct video_shader_pass *pass = NULL;
if (!d3d)
@ -240,12 +231,10 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
if (!string_is_empty(d3d->shader_path))
strlcpy(pass->source.path, d3d->shader_path,
sizeof(pass->source.path));
#endif
return true;
}
#ifdef HAVE_FBO
static bool d3d_init_multipass(d3d_video_t *d3d, const char *shader_path)
{
unsigned i;
@ -313,16 +302,13 @@ static bool d3d_init_multipass(d3d_video_t *d3d, const char *shader_path)
return true;
}
#endif
static bool d3d_process_shader(d3d_video_t *d3d)
{
#ifdef HAVE_FBO
const char *shader_path = d3d->shader_path;
if (d3d && !string_is_empty(shader_path) &&
string_is_equal(path_get_extension(shader_path), "cgp"))
return d3d_init_multipass(d3d, shader_path);
#endif
return d3d_init_singlepass(d3d);
}
@ -339,6 +325,14 @@ static void d3d_viewport_info(void *data, struct video_viewport *vp)
d3d->renderchain_driver->viewport_info(d3d, vp);
}
static void d3d_set_mvp(void *data,
void *shader_data,
const void *mat_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
d3d->renderchain_driver->set_mvp(d3d, d3d->renderchain_data, shader_data, mat_data);
}
static void d3d_overlay_render(d3d_video_t *d3d,
video_frame_info_t *video_info,
overlay_t *overlay)
@ -346,8 +340,8 @@ static void d3d_overlay_render(d3d_video_t *d3d,
struct video_viewport vp;
void *verts;
unsigned i;
float vert[4][9];
float overlay_width, overlay_height;
Vertex vert[4];
unsigned width = video_info->width;
unsigned height = video_info->height;
@ -357,7 +351,7 @@ static void d3d_overlay_render(d3d_video_t *d3d,
if (!overlay->vert_buf)
{
overlay->vert_buf = d3d_vertex_buffer_new(
d3d->dev, sizeof(vert), 0, 0, D3DPOOL_MANAGED, NULL);
d3d->dev, sizeof(vert), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, NULL);
if (!overlay->vert_buf)
return;
@ -365,63 +359,45 @@ static void d3d_overlay_render(d3d_video_t *d3d,
for (i = 0; i < 4; i++)
{
vert[i][2] = 0.5f;
vert[i][5] = 1.0f;
vert[i][6] = 1.0f;
vert[i][7] = 1.0f;
vert[i][8] = overlay->alpha_mod;
vert[i].z = 0.5f;
vert[i].color = (((uint32_t)(overlay->alpha_mod * 0xFF)) << 24) | 0xFFFFFF;
}
d3d_viewport_info(d3d, &vp);
overlay_width = vp.width;
overlay_height = vp.height;
vert[0].x = overlay->vert_coords[0];
vert[1].x = overlay->vert_coords[0] + overlay->vert_coords[2];
vert[2].x = overlay->vert_coords[0];
vert[3].x = overlay->vert_coords[0] + overlay->vert_coords[2];
vert[0].y = overlay->vert_coords[1];
vert[1].y = overlay->vert_coords[1];
vert[2].y = overlay->vert_coords[1] + overlay->vert_coords[3];
vert[3].y = overlay->vert_coords[1] + overlay->vert_coords[3];
vert[0][0] = overlay->vert_coords[0] * overlay_width;
vert[1][0] = (overlay->vert_coords[0] + overlay->vert_coords[2])
* overlay_width;
vert[2][0] = overlay->vert_coords[0] * overlay_width;
vert[3][0] = (overlay->vert_coords[0] + overlay->vert_coords[2])
* overlay_width;
vert[0][1] = overlay->vert_coords[1] * overlay_height;
vert[1][1] = overlay->vert_coords[1] * overlay_height;
vert[2][1] = (overlay->vert_coords[1] + overlay->vert_coords[3])
* overlay_height;
vert[3][1] = (overlay->vert_coords[1] + overlay->vert_coords[3])
* overlay_height;
vert[0][3] = overlay->tex_coords[0];
vert[1][3] = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[2][3] = overlay->tex_coords[0];
vert[3][3] = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[0][4] = overlay->tex_coords[1];
vert[1][4] = overlay->tex_coords[1];
vert[2][4] = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[3][4] = overlay->tex_coords[1] + overlay->tex_coords[3];
/* Align texels and vertices. */
for (i = 0; i < 4; i++)
{
vert[i][0] -= 0.5f;
vert[i][1] += 0.5f;
}
vert[0].u = overlay->tex_coords[0];
vert[1].u = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[2].u = overlay->tex_coords[0];
vert[3].u = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[0].v = overlay->tex_coords[1];
vert[1].v = overlay->tex_coords[1];
vert[2].v = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[3].v = overlay->tex_coords[1] + overlay->tex_coords[3];
verts = d3d_vertex_buffer_lock(overlay->vert_buf);
memcpy(verts, vert, sizeof(vert));
d3d_vertex_buffer_unlock(overlay->vert_buf);
d3d_enable_blend_func(d3d->dev);
#if defined(HAVE_D3D9)
{
LPDIRECT3DVERTEXDECLARATION vertex_decl;
/* set vertex declaration for overlay. */
D3DVERTEXELEMENT vElems[4] = {
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
{0, offsetof(Vertex, x), D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_POSITION, 0},
{0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
{0, offsetof(Vertex, u), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_TEXCOORD, 0},
{0, 20, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT,
{0, offsetof(Vertex, color), D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_COLOR, 0},
D3DDECL_END()
};
@ -429,6 +405,8 @@ static void d3d_overlay_render(d3d_video_t *d3d,
d3d_set_vertex_declaration(d3d->dev, vertex_decl);
d3d_vertex_declaration_free(vertex_decl);
}
#elif defined(HAVE_D3D8)
d3d_set_vertex_shader(d3d->dev, D3DFVF_CUSTOMVERTEX, NULL);
#endif
d3d_set_stream_source(d3d->dev, 0, overlay->vert_buf,
@ -489,6 +467,9 @@ static void d3d_deinitialize(d3d_video_t *d3d)
font_driver_free_osd();
d3d_deinit_chain(d3d);
d3d_vertex_buffer_free(d3d->menu_display.buffer, d3d->menu_display.decl);
d3d->menu_display.buffer = NULL;
d3d->menu_display.decl = NULL;
}
#if defined(HAVE_D3D8)
@ -586,7 +567,9 @@ void d3d_make_d3dpp(void *data,
d3dpp->BackBufferCount = 2;
d3dpp->BackBufferFormat = d3d_get_color_format_backbuffer(
info->rgb32, windowed_enable);
#ifndef _XBOX
d3dpp->hDeviceWindow = win32_get_window();
#endif
#ifdef _XBOX360
d3dpp->FrontBufferFormat = d3d_get_color_format_front_buffer();
@ -670,9 +653,13 @@ void d3d_make_d3dpp(void *data,
static bool d3d_init_base(void *data, const video_info_t *info)
{
D3DPRESENT_PARAMETERS d3dpp;
HWND focus_window = win32_get_window();
HWND focus_window = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
#ifndef _XBOX
focus_window = win32_get_window();
#endif
memset(&d3dpp, 0, sizeof(d3dpp));
g_pD3D = (LPDIRECT3D)d3d_create();
@ -834,6 +821,12 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
d3d_make_d3dpp(d3d, info, &d3dpp);
/* the D3DX font driver uses POOL_DEFAULT resources
* and will prevent a clean reset here
* another approach would be to keep track of all created D3D
* font objects and free/realloc them around the d3d_reset call */
menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
if (!d3d_reset(d3d->dev, &d3dpp))
{
d3d_deinitialize(d3d);
@ -844,6 +837,7 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
if (ret)
RARCH_LOG("[D3D]: Recovered from dead state.\n");
}
menu_driver_init(info->is_threaded);
}
if (!ret)
@ -867,6 +861,38 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
info->is_threaded,
FONT_DRIVER_RENDER_DIRECT3D_API);
#ifdef HAVE_D3D9
{
static const D3DVERTEXELEMENT VertexElements[4] = {
{0, offsetof(Vertex, x), D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_POSITION, 0},
{0, offsetof(Vertex, u), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_TEXCOORD, 0},
{0, offsetof(Vertex, color), D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_COLOR, 0},
D3DDECL_END()
};
if (!d3d_vertex_declaration_new(d3d->dev,
(void*)VertexElements, (void**)&d3d->menu_display.decl))
return false;
}
#endif
d3d->menu_display.offset = 0;
d3d->menu_display.size = 1024;
d3d->menu_display.buffer = d3d_vertex_buffer_new(
d3d->dev, d3d->menu_display.size * sizeof(Vertex),
D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT,
NULL);
if (!d3d->menu_display.buffer)
return false;
d3d_matrix_ortho_off_center_lh(&d3d->mvp_transposed, 0, 1, 0, 1, 0, 1);
d3d_matrix_transpose(&d3d->mvp, &d3d->mvp_transposed);
d3d_set_render_state(d3d->dev, D3DRS_CULLMODE, D3DCULL_NONE);
return true;
}
@ -1002,7 +1028,7 @@ static void d3d_set_osd_msg(void *data,
if (d3d->renderchain_driver->set_font_rect && params)
d3d->renderchain_driver->set_font_rect(d3d, params);
font_driver_render_msg(video_info, NULL, msg, params);
font_driver_render_msg(video_info, font, msg, params);
}
static bool d3d_init_internal(d3d_video_t *d3d,
@ -1176,26 +1202,6 @@ static void *d3d_init(const video_info_t *info,
if (!d3d_initialize_symbols())
return NULL;
#ifdef _XBOX
if (video_driver_get_ptr(false))
{
d3d = (d3d_video_t*)video_driver_get_ptr(false);
/* Reinitialize renderchain as we
* might have changed pixel formats.*/
if (d3d->renderchain_driver->reinit(d3d, (const void*)info))
{
d3d_deinit_chain(d3d);
d3d_init_chain(d3d, info);
input_driver_set(input, input_data);
video_driver_set_own_driver();
return d3d;
}
}
#endif
d3d = (d3d_video_t*)calloc(1, sizeof(*d3d));
if (!d3d)
goto error;
@ -1223,9 +1229,6 @@ static void *d3d_init(const video_info_t *info,
}
d3d->keep_aspect = info->force_aspect;
#ifdef _XBOX
video_driver_set_own_driver();
#endif
return d3d;
@ -1284,7 +1287,9 @@ static void d3d_free(void *data)
d3d->dev = NULL;
g_pD3D = NULL;
#ifndef _XBOX
win32_monitor_from_window();
#endif
if (d3d)
free(d3d);
@ -1359,7 +1364,7 @@ static bool d3d_overlay_load(void *data,
0,
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED, 0, 0, 0,
NULL, NULL);
NULL, NULL, false);
if (!overlay->tex)
{
@ -1445,10 +1450,8 @@ static bool d3d_frame(void *data, const void *frame,
D3DVIEWPORT screen_vp;
unsigned i = 0;
d3d_video_t *d3d = (d3d_video_t*)data;
HWND window = win32_get_window();
unsigned width = video_info->width;
unsigned height = video_info->height;
(void)i;
if (!frame)
@ -1457,8 +1460,11 @@ static bool d3d_frame(void *data, const void *frame,
/* We cannot recover in fullscreen. */
if (d3d->needs_restore)
{
#ifndef _XBOX
HWND window = win32_get_window();
if (IsIconic(window))
return true;
#endif
if (!d3d_restore(d3d))
{
@ -1506,16 +1512,18 @@ static bool d3d_frame(void *data, const void *frame,
return false;
}
if (msg)
{
struct font_params font_parms = {0};
font_driver_render_msg(video_info, NULL, msg, &font_parms);
}
#ifdef HAVE_MENU
if (d3d->menu && d3d->menu->enabled)
{
d3d_set_mvp(d3d, NULL, &d3d->mvp);
d3d_overlay_render(d3d, video_info, d3d->menu);
d3d->menu_display.offset = 0;
d3d_set_vertex_declaration(d3d->dev, d3d->menu_display.decl);
d3d_set_stream_source(d3d->dev, 0, d3d->menu_display.buffer, 0, sizeof(Vertex));
d3d_set_viewports(d3d->dev, &screen_vp);
menu_driver_frame(video_info);
}
#endif
@ -1523,11 +1531,18 @@ static bool d3d_frame(void *data, const void *frame,
#ifdef HAVE_OVERLAY
if (d3d->overlays_enabled)
{
d3d_set_mvp(d3d, NULL, &d3d->mvp);
for (i = 0; i < d3d->overlays_size; i++)
d3d_overlay_render(d3d, video_info, &d3d->overlays[i]);
}
#endif
if (msg && *msg)
{
d3d_set_viewports(d3d->dev, &screen_vp);
font_driver_render_msg(video_info, NULL, msg, NULL);
}
video_info->cb_update_window_title(
video_info->context_data, video_info);
@ -1610,7 +1625,7 @@ static void d3d_set_menu_texture_frame(void *data,
d3d->menu->tex = d3d_texture_new(d3d->dev, NULL,
width, height, 1,
0, D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED, 0, 0, 0, NULL, NULL);
D3DPOOL_MANAGED, 0, 0, 0, NULL, NULL, false);
if (!d3d->menu->tex)
{
@ -1686,10 +1701,42 @@ static void video_texture_load_d3d(d3d_video_t *d3d,
enum texture_filter_type filter_type,
uintptr_t *id)
{
*id = (uintptr_t)d3d_texture_new(d3d->dev, NULL,
ti->width, ti->height, 1,
0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, 0, 0, 0,
NULL, NULL);
D3DLOCKED_RECT d3dlr;
LPDIRECT3DTEXTURE tex = NULL;
unsigned usage = 0;
bool want_mipmap = false;
#ifndef HAVE_D3D8
if((filter_type == TEXTURE_FILTER_MIPMAP_LINEAR) ||
(filter_type == TEXTURE_FILTER_MIPMAP_NEAREST))
want_mipmap = true;
#endif
tex = d3d_texture_new(d3d->dev, NULL,
ti->width, ti->height, 0,
usage, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, 0, 0, 0,
NULL, NULL, want_mipmap);
if (!tex)
{
RARCH_ERR("[D3D]: Failed to create texture\n");
return;
}
if (d3d_lock_rectangle(tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
unsigned i;
uint32_t *dst = (uint32_t*)(d3dlr.pBits);
const uint32_t *src = ti->pixels;
unsigned pitch = d3dlr.Pitch >> 2;
for (i = 0; i < ti->height; i++, dst += pitch, src += ti->width)
memcpy(dst, src, ti->width << 2);
d3d_unlock_rectangle(tex);
}
*id = (uintptr_t)tex;
}
static int video_texture_load_wrap_d3d_mipmap(void *data)
@ -1746,18 +1793,6 @@ static void d3d_unload_texture(void *data, uintptr_t id)
d3d_texture_free(texid);
}
static void d3d_set_mvp(void *data,
void *shader_data,
const void *mat_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
if (d3d && d3d->renderchain_driver->set_mvp)
d3d->renderchain_driver->set_mvp(
d3d->renderchain_data,
data,
640, 480, 0);
}
static const video_poke_interface_t d3d_poke_interface = {
NULL, /* set_coords */
d3d_set_mvp,

View File

@ -17,6 +17,8 @@
#ifndef __D3DVIDEO_INTF_H__
#define __D3DVIDEO_INTF_H__
#include <gfx/math/matrix_4x4.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
@ -54,11 +56,8 @@ typedef struct
typedef struct Vertex
{
float x, y;
#if defined(HAVE_D3D8)
float z;
float rhw;
#endif
float x, y, z;
uint32_t color;
float u, v;
} Vertex;
@ -83,6 +82,8 @@ typedef struct d3d_video
RECT font_rect;
RECT font_rect_shifted;
math_matrix_4x4 mvp;
math_matrix_4x4 mvp_transposed;
struct video_viewport vp;
struct video_shader shader;
@ -93,6 +94,14 @@ typedef struct d3d_video
char *shader_path;
struct
{
int size;
int offset;
LPDIRECT3DVERTEXBUFFER buffer;
void *decl;
}menu_display;
#ifdef HAVE_OVERLAY
size_t overlays_size;
overlay_t *overlays;

View File

@ -405,19 +405,24 @@ static bool format_support(const drmModePlanePtr ovr, uint32_t fmt)
static uint64_t drm_plane_type(drmModePlane *plane)
{
int i,j;
/* The property values and their names are stored in different arrays, so we
* access them simultaneously here.
* We are interested in OVERLAY planes only, that's type 0 or DRM_PLANE_TYPE_OVERLAY
/* The property values and their names are stored in different arrays,
* so we access them simultaneously here.
* We are interested in OVERLAY planes only, that's
* type 0 or DRM_PLANE_TYPE_OVERLAY
* (see /usr/xf86drmMode.h for definition). */
drmModeObjectPropertiesPtr props =
drmModeObjectGetProperties(drm.fd, plane->plane_id, DRM_MODE_OBJECT_PLANE);
drmModeObjectGetProperties(drm.fd, plane->plane_id,
DRM_MODE_OBJECT_PLANE);
for (j = 0; j < props->count_props; j++)
{
/* found the type property */
if (string_is_equal_fast(drmModeGetProperty(drm.fd, props->props[j])->name, "type", 4))
if (string_is_equal(
drmModeGetProperty(drm.fd, props->props[j])->name, "type"))
return (props->prop_values[j]);
}
return (0);
}

View File

@ -181,7 +181,7 @@ static int exynos_get_device_index(void)
ver = drmGetVersion(fd);
if (string_is_equal_fast(ver->name, "exynos", 6))
if (string_is_equal(ver->name, "exynos"))
found = true;
else
++index;

View File

@ -1346,7 +1346,6 @@ static bool resolve_extensions(gl_t *gl, const char *context_ident, const video_
*
* have_sync - Use ARB_sync to reduce latency.
*/
gl->has_fbo = gl_check_capability(GL_CAPS_FBO);
gl->have_full_npot_support = gl_check_capability(GL_CAPS_FULL_NPOT_SUPPORT);
gl->have_mipmap = gl_check_capability(GL_CAPS_MIPMAP);
gl->have_es2_compat = gl_check_capability(GL_CAPS_ES2_COMPAT);
@ -1784,6 +1783,12 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
gl->hw_render_use = false;
gl->has_fbo = gl_check_capability(GL_CAPS_FBO);
if (gl->has_fbo && hwr->context_type != RETRO_HW_CONTEXT_NONE)
gl->hw_render_use = true;
if (!resolve_extensions(gl, ctx_driver->ident, video))
goto error;
@ -1821,10 +1826,6 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
* but still need multiple textures with PREV.
*/
gl->textures = 4;
gl->hw_render_use = false;
if (gl->has_fbo && hwr->context_type != RETRO_HW_CONTEXT_NONE)
gl->hw_render_use = true;
if (gl->hw_render_use)
{

View File

@ -213,7 +213,7 @@ static void gfx_ctx_d3d_input_driver(void *data,
#if _WIN32_WINNT >= 0x0501
/* winraw only available since XP */
if (string_is_equal_fast(settings->arrays.input_driver, "raw", 4))
if (string_is_equal(settings->arrays.input_driver, "raw"))
{
*input_data = input_winraw.init(name);
if (*input_data)

View File

@ -20,6 +20,7 @@
#include <unistd.h>
#include <emscripten/emscripten.h>
#include <emscripten/html5.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -44,30 +45,88 @@ typedef struct
unsigned fb_height;
} emscripten_ctx_data_t;
static int emscripten_initial_width;
static int emscripten_initial_height;
static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval)
{
(void)data;
/* no way to control VSync in WebGL. */
(void)interval;
if (interval == 0)
emscripten_set_main_loop_timing(EM_TIMING_SETIMMEDIATE, 0);
else
emscripten_set_main_loop_timing(EM_TIMING_RAF, (int)interval);
}
static void gfx_ctx_emscripten_get_canvas_size(int *width, int *height)
{
EmscriptenFullscreenChangeEvent fullscreen_status;
bool is_fullscreen = false;
EMSCRIPTEN_RESULT r = emscripten_get_fullscreen_status(&fullscreen_status);
if (r == EMSCRIPTEN_RESULT_SUCCESS)
{
if (fullscreen_status.isFullscreen)
{
is_fullscreen = true;
*width = fullscreen_status.screenWidth;
*height = fullscreen_status.screenHeight;
}
}
if (!is_fullscreen)
{
r = emscripten_get_canvas_element_size("#canvas", width, height);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR("[EMSCRIPTEN/EGL]: Could not get screen dimensions: %d\n",
r);
*width = 800;
*height = 600;
}
}
}
static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
{
EMSCRIPTEN_RESULT r;
int input_width;
int input_height;
int is_fullscreen;
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
(void)data;
gfx_ctx_emscripten_get_canvas_size(&input_width, &input_height);
if (input_width == 0 || input_height == 0)
{
input_width = emscripten_initial_width;
input_height = emscripten_initial_height;
emscripten->fb_width = emscripten->fb_height = 0;
}
emscripten_get_canvas_size(&input_width, &input_height, &is_fullscreen);
*width = (unsigned)input_width;
*height = (unsigned)input_height;
*resize = false;
if (*width != emscripten->fb_width || *height != emscripten->fb_height)
if (input_width != emscripten->fb_width ||
input_height != emscripten->fb_height)
{
r = emscripten_set_canvas_element_size("#canvas",
input_width, input_height);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
RARCH_ERR("[EMSCRIPTEN/EGL]: error resizing canvas: %d\n", r);
/* fix Module.requestFullscreen messing with the canvas size */
r = emscripten_set_element_css_size("#canvas",
(double)input_width, (double)input_height);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
RARCH_ERR("[EMSCRIPTEN/EGL]: error resizing canvas css: %d\n", r);
*resize = true;
}
emscripten->fb_width = (unsigned)input_width;
emscripten->fb_height = (unsigned)input_height;
@ -76,8 +135,13 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
static void gfx_ctx_emscripten_swap_buffers(void *data, void *data2)
{
(void)data;
/* no-op in emscripten, no way to force swap/wait for VSync in browsers */
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
/* doesn't really do anything in WebGL, but it might if we use WebGL workers
* in the future */
#ifdef HAVE_EGL
egl_swap_buffers(&emscripten->egl);
#endif
}
static void gfx_ctx_emscripten_get_video_size(void *data,
@ -85,6 +149,9 @@ static void gfx_ctx_emscripten_get_video_size(void *data,
{
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
if (!emscripten)
return;
*width = emscripten->fb_width;
*height = emscripten->fb_height;
}
@ -93,12 +160,16 @@ static void gfx_ctx_emscripten_destroy(void *data)
{
emscripten_ctx_data_t *emscripten = (emscripten_ctx_data_t*)data;
if (!emscripten)
return;
egl_destroy(&emscripten->egl);
free(data);
}
static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info, void *video_driver)
static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info,
void *video_driver)
{
#ifdef HAVE_EGL
unsigned width, height;
@ -128,6 +199,10 @@ static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info, void *video
(void)video_driver;
if (emscripten_initial_width == 0 || emscripten_initial_height == 0)
emscripten_get_canvas_element_size("#canvas",
&emscripten_initial_width, &emscripten_initial_height);
#ifdef HAVE_EGL
if (g_egl_inited)
{
@ -135,8 +210,8 @@ static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info, void *video
return (void*)"emscripten";
}
if (!egl_init_context(&emscripten->egl, EGL_NONE, EGL_DEFAULT_DISPLAY,
&major, &minor, &n, attribute_list))
if (!egl_init_context(&emscripten->egl, EGL_NONE,
(void *)EGL_DEFAULT_DISPLAY, &major, &minor, &n, attribute_list))
{
egl_report_error();
goto error;
@ -202,20 +277,10 @@ static void gfx_ctx_emscripten_input_driver(void *data,
const char *name,
const input_driver_t **input, void **input_data)
{
void *rwebinput = NULL;
void *rwebinput = input_rwebinput.init(name);
*input = NULL;
*input_data = NULL;
#ifndef HAVE_SDL2
rwebinput = input_rwebinput.init();
if (!rwebinput)
return;
*input = &input_rwebinput;
*input = rwebinput ? &input_rwebinput : NULL;
*input_data = rwebinput;
#endif
}
static bool gfx_ctx_emscripten_has_focus(void *data)

View File

@ -226,7 +226,7 @@ static void gfx_ctx_gdi_input_driver(void *data,
#if _WIN32_WINNT >= 0x0501
/* winraw only available since XP */
if (string_is_equal_fast(settings->arrays.input_driver, "raw", 4))
if (string_is_equal(settings->arrays.input_driver, "raw"))
{
*input_data = input_winraw.init(joypad_name);
if (*input_data)

View File

@ -56,26 +56,23 @@
typedef struct
{
bool smooth;
bool vsync_callback_set;
bool resize;
unsigned res;
unsigned fb_width, fb_height;
#ifdef HAVE_EGL
egl_ctx_data_t egl;
#endif
EGL_DISPMANX_WINDOW_T native_window;
DISPMANX_DISPLAY_HANDLE_T dispman_display;
/* For vsync wait after eglSwapBuffers when max_swapchain < 3 */
scond_t *vsync_condition;
slock_t *vsync_condition_mutex;
bool vsync_callback_set;
bool resize;
unsigned fb_width, fb_height;
EGLImageKHR eglBuffer[MAX_EGLIMAGE_TEXTURES];
EGLContext eglimage_ctx;
EGLSurface pbuff_surf;
VGImage vgimage[MAX_EGLIMAGE_TEXTURES];
bool smooth;
unsigned res;
} vc_ctx_data_t;
static enum gfx_ctx_api vc_api;
@ -85,7 +82,7 @@ static PFNEGLDESTROYIMAGEKHRPROC peglDestroyImageKHR;
static INLINE bool gfx_ctx_vc_egl_query_extension(vc_ctx_data_t *vc, const char *ext)
{
const char *str = (const char*)eglQueryString(vc->egl.dpy, EGL_EXTENSIONS);
bool ret = str && strstr(str, ext);
bool ret = str && strstr(str, ext);
RARCH_LOG("Querying EGL extension: %s => %s\n",
ext, ret ? "exists" : "doesn't exist");
@ -107,7 +104,7 @@ static void gfx_ctx_vc_check_window(void *data, bool *quit,
static void gfx_ctx_vc_get_video_size(void *data,
unsigned *width, unsigned *height)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
settings_t *settings = config_get_ptr();
/* Use dispmanx upscaling if
@ -145,6 +142,9 @@ static void dispmanx_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
if (!vc)
return;
slock_lock(vc->vsync_condition_mutex);
scond_signal(vc->vsync_condition);
slock_unlock(vc->vsync_condition_mutex);
@ -228,50 +228,52 @@ static void *gfx_ctx_vc_init(video_frame_info_t *video_info, void *video_driver)
if (graphics_get_display_size(0 /* LCD */, &vc->fb_width, &vc->fb_height) < 0)
goto error;
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = vc->fb_width;
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = vc->fb_width;
dst_rect.height = vc->fb_height;
src_rect.x = 0;
src_rect.y = 0;
src_rect.x = 0;
src_rect.y = 0;
/* Use dispmanx upscaling if fullscreen_x
* and fullscreen_y are set. */
if (settings->uints.video_fullscreen_x != 0 &&
settings->uints.video_fullscreen_y != 0)
if ((settings->uints.video_fullscreen_x != 0) &&
(settings->uints.video_fullscreen_y != 0))
{
/* Keep input and output aspect ratio equal.
* There are other aspect ratio settings which can be used to stretch video output. */
/* Calculate source and destination aspect ratios. */
float srcAspect = (float)settings->uints.video_fullscreen_x / (float)settings->uints.video_fullscreen_y;
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
float srcAspect = (float)settings->uints.video_fullscreen_x / (float)settings->uints.video_fullscreen_y;
float dstAspect = (float)vc->fb_width / (float)vc->fb_height;
/* If source and destination aspect ratios are not equal correct source width. */
if (srcAspect != dstAspect)
src_rect.width = (unsigned)(settings->uints.video_fullscreen_y * dstAspect) << 16;
src_rect.width = (unsigned)(settings->uints.video_fullscreen_y * dstAspect) << 16;
else
src_rect.width = settings->uints.video_fullscreen_x << 16;
src_rect.height = settings->uints.video_fullscreen_y << 16;
src_rect.width = settings->uints.video_fullscreen_x << 16;
src_rect.height = settings->uints.video_fullscreen_y << 16;
}
else
{
src_rect.width = vc->fb_width << 16;
src_rect.height = vc->fb_height << 16;
src_rect.width = vc->fb_width << 16;
src_rect.height = vc->fb_height << 16;
}
dispman_display = vc_dispmanx_display_open(0 /* LCD */);
vc->dispman_display = dispman_display;
dispman_display = vc_dispmanx_display_open(0 /* LCD */);
vc->dispman_display = dispman_display;
vc_dispmanx_display_get_info(dispman_display, &dispman_modeinfo);
dispman_update = vc_dispmanx_update_start(0);
alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
alpha.opacity = 255;
alpha.mask = 0;
dispman_update = vc_dispmanx_update_start(0);
dispman_element = vc_dispmanx_element_add(dispman_update, dispman_display,
0 /*layer*/, &dst_rect, 0 /*src*/,
&src_rect, DISPMANX_PROTECTION_NONE, &alpha, 0 /*clamp*/, DISPMANX_NO_ROTATE);
alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
alpha.opacity = 255;
alpha.mask = 0;
dispman_element = vc_dispmanx_element_add(dispman_update, dispman_display,
0 /*layer*/, &dst_rect, 0 /*src*/,
&src_rect, DISPMANX_PROTECTION_NONE, &alpha, 0 /*clamp*/, DISPMANX_NO_ROTATE);
vc->native_window.element = dispman_element;
@ -311,10 +313,13 @@ static void *gfx_ctx_vc_init(video_frame_info_t *video_info, void *video_driver)
/* For vsync after eglSwapBuffers when max_swapchain < 3 */
vc->vsync_condition = scond_new();
vc->vsync_condition_mutex = slock_new();
vc->vsync_callback_set = false;
if (video_info->max_swapchain_images <= 2) {
vc->vsync_callback_set = false;
if (video_info->max_swapchain_images <= 2)
{
/* Start sending vsync callbacks so we can wait for vsync after eglSwapBuffers */
vc_dispmanx_vsync_callback(vc->dispman_display, dispmanx_vsync_callback, (void*)vc);
vc_dispmanx_vsync_callback(vc->dispman_display,
dispmanx_vsync_callback, (void*)vc);
vc->vsync_callback_set = true;
}
@ -327,9 +332,10 @@ error:
static void gfx_ctx_vc_set_swap_interval(void *data, unsigned swap_interval)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
#ifdef HAVE_EGL
egl_set_swap_interval(&vc->egl, swap_interval);
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
if (vc)
egl_set_swap_interval(&vc->egl, swap_interval);
#endif
}
@ -338,11 +344,9 @@ static bool gfx_ctx_vc_set_video_mode(void *data,
unsigned width, unsigned height,
bool fullscreen)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
#ifdef HAVE_EGL
if (g_egl_inited)
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
if (!vc || g_egl_inited)
return false;
frontend_driver_install_signal_handler();
@ -462,14 +466,15 @@ static void gfx_ctx_vc_destroy(void *data)
for (i = 0; i < MAX_EGLIMAGE_TEXTURES; i++)
{
vc->eglBuffer[i] = NULL;
vc->vgimage[i] = 0;
vc->eglBuffer[i] = NULL;
vc->vgimage[i] = 0;
}
/* Stop generating vsync callbacks if we are doing so. Don't destroy the context while cbs are being generated! */
if (vc->vsync_callback_set) {
/* Stop generating vsync callbacks if we are doing so.
* Don't destroy the context while cbs are being generated! */
if (vc->vsync_callback_set)
vc_dispmanx_vsync_callback(vc->dispman_display, NULL, NULL);
}
/* Destroy mutexes and conditions. */
slock_free(vc->vsync_condition_mutex);
scond_free(vc->vsync_condition);
@ -509,8 +514,8 @@ static float gfx_ctx_vc_translate_aspect(void *data,
static bool gfx_ctx_vc_image_buffer_init(void *data,
const video_info_t *video)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
EGLBoolean result;
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
EGLint pbufsurface_list[] =
{
EGL_WIDTH, vc->res,
@ -525,8 +530,10 @@ static bool gfx_ctx_vc_image_buffer_init(void *data,
peglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)egl_get_proc_address("eglCreateImageKHR");
peglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)egl_get_proc_address("eglDestroyImageKHR");
if (!peglCreateImageKHR || !peglDestroyImageKHR
|| !gfx_ctx_vc_egl_query_extension(vc, "KHR_image"))
if ( !peglCreateImageKHR ||
!peglDestroyImageKHR ||
!gfx_ctx_vc_egl_query_extension(vc, "KHR_image")
)
return false;
vc->res = video->input_scale * RARCH_SCALE_BASE;
@ -585,7 +592,7 @@ static bool gfx_ctx_vc_image_buffer_write(void *data, const void *frame, unsigne
bool ret = false;
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
if (index >= MAX_EGLIMAGE_TEXTURES)
if (!vc || index >= MAX_EGLIMAGE_TEXTURES)
goto error;
eglBindAPI(EGL_OPENVG_API);
@ -629,27 +636,32 @@ error:
static void gfx_ctx_vc_swap_buffers(void *data, void *data2)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
#ifdef HAVE_EGL
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
video_frame_info_t *video_info = (video_frame_info_t*)data2;
#ifdef HAVE_EGL
if (!vc)
return;
egl_swap_buffers(&vc->egl);
/* Wait for vsync immediately if we don't want egl_swap_buffers to triple-buffer */
if (video_info->max_swapchain_images <= 2) {
if (video_info->max_swapchain_images <= 2)
{
/* We DON'T wait to wait without callback function ready! */
if(!vc->vsync_callback_set) {
vc_dispmanx_vsync_callback(vc->dispman_display, dispmanx_vsync_callback, (void*)vc);
if (!vc->vsync_callback_set)
{
vc_dispmanx_vsync_callback(vc->dispman_display,
dispmanx_vsync_callback, (void*)vc);
vc->vsync_callback_set = true;
}
slock_lock(vc->vsync_condition_mutex);
scond_wait(vc->vsync_condition, vc->vsync_condition_mutex);
slock_unlock(vc->vsync_condition_mutex);
}
else if (vc->vsync_callback_set) {
/* Stop generating vsync callbacks from now on */
/* Stop generating vsync callbacks from now on */
else if (vc->vsync_callback_set)
vc_dispmanx_vsync_callback(vc->dispman_display, NULL, NULL);
}
#endif
}
@ -657,6 +669,9 @@ static void gfx_ctx_vc_bind_hw_render(void *data, bool enable)
{
vc_ctx_data_t *vc = (vc_ctx_data_t*)data;
if (!vc)
return;
#ifdef HAVE_EGL
egl_bind_hw_render(&vc->egl, enable);
#endif

View File

@ -592,12 +592,12 @@ static void gfx_ctx_wgl_input_driver(void *data,
#if _WIN32_WINNT >= 0x0501
/* winraw only available since XP */
if (string_is_equal_fast(settings->arrays.input_driver, "raw", 4))
if (string_is_equal(settings->arrays.input_driver, "raw"))
{
*input_data = input_winraw.init(joypad_name);
if (*input_data)
{
*input = &input_winraw;
*input = &input_winraw;
dinput_wgl = NULL;
return;
}

View File

@ -965,7 +965,7 @@ static void gfx_ctx_x_input_driver(void *data,
#ifdef HAVE_UDEV
settings_t *settings = config_get_ptr();
if (string_is_equal_fast(settings->arrays.input_driver, "udev", 5))
if (string_is_equal(settings->arrays.input_driver, "udev"))
{
*input_data = input_udev.init(joypad_name);
if (*input_data)

View File

@ -39,19 +39,27 @@ typedef struct
#else
ID3DXFont *font;
#endif
uint32_t color;
uint32_t font_size;
uint32_t ascent;
} d3dfonts_t;
#ifdef __cplusplus
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirect3DXFont_DrawTextA(p, a, b, c, d, e, f) (p)->lpVtbl->DrawTextA(p, a, b, c, d, e, f)
#define IDirect3DXFont_GetTextMetricsA(p, a) (p)->lpVtbl->GetTextMetricsA(p, a)
#define IDirect3DXFont_Release(p) (p)->lpVtbl->Release(p)
#else
#define IDirect3DXFont_DrawTextA(p, a, b, c, d, e, f) (p)->DrawTextA(a, b, c, d, e, f)
#define IDirect3DXFont_GetTextMetricsA(p, a) (p)->GetTextMetricsA(a)
#define IDirect3DXFont_Release(p) (p)->Release()
#endif
static void *d3dfonts_w32_init_font(void *video_data,
const char *font_path, float font_size,
bool is_threaded)
{
TEXTMETRICA metrics;
settings_t *settings = config_get_ptr();
D3DXFONT_DESC desc = {
D3DXFONT_DESC desc = {
(int)(font_size), 0, 400, 0,
false, DEFAULT_CHARSET,
OUT_TT_PRECIS,
@ -64,23 +72,22 @@ static void *d3dfonts_w32_init_font(void *video_data,
#endif
};
d3dfonts_t *d3dfonts = (d3dfonts_t*)calloc(1, sizeof(*d3dfonts));
uint32_t r = (settings->floats.video_msg_color_r * 255);
uint32_t g = (settings->floats.video_msg_color_g * 255);
uint32_t b = (settings->floats.video_msg_color_b * 255);
r &= 0xff;
g &= 0xff;
b &= 0xff;
if (!d3dfonts)
return NULL;
d3dfonts->d3d = (d3d_video_t*)video_data;
d3dfonts->color = D3DCOLOR_XRGB(r, g, b);
d3dfonts->font_size = font_size * 1.2; /* to match the other font drivers */
d3dfonts->d3d = (d3d_video_t*)video_data;
desc.Height = d3dfonts->font_size;
if (!d3dx_create_font_indirect(d3dfonts->d3d->dev,
&desc, (void**)&d3dfonts->font))
goto error;
IDirect3DXFont_GetTextMetricsA(d3dfonts->font, &metrics);
d3dfonts->ascent = metrics.tmAscent;
return d3dfonts;
error:
@ -95,66 +102,126 @@ static void d3dfonts_w32_free_font(void *data, bool is_threaded)
if (!d3dfonts)
return;
#ifdef __cplusplus
if (d3dfonts->font)
d3dfonts->font->Release();
#else
if (d3dfonts->font)
d3dfonts->font->lpVtbl->Release(d3dfonts->font);
#endif
d3dfonts->font = NULL;
IDirect3DXFont_Release(d3dfonts->font);
free(d3dfonts);
d3dfonts = NULL;
}
static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data, const char *msg,
const void *userdata)
static int d3dfonts_w32_get_message_width(void* data, const char* msg,
unsigned msg_len, float scale)
{
RECT box = {0,0,0,0};
d3dfonts_t *d3dfonts = (d3dfonts_t*)data;
if (!d3dfonts || !d3dfonts->d3d | !msg)
return 0;
IDirect3DXFont_DrawTextA(d3dfonts->font, NULL, msg,
msg_len? msg_len : -1, &box, DT_CALCRECT, 0);
return box.right - box.left;
}
static void d3dfonts_w32_render_msg(video_frame_info_t *video_info,
void *data, const char *msg, const void *userdata)
{
unsigned format;
unsigned a, r, g, b;
RECT rect, rect_shifted;
RECT *p_rect_shifted = NULL;
RECT *p_rect = NULL;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
d3dfonts_t *d3dfonts = (d3dfonts_t*)data;
unsigned width = video_info->width;
unsigned height = video_info->height;
float drop_mod = 0.3f;
float drop_alpha = 1.0f;
int drop_x = -2;
int drop_y = -2;
if (!d3dfonts || !d3dfonts->d3d)
if (!d3dfonts || !d3dfonts->d3d || !msg)
return;
if (!msg)
return;
d3d_set_viewports(d3dfonts->d3d->dev, &d3dfonts->d3d->final_viewport);
if (!d3d_begin_scene(d3dfonts->d3d->dev))
return;
#ifdef __cplusplus
d3dfonts->font->DrawTextA(NULL,
msg,
-1,
&d3dfonts->d3d->font_rect_shifted,
DT_LEFT,
((d3dfonts->color >> 2) & 0x3f3f3f) | 0xff000000);
format = DT_LEFT;
p_rect = &d3dfonts->d3d->font_rect;
p_rect_shifted = &d3dfonts->d3d->font_rect_shifted;
d3dfonts->font->DrawTextA(NULL,
msg,
-1,
&d3dfonts->d3d->font_rect,
DT_LEFT,
d3dfonts->color | 0xff000000);
#else
d3dfonts->font->lpVtbl->DrawTextA(
d3dfonts->font,
NULL,
msg,
-1,
&d3dfonts->d3d->font_rect_shifted,
DT_LEFT,
((d3dfonts->color >> 2) & 0x3f3f3f) | 0xff000000);
if(params)
{
d3dfonts->font->lpVtbl->DrawTextA(
d3dfonts->font,
NULL,
msg,
-1,
&d3dfonts->d3d->font_rect,
DT_LEFT,
d3dfonts->color | 0xff000000);
#endif
a = FONT_COLOR_GET_ALPHA(params->color);
r = FONT_COLOR_GET_RED(params->color);
g = FONT_COLOR_GET_GREEN(params->color);
b = FONT_COLOR_GET_BLUE(params->color);
switch (params->text_align)
{
case TEXT_ALIGN_RIGHT:
format = DT_RIGHT;
rect.left = 0;
rect.right = params->x * width;
break;
case TEXT_ALIGN_CENTER:
format = DT_CENTER;
rect.left = (params->x - 1.0) * width;
rect.right = (params->x + 1.0) * width;
break;
case TEXT_ALIGN_LEFT:
default:
format = DT_LEFT;
rect.left = params->x * width;
rect.right = width;
break;
}
rect.top = (1.0 - params->y) * height - d3dfonts->ascent;
rect.bottom = height;
p_rect = &rect;
drop_x = params->drop_x;
drop_y = params->drop_y;
if(drop_x || drop_y)
{
drop_mod = params->drop_mod;
drop_alpha = params->drop_alpha;
rect_shifted = rect;
rect_shifted.left += params->drop_x;
rect_shifted.right += params->drop_x;
rect_shifted.top -= params->drop_y;
rect_shifted.bottom -= params->drop_y;
p_rect_shifted = &rect_shifted;
}
}
else
{
a = 255;
r = video_info->font_msg_color_r * 255;
g = video_info->font_msg_color_g * 255;
b = video_info->font_msg_color_b * 255;
}
if(drop_x || drop_y)
{
unsigned drop_a = a * drop_alpha;
unsigned drop_r = r * drop_mod;
unsigned drop_g = g * drop_mod;
unsigned drop_b = b * drop_mod;
IDirect3DXFont_DrawTextA(d3dfonts->font, NULL,
msg, -1, p_rect_shifted, format,
D3DCOLOR_ARGB(drop_a , drop_r, drop_g, drop_b));
}
IDirect3DXFont_DrawTextA(d3dfonts->font, NULL, msg, -1,
p_rect, format, D3DCOLOR_ARGB(a, r, g, b));
d3d_end_scene(d3dfonts->d3d->dev);
}
@ -167,5 +234,5 @@ font_renderer_t d3d_win32_font = {
NULL, /* get_glyph */
NULL, /* bind_block */
NULL, /* flush */
NULL /* get_message_width */
d3dfonts_w32_get_message_width
};

View File

@ -97,11 +97,14 @@ static void wiiu_font_free_font(void* data, bool is_threaded)
if (!font)
return;
if (font->font_driver && font->font_data)
if (font->font_driver && font->font_data &&
font->font_driver->free)
font->font_driver->free(font->font_data);
MEM1_free(font->texture.surface.image);
MEM1_free(font->ubo_tex);
if (font->texture.surface.image)
MEM1_free(font->texture.surface.image);
if (font->ubo_tex)
MEM1_free(font->ubo_tex);
free(font);
}

View File

@ -79,7 +79,6 @@ class PackedResource
XBRESOURCE* m_pResourceTags; /* Tags to associate names with the resources */
DWORD m_dwNumResourceTags; /* Number of resource tags */
BOOL m_bInitialized; /* Resource is fully initialized */
public:
/* Loads the resources out of the specified bundle */
@ -92,7 +91,7 @@ class PackedResource
void Destroy();
BOOL Initialized() const;
BOOL m_bInitialized; /* Resource is fully initialized */
#ifdef _XBOX360
/* Retrieves the resource tags */
@ -120,30 +119,11 @@ class PackedResource
return pResource;
}
/* Functions to retrieve resources by their offset */
void *GetData( DWORD dwOffset ) const
{ return &m_pSysMemData[dwOffset]; }
LPDIRECT3DRESOURCE GetResource( DWORD dwOffset ) const
{ return RegisterResource( (LPDIRECT3DRESOURCE)GetData(dwOffset) ); }
LPDIRECT3DTEXTURE GetTexture( DWORD dwOffset ) const
{ return (LPDIRECT3DTEXTURE)GetResource( dwOffset ); }
LPDIRECT3DVERTEXBUFFER GetVertexBuffer( DWORD dwOffset ) const
{ return (LPDIRECT3DVERTEXBUFFER)GetResource( dwOffset ); }
/* Functions to retrieve resources by their name */
void *GetData( const char* strName ) const;
LPDIRECT3DRESOURCE GetResource( const char* strName ) const
{ return RegisterResource( (LPDIRECT3DRESOURCE)GetData( strName ) ); }
LPDIRECT3DTEXTURE GetTexture( const char* strName ) const
{ return (LPDIRECT3DTEXTURE)GetResource( strName ); }
LPDIRECT3DVERTEXBUFFER GetVertexBuffer( const char* strName ) const
{ return (LPDIRECT3DVERTEXBUFFER)GetResource( strName ); }
{ return (LPDIRECT3DTEXTURE)RegisterResource((LPDIRECT3DRESOURCE)GetData(strName)); }
/* Constructor/destructor */
PackedResource();
@ -152,13 +132,13 @@ class PackedResource
PackedResource::PackedResource()
{
m_pSysMemData = NULL;
m_dwSysMemDataSize = 0L;
m_pVidMemData = NULL;
m_dwVidMemDataSize = 0L;
m_pResourceTags = NULL;
m_pSysMemData = NULL;
m_pVidMemData = NULL;
m_pResourceTags = NULL;
m_dwSysMemDataSize = 0L;
m_dwVidMemDataSize = 0L;
m_dwNumResourceTags = 0L;
m_bInitialized = FALSE;
m_bInitialized = false;
}
@ -169,18 +149,18 @@ PackedResource::~PackedResource()
void *PackedResource::GetData(const char *strName) const
{
if (m_pResourceTags == NULL || strName == NULL)
if (!m_pResourceTags || !strName)
return NULL;
#if defined(_XBOX1)
for (DWORD i=0; m_pResourceTags[i].strName; i++)
#elif defined(_XBOX360)
for (DWORD i = 0; i < m_dwNumResourceTags; i++)
for (DWORD i = 0; i < m_dwNumResourceTags; i++)
#endif
{
if (string_is_equal_noncase(strName, m_pResourceTags[i].strName))
return &m_pSysMemData[m_pResourceTags[i].dwOffset];
}
{
if (string_is_equal_noncase(strName, m_pResourceTags[i].strName))
return &m_pSysMemData[m_pResourceTags[i].dwOffset];
}
return NULL;
}
@ -210,7 +190,7 @@ char g_strMediaPath[512] = "D:\\Media\\";
static HRESULT FindMediaFile(char *strPath, const char *strFilename, size_t strPathsize)
{
if(strFilename == NULL || strPath == NULL)
if (!strFilename || !strPath)
return E_INVALIDARG;
strlcpy(strPath, strFilename, strPathsize);
@ -242,10 +222,10 @@ HRESULT PackedResource::Create(const char *strFilename)
HANDLE hFile;
DWORD dwNumBytesRead;
XPR_HEADER xprh;
bool retval;
bool retval = false;
#ifdef _XBOX1
BOOL bHasResourceOffsetsTable = FALSE;
char strResourcePath[512];
bool bHasResourceOffsetsTable = false;
if (FAILED(FindMediaFile(strResourcePath, strFilename, sizeof(strResourcePath))))
return E_FAIL;
@ -261,9 +241,9 @@ HRESULT PackedResource::Create(const char *strFilename)
#if defined(_XBOX1)
if(xprh.dwMagic == XPR0_MAGIC_VALUE)
bHasResourceOffsetsTable = FALSE;
bHasResourceOffsetsTable = false;
else if(xprh.dwMagic == XPR1_MAGIC_VALUE)
bHasResourceOffsetsTable = TRUE;
bHasResourceOffsetsTable = true;
else
#elif defined(_XBOX360)
if(!retval)
@ -290,7 +270,8 @@ HRESULT PackedResource::Create(const char *strFilename)
/* Allocate memory */
m_pSysMemData = (BYTE*)malloc(m_dwSysMemDataSize);
if (m_pSysMemData == NULL)
if (!m_pSysMemData)
{
m_dwSysMemDataSize = 0;
return E_FAIL;
@ -304,7 +285,7 @@ HRESULT PackedResource::Create(const char *strFilename)
#endif
);
if(m_pVidMemData == NULL)
if(!m_pVidMemData)
{
m_dwSysMemDataSize = 0;
m_dwVidMemDataSize = 0;
@ -360,7 +341,7 @@ HRESULT PackedResource::Create(const char *strFilename)
}
#endif
m_bInitialized = TRUE;
m_bInitialized = true;
return S_OK;
}
@ -380,24 +361,18 @@ void PackedResource::GetResourceTags(DWORD* pdwNumResourceTags,
void PackedResource::Destroy()
{
free(m_pSysMemData);
m_pSysMemData = NULL;
m_dwSysMemDataSize = 0L;
if (m_pVidMemData != NULL)
FreeContiguousMemory(m_pVidMemData);
m_pVidMemData = NULL;
m_dwVidMemDataSize = 0L;
m_pResourceTags = NULL;
m_pSysMemData = NULL;
m_pVidMemData = NULL;
m_pResourceTags = NULL;
m_dwSysMemDataSize = 0L;
m_dwVidMemDataSize = 0L;
m_dwNumResourceTags = 0L;
m_bInitialized = FALSE;
}
BOOL PackedResource::Initialized() const
{
return m_bInitialized;
m_bInitialized = false;
}
typedef struct GLYPH_ATTR
@ -605,7 +580,7 @@ static void xdk360_free_font(void *data, bool is_threaded)
font->s_FontLocals.m_pFontVertexShader = NULL;
font->s_FontLocals.m_pFontVertexDecl = NULL;
if (m_xprResource.Initialized())
if (m_xprResource.m_bInitialized)
m_xprResource.Destroy();
free(font);
@ -630,7 +605,8 @@ static void xdk360_render_msg_pre(xdk360_video_font_t * font)
LPDIRECT3DDEVICE d3dr = font->d3d->dev;
/* Save state. */
d3dr->GetRenderState( D3DRS_VIEWPORTENABLE, (DWORD*)&font->m_dwSavedState );
d3d_get_render_state(d3dr, D3DRS_VIEWPORTENABLE,
(DWORD*)&font->m_dwSavedState );
/* Set the texture scaling factor as a vertex shader constant. */
/* Get the description */
@ -639,8 +615,7 @@ static void xdk360_render_msg_pre(xdk360_video_font_t * font)
/* Set render state. */
d3d_set_texture(d3dr, 0, font->m_pFontTexture);
/* Read the TextureDesc here to ensure no load/hit/store from d3d_texture_get_level_desc(). */
vTexScale[0] = 1.0f / TextureDesc.Width; /* LHS due to int->float conversion. */
vTexScale[0] = 1.0f / TextureDesc.Width;
vTexScale[1] = 1.0f / TextureDesc.Height;
vTexScale[2] = 0.0f;
vTexScale[3] = 0.0f;
@ -649,11 +624,7 @@ static void xdk360_render_msg_pre(xdk360_video_font_t * font)
d3d_set_vertex_declaration(d3dr, font->s_FontLocals.m_pFontVertexDecl);
d3d_set_vertex_shader(d3dr, 0, font->s_FontLocals.m_pFontVertexShader);
d3d_set_pixel_shader(d3dr, font->s_FontLocals.m_pFontPixelShader);
/* Set the texture scaling factor as a vertex shader constant.
* Call here to avoid load hit store from writing to vTexScale above
*/
d3dr->SetVertexShaderConstantF( 2, vTexScale, 1 );
d3d_set_vertex_shader_constantf(d3dr, 2, vTexScale, 1);
}
static void xdk360_draw_text(xdk360_video_font_t *font,
@ -670,10 +641,7 @@ static void xdk360_draw_text(xdk360_video_font_t *font,
vColor[2] = ((0xffffffff & 0x000000ff) >> 0L) / 255.0f;
vColor[3] = ((0xffffffff & 0xff000000) >> 24L) / 255.0f;
/* Perform the actual storing of the color constant here to prevent
* a load-hit-store by inserting work between the store and the use of
* the vColor array. */
d3dr->SetVertexShaderConstantF(1, vColor, 1);
d3d_set_vertex_shader_constantf(d3dr, 1, vColor, 1);
m_fCursorX = floorf(x);
m_fCursorY = floorf(y);

View File

@ -42,31 +42,23 @@ typedef struct d3d8_renderchain
} d3d8_renderchain_t;
static void d3d8_renderchain_set_mvp(
void *data,
void *chain_data,
void *data, unsigned vp_width,
unsigned vp_height, unsigned rotation)
void *shader_data,
const void *mat_data)
{
D3DMATRIX matrix;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
D3DMATRIX p_out, p_rotate, mat;
(void)chain_data;
d3d_matrix_identity(&matrix);
d3d_matrix_ortho_off_center_lh(&mat, 0, vp_width, vp_height, 0, 0.0f, 1.0f);
d3d_matrix_identity(&p_out);
d3d_matrix_rotation_z(&p_rotate, rotation * (M_PI / 2.0));
d3d_set_transform(d3d->dev, D3DTS_PROJECTION, &matrix);
d3d_set_transform(d3d->dev, D3DTS_VIEW, &matrix);
d3d_set_transform(d3dr, D3DTS_WORLD, &p_rotate);
d3d_set_transform(d3dr, D3DTS_VIEW, &p_out);
d3d_set_transform(d3dr, D3DTS_PROJECTION, &p_out);
}
if (mat_data)
d3d_matrix_transpose(&matrix, mat_data);
static void d3d8_renderchain_clear(void *data)
{
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)data;
d3d_texture_free(chain->tex);
d3d_vertex_buffer_free(chain->vertex_buf, chain->vertex_decl);
d3d_set_transform(d3d->dev, D3DTS_WORLD, &matrix);
}
static bool d3d8_renderchain_create_first_pass(void *data,
@ -92,16 +84,15 @@ static bool d3d8_renderchain_create_first_pass(void *data,
#else
D3DFMT_X8R8G8B8 : D3DFMT_R5G6B5,
#endif
0, 0, 0, 0, NULL, NULL);
D3DPOOL_MANAGED, 0, 0, 0, NULL, NULL,
false);
if (!chain->tex)
return false;
d3d_set_sampler_address_u(d3dr, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
d3d_set_sampler_address_v(d3dr, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
#ifdef _XBOX1
d3d_set_sampler_address_u(d3dr, 0, D3DTADDRESS_BORDER);
d3d_set_sampler_address_v(d3dr, 0, D3DTADDRESS_BORDER);
d3d_set_render_state(d3dr, D3DRS_LIGHTING, 0);
#endif
d3d_set_render_state(d3dr, D3DRS_CULLMODE, D3DCULL_NONE);
d3d_set_render_state(d3dr, D3DRS_ZENABLE, FALSE);
@ -122,7 +113,6 @@ static void d3d8_renderchain_set_vertices(void *data, unsigned pass,
if (chain->last_width != vert_width || chain->last_height != vert_height)
{
unsigned i;
Vertex vert[4];
float tex_w, tex_h;
void *verts = NULL;
@ -134,39 +124,35 @@ static void d3d8_renderchain_set_vertices(void *data, unsigned pass,
tex_h = vert_height;
vert[0].x = -1.0f;
vert[0].y = -1.0f;
vert[0].y = 1.0f;
vert[0].z = 1.0f;
vert[0].rhw = 0.0f;
vert[0].u = tex_h;
vert[0].v = 0.0f;
vert[1].x = 1.0f;
vert[1].y = -1.0f;
vert[1].y = 1.0f;
vert[1].z = 1.0f;
vert[1].rhw = tex_w;
vert[1].u = tex_h;
vert[1].v = 0.0f;
vert[2].x = -1.0f;
vert[2].y = 1.0f;
vert[2].y = -1.0f;
vert[2].z = 1.0f;
vert[2].rhw = 0.0f;
vert[2].u = 0.0f;
vert[2].v = 0.0f;
vert[3].x = 1.0f;
vert[3].y = 1.0f;
vert[3].y = -1.0f;
vert[3].z = 1.0f;
vert[3].rhw = tex_w;
vert[3].u = 0.0f;
vert[3].v = 0.0f;
/* Align texels and vertices. */
for (i = 0; i < 4; i++)
{
vert[i].x -= 0.5f / ((float)chain->tex_w);
vert[i].y += 0.5f / ((float)chain->tex_h);
}
vert[0].u = 0.0f;
vert[0].v = 0.0f;
vert[1].u = tex_w / chain->tex_w;
vert[1].v = 0.0f;
vert[2].u = 0.0f;
vert[2].v = tex_h / chain->tex_h;
vert[3].u = tex_w / chain->tex_w;
vert[3].v = tex_h / chain->tex_h;
vert[0].color = 0xFFFFFFFF;
vert[1].color = 0xFFFFFFFF;
vert[2].color = 0xFFFFFFFF;
vert[3].color = 0xFFFFFFFF;
verts = d3d_vertex_buffer_lock(chain->vertex_buf);
memcpy(verts, vert, sizeof(vert));
@ -193,32 +179,32 @@ static void d3d8_renderchain_blit_to_texture(void *data, const void *frame,
/* Set the texture to NULL so D3D doesn't complain about it being in use... */
d3d_set_texture(d3dr, 0, NULL);
d3d_texture_blit(chain->pixel_size, chain->tex,
&d3dlr, frame, width, height, pitch);
}
static void d3d8_renderchain_deinit(void *data)
{
d3d8_renderchain_t *renderchain = (d3d8_renderchain_t*)data;
if (renderchain)
free(renderchain);
if (d3d_lock_rectangle(chain->tex, 0, &d3dlr, NULL, 0, 0))
{
d3d_texture_blit(chain->pixel_size, chain->tex,
&d3dlr, frame, width, height, pitch);
d3d_unlock_rectangle(chain->tex);
}
}
static void d3d8_renderchain_free(void *data)
{
d3d_video_t *chain = (d3d_video_t*)data;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)data;
if (!chain || !chain->renderchain_data)
if (!chain)
return;
d3d8_renderchain_deinit(chain->renderchain_data);
d3d8_renderchain_clear(chain->renderchain_data);
if (chain->tex)
d3d_texture_free(chain->tex);
d3d_vertex_buffer_free(chain->vertex_buf, chain->vertex_decl);
#if 0
if (chain->tracker)
state_tracker_free(chain->tracker);
#endif
free(chain);
}
@ -273,44 +259,50 @@ static bool d3d8_renderchain_init(void *data,
static void d3d8_renderchain_set_final_viewport(void *data,
void *renderchain_data, const void *viewport_data)
{
(void)data;
(void)renderchain_data;
(void)viewport_data;
d3d_video_t *d3d = (d3d_video_t*)data;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)renderchain_data;
const D3DVIEWPORT *final_viewport = (const D3DVIEWPORT*)viewport_data;
/* stub */
#if 0
d3d_recompute_pass_sizes(chain, d3d);
#endif
}
static void d3d8_renderchain_render_pass(
d3d_video_t *d3d, LPDIRECT3DDEVICE d3dr,
d3d8_renderchain_t *chain,
unsigned pass_index,
unsigned rotation)
{
settings_t *settings = config_get_ptr();
d3d_set_texture(d3dr, 0, chain->tex);
d3d_set_sampler_magfilter(d3dr, pass_index, settings->bools.video_smooth ?
D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_sampler_minfilter(d3dr, pass_index, settings->bools.video_smooth ?
D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_viewports(chain->dev, &d3d->final_viewport);
d3d_set_vertex_shader(d3dr, D3DFVF_CUSTOMVERTEX, NULL);
d3d_set_stream_source(d3dr, 0, chain->vertex_buf, 0, sizeof(Vertex));
d3d8_renderchain_set_mvp(d3d, chain, NULL, NULL);
d3d_draw_primitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
}
static bool d3d8_renderchain_render(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
unsigned pitch, unsigned rotation)
{
unsigned i;
unsigned width, height;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
settings_t *settings = config_get_ptr();
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
chain->frame_count++;
video_driver_get_size(&width, &height);
d3d8_renderchain_blit_to_texture(chain, frame, frame_width, frame_height, pitch);
d3d8_renderchain_set_vertices(d3d, 1, frame_width, frame_height, chain->frame_count);
d3d_set_texture(d3dr, 0, chain->tex);
d3d_set_viewports(chain->dev, &d3d->final_viewport);
d3d_set_sampler_minfilter(d3dr, 0, settings->bools.video_smooth ?
D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d_set_sampler_magfilter(d3dr, 0, settings->bools.video_smooth ?
D3DTEXF_LINEAR : D3DTEXF_POINT);
d3d8_renderchain_render_pass(d3d, d3dr, chain, 0, rotation);
d3d_set_vertex_declaration(d3dr, chain->vertex_decl);
for (i = 0; i < 4; i++)
d3d_set_stream_source(d3dr, i, chain->vertex_buf, 0, sizeof(Vertex));
d3d_draw_primitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
d3d8_renderchain_set_mvp(chain, d3d, width, height, d3d->dev_rotation);
chain->frame_count++;
return true;
}

View File

@ -74,6 +74,7 @@ struct CGVertex
struct Pass
{
struct LinkInfo info;
D3DPOOL pool;
LPDIRECT3DTEXTURE tex;
LPDIRECT3DVERTEXBUFFER vertex_buf;
CGprogram vPrg, fPrg;
@ -239,15 +240,6 @@ error:
return false;
}
static void d3d9_cg_renderchain_set_shader_mvp(cg_renderchain_t *chain, void *shader_data, void *matrix_data)
{
CGprogram *vPrg = (CGprogram*)shader_data;
const D3DMATRIX *matrix = (const D3DMATRIX*)matrix_data;
CGparameter cgpModelViewProj = cgGetNamedParameter(*vPrg, "modelViewProj");
if (cgpModelViewProj)
cgD3D9SetUniformMatrix(cgpModelViewProj, matrix);
}
static void d3d9_cg_renderchain_set_shader_params(
cg_renderchain_t *chain,
struct Pass *pass,
@ -865,7 +857,7 @@ static bool d3d9_cg_renderchain_create_first_pass(
chain->prev.last_height[i] = 0;
chain->prev.vertex_buf[i] = d3d_vertex_buffer_new(
chain->dev, 4 * sizeof(struct CGVertex),
0, 0, D3DPOOL_DEFAULT, NULL);
D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, NULL);
if (!chain->prev.vertex_buf[i])
return false;
@ -873,7 +865,7 @@ static bool d3d9_cg_renderchain_create_first_pass(
chain->prev.tex[i] = d3d_texture_new(chain->dev, NULL,
info->tex_w, info->tex_h, 1, 0,
(fmt == RETRO_PIXEL_FORMAT_RGB565) ? D3DFMT_R5G6B5 : D3DFMT_X8R8G8B8,
D3DPOOL_MANAGED, 0, 0, 0, NULL, NULL);
D3DPOOL_MANAGED, 0, 0, 0, NULL, NULL, false);
if (!chain->prev.tex[i])
return false;
@ -948,13 +940,14 @@ static bool d3d9_cg_renderchain_set_pass_size(
pass->info.tex_w = width;
pass->info.tex_h = height;
pass->pool = D3DPOOL_DEFAULT;
pass->tex = d3d_texture_new(chain->dev, NULL,
width, height, 1,
D3DUSAGE_RENDERTARGET,
chain->passes->data[chain->passes->count - 1].info.pass->fbo.fp_fbo ?
D3DFMT_A32B32G32R32F : D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, 0, 0, 0,
NULL, NULL);
NULL, NULL, false);
if (!pass->tex)
return false;
@ -1019,7 +1012,7 @@ static void d3d_recompute_pass_sizes(cg_renderchain_t *chain,
d3d_video_t *d3d)
{
unsigned i;
struct LinkInfo link_info = {0};
struct LinkInfo link_info;
unsigned current_width = d3d->video_info.input_scale * RARCH_SCALE_BASE;
unsigned current_height = d3d->video_info.input_scale * RARCH_SCALE_BASE;
unsigned out_width = 0;
@ -1087,6 +1080,7 @@ static bool d3d9_cg_renderchain_add_pass(
pass.last_width = 0;
pass.last_height = 0;
pass.attrib_map = unsigned_vector_list_new();
pass.pool = D3DPOOL_DEFAULT;
d3d9_cg_load_program(chain, &pass.fPrg,
&pass.vPrg, info->pass->source.path, true);
@ -1096,7 +1090,7 @@ static bool d3d9_cg_renderchain_add_pass(
pass.vertex_buf = d3d_vertex_buffer_new(chain->dev,
4 * sizeof(struct CGVertex),
0, 0, D3DPOOL_DEFAULT, NULL);
D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, NULL);
if (!pass.vertex_buf)
return false;
@ -1110,7 +1104,7 @@ static bool d3d9_cg_renderchain_add_pass(
D3DUSAGE_RENDERTARGET,
chain->passes->data[chain->passes->count - 1].info.pass->fbo.fp_fbo
? D3DFMT_A32B32G32R32F : D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, 0, 0, 0, NULL, NULL);
D3DPOOL_DEFAULT, 0, 0, 0, NULL, NULL, false);
if (!pass.tex)
return false;
@ -1144,7 +1138,8 @@ static bool d3d9_cg_renderchain_add_lut(void *data,
0,
0,
NULL,
NULL
NULL,
false
);
RARCH_LOG("[D3D]: LUT texture loaded: %s.\n", path);
@ -1190,24 +1185,49 @@ static void d3d9_cg_renderchain_end_render(cg_renderchain_t *chain)
chain->prev.ptr = (chain->prev.ptr + 1) & TEXTURESMASK;
}
static void d3d9_cg_renderchain_set_mvp(
void *chain_data,
void *data,
static void d3d9_cg_renderchain_set_shader_mvp(
cg_renderchain_t *chain, CGprogram vPrg, D3DMATRIX *matrix)
{
CGparameter cgpModelViewProj = cgGetNamedParameter(vPrg, "modelViewProj");
if (cgpModelViewProj)
cgD3D9SetUniformMatrix(cgpModelViewProj, matrix);
}
static void d3d9_cg_renderchain_calc_and_set_shader_mvp(
cg_renderchain_t *chain, CGprogram vPrg,
unsigned vp_width, unsigned vp_height,
unsigned rotation)
{
D3DMATRIX proj, ortho, rot, tmp;
CGprogram vPrg = (CGprogram)data;
cg_renderchain_t *chain = (cg_renderchain_t*)chain_data;
D3DMATRIX proj, ortho, rot, matrix;
d3d_matrix_ortho_off_center_lh(&ortho, 0, vp_width, 0, vp_height, 0, 1);
d3d_matrix_identity(&rot);
d3d_matrix_rotation_z(&rot, rotation * (D3D_PI / 2.0));
d3d_matrix_multiply(&proj, &ortho, &rot);
d3d_matrix_transpose(&tmp, &proj);
d3d_matrix_transpose(&matrix, &proj);
d3d9_cg_renderchain_set_shader_mvp(chain, &vPrg, &tmp);
d3d9_cg_renderchain_set_shader_mvp(chain, vPrg, &matrix);
}
static void d3d9_cg_renderchain_set_mvp(
void *data,
void *chain_data,
void *shader_data,
const void *mat_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
#if 0
cg_renderchain_t *chain = (cg_renderchain_t*)chain_data;
if(shader_data)
d3d9_cg_renderchain_set_shader_mvp(chain, shader_data, mat_data);
else
d3d9_cg_renderchain_set_shader_mvp(chain, chain->vStock, mat_data);
#else
d3d_set_vertex_shader_constantf(d3d->dev, 0, (const float*)mat_data, 4);
#endif
}
static void cg_d3d9_renderchain_set_vertices(
@ -1297,7 +1317,7 @@ static void cg_d3d9_renderchain_set_vertices(
if (chain)
{
d3d9_cg_renderchain_set_mvp(
d3d9_cg_renderchain_calc_and_set_shader_mvp(
chain, pass->vPrg, vp_width, vp_height, rotation);
if (pass)
d3d9_cg_renderchain_set_shader_params(chain, pass,
@ -1323,7 +1343,9 @@ static void cg_d3d9_renderchain_blit_to_texture(
D3DLOCKED_RECT d3dlr;
struct Pass *first = (struct Pass*)&chain->passes->data[0];
if (first->last_width != width || first->last_height != height)
if (
(first->last_width != width || first->last_height != height)
)
{
d3d_lock_rectangle(first->tex, 0, &d3dlr,
NULL, first->info.tex_h, D3DLOCK_NOSYSLOCK);
@ -1331,8 +1353,12 @@ static void cg_d3d9_renderchain_blit_to_texture(
NULL, first->info.tex_h, D3DLOCK_NOSYSLOCK);
}
d3d_texture_blit(chain->pixel_size, first->tex,
&d3dlr, frame, width, height, pitch);
if (d3d_lock_rectangle(first->tex, 0, &d3dlr, NULL, 0, 0))
{
d3d_texture_blit(chain->pixel_size, first->tex,
&d3dlr, frame, width, height, pitch);
d3d_unlock_rectangle(first->tex);
}
}
static void cg_d3d9_renderchain_unbind_all(cg_renderchain_t *chain)
@ -1561,7 +1587,7 @@ static bool d3d9_cg_renderchain_render(
d3d9_cg_renderchain_end_render(chain);
cgD3D9BindProgram(chain->fStock);
cgD3D9BindProgram(chain->vStock);
d3d9_cg_renderchain_set_mvp(
d3d9_cg_renderchain_calc_and_set_shader_mvp(
chain, chain->vStock, chain->final_viewport->Width,
chain->final_viewport->Height, 0);
}
@ -1590,13 +1616,10 @@ static void d3d9_cg_renderchain_set_font_rect(
if (!d3d)
return;
d3d->font_rect.left = d3d->final_viewport.X +
d3d->final_viewport.Width * pos_x;
d3d->font_rect.right = d3d->final_viewport.X +
d3d->final_viewport.Width;
d3d->font_rect.top = d3d->final_viewport.Y +
(1.0f - pos_y) * d3d->final_viewport.Height - font_size;
d3d->font_rect.bottom = d3d->final_viewport.Height;
d3d->font_rect.left = d3d->video_info.width * pos_x;
d3d->font_rect.right = d3d->video_info.width;
d3d->font_rect.top = (1.0f - pos_y) * d3d->video_info.height - font_size;
d3d->font_rect.bottom = d3d->video_info.height;
d3d->font_rect_shifted = d3d->font_rect;
d3d->font_rect_shifted.left -= 2;

View File

@ -45,28 +45,17 @@ typedef struct hlsl_d3d9_renderchain
void hlsl_set_proj_matrix(void *data, void *matrix_data);
static void hlsl_d3d9_renderchain_set_mvp(
void *data,
void *chain_data,
void *data, unsigned vp_width,
unsigned vp_height, unsigned rotation)
void *shader_data,
const void *mat_data)
{
video_shader_ctx_mvp_t mvp;
D3DMATRIX proj, ortho, rot, tmp;
d3d_video_t *d3d = (d3d_video_t*)data;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
d3d_matrix_ortho_off_center_lh(&ortho, 0, vp_width, 0, vp_height, 0, 1);
d3d_matrix_identity(&rot);
d3d_matrix_rotation_z(&rot, rotation * (M_PI / 2.0));
d3d_matrix_multiply(&proj, &ortho, &rot);
d3d_matrix_transpose(&tmp, &proj);
hlsl_set_proj_matrix((void*)&d3d->shader, &rot);
mvp.data = d3d;
mvp.matrix = &rot;
video_driver_set_mvp(&mvp);
if(shader_data)
hlsl_set_proj_matrix(shader_data, mat_data);
else
hlsl_set_proj_matrix((void*)&d3d->shader, mat_data);
}
static void hlsl_d3d9_renderchain_clear(void *data)
@ -120,7 +109,7 @@ static bool hlsl_d3d9_renderchain_create_first_pass(void *data,
#else
info->rgb32 ? D3DFMT_X8R8G8B8 : D3DFMT_R5G6B5,
#endif
0, 0, 0, 0, NULL, NULL);
0, 0, 0, 0, NULL, NULL, false);
if (!chain->tex)
return false;
@ -244,8 +233,13 @@ static void hlsl_d3d9_renderchain_blit_to_texture(
/* Set the texture to NULL so D3D doesn't complain about it being in use... */
d3d_set_texture(d3dr, 0, NULL);
d3d_texture_blit(chain->pixel_size, chain->tex,
&d3dlr, frame, width, height, pitch);
if (d3d_lock_rectangle(chain->tex, 0, &d3dlr, NULL, 0, 0))
{
d3d_texture_blit(chain->pixel_size, chain->tex,
&d3dlr, frame, width, height, pitch);
d3d_unlock_rectangle(chain->tex);
}
}
static void hlsl_d3d9_renderchain_deinit(void *data)

View File

@ -1038,8 +1038,8 @@ static bool gl2_renderchain_init_hw_render(
status = gl2_check_fb_status(RARCH_GL_FRAMEBUFFER);
if (status != RARCH_GL_FRAMEBUFFER_COMPLETE)
{
RARCH_ERR("[GL]: Failed to create HW render FBO #%u, error: 0x%u.\n",
i, (unsigned)status);
RARCH_ERR("[GL]: Failed to create HW render FBO #%u, error: 0x%04x.\n",
i, status);
return false;
}
}

View File

@ -1110,7 +1110,7 @@ static void *gl_cg_init(void *data, const char *path)
memset(cg->alias_define, 0, sizeof(cg->alias_define));
if ( !string_is_empty(path)
&& string_is_equal_fast(path_get_extension(path), "cgp", 3))
&& string_is_equal(path_get_extension(path), "cgp"))
{
if (!gl_cg_load_preset(cg, path))
goto error;

View File

@ -840,7 +840,7 @@ static void *gl_glsl_init(void *data, const char *path)
bool ret = false;
const char *path_ext = path_get_extension(path);
if (string_is_equal_fast(path_ext, "glslp", 5))
if (string_is_equal(path_ext, "glslp"))
{
conf = config_file_new(path);
if (conf)
@ -849,7 +849,7 @@ static void *gl_glsl_init(void *data, const char *path)
glsl->shader->modern = true;
}
}
else if (string_is_equal_fast(path_ext, "glsl", 4))
else if (string_is_equal(path_ext, "glsl"))
{
strlcpy(glsl->shader->pass[0].source.path, path,
sizeof(glsl->shader->pass[0].source.path));

View File

@ -479,7 +479,7 @@ static void *hlsl_init(void *data, const char *path)
if (!hlsl_data)
return NULL;
if (path && (string_is_equal_fast(path_get_extension(path), ".cgp", 4)))
if (path && (string_is_equal(path_get_extension(path), ".cgp")))
{
if (!hlsl_load_preset(hlsl_data, d3d, path))
goto error;

View File

@ -1843,13 +1843,16 @@ bool video_driver_find_driver(void)
current_video = (video_driver_t*)video_driver_find_handle(i);
else
{
unsigned d;
RARCH_ERR("Couldn't find any video driver named \"%s\"\n",
settings->arrays.video_driver);
RARCH_LOG_OUTPUT("Available video drivers are:\n");
for (d = 0; video_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", video_driver_find_ident(d));
RARCH_WARN("Going to default to first video driver...\n");
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any video driver named \"%s\"\n",
settings->arrays.video_driver);
RARCH_LOG_OUTPUT("Available video drivers are:\n");
for (d = 0; video_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", video_driver_find_ident(d));
RARCH_WARN("Going to default to first video driver...\n");
}
current_video = (video_driver_t*)video_driver_find_handle(0);

View File

@ -798,9 +798,10 @@ typedef struct video_driver
typedef struct d3d_renderchain_driver
{
void (*set_mvp)(void *chain_data,
void *data, unsigned vp_width,
unsigned vp_height, unsigned rotation);
void (*set_mvp)(void *data,
void *chain_data,
void *shader_data,
const void *mat_data);
void (*chain_free)(void *data);
void *(*chain_new)(void);
bool (*reinit)(void *data, const void *info_data);

View File

@ -537,7 +537,7 @@ bool video_shader_resolve_parameters(config_file_t *conf,
/* First try to use the more robust slang implementation to support #includes. */
/* FIXME: The check for slang can be removed if it's sufficiently tested for
* GLSL/Cg as well, it should be the same implementation. */
if (string_is_equal_fast(path_get_extension(path), "slang", 5) &&
if (string_is_equal(path_get_extension(path), "slang") &&
slang_preprocess_parse_parameters(shader->pass[i].source.path, shader))
{
free(line);

View File

@ -548,6 +548,7 @@ INPUT
#include "../input/drivers_joypad/qnx_joypad.c"
#elif defined(EMSCRIPTEN)
#include "../input/drivers/rwebinput_input.c"
#include "../input/drivers_joypad/rwebpad_joypad.c"
#elif defined(DJGPP)
#include "../input/drivers/dos_input.c"
#include "../input/drivers_joypad/dos_joypad.c"

View File

@ -1,5 +1,5 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2015 - Michael Lelli
* Copyright (C) 2010-2018 - Michael Lelli
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
@ -19,107 +19,487 @@
#include <string.h>
#include <boolean.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h>
#include <encodings/crc32.h>
#include <encodings/utf.h>
#include <emscripten/html5.h>
#include "../input_driver.h"
#include "../input_keymaps.h"
#include "../../tasks/tasks_internal.h"
#include "../../configuration.h"
#include "../../verbosity.h"
typedef struct rwebinput_state
/* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button */
#define RWEBINPUT_MOUSE_BTNL 0
#define RWEBINPUT_MOUSE_BTNM 1
#define RWEBINPUT_MOUSE_BTNR 2
#define RWEBINPUT_MOUSE_BTN4 3
#define RWEBINPUT_MOUSE_BTN5 4
typedef struct rwebinput_key_to_code_map_entry
{
uint8_t keys[32];
int mouse_x;
int mouse_y;
char mouse_l;
char mouse_r;
bool blocked;
} rwebinput_state_t;
const char *key;
enum retro_key rk;
} rwebinput_key_to_code_map_entry_t;
int RWebInputInit(void);
rwebinput_state_t *RWebInputPoll(int context);
void RWebInputDestroy(int context);
typedef struct rwebinput_keyboard_event
{
int type;
EmscriptenKeyboardEvent event;
} rwebinput_keyboard_event_t;
typedef struct rwebinput_keyboard_event_queue
{
size_t count;
size_t max_size;
rwebinput_keyboard_event_t *events;
} rwebinput_keyboard_event_queue_t;
typedef struct rwebinput_mouse_states
{
signed x;
signed y;
signed delta_x;
signed delta_y;
uint8_t buttons;
double scroll_x;
double scroll_y;
} rwebinput_mouse_state_t;
typedef struct rwebinput_input
{
rwebinput_state_t state;
int context;
bool keys[RETROK_LAST];
rwebinput_mouse_state_t mouse;
const input_device_driver_t *joypad;
bool blocked;
} rwebinput_input_t;
/* KeyboardEvent.keyCode has been deprecated for a while and doesn't have
* separate left/right modifer codes, so we have to map string labels from
* KeyboardEvent.code to retro keys */
static const rwebinput_key_to_code_map_entry_t rwebinput_key_to_code_map[] =
{
{ "KeyA", RETROK_a },
{ "KeyB", RETROK_b },
{ "KeyC", RETROK_c },
{ "KeyD", RETROK_d },
{ "KeyE", RETROK_e },
{ "KeyF", RETROK_f },
{ "KeyG", RETROK_g },
{ "KeyH", RETROK_h },
{ "KeyI", RETROK_i },
{ "KeyJ", RETROK_j },
{ "KeyK", RETROK_k },
{ "KeyL", RETROK_l },
{ "KeyM", RETROK_m },
{ "KeyN", RETROK_n },
{ "KeyO", RETROK_o },
{ "KeyP", RETROK_p },
{ "KeyQ", RETROK_q },
{ "KeyR", RETROK_r },
{ "KeyS", RETROK_s },
{ "KeyT", RETROK_t },
{ "KeyU", RETROK_u },
{ "KeyV", RETROK_v },
{ "KeyW", RETROK_w },
{ "KeyX", RETROK_x },
{ "KeyY", RETROK_y },
{ "KeyZ", RETROK_z },
{ "ArrowLeft", RETROK_LEFT },
{ "ArrowRight", RETROK_RIGHT },
{ "ArrowUp", RETROK_UP },
{ "ArrowDown", RETROK_DOWN },
{ "Enter", RETROK_RETURN },
{ "NumpadEnter", RETROK_KP_ENTER },
{ "Tab", RETROK_TAB },
{ "Insert", RETROK_INSERT },
{ "Delete", RETROK_DELETE },
{ "End", RETROK_END },
{ "Home", RETROK_HOME },
{ "ShiftRight", RETROK_RSHIFT },
{ "ShiftLeft", RETROK_LSHIFT },
{ "ControlLeft", RETROK_LCTRL },
{ "AltLeft", RETROK_LALT },
{ "Space", RETROK_SPACE },
{ "Escape", RETROK_ESCAPE },
{ "NumpadAdd", RETROK_KP_PLUS },
{ "NumpadSubtract", RETROK_KP_MINUS },
{ "F1", RETROK_F1 },
{ "F2", RETROK_F2 },
{ "F3", RETROK_F3 },
{ "F4", RETROK_F4 },
{ "F5", RETROK_F5 },
{ "F6", RETROK_F6 },
{ "F7", RETROK_F7 },
{ "F8", RETROK_F8 },
{ "F9", RETROK_F9 },
{ "F10", RETROK_F10 },
{ "F11", RETROK_F11 },
{ "F12", RETROK_F12 },
{ "Digit0", RETROK_0 },
{ "Digit1", RETROK_1 },
{ "Digit2", RETROK_2 },
{ "Digit3", RETROK_3 },
{ "Digit4", RETROK_4 },
{ "Digit5", RETROK_5 },
{ "Digit6", RETROK_6 },
{ "Digit7", RETROK_7 },
{ "Digit8", RETROK_8 },
{ "Digit9", RETROK_9 },
{ "PageUp", RETROK_PAGEUP },
{ "PageDown", RETROK_PAGEDOWN },
{ "Numpad0", RETROK_KP0 },
{ "Numpad1", RETROK_KP1 },
{ "Numpad2", RETROK_KP2 },
{ "Numpad3", RETROK_KP3 },
{ "Numpad4", RETROK_KP4 },
{ "Numpad5", RETROK_KP5 },
{ "Numpad6", RETROK_KP6 },
{ "Numpad7", RETROK_KP7 },
{ "Numpad8", RETROK_KP8 },
{ "Numpad9", RETROK_KP9 },
{ "Period", RETROK_PERIOD },
{ "CapsLock", RETROK_CAPSLOCK },
{ "NumLock", RETROK_NUMLOCK },
{ "Backspace", RETROK_BACKSPACE },
{ "NumpadMultiply", RETROK_KP_MULTIPLY },
{ "NumpadDivide", RETROK_KP_DIVIDE },
{ "PrintScreen", RETROK_PRINT },
{ "ScrollLock", RETROK_SCROLLOCK },
{ "Backquote", RETROK_BACKQUOTE },
{ "Pause", RETROK_PAUSE },
{ "Quote", RETROK_QUOTE },
{ "Comma", RETROK_COMMA },
{ "Minus", RETROK_MINUS },
{ "Slash", RETROK_SLASH },
{ "Semicolon", RETROK_SEMICOLON },
{ "Equal", RETROK_EQUALS },
{ "BracketLeft", RETROK_LEFTBRACKET },
{ "Backslash", RETROK_BACKSLASH },
{ "BracketRight", RETROK_RIGHTBRACKET },
{ "NumpadDecimal", RETROK_KP_PERIOD },
{ "NumpadEqual", RETROK_KP_EQUALS },
{ "ControlRight", RETROK_RCTRL },
{ "AltRight", RETROK_RALT },
{ "F13", RETROK_F13 },
{ "F14", RETROK_F14 },
{ "F15", RETROK_F15 },
{ "MetaRight", RETROK_RMETA },
{ "MetaLeft", RETROK_LMETA },
{ "Help", RETROK_HELP },
{ "ContextMenu", RETROK_MENU },
{ "Power", RETROK_POWER },
};
static bool g_rwebinput_initialized;
static rwebinput_keyboard_event_queue_t *g_rwebinput_keyboard;
static rwebinput_mouse_state_t *g_rwebinput_mouse;
/* to make the string labels for codes from JavaScript work, we convert them
* to CRC32 hashes for the LUT */
static void rwebinput_generate_lut(void)
{
int i;
struct rarch_key_map *key_map;
retro_assert(ARRAY_SIZE(rarch_key_map_rwebinput) ==
ARRAY_SIZE(rwebinput_key_to_code_map) + 1);
for (i = 0; i < ARRAY_SIZE(rwebinput_key_to_code_map); i++)
{
int j;
uint32_t crc;
const rwebinput_key_to_code_map_entry_t *key_to_code =
&rwebinput_key_to_code_map[i];
key_map = &rarch_key_map_rwebinput[i];
crc = encoding_crc32(0, (const uint8_t *)key_to_code->key,
strlen(key_to_code->key));
/* sanity check: make sure there's no collisions */
for (j = 0; j < i; j++)
{
retro_assert(rarch_key_map_rwebinput[j].sym != crc);
}
key_map->rk = key_to_code->rk;
key_map->sym = crc;
}
/* set terminating entry */
key_map = &rarch_key_map_rwebinput[ARRAY_SIZE(rarch_key_map_rwebinput) - 1];
key_map->rk = RETROK_UNKNOWN;
key_map->sym = 0;
}
static EM_BOOL rwebinput_keyboard_cb(int event_type,
const EmscriptenKeyboardEvent *key_event, void *user_data)
{
if (event_type == EMSCRIPTEN_EVENT_KEYPRESS)
return EM_TRUE;
if (g_rwebinput_keyboard->count >= g_rwebinput_keyboard->max_size)
{
size_t new_max = MAX(1, g_rwebinput_keyboard->max_size << 1);
g_rwebinput_keyboard->events = realloc(g_rwebinput_keyboard->events,
new_max * sizeof(g_rwebinput_keyboard->events[0]));
retro_assert(g_rwebinput_keyboard->events != NULL);
g_rwebinput_keyboard->max_size = new_max;
}
g_rwebinput_keyboard->events[g_rwebinput_keyboard->count].type = event_type;
memcpy(&g_rwebinput_keyboard->events[g_rwebinput_keyboard->count].event,
key_event, sizeof(*key_event));
g_rwebinput_keyboard->count++;
return EM_TRUE;
}
static EM_BOOL rwebinput_mouse_cb(int event_type,
const EmscriptenMouseEvent *mouse_event, void *user_data)
{
(void)user_data;
uint8_t mask = 1 << mouse_event->button;
g_rwebinput_mouse->x = mouse_event->canvasX;
g_rwebinput_mouse->y = mouse_event->canvasY;
g_rwebinput_mouse->delta_x += mouse_event->movementX;
g_rwebinput_mouse->delta_y += mouse_event->movementY;
if (event_type == EMSCRIPTEN_EVENT_MOUSEDOWN)
{
g_rwebinput_mouse->buttons |= mask;
}
else if (event_type == EMSCRIPTEN_EVENT_MOUSEUP)
{
g_rwebinput_mouse->buttons &= ~mask;
}
return EM_TRUE;
}
static EM_BOOL rwebinput_wheel_cb(int event_type,
const EmscriptenWheelEvent *wheel_event, void *user_data)
{
(void)event_type;
(void)user_data;
g_rwebinput_mouse->scroll_x += wheel_event->deltaX;
g_rwebinput_mouse->scroll_y += wheel_event->deltaY;
return EM_TRUE;
}
static void *rwebinput_input_init(const char *joypad_driver)
{
rwebinput_input_t *rwebinput = (rwebinput_input_t*)calloc(1, sizeof(*rwebinput));
if (!rwebinput)
rwebinput_input_t *rwebinput =
(rwebinput_input_t*)calloc(1, sizeof(*rwebinput));
g_rwebinput_keyboard = (rwebinput_keyboard_event_queue_t*)
calloc(1, sizeof(rwebinput_keyboard_event_queue_t));
g_rwebinput_mouse = (rwebinput_mouse_state_t*)
calloc(1, sizeof(rwebinput_mouse_state_t));
if (!rwebinput || !g_rwebinput_keyboard || !g_rwebinput_mouse)
goto error;
rwebinput->context = RWebInputInit();
if (!rwebinput->context)
goto error;
if (!g_rwebinput_initialized)
{
EMSCRIPTEN_RESULT r;
g_rwebinput_initialized = true;
rwebinput_generate_lut();
/* emscripten currently doesn't have an API to remove handlers, so make
* once and reuse it */
r = emscripten_set_keydown_callback("#document", NULL, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create keydown callback: %d\n", r);
}
r = emscripten_set_keyup_callback("#document", NULL, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create keydown callback: %d\n", r);
}
r = emscripten_set_keypress_callback("#document", NULL, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create keypress callback: %d\n", r);
}
r = emscripten_set_mousedown_callback("#canvas", NULL, false,
rwebinput_mouse_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create mousedown callback: %d\n", r);
}
r = emscripten_set_mouseup_callback("#canvas", NULL, false,
rwebinput_mouse_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create mouseup callback: %d\n", r);
}
r = emscripten_set_mousemove_callback("#canvas", NULL, false,
rwebinput_mouse_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create mousemove callback: %d\n", r);
}
r = emscripten_set_wheel_callback("#document", NULL, false,
rwebinput_wheel_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/INPUT] failed to create wheel callback: %d\n", r);
}
}
input_keymaps_init_keyboard_lut(rarch_key_map_rwebinput);
rwebinput->joypad = input_joypad_init_driver(joypad_driver, rwebinput);
return rwebinput;
error:
if (rwebinput)
free(rwebinput);
free(g_rwebinput_keyboard);
free(g_rwebinput_mouse);
free(rwebinput);
return NULL;
}
static bool rwebinput_key_pressed_internal(void *data, int key)
static bool rwebinput_key_pressed(rwebinput_input_t *rwebinput, int key)
{
unsigned sym;
bool ret;
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
if (key >= RETROK_LAST)
return false;
sym = rarch_keysym_lut[(enum retro_key)key];
ret = rwebinput->state.keys[sym >> 3] & (1 << (sym & 7));
return ret;
return rwebinput->keys[key];
}
static bool rwebinput_is_pressed(rwebinput_input_t *rwebinput,
const struct retro_keybind *binds, unsigned id)
static int16_t rwebinput_pointer_device_state(rwebinput_mouse_state_t *mouse,
unsigned id, bool screen)
{
if (id < RARCH_BIND_LIST_END)
struct video_viewport vp;
bool inside = false;
int16_t res_x = 0;
int16_t res_y = 0;
int16_t res_screen_x = 0;
int16_t res_screen_y = 0;
vp.x = 0;
vp.y = 0;
vp.width = 0;
vp.height = 0;
vp.full_width = 0;
vp.full_height = 0;
if (!(video_driver_translate_coord_viewport_wrap(&vp, mouse->x, mouse->x,
&res_x, &res_y, &res_screen_x, &res_screen_y)))
return 0;
if (screen)
{
const struct retro_keybind *bind = &binds[id];
int key = binds[id].key;
return bind->valid && (key < RETROK_LAST)
&& rwebinput_key_pressed_internal(rwebinput, key);
res_x = res_screen_x;
res_y = res_screen_y;
}
return false;
}
inside = (res_x >= -0x7fff) && (res_y >= -0x7fff);
static bool rwebinput_key_pressed(void *data, int key)
{
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
return rwebinput_is_pressed(rwebinput, input_config_binds[0], key);
}
if (!inside)
return 0;
static int16_t rwebinput_mouse_state(rwebinput_input_t *rwebinput, unsigned id)
{
switch (id)
{
case RETRO_DEVICE_ID_MOUSE_X:
return (int16_t) rwebinput->state.mouse_x;
case RETRO_DEVICE_ID_MOUSE_Y:
return (int16_t) rwebinput->state.mouse_y;
case RETRO_DEVICE_ID_MOUSE_LEFT:
return rwebinput->state.mouse_l;
case RETRO_DEVICE_ID_MOUSE_RIGHT:
return rwebinput->state.mouse_r;
case RETRO_DEVICE_ID_POINTER_X:
return res_x;
case RETRO_DEVICE_ID_POINTER_Y:
return res_y;
case RETRO_DEVICE_ID_POINTER_PRESSED:
return !!(mouse->buttons & (1 << RWEBINPUT_MOUSE_BTNL));
}
return 0;
}
static int16_t rwebinput_mouse_state(rwebinput_mouse_state_t *mouse,
unsigned id, bool screen)
{
switch (id)
{
case RETRO_DEVICE_ID_MOUSE_X:
return (int16_t)(screen ? mouse->x : mouse->delta_x);
case RETRO_DEVICE_ID_MOUSE_Y:
return (int16_t)(screen ? mouse->y : mouse->delta_y);
case RETRO_DEVICE_ID_MOUSE_LEFT:
return !!(mouse->buttons & (1 << RWEBINPUT_MOUSE_BTNL));
case RETRO_DEVICE_ID_MOUSE_RIGHT:
return !!(mouse->buttons & (1 << RWEBINPUT_MOUSE_BTNR));
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
return !!(mouse->buttons & (1 << RWEBINPUT_MOUSE_BTNM));
case RETRO_DEVICE_ID_MOUSE_BUTTON_4:
return !!(mouse->buttons & (1 << RWEBINPUT_MOUSE_BTN4));
case RETRO_DEVICE_ID_MOUSE_BUTTON_5:
return !!(mouse->buttons & (1 << RWEBINPUT_MOUSE_BTN5));
case RETRO_DEVICE_ID_MOUSE_WHEELUP:
return mouse->scroll_y < 0.0;
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
return mouse->scroll_y > 0.0;
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
return mouse->scroll_x < 0.0;
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
return mouse->scroll_x > 0.0;
}
return 0;
}
static bool rwebinput_is_pressed(rwebinput_input_t *rwebinput,
rarch_joypad_info_t joypad_info, const struct retro_keybind *binds,
unsigned port, unsigned id)
{
if (id < RARCH_BIND_LIST_END)
{
const struct retro_keybind *bind = &binds[id];
int key = bind->key;
if (!rwebinput->blocked && (bind->key < RETROK_LAST) &&
rwebinput_key_pressed(rwebinput, key))
return true;
if (bind->valid)
{
if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse,
bind->mbutton, false))
return true;
if (input_joypad_pressed(rwebinput->joypad, joypad_info, port, binds,
id))
return true;
}
}
return false;
}
static int16_t rwebinput_analog_pressed(rwebinput_input_t *rwebinput,
const struct retro_keybind *binds, unsigned idx, unsigned id)
rarch_joypad_info_t joypad_info, const struct retro_keybind *binds,
unsigned idx, unsigned id)
{
int16_t pressed_minus = 0, pressed_plus = 0;
unsigned id_minus = 0;
@ -127,9 +507,9 @@ static int16_t rwebinput_analog_pressed(rwebinput_input_t *rwebinput,
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
if (rwebinput_is_pressed(rwebinput, binds, id_minus))
if (rwebinput_is_pressed(rwebinput, joypad_info, binds, idx, id_minus))
pressed_minus = -0x7fff;
if (rwebinput_is_pressed(rwebinput, binds, id_plus))
if (rwebinput_is_pressed(rwebinput, joypad_info, binds, idx, id_plus))
pressed_plus = 0x7fff;
return pressed_plus + pressed_minus;
@ -140,18 +520,33 @@ static int16_t rwebinput_input_state(void *data,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned idx, unsigned id)
{
int16_t ret;
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
switch (device)
{
case RETRO_DEVICE_JOYPAD:
return rwebinput_is_pressed(rwebinput, binds[port], id);
if (id < RARCH_BIND_LIST_END)
return rwebinput_is_pressed(rwebinput, joypad_info, binds[port],
port, id);
break;
case RETRO_DEVICE_ANALOG:
return rwebinput_analog_pressed(rwebinput, binds[port], idx, id);
ret = rwebinput_analog_pressed(rwebinput, joypad_info, binds[port],
idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(rwebinput->joypad, joypad_info, port,
idx, id, binds[port]);
return ret;
case RETRO_DEVICE_KEYBOARD:
return rwebinput_key_pressed(rwebinput, id);
case RETRO_DEVICE_MOUSE:
return rwebinput_mouse_state(rwebinput, id);
return rwebinput_mouse_state(&rwebinput->mouse, id, false);
case RARCH_DEVICE_MOUSE_SCREEN:
return rwebinput_mouse_state(&rwebinput->mouse, id, true);
case RETRO_DEVICE_POINTER:
return rwebinput_pointer_device_state(&rwebinput->mouse, id, false);
case RARCH_DEVICE_POINTER_SCREEN:
return rwebinput_pointer_device_state(&rwebinput->mouse, id, true);
}
return 0;
@ -161,47 +556,87 @@ static void rwebinput_input_free(void *data)
{
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
if (!rwebinput)
return;
RWebInputDestroy(rwebinput->context);
if (g_rwebinput_keyboard)
free(g_rwebinput_keyboard->events);
free(g_rwebinput_keyboard);
g_rwebinput_keyboard = NULL;
free(g_rwebinput_mouse);
g_rwebinput_mouse = NULL;
free(rwebinput);
}
static void rwebinput_process_keyboard_events(rwebinput_input_t *rwebinput,
rwebinput_keyboard_event_t *event)
{
uint32_t keycode;
unsigned translated_keycode;
uint32_t character = 0;
uint16_t mod = 0;
const EmscriptenKeyboardEvent *key_event = &event->event;
bool keydown = event->type == EMSCRIPTEN_EVENT_KEYDOWN;
/* a printable key: populate character field */
if (utf8len(key_event->key) == 1)
{
const char *key_ptr = &key_event->key[0];
character = utf8_walk(&key_ptr);
}
if (key_event->ctrlKey)
mod |= RETROKMOD_CTRL;
if (key_event->altKey)
mod |= RETROKMOD_ALT;
if (key_event->shiftKey)
mod |= RETROKMOD_SHIFT;
if (key_event->metaKey)
mod |= RETROKMOD_META;
keycode = encoding_crc32(0, (const uint8_t *)key_event->code,
strnlen(key_event->code, sizeof(key_event->code)));
translated_keycode = input_keymaps_translate_keysym_to_rk(keycode);
if (translated_keycode == RETROK_BACKSPACE)
character = '\b';
else if (translated_keycode == RETROK_RETURN ||
translated_keycode == RETROK_KP_ENTER)
character = '\n';
else if (translated_keycode == RETROK_TAB)
character = '\t';
input_keyboard_event(keydown, translated_keycode, character, mod,
RETRO_DEVICE_KEYBOARD);
if (translated_keycode < RETROK_LAST)
{
rwebinput->keys[translated_keycode] = keydown;
}
}
static void rwebinput_input_poll(void *data)
{
unsigned i;
size_t i;
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
rwebinput_state_t *state = RWebInputPoll(rwebinput->context);
/* Get new keys. */
for (i = 0; i < 32; i++)
{
unsigned k;
uint8_t diff;
for (i = 0; i < g_rwebinput_keyboard->count; i++)
rwebinput_process_keyboard_events(rwebinput,
&g_rwebinput_keyboard->events[i]);
g_rwebinput_keyboard->count = 0;
if (state->keys[i] == rwebinput->state.keys[i])
continue;
memcpy(&rwebinput->mouse, g_rwebinput_mouse, sizeof(*g_rwebinput_mouse));
g_rwebinput_mouse->delta_x = g_rwebinput_mouse->delta_y = 0;
g_rwebinput_mouse->scroll_x = g_rwebinput_mouse->scroll_y = 0.0;
diff = state->keys[i] ^ rwebinput->state.keys[i];
for (k = 0; diff; diff >>= 1, k++)
{
if (diff & 1)
input_keyboard_event((state->keys[i] & (1 << k)) != 0,
input_keymaps_translate_keysym_to_rk(i * 8 + k), 0, 0,
RETRO_DEVICE_KEYBOARD);
}
}
memcpy(&rwebinput->state, state, sizeof(rwebinput->state));
if (rwebinput->joypad)
rwebinput->joypad->poll();
}
static void rwebinput_grab_mouse(void *data, bool state)
{
(void)data;
(void)state;
if (state)
emscripten_request_pointerlock("#canvas", EM_TRUE);
else
emscripten_exit_pointerlock();
}
static bool rwebinput_set_rumble(void *data, unsigned port,
@ -215,6 +650,14 @@ static bool rwebinput_set_rumble(void *data, unsigned port,
return false;
}
static const input_device_driver_t *rwebinput_get_joypad_driver(void *data)
{
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
if (!rwebinput)
return NULL;
return rwebinput->joypad;
}
static uint64_t rwebinput_get_capabilities(void *data)
{
uint64_t caps = 0;
@ -223,6 +666,7 @@ static uint64_t rwebinput_get_capabilities(void *data)
caps |= (1 << RETRO_DEVICE_ANALOG);
caps |= (1 << RETRO_DEVICE_KEYBOARD);
caps |= (1 << RETRO_DEVICE_MOUSE);
caps |= (1 << RETRO_DEVICE_POINTER);
return caps;
}
@ -232,7 +676,7 @@ static bool rwebinput_keyboard_mapping_is_blocked(void *data)
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
if (!rwebinput)
return false;
return rwebinput->state.blocked;
return rwebinput->blocked;
}
static void rwebinput_keyboard_mapping_set_block(void *data, bool value)
@ -240,7 +684,7 @@ static void rwebinput_keyboard_mapping_set_block(void *data, bool value)
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
if (!rwebinput)
return;
rwebinput->state.blocked = value;
rwebinput->blocked = value;
}
input_driver_t input_rwebinput = {
@ -255,7 +699,7 @@ input_driver_t input_rwebinput = {
rwebinput_grab_mouse,
NULL,
rwebinput_set_rumble,
NULL,
rwebinput_get_joypad_driver,
NULL,
rwebinput_keyboard_mapping_is_blocked,
rwebinput_keyboard_mapping_set_block,

View File

@ -274,7 +274,7 @@ static void sdl_grab_mouse(void *data, bool state)
SDL_Window *w;
};
if (string_is_not_equal_fast(video_driver_get_ident(), "sdl2", 4))
if (string_is_not_equal(video_driver_get_ident(), "sdl2"))
return;
/* First member of sdl2_video_t is the window */

View File

@ -615,18 +615,18 @@ static void udev_input_handle_hotplug(udev_input_t *udev)
action = udev_device_get_action(dev);
devnode = udev_device_get_devnode(dev);
if (val_key && string_is_equal_fast(val_key, "1", 1) && devnode)
if (val_key && string_is_equal(val_key, "1") && devnode)
{
/* EV_KEY device, can be a keyboard or a remote control device. */
dev_type = UDEV_INPUT_KEYBOARD;
cb = udev_handle_keyboard;
}
else if (val_mouse && string_is_equal_fast(val_mouse, "1", 1) && devnode)
else if (val_mouse && string_is_equal(val_mouse, "1") && devnode)
{
dev_type = UDEV_INPUT_MOUSE;
cb = udev_handle_mouse;
}
else if (val_touchpad && string_is_equal_fast(val_touchpad, "1", 1) && devnode)
else if (val_touchpad && string_is_equal(val_touchpad, "1") && devnode)
{
dev_type = UDEV_INPUT_TOUCHPAD;
cb = udev_handle_mouse;
@ -634,13 +634,13 @@ static void udev_input_handle_hotplug(udev_input_t *udev)
else
goto end;
if (string_is_equal_fast(action, "add", 3))
if (string_is_equal(action, "add"))
{
RARCH_LOG("[udev]: Hotplug add %s: %s.\n",
g_dev_type_str[dev_type], devnode);
udev_input_add_device(udev, dev_type, devnode, cb);
}
else if (string_is_equal_fast(action, "remove", 6))
else if (string_is_equal(action, "remove"))
{
RARCH_LOG("[udev]: Hotplug remove %s: %s.\n",
g_dev_type_str[dev_type], devnode);

View File

@ -0,0 +1,219 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2018 - Michael Lelli
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include <retro_miscellaneous.h>
#include <emscripten/html5.h>
#include "../input_driver.h"
#include "../../tasks/tasks_internal.h"
#include "../../verbosity.h"
#define CLAMPDOUBLE(x) MIN(1.0, MAX(-1.0, (x)))
static bool g_rwebpad_initialized;
static EM_BOOL rwebpad_gamepad_cb(int event_type,
const EmscriptenGamepadEvent *gamepad_event, void *user_data)
{
unsigned vid = 0;
unsigned pid = 0;
(void)event_type;
(void)gamepad_event;
(void)user_data;
if (strncmp(gamepad_event->mapping, "standard",
sizeof(gamepad_event->mapping)) == 0)
{
/* give a dummy vid/pid for automapping */
vid = 1;
pid = 1;
}
if (event_type == EMSCRIPTEN_EVENT_GAMEPADCONNECTED)
{
if(!input_autoconfigure_connect(
gamepad_event->id, /* name */
NULL, /* display name */
rwebpad_joypad.ident, /* driver */
gamepad_event->index, /* idx */
vid, /* vid */
pid)) /* pid */
input_config_set_device_name(gamepad_event->index,
gamepad_event->id);
}
else if (event_type == EMSCRIPTEN_EVENT_GAMEPADDISCONNECTED)
{
input_autoconfigure_disconnect(gamepad_event->index,
rwebpad_joypad.ident);
}
return EM_TRUE;
}
static bool rwebpad_joypad_init(void *data)
{
int supported = emscripten_get_num_gamepads();
(void)data;
if (supported == EMSCRIPTEN_RESULT_NOT_SUPPORTED)
return false;
if (!g_rwebpad_initialized)
{
EMSCRIPTEN_RESULT r;
g_rwebpad_initialized = true;
/* callbacks needs to be registered for gamepads to connect */
r = emscripten_set_gamepadconnected_callback(NULL, false,
rwebpad_gamepad_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/PAD] failed to create connect callback: %d\n", r);
}
r = emscripten_set_gamepaddisconnected_callback(NULL, false,
rwebpad_gamepad_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
RARCH_ERR(
"[EMSCRIPTEN/PAD] failed to create disconnect callback: %d\n", r);
}
}
return true;
}
static const char *rwebpad_joypad_name(unsigned pad)
{
static EmscriptenGamepadEvent gamepad_state;
EMSCRIPTEN_RESULT r;
r = emscripten_get_gamepad_status(pad, &gamepad_state);
if (r == EMSCRIPTEN_RESULT_SUCCESS)
return gamepad_state.id;
else
return "";
}
static bool rwebpad_joypad_button(unsigned port_num, uint16_t joykey)
{
EmscriptenGamepadEvent gamepad_state;
EMSCRIPTEN_RESULT r;
r = emscripten_get_gamepad_status(port_num, &gamepad_state);
if (r == EMSCRIPTEN_RESULT_SUCCESS)
if (joykey < gamepad_state.numButtons)
return gamepad_state.digitalButton[joykey];
return false;
}
static void rwebpad_joypad_get_buttons(unsigned port_num, retro_bits_t *state)
{
EmscriptenGamepadEvent gamepad_state;
EMSCRIPTEN_RESULT r;
r = emscripten_get_gamepad_status(port_num, &gamepad_state);
if (r == EMSCRIPTEN_RESULT_SUCCESS)
{
int i;
for (i = 0; i < gamepad_state.numButtons; i++)
{
if (gamepad_state.digitalButton[i])
BIT256_SET_PTR(state, i);
}
}
else
BIT256_CLEAR_ALL_PTR(state);
}
static int16_t rwebpad_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
EmscriptenGamepadEvent gamepad_state;
EMSCRIPTEN_RESULT r;
int16_t val = 0;
if (joyaxis == 0xFFFFFFFF)
return 0;
r = emscripten_get_gamepad_status(port_num, &gamepad_state);
if (r == EMSCRIPTEN_RESULT_SUCCESS)
{
if (AXIS_NEG_GET(joyaxis) < gamepad_state.numAxes)
{
val = CLAMPDOUBLE(gamepad_state.axis[AXIS_NEG_GET(joyaxis)]) * 0x7FFF;
if (val > 0)
val = 0;
}
else if (AXIS_POS_GET(joyaxis) < gamepad_state.numAxes)
{
val = CLAMPDOUBLE(gamepad_state.axis[AXIS_POS_GET(joyaxis)]) * 0x7FFF;
if (val < 0)
val = 0;
}
}
return val;
}
static void rwebpad_joypad_poll(void)
{
/* this call makes emscripten poll gamepad state */
(void)emscripten_get_num_gamepads();
}
static bool rwebpad_joypad_query_pad(unsigned pad)
{
EmscriptenGamepadEvent gamepad_state;
EMSCRIPTEN_RESULT r;
r = emscripten_get_gamepad_status(pad, &gamepad_state);
if (r == EMSCRIPTEN_RESULT_SUCCESS)
return gamepad_state.connected == EM_TRUE;
return false;
}
static void rwebpad_joypad_destroy(void)
{
}
input_device_driver_t rwebpad_joypad = {
rwebpad_joypad_init,
rwebpad_joypad_query_pad,
rwebpad_joypad_destroy,
rwebpad_joypad_button,
rwebpad_joypad_get_buttons,
rwebpad_joypad_axis,
rwebpad_joypad_poll,
NULL,
rwebpad_joypad_name,
"rwebpad",
};

View File

@ -449,14 +449,14 @@ static void udev_joypad_poll(void)
const char *action = udev_device_get_action(dev);
const char *devnode = udev_device_get_devnode(dev);
if (val && string_is_equal_fast(val, "1", 1) && devnode)
if (val && string_is_equal(val, "1") && devnode)
{
if (string_is_equal_fast(action, "add", 3))
if (string_is_equal(action, "add"))
{
RARCH_LOG("[udev]: Hotplug add: %s.\n", devnode);
udev_check_device(dev, devnode);
}
else if (string_is_equal_fast(action, "remove", 6))
else if (string_is_equal(action, "remove"))
{
RARCH_LOG("[udev]: Hotplug remove: %s.\n", devnode);
udev_joypad_remove_device(devnode);

View File

@ -23,9 +23,6 @@ static uint64_t pad_state[MAX_PADS];
static int16_t analog_state[MAX_PADS][2][2];
#ifdef _XBOX1
static HANDLE gamepads[MAX_PADS];
static DWORD dwDeviceMask;
static bool bInserted[MAX_PADS];
static bool bRemoved[MAX_PADS];
#endif
static const char* const XBOX_CONTROLLER_NAMES[4] =
@ -38,7 +35,7 @@ static const char* const XBOX_CONTROLLER_NAMES[4] =
static const char *xdk_joypad_name(unsigned pad)
{
return input_config_get_device_name(pad);
return XBOX_CONTROLLER_NAMES[pad];
}
static void xdk_joypad_autodetect_add(unsigned autoconf_pad)
@ -131,15 +128,12 @@ static int16_t xdk_joypad_axis(unsigned port_num, uint32_t joyaxis)
return val;
}
static void xdk_joypad_poll(void)
{
unsigned port;
#ifdef _XBOX1
unsigned int dwInsertions, dwRemovals;
#endif
#if defined(_XBOX1)
DWORD dwInsertions, dwRemovals;
#ifdef __cplusplus
XGetDeviceChanges(XDEVICE_TYPE_GAMEPAD,
reinterpret_cast<PDWORD>(&dwInsertions),
@ -153,22 +147,26 @@ static void xdk_joypad_poll(void)
for (port = 0; port < MAX_PADS; port++)
{
unsigned i, j;
unsigned i, j;
XINPUT_STATE state_tmp;
uint64_t *state_cur = NULL;
#ifdef _XBOX1
XINPUT_CAPABILITIES caps[MAX_PADS];
(void)caps;
#if defined(_XBOX1)
bool device_removed = false;
bool device_inserted = false;
/* handle inserted devices. */
/* handle removed devices. */
bRemoved[port] = (dwRemovals & (1 << port)) ? true : false;
if (dwRemovals & (1 << port))
device_removed = true;
if (dwInsertions & (1 << port))
device_inserted = true;
if(bRemoved[port])
if (device_removed)
{
/* if the controller was removed after
* XGetDeviceChanges but before
* XInputOpen, the device handle will be NULL. */
if(gamepads[port])
if (gamepads[port])
XInputClose(gamepads[port]);
gamepads[port] = 0;
@ -177,18 +175,18 @@ static void xdk_joypad_poll(void)
input_autoconfigure_disconnect(port, xdk_joypad.ident);
}
/* handle inserted devices. */
bInserted[port] = (dwInsertions & (1 << port)) ? true : false;
if(bInserted[port])
if (device_inserted)
{
XINPUT_POLLING_PARAMETERS m_pollingParameters;
m_pollingParameters.fAutoPoll = FALSE;
m_pollingParameters.fInterruptOut = TRUE;
m_pollingParameters.bInputInterval = 8;
m_pollingParameters.fAutoPoll = FALSE;
m_pollingParameters.fInterruptOut = TRUE;
m_pollingParameters.bInputInterval = 8;
m_pollingParameters.bOutputInterval = 8;
gamepads[port] = XInputOpen(XDEVICE_TYPE_GAMEPAD, port,
XDEVICE_NO_SLOT, NULL);
gamepads[port] = XInputOpen(
XDEVICE_TYPE_GAMEPAD, port,
XDEVICE_NO_SLOT, &m_pollingParameters);
xdk_joypad_autodetect_add(port);
}
@ -199,9 +197,6 @@ static void xdk_joypad_poll(void)
/* if the controller is removed after
* XGetDeviceChanges but before XInputOpen,
* the device handle will be NULL. */
#endif
#if defined(_XBOX1)
if (XInputPoll(gamepads[port]) != ERROR_SUCCESS)
continue;
@ -263,6 +258,21 @@ static bool xdk_joypad_query_pad(unsigned pad)
static void xdk_joypad_destroy(void)
{
unsigned i;
for (i = 0; i < MAX_PADS; i++)
{
pad_state[i] = 0;
analog_state[i][0][0] = 0;
analog_state[i][0][1] = 0;
analog_state[i][1][0] = 0;
analog_state[i][1][1] = 0;
#if defined(_XBOX1)
if (gamepads[i])
XInputClose(gamepads[i]);
gamepads[i] = 0;
#endif
}
}
input_device_driver_t xdk_joypad = {

View File

@ -37,7 +37,8 @@
#define DECL_AXIS(axis, bind) "input_" #axis "_axis = " #bind "\n"
#define DECL_AXIS_EX(axis, bind, name) "input_" #axis "_axis = " #bind "\ninput_" #axis "_axis_label = \"" name "\"\n"
#define DECL_MENU(btn) "input_menu_toggle_btn = " #btn "\n"
#define DECL_AUTOCONF_DEVICE(device, driver, binds) "input_device = \"" device "\" \ninput_driver = \"" driver "\" \n" binds
#define DECL_AUTOCONF_DEVICE(device, driver, binds) "input_device = \"" device "\"\ninput_driver = \"" driver "\"\n" binds
#define DECL_AUTOCONF_PID(pid, vid, driver, binds) "input_product_id = " #pid "\ninput_vendor_id = " #vid "\ninput_driver = \"" driver "\"\n" binds
/* TODO/FIXME - Missing L2/R2 */
@ -528,10 +529,39 @@ DECL_AXIS(r_x_minus, -2) \
DECL_AXIS(r_y_plus, +3) \
DECL_AXIS(r_y_minus, -3)
#define EMSCRIPTEN_DEFAULT_BINDS \
DECL_BTN(a, 1) \
DECL_BTN(b, 0) \
DECL_BTN(x, 3) \
DECL_BTN(y, 2) \
DECL_BTN(start, 9) \
DECL_BTN(select, 8) \
DECL_BTN(up, 12) \
DECL_BTN(down, 13) \
DECL_BTN(left, 14) \
DECL_BTN(right, 15) \
DECL_BTN(l, 4) \
DECL_BTN(r, 5) \
DECL_BTN(l2, 6) \
DECL_BTN(r2, 7) \
DECL_BTN(l3, 10) \
DECL_BTN(r3, 11) \
DECL_AXIS(l_x_plus, +0) \
DECL_AXIS(l_x_minus, -0) \
DECL_AXIS(l_y_plus, +1) \
DECL_AXIS(l_y_minus, -1) \
DECL_AXIS(r_x_plus, +2) \
DECL_AXIS(r_x_minus, -2) \
DECL_AXIS(r_y_plus, +3) \
DECL_AXIS(r_y_minus, -3)
const char* const input_builtin_autoconfs[] =
{
#if defined(_WIN32) && defined(_XBOX)
DECL_AUTOCONF_DEVICE("XInput Controller", "xdk", XINPUT_DEFAULT_BINDS),
DECL_AUTOCONF_DEVICE("XInput Controller (User 1)", "xdk", XINPUT_DEFAULT_BINDS),
DECL_AUTOCONF_DEVICE("XInput Controller (User 2)", "xdk", XINPUT_DEFAULT_BINDS),
DECL_AUTOCONF_DEVICE("XInput Controller (User 3)", "xdk", XINPUT_DEFAULT_BINDS),
DECL_AUTOCONF_DEVICE("XInput Controller (User 4)", "xdk", XINPUT_DEFAULT_BINDS),
#elif defined(_WIN32)
#if !defined(__STDC_C89__) && !defined(__STDC_C89_AMENDMENT_1__)
DECL_AUTOCONF_DEVICE("XInput Controller (User 1)", "xinput", XINPUT_DEFAULT_BINDS),
@ -588,6 +618,9 @@ const char* const input_builtin_autoconfs[] =
#endif
#ifdef __SWITCH__
DECL_AUTOCONF_DEVICE("Switch Controller", "switch", SWITCH_DEFAULT_BINDS),
#endif
#ifdef EMSCRIPTEN
DECL_AUTOCONF_PID(1, 1, "rwebpad", EMSCRIPTEN_DEFAULT_BINDS),
#endif
NULL
};

View File

@ -181,6 +181,9 @@ static input_device_driver_t *joypad_drivers[] = {
* to be selectable in the UI. */
#if defined(HAVE_HID) && !defined(WIIU)
&hid_joypad,
#endif
#ifdef EMSCRIPTEN
&rwebpad_joypad,
#endif
&null_joypad,
NULL,
@ -804,7 +807,7 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2)
static INLINE bool input_keys_pressed_iterate(unsigned i,
retro_bits_t* p_new_state)
{
if ((i >= RARCH_FIRST_META_KEY) &&
if ((i >= RARCH_FIRST_META_KEY) &&
BIT64_GET(lifecycle_state, i)
)
return true;
@ -2336,13 +2339,13 @@ static void parse_hat(struct retro_keybind *bind, const char *str)
return;
}
if (string_is_equal_fast(dir, "up", 2))
if (string_is_equal(dir, "up"))
hat_dir = HAT_UP_MASK;
else if (string_is_equal_fast(dir, "down", 4))
else if (string_is_equal(dir, "down"))
hat_dir = HAT_DOWN_MASK;
else if (string_is_equal_fast(dir, "left", 4))
else if (string_is_equal(dir, "left"))
hat_dir = HAT_LEFT_MASK;
else if (string_is_equal_fast(dir, "right", 5))
else if (string_is_equal(dir, "right"))
hat_dir = HAT_RIGHT_MASK;
if (hat_dir)

View File

@ -814,6 +814,7 @@ extern input_device_driver_t qnx_joypad;
extern input_device_driver_t null_joypad;
extern input_device_driver_t mfi_joypad;
extern input_device_driver_t dos_joypad;
extern input_device_driver_t rwebpad_joypad;
extern input_driver_t input_android;
extern input_driver_t input_sdl;

View File

@ -579,109 +579,8 @@ const struct rarch_key_map rarch_key_map_dinput[] = {
#endif
#ifdef EMSCRIPTEN
const struct rarch_key_map rarch_key_map_rwebinput[] = {
{ 37, RETROK_LEFT },
{ 39, RETROK_RIGHT },
{ 38, RETROK_UP },
{ 40, RETROK_DOWN },
{ 13, RETROK_RETURN },
{ 9, RETROK_TAB },
{ 45, RETROK_INSERT },
{ 46, RETROK_DELETE },
{ 16, RETROK_RSHIFT },
{ 16, RETROK_LSHIFT },
{ 17, RETROK_LCTRL },
{ 35, RETROK_END },
{ 36, RETROK_HOME },
{ 34, RETROK_PAGEDOWN },
{ 33, RETROK_PAGEUP },
{ 18, RETROK_LALT },
{ 32, RETROK_SPACE },
{ 27, RETROK_ESCAPE },
{ 8, RETROK_BACKSPACE },
{ 13, RETROK_KP_ENTER },
{ 107, RETROK_KP_PLUS },
{ 109, RETROK_KP_MINUS },
{ 106, RETROK_KP_MULTIPLY },
{ 111, RETROK_KP_DIVIDE },
{ 192, RETROK_BACKQUOTE },
{ 19, RETROK_PAUSE },
{ 96, RETROK_KP0 },
{ 97, RETROK_KP1 },
{ 98, RETROK_KP2 },
{ 99, RETROK_KP3 },
{ 100, RETROK_KP4 },
{ 101, RETROK_KP5 },
{ 102, RETROK_KP6 },
{ 103, RETROK_KP7 },
{ 104, RETROK_KP8 },
{ 105, RETROK_KP9 },
{ 48, RETROK_0 },
{ 49, RETROK_1 },
{ 50, RETROK_2 },
{ 51, RETROK_3 },
{ 52, RETROK_4 },
{ 53, RETROK_5 },
{ 54, RETROK_6 },
{ 55, RETROK_7 },
{ 56, RETROK_8 },
{ 57, RETROK_9 },
{ 112, RETROK_F1 },
{ 113, RETROK_F2 },
{ 114, RETROK_F3 },
{ 115, RETROK_F4 },
{ 116, RETROK_F5 },
{ 117, RETROK_F6 },
{ 118, RETROK_F7 },
{ 119, RETROK_F8 },
{ 120, RETROK_F9 },
{ 121, RETROK_F10 },
{ 122, RETROK_F11 },
{ 123, RETROK_F12 },
{ 65, RETROK_a },
{ 66, RETROK_b },
{ 67, RETROK_c },
{ 68, RETROK_d },
{ 69, RETROK_e },
{ 70, RETROK_f },
{ 71, RETROK_g },
{ 72, RETROK_h },
{ 73, RETROK_i },
{ 74, RETROK_j },
{ 75, RETROK_k },
{ 76, RETROK_l },
{ 77, RETROK_m },
{ 78, RETROK_n },
{ 79, RETROK_o },
{ 80, RETROK_p },
{ 81, RETROK_q },
{ 82, RETROK_r },
{ 83, RETROK_s },
{ 84, RETROK_t },
{ 85, RETROK_u },
{ 86, RETROK_v },
{ 87, RETROK_w },
{ 88, RETROK_x },
{ 89, RETROK_y },
{ 90, RETROK_z },
{ 222, RETROK_QUOTE },
{ 188, RETROK_COMMA },
{ 173, RETROK_MINUS },
{ 191, RETROK_SLASH },
{ 59, RETROK_SEMICOLON },
{ 61, RETROK_EQUALS },
{ 219, RETROK_LEFTBRACKET },
{ 220, RETROK_BACKSLASH },
{ 221, RETROK_RIGHTBRACKET },
{ 188, RETROK_KP_PERIOD },
{ 17, RETROK_RCTRL },
{ 18, RETROK_RALT },
{ 190, RETROK_PERIOD },
{ 145, RETROK_SCROLLOCK },
{ 20, RETROK_CAPSLOCK },
{ 144, RETROK_NUMLOCK },
{ 0, RETROK_UNKNOWN },
};
/* this is generated at runtime, so it isn't constant */
struct rarch_key_map rarch_key_map_rwebinput[RARCH_KEY_MAP_RWEBINPUT_SIZE];
#endif
#ifdef WIIU

View File

@ -46,13 +46,18 @@ struct apple_key_name_map_entry
extern const struct apple_key_name_map_entry apple_key_name_map[];
#endif
#define RARCH_KEY_MAP_RWEBINPUT_SIZE 111
extern const struct input_key_map input_config_key_map[];
extern const struct rarch_key_map rarch_key_map_x11[];
extern const struct rarch_key_map rarch_key_map_sdl[];
extern const struct rarch_key_map rarch_key_map_sdl2[];
extern const struct rarch_key_map rarch_key_map_dinput[];
extern const struct rarch_key_map rarch_key_map_rwebinput[];
/* is generated at runtime so can't be const */
extern struct rarch_key_map rarch_key_map_rwebinput[RARCH_KEY_MAP_RWEBINPUT_SIZE];
extern const struct rarch_key_map rarch_key_map_linux[];
extern const struct rarch_key_map rarch_key_map_apple_hid[];
extern const struct rarch_key_map rarch_key_map_android[];
@ -96,4 +101,3 @@ extern enum retro_key rarch_keysym_lut[RETROK_LAST];
RETRO_END_DECLS
#endif

View File

@ -757,7 +757,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"当前视频驱动.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL视频驱动. \n"
@ -771,7 +771,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
"dependent on your graphics card's \n"
"underlying GL driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL 2 视频驱动.\n"
@ -783,7 +783,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
"core implementations is dependent \n"
"on your platform SDL implementation.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL 视频驱动.\n"
@ -794,7 +794,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance is considered to be suboptimal. \n"
"Consider using it only as a last resort.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D 视频驱动. \n"
@ -803,7 +803,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
"is dependent on your graphic card's \n"
"underlying D3D driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D 视频驱动. \n"
@ -815,7 +815,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance for software rendered cores \n"
"should be optimal.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Plain DRM 视频驱动. \n"
@ -824,7 +824,7 @@ int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
"libdrm for hardware scaling using \n"
"GPU overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D 视频驱动. \n"

View File

@ -754,7 +754,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"當前視訊驅動.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL視訊驅動. \n"
@ -768,7 +768,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
"dependent on your graphics card's \n"
"underlying GL driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL 2 視訊驅動.\n"
@ -780,7 +780,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
"core implementations is dependent \n"
"on your platform SDL implementation.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL 視訊驅動.\n"
@ -791,7 +791,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance is considered to be suboptimal. \n"
"Consider using it only as a last resort.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D 視訊驅動. \n"
@ -800,7 +800,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
"is dependent on your graphic card's \n"
"underlying D3D driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D 視訊驅動. \n"
@ -812,7 +812,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance for software rendered cores \n"
"should be optimal.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Plain DRM 視訊驅動. \n"
@ -821,7 +821,7 @@ int menu_hash_get_help_cht_enum(enum msg_hash_enums msg, char *s, size_t len)
"libdrm for hardware scaling using \n"
"GPU overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D 視訊驅動. \n"

View File

@ -787,7 +787,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Aktueller Grafiktreiber");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL-Grafiktreiber. \n"
@ -800,7 +800,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
"als auch bei Libretro-GL-Cores, hängt von dem \n"
"GL-Treiber deiner Grafikkarte ab.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL2-Grafiktreiber.\n"
@ -811,7 +811,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
"Die Leistung hängt von der SDL- \n"
"Implementierung deiner Plattform ab.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL-Grafiktreiber.\n"
@ -823,7 +823,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
"solltest diesen Treiber nur als letzte \n"
"Möglichkeit verwenden.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D-Grafiktreiber. \n"
@ -832,7 +832,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
"Cores hängt von dem D3D-Treiber deiner \n"
"Grafikkarte ab.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D-Grafiktreiber. \n"
@ -844,7 +844,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
"Die Leistung bei software-gerendeten Cores sollte \n"
"optimal sein.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"DRM-Grafiktreiber \n"
@ -853,7 +853,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len)
"Er verwendet libdrm für Hardware-Skalierung und \n"
"GPU-Overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D-Grafiktreiber\n"
@ -2078,7 +2078,7 @@ const char *msg_hash_to_str_de(enum msg_hash_enums msg)
#ifdef HAVE_MENU
const char *ret = menu_hash_to_str_de_label_enum(msg);
if (ret && (string_is_not_equal_fast(ret, "null", 4)))
if (ret && (string_is_not_equal(ret, "null")))
return ret;
#endif

View File

@ -63,7 +63,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"Bienvenido a RetroArch\n"
"\n"
"Para más información ve al menú \n"
"de Ayuda.\n"
"de Ayuda.\n"
);
break;
case MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC:
@ -73,30 +73,29 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
const char * t =
"RetroArch utiliza un formato único para \n"
"sincronizar vídeo y sonido que necesita \n"
"calibrarse con la frecuencia de \n"
"actualización de tu monitor para obtener \n"
"el mejor rendimiento. \n"
"sincronizar el audio y el video. Necesita \n"
"calibrarse con la tasa de refresco del monitor \n"
"para obtener los mejores resultados. \n"
" \n"
"Si notas cortes de sonido o en la imagen,\n"
"Si notas cortes en el audio o la imagen,\n"
"lo normal es que necesites calibrar estos\n"
"ajustes. Aquí van algunas opciones:\n"
"ajustes. Intenta con algunas de la siguientes opciones:\n"
" \n";
snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */
"a) Ve a '%s' -> '%s' y activa\n"
"'Vídeo por hilos'. En este modo la tasa\n"
"de refresco es irrelevante, habrá más fps,\n"
"'Vídeo multinúcleo'. En este modo la \n"
"frecuencia es irrelevante, habrá más fps,\n"
"pero la imagen podría ser menos fluida.\n"
"b) Ve a '%s' -> '%s' y busca\n"
"'%s'. Deja que se ejecute durante\n"
"2048 fotogramas y selecciona Aceptar.",
"a) Ve a '%s' -> '%s' -> '%s'\n"
"Deja que se ejecute durante\n"
"2048 frames y pulsa Aceptar.\n"
" \n"
"b) Ve a '%s' -> '%s' y activa '%s'.\n"
"En este modo la tasa de refresco es irrelevante.\n"
"Aumentarán los FPS (si es que no estaban al máximo),\n"
"a costa de aumentar latencia y podría hacer la imagen menos fluida.",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_THREADED)
);
strlcpy(s, t, len);
strlcat(s, u, len);
@ -105,23 +104,20 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
case MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC:
snprintf(s, len,
"Para escanear contenidos ve a '%s' \n"
"y selecciona '%s' o \n"
"'%s'.\n"
"y selecciona '%s' o '%s'.\n"
" \n"
"Esto comparará los archivos con las entradas en \n"
"la base de datos. Si hay una coincidencia, \n"
"añadirá una entrada en una colección.\n"
" \n"
"Entonces podrás acceder fácilmente al contenido\n"
"si vas a '%s' ->\n"
"'%s'\n"
"si vas a '%s' -> '%s'\n"
"en vez de tener que pasar por el navegador \n"
"de archivos constantemente.\n"
" \n"
"NOTA: El contenido de algunos núcleos podría\n"
"no ser localizable. Entre los ejemplos están\n"
"PlayStation, MAME, FBA, y puede que otros."
,
"PlayStation, MAME, FBA, y puede que otros.",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_CONTENT_LIST),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SCAN_FILE),
@ -147,24 +143,22 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
strlcpy(t,
"Controlador de entrada udev. \n"
" \n"
"Este controlador puede funcionar sin X. \n"
" \n"
"Utiliza la API más reciente para joypads \n"
"evdec para dar compatibilidad con joysticks. \n"
"Permite conexión en caliente y force \n"
"feedback (si lo admite el dispositivo). \n",
"Utiliza la API evdev más reciente \n"
"para dar compatibilidad con mandos. \n"
"Permite hotplug (conexión en caliente) \n"
"y force feedback (fuerza de respuesta). \n",
sizeof(t));
strlcpy(u,
" \n"
"El controlador lee los eventos evdev para \n"
"dar compatibilidad con teclados. También \n"
"es compatible con retrollamadas de teclado, \n"
"es compatible con callbacks de teclado, \n"
"ratones y pantallas táctiles. \n"
" \n"
"La mayoría de las distros tienen los nodos \n"
"/dev/input en modo root-only (modo 600). \n"
"/dev/input en modo solo root (modo 600). \n"
"Puedes configurar una regla udev que los haga \n"
"accesibles fuera de la raíz.", sizeof(u)
"accesibles a otros usuarios.", sizeof(u)
);
strlcpy(s, t, len);
@ -181,8 +175,8 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"flexible como udev. \n"
"No es compatible con ratones, etc. \n"
" \n"
"Este controlador utiliza la antigua API de \n"
"joysticks (/dev/input/js*).");
"Este controlador utiliza la antigua API de mandos \n"
"(/dev/input/js*).");
break;
default:
snprintf(s, len,
@ -204,14 +198,18 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
" \n"
"Para controlar el lugar donde el menú \n"
"empieza a buscar contenidos, cambia \n"
"la opción 'Carpeta del navegador de \n"
"archivos'. En caso de que no esté \n"
"la opción '%s' en '%s' -> '%s'\n"
"En caso de que no esté \n"
"configurada, empezará desde la raíz.\n"
" \n"
"El navegador filtrará las extensiones \n"
"del último núcleo seleccionado en \n"
"'Cargar núcleo' y lo utilizará al \n"
"cargar un contenido."
"'%s' y lo utilizará al \n"
"cargar un contenido.",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_LIST)
);
break;
case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY:
@ -234,46 +232,44 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Controlador de vídeo actual.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"Controlador de vídeo OpenGL. \n"
"Controlador de vídeo OpenGL \n"
" \n"
"Este controlador permite que los núcleos \n"
"libretro GL se utilicen, además de las \n"
"Este controlador permite utilizar \n"
"los núcleos OpenGL, además de las \n"
"implementaciones renderizadas por\n"
"software del núcleo.\n"
" \n"
"El rendimiento de las implementaciones \n"
"por software y libretro GL dependen \n"
"del controlador GL que tenga tu \n"
"por software y libretro OpenGL dependen \n"
"del controlador OpenGL de la \n"
"tarjeta gráfica.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"Controlador de vídeo SDL 2.\n"
"Controlador de vídeo SDL 2 \n"
" \n"
"Este es un controlador de vídeo por \n"
"software SDL 2.\n"
"Este es un controlador de vídeo por software \n"
" \n"
"El rendimiento para las implementaciones \n"
"libretro por software depende de la \n"
"implementación SDL de tu plataforma.");
"implementación SDL de la plataforma.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"Controlador de vídeo SDL.\n"
"Controlador de vídeo SDL 1.2 \n"
" \n"
"Este es un controlador de vídeo por \n"
"software SDL 1.2.\n"
"Este es un controlador de vídeo por software \n"
" \n"
"Su rendimiento es considerado inferior \n"
"a lo óptimo. Utilízalo únicamente como \n"
"último recurso.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Controlador de vídeo Direct3D. \n"
@ -283,7 +279,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"del controlador D3D de tu tarjeta \n"
"gráfica.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Controlador de vídeo Exynos-G2D. \n"
@ -297,31 +293,29 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"renderizados por software debería \n"
"ser óptimo.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Controlador de vídeo de DRM simple. \n"
" \n"
"Este es un controlador de vídeo que \n"
"usa libdrm para escalado por hardware \n"
"mediante los overlays de la GPU. \n"
" \n"
"El blitting se hace por software.");
"mediante los overlays de la GPU. \n");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Controlador de vídeo Sunxi-G2D. \n"
" \n"
"Este es un controlador de vídeo Sunxi \n"
"de bajo nivel. Utiliza el bloque G2D \n"
"de todos los SoC Allwinner.");
"de los SoC Allwinner.");
}
break;
case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN:
snprintf(s, len,
"Plugin de sonido DSP.\n"
"Procesa el sonido antes de enviarlo \n"
"Plugin de audio DSP.\n"
"Procesa el audio antes de enviarlo \n"
"al controlador."
);
break;
@ -333,7 +327,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
{
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_SINC:
snprintf(s, len,
"Implementación SINC en ventana.");
"Implementación windowed SINC.");
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER_CC:
snprintf(s, len,
@ -343,9 +337,9 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET:
snprintf(s, len,
"Cargar preajustes de shaders. \n"
"Cargar presets de shaders. \n"
" \n"
" Carga directamente un preajuste "
" Carga directamente un preset "
#ifdef HAVE_CG
"Cg"
#endif
@ -382,8 +376,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
" \n"
"Si el último pase tiene un factor de \n"
"escala, el resultado se estirará por \n"
"toda la pantalla con el filtro espe- \n"
"cificado en 'Filtro predeterminado'. \n"
"toda la pantalla con el filtro especificado.\n"
" \n"
"Si has seleccionado 'No importa', se \n"
"utilizará o bien la escala 1x o se \n"
@ -396,29 +389,29 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"Pases de shaders. \n"
" \n"
"RetroArch permite mezclar diversos shaders \n"
"con pasadas arbitrarias, filtros persona- \n"
"lizados de hardware y factores de escala. \n"
"con pasadas arbitrarias, filtros personales \n"
"de hardware y factores de escala. \n"
" \n"
"Esta opción especifica la cantidad de pasadas \n"
"de shaders a utilizar. Si seleccionas 0 y \n"
"luego 'Aplicar cambios en shaders', \n"
"utilizarás un shader 'en blanco'. \n"
" \n"
"La opción filtro predeterminado afectará \n"
"al filtro de estiramiento.");
"La opción filtro cambiará \n"
"el algoritmo de escalado.");
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS:
snprintf(s, len,
"Parámetros de shaders. \n"
" \n"
"Modifica directamente el shader actual. \n"
"No se guardará en el preajuste CGP/GLSLP.");
"No se guardará en el preset CGP/GLSLP.");
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS:
snprintf(s, len,
"Parámetros del preajuste de shaders. \n"
"Parámetros del preset de shaders. \n"
" \n"
"Modifica el preajuste de shaders que \n"
"Modifica el preset de shaders que \n"
"se encuentra actualmente en el menú."
);
break;
@ -464,7 +457,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"Filtro de hardware para esta pasada. \n"
" \n"
"Si se ha seleccionado 'No importa', \n"
"se utilizará el filtro predeterminado."
"se utilizará el predeterminado."
);
break;
case MENU_ENUM_LABEL_AUTOSAVE_INTERVAL:
@ -477,7 +470,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"lo contrario. El intervalo se mide \n"
"en segundos. \n"
" \n"
"Si utlizas 0, desactivarás el \n"
"Si utilizas 0, desactivarás el \n"
"guardado automático.");
break;
case MENU_ENUM_LABEL_INPUT_BIND_DEVICE_TYPE:
@ -576,9 +569,9 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
break;
case MENU_ENUM_LABEL_AUDIO_DEVICE:
snprintf(s, len,
"Anula el dispositivo de sonido \n"
"Anula el dispositivo de audio \n"
"predeterminado que utiliza el \n"
"controlador de sonido.\n"
"controlador de audio.\n"
"Esta opción depende del contro- \n"
"lador. Por ejemplo:\n"
#ifdef HAVE_ALSA
@ -616,7 +609,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"Activa otras teclas rápidas.\n"
" \n"
"Si esta tecla rápida está asignada a un \n"
"teclado, un botón o un eje de un joystick, \n"
"teclado, un botón o un eje de un mando, \n"
"el resto de teclas rápidas se desactivarán \n"
"a menos que esta tecla se mantenga pulsada \n"
"al mismo tiempo. \n"
@ -652,7 +645,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
" \n"
"La frecuencia de actualización precisa del \n"
"monitor (en Hz). Se utiliza para calcular \n"
"la frecuencia de entrada de sonido con esta \n"
"la frecuencia de entrada de audio con esta \n"
"fórmula: \n"
" \n"
"audio_input_rate = veloc. de entrada de juego \n"
@ -740,7 +733,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
break;
case MENU_ENUM_LABEL_AUDIO_VOLUME:
snprintf(s, len,
"Volumen de sonido expresado en dB.\n"
"Volumen de audio expresado en dB.\n"
" \n"
"0 dB es el volumen normal, sin ganancia \n"
"aplicada. La ganancia se puede controlar \n"
@ -749,12 +742,12 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
break;
case MENU_ENUM_LABEL_AUDIO_RATE_CONTROL_DELTA:
snprintf(s, len,
"Control de la frecuencia de sonido.\n"
"Control de la frecuencia de audio.\n"
" \n"
"Si seleccionas 0, desactivarás el control \n"
"de la frecuencia. Cualquier otro valor \n"
"cambiará el delta de control de la \n"
"frecuencia de sonido.\n"
"frecuencia de audio.\n"
" \n"
"Define cuánta frecuencia de entrada puede \n"
"ajustarse de forma dinámica.\n"
@ -766,14 +759,14 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW:
snprintf(s, len,
"Variación máxima en la sincronía de \n"
"sonido.\n"
"audio.\n"
" \n"
"Define la variación máxima de la \n"
"frecuencia de entrada. Podrías aumentar \n"
"el valor para cambiar la sincronía, por \n"
"ejemplo, si ejecutas núcleos PAL en \n"
"monitores NTSC, a cambio de tener un \n"
"tono de sonido impreciso.\n"
"tono de audio impreciso.\n"
" \n"
" La frecuencia de entrada se define como: \n"
" frecuencia de entrada * (1.0 +/- \n"
@ -792,11 +785,11 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
break;
case MENU_ENUM_LABEL_VOLUME_UP:
snprintf(s, len,
"Aumenta el volumen del sonido.");
"Aumenta el volumen del audio.");
break;
case MENU_ENUM_LABEL_VOLUME_DOWN:
snprintf(s, len,
"Disminuye el volumen del sonido.");
"Disminuye el volumen del audio.");
break;
case MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION:
snprintf(s, len,
@ -1061,7 +1054,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
break;
case MENU_ENUM_LABEL_AUDIO_MUTE:
snprintf(s, len,
"Silencia o no el sonido.");
"Silencia o no el audio.");
break;
case MENU_ENUM_LABEL_REWIND:
snprintf(s, len,
@ -1152,7 +1145,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
case MENU_ENUM_LABEL_R_Y_PLUS:
case MENU_ENUM_LABEL_R_Y_MINUS:
snprintf(s, len,
"El eje de un joystick analógico \n"
"El eje de un mando analógico \n"
"(estilo DualShock).\n"
" \n"
"Se asigna como siempre, sin embargo, si se \n"
@ -1167,10 +1160,8 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
"RetroArch, por si solo, no hace nada. \n"
" \n"
"Para que haga algo necesitas cargar \n"
"un programa en él. \n"
"\n"
"Llamamos a estos programas 'núcleos \n"
"libretro', o 'núcleos' para abreviar. \n"
"programas que llamamos 'núcleos' o \n"
"'cores' en inglés. \n"
" \n"
"Para cargar un núcleo, selecciona uno \n"
"en 'Cargar núcleo'. \n"
@ -1186,7 +1177,7 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH)
#else
"Puedes conseguir núcleos si los\n"
"trasladas a mano a la carpeta\n"
"copias a mano a la carpeta\n"
"'%s'.",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LIBRETRO_DIR_PATH)
#endif
@ -1196,18 +1187,19 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Puedes cambiar la superposición del \n"
"mando virtual si vas a '%s' \n"
"-> '%s'."
"-> '%s'-> '%s'."
" \n"
"Desde ahí puedes cambiar la superposición, \n"
"el tamaño y opacidad de sus botones, etc.\n"
" \n"
"NOTA: Las superposiciones de mandos \n"
"virtuales están ocultas de forma \n"
"predeterminada si estás dentro del menú. \n"
"predeterminada dentro del menú. \n"
"Si quieres cambiar este comportamiento, \n"
"cambia '%s' a Desactivado/false.",
"cambia '%s' a Desactivado/off.",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU)
);
break;

View File

@ -844,7 +844,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU,
"Todos los usuarios Controlan el menú"
"Todos controlan el menú"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X,
@ -948,7 +948,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL,
"Menú: cambiar botones de OK y Cancelar"
"Menú: cambiar OK y Cancelar"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL,
@ -1112,7 +1112,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO,
"Combo de botones para mostrar el menú"
"Combinación para mostrar el menú"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_META_CHEAT_INDEX_MINUS,
@ -1264,7 +1264,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_SHOW_PHYSICAL_INPUTS_PORT,
"Puerto de escucha para mostrar entradas"
"Puerto de escucha para entradas"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_POLL_TYPE_BEHAVIOR,
@ -1848,7 +1848,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PAUSE_NONACTIVE,
"Detenerse al quedar en segundo plano"
"Pausar al quedar en segundo plano"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PERFCNT_ENABLE,
@ -2016,7 +2016,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORD_CONFIG,
"Cargando configuración de grabación.."
"Cargar configuración de grabación..."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORD_DRIVER,
@ -2028,7 +2028,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORD_PATH,
"Guardar grabación como.."
"Guardar grabación en..."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RECORD_USE_OUTPUT_DIRECTORY,
@ -2188,7 +2188,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SAVING_SETTINGS,
"Guardando"
"Guardado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SCAN_DIRECTORY,
@ -2592,7 +2592,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER,
"Controlador de contexto de vídeo"
"Controlador de contexto de video"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VULKAN_SUPPORT,
@ -2796,11 +2796,11 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_DRIVER,
"Controlador de vídeo"
"Controlador de video"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FILTER,
"Filtro de vídeo"
"Filtro de video"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FILTER_DIR,
@ -2840,7 +2840,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA,
"Gamma de vídeo"
"Gamma de video"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD,
@ -2928,11 +2928,11 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_CORE,
"Guardar preset del núcleo"
"Guardar preset para el núcleo"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_SAVE_GAME,
"Guardar preset del juego"
"Guardar preset para el juego"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SHARED_CONTEXT,
@ -2956,7 +2956,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_THREADED,
"Vídeo por hilos"
"Video por hilos"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_VFILTER,
@ -3018,6 +3018,18 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_ALPHA_FACTOR,
"Transparencia del menú"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_RED,
"Fuente del Menú componente roja"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_GREEN,
"Fuente del Menú componente verde"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_FONT_COLOR_BLUE,
"Fuente del Menú componente azul"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_FONT,
"Fuente del menú"
@ -3034,6 +3046,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME,
"Monochrome"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED,
"Monochrome Invertido"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC,
"Systematic"
@ -3064,47 +3080,51 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN,
"Apple Green"
"Verde manzana"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK,
"Dark"
"Oscuro"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LIGHT,
"Claro"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE,
"Dark Purple"
"Violeta"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE,
"Electric Blue"
"Azul Eléctrico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_GOLDEN,
"Golden"
"Dorado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LEGACY_RED,
"Legacy Red"
"Rojo"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_MIDNIGHT_BLUE,
"Midnight Blue"
"Azul Medianoche"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_PLAIN,
"Plain"
"Nada"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_UNDERSEA,
"Undersea"
"Bajo el mar"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_VOLCANIC_RED,
"Volcanic Red"
"Rojo Volcánico"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE,
"Menu Shader Pipeline"
"Menú Shader Pipeline"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_SCALE_FACTOR,
@ -3248,7 +3268,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_BLUETOOTH_ENABLE,
"Activar o desactivar bluetooth"
"Activar o desactivar Bluetooth"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT,
@ -3268,11 +3288,11 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_FPS_SHOW,
"Mostrar FPS (Cuadros por segundo)"
"Muestra la velocidad de cuadros por segundo"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BINDS,
"Opciones de hotkeys"
"Opciones de teclas rápidas (hotkeys)"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO,
@ -3324,7 +3344,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_SUSPEND_SCREENSAVER_ENABLE,
"Previene que el salvapantallas se active"
"Evita que el protector de pantalla se active"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOW_SCALE,
@ -3340,7 +3360,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY,
"Reducir latencia a costa de un mayor riesgo de stuttering. Agrega un retraso después del VSync (en ms)"
"Reducir latencia a costa de un mayor riesgo de stuttering. Agrega un retraso después del VSync en milisegundos"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES,
@ -3356,7 +3376,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_AUTO,
"El estimado preciso de refresco de la pantalla en Hz"
"Estimado preciso de refresco de la pantalla en Hz"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SETTINGS,
@ -4192,7 +4212,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_VOLUME,
"Volumen de audio (en dB). 0 dB es normal, sin ganancia"
"0 dB es normal, donde no se aplica ganancia"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_WASAPI_EXCLUSIVE_MODE,
@ -4207,93 +4227,93 @@ MSG_HASH(
"El tamaño del buffer intermedio (en frames) al usar WASAPI en modo compartido"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_SYNC,
"Sincronizar audio. Recomendado"
)
MENU_ENUM_SUBLABEL_AUDIO_SYNC,
"Sincronizar audio. Recomendado"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD,
"Cuanto debe mover un eje, para convertirse en una pulsación de botón"
)
MENU_ENUM_SUBLABEL_INPUT_AXIS_THRESHOLD,
"Cuanto debe mover la palanca para ser detectada. Evita movimientos indeseados en los mandos que no vuelven perfectamente al centro"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT,
"Cantidad de segundos a esperar hasta la siguiente asignación"
)
MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT,
"Cantidad de segundos a esperar hasta la siguiente asignación"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD,
"Periodo entre pulsación de los botones turbo (en frames)"
)
MENU_ENUM_SUBLABEL_INPUT_TURBO_PERIOD,
"Periodo entre pulsación de los botones turbo (en frames)"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE,
"Cuanto debe durar la pulsación de los botones turbo (en frames)"
)
MENU_ENUM_SUBLABEL_INPUT_DUTY_CYCLE,
"Cuanto debe durar la pulsación de los botones turbo (en frames)"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_VSYNC,
"Sincroniza la salida de la placa de video al refresco de la pantalla. Recomendado"
)
MENU_ENUM_SUBLABEL_VIDEO_VSYNC,
"Sincroniza la salida de la placa de video al refresco de la pantalla. Recomendado"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE,
"Permitir a los núcleos rotar la pantalla. Desactivarlo es útil cuando se puede girar el dispositivo manualmente"
)
MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE,
"Permitir a los núcleos rotar la pantalla. Desactivarlo es útil cuando se puede girar el dispositivo manualmente"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN,
"Activarlo previene que algunos núcleos con función de apagado cierren RetroArch, en lugar de eso se cargará un núcleo vacío"
)
MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN,
"Activarlo previene que algunos núcleos con función de apagado cierren RetroArch, en lugar de eso se cargará un núcleo vacío"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE,
"Verificar que el firmware necesario este disponible antes de cargar el contenido"
)
MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE,
"Verificar que el firmware necesario este disponible antes de cargar el contenido"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE,
"Tasa de refresco vertical de su pantalla. Usada para calcular la velocidad de audio. Nota: Se ignorará si 'Video por hilos' esta activado"
)
MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE,
"Tasa de refresco vertical de su pantalla. Usada para calcular la velocidad de audio. Nota: Se ignorará si 'Video por hilos' esta activado"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_ENABLE,
"Activar salida de audio"
)
MENU_ENUM_SUBLABEL_AUDIO_ENABLE,
"Activar salida de audio"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW,
"El máximo cambio en la velocidad de audio. Incrementarlo permite grandes cambios de timing a costa del tono de audio (Ej. Núcleos PAL en pantallas NTSC)"
)
MENU_ENUM_SUBLABEL_AUDIO_MAX_TIMING_SKEW,
"El máximo cambio en la velocidad de audio. Incrementarlo permite grandes cambios de timing a costa del tono de audio (Ej. Núcleos PAL en pantallas NTSC)"
)
MSG_HASH(
MSG_FAILED,
"Fallo"
)
MSG_FAILED,
"Fallo"
)
MSG_HASH(
MSG_SUCCEEDED,
"Éxito"
)
MSG_SUCCEEDED,
"Éxito"
)
MSG_HASH(
MSG_DEVICE_NOT_CONFIGURED,
"no configurado"
)
MSG_DEVICE_NOT_CONFIGURED,
"no configurado"
)
MSG_HASH(
MSG_DEVICE_NOT_CONFIGURED_FALLBACK,
"no configurado, usando respaldo"
)
MSG_DEVICE_NOT_CONFIGURED_FALLBACK,
"no configurado, usando respaldo"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST,
"Base de datos: Lista cursor"
)
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST,
"Base de datos: Lista cursor"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DEVELOPER,
"Base de datos - Filtro : Desarrollador"
)
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_DEVELOPER,
"Base de datos - Filtro : Desarrollador"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PUBLISHER,
"Base de datos - Filtro : Distribuidora"
)
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_PUBLISHER,
"Base de datos - Filtro : Distribuidora"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_DISABLED,
"Desactivado"
)
MENU_ENUM_LABEL_VALUE_DISABLED,
"Desactivado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_ENABLED,
"Activado"
)
MENU_ENUM_LABEL_VALUE_ENABLED,
"Activado"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_PATH,
"Ruta del historial"
)
MENU_ENUM_LABEL_VALUE_CONTENT_HISTORY_PATH,
"Ruta del historial"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_DATABASE_CURSOR_LIST_ENTRY_ORIGIN,
"Base de datos - Filtro : Origen"
@ -4464,7 +4484,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_SMOOTH,
"Añado un pequeño desenfoque a la imagen para borrar los bordes de los pixeles. Esta opción tiene muy poco impacto en el rendimiento"
"Aplicar un pequeño desenfoque a la imagen para borrar los bordes de los pixeles. Esta opción tiene muy poco impacto en el rendimiento"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_FILTER,
@ -4484,7 +4504,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_POST_FILTER_RECORD,
"Capturar la imagen con los filtros (no shaders). Su video se verá como en su pantalla"
"Capturar la imagen con los filtros (no shaders)"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_CORE_LIST,
@ -4568,7 +4588,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN,
"Iniciar en pantalla completa. Puede ser anulado por un argumento en la linea de comandos"
"Puede ser anulado por un argumento en la linea de comandos"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN,
@ -4636,7 +4656,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL,
"Intercambiar botones de OK/Cancelar. Desactivado es el estilo Japones, Activado el estilo occidental"
"Intercambiar los botones de OK y Cancelar. Desactivado es el estilo Japones, Activado el estilo occidental"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO,
@ -5300,11 +5320,11 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_MIXER_VOLUME,
"Volumen global (en dB).0 dB es normal, donde no se aplica ganancia"
"Volumen global. 0 dB es normal, donde no se aplica ganancia"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_VOLUME,
"Volumen del mezclador de audio (en dB)"
"Volumen del mezclador de audio (dB)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_MUTE,
@ -5320,7 +5340,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER,
"Muestra u oculta la opción de 'Actualizador en línea'"
"Mostrar/ocultar la opción de 'Actualizador en línea'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS,
@ -5328,7 +5348,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_VIEWS_SETTINGS,
"Muestra u oculta elementos del menú"
"Mostrar/ocultar elementos del menú"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_CORE_UPDATER,
@ -5336,7 +5356,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER,
"Muestra u oculta la habilidad de actualizar núcleos y archivos asociados"
"Mostrar/ocultar la habilidad de actualizar núcleos y archivos asociados"
)
MSG_HASH(
MSG_PREPARING_FOR_CONTENT_SCAN,
@ -5448,7 +5468,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE,
"Mostrar u ocultar la opción de 'Cargar núcleo'"
"Mostrar/ocultar la opción de 'Cargar núcleo'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CONTENT,
@ -5456,7 +5476,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT,
"Mostrar u ocultar la opción de 'Cargar contenido'"
"Mostrar/ocultar la opción de 'Cargar contenido'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_INFORMATION,
@ -5464,7 +5484,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_INFORMATION,
"Mostrar u ocultar la opción de 'Información'"
"Mostrar/ocultar la opción de 'Información'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_CONFIGURATIONS,
@ -5472,7 +5492,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_CONFIGURATIONS,
"Mostrar u ocultar la opción de 'Configuraciones'"
"Mostrar/ocultar la opción de 'Configuraciones'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_HELP,
@ -5480,7 +5500,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_HELP,
"Mostrar u ocultar la opción de 'Ayuda'"
"Mostrar/ocultar la opción de 'Ayuda'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_QUIT_RETROARCH,
@ -5488,7 +5508,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_QUIT_RETROARCH,
"Mostrar u ocultar la opción de 'Salir de RetroArch'"
"Mostrar/ocultar la opción de 'Salir de RetroArch'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_SHOW_REBOOT,
@ -5496,7 +5516,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_SHOW_REBOOT,
"Mostrar u ocultar la opción de 'Reiniciar'"
"Mostrar/ocultar la opción de 'Reiniciar'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS,
@ -5504,7 +5524,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_VIEWS_SETTINGS,
"Mostrar u ocultar elementos del menú rápido"
"Mostrar/ocultar elementos del menú rápido"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_TAKE_SCREENSHOT,
@ -5512,7 +5532,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_TAKE_SCREENSHOT,
"Mostrar u ocultar la opción de 'Captura de pantalla'"
"Mostrar/ocultar la opción de 'Captura de pantalla'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_LOAD_STATE,
@ -5520,7 +5540,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_LOAD_STATE,
"Mostrar u ocultar la opción de 'Guardado rápido'"
"Mostrar/ocultar la opción de 'Guardado rápido'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE,
@ -5528,7 +5548,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_UNDO_SAVE_LOAD_STATE,
"Mostrar u ocultar la opción para deshacer la carga y guardado rápido"
"Mostrar/ocultar la opción para deshacer la carga y guardado rápido"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_ADD_TO_FAVORITES,
@ -5536,7 +5556,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_ADD_TO_FAVORITES,
"Mostrar u ocultar la opción de 'Agregar a favoritos'"
"Mostrar/ocultar la opción de 'Agregar a favoritos'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_OPTIONS,
@ -5544,7 +5564,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_OPTIONS,
"Mostrar u ocultar la opción de 'Opciones'"
"Mostrar/ocultar la opción de 'Opciones'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CONTROLS,
@ -5552,7 +5572,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CONTROLS,
"Mostrar u ocultar la opción de 'Controles'"
"Mostrar/ocultar la opción de 'Controles'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_CHEATS,
@ -5560,7 +5580,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_CHEATS,
"Mostrar u ocultar la opción de 'Trucos'"
"Mostrar/ocultar la opción de 'Trucos'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SHADERS,
@ -5568,7 +5588,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SHADERS,
"Mostrar u ocultar la opción de 'Shaders'"
"Mostrar/ocultar la opción de 'Shaders'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES,
@ -5576,7 +5596,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_CORE_OVERRIDES,
"Mostrar u ocultar la opción de 'Guardar anulaciones de núcleo'"
"Mostrar/ocultar la opción de 'Guardar anulaciones de núcleo'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES,
@ -5584,7 +5604,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_SAVE_GAME_OVERRIDES,
"Mostrar u ocultar la opción de 'Guardar anulaciones de juego'"
"Mostrar/ocultar la opción de 'Guardar anulaciones de juego'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_QUICK_MENU_SHOW_INFORMATION,
@ -5592,7 +5612,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_QUICK_MENU_SHOW_INFORMATION,
"Mostrar u ocultar la opción de 'Información'"
"Mostrar/ocultar la opción de 'Información'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_ENABLE,
@ -5664,7 +5684,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW,
"Mostrar contador de frames junto a los FPS"
"Contador de frames junto a FPS"
)
MSG_HASH(
MSG_CONFIG_OVERRIDE_LOADED,
@ -5694,3 +5714,11 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_OPACITY,
"Opacidad de la ventana"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_AUDIO_RESAMPLER_QUALITY,
"Calidad del muestreo de audio"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_AUDIO_RESAMPLER_QUALITY,
"Valores mas bajos favorecen el rendimiento y bajan la latencia a costa de la calidad, incrementar el valor aumentará la calidad a costa del rendimiento y latencia"
)

View File

@ -209,7 +209,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Driver video attuale.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"Diver video OpenGL. \n"
@ -223,7 +223,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len)
"dalla tua scheda grafica \n"
"sottostante driver GL).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"Driver video SDL 2.\n"
@ -235,7 +235,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len)
"renderizzati via software dipende \n"
"dall'implementazzione sulla tua piattaforma SDL.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"Driver video SDL.\n"
@ -246,7 +246,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len)
"Le performance sono considerate quasi ottimali. \n"
"Considera di usare questo soltanto come ultima scelta.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Driver video Direct3D. \n"
@ -255,7 +255,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len)
"software dipende dal driver D3D inerente \n"
"alla tua scheda video).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D Video Driver. \n"
@ -267,7 +267,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len)
"Le performance per i core renderizzati via software \n"
"dovrebbero essere ottimali.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Driver video Sunxi-G2D. \n"

View File

@ -781,7 +781,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Current Video driver.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL Video driver. \n"
@ -795,7 +795,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
"dependent on your graphics card's \n"
"underlying GL driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL 2 Video driver.\n"
@ -807,7 +807,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
"core implementations is dependent \n"
"on your platform SDL implementation.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL Video driver.\n"
@ -818,7 +818,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance is considered to be suboptimal. \n"
"Consider using it only as a last resort.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D Video driver. \n"
@ -827,7 +827,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
"is dependent on your graphic card's \n"
"underlying D3D driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D Video Driver. \n"
@ -839,7 +839,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance for software rendered cores \n"
"should be optimal.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Plain DRM Video Driver. \n"
@ -848,7 +848,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len)
"libdrm for hardware scaling using \n"
"GPU overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D Video Driver. \n"

View File

@ -17,7 +17,7 @@ MSG_HASH(
)
MSG_HASH(
MSG_UNKNOWN_NETPLAY_COMMAND_RECEIVED,
"Unknown netplay command received"
"不正なネットプレイコマンドが受信されました。"
)
MSG_HASH(
MSG_FILE_ALREADY_EXISTS_SAVING_TO_BACKUP_BUFFER,
@ -45,7 +45,7 @@ MSG_HASH(
)
MSG_HASH(
MSG_SETTING_DISK_IN_TRAY,
"Setting disk in tray"
"ディスクがトレイに入りました。"
)
MSG_HASH(
MSG_WAITING_FOR_CLIENT,
@ -1620,7 +1620,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_AUTOCONFIG_PROFILES,
MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CG_SHADERS,
"Cgシェーダーをアップデート")
MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CHEATS,
"チーをアップデート")
"チーをアップデート")
MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_CORE_INFO_FILES,
"コアの情報ファイルをアップデート")
MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_DATABASES,
@ -1807,6 +1807,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN,
"りんご緑")
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK,
"ダーク")
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_LIGHT,
"ライト")
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK_PURPLE,
"ぶどう色")
MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_ELECTRIC_BLUE,
@ -1951,10 +1953,12 @@ MSG_HASH(MENU_ENUM_SUBLABEL_WIFI_SETTINGS,
"無線ネットワークを検索して接続する。")
MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST,
"RetroArchの使い方について学ぶ。")
MSG_HASH(MENU_ENUM_SUBLABEL_CHEAT_APPLY_CHANGES,
"チートの変更点が今すぐに適用する。")
MSG_HASH(MSG_ADDED_TO_FAVORITES,
"お気に入りに追加しました")
MSG_HASH(MSG_APPENDED_DISK,
"Appended disk")
"ディスクを追加しました。")
MSG_HASH(MSG_APPLICATION_DIR,
"アプリフォルダ")
MSG_HASH(MSG_APPLYING_CHEAT,
@ -2948,7 +2952,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DISK_INDEX,
MSG_HASH(MENU_ENUM_SUBLABEL_DISK_OPTIONS,
"ディスクのイメージ管理")
MSG_HASH(MENU_ENUM_SUBLABEL_DISK_IMAGE_APPEND,
"挿入するディスクイメージを選択する。")
"ディスクイメージを追加する。")
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_ENUM_THROTTLE_FRAMERATE,
"Makes sure the framerate is capped while inside the menu.")
MSG_HASH(MENU_ENUM_SUBLABEL_XMB_THEME,

View File

@ -770,7 +770,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
snprintf(s, len,
"Current Video driver.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL Video driver. \n"
@ -784,7 +784,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
"dependent on your graphics card's \n"
"underlying GL driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL 2 Video driver.\n"
@ -796,7 +796,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
"core implementations is dependent \n"
"on your platform SDL implementation.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL Video driver.\n"
@ -807,7 +807,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
"Performance is considered to be suboptimal. \n"
"Consider using it only as a last resort.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D Video driver. \n"
@ -816,7 +816,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
"is dependent on your graphic card's \n"
"underlying D3D driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D Video Driver. \n"
@ -827,7 +827,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
" \n"
"Performance for software rendered cores \n"
"should be optimal.");
} else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
} else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Plain DRM Video Driver. \n"
@ -836,7 +836,7 @@ int menu_hash_get_help_ko_enum(enum msg_hash_enums msg, char *s, size_t len) {
"libdrm for hardware scaling using \n"
"GPU overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D Video Driver. \n"
@ -1999,7 +1999,7 @@ const char *msg_hash_to_str_ko(enum msg_hash_enums msg) {
#ifdef HAVE_MENU
const char *ret = menu_hash_to_str_ko_label_enum(msg);
if (ret && (string_is_not_equal_fast(ret, "null", 4)))
if (ret && (string_is_not_equal(ret, "null")))
return ret;
#endif

View File

@ -823,7 +823,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Driver de vídeo atual.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"Driver de vídeo OpenGL. \n"
@ -836,7 +836,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"Libretro GL ou renderizados por software \n"
"é dependente do driver GL de sua placa de vídeo.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"Driver de vídeo SDL 2.\n"
@ -848,7 +848,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"libretro renderizados por software é dependente \n"
"da implementação SDL da sua plataforma.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"Driver de vídeo SDL. \n"
@ -859,7 +859,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"O desempenho é considerado medíocre. \n"
"Cosidere utilizar apenas como último recurso.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Driver de vídeo Direct3D. \n"
@ -868,7 +868,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"software depende do driver D3D de base da\n"
"sua placa de vídeo).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Driver de vídeo Exynos-G2D. \n"
@ -880,7 +880,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"O desempenho de núcleos renderizados por \n"
"por hardware deve ser ótimo.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Driver de vídeo Plain DRM. \n"
@ -889,7 +889,7 @@ int menu_hash_get_help_pt_br_enum(enum msg_hash_enums msg, char *s, size_t len)
"usando libdrm para escala por hardware \n"
"utilizando overlay de GPU.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Driver de vídeo Sunxi-G2D. \n"

View File

@ -108,7 +108,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Driver de Vídeo em uso.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"Driver de Vídeo OpenGL. \n"
@ -122,7 +122,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
"depende do driver GL instalado em sua \n"
"placa de vídeo.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"Driver de Vídeo SDL 2.\n"
@ -134,7 +134,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
"renderização por software depende da \n"
"implementação SDL de sua plataforma.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"Driver de Vídeo SDL.\n"
@ -145,7 +145,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
"O desemprenho é considerado subótimo. \n"
"Considere seu uso apenas em último caso.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Driver de Vídeo Direct3D. \n"
@ -154,7 +154,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
"renderização por software depende do driver \n"
"D3D instalado em sua placa de vídeo.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Driver de Vídeo Exynos-G2D. \n"
@ -166,7 +166,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len)
"O desempenho para cores de renderização por \n"
"software deve ser ótimo.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Driver de Vídeo Sunxi-G2D. \n"

View File

@ -793,7 +793,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Current Video driver.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL Video driver. \n"
@ -807,7 +807,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
"dependent on your graphics card's \n"
"underlying GL driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL 2 Video driver.\n"
@ -819,7 +819,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
"core implementations is dependent \n"
"on your platform SDL implementation.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL Video driver.\n"
@ -830,7 +830,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance is considered to be suboptimal. \n"
"Consider using it only as a last resort.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D Video driver. \n"
@ -839,7 +839,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
"is dependent on your graphic card's \n"
"underlying D3D driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D Video Driver. \n"
@ -851,7 +851,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance for software rendered cores \n"
"should be optimal.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Plain DRM Video Driver. \n"
@ -860,7 +860,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
"libdrm for hardware scaling using \n"
"GPU overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D Video Driver. \n"

View File

@ -781,7 +781,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
snprintf(s, len,
"Current Video driver.");
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2))
if (string_is_equal(settings->arrays.video_driver, "gl"))
{
snprintf(s, len,
"OpenGL Video driver. \n"
@ -795,7 +795,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
"dependent on your graphics card's \n"
"underlying GL driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl2", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl2"))
{
snprintf(s, len,
"SDL 2 Video driver.\n"
@ -807,7 +807,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
"core implementations is dependent \n"
"on your platform SDL implementation.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sdl1", 4))
else if (string_is_equal(settings->arrays.video_driver, "sdl1"))
{
snprintf(s, len,
"SDL Video driver.\n"
@ -818,7 +818,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance is considered to be suboptimal. \n"
"Consider using it only as a last resort.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "d3d", 3))
else if (string_is_equal(settings->arrays.video_driver, "d3d"))
{
snprintf(s, len,
"Direct3D Video driver. \n"
@ -827,7 +827,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
"is dependent on your graphic card's \n"
"underlying D3D driver).");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "exynos", 6))
else if (string_is_equal(settings->arrays.video_driver, "exynos"))
{
snprintf(s, len,
"Exynos-G2D Video Driver. \n"
@ -839,7 +839,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
"Performance for software rendered cores \n"
"should be optimal.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "drm", 3))
else if (string_is_equal(settings->arrays.video_driver, "drm"))
{
snprintf(s, len,
"Plain DRM Video Driver. \n"
@ -848,7 +848,7 @@ int menu_hash_get_help_vn_enum(enum msg_hash_enums msg, char *s, size_t len)
"libdrm for hardware scaling using \n"
"GPU overlays.");
}
else if (string_is_equal_fast(settings->arrays.video_driver, "sunxi", 5))
else if (string_is_equal(settings->arrays.video_driver, "sunxi"))
{
snprintf(s, len,
"Sunxi-G2D Video Driver. \n"

View File

@ -241,9 +241,6 @@ static int sevenzip_file_read(
{
size_t output_size = 0;
/*RARCH_LOG_OUTPUT("Opened archive %s. Now trying to extract %s\n",
path, needle);*/
/* C LZMA SDK does not support chunked extraction - see here:
* sourceforge.net/p/sevenzip/discussion/45798/thread/6fb59aaf/
* */
@ -263,8 +260,6 @@ static int sevenzip_file_read(
if (!filestream_write_file(optional_outfile, ptr, outsize))
{
/*RARCH_ERR("Could not open outfilepath %s.\n",
optional_outfile);*/
res = SZ_OK;
file_found = true;
outsize = -1;

View File

@ -186,10 +186,6 @@ static int zip_file_decompressed(
if (name[strlen(name) - 1] == '/' || name[strlen(name) - 1] == '\\')
return 1;
#if 0
RARCH_LOG("[deflate] Path: %s, CRC32: 0x%x\n", name, crc32);
#endif
if (strstr(name, userdata->decomp_state.needle))
{
bool goto_error = false;
@ -207,9 +203,6 @@ static int zip_file_decompressed(
if (buf)
{
/*RARCH_LOG("%s: %s\n",
msg_hash_to_str(MSG_EXTRACTING_FILE),
userdata->decomp_state.opt_file);*/
memcpy(buf, handle.data, size);
if (!filestream_write_file(userdata->decomp_state.opt_file, buf, size))

View File

@ -720,13 +720,13 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in)
if (entry)
{
if (string_is_equal_fast(entry->value, "true", 4))
if (string_is_equal(entry->value, "true"))
*in = true;
else if (string_is_equal_fast(entry->value, "1", 1))
else if (string_is_equal(entry->value, "1"))
*in = true;
else if (string_is_equal_fast(entry->value, "false", 5))
else if (string_is_equal(entry->value, "false"))
*in = false;
else if (string_is_equal_fast(entry->value, "0", 1))
else if (string_is_equal(entry->value, "0"))
*in = false;
else
return false;

View File

@ -30,7 +30,12 @@
#include <boolean.h>
#include <file/file_path.h>
#include <retro_assert.h>
#include <string/stdstring.h>
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifndef __MACH__
#include <compat/strl.h>
#include <compat/posix_string.h>
@ -912,3 +917,237 @@ void fill_short_pathname_representation_noext(char* out_rep,
fill_short_pathname_representation(out_rep, in_path, size);
path_remove_extension(out_rep);
}
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size)
{
#if !defined(RARCH_CONSOLE)
if (*in_path == '~')
{
const char *home = getenv("HOME");
if (home)
{
size_t src_size = strlcpy(out_path, home, size);
retro_assert(src_size < size);
out_path += src_size;
size -= src_size;
in_path++;
}
}
else if ((in_path[0] == ':') &&
(
(in_path[1] == '/')
#ifdef _WIN32
|| (in_path[1] == '\\')
#endif
)
)
{
size_t src_size;
char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
application_dir[0] = '\0';
fill_pathname_application_path(application_dir,
PATH_MAX_LENGTH * sizeof(char));
path_basedir_wrapper(application_dir);
src_size = strlcpy(out_path, application_dir, size);
retro_assert(src_size < size);
free(application_dir);
out_path += src_size;
size -= src_size;
in_path += 2;
}
#endif
retro_assert(strlcpy(out_path, in_path, size) < size);
}
void fill_pathname_abbreviate_special(char *out_path,
const char *in_path, size_t size)
{
#if !defined(RARCH_CONSOLE)
unsigned i;
const char *candidates[3];
const char *notations[3];
char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
const char *home = getenv("HOME");
application_dir[0] = '\0';
/* application_dir could be zero-string. Safeguard against this.
*
* Keep application dir in front of home, moving app dir to a
* new location inside home would break otherwise. */
/* ugly hack - use application_dir pointer
* before filling it in. C89 reasons */
candidates[0] = application_dir;
candidates[1] = home;
candidates[2] = NULL;
notations [0] = ":";
notations [1] = "~";
notations [2] = NULL;
fill_pathname_application_path(application_dir,
PATH_MAX_LENGTH * sizeof(char));
path_basedir_wrapper(application_dir);
for (i = 0; candidates[i]; i++)
{
if (!string_is_empty(candidates[i]) &&
strstr(in_path, candidates[i]) == in_path)
{
size_t src_size = strlcpy(out_path, notations[i], size);
retro_assert(src_size < size);
out_path += src_size;
size -= src_size;
in_path += strlen(candidates[i]);
if (!path_char_is_slash(*in_path))
{
retro_assert(strlcpy(out_path,
path_default_slash(), size) < size);
out_path++;
size--;
}
break; /* Don't allow more abbrevs to take place. */
}
}
free(application_dir);
#endif
retro_assert(strlcpy(out_path, in_path, size) < size);
}
/**
* path_basedir:
* @path : path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
**/
void path_basedir_wrapper(char *path)
{
char *last = NULL;
if (strlen(path) < 2)
return;
#ifdef HAVE_COMPRESSION
/* We want to find the directory with the archive in basedir. */
last = (char*)path_get_archive_delim(path);
if (last)
*last = '\0';
#endif
last = find_last_slash(path);
if (last)
last[1] = '\0';
else
snprintf(path, 3, ".%s", path_default_slash());
}
#if !defined(RARCH_CONSOLE)
void fill_pathname_application_path(char *s, size_t len)
{
size_t i;
#ifdef __APPLE__
CFBundleRef bundle = CFBundleGetMainBundle();
#endif
#ifdef _WIN32
DWORD ret;
wchar_t wstr[PATH_MAX_LENGTH] = {0};
#endif
#ifdef __HAIKU__
image_info info;
int32_t cookie = 0;
#endif
(void)i;
if (!len)
return;
#ifdef _WIN32
#ifdef LEGACY_WIN32
ret = GetModuleFileNameA(GetModuleHandle(NULL), s, len);
#else
ret = GetModuleFileNameW(GetModuleHandle(NULL), wstr, ARRAY_SIZE(wstr));
if (*wstr)
{
char *str = utf16_to_utf8_string_alloc(wstr);
if (str)
{
strlcpy(s, str, len);
free(str);
}
}
#endif
s[ret] = '\0';
#elif defined(__APPLE__)
if (bundle)
{
CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);
CFStringRef bundle_path = CFURLCopyPath(bundle_url);
CFStringGetCString(bundle_path, s, len, kCFStringEncodingUTF8);
CFRelease(bundle_path);
CFRelease(bundle_url);
retro_assert(strlcat(s, "nobin", len) < len);
return;
}
#elif defined(__HAIKU__)
while (get_next_image_info(0, &cookie, &info) == B_OK)
{
if (info.type == B_APP_IMAGE)
{
strlcpy(s, info.name, len);
return;
}
}
#elif defined(__QNX__)
char *buff = malloc(len);
if(_cmdname(buff))
strlcpy(s, buff, len);
free(buff);
#else
{
pid_t pid;
static const char *exts[] = { "exe", "file", "path/a.out" };
char link_path[255];
link_path[0] = *s = '\0';
pid = getpid();
/* Linux, BSD and Solaris paths. Not standardized. */
for (i = 0; i < ARRAY_SIZE(exts); i++)
{
ssize_t ret;
snprintf(link_path, sizeof(link_path), "/proc/%u/%s",
(unsigned)pid, exts[i]);
ret = readlink(link_path, s, len - 1);
if (ret >= 0)
{
s[ret] = '\0';
return;
}
}
}
#endif
}
#endif

View File

@ -152,7 +152,7 @@ static enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
for (i = 0; i < ARRAY_SIZE(chunk_map); i++)
{
if (string_is_equal_fast(chunk->type, chunk_map[i].id, 4))
if (string_is_equal(chunk->type, chunk_map[i].id))
return chunk_map[i].type;
}

View File

@ -411,10 +411,6 @@ static char *purge_xml_comments(const char *str)
rxml_document_t *rxml_load_document(const char *path)
{
#ifndef RXML_TEST
RARCH_WARN("Using RXML as drop in for libxml2. Behavior might be very buggy.\n");
#endif
char *memory_buffer = NULL;
char *new_memory_buffer = NULL;
const char *mem_ptr = NULL;

View File

@ -389,6 +389,15 @@ void fill_pathname_expand_special(char *out_path,
void fill_pathname_abbreviate_special(char *out_path,
const char *in_path, size_t size);
/**
* path_basedir:
* @path : path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
**/
void path_basedir_wrapper(char *path);
/**
* path_char_is_slash:
* @c : character

View File

@ -375,6 +375,10 @@ enum retro_key
RETROK_x = 120,
RETROK_y = 121,
RETROK_z = 122,
RETROK_LEFTBRACE = 123,
RETROK_BAR = 124,
RETROK_RIGHTBRACE = 125,
RETROK_TILDE = 126,
RETROK_DELETE = 127,
RETROK_KP0 = 256,

View File

@ -48,6 +48,11 @@ static INLINE bool string_is_equal(const char *a, const char *b)
return (*(const unsigned char*)a - *(const unsigned char*)b) == 0;
}
static INLINE bool string_is_not_equal(const char *a, const char *b)
{
return !string_is_equal(a, b);
}
#define string_is_not_equal_fast(a, b, size) (memcmp(a, b, size) != 0)
#define string_is_equal_fast(a, b, size) (memcmp(a, b, size) == 0)

View File

@ -381,7 +381,7 @@ struct http_t *net_http_new(struct http_connection_t *conn)
net_http_send_str(&conn->sock_state, &error, "\r\n");
}
if (conn->methodcopy && (string_is_equal_fast(conn->methodcopy, "POST", 4)))
if (conn->methodcopy && (string_is_equal(conn->methodcopy, "POST")))
{
size_t post_len, len;
char *len_str = NULL;
@ -418,7 +418,7 @@ struct http_t *net_http_new(struct http_connection_t *conn)
net_http_send_str(&conn->sock_state, &error, "Connection: close\r\n");
net_http_send_str(&conn->sock_state, &error, "\r\n");
if (conn->methodcopy && (string_is_equal_fast(conn->methodcopy, "POST", 4)))
if (conn->methodcopy && (string_is_equal(conn->methodcopy, "POST")))
net_http_send_str(&conn->sock_state, &error, conn->postdatacopy);
if (error)

View File

@ -0,0 +1,196 @@
/* Copyright (C) 2010-2017 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (gx_pthread.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _CTR_PTHREAD_WRAP_CTR_
#define _CTR_PTHREAD_WRAP_CTR_
#include <3ds/thread.h>
#include <3ds/synchronization.h>
#include <3ds/svc.h>
#include <time.h>
#include <errno.h>
#include <retro_inline.h>
#define STACKSIZE (4 * 1024)
typedef Thread pthread_t;
typedef LightLock pthread_mutex_t;
typedef void* pthread_mutexattr_t;
typedef int pthread_attr_t;
typedef LightEvent pthread_cond_t;
typedef int pthread_condattr_t;
/* libctru threads return void but pthreads return void pointer */
static bool mutex_inited = false;
static LightLock safe_double_thread_launch;
static void *(*start_routine_jump)(void*);
static void ctr_thread_launcher(void* data)
{
void *(*start_routine_jump_safe)(void*) = start_routine_jump;
LightLock_Unlock(&safe_double_thread_launch);
start_routine_jump_safe(data);
}
static INLINE int pthread_create(pthread_t *thread,
const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
{
s32 prio = 0;
Thread new_ctr_thread;
if (!mutex_inited)
{
LightLock_Init(&safe_double_thread_launch);
mutex_inited = true;
}
/*Must wait if attempting to launch 2 threads at once to prevent corruption of function pointer*/
while (LightLock_TryLock(&safe_double_thread_launch) != 0);
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
start_routine_jump = start_routine;
new_ctr_thread = threadCreate(ctr_thread_launcher, arg, STACKSIZE, prio - 1, -1/*No affinity, use any CPU*/, false);
if (!new_ctr_thread)
{
LightLock_Unlock(&safe_double_thread_launch);
return EAGAIN;
}
*thread = new_ctr_thread;
return 0;
}
static INLINE pthread_t pthread_self(void)
{
return threadGetCurrent();
}
static INLINE int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr)
{
LightLock_Init(mutex);
return 0;
}
static INLINE int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
/*Nothing to destroy*/
return 0;
}
static INLINE int pthread_mutex_lock(pthread_mutex_t *mutex)
{
return LightLock_TryLock(mutex);
}
static INLINE int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
LightLock_Unlock(mutex);
return 0;
}
static INLINE void pthread_exit(void *retval)
{
/*Yes the pointer to int cast is not ideal*/
/*threadExit((int)retval);*/
(void)retval;
}
static INLINE int pthread_detach(pthread_t thread)
{
/* FIXME: pthread_detach equivalent missing? */
(void)thread;
return 0;
}
static INLINE int pthread_join(pthread_t thread, void **retval)
{
/*retval is ignored*/
return threadJoin(thread, U64_MAX);
}
static INLINE int pthread_mutex_trylock(pthread_mutex_t *mutex)
{
return LightLock_TryLock(mutex);
}
static INLINE int pthread_cond_wait(pthread_cond_t *cond,
pthread_mutex_t *mutex)
{
LightEvent_Wait(cond);
return 0;
}
static INLINE int pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex, const struct timespec *abstime)
{
while (true)
{
struct timespec now = {0};
/* Missing clock_gettime*/
struct timeval tm;
gettimeofday(&tm, NULL);
now.tv_sec = tm.tv_sec;
now.tv_nsec = tm.tv_usec * 1000;
if (LightEvent_TryWait(cond) != 0 || now.tv_sec > abstime->tv_sec || (now.tv_sec == abstime->tv_sec && now.tv_nsec > abstime->tv_nsec))
break;
}
return 0;
}
static INLINE int pthread_cond_init(pthread_cond_t *cond,
const pthread_condattr_t *attr)
{
LightEvent_Init(cond, RESET_ONESHOT);
return 0;
}
static INLINE int pthread_cond_signal(pthread_cond_t *cond)
{
LightEvent_Signal(cond);
return 0;
}
static INLINE int pthread_cond_broadcast(pthread_cond_t *cond)
{
LightEvent_Signal(cond);
return 0;
}
static INLINE int pthread_cond_destroy(pthread_cond_t *cond)
{
/*nothing to destroy*/
return 0;
}
static INLINE int pthread_equal(pthread_t t1, pthread_t t2)
{
if (threadGetHandle(t1) == threadGetHandle(t2))
return 1;
return 0;
}
#endif

View File

@ -47,6 +47,8 @@
#endif
#elif defined(GEKKO)
#include "gx_pthread.h"
#elif defined(_3DS)
#include "ctr_pthread.h"
#elif defined(__CELLOS_LV2__)
#include <pthread.h>
#include <sys/sys_time.h>
@ -801,7 +803,7 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us)
sys_time_get_current_time(&s, &n);
now.tv_sec = s;
now.tv_nsec = n;
#elif defined(__mips__) || defined(VITA)
#elif defined(__mips__) || defined(VITA) || defined(_3DS)
struct timeval tm;
gettimeofday(&tm, NULL);

View File

@ -75,7 +75,7 @@ static void zlib_inflate_stream_free(void *data)
static bool zlib_deflate_define(void *data, const char *prop, uint32_t val)
{
struct zlib_trans_stream *z = (struct zlib_trans_stream *) data;
if (string_is_equal_fast(prop, "level", 5))
if (string_is_equal(prop, "level"))
{
if (z)
z->ex = (int) val;
@ -87,7 +87,7 @@ static bool zlib_deflate_define(void *data, const char *prop, uint32_t val)
static bool zlib_inflate_define(void *data, const char *prop, uint32_t val)
{
struct zlib_trans_stream *z = (struct zlib_trans_stream *) data;
if (string_is_equal_fast(prop, "window_bits", 11))
if (string_is_equal(prop, "window_bits"))
{
if (z)
z->ex = (int) val;

View File

@ -106,14 +106,18 @@ void find_location_driver(void)
location_driver = (const location_driver_t*)location_driver_find_handle(i);
else
{
unsigned d;
RARCH_ERR("Couldn't find any location driver named \"%s\"\n",
settings->arrays.location_driver);
RARCH_LOG_OUTPUT("Available location drivers are:\n");
for (d = 0; location_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", location_driver_find_ident(d));
RARCH_WARN("Going to default to first location driver...\n");
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any location driver named \"%s\"\n",
settings->arrays.location_driver);
RARCH_LOG_OUTPUT("Available location drivers are:\n");
for (d = 0; location_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", location_driver_find_ident(d));
RARCH_WARN("Going to default to first location driver...\n");
}
location_driver = (const location_driver_t*)location_driver_find_handle(0);

View File

@ -125,7 +125,7 @@ static char *lakka_get_project(void)
info.enum_idx = a; \
dl_type = b;
static unsigned action_ok_dl_to_enum(unsigned lbl)
static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
{
switch (lbl)
{
@ -209,7 +209,7 @@ static unsigned action_ok_dl_to_enum(unsigned lbl)
break;
}
return 0;
return MSG_UNKNOWN;
}
int generic_action_ok_displaylist_push(const char *path,
@ -1171,23 +1171,23 @@ static int generic_action_ok(const char *path,
break;
case ACTION_OK_SET_DIRECTORY:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST);
ret = set_path_generic(filebrowser_label, action_path);
ret = set_path_generic(filebrowser_label, action_path);
break;
case ACTION_OK_SET_PATH_VIDEO_FILTER:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST);
ret = set_path_generic(menu_label, action_path);
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_PATH_AUDIO_FILTER:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST);
ret = set_path_generic(menu_label, action_path);
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_PATH_OVERLAY:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST);
ret = set_path_generic(menu_label, action_path);
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_PATH:
flush_type = MENU_SETTINGS;
ret = set_path_generic(menu_label, action_path);
ret = set_path_generic(menu_label, action_path);
break;
default:
flush_char = msg_hash_to_str(flush_id);
@ -1209,13 +1209,16 @@ static int default_action_ok_load_content_with_core_from_menu(const char *_path,
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
if (!task_push_load_content_with_core_from_menu(_path, &content_info, (enum rarch_core_type)_type, NULL, NULL))
if (!task_push_load_content_with_core_from_menu(
_path, &content_info,
(enum rarch_core_type)_type, NULL, NULL))
return -1;
content_add_to_playlist(_path);
return 0;
}
static int default_action_ok_load_content_from_playlist_from_menu(const char *_path, const char *path, const char *entry_label)
static int default_action_ok_load_content_from_playlist_from_menu(const char *_path,
const char *path, const char *entry_label)
{
content_ctx_info_t content_info;
content_info.argc = 0;
@ -1401,7 +1404,8 @@ static int action_ok_playlist_entry_collection(const char *path,
playlist_get_index(playlist,
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
return default_action_ok_load_content_from_playlist_from_menu(new_core_path, path, entry_label);
return default_action_ok_load_content_from_playlist_from_menu(
new_core_path, path, entry_label);
}
static int action_ok_playlist_entry(const char *path,

View File

@ -28,26 +28,15 @@
cbs->action_get_title_ident = #name;
#endif
static void replace_chars(char *str, char c1, char c2)
{
char *pos = NULL;
while((pos = strchr(str, c1)))
*pos = c2;
}
static void sanitize_to_string(char *s, const char *label, size_t len)
{
char new_label[255];
char *pos = NULL;
new_label[0] = '\0';
strlcpy(s, label, len);
if (!string_is_empty(label))
strlcpy(new_label, label, sizeof(new_label));
if (s && !string_is_empty(new_label))
{
strlcpy(s, new_label, len);
replace_chars(s, '_', ' ');
}
/* replace characters */
while((pos = strchr(s, '_')))
*pos = ' ';
}
static int fill_title(char *s, const char *title, const char *path, size_t len)
@ -60,14 +49,17 @@ static int fill_title(char *s, const char *title, const char *path, size_t len)
static int action_get_title_action_generic(const char *path, const char *label,
unsigned menu_type, char *s, size_t len)
{
sanitize_to_string(s, label, len);
if (s && !string_is_empty(label))
sanitize_to_string(s, label, len);
return 0;
}
#define default_title_macro(func_name, lbl) \
static int (func_name)(const char *path, const char *label, unsigned menu_type, char *s, size_t len) \
{ \
sanitize_to_string(s, msg_hash_to_str(lbl), len); \
const char *str = msg_hash_to_str(lbl); \
if (s && !string_is_empty(str)) \
sanitize_to_string(s, str, len); \
return 0; \
}

Some files were not shown because too many files have changed in this diff Show More