mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-08 08:10:30 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28c7ae5007 | ||
|
|
0a613c04a6 | ||
|
|
f12092a09f | ||
|
|
21aa1cdbe6 | ||
|
|
5e18a5513c | ||
|
|
1188650a3f | ||
|
|
f64a01c5d4 | ||
|
|
42e803435f | ||
|
|
5e1486d92a | ||
|
|
f03a0cedca | ||
|
|
75a134a578 | ||
|
|
a9b9435e0b | ||
|
|
b674457671 | ||
|
|
7752c73abc |
No files matched your search
@@ -1,6 +1,3 @@
|
||||
[submodule "deps/glslang/glslang"]
|
||||
path = deps/glslang/glslang
|
||||
url = git://github.com/KhronosGroup/glslang.git
|
||||
[submodule "deps/spir2cross"]
|
||||
path = deps/spir2cross
|
||||
url = git://github.com/ARM-software/spir2cross
|
||||
@@ -67,9 +67,7 @@ OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
|
||||
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
LINK = $(CXX)
|
||||
CFLAGS := $(CXXFLAGS) -xc++
|
||||
CFLAGS += -DCXX_BUILD
|
||||
CXXFLAGS += -DCXX_BUILD
|
||||
CFLAGS := $(CXXFLAGS) -xc++
|
||||
else
|
||||
ifeq ($(findstring Win32,$(OS)),)
|
||||
LINK = $(CC)
|
||||
|
||||
+21
-30
@@ -129,17 +129,16 @@ OBJ += frontend/frontend.o \
|
||||
tasks/task_file_transfer.o \
|
||||
content.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/lists/file_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/file_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/streams/interface_stream.o \
|
||||
libretro-common/streams/memory_stream.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/memmap/memalign.o \
|
||||
list_special.o \
|
||||
dir_list_special.o \
|
||||
string_list_special.o \
|
||||
libretro-common/file/nbio/nbio_stdio.o \
|
||||
libretro-common/file/file_path.o \
|
||||
file_path_special.o \
|
||||
@@ -167,14 +166,14 @@ OBJ += frontend/frontend.o \
|
||||
tasks/task_overlay.o \
|
||||
input/input_overlay.o \
|
||||
patch.o \
|
||||
libretro-common/queues/fifo_queue.o \
|
||||
libretro-common/queues/fifo_buffer.o \
|
||||
core_options.o \
|
||||
libretro-common/compat/compat_fnmatch.o \
|
||||
libretro-common/compat/compat_posix_string.o \
|
||||
cheats.o \
|
||||
core_info.o \
|
||||
libretro-common/file/config_file.o \
|
||||
config_file_userdata.o \
|
||||
libretro-common/file/config_file_userdata.o \
|
||||
screenshot.o \
|
||||
libretro-common/gfx/scaler/scaler.o \
|
||||
gfx/drivers_shader/shader_null.o \
|
||||
@@ -389,8 +388,8 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
|
||||
HAVE_MATERIALUI = 1
|
||||
endif
|
||||
|
||||
#ifeq ($(HAVE_NUKLEAR),)
|
||||
#HAVE_NUKLEAR = 1
|
||||
#ifeq ($(HAVE_ZAHNRAD),)
|
||||
#HAVE_ZAHNRAD = 1
|
||||
#endif
|
||||
|
||||
ifeq ($(HAVE_XMB),)
|
||||
@@ -399,7 +398,7 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
|
||||
else
|
||||
HAVE_ZARCH = 0
|
||||
HAVE_MATERIALUI = 0
|
||||
#HAVE_NUKLEAR = 0
|
||||
#HAVE_ZAHNRAD = 0
|
||||
HAVE_XMB = 0
|
||||
endif
|
||||
|
||||
@@ -411,11 +410,12 @@ ifeq ($(HAVE_MATERIALUI), 1)
|
||||
OBJ += menu/drivers/materialui.o
|
||||
DEFINES += -DHAVE_MATERIALUI
|
||||
endif
|
||||
ifeq ($(HAVE_NUKLEAR), 1)
|
||||
OBJ += menu/drivers/nk_common.o
|
||||
OBJ += menu/drivers/nk_menu.o
|
||||
OBJ += menu/drivers/nuklear.o
|
||||
DEFINES += -DHAVE_NUKLEAR
|
||||
ifeq ($(HAVE_ZAHNRAD), 1)
|
||||
OBJ += deps/zahnrad/zahnrad.o
|
||||
OBJ += menu/drivers/zr_common.o
|
||||
OBJ += menu/drivers/zr_menu.o
|
||||
OBJ += menu/drivers/zr.o
|
||||
DEFINES += -DHAVE_ZAHNRAD
|
||||
endif
|
||||
ifeq ($(HAVE_ZARCH), 1)
|
||||
OBJ += menu/drivers/zarch.o
|
||||
@@ -429,7 +429,6 @@ endif
|
||||
|
||||
ifeq ($(HAVE_LAKKA), 1)
|
||||
DEFINES += -DHAVE_LAKKA
|
||||
DEFINES += -DLAKKA_PROJECT=$(LAKKA_PROJECT)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
@@ -598,7 +597,6 @@ endif
|
||||
ifeq ($(HAVE_HID), 1)
|
||||
DEFINES += -DHAVE_HID
|
||||
OBJ += input/connect/joypad_connection.o \
|
||||
input/connect/connect_ps2adapter.o \
|
||||
input/connect/connect_ps3.o \
|
||||
input/connect/connect_ps4.o \
|
||||
input/connect/connect_wii.o \
|
||||
@@ -752,31 +750,25 @@ ifeq ($(HAVE_VULKAN), 1)
|
||||
$(wildcard deps/glslang/glslang/glslang/MachineIndependent/preprocessor/*.cpp) \
|
||||
$(wildcard deps/glslang/glslang/glslang/OSDependent/$(GLSLANG_PLATFORM)/*.cpp)
|
||||
|
||||
SPIR2CROSS_SOURCES := deps/spir2cross/spir2cross.cpp
|
||||
|
||||
DEFINES += \
|
||||
-Ideps/glslang/glslang/glslang/OSDependent/$(GLSLANG_PLATFORM) \
|
||||
-Ideps/glslang/glslang \
|
||||
-Ideps/glslang/glslang/glslang/MachineIndependent \
|
||||
-Ideps/glslang/glslang/glslang/Public \
|
||||
-Ideps/glslang/glslang/SPIRV \
|
||||
-Ideps/glslang \
|
||||
-Ideps/spir2cross
|
||||
-Ideps/glslang
|
||||
|
||||
CXXFLAGS += -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -I./gfx/include/vulkan
|
||||
CFLAGS += -I./gfx/include/vulkan
|
||||
|
||||
GLSLANG_OBJ := $(GLSLANG_SOURCES:.cpp=.o)
|
||||
SPIR2CROSS_OBJ := $(SPIR2CROSS_SOURCES:.cpp=.o)
|
||||
|
||||
OBJ += gfx/drivers/vulkan.o \
|
||||
gfx/common/vulkan_common.o \
|
||||
gfx/drivers_font/vulkan_raster_font.o \
|
||||
gfx/drivers_shader/shader_vulkan.o \
|
||||
gfx/drivers_shader/glslang_util.o \
|
||||
gfx/drivers_shader/slang_reflection.o \
|
||||
$(GLSLANG_OBJ) \
|
||||
$(SPIR2CROSS_OBJ)
|
||||
$(GLSLANG_OBJ)
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/drivers_display/menu_display_vulkan.o
|
||||
endif
|
||||
@@ -882,8 +874,8 @@ endif
|
||||
|
||||
|
||||
ifeq ($(HAVE_ZLIB), 1)
|
||||
OBJ += libretro-common/file/archive_file.o \
|
||||
libretro-common/file/archive_file_zlib.o \
|
||||
OBJ += libretro-common/file/file_archive.o \
|
||||
libretro-common/file/file_archive_zlib.o \
|
||||
tasks/task_decompress.o
|
||||
OBJ += $(ZLIB_OBJS)
|
||||
DEFINES += -DHAVE_ZLIB
|
||||
@@ -952,7 +944,6 @@ ifeq ($(HAVE_NETWORKING), 1)
|
||||
DEFINES += -DHAVE_NETWORKING
|
||||
OBJ += libretro-common/net/net_compat.o \
|
||||
libretro-common/net/net_http.o \
|
||||
libretro-common/net/net_socket.o \
|
||||
net_http_special.o \
|
||||
tasks/task_http.o
|
||||
|
||||
|
||||
+34
-41
@@ -21,32 +21,20 @@ APP_RSF = ctr/tools/template.rsf
|
||||
APP_SYSTEM_MODE = 64MB
|
||||
APP_SYSTEM_MODE_EXT = 124MB
|
||||
APP_BIG_TEXT_SECTION = 0
|
||||
APP_USE_SVCHAX = 0
|
||||
|
||||
include ctr/Makefile.cores
|
||||
|
||||
OBJS :=
|
||||
OBJS += gfx/drivers/ctr_shaders/ctr_sprite.o
|
||||
OBJS += gfx/drivers/ctr_sprite.o
|
||||
OBJS += ctr/ctr_system.o
|
||||
OBJS += ctr/ctr_memory.o
|
||||
OBJS += ctr/ctr_linear.o
|
||||
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
APP_USE_SVCHAX = 1
|
||||
LDFLAGS += -Wl,--defsym,__ctr_patch_services=__service_ptr
|
||||
endif
|
||||
|
||||
ifeq ($(APP_USE_SVCHAX), 1)
|
||||
OBJS += ctr/ctr_svchax.o
|
||||
endif
|
||||
OBJS += ctr/ctr_svchax.o
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJS += griffin/griffin.o
|
||||
else
|
||||
CFLAGS += -DHAVE_COMPRESSION
|
||||
OBJS += libretro-common/file/archive_file.o
|
||||
OBJS += libretro-common/file/archive_file_zlib.o
|
||||
OBJS += libretro-common/encodings/encoding_utf.o
|
||||
OBJS += libretro-common/file/file_extract.o
|
||||
OBJS += verbosity.o
|
||||
OBJS += performance.o
|
||||
OBJS += libretro-common/compat/compat_getopt.o
|
||||
@@ -55,13 +43,13 @@ else
|
||||
OBJS += libretro-common/compat/compat_fnmatch.o
|
||||
OBJS += libretro-common/memmap/memalign.o
|
||||
OBJS += libretro-common/file/config_file.o
|
||||
OBJS += config_file_userdata.o
|
||||
OBJS += libretro-common/file/config_file_userdata.o
|
||||
OBJS += core_options.o
|
||||
OBJS += cheats.o
|
||||
OBJS += libretro-common/hash/rhash.o
|
||||
OBJS += gfx/video_context_driver.o
|
||||
OBJS += gfx/drivers_context/gfx_null_ctx.o
|
||||
OBJS += gfx/video_texture_image.o
|
||||
OBJS += gfx/image/image.o
|
||||
OBJS += libretro-common/formats/tga/rtga.o
|
||||
OBJS += libretro-common/formats/png/rpng.o
|
||||
OBJS += libretro-common/formats/png/rpng_encode.o
|
||||
@@ -87,11 +75,10 @@ else
|
||||
OBJS += input/drivers_joypad/hid_joypad.o
|
||||
OBJS += input/drivers_hid/null_hid.o
|
||||
OBJS += gfx/video_state_tracker.o
|
||||
OBJS += libretro-common/queues/fifo_queue.o
|
||||
OBJS += libretro-common/queues/fifo_buffer.o
|
||||
OBJS += audio/audio_resampler_driver.o
|
||||
OBJS += audio/drivers_resampler/sinc_resampler.o
|
||||
OBJS += audio/drivers_resampler/nearest_resampler.o
|
||||
OBJS += audio/drivers_resampler/null_resampler.o
|
||||
OBJS += audio/drivers_resampler/sinc.o
|
||||
OBJS += audio/drivers_resampler/nearest.o
|
||||
OBJS += audio/drivers_resampler/cc_resampler.o
|
||||
OBJS += camera/drivers/nullcamera.o
|
||||
OBJS += location/drivers/nulllocation.o
|
||||
@@ -99,7 +86,7 @@ else
|
||||
OBJS += audio/drivers/ctr_dsp_audio.o
|
||||
OBJS += audio/drivers/nullaudio.o
|
||||
OBJS += gfx/video_driver.o
|
||||
OBJS += gfx/video_coord_array.o
|
||||
OBJS += gfx/video_common.o
|
||||
OBJS += input/input_driver.o
|
||||
OBJS += audio/audio_driver.o
|
||||
OBJS += camera/camera_driver.o
|
||||
@@ -135,15 +122,17 @@ else
|
||||
OBJS += content.o
|
||||
OBJS += libretro-common/file/file_path.o
|
||||
OBJS += file_path_special.o
|
||||
OBJS += libretro-common/lists/dir_list.o
|
||||
OBJS += libretro-common/file/dir_list.o
|
||||
OBJS += libretro-common/file/retro_dirent.o
|
||||
OBJS += libretro-common/streams/file_stream.o
|
||||
OBJS += libretro-common/file/retro_file.o
|
||||
OBJS += libretro-common/file/retro_stat.o
|
||||
OBJS += list_special.o
|
||||
OBJS += libretro-common/lists/string_list.o
|
||||
OBJS += dir_list_special.o
|
||||
OBJS += string_list_special.o
|
||||
OBJS += libretro-common/string/string_list.o
|
||||
OBJS += libretro-common/string/stdstring.o
|
||||
OBJS += file_ops.o
|
||||
OBJS += libretro-common/file/nbio/nbio_stdio.o
|
||||
OBJS += libretro-common/lists/file_list.o
|
||||
OBJS += libretro-common/file/file_list.o
|
||||
OBJS += libretro-common/queues/message_queue.o
|
||||
OBJS += patch.o
|
||||
OBJS += configuration.o
|
||||
@@ -158,8 +147,7 @@ else
|
||||
OBJS += libretro_version_1.o
|
||||
OBJS += retroarch.o
|
||||
OBJS += runloop.o
|
||||
OBJS += libretro-common/queues/task_queue.o
|
||||
OBJS += tasks/tasks_internal.o
|
||||
OBJS += tasks/tasks.o
|
||||
OBJS += msg_hash.o
|
||||
OBJS += intl/msg_hash_de.o
|
||||
OBJS += intl/msg_hash_es.o
|
||||
@@ -173,9 +161,8 @@ else
|
||||
OBJS += movie.o
|
||||
OBJS += record/record_driver.o
|
||||
OBJS += record/drivers/record_null.o
|
||||
OBJS += tasks/task_content.o
|
||||
OBJS += tasks/task_file_transfer.o
|
||||
OBJS += tasks/task_decompress.o
|
||||
OBJS += tasks/task_file_transfer.o
|
||||
OBJS += screenshot.o
|
||||
OBJS += playlist.o
|
||||
OBJS += menu/menu_driver.o
|
||||
@@ -185,7 +172,6 @@ else
|
||||
OBJS += menu/menu_entries.o
|
||||
OBJS += menu/menu_setting.o
|
||||
OBJS += menu/menu_cbs.o
|
||||
OBJS += menu/menu_content.o
|
||||
OBJS += menu/cbs/menu_cbs_ok.o
|
||||
OBJS += menu/cbs/menu_cbs_cancel.o
|
||||
OBJS += menu/cbs/menu_cbs_select.o
|
||||
@@ -234,6 +220,8 @@ else
|
||||
OBJS += deps/zlib/trees.o
|
||||
OBJS += deps/zlib/uncompr.o
|
||||
OBJS += deps/zlib/zutil.o
|
||||
OBJS += deps/zlib/ioapi.o
|
||||
OBJS += deps/zlib/unzip.o
|
||||
OBJS += audio/audio_utils.o
|
||||
endif
|
||||
|
||||
@@ -297,7 +285,7 @@ CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
LDFLAGS = -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
|
||||
@@ -325,6 +313,11 @@ $(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
$(TARGET).elf: $(OBJS) libretro_ctr.a
|
||||
|
||||
ctr_sprite_shader_shbin.h: gfx/drivers/ctr_sprite.o
|
||||
gfx/drivers/ctr_gfx.c: ctr_sprite_shader_shbin.h
|
||||
griffin/griffin.o: gfx/drivers/ctr_gfx.c
|
||||
|
||||
|
||||
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
@@ -347,15 +340,14 @@ else
|
||||
BANNERTOOL = ctr/tools/bannertool.exe
|
||||
endif
|
||||
|
||||
%.o: %.vsh %.gsh
|
||||
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
%.o: %.shader
|
||||
python $(AEMSTRO)/aemstro_as.py $< $(notdir $<).shbin
|
||||
$(DEVKITARM)/bin/bin2s $(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
rm $(notdir $<).shbin
|
||||
|
||||
%.o: %.vsh
|
||||
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
||||
@@ -411,6 +403,7 @@ clean:
|
||||
rm -f $(TARGET).smdh
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f *_shader_shbin.h
|
||||
rm -f ctr/ctr_config_*.o
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
|
||||
@@ -24,22 +24,20 @@ PPU_SRCS = frontend/frontend_salamander.c \
|
||||
frontend/drivers/platform_ps3.c \
|
||||
frontend/drivers/platform_null.c \
|
||||
libretro-common/file/file_path.c \
|
||||
libretro-common/lists/dir_list.c \
|
||||
libretro-common/lists/string_list.c \
|
||||
libretro-common/file/dir_list.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/file/retro_stat.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/stdstring.c \
|
||||
libretro-common/string/string_list.c \
|
||||
libretro-common/compat/compat_strl.c \
|
||||
libretro-common/streams/file_stream.c \
|
||||
libretro-common/file/retro_file.c \
|
||||
libretro-common/file/config_file.c \
|
||||
verbosity.c
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
PPU_CFLAGS += -DHAVE_LOGGER
|
||||
PPU_SRCS += netlogger.c \
|
||||
libretro-common/net/net_compat.c \
|
||||
libretro-common/net/net_socket.c
|
||||
PPU_SRCS += netlogger.c
|
||||
endif
|
||||
|
||||
PPU_TARGET = retroarch-salamander_ps3.elf
|
||||
|
||||
@@ -37,12 +37,12 @@ OBJS = frontend/frontend_salamander.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
verbosity.o \
|
||||
|
||||
@@ -47,9 +47,9 @@ OBJ = frontend/frontend_salamander.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
@@ -60,9 +60,7 @@ OBJ = frontend/frontend_salamander.o \
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
OBJ += logger/netlogger.o \
|
||||
libretro-common/net/net_compat.o \
|
||||
libretro-common/net/net_socket.o
|
||||
OBJ += logger/netlogger.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
|
||||
+7
-36
@@ -18,8 +18,6 @@
|
||||
|
||||
#include <retro_assert.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include "audio_driver.h"
|
||||
#include "audio_resampler_driver.h"
|
||||
#include "../record/record_driver.h"
|
||||
@@ -28,11 +26,14 @@
|
||||
|
||||
#include "../command_event.h"
|
||||
#include "../configuration.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../runloop.h"
|
||||
#include "../general.h"
|
||||
#include "../performance.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../list_special.h"
|
||||
#include "../string_list_special.h"
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
#include "../netplay/netplay.h"
|
||||
#endif
|
||||
|
||||
#ifndef AUDIO_BUFFER_FREE_SAMPLES_COUNT
|
||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||
@@ -779,7 +780,6 @@ static bool find_audio_driver(void)
|
||||
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
{
|
||||
static struct retro_audio_callback audio_callback;
|
||||
static struct string_list *audio_driver_devices_list = NULL;
|
||||
static struct retro_perf_counter resampler_proc = {0};
|
||||
static const rarch_resampler_t *audio_driver_resampler = NULL;
|
||||
static void *audio_driver_resampler_data = NULL;
|
||||
@@ -793,31 +793,6 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
rarch_resampler_freep(&audio_driver_resampler,
|
||||
&audio_driver_resampler_data);
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_DEVICES_LIST_FREE:
|
||||
if (!current_audio || !current_audio->device_list_free
|
||||
|| !audio_driver_context_audio_data)
|
||||
return false;
|
||||
current_audio->device_list_free(audio_driver_context_audio_data,
|
||||
audio_driver_devices_list);
|
||||
audio_driver_devices_list = NULL;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_DEVICES_LIST_NEW:
|
||||
if (!current_audio || !current_audio->device_list_new
|
||||
|| !audio_driver_context_audio_data)
|
||||
return false;
|
||||
audio_driver_devices_list = (struct string_list*)
|
||||
current_audio->device_list_new(audio_driver_context_audio_data);
|
||||
if (!audio_driver_devices_list)
|
||||
return false;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_DEVICES_LIST_GET:
|
||||
{
|
||||
struct string_list**ptr = (struct string_list**)data;
|
||||
if (!ptr)
|
||||
return false;
|
||||
*ptr = audio_driver_devices_list;
|
||||
}
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_RESAMPLER_INIT:
|
||||
return rarch_resampler_realloc(
|
||||
&audio_driver_resampler_data,
|
||||
@@ -843,7 +818,6 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
audio_driver_context_audio_data = NULL;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_DEINIT:
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_DEVICES_LIST_FREE, NULL);
|
||||
if (!uninit_audio())
|
||||
return false;
|
||||
break;
|
||||
@@ -880,15 +854,12 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
{
|
||||
const struct retro_audio_callback *cb =
|
||||
(const struct retro_audio_callback*)data;
|
||||
#ifdef HAVE_NETPLAY
|
||||
global_t *global = global_get_ptr();
|
||||
#endif
|
||||
|
||||
if (recording_driver_get_data_ptr()) /* A/V sync is a must. */
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (global->netplay.enable)
|
||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
|
||||
return false;
|
||||
#endif
|
||||
if (cb)
|
||||
|
||||
+1
-17
@@ -27,13 +27,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AUDIO_CHUNK_SIZE_BLOCKING 512
|
||||
|
||||
/* So we don't get complete line-noise when fast-forwarding audio. */
|
||||
#define AUDIO_CHUNK_SIZE_NONBLOCKING 2048
|
||||
|
||||
#define AUDIO_MAX_RATIO 16
|
||||
|
||||
enum rarch_audio_ctl_state
|
||||
{
|
||||
RARCH_AUDIO_CTL_NONE = 0,
|
||||
@@ -65,10 +58,7 @@ enum rarch_audio_ctl_state
|
||||
RARCH_AUDIO_CTL_IS_ACTIVE,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_DEINIT,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_INIT,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_PROCESS,
|
||||
RARCH_AUDIO_CTL_DEVICES_LIST_NEW,
|
||||
RARCH_AUDIO_CTL_DEVICES_LIST_FREE,
|
||||
RARCH_AUDIO_CTL_DEVICES_LIST_GET
|
||||
RARCH_AUDIO_CTL_RESAMPLER_PROCESS
|
||||
};
|
||||
|
||||
typedef struct audio_driver
|
||||
@@ -110,12 +100,6 @@ typedef struct audio_driver
|
||||
/* Human-readable identifier. */
|
||||
const char *ident;
|
||||
|
||||
/* Optional. Get audio device list (allocates, caller has to free this) */
|
||||
void *(*device_list_new)(void *data);
|
||||
|
||||
/* Optional. Frees audio device list */
|
||||
void (*device_list_free)(void *data, void *data2);
|
||||
|
||||
/* Optional. */
|
||||
size_t (*write_avail)(void *data);
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#include <dynamic/dylib.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <file/dir_list.h>
|
||||
|
||||
#include "audio_dsp_filter.h"
|
||||
#include "audio_filters/dspfilter.h"
|
||||
|
||||
#include "../config_file_userdata.h"
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../performance.h"
|
||||
#include "../dynamic.h"
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "audio_resampler_driver.h"
|
||||
#include "../config_file_userdata.h"
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../performance.h"
|
||||
#endif
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
#include "../list_special.h"
|
||||
#include "../string_list_special.h"
|
||||
#endif
|
||||
|
||||
static const rarch_resampler_t *resampler_drivers[] = {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "audio_thread_wrapper.h"
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
@@ -326,64 +324,6 @@ static size_t alsa_buffer_size(void *data)
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
static void *alsa_device_list_new(void *data)
|
||||
{
|
||||
void **hints, **n;
|
||||
union string_list_elem_attr attr;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (snd_device_name_hint(-1, "pcm", &hints) != 0)
|
||||
goto error;
|
||||
|
||||
n = hints;
|
||||
|
||||
while (*n != NULL)
|
||||
{
|
||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||
char *io = snd_device_name_get_hint(*n, "IOID");
|
||||
char *desc = snd_device_name_get_hint(*n, "DESC");
|
||||
|
||||
/* description of device IOID - input / output identifcation
|
||||
* ("Input" or "Output"), NULL means both) */
|
||||
|
||||
if (!io || !strcmp(io,"Output"))
|
||||
string_list_append(s, name, attr);
|
||||
|
||||
if (name)
|
||||
free(name);
|
||||
if (io)
|
||||
free(io);
|
||||
if (desc)
|
||||
free(desc);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* free hint buffer too */
|
||||
snd_device_name_free_hint(hints);
|
||||
|
||||
return s;
|
||||
|
||||
error:
|
||||
string_list_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void alsa_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
struct string_list *s = (struct string_list*)array_list_data;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
string_list_free(s);
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsa = {
|
||||
alsa_init,
|
||||
alsa_write,
|
||||
@@ -394,8 +334,6 @@ audio_driver_t audio_alsa = {
|
||||
alsa_free,
|
||||
alsa_use_float,
|
||||
"alsa",
|
||||
alsa_device_list_new,
|
||||
alsa_device_list_free,
|
||||
alsa_write_avail,
|
||||
alsa_buffer_size,
|
||||
};
|
||||
@@ -377,8 +377,6 @@ audio_driver_t audio_alsa = {
|
||||
alsa_qsa_free,
|
||||
alsa_qsa_use_float,
|
||||
"alsa",
|
||||
NULL,
|
||||
NULL,
|
||||
alsa_qsa_write_avail,
|
||||
alsa_qsa_buffer_size,
|
||||
};
|
||||
@@ -16,12 +16,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
@@ -344,64 +342,6 @@ static size_t alsa_thread_buffer_size(void *data)
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
static void *alsa_device_list_new(void *data)
|
||||
{
|
||||
void **hints, **n;
|
||||
union string_list_elem_attr attr;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (snd_device_name_hint(-1, "pcm", &hints) != 0)
|
||||
goto error;
|
||||
|
||||
n = hints;
|
||||
|
||||
while (*n != NULL)
|
||||
{
|
||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||
char *io = snd_device_name_get_hint(*n, "IOID");
|
||||
char *desc = snd_device_name_get_hint(*n, "DESC");
|
||||
|
||||
/* description of device IOID - input / output identifcation
|
||||
* ("Input" or "Output"), NULL means both) */
|
||||
|
||||
if (!io || !strcmp(io,"Output"))
|
||||
string_list_append(s, name, attr);
|
||||
|
||||
if (name)
|
||||
free(name);
|
||||
if (io)
|
||||
free(io);
|
||||
if (desc)
|
||||
free(desc);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* free hint buffer too */
|
||||
snd_device_name_free_hint(hints);
|
||||
|
||||
return s;
|
||||
|
||||
error:
|
||||
string_list_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void alsa_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
struct string_list *s = (struct string_list*)array_list_data;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
string_list_free(s);
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsathread = {
|
||||
alsa_thread_init,
|
||||
alsa_thread_write,
|
||||
@@ -412,8 +352,6 @@ audio_driver_t audio_alsathread = {
|
||||
alsa_thread_free,
|
||||
alsa_thread_use_float,
|
||||
"alsathread",
|
||||
alsa_device_list_new,
|
||||
alsa_device_list_free,
|
||||
alsa_thread_write_avail,
|
||||
alsa_thread_buffer_size,
|
||||
};
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <AudioUnit/AUComponent.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <retro_endianness.h>
|
||||
#include <string/stdstring.h>
|
||||
@@ -440,17 +440,6 @@ static size_t coreaudio_buffer_size(void *data)
|
||||
return dev->buffer_size;
|
||||
}
|
||||
|
||||
static void *coreaudio_device_list_new(void *data)
|
||||
{
|
||||
/* TODO/FIXME */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void coreaudio_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
/* TODO/FIXME */
|
||||
}
|
||||
|
||||
audio_driver_t audio_coreaudio = {
|
||||
coreaudio_init,
|
||||
coreaudio_write,
|
||||
@@ -461,8 +450,6 @@ audio_driver_t audio_coreaudio = {
|
||||
coreaudio_free,
|
||||
coreaudio_use_float,
|
||||
"coreaudio",
|
||||
coreaudio_device_list_new,
|
||||
coreaudio_device_list_free,
|
||||
coreaudio_write_avail,
|
||||
coreaudio_buffer_size,
|
||||
};
|
||||
@@ -300,8 +300,6 @@ audio_driver_t audio_ctr_csnd = {
|
||||
ctr_csnd_audio_free,
|
||||
ctr_csnd_audio_use_float,
|
||||
"csnd",
|
||||
NULL,
|
||||
NULL,
|
||||
ctr_csnd_audio_write_avail,
|
||||
ctr_csnd_audio_buffer_size
|
||||
};
|
||||
@@ -214,8 +214,6 @@ audio_driver_t audio_ctr_dsp = {
|
||||
ctr_dsp_audio_free,
|
||||
ctr_dsp_audio_use_float,
|
||||
"dsp",
|
||||
NULL,
|
||||
NULL,
|
||||
ctr_dsp_audio_write_avail,
|
||||
ctr_dsp_audio_buffer_size
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
@@ -489,8 +489,6 @@ audio_driver_t audio_dsound = {
|
||||
dsound_free,
|
||||
dsound_use_float,
|
||||
"dsound",
|
||||
NULL,
|
||||
NULL,
|
||||
dsound_write_avail,
|
||||
dsound_buffer_size,
|
||||
};
|
||||
@@ -241,8 +241,6 @@ audio_driver_t audio_gx = {
|
||||
gx_audio_free,
|
||||
gx_audio_use_float,
|
||||
"gx",
|
||||
NULL,
|
||||
NULL,
|
||||
gx_audio_write_avail,
|
||||
gx_audio_buffer_size,
|
||||
};
|
||||
@@ -362,8 +362,6 @@ audio_driver_t audio_jack = {
|
||||
ja_free,
|
||||
ja_use_float,
|
||||
"jack",
|
||||
NULL,
|
||||
NULL,
|
||||
ja_write_avail,
|
||||
ja_buffer_size,
|
||||
};
|
||||
@@ -85,8 +85,6 @@ audio_driver_t audio_null = {
|
||||
null_audio_free,
|
||||
null_audio_use_float,
|
||||
"null",
|
||||
NULL,
|
||||
NULL,
|
||||
null_audio_write_avail,
|
||||
NULL
|
||||
};
|
||||
@@ -267,8 +267,6 @@ audio_driver_t audio_openal = {
|
||||
al_free,
|
||||
al_use_float,
|
||||
"openal",
|
||||
NULL,
|
||||
NULL,
|
||||
al_write_avail,
|
||||
al_buffer_size,
|
||||
};
|
||||
@@ -313,8 +313,6 @@ audio_driver_t audio_opensl = {
|
||||
sl_free,
|
||||
sl_use_float,
|
||||
"opensl",
|
||||
NULL,
|
||||
NULL,
|
||||
sl_write_avail,
|
||||
sl_buffer_size,
|
||||
};
|
||||
@@ -212,8 +212,6 @@ audio_driver_t audio_oss = {
|
||||
oss_free,
|
||||
oss_use_float,
|
||||
"oss",
|
||||
NULL,
|
||||
NULL,
|
||||
oss_write_avail,
|
||||
oss_buffer_size,
|
||||
};
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
@@ -247,8 +247,6 @@ audio_driver_t audio_ps3 = {
|
||||
ps3_audio_free,
|
||||
ps3_audio_use_float,
|
||||
"ps3",
|
||||
NULL,
|
||||
NULL,
|
||||
ps3_audio_write_avail,
|
||||
NULL
|
||||
};
|
||||
@@ -286,8 +286,6 @@ audio_driver_t audio_psp = {
|
||||
#else
|
||||
"psp",
|
||||
#endif
|
||||
NULL,
|
||||
NULL,
|
||||
psp_write_avail,
|
||||
psp_buffer_size,
|
||||
};
|
||||
@@ -343,8 +343,6 @@ audio_driver_t audio_pulse = {
|
||||
pulse_free,
|
||||
pulse_use_float,
|
||||
"pulse",
|
||||
NULL,
|
||||
NULL,
|
||||
pulse_write_avail,
|
||||
pulse_buffer_size,
|
||||
};
|
||||
@@ -142,8 +142,6 @@ audio_driver_t audio_roar = {
|
||||
ra_free,
|
||||
ra_use_float,
|
||||
"roar",
|
||||
NULL,
|
||||
NULL,
|
||||
ra_write_avail,
|
||||
NULL
|
||||
};
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
@@ -233,8 +233,6 @@ audio_driver_t audio_rsound = {
|
||||
rs_free,
|
||||
rs_use_float,
|
||||
"rsound",
|
||||
NULL,
|
||||
NULL,
|
||||
rs_write_avail,
|
||||
rs_buffer_size,
|
||||
};
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define RSD_DEFAULT_HOST "127.0.0.1" /* Stupid Windows. */
|
||||
|
||||
@@ -110,8 +110,6 @@ audio_driver_t audio_rwebaudio = {
|
||||
rwebaudio_free,
|
||||
rwebaudio_use_float,
|
||||
"rwebaudio",
|
||||
NULL,
|
||||
NULL,
|
||||
rwebaudio_write_avail,
|
||||
rwebaudio_buffer_size,
|
||||
};
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
@@ -253,8 +253,6 @@ audio_driver_t audio_sdl = {
|
||||
#else
|
||||
"sdl",
|
||||
#endif
|
||||
NULL,
|
||||
NULL,
|
||||
sdl_audio_write_avail,
|
||||
NULL
|
||||
};
|
||||
@@ -347,8 +347,6 @@ audio_driver_t audio_xa = {
|
||||
xa_free,
|
||||
xa_use_float,
|
||||
"xaudio",
|
||||
NULL,
|
||||
NULL,
|
||||
xa_write_avail,
|
||||
xa_buffer_size,
|
||||
};
|
||||
@@ -146,8 +146,6 @@ audio_driver_t audio_xenon360 = {
|
||||
xenon360_audio_free,
|
||||
xenon360_use_float,
|
||||
"xenon360",
|
||||
NULL,
|
||||
NULL,
|
||||
xenon360_write_avail,
|
||||
NULL
|
||||
};
|
||||
+26
-23
@@ -20,19 +20,22 @@ CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I../../
|
||||
LDFLAGS += -lm
|
||||
|
||||
SHAREDOBJ += $(LIBRETRO_COMM_DIR)/memmap/memalign.o \
|
||||
$(LIBRETRO_COMM_DIR)/lists/string_list.o \
|
||||
../..//config_file_userdata.o \
|
||||
../audio_resampler_driver.o \
|
||||
$(LIBRETRO_COMM_DIR)/string/string_list.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/config_file_userdata.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/config_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/streams/file_stream.o \
|
||||
$(LIBRETRO_COMM_DIR)/string/stdstring.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/retro_file.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/file_path.o \
|
||||
$(LIBRETRO_COMM_DIR)/file/retro_stat.o \
|
||||
$(LIBRETRO_COMM_DIR)/compat/compat_strl.o \
|
||||
$(LIBRETRO_COMM_DIR)/compat/compat.o \
|
||||
$(LIBRETRO_COMM_DIR)/hash/rhash.o \
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
resampler-sinc.o: ../audio_resampler_driver.c $(SHAREDOBJ)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
resampler-cc.o: ../audio_resampler_driver.c $(SHAREDOBJ)
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DRESAMPLER_IDENT='"CC"'
|
||||
|
||||
main-cc.o: main.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DRESAMPLER_IDENT='"CC"'
|
||||
|
||||
@@ -42,16 +45,16 @@ snr-cc.o: snr.c
|
||||
cc-resampler.o: ../drivers_resampler/cc_resampler.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
sinc-lowest.o: ../drivers_resampler/sinc_resampler.c
|
||||
sinc-lowest.o: ../drivers_resampler/sinc.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DSINC_LOWEST_QUALITY
|
||||
|
||||
sinc-lower.o: ../drivers_resampler/sinc_resampler.c
|
||||
sinc-lower.o: ../drivers_resampler/sinc.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DSINC_LOWER_QUALITY
|
||||
|
||||
sinc.o: ../drivers_resampler/sinc_resampler.c
|
||||
sinc.o: ../drivers_resampler/sinc.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
nearest_resampler.o: ../drivers_resampler/nearest_resampler.c
|
||||
nearest.o: ../drivers_resampler/nearest.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
sinc-higher.o: ../drivers_resampler/sinc.c
|
||||
@@ -60,40 +63,40 @@ sinc-higher.o: ../drivers_resampler/sinc.c
|
||||
sinc-highest.o: ../drivers_resampler/sinc.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) -DSINC_HIGHEST_QUALITY
|
||||
|
||||
test-sinc-lowest: sinc-lowest.o ../audio_utils.o main.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-sinc-lowest: sinc-lowest.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-lowest: sinc-lowest.o ../audio_utils.o snr.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-snr-sinc-lowest: sinc-lowest.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-lower: sinc-lower.o ../audio_utils.o main.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-sinc-lower: sinc-lower.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-lower: sinc-lower.o ../audio_utils.o snr.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-snr-sinc-lower: sinc-lower.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc: sinc.o ../audio_utils.o main.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-sinc: sinc.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc: sinc.o ../audio_utils.o snr.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-snr-sinc: sinc.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-higher: sinc-higher.o ../audio_utils.o main.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-sinc-higher: sinc-higher.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-higher: sinc-higher.o ../audio_utils.o snr.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-snr-sinc-higher: sinc-higher.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-sinc-highest: sinc-highest.o ../audio_utils.o main.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-sinc-highest: sinc-highest.o ../audio_utils.o main.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-sinc-highest: sinc-highest.o ../audio_utils.o snr.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-snr-sinc-highest: sinc-highest.o ../audio_utils.o snr.o resampler-sinc.o resampler-cc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-cc: cc-resampler.o ../audio_utils.o main-cc.o resampler-cc.o sinc.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-cc: cc-resampler.o ../audio_utils.o main-cc.o resampler-cc.o resampler-cc.o sinc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
test-snr-cc: cc-resampler.o ../audio_utils.o snr-cc.o resampler-cc.o sinc.o nearest_resampler.o $(SHAREDOBJ)
|
||||
test-snr-cc: cc-resampler.o ../audio_utils.o snr-cc.o resampler-cc.o sinc.o nearest.o $(SHAREDOBJ)
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
|
||||
+39
-24
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
#include <string/string_list.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "autosave.h"
|
||||
@@ -55,6 +55,28 @@ struct autosave
|
||||
|
||||
static struct autosave_st autosave_state;
|
||||
|
||||
/**
|
||||
* autosave_lock:
|
||||
* @handle : pointer to autosave object
|
||||
*
|
||||
* Locks autosave.
|
||||
**/
|
||||
static void autosave_lock(autosave_t *handle)
|
||||
{
|
||||
slock_lock(handle->lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* autosave_unlock:
|
||||
* @handle : pointer to autosave object
|
||||
*
|
||||
* Unlocks autosave.
|
||||
**/
|
||||
static void autosave_unlock(autosave_t *handle)
|
||||
{
|
||||
slock_unlock(handle->lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* autosave_thread:
|
||||
* @data : pointer to autosave object
|
||||
@@ -63,19 +85,19 @@ static struct autosave_st autosave_state;
|
||||
**/
|
||||
static void autosave_thread(void *data)
|
||||
{
|
||||
bool first_log = true;
|
||||
bool first_log = true;
|
||||
autosave_t *save = (autosave_t*)data;
|
||||
|
||||
while (!save->quit)
|
||||
{
|
||||
bool differ;
|
||||
|
||||
slock_lock(save->lock);
|
||||
autosave_lock(save);
|
||||
differ = memcmp(save->buffer, save->retro_buffer,
|
||||
save->bufsize) != 0;
|
||||
if (differ)
|
||||
memcpy(save->buffer, save->retro_buffer, save->bufsize);
|
||||
slock_unlock(save->lock);
|
||||
autosave_unlock(save);
|
||||
|
||||
if (differ)
|
||||
{
|
||||
@@ -127,13 +149,12 @@ static void autosave_thread(void *data)
|
||||
* Returns: pointer to new autosave_t object if successful, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
static autosave_t *autosave_new(const char *path,
|
||||
const void *data, size_t size,
|
||||
autosave_t *autosave_new(const char *path, const void *data, size_t size,
|
||||
unsigned interval)
|
||||
{
|
||||
autosave_t *handle = (autosave_t*)calloc(1, sizeof(*handle));
|
||||
autosave_t *handle = (autosave_t*)calloc(1, sizeof(*handle));
|
||||
if (!handle)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
handle->bufsize = size;
|
||||
handle->interval = interval;
|
||||
@@ -142,8 +163,10 @@ static autosave_t *autosave_new(const char *path,
|
||||
handle->retro_buffer = data;
|
||||
|
||||
if (!handle->buffer)
|
||||
goto error;
|
||||
|
||||
{
|
||||
free(handle);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(handle->buffer, handle->retro_buffer, handle->bufsize);
|
||||
|
||||
handle->lock = slock_new();
|
||||
@@ -153,11 +176,6 @@ static autosave_t *autosave_new(const char *path,
|
||||
handle->thread = sthread_create(autosave_thread, handle);
|
||||
|
||||
return handle;
|
||||
|
||||
error:
|
||||
if (handle)
|
||||
free(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +184,7 @@ error:
|
||||
*
|
||||
* Frees autosave object.
|
||||
**/
|
||||
static void autosave_free(autosave_t *handle)
|
||||
void autosave_free(autosave_t *handle)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
@@ -197,7 +215,7 @@ void lock_autosave(void)
|
||||
for (i = 0; i < autosave_state.num; i++)
|
||||
{
|
||||
if (autosave_state.list[i])
|
||||
slock_lock(autosave_state.list[i]->lock);
|
||||
autosave_lock(autosave_state.list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,27 +231,24 @@ void unlock_autosave(void)
|
||||
for (i = 0; i < autosave_state.num; i++)
|
||||
{
|
||||
if (autosave_state.list[i])
|
||||
slock_unlock(autosave_state.list[i]->lock);
|
||||
autosave_unlock(autosave_state.list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void autosave_event_init(void)
|
||||
{
|
||||
unsigned i;
|
||||
autosave_t **list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (settings->autosave_interval < 1 || !global->savefiles)
|
||||
return;
|
||||
|
||||
list = (autosave_t**)calloc(global->savefiles->size,
|
||||
sizeof(*autosave_state.list));
|
||||
if (!list)
|
||||
if (!(autosave_state.list = (autosave_t**)calloc(global->savefiles->size,
|
||||
sizeof(*autosave_state.list))))
|
||||
return;
|
||||
|
||||
autosave_state.list = list;
|
||||
autosave_state.num = global->savefiles->size;
|
||||
autosave_state.num = global->savefiles->size;
|
||||
|
||||
for (i = 0; i < global->savefiles->size; i++)
|
||||
{
|
||||
|
||||
+23
@@ -25,6 +25,29 @@ extern "C" {
|
||||
|
||||
typedef struct autosave autosave_t;
|
||||
|
||||
/**
|
||||
* autosave_new:
|
||||
* @path : path to autosave file
|
||||
* @data : pointer to buffer
|
||||
* @size : size of @data buffer
|
||||
* @interval : interval at which saves should be performed.
|
||||
*
|
||||
* Create and initialize autosave object.
|
||||
*
|
||||
* Returns: pointer to new autosave_t object if successful, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
autosave_t *autosave_new(const char *path, const void *data,
|
||||
size_t size, unsigned interval);
|
||||
|
||||
/**
|
||||
* autosave_free:
|
||||
* @handle : pointer to autosave object
|
||||
*
|
||||
* Frees autosave object.
|
||||
**/
|
||||
void autosave_free(autosave_t *handle);
|
||||
|
||||
/**
|
||||
* lock_autosave:
|
||||
*
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
|
||||
#include "camera_driver.h"
|
||||
|
||||
#include "../configuration.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../runloop.h"
|
||||
#include "../list_special.h"
|
||||
#include "../general.h"
|
||||
#include "../string_list_special.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
static const camera_driver_t *camera_drivers[] = {
|
||||
|
||||
@@ -130,7 +130,7 @@ bool cheat_manager_save(const char *path)
|
||||
settings_t *settings = config_get_ptr();
|
||||
cheat_manager_t *handle = cheat_manager_state;
|
||||
|
||||
fill_pathname_join(buf, settings->path.cheat_database,
|
||||
fill_pathname_join(buf, settings->cheat_database,
|
||||
path, sizeof(buf));
|
||||
|
||||
fill_pathname_noext(cheats_file, buf, ".cht", sizeof(cheats_file));
|
||||
@@ -177,38 +177,6 @@ bool cheat_manager_save(const char *path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static cheat_manager_t *cheat_manager_new(unsigned size)
|
||||
{
|
||||
unsigned i;
|
||||
cheat_manager_t *handle = (cheat_manager_t*)
|
||||
calloc(1, sizeof(struct cheat_manager));
|
||||
|
||||
if (!handle)
|
||||
return NULL;
|
||||
|
||||
handle->buf_size = size;
|
||||
handle->size = size;
|
||||
handle->cheats = (struct item_cheat*)
|
||||
calloc(handle->buf_size, sizeof(struct item_cheat));
|
||||
|
||||
if (!handle->cheats)
|
||||
{
|
||||
handle->buf_size = 0;
|
||||
handle->size = 0;
|
||||
handle->cheats = NULL;
|
||||
return handle;
|
||||
}
|
||||
|
||||
for (i = 0; i < handle->size; i++)
|
||||
{
|
||||
handle->cheats[i].desc = NULL;
|
||||
handle->cheats[i].code = NULL;
|
||||
handle->cheats[i].state = false;
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
bool cheat_manager_load(const char *path)
|
||||
{
|
||||
unsigned cheats = 0, i;
|
||||
@@ -262,6 +230,37 @@ bool cheat_manager_load(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
cheat_manager_t *cheat_manager_new(unsigned size)
|
||||
{
|
||||
unsigned i;
|
||||
cheat_manager_t *handle = (cheat_manager_t*)
|
||||
calloc(1, sizeof(struct cheat_manager));
|
||||
|
||||
if (!handle)
|
||||
return NULL;
|
||||
|
||||
handle->buf_size = size;
|
||||
handle->size = size;
|
||||
handle->cheats = (struct item_cheat*)
|
||||
calloc(handle->buf_size, sizeof(struct item_cheat));
|
||||
|
||||
if (!handle->cheats)
|
||||
{
|
||||
handle->buf_size = 0;
|
||||
handle->size = 0;
|
||||
handle->cheats = NULL;
|
||||
return handle;
|
||||
}
|
||||
|
||||
for (i = 0; i < handle->size; i++)
|
||||
{
|
||||
handle->cheats[i].desc = NULL;
|
||||
handle->cheats[i].code = NULL;
|
||||
handle->cheats[i].state = false;
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
bool cheat_manager_realloc(unsigned new_size)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@ typedef struct cheat_manager cheat_manager_t;
|
||||
|
||||
unsigned cheat_manager_get_size(void);
|
||||
|
||||
cheat_manager_t *cheat_manager_new(unsigned size);
|
||||
|
||||
bool cheat_manager_load(const char *path);
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include <formats/jsonsax.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <retro_file.h>
|
||||
#include <rhash.h>
|
||||
#include <rthreads/async_job.h>
|
||||
|
||||
@@ -1688,7 +1688,7 @@ static size_t cheevos_eval_md5(
|
||||
}
|
||||
else
|
||||
{
|
||||
RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0);
|
||||
RFILE *file = retro_fopen(info->path, RFILE_MODE_READ, 0);
|
||||
size_t size = 0;
|
||||
|
||||
if (!file)
|
||||
@@ -1697,7 +1697,7 @@ static size_t cheevos_eval_md5(
|
||||
for (;;)
|
||||
{
|
||||
uint8_t buffer[4096];
|
||||
ssize_t num_read = filestream_read(file,
|
||||
ssize_t num_read = retro_fread(file,
|
||||
(void*)buffer, sizeof(buffer));
|
||||
|
||||
if (num_read <= 0)
|
||||
@@ -1707,7 +1707,7 @@ static size_t cheevos_eval_md5(
|
||||
size += num_read;
|
||||
}
|
||||
|
||||
filestream_close(file);
|
||||
retro_fclose(file);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
@@ -1825,14 +1825,14 @@ static unsigned cheevos_find_game_id_nes(
|
||||
}
|
||||
else
|
||||
{
|
||||
RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0);
|
||||
RFILE *file = retro_fopen(info->path, RFILE_MODE_READ, 0);
|
||||
ssize_t num_read;
|
||||
|
||||
if (!file)
|
||||
return 0;
|
||||
|
||||
num_read = filestream_read(file, (void*)&header, sizeof(header));
|
||||
filestream_close(file);
|
||||
num_read = retro_fread(file, (void*)&header, sizeof(header));
|
||||
retro_fclose(file);
|
||||
|
||||
if (num_read < (ssize_t)sizeof(header))
|
||||
return 0;
|
||||
@@ -1861,15 +1861,7 @@ static unsigned cheevos_find_game_id_nes(
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned bytes;
|
||||
ssize_t num_read;
|
||||
int i, mapper_no;
|
||||
int not_power2[] =
|
||||
{
|
||||
53, 198, 228
|
||||
};
|
||||
bool round = true;
|
||||
RFILE *file = filestream_open(info->path, RFILE_MODE_READ, 0);
|
||||
RFILE *file = retro_fopen(info->path, RFILE_MODE_READ, 0);
|
||||
uint8_t * data = (uint8_t *) malloc(rom_size << 14);
|
||||
|
||||
if (!file || !data)
|
||||
@@ -1879,32 +1871,36 @@ static unsigned cheevos_find_game_id_nes(
|
||||
memset(data, 0xFF, rom_size << 14);
|
||||
|
||||
/* from fceu core - compute size using the cart mapper */
|
||||
mapper_no = (header.rom_type >> 4);
|
||||
mapper_no |= (header.rom_type2 & 0xF0);
|
||||
int MapperNo = (header.rom_type >> 4);
|
||||
MapperNo |= (header.rom_type2 & 0xF0);
|
||||
|
||||
|
||||
for (i = 0; i != sizeof(not_power2) / sizeof(not_power2[0]); ++i)
|
||||
int not_power2[] =
|
||||
{
|
||||
/* for games not to the power of 2, so we just read enough
|
||||
* PRG rom from it, but we have to keep ROM_size to the power of 2
|
||||
* since PRGCartMapping wants ROM_size to be to the power of 2
|
||||
* so instead if not to power of 2, we just use head.ROM_size when
|
||||
* we use FCEU_read. */
|
||||
if (not_power2[i] == mapper_no) {
|
||||
53, 198, 228
|
||||
};
|
||||
|
||||
bool round = true;
|
||||
for (int i = 0; i != sizeof(not_power2) / sizeof(not_power2[0]); ++i) {
|
||||
//for games not to the power of 2, so we just read enough
|
||||
//prg rom from it, but we have to keep ROM_size to the power of 2
|
||||
//since PRGCartMapping wants ROM_size to be to the power of 2
|
||||
//so instead if not to power of 2, we just use head.ROM_size when
|
||||
//we use FCEU_read
|
||||
if (not_power2[i] == MapperNo) {
|
||||
round = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MD5_Init(&ctx);
|
||||
filestream_seek(file, sizeof(header), SEEK_SET);
|
||||
retro_fseek(file, sizeof(header), SEEK_SET);
|
||||
/* from fceu core - check if Trainer included in ROM data */
|
||||
if (header.rom_type & 4)
|
||||
filestream_seek(file, sizeof(header), SEEK_CUR);
|
||||
retro_fseek(file, sizeof(header), SEEK_CUR);
|
||||
|
||||
bytes = (round) ? rom_size : header.rom_size;
|
||||
num_read = filestream_read(file, (void*) data, 0x4000 * bytes );
|
||||
filestream_close(file);
|
||||
unsigned bytes = (round) ? rom_size : header.rom_size;
|
||||
ssize_t num_read = retro_fread(file, (void*) data, 0x4000 * bytes );
|
||||
retro_fclose(file);
|
||||
|
||||
if (num_read <= 0)
|
||||
return 0;
|
||||
@@ -2109,9 +2105,9 @@ static void cheevos_populate_menu(void *data)
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_displaylist_info_t *info = (menu_displaylist_info_t*)data;
|
||||
|
||||
menu_entries_add(info->list, "Unlocked Achievements:",
|
||||
menu_entries_push(info->list, "Unlocked Achievements:",
|
||||
"", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
menu_entries_add(info->list, "", "", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "", "", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
|
||||
cheevo = cheevos_locals.core.cheevos;
|
||||
end = cheevos_locals.core.cheevos + cheevos_locals.core.count;
|
||||
@@ -2119,7 +2115,7 @@ static void cheevos_populate_menu(void *data)
|
||||
for (i = 0; cheevo < end; i++, cheevo++)
|
||||
{
|
||||
if (!cheevo->active)
|
||||
menu_entries_add(info->list, cheevo->title,
|
||||
menu_entries_push(info->list, cheevo->title,
|
||||
cheevo->description, MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
|
||||
}
|
||||
|
||||
@@ -2132,15 +2128,15 @@ static void cheevos_populate_menu(void *data)
|
||||
for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++)
|
||||
{
|
||||
if (!cheevo->active)
|
||||
menu_entries_add(info->list, cheevo->title,
|
||||
menu_entries_push(info->list, cheevo->title,
|
||||
cheevo->description, MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
menu_entries_add(info->list, "", "", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
menu_entries_add(info->list, "Locked Achievements:", "",
|
||||
menu_entries_push(info->list, "", "", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "Locked Achievements:", "",
|
||||
MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
menu_entries_add(info->list, "", "", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
menu_entries_push(info->list, "", "", MENU_SETTINGS_CHEEVOS_NONE, 0, 0);
|
||||
|
||||
cheevo = cheevos_locals.core.cheevos;
|
||||
end = cheevos_locals.core.cheevos + cheevos_locals.core.count;
|
||||
@@ -2148,7 +2144,7 @@ static void cheevos_populate_menu(void *data)
|
||||
for (i = 0; cheevo < end; i++, cheevo++)
|
||||
{
|
||||
if (cheevo->active)
|
||||
menu_entries_add(info->list, cheevo->title,
|
||||
menu_entries_push(info->list, cheevo->title,
|
||||
cheevo->description, MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
|
||||
}
|
||||
|
||||
@@ -2161,7 +2157,7 @@ static void cheevos_populate_menu(void *data)
|
||||
for (i = cheevos_locals.core.count; cheevo < end; i++, cheevo++)
|
||||
{
|
||||
if (cheevo->active)
|
||||
menu_entries_add(info->list, cheevo->title,
|
||||
menu_entries_push(info->list, cheevo->title,
|
||||
cheevo->description, MENU_SETTINGS_CHEEVOS_START + i, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/file_path.h>
|
||||
#include <net/net_compat.h>
|
||||
#include <net/net_socket.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "msg_hash.h"
|
||||
@@ -123,23 +122,41 @@ static const struct cmd_map map[] = {
|
||||
#if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY)
|
||||
static bool cmd_init_network(rarch_cmd_t *handle, uint16_t port)
|
||||
{
|
||||
int fd;
|
||||
struct addrinfo hints = {0};
|
||||
char port_buf[16] = {0};
|
||||
struct addrinfo *res = NULL;
|
||||
int yes = 1;
|
||||
|
||||
if (!network_init())
|
||||
return false;
|
||||
|
||||
RARCH_LOG("Bringing up command interface on port %hu.\n",
|
||||
(unsigned short)port);
|
||||
|
||||
fd = socket_init((void**)&res, port, NULL, SOCKET_TYPE_DATAGRAM);
|
||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||
hints.ai_family = AF_INET;
|
||||
#else
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
#endif
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
if (fd < 0)
|
||||
|
||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||
if (getaddrinfo_retro(NULL, port_buf, &hints, &res) < 0)
|
||||
goto error;
|
||||
|
||||
handle->net_fd = fd;
|
||||
handle->net_fd = socket(res->ai_family,
|
||||
res->ai_socktype, res->ai_protocol);
|
||||
if (handle->net_fd < 0)
|
||||
goto error;
|
||||
|
||||
if (!socket_nonblock(handle->net_fd))
|
||||
goto error;
|
||||
|
||||
if (!socket_bind(handle->net_fd, (void*)res))
|
||||
setsockopt(handle->net_fd, SOL_SOCKET,
|
||||
SO_REUSEADDR, (const char*)&yes, sizeof(int));
|
||||
if (bind(handle->net_fd, res->ai_addr, res->ai_addrlen) < 0)
|
||||
{
|
||||
RARCH_ERR("Failed to bind socket.\n");
|
||||
goto error;
|
||||
@@ -505,6 +522,11 @@ static bool send_udp_packet(const char *host,
|
||||
int fd = -1;
|
||||
bool ret = true;
|
||||
|
||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||
hints.ai_family = AF_INET;
|
||||
#else
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
#endif
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
|
||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||
@@ -525,7 +547,7 @@ static bool send_udp_packet(const char *host,
|
||||
goto end;
|
||||
}
|
||||
|
||||
len = strlen(msg);
|
||||
len = strlen(msg);
|
||||
ret_len = sendto(fd, msg, len, 0, tmp->ai_addr, tmp->ai_addrlen);
|
||||
|
||||
if (ret_len < len)
|
||||
|
||||
+38
-50
@@ -17,12 +17,11 @@
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <file/dir_list.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "command_event.h"
|
||||
|
||||
#include "defaults.h"
|
||||
#include "frontend/frontend_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
@@ -39,7 +38,7 @@
|
||||
#include "rewind.h"
|
||||
#include "system.h"
|
||||
#include "ui/ui_companion_driver.h"
|
||||
#include "list_special.h"
|
||||
#include "dir_list_special.h"
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
#include "cheevos.h"
|
||||
@@ -462,7 +461,8 @@ static void event_load_auto_state(void)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (global->netplay.enable && !global->netplay.is_spectate)
|
||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)
|
||||
&& !global->netplay.is_spectate)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -670,10 +670,11 @@ static bool event_save_core_config(void)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
*config_dir = '\0';
|
||||
if (!string_is_empty(settings->directory.menu_config))
|
||||
strlcpy(config_dir, settings->directory.menu_config,
|
||||
|
||||
if (*settings->menu_config_directory)
|
||||
strlcpy(config_dir, settings->menu_config_directory,
|
||||
sizeof(config_dir));
|
||||
else if (!string_is_empty(global->path.config)) /* Fallback */
|
||||
else if (*global->path.config) /* Fallback */
|
||||
fill_pathname_basedir(config_dir, global->path.config,
|
||||
sizeof(config_dir));
|
||||
else
|
||||
@@ -682,23 +683,18 @@ static bool event_save_core_config(void)
|
||||
RARCH_ERR("%s\n", msg_hash_to_str(MSG_CONFIG_DIRECTORY_NOT_SET));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Infer file name based on libretro core. */
|
||||
if (!string_is_empty(settings->path.libretro)
|
||||
&& path_file_exists(settings->path.libretro))
|
||||
if (*settings->libretro && path_file_exists(settings->libretro))
|
||||
{
|
||||
unsigned i;
|
||||
RARCH_LOG("Using core name for new config\n");
|
||||
|
||||
/* In case of collision, find an alternative name. */
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
char tmp[64];
|
||||
|
||||
fill_pathname_base(
|
||||
config_name,
|
||||
settings->path.libretro,
|
||||
fill_pathname_base(config_name, settings->libretro,
|
||||
sizeof(config_name));
|
||||
|
||||
path_remove_extension(config_name);
|
||||
fill_pathname_join(config_path, config_dir, config_name,
|
||||
sizeof(config_path));
|
||||
@@ -707,7 +703,7 @@ static bool event_save_core_config(void)
|
||||
else
|
||||
strlcpy(tmp, ".cfg", sizeof(tmp));
|
||||
|
||||
strlcat(config_path, tmp, sizeof(config_path));
|
||||
snprintf(config_path, sizeof(config_path), "%s%s", config_path, tmp);
|
||||
if (!path_file_exists(config_path))
|
||||
{
|
||||
found_path = true;
|
||||
@@ -770,7 +766,7 @@ void event_save_current_config(void)
|
||||
global_t *global = global_get_ptr();
|
||||
bool ret = false;
|
||||
|
||||
if (settings->config_save_on_exit && !string_is_empty(global->path.config))
|
||||
if (settings->config_save_on_exit && *global->path.config)
|
||||
{
|
||||
/* Save last core-specific config to the default config location,
|
||||
* needed on consoles for core switching and reusing last good
|
||||
@@ -783,21 +779,22 @@ void event_save_current_config(void)
|
||||
ret = config_save_file(global->path.core_specific_config);
|
||||
else
|
||||
ret = config_save_file(global->path.config);
|
||||
if (ret)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "Saved new config to \"%s\".",
|
||||
global->path.config);
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "Failed saving config to \"%s\".",
|
||||
global->path.config);
|
||||
RARCH_ERR("%s\n", msg);
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "Saved new config to \"%s\".",
|
||||
global->path.config);
|
||||
RARCH_LOG("%s\n", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "Failed saving config to \"%s\".",
|
||||
global->path.config);
|
||||
RARCH_ERR("%s\n", msg);
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(msg, 1, 180, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -988,7 +985,7 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
#else
|
||||
char *fullpath = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, settings->path.libretro);
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, settings->libretro);
|
||||
event_cmd_ctl(EVENT_CMD_EXEC, (void*)fullpath);
|
||||
event_cmd_ctl(EVENT_CMD_QUIT, NULL);
|
||||
#endif
|
||||
@@ -1013,17 +1010,13 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
core_info_ctx_find_t info_find;
|
||||
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
if (!(*settings->path.libretro))
|
||||
if (!(*settings->libretro))
|
||||
return false;
|
||||
|
||||
libretro_get_system_info(
|
||||
settings->path.libretro,
|
||||
system,
|
||||
libretro_get_system_info(settings->libretro, system,
|
||||
ptr);
|
||||
#else
|
||||
libretro_get_system_info_static(system, ptr);
|
||||
#endif
|
||||
info_find.path = settings->path.libretro;
|
||||
info_find.path = settings->libretro;
|
||||
|
||||
if (!core_info_ctl(CORE_INFO_CTL_LOAD, &info_find))
|
||||
return false;
|
||||
@@ -1198,12 +1191,7 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
break;
|
||||
case EVENT_CMD_AUTOSAVE_DEINIT:
|
||||
#ifdef HAVE_THREADS
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global->sram.use)
|
||||
return false;
|
||||
autosave_event_deinit();
|
||||
}
|
||||
autosave_event_deinit();
|
||||
#endif
|
||||
break;
|
||||
case EVENT_CMD_AUTOSAVE_INIT:
|
||||
@@ -1272,9 +1260,9 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
break;
|
||||
case EVENT_CMD_DSP_FILTER_INIT:
|
||||
event_cmd_ctl(EVENT_CMD_DSP_FILTER_DEINIT, NULL);
|
||||
if (!*settings->path.audio_dsp_plugin)
|
||||
if (!*settings->audio.dsp_plugin)
|
||||
break;
|
||||
audio_driver_dsp_filter_init(settings->path.audio_dsp_plugin);
|
||||
audio_driver_dsp_filter_init(settings->audio.dsp_plugin);
|
||||
break;
|
||||
case EVENT_CMD_GPU_RECORD_DEINIT:
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_GPU_RECORD_DEINIT, NULL);
|
||||
@@ -1302,9 +1290,9 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
return false;
|
||||
RARCH_LOG("%s: [%s].\n",
|
||||
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
|
||||
settings->path.content_history);
|
||||
settings->content_history_path);
|
||||
g_defaults.history = content_playlist_init(
|
||||
settings->path.content_history,
|
||||
settings->content_history_path,
|
||||
settings->content_history_size);
|
||||
break;
|
||||
case EVENT_CMD_CORE_INFO_DEINIT:
|
||||
@@ -1313,7 +1301,7 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
|
||||
case EVENT_CMD_CORE_INFO_INIT:
|
||||
event_cmd_ctl(EVENT_CMD_CORE_INFO_DEINIT, NULL);
|
||||
|
||||
if (*settings->directory.libretro)
|
||||
if (*settings->libretro_directory)
|
||||
core_info_ctl(CORE_INFO_CTL_LIST_INIT, NULL);
|
||||
break;
|
||||
case EVENT_CMD_CORE_DEINIT:
|
||||
|
||||
+1
-18
@@ -18,6 +18,7 @@
|
||||
#define __CONFIG_DEF_H
|
||||
|
||||
#include <boolean.h>
|
||||
#include "libretro.h"
|
||||
#include "driver.h"
|
||||
#include "gfx/video_driver.h"
|
||||
|
||||
@@ -125,7 +126,6 @@ enum
|
||||
MENU_XUI,
|
||||
MENU_MATERIALUI,
|
||||
MENU_XMB,
|
||||
MENU_NUKLEAR,
|
||||
|
||||
RECORD_FFMPEG,
|
||||
RECORD_NULL
|
||||
@@ -511,21 +511,6 @@ static bool default_block_config_read = true;
|
||||
|
||||
static unsigned xmb_scale_factor = 100;
|
||||
static unsigned xmb_alpha_factor = 75;
|
||||
static unsigned xmb_theme = 0;
|
||||
|
||||
#ifdef HAVE_LAKKA
|
||||
static bool xmb_shadows_enable = false;
|
||||
#else
|
||||
static bool xmb_shadows_enable = true;
|
||||
#endif
|
||||
|
||||
static unsigned menu_background_gradient = 4;
|
||||
|
||||
#if defined(HAVE_OPENGLES2) || defined(OSX_PPC)
|
||||
static unsigned menu_shader_pipeline = 1;
|
||||
#else
|
||||
static unsigned menu_shader_pipeline = 2;
|
||||
#endif
|
||||
|
||||
static bool show_advanced_settings = true;
|
||||
static const uint32_t menu_entry_normal_color = 0xffffffff;
|
||||
@@ -780,8 +765,6 @@ static const unsigned input_max_users = 5;
|
||||
|
||||
static const unsigned input_poll_type_behavior = 2;
|
||||
|
||||
static const unsigned menu_thumbnails_default = 3;
|
||||
|
||||
#ifdef IOS
|
||||
static const bool ui_companion_start_on_boot = false;
|
||||
#else
|
||||
|
||||
+392
-445
File diff suppressed because it is too large.
Load diff
+43
-60
@@ -72,12 +72,17 @@ typedef struct settings
|
||||
unsigned aspect_ratio_idx;
|
||||
unsigned rotation;
|
||||
|
||||
char shader_path[PATH_MAX_LENGTH];
|
||||
bool shader_enable;
|
||||
|
||||
char softfilter_plugin[PATH_MAX_LENGTH];
|
||||
float refresh_rate;
|
||||
bool threaded;
|
||||
|
||||
char filter_dir[PATH_MAX_LENGTH];
|
||||
char shader_dir[PATH_MAX_LENGTH];
|
||||
|
||||
char font_path[PATH_MAX_LENGTH];
|
||||
float font_size;
|
||||
bool font_enable;
|
||||
float msg_pos_x;
|
||||
@@ -118,8 +123,9 @@ typedef struct settings
|
||||
bool timedate_enable;
|
||||
bool core_enable;
|
||||
bool dynamic_wallpaper_enable;
|
||||
unsigned thumbnails;
|
||||
bool boxart_enable;
|
||||
bool throttle;
|
||||
char wallpaper[PATH_MAX_LENGTH];
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -160,10 +166,6 @@ typedef struct settings
|
||||
unsigned title_color;
|
||||
unsigned xmb_scale_factor;
|
||||
unsigned xmb_alpha_factor;
|
||||
unsigned xmb_theme;
|
||||
unsigned background_gradient;
|
||||
bool xmb_shadows_enable;
|
||||
unsigned shader_pipeline;
|
||||
char xmb_font[PATH_MAX_LENGTH];
|
||||
bool throttle_framerate;
|
||||
bool linear_filter;
|
||||
@@ -194,20 +196,22 @@ typedef struct settings
|
||||
struct
|
||||
{
|
||||
char driver[32];
|
||||
char resampler[32];
|
||||
char device[PATH_MAX_LENGTH];
|
||||
bool enable;
|
||||
bool mute_enable;
|
||||
unsigned out_rate;
|
||||
unsigned block_frames;
|
||||
char device[PATH_MAX_LENGTH];
|
||||
unsigned latency;
|
||||
bool sync;
|
||||
|
||||
char dsp_plugin[PATH_MAX_LENGTH];
|
||||
char filter_dir[PATH_MAX_LENGTH];
|
||||
|
||||
bool rate_control;
|
||||
float rate_control_delta;
|
||||
float max_timing_skew;
|
||||
float volume; /* dB scale. */
|
||||
char resampler[32];
|
||||
} audio;
|
||||
|
||||
struct
|
||||
@@ -215,7 +219,6 @@ typedef struct settings
|
||||
char driver[32];
|
||||
char joypad_driver[32];
|
||||
char keyboard_layout[64];
|
||||
char device_names[MAX_USERS][64];
|
||||
|
||||
unsigned remap_ids[MAX_USERS][RARCH_BIND_LIST_END];
|
||||
struct retro_keybind binds[MAX_USERS][RARCH_BIND_LIST_END];
|
||||
@@ -236,6 +239,7 @@ typedef struct settings
|
||||
float axis_threshold;
|
||||
unsigned joypad_map[MAX_USERS];
|
||||
unsigned device[MAX_USERS];
|
||||
char device_names[MAX_USERS][64];
|
||||
unsigned device_name_index[MAX_USERS];
|
||||
bool autodetect_enable;
|
||||
bool netplay_client_swap_input;
|
||||
@@ -246,9 +250,11 @@ typedef struct settings
|
||||
bool overlay_enable;
|
||||
bool overlay_enable_autopreferred;
|
||||
bool overlay_hide_in_menu;
|
||||
char overlay[PATH_MAX_LENGTH];
|
||||
float overlay_opacity;
|
||||
float overlay_scale;
|
||||
|
||||
char autoconfig_dir[PATH_MAX_LENGTH];
|
||||
bool input_descriptor_label_show;
|
||||
bool input_descriptor_hide_unbound;
|
||||
|
||||
@@ -266,6 +272,7 @@ typedef struct settings
|
||||
struct
|
||||
{
|
||||
bool enable;
|
||||
char overlay[PATH_MAX_LENGTH];
|
||||
float opacity;
|
||||
float scale;
|
||||
} osk;
|
||||
@@ -306,58 +313,35 @@ typedef struct settings
|
||||
bool bundle_assets_extract_enable;
|
||||
unsigned bundle_assets_extract_version_current;
|
||||
unsigned bundle_assets_extract_last_version;
|
||||
char bundle_assets_src_path[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst_path[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst_path_subdir[PATH_MAX_LENGTH];
|
||||
|
||||
struct
|
||||
{
|
||||
char cheat_database[PATH_MAX_LENGTH];
|
||||
char content_database[PATH_MAX_LENGTH];
|
||||
char libretro[PATH_MAX_LENGTH];
|
||||
char osk_overlay[PATH_MAX_LENGTH];
|
||||
char overlay[PATH_MAX_LENGTH];
|
||||
char menu_wallpaper[PATH_MAX_LENGTH];
|
||||
char audio_dsp_plugin[PATH_MAX_LENGTH];
|
||||
char softfilter_plugin[PATH_MAX_LENGTH];
|
||||
char core_options[PATH_MAX_LENGTH];
|
||||
char content_history[PATH_MAX_LENGTH];
|
||||
char libretro_info[PATH_MAX_LENGTH];
|
||||
char cheat_settings[PATH_MAX_LENGTH];
|
||||
char bundle_assets_src[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst[PATH_MAX_LENGTH];
|
||||
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
|
||||
char shader[PATH_MAX_LENGTH];
|
||||
char font[PATH_MAX_LENGTH];
|
||||
} path;
|
||||
|
||||
struct
|
||||
{
|
||||
char audio_filter[PATH_MAX_LENGTH];
|
||||
char autoconfig[PATH_MAX_LENGTH];
|
||||
char video_filter[PATH_MAX_LENGTH];
|
||||
char video_shader[PATH_MAX_LENGTH];
|
||||
char content_history[PATH_MAX_LENGTH];
|
||||
char libretro[PATH_MAX_LENGTH];
|
||||
char cursor[PATH_MAX_LENGTH];
|
||||
char input_remapping[PATH_MAX_LENGTH];
|
||||
char overlay[PATH_MAX_LENGTH];
|
||||
char resampler[PATH_MAX_LENGTH];
|
||||
char screenshot[PATH_MAX_LENGTH];
|
||||
char system[PATH_MAX_LENGTH];
|
||||
char cache[PATH_MAX_LENGTH];
|
||||
char playlist[PATH_MAX_LENGTH];
|
||||
char core_assets[PATH_MAX_LENGTH];
|
||||
char assets[PATH_MAX_LENGTH];
|
||||
char dynamic_wallpapers[PATH_MAX_LENGTH];
|
||||
char thumbnails[PATH_MAX_LENGTH];
|
||||
char menu_config[PATH_MAX_LENGTH];
|
||||
char menu_content[PATH_MAX_LENGTH];
|
||||
} directory;
|
||||
|
||||
char core_options_path[PATH_MAX_LENGTH];
|
||||
char content_history_path[PATH_MAX_LENGTH];
|
||||
char content_history_directory[PATH_MAX_LENGTH];
|
||||
unsigned content_history_size;
|
||||
|
||||
char libretro[PATH_MAX_LENGTH];
|
||||
char libretro_directory[PATH_MAX_LENGTH];
|
||||
unsigned libretro_log_level;
|
||||
char libretro_info_path[PATH_MAX_LENGTH];
|
||||
char content_database[PATH_MAX_LENGTH];
|
||||
char cheat_database[PATH_MAX_LENGTH];
|
||||
char cursor_directory[PATH_MAX_LENGTH];
|
||||
char cheat_settings_path[PATH_MAX_LENGTH];
|
||||
char input_remapping_directory[PATH_MAX_LENGTH];
|
||||
|
||||
char overlay_directory[PATH_MAX_LENGTH];
|
||||
char resampler_directory[PATH_MAX_LENGTH];
|
||||
char screenshot_directory[PATH_MAX_LENGTH];
|
||||
char system_directory[PATH_MAX_LENGTH];
|
||||
|
||||
bool auto_screenshot_filename;
|
||||
|
||||
char cache_directory[PATH_MAX_LENGTH];
|
||||
char playlist_directory[PATH_MAX_LENGTH];
|
||||
|
||||
bool history_list_enable;
|
||||
bool rewind_enable;
|
||||
size_t rewind_buffer_size;
|
||||
@@ -382,7 +366,13 @@ typedef struct settings
|
||||
unsigned network_remote_base_port;
|
||||
bool debug_panel_enable;
|
||||
|
||||
char core_assets_directory[PATH_MAX_LENGTH];
|
||||
char assets_directory[PATH_MAX_LENGTH];
|
||||
char dynamic_wallpapers_directory[PATH_MAX_LENGTH];
|
||||
char boxarts_directory[PATH_MAX_LENGTH];
|
||||
char menu_config_directory[PATH_MAX_LENGTH];
|
||||
#if defined(HAVE_MENU)
|
||||
char menu_content_directory[PATH_MAX_LENGTH];
|
||||
bool menu_show_start_screen;
|
||||
#endif
|
||||
bool fps_show;
|
||||
@@ -408,13 +398,6 @@ typedef struct settings
|
||||
unsigned int user_language;
|
||||
|
||||
bool config_save_on_exit;
|
||||
|
||||
#ifdef HAVE_SYSTEMD
|
||||
bool ssh_enable;
|
||||
bool samba_enable;
|
||||
bool bluetooth_enable;
|
||||
#endif
|
||||
|
||||
} settings_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,19 +40,18 @@
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/file_path.h>
|
||||
#ifdef HAVE_COMPRESSION
|
||||
#include <file/archive_file.h>
|
||||
#include <file/file_archive.h>
|
||||
#endif
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <retro_file.h>
|
||||
#include <retro_stat.h>
|
||||
#include <retro_assert.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
#include <string/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "defaults.h"
|
||||
#include "msg_hash.h"
|
||||
#include "content.h"
|
||||
#include "general.h"
|
||||
@@ -62,7 +61,6 @@
|
||||
#include "system.h"
|
||||
#include "retroarch.h"
|
||||
#include "command_event.h"
|
||||
#include "file_path_special.h"
|
||||
#include "libretro_version_1.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
@@ -231,7 +229,7 @@ static int content_7zip_file_read(
|
||||
{
|
||||
const void *ptr = (const void*)(output + offset);
|
||||
|
||||
if (!filestream_write_file(optional_outfile, ptr, outsize))
|
||||
if (!retro_write_file(optional_outfile, ptr, outsize))
|
||||
{
|
||||
RARCH_ERR("Could not open outfilepath %s.\n",
|
||||
optional_outfile);
|
||||
@@ -490,8 +488,7 @@ static int content_zip_file_decompressed(
|
||||
{
|
||||
RARCH_LOG("Extracting file : %s\n", st->opt_file);
|
||||
memcpy(buf, handle.data, size);
|
||||
|
||||
if (!filestream_write_file(st->opt_file, buf, size))
|
||||
if (!retro_write_file(st->opt_file, buf, size))
|
||||
goto_error = true;
|
||||
}
|
||||
|
||||
@@ -644,7 +641,7 @@ error:
|
||||
* @length : Number of items read, -1 on error.
|
||||
*
|
||||
* Read the contents of a file into @buf. Will call content_file_compressed_read
|
||||
* if path contains a compressed file, otherwise will call filestream_read_file().
|
||||
* if path contains a compressed file, otherwise will call retro_read_file().
|
||||
*
|
||||
* Returns: 1 if file read, 0 on error.
|
||||
*/
|
||||
@@ -657,7 +654,7 @@ static int content_file_read(const char *path, void **buf, ssize_t *length)
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return filestream_read_file(path, buf, length);
|
||||
return retro_read_file(path, buf, length);
|
||||
}
|
||||
|
||||
struct string_list *compressed_file_list_new(const char *path,
|
||||
@@ -680,22 +677,13 @@ struct string_list *compressed_file_list_new(const char *path,
|
||||
|
||||
static void check_defaults_dir_create_dir(const char *path)
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
fill_pathname_expand_special(new_path,
|
||||
path, sizeof(new_path));
|
||||
|
||||
if (path_is_directory(new_path))
|
||||
if (path_is_directory(path))
|
||||
return;
|
||||
path_mkdir(new_path);
|
||||
path_mkdir(path);
|
||||
}
|
||||
|
||||
static void check_default_dirs(void)
|
||||
static void check_defaults_dirs(void)
|
||||
{
|
||||
/* early return for people with a custom folder setup
|
||||
so it doesn't create unnecessary directories
|
||||
*/
|
||||
if (path_file_exists("custom.ini"))
|
||||
return;
|
||||
if (*g_defaults.dir.core_assets)
|
||||
check_defaults_dir_create_dir(g_defaults.dir.core_assets);
|
||||
if (*g_defaults.dir.remap)
|
||||
@@ -744,8 +732,6 @@ static void check_default_dirs(void)
|
||||
check_defaults_dir_create_dir(g_defaults.dir.cursor);
|
||||
if (*g_defaults.dir.cheats)
|
||||
check_defaults_dir_create_dir(g_defaults.dir.cheats);
|
||||
if (*g_defaults.dir.thumbnails)
|
||||
check_defaults_dir_create_dir(g_defaults.dir.thumbnails);
|
||||
}
|
||||
|
||||
void content_push_to_history_playlist(bool do_push,
|
||||
@@ -765,7 +751,7 @@ void content_push_to_history_playlist(bool do_push,
|
||||
content_playlist_push(g_defaults.history,
|
||||
path,
|
||||
NULL,
|
||||
settings->path.libretro,
|
||||
settings->libretro,
|
||||
info->library_name,
|
||||
NULL,
|
||||
NULL);
|
||||
@@ -898,7 +884,7 @@ static bool content_load(content_ctx_info_t *info)
|
||||
event_cmd_ctl(EVENT_CMD_RESUME, NULL);
|
||||
event_cmd_ctl(EVENT_CMD_VIDEO_SET_ASPECT_RATIO, NULL);
|
||||
|
||||
check_default_dirs();
|
||||
check_defaults_dirs();
|
||||
|
||||
frontend_driver_process_args(rarch_argc_ptr, rarch_argv_ptr);
|
||||
frontend_driver_content_loaded();
|
||||
@@ -979,22 +965,26 @@ static bool dump_to_file_desperate(const void *data,
|
||||
{
|
||||
time_t time_;
|
||||
char timebuf[256];
|
||||
char application_data[PATH_MAX_LENGTH];
|
||||
char path[PATH_MAX_LENGTH];
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
const char *base = getenv("APPDATA");
|
||||
#elif defined(__CELLOS_LV2__) || defined(_XBOX)
|
||||
const char *base = NULL;
|
||||
#else
|
||||
const char *base = getenv("HOME");
|
||||
#endif
|
||||
|
||||
if (!fill_pathname_application_data(application_data,
|
||||
sizeof(application_data)))
|
||||
if (!base)
|
||||
return false;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/RetroArch-recovery-%u",
|
||||
application_data, type);
|
||||
snprintf(path, sizeof(path), "%s/RetroArch-recovery-%u", base, type);
|
||||
|
||||
time(&time_);
|
||||
|
||||
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d-%H-%M-%S", localtime(&time_));
|
||||
strlcat(path, timebuf, sizeof(path));
|
||||
|
||||
if (!filestream_write_file(path, data, size))
|
||||
if (!retro_write_file(path, data, size))
|
||||
return false;
|
||||
|
||||
RARCH_WARN("Succeeded in saving RAM data to \"%s\".\n", path);
|
||||
@@ -1041,7 +1031,7 @@ static bool content_save_state(const char *path)
|
||||
ret = core_ctl(CORE_CTL_RETRO_SERIALIZE, &serial_info);
|
||||
|
||||
if (ret)
|
||||
ret = filestream_write_file(path, data, info.size);
|
||||
ret = retro_write_file(path, data, info.size);
|
||||
else
|
||||
{
|
||||
RARCH_ERR("%s \"%s\".\n",
|
||||
@@ -1072,7 +1062,7 @@ static bool content_load_state(const char *path)
|
||||
struct sram_block *blocks = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
bool ret = filestream_read_file(path, &buf, &size);
|
||||
bool ret = retro_read_file(path, &buf, &size);
|
||||
|
||||
RARCH_LOG("%s: \"%s\".\n",
|
||||
msg_hash_to_str(MSG_LOADING_STATE),
|
||||
@@ -1198,7 +1188,7 @@ static bool load_ram_file(void *data)
|
||||
if (mem_info.size == 0 || !mem_info.data)
|
||||
return false;
|
||||
|
||||
if (!filestream_read_file(ram->path, &buf, &rc))
|
||||
if (!retro_read_file(ram->path, &buf, &rc))
|
||||
return false;
|
||||
|
||||
if (rc > 0)
|
||||
@@ -1234,9 +1224,6 @@ static bool save_ram_file(ram_type_t *ram)
|
||||
{
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
|
||||
if (!ram)
|
||||
return false;
|
||||
|
||||
mem_info.id = ram->type;
|
||||
|
||||
core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);
|
||||
@@ -1244,7 +1231,7 @@ static bool save_ram_file(ram_type_t *ram)
|
||||
if (!mem_info.data || mem_info.size == 0)
|
||||
return false;
|
||||
|
||||
if (!filestream_write_file(ram->path, mem_info.data, mem_info.size))
|
||||
if (!retro_write_file(ram->path, mem_info.data, mem_info.size))
|
||||
{
|
||||
RARCH_ERR("%s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_SAVE_SRAM));
|
||||
@@ -1324,7 +1311,7 @@ static bool load_content_from_compressed_archive(
|
||||
RARCH_LOG("Compressed file in case of need_fullpath."
|
||||
" Now extracting to temporary directory.\n");
|
||||
|
||||
strlcpy(new_basedir, settings->directory.cache,
|
||||
strlcpy(new_basedir, settings->cache_directory,
|
||||
sizeof(new_basedir));
|
||||
|
||||
if (string_is_empty(new_basedir) || !path_is_directory(new_basedir))
|
||||
@@ -1540,8 +1527,8 @@ static bool init_content_file_extract(
|
||||
|
||||
if (!file_archive_extract_first_content_file(temp_content,
|
||||
sizeof(temp_content), valid_ext,
|
||||
*settings->directory.cache ?
|
||||
settings->directory.cache : NULL,
|
||||
*settings->cache_directory ?
|
||||
settings->cache_directory : NULL,
|
||||
new_path, sizeof(new_path)))
|
||||
{
|
||||
RARCH_ERR("Failed to extract content from zipped file: %s.\n",
|
||||
@@ -1622,7 +1609,7 @@ static bool init_content_file_set_attribs(
|
||||
*
|
||||
* Returns : true if successful, otherwise false.
|
||||
**/
|
||||
static bool content_file_init(struct string_list *temporary_content)
|
||||
static bool content_init_file(struct string_list *temporary_content)
|
||||
{
|
||||
unsigned i;
|
||||
struct retro_game_info *info = NULL;
|
||||
@@ -1671,31 +1658,9 @@ error:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool content_file_free(struct string_list *temporary_content)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!temporary_content)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < temporary_content->size; i++)
|
||||
{
|
||||
const char *path = temporary_content->elems[i].data;
|
||||
|
||||
RARCH_LOG("%s: %s.\n",
|
||||
msg_hash_to_str(MSG_REMOVING_TEMPORARY_CONTENT_FILE), path);
|
||||
if (remove(path) < 0)
|
||||
RARCH_ERR("%s: %s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_REMOVE_TEMPORARY_FILE),
|
||||
path);
|
||||
}
|
||||
string_list_free(temporary_content);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool content_ctl(enum content_ctl_state state, void *data)
|
||||
{
|
||||
unsigned i;
|
||||
static const struct file_archive_file_backend *stream_backend = NULL;
|
||||
static struct string_list *temporary_content = NULL;
|
||||
static bool content_is_inited = false;
|
||||
@@ -1707,7 +1672,13 @@ bool content_ctl(enum content_ctl_state state, void *data)
|
||||
case CONTENT_CTL_LOAD_RAM_FILE:
|
||||
return load_ram_file(data);
|
||||
case CONTENT_CTL_SAVE_RAM_FILE:
|
||||
return save_ram_file((ram_type_t*)data);
|
||||
{
|
||||
ram_type_t *ram = (ram_type_t*)data;
|
||||
if (!ram)
|
||||
return false;
|
||||
save_ram_file(ram);
|
||||
}
|
||||
break;
|
||||
case CONTENT_CTL_DOES_NOT_NEED_CONTENT:
|
||||
return core_does_not_need_content;
|
||||
case CONTENT_CTL_SET_DOES_NOT_NEED_CONTENT:
|
||||
@@ -1751,7 +1722,7 @@ bool content_ctl(enum content_ctl_state state, void *data)
|
||||
temporary_content = string_list_new();
|
||||
if (!temporary_content)
|
||||
return false;
|
||||
if (content_file_init(temporary_content))
|
||||
if (content_init_file(temporary_content))
|
||||
{
|
||||
content_is_inited = true;
|
||||
return true;
|
||||
@@ -1759,7 +1730,22 @@ bool content_ctl(enum content_ctl_state state, void *data)
|
||||
content_ctl(CONTENT_CTL_DEINIT, NULL);
|
||||
return false;
|
||||
case CONTENT_CTL_TEMPORARY_FREE:
|
||||
content_file_free(temporary_content);
|
||||
if (!temporary_content)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < temporary_content->size; i++)
|
||||
{
|
||||
const char *path = temporary_content->elems[i].data;
|
||||
|
||||
RARCH_LOG("%s: %s.\n",
|
||||
msg_hash_to_str(MSG_REMOVING_TEMPORARY_CONTENT_FILE), path);
|
||||
if (remove(path) < 0)
|
||||
RARCH_ERR("%s: %s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_REMOVE_TEMPORARY_FILE),
|
||||
path);
|
||||
}
|
||||
string_list_free(temporary_content);
|
||||
|
||||
temporary_content = NULL;
|
||||
break;
|
||||
case CONTENT_CTL_STREAM_INIT:
|
||||
|
||||
+6
-6
@@ -16,15 +16,15 @@
|
||||
*/
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <file/archive_file.h>
|
||||
#include <file/dir_list.h>
|
||||
#include <file/file_archive.h>
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "core_info.h"
|
||||
#include "configuration.h"
|
||||
#include "list_special.h"
|
||||
#include "dir_list_special.h"
|
||||
#include "config.def.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -181,8 +181,8 @@ static config_file_t *core_info_list_iterate(
|
||||
|
||||
strlcat(info_path_base, ".info", sizeof(info_path_base));
|
||||
|
||||
fill_pathname_join(info_path, (*settings->path.libretro_info) ?
|
||||
settings->path.libretro_info : settings->directory.libretro,
|
||||
fill_pathname_join(info_path, (*settings->libretro_info_path) ?
|
||||
settings->libretro_info_path : settings->libretro_directory,
|
||||
info_path_base, sizeof(info_path));
|
||||
|
||||
return config_file_new(info_path);
|
||||
@@ -702,7 +702,7 @@ bool core_info_ctl(enum core_info_state state, void *data)
|
||||
return false;
|
||||
|
||||
return core_info_list_update_missing_firmware(core_info_curr_list,
|
||||
info->path, info->directory.system);
|
||||
info->path, info->system_directory);
|
||||
}
|
||||
case CORE_INFO_CTL_FIND:
|
||||
{
|
||||
|
||||
+1
-6
@@ -20,8 +20,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -89,10 +87,7 @@ typedef struct
|
||||
typedef struct core_info_ctx_firmware
|
||||
{
|
||||
const char *path;
|
||||
struct
|
||||
{
|
||||
const char *system;
|
||||
} directory;
|
||||
const char *system_directory;
|
||||
} core_info_ctx_firmware_t;
|
||||
|
||||
typedef struct core_info_ctx_find
|
||||
|
||||
+23
-10
@@ -17,15 +17,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <file/config_file.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <file/dir_list.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <compat/strl.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "libretro.h"
|
||||
|
||||
#include "core_options.h"
|
||||
|
||||
struct core_option
|
||||
@@ -80,10 +77,9 @@ void core_option_free(core_option_manager_t *opt)
|
||||
free(opt);
|
||||
}
|
||||
|
||||
void core_option_get(core_option_manager_t *opt, void *data)
|
||||
void core_option_get(core_option_manager_t *opt, struct retro_variable *var)
|
||||
{
|
||||
size_t i;
|
||||
struct retro_variable *var = (struct retro_variable*)data;
|
||||
|
||||
if (!opt)
|
||||
return;
|
||||
@@ -170,12 +166,11 @@ static bool parse_variable(core_option_manager_t *opt, size_t idx,
|
||||
* Returns: handle to new core manager handle, otherwise NULL.
|
||||
**/
|
||||
core_option_manager_t *core_option_new(const char *conf_path,
|
||||
const void *data)
|
||||
const struct retro_variable *vars)
|
||||
{
|
||||
const struct retro_variable *var;
|
||||
const struct retro_variable *vars = (const struct retro_variable*)data;
|
||||
size_t size = 0;
|
||||
core_option_manager_t *opt = (core_option_manager_t*)
|
||||
size_t size = 0;
|
||||
core_option_manager_t *opt = (core_option_manager_t*)
|
||||
calloc(1, sizeof(*opt));
|
||||
|
||||
if (!opt)
|
||||
@@ -329,6 +324,24 @@ const char *core_option_get_val(core_option_manager_t *opt, size_t idx)
|
||||
return option->vals->elems[option->index].data;
|
||||
}
|
||||
|
||||
/**
|
||||
* core_option_get_vals:
|
||||
* @opt : pointer to core option manager object.
|
||||
* @idx : idx of core option.
|
||||
*
|
||||
* Gets list of core option values from core option at index @idx.
|
||||
*
|
||||
* Returns: string list of core option values if successful, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
struct string_list *core_option_get_vals(
|
||||
core_option_manager_t *opt, size_t idx)
|
||||
{
|
||||
if (!opt)
|
||||
return NULL;
|
||||
return opt->opts[idx].vals;
|
||||
}
|
||||
|
||||
void core_option_set_val(core_option_manager_t *opt,
|
||||
size_t idx, size_t val_idx)
|
||||
{
|
||||
|
||||
+19
-2
@@ -20,6 +20,9 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <string/string_list.h>
|
||||
|
||||
#include "libretro.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -37,7 +40,7 @@ typedef struct core_option_manager core_option_manager_t;
|
||||
* Returns: handle to new core manager handle, otherwise NULL.
|
||||
**/
|
||||
core_option_manager_t *core_option_new(const char *conf_path,
|
||||
const void *data);
|
||||
const struct retro_variable *vars);
|
||||
|
||||
/**
|
||||
* core_option_updated:
|
||||
@@ -82,7 +85,8 @@ bool core_option_flush_game_specific(
|
||||
**/
|
||||
void core_option_free(core_option_manager_t *opt);
|
||||
|
||||
void core_option_get(core_option_manager_t *opt, void *data);
|
||||
void core_option_get(core_option_manager_t *opt,
|
||||
struct retro_variable *var);
|
||||
|
||||
/**
|
||||
* core_option_size:
|
||||
@@ -118,6 +122,19 @@ const char *core_option_get_desc(core_option_manager_t *opt,
|
||||
const char *core_option_get_val(core_option_manager_t *opt,
|
||||
size_t idx);
|
||||
|
||||
/**
|
||||
* core_option_get_vals:
|
||||
* @opt : pointer to core option manager object.
|
||||
* @idx : idx of core option.
|
||||
*
|
||||
* Gets list of core option values from core option at index @idx.
|
||||
*
|
||||
* Returns: string list of core option values if successful, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
struct string_list *core_option_get_vals(
|
||||
core_option_manager_t *opt, size_t idx);
|
||||
|
||||
void core_option_set_val(core_option_manager_t *opt,
|
||||
size_t idx, size_t val_idx);
|
||||
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CORE_TYPE_H
|
||||
#define __CORE_TYPE_H
|
||||
|
||||
enum rarch_core_type
|
||||
{
|
||||
CORE_TYPE_PLAIN = 0,
|
||||
CORE_TYPE_DUMMY,
|
||||
CORE_TYPE_FFMPEG,
|
||||
CORE_TYPE_IMAGEVIEWER
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -18,7 +18,6 @@ extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libavutil/time.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavdevice/avdevice.h>
|
||||
@@ -40,7 +39,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "libretro.h"
|
||||
#ifdef RARCH_INTERNAL
|
||||
@@ -900,7 +899,7 @@ static bool init_media_info(void)
|
||||
#ifdef HAVE_SSA
|
||||
if (sctx[0])
|
||||
{
|
||||
unsigned i;
|
||||
size_t i;
|
||||
|
||||
ass = ass_library_init();
|
||||
ass_set_message_cb(ass, ass_msg_cb, NULL);
|
||||
@@ -915,7 +914,7 @@ static bool init_media_info(void)
|
||||
ass_set_fonts(ass_render, NULL, NULL, 1, NULL, 1);
|
||||
ass_set_hinting(ass_render, ASS_HINTING_LIGHT);
|
||||
|
||||
for (i = 0; i < (unsigned)subtitle_streams_num; i++)
|
||||
for (i = 0; i < subtitle_streams_num; i++)
|
||||
{
|
||||
ass_track[i] = ass_new_track(ass);
|
||||
ass_process_codec_private(ass_track[i], (char*)ass_extra_data[i],
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <file/dir_list.h>
|
||||
#include <file/file_path.h>
|
||||
#include <compat/strl.h>
|
||||
|
||||
|
||||
@@ -30,10 +30,12 @@ ifeq ($(platform), unix)
|
||||
TARGET := $(TARGET_NAME)_libretro.so
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
VULKAN_LIB := -lvulkan
|
||||
else
|
||||
CC = gcc
|
||||
TARGET := $(TARGET_NAME)_libretro.dll
|
||||
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
VULKAN_LIB := -lvulkan
|
||||
CFLAGS += -I..
|
||||
endif
|
||||
|
||||
@@ -46,11 +48,12 @@ endif
|
||||
CFLAGS += -std=gnu99
|
||||
OBJECTS := libretro-test.o
|
||||
CFLAGS += -Wall -pedantic $(fpic)
|
||||
LIBS += $(VULKAN_LIB)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) -lm
|
||||
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) -lm $(EXTRA_VULKAN_LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -I../../libretro-common/include $(CFLAGS) -c -o $@ $<
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define VK_PROTOTYPES
|
||||
#include "../../libretro_vulkan.h"
|
||||
#include "shaders/triangle.vert.inc"
|
||||
#include "shaders/triangle.frag.inc"
|
||||
@@ -16,294 +17,6 @@ static const struct retro_hw_render_interface_vulkan *vulkan;
|
||||
#define BASE_HEIGHT 240
|
||||
#define MAX_SYNC 8
|
||||
|
||||
/* We'll probably want a libretro common solution for this, but this will do for now. */
|
||||
#define VK_GET_DEVICE_PROC_ADDR(entrypoint) do { \
|
||||
vkcfp.vk##entrypoint = (PFN_vk##entrypoint) vulkan->get_device_proc_addr(vulkan->device, \
|
||||
"vk" #entrypoint); \
|
||||
} while(0)
|
||||
|
||||
#define VK_GET_INSTANCE_PROC_ADDR(entrypoint) do { \
|
||||
vkcfp.vk##entrypoint = (PFN_vk##entrypoint) vulkan->get_instance_proc_addr(vulkan->instance, \
|
||||
"vk" #entrypoint); \
|
||||
} while(0)
|
||||
|
||||
typedef struct vulkan_context_fp
|
||||
{
|
||||
/* Device */
|
||||
PFN_vkDeviceWaitIdle vkDeviceWaitIdle;
|
||||
|
||||
/* Device Memory */
|
||||
PFN_vkAllocateMemory vkAllocateMemory;
|
||||
PFN_vkFreeMemory vkFreeMemory;
|
||||
|
||||
/* Command Function Pointers */
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
||||
PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
|
||||
|
||||
/* Buffers */
|
||||
PFN_vkCreateBuffer vkCreateBuffer;
|
||||
PFN_vkDestroyBuffer vkDestroyBuffer;
|
||||
|
||||
/* Fences */
|
||||
PFN_vkCreateFence vkCreateFence;
|
||||
PFN_vkDestroyFence vkDestroyFence;
|
||||
PFN_vkResetFences vkResetFences;
|
||||
PFN_vkWaitForFences vkWaitForFences;
|
||||
|
||||
/* Semaphores */
|
||||
PFN_vkCreateSemaphore vkCreateSemaphore;
|
||||
PFN_vkDestroySemaphore vkDestroySemaphore;
|
||||
|
||||
/* Images */
|
||||
PFN_vkCreateImage vkCreateImage;
|
||||
PFN_vkDestroyImage vkDestroyImage;
|
||||
PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout;
|
||||
|
||||
/* Images (Resource Memory Association) */
|
||||
PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
|
||||
PFN_vkBindBufferMemory vkBindBufferMemory;
|
||||
PFN_vkBindImageMemory vkBindImageMemory;
|
||||
|
||||
/* Image Views */
|
||||
PFN_vkCreateImageView vkCreateImageView;
|
||||
PFN_vkDestroyImageView vkDestroyImageView;
|
||||
|
||||
/* Image Views (Resource Memory Association) */
|
||||
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
|
||||
|
||||
/* Queues */
|
||||
PFN_vkGetDeviceQueue vkGetDeviceQueue;
|
||||
PFN_vkQueueWaitIdle vkQueueWaitIdle;
|
||||
|
||||
/* Pipelines */
|
||||
PFN_vkDestroyPipeline vkDestroyPipeline;
|
||||
PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines;
|
||||
|
||||
/* Pipeline Layouts */
|
||||
PFN_vkCreatePipelineLayout vkCreatePipelineLayout;
|
||||
PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout;
|
||||
|
||||
/* Pipeline Cache */
|
||||
PFN_vkCreatePipelineCache vkCreatePipelineCache;
|
||||
PFN_vkDestroyPipelineCache vkDestroyPipelineCache;
|
||||
|
||||
/* Pipeline Barriers */
|
||||
PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier;
|
||||
|
||||
/* Descriptor pools */
|
||||
PFN_vkCreateDescriptorPool vkCreateDescriptorPool;
|
||||
PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool;
|
||||
|
||||
/* Descriptor sets */
|
||||
PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets;
|
||||
PFN_vkFreeDescriptorSets vkFreeDescriptorSets;
|
||||
PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets;
|
||||
PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets;
|
||||
|
||||
/* Descriptor Set Layout */
|
||||
PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout;
|
||||
PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout;
|
||||
|
||||
/* Command Buffers */
|
||||
PFN_vkCreateCommandPool vkCreateCommandPool;
|
||||
PFN_vkDestroyCommandPool vkDestroyCommandPool;
|
||||
PFN_vkBeginCommandBuffer vkBeginCommandBuffer;
|
||||
PFN_vkEndCommandBuffer vkEndCommandBuffer;
|
||||
PFN_vkResetCommandBuffer vkResetCommandBuffer;
|
||||
PFN_vkFreeCommandBuffers vkFreeCommandBuffers;
|
||||
PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers;
|
||||
|
||||
/* Command Buffer Submission */
|
||||
PFN_vkQueueSubmit vkQueueSubmit;
|
||||
|
||||
/* Framebuffers */
|
||||
PFN_vkCreateFramebuffer vkCreateFramebuffer;
|
||||
PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
|
||||
|
||||
/* Memory allocation */
|
||||
PFN_vkMapMemory vkMapMemory;
|
||||
PFN_vkUnmapMemory vkUnmapMemory;
|
||||
|
||||
/* Samplers */
|
||||
PFN_vkCreateSampler vkCreateSampler;
|
||||
PFN_vkDestroySampler vkDestroySampler;
|
||||
|
||||
/* Render Passes */
|
||||
PFN_vkCreateRenderPass vkCreateRenderPass;
|
||||
PFN_vkDestroyRenderPass vkDestroyRenderPass;
|
||||
|
||||
/* Image commands */
|
||||
PFN_vkCmdCopyImage vkCmdCopyImage;
|
||||
PFN_vkCmdClearColorImage vkCmdClearColorImage;
|
||||
|
||||
/* Pipeline commands */
|
||||
PFN_vkCmdBindPipeline vkCmdBindPipeline;
|
||||
|
||||
/* Vertex input descriptions */
|
||||
PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers;
|
||||
|
||||
/* Render Pass commands */
|
||||
PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass;
|
||||
PFN_vkCmdEndRenderPass vkCmdEndRenderPass;
|
||||
|
||||
/* Clear commands */
|
||||
PFN_vkCmdClearAttachments vkCmdClearAttachments;
|
||||
|
||||
/* Drawing commands */
|
||||
PFN_vkCmdDraw vkCmdDraw;
|
||||
|
||||
/* Fragment operations */
|
||||
PFN_vkCmdSetScissor vkCmdSetScissor;
|
||||
|
||||
/* Fixed-function vertex postprocessing */
|
||||
PFN_vkCmdSetViewport vkCmdSetViewport;
|
||||
|
||||
/* Shaders */
|
||||
PFN_vkCreateShaderModule vkCreateShaderModule;
|
||||
PFN_vkDestroyShaderModule vkDestroyShaderModule;
|
||||
|
||||
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
|
||||
} vulkan_context_fp_t;
|
||||
|
||||
static vulkan_context_fp_t vkcfp;
|
||||
#define VKFUNC(sym) (vkcfp.sym)
|
||||
|
||||
static void load_device_symbols(void)
|
||||
{
|
||||
VK_GET_INSTANCE_PROC_ADDR(GetPhysicalDeviceProperties);
|
||||
VK_GET_INSTANCE_PROC_ADDR(GetPhysicalDeviceMemoryProperties);
|
||||
|
||||
/* Memory */
|
||||
VK_GET_DEVICE_PROC_ADDR(AllocateMemory);
|
||||
VK_GET_DEVICE_PROC_ADDR(FreeMemory);
|
||||
|
||||
/* Waiting */
|
||||
VK_GET_DEVICE_PROC_ADDR(DeviceWaitIdle);
|
||||
|
||||
/* Queues */
|
||||
VK_GET_DEVICE_PROC_ADDR(GetDeviceQueue);
|
||||
VK_GET_DEVICE_PROC_ADDR(QueueWaitIdle);
|
||||
VK_GET_DEVICE_PROC_ADDR(QueueSubmit);
|
||||
|
||||
/* Semaphores */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateSemaphore);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroySemaphore);
|
||||
|
||||
/* Buffers */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateBuffer);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyBuffer);
|
||||
|
||||
/* Fences */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateFence);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyFence);
|
||||
VK_GET_DEVICE_PROC_ADDR(ResetFences);
|
||||
VK_GET_DEVICE_PROC_ADDR(WaitForFences);
|
||||
|
||||
/* Images */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateImage);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyImage);
|
||||
VK_GET_DEVICE_PROC_ADDR(GetImageSubresourceLayout);
|
||||
|
||||
/* Images (Resource Memory Association) */
|
||||
VK_GET_DEVICE_PROC_ADDR(GetBufferMemoryRequirements);
|
||||
VK_GET_DEVICE_PROC_ADDR(BindBufferMemory);
|
||||
VK_GET_DEVICE_PROC_ADDR(BindImageMemory);
|
||||
|
||||
/* Image Views */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateImageView);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyImageView);
|
||||
|
||||
/* Resource Memory Associations */
|
||||
VK_GET_DEVICE_PROC_ADDR(GetImageMemoryRequirements);
|
||||
|
||||
/* Descriptor pools */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateDescriptorPool);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyDescriptorPool);
|
||||
|
||||
/* Descriptor sets */
|
||||
VK_GET_DEVICE_PROC_ADDR(AllocateDescriptorSets);
|
||||
VK_GET_DEVICE_PROC_ADDR(FreeDescriptorSets);
|
||||
VK_GET_DEVICE_PROC_ADDR(UpdateDescriptorSets);
|
||||
|
||||
/* Descriptor Set Layout */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateDescriptorSetLayout);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyDescriptorSetLayout);
|
||||
|
||||
/* Framebuffers */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateFramebuffer);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyFramebuffer);
|
||||
VK_GET_DEVICE_PROC_ADDR(AllocateCommandBuffers);
|
||||
VK_GET_DEVICE_PROC_ADDR(FreeCommandBuffers);
|
||||
|
||||
/* Memory allocation */
|
||||
VK_GET_DEVICE_PROC_ADDR(MapMemory);
|
||||
VK_GET_DEVICE_PROC_ADDR(UnmapMemory);
|
||||
|
||||
/* Render Passes */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateRenderPass);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyRenderPass);
|
||||
|
||||
/* Pipelines */
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyPipeline);
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateGraphicsPipelines);
|
||||
|
||||
/* Shaders */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateShaderModule);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyShaderModule);
|
||||
|
||||
/* Pipeline Layouts */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreatePipelineLayout);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyPipelineLayout);
|
||||
|
||||
/* Pipeline Cache */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreatePipelineCache);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyPipelineCache);
|
||||
|
||||
/* Command buffers */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateCommandPool);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroyCommandPool);
|
||||
VK_GET_DEVICE_PROC_ADDR(BeginCommandBuffer);
|
||||
VK_GET_DEVICE_PROC_ADDR(ResetCommandBuffer);
|
||||
VK_GET_DEVICE_PROC_ADDR(EndCommandBuffer);
|
||||
|
||||
/* Image commands */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdCopyImage);
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdClearColorImage);
|
||||
|
||||
/* Vertex input descriptions */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdBindVertexBuffers);
|
||||
|
||||
/* Descriptor Set commands */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdBindDescriptorSets);
|
||||
|
||||
/* Fragment operations */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdSetScissor);
|
||||
|
||||
/* Render Pass commands */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdBeginRenderPass);
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdEndRenderPass);
|
||||
|
||||
/* Samplers */
|
||||
VK_GET_DEVICE_PROC_ADDR(CreateSampler);
|
||||
VK_GET_DEVICE_PROC_ADDR(DestroySampler);
|
||||
|
||||
/* Fixed-function vertex postprocessing */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdSetViewport);
|
||||
|
||||
/* Clear commands */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdClearAttachments);
|
||||
|
||||
/* Pipeline */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdBindPipeline);
|
||||
|
||||
/* Pipeline Barriers */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdPipelineBarrier);
|
||||
|
||||
/* Drawing commands */
|
||||
VK_GET_DEVICE_PROC_ADDR(CmdDraw);
|
||||
}
|
||||
|
||||
struct buffer
|
||||
{
|
||||
VkBuffer buffer;
|
||||
@@ -454,10 +167,10 @@ static void update_ubo(void)
|
||||
tmp[15] = 1.0f;
|
||||
|
||||
float *mvp = NULL;
|
||||
VKFUNC(vkMapMemory)(vulkan->device, vk.ubo[vk.index].memory,
|
||||
vkMapMemory(vulkan->device, vk.ubo[vk.index].memory,
|
||||
0, 16 * sizeof(float), 0, (void**)&mvp);
|
||||
memcpy(mvp, tmp, sizeof(tmp));
|
||||
VKFUNC(vkUnmapMemory)(vulkan->device, vk.ubo[vk.index].memory);
|
||||
vkUnmapMemory(vulkan->device, vk.ubo[vk.index].memory);
|
||||
}
|
||||
|
||||
static void vulkan_test_render(void)
|
||||
@@ -468,12 +181,12 @@ static void vulkan_test_render(void)
|
||||
|
||||
VkCommandBufferBeginInfo begin_info = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
|
||||
begin_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
||||
VKFUNC(vkResetCommandBuffer)(cmd, 0);
|
||||
VKFUNC(vkBeginCommandBuffer)(cmd, &begin_info);
|
||||
vkResetCommandBuffer(cmd, 0);
|
||||
vkBeginCommandBuffer(cmd, &begin_info);
|
||||
|
||||
VkImageMemoryBarrier prepare_rendering = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER };
|
||||
prepare_rendering.srcAccessMask = 0;
|
||||
prepare_rendering.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT;
|
||||
prepare_rendering.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
prepare_rendering.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
prepare_rendering.newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
prepare_rendering.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
@@ -482,7 +195,7 @@ static void vulkan_test_render(void)
|
||||
prepare_rendering.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
prepare_rendering.subresourceRange.levelCount = 1;
|
||||
prepare_rendering.subresourceRange.layerCount = 1;
|
||||
VKFUNC(vkCmdPipelineBarrier)(cmd,
|
||||
vkCmdPipelineBarrier(cmd,
|
||||
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
false,
|
||||
0, NULL,
|
||||
@@ -502,10 +215,10 @@ static void vulkan_test_render(void)
|
||||
rp_begin.renderArea.extent.height = BASE_HEIGHT;
|
||||
rp_begin.clearValueCount = 1;
|
||||
rp_begin.pClearValues = &clear_value;
|
||||
VKFUNC(vkCmdBeginRenderPass)(cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE);
|
||||
vkCmdBeginRenderPass(cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE);
|
||||
|
||||
VKFUNC(vkCmdBindPipeline)(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, vk.pipeline);
|
||||
VKFUNC(vkCmdBindDescriptorSets)(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, vk.pipeline);
|
||||
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
vk.pipeline_layout, 0,
|
||||
1, &vk.desc_set[vk.index], 0, NULL);
|
||||
|
||||
@@ -516,20 +229,20 @@ static void vulkan_test_render(void)
|
||||
vp.height = BASE_HEIGHT;
|
||||
vp.minDepth = 0.0f;
|
||||
vp.maxDepth = 1.0f;
|
||||
VKFUNC(vkCmdSetViewport)(cmd, 0, 1, &vp);
|
||||
vkCmdSetViewport(cmd, 0, 1, &vp);
|
||||
|
||||
VkRect2D scissor;
|
||||
memset(&scissor, 0, sizeof(scissor));
|
||||
scissor.extent.width = BASE_WIDTH;
|
||||
scissor.extent.height = BASE_HEIGHT;
|
||||
VKFUNC(vkCmdSetScissor)(cmd, 0, 1, &scissor);
|
||||
vkCmdSetScissor(cmd, 0, 1, &scissor);
|
||||
|
||||
VkDeviceSize offset = 0;
|
||||
VKFUNC(vkCmdBindVertexBuffers)(cmd, 0, 1, &vk.vbo.buffer, &offset);
|
||||
vkCmdBindVertexBuffers(cmd, 0, 1, &vk.vbo.buffer, &offset);
|
||||
|
||||
VKFUNC(vkCmdDraw)(cmd, 3, 1, 0, 0);
|
||||
vkCmdDraw(cmd, 3, 1, 0, 0);
|
||||
|
||||
VKFUNC(vkCmdEndRenderPass)(cmd);
|
||||
vkCmdEndRenderPass(cmd);
|
||||
|
||||
VkImageMemoryBarrier prepare_presentation = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER };
|
||||
prepare_presentation.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
@@ -543,14 +256,14 @@ static void vulkan_test_render(void)
|
||||
prepare_presentation.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
prepare_presentation.subresourceRange.levelCount = 1;
|
||||
prepare_presentation.subresourceRange.layerCount = 1;
|
||||
VKFUNC(vkCmdPipelineBarrier)(cmd, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
|
||||
vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
|
||||
false,
|
||||
0, NULL,
|
||||
0, NULL,
|
||||
1, &prepare_presentation);
|
||||
|
||||
VKFUNC(vkEndCommandBuffer)(cmd);
|
||||
vkEndCommandBuffer(cmd);
|
||||
}
|
||||
|
||||
static struct buffer create_buffer(const void *initial, size_t size, VkBufferUsageFlags usage)
|
||||
@@ -562,10 +275,10 @@ static struct buffer create_buffer(const void *initial, size_t size, VkBufferUsa
|
||||
info.usage = usage;
|
||||
info.size = size;
|
||||
|
||||
VKFUNC(vkCreateBuffer)(device, &info, NULL, &buffer.buffer);
|
||||
vkCreateBuffer(device, &info, NULL, &buffer.buffer);
|
||||
|
||||
VkMemoryRequirements mem_reqs;
|
||||
VKFUNC(vkGetBufferMemoryRequirements)(device, buffer.buffer, &mem_reqs);
|
||||
vkGetBufferMemoryRequirements(device, buffer.buffer, &mem_reqs);
|
||||
|
||||
VkMemoryAllocateInfo alloc = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
|
||||
alloc.allocationSize = mem_reqs.size;
|
||||
@@ -573,15 +286,15 @@ static struct buffer create_buffer(const void *initial, size_t size, VkBufferUsa
|
||||
alloc.memoryTypeIndex = find_memory_type_from_requirements(mem_reqs.memoryTypeBits,
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||
|
||||
VKFUNC(vkAllocateMemory)(device, &alloc, NULL, &buffer.memory);
|
||||
VKFUNC(vkBindBufferMemory)(device, buffer.buffer, buffer.memory, 0);
|
||||
vkAllocateMemory(device, &alloc, NULL, &buffer.memory);
|
||||
vkBindBufferMemory(device, buffer.buffer, buffer.memory, 0);
|
||||
|
||||
if (initial)
|
||||
{
|
||||
void *ptr;
|
||||
VKFUNC(vkMapMemory)(device, buffer.memory, 0, size, 0, &ptr);
|
||||
vkMapMemory(device, buffer.memory, 0, size, 0, &ptr);
|
||||
memcpy(ptr, initial, size);
|
||||
VKFUNC(vkUnmapMemory)(device, buffer.memory);
|
||||
vkUnmapMemory(device, buffer.memory);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
@@ -613,7 +326,7 @@ static VkShaderModule create_shader_module(const uint8_t *data, size_t size)
|
||||
VkShaderModule module;
|
||||
module_info.codeSize = size;
|
||||
module_info.pCode = (const uint32_t*)data;
|
||||
VKFUNC(vkCreateShaderModule)(vulkan->device, &module_info, NULL, &module);
|
||||
vkCreateShaderModule(vulkan->device, &module_info, NULL, &module);
|
||||
return module;
|
||||
}
|
||||
|
||||
@@ -635,19 +348,19 @@ static void init_descriptor(void)
|
||||
VkDescriptorSetLayoutCreateInfo set_layout_info = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO };
|
||||
set_layout_info.bindingCount = 1;
|
||||
set_layout_info.pBindings = &binding;
|
||||
VKFUNC(vkCreateDescriptorSetLayout)(device, &set_layout_info, NULL, &vk.set_layout);
|
||||
vkCreateDescriptorSetLayout(device, &set_layout_info, NULL, &vk.set_layout);
|
||||
|
||||
VkPipelineLayoutCreateInfo layout_info = { VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO };
|
||||
layout_info.setLayoutCount = 1;
|
||||
layout_info.pSetLayouts = &vk.set_layout;
|
||||
VKFUNC(vkCreatePipelineLayout)(device, &layout_info, NULL, &vk.pipeline_layout);
|
||||
vkCreatePipelineLayout(device, &layout_info, NULL, &vk.pipeline_layout);
|
||||
|
||||
VkDescriptorPoolCreateInfo pool_info = { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO };
|
||||
pool_info.maxSets = vk.num_swapchain_images;
|
||||
pool_info.poolSizeCount = 1;
|
||||
pool_info.pPoolSizes = pool_sizes;
|
||||
pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
||||
VKFUNC(vkCreateDescriptorPool)(device, &pool_info, NULL, &vk.desc_pool);
|
||||
vkCreateDescriptorPool(device, &pool_info, NULL, &vk.desc_pool);
|
||||
|
||||
VkDescriptorSetAllocateInfo alloc_info = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO };
|
||||
alloc_info.descriptorPool = vk.desc_pool;
|
||||
@@ -655,7 +368,7 @@ static void init_descriptor(void)
|
||||
alloc_info.pSetLayouts = &vk.set_layout;
|
||||
for (unsigned i = 0; i < vk.num_swapchain_images; i++)
|
||||
{
|
||||
VKFUNC(vkAllocateDescriptorSets)(device, &alloc_info, &vk.desc_set[i]);
|
||||
vkAllocateDescriptorSets(device, &alloc_info, &vk.desc_set[i]);
|
||||
|
||||
VkWriteDescriptorSet write = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET };
|
||||
VkDescriptorBufferInfo buffer_info;
|
||||
@@ -670,7 +383,7 @@ static void init_descriptor(void)
|
||||
buffer_info.offset = 0;
|
||||
buffer_info.range = 16 * sizeof(float);
|
||||
|
||||
VKFUNC(vkUpdateDescriptorSets)(device, 1, &write, 0, NULL);
|
||||
vkUpdateDescriptorSets(device, 1, &write, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,10 +479,10 @@ static void init_pipeline(void)
|
||||
pipe.renderPass = vk.render_pass;
|
||||
pipe.layout = vk.pipeline_layout;
|
||||
|
||||
VKFUNC(vkCreateGraphicsPipelines)(vulkan->device, vk.pipeline_cache, 1, &pipe, NULL, &vk.pipeline);
|
||||
vkCreateGraphicsPipelines(vulkan->device, vk.pipeline_cache, 1, &pipe, NULL, &vk.pipeline);
|
||||
|
||||
VKFUNC(vkDestroyShaderModule)(device, shader_stages[0].module, NULL);
|
||||
VKFUNC(vkDestroyShaderModule)(device, shader_stages[1].module, NULL);
|
||||
vkDestroyShaderModule(device, shader_stages[0].module, NULL);
|
||||
vkDestroyShaderModule(device, shader_stages[1].module, NULL);
|
||||
}
|
||||
|
||||
static void init_render_pass(VkFormat format)
|
||||
@@ -796,7 +509,7 @@ static void init_render_pass(VkFormat format)
|
||||
rp_info.pAttachments = &attachment;
|
||||
rp_info.subpassCount = 1;
|
||||
rp_info.pSubpasses = &subpass;
|
||||
VKFUNC(vkCreateRenderPass)(vulkan->device, &rp_info, NULL, &vk.render_pass);
|
||||
vkCreateRenderPass(vulkan->device, &rp_info, NULL, &vk.render_pass);
|
||||
}
|
||||
|
||||
static void init_swapchain(void)
|
||||
@@ -823,17 +536,17 @@ static void init_swapchain(void)
|
||||
image.mipLevels = 1;
|
||||
image.arrayLayers = 1;
|
||||
|
||||
VKFUNC(vkCreateImage)(device, &image, NULL, &vk.images[i].create_info.image);
|
||||
vkCreateImage(device, &image, NULL, &vk.images[i].create_info.image);
|
||||
|
||||
VkMemoryAllocateInfo alloc = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
|
||||
VkMemoryRequirements mem_reqs;
|
||||
|
||||
VKFUNC(vkGetImageMemoryRequirements)(device, vk.images[i].create_info.image, &mem_reqs);
|
||||
vkGetImageMemoryRequirements(device, vk.images[i].create_info.image, &mem_reqs);
|
||||
alloc.allocationSize = mem_reqs.size;
|
||||
alloc.memoryTypeIndex = find_memory_type_from_requirements(
|
||||
mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
VKFUNC(vkAllocateMemory)(device, &alloc, NULL, &vk.image_memory[i]);
|
||||
VKFUNC(vkBindImageMemory)(device, vk.images[i].create_info.image, vk.image_memory[i], 0);
|
||||
vkAllocateMemory(device, &alloc, NULL, &vk.image_memory[i]);
|
||||
vkBindImageMemory(device, vk.images[i].create_info.image, vk.image_memory[i], 0);
|
||||
|
||||
vk.images[i].create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
vk.images[i].create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
@@ -848,7 +561,7 @@ static void init_swapchain(void)
|
||||
vk.images[i].create_info.components.b = VK_COMPONENT_SWIZZLE_B;
|
||||
vk.images[i].create_info.components.a = VK_COMPONENT_SWIZZLE_A;
|
||||
|
||||
VKFUNC(vkCreateImageView)(device, &vk.images[i].create_info,
|
||||
vkCreateImageView(device, &vk.images[i].create_info,
|
||||
NULL, &vk.images[i].image_view);
|
||||
vk.images[i].image_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
|
||||
@@ -860,7 +573,7 @@ static void init_swapchain(void)
|
||||
fb_info.height = BASE_HEIGHT;
|
||||
fb_info.layers = 1;
|
||||
|
||||
VKFUNC(vkCreateFramebuffer)(device, &fb_info, NULL, &vk.framebuffers[i]);
|
||||
vkCreateFramebuffer(device, &fb_info, NULL, &vk.framebuffers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,18 +587,18 @@ static void init_command(void)
|
||||
|
||||
for (unsigned i = 0; i < vk.num_swapchain_images; i++)
|
||||
{
|
||||
VKFUNC(vkCreateCommandPool)(vulkan->device, &pool_info, NULL, &vk.cmd_pool[i]);
|
||||
vkCreateCommandPool(vulkan->device, &pool_info, NULL, &vk.cmd_pool[i]);
|
||||
info.commandPool = vk.cmd_pool[i];
|
||||
info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||
info.commandBufferCount = 1;
|
||||
VKFUNC(vkAllocateCommandBuffers)(vulkan->device, &info, &vk.cmd[i]);
|
||||
vkAllocateCommandBuffers(vulkan->device, &info, &vk.cmd[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void vulkan_test_init(void)
|
||||
{
|
||||
VKFUNC(vkGetPhysicalDeviceProperties)(vulkan->gpu, &vk.gpu_properties);
|
||||
VKFUNC(vkGetPhysicalDeviceMemoryProperties)(vulkan->gpu, &vk.memory_properties);
|
||||
vkGetPhysicalDeviceProperties(vulkan->gpu, &vk.gpu_properties);
|
||||
vkGetPhysicalDeviceMemoryProperties(vulkan->gpu, &vk.memory_properties);
|
||||
|
||||
unsigned num_images = 0;
|
||||
uint32_t mask = vulkan->get_sync_index_mask(vulkan->handle);
|
||||
@@ -901,7 +614,7 @@ static void vulkan_test_init(void)
|
||||
init_descriptor();
|
||||
|
||||
VkPipelineCacheCreateInfo pipeline_cache_info = { VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO };
|
||||
VKFUNC(vkCreatePipelineCache)(vulkan->device, &pipeline_cache_info,
|
||||
vkCreatePipelineCache(vulkan->device, &pipeline_cache_info,
|
||||
NULL, &vk.pipeline_cache);
|
||||
|
||||
init_render_pass(VK_FORMAT_R8G8B8A8_UNORM);
|
||||
@@ -911,38 +624,35 @@ static void vulkan_test_init(void)
|
||||
|
||||
static void vulkan_test_deinit(void)
|
||||
{
|
||||
if (!vulkan)
|
||||
return;
|
||||
|
||||
VkDevice device = vulkan->device;
|
||||
VKFUNC(vkDeviceWaitIdle)(device);
|
||||
vkDeviceWaitIdle(device);
|
||||
|
||||
for (unsigned i = 0; i < vk.num_swapchain_images; i++)
|
||||
{
|
||||
VKFUNC(vkDestroyFramebuffer)(device, vk.framebuffers[i], NULL);
|
||||
VKFUNC(vkDestroyImageView)(device, vk.images[i].image_view, NULL);
|
||||
VKFUNC(vkFreeMemory)(device, vk.image_memory[i], NULL);
|
||||
VKFUNC(vkDestroyImage)(device, vk.images[i].create_info.image, NULL);
|
||||
vkDestroyFramebuffer(device, vk.framebuffers[i], NULL);
|
||||
vkDestroyImageView(device, vk.images[i].image_view, NULL);
|
||||
vkFreeMemory(device, vk.image_memory[i], NULL);
|
||||
vkDestroyImage(device, vk.images[i].create_info.image, NULL);
|
||||
|
||||
VKFUNC(vkFreeMemory)(device, vk.ubo[i].memory, NULL);
|
||||
VKFUNC(vkDestroyBuffer)(device, vk.ubo[i].buffer, NULL);
|
||||
vkFreeMemory(device, vk.ubo[i].memory, NULL);
|
||||
vkDestroyBuffer(device, vk.ubo[i].buffer, NULL);
|
||||
}
|
||||
|
||||
VKFUNC(vkFreeDescriptorSets)(device, vk.desc_pool, vk.num_swapchain_images, vk.desc_set);
|
||||
VKFUNC(vkDestroyDescriptorPool)(device, vk.desc_pool, NULL);
|
||||
vkFreeDescriptorSets(device, vk.desc_pool, vk.num_swapchain_images, vk.desc_set);
|
||||
vkDestroyDescriptorPool(device, vk.desc_pool, NULL);
|
||||
|
||||
VKFUNC(vkDestroyRenderPass)(device, vk.render_pass, NULL);
|
||||
VKFUNC(vkDestroyPipeline)(device, vk.pipeline, NULL);
|
||||
VKFUNC(vkDestroyPipelineLayout)(device, vk.pipeline_layout, NULL);
|
||||
vkDestroyRenderPass(device, vk.render_pass, NULL);
|
||||
vkDestroyPipeline(device, vk.pipeline, NULL);
|
||||
vkDestroyPipelineLayout(device, vk.pipeline_layout, NULL);
|
||||
|
||||
VKFUNC(vkFreeMemory)(device, vk.vbo.memory, NULL);
|
||||
VKFUNC(vkDestroyBuffer)(device, vk.vbo.buffer, NULL);
|
||||
VKFUNC(vkDestroyPipelineCache)(device, vk.pipeline_cache, NULL);
|
||||
vkFreeMemory(device, vk.vbo.memory, NULL);
|
||||
vkDestroyBuffer(device, vk.vbo.buffer, NULL);
|
||||
vkDestroyPipelineCache(device, vk.pipeline_cache, NULL);
|
||||
|
||||
for (unsigned i = 0; i < vk.num_swapchain_images; i++)
|
||||
{
|
||||
VKFUNC(vkFreeCommandBuffers)(device, vk.cmd_pool[i], 1, &vk.cmd[i]);
|
||||
VKFUNC(vkDestroyCommandPool)(device, vk.cmd_pool[i], NULL);
|
||||
vkFreeCommandBuffers(device, vk.cmd_pool[i], 1, &vk.cmd[i]);
|
||||
vkDestroyCommandPool(device, vk.cmd_pool[i], NULL);
|
||||
}
|
||||
|
||||
memset(&vk, 0, sizeof(vk));
|
||||
@@ -980,16 +690,6 @@ static void context_reset(void)
|
||||
fprintf(stderr, "Failed to get HW rendering interface!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (vulkan->interface_version != RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION)
|
||||
{
|
||||
fprintf(stderr, "HW render interface mismatch, expected %u, got %u!\n",
|
||||
RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION, vulkan->interface_version);
|
||||
vulkan = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
load_device_symbols();
|
||||
vulkan_test_init();
|
||||
}
|
||||
|
||||
@@ -1004,7 +704,7 @@ static void context_destroy(void)
|
||||
static bool retro_init_hw_context(void)
|
||||
{
|
||||
hw_render.context_type = RETRO_HW_CONTEXT_VULKAN;
|
||||
hw_render.version_major = VK_MAKE_VERSION(1, 0, 6);
|
||||
hw_render.version_major = VK_API_VERSION;
|
||||
hw_render.version_minor = 0;
|
||||
hw_render.context_reset = context_reset;
|
||||
hw_render.context_destroy = context_destroy;
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
STATIC_LINKING := 0
|
||||
AR := ar
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
platform = osx
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
arch = intel
|
||||
ifeq ($(shell uname -p),powerpc)
|
||||
arch = ppc
|
||||
endif
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
TARGET_NAME := retropad
|
||||
LIBM = -lm
|
||||
|
||||
ifeq ($(ARCHFLAGS),)
|
||||
ifeq ($(archs),ppc)
|
||||
ARCHFLAGS = -arch ppc -arch ppc64
|
||||
else
|
||||
ARCHFLAGS = -arch i386 -arch x86_64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(platform), osx)
|
||||
ifndef ($(NOUNIVERSAL))
|
||||
CFLAGS += $(ARCHFLAGS)
|
||||
LFLAGS += $(ARCHFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC_LINKING), 1)
|
||||
EXT := a
|
||||
endif
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
EXT ?= so
|
||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), linux-portable)
|
||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||
fpic := -fPIC -nostdlib
|
||||
SHARED := -shared -Wl,--version-script=link.T
|
||||
LIBM :=
|
||||
else ifneq (,$(findstring osx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
else ifneq (,$(findstring ios,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
||||
fpic := -fPIC
|
||||
SHARED := -dynamiclib
|
||||
|
||||
ifeq ($(IOSSDK),)
|
||||
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
||||
endif
|
||||
|
||||
DEFINES := -DIOS
|
||||
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
||||
ifeq ($(platform),ios9)
|
||||
CC += -miphoneos-version-min=8.0
|
||||
CFLAGS += -miphoneos-version-min=8.0
|
||||
else
|
||||
CC += -miphoneos-version-min=5.0
|
||||
CFLAGS += -miphoneos-version-min=5.0
|
||||
endif
|
||||
else ifneq (,$(findstring qnx,$(platform)))
|
||||
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
||||
fpic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
else ifeq ($(platform), vita)
|
||||
TARGET := $(TARGET_NAME)_vita.a
|
||||
CC = arm-vita-eabi-gcc
|
||||
AR = arm-vita-eabi-ar
|
||||
CFLAGS += -Wl,-q -Wall -O3
|
||||
STATIC_LINKING = 1
|
||||
else
|
||||
CC = gcc
|
||||
TARGET := $(TARGET_NAME)_libretro.dll
|
||||
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
||||
endif
|
||||
|
||||
|
||||
LDFLAGS += $(LIBM)
|
||||
|
||||
ifeq ($(platform), win)
|
||||
LDFLAGS += -lws2_32
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
OBJECTS := ../../libretro-common/net/net_compat.o ../../libretro-common/net/net_socket.o retropad.o
|
||||
CFLAGS += -I../../libretro-common/include -Wall -pedantic $(fpic)
|
||||
|
||||
ifneq (,$(findstring qnx,$(platform)))
|
||||
CFLAGS += -Wc,-std=c99
|
||||
else
|
||||
CFLAGS += -std=gnu99
|
||||
endif
|
||||
|
||||
CFLAGS += -I../../libretro-common/include
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
ifeq ($(STATIC_LINKING), 1)
|
||||
$(AR) rcs $@ $(OBJECTS)
|
||||
else
|
||||
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(TARGET)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
APP_DIR := ../../src
|
||||
|
||||
LOCAL_MODULE := retro
|
||||
|
||||
ifeq ($(TARGET_ARCH),arm)
|
||||
LOCAL_CFLAGS += -DANDROID_ARM
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_CFLAGS += -DANDROID_X86
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),mips)
|
||||
LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES += ../libretro-test.c
|
||||
LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -1 +0,0 @@
|
||||
APP_ABI := all
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
global: retro_*;
|
||||
local: *;
|
||||
};
|
||||
|
||||
@@ -1,327 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
* Copyright (C) 2016 - Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* To-do:
|
||||
* - Analog support
|
||||
* - Some sort of connection control, it only sends packets
|
||||
* but there is no acknoledgement of a connection o keepalives
|
||||
* - Send player name
|
||||
* - Render something on-screen maybe a gui to configure IP and port
|
||||
instead of the ridiculously long strings we're using now
|
||||
* - Allow changing IP address and port in runtime
|
||||
* - Support other platforms
|
||||
* - Input recording / Combos
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <net/net_compat.h>
|
||||
#include <net/net_socket.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../libretro.h"
|
||||
|
||||
#ifndef SOCKET_ERROR
|
||||
#define SOCKET_ERROR -1
|
||||
#endif
|
||||
|
||||
|
||||
struct retro_log_callback logger;
|
||||
retro_log_printf_t log_cb;
|
||||
static uint16_t *frame_buf;
|
||||
struct sockaddr_in si_other;
|
||||
int s, slen=sizeof(si_other);
|
||||
char message[64];
|
||||
char server[64];
|
||||
int port;
|
||||
int input_state = 0;
|
||||
|
||||
void retro_init(void)
|
||||
{
|
||||
frame_buf = (uint16_t*)calloc(320 * 240, sizeof(uint16_t));
|
||||
|
||||
log_cb(RETRO_LOG_INFO, "Initialising sockets...\n");
|
||||
network_init();
|
||||
}
|
||||
|
||||
void retro_deinit(void)
|
||||
{
|
||||
if (frame_buf)
|
||||
free(frame_buf);
|
||||
frame_buf = NULL;
|
||||
}
|
||||
|
||||
unsigned retro_api_version(void)
|
||||
{
|
||||
return RETRO_API_VERSION;
|
||||
}
|
||||
|
||||
void retro_set_controller_port_device(
|
||||
unsigned port, unsigned device)
|
||||
{
|
||||
(void)port;
|
||||
(void)device;
|
||||
}
|
||||
|
||||
void retro_get_system_info(
|
||||
struct retro_system_info *info)
|
||||
{
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->library_name = "RetroPad Remote";
|
||||
info->library_version = "0.01";
|
||||
info->need_fullpath = false;
|
||||
info->valid_extensions = ""; /* Nothing. */
|
||||
}
|
||||
|
||||
void retro_get_system_av_info(
|
||||
struct retro_system_av_info *info)
|
||||
{
|
||||
info->timing.fps = 60.0;
|
||||
info->timing.sample_rate = 30000.0;
|
||||
|
||||
info->geometry.base_width = 320;
|
||||
info->geometry.base_height = 240;
|
||||
info->geometry.max_width = 320;
|
||||
info->geometry.max_height = 240;
|
||||
info->geometry.aspect_ratio = 4.0 / 3.0;
|
||||
}
|
||||
|
||||
static retro_video_refresh_t video_cb;
|
||||
static retro_audio_sample_t audio_cb;
|
||||
static retro_audio_sample_batch_t audio_batch_cb;
|
||||
static retro_environment_t environ_cb;
|
||||
static retro_input_poll_t input_poll_cb;
|
||||
static retro_input_state_t input_state_cb;
|
||||
|
||||
void update_input()
|
||||
{
|
||||
input_state = 0;
|
||||
input_poll_cb();
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
|
||||
input_state += 1;
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A))
|
||||
input_state += 2;
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
|
||||
input_state += pow(2, 2);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
|
||||
input_state += pow(2, 3);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
|
||||
input_state += pow(2, 4);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
input_state += pow(2, 5);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))
|
||||
input_state += pow(2, 6);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
||||
input_state += pow(2, 7);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y))
|
||||
input_state += pow(2, 8);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X))
|
||||
input_state += pow(2, 9);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))
|
||||
input_state += pow(2, 10);
|
||||
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R))
|
||||
input_state += pow(2, 11);
|
||||
}
|
||||
|
||||
void retro_set_environment(retro_environment_t cb)
|
||||
{
|
||||
static const struct retro_variable vars[] = {
|
||||
{ "port", "Port; 55400|55401|55402|55403|55404|55405|55406|55407|55408|55409|55410|55411|55412|55413|55414|55415|55416|55417|55418|55419|55420" },
|
||||
{ "ip_octet1", "IP address part 1; 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|35|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|135|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|223|224|225|226|227|228|229|230|231|232|233|235|235|236|237|238|239|240|241|242|243|244|245|246|247|248|249|250|251|252|253|254|255" },
|
||||
{ "ip_octet2", "IP address part 2; 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|35|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|135|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|223|224|225|226|227|228|229|230|231|232|233|235|235|236|237|238|239|240|241|242|243|244|245|246|247|248|249|250|251|252|253|254|255" },
|
||||
{ "ip_octet3", "IP address part 3; 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|35|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|135|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|223|224|225|226|227|228|229|230|231|232|233|235|235|236|237|238|239|240|241|242|243|244|245|246|247|248|249|250|251|252|253|254|255" },
|
||||
{ "ip_octet4", "IP address part 4; 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|35|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|135|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218|219|220|221|222|223|224|225|226|227|228|229|230|231|232|233|235|235|236|237|238|239|240|241|242|243|244|245|246|247|248|249|250|251|252|253|254|255" },
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
|
||||
|
||||
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
|
||||
|
||||
environ_cb = cb;
|
||||
bool no_content = true;
|
||||
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
|
||||
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt);
|
||||
|
||||
if (cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &logger))
|
||||
log_cb = logger.log;
|
||||
}
|
||||
|
||||
static void check_variables(void)
|
||||
{
|
||||
struct retro_variable var, var2, var3, var4, port_var;
|
||||
var.key = "ip_octet1";
|
||||
var2.key = "ip_octet2";
|
||||
var3.key = "ip_octet3";
|
||||
var4.key = "ip_octet4";
|
||||
port_var.key = "port";
|
||||
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var2);
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var3);
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var4);
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &port_var);
|
||||
|
||||
snprintf(server, sizeof(server), "%s.%s.%s.%s", var.value, var2.value, var3.value, var4.value);
|
||||
port = atoi(port_var.value);
|
||||
}
|
||||
|
||||
void retro_set_audio_sample(retro_audio_sample_t cb)
|
||||
{
|
||||
audio_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_audio_sample_batch(
|
||||
retro_audio_sample_batch_t cb)
|
||||
{
|
||||
audio_batch_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_input_poll(retro_input_poll_t cb)
|
||||
{
|
||||
input_poll_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_input_state(retro_input_state_t cb)
|
||||
{
|
||||
input_state_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_video_refresh(retro_video_refresh_t cb)
|
||||
{
|
||||
video_cb = cb;
|
||||
}
|
||||
|
||||
void retro_reset(void)
|
||||
{}
|
||||
|
||||
void retro_run(void)
|
||||
{
|
||||
unsigned i;
|
||||
update_input();
|
||||
snprintf(message, sizeof(message), "%d", input_state);
|
||||
|
||||
/* send the message */
|
||||
if (sendto(s, message, strlen(message) , 0 , (struct sockaddr *) &si_other, slen)==-1)
|
||||
log_cb(RETRO_LOG_INFO, "Error sending data\n");
|
||||
|
||||
for (i = 0; i < 320 * 240; i++)
|
||||
frame_buf[i] = 4 << 5;
|
||||
video_cb(frame_buf, 320, 240, 640);
|
||||
}
|
||||
|
||||
bool retro_load_game(const struct retro_game_info *info)
|
||||
{
|
||||
(void)info;
|
||||
check_variables();
|
||||
|
||||
s = socket_create(
|
||||
"retropad",
|
||||
SOCKET_DOMAIN_INET,
|
||||
SOCKET_TYPE_DATAGRAM,
|
||||
SOCKET_PROTOCOL_UDP);
|
||||
|
||||
if (s == SOCKET_ERROR)
|
||||
log_cb(RETRO_LOG_INFO, "socket failed");
|
||||
|
||||
/* setup address structure */
|
||||
memset((char *) &si_other, 0, sizeof(si_other));
|
||||
|
||||
si_other.sin_family = AF_INET;
|
||||
si_other.sin_port = htons(port);
|
||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||
si_other.sin_addr.S_un.S_addr = inet_addr(server);
|
||||
#else
|
||||
si_other.sin_addr.s_addr = inet_addr(server);
|
||||
|
||||
inet_aton(server , &si_other.sin_addr);
|
||||
#endif
|
||||
|
||||
log_cb(RETRO_LOG_INFO, "Server IP Address: %s\n" , server);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void retro_unload_game(void)
|
||||
{}
|
||||
|
||||
unsigned retro_get_region(void)
|
||||
{
|
||||
return RETRO_REGION_NTSC;
|
||||
}
|
||||
|
||||
bool retro_load_game_special(unsigned type,
|
||||
const struct retro_game_info *info, size_t num)
|
||||
{
|
||||
(void)type;
|
||||
(void)info;
|
||||
(void)num;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t retro_serialize_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool retro_serialize(void *data, size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool retro_unserialize(const void *data,
|
||||
size_t size)
|
||||
{
|
||||
(void)data;
|
||||
(void)size;
|
||||
return false;
|
||||
}
|
||||
|
||||
void *retro_get_memory_data(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t retro_get_memory_size(unsigned id)
|
||||
{
|
||||
(void)id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void retro_cheat_reset(void)
|
||||
{}
|
||||
|
||||
void retro_cheat_set(unsigned idx,
|
||||
bool enabled, const char *code)
|
||||
{
|
||||
(void)idx;
|
||||
(void)enabled;
|
||||
(void)code;
|
||||
}
|
||||
|
||||
|
||||
+97
-4
@@ -1,185 +1,278 @@
|
||||
|
||||
|
||||
ifeq ($(LIBRETRO), gambatte)
|
||||
APP_TITLE = Gambatte Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-GAMBATTE
|
||||
APP_UNIQUE_ID = 0xBAC01
|
||||
APP_ICON = ctr/assets/gambatte.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), gpsp)
|
||||
APP_TITLE = gpSP Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-GPSP
|
||||
APP_UNIQUE_ID = 0xBAC02
|
||||
APP_ICON = ctr/assets/gpsp.png
|
||||
APP_USE_SVCHAX = 1
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fceumm)
|
||||
APP_TITLE = FCeumm Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-FCEUMM
|
||||
APP_UNIQUE_ID = 0xBAC03
|
||||
APP_ICON = ctr/assets/fceumm.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), nestopia)
|
||||
APP_TITLE = Nestopia Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-NESTOPIA
|
||||
APP_UNIQUE_ID = 0xBAC04
|
||||
APP_ICON = ctr/assets/nestopia.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), nxengine)
|
||||
APP_TITLE = NXengine Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-NXENGINE
|
||||
APP_UNIQUE_ID = 0xBAC05
|
||||
APP_ICON = ctr/assets/nxengine.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), genesis_plus_gx)
|
||||
APP_TITLE = Genesis Plus GX Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-GENPLUSGX
|
||||
APP_UNIQUE_ID = 0xBAC06
|
||||
APP_ICON = ctr/assets/genesis_plus_gx.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), catsfc)
|
||||
APP_TITLE = CATSFC Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-CATSFC
|
||||
APP_UNIQUE_ID = 0xBAC07
|
||||
APP_ICON = ctr/assets/catsfc.png
|
||||
APP_BANNER = ctr/assets/catsfc_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mednafen_wswan)
|
||||
APP_TITLE = Mednafen wswan Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-M-WSWAN
|
||||
APP_UNIQUE_ID = 0xBAC08
|
||||
APP_ICON = ctr/assets/mednafen_wswan.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mednafen_vb)
|
||||
APP_TITLE = Mednafen VB Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-M-VB
|
||||
APP_UNIQUE_ID = 0xBAC09
|
||||
APP_ICON = ctr/assets/mednafen_vb.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mednafen_ngp)
|
||||
APP_TITLE = Mednafen NGP Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-M-NGP
|
||||
APP_UNIQUE_ID = 0xBAC0A
|
||||
APP_ICON = ctr/assets/mednafen_ngp.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), 2048)
|
||||
APP_TITLE = 2048 Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-2048
|
||||
APP_UNIQUE_ID = 0xBAC0B
|
||||
APP_ICON = ctr/assets/2048.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), picodrive)
|
||||
APP_TITLE = Picodrive Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-PICODRIVE
|
||||
APP_UNIQUE_ID = 0xBAC0C
|
||||
APP_ICON = ctr/assets/picodrive.png
|
||||
APP_BANNER = ctr/assets/picodrive_banner.png
|
||||
APP_USE_SVCHAX = 1
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), snes9x_next)
|
||||
APP_TITLE = Snes9x Next Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-SNES9XNEXT
|
||||
APP_UNIQUE_ID = 0xBAC0D
|
||||
APP_ICON = ctr/assets/snes9x_next.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mgba)
|
||||
APP_TITLE = mGBA Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Jeffrey Pfau
|
||||
APP_PRODUCT_CODE = RARCH-MGBA
|
||||
APP_UNIQUE_ID = 0xBAC0E
|
||||
APP_ICON = ctr/assets/mgba.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), quicknes)
|
||||
APP_TITLE = QuickNES Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = blargg, kode54
|
||||
APP_PRODUCT_CODE = RARCH-QUICKNES
|
||||
APP_UNIQUE_ID = 0xBAC0F
|
||||
APP_ICON = ctr/assets/quicknes.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha_neo)
|
||||
APP_TITLE = Neo Geo (FB Alpha)
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBANEOGEO
|
||||
APP_UNIQUE_ID = 0xBAC10
|
||||
APP_ICON = ctr/assets/fb_alpha_neo.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_SYSTEM_MODE = 80MB
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha_cps1)
|
||||
APP_TITLE = Final Burn Alpha - CPS-1
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBACPS1
|
||||
APP_UNIQUE_ID = 0xBAC11
|
||||
APP_ICON = ctr/assets/fb_alpha_cps1.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha_cps2)
|
||||
APP_TITLE = Final Burn Alpha - CPS-2
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBACPS2
|
||||
APP_UNIQUE_ID = 0xBAC12
|
||||
APP_ICON = ctr/assets/fb_alpha_cps2.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_SYSTEM_MODE = 80MB
|
||||
|
||||
else ifeq ($(LIBRETRO), catsfc_plus)
|
||||
APP_TITLE = CATSFC Plus Libretro
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-CATSFCPLUS
|
||||
APP_UNIQUE_ID = 0xBAC13
|
||||
APP_ICON = ctr/assets/catsfc_plus.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), mednafen_pce_fast)
|
||||
APP_TITLE = Mednafen/Beetle PCE FAST
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Ryphecha
|
||||
APP_PRODUCT_CODE = RARCH-M-PCE-FAST
|
||||
APP_UNIQUE_ID = 0xBAC14
|
||||
APP_ICON = ctr/assets/mednafen_pce_fast.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), pcsx_rearmed)
|
||||
APP_TITLE = PCSX ReARMed
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = PCSX Team, notaz, Exophase
|
||||
APP_PRODUCT_CODE = RARCH-PCSXRARMD
|
||||
APP_UNIQUE_ID = 0xBAC15
|
||||
APP_ICON = ctr/assets/pcsx_rearmed.png
|
||||
APP_USE_SVCHAX = 1
|
||||
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fmsx)
|
||||
APP_TITLE = fMSX
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Marat Fayzullin
|
||||
APP_PRODUCT_CODE = RARCH-FMSX
|
||||
APP_UNIQUE_ID = 0xBAC16
|
||||
APP_ICON = ctr/assets/fmsx.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), fb_alpha)
|
||||
APP_TITLE = Final Burn Alpha
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team FB Alpha
|
||||
APP_PRODUCT_CODE = RARCH-FBA
|
||||
APP_UNIQUE_ID = 0xBAC17
|
||||
#APP_ICON = ctr/assets/default.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_BIG_TEXT_SECTION = 1
|
||||
|
||||
else ifeq ($(LIBRETRO), mame2003)
|
||||
APP_TITLE = MAME-2003
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-MAME2003
|
||||
APP_UNIQUE_ID = 0xBAC18
|
||||
APP_ICON = ctr/assets/mame.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_BIG_TEXT_SECTION = 1
|
||||
|
||||
else ifeq ($(LIBRETRO), mame2000)
|
||||
APP_TITLE = MAME-2000
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
#APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RARCH-MAME2000
|
||||
APP_UNIQUE_ID = 0xBAC19
|
||||
APP_ICON = ctr/assets/mame.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_BIG_TEXT_SECTION = 1
|
||||
|
||||
else ifeq ($(LIBRETRO), pocketsnes)
|
||||
APP_TITLE = Pocket Snes
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = various
|
||||
APP_PRODUCT_CODE = RARCH-POCKETSNES
|
||||
APP_UNIQUE_ID = 0xBAC1A
|
||||
APP_ICON = ctr/assets/pocketsnes.png
|
||||
APP_BANNER = ctr/assets/pocketsnes_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
else ifeq ($(LIBRETRO), dosbox)
|
||||
APP_TITLE = DosBox
|
||||
#APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = various
|
||||
APP_PRODUCT_CODE = RARCH-DOSBOX
|
||||
APP_UNIQUE_ID = 0xBAC1B
|
||||
APP_ICON = ctr/assets/dosbox.png
|
||||
#APP_BANNER = ctr/assets/libretro_banner.png
|
||||
#APP_AUDIO = ctr/assets/silent.wav
|
||||
|
||||
endif
|
||||
+67
-429
@@ -1,385 +1,8 @@
|
||||
|
||||
#include <3ds.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define CURRENT_KTHREAD 0xFFFF9000
|
||||
#define CURRENT_KPROCESS 0xFFFF9004
|
||||
#define CURRENT_KPROCESS_HANDLE 0xFFFF8001
|
||||
#define RESOURCE_LIMIT_THREADS 0x2
|
||||
|
||||
#define MCH2_THREAD_COUNT_MAX 0x20
|
||||
#define MCH2_THREAD_STACKS_SIZE 0x1000
|
||||
|
||||
#define SVC_ACL_OFFSET(svc_id) (((svc_id) >> 5) << 2)
|
||||
#define SVC_ACL_MASK(svc_id) (0x1 << ((svc_id) & 0x1F))
|
||||
#define THREAD_PAGE_ACL_OFFSET 0xF38
|
||||
|
||||
u32 __ctr_svchax = 0;
|
||||
u32 __ctr_svchax_srv = 0;
|
||||
|
||||
extern void* __service_ptr;
|
||||
extern Handle gspEvents[GSPGPU_EVENT_MAX];
|
||||
|
||||
typedef u32(*backdoor_fn)(u32 arg0, u32 arg1);
|
||||
|
||||
__attribute((naked))
|
||||
static u32 svc_7b(backdoor_fn entry_fn, ...) // can pass up to two arguments to entry_fn(...)
|
||||
{
|
||||
__asm__ volatile(
|
||||
"push {r0, r1, r2} \n\t"
|
||||
"mov r3, sp \n\t"
|
||||
"add r0, pc, #12 \n\t"
|
||||
"svc 0x7B \n\t"
|
||||
"add sp, sp, #8 \n\t"
|
||||
"ldr r0, [sp], #4 \n\t"
|
||||
"bx lr \n\t"
|
||||
"cpsid aif \n\t"
|
||||
"ldr r2, [r3], #4 \n\t"
|
||||
"ldmfd r3!, {r0, r1} \n\t"
|
||||
"push {r3, lr} \n\t"
|
||||
"blx r2 \n\t"
|
||||
"pop {r3, lr} \n\t"
|
||||
"str r0, [r3, #-4]! \n\t"
|
||||
"bx lr \n\t");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void k_enable_all_svcs(u32 isNew3DS)
|
||||
{
|
||||
u32* thread_ACL = *(*(u32***)CURRENT_KTHREAD + 0x22) - 0x6;
|
||||
u32* process_ACL = *(u32**)CURRENT_KPROCESS + (isNew3DS ? 0x24 : 0x22);
|
||||
|
||||
memset(thread_ACL, 0xFF, 0x10);
|
||||
memset(process_ACL, 0xFF, 0x10);
|
||||
}
|
||||
|
||||
static u32 k_read_kaddr(u32* kaddr)
|
||||
{
|
||||
return *kaddr;
|
||||
}
|
||||
|
||||
static u32 read_kaddr(u32 kaddr)
|
||||
{
|
||||
return svc_7b((backdoor_fn)k_read_kaddr, kaddr);
|
||||
}
|
||||
|
||||
static u32 k_write_kaddr(u32* kaddr, u32 val)
|
||||
{
|
||||
*kaddr = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void write_kaddr(u32 kaddr, u32 val)
|
||||
{
|
||||
svc_7b((backdoor_fn)k_write_kaddr, kaddr, val);
|
||||
}
|
||||
|
||||
__attribute__((naked))
|
||||
static u32 get_thread_page(void)
|
||||
{
|
||||
__asm__ volatile(
|
||||
"sub r0, sp, #8 \n\t"
|
||||
"mov r1, #1 \n\t"
|
||||
"mov r2, #0 \n\t"
|
||||
"svc 0x2A \n\t"
|
||||
"mov r0, r1, LSR#12 \n\t"
|
||||
"mov r0, r0, LSL#12 \n\t"
|
||||
"bx lr \n\t");
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Handle started_event;
|
||||
Handle lock;
|
||||
volatile u32 target_kaddr;
|
||||
volatile u32 target_val;
|
||||
} mch2_thread_args_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32* stack_top;
|
||||
Handle handle;
|
||||
bool keep;
|
||||
mch2_thread_args_t args;
|
||||
} mch2_thread_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 old_cpu_time_limit;
|
||||
u8 isNew3DS;
|
||||
u32 kernel_fcram_mapping_offset;
|
||||
|
||||
Handle arbiter;
|
||||
volatile u32 alloc_address;
|
||||
volatile u32 alloc_size;
|
||||
u8* flush_buffer;
|
||||
|
||||
Handle dummy_threads_lock;
|
||||
Handle target_threads_lock;
|
||||
Handle main_thread_lock;
|
||||
u32* thread_page_va;
|
||||
u32 thread_page_kva;
|
||||
|
||||
u32 threads_limit;
|
||||
Handle alloc_thread;
|
||||
Handle poll_thread;
|
||||
mch2_thread_t threads[MCH2_THREAD_COUNT_MAX];
|
||||
} mch2_vars_t;
|
||||
|
||||
static void alloc_thread_entry(mch2_vars_t* mch2)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
svcControlMemory(&tmp, mch2->alloc_address, 0x0, mch2->alloc_size, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE);
|
||||
svcExitThread();
|
||||
}
|
||||
|
||||
static void dummy_thread_entry(Handle lock)
|
||||
{
|
||||
svcWaitSynchronization(lock, U64_MAX);
|
||||
svcExitThread();
|
||||
}
|
||||
|
||||
static void check_tls_thread_entry(bool* keep)
|
||||
{
|
||||
*keep = !((u32)getThreadLocalStorage() & 0xFFF);
|
||||
svcExitThread();
|
||||
}
|
||||
|
||||
static void target_thread_entry(mch2_thread_args_t* args)
|
||||
{
|
||||
svcSignalEvent(args->started_event);
|
||||
svcWaitSynchronization(args->lock, U64_MAX);
|
||||
|
||||
if (args->target_kaddr)
|
||||
write_kaddr(args->target_kaddr, args->target_val);
|
||||
|
||||
svcExitThread();
|
||||
}
|
||||
|
||||
static u32 get_first_free_basemem_page(bool isNew3DS)
|
||||
{
|
||||
s64 v1;
|
||||
int memused_base;
|
||||
int memused_base_linear; // guessed
|
||||
|
||||
memused_base = osGetMemRegionUsed(MEMREGION_BASE);
|
||||
|
||||
svcGetSystemInfo(&v1, 2, 0);
|
||||
memused_base_linear = 0x6C000 + v1 +
|
||||
(osGetKernelVersion() > SYSTEM_VERSION(2, 49, 0) ? (isNew3DS ? 0x2000 : 0x1000) : 0x0);
|
||||
|
||||
return (osGetKernelVersion() > SYSTEM_VERSION(2, 40, 0) ? 0xE0000000 : 0xF0000000) // kernel FCRAM mapping
|
||||
+ (isNew3DS ? 0x10000000 : 0x08000000) // FCRAM size
|
||||
- (memused_base - memused_base_linear) // memory usage for pages allocated without the MEMOP_LINEAR flag
|
||||
- 0x1000; // skip to the start addr of the next free page
|
||||
|
||||
}
|
||||
|
||||
static u32 get_threads_limit(void)
|
||||
{
|
||||
Handle resource_limit_handle;
|
||||
s64 thread_limit_current;
|
||||
s64 thread_limit_max;
|
||||
u32 thread_limit_name = RESOURCE_LIMIT_THREADS;
|
||||
|
||||
svcGetResourceLimit(&resource_limit_handle, CURRENT_KPROCESS_HANDLE);
|
||||
svcGetResourceLimitCurrentValues(&thread_limit_current, resource_limit_handle, &thread_limit_name, 1);
|
||||
svcGetResourceLimitLimitValues(&thread_limit_max, resource_limit_handle, &thread_limit_name, 1);
|
||||
svcCloseHandle(resource_limit_handle);
|
||||
|
||||
if (thread_limit_max > MCH2_THREAD_COUNT_MAX)
|
||||
thread_limit_max = MCH2_THREAD_COUNT_MAX;
|
||||
|
||||
return thread_limit_max - thread_limit_current;
|
||||
}
|
||||
|
||||
static void do_memchunkhax2(void)
|
||||
{
|
||||
static u8 flush_buffer[0x8000];
|
||||
static u8 thread_stacks[MCH2_THREAD_STACKS_SIZE];
|
||||
|
||||
int i;
|
||||
u32 tmp;
|
||||
mch2_vars_t mch2 = {0};
|
||||
|
||||
mch2.flush_buffer = flush_buffer;
|
||||
mch2.threads_limit = get_threads_limit();
|
||||
mch2.kernel_fcram_mapping_offset = (osGetKernelVersion() > SYSTEM_VERSION(2, 40, 0)) ? 0xC0000000 : 0xD0000000;
|
||||
|
||||
for (i = 0; i < MCH2_THREAD_COUNT_MAX; i++)
|
||||
mch2.threads[i].stack_top = (u32*)((u32)thread_stacks + (i + 1) * (MCH2_THREAD_STACKS_SIZE / MCH2_THREAD_COUNT_MAX));
|
||||
|
||||
aptOpenSession();
|
||||
APT_CheckNew3DS(&mch2.isNew3DS);
|
||||
APT_GetAppCpuTimeLimit(&mch2.old_cpu_time_limit);
|
||||
APT_SetAppCpuTimeLimit(5);
|
||||
aptCloseSession();
|
||||
|
||||
for (i = 0; i < mch2.threads_limit; i++)
|
||||
{
|
||||
svcCreateThread(&mch2.threads[i].handle, (ThreadFunc)check_tls_thread_entry, (u32)&mch2.threads[i].keep,
|
||||
mch2.threads[i].stack_top, 0x18, 0);
|
||||
svcWaitSynchronization(mch2.threads[i].handle, U64_MAX);
|
||||
}
|
||||
|
||||
for (i = 0; i < mch2.threads_limit; i++)
|
||||
if (!mch2.threads[i].keep)
|
||||
svcCloseHandle(mch2.threads[i].handle);
|
||||
|
||||
svcCreateEvent(&mch2.dummy_threads_lock, 1);
|
||||
svcClearEvent(mch2.dummy_threads_lock);
|
||||
|
||||
for (i = 0; i < mch2.threads_limit; i++)
|
||||
if (!mch2.threads[i].keep)
|
||||
svcCreateThread(&mch2.threads[i].handle, (ThreadFunc)dummy_thread_entry, mch2.dummy_threads_lock,
|
||||
mch2.threads[i].stack_top, 0x3F - i, 0);
|
||||
|
||||
svcSignalEvent(mch2.dummy_threads_lock);
|
||||
|
||||
for (i = mch2.threads_limit - 1; i >= 0; i--)
|
||||
if (!mch2.threads[i].keep)
|
||||
{
|
||||
svcWaitSynchronization(mch2.threads[i].handle, U64_MAX);
|
||||
svcCloseHandle(mch2.threads[i].handle);
|
||||
mch2.threads[i].handle = 0;
|
||||
}
|
||||
|
||||
svcCloseHandle(mch2.dummy_threads_lock);
|
||||
|
||||
u32 fragmented_address = 0;
|
||||
|
||||
mch2.arbiter = __sync_get_arbiter();
|
||||
|
||||
u32 linear_buffer;
|
||||
svcControlMemory(&linear_buffer, 0, 0, 0x1000, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
|
||||
u32 linear_size = 0xF000;
|
||||
u32 skip_pages = 2;
|
||||
mch2.alloc_size = ((((linear_size - (skip_pages << 12)) + 0x1000) >> 13) << 12);
|
||||
u32 mem_free = osGetMemRegionFree(MEMREGION_APPLICATION);
|
||||
|
||||
u32 fragmented_size = mem_free - linear_size;
|
||||
extern u32 __heapBase;
|
||||
extern u32 __heap_size;
|
||||
fragmented_address = __heapBase + __heap_size;
|
||||
u32 linear_address;
|
||||
mch2.alloc_address = fragmented_address + fragmented_size;
|
||||
|
||||
svcControlMemory(&linear_address, 0x0, 0x0, linear_size, MEMOP_ALLOC_LINEAR,
|
||||
MEMPERM_READ | MEMPERM_WRITE);
|
||||
|
||||
if (fragmented_size)
|
||||
svcControlMemory(&tmp, (u32)fragmented_address, 0x0, fragmented_size, MEMOP_ALLOC,
|
||||
MEMPERM_READ | MEMPERM_WRITE);
|
||||
|
||||
if (skip_pages)
|
||||
svcControlMemory(&tmp, (u32)linear_address, 0x0, (skip_pages << 12), MEMOP_FREE, MEMPERM_DONTCARE);
|
||||
|
||||
for (i = skip_pages; i < (linear_size >> 12) ; i += 2)
|
||||
svcControlMemory(&tmp, (u32)linear_address + (i << 12), 0x0, 0x1000, MEMOP_FREE, MEMPERM_DONTCARE);
|
||||
|
||||
u32 alloc_address_kaddr = osConvertVirtToPhys((void*)linear_address) + mch2.kernel_fcram_mapping_offset;
|
||||
|
||||
mch2.thread_page_kva = get_first_free_basemem_page(mch2.isNew3DS) - 0x10000; // skip down 16 pages
|
||||
((u32*)linear_buffer)[0] = 1;
|
||||
((u32*)linear_buffer)[1] = mch2.thread_page_kva;
|
||||
((u32*)linear_buffer)[2] = alloc_address_kaddr + (((mch2.alloc_size >> 12) - 3) << 13) + (skip_pages << 12);
|
||||
|
||||
u32 dst_memchunk = linear_address + (((mch2.alloc_size >> 12) - 2) << 13) + (skip_pages << 12);
|
||||
|
||||
memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000);
|
||||
|
||||
GSPGPU_InvalidateDataCache((void*)dst_memchunk, 16);
|
||||
GSPGPU_FlushDataCache((void*)linear_buffer, 16);
|
||||
memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000);
|
||||
svcClearEvent(gspEvents[GSPGPU_EVENT_PPF]);
|
||||
|
||||
svcCreateThread(&mch2.alloc_thread, (ThreadFunc)alloc_thread_entry, (u32)&mch2,
|
||||
mch2.threads[MCH2_THREAD_COUNT_MAX - 1].stack_top, 0x3F, 1);
|
||||
|
||||
while ((u32) svcArbitrateAddress(mch2.arbiter, mch2.alloc_address, ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, 0,
|
||||
0) == 0xD9001814);
|
||||
|
||||
GX_TextureCopy((void*)linear_buffer, 0, (void*)dst_memchunk, 0, 16, 8);
|
||||
memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000);
|
||||
svcWaitSynchronization(gspEvents[GSPGPU_EVENT_PPF], U64_MAX);
|
||||
|
||||
svcWaitSynchronization(mch2.alloc_thread, U64_MAX);
|
||||
svcCloseHandle(mch2.alloc_thread);
|
||||
|
||||
u32* mapped_page = (u32*)(mch2.alloc_address + mch2.alloc_size - 0x1000);
|
||||
|
||||
volatile u32* thread_ACL = &mapped_page[THREAD_PAGE_ACL_OFFSET >> 2];
|
||||
|
||||
svcCreateEvent(&mch2.main_thread_lock, 0);
|
||||
svcCreateEvent(&mch2.target_threads_lock, 1);
|
||||
svcClearEvent(mch2.target_threads_lock);
|
||||
|
||||
for (i = 0; i < mch2.threads_limit; i++)
|
||||
{
|
||||
if (mch2.threads[i].keep)
|
||||
continue;
|
||||
|
||||
mch2.threads[i].args.started_event = mch2.main_thread_lock;
|
||||
mch2.threads[i].args.lock = mch2.target_threads_lock;
|
||||
mch2.threads[i].args.target_kaddr = 0;
|
||||
|
||||
thread_ACL[0] = 0;
|
||||
GSPGPU_FlushDataCache((void*)thread_ACL, 16);
|
||||
GSPGPU_InvalidateDataCache((void*)thread_ACL, 16);
|
||||
|
||||
svcClearEvent(mch2.main_thread_lock);
|
||||
svcCreateThread(&mch2.threads[i].handle, (ThreadFunc)target_thread_entry, (u32)&mch2.threads[i].args,
|
||||
mch2.threads[i].stack_top, 0x18, 0);
|
||||
svcWaitSynchronization(mch2.main_thread_lock, U64_MAX);
|
||||
|
||||
if (thread_ACL[0])
|
||||
{
|
||||
thread_ACL[SVC_ACL_OFFSET(0x7B) >> 2] = SVC_ACL_MASK(0x7B);
|
||||
GSPGPU_FlushDataCache((void*)thread_ACL, 16);
|
||||
GSPGPU_InvalidateDataCache((void*)thread_ACL, 16);
|
||||
mch2.threads[i].args.target_kaddr = get_thread_page() + THREAD_PAGE_ACL_OFFSET + SVC_ACL_OFFSET(0x7B);
|
||||
mch2.threads[i].args.target_val = SVC_ACL_MASK(0x7B);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
svcSignalEvent(mch2.target_threads_lock);
|
||||
|
||||
for (i = 0; i < mch2.threads_limit; i++)
|
||||
{
|
||||
if (!mch2.threads[i].handle)
|
||||
continue;
|
||||
|
||||
if (!mch2.threads[i].keep)
|
||||
svcWaitSynchronization(mch2.threads[i].handle, U64_MAX);
|
||||
|
||||
svcCloseHandle(mch2.threads[i].handle);
|
||||
}
|
||||
|
||||
svcCloseHandle(mch2.target_threads_lock);
|
||||
svcCloseHandle(mch2.main_thread_lock);
|
||||
|
||||
svcControlMemory(&tmp, mch2.alloc_address, 0, mch2.alloc_size, MEMOP_FREE, MEMPERM_DONTCARE);
|
||||
write_kaddr(alloc_address_kaddr + linear_size - 0x3000 + 0x4, alloc_address_kaddr + linear_size - 0x1000);
|
||||
svcControlMemory(&tmp, (u32)fragmented_address, 0x0, fragmented_size, MEMOP_FREE, MEMPERM_DONTCARE);
|
||||
|
||||
for (i = 1 + skip_pages; i < (linear_size >> 12) ; i += 2)
|
||||
svcControlMemory(&tmp, (u32)linear_address + (i << 12), 0x0, 0x1000, MEMOP_FREE, MEMPERM_DONTCARE);
|
||||
|
||||
svcControlMemory(&tmp, linear_buffer, 0, 0x1000, MEMOP_FREE, MEMPERM_DONTCARE);
|
||||
|
||||
aptOpenSession();
|
||||
APT_SetAppCpuTimeLimit(mch2.old_cpu_time_limit);
|
||||
aptCloseSession();
|
||||
}
|
||||
|
||||
|
||||
static void gspwn(u32 dst, u32 src, u32 size, u8* flush_buffer)
|
||||
static void svchax_gspwn(u32 dst, u32 src, u32 size, u8* flush_buffer)
|
||||
{
|
||||
extern Handle gspEvents[GSPGPU_EVENT_MAX];
|
||||
|
||||
@@ -389,7 +12,7 @@ static void gspwn(u32 dst, u32 src, u32 size, u8* flush_buffer)
|
||||
memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000);
|
||||
|
||||
svcClearEvent(gspEvents[GSPGPU_EVENT_PPF]);
|
||||
GX_TextureCopy((void*)src, 0, (void*)dst, 0, size, 8);
|
||||
GX_TextureCopy((void*)src, 0, (void*)dst, 0, size, 8);
|
||||
svcWaitSynchronization(gspEvents[GSPGPU_EVENT_PPF], U64_MAX);
|
||||
|
||||
memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000);
|
||||
@@ -408,7 +31,7 @@ static void gspwn(u32 dst, u32 src, u32 size, u8* flush_buffer)
|
||||
// X-X--X-X
|
||||
// X-XXXX-X
|
||||
|
||||
static void memchunkhax1_write_pair(u32 val1, u32 val2)
|
||||
static void memchunkhax_write_pair(u32 val1, u32 val2)
|
||||
{
|
||||
u32 linear_buffer;
|
||||
u8* flush_buffer;
|
||||
@@ -429,25 +52,25 @@ static void memchunkhax1_write_pair(u32 val1, u32 val2)
|
||||
svcControlMemory(&tmp, linear_buffer + 0x6000, 0, 0x1000, MEMOP_FREE, 0);
|
||||
|
||||
next_ptr1 = (u32*)(linear_buffer + 0x0004);
|
||||
gspwn(linear_buffer + 0x0000, linear_buffer + 0x1000, 16, flush_buffer);
|
||||
svchax_gspwn(linear_buffer + 0x0000, linear_buffer + 0x1000, 16, flush_buffer);
|
||||
|
||||
next_ptr3 = (u32*)(linear_buffer + 0x2004);
|
||||
prev_ptr3 = (u32*)(linear_buffer + 0x2008);
|
||||
gspwn(linear_buffer + 0x2000, linear_buffer + 0x3000, 16, flush_buffer);
|
||||
svchax_gspwn(linear_buffer + 0x2000, linear_buffer + 0x3000, 16, flush_buffer);
|
||||
|
||||
prev_ptr6 = (u32*)(linear_buffer + 0x5008);
|
||||
gspwn(linear_buffer + 0x5000, linear_buffer + 0x6000, 16, flush_buffer);
|
||||
svchax_gspwn(linear_buffer + 0x5000, linear_buffer + 0x6000, 16, flush_buffer);
|
||||
|
||||
*next_ptr1 = *next_ptr3;
|
||||
*prev_ptr6 = *prev_ptr3;
|
||||
|
||||
*prev_ptr3 = val1 - 4;
|
||||
*next_ptr3 = val2;
|
||||
gspwn(linear_buffer + 0x3000, linear_buffer + 0x2000, 16, flush_buffer);
|
||||
svchax_gspwn(linear_buffer + 0x3000, linear_buffer + 0x2000, 16, flush_buffer);
|
||||
svcControlMemory(&tmp, 0, 0, 0x2000, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
|
||||
gspwn(linear_buffer + 0x1000, linear_buffer + 0x0000, 16, flush_buffer);
|
||||
gspwn(linear_buffer + 0x6000, linear_buffer + 0x5000, 16, flush_buffer);
|
||||
svchax_gspwn(linear_buffer + 0x1000, linear_buffer + 0x0000, 16, flush_buffer);
|
||||
svchax_gspwn(linear_buffer + 0x6000, linear_buffer + 0x5000, 16, flush_buffer);
|
||||
|
||||
svcControlMemory(&tmp, linear_buffer + 0x0000, 0, 0x1000, MEMOP_FREE, 0);
|
||||
svcControlMemory(&tmp, linear_buffer + 0x2000, 0, 0x4000, MEMOP_FREE, 0);
|
||||
@@ -455,53 +78,68 @@ static void memchunkhax1_write_pair(u32 val1, u32 val2)
|
||||
|
||||
}
|
||||
|
||||
static void do_memchunkhax1(void)
|
||||
|
||||
static inline u32 get_7B_access_ctrl_ptr(void)
|
||||
{
|
||||
u32 saved_vram_value = *(u32*)0x1F000008;
|
||||
|
||||
// 0x1F000000 contains the enable bit for svc 0x7B
|
||||
memchunkhax1_write_pair(get_thread_page() + THREAD_PAGE_ACL_OFFSET + SVC_ACL_OFFSET(0x7B), 0x1F000000);
|
||||
|
||||
write_kaddr(0x1F000008, saved_vram_value);
|
||||
register u32 r0 __asm__("r0");
|
||||
__asm__ volatile (
|
||||
"sub r0, sp, #8 \n\t"
|
||||
"mov r1, #1 \n\t"
|
||||
"mov r2, #0 \n\t"
|
||||
"svc 0x2A \n\t"
|
||||
"orr r0, r1, #0xF00 \n\t"
|
||||
"bic r0, r0, #0x0FF \n\t"
|
||||
"add r0, r0, #0x044 \n\t"
|
||||
:::"r0","r1","r2");
|
||||
return r0;
|
||||
}
|
||||
|
||||
Result svchax_init(bool patch_srv)
|
||||
static u32 saved_vram_value;
|
||||
|
||||
static s32 k_restore_vram_value(void)
|
||||
{
|
||||
u8 isNew3DS;
|
||||
aptOpenSession();
|
||||
APT_CheckNew3DS(&isNew3DS);
|
||||
aptCloseSession();
|
||||
__asm__ volatile("cpsid aif \n\t");
|
||||
|
||||
u32 kver = osGetKernelVersion();
|
||||
|
||||
if (!__ctr_svchax)
|
||||
{
|
||||
if (__service_ptr)
|
||||
{
|
||||
if (kver > SYSTEM_VERSION(2, 50, 11))
|
||||
return -1;
|
||||
else if (kver > SYSTEM_VERSION(2, 46, 0))
|
||||
do_memchunkhax2();
|
||||
else
|
||||
do_memchunkhax1();
|
||||
}
|
||||
|
||||
svc_7b((backdoor_fn)k_enable_all_svcs, isNew3DS);
|
||||
|
||||
__ctr_svchax = 1;
|
||||
}
|
||||
|
||||
if (patch_srv && !__ctr_svchax_srv)
|
||||
{
|
||||
u32 PID_kaddr = read_kaddr(CURRENT_KPROCESS) + (isNew3DS ? 0xBC : (kver > SYSTEM_VERSION(2, 40, 0)) ? 0xB4 : 0xAC);
|
||||
u32 old_PID = read_kaddr(PID_kaddr);
|
||||
write_kaddr(PID_kaddr, 0);
|
||||
srvExit();
|
||||
srvInit();
|
||||
write_kaddr(PID_kaddr, old_PID);
|
||||
|
||||
__ctr_svchax_srv = 1;
|
||||
}
|
||||
*(u32*)0x1F000008 = saved_vram_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 k_enable_all_svc(void)
|
||||
{
|
||||
__asm__ volatile("cpsid aif");
|
||||
|
||||
u32* svc_access_control = *(*(u32***)0xFFFF9000 + 0x22) - 0x6;
|
||||
|
||||
svc_access_control[0]=0xFFFFFFFE;
|
||||
svc_access_control[1]=0xFFFFFFFF;
|
||||
svc_access_control[2]=0xFFFFFFFF;
|
||||
svc_access_control[3]=0x3FFFFFFF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 __ctr_svchax = 0;
|
||||
|
||||
void svchax_init(void)
|
||||
{
|
||||
extern void* __service_ptr;
|
||||
|
||||
if (__ctr_svchax)
|
||||
return;
|
||||
|
||||
if(__service_ptr)
|
||||
{
|
||||
if((*(u8*)0x1FF80002 > 0x2F) || (*(u8*)0x1FF80003 != 0x2))
|
||||
return;
|
||||
|
||||
saved_vram_value = *(u32*)0x1F000008;
|
||||
memchunkhax_write_pair(get_7B_access_ctrl_ptr(), 0x1F000000);
|
||||
svcBackdoor(k_restore_vram_value);
|
||||
}
|
||||
|
||||
svcBackdoor(k_enable_all_svc);
|
||||
|
||||
__ctr_svchax = 1;
|
||||
|
||||
}
|
||||
+75
-77
@@ -5,7 +5,6 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "ctr_debug.h"
|
||||
|
||||
#define CTR_APPMEMALLOC_PTR ((u32*)0x1FF80040)
|
||||
@@ -34,7 +33,7 @@ void __system_allocateHeaps();
|
||||
void __system_initArgv();
|
||||
|
||||
void __ctru_exit(int rc);
|
||||
int __libctru_gtod(struct _reent* ptr, struct timeval* tp, struct timezone* tz);
|
||||
int __libctru_gtod(struct _reent *ptr, struct timeval *tp, struct timezone *tz);
|
||||
void (*__system_retAddr)(void);
|
||||
extern void* __service_ptr;
|
||||
|
||||
@@ -45,25 +44,24 @@ Result __sync_init(void) __attribute__((weak));
|
||||
|
||||
void __attribute__((weak)) __libctru_init(void (*retAddr)(void))
|
||||
{
|
||||
// Store the return address
|
||||
__system_retAddr = envIsHomebrew() ? retAddr : NULL;
|
||||
// Store the return address
|
||||
__system_retAddr = envIsHomebrew() ? retAddr : NULL;
|
||||
|
||||
// Initialize the synchronization subsystem
|
||||
__sync_init();
|
||||
// Initialize the synchronization subsystem
|
||||
__sync_init();
|
||||
|
||||
// Initialize newlib support system calls
|
||||
__system_initSyscalls();
|
||||
// Initialize newlib support system calls
|
||||
__system_initSyscalls();
|
||||
|
||||
// Allocate application and linear heaps
|
||||
__system_allocateHeaps();
|
||||
// Allocate application and linear heaps
|
||||
__system_allocateHeaps();
|
||||
|
||||
// Build argc/argv if present
|
||||
__system_initArgv();
|
||||
// Build argc/argv if present
|
||||
__system_initArgv();
|
||||
|
||||
}
|
||||
void __system_allocateHeaps()
|
||||
{
|
||||
u32 tmp = 0;
|
||||
void __system_allocateHeaps() {
|
||||
u32 tmp=0;
|
||||
|
||||
MemInfo stack_memInfo;
|
||||
PageInfo stack_pageInfo;
|
||||
@@ -74,7 +72,7 @@ void __system_allocateHeaps()
|
||||
|
||||
__stacksize__ += 0xFFF;
|
||||
__stacksize__ &= ~0xFFF;
|
||||
__stack_size_extra = __stacksize__ > stack_memInfo.size ? __stacksize__ - stack_memInfo.size : 0;
|
||||
__stack_size_extra = __stacksize__ > stack_memInfo.size ? __stacksize__ - stack_memInfo.size: 0;
|
||||
__stack_bottom = stack_memInfo.base_addr - __stack_size_extra;
|
||||
|
||||
if (__stack_size_extra)
|
||||
@@ -83,13 +81,13 @@ void __system_allocateHeaps()
|
||||
memset((void*)__stack_bottom, 0xFC, __stack_size_extra);
|
||||
}
|
||||
|
||||
// setup the application heap
|
||||
__heapBase = 0x08000000;
|
||||
// setup the application heap
|
||||
__heapBase = 0x08000000;
|
||||
__heap_size = 0;
|
||||
|
||||
// Allocate the linear heap
|
||||
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
// Set up newlib heap
|
||||
// Allocate the linear heap
|
||||
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
// Set up newlib heap
|
||||
extern char* fake_heap_end;
|
||||
fake_heap_end = (char*)0x13F00000;
|
||||
|
||||
@@ -100,32 +98,32 @@ Result __sync_fini(void) __attribute__((weak));
|
||||
extern char** __system_argv;
|
||||
void __attribute__((noreturn)) __libctru_exit(int rc)
|
||||
{
|
||||
u32 tmp = 0;
|
||||
u32 tmp=0;
|
||||
|
||||
if (__system_argv)
|
||||
if(__system_argv)
|
||||
free(__system_argv);
|
||||
|
||||
// Unmap the linear heap
|
||||
svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0);
|
||||
// Unmap the linear heap
|
||||
svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size, MEMOP_FREE, 0x0);
|
||||
|
||||
// Unmap the application heap
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0);
|
||||
// Unmap the application heap
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, __heap_size, MEMOP_FREE, 0x0);
|
||||
|
||||
if (__stack_size_extra)
|
||||
svcControlMemory(&tmp, __stack_bottom, 0x0, __stack_size_extra, MEMOP_FREE, 0x0);
|
||||
|
||||
// Close some handles
|
||||
envDestroyHandles();
|
||||
// Close some handles
|
||||
envDestroyHandles();
|
||||
|
||||
if (__sync_fini)
|
||||
__sync_fini();
|
||||
__sync_fini();
|
||||
|
||||
// Jump to the loader if it provided a callback
|
||||
if (__system_retAddr)
|
||||
__system_retAddr();
|
||||
// Jump to the loader if it provided a callback
|
||||
if (__system_retAddr)
|
||||
__system_retAddr();
|
||||
|
||||
// Since above did not jump, end this process
|
||||
svcExitProcess();
|
||||
// Since above did not jump, end this process
|
||||
svcExitProcess();
|
||||
}
|
||||
|
||||
#include <3ds/types.h>
|
||||
@@ -137,48 +135,50 @@ int __system_argc;
|
||||
char** __system_argv;
|
||||
extern const char* __system_arglist;
|
||||
|
||||
//extern char* fake_heap_start;
|
||||
extern char* fake_heap_end;
|
||||
|
||||
void __system_initArgv()
|
||||
{
|
||||
int i;
|
||||
struct
|
||||
{
|
||||
u32 argc;
|
||||
char args[];
|
||||
}*arg_struct = (void*)__system_arglist;
|
||||
int i;
|
||||
const char* temp = __system_arglist;
|
||||
|
||||
__system_argc = 0;
|
||||
// Check if the argument list is present
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
if (arg_struct)
|
||||
__system_argc = arg_struct->argc;
|
||||
// Retrieve argc
|
||||
__system_argc = *(u32*)temp;
|
||||
temp += sizeof(u32);
|
||||
|
||||
if (__system_argc)
|
||||
{
|
||||
__system_argv = (char**) malloc((__system_argc + 1) * sizeof(char**));
|
||||
__system_argv[0] = arg_struct->args;
|
||||
for (i = 1; i < __system_argc; i++)
|
||||
__system_argv[i] = __system_argv[i - 1] + strlen(__system_argv[i - 1]) + 1;
|
||||
// Find the end of the argument data
|
||||
for (i = 0; i < __system_argc; i ++)
|
||||
{
|
||||
for (; *temp; temp ++);
|
||||
temp ++;
|
||||
}
|
||||
|
||||
i = __system_argc - 1;
|
||||
__system_argc = 1;
|
||||
while (i)
|
||||
{
|
||||
if(__system_argv[i] && isalnum(__system_argv[i][0])
|
||||
&& strncmp(__system_argv[i], "3dslink:/", 9))
|
||||
{
|
||||
__system_argv[1] = __system_argv[i];
|
||||
__system_argc = 2;
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__system_argc = 1;
|
||||
__system_argv = (char**) malloc(sizeof(char**) * 2);
|
||||
__system_argv[0] = "sdmc:/retroarch/retroarch";
|
||||
}
|
||||
__system_argv[__system_argc] = NULL;
|
||||
// Reserve heap memory for argv data
|
||||
u32 argSize = temp - __system_arglist - sizeof(u32);
|
||||
// __system_argv = (char**)fake_heap_start;
|
||||
// fake_heap_start += sizeof(char**)*(__system_argc + 1);
|
||||
// char* argCopy = fake_heap_start;
|
||||
// fake_heap_start += argSize;
|
||||
|
||||
__system_argv = malloc(sizeof(char**)*(__system_argc + 1) + argSize);
|
||||
char* argCopy = (char*)__system_argv + sizeof(char**)*(__system_argc + 1);
|
||||
|
||||
|
||||
// Fill argv array
|
||||
memcpy(argCopy, &__system_arglist[4], argSize);
|
||||
temp = argCopy;
|
||||
for (i = 0; i < __system_argc; i ++)
|
||||
{
|
||||
__system_argv[i] = (char*)temp;
|
||||
for (; *temp; temp ++);
|
||||
temp ++;
|
||||
}
|
||||
__system_argv[__system_argc] = NULL;
|
||||
}
|
||||
|
||||
void initSystem(void (*retAddr)(void))
|
||||
@@ -195,8 +195,7 @@ void __attribute__((noreturn)) __ctru_exit(int rc)
|
||||
__libctru_exit(rc);
|
||||
}
|
||||
|
||||
typedef union
|
||||
{
|
||||
typedef union{
|
||||
struct
|
||||
{
|
||||
unsigned description : 10;
|
||||
@@ -206,7 +205,7 @@ typedef union
|
||||
unsigned level : 5;
|
||||
};
|
||||
Result val;
|
||||
} ctr_result_value;
|
||||
}ctr_result_value;
|
||||
|
||||
void dump_result_value(Result val)
|
||||
{
|
||||
@@ -226,7 +225,7 @@ void wait_for_input(void)
|
||||
printf("\n\nPress Start.\n\n");
|
||||
fflush(stdout);
|
||||
|
||||
while (aptMainLoop())
|
||||
while(aptMainLoop())
|
||||
{
|
||||
u32 kDown;
|
||||
|
||||
@@ -239,7 +238,6 @@ void wait_for_input(void)
|
||||
|
||||
if (kDown & KEY_SELECT)
|
||||
exit(0);
|
||||
|
||||
#if 0
|
||||
select_pressed = true;
|
||||
#endif
|
||||
@@ -251,7 +249,7 @@ void wait_for_input(void)
|
||||
|
||||
long sysconf(int name)
|
||||
{
|
||||
switch (name)
|
||||
switch(name)
|
||||
{
|
||||
case _SC_NPROCESSORS_ONLN:
|
||||
return 2;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "list_special.h"
|
||||
#include "dir_list_special.h"
|
||||
#include "database_info.h"
|
||||
#include "msg_hash.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <file/archive_file.h>
|
||||
#include <file/file_archive.h>
|
||||
|
||||
#include "libretro-db/libretrodb.h"
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ struct defaults
|
||||
char remap[PATH_MAX_LENGTH];
|
||||
char cache[PATH_MAX_LENGTH];
|
||||
char wallpapers[PATH_MAX_LENGTH];
|
||||
char thumbnails[PATH_MAX_LENGTH];
|
||||
char database[PATH_MAX_LENGTH];
|
||||
char cursor[PATH_MAX_LENGTH];
|
||||
char cheats[PATH_MAX_LENGTH];
|
||||
@@ -68,7 +67,6 @@ struct defaults
|
||||
int out_latency;
|
||||
float video_refresh_rate;
|
||||
bool video_threaded_enable;
|
||||
char menu[PATH_MAX_LENGTH];
|
||||
} settings;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#if defined(HAVE_D3D9)
|
||||
/* Direct3D 9 */
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
#include <d3dx9core.h>
|
||||
|
||||
#define LPDIRECT3D LPDIRECT3D9
|
||||
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
|
||||
|
||||
Vendored
+1
-1
Submodule deps/glslang/glslang updated: 5ace09a75b...f2d8a5c53f.
Vendored
+1
-2
@@ -356,8 +356,7 @@ bool glslang::compile_spirv(const string &source, Stage stage, std::vector<uint3
|
||||
shader.setStrings(&src, 1);
|
||||
|
||||
string msg;
|
||||
auto forbid_include = TShader::ForbidInclude();
|
||||
if (!shader.preprocess(&process.GetResources(), 100, ENoProfile, false, false, EShMsgDefault, &msg, forbid_include))
|
||||
if (!shader.preprocess(&process.GetResources(), 100, ENoProfile, false, false, EShMsgDefault, &msg, TShader::ForbidInclude()))
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg.c_str());
|
||||
return {};
|
||||
|
||||
Vendored
+7499
File diff suppressed because it is too large.
Load diff
Vendored
+357
@@ -0,0 +1,357 @@
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int yydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
ATTRIBUTE = 258,
|
||||
VARYING = 259,
|
||||
CONST = 260,
|
||||
BOOL = 261,
|
||||
FLOAT = 262,
|
||||
DOUBLE = 263,
|
||||
INT = 264,
|
||||
UINT = 265,
|
||||
BREAK = 266,
|
||||
CONTINUE = 267,
|
||||
DO = 268,
|
||||
ELSE = 269,
|
||||
FOR = 270,
|
||||
IF = 271,
|
||||
DISCARD = 272,
|
||||
RETURN = 273,
|
||||
SWITCH = 274,
|
||||
CASE = 275,
|
||||
DEFAULT = 276,
|
||||
SUBROUTINE = 277,
|
||||
BVEC2 = 278,
|
||||
BVEC3 = 279,
|
||||
BVEC4 = 280,
|
||||
IVEC2 = 281,
|
||||
IVEC3 = 282,
|
||||
IVEC4 = 283,
|
||||
UVEC2 = 284,
|
||||
UVEC3 = 285,
|
||||
UVEC4 = 286,
|
||||
VEC2 = 287,
|
||||
VEC3 = 288,
|
||||
VEC4 = 289,
|
||||
MAT2 = 290,
|
||||
MAT3 = 291,
|
||||
MAT4 = 292,
|
||||
CENTROID = 293,
|
||||
IN = 294,
|
||||
OUT = 295,
|
||||
INOUT = 296,
|
||||
UNIFORM = 297,
|
||||
PATCH = 298,
|
||||
SAMPLE = 299,
|
||||
BUFFER = 300,
|
||||
SHARED = 301,
|
||||
COHERENT = 302,
|
||||
VOLATILE = 303,
|
||||
RESTRICT = 304,
|
||||
READONLY = 305,
|
||||
WRITEONLY = 306,
|
||||
DVEC2 = 307,
|
||||
DVEC3 = 308,
|
||||
DVEC4 = 309,
|
||||
DMAT2 = 310,
|
||||
DMAT3 = 311,
|
||||
DMAT4 = 312,
|
||||
NOPERSPECTIVE = 313,
|
||||
FLAT = 314,
|
||||
SMOOTH = 315,
|
||||
LAYOUT = 316,
|
||||
MAT2X2 = 317,
|
||||
MAT2X3 = 318,
|
||||
MAT2X4 = 319,
|
||||
MAT3X2 = 320,
|
||||
MAT3X3 = 321,
|
||||
MAT3X4 = 322,
|
||||
MAT4X2 = 323,
|
||||
MAT4X3 = 324,
|
||||
MAT4X4 = 325,
|
||||
DMAT2X2 = 326,
|
||||
DMAT2X3 = 327,
|
||||
DMAT2X4 = 328,
|
||||
DMAT3X2 = 329,
|
||||
DMAT3X3 = 330,
|
||||
DMAT3X4 = 331,
|
||||
DMAT4X2 = 332,
|
||||
DMAT4X3 = 333,
|
||||
DMAT4X4 = 334,
|
||||
ATOMIC_UINT = 335,
|
||||
SAMPLER1D = 336,
|
||||
SAMPLER2D = 337,
|
||||
SAMPLER3D = 338,
|
||||
SAMPLERCUBE = 339,
|
||||
SAMPLER1DSHADOW = 340,
|
||||
SAMPLER2DSHADOW = 341,
|
||||
SAMPLERCUBESHADOW = 342,
|
||||
SAMPLER1DARRAY = 343,
|
||||
SAMPLER2DARRAY = 344,
|
||||
SAMPLER1DARRAYSHADOW = 345,
|
||||
SAMPLER2DARRAYSHADOW = 346,
|
||||
ISAMPLER1D = 347,
|
||||
ISAMPLER2D = 348,
|
||||
ISAMPLER3D = 349,
|
||||
ISAMPLERCUBE = 350,
|
||||
ISAMPLER1DARRAY = 351,
|
||||
ISAMPLER2DARRAY = 352,
|
||||
USAMPLER1D = 353,
|
||||
USAMPLER2D = 354,
|
||||
USAMPLER3D = 355,
|
||||
USAMPLERCUBE = 356,
|
||||
USAMPLER1DARRAY = 357,
|
||||
USAMPLER2DARRAY = 358,
|
||||
SAMPLER2DRECT = 359,
|
||||
SAMPLER2DRECTSHADOW = 360,
|
||||
ISAMPLER2DRECT = 361,
|
||||
USAMPLER2DRECT = 362,
|
||||
SAMPLERBUFFER = 363,
|
||||
ISAMPLERBUFFER = 364,
|
||||
USAMPLERBUFFER = 365,
|
||||
SAMPLERCUBEARRAY = 366,
|
||||
SAMPLERCUBEARRAYSHADOW = 367,
|
||||
ISAMPLERCUBEARRAY = 368,
|
||||
USAMPLERCUBEARRAY = 369,
|
||||
SAMPLER2DMS = 370,
|
||||
ISAMPLER2DMS = 371,
|
||||
USAMPLER2DMS = 372,
|
||||
SAMPLER2DMSARRAY = 373,
|
||||
ISAMPLER2DMSARRAY = 374,
|
||||
USAMPLER2DMSARRAY = 375,
|
||||
SAMPLEREXTERNALOES = 376,
|
||||
SAMPLER = 377,
|
||||
SAMPLERSHADOW = 378,
|
||||
TEXTURE1D = 379,
|
||||
TEXTURE2D = 380,
|
||||
TEXTURE3D = 381,
|
||||
TEXTURECUBE = 382,
|
||||
TEXTURE1DARRAY = 383,
|
||||
TEXTURE2DARRAY = 384,
|
||||
ITEXTURE1D = 385,
|
||||
ITEXTURE2D = 386,
|
||||
ITEXTURE3D = 387,
|
||||
ITEXTURECUBE = 388,
|
||||
ITEXTURE1DARRAY = 389,
|
||||
ITEXTURE2DARRAY = 390,
|
||||
UTEXTURE1D = 391,
|
||||
UTEXTURE2D = 392,
|
||||
UTEXTURE3D = 393,
|
||||
UTEXTURECUBE = 394,
|
||||
UTEXTURE1DARRAY = 395,
|
||||
UTEXTURE2DARRAY = 396,
|
||||
TEXTURE2DRECT = 397,
|
||||
ITEXTURE2DRECT = 398,
|
||||
UTEXTURE2DRECT = 399,
|
||||
TEXTUREBUFFER = 400,
|
||||
ITEXTUREBUFFER = 401,
|
||||
UTEXTUREBUFFER = 402,
|
||||
TEXTURECUBEARRAY = 403,
|
||||
ITEXTURECUBEARRAY = 404,
|
||||
UTEXTURECUBEARRAY = 405,
|
||||
TEXTURE2DMS = 406,
|
||||
ITEXTURE2DMS = 407,
|
||||
UTEXTURE2DMS = 408,
|
||||
TEXTURE2DMSARRAY = 409,
|
||||
ITEXTURE2DMSARRAY = 410,
|
||||
UTEXTURE2DMSARRAY = 411,
|
||||
SUBPASSINPUT = 412,
|
||||
SUBPASSINPUTMS = 413,
|
||||
ISUBPASSINPUT = 414,
|
||||
ISUBPASSINPUTMS = 415,
|
||||
USUBPASSINPUT = 416,
|
||||
USUBPASSINPUTMS = 417,
|
||||
IMAGE1D = 418,
|
||||
IIMAGE1D = 419,
|
||||
UIMAGE1D = 420,
|
||||
IMAGE2D = 421,
|
||||
IIMAGE2D = 422,
|
||||
UIMAGE2D = 423,
|
||||
IMAGE3D = 424,
|
||||
IIMAGE3D = 425,
|
||||
UIMAGE3D = 426,
|
||||
IMAGE2DRECT = 427,
|
||||
IIMAGE2DRECT = 428,
|
||||
UIMAGE2DRECT = 429,
|
||||
IMAGECUBE = 430,
|
||||
IIMAGECUBE = 431,
|
||||
UIMAGECUBE = 432,
|
||||
IMAGEBUFFER = 433,
|
||||
IIMAGEBUFFER = 434,
|
||||
UIMAGEBUFFER = 435,
|
||||
IMAGE1DARRAY = 436,
|
||||
IIMAGE1DARRAY = 437,
|
||||
UIMAGE1DARRAY = 438,
|
||||
IMAGE2DARRAY = 439,
|
||||
IIMAGE2DARRAY = 440,
|
||||
UIMAGE2DARRAY = 441,
|
||||
IMAGECUBEARRAY = 442,
|
||||
IIMAGECUBEARRAY = 443,
|
||||
UIMAGECUBEARRAY = 444,
|
||||
IMAGE2DMS = 445,
|
||||
IIMAGE2DMS = 446,
|
||||
UIMAGE2DMS = 447,
|
||||
IMAGE2DMSARRAY = 448,
|
||||
IIMAGE2DMSARRAY = 449,
|
||||
UIMAGE2DMSARRAY = 450,
|
||||
STRUCT = 451,
|
||||
VOID = 452,
|
||||
WHILE = 453,
|
||||
IDENTIFIER = 454,
|
||||
TYPE_NAME = 455,
|
||||
FLOATCONSTANT = 456,
|
||||
DOUBLECONSTANT = 457,
|
||||
INTCONSTANT = 458,
|
||||
UINTCONSTANT = 459,
|
||||
BOOLCONSTANT = 460,
|
||||
LEFT_OP = 461,
|
||||
RIGHT_OP = 462,
|
||||
INC_OP = 463,
|
||||
DEC_OP = 464,
|
||||
LE_OP = 465,
|
||||
GE_OP = 466,
|
||||
EQ_OP = 467,
|
||||
NE_OP = 468,
|
||||
AND_OP = 469,
|
||||
OR_OP = 470,
|
||||
XOR_OP = 471,
|
||||
MUL_ASSIGN = 472,
|
||||
DIV_ASSIGN = 473,
|
||||
ADD_ASSIGN = 474,
|
||||
MOD_ASSIGN = 475,
|
||||
LEFT_ASSIGN = 476,
|
||||
RIGHT_ASSIGN = 477,
|
||||
AND_ASSIGN = 478,
|
||||
XOR_ASSIGN = 479,
|
||||
OR_ASSIGN = 480,
|
||||
SUB_ASSIGN = 481,
|
||||
LEFT_PAREN = 482,
|
||||
RIGHT_PAREN = 483,
|
||||
LEFT_BRACKET = 484,
|
||||
RIGHT_BRACKET = 485,
|
||||
LEFT_BRACE = 486,
|
||||
RIGHT_BRACE = 487,
|
||||
DOT = 488,
|
||||
COMMA = 489,
|
||||
COLON = 490,
|
||||
EQUAL = 491,
|
||||
SEMICOLON = 492,
|
||||
BANG = 493,
|
||||
DASH = 494,
|
||||
TILDE = 495,
|
||||
PLUS = 496,
|
||||
STAR = 497,
|
||||
SLASH = 498,
|
||||
PERCENT = 499,
|
||||
LEFT_ANGLE = 500,
|
||||
RIGHT_ANGLE = 501,
|
||||
VERTICAL_BAR = 502,
|
||||
CARET = 503,
|
||||
AMPERSAND = 504,
|
||||
QUESTION = 505,
|
||||
INVARIANT = 506,
|
||||
PRECISE = 507,
|
||||
HIGH_PRECISION = 508,
|
||||
MEDIUM_PRECISION = 509,
|
||||
LOW_PRECISION = 510,
|
||||
PRECISION = 511,
|
||||
PACKED = 512,
|
||||
RESOURCE = 513,
|
||||
SUPERP = 514
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 66 "glslang/glslang/MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
union {
|
||||
glslang::TString *string;
|
||||
int i;
|
||||
unsigned int u;
|
||||
bool b;
|
||||
double d;
|
||||
};
|
||||
glslang::TSymbol* symbol;
|
||||
} lex;
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
glslang::TOperator op;
|
||||
union {
|
||||
TIntermNode* intermNode;
|
||||
glslang::TIntermNodePair nodePair;
|
||||
glslang::TIntermTyped* intermTypedNode;
|
||||
};
|
||||
union {
|
||||
glslang::TPublicType type;
|
||||
glslang::TFunction* function;
|
||||
glslang::TParameter param;
|
||||
glslang::TTypeLoc typeLine;
|
||||
glslang::TTypeList* typeList;
|
||||
glslang::TArraySizes* arraySizes;
|
||||
glslang::TIdentifierList* identifierList;
|
||||
};
|
||||
} interm;
|
||||
|
||||
#line 346 "glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int yyparse (glslang::TParseContext* pParseContext);
|
||||
|
||||
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
bison --defines=glslang_tab.cpp.h -o glslang_tab.cpp -t glslang/glslang/MachineIndependent/glslang.y
|
||||
Vendored
-1
Submodule deps/spir2cross deleted from 0ae2bcc3d0.
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
CONTRIBUTING
|
||||
============
|
||||
## Submitting changes
|
||||
Please send a GitHub Pull Request with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).
|
||||
|
||||
## Features
|
||||
If you have an idea for new features just [open an issue](https://github.com/vurtun/zahnrad/issues) with your suggestion.
|
||||
* Find and correct spelling mistakes
|
||||
* Add (insert your favorite platform or render backend here) demo implementation (some possibilities: DirectX 9/DirectX 10/DirectX 11 and win32 with OpenGL)
|
||||
* Add clipboard user callbacks back into all demos
|
||||
* Add additional widgets [some possible widgets](http://doc.qt.io/qt-5/widget-classes.html#the-widget-classes)
|
||||
* Add support for multiple pointers for touch input devices (probably requires to rewrite mouse handling in `struct zr_input`)
|
||||
* Extend xlib demo to support image drawing with arbitrary image width and height
|
||||
* Change cursor in `zr_widget_edit_box` and `zr_widget_edit_field` to thin standard cursor version used in editors
|
||||
* Extend piemenu to support submenus (another ring around the first ring or something like [this:](http://gdj.gdj.netdna-cdn.com/wp-content/uploads/2013/02/ui+concepts+13.gif)) and turn it into a default library widget.
|
||||
* Add label describing the currently active piemenu entry
|
||||
* Maybe write a piemenu text only version for platforms that do not want or can use images
|
||||
* Rewrite the chart API to support a better range of charts (maybe take notes from Javascript chart frameworks)
|
||||
* Create an API to allow scaling between groups (maybe extend and convert the demo example)
|
||||
* Add multiple Tab support (maybe use `zr_group` and add a header)
|
||||
* Come up with a better way to provide and create widget and window styles
|
||||
* Add tables with scaleable column width
|
||||
* Extend context to not only support overlapping windows but tiled windows as well
|
||||
|
||||
## Bugs
|
||||
* Seperator widget is currently bugged and does not work as intended
|
||||
* Text handling is still a little bit janky and probably needs to be further tested and polished
|
||||
* `zr_edit_buffer` with multiline flag is bugged for '\n', need to differentiate between visible and non-visible characters
|
||||
|
||||
## Coding conventions
|
||||
* Only use C89 (ANSI C)
|
||||
* Do not use any compiler specific extensions
|
||||
* For indent use four spaces
|
||||
* Do not typedef structs, unions and enums
|
||||
* Variable, object and function names should always be lowercase and use underscores instead of camel case
|
||||
* Whitespace after for, while, if, do and switch
|
||||
* Always use parentheses if you use the sizeof operator (e.g: sizeof(struct zr_context) and not sizeof struct zr_context)
|
||||
* Beginning braces on the new line for functions and on the same line otherwise.
|
||||
* If function becomes to big either a.) create a subblock inside the function and comment or b.) write a functional function
|
||||
* Only use fixed size types (zr_uint, zr_size, ...) if you really need to and use basic types otherwise
|
||||
* Do not include any header files in either zahnrad.h or zahnrad.c
|
||||
* Do not add dependencies rather write your own version if possible
|
||||
* Write correct commit messages: (http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
Copyright (c) 2016 Micha Mettke
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
# Zahnrad
|
||||
[](https://scan.coverity.com/projects/5863)
|
||||
|
||||
This is a minimal state immediate mode graphical user interface toolkit
|
||||
written in ANSI C and licensed under zlib. It was designed as a simple embeddable user interface for
|
||||
application and does not have any direct dependencies,
|
||||
a default renderbackend or OS window and input handling but instead provides a very modular
|
||||
library approach by using simple input state for input and draw
|
||||
commands describing primitive shapes as output. So instead of providing a
|
||||
layered library that tries to abstract over a number of platform and
|
||||
render backends it only focuses on the actual UI.
|
||||
|
||||
## Features
|
||||
- Immediate mode graphical user interface toolkit
|
||||
- Written in C89 (ANSI C)
|
||||
- Small codebase (~9kLOC)
|
||||
- Focus on portability, efficiency and simplicity
|
||||
- No dependencies (not even the standard library)
|
||||
- No global or hidden state
|
||||
- Configurable style and colors
|
||||
- UTF-8 support
|
||||
|
||||
## Optional
|
||||
- Vertex buffer output
|
||||
- Font handling
|
||||
|
||||
## Building
|
||||
The library is self-contained within four different files that only have to be
|
||||
copied and compiled into your application. Files zahnrad.c and zahnrad.h make up
|
||||
the core of the library, while stb_rect_pack.h and stb_truetype.h are
|
||||
for a optional font handling implementation and can be removed if not needed.
|
||||
- zahnrad.c
|
||||
- zahnrad.h
|
||||
- stb_rect_pack.h (optional)
|
||||
- stb_truetype.h (optional)
|
||||
|
||||
There are no dependencies or a particular building process required. You just have
|
||||
to compile the .c file and #include zahnrad.h into your project. To actually
|
||||
run you have to provide the input state, configuration style and memory
|
||||
for draw commands to the library. After the GUI was executed all draw commands
|
||||
have to be either executed or optionally converted into a vertex buffer to
|
||||
draw the GUI.
|
||||
|
||||
## Gallery
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Example
|
||||
```c
|
||||
/* init gui state */
|
||||
struct zr_context ctx;
|
||||
zr_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
|
||||
|
||||
enum {EASY, HARD};
|
||||
int op = EASY;
|
||||
float value = 0.6f;
|
||||
int i = 20;
|
||||
|
||||
struct zr_layout layout;
|
||||
zr_begin(&ctx, &layout, "Show", zr_rect(50, 50, 220, 220),
|
||||
ZR_WINDOW_BORDER|ZR_WINDOW_MOVEABLE|ZR_WINDOW_CLOSEABLE);
|
||||
{
|
||||
/* fixed widget pixel width */
|
||||
zr_layout_row_static(&ctx, 30, 80, 1);
|
||||
if (zr_button_text(&ctx, "button", ZR_BUTTON_DEFAULT)) {
|
||||
/* event handling */
|
||||
}
|
||||
|
||||
/* fixed widget window ratio width */
|
||||
zr_layout_row_dynamic(&ctx, 30, 2);
|
||||
if (zr_option(&ctx, "easy", op == EASY)) op = EASY;
|
||||
if (zr_option(&ctx, "hard", op == HARD)) op = HARD;
|
||||
|
||||
/* custom widget pixel width */
|
||||
zr_layout_row_begin(&ctx, ZR_STATIC, 30, 2);
|
||||
{
|
||||
zr_layout_row_push(&ctx, 50);
|
||||
zr_label(&ctx, "Volume:", ZR_TEXT_LEFT);
|
||||
zr_layout_row_push(&ctx, 110);
|
||||
zr_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
|
||||
}
|
||||
zr_layout_row_end(&ctx);
|
||||
}
|
||||
zr_end(ctx);
|
||||
```
|
||||

|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
-19498
File diff suppressed because it is too large.
Load diff
Vendored
+545
@@ -0,0 +1,545 @@
|
||||
/* stb_rect_pack.h - v0.05 - public domain - rectangle packing */
|
||||
/* Sean Barrett 2014 */
|
||||
/* */
|
||||
/* Useful for e.g. packing rectangular textures into an atlas. */
|
||||
/* Does not do rotation. */
|
||||
/* */
|
||||
/* Not necessarily the awesomest packing method, but better than */
|
||||
/* the totally naive one in stb_truetype (which is primarily what */
|
||||
/* this is meant to replace). */
|
||||
/* */
|
||||
/* Has only had a few tests run, may have issues. */
|
||||
/* */
|
||||
/* More docs to come. */
|
||||
/* */
|
||||
/* No memory allocations; uses qsort() and assert() from stdlib. */
|
||||
/* */
|
||||
/* This library currently uses the Skyline Bottom-Left algorithm. */
|
||||
/* */
|
||||
/* Please note: better rectangle packers are welcome! Please */
|
||||
/* implement them to the same API, but with a different init */
|
||||
/* function. */
|
||||
/* */
|
||||
/* Version history: */
|
||||
/* */
|
||||
/* 0.05: added STBRP_ASSERT to allow replacing assert */
|
||||
/* 0.04: fixed minor bug in STBRP_LARGE_RECTS support */
|
||||
/* 0.01: initial release */
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////// */
|
||||
/* */
|
||||
/* INCLUDE SECTION */
|
||||
#ifndef STB_INCLUDE_STB_RECT_PACK_H
|
||||
#define STB_INCLUDE_STB_RECT_PACK_H
|
||||
|
||||
#define STB_RECT_PACK_VERSION 1
|
||||
|
||||
#ifdef STBRP_STATIC
|
||||
#define STBRP_DEF static
|
||||
#else
|
||||
#define STBRP_DEF extern
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct stbrp_context stbrp_context;
|
||||
typedef struct stbrp_node stbrp_node;
|
||||
typedef struct stbrp_rect stbrp_rect;
|
||||
|
||||
#ifdef STBRP_LARGE_RECTS
|
||||
typedef int stbrp_coord;
|
||||
#else
|
||||
typedef unsigned short stbrp_coord;
|
||||
#endif
|
||||
|
||||
STBRP_DEF void stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
|
||||
/* Assign packed locations to rectangles. The rectangles are of type */
|
||||
/* 'stbrp_rect' defined below, stored in the array 'rects', and there */
|
||||
/* are 'num_rects' many of them. */
|
||||
/* */
|
||||
/* Rectangles which are successfully packed have the 'was_packed' flag */
|
||||
/* set to a non-zero value and 'x' and 'y' store the minimum location */
|
||||
/* on each axis (i.e. bottom-left in cartesian coordinates, top-left */
|
||||
/* if you imagine y increasing downwards). Rectangles which do not fit */
|
||||
/* have the 'was_packed' flag set to 0. */
|
||||
/* */
|
||||
/* You should not try to access the 'rects' array from another thread */
|
||||
/* while this function is running, as the function temporarily reorders */
|
||||
/* the array while it executes. */
|
||||
/* */
|
||||
/* To pack into another rectangle, you need to call stbrp_init_target */
|
||||
/* again. To continue packing into the same rectangle, you can call */
|
||||
/* this function again. Calling this multiple times with multiple rect */
|
||||
/* arrays will probably produce worse packing results than calling it */
|
||||
/* a single time with the full rectangle array, but the option is */
|
||||
/* available. */
|
||||
|
||||
struct stbrp_rect
|
||||
{
|
||||
/* reserved for your use: */
|
||||
int id;
|
||||
|
||||
/* input: */
|
||||
stbrp_coord w, h;
|
||||
|
||||
/* output: */
|
||||
stbrp_coord x, y;
|
||||
int was_packed; /* non-zero if valid packing */
|
||||
|
||||
}; /* 16 bytes, nominally */
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);
|
||||
/* Initialize a rectangle packer to: */
|
||||
/* pack a rectangle that is 'width' by 'height' in dimensions */
|
||||
/* using temporary storage provided by the array 'nodes', which is 'num_nodes' long */
|
||||
/* */
|
||||
/* You must call this function every time you start packing into a new target. */
|
||||
/* */
|
||||
/* There is no "shutdown" function. The 'nodes' memory must stay valid for */
|
||||
/* the following stbrp_pack_rects() call (or calls), but can be freed after */
|
||||
/* the call (or calls) finish. */
|
||||
/* */
|
||||
/* Note: to guarantee best results, either: */
|
||||
/* 1. make sure 'num_nodes' >= 'width' */
|
||||
/* or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' */
|
||||
/* */
|
||||
/* If you don't do either of the above things, widths will be quantized to multiples */
|
||||
/* of small integers to guarantee the algorithm doesn't run out of temporary storage. */
|
||||
/* */
|
||||
/* If you do #2, then the non-quantized algorithm will be used, but the algorithm */
|
||||
/* may run out of temporary storage and be unable to pack some rectangles. */
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem);
|
||||
/* Optionally call this function after init but before doing any packing to */
|
||||
/* change the handling of the out-of-temp-memory scenario, described above. */
|
||||
/* If you call init again, this will be reset to the default (false). */
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic);
|
||||
/* Optionally select which packing heuristic the library should use. Different */
|
||||
/* heuristics will produce better/worse results for different data sets. */
|
||||
/* If you call init again, this will be reset to the default. */
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP_HEURISTIC_Skyline_default=0,
|
||||
STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,
|
||||
STBRP_HEURISTIC_Skyline_BF_sortHeight
|
||||
};
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////// */
|
||||
/* */
|
||||
/* the details of the following structures don't matter to you, but they must */
|
||||
/* be visible so you can handle the memory allocations for them */
|
||||
|
||||
struct stbrp_node
|
||||
{
|
||||
stbrp_coord x,y;
|
||||
stbrp_node *next;
|
||||
};
|
||||
|
||||
struct stbrp_context
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int align;
|
||||
int init_mode;
|
||||
int heuristic;
|
||||
int num_nodes;
|
||||
stbrp_node *active_head;
|
||||
stbrp_node *free_head;
|
||||
stbrp_node extra[2]; /* we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////// */
|
||||
/* */
|
||||
/* IMPLEMENTATION SECTION */
|
||||
/* */
|
||||
|
||||
#ifdef STB_RECT_PACK_IMPLEMENTATION
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef STBRP_ASSERT
|
||||
#include <assert.h>
|
||||
#define STBRP_ASSERT assert
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP__INIT_skyline = 1
|
||||
};
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
|
||||
{
|
||||
switch (context->init_mode) {
|
||||
case STBRP__INIT_skyline:
|
||||
STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);
|
||||
context->heuristic = heuristic;
|
||||
break;
|
||||
default:
|
||||
STBRP_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)
|
||||
{
|
||||
if (allow_out_of_mem)
|
||||
/* if it's ok to run out of memory, then don't bother aligning them; */
|
||||
/* this gives better packing, but may fail due to OOM (even though */
|
||||
/* the rectangles easily fit). @TODO a smarter approach would be to only */
|
||||
/* quantize once we've hit OOM, then we could get rid of this parameter. */
|
||||
context->align = 1;
|
||||
else {
|
||||
/* if it's not ok to run out of memory, then quantize the widths */
|
||||
/* so that num_nodes is always enough nodes. */
|
||||
/* */
|
||||
/* I.e. num_nodes * align >= width */
|
||||
/* align >= width / num_nodes */
|
||||
/* align = ceil(width/num_nodes) */
|
||||
|
||||
context->align = (context->width + context->num_nodes-1) / context->num_nodes;
|
||||
}
|
||||
}
|
||||
|
||||
STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes)
|
||||
{
|
||||
int i;
|
||||
#ifndef STBRP_LARGE_RECTS
|
||||
STBRP_ASSERT(width <= 0xffff && height <= 0xffff);
|
||||
#endif
|
||||
|
||||
for (i=0; i < num_nodes-1; ++i)
|
||||
nodes[i].next = &nodes[i+1];
|
||||
nodes[i].next = NULL;
|
||||
context->init_mode = STBRP__INIT_skyline;
|
||||
context->heuristic = STBRP_HEURISTIC_Skyline_default;
|
||||
context->free_head = &nodes[0];
|
||||
context->active_head = &context->extra[0];
|
||||
context->width = width;
|
||||
context->height = height;
|
||||
context->num_nodes = num_nodes;
|
||||
stbrp_setup_allow_out_of_mem(context, 0);
|
||||
|
||||
/* node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) */
|
||||
context->extra[0].x = 0;
|
||||
context->extra[0].y = 0;
|
||||
context->extra[0].next = &context->extra[1];
|
||||
context->extra[1].x = (stbrp_coord) width;
|
||||
#ifdef STBRP_LARGE_RECTS
|
||||
context->extra[1].y = (1<<30);
|
||||
#else
|
||||
context->extra[1].y = 65535;
|
||||
#endif
|
||||
context->extra[1].next = NULL;
|
||||
}
|
||||
|
||||
/* find minimum y position if it starts at x1 */
|
||||
static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)
|
||||
{
|
||||
stbrp_node *node = first;
|
||||
int x1 = x0 + width;
|
||||
int min_y, visited_width, waste_area;
|
||||
STBRP_ASSERT(first->x <= x0);
|
||||
(void)c;
|
||||
|
||||
#if 0
|
||||
/* skip in case we're past the node */
|
||||
while (node->next->x <= x0)
|
||||
++node;
|
||||
#else
|
||||
STBRP_ASSERT(node->next->x > x0); /* we ended up handling this in the caller for efficiency */
|
||||
#endif
|
||||
|
||||
STBRP_ASSERT(node->x <= x0);
|
||||
|
||||
min_y = 0;
|
||||
waste_area = 0;
|
||||
visited_width = 0;
|
||||
while (node->x < x1) {
|
||||
if (node->y > min_y) {
|
||||
/* raise min_y higher. */
|
||||
/* we've accounted for all waste up to min_y, */
|
||||
/* but we'll now add more waste for everything we've visted */
|
||||
waste_area += visited_width * (node->y - min_y);
|
||||
min_y = node->y;
|
||||
/* the first time through, visited_width might be reduced */
|
||||
if (node->x < x0)
|
||||
visited_width += node->next->x - x0;
|
||||
else
|
||||
visited_width += node->next->x - node->x;
|
||||
} else {
|
||||
/* add waste area */
|
||||
int under_width = node->next->x - node->x;
|
||||
if (under_width + visited_width > width)
|
||||
under_width = width - visited_width;
|
||||
waste_area += under_width * (min_y - node->y);
|
||||
visited_width += under_width;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
*pwaste = waste_area;
|
||||
return min_y;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x,y;
|
||||
stbrp_node **prev_link;
|
||||
} stbrp__findresult;
|
||||
|
||||
static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height)
|
||||
{
|
||||
int best_waste = (1<<30), best_x, best_y = (1 << 30);
|
||||
stbrp__findresult fr;
|
||||
stbrp_node **prev, *node, *tail, **best = NULL;
|
||||
|
||||
/* align to multiple of c->align */
|
||||
width = (width + c->align - 1);
|
||||
width -= width % c->align;
|
||||
STBRP_ASSERT(width % c->align == 0);
|
||||
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
while (node->x + width <= c->width) {
|
||||
int y,waste;
|
||||
y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { /* actually just want to test BL */
|
||||
/* bottom left */
|
||||
if (y < best_y) {
|
||||
best_y = y;
|
||||
best = prev;
|
||||
}
|
||||
} else {
|
||||
/* best-fit */
|
||||
if (y + height <= c->height) {
|
||||
/* can only use it if it first vertically */
|
||||
if (y < best_y || (y == best_y && waste < best_waste)) {
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
best_x = (best == NULL) ? 0 : (*best)->x;
|
||||
|
||||
/* if doing best-fit (BF), we also have to try aligning right edge to each node position */
|
||||
/* */
|
||||
/* e.g, if fitting */
|
||||
/* */
|
||||
/* ____________________ */
|
||||
/* |____________________| */
|
||||
/* */
|
||||
/* into */
|
||||
/* */
|
||||
/* | | */
|
||||
/* | ____________| */
|
||||
/* |____________| */
|
||||
/* */
|
||||
/* then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned */
|
||||
/* */
|
||||
/* This makes BF take about 2x the time */
|
||||
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {
|
||||
tail = c->active_head;
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
/* find first node that's admissible */
|
||||
while (tail->x < width)
|
||||
tail = tail->next;
|
||||
while (tail) {
|
||||
int xpos = tail->x - width;
|
||||
int y,waste;
|
||||
STBRP_ASSERT(xpos >= 0);
|
||||
/* find the left position that matches this */
|
||||
while (node->next->x <= xpos) {
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);
|
||||
y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);
|
||||
if (y + height < c->height) {
|
||||
if (y <= best_y) {
|
||||
if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {
|
||||
best_x = xpos;
|
||||
STBRP_ASSERT(y <= best_y);
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
tail = tail->next;
|
||||
}
|
||||
}
|
||||
|
||||
fr.prev_link = best;
|
||||
fr.x = best_x;
|
||||
fr.y = best_y;
|
||||
return fr;
|
||||
}
|
||||
|
||||
static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)
|
||||
{
|
||||
/* find best position according to heuristic */
|
||||
stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);
|
||||
stbrp_node *node, *cur;
|
||||
|
||||
/* bail if: */
|
||||
/* 1. it failed */
|
||||
/* 2. the best node doesn't fit (we don't always check this) */
|
||||
/* 3. we're out of memory */
|
||||
if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {
|
||||
res.prev_link = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* on success, create new node */
|
||||
node = context->free_head;
|
||||
node->x = (stbrp_coord) res.x;
|
||||
node->y = (stbrp_coord) (res.y + height);
|
||||
|
||||
context->free_head = node->next;
|
||||
|
||||
/* insert the new node into the right starting point, and */
|
||||
/* let 'cur' point to the remaining nodes needing to be */
|
||||
/* stiched back in */
|
||||
|
||||
cur = *res.prev_link;
|
||||
if (cur->x < res.x) {
|
||||
/* preserve the existing one, so start testing with the next one */
|
||||
stbrp_node *next = cur->next;
|
||||
cur->next = node;
|
||||
cur = next;
|
||||
} else {
|
||||
*res.prev_link = node;
|
||||
}
|
||||
|
||||
/* from here, traverse cur and free the nodes, until we get to one */
|
||||
/* that shouldn't be freed */
|
||||
while (cur->next && cur->next->x <= res.x + width) {
|
||||
stbrp_node *next = cur->next;
|
||||
/* move the current node to the free list */
|
||||
cur->next = context->free_head;
|
||||
context->free_head = cur;
|
||||
cur = next;
|
||||
}
|
||||
|
||||
/* stitch the list back in */
|
||||
node->next = cur;
|
||||
|
||||
if (cur->x < res.x + width)
|
||||
cur->x = (stbrp_coord) (res.x + width);
|
||||
|
||||
#ifdef _DEBUG
|
||||
cur = context->active_head;
|
||||
while (cur->x < context->width) {
|
||||
STBRP_ASSERT(cur->x < cur->next->x);
|
||||
cur = cur->next;
|
||||
}
|
||||
STBRP_ASSERT(cur->next == NULL);
|
||||
|
||||
{
|
||||
stbrp_node *L1 = NULL, *L2 = NULL;
|
||||
int count=0;
|
||||
cur = context->active_head;
|
||||
while (cur) {
|
||||
L1 = cur;
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
cur = context->free_head;
|
||||
while (cur) {
|
||||
L2 = cur;
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
STBRP_ASSERT(count == context->num_nodes+2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int rect_height_compare(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
if (p->h > q->h)
|
||||
return -1;
|
||||
if (p->h < q->h)
|
||||
return 1;
|
||||
return (p->w > q->w) ? -1 : (p->w < q->w);
|
||||
}
|
||||
|
||||
static int rect_width_compare(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
if (p->w > q->w)
|
||||
return -1;
|
||||
if (p->w < q->w)
|
||||
return 1;
|
||||
return (p->h > q->h) ? -1 : (p->h < q->h);
|
||||
}
|
||||
|
||||
static int rect_original_order(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);
|
||||
}
|
||||
|
||||
#ifdef STBRP_LARGE_RECTS
|
||||
#define STBRP__MAXVAL 0xffffffff
|
||||
#else
|
||||
#define STBRP__MAXVAL 0xffff
|
||||
#endif
|
||||
|
||||
STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* we use the 'was_packed' field internally to allow sorting/unsorting */
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
rects[i].was_packed = i;
|
||||
#ifndef STBRP_LARGE_RECTS
|
||||
STBRP_ASSERT(rects[i].w <= 0xffff && rects[i].h <= 0xffff);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* sort according to heuristic */
|
||||
qsort(rects, (size_t)num_rects, sizeof(rects[0]), rect_height_compare);
|
||||
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
|
||||
if (fr.prev_link) {
|
||||
rects[i].x = (stbrp_coord) fr.x;
|
||||
rects[i].y = (stbrp_coord) fr.y;
|
||||
} else {
|
||||
rects[i].x = rects[i].y = STBRP__MAXVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* unsort */
|
||||
qsort(rects, (size_t)num_rects, sizeof(rects[0]), rect_original_order);
|
||||
|
||||
/* set was_packed flags */
|
||||
for (i=0; i < num_rects; ++i)
|
||||
rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
|
||||
}
|
||||
#endif
|
||||
Vendored
+3218
File diff suppressed because it is too large.
Load diff
Vendored
+14266
File diff suppressed because it is too large.
Load diff
Vendored
+2017
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,78 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <file/dir_list.h>
|
||||
|
||||
#include "dir_list_special.h"
|
||||
#include "frontend/frontend_driver.h"
|
||||
#include "configuration.h"
|
||||
#include "core_info.h"
|
||||
|
||||
struct string_list *dir_list_new_special(const char *input_dir,
|
||||
enum dir_list_type type, const char *filter)
|
||||
{
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
const char *dir = NULL;
|
||||
const char *exts = NULL;
|
||||
bool include_dirs = false;
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)input_dir;
|
||||
(void)settings;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DIR_LIST_CORES:
|
||||
dir = settings->libretro_directory;
|
||||
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
return NULL;
|
||||
|
||||
exts = ext_name;
|
||||
break;
|
||||
case DIR_LIST_CORE_INFO:
|
||||
{
|
||||
core_info_list_t *list = NULL;
|
||||
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
|
||||
|
||||
dir = input_dir;
|
||||
exts = list->all_ext;
|
||||
}
|
||||
break;
|
||||
case DIR_LIST_SHADERS:
|
||||
dir = settings->video.shader_dir;
|
||||
exts = "cg|cgp|glsl|glslp|slang|slangp";
|
||||
break;
|
||||
case DIR_LIST_COLLECTIONS:
|
||||
dir = settings->playlist_directory;
|
||||
exts = "lpl";
|
||||
break;
|
||||
case DIR_LIST_DATABASES:
|
||||
dir = settings->content_database;
|
||||
exts = "rdb";
|
||||
break;
|
||||
case DIR_LIST_PLAIN:
|
||||
dir = input_dir;
|
||||
exts = filter;
|
||||
break;
|
||||
case DIR_LIST_NONE:
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dir_list_new(dir, exts, include_dirs, type == DIR_LIST_CORE_INFO);
|
||||
}
|
||||
@@ -14,14 +14,25 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _FILE_PATH_SPECIAL_H
|
||||
#define _FILE_PATH_SPECIAL_H
|
||||
#ifndef _DIR_LIST_SPECIAL_H
|
||||
#define _DIR_LIST_SPECIAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <string/string_list.h>
|
||||
|
||||
bool fill_pathname_application_data(char *s, size_t len);
|
||||
enum dir_list_type
|
||||
{
|
||||
DIR_LIST_NONE = 0,
|
||||
DIR_LIST_CORES,
|
||||
DIR_LIST_CORE_INFO,
|
||||
DIR_LIST_DATABASES,
|
||||
DIR_LIST_COLLECTIONS,
|
||||
DIR_LIST_PLAIN,
|
||||
DIR_LIST_SHADERS
|
||||
};
|
||||
|
||||
struct string_list *dir_list_new_special(const char *input_dir,
|
||||
enum dir_list_type type, const char *filter);
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
RARCH_VERSION=1.3.4
|
||||
RARCH_VERSION=1.3.0
|
||||
PLATFORM=$1
|
||||
SALAMANDER=no
|
||||
MAKEFILE_GRIFFIN=no
|
||||
|
||||
@@ -288,6 +288,10 @@ static void menu_update_libretro_info(void)
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
retro_get_system_info(info);
|
||||
#endif
|
||||
|
||||
event_cmd_ctl(EVENT_CMD_CORE_INFO_INIT, NULL);
|
||||
event_cmd_ctl(EVENT_CMD_LOAD_CORE_PERSIST, NULL);
|
||||
}
|
||||
@@ -338,10 +342,7 @@ static void init_drivers(int flags)
|
||||
}
|
||||
|
||||
if (flags & DRIVER_AUDIO)
|
||||
{
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_INIT, NULL);
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_DEVICES_LIST_NEW, NULL);
|
||||
}
|
||||
|
||||
/* Only initialize camera driver if we're ever going to use it. */
|
||||
if ((flags & DRIVER_CAMERA) && camera_driver_ctl(RARCH_CAMERA_CTL_IS_ACTIVE, NULL))
|
||||
@@ -446,11 +447,6 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
||||
uninit_drivers(*flags);
|
||||
}
|
||||
break;
|
||||
case RARCH_DRIVER_CTL_UNINIT_ALL:
|
||||
{
|
||||
int flags = DRIVERS_CMD_ALL;
|
||||
return driver_ctl(RARCH_DRIVER_CTL_UNINIT, &flags);
|
||||
}
|
||||
case RARCH_DRIVER_CTL_INIT:
|
||||
{
|
||||
int *flags = (int*)data;
|
||||
@@ -459,11 +455,6 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
|
||||
init_drivers(*flags);
|
||||
}
|
||||
break;
|
||||
case RARCH_DRIVER_CTL_INIT_ALL:
|
||||
{
|
||||
int flags = DRIVERS_CMD_ALL;
|
||||
return driver_ctl(RARCH_DRIVER_CTL_INIT, &flags);
|
||||
}
|
||||
case RARCH_DRIVER_CTL_INIT_PRE:
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_FIND_DRIVER, NULL);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_FIND_DRIVER, NULL);
|
||||
|
||||
@@ -28,12 +28,61 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "input/input_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AUDIO_CHUNK_SIZE_BLOCKING 512
|
||||
|
||||
/* So we don't get complete line-noise when fast-forwarding audio. */
|
||||
#define AUDIO_CHUNK_SIZE_NONBLOCKING 2048
|
||||
|
||||
#define AUDIO_MAX_RATIO 16
|
||||
|
||||
/* Specialized _MOUSE that targets the full screen regardless of viewport.
|
||||
*/
|
||||
#define RARCH_DEVICE_MOUSE_SCREEN (RETRO_DEVICE_MOUSE | 0x10000)
|
||||
|
||||
/* Specialized _POINTER that targets the full screen regardless of viewport.
|
||||
* Should not be used by a libretro implementation as coordinates returned
|
||||
* make no sense.
|
||||
*
|
||||
* It is only used internally for overlays. */
|
||||
#define RARCH_DEVICE_POINTER_SCREEN (RETRO_DEVICE_POINTER | 0x10000)
|
||||
|
||||
#define RARCH_DEVICE_ID_POINTER_BACK (RETRO_DEVICE_ID_POINTER_PRESSED | 0x10000)
|
||||
|
||||
/* libretro has 16 buttons from 0-15 (libretro.h)
|
||||
* Analog binds use RETRO_DEVICE_ANALOG, but we follow the same scheme
|
||||
* internally in RetroArch for simplicity, so they are mapped into [16, 23].
|
||||
*/
|
||||
#define RARCH_FIRST_CUSTOM_BIND 16
|
||||
#define RARCH_FIRST_META_KEY RARCH_CUSTOM_BIND_LIST_END
|
||||
|
||||
#define AXIS_NEG(x) (((uint32_t)(x) << 16) | UINT16_C(0xFFFF))
|
||||
#define AXIS_POS(x) ((uint32_t)(x) | UINT32_C(0xFFFF0000))
|
||||
#define AXIS_NONE UINT32_C(0xFFFFFFFF)
|
||||
#define AXIS_DIR_NONE UINT16_C(0xFFFF)
|
||||
|
||||
#define AXIS_NEG_GET(x) (((uint32_t)(x) >> 16) & UINT16_C(0xFFFF))
|
||||
#define AXIS_POS_GET(x) ((uint32_t)(x) & UINT16_C(0xFFFF))
|
||||
|
||||
#define NO_BTN UINT16_C(0xFFFF)
|
||||
|
||||
#define HAT_UP_SHIFT 15
|
||||
#define HAT_DOWN_SHIFT 14
|
||||
#define HAT_LEFT_SHIFT 13
|
||||
#define HAT_RIGHT_SHIFT 12
|
||||
#define HAT_UP_MASK (1 << HAT_UP_SHIFT)
|
||||
#define HAT_DOWN_MASK (1 << HAT_DOWN_SHIFT)
|
||||
#define HAT_LEFT_MASK (1 << HAT_LEFT_SHIFT)
|
||||
#define HAT_RIGHT_MASK (1 << HAT_RIGHT_SHIFT)
|
||||
#define HAT_MAP(x, hat) ((x & ((1 << 12) - 1)) | hat)
|
||||
|
||||
#define HAT_MASK (HAT_UP_MASK | HAT_DOWN_MASK | HAT_LEFT_MASK | HAT_RIGHT_MASK)
|
||||
#define GET_HAT_DIR(x) (x & HAT_MASK)
|
||||
#define GET_HAT(x) (x & (~HAT_MASK))
|
||||
|
||||
#define DRIVERS_CMD_ALL \
|
||||
( DRIVER_AUDIO \
|
||||
| DRIVER_VIDEO \
|
||||
@@ -103,6 +152,14 @@ enum
|
||||
RARCH_BIND_LIST_END_NULL
|
||||
};
|
||||
|
||||
enum analog_dpad_mode
|
||||
{
|
||||
ANALOG_DPAD_NONE = 0,
|
||||
ANALOG_DPAD_LSTICK,
|
||||
ANALOG_DPAD_RSTICK,
|
||||
ANALOG_DPAD_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DRIVER_AUDIO = 1 << 0,
|
||||
@@ -122,15 +179,10 @@ enum driver_ctl_state
|
||||
* @data is a bitmask which determines
|
||||
* which drivers get deinitialized. */
|
||||
RARCH_DRIVER_CTL_UNINIT,
|
||||
|
||||
RARCH_DRIVER_CTL_UNINIT_ALL,
|
||||
|
||||
/* Initializes drivers.
|
||||
* @data is a bitmask which determines
|
||||
* which drivers get initialized. */
|
||||
RARCH_DRIVER_CTL_INIT,
|
||||
|
||||
RARCH_DRIVER_CTL_INIT_ALL,
|
||||
/* Attempts to find a default driver for
|
||||
* all driver types.
|
||||
*
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "dynamic.h"
|
||||
#include "command_event.h"
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
#include "camera/camera_driver.h"
|
||||
#include "location/location_driver.h"
|
||||
@@ -115,23 +113,7 @@ libretro_find_controller_description(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* libretro_free_system_info:
|
||||
* @info : Pointer to system info information.
|
||||
*
|
||||
* Frees system information.
|
||||
**/
|
||||
void libretro_free_system_info(struct retro_system_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
free((void*)info->library_name);
|
||||
free((void*)info->library_version);
|
||||
free((void*)info->valid_extensions);
|
||||
memset(info, 0, sizeof(*info));
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
static bool *load_no_content_hook;
|
||||
|
||||
static bool environ_cb_get_system_info(unsigned cmd, void *data)
|
||||
@@ -149,42 +131,6 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
bool *load_no_content)
|
||||
{
|
||||
struct retro_system_info dummy_info = {0};
|
||||
|
||||
if (load_no_content)
|
||||
{
|
||||
load_no_content_hook = load_no_content;
|
||||
|
||||
/* load_no_content gets set in this callback. */
|
||||
retro_set_environment(environ_cb_get_system_info);
|
||||
|
||||
/* It's possible that we just set get_system_info callback
|
||||
* to the currently running core.
|
||||
*
|
||||
* Make sure we reset it to the actual environment callback.
|
||||
* Ignore any environment callbacks here in case we're running
|
||||
* on the non-current core. */
|
||||
ignore_environment_cb = true;
|
||||
retro_set_environment(rarch_environment_cb);
|
||||
ignore_environment_cb = false;
|
||||
}
|
||||
|
||||
retro_get_system_info(&dummy_info);
|
||||
memcpy(info, &dummy_info, sizeof(*info));
|
||||
|
||||
info->library_name = strdup(dummy_info.library_name);
|
||||
info->library_version = strdup(dummy_info.library_version);
|
||||
if (dummy_info.valid_extensions)
|
||||
info->valid_extensions = strdup(dummy_info.valid_extensions);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/**
|
||||
* libretro_get_environment_info:
|
||||
* @func : Function pointer for get_environment_info.
|
||||
@@ -292,6 +238,22 @@ bool libretro_get_system_info(const char *path,
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* libretro_free_system_info:
|
||||
* @info : Pointer to system info information.
|
||||
*
|
||||
* Frees system information.
|
||||
**/
|
||||
void libretro_free_system_info(struct retro_system_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
free((void*)info->library_name);
|
||||
free((void*)info->library_version);
|
||||
free((void*)info->valid_extensions);
|
||||
memset(info, 0, sizeof(*info));
|
||||
}
|
||||
static void load_dynamic_core(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
@@ -309,7 +271,7 @@ static void load_dynamic_core(void)
|
||||
retro_fail(1, "init_libretro_sym()");
|
||||
}
|
||||
|
||||
if (!*settings->path.libretro)
|
||||
if (!*settings->libretro)
|
||||
{
|
||||
RARCH_ERR("RetroArch is built for dynamic libretro cores, but "
|
||||
"libretro_path is not set. Cannot continue.\n");
|
||||
@@ -319,15 +281,15 @@ static void load_dynamic_core(void)
|
||||
/* 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(settings->path.libretro, sizeof(settings->path.libretro));
|
||||
path_resolve_realpath(settings->libretro, sizeof(settings->libretro));
|
||||
|
||||
RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
|
||||
settings->path.libretro);
|
||||
lib_handle = dylib_load(settings->path.libretro);
|
||||
settings->libretro);
|
||||
lib_handle = dylib_load(settings->libretro);
|
||||
if (!lib_handle)
|
||||
{
|
||||
RARCH_ERR("Failed to open libretro core: \"%s\"\n",
|
||||
settings->path.libretro);
|
||||
settings->libretro);
|
||||
RARCH_ERR("Error(s): %s\n", dylib_error());
|
||||
retro_fail(1, "load_dynamic()");
|
||||
}
|
||||
@@ -576,7 +538,6 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_FREE, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_FRAME_TIME_FREE, NULL);
|
||||
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
|
||||
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);
|
||||
|
||||
@@ -715,7 +676,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
|
||||
if (string_is_empty(settings->directory.system))
|
||||
if (string_is_empty(settings->system_directory))
|
||||
{
|
||||
char *fullpath = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
@@ -731,9 +692,9 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
}
|
||||
else
|
||||
{
|
||||
*(const char**)data = settings->directory.system;
|
||||
*(const char**)data = settings->system_directory;
|
||||
RARCH_LOG("Environ SYSTEM_DIRECTORY: \"%s\".\n",
|
||||
settings->directory.system);
|
||||
settings->system_directory);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -874,7 +835,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
core_ctl(CORE_CTL_SET_INPUT_DESCRIPTORS, NULL);
|
||||
global->has_set.input_descriptors = true;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1008,7 +969,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
const char **path = (const char**)data;
|
||||
*path = NULL;
|
||||
#ifdef HAVE_DYNAMIC
|
||||
*path = settings->path.libretro;
|
||||
*path = settings->libretro;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -1127,10 +1088,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
{
|
||||
const char **dir = (const char**)data;
|
||||
|
||||
*dir = *settings->directory.core_assets ?
|
||||
settings->directory.core_assets : NULL;
|
||||
*dir = *settings->core_assets_directory ?
|
||||
settings->core_assets_directory : NULL;
|
||||
RARCH_LOG("Environ CORE_ASSETS_DIRECTORY: \"%s\".\n",
|
||||
settings->directory.core_assets);
|
||||
settings->core_assets_directory);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,20 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "core_type.h"
|
||||
#include "libretro.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
enum rarch_core_type
|
||||
{
|
||||
CORE_TYPE_PLAIN = 0,
|
||||
CORE_TYPE_DUMMY,
|
||||
CORE_TYPE_FFMPEG,
|
||||
CORE_TYPE_IMAGEVIEWER
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -65,21 +72,6 @@ void libretro_get_environment_info(void (*)(retro_environment_t),
|
||||
**/
|
||||
bool libretro_get_system_info(const char *path,
|
||||
struct retro_system_info *info, bool *load_no_content);
|
||||
#else
|
||||
/**
|
||||
* libretro_get_system_info_static:
|
||||
* @info : System info information.
|
||||
* @load_no_content : If true, core should be able to auto-start
|
||||
* without any content loaded.
|
||||
*
|
||||
* Gets system info from the current statically linked libretro library.
|
||||
* The struct returned must be freed as strings are allocated dynamically.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
bool *load_no_content);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* libretro_free_system_info:
|
||||
@@ -88,6 +80,7 @@ bool libretro_get_system_info_static(struct retro_system_info *info,
|
||||
* Frees system information.
|
||||
**/
|
||||
void libretro_free_system_info(struct retro_system_info *info);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* libretro_get_current_core_pathname:
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <string.h>
|
||||
@@ -141,53 +137,6 @@ void fill_pathname_abbreviate_special(char *out_path,
|
||||
retro_assert(strlcpy(out_path, in_path, size) < size);
|
||||
}
|
||||
|
||||
bool fill_pathname_application_data(char *s, size_t len)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
const char *appdata = getenv("APPDATA");
|
||||
|
||||
if (appdata)
|
||||
{
|
||||
strlcpy(s, appdata, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined(OSX)
|
||||
const char *appdata = getenv("HOME");
|
||||
|
||||
if (appdata)
|
||||
{
|
||||
fill_pathname_join(s, appdata,
|
||||
"Library/Application Support/RetroArch", len);
|
||||
return true;
|
||||
}
|
||||
#elif !defined(RARCH_CONSOLE)
|
||||
const char *xdg = getenv("XDG_CONFIG_HOME");
|
||||
const char *appdata = getenv("HOME");
|
||||
|
||||
/* XDG_CONFIG_HOME falls back to $HOME/.config. */
|
||||
if (xdg)
|
||||
{
|
||||
fill_pathname_join(s, xdg, "retroarch", len);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (appdata)
|
||||
{
|
||||
#ifdef __HAIKU__
|
||||
fill_pathname_join(s, appdata,
|
||||
"config/settings/retroarch/", len);
|
||||
#else
|
||||
fill_pathname_join(s, appdata,
|
||||
".config/retroarch/", len);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !defined(RARCH_CONSOLE)
|
||||
void fill_pathname_application_path(char *s, size_t len)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <file/file_path.h>
|
||||
#ifndef IS_SALAMANDER
|
||||
#include <lists/file_list.h>
|
||||
#include <file/file_list.h>
|
||||
#endif
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
@@ -74,14 +74,33 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[],
|
||||
"system", sizeof(g_defaults.dir.system));
|
||||
fill_pathname_join(g_defaults.dir.playlist, g_defaults.dir.core,
|
||||
"playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, g_defaults.dir.port,
|
||||
"config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port,
|
||||
"config/remaps", sizeof(g_defaults.dir.remap));
|
||||
"remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.video_filter, g_defaults.dir.port,
|
||||
"filters", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dir.port,
|
||||
"retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
/* clean-up argc/argv */
|
||||
if(*argc)
|
||||
{
|
||||
int i = *argc - 1;
|
||||
*argc = 0;
|
||||
while (i)
|
||||
{
|
||||
if(argv[i] && isalnum(argv[i][0])
|
||||
&& strncmp(argv[i], "3dslink:/", 9))
|
||||
{
|
||||
argv[1] = argv[i];
|
||||
argv[2] = NULL;
|
||||
*argc = 2;
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_ctr_deinit(void *data)
|
||||
@@ -111,14 +130,9 @@ static void frontend_ctr_deinit(void *data)
|
||||
svcCloseHandle(lcd_handle);
|
||||
}
|
||||
|
||||
u32 parallax_layer_reg_state = (*(float*)0x1FF81080 == 0.0)? 0x0 : 0x00010001;
|
||||
GSPGPU_WriteHWRegs(0x202000, ¶llax_layer_reg_state, 4);
|
||||
|
||||
cfguExit();
|
||||
ndspExit();
|
||||
csndExit();
|
||||
gfxTopRightFramebuffers[0] = NULL;
|
||||
gfxTopRightFramebuffers[1] = NULL;
|
||||
gfxExit();
|
||||
#endif
|
||||
}
|
||||
@@ -178,10 +192,7 @@ static void ctr_check_dspfirm(void)
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) Result svchax_init(bool patch_srv);
|
||||
__attribute__((weak)) u32 __ctr_patch_services;
|
||||
|
||||
void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id);
|
||||
void svchax_init(void);
|
||||
|
||||
static void frontend_ctr_init(void *data)
|
||||
{
|
||||
@@ -191,38 +202,16 @@ static void frontend_ctr_init(void *data)
|
||||
|
||||
*verbose = true;
|
||||
|
||||
#if 0
|
||||
APT_SetAppCpuTimeLimit(NULL, 80);
|
||||
#endif
|
||||
gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false);
|
||||
|
||||
u32 topSize = 400 * 240 * 3;
|
||||
u32 bottomSize = 320 * 240 * 2;
|
||||
linearFree(gfxTopLeftFramebuffers[0]);
|
||||
linearFree(gfxTopLeftFramebuffers[1]);
|
||||
linearFree(gfxBottomFramebuffers[0]);
|
||||
linearFree(gfxBottomFramebuffers[1]);
|
||||
linearFree(gfxTopRightFramebuffers[0]);
|
||||
linearFree(gfxTopRightFramebuffers[1]);
|
||||
|
||||
gfxTopLeftFramebuffers[0]=linearAlloc(topSize * 2);
|
||||
gfxTopRightFramebuffers[0] = gfxTopLeftFramebuffers[0] + topSize;
|
||||
|
||||
gfxTopLeftFramebuffers[1]=linearAlloc(topSize * 2);
|
||||
gfxTopRightFramebuffers[1] = gfxTopLeftFramebuffers[1] + topSize;
|
||||
|
||||
gfxBottomFramebuffers[0]=linearAlloc(bottomSize);
|
||||
gfxBottomFramebuffers[1]=linearAlloc(bottomSize);
|
||||
|
||||
gfxSetFramebufferInfo(GFX_TOP, 0);
|
||||
gfxSetFramebufferInfo(GFX_BOTTOM, 0);
|
||||
|
||||
gfxSet3D(true);
|
||||
gfxSet3D(false);
|
||||
consoleInit(GFX_BOTTOM, NULL);
|
||||
|
||||
/* enable access to all service calls when possible. */
|
||||
if(svchax_init)
|
||||
{
|
||||
osSetSpeedupEnable(false);
|
||||
svchax_init(__ctr_patch_services);
|
||||
}
|
||||
osSetSpeedupEnable(false);
|
||||
svchax_init();
|
||||
osSetSpeedupEnable(true);
|
||||
|
||||
audio_driver_t* dsp_audio_driver = &audio_ctr_dsp;
|
||||
@@ -258,7 +247,7 @@ static int frontend_ctr_parse_drive_list(void *data)
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
"sdmc:/", "", MENU_FILE_DIRECTORY, 0, 0);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,11 +46,9 @@
|
||||
#include <rhash.h>
|
||||
|
||||
#include "../frontend_driver.h"
|
||||
#include "../../file_path_special.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../ui/ui_companion_driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../ui/ui_companion_driver.h"
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../../menu/menu_driver.h"
|
||||
@@ -361,46 +359,36 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
fill_pathname_join(g_defaults.dir.core_assets, home_dir_buf, "downloads", sizeof(g_defaults.dir.core_assets));
|
||||
fill_pathname_join(g_defaults.dir.assets, home_dir_buf, "assets", sizeof(g_defaults.dir.assets));
|
||||
fill_pathname_join(g_defaults.dir.system, home_dir_buf, "system", sizeof(g_defaults.dir.system));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, home_dir_buf, "config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, home_dir_buf, "configs", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, "retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.database, home_dir_buf, "database/rdb", sizeof(g_defaults.dir.database));
|
||||
fill_pathname_join(g_defaults.dir.cursor, home_dir_buf, "database/cursors", sizeof(g_defaults.dir.cursor));
|
||||
fill_pathname_join(g_defaults.dir.cheats, home_dir_buf, "cht", sizeof(g_defaults.dir.cheats));
|
||||
fill_pathname_join(g_defaults.dir.thumbnails, home_dir_buf, "thumbnails", sizeof(g_defaults.dir.thumbnails));
|
||||
fill_pathname_join(g_defaults.dir.sram, home_dir_buf, "saves", sizeof(g_defaults.dir.sram));
|
||||
fill_pathname_join(g_defaults.dir.savestate, home_dir_buf, "states", sizeof(g_defaults.dir.savestate));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, home_dir_buf, "config", sizeof(g_defaults.dir.menu_config));
|
||||
#if defined(IOS)
|
||||
fill_pathname_join(g_defaults.dir.playlist, home_dir_buf, "playlists", sizeof(g_defaults.dir.playlist));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dir.remap, home_dir_buf, "remaps", sizeof(g_defaults.dir.remap));
|
||||
#if defined(OSX)
|
||||
char application_data[PATH_MAX_LENGTH];
|
||||
|
||||
fill_pathname_application_data(application_data, sizeof(application_data));
|
||||
|
||||
#ifdef HAVE_CG
|
||||
fill_pathname_join(g_defaults.dir.shader, home_dir_buf, "shaders_cg", sizeof(g_defaults.dir.shader));
|
||||
#endif
|
||||
fill_pathname_join(g_defaults.dir.audio_filter, home_dir_buf, "audio_filters", sizeof(g_defaults.dir.audio_filter));
|
||||
fill_pathname_join(g_defaults.dir.video_filter, home_dir_buf, "video_filters", sizeof(g_defaults.dir.video_filter));
|
||||
fill_pathname_join(g_defaults.dir.playlist, application_data, "playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.thumbnails, application_data, "thumbnails", sizeof(g_defaults.dir.thumbnails));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, application_data, "config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, "retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.core_assets, application_data, "downloads", sizeof(g_defaults.dir.core_assets));
|
||||
fill_pathname_join(g_defaults.dir.screenshot, application_data, "screenshots", sizeof(g_defaults.dir.screenshot));
|
||||
fill_pathname_join(g_defaults.dir.playlist, home_dir_buf, "playlists", sizeof(g_defaults.dir.playlist));
|
||||
#if defined(RELEASE_BUILD)
|
||||
fill_pathname_join(g_defaults.dir.shader, bundle_path_buf, "Contents/Resources/shaders", sizeof(g_defaults.dir.shader));
|
||||
fill_pathname_join(g_defaults.dir.core, bundle_path_buf, "Contents/Resources/cores", sizeof(g_defaults.dir.core));
|
||||
fill_pathname_join(g_defaults.dir.core_info, bundle_path_buf, "Contents/Resources/info", sizeof(g_defaults.dir.core_info));
|
||||
fill_pathname_join(g_defaults.dir.overlay, bundle_path_buf, "Contents/Resources/overlays", sizeof(g_defaults.dir.overlay));
|
||||
fill_pathname_join(g_defaults.dir.autoconfig, bundle_path_buf, "Contents/Resources/autoconfig", sizeof(g_defaults.dir.autoconfig));
|
||||
fill_pathname_join(g_defaults.dir.assets, bundle_path_buf, "Contents/Resources/assets", sizeof(g_defaults.dir.assets));
|
||||
fill_pathname_join(g_defaults.dir.database, bundle_path_buf, "Contents/Resources/database/rdb", sizeof(g_defaults.dir.database));
|
||||
fill_pathname_join(g_defaults.dir.cursor, bundle_path_buf, "Contents/Resources/database/cursors", sizeof(g_defaults.dir.cursor));
|
||||
fill_pathname_join(g_defaults.dir.cheats, bundle_path_buf, "Contents/Resources/cht", sizeof(g_defaults.dir.cheats));
|
||||
fill_pathname_join(g_defaults.dir.remap, bundle_path_buf, "Contents/Resources/remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.playlist, bundle_path_buf, "Contents/Resources/playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.shader, bundle_path_buf, "Contents/Resources/shaders", sizeof(g_defaults.dir.shader));
|
||||
fill_pathname_join(g_defaults.dir.core, bundle_path_buf, "Contents/Resources/cores", sizeof(g_defaults.dir.core));
|
||||
fill_pathname_join(g_defaults.dir.core_info, bundle_path_buf, "Contents/Resources/info", sizeof(g_defaults.dir.core_info));
|
||||
fill_pathname_join(g_defaults.dir.overlay, bundle_path_buf, "Contents/Resources/overlays", sizeof(g_defaults.dir.overlay));
|
||||
fill_pathname_join(g_defaults.dir.autoconfig, bundle_path_buf, "Contents/Resources/autoconfig", sizeof(g_defaults.dir.autoconfig));
|
||||
fill_pathname_join(g_defaults.dir.core_assets, bundle_path_buf, "Contents/Resources/downloads", sizeof(g_defaults.dir.core_assets));
|
||||
fill_pathname_join(g_defaults.dir.assets, bundle_path_buf, "Contents/Resources/assets", sizeof(g_defaults.dir.assets));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, bundle_path_buf, "Contents/Resources/configs", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.path.config, g_defaults.dir.menu_config, "retroarch.cfg", sizeof(g_defaults.path.config));
|
||||
fill_pathname_join(g_defaults.dir.database, bundle_path_buf, "Contents/Resources/database/rdb", sizeof(g_defaults.dir.database));
|
||||
fill_pathname_join(g_defaults.dir.cursor, bundle_path_buf, "Contents/Resources/database/cursors", sizeof(g_defaults.dir.cursor));
|
||||
fill_pathname_join(g_defaults.dir.cheats, bundle_path_buf, "Contents/Resources/cht", sizeof(g_defaults.dir.cheats));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -420,8 +408,8 @@ static void frontend_darwin_get_environment_settings(int *argc, char *argv[],
|
||||
|
||||
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->path.bundle_assets_src, assets_zip_path, sizeof(settings->path.bundle_assets_src));
|
||||
strlcpy(settings->path.bundle_assets_dst, home_dir_buf, sizeof(settings->path.bundle_assets_dst));
|
||||
strlcpy(settings->bundle_assets_src_path, assets_zip_path, sizeof(settings->bundle_assets_src_path));
|
||||
strlcpy(settings->bundle_assets_dst_path, home_dir_buf, sizeof(settings->bundle_assets_dst_path));
|
||||
settings->bundle_assets_extract_version_current = 130; /* TODO/FIXME: Just hardcode this for now */
|
||||
}
|
||||
#endif
|
||||
@@ -647,9 +635,9 @@ static int frontend_darwin_parse_drive_list(void *data)
|
||||
|
||||
CFSearchPathForDirectoriesInDomains(CFDocumentDirectory, CFUserDomainMask, 1, home_dir_buf, sizeof(home_dir_buf));
|
||||
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
home_dir_buf, "", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_add(list, "/", "",
|
||||
menu_entries_push(list, "/", "",
|
||||
MENU_FILE_DIRECTORY, 0, 0);
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <file/config_file.h>
|
||||
|
||||
#include "../../defaults.h"
|
||||
#include "../../general.h"
|
||||
#include "../../content.h"
|
||||
#include "../frontend.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <file/file_path.h>
|
||||
#ifndef IS_SALAMANDER
|
||||
#include <lists/file_list.h>
|
||||
#include <file/file_list.h>
|
||||
#endif
|
||||
#include <string/stdstring.h>
|
||||
|
||||
@@ -382,8 +382,8 @@ static void frontend_gx_process_args(int *argc, char *argv[])
|
||||
|
||||
/* A big hack: sometimes Salamander doesn't save the new core
|
||||
* it loads on first boot, so we make sure
|
||||
* settings->path.libretro is set here. */
|
||||
if (!settings->path.libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
|
||||
* settings->libretro is set here. */
|
||||
if (!settings->libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
|
||||
{
|
||||
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));
|
||||
if (path_file_exists(path))
|
||||
@@ -438,14 +438,14 @@ static int frontend_gx_parse_drive_list(void *data)
|
||||
#ifndef IS_SALAMANDER
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
#ifdef HW_RVL
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
"sd:/", "", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
"usb:/", "", MENU_FILE_DIRECTORY, 0, 0);
|
||||
#endif
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
"carda:/", "", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
"cardb:/", "", MENU_FILE_DIRECTORY, 0, 0);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -38,15 +38,14 @@
|
||||
#include <boolean.h>
|
||||
#include <retro_dirent.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_file.h>
|
||||
#include <compat/strl.h>
|
||||
#include <rhash.h>
|
||||
#include <file/file_path.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../frontend.h"
|
||||
#include "../frontend_driver.h"
|
||||
#include "../../defaults.h"
|
||||
#include "../../general.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "platform_linux.h"
|
||||
@@ -56,7 +55,7 @@
|
||||
*
|
||||
* See http://www.kernel.org/doc/Documentation/cputopology.txt
|
||||
*
|
||||
* For now, we don't expect more than 32 cores on mobile devices,
|
||||
* For now, we don't expect more than 32 cores on mobile devices,
|
||||
* so keep everything simple.
|
||||
*/
|
||||
typedef struct
|
||||
@@ -100,7 +99,7 @@ static char *extract_cpuinfo_field(char* buffer,
|
||||
int fieldlen = strlen(field);
|
||||
char* bufend = buffer + length;
|
||||
char* result = NULL;
|
||||
/* Look for first field occurrence,
|
||||
/* Look for first field occurrence,
|
||||
* and ensures it starts the line. */
|
||||
const char *p = buffer;
|
||||
|
||||
@@ -140,7 +139,7 @@ static char *extract_cpuinfo_field(char* buffer,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Checks that a space-separated list of items
|
||||
/* Checks that a space-separated list of items
|
||||
* contains one given 'item'.
|
||||
* Returns 1 if found, 0 otherwise.
|
||||
*/
|
||||
@@ -274,7 +273,7 @@ static void cpulist_read_from(CpuList* list, const char* filename)
|
||||
|
||||
list->mask = 0;
|
||||
|
||||
if (filestream_read_file(filename, (void**)&buf, &length) != 1)
|
||||
if (retro_read_file(filename, (void**)&buf, &length) != 1)
|
||||
{
|
||||
RARCH_ERR("Could not read %s: %s\n", filename, strerror(errno));
|
||||
return;
|
||||
@@ -317,7 +316,7 @@ static void linux_cpu_init(void)
|
||||
g_cpuFeatures = 0;
|
||||
g_cpuCount = 1;
|
||||
|
||||
if (filestream_read_file("/proc/cpuinfo", &buf, &length) != 1)
|
||||
if (retro_read_file("/proc/cpuinfo", &buf, &length) != 1)
|
||||
return;
|
||||
|
||||
/* Count the CPU cores, the value may be 0 for single-core CPUs */
|
||||
@@ -484,22 +483,19 @@ error:
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
/* Internal SDCARD writable */
|
||||
#define INT_SD_WRITABLE 1
|
||||
/* Internal SDCARD not writable but the private app dir is */
|
||||
#define INT_SD_APPDIR_WRITABLE 2
|
||||
/* Internal SDCARD not writable at all */
|
||||
#define INT_SD_NOT_WRITABLE 3
|
||||
#define SDCARD_ROOT_WRITABLE 1
|
||||
#define SDCARD_EXT_DIR_WRITABLE 2
|
||||
#define SDCARD_NOT_WRITABLE 3
|
||||
|
||||
struct android_app *g_android;
|
||||
static pthread_key_t thread_key;
|
||||
|
||||
char screenshot_dir[PATH_MAX_LENGTH];
|
||||
char downloads_dir[PATH_MAX_LENGTH];
|
||||
char apk_dir[PATH_MAX_LENGTH];
|
||||
char int_sd_dir[PATH_MAX_LENGTH];
|
||||
char apk_path[PATH_MAX_LENGTH];
|
||||
char sdcard_dir[PATH_MAX_LENGTH];
|
||||
char app_dir[PATH_MAX_LENGTH];
|
||||
char int_sd_app_dir[PATH_MAX_LENGTH];
|
||||
char ext_dir[PATH_MAX_LENGTH];
|
||||
|
||||
|
||||
/* forward declaration */
|
||||
@@ -727,10 +723,9 @@ static void jni_thread_destruct(void *value)
|
||||
|
||||
static void android_app_entry(void *data)
|
||||
{
|
||||
char arguments[] = "retroarch";
|
||||
char *argv[] = {arguments, NULL};
|
||||
int ret = 0;
|
||||
int argc = 1;
|
||||
char *argv[1];
|
||||
int argc = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (rarch_main(argc, argv, data) != 0)
|
||||
goto end;
|
||||
@@ -756,7 +751,7 @@ static struct android_app* android_app_create(ANativeActivity* activity,
|
||||
void* savedState, size_t savedStateSize)
|
||||
{
|
||||
int msgpipe[2];
|
||||
struct android_app *android_app =
|
||||
struct android_app *android_app =
|
||||
(struct android_app*)calloc(1, sizeof(*android_app));
|
||||
|
||||
if (!android_app)
|
||||
@@ -900,10 +895,7 @@ static bool device_is_game_console(const char *name)
|
||||
device_is_xperia_play(name) ||
|
||||
strstr(name, "GAMEMID_BT") ||
|
||||
strstr(name, "S7800") ||
|
||||
strstr(name, "XD\n") ||
|
||||
strstr(name, "ARCHOS GAMEPAD") ||
|
||||
strstr(name, "SHIELD Android TV") ||
|
||||
strstr(name, "SHIELD\n")
|
||||
strstr(name, "SHIELD")
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -1012,11 +1004,11 @@ static void check_proc_acpi_battery(const char * node, bool * have_battery,
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state");
|
||||
|
||||
if (!filestream_read_file(path, (void**)&buf, &length))
|
||||
if (!retro_read_file(path, (void**)&buf, &length))
|
||||
goto end;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "info");
|
||||
if (!filestream_read_file(path, (void**)&buf_info, &length))
|
||||
if (!retro_read_file(path, (void**)&buf_info, &length))
|
||||
goto end;
|
||||
|
||||
ptr = &buf[0];
|
||||
@@ -1137,7 +1129,7 @@ static void check_proc_acpi_sysfs_battery(const char *node,
|
||||
return;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "status");
|
||||
if (filestream_read_file(path, (void**)&buf, &length) != 1)
|
||||
if (retro_read_file(path, (void**)&buf, &length) != 1)
|
||||
return;
|
||||
|
||||
if (strstr((char*)buf, "Discharging"))
|
||||
@@ -1146,7 +1138,7 @@ static void check_proc_acpi_sysfs_battery(const char *node,
|
||||
*have_battery = true;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "capacity");
|
||||
if (filestream_read_file(path, (void**)&buf, &length) != 1)
|
||||
if (retro_read_file(path, (void**)&buf, &length) != 1)
|
||||
goto end;
|
||||
|
||||
capacity = atoi(buf);
|
||||
@@ -1170,7 +1162,7 @@ static void check_proc_acpi_ac_adapter(const char * node, bool *have_ac)
|
||||
ssize_t length = 0;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", base, node, "state");
|
||||
if (filestream_read_file(path, (void**)&buf, &length) != 1)
|
||||
if (retro_read_file(path, (void**)&buf, &length) != 1)
|
||||
return;
|
||||
|
||||
ptr = &buf[0];
|
||||
@@ -1197,7 +1189,7 @@ static void check_proc_acpi_sysfs_ac_adapter(const char * node, bool *have_ac)
|
||||
const char *base = proc_acpi_sysfs_ac_adapter_path;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", base, "online");
|
||||
if (filestream_read_file(path, (void**)&buf, &length) != 1)
|
||||
if (retro_read_file(path, (void**)&buf, &length) != 1)
|
||||
return;
|
||||
|
||||
if (strstr((char*)buf, "1"))
|
||||
@@ -1252,7 +1244,7 @@ static bool frontend_linux_powerstate_check_apm(
|
||||
char *buf = NULL;
|
||||
char *str = NULL;
|
||||
|
||||
if (filestream_read_file(proc_apm_path, (void**)&buf, &length) != 1)
|
||||
if (retro_read_file(proc_apm_path, (void**)&buf, &length) != 1)
|
||||
goto error;
|
||||
|
||||
ptr = &buf[0];
|
||||
@@ -1674,15 +1666,15 @@ static void frontend_linux_get_env(int *argc,
|
||||
{
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
*int_sd_dir = '\0';
|
||||
*sdcard_dir = '\0';
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(int_sd_dir, argv, sizeof(int_sd_dir));
|
||||
strlcpy(sdcard_dir, argv, sizeof(sdcard_dir));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
if (*int_sd_dir)
|
||||
if (*sdcard_dir)
|
||||
{
|
||||
RARCH_LOG("External storage location [%s]\n", int_sd_dir);
|
||||
RARCH_LOG("External storage location [%s]\n", sdcard_dir);
|
||||
/* TODO base dir handler */
|
||||
}
|
||||
}
|
||||
@@ -1736,15 +1728,15 @@ static void frontend_linux_get_env(int *argc,
|
||||
{
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
*apk_dir = '\0';
|
||||
*apk_path = '\0';
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(apk_dir, argv, sizeof(apk_dir));
|
||||
strlcpy(apk_path, argv, sizeof(apk_path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
if (*apk_dir)
|
||||
if (*apk_path)
|
||||
{
|
||||
RARCH_LOG("APK location [%s].\n", apk_dir);
|
||||
RARCH_LOG("APK location [%s].\n", apk_path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1755,15 +1747,15 @@ static void frontend_linux_get_env(int *argc,
|
||||
{
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
*int_sd_app_dir = '\0';
|
||||
*ext_dir = '\0';
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(int_sd_app_dir, argv, sizeof(int_sd_app_dir));
|
||||
strlcpy(ext_dir, argv, sizeof(ext_dir));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
if (*int_sd_app_dir)
|
||||
if (*ext_dir)
|
||||
{
|
||||
RARCH_LOG("External files location [%s]\n", int_sd_app_dir);
|
||||
RARCH_LOG("External files location [%s]\n", ext_dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1782,20 +1774,20 @@ static void frontend_linux_get_env(int *argc,
|
||||
strlcpy(app_dir, argv, sizeof(app_dir));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
//set paths depending on the ability to write to int_sd_dir
|
||||
//set paths depending on the ability to write to sdcard_dir
|
||||
|
||||
if(*int_sd_dir)
|
||||
if(*sdcard_dir)
|
||||
{
|
||||
if(test_permissions(int_sd_dir))
|
||||
perms = INT_SD_WRITABLE;
|
||||
if(test_permissions(sdcard_dir))
|
||||
perms = SDCARD_ROOT_WRITABLE;
|
||||
}
|
||||
else if(*int_sd_app_dir)
|
||||
else if(*ext_dir)
|
||||
{
|
||||
if(test_permissions(int_sd_app_dir))
|
||||
perms = INT_SD_APPDIR_WRITABLE;
|
||||
if(test_permissions(ext_dir))
|
||||
perms = SDCARD_EXT_DIR_WRITABLE;
|
||||
}
|
||||
else
|
||||
perms = INT_SD_NOT_WRITABLE;
|
||||
perms = SDCARD_NOT_WRITABLE;
|
||||
|
||||
RARCH_LOG("SD permissions: %d",perms);
|
||||
|
||||
@@ -1832,8 +1824,14 @@ static void frontend_linux_get_env(int *argc,
|
||||
app_dir, "database/rdb", sizeof(g_defaults.dir.database));
|
||||
fill_pathname_join(g_defaults.dir.cursor,
|
||||
app_dir, "database/cursors", sizeof(g_defaults.dir.cursor));
|
||||
fill_pathname_join(g_defaults.dir.cheats,
|
||||
app_dir, "cheats", sizeof(g_defaults.dir.cheats));
|
||||
fill_pathname_join(g_defaults.dir.playlist,
|
||||
app_dir, "playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.remap,
|
||||
app_dir, "remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.wallpapers,
|
||||
app_dir, "assets/wallpapers", sizeof(g_defaults.dir.wallpapers));
|
||||
app_dir, "wallpapers", sizeof(g_defaults.dir.wallpapers));
|
||||
if(*downloads_dir && test_permissions(downloads_dir))
|
||||
{
|
||||
fill_pathname_join(g_defaults.dir.core_assets,
|
||||
@@ -1864,110 +1862,68 @@ static void frontend_linux_get_env(int *argc,
|
||||
|
||||
switch (perms)
|
||||
{
|
||||
case INT_SD_APPDIR_WRITABLE:
|
||||
case SDCARD_EXT_DIR_WRITABLE:
|
||||
fill_pathname_join(g_defaults.dir.sram,
|
||||
int_sd_app_dir, "saves", sizeof(g_defaults.dir.sram));
|
||||
ext_dir, "saves", sizeof(g_defaults.dir.sram));
|
||||
path_mkdir(g_defaults.dir.sram);
|
||||
|
||||
fill_pathname_join(g_defaults.dir.savestate,
|
||||
int_sd_app_dir, "states", sizeof(g_defaults.dir.savestate));
|
||||
ext_dir, "states", sizeof(g_defaults.dir.savestate));
|
||||
path_mkdir(g_defaults.dir.savestate);
|
||||
|
||||
fill_pathname_join(g_defaults.dir.system,
|
||||
int_sd_app_dir, "system", sizeof(g_defaults.dir.system));
|
||||
ext_dir, "system", sizeof(g_defaults.dir.system));
|
||||
path_mkdir(g_defaults.dir.system);
|
||||
|
||||
fill_pathname_join(g_defaults.dir.menu_config,
|
||||
int_sd_app_dir, "config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.dir.remap,
|
||||
g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.thumbnails,
|
||||
int_sd_app_dir, "thumbnails", sizeof(g_defaults.dir.thumbnails));
|
||||
fill_pathname_join(g_defaults.dir.playlist,
|
||||
int_sd_app_dir, "playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.cheats,
|
||||
int_sd_app_dir, "cheats", sizeof(g_defaults.dir.cheats));
|
||||
|
||||
/* TODO/FIXME - Test if this is needed at all, as far as I know,
|
||||
* every directory we set in g_defaults already gets created if it
|
||||
* doesn't exist already */
|
||||
path_mkdir(g_defaults.dir.sram);
|
||||
path_mkdir(g_defaults.dir.savestate);
|
||||
path_mkdir(g_defaults.dir.system);
|
||||
ext_dir, "config", sizeof(g_defaults.dir.menu_config));
|
||||
path_mkdir(g_defaults.dir.menu_config);
|
||||
path_mkdir(g_defaults.dir.remap);
|
||||
path_mkdir(g_defaults.dir.thumbnails);
|
||||
path_mkdir(g_defaults.dir.playlist);
|
||||
path_mkdir(g_defaults.dir.cheats);
|
||||
|
||||
break;
|
||||
case INT_SD_NOT_WRITABLE:
|
||||
case SDCARD_NOT_WRITABLE:
|
||||
fill_pathname_join(g_defaults.dir.sram,
|
||||
app_dir, "saves", sizeof(g_defaults.dir.sram));
|
||||
path_mkdir(g_defaults.dir.sram);
|
||||
fill_pathname_join(g_defaults.dir.savestate,
|
||||
app_dir, "states", sizeof(g_defaults.dir.savestate));
|
||||
path_mkdir(g_defaults.dir.savestate);
|
||||
fill_pathname_join(g_defaults.dir.system,
|
||||
app_dir, "system", sizeof(g_defaults.dir.system));
|
||||
path_mkdir(g_defaults.dir.system);
|
||||
|
||||
fill_pathname_join(g_defaults.dir.menu_config,
|
||||
app_dir, "config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.dir.remap,
|
||||
g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.thumbnails,
|
||||
app_dir, "thumbnails", sizeof(g_defaults.dir.thumbnails));
|
||||
fill_pathname_join(g_defaults.dir.playlist,
|
||||
app_dir, "playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.cheats,
|
||||
app_dir, "cheats", sizeof(g_defaults.dir.cheats));
|
||||
|
||||
/* TODO/FIXME - Test if this is needed at all, as far as I know,
|
||||
* every directory we set in g_defaults already gets created if it
|
||||
* doesn't exist already */
|
||||
path_mkdir(g_defaults.dir.sram);
|
||||
path_mkdir(g_defaults.dir.savestate);
|
||||
path_mkdir(g_defaults.dir.system);
|
||||
path_mkdir(g_defaults.dir.menu_config);
|
||||
path_mkdir(g_defaults.dir.remap);
|
||||
path_mkdir(g_defaults.dir.thumbnails);
|
||||
path_mkdir(g_defaults.dir.playlist);
|
||||
path_mkdir(g_defaults.dir.cheats);
|
||||
break;
|
||||
case INT_SD_WRITABLE:
|
||||
fill_pathname_join(g_defaults.dir.menu_config,
|
||||
int_sd_dir, "RetroArch/config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.dir.remap,
|
||||
g_defaults.dir.menu_config, "remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.thumbnails,
|
||||
int_sd_dir, "RetroArch/thumbnails", sizeof(g_defaults.dir.thumbnails));
|
||||
fill_pathname_join(g_defaults.dir.playlist,
|
||||
int_sd_dir, "RetroArch/playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.cheats,
|
||||
int_sd_dir, "RetroArch/cheats", sizeof(g_defaults.dir.cheats));
|
||||
|
||||
/* TODO/FIXME - Test if this is needed at all, as far as I know,
|
||||
* every directory we set in g_defaults already gets created if it
|
||||
* doesn't exist already */
|
||||
path_mkdir(g_defaults.dir.menu_config);
|
||||
path_mkdir(g_defaults.dir.remap);
|
||||
path_mkdir(g_defaults.dir.thumbnails);
|
||||
path_mkdir(g_defaults.dir.playlist);
|
||||
path_mkdir(g_defaults.dir.cheats);
|
||||
case SDCARD_ROOT_WRITABLE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* create save and system directories in the internal dir too */
|
||||
fill_pathname_join(buf, app_dir, "saves", sizeof(buf));
|
||||
fill_pathname_join(buf,
|
||||
app_dir, "saves", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
fill_pathname_join(buf, app_dir, "states", sizeof(buf));
|
||||
fill_pathname_join(buf,
|
||||
app_dir, "states", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
fill_pathname_join(buf, app_dir, "system", sizeof(buf));
|
||||
fill_pathname_join(buf,
|
||||
app_dir, "system", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
/* create save and system directories in the internal sd too */
|
||||
fill_pathname_join(buf, int_sd_app_dir, "saves", sizeof(buf));
|
||||
fill_pathname_join(buf,
|
||||
ext_dir, "saves", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
fill_pathname_join(buf, int_sd_app_dir, "states", sizeof(buf));
|
||||
fill_pathname_join(buf,
|
||||
ext_dir, "states", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
fill_pathname_join(buf, int_sd_app_dir, "system", sizeof(buf));
|
||||
fill_pathname_join(buf,
|
||||
ext_dir, "system", sizeof(buf));
|
||||
path_mkdir(buf);
|
||||
|
||||
RARCH_LOG("Default savefile folder: [%s]", g_defaults.dir.sram);
|
||||
@@ -1996,13 +1952,13 @@ static void frontend_linux_get_env(int *argc,
|
||||
else if (strstr(device_model, "JSS15J"))
|
||||
g_defaults.settings.video_refresh_rate = 59.65;
|
||||
|
||||
|
||||
#if 0
|
||||
/* Explicitly disable input overlay by default
|
||||
* for gamepad-like/console devices. */
|
||||
|
||||
if (device_is_game_console(device_model))
|
||||
snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "xmb");
|
||||
|
||||
g_defaults.settings.input_overlay_enable = false;
|
||||
#endif
|
||||
#else
|
||||
char base_path[PATH_MAX];
|
||||
const char *xdg = getenv("XDG_CONFIG_HOME");
|
||||
@@ -2022,13 +1978,11 @@ static void frontend_linux_get_env(int *argc,
|
||||
fill_pathname_join(g_defaults.dir.core_info, base_path,
|
||||
"cores", sizeof(g_defaults.dir.core_info));
|
||||
fill_pathname_join(g_defaults.dir.autoconfig, base_path,
|
||||
"autoconfig", sizeof(g_defaults.dir.autoconfig));
|
||||
"autoconf", sizeof(g_defaults.dir.autoconfig));
|
||||
fill_pathname_join(g_defaults.dir.assets, base_path,
|
||||
"assets", sizeof(g_defaults.dir.assets));
|
||||
fill_pathname_join(g_defaults.dir.menu_config, base_path,
|
||||
"config", sizeof(g_defaults.dir.menu_config));
|
||||
fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config,
|
||||
"remaps", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.remap, base_path,
|
||||
"remap", sizeof(g_defaults.dir.remap));
|
||||
fill_pathname_join(g_defaults.dir.playlist, base_path,
|
||||
"playlists", sizeof(g_defaults.dir.playlist));
|
||||
fill_pathname_join(g_defaults.dir.cursor, base_path,
|
||||
@@ -2047,8 +2001,6 @@ static void frontend_linux_get_env(int *argc,
|
||||
"downloads", sizeof(g_defaults.dir.core_assets));
|
||||
fill_pathname_join(g_defaults.dir.screenshot, base_path,
|
||||
"screenshots", sizeof(g_defaults.dir.screenshot));
|
||||
fill_pathname_join(g_defaults.dir.thumbnails, base_path,
|
||||
"thumbnails", sizeof(g_defaults.dir.thumbnails));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2178,14 +2130,14 @@ static int frontend_android_parse_drive_list(void *data)
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
|
||||
// MENU_FILE_DIRECTORY is not working with labels, placeholders for now
|
||||
menu_entries_add(list,
|
||||
menu_entries_push(list,
|
||||
app_dir, "Application Dir", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_add(list,
|
||||
int_sd_app_dir, "External Application Dir", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_add(list,
|
||||
int_sd_dir, "Internal Memory", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_push(list,
|
||||
ext_dir, "External Application Dir", MENU_FILE_DIRECTORY, 0, 0);
|
||||
menu_entries_push(list,
|
||||
sdcard_dir, "Internal Memory", MENU_FILE_DIRECTORY, 0, 0);
|
||||
|
||||
menu_entries_add(list, "/", "",
|
||||
menu_entries_push(list, "/", "",
|
||||
MENU_FILE_DIRECTORY, 0, 0);
|
||||
|
||||
return 0;
|
||||
@@ -2216,7 +2168,7 @@ static bool frontend_linux_set_fork(enum frontend_fork fork_mode)
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
fill_pathname_application_path(executable_path, sizeof(executable_path));
|
||||
strlcpy(settings->path.libretro, executable_path, sizeof(settings->path.libretro));
|
||||
strlcpy(settings->libretro, executable_path, sizeof(settings->libretro));
|
||||
}
|
||||
rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL);
|
||||
break;
|
||||
@@ -2236,6 +2188,9 @@ static void frontend_linux_exec(const char *path, bool should_load_game)
|
||||
newargv[0] = malloc(len);
|
||||
|
||||
strlcpy(newargv[0], path, len);
|
||||
|
||||
execv(path, newargv);
|
||||
perror("execv");
|
||||
}
|
||||
|
||||
static void frontend_linux_exitspawn(char *core_path, size_t core_path_size)
|
||||
|
||||
Loaded 100 of 466 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user