Merge branch 'master' of https://github.com/libretro/RetroArch
This commit is contained in:
commit
122888fa80
185
Makefile.common
185
Makefile.common
|
@ -62,7 +62,7 @@ endif
|
|||
ifneq ($(findstring Linux,$(OS)),)
|
||||
LIBS += -lrt
|
||||
JOYCONFIG_LIBS += -lrt
|
||||
OBJ += input/linuxraw_input.o input/linuxraw_joypad.o
|
||||
OBJ += input/drivers/linuxraw_input.o input/drivers_joypad/linuxraw_joypad.o
|
||||
endif
|
||||
|
||||
ifeq ($(findstring Haiku,$(OS)),)
|
||||
|
@ -85,8 +85,8 @@ endif
|
|||
# General object files
|
||||
|
||||
OBJ += frontend/frontend.o \
|
||||
frontend/frontend_context.o \
|
||||
frontend/platform/platform_null.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro_version_1.o \
|
||||
retroarch.o \
|
||||
runloop.o \
|
||||
|
@ -96,26 +96,33 @@ OBJ += frontend/frontend.o \
|
|||
libretro-sdk/string/string_list.o \
|
||||
file_ops.o \
|
||||
libretro-sdk/file/file_path.o \
|
||||
rarch_compr_file_path.o \
|
||||
hash.o \
|
||||
audio/audio_driver.o \
|
||||
input/input_driver.o \
|
||||
gfx/video_driver.o \
|
||||
osk/osk_driver.o \
|
||||
camera/camera_driver.o \
|
||||
menu/menu_driver.o \
|
||||
location/location_driver.o \
|
||||
driver.o \
|
||||
settings.o \
|
||||
settings_list.o \
|
||||
settings_data.o \
|
||||
dynamic.o \
|
||||
dynamic_dummy.o \
|
||||
message_queue.o \
|
||||
libretro-sdk/queues/message_queue.o \
|
||||
rewind.o \
|
||||
gfx/gfx_common.o \
|
||||
gfx/fonts/bitmapfont.o \
|
||||
gfx/drivers_font_renderer/bitmapfont.o \
|
||||
input/input_autodetect.o \
|
||||
input/input_context.o \
|
||||
input/input_joypad_driver.o \
|
||||
input/input_joypad.o \
|
||||
input/input_common.o \
|
||||
input/input_keymaps.o \
|
||||
input/keyboard_line.o \
|
||||
input/overlay.o \
|
||||
input/input_overlay.o \
|
||||
patch.o \
|
||||
fifo_buffer.o \
|
||||
libretro-sdk/queues/fifo_buffer.o \
|
||||
core_options.o \
|
||||
libretro-sdk/compat/compat.o \
|
||||
cheats.o \
|
||||
|
@ -124,30 +131,30 @@ OBJ += frontend/frontend.o \
|
|||
libretro-sdk/file/config_file_userdata.o \
|
||||
screenshot.o \
|
||||
libretro-sdk/gfx/scaler/scaler.o \
|
||||
gfx/shader/shader_null.o \
|
||||
gfx/shader/shader_context.o \
|
||||
gfx/shader/shader_parse.o \
|
||||
gfx/drivers_shader/shader_null.o \
|
||||
gfx/video_shader_driver.o \
|
||||
gfx/video_shader_parse.o \
|
||||
libretro-sdk/gfx/scaler/pixconv.o \
|
||||
libretro-sdk/gfx/scaler/scaler_int.o \
|
||||
libretro-sdk/gfx/scaler/scaler_filter.o \
|
||||
gfx/image/image_rpng.o \
|
||||
gfx/fonts/fonts.o \
|
||||
gfx/font_renderer_driver.o \
|
||||
gfx/video_filter.o \
|
||||
audio/resamplers/resampler.o \
|
||||
audio/dsp_filter.o \
|
||||
audio/resamplers/sinc.o \
|
||||
audio/resamplers/nearest.o \
|
||||
audio/resamplers/cc_resampler.o \
|
||||
location/nulllocation.o \
|
||||
camera/nullcamera.o \
|
||||
gfx/nullgfx.o \
|
||||
audio/nullaudio.o \
|
||||
input/nullinput.o \
|
||||
input/nullinput_joypad.o \
|
||||
input/osk/nullosk.o \
|
||||
audio/audio_resampler_driver.o \
|
||||
audio/audio_dsp_filter.o \
|
||||
audio/drivers_resampler/sinc.o \
|
||||
audio/drivers_resampler/nearest.o \
|
||||
audio/drivers_resampler/cc_resampler.o \
|
||||
location/drivers/nulllocation.o \
|
||||
camera/drivers/nullcamera.o \
|
||||
gfx/drivers/nullgfx.o \
|
||||
audio/drivers/nullaudio.o \
|
||||
input/drivers/nullinput.o \
|
||||
input/drivers_joypad/nullinput_joypad.o \
|
||||
osk/drivers/nullosk.o \
|
||||
playlist.o \
|
||||
movie.o \
|
||||
record/ffemu.o \
|
||||
record/record_driver.o \
|
||||
performance.o
|
||||
|
||||
# RarchDB
|
||||
|
@ -167,45 +174,45 @@ endif
|
|||
ifeq ($(HAVE_PYTHON), 1)
|
||||
DEFINES += $(PYTHON_CFLAGS) -Wno-unused-parameter
|
||||
LIBS += $(PYTHON_LIBS)
|
||||
OBJ += gfx/py_state/py_state.o
|
||||
OBJ += gfx/video_state_python.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_EMSCRIPTEN), 1)
|
||||
OBJ += frontend/platform/platform_emscripten.o \
|
||||
input/rwebinput_input.o \
|
||||
audio/rwebaudio.o \
|
||||
camera/rwebcam.o
|
||||
OBJ += frontend/drivers/platform_emscripten.o \
|
||||
input/drivers/rwebinput_input.o \
|
||||
audio/drivers/rwebaudio.o \
|
||||
camera/drivers/rwebcam.o
|
||||
endif
|
||||
|
||||
# Audio
|
||||
#
|
||||
ifeq ($(HAVE_COREAUDIO), 1)
|
||||
OBJ += audio/coreaudio.o
|
||||
OBJ += audio/drivers/coreaudio.o
|
||||
LIBS += -framework CoreServices -framework CoreAudio -framework AudioUnit
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OSS), 1)
|
||||
OBJ += audio/oss.o
|
||||
OBJ += audio/drivers/oss.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OSS_BSD), 1)
|
||||
OBJ += audio/oss.o
|
||||
OBJ += audio/drivers/oss.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ALSA), 1)
|
||||
OBJ += audio/alsa.o audio/alsathread.o
|
||||
OBJ += audio/drivers/alsa.o audio/drivers/alsathread.o
|
||||
LIBS += $(ALSA_LIBS)
|
||||
DEFINES += $(ALSA_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_ROAR), 1)
|
||||
OBJ += audio/roar.o
|
||||
OBJ += audio/drivers/roar.o
|
||||
LIBS += $(ROAR_LIBS)
|
||||
DEFINES += $(ROAR_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_AL), 1)
|
||||
OBJ += audio/openal.o
|
||||
OBJ += audio/drivers/openal.o
|
||||
ifeq ($(OSX),1)
|
||||
LIBS += -framework OpenAL
|
||||
else
|
||||
|
@ -214,13 +221,13 @@ ifeq ($(HAVE_AL), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_JACK),1)
|
||||
OBJ += audio/jack.o
|
||||
OBJ += audio/drivers/jack.o
|
||||
LIBS += $(JACK_LIBS)
|
||||
DEFINES += $(JACK_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_PULSE), 1)
|
||||
OBJ += audio/pulse.o
|
||||
OBJ += audio/drivers/pulse.o
|
||||
LIBS += $(PULSE_LIBS)
|
||||
DEFINES += $(PULSE_CFLAGS)
|
||||
endif
|
||||
|
@ -236,13 +243,13 @@ ifeq ($(HAVE_RSOUND), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_DSOUND), 1)
|
||||
OBJ += audio/dsound.o
|
||||
OBJ += audio/drivers/dsound.o
|
||||
DEFINES += -DHAVE_DSOUND
|
||||
LIBS += -ldxguid -ldsound
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XAUDIO), 1)
|
||||
OBJ += audio/xaudio.o audio/xaudio-c/xaudio-c.o
|
||||
OBJ += audio/drivers/xaudio.o audio/drivers/xaudio-c.o
|
||||
DEFINES += -DHAVE_XAUDIO
|
||||
LIBS += -lole32
|
||||
endif
|
||||
|
@ -250,8 +257,8 @@ endif
|
|||
# Audio Resamplers
|
||||
|
||||
ifeq ($(HAVE_NEON),1)
|
||||
OBJ += audio/resamplers/sinc_neon.o
|
||||
OBJ += audio/resamplers/cc_resampler_neon.o
|
||||
OBJ += audio/drivers_resampler/sinc_neon.o
|
||||
OBJ += audio/drivers_resampler/cc_resampler_neon.o
|
||||
# When compiled without this, tries to attempt to compile sinc lerp,
|
||||
# which will error out
|
||||
#
|
||||
|
@ -261,33 +268,33 @@ ifeq ($(HAVE_NEON),1)
|
|||
DEFINES += -DSINC_LOWER_QUALITY
|
||||
endif
|
||||
|
||||
OBJ += audio/utils.o
|
||||
OBJ += audio/audio_utils.o
|
||||
ifeq ($(HAVE_NEON),1)
|
||||
OBJ += audio/utils_neon.o
|
||||
OBJ += audio/audio_utils_neon.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
OBJ += menu/disp/rgui.o
|
||||
OBJ += menu/drivers_display/rgui.o
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
||||
HAVE_MENU_COMMON = 1
|
||||
ifeq ($(HAVE_GLUI), 1)
|
||||
OBJ += menu/disp/glui.o
|
||||
OBJ += menu/drivers_display/glui.o
|
||||
DEFINES += -DHAVE_GLUI
|
||||
endif
|
||||
ifeq ($(HAVE_XMB), 1)
|
||||
OBJ += menu/disp/xmb.o
|
||||
OBJ += menu/drivers_display/xmb.o
|
||||
DEFINES += -DHAVE_XMB
|
||||
endif
|
||||
ifeq ($(HAVE_LAKKA), 1)
|
||||
OBJ += menu/backend/menu_lakka_backend.o \
|
||||
menu/disp/lakka.o
|
||||
OBJ += menu/drivers_backend/menu_lakka_backend.o \
|
||||
menu/drivers_display/lakka.o
|
||||
DEFINES += -DHAVE_LAKKA
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += menu/backend/menu_common_backend.o \
|
||||
menu/menu_input_line_cb.o \
|
||||
OBJ += menu/drivers_backend/menu_common_backend.o \
|
||||
menu/menu_input.o \
|
||||
menu/menu.o \
|
||||
menu/menu_common_list.o \
|
||||
menu/menu_navigation.o \
|
||||
|
@ -300,7 +307,7 @@ ifeq ($(HAVE_MENU_COMMON), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_FREETYPE), 1)
|
||||
OBJ += gfx/fonts/freetype.o
|
||||
OBJ += gfx/drivers_font_renderer/freetype.o
|
||||
LIBS += $(FREETYPE_LIBS)
|
||||
DEFINES += $(FREETYPE_CFLAGS)
|
||||
endif
|
||||
|
@ -320,7 +327,7 @@ endif
|
|||
#Input
|
||||
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
#OBJ += input/wayland.o
|
||||
#OBJ += input/drivers/wayland.o
|
||||
DEFINES += $(WAYLAND_CFLAGS)
|
||||
LIBS += $(WAYLAND_LIBS)
|
||||
endif
|
||||
|
@ -328,18 +335,18 @@ endif
|
|||
ifeq ($(HAVE_DINPUT), 1)
|
||||
LIBS += -ldinput8 -ldxguid -lole32
|
||||
DEFINES += -DHAVE_DINPUT
|
||||
OBJ += input/dinput.o
|
||||
OBJ += input/drivers/dinput.o
|
||||
JOYCONFIG_LIBS += -ldinput8 -ldxguid -lole32
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_WINXINPUT), 1)
|
||||
DEFINES += -DHAVE_WINXINPUT -DHAVE_BUILTIN_AUTOCONFIG
|
||||
OBJ += input/winxinput_joypad.o \
|
||||
OBJ += input/drivers_joypad/winxinput_joypad.o \
|
||||
input/autoconf/builtin_win.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_X11), 1)
|
||||
OBJ += input/x11_input.o gfx/context/x11_common.o input/keyboard_event_x11.o
|
||||
OBJ += input/drivers/x11_input.o gfx/drivers_context/x11_common.o input/keyboard_event_x11.o
|
||||
LIBS += $(X11_LIBS) $(XEXT_LIBS) $(XF86VM_LIBS) $(XINERAMA_LIBS)
|
||||
DEFINES += $(X11_CFLAGS) $(XEXT_CFLAGS) $(XF86VM_CFLAGS) $(XINERAMA_CFLAGS)
|
||||
endif
|
||||
|
@ -354,61 +361,61 @@ ifeq ($(HAVE_UDEV), 1)
|
|||
DEFINES += $(UDEV_CFLAGS)
|
||||
LIBS += $(UDEV_LIBS)
|
||||
JOYCONFIG_LIBS += $(UDEV_LIBS)
|
||||
OBJ += input/udev_input.o input/udev_joypad.o
|
||||
OBJ += input/drivers/udev_input.o input/drivers_joypad/udev_joypad.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_PARPORT), 1)
|
||||
OBJ += input/parport_joypad.o
|
||||
OBJ += input/drivers_joypad/parport_joypad.o
|
||||
endif
|
||||
|
||||
# Video
|
||||
#
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_GLSL
|
||||
OBJ += gfx/gl.o \
|
||||
OBJ += gfx/drivers/gl.o \
|
||||
gfx/gl_common.o \
|
||||
gfx/gfx_context.o \
|
||||
gfx/context/gfx_null_ctx.o \
|
||||
gfx/fonts/gl_font.o \
|
||||
gfx/fonts/gl_raster_font.o \
|
||||
gfx/video_context_driver.o \
|
||||
gfx/drivers_context/gfx_null_ctx.o \
|
||||
gfx/font_gl_driver.o \
|
||||
gfx/drivers_font/gl_raster_font.o \
|
||||
libretro-sdk/gfx/math/matrix_4x4.o \
|
||||
gfx/state_tracker.o \
|
||||
gfx/video_state_tracker.o \
|
||||
libretro-sdk/glsym/rglgen.o
|
||||
|
||||
ifeq ($(HAVE_KMS), 1)
|
||||
OBJ += gfx/context/drm_egl_ctx.o
|
||||
OBJ += gfx/drivers_context/drm_egl_ctx.o
|
||||
DEFINES += $(GBM_CFLAGS) $(DRM_CFLAGS) $(EGL_CFLAGS)
|
||||
LIBS += $(GBM_LIBS) $(DRM_LIBS) $(EGL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VIDEOCORE), 1)
|
||||
OBJ += gfx/context/vc_egl_ctx.o
|
||||
OBJ += gfx/drivers_context/vc_egl_ctx.o
|
||||
DEFINES += $(EGL_CFLAGS)
|
||||
LIBS += $(EGL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_EMSCRIPTEN), 1)
|
||||
OBJ += gfx/context/emscriptenegl_ctx.o
|
||||
OBJ += gfx/drivers_context/emscriptenegl_ctx.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MALI_FBDEV), 1)
|
||||
OBJ += gfx/context/mali_fbdev_ctx.o
|
||||
OBJ += gfx/drivers_context/mali_fbdev_ctx.o
|
||||
DEFINES += $(EGL_CFLAGS)
|
||||
LIBS += $(EGL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VIVANTE_FBDEV), 1)
|
||||
OBJ += gfx/context/vivante_fbdev_ctx.o
|
||||
OBJ += gfx/drivers_context/vivante_fbdev_ctx.o
|
||||
DEFINES += $(EGL_CFLAGS)
|
||||
LIBS += $(EGL_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_X11), 1)
|
||||
ifeq ($(HAVE_GLES), 0)
|
||||
OBJ += gfx/context/glx_ctx.o
|
||||
OBJ += gfx/drivers_context/glx_ctx.o
|
||||
endif
|
||||
ifeq ($(HAVE_EGL), 1)
|
||||
OBJ += gfx/context/xegl_ctx.o
|
||||
OBJ += gfx/drivers_context/xegl_ctx.o
|
||||
DEFINES += $(EGL_CFLAGS)
|
||||
LIBS += $(EGL_LIBS)
|
||||
endif
|
||||
|
@ -416,7 +423,7 @@ ifeq ($(HAVE_OPENGL), 1)
|
|||
|
||||
ifeq ($(HAVE_WAYLAND), 1)
|
||||
ifeq ($(HAVE_EGL), 1)
|
||||
OBJ += gfx/context/wayland_ctx.o
|
||||
OBJ += gfx/drivers_context/wayland_ctx.o
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -434,13 +441,13 @@ ifeq ($(HAVE_OPENGL), 1)
|
|||
LIBS += -framework OpenGL
|
||||
else ifneq ($(findstring Win32,$(OS)),)
|
||||
LIBS += -lopengl32 -lgdi32 -lcomdlg32
|
||||
OBJ += gfx/context/wgl_ctx.o
|
||||
OBJ += gfx/drivers_context/wgl_ctx.o
|
||||
else
|
||||
LIBS += -lGL
|
||||
endif
|
||||
endif
|
||||
|
||||
OBJ += gfx/shader/shader_glsl.o
|
||||
OBJ += gfx/drivers_shader/shader_glsl.o
|
||||
DEFINES += -DHAVE_GLSL
|
||||
endif
|
||||
|
||||
|
@ -449,10 +456,10 @@ ifeq ($(HAVE_SDL2), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
OBJ += gfx/sdl_gfx.o input/sdl_input.o input/sdl_joypad.o audio/sdl_audio.o
|
||||
OBJ += gfx/drivers/sdl_gfx.o input/drivers/sdl_input.o input/drivers_joypad/sdl_joypad.o audio/drivers/sdl_audio.o
|
||||
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
OBJ += gfx/context/sdl_gl_ctx.o
|
||||
OBJ += gfx/drivers_context/sdl_gl_ctx.o
|
||||
endif
|
||||
|
||||
JOYCONFIG_LIBS += $(SDL_LIBS)
|
||||
|
@ -461,10 +468,10 @@ ifeq ($(HAVE_SDL), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL2), 1)
|
||||
OBJ += gfx/sdl2_gfx.o input/sdl_input.o input/sdl_joypad.o audio/sdl_audio.o
|
||||
OBJ += gfx/drivers/sdl2_gfx.o input/drivers/sdl_input.o input/drivers_joypad/sdl_joypad.o audio/drivers/sdl_audio.o
|
||||
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
OBJ += gfx/context/sdl_gl_ctx.o
|
||||
OBJ += gfx/drivers_context/sdl_gl_ctx.o
|
||||
endif
|
||||
|
||||
JOYCONFIG_LIBS += $(SDL2_LIBS)
|
||||
|
@ -474,30 +481,30 @@ ifeq ($(HAVE_SDL2), 1)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_OMAP), 1)
|
||||
OBJ += gfx/omap_gfx.o
|
||||
OBJ += gfx/drivers/omap_gfx.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_EXYNOS), 1)
|
||||
OBJ += gfx/exynos_gfx.o mem/neon/memcpy-neon.o
|
||||
OBJ += gfx/drivers/exynos_gfx.o mem/neon/memcpy-neon.o
|
||||
LIBS += $(DRM_LIBS) $(EXYNOS_LIBS)
|
||||
DEFINES += $(DRM_CFLAGS) $(EXYNOS_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VG), 1)
|
||||
OBJ += gfx/vg.o libretro-sdk/gfx/math/matrix_3x3.o
|
||||
OBJ += gfx/drivers/vg.o libretro-sdk/gfx/math/matrix_3x3.o
|
||||
DEFINES += $(VG_CFLAGS)
|
||||
LIBS += $(VG_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XVIDEO), 1)
|
||||
OBJ += gfx/xvideo.o
|
||||
OBJ += gfx/drivers/xvideo.o
|
||||
LIBS += $(XVIDEO_LIBS)
|
||||
DEFINES += $(XVIDEO_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
DEFINES += -DHAVE_CG
|
||||
OBJ += gfx/shader/shader_gl_cg.o
|
||||
OBJ += gfx/drivers_shader/shader_gl_cg.o
|
||||
LIBS += $(CG_LIBS)
|
||||
endif
|
||||
|
||||
|
@ -505,9 +512,9 @@ ifeq ($(HAVE_D3D9), 1)
|
|||
OBJ += gfx/d3d/d3d.o \
|
||||
gfx/d3d/render_chain.o \
|
||||
gfx/d3d/d3d_wrapper.o \
|
||||
gfx/fonts/d3d_font.o \
|
||||
gfx/fonts/d3d_w32_font.o \
|
||||
gfx/context/d3d_ctx.o
|
||||
gfx/font_d3d_driver.o \
|
||||
gfx/drivers_font/d3d_w32_font.o \
|
||||
gfx/drivers_context/d3d_ctx.o
|
||||
DEFINES += -DHAVE_WIN32_D3D9
|
||||
LIBS += -ld3d9 -ld3dx9 -ldxguid
|
||||
|
||||
|
@ -598,7 +605,7 @@ endif
|
|||
# Camera
|
||||
|
||||
ifeq ($(HAVE_V4L2),1)
|
||||
OBJ += camera/video4linux2.o
|
||||
OBJ += camera/drivers/video4linux2.o
|
||||
DEFINES += -DHAVE_V4L2
|
||||
endif
|
||||
|
||||
|
@ -622,7 +629,7 @@ endif
|
|||
# Record
|
||||
|
||||
ifeq ($(HAVE_FFMPEG), 1)
|
||||
OBJ += record/ffmpeg.o
|
||||
OBJ += record/drivers/ffmpeg.o
|
||||
LIBS += $(AVCODEC_LIBS) $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(SWSCALE_LIBS) $(FFMPEG_LIBS)
|
||||
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS)
|
||||
DEFINES += -DHAVE_FFMPEG -Iffmpeg
|
||||
|
|
|
@ -69,16 +69,16 @@ clean:
|
|||
rm -f menu/*.o
|
||||
rm -f menu/disp/*.o
|
||||
rm -f audio/*.o
|
||||
rm -f audio/xaudio-c/*.o
|
||||
rm -f compat/*.o
|
||||
rm -f compat/rxml/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/scaler/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/d3d/*.o
|
||||
rm -f gfx/context/*.o
|
||||
rm -f gfx/drivers_context/*.o
|
||||
rm -f gfx/math/*.o
|
||||
rm -f gfx/fonts/*.o
|
||||
rm -f gfx/drivers_font/*.o
|
||||
rm -f gfx/drivers_font_renderer/*.o
|
||||
rm -f gfx/py_state/*.o
|
||||
rm -f gfx/rpng/*.o
|
||||
rm -f gfx/glsym/*.o
|
||||
|
|
|
@ -10,7 +10,7 @@ TARGET := retroarch-pandora
|
|||
LDDIRS = -L. -L$(PNDSDK)/usr/lib
|
||||
INCDIRS = -I. -I$(PNDSDK)/usr/include
|
||||
|
||||
OBJ = griffin/griffin.o audio/resamplers/sinc_neon.o audio/utils_neon.o
|
||||
OBJ = griffin/griffin.o audio/resamplers/sinc_neon.o audio/audio_utils_neon.o
|
||||
LDFLAGS = -L$(PNDSDK)/usr/lib -Wl,-rpath,$(PNDSDK)/usr/lib
|
||||
|
||||
LIBS = -lGLESv2 -lEGL -ldl -lm -lpthread -lrt -lasound
|
||||
|
|
|
@ -40,8 +40,9 @@ clean:
|
|||
rm -f audio/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/fonts/*.o
|
||||
rm -f gfx/context/*.o
|
||||
rm -f gfx/drivers_font/*.o
|
||||
rm -f gfx/drivers_font_renderer/*.o
|
||||
rm -f gfx/drivers_context/*.o
|
||||
rm -f gfx/py_state/*.o
|
||||
rm -f compat/*.o
|
||||
rm -f record/*.o
|
||||
|
|
|
@ -18,8 +18,8 @@ endif
|
|||
|
||||
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
|
||||
|
||||
PPU_CFLAGS += -I. -Ilibretro-sdk/include -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC -DRARCH_INTERNAL
|
||||
PPU_SRCS = frontend/frontend_salamander.c frontend/frontend_context.c frontend/platform/platform_ps3.c frontend/platform/platform_null.c libretro-sdk/file/file_path.c libretro-sdk/file/dir_list.c libretro-sdk/string/string_list.c libretro-sdk/compat/compat.c libretro-sdk/file/config_file.c
|
||||
PPU_CFLAGS += -I. -Ilibretro-sdk/include -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
|
||||
PPU_SRCS = frontend/frontend_salamander.c frontend/frontend_driver.c frontend/drivers/platform_ps3.c frontend/drivers/platform_null.c libretro-sdk/file/file_path.c libretro-sdk/file/dir_list.c libretro-sdk/string/string_list.c libretro-sdk/compat/compat.c libretro-sdk/file/config_file.c
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
PPU_CFLAGS += -DHAVE_LOGGER -Ilogger/netlogger
|
||||
|
|
|
@ -14,7 +14,7 @@ INCDIR = $(PSPPATH)/include libretro-sdk/include
|
|||
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE -DRARCH_INTERNAL
|
||||
RARCH_DEFINES = -DPSP -DIS_SALAMANDER -DRARCH_CONSOLE
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
|
@ -31,7 +31,7 @@ PSP_EBOOT_TITLE = RetroArch
|
|||
PSP_EBOOT_ICON = psp1/ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = psp1/PIC1.PNG
|
||||
|
||||
OBJS = frontend/frontend_salamander.o frontend/frontend_context.o frontend/platform/platform_psp.o frontend/platform/platform_null.o libretro-sdk/file/file_path.o libretro-sdk/string/string_list.o libretro-sdk/file/dir_list.o libretro-sdk/compat/compat.o libretro-sdk/file/config_file.o psp1/kernel_functions.o
|
||||
OBJS = frontend/frontend_salamander.o frontend/frontend_driver.o frontend/drivers/platform_psp.o frontend/drivers/platform_null.o libretro-sdk/file/file_path.o libretro-sdk/string/string_list.o libretro-sdk/file/dir_list.o libretro-sdk/compat/compat.o libretro-sdk/file/config_file.o psp1/kernel_functions.o
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
|
|
@ -39,7 +39,7 @@ LIBS := -lfat -lwiiuse -logc -lbte
|
|||
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
|
||||
OBJ = frontend/frontend_salamander.o frontend/frontend_context.o frontend/platform/platform_gx.o frontend/platform/platform_wii.o frontend/platform/platform_null.o libretro-sdk/file/file_path.o libretro-sdk/string/string_list.o libretro-sdk/file/dir_list.o libretro-sdk/compat/compat.o libretro-sdk/file/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
|
||||
OBJ = frontend/frontend_salamander.o frontend/frontend_driver.o frontend/drivers/platform_gx.o frontend/drivers/platform_wii.o frontend/drivers/platform_null.o libretro-sdk/file/file_path.o libretro-sdk/string/string_list.o libretro-sdk/file/dir_list.o libretro-sdk/compat/compat.o libretro-sdk/file/config_file.o $(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
|
|
|
@ -28,9 +28,9 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
|||
|
||||
ifeq ($(HAVE_NEON),1)
|
||||
LOCAL_CFLAGS += -D__ARM_NEON__
|
||||
LOCAL_SRC_FILES += $(RARCH_DIR)/audio/utils_neon.S.neon
|
||||
LOCAL_SRC_FILES += $(RARCH_DIR)/audio/resamplers/sinc_neon.S.neon
|
||||
LOCAL_SRC_FILES += $(RARCH_DIR)/audio/resamplers/cc_resampler_neon.S.neon
|
||||
LOCAL_SRC_FILES += $(RARCH_DIR)/audio/audio_utils_neon.S.neon
|
||||
LOCAL_SRC_FILES += $(RARCH_DIR)/audio/drivers_resampler/sinc_neon.S.neon
|
||||
LOCAL_SRC_FILES += $(RARCH_DIR)/audio/drivers_resampler/cc_resampler_neon.S.neon
|
||||
endif
|
||||
LOCAL_CFLAGS += -DSINC_LOWER_QUALITY
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <objc/runtime.h>
|
||||
|
||||
#import "../common/RetroArch_Apple.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "../../input/drivers/apple_input.h"
|
||||
#include "../../frontend/frontend.h"
|
||||
#include "../../menu/menu.h"
|
||||
#include "../../retroarch.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#import <objc/runtime.h>
|
||||
#import "../common/RetroArch_Apple.h"
|
||||
#include "../../settings_data.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "../../input/drivers/apple_input.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../input/input_common.h"
|
||||
|
@ -72,7 +72,7 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
|||
int32_t idx = self.setting->index ? self.setting->index - 1 : 0;
|
||||
|
||||
if ((value = apple_input_find_any_key()))
|
||||
BINDFOR(*[self setting]).key = input_translate_keysym_to_rk(value);
|
||||
BINDFOR(*[self setting]).key = input_keymaps_translate_keysym_to_rk(value);
|
||||
else if ((value = apple_input_find_any_button(idx)) >= 0)
|
||||
BINDFOR(*[self setting]).joykey = value;
|
||||
else if ((value = apple_input_find_any_axis(idx)))
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "RetroArch_Apple.h"
|
||||
#import <GameController/GameController.h>
|
||||
#include "apple_gamecontroller.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "../../input/drivers/apple_input.h"
|
||||
|
||||
static BOOL apple_gamecontroller_available(void)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#endif
|
||||
|
||||
#include "../../gfx/gfx_common.h"
|
||||
#include "../../gfx/gfx_context.h"
|
||||
#include "../../gfx/video_context_driver.h"
|
||||
#include "../../gfx/gl_common.h"
|
||||
|
||||
//#define HAVE_NSOPENGL
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
501232C8192E5FB00063A359 /* apple_gamecontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 501232C7192E5FB00063A359 /* apple_gamecontroller.m */; };
|
||||
501232CA192E5FC40063A359 /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = 501232C9192E5FC40063A359 /* griffin.c */; };
|
||||
501232CC192E5FDC0063A359 /* sinc_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 501232CB192E5FDC0063A359 /* sinc_neon.S */; };
|
||||
501232CE192E5FE30063A359 /* utils_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 501232CD192E5FE30063A359 /* utils_neon.S */; };
|
||||
501232CE192E5FE30063A359 /* audio_utils_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 501232CD192E5FE30063A359 /* audio_utils_neon.S */; };
|
||||
501232D6192E60580063A359 /* platform.m in Sources */ = {isa = PBXBuildFile; fileRef = 501232D5192E60580063A359 /* platform.m */; };
|
||||
501232D8192E605F0063A359 /* browser.m in Sources */ = {isa = PBXBuildFile; fileRef = 501232D7192E605F0063A359 /* browser.m */; };
|
||||
501232DA192E606D0063A359 /* menu.m in Sources */ = {isa = PBXBuildFile; fileRef = 501232D9192E606D0063A359 /* menu.m */; };
|
||||
|
@ -42,8 +42,8 @@
|
|||
/* Begin PBXFileReference section */
|
||||
501232C7192E5FB00063A359 /* apple_gamecontroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = apple_gamecontroller.m; path = ../common/apple_gamecontroller.m; sourceTree = "<group>"; };
|
||||
501232C9192E5FC40063A359 /* griffin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = griffin.c; path = ../../griffin/griffin.c; sourceTree = "<group>"; };
|
||||
501232CB192E5FDC0063A359 /* sinc_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = sinc_neon.S; path = ../../audio/resamplers/sinc_neon.S; sourceTree = "<group>"; };
|
||||
501232CD192E5FE30063A359 /* utils_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = utils_neon.S; path = ../../audio/utils_neon.S; sourceTree = "<group>"; };
|
||||
501232CB192E5FDC0063A359 /* sinc_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = sinc_neon.S; path = ../../audio/drivers_resampler/sinc_neon.S; sourceTree = "<group>"; };
|
||||
501232CD192E5FE30063A359 /* audio_utils_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = audio_utils_neon.S; path = ../../audio/audio_utils_neon.S; sourceTree = "<group>"; };
|
||||
501232D5192E60580063A359 /* platform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = platform.m; sourceTree = "<group>"; };
|
||||
501232D7192E605F0063A359 /* browser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = browser.m; sourceTree = "<group>"; };
|
||||
501232D9192E606D0063A359 /* menu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = menu.m; sourceTree = "<group>"; };
|
||||
|
@ -52,7 +52,7 @@
|
|||
5073C587196C0BA40026E146 /* RAGameView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAGameView.m; path = ../common/RAGameView.m; sourceTree = SOURCE_ROOT; };
|
||||
5073C588196C0BA40026E146 /* utility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = utility.m; path = ../common/utility.m; sourceTree = SOURCE_ROOT; };
|
||||
50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
|
||||
50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = cc_resampler_neon.S; path = ../../audio/resamplers/cc_resampler_neon.S; sourceTree = "<group>"; };
|
||||
50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = cc_resampler_neon.S; path = ../../audio/drivers_resampler/cc_resampler_neon.S; sourceTree = "<group>"; };
|
||||
50E7189E184B88AA001956CE /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
|
||||
6949E72219FABADC00CC7F42 /* CFExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CFExtensions.m; path = ../common/CFExtensions.m; sourceTree = "<group>"; };
|
||||
696012F119F3389A006A1088 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
|
||||
|
@ -201,7 +201,7 @@
|
|||
96AFAEE516C1DC73009DE44C /* audio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
501232CD192E5FE30063A359 /* utils_neon.S */,
|
||||
501232CD192E5FE30063A359 /* audio_utils_neon.S */,
|
||||
501232CB192E5FDC0063A359 /* sinc_neon.S */,
|
||||
);
|
||||
name = audio;
|
||||
|
@ -312,7 +312,7 @@
|
|||
501232DA192E606D0063A359 /* menu.m in Sources */,
|
||||
501232D8192E605F0063A359 /* browser.m in Sources */,
|
||||
501232D6192E60580063A359 /* platform.m in Sources */,
|
||||
501232CE192E5FE30063A359 /* utils_neon.S in Sources */,
|
||||
501232CE192E5FE30063A359 /* audio_utils_neon.S in Sources */,
|
||||
501232C8192E5FB00063A359 /* apple_gamecontroller.m in Sources */,
|
||||
5073C58A196C0BA40026E146 /* RAGameView.m in Sources */,
|
||||
501232CC192E5FDC0063A359 /* sinc_neon.S in Sources */,
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
#include "../common/RetroArch_Apple.h"
|
||||
#include "../../input/input_common.h"
|
||||
#include "../../input/input_keymaps.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "../../input/drivers/apple_input.h"
|
||||
#include <file/file_path.h>
|
||||
#include "menu.h"
|
||||
|
||||
#include "../../menu/menu.h"
|
||||
#include "../../menu/menu_entries.h"
|
||||
#include "../../menu/disp/shared.h"
|
||||
#include "../../menu/drivers_display/shared.h"
|
||||
|
||||
/*********************************************/
|
||||
/* RunActionSheet */
|
||||
|
@ -558,7 +558,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||
idx = self.setting->index - 1;
|
||||
|
||||
if ((value = apple_input_find_any_key()))
|
||||
BINDFOR(*self.setting).key = input_translate_keysym_to_rk(value);
|
||||
BINDFOR(*self.setting).key = input_keymaps_translate_keysym_to_rk(value);
|
||||
else if ((value = apple_input_find_any_button(idx)) >= 0)
|
||||
BINDFOR(*self.setting).joykey = value;
|
||||
else if ((value = apple_input_find_any_axis(idx)))
|
||||
|
@ -717,7 +717,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||
|
||||
- (void)menuBack
|
||||
{
|
||||
apply_deferred_settings();
|
||||
menu_apply_deferred_settings();
|
||||
menu_list_pop_stack(driver.menu->menu_list);
|
||||
[self menuRefresh];
|
||||
[self reloadData];
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "../common/RetroArch_Apple.h"
|
||||
#include "../../input/apple_input.h"
|
||||
#include "../../input/drivers/apple_input.h"
|
||||
#include "../../settings_data.h"
|
||||
#include "../common/apple_gamecontroller.h"
|
||||
#include "menu.h"
|
||||
|
@ -27,7 +27,7 @@
|
|||
#include "bluetooth/btdynamic.h"
|
||||
#include "bluetooth/btpad.h"
|
||||
|
||||
#include "../../menu/disp/ios.h"
|
||||
#include "../../menu/drivers_display/ios.h"
|
||||
|
||||
id<RetroArch_Platform> apple_platform;
|
||||
|
||||
|
|
|
@ -0,0 +1,383 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - 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 <string.h>
|
||||
#include <string/string_list.h>
|
||||
#include "audio_driver.h"
|
||||
#include "audio_utils.h"
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
static const audio_driver_t *audio_drivers[] = {
|
||||
#ifdef HAVE_ALSA
|
||||
&audio_alsa,
|
||||
#ifndef __QNX__
|
||||
&audio_alsathread,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HAVE_OSS) || defined(HAVE_OSS_BSD)
|
||||
&audio_oss,
|
||||
#endif
|
||||
#ifdef HAVE_RSOUND
|
||||
&audio_rsound,
|
||||
#endif
|
||||
#ifdef HAVE_COREAUDIO
|
||||
&audio_coreaudio,
|
||||
#endif
|
||||
#ifdef HAVE_AL
|
||||
&audio_openal,
|
||||
#endif
|
||||
#ifdef HAVE_SL
|
||||
&audio_opensl,
|
||||
#endif
|
||||
#ifdef HAVE_ROAR
|
||||
&audio_roar,
|
||||
#endif
|
||||
#ifdef HAVE_JACK
|
||||
&audio_jack,
|
||||
#endif
|
||||
#if defined(HAVE_SDL) || defined(HAVE_SDL2)
|
||||
&audio_sdl,
|
||||
#endif
|
||||
#ifdef HAVE_XAUDIO
|
||||
&audio_xa,
|
||||
#endif
|
||||
#ifdef HAVE_DSOUND
|
||||
&audio_dsound,
|
||||
#endif
|
||||
#ifdef HAVE_PULSE
|
||||
&audio_pulse,
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
&audio_ps3,
|
||||
#endif
|
||||
#ifdef XENON
|
||||
&audio_xenon360,
|
||||
#endif
|
||||
#ifdef GEKKO
|
||||
&audio_gx,
|
||||
#endif
|
||||
#ifdef EMSCRIPTEN
|
||||
&audio_rwebaudio,
|
||||
#endif
|
||||
#ifdef PSP
|
||||
&audio_psp1,
|
||||
#endif
|
||||
&audio_null,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/**
|
||||
* compute_audio_buffer_statistics:
|
||||
*
|
||||
* Computes audio buffer statistics.
|
||||
*
|
||||
**/
|
||||
static void compute_audio_buffer_statistics(void)
|
||||
{
|
||||
unsigned i, low_water_size, high_water_size, avg, stddev;
|
||||
float avg_filled, deviation;
|
||||
uint64_t accum = 0, accum_var = 0;
|
||||
unsigned low_water_count = 0, high_water_count = 0;
|
||||
unsigned samples = min(g_extern.measure_data.buffer_free_samples_count,
|
||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT);
|
||||
|
||||
if (samples < 3)
|
||||
return;
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
accum += g_extern.measure_data.buffer_free_samples[i];
|
||||
|
||||
avg = accum / (samples - 1);
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
{
|
||||
int diff = avg - g_extern.measure_data.buffer_free_samples[i];
|
||||
accum_var += diff * diff;
|
||||
}
|
||||
|
||||
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
|
||||
avg_filled = 1.0f - (float)avg / g_extern.audio_data.driver_buffer_size;
|
||||
deviation = (float)stddev / g_extern.audio_data.driver_buffer_size;
|
||||
|
||||
low_water_size = g_extern.audio_data.driver_buffer_size * 3 / 4;
|
||||
high_water_size = g_extern.audio_data.driver_buffer_size / 4;
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
{
|
||||
if (g_extern.measure_data.buffer_free_samples[i] >= low_water_size)
|
||||
low_water_count++;
|
||||
else if (g_extern.measure_data.buffer_free_samples[i] <= high_water_size)
|
||||
high_water_count++;
|
||||
}
|
||||
|
||||
RARCH_LOG("Average audio buffer saturation: %.2f %%, standard deviation (percentage points): %.2f %%.\n",
|
||||
avg_filled * 100.0, deviation * 100.0);
|
||||
RARCH_LOG("Amount of time spent close to underrun: %.2f %%. Close to blocking: %.2f %%.\n",
|
||||
(100.0 * low_water_count) / (samples - 1),
|
||||
(100.0 * high_water_count) / (samples - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_driver_find_handle(int index)
|
||||
{
|
||||
const void *drv = audio_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *audio_driver_find_ident(int index)
|
||||
{
|
||||
const audio_driver_t *drv = audio_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
for (i = 0; audio_driver_find_handle(i); i++)
|
||||
{
|
||||
const char *opt = audio_driver_find_ident(i);
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
||||
|
||||
options = (char*)calloc(options_len, sizeof(char));
|
||||
|
||||
string_list_join_concat(options, options_len, options_l, "|");
|
||||
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
void find_audio_driver(void)
|
||||
{
|
||||
int i = find_driver_index("audio_driver", g_settings.audio.driver);
|
||||
if (i >= 0)
|
||||
driver.audio = (const audio_driver_t*)audio_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
|
||||
g_settings.audio.driver);
|
||||
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
|
||||
for (d = 0; audio_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", audio_driver_find_ident(d));
|
||||
RARCH_WARN("Going to default to first audio driver...\n");
|
||||
|
||||
driver.audio = (const audio_driver_t*)audio_driver_find_handle(0);
|
||||
|
||||
if (!driver.audio)
|
||||
rarch_fail(1, "find_audio_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
void uninit_audio(void)
|
||||
{
|
||||
if (driver.audio_data && driver.audio)
|
||||
driver.audio->free(driver.audio_data);
|
||||
|
||||
free(g_extern.audio_data.conv_outsamples);
|
||||
g_extern.audio_data.conv_outsamples = NULL;
|
||||
g_extern.audio_data.data_ptr = 0;
|
||||
|
||||
free(g_extern.audio_data.rewind_buf);
|
||||
g_extern.audio_data.rewind_buf = NULL;
|
||||
|
||||
if (!g_settings.audio.enable)
|
||||
{
|
||||
driver.audio_active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
rarch_resampler_freep(&driver.resampler,
|
||||
&driver.resampler_data);
|
||||
|
||||
free(g_extern.audio_data.data);
|
||||
g_extern.audio_data.data = NULL;
|
||||
|
||||
free(g_extern.audio_data.outsamples);
|
||||
g_extern.audio_data.outsamples = NULL;
|
||||
|
||||
rarch_main_command(RARCH_CMD_DSP_FILTER_DEINIT);
|
||||
|
||||
compute_audio_buffer_statistics();
|
||||
}
|
||||
|
||||
void init_audio(void)
|
||||
{
|
||||
size_t outsamples_max, max_bufsamples = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
|
||||
|
||||
audio_convert_init_simd();
|
||||
|
||||
/* Resource leaks will follow if audio is initialized twice. */
|
||||
if (driver.audio_data)
|
||||
return;
|
||||
|
||||
/* Accomodate rewind since at some point we might have two full buffers. */
|
||||
outsamples_max = max_bufsamples * AUDIO_MAX_RATIO *
|
||||
g_settings.slowmotion_ratio;
|
||||
|
||||
/* Used for recording even if audio isn't enabled. */
|
||||
rarch_assert(g_extern.audio_data.conv_outsamples =
|
||||
(int16_t*)malloc(outsamples_max * sizeof(int16_t)));
|
||||
|
||||
g_extern.audio_data.block_chunk_size = AUDIO_CHUNK_SIZE_BLOCKING;
|
||||
g_extern.audio_data.nonblock_chunk_size = AUDIO_CHUNK_SIZE_NONBLOCKING;
|
||||
g_extern.audio_data.chunk_size =
|
||||
g_extern.audio_data.block_chunk_size;
|
||||
|
||||
/* Needs to be able to hold full content of a full max_bufsamples
|
||||
* in addition to its own. */
|
||||
rarch_assert(g_extern.audio_data.rewind_buf = (int16_t*)
|
||||
malloc(max_bufsamples * sizeof(int16_t)));
|
||||
g_extern.audio_data.rewind_size = max_bufsamples;
|
||||
|
||||
if (!g_settings.audio.enable)
|
||||
{
|
||||
driver.audio_active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
find_audio_driver();
|
||||
#ifdef HAVE_THREADS
|
||||
if (g_extern.system.audio_callback.callback)
|
||||
{
|
||||
RARCH_LOG("Starting threaded audio driver ...\n");
|
||||
if (!rarch_threaded_audio_init(&driver.audio, &driver.audio_data,
|
||||
*g_settings.audio.device ? g_settings.audio.device : NULL,
|
||||
g_settings.audio.out_rate, g_settings.audio.latency,
|
||||
driver.audio))
|
||||
{
|
||||
RARCH_ERR("Cannot open threaded audio driver ... Exiting ...\n");
|
||||
rarch_fail(1, "init_audio()");
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
driver.audio_data = driver.audio->init(*g_settings.audio.device ?
|
||||
g_settings.audio.device : NULL,
|
||||
g_settings.audio.out_rate, g_settings.audio.latency);
|
||||
}
|
||||
|
||||
if (!driver.audio_data)
|
||||
{
|
||||
RARCH_ERR("Failed to initialize audio driver. Will continue without audio.\n");
|
||||
driver.audio_active = false;
|
||||
}
|
||||
|
||||
g_extern.audio_data.use_float = false;
|
||||
if (driver.audio_active && driver.audio->use_float(driver.audio_data))
|
||||
g_extern.audio_data.use_float = true;
|
||||
|
||||
if (!g_settings.audio.sync && driver.audio_active)
|
||||
{
|
||||
rarch_main_command(RARCH_CMD_AUDIO_SET_NONBLOCKING_STATE);
|
||||
g_extern.audio_data.chunk_size =
|
||||
g_extern.audio_data.nonblock_chunk_size;
|
||||
}
|
||||
|
||||
if (g_extern.audio_data.in_rate <= 0.0f)
|
||||
{
|
||||
/* Should never happen. */
|
||||
RARCH_WARN("Input rate is invalid (%.3f Hz). Using output rate (%u Hz).\n",
|
||||
g_extern.audio_data.in_rate, g_settings.audio.out_rate);
|
||||
g_extern.audio_data.in_rate = g_settings.audio.out_rate;
|
||||
}
|
||||
|
||||
g_extern.audio_data.orig_src_ratio =
|
||||
g_extern.audio_data.src_ratio =
|
||||
(double)g_settings.audio.out_rate / g_extern.audio_data.in_rate;
|
||||
|
||||
if (!rarch_resampler_realloc(&driver.resampler_data,
|
||||
&driver.resampler,
|
||||
g_settings.audio.resampler, g_extern.audio_data.orig_src_ratio))
|
||||
{
|
||||
RARCH_ERR("Failed to initialize resampler \"%s\".\n",
|
||||
g_settings.audio.resampler);
|
||||
driver.audio_active = false;
|
||||
}
|
||||
|
||||
rarch_assert(g_extern.audio_data.data = (float*)
|
||||
malloc(max_bufsamples * sizeof(float)));
|
||||
|
||||
g_extern.audio_data.data_ptr = 0;
|
||||
|
||||
rarch_assert(g_settings.audio.out_rate <
|
||||
g_extern.audio_data.in_rate * AUDIO_MAX_RATIO);
|
||||
rarch_assert(g_extern.audio_data.outsamples = (float*)
|
||||
malloc(outsamples_max * sizeof(float)));
|
||||
|
||||
g_extern.audio_data.rate_control = false;
|
||||
if (!g_extern.system.audio_callback.callback && driver.audio_active &&
|
||||
g_settings.audio.rate_control)
|
||||
{
|
||||
if (driver.audio->buffer_size && driver.audio->write_avail)
|
||||
{
|
||||
g_extern.audio_data.driver_buffer_size =
|
||||
driver.audio->buffer_size(driver.audio_data);
|
||||
g_extern.audio_data.rate_control = true;
|
||||
}
|
||||
else
|
||||
RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n");
|
||||
}
|
||||
|
||||
rarch_main_command(RARCH_CMD_DSP_FILTER_DEINIT);
|
||||
|
||||
g_extern.measure_data.buffer_free_samples_count = 0;
|
||||
|
||||
if (driver.audio_active && !g_extern.audio_data.mute &&
|
||||
g_extern.system.audio_callback.callback)
|
||||
{
|
||||
/* Threaded driver is initially stopped. */
|
||||
driver.audio->start(driver.audio_data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - 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 __AUDIO_DRIVER__H
|
||||
#define __AUDIO_DRIVER__H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
void *(*init)(const char *device, unsigned rate, unsigned latency);
|
||||
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
|
||||
bool (*stop)(void *data);
|
||||
|
||||
bool (*start)(void *data);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Should we care about blocking in audio thread? Fast forwarding. */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
|
||||
void (*free)(void *data);
|
||||
|
||||
/* Defines if driver will take standard floating point samples,
|
||||
* or int16_t samples. */
|
||||
bool (*use_float)(void *data);
|
||||
|
||||
/* Human-readable identifier. */
|
||||
const char *ident;
|
||||
|
||||
/* Optional. */
|
||||
size_t (*write_avail)(void *data);
|
||||
|
||||
size_t (*buffer_size)(void *data);
|
||||
} audio_driver_t;
|
||||
|
||||
extern audio_driver_t audio_rsound;
|
||||
extern audio_driver_t audio_oss;
|
||||
extern audio_driver_t audio_alsa;
|
||||
extern audio_driver_t audio_alsathread;
|
||||
extern audio_driver_t audio_roar;
|
||||
extern audio_driver_t audio_openal;
|
||||
extern audio_driver_t audio_opensl;
|
||||
extern audio_driver_t audio_jack;
|
||||
extern audio_driver_t audio_sdl;
|
||||
extern audio_driver_t audio_xa;
|
||||
extern audio_driver_t audio_pulse;
|
||||
extern audio_driver_t audio_dsound;
|
||||
extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
extern audio_driver_t audio_psp1;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *audio_driver_find_ident(int index);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void);
|
||||
|
||||
void find_audio_driver(void);
|
||||
|
||||
void uninit_audio(void);
|
||||
|
||||
void init_audio(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "../performance.h"
|
||||
|
||||
#include "dsp_filter.h"
|
||||
#include "audio_dsp_filter.h"
|
||||
#include "../dynamic.h"
|
||||
#include <file/config_file_userdata.h>
|
||||
#include "audio_filters/dspfilter.h"
|
|
@ -14,8 +14,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RARCH_DSP_FILTER_H__
|
||||
#define RARCH_DSP_FILTER_H__
|
||||
#ifndef __AUDIO_DSP_FILTER_H__
|
||||
#define __AUDIO_DSP_FILTER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
|
@ -14,12 +14,15 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "resampler.h"
|
||||
#include "audio_resampler_driver.h"
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../../performance.h"
|
||||
#include "../performance.h"
|
||||
#endif
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <string.h>
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
#include <string/string_list.h>
|
||||
#endif
|
||||
|
||||
static const rarch_resampler_t *resampler_drivers[] = {
|
||||
&sinc_resampler,
|
||||
|
@ -56,44 +59,37 @@ static int find_resampler_driver_index(const char *ident)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(RESAMPLER_TEST) && defined(RARCH_INTERNAL)
|
||||
#include <string/string_list.h>
|
||||
#include "../../general.h"
|
||||
|
||||
/**
|
||||
* find_prev_resampler_driver:
|
||||
* audio_resampler_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Finds previous driver in resampler driver array.
|
||||
* Returns: handle to audio resampler driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
void find_prev_resampler_driver(void)
|
||||
const void *audio_resampler_driver_find_handle(int index)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
|
||||
if (i > 0)
|
||||
strlcpy(g_settings.audio.resampler, resampler_drivers[i - 1]->ident,
|
||||
sizeof(g_settings.audio.resampler));
|
||||
else
|
||||
RARCH_WARN("Couldn't find any previous resampler driver (current one: \"%s\").\n",
|
||||
driver.resampler->ident);
|
||||
const void *drv = resampler_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv;
|
||||
}
|
||||
|
||||
/**
|
||||
* find_next_resampler_driver:
|
||||
* audio_resampler_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Finds next driver in resampler driver array.
|
||||
* Returns: Human-readable identifier of audio resampler driver at index.
|
||||
* Can be NULL if nothing found.
|
||||
**/
|
||||
void find_next_resampler_driver(void)
|
||||
const char *audio_resampler_driver_find_ident(int index)
|
||||
{
|
||||
int i = find_resampler_driver_index(g_settings.audio.resampler);
|
||||
|
||||
if (i >= 0 && resampler_drivers[i + 1])
|
||||
strlcpy(g_settings.audio.resampler, resampler_drivers[i + 1]->ident,
|
||||
sizeof(g_settings.audio.resampler));
|
||||
else
|
||||
RARCH_WARN("Couldn't find any next resampler driver (current one: \"%s\").\n",
|
||||
driver.resampler->ident);
|
||||
const rarch_resampler_t *drv = resampler_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
|
@ -104,16 +100,16 @@ void find_next_resampler_driver(void)
|
|||
const char* config_get_audio_resampler_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int option_k = 0;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
for (option_k = 0; resampler_drivers[option_k]; option_k++)
|
||||
for (i = 0; resampler_drivers[i]; i++)
|
||||
{
|
||||
const char *opt = resampler_drivers[option_k]->ident;
|
||||
const char *opt = resampler_drivers[i]->ident;
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef __RARCH_RESAMPLER_H
|
||||
#define __RARCH_RESAMPLER_H
|
||||
#ifndef __AUDIO_RESAMPLER_DRIVER_H
|
||||
#define __AUDIO_RESAMPLER_DRIVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -143,6 +143,35 @@ extern rarch_resampler_t sinc_resampler;
|
|||
extern rarch_resampler_t CC_resampler;
|
||||
extern rarch_resampler_t nearest_resampler;
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio resampler driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_resampler_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio resampler driver at index.
|
||||
* Can be NULL if nothing found.
|
||||
**/
|
||||
const char *audio_resampler_driver_find_ident(int index);
|
||||
|
||||
/**
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
|
@ -18,7 +18,7 @@
|
|||
#include <rthreads/rthreads.h>
|
||||
#include "../general.h"
|
||||
#include "../performance.h"
|
||||
#include "../fifo_buffer.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#include <boolean.h>
|
||||
#include "utils.h"
|
||||
#include "audio_utils.h"
|
||||
|
||||
#include "../performance.h"
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "../general.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) { \
|
||||
goto error; \
|
|
@ -14,8 +14,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../general.h"
|
||||
#include "../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "../general.h"
|
||||
#include "../../general.h"
|
||||
#include <rthreads/rthreads.h>
|
||||
#include "../fifo_buffer.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) { \
|
||||
goto error; \
|
||||
|
@ -284,9 +284,9 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t size)
|
|||
static bool alsa_thread_alive(void *data)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||
if (alsa)
|
||||
return !alsa->is_paused;
|
||||
return false;
|
||||
if (!alsa)
|
||||
return false;
|
||||
return !alsa->is_paused;
|
||||
}
|
||||
|
||||
static bool alsa_thread_stop(void *data)
|
|
@ -14,10 +14,9 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../fifo_buffer.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <pthread.h>
|
||||
|
@ -55,6 +54,7 @@ static bool g_interrupted;
|
|||
static void coreaudio_free(void *data)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
|
@ -82,7 +82,10 @@ static OSStatus audio_write_cb(void *userdata,
|
|||
const AudioTimeStamp *time_stamp, UInt32 bus_number,
|
||||
UInt32 number_frames, AudioBufferList *io_data)
|
||||
{
|
||||
void *outbuf;
|
||||
unsigned write_avail;
|
||||
coreaudio_t *dev = (coreaudio_t*)userdata;
|
||||
|
||||
(void)time_stamp;
|
||||
(void)bus_number;
|
||||
(void)number_frames;
|
||||
|
@ -92,10 +95,11 @@ static OSStatus audio_write_cb(void *userdata,
|
|||
if (io_data->mNumberBuffers != 1)
|
||||
return noErr;
|
||||
|
||||
unsigned write_avail = io_data->mBuffers[0].mDataByteSize;
|
||||
void *outbuf = io_data->mBuffers[0].mData;
|
||||
write_avail = io_data->mBuffers[0].mDataByteSize;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
|
||||
if (fifo_read_avail(dev->buffer) < write_avail)
|
||||
{
|
||||
*action_flags = kAudioUnitRenderAction_OutputIsSilence;
|
||||
|
@ -119,6 +123,8 @@ static OSStatus audio_write_cb(void *userdata,
|
|||
#ifdef OSX
|
||||
static void choose_output_device(coreaudio_t *dev, const char* device)
|
||||
{
|
||||
unsigned i;
|
||||
AudioDeviceID *devices;
|
||||
AudioObjectPropertyAddress propaddr =
|
||||
{
|
||||
kAudioHardwarePropertyDevices,
|
||||
|
@ -126,14 +132,14 @@ static void choose_output_device(coreaudio_t *dev, const char* device)
|
|||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
UInt32 size = 0;
|
||||
UInt32 size = 0, deviceCount;
|
||||
|
||||
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
|
||||
&propaddr, 0, 0, &size) != noErr)
|
||||
return;
|
||||
|
||||
UInt32 deviceCount = size / sizeof(AudioDeviceID);
|
||||
AudioDeviceID *devices = malloc(size);
|
||||
deviceCount = size / sizeof(AudioDeviceID);
|
||||
devices = (AudioDeviceID*)malloc(size);
|
||||
|
||||
if (!devices || AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
||||
&propaddr, 0, 0, &size, devices) != noErr)
|
||||
|
@ -143,7 +149,7 @@ static void choose_output_device(coreaudio_t *dev, const char* device)
|
|||
propaddr.mSelector = kAudioDevicePropertyDeviceName;
|
||||
size = 1024;
|
||||
|
||||
for (unsigned i = 0; i < deviceCount; i ++)
|
||||
for (i = 0; i < deviceCount; i ++)
|
||||
{
|
||||
char device_name[1024];
|
||||
device_name[0] = 0;
|
||||
|
@ -174,6 +180,10 @@ static void coreaudio_interrupt_listener(void *data, UInt32 interrupt_state)
|
|||
static void *coreaudio_init(const char *device,
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
static bool session_initialized = false;
|
||||
UInt32 i_size;
|
||||
|
||||
(void)session_initialized;
|
||||
(void)device;
|
||||
|
||||
coreaudio_t *dev = (coreaudio_t*)calloc(1, sizeof(*dev));
|
||||
|
@ -184,7 +194,6 @@ static void *coreaudio_init(const char *device,
|
|||
pthread_cond_init(&dev->cond, NULL);
|
||||
|
||||
#ifdef IOS
|
||||
static bool session_initialized = false;
|
||||
if (!session_initialized)
|
||||
{
|
||||
session_initialized = true;
|
||||
|
@ -249,7 +258,7 @@ static void *coreaudio_init(const char *device,
|
|||
goto error;
|
||||
|
||||
/* Check returned audio format. */
|
||||
UInt32 i_size = sizeof(real_desc);;
|
||||
i_size = sizeof(real_desc);;
|
||||
if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input, 0, &real_desc, &i_size) != noErr)
|
||||
goto error;
|
||||
|
@ -333,9 +342,11 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
|||
|
||||
while (!g_interrupted && size > 0)
|
||||
{
|
||||
size_t write_avail;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
|
||||
size_t write_avail = fifo_write_avail(dev->buffer);
|
||||
write_avail = fifo_write_avail(dev->buffer);
|
||||
if (write_avail > size)
|
||||
write_avail = size;
|
||||
|
||||
|
@ -374,14 +385,16 @@ static void coreaudio_set_nonblock_state(void *data, bool state)
|
|||
static bool coreaudio_alive(void *data)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
if (dev)
|
||||
return !dev->is_paused;
|
||||
return false;
|
||||
if (!dev)
|
||||
return false;
|
||||
return !dev->is_paused;
|
||||
}
|
||||
|
||||
static bool coreaudio_stop(void *data)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
if (!dev)
|
||||
return false;
|
||||
dev->is_paused = (AudioOutputUnitStop(dev->dev) == noErr) ? true : false;
|
||||
return dev->is_paused ? true : false;
|
||||
}
|
||||
|
@ -389,6 +402,8 @@ static bool coreaudio_stop(void *data)
|
|||
static bool coreaudio_start(void *data)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
if (!dev)
|
||||
return false;
|
||||
dev->is_paused = (AudioOutputUnitStart(dev->dev) == noErr) ? false : true;
|
||||
return dev->is_paused ? false : true;
|
||||
}
|
||||
|
@ -401,10 +416,13 @@ static bool coreaudio_use_float(void *data)
|
|||
|
||||
static size_t coreaudio_write_avail(void *data)
|
||||
{
|
||||
size_t avail;
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
|
||||
pthread_mutex_lock(&dev->lock);
|
||||
size_t avail = fifo_write_avail(dev->buffer);
|
||||
avail = fifo_write_avail(dev->buffer);
|
||||
pthread_mutex_unlock(&dev->lock);
|
||||
|
||||
return avail;
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ static DSMIXBINVOLUMEPAIR dsmbvp[8] = {
|
|||
static DSMIXBINS dsmb;
|
||||
#endif
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
|
@ -52,8 +52,8 @@ static DSMIXBINS dsmb;
|
|||
#include <mmsystem.h>
|
||||
#endif
|
||||
#include <dsound.h>
|
||||
#include "../fifo_buffer.h"
|
||||
#include "../general.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct dsound
|
||||
{
|
||||
|
@ -93,21 +93,25 @@ struct audio_lock
|
|||
DWORD size2;
|
||||
};
|
||||
|
||||
static inline bool grab_region(dsound_t *ds, DWORD write_ptr, struct audio_lock *region)
|
||||
static inline bool grab_region(dsound_t *ds, DWORD write_ptr,
|
||||
struct audio_lock *region)
|
||||
{
|
||||
HRESULT res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE, ®ion->chunk1, ®ion->size1, ®ion->chunk2, ®ion->size2, 0);
|
||||
const char *err;
|
||||
HRESULT res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE,
|
||||
®ion->chunk1, ®ion->size1, ®ion->chunk2, ®ion->size2, 0);
|
||||
|
||||
if (res == DSERR_BUFFERLOST)
|
||||
{
|
||||
res = IDirectSoundBuffer_Restore(ds->dsb);
|
||||
if (res != DS_OK)
|
||||
return false;
|
||||
|
||||
res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE, ®ion->chunk1, ®ion->size1, ®ion->chunk2, ®ion->size2, 0);
|
||||
res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE,
|
||||
®ion->chunk1, ®ion->size1, ®ion->chunk2, ®ion->size2, 0);
|
||||
if (res != DS_OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *err;
|
||||
switch (res)
|
||||
{
|
||||
case DSERR_BUFFERLOST:
|
||||
|
@ -143,34 +147,43 @@ static inline void release_region(dsound_t *ds, const struct audio_lock *region)
|
|||
|
||||
static DWORD CALLBACK dsound_thread(PVOID data)
|
||||
{
|
||||
DWORD write_ptr;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
|
||||
DWORD write_ptr;
|
||||
get_positions(ds, NULL, &write_ptr);
|
||||
write_ptr = (write_ptr + ds->buffer_size / 2) % ds->buffer_size;
|
||||
|
||||
while (ds->thread_alive)
|
||||
{
|
||||
DWORD read_ptr;
|
||||
struct audio_lock region;
|
||||
DWORD read_ptr, avail, fifo_avail;
|
||||
get_positions(ds, &read_ptr, NULL);
|
||||
|
||||
DWORD avail = write_avail(read_ptr, write_ptr, ds->buffer_size);
|
||||
avail = write_avail(read_ptr, write_ptr, ds->buffer_size);
|
||||
|
||||
EnterCriticalSection(&ds->crit);
|
||||
DWORD fifo_avail = fifo_read_avail(ds->buffer);
|
||||
fifo_avail = fifo_read_avail(ds->buffer);
|
||||
LeaveCriticalSection(&ds->crit);
|
||||
|
||||
// No space to write, or we don't have data in our fifo, but we can wait some time before it underruns ...
|
||||
if (avail < CHUNK_SIZE || ((fifo_avail < CHUNK_SIZE) && (avail < ds->buffer_size / 2)))
|
||||
{
|
||||
/* No space to write, or we don't have data in our fifo,
|
||||
* but we can wait some time before it underruns ... */
|
||||
|
||||
Sleep(1);
|
||||
// We could opt for using the notification interface,
|
||||
// but it is not guaranteed to work, so use high priority sleeping patterns. :(
|
||||
|
||||
/* We could opt for using the notification interface,
|
||||
* but it is not guaranteed to work, so use high
|
||||
* priority sleeping patterns.
|
||||
*/
|
||||
}
|
||||
else if (fifo_avail < CHUNK_SIZE) // Got space to write, but nothing in FIFO (underrun), fill block with silence.
|
||||
else if (fifo_avail < CHUNK_SIZE)
|
||||
{
|
||||
struct audio_lock region;
|
||||
/* Got space to write, but nothing in FIFO (underrun),
|
||||
* fill block with silence. */
|
||||
|
||||
if (!grab_region(ds, write_ptr, ®ion))
|
||||
{
|
||||
ds->thread_alive = false;
|
||||
|
@ -184,9 +197,10 @@ static DWORD CALLBACK dsound_thread(PVOID data)
|
|||
release_region(ds, ®ion);
|
||||
write_ptr = (write_ptr + region.size1 + region.size2) % ds->buffer_size;
|
||||
}
|
||||
else // All is good. Pull from it and notify FIFO :D
|
||||
else
|
||||
{
|
||||
struct audio_lock region;
|
||||
/* All is good. Pull from it and notify FIFO. */
|
||||
|
||||
if (!grab_region(ds, write_ptr, ®ion))
|
||||
{
|
||||
ds->thread_alive = false;
|
||||
|
@ -213,13 +227,13 @@ static DWORD CALLBACK dsound_thread(PVOID data)
|
|||
|
||||
static void dsound_stop_thread(dsound_t *ds)
|
||||
{
|
||||
if (ds->thread)
|
||||
{
|
||||
ds->thread_alive = false;
|
||||
WaitForSingleObject(ds->thread, INFINITE);
|
||||
CloseHandle(ds->thread);
|
||||
ds->thread = NULL;
|
||||
}
|
||||
if (!ds->thread)
|
||||
return;
|
||||
|
||||
ds->thread_alive = false;
|
||||
WaitForSingleObject(ds->thread, INFINITE);
|
||||
CloseHandle(ds->thread);
|
||||
ds->thread = NULL;
|
||||
}
|
||||
|
||||
static bool dsound_start_thread(dsound_t *ds)
|
||||
|
@ -237,11 +251,12 @@ static bool dsound_start_thread(dsound_t *ds)
|
|||
|
||||
static void dsound_clear_buffer(dsound_t *ds)
|
||||
{
|
||||
IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0);
|
||||
void *ptr;
|
||||
DWORD size;
|
||||
IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0);
|
||||
|
||||
if (IDirectSoundBuffer_Lock(ds->dsb, 0, 0, &ptr, &size, NULL, NULL, DSBLOCK_ENTIREBUFFER) == DS_OK)
|
||||
if (IDirectSoundBuffer_Lock(ds->dsb, 0, 0, &ptr, &size,
|
||||
NULL, NULL, DSBLOCK_ENTIREBUFFER) == DS_OK)
|
||||
{
|
||||
memset(ptr, 0, size);
|
||||
IDirectSoundBuffer_Unlock(ds->dsb, ptr, size, NULL, 0);
|
||||
|
@ -251,34 +266,35 @@ static void dsound_clear_buffer(dsound_t *ds)
|
|||
static void dsound_free(void *data)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
if (ds)
|
||||
|
||||
if (!ds)
|
||||
return;
|
||||
|
||||
if (ds->thread)
|
||||
{
|
||||
if (ds->thread)
|
||||
{
|
||||
ds->thread_alive = false;
|
||||
WaitForSingleObject(ds->thread, INFINITE);
|
||||
CloseHandle(ds->thread);
|
||||
}
|
||||
|
||||
DeleteCriticalSection(&ds->crit);
|
||||
|
||||
if (ds->dsb)
|
||||
{
|
||||
IDirectSoundBuffer_Stop(ds->dsb);
|
||||
IDirectSoundBuffer_Release(ds->dsb);
|
||||
}
|
||||
|
||||
if (ds->ds)
|
||||
IDirectSound_Release(ds->ds);
|
||||
|
||||
if (ds->event)
|
||||
CloseHandle(ds->event);
|
||||
|
||||
if (ds->buffer)
|
||||
fifo_free(ds->buffer);
|
||||
|
||||
free(ds);
|
||||
ds->thread_alive = false;
|
||||
WaitForSingleObject(ds->thread, INFINITE);
|
||||
CloseHandle(ds->thread);
|
||||
}
|
||||
|
||||
DeleteCriticalSection(&ds->crit);
|
||||
|
||||
if (ds->dsb)
|
||||
{
|
||||
IDirectSoundBuffer_Stop(ds->dsb);
|
||||
IDirectSoundBuffer_Release(ds->dsb);
|
||||
}
|
||||
|
||||
if (ds->ds)
|
||||
IDirectSound_Release(ds->ds);
|
||||
|
||||
if (ds->event)
|
||||
CloseHandle(ds->event);
|
||||
|
||||
if (ds->buffer)
|
||||
fifo_free(ds->buffer);
|
||||
|
||||
free(ds);
|
||||
}
|
||||
|
||||
struct dsound_dev
|
||||
|
@ -291,7 +307,9 @@ struct dsound_dev
|
|||
static BOOL CALLBACK enumerate_cb(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOID context)
|
||||
{
|
||||
struct dsound_dev *dev = (struct dsound_dev*)context;
|
||||
|
||||
RARCH_LOG("\t%u: %s\n", dev->total_count, desc);
|
||||
|
||||
if (dev->device == dev->total_count)
|
||||
dev->guid = guid;
|
||||
dev->total_count++;
|
||||
|
@ -303,8 +321,8 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency)
|
|||
WAVEFORMATEX wfx = {0};
|
||||
DSBUFFERDESC bufdesc = {0};
|
||||
struct dsound_dev dev = {0};
|
||||
|
||||
dsound_t *ds = (dsound_t*)calloc(1, sizeof(*ds));
|
||||
|
||||
if (!ds)
|
||||
goto error;
|
||||
|
||||
|
@ -384,14 +402,17 @@ error:
|
|||
static bool dsound_stop(void *data)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
dsound_stop_thread(ds);
|
||||
ds->is_paused = (IDirectSoundBuffer_Stop(ds->dsb) == DS_OK) ? true : false;
|
||||
|
||||
return (ds->is_paused) ? true : false;
|
||||
}
|
||||
|
||||
static bool dsound_start(void *data)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
dsound_clear_buffer(ds);
|
||||
|
||||
if (!dsound_start_thread(ds))
|
||||
|
@ -404,30 +425,34 @@ static bool dsound_start(void *data)
|
|||
static bool dsound_alive(void *data)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
if (ds)
|
||||
return !ds->is_paused;
|
||||
return false;
|
||||
|
||||
if (!ds)
|
||||
return false;
|
||||
return !ds->is_paused;
|
||||
}
|
||||
|
||||
static void dsound_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
ds->nonblock = state;
|
||||
if (ds)
|
||||
ds->nonblock = state;
|
||||
}
|
||||
|
||||
static ssize_t dsound_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
size_t written = 0;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
|
||||
if (!ds->thread_alive)
|
||||
return -1;
|
||||
|
||||
size_t written = 0;
|
||||
while (size > 0)
|
||||
{
|
||||
size_t avail;
|
||||
|
||||
EnterCriticalSection(&ds->crit);
|
||||
size_t avail = fifo_write_avail(ds->buffer);
|
||||
avail = fifo_write_avail(ds->buffer);
|
||||
if (avail > size)
|
||||
avail = size;
|
||||
|
||||
|
@ -450,9 +475,11 @@ static ssize_t dsound_write(void *data, const void *buf_, size_t size)
|
|||
|
||||
static size_t dsound_write_avail(void *data)
|
||||
{
|
||||
size_t avail;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
EnterCriticalSection(&ds->crit);
|
||||
size_t avail = fifo_write_avail(ds->buffer);
|
||||
avail = fifo_write_avail(ds->buffer);
|
||||
LeaveCriticalSection(&ds->crit);
|
||||
return avail;
|
||||
}
|
|
@ -14,10 +14,10 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include "../general.h"
|
||||
#include "../../general.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef GEKKO
|
||||
|
@ -27,7 +27,7 @@
|
|||
#include <cafe/ai.h>
|
||||
#endif
|
||||
|
||||
#include "../gfx/gx/sdk_defines.h"
|
||||
#include "../../gfx/drivers/gx_sdk_defines.h"
|
||||
|
||||
#define CHUNK_FRAMES 64
|
||||
#define CHUNK_SIZE (CHUNK_FRAMES * sizeof(uint32_t))
|
||||
|
@ -63,20 +63,20 @@ static void dma_callback(void)
|
|||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)gx_audio_data;
|
||||
|
||||
if (!stop_audio)
|
||||
{
|
||||
/* Erase last chunk to avoid repeating audio. */
|
||||
memset(wa->data[wa->dma_busy], 0, CHUNK_SIZE);
|
||||
if (stop_audio)
|
||||
return;
|
||||
|
||||
wa->dma_busy = wa->dma_next;
|
||||
wa->dma_next = (wa->dma_next + 1) & (BLOCKS - 1);
|
||||
/* Erase last chunk to avoid repeating audio. */
|
||||
memset(wa->data[wa->dma_busy], 0, CHUNK_SIZE);
|
||||
|
||||
DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
wa->dma_busy = wa->dma_next;
|
||||
wa->dma_next = (wa->dma_next + 1) & (BLOCKS - 1);
|
||||
|
||||
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
|
||||
OSSignalCond(wa->cond);
|
||||
}
|
||||
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
|
||||
OSSignalCond(wa->cond);
|
||||
}
|
||||
|
||||
static void *gx_audio_init(const char *device,
|
||||
|
@ -135,6 +135,7 @@ static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
|
|||
while (frames)
|
||||
{
|
||||
size_t to_write = CHUNK_FRAMES - wa->write_ptr;
|
||||
|
||||
if (frames < to_write)
|
||||
to_write = frames;
|
||||
|
||||
|
@ -178,15 +179,17 @@ static void gx_audio_set_nonblock_state(void *data, bool state)
|
|||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)data;
|
||||
|
||||
if (!wa)
|
||||
return;
|
||||
|
||||
wa->nonblock = state;
|
||||
if (wa)
|
||||
wa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool gx_audio_start(void *data)
|
||||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)data;
|
||||
|
||||
if (!wa)
|
||||
return false;
|
||||
|
||||
AIStartDMA();
|
||||
wa->is_paused = false;
|
||||
return true;
|
||||
|
@ -195,9 +198,9 @@ static bool gx_audio_start(void *data)
|
|||
static bool gx_audio_alive(void *data)
|
||||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)data;
|
||||
if (wa)
|
||||
return !wa->is_paused;
|
||||
return false;
|
||||
if (!wa)
|
||||
return false;
|
||||
return !wa->is_paused;
|
||||
}
|
||||
|
||||
static void gx_audio_free(void *data)
|
|
@ -14,9 +14,9 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include "../general.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#include <jack/jack.h>
|
||||
#include <jack/types.h>
|
||||
|
@ -46,18 +46,18 @@ typedef struct jack
|
|||
static int process_cb(jack_nframes_t nframes, void *data)
|
||||
{
|
||||
int i;
|
||||
jack_nframes_t f;
|
||||
jack_nframes_t f, avail[2], min_avail;
|
||||
jack_t *jd = (jack_t*)data;
|
||||
|
||||
if (nframes <= 0)
|
||||
{
|
||||
pthread_cond_signal(&jd->cond);
|
||||
return 0;
|
||||
}
|
||||
|
||||
jack_nframes_t avail[2];
|
||||
avail[0] = jack_ringbuffer_read_space(jd->buffer[0]);
|
||||
avail[1] = jack_ringbuffer_read_space(jd->buffer[1]);
|
||||
jack_nframes_t min_avail = ((avail[0] < avail[1]) ? avail[0] : avail[1]) / sizeof(jack_default_audio_sample_t);
|
||||
min_avail = ((avail[0] < avail[1]) ? avail[0] : avail[1]) / sizeof(jack_default_audio_sample_t);
|
||||
|
||||
if (min_avail > nframes)
|
||||
min_avail = nframes;
|
||||
|
@ -69,9 +69,7 @@ static int process_cb(jack_nframes_t nframes, void *data)
|
|||
jack_ringbuffer_read(jd->buffer[i], (char*)out, min_avail * sizeof(jack_default_audio_sample_t));
|
||||
|
||||
for (f = min_avail; f < nframes; f++)
|
||||
{
|
||||
out[f] = 0.0f;
|
||||
}
|
||||
}
|
||||
pthread_cond_signal(&jd->cond);
|
||||
return 0;
|
||||
|
@ -80,6 +78,10 @@ static int process_cb(jack_nframes_t nframes, void *data)
|
|||
static void shutdown_cb(void *data)
|
||||
{
|
||||
jack_t *jd = (jack_t*)data;
|
||||
|
||||
if (!jd)
|
||||
return;
|
||||
|
||||
jd->shutdown = true;
|
||||
pthread_cond_signal(&jd->cond);
|
||||
}
|
||||
|
@ -88,8 +90,8 @@ static int parse_ports(char **dest_ports, const char **jports)
|
|||
{
|
||||
int i;
|
||||
char *save;
|
||||
const char *con = strtok_r(g_settings.audio.device, ",", &save);
|
||||
int parsed = 0;
|
||||
const char *con = strtok_r(g_settings.audio.device, ",", &save);
|
||||
|
||||
if (con)
|
||||
dest_ports[parsed++] = strdup(con);
|
||||
|
@ -105,11 +107,10 @@ static int parse_ports(char **dest_ports, const char **jports)
|
|||
|
||||
static size_t find_buffersize(jack_t *jd, int latency)
|
||||
{
|
||||
int i;
|
||||
int i, buffer_frames, min_buffer_frames, jack_latency = 0;
|
||||
jack_latency_range_t range;
|
||||
int frames = latency * g_settings.audio.out_rate / 1000;
|
||||
|
||||
jack_latency_range_t range;
|
||||
int jack_latency = 0;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
jack_port_get_latency_range(jd->ports[i], JackPlaybackLatency, &range);
|
||||
|
@ -119,8 +120,9 @@ static size_t find_buffersize(jack_t *jd, int latency)
|
|||
|
||||
RARCH_LOG("JACK: Jack latency is %d frames.\n", jack_latency);
|
||||
|
||||
int buffer_frames = frames - jack_latency;
|
||||
int min_buffer_frames = jack_get_buffer_size(jd->client) * 2;
|
||||
buffer_frames = frames - jack_latency;
|
||||
min_buffer_frames = jack_get_buffer_size(jd->client) * 2;
|
||||
|
||||
RARCH_LOG("JACK: Minimum buffer size is %d frames.\n", min_buffer_frames);
|
||||
|
||||
if (buffer_frames < min_buffer_frames)
|
||||
|
@ -132,17 +134,17 @@ static size_t find_buffersize(jack_t *jd, int latency)
|
|||
static void *ja_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
int i;
|
||||
const char **jports = NULL;
|
||||
char *dest_ports[2];
|
||||
size_t bufsize = 0;
|
||||
int parsed = 0;
|
||||
jack_t *jd = (jack_t*)calloc(1, sizeof(jack_t));
|
||||
|
||||
if (!jd)
|
||||
return NULL;
|
||||
|
||||
pthread_cond_init(&jd->cond, NULL);
|
||||
pthread_mutex_init(&jd->cond_lock, NULL);
|
||||
|
||||
const char **jports = NULL;
|
||||
char *dest_ports[2];
|
||||
size_t bufsize = 0;
|
||||
int parsed = 0;
|
||||
|
||||
jd->client = jack_client_open("RetroArch", JackNullOption, NULL);
|
||||
if (jd->client == NULL)
|
||||
|
@ -214,12 +216,12 @@ error:
|
|||
static size_t write_buffer(jack_t *jd, const float *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
size_t j;
|
||||
size_t j, frames, written = 0;
|
||||
jack_default_audio_sample_t out_deinterleaved_buffer[2][AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO];
|
||||
|
||||
size_t frames = FRAMES(size);
|
||||
frames = FRAMES(size);
|
||||
|
||||
// Avoid buffer overflow if a DSP plugin generated a huge number of frames
|
||||
/* Avoid buffer overflow if a DSP plugin generated a huge number of frames. */
|
||||
if (frames > AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO)
|
||||
frames = AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO;
|
||||
|
||||
|
@ -227,21 +229,19 @@ static size_t write_buffer(jack_t *jd, const float *buf, size_t size)
|
|||
for (j = 0; j < frames; j++)
|
||||
out_deinterleaved_buffer[i][j] = buf[j * 2 + i];
|
||||
|
||||
size_t written = 0;
|
||||
while (written < frames)
|
||||
{
|
||||
size_t avail[2], min_avail, write_frames;
|
||||
if (jd->shutdown)
|
||||
return 0;
|
||||
|
||||
size_t avail[2] = {
|
||||
jack_ringbuffer_write_space(jd->buffer[0]),
|
||||
jack_ringbuffer_write_space(jd->buffer[1]),
|
||||
};
|
||||
avail[0] = jack_ringbuffer_write_space(jd->buffer[0]);
|
||||
avail[1] = jack_ringbuffer_write_space(jd->buffer[1]);
|
||||
|
||||
size_t min_avail = avail[0] < avail[1] ? avail[0] : avail[1];
|
||||
min_avail = avail[0] < avail[1] ? avail[0] : avail[1];
|
||||
min_avail /= sizeof(float);
|
||||
|
||||
size_t write_frames = frames - written > min_avail ? min_avail : frames - written;
|
||||
write_frames = frames - written > min_avail ? min_avail : frames - written;
|
||||
|
||||
if (write_frames > 0)
|
||||
{
|
||||
|
@ -284,15 +284,16 @@ static bool ja_stop(void *data)
|
|||
static bool ja_alive(void *data)
|
||||
{
|
||||
jack_t *jd = (jack_t*)data;
|
||||
if (jd)
|
||||
return !jd->is_paused;
|
||||
return false;
|
||||
if (!jd)
|
||||
return false;
|
||||
return !jd->is_paused;
|
||||
}
|
||||
|
||||
static void ja_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
jack_t *jd = (jack_t*)data;
|
||||
jd->nonblock = state;
|
||||
if (jd)
|
||||
jd->nonblock = state;
|
||||
}
|
||||
|
||||
static bool ja_start(void *data)
|
|
@ -13,8 +13,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../general.h"
|
||||
#include "../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
static void *null_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
|
@ -13,8 +13,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenAL/al.h>
|
||||
|
@ -56,6 +56,7 @@ typedef struct al
|
|||
static void al_free(void *data)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
|
||||
if (!al)
|
||||
return;
|
||||
|
||||
|
@ -78,24 +79,27 @@ static void al_free(void *data)
|
|||
|
||||
static void *al_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
al_t *al;
|
||||
|
||||
(void)device;
|
||||
al_t *al = (al_t*)calloc(1, sizeof(al_t));
|
||||
|
||||
al = (al_t*)calloc(1, sizeof(al_t));
|
||||
if (!al)
|
||||
return NULL;
|
||||
|
||||
al->handle = alcOpenDevice(NULL);
|
||||
if (al->handle == NULL)
|
||||
if (!al->handle)
|
||||
goto error;
|
||||
|
||||
al->ctx = alcCreateContext(al->handle, NULL);
|
||||
if (al->ctx == NULL)
|
||||
if (!al->ctx)
|
||||
goto error;
|
||||
|
||||
alcMakeContextCurrent(al->ctx);
|
||||
|
||||
al->rate = rate;
|
||||
|
||||
// We already use one buffer for tmpbuf.
|
||||
/* We already use one buffer for tmpbuf. */
|
||||
al->num_buffers = (latency * rate * 2 * sizeof(int16_t)) / (1000 * BUFSIZE) - 1;
|
||||
if (al->num_buffers < 2)
|
||||
al->num_buffers = 2;
|
||||
|
@ -126,14 +130,12 @@ static bool al_unqueue_buffers(al_t *al)
|
|||
|
||||
alGetSourcei(al->source, AL_BUFFERS_PROCESSED, &val);
|
||||
|
||||
if (val > 0)
|
||||
{
|
||||
alSourceUnqueueBuffers(al->source, val, &al->res_buf[al->res_ptr]);
|
||||
al->res_ptr += val;
|
||||
return true;
|
||||
}
|
||||
if (val <= 0)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
alSourceUnqueueBuffers(al->source, val, &al->res_buf[al->res_ptr]);
|
||||
al->res_ptr += val;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool al_get_buffer(al_t *al, ALuint *buffer)
|
||||
|
@ -169,11 +171,14 @@ static ssize_t al_write(void *data, const void *buf_, size_t size)
|
|||
{
|
||||
al_t *al = (al_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
|
||||
size_t written = 0;
|
||||
|
||||
while (size)
|
||||
{
|
||||
ALint val;
|
||||
ALuint buffer;
|
||||
size_t rc = al_fill_internal_buf(al, buf, size);
|
||||
|
||||
written += rc;
|
||||
buf += rc;
|
||||
size -= rc;
|
||||
|
@ -181,7 +186,6 @@ static ssize_t al_write(void *data, const void *buf_, size_t size)
|
|||
if (al->tmpbuf_ptr != BUFSIZE)
|
||||
break;
|
||||
|
||||
ALuint buffer;
|
||||
if (!al_get_buffer(al, &buffer))
|
||||
break;
|
||||
|
||||
|
@ -191,7 +195,6 @@ static ssize_t al_write(void *data, const void *buf_, size_t size)
|
|||
if (alGetError() != AL_NO_ERROR)
|
||||
return -1;
|
||||
|
||||
ALint val;
|
||||
alGetSourcei(al->source, AL_SOURCE_STATE, &val);
|
||||
if (val != AL_PLAYING)
|
||||
alSourcePlay(al->source);
|
||||
|
@ -214,15 +217,16 @@ static bool al_stop(void *data)
|
|||
static bool al_alive(void *data)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
if (al)
|
||||
return !al->is_paused;
|
||||
return false;
|
||||
if (!al)
|
||||
return false;
|
||||
return !al->is_paused;
|
||||
}
|
||||
|
||||
static void al_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
al->nonblock = state;
|
||||
if (al)
|
||||
al->nonblock = state;
|
||||
}
|
||||
|
||||
static bool al_start(void *data)
|
||||
|
@ -243,7 +247,7 @@ static size_t al_write_avail(void *data)
|
|||
static size_t al_buffer_size(void *data)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
return (al->num_buffers + 1) * BUFSIZE; // Also got tmpbuf.
|
||||
return (al->num_buffers + 1) * BUFSIZE; /* Also got tmpbuf. */
|
||||
}
|
||||
|
||||
static bool al_use_float(void *data)
|
|
@ -14,8 +14,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include <SLES/OpenSLES.h>
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include <SLES/OpenSLES_Android.h>
|
||||
#endif
|
||||
|
||||
// Helper macros, COM-style!
|
||||
/* Helper macros, COM-style. */
|
||||
#define SLObjectItf_Realize(a, ...) ((*(a))->Realize(a, __VA_ARGS__))
|
||||
#define SLObjectItf_GetInterface(a, ...) ((*(a))->GetInterface(a, __VA_ARGS__))
|
||||
#define SLObjectItf_Destroy(a) ((*(a))->Destroy((a)))
|
||||
|
@ -100,20 +100,23 @@ static void sl_free(void *data)
|
|||
static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
unsigned i;
|
||||
(void)device;
|
||||
|
||||
SLInterfaceID id;
|
||||
SLboolean req;
|
||||
SLresult res;
|
||||
sl_t *sl;
|
||||
SLDataFormat_PCM fmt_pcm = {0};
|
||||
SLDataSource audio_src = {0};
|
||||
SLDataSink audio_sink = {0};
|
||||
|
||||
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {0};
|
||||
SLDataLocator_OutputMix loc_outmix = {0};
|
||||
|
||||
SLInterfaceID id = SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
SLboolean req = SL_BOOLEAN_TRUE;
|
||||
(void)device;
|
||||
|
||||
SLresult res = 0;
|
||||
sl_t *sl = (sl_t*)calloc(1, sizeof(sl_t));
|
||||
id = SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
req = SL_BOOLEAN_TRUE;
|
||||
|
||||
res = 0;
|
||||
sl = (sl_t*)calloc(1, sizeof(sl_t));
|
||||
if (!sl)
|
||||
goto error;
|
||||
|
||||
|
@ -154,7 +157,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
|||
fmt_pcm.bitsPerSample = 16;
|
||||
fmt_pcm.containerSize = 16;
|
||||
fmt_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
|
||||
fmt_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; // Android only.
|
||||
fmt_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; /* Android only. */
|
||||
|
||||
audio_src.pLocator = &loc_bufq;
|
||||
audio_src.pFormat = &fmt_pcm;
|
||||
|
@ -180,7 +183,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
|||
|
||||
(*sl->buffer_queue)->RegisterCallback(sl->buffer_queue, opensl_callback, sl);
|
||||
|
||||
// Enqueue a bit to get stuff rolling.
|
||||
/* Enqueue a bit to get stuff rolling. */
|
||||
sl->buffered_blocks = sl->buf_count;
|
||||
sl->buffer_index = 0;
|
||||
for (i = 0; i < sl->buf_count; i++)
|
||||
|
@ -207,15 +210,16 @@ static bool sl_stop(void *data)
|
|||
static bool sl_alive(void *data)
|
||||
{
|
||||
sl_t *sl = (sl_t*)data;
|
||||
if (sl)
|
||||
return !sl->is_paused;
|
||||
return false;
|
||||
if (!sl)
|
||||
return false;
|
||||
return !sl->is_paused;
|
||||
}
|
||||
|
||||
static void sl_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
sl_t *sl = (sl_t*)data;
|
||||
sl->nonblock = state;
|
||||
if (sl)
|
||||
sl->nonblock = state;
|
||||
}
|
||||
|
||||
static bool sl_start(void *data)
|
||||
|
@ -229,12 +233,13 @@ static bool sl_start(void *data)
|
|||
static ssize_t sl_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
sl_t *sl = (sl_t*)data;
|
||||
|
||||
size_t written = 0;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
|
||||
while (size)
|
||||
{
|
||||
size_t avail_write;
|
||||
|
||||
if (sl->nonblock)
|
||||
{
|
||||
if (sl->buffered_blocks == sl->buf_count)
|
||||
|
@ -248,7 +253,8 @@ static ssize_t sl_write(void *data, const void *buf_, size_t size)
|
|||
slock_unlock(sl->lock);
|
||||
}
|
||||
|
||||
size_t avail_write = min(sl->buf_size - sl->buffer_ptr, size);
|
||||
avail_write = min(sl->buf_size - sl->buffer_ptr, size);
|
||||
|
||||
if (avail_write)
|
||||
{
|
||||
memcpy(sl->buffer[sl->buffer_index] + sl->buffer_ptr, buf, avail_write);
|
|
@ -17,8 +17,8 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "driver.h"
|
||||
#include "general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_OSS_BSD
|
||||
|
@ -43,7 +43,9 @@ static bool oss_is_paused;
|
|||
|
||||
static void *oss_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
int frags, frag, channels, format, new_rate;
|
||||
int *fd = (int*)calloc(1, sizeof(int));
|
||||
|
||||
if (fd == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -59,15 +61,14 @@ static void *oss_init(const char *device, unsigned rate, unsigned latency)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int frags = (latency * rate * 4) / (1000 * (1 << 10));
|
||||
int frag = (frags << 16) | 10;
|
||||
frags = (latency * rate * 4) / (1000 * (1 << 10));
|
||||
frag = (frags << 16) | 10;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_SETFRAGMENT, &frag) < 0)
|
||||
RARCH_WARN("Cannot set fragment sizes. Latency might not be as expected ...\n");
|
||||
|
||||
int channels = 2;
|
||||
int format = is_little_endian() ?
|
||||
AFMT_S16_LE : AFMT_S16_BE;
|
||||
channels = 2;
|
||||
format = is_little_endian() ? AFMT_S16_LE : AFMT_S16_BE;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_CHANNELS, &channels) < 0)
|
||||
{
|
||||
|
@ -85,7 +86,8 @@ static void *oss_init(const char *device, unsigned rate, unsigned latency)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int new_rate = rate;
|
||||
new_rate = rate;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_SPEED, &new_rate) < 0)
|
||||
{
|
||||
close(*fd);
|
||||
|
@ -105,12 +107,12 @@ static void *oss_init(const char *device, unsigned rate, unsigned latency)
|
|||
|
||||
static ssize_t oss_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
ssize_t ret;
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
|
||||
ssize_t ret;
|
||||
if ((ret = write(*fd, buf, size)) < 0)
|
||||
{
|
||||
if (errno == EAGAIN && (fcntl(*fd, F_GETFL) & O_NONBLOCK))
|
||||
|
@ -125,6 +127,7 @@ static ssize_t oss_write(void *data, const void *buf, size_t size)
|
|||
static bool oss_stop(void *data)
|
||||
{
|
||||
int *fd = (int*)data;
|
||||
|
||||
ioctl(*fd, SNDCTL_DSP_RESET, 0);
|
||||
oss_is_paused = true;
|
||||
return true;
|
||||
|
@ -145,8 +148,9 @@ static bool oss_alive(void *data)
|
|||
|
||||
static void oss_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
int *fd = (int*)data;
|
||||
int rc;
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (state)
|
||||
rc = fcntl(*fd, F_SETFL, fcntl(*fd, F_GETFL) | O_NONBLOCK);
|
||||
else
|
|
@ -19,7 +19,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "../fifo_buffer.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../ps3/sdk_defines.h"
|
||||
|
||||
|
@ -46,17 +46,16 @@ static void event_loop(void *data)
|
|||
static void event_loop(uint64_t data)
|
||||
#endif
|
||||
{
|
||||
ps3_audio_t *aud = data;
|
||||
float out_tmp[CELL_AUDIO_BLOCK_SAMPLES * AUDIO_CHANNELS]
|
||||
__attribute__((aligned(16)));
|
||||
sys_event_queue_t id;
|
||||
sys_ipc_key_t key;
|
||||
sys_event_t event;
|
||||
ps3_audio_t *aud = data;
|
||||
|
||||
cellAudioCreateNotifyEventQueue(&id, &key);
|
||||
cellAudioSetNotifyEventQueue(key);
|
||||
|
||||
float out_tmp[CELL_AUDIO_BLOCK_SAMPLES * AUDIO_CHANNELS]
|
||||
__attribute__((aligned(16)));
|
||||
|
||||
while (!aud->quit_thread)
|
||||
{
|
||||
sys_event_queue_receive(id, &event, SYS_NO_TIMEOUT);
|
||||
|
@ -80,16 +79,19 @@ static void event_loop(uint64_t data)
|
|||
static void *ps3_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
CellAudioPortParam params;
|
||||
ps3_audio_t *data;
|
||||
|
||||
(void)latency;
|
||||
(void)device;
|
||||
(void)rate;
|
||||
|
||||
ps3_audio_t *data = calloc(1, sizeof(*data));
|
||||
data = calloc(1, sizeof(*data));
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
CellAudioPortParam params;
|
||||
cellAudioInit();
|
||||
|
||||
params.numChannels = AUDIO_CHANNELS;
|
||||
params.numBlocks = AUDIO_BLOCKS;
|
||||
#ifdef HAVE_HEADSET
|
||||
|
@ -151,15 +153,14 @@ static ssize_t ps3_audio_write(void *data, const void *buf, size_t size)
|
|||
if (fifo_write_avail(aud->buffer) < size)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (fifo_write_avail(aud->buffer) < size)
|
||||
sys_lwcond_wait(&aud->cond, 0);
|
||||
}
|
||||
|
||||
while (fifo_write_avail(aud->buffer) < size)
|
||||
sys_lwcond_wait(&aud->cond, 0);
|
||||
|
||||
sys_lwmutex_lock(&aud->lock, SYS_NO_TIMEOUT);
|
||||
fifo_write(aud->buffer, buf, size);
|
||||
sys_lwmutex_unlock(&aud->lock);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -188,13 +189,16 @@ static bool ps3_audio_start(void *data)
|
|||
static bool ps3_audio_alive(void *data)
|
||||
{
|
||||
ps3_audio_t *aud = data;
|
||||
if (!aud)
|
||||
return false;
|
||||
return aud->started;
|
||||
}
|
||||
|
||||
static void ps3_audio_set_nonblock_state(void *data, bool toggle)
|
||||
{
|
||||
ps3_audio_t *aud = data;
|
||||
aud->nonblocking = toggle;
|
||||
if (aud)
|
||||
aud->nonblocking = toggle;
|
||||
}
|
||||
|
||||
static void ps3_audio_free(void *data)
|
|
@ -15,8 +15,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../general.h"
|
||||
#include "../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
#include <pspkernel.h>
|
||||
#include <pspaudio.h>
|
||||
|
@ -71,10 +71,12 @@ static int audioMainLoop(SceSize args, void* argp)
|
|||
static void *psp_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
psp1_audio_t* psp;
|
||||
|
||||
(void)device;
|
||||
(void)latency;
|
||||
|
||||
psp1_audio_t* psp = (psp1_audio_t*)calloc(1, sizeof(psp1_audio_t));
|
||||
psp = (psp1_audio_t*)calloc(1, sizeof(psp1_audio_t));
|
||||
|
||||
if (!psp)
|
||||
return NULL;
|
||||
|
@ -103,12 +105,13 @@ static void *psp_audio_init(const char *device,
|
|||
|
||||
static void psp_audio_free(void *data)
|
||||
{
|
||||
SceUInt timeout = 100000;
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
if(!psp)
|
||||
return;
|
||||
|
||||
psp->running = false;
|
||||
SceUInt timeout = 100000;
|
||||
psp->running = false;
|
||||
|
||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||
sceKernelDeleteThread(psp->thread);
|
||||
|
||||
|
@ -153,14 +156,15 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
|
|||
static bool psp_audio_alive(void *data)
|
||||
{
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
if (psp)
|
||||
return psp->running;
|
||||
return false;
|
||||
if (!psp)
|
||||
return false;
|
||||
return psp->running;
|
||||
}
|
||||
|
||||
static bool psp_audio_stop(void *data)
|
||||
{
|
||||
SceKernelThreadRunStatus runStatus;
|
||||
SceUInt timeout = 100000;
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
|
||||
runStatus.size = sizeof(SceKernelThreadRunStatus);
|
||||
|
@ -172,7 +176,6 @@ static bool psp_audio_stop(void *data)
|
|||
return false;
|
||||
|
||||
psp->running = false;
|
||||
SceUInt timeout = 100000;
|
||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||
|
||||
return true;
|
||||
|
@ -201,7 +204,8 @@ static bool psp_audio_start(void *data)
|
|||
static void psp_audio_set_nonblock_state(void *data, bool toggle)
|
||||
{
|
||||
psp1_audio_t* psp = (psp1_audio_t*)data;
|
||||
psp->nonblocking = toggle;
|
||||
if (psp)
|
||||
psp->nonblocking = toggle;
|
||||
}
|
||||
|
||||
static bool psp_audio_use_float(void *data)
|
|
@ -14,8 +14,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include "general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include <pulse/pulseaudio.h>
|
||||
#include <boolean.h>
|
||||
#include <string.h>
|
||||
|
@ -35,28 +35,29 @@ typedef struct
|
|||
static void pulse_free(void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
if (pa)
|
||||
|
||||
if (!pa)
|
||||
return;
|
||||
|
||||
if (pa->mainloop)
|
||||
pa_threaded_mainloop_stop(pa->mainloop);
|
||||
|
||||
if (pa->stream)
|
||||
{
|
||||
if (pa->mainloop)
|
||||
pa_threaded_mainloop_stop(pa->mainloop);
|
||||
|
||||
if (pa->stream)
|
||||
{
|
||||
pa_stream_disconnect(pa->stream);
|
||||
pa_stream_unref(pa->stream);
|
||||
}
|
||||
|
||||
if (pa->context)
|
||||
{
|
||||
pa_context_disconnect(pa->context);
|
||||
pa_context_unref(pa->context);
|
||||
}
|
||||
|
||||
if (pa->mainloop)
|
||||
pa_threaded_mainloop_free(pa->mainloop);
|
||||
|
||||
free(pa);
|
||||
pa_stream_disconnect(pa->stream);
|
||||
pa_stream_unref(pa->stream);
|
||||
}
|
||||
|
||||
if (pa->context)
|
||||
{
|
||||
pa_context_disconnect(pa->context);
|
||||
pa_context_unref(pa->context);
|
||||
}
|
||||
|
||||
if (pa->mainloop)
|
||||
pa_threaded_mainloop_free(pa->mainloop);
|
||||
|
||||
free(pa);
|
||||
}
|
||||
|
||||
static void stream_success_cb(pa_stream *s, int success, void *data)
|
||||
|
@ -70,6 +71,7 @@ static void stream_success_cb(pa_stream *s, int success, void *data)
|
|||
static void context_state_cb(pa_context *c, void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
switch (pa_context_get_state(c))
|
||||
{
|
||||
case PA_CONTEXT_READY:
|
||||
|
@ -85,6 +87,7 @@ static void context_state_cb(pa_context *c, void *data)
|
|||
static void stream_state_cb(pa_stream *s, void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
switch (pa_stream_get_state(s))
|
||||
{
|
||||
case PA_STREAM_READY:
|
||||
|
@ -99,23 +102,29 @@ static void stream_state_cb(pa_stream *s, void *data)
|
|||
|
||||
static void stream_request_cb(pa_stream *s, size_t length, void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
(void)length;
|
||||
(void)s;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
pa_threaded_mainloop_signal(pa->mainloop, 0);
|
||||
}
|
||||
|
||||
static void stream_latency_update_cb(pa_stream *s, void *data)
|
||||
{
|
||||
(void)s;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
(void)s;
|
||||
|
||||
pa_threaded_mainloop_signal(pa->mainloop, 0);
|
||||
}
|
||||
|
||||
static void underrun_update_cb(pa_stream *s, void *data)
|
||||
{
|
||||
(void)s;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
(void)s;
|
||||
|
||||
RARCH_LOG("[PulseAudio]: Underrun (Buffer: %u, Writable size: %u).\n",
|
||||
(unsigned)pa->buffer_size,
|
||||
(unsigned)pa_stream_writable_size(pa->stream));
|
||||
|
@ -133,11 +142,14 @@ static void buffer_attr_cb(pa_stream *s, void *data)
|
|||
|
||||
static void *pulse_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
const pa_buffer_attr *server_attr = NULL;
|
||||
pa_sample_spec spec;
|
||||
memset(&spec, 0, sizeof(spec));
|
||||
pa_t *pa;
|
||||
pa_buffer_attr buffer_attr = {0};
|
||||
pa_t *pa = (pa_t*)calloc(1, sizeof(*pa));
|
||||
const pa_buffer_attr *server_attr = NULL;
|
||||
|
||||
memset(&spec, 0, sizeof(spec));
|
||||
|
||||
pa = (pa_t*)calloc(1, sizeof(*pa));
|
||||
if (!pa)
|
||||
goto error;
|
||||
|
||||
|
@ -217,13 +229,13 @@ static ssize_t pulse_write(void *data, const void *buf_, size_t size)
|
|||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
|
||||
size_t written = 0;
|
||||
|
||||
pa_threaded_mainloop_lock(pa->mainloop);
|
||||
while (size)
|
||||
{
|
||||
size_t writable = pa_stream_writable_size(pa->stream);
|
||||
|
||||
writable = min(size, writable);
|
||||
|
||||
if (writable)
|
||||
|
@ -246,13 +258,16 @@ static ssize_t pulse_write(void *data, const void *buf_, size_t size)
|
|||
|
||||
static bool pulse_stop(void *data)
|
||||
{
|
||||
RARCH_LOG("[PulseAudio]: Pausing.\n");
|
||||
bool ret;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
pa->success = true; // In case of spurious wakeup. Not critical.
|
||||
|
||||
RARCH_LOG("[PulseAudio]: Pausing.\n");
|
||||
|
||||
pa->success = true; /* In case of spurious wakeup. Not critical. */
|
||||
pa_threaded_mainloop_lock(pa->mainloop);
|
||||
pa_stream_cork(pa->stream, true, stream_success_cb, pa);
|
||||
pa_threaded_mainloop_wait(pa->mainloop);
|
||||
bool ret = pa->success;
|
||||
ret = pa->success;
|
||||
pa_threaded_mainloop_unlock(pa->mainloop);
|
||||
pa->is_paused = true;
|
||||
return ret;
|
||||
|
@ -261,20 +276,24 @@ static bool pulse_stop(void *data)
|
|||
static bool pulse_alive(void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
if (pa)
|
||||
return !pa->is_paused;
|
||||
return false;
|
||||
|
||||
if (!pa)
|
||||
return false;
|
||||
return !pa->is_paused;
|
||||
}
|
||||
|
||||
static bool pulse_start(void *data)
|
||||
{
|
||||
RARCH_LOG("[PulseAudio]: Unpausing.\n");
|
||||
bool ret;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
pa->success = true; // In case of spurious wakeup. Not critical.
|
||||
|
||||
RARCH_LOG("[PulseAudio]: Unpausing.\n");
|
||||
|
||||
pa->success = true; /* In case of spurious wakeup. Not critical. */
|
||||
pa_threaded_mainloop_lock(pa->mainloop);
|
||||
pa_stream_cork(pa->stream, false, stream_success_cb, pa);
|
||||
pa_threaded_mainloop_wait(pa->mainloop);
|
||||
bool ret = pa->success;
|
||||
ret = pa->success;
|
||||
pa_threaded_mainloop_unlock(pa->mainloop);
|
||||
pa->is_paused = false;
|
||||
return ret;
|
||||
|
@ -283,7 +302,8 @@ static bool pulse_start(void *data)
|
|||
static void pulse_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
pa->nonblock = state;
|
||||
if (pa)
|
||||
pa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool pulse_use_float(void *data)
|
||||
|
@ -294,10 +314,12 @@ static bool pulse_use_float(void *data)
|
|||
|
||||
static size_t pulse_write_avail(void *data)
|
||||
{
|
||||
size_t length;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
pa_threaded_mainloop_lock(pa->mainloop);
|
||||
size_t length = pa_stream_writable_size(pa->stream);
|
||||
g_extern.audio_data.driver_buffer_size = pa->buffer_size; // Can change spuriously.
|
||||
length = pa_stream_writable_size(pa->stream);
|
||||
g_extern.audio_data.driver_buffer_size = pa->buffer_size; /* Can change spuriously. */
|
||||
pa_threaded_mainloop_unlock(pa->mainloop);
|
||||
return length;
|
||||
}
|
|
@ -14,13 +14,13 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <roaraudio.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include "general.h"
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -30,13 +30,15 @@ typedef struct
|
|||
|
||||
static void *ra_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
(void)latency;
|
||||
int err;
|
||||
roar_vs_t *vss;
|
||||
roar_t *roar = (roar_t*)calloc(1, sizeof(roar_t));
|
||||
if (roar == NULL)
|
||||
|
||||
if (!roar)
|
||||
return NULL;
|
||||
|
||||
roar_vs_t *vss;
|
||||
(void)latency;
|
||||
|
||||
if ((vss = roar_vs_new_simple(device, "RetroArch", rate, 2, ROAR_CODEC_PCM_S, 16, ROAR_DIR_PLAY, &err)) == NULL)
|
||||
{
|
||||
RARCH_ERR("RoarAudio: \"%s\"\n", roar_vs_strerr(err));
|
||||
|
@ -52,17 +54,18 @@ static void *ra_init(const char *device, unsigned rate, unsigned latency)
|
|||
|
||||
static ssize_t ra_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
roar_t *roar = (roar_t*)data;
|
||||
int err;
|
||||
ssize_t rc;
|
||||
size_t written = 0;
|
||||
roar_t *roar = (roar_t*)data;
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
|
||||
int err;
|
||||
size_t written = 0;
|
||||
while (written < size)
|
||||
{
|
||||
size_t write_amt = size - written;
|
||||
|
||||
if ((rc = roar_vs_write(roar->vss, (const char*)buf + written, write_amt, &err)) < (ssize_t)write_amt)
|
||||
{
|
||||
if (roar->nonblocking)
|
||||
|
@ -87,9 +90,9 @@ static bool ra_stop(void *data)
|
|||
static bool ra_alive(void *data)
|
||||
{
|
||||
roar_t *roar = (roar_t*)data;
|
||||
if (roar)
|
||||
return !roar->is_paused;
|
||||
return false;
|
||||
if (!roar)
|
||||
return false;
|
||||
return !roar->is_paused;
|
||||
}
|
||||
|
||||
static void ra_set_nonblock_state(void *data, bool state)
|
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../audio_driver.h"
|
||||
#include <stdlib.h>
|
||||
#include "rsound.h"
|
||||
#include "../fifo_buffer.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "../fifo_buffer.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define RSD_DEFAULT_HOST "127.0.0.1" // Stupid Windows.
|
|
@ -13,10 +13,10 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#include "../emscripten/RWebAudio.h"
|
||||
#include "../../emscripten/RWebAudio.h"
|
||||
|
||||
static bool rwebaudio_is_paused;
|
||||
|
||||
|
@ -27,9 +27,11 @@ static void rwebaudio_free(void *data)
|
|||
|
||||
static void *rwebaudio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
void *data;
|
||||
(void)device;
|
||||
(void)rate;
|
||||
void *data = RWebAudioInit(latency);
|
||||
data = RWebAudioInit(latency);
|
||||
|
||||
if (data)
|
||||
g_settings.audio.out_rate = RWebAudioSampleRate();
|
||||
return data;
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <stddef.h>
|
||||
|
@ -25,8 +25,8 @@
|
|||
#include "SDL_audio.h"
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../general.h"
|
||||
#include "../fifo_buffer.h"
|
||||
#include "../../general.h"
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
typedef struct sdl_audio
|
||||
{
|
||||
|
@ -41,26 +41,36 @@ typedef struct sdl_audio
|
|||
static void sdl_audio_cb(void *data, Uint8 *stream, int len)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
|
||||
size_t avail = fifo_read_avail(sdl->buffer);
|
||||
size_t write_size = len > (int)avail ? avail : len;
|
||||
|
||||
fifo_read(sdl->buffer, stream, write_size);
|
||||
scond_signal(sdl->cond);
|
||||
|
||||
// If underrun, fill rest with silence.
|
||||
/* If underrun, fill rest with silence. */
|
||||
memset(stream + write_size, 0, len - write_size);
|
||||
}
|
||||
|
||||
static inline int find_num_frames(int rate, int latency)
|
||||
{
|
||||
int frames = (rate * latency) / 1000;
|
||||
// SDL only likes 2^n sized buffers.
|
||||
|
||||
/* SDL only likes 2^n sized buffers. */
|
||||
|
||||
return next_pow2(frames);
|
||||
}
|
||||
|
||||
static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
static void *sdl_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
int frames;
|
||||
size_t bufsize;
|
||||
void *tmp;
|
||||
SDL_AudioSpec out;
|
||||
SDL_AudioSpec spec = {0};
|
||||
sdl_audio_t *sdl = NULL;
|
||||
(void)device;
|
||||
|
||||
if (SDL_WasInit(0) == 0)
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_AUDIO) < 0)
|
||||
|
@ -69,14 +79,16 @@ static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
|
|||
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
||||
return NULL;
|
||||
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)calloc(1, sizeof(*sdl));
|
||||
sdl = (sdl_audio_t*)calloc(1, sizeof(*sdl));
|
||||
if (!sdl)
|
||||
return NULL;
|
||||
|
||||
// We have to buffer up some data ourselves, so we let SDL carry approx half of the latency. SDL double buffers audio and we do as well.
|
||||
int frames = find_num_frames(rate, latency / 4);
|
||||
/* We have to buffer up some data ourselves, so we let SDL
|
||||
* carry approximately half of the latency.
|
||||
*
|
||||
* SDL double buffers audio and we do as well. */
|
||||
frames = find_num_frames(rate, latency / 4);
|
||||
|
||||
SDL_AudioSpec spec = {0};
|
||||
spec.freq = rate;
|
||||
spec.format = AUDIO_S16SYS;
|
||||
spec.channels = 2;
|
||||
|
@ -84,8 +96,6 @@ static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
|
|||
spec.callback = sdl_audio_cb;
|
||||
spec.userdata = sdl;
|
||||
|
||||
SDL_AudioSpec out;
|
||||
|
||||
if (SDL_OpenAudio(&spec, &out) < 0)
|
||||
{
|
||||
RARCH_ERR("Failed to open SDL audio: %s\n", SDL_GetError());
|
||||
|
@ -97,12 +107,14 @@ static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
|
|||
sdl->lock = slock_new();
|
||||
sdl->cond = scond_new();
|
||||
|
||||
RARCH_LOG("SDL audio: Requested %u ms latency, got %d ms\n", latency, (int)(out.samples * 4 * 1000 / g_settings.audio.out_rate));
|
||||
RARCH_LOG("SDL audio: Requested %u ms latency, got %d ms\n",
|
||||
latency, (int)(out.samples * 4 * 1000 / g_settings.audio.out_rate));
|
||||
|
||||
// Create a buffer twice as big as needed and prefill the buffer.
|
||||
size_t bufsize = out.samples * 4 * sizeof(int16_t);
|
||||
void *tmp = calloc(1, bufsize);
|
||||
/* Create a buffer twice as big as needed and prefill the buffer. */
|
||||
bufsize = out.samples * 4 * sizeof(int16_t);
|
||||
tmp = calloc(1, bufsize);
|
||||
sdl->buffer = fifo_new(bufsize);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
fifo_write(sdl->buffer, tmp, bufsize);
|
||||
|
@ -115,14 +127,16 @@ static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
|
|||
|
||||
static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
|
||||
ssize_t ret = 0;
|
||||
if (sdl->nonblock)
|
||||
{
|
||||
size_t avail, write_amt;
|
||||
|
||||
SDL_LockAudio();
|
||||
size_t avail = fifo_write_avail(sdl->buffer);
|
||||
size_t write_amt = avail > size ? size : avail;
|
||||
avail = fifo_write_avail(sdl->buffer);
|
||||
write_amt = avail > size ? size : avail;
|
||||
fifo_write(sdl->buffer, buf, write_amt);
|
||||
SDL_UnlockAudio();
|
||||
ret = write_amt;
|
||||
|
@ -130,10 +144,13 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
|
|||
else
|
||||
{
|
||||
size_t written = 0;
|
||||
|
||||
while (written < size)
|
||||
{
|
||||
size_t avail;
|
||||
|
||||
SDL_LockAudio();
|
||||
size_t avail = fifo_write_avail(sdl->buffer);
|
||||
avail = fifo_write_avail(sdl->buffer);
|
||||
|
||||
if (avail == 0)
|
||||
{
|
||||
|
@ -167,9 +184,9 @@ static bool sdl_audio_stop(void *data)
|
|||
static bool sdl_audio_alive(void *data)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
if (sdl)
|
||||
return !sdl->is_paused;
|
||||
return false;
|
||||
if (!sdl)
|
||||
return false;
|
||||
return !sdl->is_paused;
|
||||
}
|
||||
|
||||
static bool sdl_audio_start(void *data)
|
||||
|
@ -184,15 +201,17 @@ static bool sdl_audio_start(void *data)
|
|||
static void sdl_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
sdl->nonblock = state;
|
||||
if (sdl)
|
||||
sdl->nonblock = state;
|
||||
}
|
||||
|
||||
static void sdl_audio_free(void *data)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
|
||||
SDL_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
if (sdl)
|
||||
{
|
||||
fifo_free(sdl->buffer);
|
|
@ -67,12 +67,17 @@ struct xaudio2 : public IXAudio2VoiceCallback
|
|||
|
||||
void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
{
|
||||
UINT32 dev_count = 0;
|
||||
unsigned i = 0;
|
||||
|
||||
(void)xa;
|
||||
(void)i;
|
||||
(void)dev_count;
|
||||
#ifndef _XBOX
|
||||
UINT32 dev_count;
|
||||
xa->pXAudio2->GetDeviceCount(&dev_count);
|
||||
fprintf(stderr, "XAudio2 devices:\n");
|
||||
for (unsigned i = 0; i < dev_count; i++)
|
||||
|
||||
for (i = 0; i < dev_count; i++)
|
||||
{
|
||||
XAUDIO2_DEVICE_DETAILS dev_detail;
|
||||
xa->pXAudio2->GetDeviceDetails(i, &dev_detail);
|
||||
|
@ -97,13 +102,14 @@ static void xaudio2_set_wavefmt(WAVEFORMATEX *wfx,
|
|||
xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
size_t size, unsigned device)
|
||||
{
|
||||
xaudio2_t *handle;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
|
||||
#ifndef _XBOX
|
||||
CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
#endif
|
||||
|
||||
xaudio2_t *handle = new xaudio2;
|
||||
|
||||
WAVEFORMATEX wfx = {0};
|
||||
handle = new xaudio2;
|
||||
|
||||
if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||
goto error;
|
||||
|
@ -147,9 +153,11 @@ size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
|||
{
|
||||
unsigned bytes = bytes_;
|
||||
const uint8_t *buffer = (const uint8_t*)buf;
|
||||
|
||||
while (bytes)
|
||||
{
|
||||
unsigned need = min(bytes, handle->bufsize - handle->bufptr);
|
||||
|
||||
memcpy(handle->buf + handle->write_buffer * handle->bufsize + handle->bufptr,
|
||||
buffer, need);
|
||||
|
||||
|
@ -159,10 +167,11 @@ size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
|||
|
||||
if (handle->bufptr == handle->bufsize)
|
||||
{
|
||||
XAUDIO2_BUFFER xa2buffer = {0};
|
||||
|
||||
while (handle->buffers == MAX_BUFFERS - 1)
|
||||
WaitForSingleObject(handle->hEvent, INFINITE);
|
||||
|
||||
XAUDIO2_BUFFER xa2buffer = {0};
|
||||
xa2buffer.AudioBytes = handle->bufsize;
|
||||
xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize;
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include "xaudio-c/xaudio-c.h"
|
||||
#include "../general.h"
|
||||
#include "xaudio-c.h"
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -29,21 +29,24 @@ typedef struct
|
|||
|
||||
static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
if (latency < 8)
|
||||
latency = 8; // Do not allow shenanigans.
|
||||
size_t bufsize;
|
||||
xa_t *xa;
|
||||
unsigned device_index = 0;
|
||||
|
||||
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||
if (latency < 8)
|
||||
latency = 8; /* Do not allow shenanigans. */
|
||||
|
||||
xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||
if (!xa)
|
||||
return NULL;
|
||||
|
||||
size_t bufsize = latency * rate / 1000;
|
||||
bufsize = latency * rate / 1000;
|
||||
|
||||
RARCH_LOG("XAudio2: Requesting %u ms latency, using %d ms latency.\n",
|
||||
latency, (int)bufsize * 1000 / rate);
|
||||
|
||||
xa->bufsize = bufsize * 2 * sizeof(float);
|
||||
|
||||
unsigned device_index = 0;
|
||||
if (device)
|
||||
device_index = strtoul(device, NULL, 0);
|
||||
|
||||
|
@ -63,17 +66,20 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
|||
|
||||
static ssize_t xa_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
size_t ret;
|
||||
xa_t *xa = (xa_t*)data;
|
||||
|
||||
if (xa->nonblock)
|
||||
{
|
||||
size_t avail = xaudio2_write_avail(xa->xa);
|
||||
|
||||
if (avail == 0)
|
||||
return 0;
|
||||
if (avail < size)
|
||||
size = avail;
|
||||
}
|
||||
|
||||
size_t ret = xaudio2_write(xa->xa, buf, size);
|
||||
ret = xaudio2_write(xa->xa, buf, size);
|
||||
if (ret == 0 && size > 0)
|
||||
return -1;
|
||||
return ret;
|
||||
|
@ -89,15 +95,16 @@ static bool xa_stop(void *data)
|
|||
static bool xa_alive(void *data)
|
||||
{
|
||||
xa_t *xa = (xa_t*)data;
|
||||
if (xa)
|
||||
return !xa->is_paused;
|
||||
return false;
|
||||
if (!xa)
|
||||
return false;
|
||||
return !xa->is_paused;
|
||||
}
|
||||
|
||||
static void xa_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
xa_t *xa = (xa_t*)data;
|
||||
xa->nonblock = state;
|
||||
if (xa)
|
||||
xa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool xa_start(void *data)
|
||||
|
@ -116,12 +123,13 @@ static bool xa_use_float(void *data)
|
|||
static void xa_free(void *data)
|
||||
{
|
||||
xa_t *xa = (xa_t*)data;
|
||||
if (xa)
|
||||
{
|
||||
if (xa->xa)
|
||||
xaudio2_free(xa->xa);
|
||||
free(xa);
|
||||
}
|
||||
|
||||
if (!xa)
|
||||
return;
|
||||
|
||||
if (xa->xa)
|
||||
xaudio2_free(xa->xa);
|
||||
free(xa);
|
||||
}
|
||||
|
||||
static size_t xa_write_avail(void *data)
|
|
@ -14,10 +14,10 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include "../general.h"
|
||||
#include "../../general.h"
|
||||
|
||||
#include <xenon_sound/sound.h>
|
||||
|
||||
|
@ -35,6 +35,7 @@ static void *xenon360_audio_init(const char *device,
|
|||
unsigned rate, unsigned latency)
|
||||
{
|
||||
static bool inited = false;
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
xenon_sound_init();
|
||||
|
@ -53,12 +54,11 @@ static inline uint32_t bswap_32(uint32_t val)
|
|||
|
||||
static ssize_t xenon360_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
size_t written = 0, i;
|
||||
const uint32_t *in_buf = buf;
|
||||
xenon_audio_t *xa = data;
|
||||
|
||||
size_t written = 0;
|
||||
|
||||
const uint32_t *in_buf = buf;
|
||||
for (size_t i = 0; i < (size >> 2); i++)
|
||||
for (i = 0; i < (size >> 2); i++)
|
||||
xa->buffer[i] = bswap_32(in_buf[i]);
|
||||
|
||||
if (!xa->nonblock)
|
||||
|
@ -95,15 +95,16 @@ static bool xenon360_audio_stop(void *data)
|
|||
static bool xenon360_audio_alive(void *data)
|
||||
{
|
||||
xenon_audio_t *xa = data;
|
||||
if (xa)
|
||||
return !xa->is_paused;
|
||||
return false;
|
||||
if (!xa)
|
||||
return false;
|
||||
return !xa->is_paused;
|
||||
}
|
||||
|
||||
static void xenon360_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
xenon_audio_t *xa = data;
|
||||
xa->nonblock = state;
|
||||
if (xa)
|
||||
xa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool xenon360_audio_start(void *data)
|
|
@ -15,10 +15,13 @@
|
|||
|
||||
/* Convoluted Cosine Resampler */
|
||||
|
||||
#include "resampler.h"
|
||||
#include "../audio_resampler_driver.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if !defined(RESAMPLER_TEST) && defined(RARCH_INTERNAL)
|
||||
#include "../../general.h"
|
||||
|
@ -212,9 +215,6 @@ static void *resampler_CC_init(const struct resampler_config *config,
|
|||
|
||||
|
||||
#if defined(__SSE__)
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define CC_RESAMPLER_IDENT "SSE"
|
||||
|
||||
static void resampler_CC_downsample(void *re_, struct resampler_data *data)
|
|
@ -13,7 +13,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "resampler.h"
|
||||
#include "../audio_resampler_driver.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
/* Bog-standard windowed SINC implementation. */
|
||||
|
||||
#include "resampler.h"
|
||||
#include "../audio_resampler_driver.h"
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
|
@ -29,14 +29,14 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "rsound.h"
|
||||
#include "drivers/rsound.h"
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include <cell/sysmodule.h>
|
||||
#include <sys/timer.h>
|
||||
#include <sys/sys_time.h>
|
||||
|
||||
// network headers
|
||||
/* Network headers */
|
||||
#include <netex/net.h>
|
||||
#include <netex/errno.h>
|
||||
#define NETWORK_COMPAT_HEADERS 1
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
// Used for testing and performance benchmarking.
|
||||
|
||||
#include "../resamplers/resampler.h"
|
||||
#include "../utils.h"
|
||||
#include "../audio_utils.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "../resamplers/resampler.h"
|
||||
#include "../utils.h"
|
||||
#include "../audio_utils.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.1085916531" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.debug.381170420.973423226" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.2035959754.347573070">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.debug.381170420.973423226" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.2035959754.347573070">
|
||||
<tool id="com.qnx.qcc.tool.assembler.2035959754.347573070" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.2035959754">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1775882432" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
@ -221,7 +221,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.1064746892" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.release.648144057.1910510900" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.599691721.237427487">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.release.648144057.1910510900" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.599691721.237427487">
|
||||
<tool id="com.qnx.qcc.tool.assembler.599691721.237427487" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.599691721">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1196541901" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
@ -341,7 +341,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.1486816912" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.617031134.415465679" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.1306097437.609090486">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.617031134.415465679" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.1306097437.609090486">
|
||||
<tool id="com.qnx.qcc.tool.assembler.1306097437.609090486" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.1306097437">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1755349708" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
@ -461,7 +461,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.1995010572" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.coverage.2128233679.536693408" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.483492359.168355956">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.coverage.2128233679.536693408" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.483492359.168355956">
|
||||
<tool id="com.qnx.qcc.tool.assembler.483492359.168355956" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.483492359">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.107131003" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
@ -578,7 +578,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.919891290" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.debug.647263012.789881881" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.2099172774.690326989">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.debug.647263012.789881881" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.2099172774.690326989">
|
||||
<tool id="com.qnx.qcc.tool.assembler.2099172774.690326989" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.2099172774">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.258310796" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
@ -697,7 +697,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.251174326" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.398924846.187017604" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.752341444.1503771397">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.398924846.187017604" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.752341444.1503771397">
|
||||
<tool id="com.qnx.qcc.tool.assembler.752341444.1503771397" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.752341444">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1622160611" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
@ -816,7 +816,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.528382439" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.coverage.817388964.948765454" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.435181371.50421175">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.coverage.817388964.948765454" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.435181371.50421175">
|
||||
<tool id="com.qnx.qcc.tool.assembler.435181371.50421175" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.435181371">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1447558744" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mcpu=cortex-a9"/>
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.100731813" name="Resource Custom Build Step Output Type"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.debug.507133694.1992358048" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.722220103.552409735">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.debug.507133694.1992358048" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.722220103.552409735">
|
||||
<tool errorParsers="" id="com.qnx.qcc.tool.assembler.722220103.552409735" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.722220103">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.932071200" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mfpu=neon"/>
|
||||
|
@ -232,7 +232,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.905354291" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.release.237026123.1399355246" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.676105057.276341761">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.release.237026123.1399355246" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.676105057.276341761">
|
||||
<tool errorParsers="" id="com.qnx.qcc.tool.assembler.676105057.276341761" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.676105057">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1400744511" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mfpu=neon"/>
|
||||
|
@ -351,7 +351,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.761454528" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.491517832.1495032052" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.820786892.1413292621">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.491517832.1495032052" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.820786892.1413292621">
|
||||
<tool errorParsers="" id="com.qnx.qcc.tool.assembler.820786892.1413292621" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.820786892">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.1095049940" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mfpu=neon"/>
|
||||
|
@ -470,7 +470,7 @@
|
|||
<inputType id="com.qnx.qcc.inputType.assembler.265652705" superClass="com.qnx.qcc.inputType.assembler"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.coverage.511003583.427866523" name="utils_neon.S" rcbsApplicability="disable" resourcePath="src/utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.1771923802.1770971197">
|
||||
<fileInfo id="com.qnx.qcc.configuration.exe.profile.coverage.511003583.427866523" name="audio_utils_neon.S" rcbsApplicability="disable" resourcePath="src/audio_utils_neon.S" toolsToInvoke="com.qnx.qcc.tool.assembler.1771923802.1770971197">
|
||||
<tool errorParsers="" id="com.qnx.qcc.tool.assembler.1771923802.1770971197" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler.1771923802">
|
||||
<option id="com.qnx.qcc.option.assembler.qccoptions.80954895" name="QCC Options" superClass="com.qnx.qcc.option.assembler.qccoptions" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="-mfpu=neon"/>
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - 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 <string.h>
|
||||
#include <string/string_list.h>
|
||||
#include "camera_driver.h"
|
||||
#include "../driver.h"
|
||||
#include "../general.h"
|
||||
|
||||
static const camera_driver_t *camera_drivers[] = {
|
||||
#ifdef HAVE_V4L2
|
||||
&camera_v4l2,
|
||||
#endif
|
||||
#ifdef EMSCRIPTEN
|
||||
&camera_rwebcam,
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
&camera_android,
|
||||
#endif
|
||||
#if defined(MAC_OS_X_VERSION_10_7) || defined(__IPHONE_4_0)
|
||||
&camera_apple,
|
||||
#endif
|
||||
&camera_null,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/**
|
||||
* camera_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to camera driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *camera_driver_find_handle(int index)
|
||||
{
|
||||
const void *drv = camera_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv;
|
||||
}
|
||||
|
||||
/**
|
||||
* camera_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of camera driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *camera_driver_find_ident(int index)
|
||||
{
|
||||
const camera_driver_t *drv = camera_drivers[index];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
|
||||
/**
|
||||
* config_get_camera_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all camera driver names,
|
||||
* separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all camera driver names,
|
||||
* separated by '|'.
|
||||
**/
|
||||
const char* config_get_camera_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
for (i = 0; camera_driver_find_handle(i); i++)
|
||||
{
|
||||
const char *opt = camera_driver_find_ident(i);
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
||||
|
||||
options = (char*)calloc(options_len, sizeof(char));
|
||||
|
||||
string_list_join_concat(options, options_len, options_l, "|");
|
||||
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
void find_camera_driver(void)
|
||||
{
|
||||
int i = find_driver_index("camera_driver", g_settings.camera.driver);
|
||||
if (i >= 0)
|
||||
driver.camera = (const camera_driver_t*)camera_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any camera driver named \"%s\"\n",
|
||||
g_settings.camera.driver);
|
||||
RARCH_LOG_OUTPUT("Available camera drivers are:\n");
|
||||
for (d = 0; camera_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", camera_driver_find_ident(d));
|
||||
|
||||
RARCH_WARN("Going to default to first camera driver...\n");
|
||||
|
||||
driver.camera = (const camera_driver_t*)camera_driver_find_handle(0);
|
||||
|
||||
if (!driver.camera)
|
||||
rarch_fail(1, "find_camera_driver()");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_camera_start:
|
||||
*
|
||||
* Starts camera driver interface.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool driver_camera_start(void)
|
||||
{
|
||||
if (driver.camera && driver.camera_data && driver.camera->start)
|
||||
{
|
||||
if (g_settings.camera.allow)
|
||||
return driver.camera->start(driver.camera_data);
|
||||
|
||||
msg_queue_push(g_extern.msg_queue,
|
||||
"Camera is explicitly disabled.\n", 1, 180);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_camera_stop:
|
||||
*
|
||||
* Stops camera driver.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_camera_stop(void)
|
||||
{
|
||||
if (driver.camera && driver.camera->stop && driver.camera_data)
|
||||
driver.camera->stop(driver.camera_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* driver_camera_poll:
|
||||
*
|
||||
* Call camera driver's poll function.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_camera_poll(void)
|
||||
{
|
||||
if (driver.camera && driver.camera->poll && driver.camera_data)
|
||||
driver.camera->poll(driver.camera_data,
|
||||
g_extern.system.camera_callback.frame_raw_framebuffer,
|
||||
g_extern.system.camera_callback.frame_opengl_texture);
|
||||
}
|
||||
|
||||
void init_camera(void)
|
||||
{
|
||||
/* Resource leaks will follow if camera is initialized twice. */
|
||||
if (driver.camera_data)
|
||||
return;
|
||||
|
||||
find_camera_driver();
|
||||
|
||||
driver.camera_data = driver.camera->init(
|
||||
*g_settings.camera.device ? g_settings.camera.device : NULL,
|
||||
g_extern.system.camera_callback.caps,
|
||||
g_settings.camera.width ?
|
||||
g_settings.camera.width : g_extern.system.camera_callback.width,
|
||||
g_settings.camera.height ?
|
||||
g_settings.camera.height : g_extern.system.camera_callback.height);
|
||||
|
||||
if (!driver.camera_data)
|
||||
{
|
||||
RARCH_ERR("Failed to initialize camera driver. Will continue without camera.\n");
|
||||
driver.camera_active = false;
|
||||
}
|
||||
|
||||
if (g_extern.system.camera_callback.initialized)
|
||||
g_extern.system.camera_callback.initialized();
|
||||
}
|
||||
|
||||
void uninit_camera(void)
|
||||
{
|
||||
if (driver.camera_data && driver.camera)
|
||||
{
|
||||
if (g_extern.system.camera_callback.deinitialized)
|
||||
g_extern.system.camera_callback.deinitialized();
|
||||
|
||||
if (driver.camera->free)
|
||||
driver.camera->free(driver.camera_data);
|
||||
}
|
||||
driver.camera_data = NULL;
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - 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 __CAMERA_DRIVER__H
|
||||
#define __CAMERA_DRIVER__H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include "../libretro.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct camera_driver
|
||||
{
|
||||
/* FIXME: params for initialization - queries for resolution,
|
||||
* framerate, color format which might or might not be honored. */
|
||||
void *(*init)(const char *device, uint64_t buffer_types,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
void (*free)(void *data);
|
||||
|
||||
bool (*start)(void *data);
|
||||
void (*stop)(void *data);
|
||||
|
||||
/* Polls the camera driver.
|
||||
* Will call the appropriate callback if a new frame is ready.
|
||||
* Returns true if a new frame was handled. */
|
||||
bool (*poll)(void *data,
|
||||
retro_camera_frame_raw_framebuffer_t frame_raw_cb,
|
||||
retro_camera_frame_opengl_texture_t frame_gl_cb);
|
||||
|
||||
const char *ident;
|
||||
} camera_driver_t;
|
||||
|
||||
extern camera_driver_t camera_v4l2;
|
||||
extern camera_driver_t camera_android;
|
||||
extern camera_driver_t camera_rwebcam;
|
||||
extern camera_driver_t camera_apple;
|
||||
extern camera_driver_t camera_null;
|
||||
|
||||
/**
|
||||
* driver_camera_start:
|
||||
*
|
||||
* Starts camera driver.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool driver_camera_start(void);
|
||||
|
||||
/**
|
||||
* driver_camera_stop:
|
||||
*
|
||||
* Stops camera driver.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_camera_stop(void);
|
||||
|
||||
/**
|
||||
* driver_camera_poll:
|
||||
*
|
||||
* Call camera driver's poll function.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_camera_poll(void);
|
||||
|
||||
/**
|
||||
* config_get_camera_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all camera driver names,
|
||||
* separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all camera driver names,
|
||||
* separated by '|'.
|
||||
**/
|
||||
const char* config_get_camera_driver_options(void);
|
||||
|
||||
/**
|
||||
* camera_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to camera driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *camera_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* camera_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of camera driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *camera_driver_find_ident(int index);
|
||||
|
||||
void find_camera_driver(void);
|
||||
|
||||
void init_camera(void);
|
||||
|
||||
void uninit_camera(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <glsym/glsym.h>
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
typedef struct android_camera
|
||||
{
|
|
@ -13,7 +13,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../../driver.h"
|
||||
|
||||
static void *nullcamera_init(const char *device, uint64_t caps,
|
||||
unsigned width, unsigned height)
|
|
@ -13,8 +13,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../emscripten/RWebCam.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../emscripten/RWebCam.h"
|
||||
|
||||
static void *rwebcam_init(const char *device, uint64_t caps,
|
||||
unsigned width, unsigned height)
|
|
@ -20,7 +20,7 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include "../performance.h"
|
||||
#include "../../performance.h"
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include <stdlib.h>
|
|
@ -532,7 +532,7 @@ static bool load_content(const struct retro_subsystem_info *special,
|
|||
ret = pretro_load_game(*content->elems[0].data ? info : NULL);
|
||||
|
||||
if (!ret)
|
||||
RARCH_ERR("Failed to load game.\n");
|
||||
RARCH_ERR("Failed to load content.\n");
|
||||
|
||||
end:
|
||||
for (i = 0; i < content->size; i++)
|
||||
|
|
54
core_info.c
54
core_info.c
|
@ -37,8 +37,9 @@ static void core_info_list_resolve_all_extensions(
|
|||
|
||||
for (i = 0; i < core_info_list->count; i++)
|
||||
{
|
||||
all_ext_len += core_info_list->list[i].supported_extensions ?
|
||||
(strlen(core_info_list->list[i].supported_extensions) + 2) : 0;
|
||||
if (core_info_list->list[i].supported_extensions)
|
||||
all_ext_len +=
|
||||
(strlen(core_info_list->list[i].supported_extensions) + 2);
|
||||
}
|
||||
|
||||
if (all_ext_len)
|
||||
|
@ -48,12 +49,12 @@ static void core_info_list_resolve_all_extensions(
|
|||
{
|
||||
for (i = 0; i < core_info_list->count; i++)
|
||||
{
|
||||
if (core_info_list->list[i].supported_extensions)
|
||||
{
|
||||
strlcat(core_info_list->all_ext,
|
||||
core_info_list->list[i].supported_extensions, all_ext_len);
|
||||
strlcat(core_info_list->all_ext, "|", all_ext_len);
|
||||
}
|
||||
if (!core_info_list->list[i].supported_extensions)
|
||||
continue;
|
||||
|
||||
strlcat(core_info_list->all_ext,
|
||||
core_info_list->list[i].supported_extensions, all_ext_len);
|
||||
strlcat(core_info_list->all_ext, "|", all_ext_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +334,12 @@ bool core_info_list_get_by_id(core_info_list_t *core_info_list,
|
|||
{
|
||||
core_info_t *info = (core_info_t*)&core_info_list->list[i];
|
||||
|
||||
if (info && info->path && strcmp(core_id, info->path) == 0)
|
||||
if (!info)
|
||||
continue;
|
||||
if (!info->path)
|
||||
continue;
|
||||
|
||||
if (!strcmp(core_id, info->path))
|
||||
{
|
||||
*out_info = *info;
|
||||
return true;
|
||||
|
@ -421,12 +427,15 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
|
|||
if (!core)
|
||||
continue;
|
||||
|
||||
if (!core_info_does_support_file(core, path)
|
||||
if (core_info_does_support_file(core, path))
|
||||
continue;
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
&& !core_info_does_support_any_file(core, list)
|
||||
if (core_info_does_support_any_file(core, list))
|
||||
continue;
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
|
@ -446,7 +455,12 @@ static core_info_t *find_core_info(core_info_list_t *list,
|
|||
for (i = 0; i < list->count; i++)
|
||||
{
|
||||
core_info_t *info = (core_info_t*)&list->list[i];
|
||||
if (info && info->path && !strcmp(info->path, core))
|
||||
|
||||
if (!info)
|
||||
continue;
|
||||
if (!info->path)
|
||||
continue;
|
||||
if (!strcmp(info->path, core))
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -479,12 +493,12 @@ void core_info_list_update_missing_firmware(core_info_list_t *core_info_list,
|
|||
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
{
|
||||
if (info->firmware[i].path)
|
||||
{
|
||||
fill_pathname_join(path, systemdir,
|
||||
info->firmware[i].path, sizeof(path));
|
||||
info->firmware[i].missing = !path_file_exists(path);
|
||||
}
|
||||
if (!info->firmware[i].path)
|
||||
continue;
|
||||
|
||||
fill_pathname_join(path, systemdir,
|
||||
info->firmware[i].path, sizeof(path));
|
||||
info->firmware[i].missing = !path_file_exists(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,12 @@
|
|||
int read_zip_file(const char * archive_path,
|
||||
const char *relative_path, void **buf, const char* optional_outfile)
|
||||
{
|
||||
uLong i;
|
||||
unz_global_info global_info;
|
||||
ssize_t bytes_read = -1;
|
||||
bool finished_reading = false;
|
||||
unzFile *zipfile = (unzFile*)unzOpen( archive_path );
|
||||
|
||||
if (!zipfile)
|
||||
{
|
||||
RARCH_ERR("Could not open ZIP file %s.\n",archive_path);
|
||||
|
@ -54,24 +57,23 @@ int read_zip_file(const char * archive_path,
|
|||
}
|
||||
|
||||
/* Get info about the zip file */
|
||||
unz_global_info global_info;
|
||||
if ( unzGetGlobalInfo( zipfile, &global_info ) != UNZ_OK )
|
||||
if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Could not get global ZIP file info of %s."
|
||||
"Could be only a GZIP file without the ZIP part.\n",
|
||||
archive_path);
|
||||
unzClose( zipfile );
|
||||
unzClose(zipfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Loop to extract all files */
|
||||
uLong i;
|
||||
for ( i = 0; i < global_info.number_entry; ++i )
|
||||
{
|
||||
/* Get info about current file. */
|
||||
unz_file_info file_info;
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
if ( unzGetCurrentFileInfo(
|
||||
char last_char = ' ';
|
||||
|
||||
if (unzGetCurrentFileInfo(
|
||||
zipfile,
|
||||
&file_info,
|
||||
filename,
|
||||
|
@ -80,12 +82,11 @@ int read_zip_file(const char * archive_path,
|
|||
{
|
||||
RARCH_ERR("Could not read file info in ZIP %s.\n",
|
||||
archive_path);
|
||||
unzClose( zipfile );
|
||||
unzClose(zipfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check if this entry is a directory or file. */
|
||||
char last_char = ' ';
|
||||
last_char = filename[strlen(filename)-1];
|
||||
if ( last_char == '/' || last_char == '\\' )
|
||||
{
|
||||
|
@ -94,11 +95,11 @@ int read_zip_file(const char * archive_path,
|
|||
else if (strcmp(filename,relative_path) == 0)
|
||||
{
|
||||
/* We found the correct file in the zip, now extract it to *buf */
|
||||
if ( unzOpenCurrentFile( zipfile ) != UNZ_OK )
|
||||
if (unzOpenCurrentFile(zipfile) != UNZ_OK )
|
||||
{
|
||||
RARCH_ERR("The file %s in %s could not be read.\n",
|
||||
relative_path, archive_path);
|
||||
unzClose( zipfile );
|
||||
unzClose(zipfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -109,26 +110,30 @@ int read_zip_file(const char * archive_path,
|
|||
if (outsink == NULL)
|
||||
{
|
||||
RARCH_ERR("Could not open outfilepath %s.\n", optional_outfile);
|
||||
unzCloseCurrentFile( zipfile );
|
||||
unzClose( zipfile );
|
||||
unzCloseCurrentFile(zipfile);
|
||||
unzClose(zipfile);
|
||||
return -1;
|
||||
}
|
||||
bytes_read = 0;
|
||||
do
|
||||
{
|
||||
bytes_read = unzReadCurrentFile( zipfile, read_buffer,
|
||||
ssize_t fwrite_bytes;
|
||||
|
||||
bytes_read = unzReadCurrentFile(zipfile, read_buffer,
|
||||
RARCH_ZIP_SUPPORT_BUFFER_SIZE_MAX );
|
||||
ssize_t fwrite_bytes = fwrite(read_buffer,1,bytes_read,outsink);
|
||||
if (fwrite_bytes != bytes_read)
|
||||
{
|
||||
/* couldn't write all bytes */
|
||||
RARCH_ERR("Error writing to %s.\n",optional_outfile);
|
||||
fclose(outsink);
|
||||
unzCloseCurrentFile( zipfile );
|
||||
unzClose( zipfile );
|
||||
return -1;
|
||||
}
|
||||
} while(bytes_read > 0) ;
|
||||
fwrite_bytes = fwrite(read_buffer,1,bytes_read,outsink);
|
||||
|
||||
if (fwrite_bytes == bytes_read)
|
||||
continue;
|
||||
|
||||
/* couldn't write all bytes */
|
||||
RARCH_ERR("Error writing to %s.\n",optional_outfile);
|
||||
fclose(outsink);
|
||||
unzCloseCurrentFile(zipfile);
|
||||
unzClose(zipfile);
|
||||
return -1;
|
||||
}while(bytes_read > 0);
|
||||
|
||||
fclose(outsink);
|
||||
}
|
||||
else
|
||||
|
@ -136,7 +141,8 @@ int read_zip_file(const char * archive_path,
|
|||
/* Allocate outbuffer */
|
||||
*buf = malloc(file_info.uncompressed_size + 1 );
|
||||
|
||||
bytes_read = unzReadCurrentFile( zipfile, *buf, file_info.uncompressed_size );
|
||||
bytes_read = unzReadCurrentFile(zipfile, *buf, file_info.uncompressed_size);
|
||||
|
||||
if (bytes_read != (ssize_t)file_info.uncompressed_size)
|
||||
{
|
||||
RARCH_ERR(
|
||||
|
@ -144,42 +150,53 @@ int read_zip_file(const char * archive_path,
|
|||
(unsigned int) file_info.uncompressed_size, (int)bytes_read,
|
||||
relative_path, archive_path);
|
||||
free(*buf);
|
||||
unzCloseCurrentFile( zipfile );
|
||||
unzClose( zipfile );
|
||||
unzCloseCurrentFile(zipfile);
|
||||
unzClose(zipfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
((char*)(*buf))[file_info.uncompressed_size] = '\0';
|
||||
}
|
||||
finished_reading = true;
|
||||
}
|
||||
unzCloseCurrentFile( zipfile );
|
||||
|
||||
unzCloseCurrentFile(zipfile);
|
||||
|
||||
if (finished_reading)
|
||||
break;
|
||||
|
||||
if ( ( i+1 ) < global_info.number_entry )
|
||||
if ((i + 1) < global_info.number_entry)
|
||||
{
|
||||
if ( unzGoToNextFile( zipfile ) != UNZ_OK )
|
||||
{
|
||||
RARCH_ERR(
|
||||
"Could not iterate to next file in %s. ZIP file might be corrupt.\n",
|
||||
archive_path );
|
||||
unzClose( zipfile );
|
||||
return -1;
|
||||
}
|
||||
if (unzGoToNextFile(zipfile) == UNZ_OK)
|
||||
continue;
|
||||
|
||||
RARCH_ERR(
|
||||
"Could not iterate to next file in %s. ZIP file might be corrupt.\n",
|
||||
archive_path );
|
||||
unzClose(zipfile);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
unzClose( zipfile );
|
||||
|
||||
unzClose(zipfile);
|
||||
|
||||
if(!finished_reading)
|
||||
{
|
||||
RARCH_ERR("File %s not found in %s\n", relative_path, archive_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
struct string_list *compressed_zip_file_list_new(const char *path,
|
||||
const char* ext)
|
||||
{
|
||||
uLong i;
|
||||
unz_global_info global_info;
|
||||
unzFile *zipfile = NULL;
|
||||
ssize_t bytes_read = -1;
|
||||
bool finished_reading = false;
|
||||
struct string_list *ext_list = NULL;
|
||||
struct string_list *list = string_list_new();
|
||||
|
||||
|
@ -189,10 +206,7 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||
if (ext)
|
||||
ext_list = string_split(ext, "|");
|
||||
|
||||
|
||||
ssize_t bytes_read = -1;
|
||||
bool finished_reading = false;
|
||||
unzFile *zipfile = (unzFile*)unzOpen( path );
|
||||
zipfile = (unzFile*)unzOpen( path );
|
||||
|
||||
(void)finished_reading;
|
||||
(void)bytes_read;
|
||||
|
@ -206,42 +220,41 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||
}
|
||||
|
||||
/* Get info about the zip file */
|
||||
unz_global_info global_info;
|
||||
if ( unzGetGlobalInfo( zipfile, &global_info ) != UNZ_OK )
|
||||
if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Could not get global zipfile info of %s."
|
||||
"Could be only a GZIP file without the ZIP part.\n",
|
||||
path);
|
||||
unzClose( zipfile );
|
||||
unzClose(zipfile);
|
||||
string_list_free(list);
|
||||
string_list_free(ext_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Loop to extract all files */
|
||||
uLong i;
|
||||
for ( i = 0; i < global_info.number_entry; ++i )
|
||||
{
|
||||
/* Get info about current file. */
|
||||
unz_file_info file_info;
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
if ( unzGetCurrentFileInfo(
|
||||
char last_char = ' ';
|
||||
|
||||
if (unzGetCurrentFileInfo(
|
||||
zipfile,
|
||||
&file_info,
|
||||
filename,
|
||||
PATH_MAX_LENGTH,
|
||||
NULL, 0, NULL, 0 ) != UNZ_OK )
|
||||
NULL, 0, NULL, 0 ) != UNZ_OK)
|
||||
{
|
||||
RARCH_ERR("Could not read file info in ZIP %s.\n", path);
|
||||
unzClose( zipfile );
|
||||
unzClose(zipfile);
|
||||
string_list_free(list);
|
||||
string_list_free(ext_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check if this entry is a directory or file. */
|
||||
char last_char = ' ';
|
||||
last_char = filename[strlen(filename)-1];
|
||||
|
||||
if ( last_char == '/' || last_char == '\\' )
|
||||
{
|
||||
/* We skip directories */
|
||||
|
@ -251,6 +264,7 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||
const char *file_ext = path_get_extension(filename);
|
||||
bool supported_by_core = false;
|
||||
union string_list_elem_attr attr;
|
||||
|
||||
if (string_list_find_elem_prefix(ext_list, ".", file_ext))
|
||||
supported_by_core = true;
|
||||
|
||||
|
@ -260,26 +274,30 @@ struct string_list *compressed_zip_file_list_new(const char *path,
|
|||
if (!string_list_append(list, filename, attr))
|
||||
{
|
||||
RARCH_ERR("Could not append item to string list.\n");
|
||||
unzCloseCurrentFile( zipfile );
|
||||
unzCloseCurrentFile(zipfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
unzCloseCurrentFile( zipfile );
|
||||
if ( ( i+1 ) < global_info.number_entry )
|
||||
|
||||
unzCloseCurrentFile(zipfile);
|
||||
|
||||
if ((i + 1) < global_info.number_entry)
|
||||
{
|
||||
if ( unzGoToNextFile( zipfile ) != UNZ_OK )
|
||||
if (unzGoToNextFile(zipfile) != UNZ_OK )
|
||||
{
|
||||
RARCH_ERR( "Could not iterate to next file in %s. ZIP file might be corrupt.\n",path );
|
||||
unzClose( zipfile );
|
||||
unzClose(zipfile);
|
||||
string_list_free(list);
|
||||
string_list_free(ext_list);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
unzClose( zipfile );
|
||||
|
||||
unzClose(zipfile);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
591
driver.h
591
driver.h
|
@ -14,7 +14,6 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DRIVER__H
|
||||
#define __DRIVER__H
|
||||
|
||||
|
@ -24,23 +23,19 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include "gfx/scaler/scaler.h"
|
||||
#include "gfx/image/image.h"
|
||||
#include "gfx/shader/shader_parse.h"
|
||||
#include "input/input_context.h"
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
#include "input/overlay.h"
|
||||
#endif
|
||||
|
||||
#include "frontend/frontend_context.h"
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "frontend/frontend_driver.h"
|
||||
#include "gfx/video_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
|
||||
#include "menu/menu_driver.h"
|
||||
#include "menu/backend/menu_backend.h"
|
||||
#include "menu/disp/menu_display.h"
|
||||
#include "audio/resamplers/resampler.h"
|
||||
#include "record/ffemu.h"
|
||||
#include "osk/osk_driver.h"
|
||||
#include "camera/camera_driver.h"
|
||||
#include "location/location_driver.h"
|
||||
#include "audio/audio_resampler_driver.h"
|
||||
#include "record/record_driver.h"
|
||||
|
||||
#include "retro.h"
|
||||
|
||||
|
@ -136,80 +131,6 @@ enum
|
|||
RARCH_BIND_LIST_END_NULL
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
{
|
||||
bool valid;
|
||||
unsigned id;
|
||||
const char *desc;
|
||||
enum retro_key key;
|
||||
|
||||
uint64_t joykey;
|
||||
/* Default key binding value - for resetting bind to default */
|
||||
uint64_t def_joykey;
|
||||
|
||||
uint32_t joyaxis;
|
||||
uint32_t def_joyaxis;
|
||||
|
||||
/* Used by input_{push,pop}_analog_dpad(). */
|
||||
uint32_t orig_joyaxis;
|
||||
|
||||
char joykey_label[256];
|
||||
char joyaxis_label[256];
|
||||
};
|
||||
|
||||
struct platform_bind
|
||||
{
|
||||
uint64_t joykey;
|
||||
char desc[64];
|
||||
};
|
||||
|
||||
typedef struct video_info
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
bool fullscreen;
|
||||
bool vsync;
|
||||
bool force_aspect;
|
||||
#ifdef GEKKO
|
||||
/* TODO - we can't really have driver system-specific
|
||||
* variables in here. There should be some
|
||||
* kind of publicly accessible driver implementation
|
||||
* video struct for specific things like this.
|
||||
*/
|
||||
unsigned viwidth;
|
||||
#endif
|
||||
bool vfilter;
|
||||
bool smooth;
|
||||
/* Maximum input size: RARCH_SCALE_BASE * input_scale */
|
||||
unsigned input_scale;
|
||||
/* Use 32bit RGBA rather than native XBGR1555. */
|
||||
bool rgb32;
|
||||
} video_info_t;
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
void *(*init)(const char *device, unsigned rate, unsigned latency);
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
bool (*stop)(void *data);
|
||||
bool (*start)(void *data);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Should we care about blocking in audio thread? Fast forwarding. */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
void (*free)(void *data);
|
||||
|
||||
/* Defines if driver will take standard floating point samples,
|
||||
* or int16_t samples. */
|
||||
bool (*use_float)(void *data);
|
||||
const char *ident;
|
||||
|
||||
/* Optional. */
|
||||
size_t (*write_avail)(void *data);
|
||||
size_t (*buffer_size)(void *data);
|
||||
} audio_driver_t;
|
||||
|
||||
#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)
|
||||
|
@ -242,187 +163,6 @@ enum analog_dpad_mode
|
|||
ANALOG_DPAD_LAST
|
||||
};
|
||||
|
||||
typedef struct input_driver
|
||||
{
|
||||
void *(*init)(void);
|
||||
void (*poll)(void *data);
|
||||
int16_t (*input_state)(void *data,
|
||||
const struct retro_keybind **retro_keybinds,
|
||||
unsigned port, unsigned device, unsigned index, unsigned id);
|
||||
bool (*key_pressed)(void *data, int key);
|
||||
void (*free)(void *data);
|
||||
bool (*set_sensor_state)(void *data, unsigned port,
|
||||
enum retro_sensor_action action, unsigned rate);
|
||||
float (*get_sensor_input)(void *data, unsigned port, unsigned id);
|
||||
uint64_t (*get_capabilities)(void *data);
|
||||
const char *ident;
|
||||
|
||||
void (*grab_mouse)(void *data, bool state);
|
||||
bool (*set_rumble)(void *data, unsigned port,
|
||||
enum retro_rumble_effect effect, uint16_t state);
|
||||
const rarch_joypad_driver_t *(*get_joypad_driver)(void *data);
|
||||
} input_driver_t;
|
||||
|
||||
typedef struct input_osk_driver
|
||||
{
|
||||
void *(*init)(size_t size);
|
||||
void (*free)(void *data);
|
||||
bool (*enable_key_layout)(void *data);
|
||||
void (*oskutil_create_activation_parameters)(void *data);
|
||||
void (*write_msg)(void *data, const void *msg);
|
||||
void (*write_initial_msg)(void *data, const void *msg);
|
||||
bool (*start)(void *data);
|
||||
void (*lifecycle)(void *data, uint64_t status);
|
||||
void *(*get_text_buf)(void *data);
|
||||
const char *ident;
|
||||
} input_osk_driver_t;
|
||||
|
||||
typedef struct camera_driver
|
||||
{
|
||||
/* FIXME: params for initialization - queries for resolution,
|
||||
* framerate, color format which might or might not be honored. */
|
||||
void *(*init)(const char *device, uint64_t buffer_types,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
void (*free)(void *data);
|
||||
|
||||
bool (*start)(void *data);
|
||||
void (*stop)(void *data);
|
||||
|
||||
/* Polls the camera driver.
|
||||
* Will call the appropriate callback if a new frame is ready.
|
||||
* Returns true if a new frame was handled. */
|
||||
bool (*poll)(void *data,
|
||||
retro_camera_frame_raw_framebuffer_t frame_raw_cb,
|
||||
retro_camera_frame_opengl_texture_t frame_gl_cb);
|
||||
|
||||
const char *ident;
|
||||
} camera_driver_t;
|
||||
|
||||
typedef struct location_driver
|
||||
{
|
||||
void *(*init)(void);
|
||||
void (*free)(void *data);
|
||||
|
||||
bool (*start)(void *data);
|
||||
void (*stop)(void *data);
|
||||
|
||||
bool (*get_position)(void *data, double *lat, double *lon,
|
||||
double *horiz_accuracy, double *vert_accuracy);
|
||||
void (*set_interval)(void *data, unsigned interval_msecs,
|
||||
unsigned interval_distance);
|
||||
const char *ident;
|
||||
} location_driver_t;
|
||||
|
||||
struct rarch_viewport;
|
||||
|
||||
struct font_params
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float scale;
|
||||
/* Drop shadow color multiplier. */
|
||||
float drop_mod;
|
||||
/* Drop shadow offset.
|
||||
* If both are 0, no drop shadow will be rendered. */
|
||||
int drop_x, drop_y;
|
||||
/* ABGR. Use the macros. */
|
||||
uint32_t color;
|
||||
bool full_screen;
|
||||
};
|
||||
#define FONT_COLOR_RGBA(r, g, b, a) (((r) << 0) | ((g) << 8) | ((b) << 16) | ((a) << 24))
|
||||
#define FONT_COLOR_GET_RED(col) (((col) >> 0) & 0xff)
|
||||
#define FONT_COLOR_GET_GREEN(col) (((col) >> 8) & 0xff)
|
||||
#define FONT_COLOR_GET_BLUE(col) (((col) >> 16) & 0xff)
|
||||
#define FONT_COLOR_GET_ALPHA(col) (((col) >> 24) & 0xff)
|
||||
|
||||
/* Optionally implemented interface to poke more
|
||||
* deeply into video driver. */
|
||||
|
||||
typedef struct video_poke_interface
|
||||
{
|
||||
void (*set_filtering)(void *data, unsigned index, bool smooth);
|
||||
#ifdef HAVE_FBO
|
||||
uintptr_t (*get_current_framebuffer)(void *data);
|
||||
retro_proc_address_t (*get_proc_address)(void *data, const char *sym);
|
||||
#endif
|
||||
void (*set_aspect_ratio)(void *data, unsigned aspectratio_index);
|
||||
void (*apply_state_changes)(void *data);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* Update texture. */
|
||||
void (*set_texture_frame)(void *data, const void *frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha);
|
||||
|
||||
/* Enable or disable rendering. */
|
||||
void (*set_texture_enable)(void *data, bool enable, bool full_screen);
|
||||
#endif
|
||||
void (*set_osd_msg)(void *data, const char *msg,
|
||||
const struct font_params *params, void *font);
|
||||
|
||||
void (*show_mouse)(void *data, bool state);
|
||||
void (*grab_mouse_toggle)(void *data);
|
||||
|
||||
struct gfx_shader *(*get_current_shader)(void *data);
|
||||
} video_poke_interface_t;
|
||||
|
||||
typedef struct video_driver
|
||||
{
|
||||
/* Should the video driver act as an input driver as well?
|
||||
* The video initialization might preinitialize an input driver
|
||||
* to override the settings in case the video driver relies on
|
||||
* input driver for event handling. */
|
||||
void *(*init)(const video_info_t *video, const input_driver_t **input,
|
||||
void **input_data);
|
||||
|
||||
/* msg is for showing a message on the screen along with the video frame. */
|
||||
bool (*frame)(void *data, const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg);
|
||||
|
||||
/* Should we care about syncing to vblank? Fast forwarding. */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
|
||||
/* Is the window still active? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Does the window have focus? */
|
||||
bool (*focus)(void *data);
|
||||
|
||||
/* Does the graphics conext support windowed mode? */
|
||||
bool (*has_windowed)(void *data);
|
||||
|
||||
/* Sets shader. Might not be implemented. Will be moved to
|
||||
* poke_interface later. */
|
||||
bool (*set_shader)(void *data, enum rarch_shader_type type,
|
||||
const char *path);
|
||||
|
||||
void (*free)(void *data);
|
||||
const char *ident;
|
||||
|
||||
void (*set_rotation)(void *data, unsigned rotation);
|
||||
void (*viewport_info)(void *data, struct rarch_viewport *vp);
|
||||
|
||||
/* Reads out in BGR byte order (24bpp). */
|
||||
bool (*read_viewport)(void *data, uint8_t *buffer);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
void (*overlay_interface)(void *data, const video_overlay_interface_t **iface);
|
||||
#endif
|
||||
void (*poke_interface)(void *data, const video_poke_interface_t **iface);
|
||||
unsigned (*wrap_type_to_enum)(enum gfx_wrap_type type);
|
||||
} video_driver_t;
|
||||
|
||||
enum rarch_display_type
|
||||
{
|
||||
/* Non-bindable types like consoles, KMS, VideoCore, etc. */
|
||||
RARCH_DISPLAY_NONE = 0,
|
||||
/* video_display => Display*, video_window => Window */
|
||||
RARCH_DISPLAY_X11,
|
||||
/* video_display => N/A, video_window => HWND */
|
||||
RARCH_DISPLAY_WIN32,
|
||||
RARCH_DISPLAY_OSX
|
||||
};
|
||||
|
||||
/* Flags for init_drivers/uninit_drivers */
|
||||
enum
|
||||
{
|
||||
|
@ -559,10 +299,32 @@ typedef struct driver
|
|||
const char *current_msg;
|
||||
} driver_t;
|
||||
|
||||
/**
|
||||
* init_drivers:
|
||||
* @flags : Bitmask of drivers to initialize.
|
||||
*
|
||||
* Initializes drivers.
|
||||
* @flags determines which drivers get initialized.
|
||||
**/
|
||||
void init_drivers(int flags);
|
||||
|
||||
/**
|
||||
* init_drivers_pre:
|
||||
*
|
||||
* Attempts to find a default driver for
|
||||
* all driver types.
|
||||
*
|
||||
* Should be run before init_drivers().
|
||||
**/
|
||||
void init_drivers_pre(void);
|
||||
|
||||
/**
|
||||
* uninit_drivers:
|
||||
* @flags : Bitmask of drivers to deinitialize.
|
||||
*
|
||||
* Deinitializes drivers.
|
||||
* @flags determines which drivers get deinitialized.
|
||||
**/
|
||||
void uninit_drivers(int flags);
|
||||
|
||||
/**
|
||||
|
@ -586,34 +348,41 @@ void find_prev_driver(const char *label, char *str, size_t sizeof_str);
|
|||
void find_next_driver(const char *label, char *str, size_t sizeof_str);
|
||||
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
* driver_set_monitor_refresh_rate:
|
||||
* @hz : New refresh rate for monitor.
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
* Sets monitor refresh rate to new value.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void);
|
||||
|
||||
/**
|
||||
* find_prev_resampler_driver:
|
||||
*
|
||||
* Find previous driver in resampler driver array.
|
||||
**/
|
||||
void find_prev_resampler_driver(void);
|
||||
|
||||
/**
|
||||
* find_next_resampler_driver:
|
||||
*
|
||||
* Find next driver in resampler driver array.
|
||||
**/
|
||||
void find_next_resampler_driver(void);
|
||||
|
||||
void driver_set_monitor_refresh_rate(float hz);
|
||||
|
||||
/**
|
||||
* driver_monitor_fps_statistics
|
||||
* @refresh_rate : Monitor refresh rate.
|
||||
* @deviation : Deviation from measured refresh rate.
|
||||
* @sample_points : Amount of sampled points.
|
||||
*
|
||||
* Gets the monitor FPS statistics based on the current
|
||||
* runtime.
|
||||
*
|
||||
* Returns: true (1) on success.
|
||||
* false (0) if:
|
||||
* a) threaded video mode is enabled
|
||||
* b) less than 2 frame time samples.
|
||||
* c) FPS monitor enable is off.
|
||||
**/
|
||||
bool driver_monitor_fps_statistics(double *refresh_rate,
|
||||
double *deviation, unsigned *sample_points);
|
||||
|
||||
void driver_set_nonblock_state(bool nonblock);
|
||||
/**
|
||||
* driver_set_nonblock_state:
|
||||
* @enable : Enable nonblock state?
|
||||
*
|
||||
* Sets audio and video drivers to nonblock state.
|
||||
*
|
||||
* If @enable is false, sets blocking state for both
|
||||
* audio and video drivers instead.
|
||||
**/
|
||||
void driver_set_nonblock_state(bool enable);
|
||||
|
||||
/**
|
||||
* driver_get_current_framebuffer:
|
||||
|
@ -653,94 +422,6 @@ bool driver_set_sensor_state(unsigned port,
|
|||
|
||||
float driver_sensor_get_input(unsigned port, unsigned action);
|
||||
|
||||
/**
|
||||
* driver_video_resolve:
|
||||
* @drv : real video driver will be set to this.
|
||||
*
|
||||
* Use this if you need the real video driver
|
||||
* and driver data pointers.
|
||||
*
|
||||
* Returns: video driver's userdata.
|
||||
**/
|
||||
void *driver_video_resolve(const video_driver_t **drv);
|
||||
|
||||
/**
|
||||
* driver_camera_start:
|
||||
*
|
||||
* Starts camera driver.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool driver_camera_start(void);
|
||||
|
||||
/**
|
||||
* driver_camera_stop:
|
||||
*
|
||||
* Stops camera driver.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_camera_stop(void);
|
||||
|
||||
/**
|
||||
* driver_camera_poll:
|
||||
*
|
||||
* Call camera driver's poll function.
|
||||
* Used by RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_camera_poll(void);
|
||||
|
||||
/**
|
||||
* driver_location_start:
|
||||
*
|
||||
* Starts location driver interface..
|
||||
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool driver_location_start(void);
|
||||
|
||||
/**
|
||||
* driver_location_stop:
|
||||
*
|
||||
* Stops location driver interface..
|
||||
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
void driver_location_stop(void);
|
||||
|
||||
/**
|
||||
* driver_location_get_position:
|
||||
* @lat : Latitude of current position.
|
||||
* @lon : Longitude of current position.
|
||||
* @horiz_accuracy : Horizontal accuracy.
|
||||
* @vert_accuracy : Vertical accuracy.
|
||||
*
|
||||
* Gets current positioning information from
|
||||
* location driver interface.
|
||||
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
|
||||
*
|
||||
* Returns: bool (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool driver_location_get_position(double *lat, double *lon,
|
||||
double *horiz_accuracy, double *vert_accuracy);
|
||||
|
||||
/**
|
||||
* driver_location_set_interval:
|
||||
* @interval_msecs : Interval time in milliseconds.
|
||||
* @interval_distance : Distance at which to update.
|
||||
*
|
||||
* Sets interval update time for location driver interface.
|
||||
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
|
||||
**/
|
||||
void driver_location_set_interval(unsigned interval_msecs,
|
||||
unsigned interval_distance);
|
||||
|
||||
/**
|
||||
* driver_update_system_av_info:
|
||||
* @info : pointer to new A/V info
|
||||
|
@ -755,158 +436,18 @@ bool driver_update_system_av_info(const struct retro_system_av_info *info);
|
|||
|
||||
extern driver_t driver;
|
||||
|
||||
/* Backends */
|
||||
extern audio_driver_t audio_rsound;
|
||||
extern audio_driver_t audio_oss;
|
||||
extern audio_driver_t audio_alsa;
|
||||
extern audio_driver_t audio_alsathread;
|
||||
extern audio_driver_t audio_roar;
|
||||
extern audio_driver_t audio_openal;
|
||||
extern audio_driver_t audio_opensl;
|
||||
extern audio_driver_t audio_jack;
|
||||
extern audio_driver_t audio_sdl;
|
||||
extern audio_driver_t audio_xa;
|
||||
extern audio_driver_t audio_pulse;
|
||||
extern audio_driver_t audio_dsound;
|
||||
extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
extern audio_driver_t audio_psp1;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
extern video_driver_t video_gl;
|
||||
extern video_driver_t video_psp1;
|
||||
extern video_driver_t video_vita;
|
||||
extern video_driver_t video_d3d;
|
||||
extern video_driver_t video_gx;
|
||||
extern video_driver_t video_xenon360;
|
||||
extern video_driver_t video_xvideo;
|
||||
extern video_driver_t video_xdk_d3d;
|
||||
extern video_driver_t video_sdl;
|
||||
extern video_driver_t video_sdl2;
|
||||
extern video_driver_t video_vg;
|
||||
extern video_driver_t video_omap;
|
||||
extern video_driver_t video_exynos;
|
||||
extern video_driver_t video_null;
|
||||
|
||||
extern input_driver_t input_android;
|
||||
extern input_driver_t input_sdl;
|
||||
extern input_driver_t input_dinput;
|
||||
extern input_driver_t input_x;
|
||||
extern input_driver_t input_wayland;
|
||||
extern input_driver_t input_ps3;
|
||||
extern input_driver_t input_psp;
|
||||
extern input_driver_t input_xenon360;
|
||||
extern input_driver_t input_gx;
|
||||
extern input_driver_t input_xinput;
|
||||
extern input_driver_t input_linuxraw;
|
||||
extern input_driver_t input_udev;
|
||||
extern input_driver_t input_apple;
|
||||
extern input_driver_t input_qnx;
|
||||
extern input_driver_t input_rwebinput;
|
||||
extern input_driver_t input_null;
|
||||
|
||||
/**
|
||||
* config_get_input_driver_options:
|
||||
* find_driver_index:
|
||||
* @label : string of driver type to be found.
|
||||
* @drv : identifier of driver to be found.
|
||||
*
|
||||
* Get an enumerated list of all input driver names, separated by '|'.
|
||||
* Find index of the driver, based on @label.
|
||||
*
|
||||
* Returns: string listing of all input driver names, separated by '|'.
|
||||
* Returns: -1 if no driver based on @label and @drv found, otherwise
|
||||
* index number of the driver found in the array.
|
||||
**/
|
||||
const char* config_get_input_driver_options(void);
|
||||
|
||||
/**
|
||||
* config_get_camera_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all camera driver names,
|
||||
* separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all camera driver names,
|
||||
* separated by '|'.
|
||||
**/
|
||||
const char* config_get_camera_driver_options(void);
|
||||
|
||||
/**
|
||||
* config_get_video_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all video driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all video driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_video_driver_options(void);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void);
|
||||
|
||||
/**
|
||||
* config_get_osk_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all OSK (onscreen keyboard) driver names,
|
||||
* separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all OSK (onscreen keyboard) driver names,
|
||||
* separated by '|'.
|
||||
**/
|
||||
const char* config_get_osk_driver_options(void);
|
||||
|
||||
/**
|
||||
* config_get_location_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all location driver names,
|
||||
* separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all location driver names,
|
||||
* separated by '|'.
|
||||
**/
|
||||
const char* config_get_location_driver_options(void);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/**
|
||||
* config_get_menu_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all menu driver names,
|
||||
* separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all menu driver names,
|
||||
* separated by '|'.
|
||||
**/
|
||||
const char* config_get_menu_driver_options(void);
|
||||
#endif
|
||||
int find_driver_index(const char * label, const char *drv);
|
||||
|
||||
extern camera_driver_t camera_v4l2;
|
||||
extern camera_driver_t camera_android;
|
||||
extern camera_driver_t camera_rwebcam;
|
||||
extern camera_driver_t camera_apple;
|
||||
extern camera_driver_t camera_null;
|
||||
|
||||
extern location_driver_t location_apple;
|
||||
extern location_driver_t location_android;
|
||||
extern location_driver_t location_null;
|
||||
|
||||
extern input_osk_driver_t input_ps3_osk;
|
||||
extern input_osk_driver_t input_null_osk;
|
||||
|
||||
extern menu_ctx_driver_t menu_ctx_rmenu;
|
||||
extern menu_ctx_driver_t menu_ctx_rmenu_xui;
|
||||
extern menu_ctx_driver_t menu_ctx_rgui;
|
||||
extern menu_ctx_driver_t menu_ctx_glui;
|
||||
extern menu_ctx_driver_t menu_ctx_xmb;
|
||||
extern menu_ctx_driver_t menu_ctx_lakka;
|
||||
extern menu_ctx_driver_t menu_ctx_ios;
|
||||
|
||||
extern menu_ctx_driver_backend_t menu_ctx_backend_common;
|
||||
extern menu_ctx_driver_backend_t menu_ctx_backend_lakka;
|
||||
|
||||
extern rarch_joypad_driver_t *joypad_drivers[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - 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 __FIFO_BUFFER_H
|
||||
#define __FIFO_BUFFER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct fifo_buffer
|
||||
{
|
||||
uint8_t *buffer;
|
||||
size_t bufsize;
|
||||
size_t first;
|
||||
size_t end;
|
||||
};
|
||||
|
||||
typedef struct fifo_buffer fifo_buffer_t;
|
||||
|
||||
fifo_buffer_t *fifo_new(size_t size);
|
||||
|
||||
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
|
||||
|
||||
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size);
|
||||
|
||||
void fifo_free(fifo_buffer_t *buffer);
|
||||
|
||||
size_t fifo_read_avail(fifo_buffer_t *buffer);
|
||||
|
||||
size_t fifo_write_avail(fifo_buffer_t *buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -504,3 +504,20 @@ struct string_list *zlib_get_file_list(const char *path)
|
|||
return list;
|
||||
}
|
||||
|
||||
struct string_list *compressed_file_list_new(const char *path,
|
||||
const char* ext)
|
||||
{
|
||||
#ifdef HAVE_COMPRESSION
|
||||
const char* file_ext = path_get_extension(path);
|
||||
#ifdef HAVE_7ZIP
|
||||
if (strcasecmp(file_ext,"7z") == 0)
|
||||
return compressed_7zip_file_list_new(path,ext);
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
if (strcasecmp(file_ext,"zip") == 0)
|
||||
return compressed_zip_file_list_new(path,ext);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,14 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_7ZIP
|
||||
#include "decompress/7zip_support.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "decompress/zip_support.h"
|
||||
#endif
|
||||
|
||||
/* Returns true when parsing should continue. False to stop. */
|
||||
typedef bool (*zlib_file_cb)(const char *name,
|
||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||
|
|
58
file_ops.c
58
file_ops.c
|
@ -25,6 +25,10 @@
|
|||
#include <compat/posix_string.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
#include "file_extract.h"
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#include <kernel/image.h>
|
||||
#endif
|
||||
|
@ -152,6 +156,60 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
/* Generic compressed file loader.
|
||||
* Extracts to buf, unless optional_filename != 0
|
||||
* Then extracts to optional_filename and leaves buf alone.
|
||||
*/
|
||||
long read_compressed_file(const char * path, void **buf,
|
||||
const char* optional_filename)
|
||||
{
|
||||
const char* file_ext;
|
||||
char archive_path[PATH_MAX_LENGTH], *archive_found = NULL;
|
||||
|
||||
/* Safety check.
|
||||
* If optional_filename and optional_filename exists, we simply return 0,
|
||||
* hoping that optional_filename is the same as requested.
|
||||
*/
|
||||
if (optional_filename)
|
||||
if(path_file_exists(optional_filename))
|
||||
return 0;
|
||||
|
||||
//We split carchive path and relative path:
|
||||
strlcpy(archive_path,path,sizeof(archive_path));
|
||||
archive_found = (char*)strchr(archive_path,'#');
|
||||
rarch_assert(archive_found != NULL);
|
||||
|
||||
//We assure that there is something after the '#' symbol
|
||||
if (strlen(archive_found) <= 1)
|
||||
{
|
||||
/*
|
||||
* This error condition happens for example, when
|
||||
* path = /path/to/file.7z, or
|
||||
* path = /path/to/file.7z#
|
||||
*/
|
||||
RARCH_ERR("Could not extract image path and carchive path from "
|
||||
"path: %s.\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We split the string in two, by putting a \0, where the hash was: */
|
||||
*archive_found = '\0';
|
||||
archive_found+=1;
|
||||
|
||||
file_ext = path_get_extension(archive_path);
|
||||
#ifdef HAVE_7ZIP
|
||||
if (strcasecmp(file_ext,"7z") == 0)
|
||||
return read_7zip_file(archive_path,archive_found,buf,optional_filename);
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
if (strcasecmp(file_ext,"zip") == 0)
|
||||
return read_zip_file(archive_path,archive_found,buf,optional_filename);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* read_file:
|
||||
* @path : path to file.
|
||||
|
|
|
@ -36,8 +36,8 @@ extern void android_app_entry(void *args);
|
|||
|
||||
void engine_handle_cmd(void *data)
|
||||
{
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
int8_t cmd;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
|
||||
if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd))
|
||||
cmd = -1;
|
||||
|
@ -175,8 +175,10 @@ static void android_app_set_input(void *data, AInputQueue* inputQueue)
|
|||
slock_lock(android_app->mutex);
|
||||
android_app->pendingInputQueue = inputQueue;
|
||||
android_app_write_cmd(android_app, APP_CMD_INPUT_CHANGED);
|
||||
|
||||
while (android_app->inputQueue != android_app->pendingInputQueue)
|
||||
scond_wait(android_app->cond, android_app->mutex);
|
||||
|
||||
slock_unlock(android_app->mutex);
|
||||
}
|
||||
|
||||
|
@ -524,16 +526,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||
android_app->getIntent);
|
||||
RARCH_LOG("Checking arguments passed from intent ...\n");
|
||||
|
||||
// Config file
|
||||
/* Config file. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "CONFIGFILE"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
const char *argv = NULL;
|
||||
static char config_path[PATH_MAX_LENGTH];
|
||||
*config_path = '\0';
|
||||
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(config_path, argv, sizeof(config_path));
|
||||
|
@ -544,7 +547,7 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||
args->config_path = config_path;
|
||||
}
|
||||
|
||||
// Current IME
|
||||
/* Current IME. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "IME"));
|
||||
|
||||
|
@ -570,16 +573,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||
RARCH_LOG("USED: [%s].\n", used ? "true" : "false");
|
||||
}
|
||||
|
||||
// LIBRETRO
|
||||
/* LIBRETRO. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "LIBRETRO"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
const char *argv = NULL;
|
||||
static char core_path[PATH_MAX_LENGTH];
|
||||
*core_path = '\0';
|
||||
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
*core_path = '\0';
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
if (argv && *argv)
|
||||
strlcpy(core_path, argv, sizeof(core_path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
@ -589,16 +593,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||
args->libretro_path = core_path;
|
||||
}
|
||||
|
||||
// Content
|
||||
/* Content. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "ROM"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
const char *argv = NULL;
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
*path = '\0';
|
||||
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
*path = '\0';
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(path, argv, sizeof(path));
|
||||
|
@ -612,16 +617,17 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||
}
|
||||
}
|
||||
|
||||
// Content
|
||||
/* Content. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "DATADIR"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
const char *argv = NULL;
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
*path = '\0';
|
||||
|
||||
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
*path = '\0';
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(path, argv, sizeof(path));
|
||||
|
@ -745,6 +751,7 @@ static void frontend_android_init(void *data)
|
|||
|
||||
static void frontend_android_deinit(void *data)
|
||||
{
|
||||
JNIEnv *env;
|
||||
struct android_app *android_app = (struct android_app*)data;
|
||||
|
||||
if (!android_app)
|
||||
|
@ -753,7 +760,8 @@ static void frontend_android_deinit(void *data)
|
|||
RARCH_LOG("Deinitializing RetroArch ...\n");
|
||||
android_app->activityState = APP_CMD_DEAD;
|
||||
|
||||
JNIEnv *env = jni_thread_getenv();
|
||||
env = jni_thread_getenv();
|
||||
|
||||
if (env && android_app->onRetroArchExit)
|
||||
CALL_VOID_METHOD(env, android_app->activity->clazz,
|
||||
android_app->onRetroArchExit);
|
|
@ -19,7 +19,9 @@
|
|||
|
||||
#include "../frontend.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../menu/disp/ios.h"
|
||||
#ifdef IOS
|
||||
#include "../../menu/drivers_display/ios.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
|
@ -34,7 +36,7 @@ static CFRunLoopObserverRef iterate_observer = NULL;
|
|||
|
||||
static void do_iteration(void)
|
||||
{
|
||||
int ret = main_entry_decide(0, NULL, NULL);
|
||||
int ret = rarch_main_iterate();
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
|
@ -106,24 +108,24 @@ static void do_iteration(void)
|
|||
|
||||
void apple_start_iteration(void)
|
||||
{
|
||||
if (iterate_observer == NULL)
|
||||
{
|
||||
iterate_observer =
|
||||
if (iterate_observer)
|
||||
return;
|
||||
|
||||
iterate_observer =
|
||||
CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting,
|
||||
true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
|
||||
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer,
|
||||
kCFRunLoopCommonModes);
|
||||
}
|
||||
true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
|
||||
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer,
|
||||
kCFRunLoopCommonModes);
|
||||
}
|
||||
|
||||
void apple_stop_iteration(void)
|
||||
{
|
||||
if (iterate_observer != NULL)
|
||||
{
|
||||
CFRunLoopObserverInvalidate(iterate_observer);
|
||||
CFRelease(iterate_observer);
|
||||
iterate_observer = NULL;
|
||||
}
|
||||
if (!iterate_observer)
|
||||
return;
|
||||
|
||||
CFRunLoopObserverInvalidate(iterate_observer);
|
||||
CFRelease(iterate_observer);
|
||||
iterate_observer = NULL;
|
||||
}
|
||||
|
||||
static void frontend_apple_get_environment_settings(int *argc, char *argv[],
|
|
@ -23,13 +23,11 @@
|
|||
|
||||
static void emscripten_mainloop(void)
|
||||
{
|
||||
int ret = main_entry_decide(0, NULL, NULL);
|
||||
if (rarch_main_iterate() != -1)
|
||||
return;
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
main_exit(NULL);
|
||||
exit(0);
|
||||
}
|
||||
main_exit(NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
|
@ -19,7 +19,7 @@
|
|||
#include "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../../libretro_private.h"
|
||||
#include "../../gfx/gx/sdk_defines.h"
|
||||
#include "../../gfx/drivers/gx_sdk_defines.h"
|
||||
|
||||
#include <file/file_path.h>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../frontend_context.h"
|
||||
#include "../frontend_driver.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
|
@ -25,7 +25,7 @@
|
|||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../gfx/psp/sdk_defines.h"
|
||||
#include "../../gfx/drivers/psp_sdk_defines.h"
|
||||
#include <file/file_path.h>
|
||||
#include "../../general.h"
|
||||
|
||||
|
@ -85,11 +85,14 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
|||
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir,
|
||||
"retroarch.cfg", sizeof(g_defaults.config_path));
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
if (argv[1] && (argv[1][0] != '\0'))
|
||||
{
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
struct rarch_main_wrap *args = NULL;
|
||||
|
||||
*path = '\0';
|
||||
struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data;
|
||||
args = (struct rarch_main_wrap*)params_data;
|
||||
|
||||
if (args)
|
||||
{
|
||||
|
@ -111,6 +114,7 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
|||
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_psp_deinit(void *data)
|
|
@ -21,7 +21,7 @@
|
|||
#include <fat.h>
|
||||
#include <gctypes.h>
|
||||
#include <ogc/cache.h>
|
||||
#include "../../gfx/gx/ppc_asm.h"
|
||||
#include "../../gfx/drivers/ppc_asm.h"
|
||||
#include <file/file_path.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <ogc/system.h>
|
|
@ -50,33 +50,6 @@
|
|||
|
||||
#define MAX_ARGS 32
|
||||
|
||||
/**
|
||||
* main_entry_decide:
|
||||
*
|
||||
* Runs RetroArch for one frame.
|
||||
*
|
||||
* Returns: -1 upon exiting, 0 if we want to
|
||||
* iterate to the next frame.
|
||||
**/
|
||||
int main_entry_decide(signature(), args_type() args)
|
||||
{
|
||||
int ret = rarch_main_iterate();
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
if (g_extern.core_shutdown_initiated
|
||||
&& g_settings.load_dummy_on_core_shutdown)
|
||||
{
|
||||
/* Load dummy core instead of exiting RetroArch completely. */
|
||||
rarch_main_command(RARCH_CMD_PREPARE_DUMMY);
|
||||
g_extern.core_shutdown_initiated = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* main_exit_save_config:
|
||||
*
|
||||
|
@ -322,7 +295,7 @@ returntype main_entry(signature())
|
|||
}
|
||||
|
||||
#if defined(HAVE_MAIN_LOOP)
|
||||
while (main_entry_decide(signature_expand(), args) != -1);
|
||||
while (rarch_main_iterate() != -1);
|
||||
|
||||
main_exit(args);
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,25 @@
|
|||
#include <stddef.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include "drivers/platform_android.h"
|
||||
#define main_entry android_app_entry
|
||||
#define args_type() struct android_app*
|
||||
#define signature() void* data
|
||||
#define signature_expand() data
|
||||
#define returntype void
|
||||
#else
|
||||
#if defined(__APPLE__) || defined(HAVE_BB10) || defined(EMSCRIPTEN)
|
||||
#define main_entry rarch_main
|
||||
#else
|
||||
#define main_entry main
|
||||
#endif
|
||||
#define args_type() void*
|
||||
#define signature() int argc, char *argv[]
|
||||
#define signature_expand() argc, argv
|
||||
#define returntype int
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -75,16 +94,6 @@ bool main_load_content(int argc, char **argv,
|
|||
args_type() args, environment_get_t environ_get,
|
||||
process_args_t process_args);
|
||||
|
||||
/**
|
||||
* main_entry_decide:
|
||||
*
|
||||
* Runs RetroArch for one frame.
|
||||
*
|
||||
* Returns: -1 upon exiting, 0 if we want to
|
||||
* iterate to the next frame.
|
||||
**/
|
||||
int main_entry_decide(signature(), args_type() args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "frontend_context.h"
|
||||
#include "frontend_driver.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -58,6 +58,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
|||
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; frontend_ctx_drivers[i]; i++)
|
||||
{
|
||||
if (strcmp(frontend_ctx_drivers[i]->ident, ident) == 0)
|
||||
|
@ -77,6 +78,7 @@ const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident)
|
|||
const frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; frontend_ctx_drivers[i]; i++)
|
||||
return frontend_ctx_drivers[i];
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FRONTEND_CONTEXT_H
|
||||
#define __FRONTEND_CONTEXT_H
|
||||
#ifndef __FRONTEND_DRIVER_H
|
||||
#define __FRONTEND_DRIVER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <boolean.h>
|
||||
|
@ -24,25 +24,6 @@
|
|||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include "platform/platform_android.h"
|
||||
#define main_entry android_app_entry
|
||||
#define args_type() struct android_app*
|
||||
#define signature() void* data
|
||||
#define signature_expand() data
|
||||
#define returntype void
|
||||
#else
|
||||
#if defined(__APPLE__) || defined(HAVE_BB10) || defined(EMSCRIPTEN)
|
||||
#define main_entry rarch_main
|
||||
#else
|
||||
#define main_entry main
|
||||
#endif
|
||||
#define args_type() void*
|
||||
#define signature() int argc, char *argv[]
|
||||
#define signature_expand() argc, argv
|
||||
#define returntype int
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
|
@ -24,7 +24,7 @@
|
|||
#include "../file_ext.h"
|
||||
#include <file/file_path.h>
|
||||
#include <file/dir_list.h>
|
||||
#include "frontend_context.h"
|
||||
#include "frontend_driver.h"
|
||||
|
||||
struct defaults g_defaults;
|
||||
|
||||
|
|
106
general.h
106
general.h
|
@ -22,12 +22,12 @@
|
|||
#include <limits.h>
|
||||
#include <setjmp.h>
|
||||
#include "driver.h"
|
||||
#include "message_queue.h"
|
||||
#include <queues/message_queue.h>
|
||||
#include "rewind.h"
|
||||
#include "movie.h"
|
||||
#include "autosave.h"
|
||||
#include "cheats.h"
|
||||
#include "audio/dsp_filter.h"
|
||||
#include "audio/audio_dsp_filter.h"
|
||||
#include <compat/strl.h>
|
||||
#include "core_options.h"
|
||||
#include "core_info.h"
|
||||
|
@ -80,106 +80,9 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MAX_USERS
|
||||
#define MAX_USERS 16
|
||||
|
||||
enum basic_event
|
||||
{
|
||||
RARCH_CMD_NONE = 0,
|
||||
RARCH_CMD_RESET,
|
||||
RARCH_CMD_LOAD_CONTENT,
|
||||
RARCH_CMD_LOAD_CONTENT_PERSIST,
|
||||
RARCH_CMD_LOAD_CORE,
|
||||
RARCH_CMD_LOAD_STATE,
|
||||
RARCH_CMD_SAVE_STATE,
|
||||
RARCH_CMD_TAKE_SCREENSHOT,
|
||||
RARCH_CMD_PREPARE_DUMMY,
|
||||
RARCH_CMD_QUIT,
|
||||
RARCH_CMD_REINIT,
|
||||
RARCH_CMD_REWIND_DEINIT,
|
||||
RARCH_CMD_REWIND_INIT,
|
||||
RARCH_CMD_REWIND_TOGGLE,
|
||||
RARCH_CMD_AUTOSAVE_DEINIT,
|
||||
RARCH_CMD_AUTOSAVE_INIT,
|
||||
RARCH_CMD_AUTOSAVE_STATE,
|
||||
RARCH_CMD_AUDIO_STOP,
|
||||
RARCH_CMD_AUDIO_START,
|
||||
RARCH_CMD_AUDIO_MUTE_TOGGLE,
|
||||
RARCH_CMD_OVERLAY_INIT,
|
||||
RARCH_CMD_OVERLAY_DEINIT,
|
||||
RARCH_CMD_OVERLAY_SET_SCALE_FACTOR,
|
||||
RARCH_CMD_OVERLAY_SET_ALPHA_MOD,
|
||||
RARCH_CMD_OVERLAY_NEXT,
|
||||
RARCH_CMD_DSP_FILTER_INIT,
|
||||
RARCH_CMD_DSP_FILTER_DEINIT,
|
||||
RARCH_CMD_GPU_RECORD_DEINIT,
|
||||
RARCH_CMD_RECORD_INIT,
|
||||
RARCH_CMD_RECORD_DEINIT,
|
||||
RARCH_CMD_HISTORY_DEINIT,
|
||||
RARCH_CMD_HISTORY_INIT,
|
||||
RARCH_CMD_CORE_INFO_DEINIT,
|
||||
RARCH_CMD_CORE_INFO_INIT,
|
||||
RARCH_CMD_CORE_DEINIT,
|
||||
RARCH_CMD_CORE_INIT,
|
||||
RARCH_CMD_AUDIO_SET_BLOCKING_STATE,
|
||||
RARCH_CMD_AUDIO_SET_NONBLOCKING_STATE,
|
||||
RARCH_CMD_VIDEO_APPLY_STATE_CHANGES,
|
||||
RARCH_CMD_VIDEO_SET_BLOCKING_STATE,
|
||||
RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE,
|
||||
RARCH_CMD_VIDEO_SET_ASPECT_RATIO,
|
||||
RARCH_CMD_RESET_CONTEXT,
|
||||
RARCH_CMD_RESTART_RETROARCH,
|
||||
RARCH_CMD_QUIT_RETROARCH,
|
||||
RARCH_CMD_RESUME,
|
||||
RARCH_CMD_PAUSE_TOGGLE,
|
||||
RARCH_CMD_UNPAUSE,
|
||||
RARCH_CMD_PAUSE,
|
||||
RARCH_CMD_PAUSE_CHECKS,
|
||||
RARCH_CMD_MENU_SAVE_CONFIG,
|
||||
RARCH_CMD_MENU_PAUSE_LIBRETRO,
|
||||
RARCH_CMD_MENU_TOGGLE,
|
||||
RARCH_CMD_SHADERS_APPLY_CHANGES,
|
||||
RARCH_CMD_SHADER_DIR_INIT,
|
||||
RARCH_CMD_SHADER_DIR_DEINIT,
|
||||
RARCH_CMD_CONTROLLERS_INIT,
|
||||
RARCH_CMD_SAVEFILES,
|
||||
RARCH_CMD_SAVEFILES_INIT,
|
||||
RARCH_CMD_SAVEFILES_DEINIT,
|
||||
RARCH_CMD_MSG_QUEUE_INIT,
|
||||
RARCH_CMD_MSG_QUEUE_DEINIT,
|
||||
RARCH_CMD_CHEATS_INIT,
|
||||
RARCH_CMD_CHEATS_DEINIT,
|
||||
RARCH_CMD_NETPLAY_INIT,
|
||||
RARCH_CMD_NETPLAY_DEINIT,
|
||||
RARCH_CMD_NETPLAY_FLIP_PLAYERS,
|
||||
RARCH_CMD_BSV_MOVIE_INIT,
|
||||
RARCH_CMD_BSV_MOVIE_DEINIT,
|
||||
RARCH_CMD_COMMAND_INIT,
|
||||
RARCH_CMD_COMMAND_DEINIT,
|
||||
RARCH_CMD_DRIVERS_DEINIT,
|
||||
RARCH_CMD_DRIVERS_INIT,
|
||||
RARCH_CMD_AUDIO_REINIT,
|
||||
RARCH_CMD_RESIZE_WINDOWED_SCALE,
|
||||
RARCH_CMD_TEMPORARY_CONTENT_DEINIT,
|
||||
RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT,
|
||||
RARCH_CMD_LOG_FILE_DEINIT,
|
||||
RARCH_CMD_DISK_EJECT_TOGGLE,
|
||||
RARCH_CMD_DISK_NEXT,
|
||||
RARCH_CMD_DISK_PREV,
|
||||
RARCH_CMD_RUMBLE_STOP,
|
||||
RARCH_CMD_GRAB_MOUSE_TOGGLE,
|
||||
RARCH_CMD_FULLSCREEN_TOGGLE,
|
||||
RARCH_CMD_PERFCNT_REPORT_FRONTEND_LOG,
|
||||
};
|
||||
|
||||
enum action_state
|
||||
{
|
||||
RARCH_ACTION_STATE_NONE = 0,
|
||||
RARCH_ACTION_STATE_LOAD_CONTENT,
|
||||
RARCH_ACTION_STATE_MENU_RUNNING,
|
||||
RARCH_ACTION_STATE_MENU_RUNNING_FINISHED,
|
||||
RARCH_ACTION_STATE_QUIT,
|
||||
RARCH_ACTION_STATE_FORCE_QUIT,
|
||||
};
|
||||
#endif
|
||||
|
||||
enum sound_mode_enums
|
||||
{
|
||||
|
@ -452,6 +355,7 @@ struct settings
|
|||
bool menu_show_start_screen;
|
||||
#endif
|
||||
bool fps_show;
|
||||
bool fps_monitor_enable;
|
||||
bool load_dummy_on_core_shutdown;
|
||||
|
||||
bool core_specific_config;
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - 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 "../../driver.h"
|
||||
#include "../../general.h"
|
||||
#include "../gfx_common.h"
|
||||
#include "../gl_common.h"
|
||||
|
||||
static void gfx_ctx_set_swap_interval(unsigned interval)
|
||||
{
|
||||
(void)interval;
|
||||
}
|
||||
|
||||
static void gfx_ctx_destroy(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void gfx_ctx_get_video_size(void *data, unsigned *width, unsigned *height)
|
||||
{}
|
||||
|
||||
static bool gfx_ctx_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void gfx_ctx_swap_buffers(void *data)
|
||||
{
|
||||
|
||||
/* video_data can have changed here... */
|
||||
video_data = driver.video_data;
|
||||
}
|
||||
|
||||
static void gfx_ctx_check_window(void *data, bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||
{
|
||||
(void)data;
|
||||
(void)frame_count;
|
||||
|
||||
*quit = false;
|
||||
|
||||
unsigned new_width, new_height;
|
||||
gfx_ctx_get_video_size(&new_width, &new_height);
|
||||
if (new_width != *width || new_height != *height)
|
||||
{
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
|
||||
{
|
||||
(void)data;
|
||||
(void)width;
|
||||
(void)height;
|
||||
}
|
||||
|
||||
static void gfx_ctx_update_window_title(void *data)
|
||||
{
|
||||
(void)data;
|
||||
char buf[128], buf_fps[128];
|
||||
gfx_get_fps(buf, sizeof(buf), buf_fps, sizeof(buf_fps));
|
||||
}
|
||||
|
||||
static bool gfx_ctx_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
(void)data;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)fullscreen;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_bind_api(void *data, enum gfx_ctx_api api)
|
||||
{
|
||||
(void)data;
|
||||
(void)api;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool gfx_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
const gfx_ctx_driver_t gfx_ctx_null = {
|
||||
gfx_ctx_init,
|
||||
gfx_ctx_destroy,
|
||||
gfx_ctx_bind_api,
|
||||
gfx_ctx_set_swap_interval,
|
||||
gfx_ctx_set_video_mode,
|
||||
gfx_ctx_get_video_size,
|
||||
NULL,
|
||||
gfx_ctx_update_window_title,
|
||||
gfx_ctx_check_window,
|
||||
gfx_ctx_set_resize,
|
||||
gfx_ctx_has_focus,
|
||||
gfx_ctx_swap_buffers,
|
||||
gfx_ctx_input_driver,
|
||||
NULL,
|
||||
NULL,
|
||||
"null",
|
||||
};
|
|
@ -26,7 +26,7 @@
|
|||
#endif
|
||||
#include "../gfx_common.h"
|
||||
|
||||
#include "../context/win32_common.h"
|
||||
#include "../drivers_context/win32_common.h"
|
||||
|
||||
#ifndef _XBOX
|
||||
#define HAVE_MONITOR
|
||||
|
@ -42,14 +42,14 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
#include "../../gfx/shader/shader_hlsl.h"
|
||||
#include "../drivers_shader/shader_hlsl.h"
|
||||
#endif
|
||||
|
||||
#include "d3d_defines.h"
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
#include "../shader/shader_hlsl.h"
|
||||
#include "../drivers_shader/shader_hlsl.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,11 +46,11 @@
|
|||
#include "../../driver.h"
|
||||
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||
#include "../shader/shader_context.h"
|
||||
#include "../video_shader_driver.h"
|
||||
#endif
|
||||
|
||||
#include "../fonts/d3d_font.h"
|
||||
#include "../gfx_context.h"
|
||||
#include "../font_d3d_driver.h"
|
||||
#include "../video_context_driver.h"
|
||||
#include "../gfx_common.h"
|
||||
|
||||
#ifdef HAVE_CG
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _D3D_WRAPPER_H
|
||||
#define _D3D_WRAPPER_H
|
||||
|
||||
#include "../context/win32_common.h"
|
||||
#include "../drivers_context/win32_common.h"
|
||||
#include "d3d_defines.h"
|
||||
|
||||
void d3d_swap(void *data, LPDIRECT3DDEVICE dev);
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
#define __D3D_RENDER_CHAIN_H
|
||||
|
||||
#include "d3d.h"
|
||||
#include "../state_tracker.h"
|
||||
#include "../shader/shader_parse.h"
|
||||
#include "../video_state_tracker.h"
|
||||
#include "../video_shader_parse.h"
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
|
|
|
@ -221,7 +221,7 @@ void renderchain_bind_tracker(void *data, Pass *pass, unsigned pass_index)
|
|||
return;
|
||||
|
||||
if (pass_index == 1)
|
||||
chain->uniform_cnt = state_get_uniform(chain->tracker,
|
||||
chain->uniform_cnt = state_tracker_get_uniform(chain->tracker,
|
||||
chain->uniform_info, MAX_VARIABLES, chain->frame_count);
|
||||
|
||||
for (unsigned i = 0; i < chain->uniform_cnt; i++)
|
||||
|
|
|
@ -30,10 +30,10 @@
|
|||
|
||||
#include <exynos/exynos_fimg2d.h>
|
||||
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
#include "gfx_common.h"
|
||||
#include "fonts/fonts.h"
|
||||
#include "../../general.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../gfx_common.h"
|
||||
#include "../font_renderer_driver.h"
|
||||
|
||||
/* TODO: Honor these properties: vsync, menu rotation, menu alpha, aspect ratio change */
|
||||
|
|
@ -19,37 +19,37 @@
|
|||
#pragma comment(lib, "opengl32")
|
||||
#endif
|
||||
|
||||
#include "../driver.h"
|
||||
#include "../performance.h"
|
||||
#include "../../driver.h"
|
||||
#include "../../performance.h"
|
||||
#include <gfx/scaler/scaler.h>
|
||||
#include "image/image.h"
|
||||
#include "../image/image.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../libretro.h"
|
||||
#include "../../libretro.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../general.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../../general.h"
|
||||
#include "../../retroarch.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gl_common.h"
|
||||
#include "gfx_common.h"
|
||||
#include "gfx_context.h"
|
||||
#include "../gl_common.h"
|
||||
#include "../gfx_common.h"
|
||||
#include "../video_context_driver.h"
|
||||
#include <compat/strl.h>
|
||||
|
||||
#ifdef HAVE_GLSL
|
||||
#include "shader/shader_glsl.h"
|
||||
#include "../drivers_shader/shader_glsl.h"
|
||||
#endif
|
||||
|
||||
#ifdef GL_DEBUG
|
||||
#include <string/string_list.h>
|
||||
#endif
|
||||
|
||||
#include "shader/shader_context.h"
|
||||
#include "../video_shader_driver.h"
|
||||
|
||||
/* Used for the last pass when rendering to the back buffer. */
|
||||
static const GLfloat vertexes_flipped[] = {
|
||||
|
@ -847,8 +847,8 @@ void gl_set_viewport(gl_t *gl, unsigned width,
|
|||
}
|
||||
else
|
||||
{
|
||||
gl->vp.x = gl->vp.y = 0;
|
||||
gl->vp.width = width;
|
||||
gl->vp.x = gl->vp.y = 0;
|
||||
gl->vp.width = width;
|
||||
gl->vp.height = height;
|
||||
}
|
||||
|
||||
|
@ -1249,12 +1249,12 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
|
|||
gl->tex_w * gl->base_size,
|
||||
gl->tex_w * gl->tex_h * i * gl->base_size);
|
||||
#else
|
||||
if (!gl->egl_images)
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, internal_fmt, gl->tex_w, gl->tex_h, 0, texture_type,
|
||||
texture_fmt, gl->empty_buf ? gl->empty_buf : NULL);
|
||||
}
|
||||
if (gl->egl_images)
|
||||
continue;
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, internal_fmt, gl->tex_w, gl->tex_h, 0, texture_type,
|
||||
texture_fmt, gl->empty_buf ? gl->empty_buf : NULL);
|
||||
#endif
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
|
@ -1914,8 +1914,10 @@ static bool resolve_extensions(gl_t *gl)
|
|||
const char *ext = (const char*)glGetString(GL_EXTENSIONS);
|
||||
if (ext)
|
||||
{
|
||||
size_t i;
|
||||
struct string_list *list = string_split(ext, " ");
|
||||
for (size_t i = 0; i < list->size; i++)
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
RARCH_LOG("\t%s\n", list->elems[i].data);
|
||||
string_list_free(list);
|
||||
}
|
||||
|
@ -2368,6 +2370,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||
|
||||
#if !defined(HAVE_PSGL)
|
||||
gl->conv_buffer = calloc(sizeof(uint32_t), gl->tex_w * gl->tex_h);
|
||||
|
||||
if (!gl->conv_buffer)
|
||||
{
|
||||
gl->ctx_driver->destroy(gl);
|
||||
|
@ -2489,14 +2492,14 @@ static void gl_update_tex_filter_frame(gl_t *gl)
|
|||
gl->wrap_mode = wrap_mode;
|
||||
for (i = 0; i < gl->textures; i++)
|
||||
{
|
||||
if (gl->texture[i])
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[i]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl->wrap_mode);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl->wrap_mode);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl->tex_mag_filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl->tex_min_filter);
|
||||
}
|
||||
if (!gl->texture[i])
|
||||
continue;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[i]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl->wrap_mode);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl->wrap_mode);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl->tex_mag_filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl->tex_min_filter);
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
|
@ -2679,7 +2682,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
|||
return false;
|
||||
}
|
||||
#else
|
||||
ptr = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
ptr = (const uint8_t*)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
if (!ptr)
|
||||
{
|
||||
RARCH_ERR("[GL]: Failed to map pixel unpack buffer.\n");
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue