Merge pull request #1 from libretro/master

updates
This commit is contained in:
Ömercan Kömür 2019-06-12 12:13:31 +03:00 committed by GitHub
commit c91b8e6295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
262 changed files with 25534 additions and 17319 deletions

View File

@ -39,6 +39,8 @@ matrix:
env: C89_BUILD=1 CC=clang-6.0 CXX=clang++-6.0
- compiler: clang
env: CXX_BUILD=1 CC=clang-6.0 CXX=clang++-6.0
- os: osx
env: CC=clang CXX=clang++
- os: osx
osx_image: xcode8
script:
@ -75,7 +77,7 @@ before_install:
script:
- |
if [ -n "$CROSS_COMPILE" ]; then
ARGS="$ARGS --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 --enable-builtinzlib"
ARGS="$ARGS --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12"
fi
- |
if [ -n "$DISABLE_MENU" ]; then

View File

@ -1,19 +1,37 @@
# 1.7.8 (future)
- COMMON: Add optional 'on demand' thumbnail downloads.
- COMMON: Add new playlist-based thumbnail downloader. Hide the legacy thumbnail pack version by default.
- COMMON: Show license per core (if available) inside 'Load Core'.
- GAMECUBE: Add default video/audio filter directories.
- GL1: Ignore alpha in core video, fixes XRGB8888 rendering in some cores.
- GLCORE: Don't hardcode shader cross compilation target version but poll it. glcore would always only use the minimum target shader version, i.e. GLSL ES 3.00 for OpenGL ES 3.0+ or GLSL 1.50 for OpenGL 3.2+.
- D3D10/11/12/SLANG: Added "FrameDirection" slang semantic. Works fine with braid-rewind shader, not entirely perfect with D3D12 though.
- GLCORE/SLANG: Added "FrameDirection" slang semantic.
- IOS: Correctly centers screen on iPhone X landscape.
- LOCALIZATION: Update Korean translation.
- LOCALIZATION: Update Portuguese Brazilian Translation.
- LOCALIZATION: Update Polish translation.
- MENU/WIDGETS: All widgets are now properly cleaned up, fixing the frozen widgets bug when loading / closing content.
- MENU/WIDGETS: Widgets are now drawn above the overlay with OpenGL and Vulkan.
- MENU/WIDGETS: Fine tune progress bar colors.
- MENU: Fix longstanding menu display issues on Mali400 GPUs (on ARM hardware, SBCs and mobile phones/tablets).
- MENU/THUMBNAILS: Ensure that displayed thumbnails are always refreshed correctly after selecting 'Download Thumbnails' from Quick Menu.
- MENU/OZONE: Add it for PS3
- MENU/OZONE: Fix regression in 1.7.7 - OSX/macOS - was unable to start it.
- MENU/XMB: Add menu animation settings.
- MENU: Fix Record -> Streaming Quality, and Record -> Recording Threads settings.
- MENU/QT/WIMP: Path selector fixes.
- METAL/SLANG: Added "FrameDirection" slang semantic.
- NETBSD: Audioio is now the default audio driver.
- NETBSD: Fix a segfault when starting RetroArch with an empty configuration file and LANG unset in the environment.
- OSD: OSD is now drawn above the overlay with Vulkan.
- RECORD: Fix Twitch streaming.
- SCALER: Fix SSE2 path for ARGB/BGRA -> BGR24 - should fix screenshots being taken for XRGB888 (viewport).
- SCANNER: Skip all databases with incompatible file extensions, whether content is inside an archive or not.
- VULKAN/SLANG: Added "FrameDirection" slang semantic.
- WII: Add default video/audio filter directories.
- WII: Fix RGUI display corruption.
- WIIU/SLANG: Added "FrameDirection" slang semantic.
- X11: Add non-evdev keycodes to fix keyboard input on non-Linux systems with X11.
# 1.7.7

View File

@ -186,10 +186,12 @@ ifeq ($(MAKECMDGOALS),clean)
config.mk:
else
-include $(RARCH_OBJ:.o=.d)
ifeq ($(HAVE_CONFIG_MK),)
config.mk: configure qb/*
@echo "config.mk is outdated or non-existing. Run ./configure again."
@exit 1
endif
endif
retroarch: $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)

View File

@ -207,7 +207,7 @@ OBJ += frontend/frontend.o \
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
audio/audio_driver.o \
$(LIBRETRO_COMM_DIR)/audio/audio_mixer.o \
input/common/input_common.o \
input/common/input_hid_common.o \
input/input_driver.o \
input/input_mapper.o \
led/led_driver.o \
@ -1342,15 +1342,14 @@ endif
ifeq ($(HAVE_D3D9), 1)
HAVE_D3D_COMMON = 1
HAVE_D3DX = 1
DEFINES += -DHAVE_D3D9
ifeq ($(HAVE_D3DX), 1)
DEFINES += -DHAVE_D3DX
ifeq ($(HAVE_D3DX9), 1)
HAVE_D3DX_COMMON = 1
endif
ifneq ($(HAVE_DYLIB), 1)
LIBS += -ld3d9
ifeq ($(HAVE_D3DX), 1)
LIBS += -ld3dx9
LIBS += $(D3D9_LIBS)
ifeq ($(HAVE_D3DX9), 1)
LIBS += $(D3DX9_LIBS)
endif
endif
HAVE_DX_COMMON = 1
@ -1412,14 +1411,21 @@ ifeq ($(HAVE_D3D8), 1)
HAVE_D3D_COMMON = 1
HAVE_DX_COMMON = 1
DEFINES += -DHAVE_D3D8
ifeq ($(HAVE_D3DX8), 1)
HAVE_D3DX_COMMON = 1
endif
ifneq ($(HAVE_DYLIB), 1)
LIBS += -ld3d8
ifeq ($(HAVE_D3DX), 1)
LIBS += -ld3dx8
LIBS += $(D3D8_LIBS)
ifeq ($(HAVE_D3DX8), 1)
LIBS += $(D3DX8_LIBS)
endif
endif
endif
ifeq ($(HAVE_D3DX_COMMON), 1)
DEFINES += -DHAVE_D3DX
endif
ifeq ($(HAVE_DX_COMMON), 1)
LIBS += -ldxguid
endif
@ -1574,49 +1580,54 @@ else ifeq ($(HAVE_FLAC),1)
LIBS += $(FLAC_LIBS)
endif
ifeq ($(HAVE_ZLIB), 1)
ifeq ($(HAVE_BUILTINZLIB), 1)
HAVE_ZLIB_COMMON = 1
OBJ += $(DEPS_DIR)/libz/adler32.o \
$(DEPS_DIR)/libz/compress.o \
$(DEPS_DIR)/libz/libz-crc32.o \
$(DEPS_DIR)/libz/deflate.o \
$(DEPS_DIR)/libz/gzclose.o \
$(DEPS_DIR)/libz/gzlib.o \
$(DEPS_DIR)/libz/gzread.o \
$(DEPS_DIR)/libz/gzwrite.o \
$(DEPS_DIR)/libz/inffast.o \
$(DEPS_DIR)/libz/inflate.o \
$(DEPS_DIR)/libz/inftrees.o \
$(DEPS_DIR)/libz/trees.o \
$(DEPS_DIR)/libz/uncompr.o \
$(DEPS_DIR)/libz/zutil.o
INCLUDE_DIRS += -I$(LIBRETRO_COMM_DIR)/include/compat/zlib
DEFINES += -DWANT_ZLIB
else
HAVE_ZLIB_COMMON = 1
LIBS += $(ZLIB_LIBS)
endif
ifeq ($(HAVE_ZLIB_COMMON), 1)
OBJ += $(LIBRETRO_COMM_DIR)/file/archive_file_zlib.o \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_zlib.o
DEFINES += -DHAVE_ZLIB
HAVE_COMPRESSION = 1
ifeq ($(HAVE_BUILTINZLIB), 1)
OBJ += $(DEPS_DIR)/libz/adler32.o \
$(DEPS_DIR)/libz/compress.o \
$(DEPS_DIR)/libz/libz-crc32.o \
$(DEPS_DIR)/libz/deflate.o \
$(DEPS_DIR)/libz/gzclose.o \
$(DEPS_DIR)/libz/gzlib.o \
$(DEPS_DIR)/libz/gzread.o \
$(DEPS_DIR)/libz/gzwrite.o \
$(DEPS_DIR)/libz/inffast.o \
$(DEPS_DIR)/libz/inflate.o \
$(DEPS_DIR)/libz/inftrees.o \
$(DEPS_DIR)/libz/trees.o \
$(DEPS_DIR)/libz/uncompr.o \
$(DEPS_DIR)/libz/zutil.o
INCLUDE_DIRS += -I$(LIBRETRO_COMM_DIR)/include/compat
DEFINES += -DWANT_ZLIB
else
LIBS += $(ZLIB_LIBS)
endif
ifeq ($(HAVE_CHD), 1)
DEF_FLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
DEFINES += -DHAVE_CHD -DWANT_SUBCODE -DWANT_RAW_DATA_SECTOR
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_bitstream.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_cdrom.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_chd.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_huffman.o \
$(LIBRETRO_COMM_DIR)/streams/chd_stream.o
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_zlib.o
ifeq ($(HAVE_FLAC),1)
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_flac.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_flac_codec.o
ifeq ($(HAVE_CHD), 1)
DEF_FLAGS += -I$(LIBRETRO_COMM_DIR)/formats/libchdr
DEFINES += -DHAVE_CHD -DWANT_SUBCODE -DWANT_RAW_DATA_SECTOR
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_bitstream.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_cdrom.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_chd.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_huffman.o \
$(LIBRETRO_COMM_DIR)/streams/chd_stream.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_zlib.o
ifeq ($(HAVE_FLAC),1)
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_flac.o \
$(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_flac_codec.o
endif
ifeq ($(HAVE_7ZIP), 1)
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_lzma.o
endif
endif
ifeq ($(HAVE_7ZIP), 1)
OBJ += $(LIBRETRO_COMM_DIR)/formats/libchdr/libchdr_lzma.o
endif
endif
endif
ifeq ($(HAVE_RTGA), 1)
@ -1646,10 +1657,6 @@ OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp_encode.o \
$(LIBRETRO_COMM_DIR)/formats/xml/rxml.o \
$(LIBRETRO_COMM_DIR)/formats/image_transfer.o
ifdef HAVE_COMPRESSION
DEFINES += -DHAVE_COMPRESSION
endif
# Easter Egg
ifeq ($(HAVE_EASTEREGG),1)
DEFINES += -DHAVE_EASTEREGG
@ -1723,11 +1730,8 @@ ifeq ($(HAVE_NETWORKING), 1)
DEFINES += -DHAVE_CHEEVOS \
-Ideps/rcheevos/include
OBJ += cheevos/cheevos.o \
cheevos/badges.o \
cheevos/var.o \
cheevos/cond.o \
cheevos-new/cheevos.o \
OBJ += cheevos-new/cheevos.o \
cheevos-new/badges.o \
cheevos-new/fixup.o \
cheevos-new/parser.o \
cheevos-new/hash.o \
@ -1922,7 +1926,7 @@ ifeq ($(HAVE_STATIC_VIDEO_FILTERS), 1)
endif
ifeq ($(WANT_IOSUHAX), 1)
DEFINES += -I$(DEPS_DIR)/libiosuhax
DEFINES += -DHAVE_IOSUHAX
DEF_FLAGS += -I$(DEPS_DIR)/libiosuhax
OBJ += $(DEPS_DIR)/libiosuhax/iosuhax.o \
$(DEPS_DIR)/libiosuhax/iosuhax_devoptab.o \
@ -1930,7 +1934,7 @@ ifeq ($(WANT_IOSUHAX), 1)
endif
ifeq ($(WANT_LIBFAT), 1)
DEFINES += -I$(DEPS_DIR)/libfat/include
DEFINES += -DHAVE_LIBFAT
DEF_FLAGS += -I$(DEPS_DIR)/libfat/include
OBJ += $(DEPS_DIR)/libfat/cache.o \
$(DEPS_DIR)/libfat/directory.o \

View File

@ -136,7 +136,8 @@ CFLAGS += -I. \
-Ideps/libz \
-Ideps/7zip \
-Ideps/stb \
-Ilibretro-common/include
-Ilibretro-common/include \
-Ilibretro-common/include/compat/zlib
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)

View File

@ -23,7 +23,7 @@ HAVE_RGUI = 1
HAVE_SDL = 0
HAVE_SDL2 = 0
HAVE_ZLIB = 1
WANT_ZLIB = 1
WANT_ZLIB = 0
HAVE_SHADERPIPELINE = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1

View File

@ -190,6 +190,7 @@ else ifeq ($(libogc_platform), 1)
HAVE_IBXM := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -302,6 +303,7 @@ else ifeq ($(platform), vita)
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
HAVE_7ZIP := 1
HAVE_VITA2D := 1
@ -362,6 +364,7 @@ else ifeq ($(platform), windows_msvc2003_x86)
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -410,6 +413,7 @@ else ifeq ($(platform), windows_msvc2005_x86)
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -459,6 +463,7 @@ else ifneq (,$(findstring windows_msvc2010,$(platform)))
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -531,6 +536,7 @@ else ifneq (,$(findstring windows_msvc2012,$(platform)))
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -607,6 +613,7 @@ else ifneq (,$(findstring windows_msvc2013,$(platform)))
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -683,6 +690,7 @@ else ifneq (,$(findstring windows_msvc2015,$(platform)))
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_BUILTINZLIB := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
@ -838,6 +846,7 @@ endif
ifeq ($(HAVE_ZLIB), 1)
CFLAGS += -DHAVE_ZLIB
CFLAGS += -I./libretro-common/include/compat/zlib
endif
ifeq ($(WANT_ZLIB), 1)

View File

@ -112,7 +112,7 @@ APP_ICON := pkg/libnx/retroarch.jpg
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd
CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \
$(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h #$(shell $(PORTLIBS)/bin/freetype-config --cflags)
$(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h #$(shell $(PORTLIBS)/bin/freetype-config --cflags)
CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DHAVE_STB_FONT #-DHAVE_FREETYPE

View File

@ -60,6 +60,20 @@ HAVE_CHEEVOS := 1
HAVE_SHADERPIPELINE := 1
HAVE_IMAGEVIEWER := 1
ifeq ($(HAVE_D3D8), 1)
D3D8_LIBS := -ld3d8
ifeq ($(HAVE_D3DX), 1)
D3DX8_LIBS := -ld3dx8
endif
endif
ifeq ($(HAVE_D3D9), 1)
D3D9_LIBS := -ld3d9
ifeq ($(HAVE_D3DX), 1)
D3DX9_LIBS := -ld3dx9
endif
endif
include Makefile.common
INCLUDE_DIRS := $(patsubst -isystem%,-I%,$(INCLUDE_DIRS))
CFLAGS := $(filter-out -Wno-unknown-pragmas,$(DEF_FLAGS))

View File

@ -83,7 +83,7 @@ STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := $(CXX)
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb -Ilibretro-common/include/compat/zlib
LIBDIRS := -L.
ARCHFLAGS := -m64 -DORBIS

View File

@ -31,18 +31,18 @@ ifeq ($(MUTE_WARNINGS), 1)
endif
INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include -I$(CDVD_DIR)/ee
INCDIR += -Ips2 -Ips2/include -Ilibretro-common/include
INCDIR += -Ips2 -Ips2/include -Ilibretro-common/include -Ilibretro-common/include/compat/zlib
INCDIR += -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ideps/pthreads -Ideps/pthreads/platform/ps2 -Ideps/pthreads/platform/helper
GPVAL = -G0
CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) -ffast-math -fsingle-precision-constant
ASFLAGS = $(CFLAGS)
RARCH_DEFINES += -DPS2 -DUSE_IOP_CTYPE_MACRO -D_MIPS_ARCH_R5900 -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DWANT_ZLIB
RARCH_DEFINES += -DPS2 -DUSE_IOP_CTYPE_MACRO -D_MIPS_ARCH_R5900 -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG
RARCH_DEFINES += -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
LIBDIR =
LDFLAGS += -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L$(CDVD_DIR)/lib -L.
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lmf -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lmf -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio -lz
LIBS += -lcdvdfs -lpatches -lpoweroff

View File

@ -39,7 +39,8 @@ INCDIRS = -I. \
-Ideps/libz \
-Ideps/stb \
-Ideps/rcheevos/include \
-Ilibretro-common/include
-Ilibretro-common/include \
-Ilibretro-common/include/compat/zlib
# system platform
system_platform = unix

View File

@ -17,7 +17,7 @@ ELF_TARGET := retroarch_psl1ght.elf
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__

View File

@ -21,7 +21,7 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_END := -Wl,--no-whole-archive
endif
INCDIR = deps deps/stb deps/libz deps/7zip deps/pthreads deps/pthreads/platform/psp deps/pthreads/platform/helper libretro-common/include
INCDIR = deps deps/stb deps/libz deps/7zip deps/pthreads deps/pthreads/platform/psp deps/pthreads/platform/helper libretro-common/include libretro-common/include/compat/zlib
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math -fsingle-precision-constant
ASFLAGS = $(CFLAGS)

View File

@ -46,7 +46,7 @@ endif
include $(LIBTRANSISTOR_HOME)/libtransistor.mk
INCDIRS := -I. -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBTRANSISTOR_HOME)/build/sdl2_install/include/SDL2/
INCDIRS := -I. -Ideps -Ideps/libz -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -Ideps/stb -I$(LIBTRANSISTOR_HOME)/build/sdl2_install/include/SDL2/
LIBDIRS := -L.
TARGETS := $(TARGET).nro

View File

@ -1,4 +1,4 @@
TARGET := retroarch_wiiu
TARGET := retroarch_wiiu
BUILD_HBL_ELF = 1
BUILD_RPX = 1
@ -10,7 +10,7 @@ WIIU_HID = 1
HAVE_RUNAHEAD = 1
WIIU_LOG_RPX = 0
BUILD_DIR = objs/wiiu
PC_DEVELOPMENT_TCP_PORT ?=
PC_DEVELOPMENT_TCP_PORT ?=
ifeq ($(SALAMANDER_BUILD),1)
BUILD_DIR := $(BUILD_DIR)-salamander
@ -27,7 +27,13 @@ ifneq ($(V), 1)
Q := @
endif
DEFINES :=
OBJ :=
INCDIRS :=
#-----------------------------
# Features and object files
OBJ += wiiu/main.o
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/atomic.o
@ -37,23 +43,9 @@ OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/hbl.o
DEFINES :=
ifeq ($(WIIU_LOG_RPX),1)
defines += -DWIIU_LOG_RPX
endif
ifeq ($(WIIU_HID),1)
DEFINES += -DWIIU_HID
OBJ += input/drivers_joypad/wiiu/hidpad_driver.o
OBJ += input/drivers_hid/wiiu_hid.o
OBJ += input/connect/joypad_connection.o \
input/common/hid/hid_device_driver.o \
input/common/hid/device_wiiu_gca.o \
input/common/hid/device_ds3.o \
input/common/hid/device_ds4.o \
input/common/hid/device_null.o
endif
RPX_OBJ = $(BUILD_DIR)/wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = $(BUILD_DIR)/wiiu/system/dynamic.o \
$(BUILD_DIR)/wiiu/system/stubs_elf.o
ifeq ($(SALAMANDER_BUILD),1)
DEFINES += -DRARCH_CONSOLE -DIS_SALAMANDER
@ -77,6 +69,8 @@ ifeq ($(SALAMANDER_BUILD),1)
OBJ += libretro-common/hash/rhash.o
OBJ += file_path_str.o
OBJ += verbosity.o
# $(SALAMANDER_BUILD),0
else
DEFINES += -DRARCH_INTERNAL
DEFINES += -DHAVE_KEYMAPPER
@ -86,7 +80,7 @@ else
DEFINES += -DHAVE_SHADERPIPELINE
ifeq ($(HAVE_RUNAHEAD),1)
DEFINES += -DHAVE_RUNAHEAD
DEFINES += -DHAVE_RUNAHEAD
endif
OBJ += wiiu/shader_utils.o
@ -103,70 +97,156 @@ endif
OBJ += gfx/drivers_shader/glslang_util.o
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY
# DEFINES += -DWANT_IFADDRS
# DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
OBJ += griffin/griffin.o
INCDIRS += -Ilibretro-common/include/compat/zlib
# for stb, libfat, iosuhax
INCDIRS += -Ideps -Ideps/libfat/include -Ideps/libiosuhax
# pad_functions uses wiiu/input.h
INCDIRS += -Iinput/include
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY
#DEFINES += -DWANT_IFADDRS
#DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
DEFINES += -DHAVE_HID
DEFINES += -DWANT_LIBFAT -DHAVE_LIBFAT -DWANT_IOSUHAX -DHAVE_IOSUHAX
# $(GRIFFIN_BUILD),0
else
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 0
HAVE_LIBRETRODB = 1
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
# HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_NETPLAYDISCOVERY = 1
HAVE_CHEEVOS = 1
# WANT_IFADDRS = 1
HAVE_OVERLAY = 1
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_7ZIP = 1
HAVE_ZLIB = 1
HAVE_BUILTINZLIB = 0
HAVE_LIBRETRODB = 1
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
#HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_NETPLAYDISCOVERY = 1
HAVE_CHEEVOS = 1
#WANT_IFADDRS = 1
HAVE_OVERLAY = 1
HAVE_VIDEO_LAYOUT = 0
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
WANT_LIBFAT = 1
WANT_IOSUHAX = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
WANT_LIBFAT = 1
WANT_IOSUHAX = 1
include Makefile.common
include Makefile.common
DEFINES += $(DEF_FLAGS)
INCDIRS += $(INCLUDE_DIRS)
OBJ += gfx/drivers/gx2_gfx.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += input/drivers_joypad/wiiu/wpad_driver.o
OBJ += input/drivers_joypad/wiiu/kpad_driver.o
OBJ += input/drivers_joypad/wiiu/pad_functions.o
OBJ += gfx/drivers/gx2_gfx.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += input/drivers_joypad/wiiu/wpad_driver.o
OBJ += input/drivers_joypad/wiiu/kpad_driver.o
OBJ += input/drivers_joypad/wiiu/pad_functions.o
INCDIRS += -Iinput/include
OBJ += audio/drivers/wiiu_audio.o
OBJ += frontend/drivers/platform_wiiu.o
OBJ += audio/drivers/wiiu_audio.o
OBJ += frontend/drivers/platform_wiiu.o
ifeq ($(WIIU_HID),1)
DEFINES += -DWIIU_HID
OBJ += input/drivers_joypad/wiiu/hidpad_driver.o
OBJ += input/drivers_hid/wiiu_hid.o
OBJ += input/connect/joypad_connection.o \
input/common/hid/hid_device_driver.o \
input/common/hid/device_wiiu_gca.o \
input/common/hid/device_ds3.o \
input/common/hid/device_ds4.o \
input/common/hid/device_null.o
endif
endif
endif
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__
#DEFINES += -D_GNU_SOURCE
#-----------------------------
# Compile flags
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__ -DHW_WUP -D__wiiu__
DEFINES += -DHAVE_MAIN
DEFINES += -DRARCH_CONSOLE
ifeq ($(WIIU_LOG_RPX),1)
DEFINES += -DWIIU_LOG_RPX
endif
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
DEFINES += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
endif
INCDIRS += -I.
INCDIRS += -Ilibretro-common/include
INCDIRS += -Iwiiu
INCDIRS += -Iwiiu/include
CFLAGS := -mcpu=750 -meabi -mhard-float
CFLAGS += -ffast-math -Werror=implicit-function-declaration
CFLAGS += -ffunction-sections -fdata-sections
#CFLAGS += -fomit-frame-pointer -mword-relocations
#CFLAGS += -Wall
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
ASFLAGS := $(CFLAGS) -mregnames
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
#-----------------------------
# Linking/library flags
LIBDIRS := -L.
LDFLAGS := $(CFLAGS)
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
# Use portlibs zlib if deps/ isn't being used
ifeq ($(HAVE_ZLIB),1)
ifeq ($(HAVE_BUILTINZLIB),0)
INCDIRS += -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS += -L$(DEVKITPRO)/portlibs/ppc/lib
# Bonus: libpng for cores that need it
LIBS += -lpng -lz
endif
endif
LDFLAGS += -Wl,--gc-sections
RPX_LDFLAGS := -pie -fPIE
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
RPX_LDFLAGS += -T wiiu/link_rpl.ld
RPX_LDFLAGS += -nostartfiles
HBL_ELF_LDFLAGS := -T wiiu/link_elf.ld
#-----------------------------
# Compiler setup
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
@ -195,63 +275,8 @@ else
ELF2RPL := $(ELF2RPL).exe
endif
INCDIRS := -I.
INCDIRS += -Ideps
INCDIRS += -Ideps/stb
INCDIRS += -Ideps/libz
INCDIRS += -Ideps/7zip
INCDIRS += -Ilibretro-common/include
INCDIRS += -Iinput/include
INCDIRS += -Iwiiu
INCDIRS += -Iwiiu/include
INCDIRS += -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
CFLAGS := -mwup -mcpu=750 -meabi -mhard-float
LDFLAGS :=
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
LDFLAGS := $(CFLAGS)
ASFLAGS := $(CFLAGS) -mregnames
CFLAGS += -ffast-math -Werror=implicit-function-declaration
#CFLAGS += -fomit-frame-pointer -mword-relocations
#CFLAGS += -Wall
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
LDFLAGS += -Wl,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm -lpng -lz
ifneq ($(WANT_LIBFAT), 1)
LIBS += -lfat
endif
ifneq ($(WANT_IOSUHAX), 1)
LIBS += -liosuhax
endif
RPX_OBJ = $(BUILD_DIR)/wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = $(BUILD_DIR)/wiiu/system/dynamic.o $(BUILD_DIR)/wiiu/system/stubs_elf.o
RPX_LDFLAGS := -pie -fPIE
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
RPX_LDFLAGS += -T wiiu/link_rpl.ld
RPX_LDFLAGS += -nostartfiles
HBL_ELF_LDFLAGS := -T wiiu/link_elf.ld
#-----------------------------
# Targets and build rules
TARGETS :=
ifeq ($(BUILD_RPX), 1)
@ -315,10 +340,11 @@ $(BUILD_DIR)/$(TARGET).rpx: $(BUILD_DIR)/$(TARGET).rpx.elf $(ELF2RPL) .$(TARGET)
$(Q)-$(ELF2RPL) $< $@
clean:
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).rpx
rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.last
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
@$(if $(Q), echo $@,)
$(Q)rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
$(Q)rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).rpx
$(Q)rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.last
$(Q)rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
.PHONY: clean all
.PRECIOUS: %.depend %.last

View File

@ -56,6 +56,20 @@ SDL2_LIBS := -lSDL2
SDL2_CFLAGS := -ISDL2 -DHAVE_SDL2
endif
ifeq ($(HAVE_D3D8), 1)
D3D8_LIBS := -ld3d8
ifeq ($(HAVE_D3DX), 1)
D3DX8_LIBS := -ld3dx8
endif
endif
ifeq ($(HAVE_D3D9), 1)
D3D9_LIBS := -ld3d9
ifeq ($(HAVE_D3DX), 1)
D3DX9_LIBS := -ld3dx9
endif
endif
ifeq ($(HAVE_RSOUND), 1)
RSOUND_CFLAGS := -DHAVE_RSOUND
RSOUND_LIBS := -lrsound
@ -81,7 +95,7 @@ OS := Win32
OBJ :=
LIBS := -lm
DEFINES :=
DEFINES += -I. -Ilibretro-common/include -DRARCH_INTERNAL -DHAVE_OVERLAY
DEFINES += -I. -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -DRARCH_INTERNAL -DHAVE_OVERLAY
#DEFINES += -DHAVE_VIDEO_LAYOUT
LDFLAGS := -L. -static-libgcc

View File

@ -617,34 +617,16 @@ void audio_driver_set_nonblocking_state(bool enable)
* Writes audio samples to audio driver. Will first
* perform DSP processing (if enabled) and resampling.
**/
static void audio_driver_flush(const int16_t *data, size_t samples)
static void audio_driver_flush(const int16_t *data, size_t samples,
bool is_slowmotion)
{
struct resampler_data src_data;
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
bool is_active = false;
const void *output_data = NULL;
unsigned output_frames = 0;
float audio_volume_gain = !audio_driver_mute_enable ?
audio_driver_volume_gain : 0.0f;
src_data.data_out = NULL;
src_data.output_frames = 0;
if (recording_data)
recording_push_audio(data, samples);
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
&is_perfcnt_enable);
if ( is_paused ||
!audio_driver_active ||
!audio_driver_input_data ||
!audio_driver_output_samples_buf)
return;
convert_s16_to_float(audio_driver_input_data, data, samples,
audio_volume_gain);
@ -713,9 +695,7 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
audio_driver_resampler->process(audio_driver_resampler_data, &src_data);
is_active = audio_mixer_active;
if (is_active)
if (audio_mixer_active)
{
bool override = audio_driver_mixer_mute_enable ? true :
(audio_driver_mixer_volume_gain != 1.0f) ? true : false;
@ -725,23 +705,25 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
src_data.output_frames, mixer_gain, override);
}
output_data = audio_driver_output_samples_buf;
output_frames = (unsigned)src_data.output_frames;
if (audio_driver_use_float)
output_frames *= sizeof(float);
else
{
convert_float_to_s16(audio_driver_output_samples_conv_buf,
(const float*)output_data, output_frames * 2);
const void *output_data = audio_driver_output_samples_buf;
unsigned output_frames = (unsigned)src_data.output_frames;
output_data = audio_driver_output_samples_conv_buf;
output_frames *= sizeof(int16_t);
if (audio_driver_use_float)
output_frames *= sizeof(float);
else
{
convert_float_to_s16(audio_driver_output_samples_conv_buf,
(const float*)output_data, output_frames * 2);
output_data = audio_driver_output_samples_conv_buf;
output_frames *= sizeof(int16_t);
}
if (current_audio->write(audio_driver_context_audio_data,
output_data, output_frames * 2) < 0)
audio_driver_active = false;
}
if (current_audio->write(audio_driver_context_audio_data,
output_data, output_frames * 2) < 0)
audio_driver_active = false;
}
/**
@ -753,6 +735,11 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
**/
void audio_driver_sample(int16_t left, int16_t right)
{
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
if (audio_suspended)
return;
@ -762,25 +749,55 @@ void audio_driver_sample(int16_t left, int16_t right)
if (audio_driver_data_ptr < audio_driver_chunk_size)
return;
audio_driver_flush(audio_driver_output_samples_conv_buf,
audio_driver_data_ptr);
if (recording_data)
recording_push_audio(audio_driver_output_samples_conv_buf,
audio_driver_data_ptr);
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
&is_perfcnt_enable);
if (!(is_paused ||
!audio_driver_active ||
!audio_driver_input_data ||
!audio_driver_output_samples_buf))
audio_driver_flush(audio_driver_output_samples_conv_buf,
audio_driver_data_ptr, is_slowmotion);
audio_driver_data_ptr = 0;
}
void audio_driver_menu_sample(void)
{
bool check_flush = false;
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
static int16_t samples_buf[1024] = {0};
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
const struct retro_system_timing *info =
(const struct retro_system_timing*)&av_info->timing;
unsigned sample_count = (info->sample_rate / info->fps) * 2;
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
&is_perfcnt_enable);
check_flush = !(
is_paused ||
!audio_driver_active ||
!audio_driver_input_data ||
!audio_driver_output_samples_buf);
while (sample_count > 1024)
{
audio_driver_flush(samples_buf, 1024);
if (recording_data)
recording_push_audio(samples_buf, 1024);
if (check_flush)
audio_driver_flush(samples_buf, 1024, is_slowmotion);
sample_count -= 1024;
}
audio_driver_flush(samples_buf, sample_count);
if (recording_data)
recording_push_audio(samples_buf, sample_count);
if (check_flush)
audio_driver_flush(samples_buf, sample_count, is_slowmotion);
}
/**
@ -795,13 +812,28 @@ void audio_driver_menu_sample(void)
**/
size_t audio_driver_sample_batch(const int16_t *data, size_t frames)
{
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
if (frames > (AUDIO_CHUNK_SIZE_NONBLOCKING >> 1))
frames = AUDIO_CHUNK_SIZE_NONBLOCKING >> 1;
if (audio_suspended)
return frames;
audio_driver_flush(data, frames << 1);
if (recording_data)
recording_push_audio(data, frames << 1);
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
&is_perfcnt_enable);
if (!(
is_paused ||
!audio_driver_active ||
!audio_driver_input_data ||
!audio_driver_output_samples_buf))
audio_driver_flush(data, frames << 1, is_slowmotion);
return frames;
}
@ -1698,10 +1730,28 @@ void audio_driver_unset_callback(void)
void audio_driver_frame_is_reverse(void)
{
bool is_perfcnt_enable = false;
bool is_paused = false;
bool is_idle = false;
bool is_slowmotion = false;
/* We just rewound. Flush rewind audio buffer. */
audio_driver_flush(
audio_driver_rewind_buf + audio_driver_rewind_ptr,
audio_driver_rewind_size - audio_driver_rewind_ptr);
if (recording_data)
recording_push_audio(
audio_driver_rewind_buf + audio_driver_rewind_ptr,
audio_driver_rewind_size - audio_driver_rewind_ptr);
runloop_get_status(&is_paused, &is_idle, &is_slowmotion,
&is_perfcnt_enable);
if (!(
is_paused ||
!audio_driver_active ||
!audio_driver_input_data ||
!audio_driver_output_samples_buf))
audio_driver_flush(
audio_driver_rewind_buf + audio_driver_rewind_ptr,
audio_driver_rewind_size - audio_driver_rewind_ptr,
is_slowmotion);
}
void audio_driver_destroy_data(void)

View File

@ -1,6 +1,5 @@
#include <file/file_path.h>
#include <string/stdstring.h>
#include <streams/file_stream.h>
#ifdef HAVE_MENU
#include "../menu/menu_driver.h"
@ -17,7 +16,7 @@ badges_ctx_t badges_ctx;
bool badge_exists(const char* filepath)
{
return filestream_exists(filepath);
return path_is_valid(filepath);
}
void set_badge_menu_texture(badges_ctx_t * badges, int i)

View File

@ -44,7 +44,7 @@
#include <rthreads/rthreads.h>
#endif
#include "../cheevos/badges.h" /* RCHEEVOS TODO: fix path */
#include "badges.h"
#include "cheevos.h"
#include "fixup.h"
#include "parser.h"
@ -1490,7 +1490,7 @@ found:
/* Checks for the existence of a headered Lynx file.
Unheadered files fall back to RCHEEVOS_GENERIC_MD5. */
if (coro->len <= lynx_header_len ||
if (coro->len <= (unsigned)lynx_header_len ||
memcmp("LYNX", (void *)coro->data, 5) != 0)
{
coro->gameid = 0;

View File

@ -1,74 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2018 - Andre Leiradella
*
* 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 <file/file_path.h>
#include <string/stdstring.h>
#include <streams/file_stream.h>
#ifdef HAVE_MENU
#include "../menu/menu_driver.h"
#endif
#include "../file_path_special.h"
#include "../configuration.h"
#include "../verbosity.h"
#include "../network/net_http_special.h"
#include "badges.h"
badges_ctx_t badges_ctx;
bool badge_exists(const char* filepath)
{
return filestream_exists(filepath);
}
void set_badge_menu_texture(badges_ctx_t * badges, int i)
{
char badge_file[16];
char fullpath[PATH_MAX_LENGTH];
snprintf(badge_file, sizeof(badge_file), "%s%s", badges->badge_id_list[i],
badges->badge_locked[i] ? "_lock.png" : ".png");
fill_pathname_application_special(fullpath,
PATH_MAX_LENGTH * sizeof(char),
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES);
#if defined(HAVE_MENU) || defined(HAVE_MENU_WIDGETS)
menu_display_reset_textures_list(badge_file, fullpath,
&badges->menu_texture_list[i],TEXTURE_FILTER_MIPMAP_LINEAR, NULL, NULL);
#endif
}
void set_badge_info (badges_ctx_t *badge_struct, int id,
const char *badge_id, bool active)
{
if (!badge_struct)
return;
badge_struct->badge_id_list[id] = badge_id;
badge_struct->badge_locked[id] = active;
set_badge_menu_texture(badge_struct, id);
}
menu_texture_item get_badge_texture(int id)
{
settings_t *settings = config_get_ptr();
if (!settings || !settings->bools.cheevos_badges_enable)
return (menu_texture_item)NULL;
return badges_ctx.menu_texture_list[id];
}

View File

@ -1,44 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2018 - Andre Leiradella
*
* 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/>.
*/
#ifndef __RARCH_CHEEVOS_OLD_BADGE_H
#define __RARCH_CHEEVOS_OLD_BADGE_H
#include "../menu/menu_driver.h"
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#define CHEEVOS_BADGE_LIMIT 256
typedef struct
{
bool badge_locked[CHEEVOS_BADGE_LIMIT];
const char * badge_id_list[CHEEVOS_BADGE_LIMIT];
menu_texture_item menu_texture_list[CHEEVOS_BADGE_LIMIT];
} badges_ctx_t;
bool badge_exists(const char* filepath);
void set_badge_menu_texture(badges_ctx_t * badges, int i);
extern void set_badge_info (badges_ctx_t *badge_struct, int id, const char *badge_id, bool active);
extern menu_texture_item get_badge_texture(int id);
extern badges_ctx_t badges_ctx;
static badges_ctx_t new_badges_ctx;
RETRO_END_DECLS
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,165 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2018 - Andre Leiradella
*
* 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/>.
*/
#ifndef __RARCH_CHEEVOS_OLD_H
#define __RARCH_CHEEVOS_OLD_H
#include <stdint.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/*****************************************************************************
Setup - mainly for debugging
*****************************************************************************/
/* Define this macro to get extra-verbose log for cheevos. */
#define CHEEVOS_VERBOSE
/*****************************************************************************
End of setup
*****************************************************************************/
#define CHEEVOS_TAG "[CHEEVOS]: "
#ifdef CHEEVOS_VERBOSE
#define CHEEVOS_LOG RARCH_LOG
#define CHEEVOS_ERR RARCH_ERR
#else
void cheevos_log(const char *fmt, ...);
#define CHEEVOS_LOG cheevos_log
#define CHEEVOS_ERR cheevos_log
#endif
typedef struct cheevos_ctx_desc
{
unsigned idx;
char *s;
size_t len;
} cheevos_ctx_desc_t;
typedef enum
{
CHEEVOS_CONSOLE_NONE = 0,
/* Don't change those, the values match the console IDs
* at retroachievements.org. */
CHEEVOS_CONSOLE_MEGA_DRIVE = 1,
CHEEVOS_CONSOLE_NINTENDO_64 = 2,
CHEEVOS_CONSOLE_SUPER_NINTENDO = 3,
CHEEVOS_CONSOLE_GAMEBOY = 4,
CHEEVOS_CONSOLE_GAMEBOY_ADVANCE = 5,
CHEEVOS_CONSOLE_GAMEBOY_COLOR = 6,
CHEEVOS_CONSOLE_NINTENDO = 7,
CHEEVOS_CONSOLE_PC_ENGINE = 8,
CHEEVOS_CONSOLE_SEGA_CD = 9,
CHEEVOS_CONSOLE_SEGA_32X = 10,
CHEEVOS_CONSOLE_MASTER_SYSTEM = 11,
CHEEVOS_CONSOLE_PLAYSTATION = 12,
CHEEVOS_CONSOLE_ATARI_LYNX = 13,
CHEEVOS_CONSOLE_NEOGEO_POCKET = 14,
CHEEVOS_CONSOLE_GAME_GEAR = 15,
CHEEVOS_CONSOLE_GAMECUBE = 16,
CHEEVOS_CONSOLE_ATARI_JAGUAR = 17,
CHEEVOS_CONSOLE_NINTENDO_DS = 18,
CHEEVOS_CONSOLE_WII = 19,
CHEEVOS_CONSOLE_WII_U = 20,
CHEEVOS_CONSOLE_PLAYSTATION_2 = 21,
CHEEVOS_CONSOLE_XBOX = 22,
CHEEVOS_CONSOLE_SKYNET = 23,
CHEEVOS_CONSOLE_XBOX_ONE = 24,
CHEEVOS_CONSOLE_ATARI_2600 = 25,
CHEEVOS_CONSOLE_MS_DOS = 26,
CHEEVOS_CONSOLE_ARCADE = 27,
CHEEVOS_CONSOLE_VIRTUAL_BOY = 28,
CHEEVOS_CONSOLE_MSX = 29,
CHEEVOS_CONSOLE_COMMODORE_64 = 30,
CHEEVOS_CONSOLE_ZX81 = 31,
CHEEVOS_CONSOLE_ATARI_7800 = 51
} cheevos_console_t;
enum
{
CHEEVOS_DIRTY_TITLE = 1 << 0,
CHEEVOS_DIRTY_DESC = 1 << 1,
CHEEVOS_DIRTY_POINTS = 1 << 2,
CHEEVOS_DIRTY_AUTHOR = 1 << 3,
CHEEVOS_DIRTY_ID = 1 << 4,
CHEEVOS_DIRTY_BADGE = 1 << 5,
CHEEVOS_DIRTY_CONDITIONS = 1 << 6,
CHEEVOS_DIRTY_VOTES = 1 << 7,
CHEEVOS_DIRTY_DESCRIPTION = 1 << 8,
CHEEVOS_DIRTY_ALL = (1 << 9) - 1
};
enum
{
CHEEVOS_ACTIVE_SOFTCORE = 1 << 0,
CHEEVOS_ACTIVE_HARDCORE = 1 << 1
};
enum
{
CHEEVOS_FORMAT_FRAMES = 0,
CHEEVOS_FORMAT_SECS,
CHEEVOS_FORMAT_MILLIS,
CHEEVOS_FORMAT_SCORE,
CHEEVOS_FORMAT_VALUE,
CHEEVOS_FORMAT_OTHER
};
bool cheevos_load(const void *data);
void cheevos_reset_game(void);
void cheevos_populate_menu(void *data);
bool cheevos_get_description(cheevos_ctx_desc_t *desc);
bool cheevos_apply_cheats(bool *data_bool);
bool cheevos_unload(void);
bool cheevos_toggle_hardcore_mode(void);
void cheevos_test(void);
bool cheevos_set_cheats(void);
void cheevos_set_support_cheevos(bool state);
bool cheevos_get_support_cheevos(void);
cheevos_console_t cheevos_get_console(void);
extern bool cheevos_loaded;
extern bool cheevos_hardcore_active;
extern bool cheevos_hardcore_paused;
extern bool cheevos_state_loaded_flag;
extern int cheats_are_enabled;
extern int cheats_were_enabled;
RETRO_END_DECLS
#endif /* __RARCH_CHEEVOS_H */

View File

@ -1,189 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* 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 "cond.h"
#include "var.h"
#include "../retroarch.h"
#include "../verbosity.h"
/*****************************************************************************
Parsing
*****************************************************************************/
static cheevos_cond_op_t cheevos_cond_parse_operator(const char** memaddr)
{
const char *str = *memaddr;
cheevos_cond_op_t op;
if (*str == '=' && str[1] == '=')
{
op = CHEEVOS_COND_OP_EQUALS;
str += 2;
}
else if (*str == '=')
{
op = CHEEVOS_COND_OP_EQUALS;
str++;
}
else if (*str == '!' && str[1] == '=')
{
op = CHEEVOS_COND_OP_NOT_EQUAL_TO;
str += 2;
}
else if (*str == '<' && str[1] == '=')
{
op = CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL;
str += 2;
}
else if (*str == '<')
{
op = CHEEVOS_COND_OP_LESS_THAN;
str++;
}
else if (*str == '>' && str[1] == '=')
{
op = CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL;
str += 2;
}
else if (*str == '>')
{
op = CHEEVOS_COND_OP_GREATER_THAN;
str++;
}
else
{
CHEEVOS_ERR(CHEEVOS_TAG "unknown operator %c\n.", *str);
op = CHEEVOS_COND_OP_EQUALS;
}
*memaddr = str;
return op;
}
void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr)
{
const char* str = *memaddr;
cond->type = CHEEVOS_COND_TYPE_STANDARD;
if (*str != 0 && str[1] == ':')
{
int skip = 2;
switch (*str)
{
case 'R':
cond->type = CHEEVOS_COND_TYPE_RESET_IF;
break;
case 'P':
cond->type = CHEEVOS_COND_TYPE_PAUSE_IF;
break;
case 'A':
cond->type = CHEEVOS_COND_TYPE_ADD_SOURCE;
break;
case 'B':
cond->type = CHEEVOS_COND_TYPE_SUB_SOURCE;
break;
case 'C':
cond->type = CHEEVOS_COND_TYPE_ADD_HITS;
break;
default:
skip = 0;
break;
}
str += skip;
}
cheevos_var_parse(&cond->source, &str);
cond->op = cheevos_cond_parse_operator(&str);
cheevos_var_parse(&cond->target, &str);
cond->curr_hits = 0;
if (*str == '(' || *str == '.')
{
char* end;
cond->req_hits = (unsigned)strtol(str + 1, &end, 10);
str = end + (*end == ')' || *end == '.');
}
else
cond->req_hits = 0;
*memaddr = str;
}
unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which)
{
cheevos_cond_t dummy;
unsigned index = 0;
unsigned count = 0;
for (;;)
{
for (;;)
{
cheevos_cond_parse(&dummy, &memaddr);
if (index == which)
count++;
if (*memaddr != '_')
break;
memaddr++;
}
index++;
if (*memaddr != 'S')
break;
memaddr++;
}
return count;
}
void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which)
{
cheevos_cond_t dummy;
unsigned index = 0;
for (;;)
{
for (;;)
{
if (index == which)
{
cheevos_cond_parse(cond, &memaddr);
cond++;
}
else
cheevos_cond_parse(&dummy, &memaddr);
if (*memaddr != '_')
break;
memaddr++;
}
index++;
if (*memaddr != 'S')
break;
memaddr++;
}
}

View File

@ -1,63 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* 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/>.
*/
#ifndef __RARCH_CHEEVOS_COND_H
#define __RARCH_CHEEVOS_COND_H
#include "var.h"
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef enum
{
CHEEVOS_COND_TYPE_STANDARD,
CHEEVOS_COND_TYPE_PAUSE_IF,
CHEEVOS_COND_TYPE_RESET_IF,
CHEEVOS_COND_TYPE_ADD_SOURCE,
CHEEVOS_COND_TYPE_SUB_SOURCE,
CHEEVOS_COND_TYPE_ADD_HITS
} cheevos_cond_type_t;
typedef enum
{
CHEEVOS_COND_OP_EQUALS,
CHEEVOS_COND_OP_LESS_THAN,
CHEEVOS_COND_OP_LESS_THAN_OR_EQUAL,
CHEEVOS_COND_OP_GREATER_THAN,
CHEEVOS_COND_OP_GREATER_THAN_OR_EQUAL,
CHEEVOS_COND_OP_NOT_EQUAL_TO
} cheevos_cond_op_t;
typedef struct
{
cheevos_cond_type_t type;
unsigned req_hits;
unsigned curr_hits;
char pause;
cheevos_var_t source;
cheevos_cond_op_t op;
cheevos_var_t target;
} cheevos_cond_t;
void cheevos_cond_parse(cheevos_cond_t* cond, const char** memaddr);
unsigned cheevos_cond_count_in_set(const char* memaddr, unsigned which);
void cheevos_cond_parse_in_set(cheevos_cond_t* cond, const char* memaddr, unsigned which);
RETRO_END_DECLS
#endif /* __RARCH_CHEEVOS_COND_H */

View File

@ -1,75 +0,0 @@
#ifndef CORO_H
#define CORO_H
/*
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 { \
coro->step = ( x ); \
goto CORO_again; \
} while ( 0 )
/* Go to a subroutine, execution continues until the subroutine returns via RET */
#define CORO_GOSUB( x ) \
do { \
coro->stack[ coro->sp++ ] = __LINE__; \
coro->step = ( x ); \
goto CORO_again; \
case __LINE__: ; \
} while ( 0 )
/* Returns from a subroutine */
#define CORO_RET() \
do { \
coro->step = coro->stack[ --coro->sp ]; \
goto CORO_again; \
} while ( 0 )
/* Yields to the caller, execution continues from this point when the coroutine is resumed */
#define CORO_YIELD() \
do { \
coro->step = __LINE__; \
return 1; \
case __LINE__: ; \
} while ( 0 )
/* The coroutine entry point, never use 0 as a label */
#define CORO_BEGIN 0
/* Sets up the coroutine */
#define CORO_SETUP() \
do { \
coro->step = CORO_BEGIN; \
coro->sp = 0; \
} while ( 0 )
#define CORO_STOP() \
do { \
return 0; \
} while ( 0 )
/* Add this macro to your coro_t structure containing the variables for the coroutine */
#define CORO_FIELDS \
int step, sp; \
int stack[ 8 ];
#endif /* CORO_H */

View File

@ -1,422 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2017 - Andre Leiradella
*
* 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 <ctype.h>
#include <stdint.h>
#include <libretro.h>
#include "var.h"
#include "../retroarch.h"
#include "../core.h"
#include "../verbosity.h"
/*****************************************************************************
Parsing
*****************************************************************************/
static cheevos_var_size_t cheevos_var_parse_prefix(const char** memaddr)
{
/* Careful not to use ABCDEF here, this denotes part of an actual variable! */
const char* str = *memaddr;
cheevos_var_size_t size;
switch (toupper((unsigned char)*str++))
{
case 'M':
size = CHEEVOS_VAR_SIZE_BIT_0;
break;
case 'N':
size = CHEEVOS_VAR_SIZE_BIT_1;
break;
case 'O':
size = CHEEVOS_VAR_SIZE_BIT_2;
break;
case 'P':
size = CHEEVOS_VAR_SIZE_BIT_3;
break;
case 'Q':
size = CHEEVOS_VAR_SIZE_BIT_4;
break;
case 'R':
size = CHEEVOS_VAR_SIZE_BIT_5;
break;
case 'S':
size = CHEEVOS_VAR_SIZE_BIT_6;
break;
case 'T':
size = CHEEVOS_VAR_SIZE_BIT_7;
break;
case 'L':
size = CHEEVOS_VAR_SIZE_NIBBLE_LOWER;
break;
case 'U':
size = CHEEVOS_VAR_SIZE_NIBBLE_UPPER;
break;
case 'H':
size = CHEEVOS_VAR_SIZE_EIGHT_BITS;
break;
case 'X':
size = CHEEVOS_VAR_SIZE_THIRTYTWO_BITS;
break;
default:
str--;
/* fall through */
case ' ':
size = CHEEVOS_VAR_SIZE_SIXTEEN_BITS;
break;
}
*memaddr = str;
return size;
}
static size_t cheevos_var_reduce(size_t addr, size_t mask)
{
while (mask)
{
size_t tmp = (mask - 1) & ~mask;
addr = (addr & tmp) | ((addr >> 1) & ~tmp);
mask = (mask & (mask - 1)) >> 1;
}
return addr;
}
static size_t cheevos_var_highest_bit(size_t n)
{
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
return n ^ (n >> 1);
}
void cheevos_var_parse(cheevos_var_t* var, const char** memaddr)
{
char *end = NULL;
const char *str = *memaddr;
unsigned base = 16;
var->is_bcd = false;
if (toupper((unsigned char)*str) == 'D' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
{
/* d0x + 4 hex digits */
str += 3;
var->type = CHEEVOS_VAR_TYPE_DELTA_MEM;
}
else if (toupper((unsigned char)*str) == 'B' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
{
/* b0x (binary-coded decimal) */
str += 3;
var->is_bcd = true;
var->type = CHEEVOS_VAR_TYPE_ADDRESS;
}
else if (*str == '0' && toupper((unsigned char)str[1]) == 'X')
{
/* 0x + 4 hex digits */
str += 2;
var->type = CHEEVOS_VAR_TYPE_ADDRESS;
}
else
{
var->type = CHEEVOS_VAR_TYPE_VALUE_COMP;
if (toupper((unsigned char)*str) == 'H')
str++;
else
{
if (toupper((unsigned char)*str) == 'V')
str++;
base = 10;
}
}
if (var->type != CHEEVOS_VAR_TYPE_VALUE_COMP)
{
var->size = cheevos_var_parse_prefix(&str);
}
var->value = (unsigned)strtol(str, &end, base);
*memaddr = end;
}
void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console)
{
rarch_system_info_t *system = runloop_get_system_info();
var->bank_id = -1;
if (console == CHEEVOS_CONSOLE_NINTENDO)
{
if (var->value >= 0x0800 && var->value < 0x2000)
{
CHEEVOS_LOG(CHEEVOS_TAG "NES memory address in mirrorred RAM %X, adjusted to %X\n", var->value, var->value & 0x07ff);
var->value &= 0x07ff;
}
}
else if (console == CHEEVOS_CONSOLE_GAMEBOY_COLOR)
{
if (var->value >= 0xe000 && var->value <= 0xfdff)
{
CHEEVOS_LOG(CHEEVOS_TAG "GBC memory address in echo RAM %X, adjusted to %X\n", var->value, var->value - 0x2000);
var->value -= 0x2000;
}
}
if (system->mmaps.num_descriptors != 0)
{
const rarch_memory_descriptor_t *desc = NULL;
const rarch_memory_descriptor_t *end = NULL;
/* Patch the address to correctly map it to the mmaps */
if (console == CHEEVOS_CONSOLE_GAMEBOY_ADVANCE)
{
if (var->value < 0x8000) /* Internal RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x3000000);
var->value += 0x3000000;
}
else /* Work RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "GBA memory address %X adjusted to %X\n", var->value, var->value + 0x2000000 - 0x8000);
var->value += 0x2000000 - 0x8000;
}
}
else if (console == CHEEVOS_CONSOLE_PC_ENGINE)
{
CHEEVOS_LOG(CHEEVOS_TAG "PCE memory address %X adjusted to %X\n", var->value, var->value + 0x1f0000);
var->value += 0x1f0000;
}
else if (console == CHEEVOS_CONSOLE_SUPER_NINTENDO)
{
if (var->value < 0x020000) /* Work RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x7e0000);
var->value += 0x7e0000;
}
else /* Save RAM */
{
CHEEVOS_LOG(CHEEVOS_TAG "SNES memory address %X adjusted to %X\n", var->value, var->value + 0x006000 - 0x020000);
var->value += 0x006000 - 0x020000;
}
}
desc = system->mmaps.descriptors;
end = desc + system->mmaps.num_descriptors;
for (; desc < end; desc++)
{
if (((desc->core.start ^ var->value) & desc->core.select) == 0)
{
unsigned addr = var->value;
var->bank_id = (int)(desc - system->mmaps.descriptors);
var->value = (unsigned)cheevos_var_reduce(
(addr - desc->core.start) & desc->disconnect_mask,
desc->core.disconnect);
if (var->value >= desc->core.len)
var->value -= cheevos_var_highest_bit(var->value);
var->value += desc->core.offset;
CHEEVOS_LOG(CHEEVOS_TAG "address %X set to descriptor %d at offset %X\n", addr, var->bank_id + 1, var->value);
break;
}
}
}
else
{
unsigned i;
for (i = 0; i < 4; i++)
{
retro_ctx_memory_info_t meminfo;
switch (i)
{
case 0:
meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
break;
case 1:
meminfo.id = RETRO_MEMORY_SAVE_RAM;
break;
case 2:
meminfo.id = RETRO_MEMORY_VIDEO_RAM;
break;
case 3:
meminfo.id = RETRO_MEMORY_RTC;
break;
}
core_get_memory(&meminfo);
if (var->value < meminfo.size)
{
var->bank_id = i;
break;
}
/* HACK subtract the correct amount of bytes to reach the save RAM */
if (i == 0 && console == CHEEVOS_CONSOLE_NINTENDO)
var->value -= 0x6000;
else
var->value -= meminfo.size;
}
}
}
/*****************************************************************************
Testing
*****************************************************************************/
uint8_t* cheevos_var_get_memory(const cheevos_var_t* var)
{
rarch_system_info_t *system = NULL;
uint8_t *memory = NULL;
size_t length = 0;
if (var->bank_id < 0)
return NULL;
system = runloop_get_system_info();
if (system->mmaps.num_descriptors != 0)
{
memory = (uint8_t*)system->mmaps.descriptors[var->bank_id].core.ptr;
length = system->mmaps.descriptors[var->bank_id].core.len;
}
else
{
retro_ctx_memory_info_t meminfo = {NULL, 0, 0};
switch (var->bank_id)
{
case 0:
meminfo.id = RETRO_MEMORY_SYSTEM_RAM;
break;
case 1:
meminfo.id = RETRO_MEMORY_SAVE_RAM;
break;
case 2:
meminfo.id = RETRO_MEMORY_VIDEO_RAM;
break;
case 3:
meminfo.id = RETRO_MEMORY_RTC;
break;
default:
CHEEVOS_ERR(CHEEVOS_TAG "invalid bank id: %d\n", var->bank_id);
break;
}
core_get_memory(&meminfo);
memory = (uint8_t*)meminfo.data;
length = meminfo.size;
}
if (memory == NULL || var->value >= length)
return NULL;
return memory + var->value;
}
unsigned cheevos_var_get_value(cheevos_var_t* var)
{
const uint8_t* memory = NULL;
unsigned value = 0;
switch (var->type)
{
case CHEEVOS_VAR_TYPE_VALUE_COMP:
value = var->value;
break;
case CHEEVOS_VAR_TYPE_ADDRESS:
case CHEEVOS_VAR_TYPE_DELTA_MEM:
memory = cheevos_var_get_memory(var);
if (memory)
{
value = memory[0];
switch (var->size)
{
case CHEEVOS_VAR_SIZE_BIT_0:
value &= 1;
break;
case CHEEVOS_VAR_SIZE_BIT_1:
value = (value >> 1) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_2:
value = (value >> 2) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_3:
value = (value >> 3) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_4:
value = (value >> 4) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_5:
value = (value >> 5) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_6:
value = (value >> 6) & 1;
break;
case CHEEVOS_VAR_SIZE_BIT_7:
value = (value >> 7) & 1;
break;
case CHEEVOS_VAR_SIZE_NIBBLE_LOWER:
value &= 0x0f;
break;
case CHEEVOS_VAR_SIZE_NIBBLE_UPPER:
value = (value >> 4) & 0x0f;
break;
case CHEEVOS_VAR_SIZE_EIGHT_BITS:
break;
case CHEEVOS_VAR_SIZE_SIXTEEN_BITS:
value |= memory[1] << 8;
break;
case CHEEVOS_VAR_SIZE_THIRTYTWO_BITS:
value |= memory[1] << 8;
value |= memory[2] << 16;
value |= memory[3] << 24;
break;
}
}
if (var->type == CHEEVOS_VAR_TYPE_DELTA_MEM)
{
unsigned previous = var->previous;
var->previous = value;
value = previous;
}
break;
case CHEEVOS_VAR_TYPE_DYNAMIC_VAR:
/* We shouldn't get here... */
break;
}
if(var->is_bcd)
return (((value >> 4) & 0xf) * 10) + (value & 0xf);
return value;
}

View File

@ -1,78 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2015-2018 - Andre Leiradella
*
* 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/>.
*/
#ifndef __RARCH_CHEEVOS_VAR_H
#define __RARCH_CHEEVOS_VAR_H
#include <stdint.h>
#include "cheevos.h"
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef enum
{
CHEEVOS_VAR_SIZE_BIT_0 = 0,
CHEEVOS_VAR_SIZE_BIT_1,
CHEEVOS_VAR_SIZE_BIT_2,
CHEEVOS_VAR_SIZE_BIT_3,
CHEEVOS_VAR_SIZE_BIT_4,
CHEEVOS_VAR_SIZE_BIT_5,
CHEEVOS_VAR_SIZE_BIT_6,
CHEEVOS_VAR_SIZE_BIT_7,
CHEEVOS_VAR_SIZE_NIBBLE_LOWER,
CHEEVOS_VAR_SIZE_NIBBLE_UPPER,
/* Byte, */
CHEEVOS_VAR_SIZE_EIGHT_BITS, /* =Byte, */
CHEEVOS_VAR_SIZE_SIXTEEN_BITS,
CHEEVOS_VAR_SIZE_THIRTYTWO_BITS
} cheevos_var_size_t;
typedef enum
{
/* compare to the value of a live address in RAM */
CHEEVOS_VAR_TYPE_ADDRESS = 0,
/* a number. assume 32 bit */
CHEEVOS_VAR_TYPE_VALUE_COMP,
/* the value last known at this address. */
CHEEVOS_VAR_TYPE_DELTA_MEM,
/* a custom user-set variable */
CHEEVOS_VAR_TYPE_DYNAMIC_VAR
} cheevos_var_type_t;
typedef struct
{
cheevos_var_size_t size;
cheevos_var_type_t type;
int bank_id;
bool is_bcd;
unsigned value;
unsigned previous;
} cheevos_var_t;
void cheevos_var_parse(cheevos_var_t* var, const char** memaddr);
void cheevos_var_patch_addr(cheevos_var_t* var, cheevos_console_t console);
uint8_t* cheevos_var_get_memory(const cheevos_var_t* var);
unsigned cheevos_var_get_value(cheevos_var_t* var);
RETRO_END_DECLS
#endif /* __RARCH_CHEEVOS_VAR_H */

566
command.c
View File

@ -24,7 +24,6 @@
#include <file/file_path.h>
#include <lists/dir_list.h>
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include <streams/stdin_stream.h>
#ifdef HAVE_CONFIG_H
@ -40,9 +39,7 @@
#endif
#ifdef HAVE_CHEEVOS
#include "cheevos/cheevos.h"
#include "cheevos/var.h"
#include "cheevos-new/cheevos.h" /* RCHEEVOS TODO: remove lines */
#include "cheevos-new/cheevos.h"
#include "cheevos-new/fixup.h"
#endif
@ -290,10 +287,6 @@ bool command_set_shader(const char *arg)
#define SMY_CMD_STR "READ_CORE_RAM"
static bool command_read_ram(const char *arg)
{
/* RCHEEVOS TODO: remove settings init and test */
settings_t *settings = config_get_ptr();
cheevos_var_t var;
unsigned i;
char *reply = NULL;
const uint8_t *data = NULL;
@ -301,37 +294,28 @@ static bool command_read_ram(const char *arg)
unsigned int nbytes = 0;
unsigned int alloc_size = 0;
unsigned int addr = -1;
unsigned int len = 0;
if (sscanf(arg, "%x %u", &addr, &nbytes) != 2)
return true;
alloc_size = 40 + nbytes * 3; /* We alloc more than needed, saving 20 bytes is not really relevant */
alloc_size = 40 + nbytes * 3; /* We allocate more than needed, saving 20 bytes is not really relevant */
reply = (char*) malloc(alloc_size);
reply[0] = '\0';
reply_at = reply + snprintf(reply, alloc_size - 1, SMY_CMD_STR " %x", addr);
/* RCHEEVOS TODO: remove if condition below */
if (!settings->bools.cheevos_old_enable)
data = rcheevos_patch_address(addr, rcheevos_get_console());
/* RCHEEVOS TODO: remove whole else block below */
else
{
var.value = addr;
cheevos_var_patch_addr(&var, cheevos_get_console());
data = cheevos_var_get_memory(&var);
}
if (data)
if ((data = rcheevos_patch_address(addr, rcheevos_get_console())))
{
for (i = 0; i < nbytes; i++)
snprintf(reply_at + 3 * i, 4, " %.2X", data[i]);
reply_at[3 * nbytes] = '\n';
command_reply(reply, reply_at + 3 * nbytes + 1 - reply);
len = reply_at + 3 * nbytes + 1 - reply;
}
else
{
strlcpy(reply_at, " -1\n", sizeof(reply) - strlen(reply));
command_reply(reply, reply_at + STRLEN_CONST(" -1\n") - reply);
len = reply_at + STRLEN_CONST(" -1\n") - reply;
}
command_reply(reply, len);
free(reply);
return true;
}
@ -340,39 +324,18 @@ static bool command_read_ram(const char *arg)
static bool command_write_ram(const char *arg)
{
unsigned nbytes = 0;
uint8_t *data = NULL;
unsigned int addr = 0;
unsigned int addr = strtoul(arg, (char**)&arg, 16);
uint8_t *data = (uint8_t *)rcheevos_patch_address(addr, rcheevos_get_console());
/* RCHEEVOS TODO: remove settings init and test */
settings_t *settings = config_get_ptr();
if (!data)
return false;
if (!settings->bools.cheevos_old_enable)
while (*arg)
{
addr = strtoul(arg, (char**)&arg, 16);
data = (uint8_t *)rcheevos_patch_address(addr, rcheevos_get_console());
*data = strtoul(arg, (char**)&arg, 16);
data++;
}
/* RCHEEVOS TODO: remove the whole else block below */
else
{
cheevos_var_t var;
var.value = strtoul(arg, (char**)&arg, 16);
cheevos_var_patch_addr(&var, cheevos_get_console());
data = cheevos_var_get_memory(&var);
}
if (data)
{
while (*arg)
{
*data = strtoul(arg, (char**)&arg, 16);
data++;
}
return true;
}
return false;
return true;
}
#endif
@ -1119,9 +1082,7 @@ static void command_event_init_controllers(void)
static void command_event_deinit_core(bool reinit)
{
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove settings init and test */
settings_t *settings = config_get_ptr();
!settings->bools.cheevos_old_enable ? rcheevos_unload() : cheevos_unload();
rcheevos_unload();
#endif
RARCH_LOG("Unloading game..\n");
@ -1164,33 +1125,34 @@ static void command_event_load_auto_state(void)
{
bool ret;
char msg[128] = {0};
char *savestate_name_auto = (char*)calloc(PATH_MAX_LENGTH,
sizeof(*savestate_name_auto));
char *savestate_name_auto = NULL;
size_t savestate_name_auto_size = PATH_MAX_LENGTH * sizeof(char);
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
if (!global || !settings->bools.savestate_auto_load)
return;
#ifdef HAVE_CHEEVOS
if (rcheevos_hardcore_active)
return;
#endif
#ifdef HAVE_NETWORKING
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
goto error;
return;
#endif
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove OR below */
if (cheevos_hardcore_active || rcheevos_hardcore_active)
goto error;
#endif
savestate_name_auto = (char*)calloc(PATH_MAX_LENGTH,
sizeof(*savestate_name_auto));
if (!settings->bools.savestate_auto_load)
goto error;
fill_pathname_noext(savestate_name_auto, global->name.savestate,
file_path_str(FILE_PATH_AUTO_EXTENSION),
savestate_name_auto_size);
if (global)
fill_pathname_noext(savestate_name_auto, global->name.savestate,
file_path_str(FILE_PATH_AUTO_EXTENSION),
savestate_name_auto_size);
if (!filestream_exists(savestate_name_auto))
goto error;
if (!path_is_valid(savestate_name_auto))
{
free(savestate_name_auto);
return;
}
ret = content_load_state(savestate_name_auto, false, true);
@ -1203,45 +1165,45 @@ static void command_event_load_auto_state(void)
RARCH_LOG("%s\n", msg);
free(savestate_name_auto);
return;
error:
free(savestate_name_auto);
}
static void command_event_set_savestate_auto_index(void)
{
size_t i;
char *state_dir = (char*)calloc(PATH_MAX_LENGTH, sizeof(*state_dir));
char *state_base = (char*)calloc(PATH_MAX_LENGTH, sizeof(*state_base));
char *state_dir = NULL;
char *state_base = NULL;
size_t state_size = PATH_MAX_LENGTH * sizeof(char);
struct string_list *dir_list = NULL;
unsigned max_idx = 0;
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
if (!settings->bools.savestate_auto_index)
goto error;
if (!global || !settings->bools.savestate_auto_index)
return;
if (global)
{
/* Find the file in the same directory as global->savestate_name
* with the largest numeral suffix.
*
* E.g. /foo/path/content.state, will try to find
* /foo/path/content.state%d, where %d is the largest number available.
*/
fill_pathname_basedir(state_dir, global->name.savestate,
state_size);
fill_pathname_base(state_base, global->name.savestate,
state_size);
}
state_dir = (char*)calloc(PATH_MAX_LENGTH, sizeof(*state_dir));
/* Find the file in the same directory as global->savestate_name
* with the largest numeral suffix.
*
* E.g. /foo/path/content.state, will try to find
* /foo/path/content.state%d, where %d is the largest number available.
*/
fill_pathname_basedir(state_dir, global->name.savestate,
state_size);
dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN, NULL);
free(state_dir);
if (!dir_list)
goto error;
return;
state_base = (char*)calloc(PATH_MAX_LENGTH, sizeof(*state_base));
fill_pathname_base(state_base, global->name.savestate,
state_size);
for (i = 0; i < dir_list->size; i++)
{
@ -1265,29 +1227,19 @@ static void command_event_set_savestate_auto_index(void)
}
dir_list_free(dir_list);
free(state_base);
configuration_set_int(settings, settings->ints.state_slot, max_idx);
RARCH_LOG("%s: #%d\n",
msg_hash_to_str(MSG_FOUND_LAST_STATE_SLOT),
max_idx);
free(state_dir);
free(state_base);
return;
error:
free(state_dir);
free(state_base);
}
static bool event_init_content(void)
{
bool contentless = false;
bool is_inited = false;
settings_t *settings = config_get_ptr();
content_get_status(&contentless, &is_inited);
rarch_ctl(RARCH_CTL_SET_SRAM_ENABLE, NULL);
@ -1297,6 +1249,7 @@ static bool event_init_content(void)
return true;
content_set_subsystem_info();
content_get_status(&contentless, &is_inited);
if (!contentless)
path_fill_names();
@ -1304,8 +1257,6 @@ static bool event_init_content(void)
if (!content_init())
return false;
content_get_status(&contentless, &is_inited);
command_event_set_savestate_auto_index();
if (event_load_save_files())
@ -1313,13 +1264,19 @@ static bool event_init_content(void)
msg_hash_to_str(MSG_SKIPPING_SRAM_LOAD));
/*
Since the operations are asynchronouse we can't guarantee users will not use auto_load_state to cheat on
achievements so we forbid auto_load_state from happening if cheevos_enable and cheevos_hardcode_mode_enable
are true
Since the operations are asynchronous we can't
guarantee users will not use auto_load_state to cheat on
achievements so we forbid auto_load_state from happening
if cheevos_enable and cheevos_hardcode_mode_enable
are true.
*/
#ifdef HAVE_CHEEVOS
if (!settings->bools.cheevos_enable || !settings->bools.cheevos_hardcore_mode_enable)
command_event_load_auto_state();
{
settings_t *settings = config_get_ptr();
if ( !settings->bools.cheevos_enable ||
!settings->bools.cheevos_hardcore_mode_enable)
command_event_load_auto_state();
}
#else
command_event_load_auto_state();
#endif
@ -1408,31 +1365,30 @@ static bool command_event_save_auto_state(void)
bool ret = false;
bool contentless = false;
bool is_inited = false;
char *savestate_name_auto = (char*)
calloc(PATH_MAX_LENGTH, sizeof(*savestate_name_auto));
char *savestate_name_auto = NULL;
size_t
savestate_name_auto_size = PATH_MAX_LENGTH * sizeof(char);
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
if (!settings || !settings->bools.savestate_auto_save)
goto error;
if (!global)
goto error;
if (!global || !settings || !settings->bools.savestate_auto_save)
return false;
if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
goto error;
return false;
content_get_status(&contentless, &is_inited);
if (contentless)
goto error;
return false;
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove OR below */
if (cheevos_hardcore_active || rcheevos_hardcore_active)
goto error;
if (rcheevos_hardcore_active)
return false;
#endif
savestate_name_auto = (char*)
calloc(PATH_MAX_LENGTH, sizeof(*savestate_name_auto));
fill_pathname_noext(savestate_name_auto, global->name.savestate,
file_path_str(FILE_PATH_AUTO_EXTENSION),
savestate_name_auto_size);
@ -1445,10 +1401,6 @@ static bool command_event_save_auto_state(void)
free(savestate_name_auto);
return true;
error:
free(savestate_name_auto);
return false;
}
static bool command_event_save_config(
@ -1557,7 +1509,7 @@ static bool command_event_save_core_config(void)
sizeof(tmp));
strlcat(config_path, tmp, config_size);
if (!filestream_exists(config_path))
if (!path_is_valid(config_path))
{
found_path = true;
break;
@ -1729,9 +1681,6 @@ static bool command_event_main_state(unsigned cmd)
if (content_load_state(state_path, false, false))
{
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove duplication below */
if (cheevos_hardcore_active)
cheevos_state_loaded_flag = true;
if (rcheevos_hardcore_active)
rcheevos_state_loaded_flag = true;
#endif
@ -1800,6 +1749,55 @@ bool command_event(enum event_command cmd, void *data)
switch (cmd)
{
case CMD_EVENT_CHEAT_INDEX_PLUS:
cheat_manager_index_next();
break;
case CMD_EVENT_CHEAT_INDEX_MINUS:
cheat_manager_index_prev();
break;
case CMD_EVENT_CHEAT_TOGGLE:
cheat_manager_toggle();
break;
case CMD_EVENT_SHADER_NEXT:
dir_check_shader(true, false);
break;
case CMD_EVENT_SHADER_PREV:
dir_check_shader(false, true);
break;
case CMD_EVENT_BSV_RECORDING_TOGGLE:
if (!recording_is_enabled())
command_event(CMD_EVENT_RECORD_INIT, NULL);
else
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
bsv_movie_check();
break;
case CMD_EVENT_AI_SERVICE_TOGGLE:
/* TODO/FIXME - implement */
break;
case CMD_EVENT_STREAMING_TOGGLE:
if (streaming_is_enabled())
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
else
{
streaming_set_state(true);
command_event(CMD_EVENT_RECORD_INIT, NULL);
}
break;
case CMD_EVENT_RECORDING_TOGGLE:
if (recording_is_enabled())
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
else
command_event(CMD_EVENT_RECORD_INIT, NULL);
break;
case CMD_EVENT_OSK_TOGGLE:
if (input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_IS_LINEFEED_ENABLED, NULL))
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_UNSET_LINEFEED_ENABLED, NULL);
else
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_SET_LINEFEED_ENABLED, NULL);
break;
case CMD_EVENT_SET_PER_GAME_RESOLUTION:
#if defined(GEKKO)
{
@ -1842,9 +1840,9 @@ bool command_event(enum event_command cmd, void *data)
#endif
if (!libretro_get_system_info(
core_path,
system,
&system_info->load_no_content))
core_path,
system,
&system_info->load_no_content))
return false;
info_find.path = core_path;
@ -1858,21 +1856,21 @@ bool command_event(enum event_command cmd, void *data)
}
break;
case CMD_EVENT_LOAD_CORE:
{
bool success = false;
subsystem_current_count = 0;
content_clear_subsystem();
success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
(void)success;
{
bool success = false;
subsystem_current_count = 0;
content_clear_subsystem();
success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
(void)success;
#ifndef HAVE_DYNAMIC
command_event(CMD_EVENT_QUIT, NULL);
command_event(CMD_EVENT_QUIT, NULL);
#else
if (!success)
return false;
if (!success)
return false;
#endif
break;
}
break;
}
case CMD_EVENT_LOAD_STATE:
/* Immutable - disallow savestate load when
* we absolutely cannot change game state. */
@ -1880,8 +1878,7 @@ bool command_event(enum event_command cmd, void *data)
return false;
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove OR below */
if (cheevos_hardcore_active || rcheevos_hardcore_active)
if (rcheevos_hardcore_active)
return false;
#endif
if (!command_event_main_state(cmd))
@ -1911,28 +1908,24 @@ bool command_event(enum event_command cmd, void *data)
command_event_init_controllers();
break;
case CMD_EVENT_RESET:
/* RCHEEVOS TODO: remove starting block bracket, settings init and tests */
{
#ifdef HAVE_CHEEVOS
settings_t *settings = config_get_ptr();
rcheevos_state_loaded_flag = cheevos_state_loaded_flag = false;
rcheevos_hardcore_paused = cheevos_hardcore_paused = false;
rcheevos_state_loaded_flag = false;
rcheevos_hardcore_paused = false;
#endif
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_RESET));
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
RARCH_LOG("%s.\n", msg_hash_to_str(MSG_RESET));
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET), 1, 120, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
#ifdef HAVE_CHEEVOS
!settings->bools.cheevos_old_enable ? rcheevos_set_cheats() : cheevos_set_cheats();
rcheevos_set_cheats();
#endif
core_reset();
core_reset();
#ifdef HAVE_CHEEVOS
!settings->bools.cheevos_old_enable ? rcheevos_reset_game() : cheevos_reset_game();
rcheevos_reset_game();
#endif
#if HAVE_NETWORKING
netplay_driver_ctl(RARCH_NETPLAY_CTL_RESET, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_RESET, NULL);
#endif
return false;
}
return false;
case CMD_EVENT_SAVE_STATE:
{
settings_t *settings = config_get_ptr();
@ -2019,15 +2012,11 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE:
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove starting block bracket, settings init and test */
{
settings_t *settings = config_get_ptr();
!settings->bools.cheevos_old_enable ? rcheevos_toggle_hardcore_mode() : cheevos_toggle_hardcore_mode();
}
rcheevos_toggle_hardcore_mode();
#endif
break;
/* this fallthrough is on purpose, it should do
a CMD_EVENT_REINIT too */
/* this fallthrough is on purpose, it should do
a CMD_EVENT_REINIT too */
case CMD_EVENT_REINIT_FROM_TOGGLE:
retroarch_unset_forced_fullscreen();
case CMD_EVENT_REINIT:
@ -2064,8 +2053,7 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_REWIND_DEINIT:
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove OR below */
if (cheevos_hardcore_active || rcheevos_hardcore_active)
if (rcheevos_hardcore_active)
return false;
#endif
state_manager_event_deinit();
@ -2074,8 +2062,7 @@ bool command_event(enum event_command cmd, void *data)
{
settings_t *settings = config_get_ptr();
#ifdef HAVE_CHEEVOS
/* RCHEEVOS TODO: remove OR below */
if (cheevos_hardcore_active || rcheevos_hardcore_active)
if (rcheevos_hardcore_active)
return false;
#endif
if (settings->bools.rewind_enable)
@ -2110,21 +2097,21 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_AUTOSAVE_INIT:
command_event(CMD_EVENT_AUTOSAVE_DEINIT, NULL);
#ifdef HAVE_THREADS
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
settings_t *settings = config_get_ptr();
if (settings->uints.autosave_interval != 0
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
{
if (autosave_init())
runloop_set(RUNLOOP_ACTION_AUTOSAVE);
else
runloop_unset(RUNLOOP_ACTION_AUTOSAVE);
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
settings_t *settings = config_get_ptr();
if (settings->uints.autosave_interval != 0
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
{
if (autosave_init())
runloop_set(RUNLOOP_ACTION_AUTOSAVE);
else
runloop_unset(RUNLOOP_ACTION_AUTOSAVE);
}
}
}
#endif
break;
case CMD_EVENT_AUTOSAVE_STATE:
@ -2179,9 +2166,9 @@ TODO: Add a setting for these tweaks */
{
#if defined(GEKKO)
/* Avoid a crash at startup or even when toggling overlay in rgui */
uint64_t memory_used = frontend_driver_get_used_memory();
if(memory_used > (72 * 1024 * 1024))
break;
uint64_t memory_used = frontend_driver_get_used_memory();
if(memory_used > (72 * 1024 * 1024))
break;
#endif
settings_t *settings = config_get_ptr();
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
@ -2406,10 +2393,8 @@ TODO: Add a setting for these tweaks */
}
break;
case CMD_EVENT_AUDIO_REINIT:
{
driver_uninit(DRIVER_AUDIO_MASK);
drivers_init(DRIVER_AUDIO_MASK);
}
driver_uninit(DRIVER_AUDIO_MASK);
drivers_init(DRIVER_AUDIO_MASK);
break;
case CMD_EVENT_RESET_CONTEXT:
{
@ -2451,53 +2436,53 @@ TODO: Add a setting for these tweaks */
ui_companion_driver_toggle(false);
break;
case CMD_EVENT_ADD_TO_FAVORITES:
{
struct string_list *str_list = (struct string_list*)data;
if (str_list)
{
if (str_list->size >= 6)
struct string_list *str_list = (struct string_list*)data;
if (str_list)
{
struct playlist_entry entry = {0};
if (str_list->size >= 6)
{
struct playlist_entry entry = {0};
entry.path = str_list->elems[0].data; /* content_path */
entry.label = str_list->elems[1].data; /* content_label */
entry.core_path = str_list->elems[2].data; /* core_path */
entry.core_name = str_list->elems[3].data; /* core_name */
entry.crc32 = str_list->elems[4].data; /* crc32 */
entry.db_name = str_list->elems[5].data; /* db_name */
entry.path = str_list->elems[0].data; /* content_path */
entry.label = str_list->elems[1].data; /* content_label */
entry.core_path = str_list->elems[2].data; /* core_path */
entry.core_name = str_list->elems[3].data; /* core_name */
entry.crc32 = str_list->elems[4].data; /* crc32 */
entry.db_name = str_list->elems[5].data; /* db_name */
/* Write playlist entry */
command_playlist_push_write(
g_defaults.content_favorites,
&entry
);
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
/* Write playlist entry */
command_playlist_push_write(
g_defaults.content_favorites,
&entry
);
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}
break;
}
break;
}
case CMD_EVENT_RESET_CORE_ASSOCIATION:
{
const char *core_name = "DETECT";
const char *core_path = "DETECT";
size_t *playlist_index = (size_t*)data;
struct playlist_entry entry = {0};
{
const char *core_name = "DETECT";
const char *core_path = "DETECT";
size_t *playlist_index = (size_t*)data;
struct playlist_entry entry = {0};
/* the update function reads our entry as const, so these casts are safe */
entry.core_path = (char*)core_path;
entry.core_name = (char*)core_name;
/* the update function reads our entry as const, so these casts are safe */
entry.core_path = (char*)core_path;
entry.core_name = (char*)core_name;
command_playlist_update_write(
NULL,
*playlist_index,
&entry);
command_playlist_update_write(
NULL,
*playlist_index,
&entry);
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
}
}
case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false;
@ -2567,7 +2552,7 @@ TODO: Add a setting for these tweaks */
if (settings->bools.translation_service_enable)
{
#ifdef HAVE_TRANSLATE
if (g_translation_service_status == false)
if (!g_translation_service_status)
{
RARCH_LOG("OCR START\n");
run_translation_service();
@ -2650,6 +2635,9 @@ TODO: Add a setting for these tweaks */
bsv_movie_init();
break;
#ifdef HAVE_NETWORKING
case CMD_EVENT_NETPLAY_GAME_WATCH:
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
break;
case CMD_EVENT_NETPLAY_DEINIT:
deinit_netplay();
break;
@ -2659,7 +2647,7 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_NETWORK_INIT:
network_init();
break;
/* init netplay manually */
/* init netplay manually */
case CMD_EVENT_NETPLAY_INIT:
{
char *hostname = (char *) data;
@ -2668,22 +2656,22 @@ TODO: Add a setting for these tweaks */
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
if (!init_netplay(NULL, hostname ? hostname :
settings->paths.netplay_server,
settings->uints.netplay_port))
settings->paths.netplay_server,
settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
return false;
}
/* Disable rewind & sram autosave if it was enabled
TODO: Add a setting for these tweaks */
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
autosave_deinit();
#endif
}
break;
/* init netplay via lobby when content is loaded */
/* init netplay via lobby when content is loaded */
case CMD_EVENT_NETPLAY_INIT_DIRECT:
{
/* buf is expected to be address|port */
@ -2698,12 +2686,12 @@ TODO: Add a setting for these tweaks */
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d (direct)\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
string_list_free(hostname);
@ -2713,14 +2701,14 @@ TODO: Add a setting for these tweaks */
string_list_free(hostname);
/* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
autosave_deinit();
#endif
}
break;
/* init netplay via lobby when content is not loaded */
/* init netplay via lobby when content is not loaded */
case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED:
{
static struct string_list *hostname = NULL;
@ -2730,17 +2718,17 @@ TODO: Add a setting for these tweaks */
RARCH_LOG("[netplay] buf %s\n", buf);
hostname = string_split(buf, "|");
hostname = string_split(buf, "|");
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d (deferred)\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
if (!init_netplay_deferred(hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
string_list_free(hostname);
@ -2750,67 +2738,64 @@ TODO: Add a setting for these tweaks */
string_list_free(hostname);
/* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
autosave_deinit();
#endif
}
break;
case CMD_EVENT_NETPLAY_GAME_WATCH:
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
break;
case CMD_EVENT_NETPLAY_ENABLE_HOST:
{
#ifdef HAVE_MENU
bool contentless = false;
bool is_inited = false;
content_get_status(&contentless, &is_inited);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
/* If we haven't yet started, this will load on its own */
if (!is_inited)
{
runloop_msg_queue_push(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false;
}
#ifdef HAVE_MENU
bool contentless = false;
bool is_inited = false;
/* Enable Netplay itself */
if (!command_event(CMD_EVENT_NETPLAY_INIT, NULL))
return false;
content_get_status(&contentless, &is_inited);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
/* If we haven't yet started, this will load on its own */
if (!is_inited)
{
runloop_msg_queue_push(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false;
}
/* Enable Netplay itself */
if (!command_event(CMD_EVENT_NETPLAY_INIT, NULL))
return false;
#endif
break;
}
break;
}
case CMD_EVENT_NETPLAY_DISCONNECT:
{
settings_t *settings = config_get_ptr();
{
settings_t *settings = config_get_ptr();
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISCONNECT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISABLE, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISCONNECT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISABLE, NULL);
/* Re-enable rewind if it was enabled
TODO: Add a setting for these tweaks */
if (settings->bools.rewind_enable)
command_event(CMD_EVENT_REWIND_INIT, NULL);
if (settings->uints.autosave_interval != 0)
command_event(CMD_EVENT_AUTOSAVE_INIT, NULL);
/* Re-enable rewind if it was enabled
TODO: Add a setting for these tweaks */
if (settings->bools.rewind_enable)
command_event(CMD_EVENT_REWIND_INIT, NULL);
if (settings->uints.autosave_interval != 0)
command_event(CMD_EVENT_AUTOSAVE_INIT, NULL);
break;
}
break;
}
case CMD_EVENT_NETPLAY_HOST_TOGGLE:
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL);
else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL))
!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL))
command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL);
else
command_event(CMD_EVENT_NETPLAY_ENABLE_HOST, NULL);
@ -2823,7 +2808,6 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_NETPLAY_INIT:
case CMD_EVENT_NETPLAY_INIT_DIRECT:
case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED:
case CMD_EVENT_NETPLAY_GAME_WATCH:
case CMD_EVENT_NETPLAY_HOST_TOGGLE:
case CMD_EVENT_NETPLAY_DISCONNECT:
case CMD_EVENT_NETPLAY_ENABLE_HOST:
@ -3013,9 +2997,9 @@ TODO: Add a setting for these tweaks */
* any other: toggle
*/
if (mode == 1)
game_focus_state = true;
game_focus_state = true;
else if (mode != -1)
game_focus_state = !game_focus_state;
game_focus_state = !game_focus_state;
RARCH_LOG("%s: %s.\n",
"Game focus is: ",

View File

@ -245,7 +245,17 @@ enum event_command
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET,
CMD_EVENT_DISCORD_INIT,
CMD_EVENT_DISCORD_DEINIT,
CMD_EVENT_DISCORD_UPDATE
CMD_EVENT_DISCORD_UPDATE,
CMD_EVENT_OSK_TOGGLE,
CMD_EVENT_RECORDING_TOGGLE,
CMD_EVENT_STREAMING_TOGGLE,
CMD_EVENT_AI_SERVICE_TOGGLE,
CMD_EVENT_BSV_RECORDING_TOGGLE,
CMD_EVENT_SHADER_NEXT,
CMD_EVENT_SHADER_PREV,
CMD_EVENT_CHEAT_INDEX_PLUS,
CMD_EVENT_CHEAT_INDEX_MINUS,
CMD_EVENT_CHEAT_TOGGLE
};
bool command_set_shader(const char *arg);

View File

@ -54,9 +54,9 @@
#endif
#if defined(RARCH_MOBILE) || defined(HAVE_LIBNX)
static const bool pointer_enable = true;
#define DEFAULT_POINTER_ENABLE true
#else
static const bool pointer_enable = false;
#define DEFAULT_POINTER_ENABLE false
#endif
/* Certain platforms might have assets stored in the bundle that
@ -64,13 +64,13 @@ static const bool pointer_enable = false;
*
* Examples include: Android, iOS/OSX) */
#if defined(ANDROID) || defined(IOS)
static bool bundle_assets_extract_enable = true;
#define DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE true
#else
static bool bundle_assets_extract_enable = false;
#define DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE false
#endif
#ifdef HAVE_MATERIALUI
static bool materialui_icons_enable = true;
#define DEFAULT_MATERIALUI_ICONS_ENABLE true
#endif
static const unsigned crt_switch_resolution = CRT_SWITCH_NONE;
@ -78,19 +78,18 @@ static const int crt_switch_resolution_super = 2560;
static const int crt_switch_center_adjust = 0;
static const bool def_history_list_enable = true;
static const bool def_playlist_entry_remove = true;
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)) || defined(EMSCRIPTEN)
static const bool def_mouse_enable = true;
#define DEFAULT_MOUSE_ENABLE true
#else
static const bool def_mouse_enable = false;
#define DEFAULT_MOUSE_ENABLE false
#endif
#ifdef HAVE_CHEEVOS
static const bool cheevos_enable = false;
#define DEFAULT_CHEEVOS_ENABLE false
#endif
/* VIDEO */
@ -105,181 +104,184 @@ static const bool cheevos_enable = false;
* Real x resolution = aspect * base_size * x scale
* Real y resolution = base_size * y scale
*/
static const float scale = 3.0;
#define DEFAULT_SCALE (3.0)
/* Fullscreen */
/* To start in Fullscreen, or not. */
static const bool fullscreen = false;
#define DEFAULT_FULLSCREEN false
/* To use windowed mode or not when going fullscreen. */
static const bool windowed_fullscreen = true;
#define DEFAULT_WINDOWED_FULLSCREEN true
/* Which monitor to prefer. 0 is any monitor, 1 and up selects
* specific monitors, 1 being the first monitor. */
static const unsigned monitor_index = 0;
#define DEFAULT_MONITOR_INDEX 0
/* Window */
/* Window size. A value of 0 uses window scale
* multiplied by the core framebuffer size. */
static const unsigned window_width = 1280;
static const unsigned window_height = 720;
#define DEFAULT_WINDOW_WIDTH 1280
#define DEFAULT_WINDOW_HEIGHT 720
/* Fullscreen resolution. A value of 0 uses the desktop
* resolution. */
static const unsigned fullscreen_x = 0;
static const unsigned fullscreen_y = 0;
#define DEFAULT_FULLSCREEN_X 0
#define DEFAULT_FULLSCREEN_Y 0
/* Number of threads to use for video recording */
static const unsigned video_record_threads = 2;
#define DEFAULT_VIDEO_RECORD_THREADS 2
/* Amount of transparency to use for the main window.
* 1 is the most transparent while 100 is opaque.
*/
static const unsigned window_opacity = 100;
#define DEFAULT_WINDOW_OPACITY 100
/* Whether to show the usual window decorations like border, titlebar etc. */
static const bool window_decorations = true;
#define DEFAULT_WINDOW_DECORATIONS true
#if defined(RARCH_CONSOLE) || defined(__APPLE__)
static const bool load_dummy_on_core_shutdown = false;
#define DEFAULT_LOAD_DUMMY_ON_CORE_SHUTDOWN false
#else
static const bool load_dummy_on_core_shutdown = true;
#define DEFAULT_LOAD_DUMMY_ON_CORE_SHUTDOWN true
#endif
static const bool check_firmware_before_loading = false;
#define DEFAULT_CHECK_FIRMWARE_BEFORE_LOADING false
/* Forcibly disable composition.
* Only valid on Windows Vista/7/8 for now. */
static const bool disable_composition = false;
#define DEFAULT_DISABLE_COMPOSITION false
/* Video VSYNC (recommended) */
static const bool vsync = true;
#define DEFAULT_VSYNC false
static const unsigned max_swapchain_images = 3;
#define DEFAULT_MAX_SWAPCHAIN_IMAGES 3
static const bool adaptive_vsync = false;
#define DEFAULT_ADAPTIVE_VSYNC false
/* Attempts to hard-synchronize CPU and GPU.
* Can reduce latency at cost of performance. */
static const bool hard_sync = false;
#define DEFAULT_HARD_SYNC false
/* Configures how many frames the GPU can run ahead of CPU.
* 0: Syncs to GPU immediately.
* 1: Syncs to previous frame.
* 2: Etc ...
*/
static const unsigned hard_sync_frames = 0;
#define DEFAULT_HARD_SYNC_FRAMES 0
/* Sets how many milliseconds to delay after VSync before running the core.
* Can reduce latency at cost of higher risk of stuttering.
*/
static const unsigned frame_delay = 0;
#define DEFAULT_FRAME_DELAY 0
/* Inserts a black frame inbetween frames.
* Useful for 120 Hz monitors who want to play 60 Hz material with eliminated
* ghosting. video_refresh_rate should still be configured as if it
* is a 60 Hz monitor (divide refresh rate by 2).
*/
static bool black_frame_insertion = false;
#define DEFAULT_BLACK_FRAME_INSERTION false
/* Uses a custom swap interval for VSync.
* Set this to effectively halve monitor refresh rate.
*/
static unsigned swap_interval = 1;
#define DEFAULT_SWAP_INTERVAL 1
/* Threaded video. Will possibly increase performance significantly
* at the cost of worse synchronization and latency.
*/
#if defined(HAVE_LIBNX)
static const bool video_threaded = true;
#define DEFAULT_VIDEO_THREADED true
#else
static const bool video_threaded = false;
#define DEFAULT_VIDEO_THREADED false
#endif
#if defined(HAVE_THREADS)
#if defined(GEKKO) || defined(PSP) || defined(PS2)
/* For single-core consoles right now it's better to have this be disabled. */
static const bool threaded_data_runloop_enable = false;
/* For single-core consoles right now it's best to have this be disabled. */
#define DEFAULT_THREADED_DATA_RUNLOOP_ENABLE false
#else
static const bool threaded_data_runloop_enable = true;
#define DEFAULT_THREADED_DATA_RUNLOOP_ENABLE true
#endif
#else
static const bool threaded_data_runloop_enable = false;
#define DEFAULT_THREADED_DATA_RUNLOOP_ENABLE false
#endif
/* Set to true if HW render cores should get their private context. */
static const bool video_shared_context = false;
#define DEFAULT_VIDEO_SHARED_CONTEXT false
/* Sets GC/Wii screen width. */
static const unsigned video_viwidth = 640;
#define DEFAULT_VIDEO_VI_WIDTH 640
#ifdef GEKKO
/* Removes 480i flicker, smooths picture a little. */
static const bool video_vfilter = true;
#define DEFAULT_VIDEO_VFILTER true
/* Allow overscan to be corrected on displays that
* do not have proper 'pixel perfect' scaling */
#define DEFAULT_VIDEO_OVERSCAN_CORRECTION_TOP 0
#define DEFAULT_VIDEO_OVERSCAN_CORRECTION_BOTTOM 0
#endif
/* Smooths picture. */
static const bool video_smooth = true;
#define DEFAULT_VIDEO_SMOOTH true
/* On resize and fullscreen, rendering area will stay 4:3 */
static const bool force_aspect = true;
#define DEFAULT_FORCE_ASPECT true
/* Enable use of shaders. */
#ifdef RARCH_CONSOLE
static const bool shader_enable = true;
#define DEFAULT_SHADER_ENABLE true
#else
static const bool shader_enable = false;
#define DEFAULT_SHADER_ENABLE false
#endif
/* Only scale in integer steps.
* The base size depends on system-reported geometry and aspect ratio.
* If video_force_aspect is not set, X/Y will be integer scaled independently.
*/
static const bool scale_integer = false;
#define DEFAULT_SCALE_INTEGER false
/* Controls aspect ratio handling. */
/* Automatic */
static const float aspect_ratio = DEFAULT_ASPECT_RATIO;
/* 1:1 PAR */
static const bool aspect_ratio_auto = false;
#define DEFAULT_ASPECT_RATIO_AUTO false
#if defined(__CELLOS_LV2) || defined(_XBOX360)
static unsigned aspect_ratio_idx = ASPECT_RATIO_16_9;
#define DEFAULT_ASPECT_RATIO_IDX ASPECT_RATIO_16_9
#elif defined(PSP)
static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE;
#define DEFAULT_ASPECT_RATIO_IDX ASPECT_RATIO_CORE
#elif defined(_3DS)
/* Previously defaulted to ASPECT_RATIO_4_3.
* Non-4:3 content looks dreadful when stretched
* to 4:3 on the 3DS screen... */
static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE;
#define DEFAULT_ASPECT_RATIO_IDX ASPECT_RATIO_CORE
#elif defined(RARCH_CONSOLE)
static unsigned aspect_ratio_idx = ASPECT_RATIO_4_3;
#define DEFAULT_ASPECT_RATIO_IDX ASPECT_RATIO_4_3
#else
static unsigned aspect_ratio_idx = ASPECT_RATIO_CORE;
#define DEFAULT_ASPECT_RATIO_IDX ASPECT_RATIO_CORE
#endif
/* Save configuration file on exit. */
static bool config_save_on_exit = true;
#define DEFAULT_CONFIG_SAVE_ON_EXIT true
static bool show_hidden_files = false;
#define DEFAULT_SHOW_HIDDEN_FILES false
static const bool overlay_hide_in_menu = true;
#define DEFAULT_OVERLAY_HIDE_IN_MENU true
#define DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR true
static const bool display_keyboard_overlay = false;
#define DEFAULT_DISPLAY_KEYBOARD_OVERLAY false
#ifdef HAKCHI
static const float default_input_overlay_opacity = 0.5f;
#define DEFAULT_INPUT_OVERLAY_OPACITY 0.5f
#else
static const float default_input_overlay_opacity = 0.7f;
#define DEFAULT_INPUT_OVERLAY_OPACITY 0.7f
#endif
#ifdef HAVE_MENU
#include "menu/menu_driver.h"
#include "menu/menu_animation.h"
static bool default_block_config_read = true;
#define DEFAULT_BLOCK_CONFIG_READ true
#ifdef HAVE_LIBNX
static bool menu_use_preferred_system_color_theme = true;
@ -322,6 +324,7 @@ static bool menu_show_information = true;
static bool menu_show_configurations = true;
static bool menu_show_help = true;
static bool menu_show_quit_retroarch = true;
static bool menu_show_restart_retroarch = true;
static bool menu_show_reboot = true;
static bool menu_show_shutdown = true;
#if defined(HAVE_LAKKA) || defined(VITA) || defined(_3DS)
@ -369,8 +372,6 @@ static bool xmb_shadows_enable = true;
#endif
#endif
static bool automatically_add_content_to_playlist = false;
static float menu_framebuffer_opacity = 0.900;
static float menu_wallpaper_opacity = 0.300;
@ -401,10 +402,11 @@ static unsigned rgui_particle_effect = RGUI_PARTICLE_EFFECT_NONE;
static bool rgui_extended_ascii = false;
#else
static bool default_block_config_read = false;
static bool automatically_add_content_to_playlist = false;
#define DEFAULT_BLOCK_CONFIG_READ false
#endif
static bool automatically_add_content_to_playlist = false;
static bool default_game_specific_options = true;
static bool default_auto_overrides_enable = true;
static bool default_auto_remaps_enable = true;
@ -455,13 +457,13 @@ static bool default_log_to_file = false;
static bool log_to_file_timestamp = false;
/* Crop overscanned frames. */
static const bool crop_overscan = true;
#define DEFAULT_CROP_OVERSCAN true
/* Font size for on-screen messages. */
#if defined(HAVE_LIBDBGFONT)
static const float font_size = 1.0f;
#define DEFAULT_FONT_SIZE 1.0f
#else
static const float font_size = 32;
#define DEFAULT_FONT_SIZE 32
#endif
/* Offset for where messages will be placed on-screen.
@ -535,7 +537,7 @@ static const unsigned video_3ds_display_mode = CTR_VIDEO_MODE_3D;
/* AUDIO */
/* Will enable audio or not. */
static const bool audio_enable = true;
#define DEFAULT_AUDIO_ENABLE true
/* Enable menu audio sounds. */
static const bool audio_enable_menu = false;
@ -552,11 +554,11 @@ static const bool menu_enable_widgets = false;
/* Output samplerate. */
#ifdef GEKKO
static const unsigned out_rate = 32000;
#define DEFAULT_OUTPUT_RATE 32000
#elif defined(_3DS)
static const unsigned out_rate = 32730;
#define DEFAULT_OUTPUT_RATE 32730
#else
static const unsigned out_rate = 48000;
#define DEFAULT_OUTPUT_RATE 48000
#endif
/* Audio device (e.g. hw:0,0 or /dev/audio). If NULL, will use defaults. */
@ -566,34 +568,34 @@ static const char *audio_device = NULL;
* if driver can't provide given latency. */
#if defined(ANDROID) || defined(EMSCRIPTEN)
/* For most Android devices, 64ms is way too low. */
static const int out_latency = 128;
#define DEFAULT_OUT_LATENCY 128
#else
static const int out_latency = 64;
#define DEFAULT_OUT_LATENCY 64
#endif
/* Will sync audio. (recommended) */
static const bool audio_sync = true;
#define DEFAULT_AUDIO_SYNC true
/* Audio rate control. */
#if !defined(RARCH_CONSOLE)
static const bool rate_control = true;
#define DEFAULT_RATE_CONTROL true
#else
static const bool rate_control = false;
#define DEFAULT_RATE_CONTROL false
#endif
/* Rate control delta. Defines how much rate_control
* is allowed to adjust input rate. */
static const float rate_control_delta = 0.005;
#define DEFAULT_RATE_CONTROL_DELTA 0.005
/* Maximum timing skew. Defines how much adjust_system_rates
* is allowed to adjust input rate. */
static const float max_timing_skew = 0.05;
#define DEFAULT_MAX_TIMING_SKEW 0.05
/* Default audio volume in dB. (0.0 dB == unity gain). */
static const float audio_volume = 0.0;
#define DEFAULT_AUDIO_VOLUME 0.0
/* Default audio volume of the audio mixer in dB. (0.0 dB == unity gain). */
static const float audio_mixer_volume = 0.0;
#define DEFAULT_AUDIO_MIXER_VOLUME 0.0
#ifdef HAVE_WASAPI
/* WASAPI defaults */
@ -605,56 +607,56 @@ static const int wasapi_sh_buffer_length = -16; /* auto */
/* MISC */
/* Enables displaying the current frames per second. */
static const bool fps_show = false;
#define DEFAULT_FPS_SHOW false
/* Enables displaying the current frame count. */
static const bool framecount_show = false;
#define DEFAULT_FRAMECOUNT_SHOW false
/* Includes displaying the current memory usage/total with FPS/Frames. */
static const bool memory_show = false;
#define DEFAULT_MEMORY_SHOW false
/* Enables displaying various timing statistics. */
static const bool statistics_show = false;
#define DEFAULT_STATISTICS_SHOW false
/* Enables use of rewind. This will incur some memory footprint
* depending on the save state buffer. */
static const bool rewind_enable = false;
#define DEFAULT_REWIND_ENABLE false
/* When set, any time a cheat is toggled it is immediately applied. */
static const bool apply_cheats_after_toggle = false;
#define DEFAULT_APPLY_CHEATS_AFTER_TOGGLE false
/* When set, all enabled cheats are auto-applied when a game is loaded. */
static const bool apply_cheats_after_load = false;
#define DEFAULT_APPLY_CHEATS_AFTER_LOAD false
/* The buffer size for the rewind buffer. This needs to be about
* 15-20MB per minute. Very game dependant. */
static const unsigned rewind_buffer_size = 20 << 20; /* 20MiB */
#define DEFAULT_REWIND_BUFFER_SIZE (20 << 20) /* 20MiB */
/* The amount of MB to increase/decrease the rewind_buffer_size when it is changed via the UI. */
static const unsigned rewind_buffer_size_step = 10; /* 10MB */
#define DEFAULT_REWIND_BUFFER_SIZE_STEP 10 /* 10MB */
/* How many frames to rewind at a time. */
static const unsigned rewind_granularity = 1;
#define DEFAULT_REWIND_GRANULARITY 1
/* Pause gameplay when gameplay loses focus. */
#ifdef EMSCRIPTEN
static const bool pause_nonactive = false;
#define DEFAULT_PAUSE_NONACTIVE false
#else
static const bool pause_nonactive = true;
#define DEFAULT_PAUSE_NONACTIVE true
#endif
/* Saves non-volatile SRAM at a regular interval.
* It is measured in seconds. A value of 0 disables autosave. */
#if defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(__x86_64__) || defined(_M_X64) || defined(_WIN32) || defined(OSX) || defined(ANDROID) || defined(IOS)
/* Flush to file every 10 seconds on modern platforms by default */
static const unsigned autosave_interval = 10;
#define DEFAULT_AUTOSAVE_INTERVAL 10
#else
/* Default to disabled on I/O-constrained platforms */
static const unsigned autosave_interval = 0;
#define DEFAULT_AUTOSAVE_INTERVAL 0
#endif
/* Publicly announce netplay */
static const bool netplay_public_announce = true;
#define DEFAULT_NETPLAY_PUBLIC_ANNOUNCE true
/* Start netplay in spectator mode */
static const bool netplay_start_as_spectator = false;
@ -690,7 +692,7 @@ static const unsigned netplay_share_analog = RARCH_NETPLAY_SHARE_ANALOG_NO_PREFE
/* On save state load, block SRAM from being overwritten.
* This could potentially lead to buggy games. */
static const bool block_sram_overwrite = false;
#define DEFAULT_BLOCK_SRAM_OVERWRITE false
/* When saving savestates, state index is automatically
* incremented before saving.
@ -708,16 +710,16 @@ static const bool savestate_auto_load = false;
static const bool savestate_thumbnail_enable = false;
/* Slowmotion ratio. */
static const float slowmotion_ratio = 3.0;
#define DEFAULT_SLOWMOTION_RATIO 3.0
/* Maximum fast forward ratio. */
static const float fastforward_ratio = 0.0;
#define DEFAULT_FASTFORWARD_RATIO 0.0
/* Enable runloop for variable refresh rate screens. Force x1 speed while handling fast forward too. */
static const bool vrr_runloop_enable = false;
#define DEFAULT_VRR_RUNLOOP_ENABLE false
/* Run core logic one or more frames ahead then load the state back to reduce perceived input lag. */
static const unsigned run_ahead_frames = 1;
#define DEFAULT_RUN_AHEAD_FRAMES 1
/* When using the Run Ahead feature, use a secondary instance of the core. */
static const bool run_ahead_secondary_instance = true;
@ -749,6 +751,8 @@ static const unsigned playlist_show_inline_core_name = PLAYLIST_INLINE_CORE_DISP
/* Specifies which runtime record to use on playlist sublabels */
static const unsigned playlist_sublabel_runtime_type = PLAYLIST_RUNTIME_PER_CORE;
static const unsigned playlist_entry_remove_enable = PLAYLIST_ENTRY_REMOVE_ENABLE_ALL;
#endif
static const bool scan_without_core_match = false;
@ -817,10 +821,14 @@ static const unsigned menu_thumbnails_default = 3;
static const unsigned menu_left_thumbnails_default = 0;
static const unsigned menu_thumbnail_upscale_threshold = 0;
static const unsigned menu_timedate_style = 5;
static const bool xmb_vertical_thumbnails = false;
static const unsigned xmb_thumbnail_scale_factor = 100;
#ifdef IOS
static const bool ui_companion_start_on_boot = false;
#else
@ -857,8 +865,8 @@ static const unsigned midi_volume = 100;
/* Only applies to Android 7.0 (API 24) and up */
static const bool sustained_performance_mode = false;
static const bool vibrate_on_keypress = false;
static const bool enable_device_vibration = false;
static const bool vibrate_on_keypress = false;
static const bool enable_device_vibration = false;
#if defined(HAKCHI)
static char buildbot_server_url[] = "http://hakchicloud.com/Libretro_Cores/";
@ -895,16 +903,20 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/apple/
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-desktop/x64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-desktop/x86/latest/";
#elif defined(__arm__) || defined(_M_ARM)
#elif defined(__arm__) || defined(_M_ARM)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-desktop/arm/latest/";
#elif defined(__aarch64__) || defined(_M_ARM64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-desktop/arm64/latest/";
#endif
#else
#if defined(__x86_64__) || defined(_M_X64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/x64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/x86/latest/";
#elif defined(__arm__) || defined(_M_ARM)
#elif defined(__arm__) || defined(_M_ARM)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/arm/latest/";
#elif defined(__aarch64__) || defined(_M_ARM64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2017-uwp/arm64/latest/";
#endif
#endif
#elif _MSC_VER == 1600

View File

@ -1189,6 +1189,7 @@ static struct config_array_setting *populate_settings_array(settings_t *settings
SETTING_ARRAY("twitch_stream_key", settings->arrays.twitch_stream_key, true, NULL, true);
SETTING_ARRAY("discord_app_id", settings->arrays.discord_app_id, true, default_discord_app_id, true);
SETTING_ARRAY("translation_service_url", settings->arrays.translation_service_url, true, default_translation_service_url, true);
SETTING_ARRAY("ai_service_url", settings->arrays.ai_service_url, true, "", true);
*size = count;
@ -1357,7 +1358,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, all_users_control_menu, false);
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, menu_swap_ok_cancel_buttons, false);
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_public_announce", &settings->bools.netplay_public_announce, true, netplay_public_announce, false);
SETTING_BOOL("netplay_public_announce", &settings->bools.netplay_public_announce, true, DEFAULT_NETPLAY_PUBLIC_ANNOUNCE, false);
SETTING_BOOL("netplay_start_as_spectator", &settings->bools.netplay_start_as_spectator, false, netplay_start_as_spectator, false);
SETTING_BOOL("netplay_allow_slaves", &settings->bools.netplay_allow_slaves, true, netplay_allow_slaves, false);
SETTING_BOOL("netplay_require_slaves", &settings->bools.netplay_require_slaves, true, netplay_require_slaves, false);
@ -1384,53 +1385,53 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#endif
SETTING_BOOL("input_descriptor_label_show", &settings->bools.input_descriptor_label_show, true, input_descriptor_label_show, false);
SETTING_BOOL("input_descriptor_hide_unbound", &settings->bools.input_descriptor_hide_unbound, true, input_descriptor_hide_unbound, false);
SETTING_BOOL("load_dummy_on_core_shutdown", &settings->bools.load_dummy_on_core_shutdown, true, load_dummy_on_core_shutdown, false);
SETTING_BOOL("check_firmware_before_loading", &settings->bools.check_firmware_before_loading, true, check_firmware_before_loading, false);
SETTING_BOOL("load_dummy_on_core_shutdown", &settings->bools.load_dummy_on_core_shutdown, true, DEFAULT_LOAD_DUMMY_ON_CORE_SHUTDOWN, false);
SETTING_BOOL("check_firmware_before_loading", &settings->bools.check_firmware_before_loading, true, DEFAULT_CHECK_FIRMWARE_BEFORE_LOADING, false);
SETTING_BOOL("builtin_mediaplayer_enable", &settings->bools.multimedia_builtin_mediaplayer_enable, false, false /* TODO */, false);
SETTING_BOOL("builtin_imageviewer_enable", &settings->bools.multimedia_builtin_imageviewer_enable, true, true, false);
SETTING_BOOL("fps_show", &settings->bools.video_fps_show, true, fps_show, false);
SETTING_BOOL("statistics_show", &settings->bools.video_statistics_show, true, statistics_show, false);
SETTING_BOOL("framecount_show", &settings->bools.video_framecount_show, true, framecount_show, false);
SETTING_BOOL("memory_show", &settings->bools.video_memory_show, true, memory_show, false);
SETTING_BOOL("fps_show", &settings->bools.video_fps_show, true, DEFAULT_FPS_SHOW, false);
SETTING_BOOL("statistics_show", &settings->bools.video_statistics_show, true, DEFAULT_STATISTICS_SHOW, false);
SETTING_BOOL("framecount_show", &settings->bools.video_framecount_show, true, DEFAULT_FRAMECOUNT_SHOW, false);
SETTING_BOOL("memory_show", &settings->bools.video_memory_show, true, DEFAULT_MEMORY_SHOW, false);
SETTING_BOOL("ui_menubar_enable", &settings->bools.ui_menubar_enable, true, true, false);
SETTING_BOOL("suspend_screensaver_enable", &settings->bools.ui_suspend_screensaver_enable, true, true, false);
SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, rewind_enable, false);
SETTING_BOOL("vrr_runloop_enable", &settings->bools.vrr_runloop_enable, true, vrr_runloop_enable, false);
SETTING_BOOL("apply_cheats_after_toggle", &settings->bools.apply_cheats_after_toggle, true, apply_cheats_after_toggle, false);
SETTING_BOOL("apply_cheats_after_load", &settings->bools.apply_cheats_after_load, true, apply_cheats_after_load, false);
SETTING_BOOL("rewind_enable", &settings->bools.rewind_enable, true, DEFAULT_REWIND_ENABLE, false);
SETTING_BOOL("vrr_runloop_enable", &settings->bools.vrr_runloop_enable, true, DEFAULT_VRR_RUNLOOP_ENABLE, false);
SETTING_BOOL("apply_cheats_after_toggle", &settings->bools.apply_cheats_after_toggle, true, DEFAULT_APPLY_CHEATS_AFTER_TOGGLE, false);
SETTING_BOOL("apply_cheats_after_load", &settings->bools.apply_cheats_after_load, true, DEFAULT_APPLY_CHEATS_AFTER_LOAD, false);
SETTING_BOOL("run_ahead_enabled", &settings->bools.run_ahead_enabled, true, false, false);
SETTING_BOOL("run_ahead_secondary_instance", &settings->bools.run_ahead_secondary_instance, true, false, false);
SETTING_BOOL("run_ahead_hide_warnings", &settings->bools.run_ahead_hide_warnings, true, false, false);
SETTING_BOOL("audio_sync", &settings->bools.audio_sync, true, audio_sync, false);
SETTING_BOOL("video_shader_enable", &settings->bools.video_shader_enable, true, shader_enable, false);
SETTING_BOOL("audio_sync", &settings->bools.audio_sync, true, DEFAULT_AUDIO_SYNC, false);
SETTING_BOOL("video_shader_enable", &settings->bools.video_shader_enable, true, DEFAULT_SHADER_ENABLE, false);
SETTING_BOOL("video_shader_watch_files", &settings->bools.video_shader_watch_files, true, video_shader_watch_files, false);
/* Let implementation decide if automatic, or 1:1 PAR. */
SETTING_BOOL("video_aspect_ratio_auto", &settings->bools.video_aspect_ratio_auto, true, aspect_ratio_auto, false);
SETTING_BOOL("video_aspect_ratio_auto", &settings->bools.video_aspect_ratio_auto, true, DEFAULT_ASPECT_RATIO_AUTO, false);
SETTING_BOOL("video_allow_rotate", &settings->bools.video_allow_rotate, true, allow_rotate, false);
SETTING_BOOL("video_windowed_fullscreen", &settings->bools.video_windowed_fullscreen, true, windowed_fullscreen, false);
SETTING_BOOL("video_crop_overscan", &settings->bools.video_crop_overscan, true, crop_overscan, false);
SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, scale_integer, false);
SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, video_smooth, false);
SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, force_aspect, false);
SETTING_BOOL("video_threaded", video_driver_get_threaded(), true, video_threaded, false);
SETTING_BOOL("video_shared_context", &settings->bools.video_shared_context, true, video_shared_context, false);
SETTING_BOOL("video_windowed_fullscreen", &settings->bools.video_windowed_fullscreen, true, DEFAULT_WINDOWED_FULLSCREEN, false);
SETTING_BOOL("video_crop_overscan", &settings->bools.video_crop_overscan, true, DEFAULT_CROP_OVERSCAN, false);
SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, DEFAULT_SCALE_INTEGER, false);
SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, DEFAULT_VIDEO_SMOOTH, false);
SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, DEFAULT_FORCE_ASPECT, false);
SETTING_BOOL("video_threaded", video_driver_get_threaded(), true, DEFAULT_VIDEO_THREADED, false);
SETTING_BOOL("video_shared_context", &settings->bools.video_shared_context, true, DEFAULT_VIDEO_SHARED_CONTEXT, false);
SETTING_BOOL("auto_screenshot_filename", &settings->bools.auto_screenshot_filename, true, auto_screenshot_filename, false);
SETTING_BOOL("video_force_srgb_disable", &settings->bools.video_force_srgb_disable, true, false, false);
SETTING_BOOL("video_fullscreen", &settings->bools.video_fullscreen, true, fullscreen, false);
SETTING_BOOL("bundle_assets_extract_enable", &settings->bools.bundle_assets_extract_enable, true, bundle_assets_extract_enable, false);
SETTING_BOOL("video_vsync", &settings->bools.video_vsync, true, vsync, false);
SETTING_BOOL("video_adaptive_vsync", &settings->bools.video_adaptive_vsync, true, adaptive_vsync, false);
SETTING_BOOL("video_hard_sync", &settings->bools.video_hard_sync, true, hard_sync, false);
SETTING_BOOL("video_black_frame_insertion", &settings->bools.video_black_frame_insertion, true, black_frame_insertion, false);
SETTING_BOOL("video_disable_composition", &settings->bools.video_disable_composition, true, disable_composition, false);
SETTING_BOOL("pause_nonactive", &settings->bools.pause_nonactive, true, pause_nonactive, false);
SETTING_BOOL("video_fullscreen", &settings->bools.video_fullscreen, true, DEFAULT_FULLSCREEN, false);
SETTING_BOOL("bundle_assets_extract_enable", &settings->bools.bundle_assets_extract_enable, true, DEFAULT_BUNDLE_ASSETS_EXTRACT_ENABLE, false);
SETTING_BOOL("video_vsync", &settings->bools.video_vsync, true, DEFAULT_VSYNC, false);
SETTING_BOOL("video_adaptive_vsync", &settings->bools.video_adaptive_vsync, true, DEFAULT_ADAPTIVE_VSYNC, false);
SETTING_BOOL("video_hard_sync", &settings->bools.video_hard_sync, true, DEFAULT_HARD_SYNC, false);
SETTING_BOOL("video_black_frame_insertion", &settings->bools.video_black_frame_insertion, true, DEFAULT_BLACK_FRAME_INSERTION, false);
SETTING_BOOL("video_disable_composition", &settings->bools.video_disable_composition, true, DEFAULT_DISABLE_COMPOSITION, false);
SETTING_BOOL("pause_nonactive", &settings->bools.pause_nonactive, true, DEFAULT_PAUSE_NONACTIVE, false);
SETTING_BOOL("video_gpu_screenshot", &settings->bools.video_gpu_screenshot, true, gpu_screenshot, false);
SETTING_BOOL("video_post_filter_record", &settings->bools.video_post_filter_record, true, post_filter_record, false);
SETTING_BOOL("keyboard_gamepad_enable", &settings->bools.input_keyboard_gamepad_enable, true, true, false);
SETTING_BOOL("core_set_supports_no_game_enable", &settings->bools.set_supports_no_game_enable, true, true, false);
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, audio_enable, false);
SETTING_BOOL("audio_enable", &settings->bools.audio_enable, true, DEFAULT_AUDIO_ENABLE, false);
SETTING_BOOL("menu_enable_widgets", &settings->bools.menu_enable_widgets, true, menu_enable_widgets, false);
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false);
SETTING_BOOL("audio_enable_menu_ok", &settings->bools.audio_enable_menu_ok, true, audio_enable_menu_ok, false);
@ -1452,10 +1453,10 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("small_keyboard_enable", &settings->bools.input_small_keyboard_enable, true, false, false);
#endif
#ifdef GEKKO
SETTING_BOOL("video_vfilter", &settings->bools.video_vfilter, true, video_vfilter, false);
SETTING_BOOL("video_vfilter", &settings->bools.video_vfilter, true, DEFAULT_VIDEO_VFILTER, false);
#endif
#ifdef HAVE_THREADS
SETTING_BOOL("threaded_data_runloop_enable", &settings->bools.threaded_data_runloop_enable, true, threaded_data_runloop_enable, false);
SETTING_BOOL("threaded_data_runloop_enable", &settings->bools.threaded_data_runloop_enable, true, DEFAULT_THREADED_DATA_RUNLOOP_ENABLE, false);
#endif
#ifdef HAVE_MENU
SETTING_BOOL("menu_unified_controls", &settings->bools.menu_unified_controls, true, false, false);
@ -1464,8 +1465,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("menu_horizontal_animation", &settings->bools.menu_horizontal_animation, true, true, false);
SETTING_BOOL("dpi_override_enable", &settings->bools.menu_dpi_override_enable, true, menu_dpi_override_enable, false);
SETTING_BOOL("menu_pause_libretro", &settings->bools.menu_pause_libretro, true, true, false);
SETTING_BOOL("menu_mouse_enable", &settings->bools.menu_mouse_enable, true, def_mouse_enable, false);
SETTING_BOOL("menu_pointer_enable", &settings->bools.menu_pointer_enable, true, pointer_enable, false);
SETTING_BOOL("menu_mouse_enable", &settings->bools.menu_mouse_enable, true, DEFAULT_MOUSE_ENABLE, false);
SETTING_BOOL("menu_pointer_enable", &settings->bools.menu_pointer_enable, true, DEFAULT_POINTER_ENABLE, false);
SETTING_BOOL("menu_timedate_enable", &settings->bools.menu_timedate_enable, true, true, false);
SETTING_BOOL("menu_battery_level_enable", &settings->bools.menu_battery_level_enable, true, true, false);
SETTING_BOOL("menu_core_enable", &settings->bools.menu_core_enable, true, true, false);
@ -1523,6 +1524,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#endif
SETTING_BOOL("menu_show_help", &settings->bools.menu_show_help, true, menu_show_help, false);
SETTING_BOOL("menu_show_quit_retroarch", &settings->bools.menu_show_quit_retroarch, true, menu_show_quit_retroarch, false);
SETTING_BOOL("menu_show_restart_retroarch", &settings->bools.menu_show_restart_retroarch, true, menu_show_restart_retroarch, false);
SETTING_BOOL("menu_show_reboot", &settings->bools.menu_show_reboot, true, menu_show_reboot, false);
SETTING_BOOL("menu_show_shutdown", &settings->bools.menu_show_shutdown, true, menu_show_shutdown, false);
SETTING_BOOL("menu_show_online_updater", &settings->bools.menu_show_online_updater, true, menu_show_online_updater, false);
@ -1535,7 +1537,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
&settings->bools.menu_navigation_browser_filter_supported_extensions_enable, true, true, false);
SETTING_BOOL("menu_show_advanced_settings", &settings->bools.menu_show_advanced_settings, true, show_advanced_settings, false);
#ifdef HAVE_MATERIALUI
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, materialui_icons_enable, false);
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, DEFAULT_MATERIALUI_ICONS_ENABLE, false);
#endif
#ifdef HAVE_RGUI
SETTING_BOOL("rgui_background_filler_thickness_enable", &settings->bools.menu_rgui_background_filler_thickness_enable, true, true, false);
@ -1553,14 +1555,12 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#endif
#endif
#ifdef HAVE_CHEEVOS
SETTING_BOOL("cheevos_enable", &settings->bools.cheevos_enable, true, cheevos_enable, false);
SETTING_BOOL("cheevos_enable", &settings->bools.cheevos_enable, true, DEFAULT_CHEEVOS_ENABLE, false);
SETTING_BOOL("cheevos_test_unofficial", &settings->bools.cheevos_test_unofficial, true, false, false);
SETTING_BOOL("cheevos_hardcore_mode_enable", &settings->bools.cheevos_hardcore_mode_enable, true, false, false);
SETTING_BOOL("cheevos_leaderboards_enable", &settings->bools.cheevos_leaderboards_enable, true, false, false);
SETTING_BOOL("cheevos_verbose_enable", &settings->bools.cheevos_verbose_enable, true, false, false);
SETTING_BOOL("cheevos_auto_screenshot", &settings->bools.cheevos_auto_screenshot, true, false, false);
SETTING_BOOL("cheevos_old_enable", &settings->bools.cheevos_old_enable, true, false, false);
/* RCHEEVOS TODO: remove line above */
#ifdef HAVE_XMB
SETTING_BOOL("cheevos_badges_enable", &settings->bools.cheevos_badges_enable, true, false, false);
#endif
@ -1569,7 +1569,8 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("input_overlay_enable", &settings->bools.input_overlay_enable, true, config_overlay_enable_default(), false);
SETTING_BOOL("input_overlay_enable_autopreferred", &settings->bools.input_overlay_enable_autopreferred, true, true, false);
SETTING_BOOL("input_overlay_show_physical_inputs", &settings->bools.input_overlay_show_physical_inputs, true, false, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, overlay_hide_in_menu, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, DEFAULT_OVERLAY_HIDE_IN_MENU, false);
SETTING_BOOL("input_overlay_show_mouse_cursor", &settings->bools.input_overlay_show_mouse_cursor, true, DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR, false);
#endif
#ifdef HAVE_VIDEO_LAYOUT
SETTING_BOOL("video_layout_enable", &settings->bools.video_layout_enable, true, true, false);
@ -1584,13 +1585,12 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_nat_traversal", &settings->bools.netplay_nat_traversal, true, true, false);
#endif
SETTING_BOOL("block_sram_overwrite", &settings->bools.block_sram_overwrite, true, block_sram_overwrite, false);
SETTING_BOOL("block_sram_overwrite", &settings->bools.block_sram_overwrite, true, DEFAULT_BLOCK_SRAM_OVERWRITE, false);
SETTING_BOOL("savestate_auto_index", &settings->bools.savestate_auto_index, true, savestate_auto_index, false);
SETTING_BOOL("savestate_auto_save", &settings->bools.savestate_auto_save, true, savestate_auto_save, false);
SETTING_BOOL("savestate_auto_load", &settings->bools.savestate_auto_load, true, savestate_auto_load, false);
SETTING_BOOL("savestate_thumbnail_enable", &settings->bools.savestate_thumbnail_enable, true, savestate_thumbnail_enable, false);
SETTING_BOOL("history_list_enable", &settings->bools.history_list_enable, true, def_history_list_enable, false);
SETTING_BOOL("playlist_entry_remove", &settings->bools.playlist_entry_remove, true, def_playlist_entry_remove, false);
SETTING_BOOL("playlist_entry_rename", &settings->bools.playlist_entry_rename, true, def_playlist_entry_rename, false);
SETTING_BOOL("game_specific_options", &settings->bools.game_specific_options, true, default_game_specific_options, false);
SETTING_BOOL("auto_overrides_enable", &settings->bools.auto_overrides_enable, true, default_auto_overrides_enable, false);
@ -1599,10 +1599,10 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("scan_without_core_match", &settings->bools.scan_without_core_match, true, scan_without_core_match, false);
SETTING_BOOL("sort_savefiles_enable", &settings->bools.sort_savefiles_enable, true, default_sort_savefiles_enable, false);
SETTING_BOOL("sort_savestates_enable", &settings->bools.sort_savestates_enable, true, default_sort_savestates_enable, false);
SETTING_BOOL("config_save_on_exit", &settings->bools.config_save_on_exit, true, config_save_on_exit, false);
SETTING_BOOL("show_hidden_files", &settings->bools.show_hidden_files, true, show_hidden_files, false);
SETTING_BOOL("config_save_on_exit", &settings->bools.config_save_on_exit, true, DEFAULT_CONFIG_SAVE_ON_EXIT, false);
SETTING_BOOL("show_hidden_files", &settings->bools.show_hidden_files, true, DEFAULT_SHOW_HIDDEN_FILES, false);
SETTING_BOOL("input_autodetect_enable", &settings->bools.input_autodetect_enable, true, input_autodetect_enable, false);
SETTING_BOOL("audio_rate_control", &settings->bools.audio_rate_control, true, rate_control, false);
SETTING_BOOL("audio_rate_control", &settings->bools.audio_rate_control, true, DEFAULT_RATE_CONTROL, false);
#ifdef HAVE_WASAPI
SETTING_BOOL("audio_wasapi_exclusive_mode", &settings->bools.audio_wasapi_exclusive_mode, true, wasapi_exclusive_mode, false);
SETTING_BOOL("audio_wasapi_float_format", &settings->bools.audio_wasapi_float_format, true, wasapi_float_format, false);
@ -1614,7 +1614,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false);
SETTING_BOOL("video_msg_bgcolor_enable", &settings->bools.video_msg_bgcolor_enable, true, message_bgcolor_enable, false);
SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, window_decorations, false);
SETTING_BOOL("video_window_show_decorations", &settings->bools.video_window_show_decorations, true, DEFAULT_WINDOW_DECORATIONS, false);
SETTING_BOOL("video_window_save_positions", &settings->bools.video_window_save_positions, true, false, false);
SETTING_BOOL("sustained_performance_mode", &settings->bools.sustained_performance_mode, true, sustained_performance_mode, false);
@ -1642,6 +1642,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("log_to_file", &settings->bools.log_to_file, true, default_log_to_file, false);
SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_LOG_TO_FILE);
SETTING_BOOL("log_to_file_timestamp", &settings->bools.log_to_file_timestamp, true, log_to_file_timestamp, false);
SETTING_BOOL("ai_service_enable", &settings->bools.ai_service_enable, true, false, false);
*size = count;
@ -1656,16 +1657,16 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
if (!tmp)
return NULL;
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false);
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false);
SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false);
SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false);
SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, refresh_rate, false);
SETTING_FLOAT("audio_rate_control_delta", audio_get_float_ptr(AUDIO_ACTION_RATE_CONTROL_DELTA), true, rate_control_delta, false);
SETTING_FLOAT("audio_max_timing_skew", &settings->floats.audio_max_timing_skew, true, max_timing_skew, false);
SETTING_FLOAT("audio_volume", &settings->floats.audio_volume, true, audio_volume, false);
SETTING_FLOAT("audio_mixer_volume", &settings->floats.audio_mixer_volume, true, audio_mixer_volume, false);
SETTING_FLOAT("audio_rate_control_delta", audio_get_float_ptr(AUDIO_ACTION_RATE_CONTROL_DELTA), true, DEFAULT_RATE_CONTROL_DELTA, false);
SETTING_FLOAT("audio_max_timing_skew", &settings->floats.audio_max_timing_skew, true, DEFAULT_MAX_TIMING_SKEW, false);
SETTING_FLOAT("audio_volume", &settings->floats.audio_volume, true, DEFAULT_AUDIO_VOLUME, false);
SETTING_FLOAT("audio_mixer_volume", &settings->floats.audio_mixer_volume, true, DEFAULT_AUDIO_MIXER_VOLUME, false);
#ifdef HAVE_OVERLAY
SETTING_FLOAT("input_overlay_opacity", &settings->floats.input_overlay_opacity, true, default_input_overlay_opacity, false);
SETTING_FLOAT("input_overlay_opacity", &settings->floats.input_overlay_opacity, true, DEFAULT_INPUT_OVERLAY_OPACITY, false);
SETTING_FLOAT("input_overlay_scale", &settings->floats.input_overlay_scale, true, 1.0f, false);
#endif
#ifdef HAVE_MENU
@ -1677,9 +1678,9 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
#endif
SETTING_FLOAT("video_message_pos_x", &settings->floats.video_msg_pos_x, true, message_pos_offset_x, false);
SETTING_FLOAT("video_message_pos_y", &settings->floats.video_msg_pos_y, true, message_pos_offset_y, false);
SETTING_FLOAT("video_font_size", &settings->floats.video_font_size, true, font_size, false);
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, fastforward_ratio, false);
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, slowmotion_ratio, false);
SETTING_FLOAT("video_font_size", &settings->floats.video_font_size, true, DEFAULT_FONT_SIZE, false);
SETTING_FLOAT("fastforward_ratio", &settings->floats.fastforward_ratio, true, DEFAULT_FASTFORWARD_RATIO, false);
SETTING_FLOAT("slowmotion_ratio", &settings->floats.slowmotion_ratio, true, DEFAULT_SLOWMOTION_RATIO, false);
SETTING_FLOAT("input_axis_threshold", input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD), true, axis_threshold, false);
SETTING_FLOAT("input_analog_deadzone", &settings->floats.input_analog_deadzone, true, analog_deadzone, false);
SETTING_FLOAT("input_analog_sensitivity", &settings->floats.input_analog_sensitivity, true, analog_sensitivity, false);
@ -1714,16 +1715,16 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
#ifdef ANDROID
SETTING_UINT("input_block_timeout", &settings->uints.input_block_timeout, true, 1, false);
#endif
SETTING_UINT("rewind_granularity", &settings->uints.rewind_granularity, true, rewind_granularity, false);
SETTING_UINT("rewind_buffer_size_step", &settings->uints.rewind_buffer_size_step, true, rewind_buffer_size_step, false);
SETTING_UINT("autosave_interval", &settings->uints.autosave_interval, true, autosave_interval, false);
SETTING_UINT("rewind_granularity", &settings->uints.rewind_granularity, true, DEFAULT_REWIND_GRANULARITY, false);
SETTING_UINT("rewind_buffer_size_step", &settings->uints.rewind_buffer_size_step, true, DEFAULT_REWIND_BUFFER_SIZE_STEP, false);
SETTING_UINT("autosave_interval", &settings->uints.autosave_interval, true, DEFAULT_AUTOSAVE_INTERVAL, false);
SETTING_UINT("libretro_log_level", &settings->uints.libretro_log_level, true, libretro_log_level, false);
SETTING_UINT("keyboard_gamepad_mapping_type",&settings->uints.input_keyboard_gamepad_mapping_type, true, 1, false);
SETTING_UINT("input_poll_type_behavior", &settings->uints.input_poll_type_behavior, true, 2, false);
SETTING_UINT("video_monitor_index", &settings->uints.video_monitor_index, true, monitor_index, false);
SETTING_UINT("video_fullscreen_x", &settings->uints.video_fullscreen_x, true, fullscreen_x, false);
SETTING_UINT("video_fullscreen_y", &settings->uints.video_fullscreen_y, true, fullscreen_y, false);
SETTING_UINT("video_window_opacity", &settings->uints.video_window_opacity, true, window_opacity, false);
SETTING_UINT("video_monitor_index", &settings->uints.video_monitor_index, true, DEFAULT_MONITOR_INDEX, false);
SETTING_UINT("video_fullscreen_x", &settings->uints.video_fullscreen_x, true, DEFAULT_FULLSCREEN_X, false);
SETTING_UINT("video_fullscreen_y", &settings->uints.video_fullscreen_y, true, DEFAULT_FULLSCREEN_Y, false);
SETTING_UINT("video_window_opacity", &settings->uints.video_window_opacity, true, DEFAULT_WINDOW_OPACITY, false);
#ifdef HAVE_VIDEO_LAYOUT
SETTING_UINT("video_layout_selected_view", &settings->uints.video_layout_selected_view, true, 0, false);
#endif
@ -1734,11 +1735,15 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("network_remote_base_port", &settings->uints.network_remote_base_port, true, network_remote_base_port, false);
#endif
#ifdef GEKKO
SETTING_UINT("video_viwidth", &settings->uints.video_viwidth, true, video_viwidth, false);
SETTING_UINT("video_viwidth", &settings->uints.video_viwidth, true, DEFAULT_VIDEO_VI_WIDTH, false);
SETTING_UINT("video_overscan_correction_top", &settings->uints.video_overscan_correction_top, true, DEFAULT_VIDEO_OVERSCAN_CORRECTION_TOP, false);
SETTING_UINT("video_overscan_correction_bottom", &settings->uints.video_overscan_correction_bottom, true, DEFAULT_VIDEO_OVERSCAN_CORRECTION_BOTTOM, false);
#endif
#ifdef HAVE_MENU
SETTING_UINT("dpi_override_value", &settings->uints.menu_dpi_override_value, true, menu_dpi_override_value, false);
SETTING_UINT("menu_thumbnails", &settings->uints.menu_thumbnails, true, menu_thumbnails_default, false);
SETTING_UINT("menu_left_thumbnails", &settings->uints.menu_left_thumbnails, true, menu_left_thumbnails_default, false);
SETTING_UINT("menu_thumbnail_upscale_threshold", &settings->uints.menu_thumbnail_upscale_threshold, true, menu_thumbnail_upscale_threshold, false);
SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, menu_timedate_style, false);
SETTING_UINT("menu_ticker_type", &settings->uints.menu_ticker_type, true, menu_ticker_type, false);
#ifdef HAVE_RGUI
@ -1761,7 +1766,6 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("split_joycon_p8", &settings->uints.input_split_joycon[7], true, 0, false);
#endif
#ifdef HAVE_XMB
SETTING_UINT("menu_left_thumbnails", &settings->uints.menu_left_thumbnails, true, menu_left_thumbnails_default, false);
SETTING_UINT("menu_xmb_animation_opening_main_menu", &settings->uints.menu_xmb_animation_opening_main_menu, true, 0 /* TODO/FIXME - implement */, false);
SETTING_UINT("menu_xmb_animation_horizontal_highlight", &settings->uints.menu_xmb_animation_horizontal_highlight, true, 0 /* TODO/FIXME - implement */, false);
SETTING_UINT("menu_xmb_animation_move_up_down", &settings->uints.menu_xmb_animation_move_up_down, true, 0 /* TODO/FIXME - implement */, false);
@ -1773,6 +1777,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("menu_font_color_red", &settings->uints.menu_font_color_red, true, menu_font_color_red, false);
SETTING_UINT("menu_font_color_green", &settings->uints.menu_font_color_green, true, menu_font_color_green, false);
SETTING_UINT("menu_font_color_blue", &settings->uints.menu_font_color_blue, true, menu_font_color_blue, false);
SETTING_UINT("menu_xmb_thumbnail_scale_factor", &settings->uints.menu_xmb_thumbnail_scale_factor, true, xmb_thumbnail_scale_factor, false);
#endif
SETTING_UINT("materialui_menu_color_theme", &settings->uints.menu_materialui_color_theme, true, MATERIALUI_THEME_BLUE, false);
SETTING_UINT("menu_shader_pipeline", &settings->uints.menu_xmb_shader_pipeline, true, menu_shader_pipeline, false);
@ -1780,20 +1785,20 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("ozone_menu_color_theme", &settings->uints.menu_ozone_color_theme, true, 1, false);
#endif
#endif
SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, out_rate, false);
SETTING_UINT("audio_out_rate", &settings->uints.audio_out_rate, true, DEFAULT_OUTPUT_RATE, false);
SETTING_UINT("custom_viewport_width", &settings->video_viewport_custom.width, false, 0 /* TODO */, false);
SETTING_UINT("crt_switch_resolution_super", &settings->uints.crt_switch_resolution_super, true, crt_switch_resolution_super, false);
SETTING_UINT("custom_viewport_height", &settings->video_viewport_custom.height, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_x", (unsigned*)&settings->video_viewport_custom.x, false, 0 /* TODO */, false);
SETTING_UINT("custom_viewport_y", (unsigned*)&settings->video_viewport_custom.y, false, 0 /* TODO */, false);
SETTING_UINT("content_history_size", &settings->uints.content_history_size, true, default_content_history_size, false);
SETTING_UINT("video_hard_sync_frames", &settings->uints.video_hard_sync_frames, true, hard_sync_frames, false);
SETTING_UINT("video_frame_delay", &settings->uints.video_frame_delay, true, frame_delay, false);
SETTING_UINT("video_max_swapchain_images", &settings->uints.video_max_swapchain_images, true, max_swapchain_images, false);
SETTING_UINT("video_swap_interval", &settings->uints.video_swap_interval, true, swap_interval, false);
SETTING_UINT("video_hard_sync_frames", &settings->uints.video_hard_sync_frames, true, DEFAULT_HARD_SYNC_FRAMES, false);
SETTING_UINT("video_frame_delay", &settings->uints.video_frame_delay, true, DEFAULT_FRAME_DELAY, false);
SETTING_UINT("video_max_swapchain_images", &settings->uints.video_max_swapchain_images, true, DEFAULT_MAX_SWAPCHAIN_IMAGES, false);
SETTING_UINT("video_swap_interval", &settings->uints.video_swap_interval, true, DEFAULT_SWAP_INTERVAL, false);
SETTING_UINT("video_rotation", &settings->uints.video_rotation, true, ORIENTATION_NORMAL, false);
SETTING_UINT("screen_orientation", &settings->uints.screen_orientation, true, ORIENTATION_NORMAL, false);
SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, aspect_ratio_idx, false);
SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, DEFAULT_ASPECT_RATIO_IDX, false);
#ifdef HAVE_NETWORKING
SETTING_UINT("netplay_ip_port", &settings->uints.netplay_port, true, RARCH_DEFAULT_PORT, false);
SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT);
@ -1823,10 +1828,11 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("video_stream_scale_factor", &settings->uints.video_stream_scale_factor, true, 1, false);
SETTING_UINT("video_windowed_position_x", &settings->uints.window_position_x, true, 0, false);
SETTING_UINT("video_windowed_position_y", &settings->uints.window_position_y, true, 0, false);
SETTING_UINT("video_windowed_position_width", &settings->uints.window_position_width, true, window_width, false);
SETTING_UINT("video_windowed_position_height", &settings->uints.window_position_height, true, window_height, false);
SETTING_UINT("video_windowed_position_width", &settings->uints.window_position_width, true, DEFAULT_WINDOW_WIDTH, false);
SETTING_UINT("video_windowed_position_height", &settings->uints.window_position_height, true, DEFAULT_WINDOW_HEIGHT, false);
SETTING_UINT("ai_service_mode", &settings->uints.ai_service_mode, true, 0, false);
SETTING_UINT("video_record_threads", &settings->uints.video_record_threads, true, video_record_threads, false);
SETTING_UINT("video_record_threads", &settings->uints.video_record_threads, true, DEFAULT_VIDEO_RECORD_THREADS, false);
#ifdef HAVE_LIBNX
SETTING_UINT("libnx_overclock", &settings->uints.libnx_overclock, true, SWITCH_DEFAULT_CPU_PROFILE, false);
@ -1837,6 +1843,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
#endif
#ifdef HAVE_MENU
SETTING_UINT("playlist_entry_remove_enable", &settings->uints.playlist_entry_remove_enable, true, playlist_entry_remove_enable, false);
SETTING_UINT("playlist_show_inline_core_name", &settings->uints.playlist_show_inline_core_name, true, playlist_show_inline_core_name, false);
SETTING_UINT("playlist_sublabel_runtime_type", &settings->uints.playlist_sublabel_runtime_type, true, playlist_sublabel_runtime_type, false);
#endif
@ -1854,7 +1861,7 @@ static struct config_size_setting *populate_settings_size(settings_t *settings,
if (!tmp)
return NULL;
SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, rewind_buffer_size, false);
SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, DEFAULT_REWIND_BUFFER_SIZE, false);
*size = count;
@ -2039,9 +2046,9 @@ void config_set_defaults(void)
#else
configuration_set_bool(settings, settings->bools.multimedia_builtin_mediaplayer_enable, false);
#endif
settings->floats.video_scale = scale;
settings->floats.video_scale = DEFAULT_SCALE;
if (g_defaults.settings.video_threaded_enable != video_threaded)
if (g_defaults.settings.video_threaded_enable != DEFAULT_VIDEO_THREADED)
video_driver_set_threaded(g_defaults.settings.video_threaded_enable);
settings->floats.video_msg_color_r = ((message_color >> 16) & 0xff) / 255.0f;
@ -2057,7 +2064,7 @@ void config_set_defaults(void)
audio_device, sizeof(settings->arrays.audio_device));
if (!g_defaults.settings.out_latency)
g_defaults.settings.out_latency = out_latency;
g_defaults.settings.out_latency = DEFAULT_OUT_LATENCY;
settings->uints.audio_latency = g_defaults.settings.out_latency;
@ -2301,6 +2308,7 @@ void config_set_defaults(void)
fill_pathname_join(config_file_path, settings->paths.directory_menu_config, file_path_str(FILE_PATH_MAIN_CONFIG), config_file_path_size);
path_set(RARCH_PATH_CONFIG,
config_file_path);
free(config_file_path);
}
#endif
}
@ -2364,7 +2372,7 @@ void config_set_defaults(void)
midi_output, sizeof(settings->arrays.midi_output));
/* Avoid reloading config on every content load */
if (default_block_config_read)
if (DEFAULT_BLOCK_CONFIG_READ)
rarch_ctl(RARCH_CTL_SET_BLOCK_CONFIG_READ, NULL);
else
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
@ -3585,7 +3593,6 @@ static bool config_load_shader_preset_internal(
{
unsigned idx;
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
bool ret = false;
char *shader_path = (char*)malloc(path_size);
shader_path[0] = '\0';
@ -3609,13 +3616,13 @@ static bool config_load_shader_preset_internal(
RARCH_LOG("[Shaders]: Specific shader preset found at %s.\n",
shader_path);
retroarch_set_shader_preset(shader_path);
ret = true;
break;
free(shader_path);
return true;
}
free(shader_path);
return ret;
return false;
}
/**
@ -4019,10 +4026,8 @@ bool config_save_file(const char *path)
/* Verbosity isn't in bool_settings since it needs to be loaded differently */
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_VERBOSITY, NULL))
{
config_set_bool(conf, "log_verbosity",
verbosity_is_enabled());
}
config_set_bool(conf, "perfcnt_enable",
rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL));

View File

@ -129,6 +129,7 @@ typedef struct settings
bool input_overlay_enable_autopreferred;
bool input_overlay_hide_in_menu;
bool input_overlay_show_physical_inputs;
bool input_overlay_show_mouse_cursor;
bool input_descriptor_label_show;
bool input_descriptor_hide_unbound;
bool input_all_users_control_menu;
@ -166,6 +167,7 @@ typedef struct settings
bool menu_show_configurations;
bool menu_show_help;
bool menu_show_quit_retroarch;
bool menu_show_restart_retroarch;
bool menu_show_reboot;
bool menu_show_shutdown;
bool menu_show_latency;
@ -250,7 +252,6 @@ typedef struct settings
bool cheevos_badges_enable;
bool cheevos_verbose_enable;
bool cheevos_auto_screenshot;
bool cheevos_old_enable; /* RCHEEVOS TODO: remove line */
/* Camera */
bool camera_allow;
@ -275,7 +276,6 @@ typedef struct settings
bool set_supports_no_game_enable;
bool auto_screenshot_filename;
bool history_list_enable;
bool playlist_entry_remove;
bool playlist_entry_rename;
bool rewind_enable;
bool vrr_runloop_enable;
@ -341,6 +341,8 @@ typedef struct settings
bool log_to_file_timestamp;
bool scan_without_core_match;
bool ai_service_enable;
} bools;
struct
@ -449,10 +451,15 @@ typedef struct settings
#ifdef HAVE_VIDEO_LAYOUT
unsigned video_layout_selected_view;
#endif
#ifdef GEKKO
unsigned video_overscan_correction_top;
unsigned video_overscan_correction_bottom;
#endif
unsigned menu_timedate_style;
unsigned menu_thumbnails;
unsigned menu_left_thumbnails;
unsigned menu_thumbnail_upscale_threshold;
unsigned menu_rgui_thumbnail_downscaler;
unsigned menu_rgui_thumbnail_delay;
unsigned menu_dpi_override_value;
@ -466,6 +473,7 @@ typedef struct settings
unsigned menu_xmb_alpha_factor;
unsigned menu_xmb_theme;
unsigned menu_xmb_color_theme;
unsigned menu_xmb_thumbnail_scale_factor;
unsigned menu_materialui_color_theme;
unsigned menu_ozone_color_theme;
unsigned menu_font_color_red;
@ -477,6 +485,7 @@ typedef struct settings
unsigned menu_rgui_particle_effect;
unsigned menu_ticker_type;
unsigned playlist_entry_remove_enable;
unsigned playlist_show_inline_core_name;
unsigned playlist_sublabel_runtime_type;
@ -513,6 +522,7 @@ typedef struct settings
unsigned video_record_threads;
unsigned libnx_overclock;
unsigned ai_service_mode;
} uints;
struct
@ -563,6 +573,7 @@ typedef struct settings
char discord_app_id[PATH_MAX_LENGTH];
char translation_service_url[2048];
char ai_service_url[PATH_MAX_LENGTH];
} arrays;
struct

View File

@ -174,7 +174,8 @@ bool fatInit (uint32_t cacheSize, bool setAsDefaultDevice)
char filePath[PATH_MAX];
strcpy (filePath, _FAT_disc_interfaces[defaultDevice].name);
strcat (filePath, ":/");
#ifdef ARGV_MAGIC
//ARGV_MAGIC means something else on wiiu
#if defined(ARGV_MAGIC) && !defined(WIIU)
if ( __system_argv->argvMagic == ARGV_MAGIC && __system_argv->argc >= 1 && strrchr( __system_argv->argv[0], '/' )!=NULL )
{
/* Check the app's path against each of our mounted devices, to see

View File

@ -7,6 +7,11 @@ extern "C" {
#define OS_MUTEX_SIZE 44
// RetroArch mod: use existing headers; prevents conflicts in griffin
#include <wiiu/os.h>
#include <wiiu/ios.h>
#if 0
#ifndef __WUT__
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Mutex functions
@ -41,4 +46,6 @@ extern int IOS_Close(int fd);
}
#endif
#endif // 0
#endif // __OS_FUNCTIONS_H_

2
deps/libz/adler32.c vendored
View File

@ -8,7 +8,7 @@
#define ZLIB_INTERNAL
#include <stdint.h>
#include <stddef.h>
#include <compat/zutil.h>
#include <zutil.h>
#define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552

View File

@ -6,7 +6,7 @@
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include <compat/zlib.h>
#include <zlib.h>
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level

2
deps/libz/deflate.h vendored
View File

@ -13,7 +13,7 @@
#ifndef DEFLATE_H
#define DEFLATE_H
#include <compat/zutil.h>
#include <zutil.h>
/* define NO_GZIP when compiling if you want to disable gzip header and
trailer creation by deflate(). NO_GZIP would be used to avoid linking in

2
deps/libz/gzguts.h vendored
View File

@ -22,7 +22,7 @@
#endif
#include <stdio.h>
#include <compat/zlib.h>
#include <zlib.h>
#ifdef STDC
# include <string.h>
# include <stdlib.h>

2
deps/libz/inffast.c vendored
View File

@ -3,7 +3,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include <compat/zutil.h>
#include <zutil.h>
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"

2
deps/libz/inflate.c vendored
View File

@ -80,7 +80,7 @@
* The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
*/
#include <compat/zutil.h>
#include <zutil.h>
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"

View File

@ -3,7 +3,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include <compat/zutil.h>
#include <zutil.h>
#include "inftrees.h"
#define MAXBITS 15

2
deps/libz/uncompr.c vendored
View File

@ -6,7 +6,7 @@
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include <compat/zlib.h>
#include <zlib.h>
/* ===========================================================================
Decompresses the source buffer into the destination buffer. sourceLen is

2
deps/libz/zutil.c vendored
View File

@ -5,7 +5,7 @@
/* @(#) $Id$ */
#include <compat/zutil.h>
#include <zutil.h>
#ifndef Z_SOLO
# include "gzguts.h"
#endif

204
deps/mbedtls/aesni.c vendored
View File

@ -97,35 +97,35 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
asm( "movdqu (%3), %%xmm0 \n\t" // load input
"movdqu (%1), %%xmm1 \n\t" // load round key 0
"pxor %%xmm1, %%xmm0 \n\t" // round 0
"add $16, %1 \n\t" // point to next round key
"subl $1, %0 \n\t" // normal rounds = nr - 1
"test %2, %2 \n\t" // mode?
"jz 2f \n\t" // 0 = decrypt
asm( "movdqu (%3), %%xmm0 \n\t" /* load input */
"movdqu (%1), %%xmm1 \n\t" /* load round key 0 */
"pxor %%xmm1, %%xmm0 \n\t" /* round 0 */
"add $16, %1 \n\t" /* point to next round key */
"subl $1, %0 \n\t" /* normal rounds = nr - 1 */
"test %2, %2 \n\t" /* mode? */
"jz 2f \n\t" /* 0 = decrypt */
"1: \n\t" // encryption loop
"movdqu (%1), %%xmm1 \n\t" // load round key
AESENC xmm1_xmm0 "\n\t" // do round
"add $16, %1 \n\t" // point to next round key
"subl $1, %0 \n\t" // loop
"1: \n\t" /* encryption loop */
"movdqu (%1), %%xmm1 \n\t" /* load round key */
AESENC xmm1_xmm0 "\n\t" /* do round */
"add $16, %1 \n\t" /* point to next round key */
"subl $1, %0 \n\t" /* loop */
"jnz 1b \n\t"
"movdqu (%1), %%xmm1 \n\t" // load round key
AESENCLAST xmm1_xmm0 "\n\t" // last round
"movdqu (%1), %%xmm1 \n\t" /* load round key */
AESENCLAST xmm1_xmm0 "\n\t" /* last round */
"jmp 3f \n\t"
"2: \n\t" // decryption loop
"2: \n\t" /* decryption loop */
"movdqu (%1), %%xmm1 \n\t"
AESDEC xmm1_xmm0 "\n\t" // do round
AESDEC xmm1_xmm0 "\n\t" /* do round */
"add $16, %1 \n\t"
"subl $1, %0 \n\t"
"jnz 2b \n\t"
"movdqu (%1), %%xmm1 \n\t" // load round key
AESDECLAST xmm1_xmm0 "\n\t" // last round
"movdqu (%1), %%xmm1 \n\t" /* load round key */
AESDECLAST xmm1_xmm0 "\n\t" /* last round */
"3: \n\t"
"movdqu %%xmm0, (%4) \n\t" // export output
"movdqu %%xmm0, (%4) \n\t" /* export output */
:
: "r" (ctx->nr), "r" (ctx->rk), "r" (mode), "r" (input), "r" (output)
: "memory", "cc", "xmm0", "xmm1" );
@ -152,44 +152,44 @@ void mbedtls_aesni_gcm_mult( unsigned char c[16],
bb[i] = b[15 - i];
}
asm( "movdqu (%0), %%xmm0 \n\t" // a1:a0
"movdqu (%1), %%xmm1 \n\t" // b1:b0
asm( "movdqu (%0), %%xmm0 \n\t" /* a1:a0 */
"movdqu (%1), %%xmm1 \n\t" /* b1:b0 */
/*
* Caryless multiplication xmm2:xmm1 = xmm0 * xmm1
* using [CLMUL-WP] algorithm 1 (p. 13).
*/
"movdqa %%xmm1, %%xmm2 \n\t" // copy of b1:b0
"movdqa %%xmm1, %%xmm3 \n\t" // same
"movdqa %%xmm1, %%xmm4 \n\t" // same
PCLMULQDQ xmm0_xmm1 ",0x00 \n\t" // a0*b0 = c1:c0
PCLMULQDQ xmm0_xmm2 ",0x11 \n\t" // a1*b1 = d1:d0
PCLMULQDQ xmm0_xmm3 ",0x10 \n\t" // a0*b1 = e1:e0
PCLMULQDQ xmm0_xmm4 ",0x01 \n\t" // a1*b0 = f1:f0
"pxor %%xmm3, %%xmm4 \n\t" // e1+f1:e0+f0
"movdqa %%xmm4, %%xmm3 \n\t" // same
"psrldq $8, %%xmm4 \n\t" // 0:e1+f1
"pslldq $8, %%xmm3 \n\t" // e0+f0:0
"pxor %%xmm4, %%xmm2 \n\t" // d1:d0+e1+f1
"pxor %%xmm3, %%xmm1 \n\t" // c1+e0+f1:c0
"movdqa %%xmm1, %%xmm2 \n\t" /* copy of b1:b0 */
"movdqa %%xmm1, %%xmm3 \n\t" /* same */
"movdqa %%xmm1, %%xmm4 \n\t" /* same */
PCLMULQDQ xmm0_xmm1 ",0x00 \n\t" /* a0*b0 = c1:c0 */
PCLMULQDQ xmm0_xmm2 ",0x11 \n\t" /* a1*b1 = d1:d0 */
PCLMULQDQ xmm0_xmm3 ",0x10 \n\t" /* a0*b1 = e1:e0 */
PCLMULQDQ xmm0_xmm4 ",0x01 \n\t" /* a1*b0 = f1:f0 */
"pxor %%xmm3, %%xmm4 \n\t" /* e1+f1:e0+f0 */
"movdqa %%xmm4, %%xmm3 \n\t" /* same */
"psrldq $8, %%xmm4 \n\t" /* 0:e1+f1 */
"pslldq $8, %%xmm3 \n\t" /* e0+f0:0 */
"pxor %%xmm4, %%xmm2 \n\t" /* d1:d0+e1+f1 */
"pxor %%xmm3, %%xmm1 \n\t" /* c1+e0+f1:c0 */
/*
* Now shift the result one bit to the left,
* taking advantage of [CLMUL-WP] eq 27 (p. 20)
*/
"movdqa %%xmm1, %%xmm3 \n\t" // r1:r0
"movdqa %%xmm2, %%xmm4 \n\t" // r3:r2
"psllq $1, %%xmm1 \n\t" // r1<<1:r0<<1
"psllq $1, %%xmm2 \n\t" // r3<<1:r2<<1
"psrlq $63, %%xmm3 \n\t" // r1>>63:r0>>63
"psrlq $63, %%xmm4 \n\t" // r3>>63:r2>>63
"movdqa %%xmm3, %%xmm5 \n\t" // r1>>63:r0>>63
"pslldq $8, %%xmm3 \n\t" // r0>>63:0
"pslldq $8, %%xmm4 \n\t" // r2>>63:0
"psrldq $8, %%xmm5 \n\t" // 0:r1>>63
"por %%xmm3, %%xmm1 \n\t" // r1<<1|r0>>63:r0<<1
"por %%xmm4, %%xmm2 \n\t" // r3<<1|r2>>62:r2<<1
"por %%xmm5, %%xmm2 \n\t" // r3<<1|r2>>62:r2<<1|r1>>63
"movdqa %%xmm1, %%xmm3 \n\t" /* r1:r0 */
"movdqa %%xmm2, %%xmm4 \n\t" /* r3:r2 */
"psllq $1, %%xmm1 \n\t" /* r1<<1:r0<<1 */
"psllq $1, %%xmm2 \n\t" /* r3<<1:r2<<1 */
"psrlq $63, %%xmm3 \n\t" /* r1>>63:r0>>63 */
"psrlq $63, %%xmm4 \n\t" /* r3>>63:r2>>63 */
"movdqa %%xmm3, %%xmm5 \n\t" /* r1>>63:r0>>63 */
"pslldq $8, %%xmm3 \n\t" /* r0>>63:0 */
"pslldq $8, %%xmm4 \n\t" /* r2>>63:0 */
"psrldq $8, %%xmm5 \n\t" /* 0:r1>>63 */
"por %%xmm3, %%xmm1 \n\t" /* r1<<1|r0>>63:r0<<1 */
"por %%xmm4, %%xmm2 \n\t" /* r3<<1|r2>>62:r2<<1 */
"por %%xmm5, %%xmm2 \n\t" /* r3<<1|r2>>62:r2<<1|r1>>63 */
/*
* Now reduce modulo the GCM polynomial x^128 + x^7 + x^2 + x + 1
@ -197,44 +197,44 @@ void mbedtls_aesni_gcm_mult( unsigned char c[16],
* Currently xmm2:xmm1 holds x3:x2:x1:x0 (already shifted).
*/
/* Step 2 (1) */
"movdqa %%xmm1, %%xmm3 \n\t" // x1:x0
"movdqa %%xmm1, %%xmm4 \n\t" // same
"movdqa %%xmm1, %%xmm5 \n\t" // same
"psllq $63, %%xmm3 \n\t" // x1<<63:x0<<63 = stuff:a
"psllq $62, %%xmm4 \n\t" // x1<<62:x0<<62 = stuff:b
"psllq $57, %%xmm5 \n\t" // x1<<57:x0<<57 = stuff:c
"movdqa %%xmm1, %%xmm3 \n\t" /* x1:x0 */
"movdqa %%xmm1, %%xmm4 \n\t" /* same */
"movdqa %%xmm1, %%xmm5 \n\t" /* same */
"psllq $63, %%xmm3 \n\t" /* x1<<63:x0<<63 = stuff:a */
"psllq $62, %%xmm4 \n\t" /* x1<<62:x0<<62 = stuff:b */
"psllq $57, %%xmm5 \n\t" /* x1<<57:x0<<57 = stuff:c */
/* Step 2 (2) */
"pxor %%xmm4, %%xmm3 \n\t" // stuff:a+b
"pxor %%xmm5, %%xmm3 \n\t" // stuff:a+b+c
"pslldq $8, %%xmm3 \n\t" // a+b+c:0
"pxor %%xmm3, %%xmm1 \n\t" // x1+a+b+c:x0 = d:x0
"pxor %%xmm4, %%xmm3 \n\t" /* stuff:a+b */
"pxor %%xmm5, %%xmm3 \n\t" /* stuff:a+b+c */
"pslldq $8, %%xmm3 \n\t" /* a+b+c:0 */
"pxor %%xmm3, %%xmm1 \n\t" /* x1+a+b+c:x0 = d:x0 */
/* Steps 3 and 4 */
"movdqa %%xmm1,%%xmm0 \n\t" // d:x0
"movdqa %%xmm1,%%xmm4 \n\t" // same
"movdqa %%xmm1,%%xmm5 \n\t" // same
"psrlq $1, %%xmm0 \n\t" // e1:x0>>1 = e1:e0'
"psrlq $2, %%xmm4 \n\t" // f1:x0>>2 = f1:f0'
"psrlq $7, %%xmm5 \n\t" // g1:x0>>7 = g1:g0'
"pxor %%xmm4, %%xmm0 \n\t" // e1+f1:e0'+f0'
"pxor %%xmm5, %%xmm0 \n\t" // e1+f1+g1:e0'+f0'+g0'
// e0'+f0'+g0' is almost e0+f0+g0, ex\tcept for some missing
// bits carried from d. Now get those\t bits back in.
"movdqa %%xmm1,%%xmm3 \n\t" // d:x0
"movdqa %%xmm1,%%xmm4 \n\t" // same
"movdqa %%xmm1,%%xmm5 \n\t" // same
"psllq $63, %%xmm3 \n\t" // d<<63:stuff
"psllq $62, %%xmm4 \n\t" // d<<62:stuff
"psllq $57, %%xmm5 \n\t" // d<<57:stuff
"pxor %%xmm4, %%xmm3 \n\t" // d<<63+d<<62:stuff
"pxor %%xmm5, %%xmm3 \n\t" // missing bits of d:stuff
"psrldq $8, %%xmm3 \n\t" // 0:missing bits of d
"pxor %%xmm3, %%xmm0 \n\t" // e1+f1+g1:e0+f0+g0
"pxor %%xmm1, %%xmm0 \n\t" // h1:h0
"pxor %%xmm2, %%xmm0 \n\t" // x3+h1:x2+h0
"movdqa %%xmm1,%%xmm0 \n\t" /* d:x0 */
"movdqa %%xmm1,%%xmm4 \n\t" /* same */
"movdqa %%xmm1,%%xmm5 \n\t" /* same */
"psrlq $1, %%xmm0 \n\t" /* e1:x0>>1 = e1:e0' */
"psrlq $2, %%xmm4 \n\t" /* f1:x0>>2 = f1:f0' */
"psrlq $7, %%xmm5 \n\t" /* g1:x0>>7 = g1:g0' */
"pxor %%xmm4, %%xmm0 \n\t" /* e1+f1:e0'+f0' */
"pxor %%xmm5, %%xmm0 \n\t" /* e1+f1+g1:e0'+f0'+g0' */
/* e0'+f0'+g0' is almost e0+f0+g0, ex\tcept for some missing
* bits carried from d. Now get those\t bits back in. */
"movdqa %%xmm1,%%xmm3 \n\t" /* d:x0 */
"movdqa %%xmm1,%%xmm4 \n\t" /* same */
"movdqa %%xmm1,%%xmm5 \n\t" /* same */
"psllq $63, %%xmm3 \n\t" /* d<<63:stuff */
"psllq $62, %%xmm4 \n\t" /* d<<62:stuff */
"psllq $57, %%xmm5 \n\t" /* d<<57:stuff */
"pxor %%xmm4, %%xmm3 \n\t" /* d<<63+d<<62:stuff */
"pxor %%xmm5, %%xmm3 \n\t" /* missing bits of d:stuff */
"psrldq $8, %%xmm3 \n\t" /* 0:missing bits of d */
"pxor %%xmm3, %%xmm0 \n\t" /* e1+f1+g1:e0+f0+g0 */
"pxor %%xmm1, %%xmm0 \n\t" /* h1:h0 */
"pxor %%xmm2, %%xmm0 \n\t" /* x3+h1:x2+h0 */
"movdqu %%xmm0, (%2) \n\t" // done
"movdqu %%xmm0, (%2) \n\t" /* done */
:
: "r" (aa), "r" (bb), "r" (cc)
: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" );
@ -274,9 +274,9 @@ void mbedtls_aesni_inverse_key( unsigned char *invkey,
static void aesni_setkey_enc_128( unsigned char *rk,
const unsigned char *key )
{
asm( "movdqu (%1), %%xmm0 \n\t" // copy the original key
"movdqu %%xmm0, (%0) \n\t" // as round key 0
"jmp 2f \n\t" // skip auxiliary routine
asm( "movdqu (%1), %%xmm0 \n\t" /* copy the original key */
"movdqu %%xmm0, (%0) \n\t" /* as round key 0 */
"jmp 2f \n\t" /* skip auxiliary routine */
/*
* Finish generating the next round key.
@ -289,16 +289,16 @@ static void aesni_setkey_enc_128( unsigned char *rk,
* and those are written to the round key buffer.
*/
"1: \n\t"
"pshufd $0xff, %%xmm1, %%xmm1 \n\t" // X:X:X:X
"pxor %%xmm0, %%xmm1 \n\t" // X+r3:X+r2:X+r1:r4
"pslldq $4, %%xmm0 \n\t" // r2:r1:r0:0
"pxor %%xmm0, %%xmm1 \n\t" // X+r3+r2:X+r2+r1:r5:r4
"pslldq $4, %%xmm0 \n\t" // etc
"pshufd $0xff, %%xmm1, %%xmm1 \n\t" /* X:X:X:X */
"pxor %%xmm0, %%xmm1 \n\t" /* X+r3:X+r2:X+r1:r4 */
"pslldq $4, %%xmm0 \n\t" /* r2:r1:r0:0 */
"pxor %%xmm0, %%xmm1 \n\t" /* X+r3+r2:X+r2+r1:r5:r4 */
"pslldq $4, %%xmm0 \n\t" /* etc */
"pxor %%xmm0, %%xmm1 \n\t"
"pslldq $4, %%xmm0 \n\t"
"pxor %%xmm1, %%xmm0 \n\t" // update xmm0 for next time!
"add $16, %0 \n\t" // point to next round key
"movdqu %%xmm0, (%0) \n\t" // write it
"pxor %%xmm1, %%xmm0 \n\t" /* update xmm0 for next time! */
"add $16, %0 \n\t" /* point to next round key */
"movdqu %%xmm0, (%0) \n\t" /* write it */
"ret \n\t"
/* Main "loop" */
@ -324,13 +324,13 @@ static void aesni_setkey_enc_128( unsigned char *rk,
static void aesni_setkey_enc_192( unsigned char *rk,
const unsigned char *key )
{
asm( "movdqu (%1), %%xmm0 \n\t" // copy original round key
asm( "movdqu (%1), %%xmm0 \n\t" /* copy original round key */
"movdqu %%xmm0, (%0) \n\t"
"add $16, %0 \n\t"
"movq 16(%1), %%xmm1 \n\t"
"movq %%xmm1, (%0) \n\t"
"add $8, %0 \n\t"
"jmp 2f \n\t" // skip auxiliary routine
"jmp 2f \n\t" /* skip auxiliary routine */
/*
* Finish generating the next 6 quarter-keys.
@ -342,20 +342,20 @@ static void aesni_setkey_enc_192( unsigned char *rk,
* and those are written to the round key buffer.
*/
"1: \n\t"
"pshufd $0x55, %%xmm2, %%xmm2 \n\t" // X:X:X:X
"pxor %%xmm0, %%xmm2 \n\t" // X+r3:X+r2:X+r1:r4
"pslldq $4, %%xmm0 \n\t" // etc
"pshufd $0x55, %%xmm2, %%xmm2 \n\t" /* X:X:X:X */
"pxor %%xmm0, %%xmm2 \n\t" /* X+r3:X+r2:X+r1:r4q */
"pslldq $4, %%xmm0 \n\t" /* etc */
"pxor %%xmm0, %%xmm2 \n\t"
"pslldq $4, %%xmm0 \n\t"
"pxor %%xmm0, %%xmm2 \n\t"
"pslldq $4, %%xmm0 \n\t"
"pxor %%xmm2, %%xmm0 \n\t" // update xmm0 = r9:r8:r7:r6
"pxor %%xmm2, %%xmm0 \n\t" /* update xmm0 = r9:r8:r7:r6 */
"movdqu %%xmm0, (%0) \n\t"
"add $16, %0 \n\t"
"pshufd $0xff, %%xmm0, %%xmm2 \n\t" // r9:r9:r9:r9
"pxor %%xmm1, %%xmm2 \n\t" // stuff:stuff:r9+r5:r10
"pslldq $4, %%xmm1 \n\t" // r2:r1:r0:0
"pxor %%xmm2, %%xmm1 \n\t" // xmm1 = stuff:stuff:r11:r10
"pshufd $0xff, %%xmm0, %%xmm2 \n\t" /* r9:r9:r9:r9 */
"pxor %%xmm1, %%xmm2 \n\t" /* stuff:stuff:r9+r5:r10 */
"pslldq $4, %%xmm1 \n\t" /* r2:r1:r0:0 */
"pxor %%xmm2, %%xmm1 \n\t" /* xmm1 = stuff:stuff:r11:r10 */
"movq %%xmm1, (%0) \n\t"
"add $8, %0 \n\t"
"ret \n\t"
@ -386,7 +386,7 @@ static void aesni_setkey_enc_256( unsigned char *rk,
"add $16, %0 \n\t"
"movdqu 16(%1), %%xmm1 \n\t"
"movdqu %%xmm1, (%0) \n\t"
"jmp 2f \n\t" // skip auxiliary routine
"jmp 2f \n\t" /* skip auxiliary routine */
/*
* Finish generating the next two round keys.

View File

@ -130,8 +130,7 @@ int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start, const mbedt
int ret;
size_t len = 0;
// Write the MPI
//
/* Write the MPI */
len = mbedtls_mpi_size( X );
if( *p < start || (size_t)( *p - start ) < len )
@ -140,9 +139,9 @@ int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start, const mbedt
(*p) -= len;
MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( X, *p, len ) );
// DER format assumes 2s complement for numbers, so the leftmost bit
// should be 0 for positive numbers and 1 for negative numbers.
//
/* DER format assumes 2s complement for numbers, so the leftmost bit
* should be 0 for positive numbers and 1 for negative numbers.
*/
if( X->s ==1 && **p & 0x80 )
{
if( *p - start < 1 )
@ -167,8 +166,7 @@ int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start )
int ret;
size_t len = 0;
// Write NULL
//
/* Write NULL */
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, 0) );
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_NULL ) );
@ -232,10 +230,10 @@ int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val )
int ret;
size_t len = 0;
// TODO negative values and values larger than 128
// DER format assumes 2s complement for numbers, so the leftmost bit
// should be 0 for positive numbers and 1 for negative numbers.
//
/* TODO negative values and values larger than 128
* DER format assumes 2s complement for numbers, so the leftmost bit
* should be 0 for positive numbers and 1 for negative numbers.
*/
if( *p - start < 1 )
return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
@ -295,8 +293,7 @@ int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
size = ( bits / 8 ) + ( ( bits % 8 ) ? 1 : 0 );
// Calculate byte length
//
/* Calculate byte length */
if( *p < start || (size_t)( *p - start ) < size + 1 )
return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
@ -304,8 +301,7 @@ int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
(*p) -= size;
memcpy( *p, buf, size );
// Write unused bits
//
/* Write unused bits */
*--(*p) = (unsigned char) (size * 8 - bits);
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) );
@ -337,8 +333,7 @@ mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data
if( ( cur = mbedtls_asn1_find_named_data( *head, oid, oid_len ) ) == NULL )
{
// Add new entry if not present yet based on OID
//
/* Add new entry if not present yet based on OID */
cur = (mbedtls_asn1_named_data*)mbedtls_calloc( 1,
sizeof(mbedtls_asn1_named_data) );
if( cur == NULL )

View File

@ -43,11 +43,6 @@
#include <stdio.h>
#include <string.h>
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
#endif
#define DEBUG_BUF_SIZE 512
static int debug_threshold = 0;
@ -60,7 +55,7 @@ void mbedtls_debug_set_threshold( int threshold )
/*
* All calls to f_dbg must be made via this function
*/
static inline void debug_send_line( const mbedtls_ssl_context *ssl, int level,
static void debug_send_line( const mbedtls_ssl_context *ssl, int level,
const char *file, int line,
const char *str )
{

7
deps/mbedtls/ecp.c vendored
View File

@ -107,7 +107,7 @@ typedef enum
{
ECP_TYPE_NONE = 0,
ECP_TYPE_SHORT_WEIERSTRASS, /* y^2 = x^3 + a x + b */
ECP_TYPE_MONTGOMERY, /* y^2 = x^3 + a x^2 + x */
ECP_TYPE_MONTGOMERY /* y^2 = x^3 + a x^2 + x */
} ecp_curve_type;
/*
@ -256,15 +256,14 @@ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name( const char *name
/*
* Get the type of a curve
*/
static inline ecp_curve_type ecp_get_type( const mbedtls_ecp_group *grp )
static ecp_curve_type ecp_get_type( const mbedtls_ecp_group *grp )
{
if( grp->G.X.p == NULL )
return( ECP_TYPE_NONE );
if( grp->G.Y.p == NULL )
return( ECP_TYPE_MONTGOMERY );
else
return( ECP_TYPE_SHORT_WEIERSTRASS );
return( ECP_TYPE_SHORT_WEIERSTRASS );
}
/*

View File

@ -33,11 +33,6 @@
#if !defined(MBEDTLS_ECP_ALT)
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
#endif
/*
* Conversion macros for embedded constants:
* build lists of mbedtls_mpi_uint's from lists of unsigned char's grouped by 8, 4 or 2
@ -553,7 +548,7 @@ static const mbedtls_mpi_uint brainpoolP512r1_n[] = {
* Create an MPI from embedded constants
* (assumes len is an exact multiple of sizeof mbedtls_mpi_uint)
*/
static inline void ecp_mpi_load( mbedtls_mpi *X, const mbedtls_mpi_uint *p, size_t len )
static void ecp_mpi_load( mbedtls_mpi *X, const mbedtls_mpi_uint *p, size_t len )
{
X->s = 1;
X->n = len / sizeof( mbedtls_mpi_uint );
@ -563,7 +558,7 @@ static inline void ecp_mpi_load( mbedtls_mpi *X, const mbedtls_mpi_uint *p, size
/*
* Set an MPI to static value 1
*/
static inline void ecp_mpi_set1( mbedtls_mpi *X )
static void ecp_mpi_set1( mbedtls_mpi *X )
{
static mbedtls_mpi_uint one[] = { 1 };
X->s = 1;
@ -798,7 +793,7 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id )
*/
/* Add 64-bit chunks (dst += src) and update carry */
static inline void add64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *src, mbedtls_mpi_uint *carry )
static void add64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *src, mbedtls_mpi_uint *carry )
{
unsigned char i;
mbedtls_mpi_uint c = 0;
@ -811,7 +806,7 @@ static inline void add64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *src, mbedtls_
}
/* Add carry to a 64-bit chunk and update carry */
static inline void carry64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *carry )
static void carry64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *carry )
{
unsigned char i;
for( i = 0; i < 8 / sizeof( mbedtls_mpi_uint ); i++, dst++ )
@ -842,9 +837,9 @@ static int ecp_mod_p192( mbedtls_mpi *N )
p = N->p;
end = p + N->n;
ADD( 3 ); ADD( 5 ); NEXT; // A0 += A3 + A5
ADD( 3 ); ADD( 4 ); ADD( 5 ); NEXT; // A1 += A3 + A4 + A5
ADD( 4 ); ADD( 5 ); LAST; // A2 += A4 + A5
ADD( 3 ); ADD( 5 ); NEXT; /* A0 += A3 + A5 */
ADD( 3 ); ADD( 4 ); ADD( 5 ); NEXT; /* A1 += A3 + A4 + A5 */
ADD( 4 ); ADD( 5 ); LAST; /* A2 += A4 + A5 */
cleanup:
return( ret );
@ -902,13 +897,13 @@ cleanup:
/*
* Helpers for addition and subtraction of chunks, with signed carry.
*/
static inline void add32( uint32_t *dst, uint32_t src, signed char *carry )
static void add32( uint32_t *dst, uint32_t src, signed char *carry )
{
*dst += src;
*carry += ( *dst < src );
}
static inline void sub32( uint32_t *dst, uint32_t src, signed char *carry )
static void sub32( uint32_t *dst, uint32_t src, signed char *carry )
{
*carry -= ( *dst < src );
*dst -= src;
@ -955,7 +950,7 @@ static inline void sub32( uint32_t *dst, uint32_t src, signed char *carry )
* If the result is negative, we get it in the form
* c * 2^(bits + 32) + N, with c negative and N positive shorter than 'bits'
*/
static inline int fix_negative( mbedtls_mpi *N, signed char c, mbedtls_mpi *C, size_t bits )
static int fix_negative( mbedtls_mpi *N, signed char c, mbedtls_mpi *C, size_t bits )
{
int ret;
@ -986,13 +981,13 @@ static int ecp_mod_p224( mbedtls_mpi *N )
{
INIT( 224 );
SUB( 7 ); SUB( 11 ); NEXT; // A0 += -A7 - A11
SUB( 8 ); SUB( 12 ); NEXT; // A1 += -A8 - A12
SUB( 9 ); SUB( 13 ); NEXT; // A2 += -A9 - A13
SUB( 10 ); ADD( 7 ); ADD( 11 ); NEXT; // A3 += -A10 + A7 + A11
SUB( 11 ); ADD( 8 ); ADD( 12 ); NEXT; // A4 += -A11 + A8 + A12
SUB( 12 ); ADD( 9 ); ADD( 13 ); NEXT; // A5 += -A12 + A9 + A13
SUB( 13 ); ADD( 10 ); LAST; // A6 += -A13 + A10
SUB( 7 ); SUB( 11 ); NEXT; /* A0 += -A7 - A11 */
SUB( 8 ); SUB( 12 ); NEXT; /* A1 += -A8 - A12 */
SUB( 9 ); SUB( 13 ); NEXT; /* A2 += -A9 - A13 */
SUB( 10 ); ADD( 7 ); ADD( 11 ); NEXT; /* A3 += -A10 + A7 + A11 */
SUB( 11 ); ADD( 8 ); ADD( 12 ); NEXT; /* A4 += -A11 + A8 + A12 */
SUB( 12 ); ADD( 9 ); ADD( 13 ); NEXT; /* A5 += -A12 + A9 + A13 */
SUB( 13 ); ADD( 10 ); LAST; /* A6 += -A13 + A10 */
cleanup:
return( ret );
@ -1008,28 +1003,28 @@ static int ecp_mod_p256( mbedtls_mpi *N )
INIT( 256 );
ADD( 8 ); ADD( 9 );
SUB( 11 ); SUB( 12 ); SUB( 13 ); SUB( 14 ); NEXT; // A0
SUB( 11 ); SUB( 12 ); SUB( 13 ); SUB( 14 ); NEXT; /* A0 */
ADD( 9 ); ADD( 10 );
SUB( 12 ); SUB( 13 ); SUB( 14 ); SUB( 15 ); NEXT; // A1
SUB( 12 ); SUB( 13 ); SUB( 14 ); SUB( 15 ); NEXT; /* A1 */
ADD( 10 ); ADD( 11 );
SUB( 13 ); SUB( 14 ); SUB( 15 ); NEXT; // A2
SUB( 13 ); SUB( 14 ); SUB( 15 ); NEXT; /* A2 */
ADD( 11 ); ADD( 11 ); ADD( 12 ); ADD( 12 ); ADD( 13 );
SUB( 15 ); SUB( 8 ); SUB( 9 ); NEXT; // A3
SUB( 15 ); SUB( 8 ); SUB( 9 ); NEXT; /* A3 */
ADD( 12 ); ADD( 12 ); ADD( 13 ); ADD( 13 ); ADD( 14 );
SUB( 9 ); SUB( 10 ); NEXT; // A4
SUB( 9 ); SUB( 10 ); NEXT; /* A4 */
ADD( 13 ); ADD( 13 ); ADD( 14 ); ADD( 14 ); ADD( 15 );
SUB( 10 ); SUB( 11 ); NEXT; // A5
SUB( 10 ); SUB( 11 ); NEXT; /* A5 */
ADD( 14 ); ADD( 14 ); ADD( 15 ); ADD( 15 ); ADD( 14 ); ADD( 13 );
SUB( 8 ); SUB( 9 ); NEXT; // A6
SUB( 8 ); SUB( 9 ); NEXT; /* A6 */
ADD( 15 ); ADD( 15 ); ADD( 15 ); ADD( 8 );
SUB( 10 ); SUB( 11 ); SUB( 12 ); SUB( 13 ); LAST; // A7
SUB( 10 ); SUB( 11 ); SUB( 12 ); SUB( 13 ); LAST; /* A7 */
cleanup:
return( ret );
@ -1045,40 +1040,40 @@ static int ecp_mod_p384( mbedtls_mpi *N )
INIT( 384 );
ADD( 12 ); ADD( 21 ); ADD( 20 );
SUB( 23 ); NEXT; // A0
SUB( 23 ); NEXT; /* A0 */
ADD( 13 ); ADD( 22 ); ADD( 23 );
SUB( 12 ); SUB( 20 ); NEXT; // A2
SUB( 12 ); SUB( 20 ); NEXT; /* A2 */
ADD( 14 ); ADD( 23 );
SUB( 13 ); SUB( 21 ); NEXT; // A2
SUB( 13 ); SUB( 21 ); NEXT; /* A2 */
ADD( 15 ); ADD( 12 ); ADD( 20 ); ADD( 21 );
SUB( 14 ); SUB( 22 ); SUB( 23 ); NEXT; // A3
SUB( 14 ); SUB( 22 ); SUB( 23 ); NEXT; /* A3 */
ADD( 21 ); ADD( 21 ); ADD( 16 ); ADD( 13 ); ADD( 12 ); ADD( 20 ); ADD( 22 );
SUB( 15 ); SUB( 23 ); SUB( 23 ); NEXT; // A4
SUB( 15 ); SUB( 23 ); SUB( 23 ); NEXT; /* A4 */
ADD( 22 ); ADD( 22 ); ADD( 17 ); ADD( 14 ); ADD( 13 ); ADD( 21 ); ADD( 23 );
SUB( 16 ); NEXT; // A5
SUB( 16 ); NEXT; /* A5 */
ADD( 23 ); ADD( 23 ); ADD( 18 ); ADD( 15 ); ADD( 14 ); ADD( 22 );
SUB( 17 ); NEXT; // A6
SUB( 17 ); NEXT; /* A6 */
ADD( 19 ); ADD( 16 ); ADD( 15 ); ADD( 23 );
SUB( 18 ); NEXT; // A7
SUB( 18 ); NEXT; /* A7 */
ADD( 20 ); ADD( 17 ); ADD( 16 );
SUB( 19 ); NEXT; // A8
SUB( 19 ); NEXT; /* A8 */
ADD( 21 ); ADD( 18 ); ADD( 17 );
SUB( 20 ); NEXT; // A9
SUB( 20 ); NEXT; /* A9 */
ADD( 22 ); ADD( 19 ); ADD( 18 );
SUB( 21 ); NEXT; // A10
SUB( 21 ); NEXT; /* A10 */
ADD( 23 ); ADD( 20 ); ADD( 19 );
SUB( 22 ); LAST; // A11
SUB( 22 ); LAST; /* A11 */
cleanup:
return( ret );
@ -1207,9 +1202,9 @@ cleanup:
* Write N as A0 + 2^224 A1, return A0 + R * A1.
* Actually do two passes, since R is big.
*/
#define P_KOBLITZ_MAX ( 256 / 8 / sizeof( mbedtls_mpi_uint ) ) // Max limbs in P
#define P_KOBLITZ_R ( 8 / sizeof( mbedtls_mpi_uint ) ) // Limbs in R
static inline int ecp_mod_koblitz( mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p_limbs,
#define P_KOBLITZ_MAX ( 256 / 8 / sizeof( mbedtls_mpi_uint ) ) /* Max limbs in P */
#define P_KOBLITZ_R ( 8 / sizeof( mbedtls_mpi_uint ) ) /* Limbs in R */
static int ecp_mod_koblitz( mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p_limbs,
size_t adjust, size_t shift, mbedtls_mpi_uint mask )
{
int ret;

22
deps/mbedtls/error.c vendored
View File

@ -167,9 +167,9 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
{
use_ret = ret & 0xFF80;
// High level error codes
//
// BEGIN generated code
/* High level error codes
*
* BEGIN generated code */
#if defined(MBEDTLS_CIPHER_C)
if( use_ret == -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE) )
mbedtls_snprintf( buf, buflen, "CIPHER - The selected feature is not available" );
@ -481,7 +481,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
if( use_ret == -(MBEDTLS_ERR_X509_BUFFER_TOO_SMALL) )
mbedtls_snprintf( buf, buflen, "X509 - Destination buffer is too small" );
#endif /* MBEDTLS_X509_USE_C || MBEDTLS_X509_CREATE_C */
// END generated code
/* END generated code */
if( strlen( buf ) == 0 )
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
@ -492,9 +492,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
if( use_ret == 0 )
return;
// If high level code is present, make a concatenation between both
// error strings.
//
/* If high level code is present, make a concatenation between both
* error strings. */
len = strlen( buf );
if( len > 0 )
@ -508,9 +507,10 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
buflen -= len + 3;
}
// Low level error codes
//
// BEGIN generated code
/* Low level error codes
*
* BEGIN generated code
*/
#if defined(MBEDTLS_AES_C)
if( use_ret == -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH) )
mbedtls_snprintf( buf, buflen, "AES - Invalid key length" );
@ -679,7 +679,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
if( use_ret == -(MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH) )
mbedtls_snprintf( buf, buflen, "XTEA - The data input has an invalid length" );
#endif /* MBEDTLS_XTEA_C */
// END generated code
/* END generated code */
if( strlen( buf ) != 0 )
return;

View File

@ -32,8 +32,7 @@
#include <stddef.h>
#if !defined(MBEDTLS_ARC4_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -43,8 +43,7 @@
#define MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH -0x0018 /**< Invalid data input length. */
#if !defined(MBEDTLS_BLOWFISH_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -39,8 +39,7 @@
#define MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< Invalid data input length. */
#if !defined(MBEDTLS_CAMELLIA_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -40,8 +40,7 @@
#define MBEDTLS_DES_KEY_SIZE 8
#if !defined(MBEDTLS_DES_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -33,8 +33,7 @@
#include <stdint.h>
#if !defined(MBEDTLS_MD5_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -33,8 +33,7 @@
#include <stdint.h>
#if !defined(MBEDTLS_RIPEMD160_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -33,8 +33,7 @@
#include <stdint.h>
#if !defined(MBEDTLS_SHA1_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -33,8 +33,7 @@
#include <stdint.h>
#if !defined(MBEDTLS_SHA256_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

View File

@ -30,8 +30,7 @@
#endif
#if !defined(MBEDTLS_TIMING_ALT)
// Regular implementation
//
/* Regular implementation */
#include <stdint.h>

View File

@ -38,8 +38,7 @@
#define MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028 /**< The data input has an invalid length. */
#if !defined(MBEDTLS_XTEA_ALT)
// Regular implementation
//
/* Regular implementation */
#ifdef __cplusplus
extern "C" {

2
deps/mbedtls/pk.c vendored
View File

@ -158,7 +158,7 @@ int mbedtls_pk_can_do( const mbedtls_pk_context *ctx, mbedtls_pk_type_t type )
/*
* Helper for mbedtls_pk_sign and mbedtls_pk_verify
*/
static inline int pk_hashlen_helper( mbedtls_md_type_t md_alg, size_t *hash_len )
static int pk_hashlen_helper( mbedtls_md_type_t md_alg, size_t *hash_len )
{
const mbedtls_md_info_t *md_info;

14
deps/mbedtls/pkcs12.c vendored
View File

@ -261,7 +261,7 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
const mbedtls_md_info_t *md_info;
mbedtls_md_context_t md_ctx;
// This version only allows max of 64 bytes of password or salt
/* This version only allows max of 64 bytes of password or salt */
if( datalen > 128 || pwdlen > 64 || saltlen > 64 )
return( MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA );
@ -288,7 +288,7 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
p = data;
while( datalen > 0 )
{
// Calculate hash( diversifier || salt_block || pwd_block )
/* Calculate hash( diversifier || salt_block || pwd_block ) */
if( ( ret = mbedtls_md_starts( &md_ctx ) ) != 0 )
goto exit;
@ -304,7 +304,7 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
if( ( ret = mbedtls_md_finish( &md_ctx, hash_output ) ) != 0 )
goto exit;
// Perform remaining ( iterations - 1 ) recursive hash calculations
/* Perform remaining ( iterations - 1 ) recursive hash calculations */
for( i = 1; i < (size_t) iterations; i++ )
{
if( ( ret = mbedtls_md( md_info, hash_output, hlen, hash_output ) ) != 0 )
@ -319,15 +319,15 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
if( datalen == 0 )
break;
// Concatenating copies of hash_output into hash_block (B)
/* Concatenating copies of hash_output into hash_block (B) */
pkcs12_fill_buffer( hash_block, v, hash_output, hlen );
// B += 1
/* B += 1 */
for( i = v; i > 0; i-- )
if( ++hash_block[i - 1] != 0 )
break;
// salt_block += B
/* salt_block += B */
c = 0;
for( i = v; i > 0; i-- )
{
@ -336,7 +336,7 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
salt_block[i - 1] = j & 0xFF;
}
// pwd_block += B
/* pwd_block += B */
c = 0;
for( i = v; i > 0; i-- )
{

12
deps/mbedtls/pkcs5.c vendored
View File

@ -142,8 +142,7 @@ int mbedtls_pkcs5_pbes2( const mbedtls_asn1_buf *pbe_params, int mode,
if( ( ret = mbedtls_asn1_get_alg( &p, end, &kdf_alg_oid, &kdf_alg_params ) ) != 0 )
return( MBEDTLS_ERR_PKCS5_INVALID_FORMAT + ret );
// Only PBKDF2 supported at the moment
//
/* Only PBKDF2 supported at the moment */
if( MBEDTLS_OID_CMP( MBEDTLS_OID_PKCS5_PBKDF2, &kdf_alg_oid ) != 0 )
return( MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE );
@ -236,8 +235,7 @@ int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx, const unsigned char *p
while( key_length )
{
// U1 ends up in work
//
/* U1 ends up in work */
if( ( ret = mbedtls_md_hmac_starts( ctx, password, plen ) ) != 0 )
return( ret );
@ -254,8 +252,7 @@ int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx, const unsigned char *p
for( i = 1; i < iteration_count; i++ )
{
// U2 ends up in md1
//
/* U2 ends up in md1 */
if( ( ret = mbedtls_md_hmac_starts( ctx, password, plen ) ) != 0 )
return( ret );
@ -265,8 +262,7 @@ int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx, const unsigned char *p
if( ( ret = mbedtls_md_hmac_finish( ctx, md1 ) ) != 0 )
return( ret );
// U1 xor U2
//
/* U1 xor U2 */
for( j = 0; j < md_size; j++ )
work[j] ^= md1[j];
}

View File

@ -1013,9 +1013,9 @@ static int pk_parse_key_pkcs8_encrypted_der(
return( ret );
}
// Best guess for password mismatch when using RC4. If first tag is
// not MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE
//
/* Best guess for password mismatch when using RC4. If first tag is
* not MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE
*/
if( *buf != ( MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) )
return( MBEDTLS_ERR_PK_PASSWORD_MISMATCH );

4
deps/mbedtls/rsa.c vendored
View File

@ -698,7 +698,7 @@ int mbedtls_rsa_rsaes_pkcs1_v15_encrypt( mbedtls_rsa_context *ctx,
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V15 )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
// We don't check p_rng because it won't be dereferenced here
/* We don't check p_rng because it won't be dereferenced here */
if( f_rng == NULL || input == NULL || output == NULL )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
@ -816,7 +816,7 @@ int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
hlen = mbedtls_md_get_size( md_info );
// checking for integer underflow
/* checking for integer underflow */
if( 2 * hlen + 2 > ilen )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );

View File

@ -199,8 +199,7 @@ static int x509_write_name( unsigned char **p, unsigned char *start,
int ret;
size_t len = 0;
// Write PrintableString for all except MBEDTLS_OID_PKCS9_EMAIL
//
/* Write PrintableString for all except MBEDTLS_OID_PKCS9_EMAIL */
if( MBEDTLS_OID_SIZE( MBEDTLS_OID_PKCS9_EMAIL ) == oid_len &&
memcmp( oid, MBEDTLS_OID_PKCS9_EMAIL, oid_len ) == 0 )
{
@ -215,8 +214,7 @@ static int x509_write_name( unsigned char **p, unsigned char *start,
name_len ) );
}
// Write OID
//
/* Write OID */
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_oid( p, start, oid, oid_len ) );
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) );
@ -275,8 +273,7 @@ int mbedtls_x509_write_sig( unsigned char **p, unsigned char *start,
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) );
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_BIT_STRING ) );
// Write OID
//
/* Write OID */
MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_algorithm_identifier( p, start, oid,
oid_len, 0 ) );

View File

@ -499,8 +499,8 @@ int mbedtls_x509_crl_parse( mbedtls_x509_crl *chain, const unsigned char *buf, s
{
mbedtls_pem_init( &pem );
// Avoid calling mbedtls_pem_read_buffer() on non-null-terminated
// string
/* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated
* string */
if( buflen == 0 || buf[buflen - 1] != '\0' )
ret = MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT;
else

View File

@ -676,7 +676,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
if( crt == NULL || buf == NULL )
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
// Use the original buffer until we figure out actual length
/* Use the original buffer until we figure out actual length */
p = (unsigned char*) buf;
len = buflen;
end = p + len;
@ -702,7 +702,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
}
crt_end = p + len;
// Create and populate a new buffer for the raw field
/* Create and populate a new buffer for the raw field */
crt->raw.len = crt_end - buf;
crt->raw.p = p = mbedtls_calloc( 1, crt->raw.len );
if( p == NULL )
@ -710,7 +710,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
memcpy( p, buf, crt->raw.len );
// Direct pointers to the new buffer
/* Direct pointers to the new buffer */
p += crt->raw.len - len;
end = crt_end = p + len;
@ -1199,8 +1199,7 @@ cleanup:
if( !S_ISREG( sb.st_mode ) )
continue;
// Ignore parse errors
//
/* Ignore parse errors */
t_ret = mbedtls_x509_crt_parse_file( chain, entry_name );
if( t_ret < 0 )
ret++;

10
dirs.c
View File

@ -140,7 +140,7 @@ bool dir_is_empty(enum rarch_dir_type type)
switch (type)
{
case RARCH_DIR_SYSTEM:
return string_is_empty(dir_savefile);
return string_is_empty(dir_system);
case RARCH_DIR_SAVEFILE:
return string_is_empty(dir_savefile);
case RARCH_DIR_CURRENT_SAVEFILE:
@ -291,12 +291,10 @@ void dir_check_defaults(void)
/* early return for people with a custom folder setup
so it doesn't create unnecessary directories
*/
#ifdef ORBIS
if (filestream_exists("host0:app/custom.ini"))
#elif defined(ANDROID)
if (filestream_exists("host0:app/custom.ini"))
#if defined(ORBIS) || defined(ANDROID)
if (path_is_valid("host0:app/custom.ini"))
#else
if (filestream_exists("custom.ini"))
if (path_is_valid("custom.ini"))
#endif
return;

View File

@ -40,8 +40,7 @@
#endif
#ifdef HAVE_CHEEVOS
#include "../cheevos/cheevos.h"
#include "../cheevos-new/cheevos.h" /* RCHEEVOS TODO: remove line */
#include "../cheevos-new/cheevos.h"
#endif
#ifdef HAVE_MENU
@ -139,7 +138,7 @@ static bool discord_download_avatar(
fill_pathname_join(full_path, buf, avatar_id, sizeof(full_path));
strlcpy(user_avatar, avatar_id, sizeof(user_avatar));
if(filestream_exists(full_path))
if (path_is_valid(full_path))
return true;
if (string_is_empty(avatar_id))
@ -392,6 +391,7 @@ void discord_update(enum discord_presence presence)
discord_presence.partyId = NULL;
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
discord_presence.joinSecret = (const char*)'\0';
connecting = false;
}
}
@ -434,6 +434,7 @@ void discord_update(enum discord_presence presence)
discord_presence.partyId = NULL;
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
discord_presence.joinSecret = (const char*)'\0';
connecting = false;
}
}
@ -442,6 +443,7 @@ void discord_update(enum discord_presence presence)
discord_presence.partyId = NULL;
discord_presence.partyMax = 0;
discord_presence.partySize = 0;
discord_presence.joinSecret = (const char*)'\0';
connecting = false;
default:
break;

394
dynamic.c
View File

@ -36,8 +36,7 @@
#endif
#ifdef HAVE_CHEEVOS
#include "cheevos/cheevos.h"
#include "cheevos-new/cheevos.h" /* RCHEEVOS TODO: remove line */
#include "cheevos-new/cheevos.h"
#endif
#if defined(HAVE_OPENGL)
@ -323,14 +322,11 @@ static void libretro_get_environment_info(void (*func)(retro_environment_t),
ignore_environment_cb = false;
}
static bool load_dynamic_core(void)
static bool load_dynamic_core(const char *path, char *buf, size_t size)
{
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
/* Can't lookup symbols in itself on UWP */
#else
function_t sym = dylib_proc(NULL, "retro_init");
if (sym)
#if !(defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
if (dylib_proc(NULL, "retro_init"))
{
/* Try to verify that -lretro was not linked in from other modules
* since loading it dynamically and with -l will fail hard. */
@ -343,33 +339,12 @@ static bool load_dynamic_core(void)
}
#endif
if (string_is_empty(path_get(RARCH_PATH_CORE)))
{
RARCH_ERR("RetroArch is built for dynamic libretro cores, but "
"libretro_path is not set. Cannot continue.\n");
retroarch_fail(1, "init_libretro_sym()");
}
/* Need to use absolute path for this setting. It can be
* saved to content history, and a relative path would
* break in that scenario. */
path_resolve_realpath(
path_get_ptr(RARCH_PATH_CORE),
path_get_realsize(RARCH_PATH_CORE));
RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
path_get(RARCH_PATH_CORE));
lib_handle = dylib_load(path_get(RARCH_PATH_CORE));
if (lib_handle)
path_resolve_realpath(buf, size);
if ((lib_handle = dylib_load(path)))
return true;
RARCH_ERR("Failed to open libretro core: \"%s\"\n",
path_get(RARCH_PATH_CORE));
RARCH_ERR("Error(s): %s\n", dylib_error());
runloop_msg_queue_push(msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false;
}
@ -380,13 +355,7 @@ static dylib_t libretro_get_system_info_lib(const char *path,
void (*proc)(struct retro_system_info*);
if (!lib)
{
RARCH_ERR("%s: \"%s\"\n",
msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE),
path);
RARCH_ERR("Error(s): %s\n", dylib_error());
return NULL;
}
proc = (void (*)(struct retro_system_info*))
dylib_proc(lib, "retro_get_system_info");
@ -406,10 +375,8 @@ static dylib_t libretro_get_system_info_lib(const char *path,
set_environ = (void (*)(retro_environment_t))
dylib_proc(lib, "retro_set_environment");
if (!set_environ)
return lib;
libretro_get_environment_info(set_environ, load_no_content);
if (set_environ)
libretro_get_environment_info(set_environ, load_no_content);
}
return lib;
@ -451,7 +418,13 @@ bool libretro_get_system_info(const char *path,
path, &dummy_info, load_no_content);
if (!lib)
{
RARCH_ERR("%s: \"%s\"\n",
msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE),
path);
RARCH_ERR("Error(s): %s\n", dylib_error());
return false;
}
#else
if (load_no_content)
{
@ -500,6 +473,33 @@ bool libretro_get_system_info(const char *path,
return true;
}
#define CORE_SYMBOLS(x) \
x(retro_init); \
x(retro_deinit); \
x(retro_api_version); \
x(retro_get_system_info); \
x(retro_get_system_av_info); \
x(retro_set_environment); \
x(retro_set_video_refresh); \
x(retro_set_audio_sample); \
x(retro_set_audio_sample_batch); \
x(retro_set_input_poll); \
x(retro_set_input_state); \
x(retro_set_controller_port_device); \
x(retro_reset); \
x(retro_run); \
x(retro_serialize_size); \
x(retro_serialize); \
x(retro_unserialize); \
x(retro_cheat_reset); \
x(retro_cheat_set); \
x(retro_load_game); \
x(retro_load_game_special); \
x(retro_unload_game); \
x(retro_get_region); \
x(retro_get_memory_data); \
x(retro_get_memory_size);
/**
* load_symbols:
* @type : Type of core to be loaded.
@ -509,7 +509,8 @@ bool libretro_get_system_info(const char *path,
* Setup libretro callback symbols. Returns true on success,
* or false if symbols could not be loaded.
**/
bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *current_core, const char *lib_path, void *_lib_handle_p)
bool init_libretro_sym_custom(enum rarch_core_type type,
struct retro_core_t *current_core, const char *lib_path, void *_lib_handle_p)
{
#ifdef HAVE_DYNAMIC
/* the library handle for use with the SYMBOL macro */
@ -526,8 +527,30 @@ bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *cu
if (!lib_path || !lib_handle_p)
#endif
{
if (!load_dynamic_core())
const char *path = path_get(RARCH_PATH_CORE);
if (string_is_empty(path))
{
RARCH_ERR("Frontend is built for dynamic libretro cores, but "
"path is not set. Cannot continue.\n");
retroarch_fail(1, "init_libretro_sym()");
}
RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
path);
if (!load_dynamic_core(
path,
path_get_ptr(RARCH_PATH_CORE),
path_get_realsize(RARCH_PATH_CORE)
))
{
RARCH_ERR("Failed to open libretro core: \"%s\"\n", path);
RARCH_ERR("Error(s): %s\n", dylib_error());
runloop_msg_queue_push(msg_hash_to_str(MSG_FAILED_TO_OPEN_LIBRETRO_CORE),
1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false;
}
lib_handle_local = lib_handle;
}
#ifdef HAVE_RUNAHEAD
@ -546,296 +569,40 @@ bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *cu
#endif
#endif
SYMBOL(retro_init);
SYMBOL(retro_deinit);
SYMBOL(retro_api_version);
SYMBOL(retro_get_system_info);
SYMBOL(retro_get_system_av_info);
SYMBOL(retro_set_environment);
SYMBOL(retro_set_video_refresh);
SYMBOL(retro_set_audio_sample);
SYMBOL(retro_set_audio_sample_batch);
SYMBOL(retro_set_input_poll);
SYMBOL(retro_set_input_state);
SYMBOL(retro_set_controller_port_device);
SYMBOL(retro_reset);
SYMBOL(retro_run);
SYMBOL(retro_serialize_size);
SYMBOL(retro_serialize);
SYMBOL(retro_unserialize);
SYMBOL(retro_cheat_reset);
SYMBOL(retro_cheat_set);
SYMBOL(retro_load_game);
SYMBOL(retro_load_game_special);
SYMBOL(retro_unload_game);
SYMBOL(retro_get_region);
SYMBOL(retro_get_memory_data);
SYMBOL(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL);
}
break;
case CORE_TYPE_DUMMY:
SYMBOL_DUMMY(retro_init);
SYMBOL_DUMMY(retro_deinit);
SYMBOL_DUMMY(retro_api_version);
SYMBOL_DUMMY(retro_get_system_info);
SYMBOL_DUMMY(retro_get_system_av_info);
SYMBOL_DUMMY(retro_set_environment);
SYMBOL_DUMMY(retro_set_video_refresh);
SYMBOL_DUMMY(retro_set_audio_sample);
SYMBOL_DUMMY(retro_set_audio_sample_batch);
SYMBOL_DUMMY(retro_set_input_poll);
SYMBOL_DUMMY(retro_set_input_state);
SYMBOL_DUMMY(retro_set_controller_port_device);
SYMBOL_DUMMY(retro_reset);
SYMBOL_DUMMY(retro_run);
SYMBOL_DUMMY(retro_serialize_size);
SYMBOL_DUMMY(retro_serialize);
SYMBOL_DUMMY(retro_unserialize);
SYMBOL_DUMMY(retro_cheat_reset);
SYMBOL_DUMMY(retro_cheat_set);
SYMBOL_DUMMY(retro_load_game);
SYMBOL_DUMMY(retro_load_game_special);
SYMBOL_DUMMY(retro_unload_game);
SYMBOL_DUMMY(retro_get_region);
SYMBOL_DUMMY(retro_get_memory_data);
SYMBOL_DUMMY(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_DUMMY);
break;
case CORE_TYPE_FFMPEG:
#ifdef HAVE_FFMPEG
SYMBOL_FFMPEG(retro_init);
SYMBOL_FFMPEG(retro_deinit);
SYMBOL_FFMPEG(retro_api_version);
SYMBOL_FFMPEG(retro_get_system_info);
SYMBOL_FFMPEG(retro_get_system_av_info);
SYMBOL_FFMPEG(retro_set_environment);
SYMBOL_FFMPEG(retro_set_video_refresh);
SYMBOL_FFMPEG(retro_set_audio_sample);
SYMBOL_FFMPEG(retro_set_audio_sample_batch);
SYMBOL_FFMPEG(retro_set_input_poll);
SYMBOL_FFMPEG(retro_set_input_state);
SYMBOL_FFMPEG(retro_set_controller_port_device);
SYMBOL_FFMPEG(retro_reset);
SYMBOL_FFMPEG(retro_run);
SYMBOL_FFMPEG(retro_serialize_size);
SYMBOL_FFMPEG(retro_serialize);
SYMBOL_FFMPEG(retro_unserialize);
SYMBOL_FFMPEG(retro_cheat_reset);
SYMBOL_FFMPEG(retro_cheat_set);
SYMBOL_FFMPEG(retro_load_game);
SYMBOL_FFMPEG(retro_load_game_special);
SYMBOL_FFMPEG(retro_unload_game);
SYMBOL_FFMPEG(retro_get_region);
SYMBOL_FFMPEG(retro_get_memory_data);
SYMBOL_FFMPEG(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_FFMPEG);
#endif
break;
case CORE_TYPE_MPV:
#ifdef HAVE_MPV
SYMBOL_MPV(retro_init);
SYMBOL_MPV(retro_deinit);
SYMBOL_MPV(retro_api_version);
SYMBOL_MPV(retro_get_system_info);
SYMBOL_MPV(retro_get_system_av_info);
SYMBOL_MPV(retro_set_environment);
SYMBOL_MPV(retro_set_video_refresh);
SYMBOL_MPV(retro_set_audio_sample);
SYMBOL_MPV(retro_set_audio_sample_batch);
SYMBOL_MPV(retro_set_input_poll);
SYMBOL_MPV(retro_set_input_state);
SYMBOL_MPV(retro_set_controller_port_device);
SYMBOL_MPV(retro_reset);
SYMBOL_MPV(retro_run);
SYMBOL_MPV(retro_serialize_size);
SYMBOL_MPV(retro_serialize);
SYMBOL_MPV(retro_unserialize);
SYMBOL_MPV(retro_cheat_reset);
SYMBOL_MPV(retro_cheat_set);
SYMBOL_MPV(retro_load_game);
SYMBOL_MPV(retro_load_game_special);
SYMBOL_MPV(retro_unload_game);
SYMBOL_MPV(retro_get_region);
SYMBOL_MPV(retro_get_memory_data);
SYMBOL_MPV(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_MPV);
#endif
break;
case CORE_TYPE_IMAGEVIEWER:
#ifdef HAVE_IMAGEVIEWER
SYMBOL_IMAGEVIEWER(retro_init);
SYMBOL_IMAGEVIEWER(retro_deinit);
SYMBOL_IMAGEVIEWER(retro_api_version);
SYMBOL_IMAGEVIEWER(retro_get_system_info);
SYMBOL_IMAGEVIEWER(retro_get_system_av_info);
SYMBOL_IMAGEVIEWER(retro_set_environment);
SYMBOL_IMAGEVIEWER(retro_set_video_refresh);
SYMBOL_IMAGEVIEWER(retro_set_audio_sample);
SYMBOL_IMAGEVIEWER(retro_set_audio_sample_batch);
SYMBOL_IMAGEVIEWER(retro_set_input_poll);
SYMBOL_IMAGEVIEWER(retro_set_input_state);
SYMBOL_IMAGEVIEWER(retro_set_controller_port_device);
SYMBOL_IMAGEVIEWER(retro_reset);
SYMBOL_IMAGEVIEWER(retro_run);
SYMBOL_IMAGEVIEWER(retro_serialize_size);
SYMBOL_IMAGEVIEWER(retro_serialize);
SYMBOL_IMAGEVIEWER(retro_unserialize);
SYMBOL_IMAGEVIEWER(retro_cheat_reset);
SYMBOL_IMAGEVIEWER(retro_cheat_set);
SYMBOL_IMAGEVIEWER(retro_load_game);
SYMBOL_IMAGEVIEWER(retro_load_game_special);
SYMBOL_IMAGEVIEWER(retro_unload_game);
SYMBOL_IMAGEVIEWER(retro_get_region);
SYMBOL_IMAGEVIEWER(retro_get_memory_data);
SYMBOL_IMAGEVIEWER(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_IMAGEVIEWER);
#endif
break;
case CORE_TYPE_NETRETROPAD:
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD)
SYMBOL_NETRETROPAD(retro_init);
SYMBOL_NETRETROPAD(retro_deinit);
SYMBOL_NETRETROPAD(retro_api_version);
SYMBOL_NETRETROPAD(retro_get_system_info);
SYMBOL_NETRETROPAD(retro_get_system_av_info);
SYMBOL_NETRETROPAD(retro_set_environment);
SYMBOL_NETRETROPAD(retro_set_video_refresh);
SYMBOL_NETRETROPAD(retro_set_audio_sample);
SYMBOL_NETRETROPAD(retro_set_audio_sample_batch);
SYMBOL_NETRETROPAD(retro_set_input_poll);
SYMBOL_NETRETROPAD(retro_set_input_state);
SYMBOL_NETRETROPAD(retro_set_controller_port_device);
SYMBOL_NETRETROPAD(retro_reset);
SYMBOL_NETRETROPAD(retro_run);
SYMBOL_NETRETROPAD(retro_serialize_size);
SYMBOL_NETRETROPAD(retro_serialize);
SYMBOL_NETRETROPAD(retro_unserialize);
SYMBOL_NETRETROPAD(retro_cheat_reset);
SYMBOL_NETRETROPAD(retro_cheat_set);
SYMBOL_NETRETROPAD(retro_load_game);
SYMBOL_NETRETROPAD(retro_load_game_special);
SYMBOL_NETRETROPAD(retro_unload_game);
SYMBOL_NETRETROPAD(retro_get_region);
SYMBOL_NETRETROPAD(retro_get_memory_data);
SYMBOL_NETRETROPAD(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_NETRETROPAD);
#endif
break;
case CORE_TYPE_VIDEO_PROCESSOR:
#if defined(HAVE_VIDEOPROCESSOR)
SYMBOL_VIDEOPROCESSOR(retro_init);
SYMBOL_VIDEOPROCESSOR(retro_deinit);
SYMBOL_VIDEOPROCESSOR(retro_api_version);
SYMBOL_VIDEOPROCESSOR(retro_get_system_info);
SYMBOL_VIDEOPROCESSOR(retro_get_system_av_info);
SYMBOL_VIDEOPROCESSOR(retro_set_environment);
SYMBOL_VIDEOPROCESSOR(retro_set_video_refresh);
SYMBOL_VIDEOPROCESSOR(retro_set_audio_sample);
SYMBOL_VIDEOPROCESSOR(retro_set_audio_sample_batch);
SYMBOL_VIDEOPROCESSOR(retro_set_input_poll);
SYMBOL_VIDEOPROCESSOR(retro_set_input_state);
SYMBOL_VIDEOPROCESSOR(retro_set_controller_port_device);
SYMBOL_VIDEOPROCESSOR(retro_reset);
SYMBOL_VIDEOPROCESSOR(retro_run);
SYMBOL_VIDEOPROCESSOR(retro_serialize_size);
SYMBOL_VIDEOPROCESSOR(retro_serialize);
SYMBOL_VIDEOPROCESSOR(retro_unserialize);
SYMBOL_VIDEOPROCESSOR(retro_cheat_reset);
SYMBOL_VIDEOPROCESSOR(retro_cheat_set);
SYMBOL_VIDEOPROCESSOR(retro_load_game);
SYMBOL_VIDEOPROCESSOR(retro_load_game_special);
SYMBOL_VIDEOPROCESSOR(retro_unload_game);
SYMBOL_VIDEOPROCESSOR(retro_get_region);
SYMBOL_VIDEOPROCESSOR(retro_get_memory_data);
SYMBOL_VIDEOPROCESSOR(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_VIDEOPROCESSOR);
#endif
break;
case CORE_TYPE_GONG:
#ifdef HAVE_EASTEREGG
SYMBOL_GONG(retro_init);
SYMBOL_GONG(retro_deinit);
SYMBOL_GONG(retro_api_version);
SYMBOL_GONG(retro_get_system_info);
SYMBOL_GONG(retro_get_system_av_info);
SYMBOL_GONG(retro_set_environment);
SYMBOL_GONG(retro_set_video_refresh);
SYMBOL_GONG(retro_set_audio_sample);
SYMBOL_GONG(retro_set_audio_sample_batch);
SYMBOL_GONG(retro_set_input_poll);
SYMBOL_GONG(retro_set_input_state);
SYMBOL_GONG(retro_set_controller_port_device);
SYMBOL_GONG(retro_reset);
SYMBOL_GONG(retro_run);
SYMBOL_GONG(retro_serialize_size);
SYMBOL_GONG(retro_serialize);
SYMBOL_GONG(retro_unserialize);
SYMBOL_GONG(retro_cheat_reset);
SYMBOL_GONG(retro_cheat_set);
SYMBOL_GONG(retro_load_game);
SYMBOL_GONG(retro_load_game_special);
SYMBOL_GONG(retro_unload_game);
SYMBOL_GONG(retro_get_region);
SYMBOL_GONG(retro_get_memory_data);
SYMBOL_GONG(retro_get_memory_size);
CORE_SYMBOLS(SYMBOL_GONG);
#endif
break;
}
@ -843,11 +610,6 @@ bool init_libretro_sym_custom(enum rarch_core_type type, struct retro_core_t *cu
return true;
}
static bool load_symbols(enum rarch_core_type type, struct retro_core_t *current_core)
{
return init_libretro_sym_custom(type, current_core, NULL, NULL);
}
/**
* init_libretro_sym:
* @type : Type of core to be loaded.
@ -860,7 +622,8 @@ static bool load_symbols(enum rarch_core_type type, struct retro_core_t *current
**/
bool init_libretro_sym(enum rarch_core_type type, struct retro_core_t *current_core)
{
if (!load_symbols(type, current_core))
/* Load symbols */
if (!init_libretro_sym_custom(type, current_core, NULL, NULL))
return false;
#ifdef HAVE_RUNAHEAD
@ -1263,7 +1026,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
const struct retro_message *msg = (const struct retro_message*)data;
RARCH_LOG("Environ SET_MESSAGE: %s\n", msg->msg);
#ifdef HAVE_MENU_WIDGETS
if (!menu_widgets_set_libretro_message(msg->msg, msg->frames / 60 * 1000))
if (!menu_widgets_set_libretro_message(msg->msg, roundf((float)msg->frames / 60.0f * 1000.0f)))
#endif
runloop_msg_queue_push(msg->msg, 3, msg->frames, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
@ -1946,8 +1709,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
{
bool state = *(const bool*)data;
RARCH_LOG("Environ SET_SUPPORT_ACHIEVEMENTS: %s.\n", state ? "yes" : "no");
/* RCHEEVOS TODO: remove settings test */
!settings->bools.cheevos_old_enable ? rcheevos_set_support_cheevos(state) : cheevos_set_support_cheevos(state);
rcheevos_set_support_cheevos(state);
}
#endif
break;

View File

@ -447,14 +447,16 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
fill_pathname_join(assets_zip_path, bundle_path_buf, "assets.zip", sizeof(assets_zip_path));
if (filestream_exists(assets_zip_path))
if (path_is_valid(assets_zip_path))
{
settings_t *settings = config_get_ptr();
RARCH_LOG("Assets ZIP found at [%s], setting up bundle assets extraction...\n", assets_zip_path);
RARCH_LOG("Extraction dir will be: %s\n", home_dir_buf);
strlcpy(settings->arrays.bundle_assets_src, assets_zip_path, sizeof(settings->arrays.bundle_assets_src));
strlcpy(settings->arrays.bundle_assets_dst, home_dir_buf, sizeof(settings->arrays.bundle_assets_dst));
strlcpy(settings->arrays.bundle_assets_src,
assets_zip_path, sizeof(settings->arrays.bundle_assets_src));
strlcpy(settings->arrays.bundle_assets_dst,
home_dir_buf, sizeof(settings->arrays.bundle_assets_dst));
settings->uints.bundle_assets_extract_version_current = 130; /* TODO/FIXME: Just hardcode this for now */
}
#endif

View File

@ -418,7 +418,7 @@ static void frontend_gx_process_args(int *argc, char *argv[])
{
char path[PATH_MAX_LENGTH] = {0};
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));
if (filestream_exists(path))
if (path_is_valid(path))
path_set(RARCH_PATH_CORE, path);
}
#endif

View File

@ -126,7 +126,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
#ifdef HAVE_MULTIMAN
/* not launched from external launcher, set default path */
// second param is multiMAN SELF file
if ( filestream_exists(argv[2]) && *argc > 1
if ( path_is_valid(argv[2]) && *argc > 1
&& (string_is_equal(argv[2], EMULATOR_CONTENT_DIR)))
{
multiman_detected = true;
@ -606,7 +606,7 @@ static void frontend_ps3_process_args(int *argc, char *argv[])
{
char path[PATH_MAX_LENGTH] = {0};
strlcpy(path, argv[0], sizeof(path));
if (filestream_exists(path))
if (path_is_valid(path))
path_set(RARCH_PATH_CORE, path);
}
#endif

View File

@ -8,7 +8,6 @@
#include <dirent.h>
#include <file/nbio.h>
#include <formats/rpng.h>
#include <formats/image.h>
#ifdef HAVE_LIBNX
@ -162,6 +161,7 @@ static void get_first_valid_core(char *path_return)
static void frontend_switch_get_environment_settings(int *argc, char *argv[], void *args, void *params_data)
{
unsigned i;
(void)args;
#ifndef IS_SALAMANDER
@ -246,16 +246,17 @@ static void frontend_switch_get_environment_settings(int *argc, char *argv[], vo
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], g_defaults.dirs[DEFAULT_DIR_PORT],
"logs", sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
int i = 0;
for (i; i < DEFAULT_DIR_LAST; i++)
for (i = 0; i < DEFAULT_DIR_LAST; i++)
{
const char *dir_path = g_defaults.dirs[i];
if (!string_is_empty(dir_path))
path_mkdir(dir_path);
}
fill_pathname_join(g_defaults.path.config, g_defaults.dirs[DEFAULT_DIR_PORT],
file_path_str(FILE_PATH_MAIN_CONFIG), sizeof(g_defaults.path.config));
fill_pathname_join(g_defaults.path.config,
g_defaults.dirs[DEFAULT_DIR_PORT],
file_path_str(FILE_PATH_MAIN_CONFIG),
sizeof(g_defaults.path.config));
}
extern switch_ctx_data_t *nx_ctx_ptr;
@ -300,14 +301,12 @@ static void frontend_switch_exec(const char *path, bool should_load_game)
{
char game_path[PATH_MAX-4];
const char *arg_data[3];
char error_string[200 + PATH_MAX];
int args = 0;
int error = 0;
int args = 0;
game_path[0] = NULL;
arg_data[0] = NULL;
game_path[0] = NULL;
arg_data[0] = NULL;
arg_data[args] = elf_path_cst;
arg_data[args] = elf_path_cst;
arg_data[args + 1] = NULL;
args++;
@ -327,9 +326,8 @@ static void frontend_switch_exec(const char *path, bool should_load_game)
{
#ifdef IS_SALAMANDER
struct stat sbuff;
bool file_exists;
bool file_exists = stat(path, &sbuff) == 0;
file_exists = stat(path, &sbuff) == 0;
if (!file_exists)
{
char core_path[PATH_MAX];
@ -338,23 +336,14 @@ static void frontend_switch_exec(const char *path, bool should_load_game)
get_first_valid_core(&core_path[0]);
if (core_path[0] == '\0')
{
/*errorInit(&error_dialog, ERROR_TEXT, CFG_LANGUAGE_EN);
errorText(&error_dialog, "There are no cores installed, install a core to continue.");
errorDisp(&error_dialog);*/
svcExitProcess();
}
}
#endif
char *argBuffer = (char *)malloc(PATH_MAX);
if (should_load_game)
{
snprintf(argBuffer, PATH_MAX, "%s \"%s\"", path, game_path);
}
else
{
snprintf(argBuffer, PATH_MAX, "%s", path);
}
envSetNextLoad(path, argBuffer);
}
@ -407,7 +396,10 @@ static void frontend_switch_exitspawn(char *s, size_t len)
frontend_switch_exec(s, should_load_game);
}
void argb_to_rgba8(uint32_t *buff, uint32_t height, uint32_t width)
#if 0
/* TODO/FIXME - should be refactored into something that can be used for all
* RetroArch versions, and not just Switch */
static void argb_to_rgba8(uint32_t *buff, uint32_t height, uint32_t width)
{
uint32_t h, w;
/* Convert */
@ -428,7 +420,7 @@ void argb_to_rgba8(uint32_t *buff, uint32_t height, uint32_t width)
}
}
void frontend_switch_showsplash(void)
static void frontend_switch_showsplash(void)
{
printf("[Splash] Showing splashScreen\n");
@ -453,7 +445,7 @@ void frontend_switch_showsplash(void)
}
/* From rpng_test.c */
bool rpng_load_image_argb(const char *path,
static bool rpng_load_image_argb(const char *path,
uint32_t **data, unsigned *width, unsigned *height)
{
int retval;
@ -487,7 +479,7 @@ bool rpng_load_image_argb(const char *path,
goto end;
}
if (!rpng_set_buf_ptr(rpng, (uint8_t *)ptr))
if (!rpng_set_buf_ptr(rpng, (uint8_t *)ptr, file_len))
{
ret = false;
goto end;
@ -531,6 +523,7 @@ end:
return ret;
}
#endif
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
@ -694,23 +687,22 @@ extern void retro_get_system_info(struct retro_system_info *info);
static void frontend_switch_init(void *data)
{
(void)data;
#ifdef HAVE_LIBNX
bool recording_supported = false;
uint32_t width = 0;
uint32_t height = 0;
nifmInitialize();
if(hosversionBefore(8, 0, 0)) {
if(hosversionBefore(8, 0, 0))
pcvInitialize();
} else {
else
clkrstInitialize();
}
appletLockExit();
appletHook(&applet_hook_cookie, on_applet_hook, NULL);
appletSetFocusHandlingMode(AppletFocusHandlingMode_NoSuspend);
bool recording_supported = false;
appletIsGamePlayRecordingSupported(&recording_supported);
if(recording_supported)
appletInitializeGamePlayRecording();
@ -726,32 +718,31 @@ static void frontend_switch_init(void *data)
Result rc;
rc = psmInitialize();
if (R_SUCCEEDED(rc))
{
psmInitialized = true;
}
else
{
RARCH_WARN("Error initializing psm\n");
}
rarch_system_info_t *sys_info = runloop_get_system_info();
retro_get_system_info(sys_info);
const char *core_name = NULL;
uint32_t width, height;
width = height = 0;
#if 0
#ifndef HAVE_OPENGL
/* Load splash */
if (!splashData)
{
rarch_system_info_t *sys_info = runloop_get_system_info();
retro_get_system_info(sys_info);
if (sys_info)
{
core_name = sys_info->info.library_name;
char *full_core_splash_path = (char *)malloc(PATH_MAX);
snprintf(full_core_splash_path, PATH_MAX, "/retroarch/rgui/splash/%s.png", core_name);
const char *core_name = sys_info->info.library_name;
char *full_core_splash_path = (char*)malloc(PATH_MAX);
snprintf(full_core_splash_path,
PATH_MAX, "/retroarch/rgui/splash/%s.png", core_name);
rpng_load_image_argb((const char *)
full_core_splash_path, &splashData, &width, &height);
rpng_load_image_argb((const char *)full_core_splash_path, &splashData, &width, &height);
if (splashData)
{
argb_to_rgba8(splashData, height, width);
@ -759,7 +750,10 @@ static void frontend_switch_init(void *data)
}
else
{
rpng_load_image_argb("/retroarch/rgui/splash/RetroArch.png", &splashData, &width, &height);
rpng_load_image_argb(
"/retroarch/rgui/splash/RetroArch.png",
&splashData, &width, &height);
if (splashData)
{
argb_to_rgba8(splashData, height, width);
@ -771,7 +765,10 @@ static void frontend_switch_init(void *data)
}
else
{
rpng_load_image_argb("/retroarch/rgui/splash/RetroArch.png", &splashData, &width, &height);
rpng_load_image_argb(
"/retroarch/rgui/splash/RetroArch.png",
&splashData, &width, &height);
if (splashData)
{
argb_to_rgba8(splashData, height, width);
@ -784,6 +781,8 @@ static void frontend_switch_init(void *data)
frontend_switch_showsplash();
}
#endif
#endif
#endif /* HAVE_LIBNX (splash) */
}
@ -801,14 +800,17 @@ static int frontend_switch_parse_drive_list(void *data, bool load_content)
{
#ifndef IS_SALAMANDER
file_list_t *list = (file_list_t *)data;
enum msg_hash_enums enum_idx = load_content ? MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : MSG_UNKNOWN;
enum msg_hash_enums enum_idx = load_content
? MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR
: MSG_UNKNOWN;
if (!list)
return -1;
menu_entries_append_enum(list, "/", msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
menu_entries_append_enum(list,
"/", msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
#endif
return 0;
@ -831,14 +833,14 @@ static uint64_t frontend_switch_get_mem_used(void)
return memoryUsed;
}
static enum frontend_powerstate frontend_switch_get_powerstate(int *seconds, int *percent)
static enum frontend_powerstate
frontend_switch_get_powerstate(int *seconds, int *percent)
{
if (!psmInitialized)
return FRONTEND_POWERSTATE_NONE;
uint32_t pct;
ChargerType ct;
Result rc;
if (!psmInitialized)
return FRONTEND_POWERSTATE_NONE;
rc = psmGetBatteryChargePercentage(&pct);
if (!R_SUCCEEDED(rc))
@ -855,41 +857,47 @@ static enum frontend_powerstate frontend_switch_get_powerstate(int *seconds, int
switch (ct)
{
case ChargerType_Charger:
case ChargerType_Usb:
return FRONTEND_POWERSTATE_CHARGING;
default:
break;
case ChargerType_Charger:
case ChargerType_Usb:
return FRONTEND_POWERSTATE_CHARGING;
default:
break;
}
return FRONTEND_POWERSTATE_NO_SOURCE;
}
static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor)
static void frontend_switch_get_os(
char *s, size_t len, int *major, int *minor)
{
#ifdef HAVE_LIBNX
u32 hosVersion;
#else
int patch;
char firmware_version[0x100];
result_t r; /* used by LIB_ASSERT_OK macros */
ipc_object_t set_sys;
ipc_request_t rq;
#endif
strlcpy(s, "Horizon OS", len);
#ifdef HAVE_LIBNX
*major = 0;
*minor = 0;
u32 hosVersion = hosversionGet();
*major = HOSVER_MAJOR(hosVersion);
*minor = HOSVER_MINOR(hosVersion);
hosVersion = hosversionGet();
*major = HOSVER_MAJOR(hosVersion);
*minor = HOSVER_MINOR(hosVersion);
#else
/* defaults in case we error out */
*major = 0;
*minor = 0;
*major = 0;
*minor = 0;
char firmware_version[0x100];
result_t r; /* used by LIB_ASSERT_OK macros */
LIB_ASSERT_OK(fail, sm_init());
ipc_object_t set_sys;
LIB_ASSERT_OK(fail_sm, sm_get_service(&set_sys, "set:sys"));
ipc_request_t rq = ipc_make_request(3);
rq = ipc_make_request(3);
ipc_buffer_t buffers[] = {
ipc_make_buffer(firmware_version, 0x100, 0x1a),
};
@ -897,7 +905,6 @@ static void frontend_switch_get_os(char *s, size_t len, int *major, int *minor)
LIB_ASSERT_OK(fail_object, ipc_send(set_sys, &rq, &ipc_default_response_fmt));
int patch;
sscanf(firmware_version + 0x68, "%d.%d.%d", major, minor, &patch);
fail_object:

View File

@ -96,6 +96,8 @@ enum
INTERNAL_STORAGE_NOT_WRITABLE
};
unsigned storage_permissions = 0;
static void frontend_unix_set_sustained_performance_mode(bool on);
struct android_app *g_android = NULL;
@ -1295,6 +1297,7 @@ static void frontend_unix_get_env(int *argc,
jstring jstr = NULL;
jboolean jbool = JNI_FALSE;
struct android_app *android_app = (struct android_app*)data;
char parent_path[PATH_MAX_LENGTH];
if (!android_app)
return;
@ -1443,50 +1446,6 @@ static void frontend_unix_get_env(int *argc,
}
}
/* Screenshots */
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "SCREENSHOTS"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
*screenshot_dir = '\0';
if (argv && *argv)
strlcpy(screenshot_dir, argv, sizeof(screenshot_dir));
(*env)->ReleaseStringUTFChars(env, jstr, argv);
if (!string_is_empty(screenshot_dir))
{
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: android picture folder location [%s]\n",
screenshot_dir);
}
}
/* Downloads */
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "DOWNLOADS"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
*downloads_dir = '\0';
if (argv && *argv)
strlcpy(downloads_dir, argv, sizeof(downloads_dir));
(*env)->ReleaseStringUTFChars(env, jstr, argv);
if (!string_is_empty(downloads_dir))
{
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: android download folder location [%s]\n",
downloads_dir);
}
}
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "APK"));
@ -1536,7 +1495,6 @@ static void frontend_unix_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
int perms = 0;
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
*app_dir = '\0';
@ -1554,32 +1512,35 @@ static void frontend_unix_get_env(int *argc,
if(!string_is_empty(internal_storage_path))
{
if(test_permissions(internal_storage_path))
perms = INTERNAL_STORAGE_WRITABLE;
storage_permissions = INTERNAL_STORAGE_WRITABLE;
}
else if(!string_is_empty(internal_storage_app_path))
{
if(test_permissions(internal_storage_app_path))
perms = INTERNAL_STORAGE_APPDIR_WRITABLE;
storage_permissions = INTERNAL_STORAGE_APPDIR_WRITABLE;
}
else
perms = INTERNAL_STORAGE_NOT_WRITABLE;
storage_permissions = INTERNAL_STORAGE_NOT_WRITABLE;
/* code to populate default paths*/
if (!string_is_empty(app_dir))
{
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: application location: [%s]\n", app_dir);
if (args && *app_dir)
{
/* this section populates the paths for the assets that are bundled
with the apk.
TO-DO: change the extraction method so it honors the user defined paths instead
*/
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], app_dir,
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], app_dir,
"shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], app_dir,
"overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
#ifdef HAVE_VIDEO_LAYOUT
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], app_dir,
"layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], app_dir,
"cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
@ -1606,189 +1567,75 @@ static void frontend_unix_get_env(int *argc,
app_dir, "assets/wallpapers",
sizeof(g_defaults.dirs[DEFAULT_DIR_WALLPAPERS]));
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default download folder: [%s]",
g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]);
/* This switch tries to handle the different locations for devices with
weird write permissions. Should be largelly unnecesary nowadays. Most
devices I have tested are INTERNAL_STORAGE_WRITABLE but better safe than sorry */
switch (perms)
switch (storage_permissions)
{
/* only sdcard/Android/data/com.retroarch is writable */
/* only /sdcard/Android/data/com.retroarch is writable */
case INTERNAL_STORAGE_APPDIR_WRITABLE:
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
internal_storage_app_path, "saves",
sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
internal_storage_app_path, "states",
sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
internal_storage_app_path, "system",
sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
internal_storage_app_path, "config",
sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps",
sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
internal_storage_app_path, "thumbnails",
sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
internal_storage_app_path, "playlists",
sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
internal_storage_app_path, "cheats",
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE],
internal_storage_app_path, "temp",
sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
if(!string_is_empty(screenshot_dir)
&& test_permissions(screenshot_dir))
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
screenshot_dir, "RetroArch",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
}
else
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
internal_storage_app_path, "screenshots",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
}
if(!string_is_empty(downloads_dir)
&& test_permissions(downloads_dir))
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
downloads_dir, "RetroArch",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
}
else
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
internal_storage_app_path, "downloads",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
}
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS],
internal_storage_app_path, "logs",
sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
strlcpy(parent_path, internal_storage_app_path, sizeof(parent_path));
break;
/* only the internal app dir is writable, this should never happen*/
/* only the internal app dir is writable, this should never happen but it did
a few years ago in some devices */
case INTERNAL_STORAGE_NOT_WRITABLE:
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
app_dir, "saves",
sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
app_dir, "states",
sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
app_dir, "system",
sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
app_dir, "config",
sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps",
sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
app_dir, "thumbnails",
sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
app_dir, "playlists",
sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
app_dir, "cheats",
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE],
app_dir, "temp",
sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
if( !string_is_empty(screenshot_dir)
&& test_permissions(screenshot_dir))
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
screenshot_dir, "RetroArch",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
}
else
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
app_dir, "screenshots",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
}
if(!string_is_empty(downloads_dir)
&& test_permissions(downloads_dir))
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
downloads_dir, "RetroArch",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
}
else
{
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
app_dir, "downloads",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
}
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS],
app_dir, "logs",
sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
strlcpy(parent_path, app_dir, sizeof(parent_path));
break;
/* sdcard is writable, this should be the case most of the time*/
case INTERNAL_STORAGE_WRITABLE:
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
internal_storage_path, "RetroArch/saves",
sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
internal_storage_path, "RetroArch/states",
sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
internal_storage_path, "RetroArch/system",
sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
internal_storage_path, "RetroArch/screenshots",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
internal_storage_path, "RetroArch/downloads",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS],
internal_storage_path, "RetroArch/logs",
sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
internal_storage_path, "RetroArch/config",
sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps",
sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
internal_storage_path, "RetroArch/thumbnails",
sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
internal_storage_path, "RetroArch/playlists",
sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
internal_storage_path, "RetroArch/cheats",
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE],
internal_storage_path, "temp",
sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
default:
fill_pathname_join(parent_path,
internal_storage_path, "RetroArch",
sizeof(parent_path));
break;
}
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SRAM],
parent_path, "saves",
sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
parent_path, "states",
sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
parent_path, "system",
sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT],
parent_path, "screenshots",
sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS],
parent_path, "downloads",
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS],
parent_path, "logs",
sizeof(g_defaults.dirs[DEFAULT_DIR_LOGS]));
/* remaps is nested in config */
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG],
parent_path, "config",
sizeof(g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP],
g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps",
sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS],
parent_path, "thumbnails",
sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_PLAYLIST],
parent_path, "playlists",
sizeof(g_defaults.dirs[DEFAULT_DIR_PLAYLIST]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS],
parent_path, "cheats",
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
#ifdef HAVE_VIDEO_LAYOUT
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT],
parent_path, "layouts",
sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CACHE],
parent_path, "temp",
sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
__android_log_print(ANDROID_LOG_INFO,
"RetroArch", "[ENV]: default savefile folder: [%s]",
g_defaults.dirs[DEFAULT_DIR_SRAM]);
@ -2089,24 +1936,22 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
MSG_UNKNOWN;
#ifdef ANDROID
if (!string_is_empty(app_dir))
{
menu_entries_append_enum(list,
app_dir,
msg_hash_to_str(MSG_APPLICATION_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
if (!string_is_empty(internal_storage_app_path))
{
menu_entries_append_enum(list,
internal_storage_app_path,
msg_hash_to_str(MSG_EXTERNAL_APPLICATION_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
if (!string_is_empty(internal_storage_path))
{
if (storage_permissions == INTERNAL_STORAGE_WRITABLE)
{
char user_data_path[PATH_MAX_LENGTH];
fill_pathname_join(user_data_path,
internal_storage_path, "RetroArch",
sizeof(user_data_path));
menu_entries_append_enum(list,
user_data_path,
msg_hash_to_str(MSG_INTERNAL_STORAGE),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
menu_entries_append_enum(list,
internal_storage_path,
msg_hash_to_str(MSG_INTERNAL_STORAGE),
@ -2126,6 +1971,22 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
msg_hash_to_str(MSG_REMOVABLE_STORAGE),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
if (!string_is_empty(internal_storage_app_path))
{
menu_entries_append_enum(list,
internal_storage_app_path,
msg_hash_to_str(MSG_EXTERNAL_APPLICATION_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
if (!string_is_empty(app_dir))
{
menu_entries_append_enum(list,
app_dir,
msg_hash_to_str(MSG_APPLICATION_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
#endif
menu_entries_append_enum(list, "/",

View File

@ -1208,6 +1208,7 @@ typedef struct
D3D10_VIEWPORT viewport;
pass_semantics_t semantics;
uint32_t frame_count;
int32_t frame_direction;
} pass[GFX_MAX_SHADERS];
struct video_shader* shader_preset;

View File

@ -2584,6 +2584,7 @@ typedef struct
D3D11_VIEWPORT viewport;
pass_semantics_t semantics;
uint32_t frame_count;
int32_t frame_direction;
} pass[GFX_MAX_SHADERS];
struct video_shader* shader_preset;

View File

@ -1444,6 +1444,7 @@ typedef struct
D3D12_RECT scissorRect;
pass_semantics_t semantics;
uint32_t frame_count;
int32_t frame_direction;
D3D12_GPU_DESCRIPTOR_HANDLE textures;
D3D12_GPU_DESCRIPTOR_HANDLE samplers;
} pass[GFX_MAX_SHADERS];

View File

@ -305,12 +305,12 @@ void dxgi_copy(
void dxgi_update_title(video_frame_info_t* video_info)
{
#ifndef __WINRT__
const ui_window_t* window = ui_companion_driver_get_window_ptr();
const settings_t *settings = config_get_ptr();
if (settings->bools.video_memory_show)
{
#ifndef __WINRT__
char mem[128];
uint64_t mem_bytes_used = frontend_driver_get_used_memory();
uint64_t mem_bytes_total = frontend_driver_get_total_memory();
@ -321,7 +321,6 @@ void dxgi_update_title(video_frame_info_t* video_info)
mem, sizeof(mem), " || MEM: %.2f/%.2fMB", mem_bytes_used / (1024.0f * 1024.0f),
mem_bytes_total / (1024.0f * 1024.0f));
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
#endif
}
if (window)
@ -332,11 +331,10 @@ void dxgi_update_title(video_frame_info_t* video_info)
video_driver_get_window_title(title, sizeof(title));
#ifndef __WINRT__
if (title[0])
window->set_title(&main_window, title);
#endif
}
#endif
}
DXGI_FORMAT glslang_format_to_dxgi(glslang_format fmt)

View File

@ -14,6 +14,7 @@
#include <simd/simd.h>
#import <gfx/video_frame.h>
#include "../../managers/state_manager.h"
#import "metal_common.h"
#import "../../ui/drivers/cocoa/cocoa_common.h"
@ -552,6 +553,7 @@ typedef struct MTLALIGN(16)
texture_t rt;
texture_t feedback;
uint32_t frame_count;
int32_t frame_direction;
pass_semantics_t semantics;
MTLViewport viewport;
__unsafe_unretained id<MTLRenderPipelineState> _state;
@ -927,6 +929,8 @@ typedef struct MTLALIGN(16)
if (_shader->pass[i].frame_count_mod)
_engine.pass[i].frame_count %= _shader->pass[i].frame_count_mod;
_engine.pass[i].frame_direction = state_manager_frame_is_reversed() ? -1 : 1;
for (unsigned j = 0; j < SLANG_CBUFFER_MAX; j++)
{
id<MTLBuffer> buffer = _engine.pass[i].buffers[j];
@ -1176,10 +1180,11 @@ typedef struct MTLALIGN(16)
&_engine.luts[0].size_data, sizeof(*_engine.luts)},
},
{
mvp, /* MVP */
&_engine.pass[i].rt.size_data, /* OutputSize */
&_engine.frame.output_size, /* FinalViewportSize */
&_engine.pass[i].frame_count, /* FrameCount */
mvp, /* MVP */
&_engine.pass[i].rt.size_data, /* OutputSize */
&_engine.frame.output_size, /* FinalViewportSize */
&_engine.pass[i].frame_count, /* FrameCount */
&_engine.pass[i].frame_direction, /* FrameDirection */
}
};
/* clang-format on */

View File

@ -1618,6 +1618,7 @@ static bool vulkan_context_init_gpu(gfx_ctx_vulkan_data_t *vk)
&gpu_count, gpus) != VK_SUCCESS)
{
RARCH_ERR("[Vulkan]: Failed to enumerate physical devices.\n");
free(gpus);
return false;
}

View File

@ -27,6 +27,7 @@
#include "../../verbosity.h"
#include "../../configuration.h"
#include "../../retroarch.h"
#include "../../managers/state_manager.h"
#include "../video_driver.h"
#include "../font_driver.h"
@ -390,10 +391,11 @@ static bool d3d10_gfx_set_shader(void* data,
&d3d10->luts[0].size_data, sizeof(*d3d10->luts)},
},
{
&d3d10->mvp, /* MVP */
&d3d10->pass[i].rt.size_data, /* OutputSize */
&d3d10->frame.output_size, /* FinalViewportSize */
&d3d10->pass[i].frame_count, /* FrameCount */
&d3d10->mvp, /* MVP */
&d3d10->pass[i].rt.size_data, /* OutputSize */
&d3d10->frame.output_size, /* FinalViewportSize */
&d3d10->pass[i].frame_count, /* FrameCount */
&d3d10->pass[i].frame_direction, /* FrameDirection */
}
};
/* clang-format on */
@ -1283,6 +1285,8 @@ static bool d3d10_gfx_frame(
else
d3d10->pass[i].frame_count = frame_count;
d3d10->pass[i].frame_direction = state_manager_frame_is_reversed() ? -1 : 1;
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
{
D3D10Buffer buffer = d3d10->pass[i].buffers[j];

View File

@ -43,6 +43,7 @@
#include "../../menu/menu_driver.h"
#include "../video_shader_parse.h"
#include "../drivers_shader/slang_preprocess.h"
#include "../../managers/state_manager.h"
#include "../common/d3d_common.h"
#include "../common/d3d11_common.h"
@ -408,10 +409,11 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
&d3d11->luts[0].size_data, sizeof(*d3d11->luts)},
},
{
&d3d11->mvp, /* MVP */
&d3d11->pass[i].rt.size_data, /* OutputSize */
&d3d11->frame.output_size, /* FinalViewportSize */
&d3d11->pass[i].frame_count, /* FrameCount */
&d3d11->mvp, /* MVP */
&d3d11->pass[i].rt.size_data, /* OutputSize */
&d3d11->frame.output_size, /* FinalViewportSize */
&d3d11->pass[i].frame_count, /* FrameCount */
&d3d11->pass[i].frame_direction, /* FrameDirection */
}
};
/* clang-format on */
@ -1356,6 +1358,8 @@ static bool d3d11_gfx_frame(
else
d3d11->pass[i].frame_count = frame_count;
d3d11->pass[i].frame_direction = state_manager_frame_is_reversed() ? -1 : 1;
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
{
D3D11Buffer buffer = d3d11->pass[i].buffers[j];

View File

@ -32,6 +32,7 @@
#include "../../verbosity.h"
#include "../../configuration.h"
#include "../../retroarch.h"
#include "../../managers/state_manager.h"
#ifdef HAVE_MENU
#include "../../menu/menu_driver.h"
@ -398,10 +399,11 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const
&d3d12->luts[0].size_data, sizeof(*d3d12->luts)},
},
{
&d3d12->mvp, /* MVP */
&d3d12->pass[i].rt.size_data, /* OutputSize */
&d3d12->frame.output_size, /* FinalViewportSize */
&d3d12->pass[i].frame_count, /* FrameCount */
&d3d12->mvp, /* MVP */
&d3d12->pass[i].rt.size_data, /* OutputSize */
&d3d12->frame.output_size, /* FinalViewportSize */
&d3d12->pass[i].frame_count, /* FrameCount */
&d3d12->pass[i].frame_direction, /* FrameDirection */
}
};
/* clang-format on */
@ -1294,6 +1296,8 @@ static bool d3d12_gfx_frame(
else
d3d12->pass[i].frame_count = frame_count;
d3d12->pass[i].frame_direction = state_manager_frame_is_reversed() ? -1 : 1;
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
{
cbuffer_sem_t* buffer_sem = &d3d12->pass[i].semantics.cbuffers[j];

View File

@ -442,7 +442,7 @@ void gl1_gfx_set_viewport(gl1_t *gl1,
static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int height, GLuint tex, const void *frame_to_copy)
{
/* FIXME: For now, everything is uploaded as BGRA8888, I could not get 444 or 555 to work, and there is no 565 support in GL 1.1 either. */
GLint internalFormat = GL_RGBA8;
GLint internalFormat = GL_RGB8;
GLenum format = (gl1->supports_bgra ? GL_BGRA_EXT : GL_RGBA);
GLenum type = GL_UNSIGNED_BYTE;

View File

@ -1419,7 +1419,7 @@ static void gl_core_set_rotation(void *data, unsigned rotation)
if (!gl)
return;
gl->rotation = 270 * rotation;
gl->rotation = video_driver_is_hw_context() && gl->hw_render_bottom_left ? 90 * rotation : 270 * rotation;
gl_core_set_projection(gl, &gl_core_default_ortho, true);
}

View File

@ -25,6 +25,7 @@
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../../retroarch.h"
#include "../../managers/state_manager.h"
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -332,7 +333,8 @@ static void *wiiu_gfx_init(const video_info_t *video,
wiiu->menu.texture.surface.format = GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4;
wiiu->menu.texture.surface.tileMode = GX2_TILE_MODE_LINEAR_ALIGNED;
wiiu->menu.texture.viewNumSlices = 1;
wiiu->menu.texture.compMap = GX2_COMP_SEL(_A, _R, _G, _B);
/* Presumably an endian thing. RGBA, but swap R and G, then B and A. */
wiiu->menu.texture.compMap = GX2_COMP_SEL(_G, _R, _A, _B);
GX2CalcSurfaceSizeAndAlignment(&wiiu->menu.texture.surface);
GX2InitTextureRegs(&wiiu->menu.texture);
@ -369,7 +371,7 @@ static void *wiiu_gfx_init(const video_info_t *video,
wiiu->menu.v->coord.v = 0.0f;
wiiu->menu.v->coord.width = 1.0f;
wiiu->menu.v->coord.height = 1.0f;
wiiu->menu.v->color = 0xFFFFFF80;
wiiu->menu.v->color = 0xFFFFFFFF;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->menu.v, 4 * sizeof(*wiiu->menu.v));
wiiu->vertex_cache.size = 0x1000;
@ -873,7 +875,8 @@ static bool wiiu_init_frame_textures(wiiu_video_t *wiiu, unsigned width, unsigne
}
static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu, int pass, float *ubo, int id,
int size, int uniformVarCount, GX2UniformVar *uniformVars, uint64_t frame_count)
int size, int uniformVarCount, GX2UniformVar *uniformVars,
uint64_t frame_count, int32_t frame_direction)
{
for (int i = 0; i < uniformVarCount; i++)
{
@ -916,6 +919,13 @@ static void wiiu_gfx_update_uniform_block(wiiu_video_t *wiiu, int pass, float *u
continue;
}
if (string_is_equal(id, "FrameDirection"))
{
*dst = frame_direction;
*(u32 *)dst = __builtin_bswap32(*(u32 *)dst);
continue;
}
if (string_is_equal(id, "OriginalSize"))
{
((GX2_vec4 *)dst)->x = wiiu->texture.surface.width;
@ -1146,6 +1156,8 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
if (wiiu->shader_preset)
{
int32_t frame_direction = state_manager_frame_is_reversed() ? -1 : 1;
for (int i = 0; i < wiiu->shader_preset->passes; i++)
{
@ -1155,7 +1167,8 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
{
wiiu_gfx_update_uniform_block(wiiu, i, wiiu->pass[i].vs_ubos[j], j,
wiiu->pass[i].gfd->vs->uniformBlocks[j].size,
wiiu->pass[i].gfd->vs->uniformVarCount, wiiu->pass[i].gfd->vs->uniformVars, frame_count);
wiiu->pass[i].gfd->vs->uniformVarCount, wiiu->pass[i].gfd->vs->uniformVars,
frame_count, frame_direction);
GX2SetVertexUniformBlock(wiiu->pass[i].gfd->vs->uniformBlocks[j].offset,
wiiu->pass[i].gfd->vs->uniformBlocks[j].size, wiiu->pass[i].vs_ubos[j]);
}
@ -1166,7 +1179,8 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
{
wiiu_gfx_update_uniform_block(wiiu, i, wiiu->pass[i].ps_ubos[j], j,
wiiu->pass[i].gfd->ps->uniformBlocks[j].size,
wiiu->pass[i].gfd->ps->uniformVarCount, wiiu->pass[i].gfd->ps->uniformVars, frame_count);
wiiu->pass[i].gfd->ps->uniformVarCount, wiiu->pass[i].gfd->ps->uniformVars,
frame_count, frame_direction);
GX2SetPixelUniformBlock(wiiu->pass[i].gfd->ps->uniformBlocks[j].offset,
wiiu->pass[i].gfd->ps->uniformBlocks[j].size, wiiu->pass[i].ps_ubos[j]);
}
@ -1321,7 +1335,8 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.v), sizeof(*wiiu->menu.v), wiiu->menu.v);
GX2SetPixelTexture(&wiiu->menu.texture, sprite_shader.ps.samplerVars[0].location);
GX2SetPixelSampler(&wiiu->sampler_linear[RARCH_WRAP_DEFAULT],
GX2SetPixelSampler(wiiu->smooth ? &wiiu->sampler_linear[RARCH_WRAP_DEFAULT] :
&wiiu->sampler_nearest[RARCH_WRAP_DEFAULT],
sprite_shader.ps.samplerVars[0].location);
GX2DrawEx(GX2_PRIMITIVE_MODE_POINTS, 1, 0, 1);
@ -1444,7 +1459,7 @@ static bool wiiu_gfx_set_shader(void *data,
video_shader_resolve_relative(wiiu->shader_preset, path);
#if 0
video_shader_resolve_parameters(conf, wiiu->shader_preset);
video_shader_resolve_parameters(conf, wiiu->shader_preset);
#else
for (int i = 0; i < wiiu->shader_preset->passes; i++)
slang_preprocess_parse_parameters(wiiu->shader_preset->pass[i].source.path, wiiu->shader_preset);
@ -1662,14 +1677,14 @@ static void wiiu_gfx_set_texture_frame(void *data, const void *frame, bool rgb32
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->menu.texture.surface.image,
wiiu->menu.texture.surface.imageSize);
wiiu->menu.v->pos.x = 0.0f;
wiiu->menu.v->pos.y = 0.0f;
wiiu->menu.v->pos.width = width;
wiiu->menu.v->pos.height = height;
wiiu->menu.v->pos.x = wiiu->vp.x;
wiiu->menu.v->pos.y = wiiu->vp.y;
wiiu->menu.v->pos.width = wiiu->vp.width;
wiiu->menu.v->pos.height = wiiu->vp.height;
wiiu->menu.v->coord.u = 0.0f;
wiiu->menu.v->coord.v = 0.0f;
wiiu->menu.v->coord.width = (float)width / wiiu->texture.surface.width;
wiiu->menu.v->coord.height = (float)height / wiiu->texture.surface.height;
wiiu->menu.v->coord.width = (float)width / wiiu->menu.texture.surface.width;
wiiu->menu.v->coord.height = (float)height / wiiu->menu.texture.surface.height;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->menu.v, 4 * sizeof(*wiiu->menu.v));
}

View File

@ -95,6 +95,8 @@ typedef struct gx_video
bool menu_texture_enable;
video_viewport_t vp;
unsigned scale;
unsigned overscan_correction_top;
unsigned overscan_correction_bottom;
#ifdef HAVE_OVERLAY
struct gx_overlay_data *overlay;
unsigned overlays;
@ -114,7 +116,7 @@ static struct
static struct
{
uint32_t data[240 * 200];
uint32_t data[240 * 212];
GXTexObj obj;
} menu_tex ATTRIBUTE_ALIGN(32);
@ -461,14 +463,44 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
gx->double_strike = (modetype == VI_NON_INTERLACE);
gx->should_resize = true;
/* calculate menu dimensions */
/* Calculate menu dimensions
* > Height is set as large as possible, limited to
* maximum of 240 (standard RGUI framebuffer height) */
new_fb_height = (gx_mode.efbHeight / (gx->double_strike ? 1 : 2)) & ~3;
if (new_fb_height > 240)
new_fb_height = 240;
new_fb_width = (gx_mode.fbWidth / (gx_mode.fbWidth < 400 ? 1 : 2)) & ~3;
if (new_fb_width > 400)
new_fb_width = 400;
/* > Width is dertermined by current RGUI aspect ratio
* (note that width is in principal limited by hardware
* constraints to 640, but we impose a lower limit of
* 424 since this is the nearest to the RGUI 'standard'
* for 16:9 aspect ratios which is supported by the Wii
* - i.e. last two bits of value must be zero, so 426->424) */
switch (settings->uints.menu_rgui_aspect_ratio)
{
case RGUI_ASPECT_RATIO_16_9:
case RGUI_ASPECT_RATIO_16_9_CENTRE:
if (new_fb_height == 240)
new_fb_width = 424;
else
new_fb_width = (unsigned)((16.0f / 9.0f) * (float)new_fb_height) & ~3;
break;
case RGUI_ASPECT_RATIO_16_10:
case RGUI_ASPECT_RATIO_16_10_CENTRE:
if (new_fb_height == 240)
new_fb_width = 384;
else
new_fb_width = (unsigned)((16.0f / 10.0f) * (float)new_fb_height) & ~3;
break;
default:
/* 4:3 */
if (new_fb_height == 240)
new_fb_width = 320;
else
new_fb_width = (unsigned)((4.0f / 3.0f) * (float)new_fb_height) & ~3;
break;
}
if (new_fb_width > 424)
new_fb_width = 424;
new_fb_pitch = new_fb_width * 2;
@ -909,7 +941,7 @@ static void convert_texture32(const uint32_t *_src, uint32_t *_dst,
}
}
static void gx_resize(void *data)
static void gx_resize(void *data, settings_t *settings)
{
int gamma;
unsigned degrees;
@ -918,10 +950,9 @@ static void gx_resize(void *data)
float top = 1, bottom = -1, left = -1, right = 1;
int x = 0, y = 0;
gx_video_t *gx = (gx_video_t*)data;
settings_t *settings = config_get_ptr();
const global_t *global = global_get_ptr();
if (!gx)
if (!gx || !settings)
return;
width = gx->vp.full_width;
@ -994,6 +1025,24 @@ static void gx_resize(void *data)
}
}
/* Overscan correction */
if ((settings->uints.video_overscan_correction_top > 0) ||
(settings->uints.video_overscan_correction_bottom > 0))
{
float current_aspect = (float)width / (float)height;
int new_height = height - (settings->uints.video_overscan_correction_top +
settings->uints.video_overscan_correction_bottom);
int new_width = (int)((new_height * current_aspect) + 0.5f);
if ((new_height > 0) && (new_width > 0))
{
x += (int)((float)(width - new_width) * 0.5f);
y += (int)settings->uints.video_overscan_correction_top;
width = (unsigned)new_width;
height = (unsigned)new_height;
}
}
if(gx_isValidXOrigin(gx_xOrigin + x))
{
gx_mode.viXOrigin = gx_xOrigin + x;
@ -1506,21 +1555,30 @@ static bool gx_frame(void *data, const void *frame,
video_frame_info_t *video_info)
{
char fps_text_buf[128];
settings_t *settings = config_get_ptr();
gx_video_t *gx = (gx_video_t*)data;
u8 clear_efb = GX_FALSE;
uint32_t level = 0;
fps_text_buf[0] = '\0';
if(!gx || (!frame && !gx->menu_texture_enable))
if(!gx || (!frame && !gx->menu_texture_enable) || !settings)
return true;
if (!frame)
width = height = 4; /* draw a black square in the background */
if ((gx->overscan_correction_top != settings->uints.video_overscan_correction_top) ||
(gx->overscan_correction_bottom != settings->uints.video_overscan_correction_bottom))
{
gx->overscan_correction_top = settings->uints.video_overscan_correction_top;
gx->overscan_correction_bottom = settings->uints.video_overscan_correction_bottom;
gx->should_resize = true;
}
if(gx->should_resize)
{
gx_resize(gx);
gx_resize(gx, settings);
clear_efb = GX_TRUE;
}

View File

@ -909,7 +909,14 @@ static uint32_t gfx_ctx_drm_get_flags(void *data)
if (drm->core_hw_context_enable)
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
if (string_is_equal(video_driver_get_ident(), "glcore"))
{
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
}
else
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -14,6 +14,7 @@
*/
#include <compat/strl.h>
#include <string/stdstring.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -154,9 +155,42 @@ error:
}
static void gfx_ctx_khr_display_input_driver(void *data,
const char *name,
const char *joypad_name,
const input_driver_t **input, void **input_data)
{
#ifdef HAVE_X11
settings_t *settings = config_get_ptr();
/* We cannot use the X11 input driver for DRM/KMS */
if (string_is_equal(settings->arrays.input_driver, "x"))
{
#ifdef HAVE_UDEV
{
/* Try to set it to udev instead */
void *udev = input_udev.init(joypad_name);
if (udev)
{
*input = &input_udev;
*input_data = udev;
return;
}
}
#endif
#if defined(__linux__) && !defined(ANDROID)
{
/* Try to set it to linuxraw instead */
void *linuxraw = input_linuxraw.init(joypad_name);
if (linuxraw)
{
*input = &input_linuxraw;
*input_data = linuxraw;
return;
}
}
#endif
}
#endif
*input = NULL;
*input_data = NULL;
}

View File

@ -694,12 +694,14 @@ static void handle_toplevel_config(void *data,
wl->height = height;
}
#ifdef HAVE_EGL
if (wl->win)
wl_egl_window_resize(wl->win, width, height, 0, 0);
else
wl->win = wl_egl_window_create(wl->surface,
wl->width * wl->buffer_scale,
wl->height * wl->buffer_scale);
#endif
wl->configured = false;
}
@ -774,12 +776,14 @@ static void handle_zxdg_toplevel_config(
wl->height = height;
}
#ifdef HAVE_EGL
if (wl->win)
wl_egl_window_resize(wl->win, width, height, 0, 0);
else
wl->win = wl_egl_window_create(wl->surface,
wl->width * wl->buffer_scale,
wl->height * wl->buffer_scale);
#endif
wl->configured = false;
}
@ -1068,22 +1072,22 @@ static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl)
}
#ifdef HAVE_EGL
wl->win = NULL;
wl->win = NULL;
#endif
wl->xdg_shell = NULL;
wl->zxdg_shell = NULL;
wl->shell = NULL;
wl->compositor = NULL;
wl->registry = NULL;
wl->xdg_shell = NULL;
wl->zxdg_shell = NULL;
wl->shell = NULL;
wl->compositor = NULL;
wl->registry = NULL;
wl->input.dpy = NULL;
wl->xdg_surface = NULL;
wl->surface = NULL;
wl->xdg_toplevel = NULL;
wl->zxdg_toplevel = NULL;
wl->shell_surf = NULL;
wl->xdg_surface = NULL;
wl->surface = NULL;
wl->xdg_toplevel = NULL;
wl->zxdg_toplevel = NULL;
wl->shell_surf = NULL;
wl->width = 0;
wl->height = 0;
wl->width = 0;
wl->height = 0;
}
@ -1270,13 +1274,12 @@ static bool gfx_ctx_wl_get_metrics(void *data,
static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver)
{
int i;
#ifdef HAVE_OPENGL
#ifdef HAVE_EGL
static const EGLint egl_attribs_gl[] = {
WL_EGL_ATTRIBS_BASE,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE,
};
#endif
#ifdef HAVE_OPENGLES
#ifdef HAVE_OPENGLES2
@ -1299,16 +1302,15 @@ static void *gfx_ctx_wl_init(video_frame_info_t *video_info, void *video_driver)
#endif
#ifdef HAVE_EGL
static const EGLint egl_attribs_vg[] = {
WL_EGL_ATTRIBS_BASE,
EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
EGL_NONE,
};
EGLint major = 0, minor = 0;
EGLint n;
const EGLint *attrib_ptr = NULL;
EGLint major = 0, minor = 0;
const EGLint *attrib_ptr = NULL;
#endif
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)
calloc(1, sizeof(gfx_ctx_wayland_data_t));
@ -1844,26 +1846,32 @@ static bool gfx_ctx_wl_bind_api(void *video_driver,
if ((major * 1000 + minor) >= 3001)
return false;
#endif
return eglBindAPI(EGL_OPENGL_API);
#else
break;
#ifdef HAVE_EGL
if (eglBindAPI(EGL_OPENGL_API) == EGL_TRUE)
return true;
#endif
#endif
break;
case GFX_CTX_OPENGL_ES_API:
#ifdef HAVE_OPENGLES
#ifndef EGL_KHR_create_context
if (major >= 3)
return false;
#endif
return eglBindAPI(EGL_OPENGL_ES_API);
#else
break;
#ifdef HAVE_EGL
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE)
return true;
#endif
#endif
break;
case GFX_CTX_OPENVG_API:
#ifdef HAVE_VG
return eglBindAPI(EGL_OPENVG_API);
#else
break;
#ifdef HAVE_EGL
if (eglBindAPI(EGL_OPENVG_API) == EGL_TRUE)
return true;
#endif
#endif
break;
case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
return true;

View File

@ -816,7 +816,12 @@ static uint32_t gfx_ctx_wgl_get_flags(void *data)
}
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore"))
{
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
}
else
{
#ifdef HAVE_CG

View File

@ -366,7 +366,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(
/* Stream {0, 1, 2, 3} might be already taken. Find first vacant stream. */
for (index = 0; index < 4; index++)
{
if (stream_taken[index] == false)
if (!stream_taken[index])
break;
}

View File

@ -85,6 +85,25 @@ static GLuint gl_core_compile_shader(GLenum stage, const char *source)
return shader;
}
static uint32_t gl_core_get_cross_compiler_target_version()
{
const char *version = (const char*)glGetString(GL_VERSION);
unsigned major = 0;
unsigned minor = 0;
#ifdef HAVE_OPENGLES3
if (!version || sscanf(version, "OpenGL ES %u.%u", &major, &minor) != 2)
return 300u;
#else
if (!version || sscanf(version, "%u.%u", &major, &minor) != 2)
return 150u;
#endif
if (major == 3u && minor == 2u)
return 150u;
return 100u * major + 10u * minor;
}
GLuint gl_core_cross_compile_program(
const uint32_t *vertex, size_t vertex_size,
const uint32_t *fragment, size_t fragment_size,
@ -100,11 +119,10 @@ GLuint gl_core_cross_compile_program(
spirv_cross::CompilerGLSL::Options opts;
#ifdef HAVE_OPENGLES3
opts.es = true;
opts.version = 300;
#else
opts.es = false;
opts.version = 150;
#endif
opts.version = gl_core_get_cross_compiler_target_version();
opts.fragment.default_float_precision = spirv_cross::CompilerGLSL::Options::Precision::Highp;
opts.fragment.default_int_precision = spirv_cross::CompilerGLSL::Options::Precision::Highp;
opts.enable_420pack_extension = false;

View File

@ -495,7 +495,7 @@ class Pass
slang_texture_semantic semantic, unsigned index, const Texture &texture);
uint64_t frame_count = 0;
uint32_t frame_direction = 1;
int32_t frame_direction = 1;
unsigned frame_count_period = 0;
unsigned pass_number = 0;

View File

@ -183,7 +183,7 @@ void crt_switch_res_core(unsigned width, unsigned height,
{
/* ra_core_hz float passed from within
* void video_driver_monitor_adjust_system_rates(void) */
if (width == 4 )
if (width == 4)
{
width = 320;
height = 240;
@ -192,7 +192,7 @@ void crt_switch_res_core(unsigned width, unsigned height,
ra_core_height = height;
ra_core_hz = hz;
if (dynamic == true)
if (dynamic)
ra_core_width = crt_compute_dynamic_width(width);
else
ra_core_width = width;

View File

@ -1533,11 +1533,15 @@ bool video_driver_supports_recording(void)
}
bool video_driver_supports_viewport_read(void)
{
return current_video->read_viewport && current_video->viewport_info;
}
bool video_driver_prefer_viewport_read(void)
{
settings_t *settings = config_get_ptr();
return (settings->bools.video_gpu_screenshot ||
(video_driver_is_hw_context() && !current_video->read_frame_raw))
&& current_video->read_viewport && current_video->viewport_info;
return settings->bools.video_gpu_screenshot ||
(video_driver_is_hw_context() && !current_video->read_frame_raw);
}
bool video_driver_supports_read_frame_raw(void)

View File

@ -829,6 +829,7 @@ void video_driver_unset_stub_frame(void);
bool video_driver_is_stub_frame(void);
bool video_driver_supports_recording(void);
bool video_driver_supports_viewport_read(void);
bool video_driver_prefer_viewport_read(void);
bool video_driver_supports_read_frame_raw(void);
void video_driver_set_viewport_config(void);
void video_driver_set_viewport_square_pixel(void);

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