├── libretro-common ├── .gitignore ├── audio │ ├── dsp_filters │ │ ├── link.T │ │ ├── Tremolo.dsp │ │ ├── Vibrato.dsp │ │ ├── HighShelfDampen.dsp │ │ ├── Crystalizer.dsp │ │ ├── Reverb.dsp │ │ ├── WahWah.dsp │ │ ├── Phaser.dsp │ │ ├── BassBoost.dsp │ │ ├── EchoReverb.dsp │ │ ├── Mono.dsp │ │ ├── Chorus.dsp │ │ ├── IIR.dsp │ │ ├── Panning.dsp │ │ ├── ChipTuneEnhance.dsp │ │ ├── Echo.dsp │ │ ├── EQ.dsp │ │ ├── LowPassCPS.dsp │ │ ├── fft │ │ │ └── fft.h │ │ └── Makefile │ ├── resampler │ │ └── drivers │ │ │ ├── null_resampler.c │ │ │ └── sinc_resampler_neon.S │ └── conversion │ │ ├── float_to_s16_neon.S │ │ ├── s16_to_float_neon.S │ │ └── float_to_s16_neon.c ├── samples │ ├── net │ │ ├── http_test │ │ ├── net_ifinfo │ │ ├── udp-test.c │ │ ├── Makefile │ │ ├── net_ifinfo_test.c │ │ └── net_http_test.c │ ├── file │ │ └── nbio │ │ │ ├── Makefile │ │ │ └── nbio_test.c │ ├── formats │ │ └── png │ │ │ └── Makefile │ └── utils │ │ └── Makefile ├── crt │ ├── include │ │ └── string.h │ └── string.c ├── glsym │ ├── README.md │ └── rglgen.c ├── include │ ├── libchdr │ │ ├── coretypes.h │ │ ├── minmax.h │ │ ├── bitstream.h │ │ ├── flac.h │ │ └── cdrom.h │ ├── compat │ │ ├── fnmatch.h │ │ ├── fopen_utf8.h │ │ ├── ifaddrs.h │ │ ├── strcasestr.h │ │ ├── strl.h │ │ ├── posix_string.h │ │ ├── apple_compat.h │ │ └── intrinsics.h │ ├── utils │ │ └── md5.h │ ├── encodings │ │ ├── crc32.h │ │ ├── utf.h │ │ └── win32.h │ ├── gfx │ │ ├── scaler │ │ │ ├── filter.h │ │ │ └── scaler_int.h │ │ ├── math │ │ │ ├── vector_4.h │ │ │ └── vector_3.h │ │ └── gl_capabilities.h │ ├── glsym │ │ ├── glsym.h │ │ ├── rglgen.h │ │ └── rglgen_headers.h │ ├── retro_assert.h │ ├── memalign.h │ ├── streams │ │ ├── stdin_stream.h │ │ ├── memory_stream.h │ │ └── chd_stream.h │ ├── rthreads │ │ ├── async_job.h │ │ └── rsemaphore.h │ ├── retro_inline.h │ ├── boolean.h │ ├── retro_common.h │ ├── formats │ │ ├── rtga.h │ │ ├── rjpeg.h │ │ ├── rbmp.h │ │ ├── rpng.h │ │ └── jsonsax.h │ ├── net │ │ ├── net_ifinfo.h │ │ ├── net_socket_ssl.h │ │ └── net_http_parse.h │ ├── audio │ │ ├── dsp_filter.h │ │ └── conversion │ │ │ ├── float_to_s16.h │ │ │ └── s16_to_float.h │ ├── math │ │ ├── fxp.h │ │ ├── float_minmax.h │ │ └── complex.h │ ├── memmap.h │ ├── libretro_d3d.h │ ├── dynamic │ │ └── dylib.h │ ├── clamping.h │ ├── features │ │ └── features_cpu.h │ ├── libco.h │ ├── file │ │ └── config_file_userdata.h │ ├── retro_dirent.h │ ├── queues │ │ └── fifo_queue.h │ └── retro_math.h ├── formats │ ├── xml │ │ └── test │ │ │ ├── Makefile │ │ │ └── rxml_test.c │ └── png │ │ └── rpng_internal.h ├── utils │ ├── djb2.c │ └── crc32.c ├── libco │ ├── libco.c │ ├── fiber.c │ ├── ucontext.c │ ├── scefiber.c │ └── armeabi.c ├── compat │ ├── compat_vscprintf.c │ ├── compat_strcasestr.c │ ├── compat_strl.c │ ├── fopen_utf8.c │ └── compat_snprintf.c ├── rthreads │ └── xenon_sdl_threads.c ├── memmap │ └── memalign.c └── file │ └── nbio │ └── nbio_intf.c ├── .gitignore ├── link.T ├── version.h ├── .editorconfig └── README.md /libretro-common/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.dll 4 | tags 5 | -------------------------------------------------------------------------------- /link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBRETRO_MPV_VERSION 2 | #define LIBRETRO_MPV_VERSION "0.2.alpha" 3 | #endif 4 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: dspfilter_get_implementation; 3 | local: *; 4 | }; 5 | -------------------------------------------------------------------------------- /libretro-common/samples/net/http_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-mpv/HEAD/libretro-common/samples/net/http_test -------------------------------------------------------------------------------- /libretro-common/samples/net/net_ifinfo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-mpv/HEAD/libretro-common/samples/net/net_ifinfo -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Tremolo.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = tremolo 3 | 4 | # Defaults. 5 | #tremolo_frequency = 4.0 6 | #tremolo_depth = 0.9 7 | 8 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Vibrato.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = vibrato 3 | 4 | # Defaults. 5 | #vibrato_frequency = 5.0 6 | #vibrato_depth = 0.5 7 | 8 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/HighShelfDampen.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = iir 3 | 4 | iir_gain = -12.0 5 | iir_type = HSH 6 | iir_frequency = 8000.0 7 | 8 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Crystalizer.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = crystalizer 3 | # Controls dry/wet-ness of effect. 0.0 = none, 10.0 = max. 4 | crystalizer_intensity = 5.0 5 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Reverb.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = reverb 3 | 4 | # Defaults. 5 | # reverb_drytime = 0.43 6 | # reverb_wettime = 0.4 7 | # reverb_damping = 0.8 8 | # reverb_roomwidth = 0.56 9 | # reverb_roomsize = 0.56 10 | 11 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/WahWah.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = wahwah 3 | 4 | # Defaults. 5 | # wahwah_lfo_freq = 1.5 6 | # wahwah_lfo_start_phase = 0.0 7 | # wahwah_freq_offset = 0.3 8 | # wahwah_depth = 0.7 9 | # wahwah_resonance = 2.5 10 | 11 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Phaser.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = phaser 3 | 4 | # Defaults. 5 | # phaser_lfo_freq = 0.4 6 | # phaser_lfo_start_phase = 0.0 7 | # phaser_feedback = 0.0 8 | # phaser_depth = 0.4 9 | # phaser_dry_wet = 0.5 10 | # phaser_stages = 2 11 | 12 | -------------------------------------------------------------------------------- /libretro-common/crt/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBRETRO_SDK_CRT_STRING_H_ 2 | #define __LIBRETRO_SDK_CRT_STRING_H_ 3 | 4 | #include 5 | 6 | void *memcpy(void *dst, const void *src, size_t len); 7 | 8 | void *memset(void *b, int c, size_t len); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/BassBoost.dsp: -------------------------------------------------------------------------------- 1 | filters = 2 2 | filter0 = iir 3 | filter1 = panning 4 | 5 | iir_gain = 10.0 6 | iir_type = BBOOST 7 | iir_frequency = 200.0 8 | 9 | # Avoids clipping. 10 | panning_left_mix = "0.3 0.0" 11 | panning_right_mix = "0.0 0.3" 12 | 13 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/EchoReverb.dsp: -------------------------------------------------------------------------------- 1 | filters = 2 2 | filter0 = echo 3 | filter1 = reverb 4 | 5 | echo_delay = "200" 6 | echo_feedback = "0.6" 7 | echo_amp = "0.25" 8 | 9 | reverb_roomwidth = 0.75 10 | reverb_roomsize = 0.75 11 | reverb_damping = 1.0 12 | reverb_wettime = 0.3 13 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Mono.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = panning 3 | 4 | # Gains are linear. 5 | 6 | # Stereo Mono: 7 | panning_left_mix = "0.5 0.5" 8 | panning_right_mix = "0.5 0.5" 9 | 10 | # Mono on one speaker: 11 | # panning_left_mix = "0.5 0.5" 12 | # panning_right_mix = "0.0 0.0" 13 | -------------------------------------------------------------------------------- /libretro-common/glsym/README.md: -------------------------------------------------------------------------------- 1 | # Autogenerate GL extension loaders 2 | 3 | ## OpenGL desktop 4 | 5 | Use Khronos' recent [header](www.opengl.org/registry/api/glext.h). 6 | 7 | ./glgen.py /usr/include/GL/glext.h glsym_gl.h glsym_gl.c 8 | 9 | ## OpenGL ES 10 | 11 | ./glgen.py /usr/include/GLES2/gl2ext.h glsym_es2.h glsym_es2.c 12 | 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # Set tab indentation 12 | [*.{c,h}] 13 | indent_style = tab 14 | indent_size = 4 15 | max_line_length = 80 16 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Chorus.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = chorus 3 | 4 | # Controls the base delay of the chorus (milliseconds). 5 | # chorus_delay_ms = 25.0 6 | # 7 | # Controls the depth of the delay. The delay will vary between delay_ms +/- depth_ms. 8 | # chorus_depth_ms = 1.0 9 | # 10 | # Frequency of LFO which controls delay. 11 | # chorus_lfo_freq = 0.5 12 | # 13 | # Controls dry/wet-ness of effect. 1.0 = full chorus, 0.0 = no chorus. 14 | # chorus_drywet = 0.8 15 | -------------------------------------------------------------------------------- /libretro-common/include/libchdr/coretypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __CORETYPES_H__ 2 | #define __CORETYPES_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | typedef uint64_t UINT64; 9 | #ifndef OSD_CPU_H 10 | typedef uint32_t UINT32; 11 | typedef uint16_t UINT16; 12 | typedef uint8_t UINT8; 13 | #endif 14 | 15 | typedef int64_t INT64; 16 | #ifndef OSD_CPU_H 17 | typedef int32_t INT32; 18 | typedef int16_t INT16; 19 | typedef int8_t INT8; 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/IIR.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = iir 3 | 4 | # Defaults. 5 | #iir_frequency = 1024.0 6 | #iir_quality = 0.707 7 | #iir_gain = 0.0 8 | #iir_type = LPF 9 | 10 | # Filter types: 11 | # LPF: Low-pass 12 | # HPF: High-pass 13 | # BPCSGF: Band-pass #1 14 | # BPZPGF: Band-pass #2 15 | # APF: Allpass 16 | # NOTCH: Notch filter 17 | # RIAA_phono: RIAA record/tape deemphasis 18 | # PEQ: peaking band EQ 19 | # BBOOST: Bassboost 20 | # LSH: Low-shelf 21 | # HSH: High-shelf 22 | # RIAA_CD: CD de-emphasis 23 | 24 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Panning.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = panning 3 | 4 | # Gains are linear. 5 | 6 | # The default. Left and right channels map to each other. 7 | panning_left_mix = "1.0 0.0" 8 | panning_right_mix = "0.0 1.0" 9 | 10 | # Some examples: 11 | # 12 | # Mono: 13 | # panning_left_mix = "0.5 0.5" 14 | # panning_right_mix = "0.5 0.5" 15 | 16 | # Swap left and right channels: 17 | # panning_left_mix = "0.0 1.0" 18 | # panning_right_mix = "1.0 0.0" 19 | # 20 | # Mono on one speaker: 21 | # panning_left_mix = "0.5 0.5" 22 | # panning_right_mix = "0.0 0.0" 23 | 24 | -------------------------------------------------------------------------------- /libretro-common/formats/xml/test/Makefile: -------------------------------------------------------------------------------- 1 | TARGET := rxml 2 | 3 | LIBRETRO_XML_DIR := .. 4 | LIBRETRO_COMM_DIR := ../../.. 5 | 6 | SOURCES := \ 7 | rxml_test.c \ 8 | $(LIBRETRO_XML_DIR)/rxml.c \ 9 | $(LIBRETRO_COMM_DIR)/streams/file_stream.c 10 | 11 | OBJS := $(SOURCES:.c=.o) 12 | 13 | CFLAGS += -DRXML_TEST -Wall -pedantic -std=gnu99 -g -I$(LIBRETRO_COMM_DIR)/include 14 | 15 | all: $(TARGET) 16 | 17 | %.o: %.c 18 | $(CC) -c -o $@ $< $(CFLAGS) 19 | 20 | $(TARGET): $(OBJS) 21 | $(CC) -o $@ $^ $(LDFLAGS) 22 | 23 | clean: 24 | rm -f $(TARGET) $(OBJS) 25 | 26 | .PHONY: clean 27 | 28 | -------------------------------------------------------------------------------- /libretro-common/utils/djb2.c: -------------------------------------------------------------------------------- 1 | /* public domain */ 2 | /* gcc -O3 -o djb2 djb2.c */ 3 | 4 | #include 5 | #include 6 | 7 | static uint32_t djb2(const char* str) 8 | { 9 | const unsigned char* aux = (const unsigned char*)str; 10 | uint32_t hash = 5381; 11 | 12 | while (*aux) 13 | hash = (hash << 5) + hash + *aux++; 14 | 15 | return hash; 16 | } 17 | 18 | int main(int argc, const char* argv[]) 19 | { 20 | int i; 21 | 22 | for (i = 1; i < argc; i++) 23 | printf( "0x%08xU: %s\n", djb2( argv[ i ] ), argv[ i ] ); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /libretro-common/include/libchdr/minmax.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause 2 | * copyright-holders:Aaron Giles 3 | *************************************************************************** 4 | 5 | minmax.h 6 | 7 | ***************************************************************************/ 8 | 9 | #pragma once 10 | 11 | #ifndef __MINMAX_H__ 12 | #define __MINMAX_H__ 13 | 14 | #if defined(RARCH_INTERNAL) || defined(__LIBRETRO__) 15 | #include 16 | #else 17 | #define MAX(x, y) (((x) > (y)) ? (x) : (y)) 18 | #define MIN(x, y) ((x) < (y) ? (x) : (y)) 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/ChipTuneEnhance.dsp: -------------------------------------------------------------------------------- 1 | filters = 4 2 | filter0 = eq 3 | filter1 = reverb 4 | filter2 = iir 5 | filter3 = panning 6 | 7 | eq_frequencies = "32 64 125 250 500 1000 2000 4000 8000 16000 20000" 8 | eq_gains = "6 9 12 7 6 5 7 9 11 6 0" 9 | 10 | # Reverb - slight reverb 11 | reverb_drytime = 0.5 12 | reverb_wettime = 0.15 13 | reverb_damping = 0.8 14 | reverb_roomwidth = 0.25 15 | reverb_roomsize = 0.25 16 | 17 | # IIR - filters out some harsh sounds on the upper end 18 | iir_type = RIAA_CD 19 | 20 | # Panning - cut the volume a bit 21 | panning_left_mix = "0.75 0.0" 22 | panning_right_mix = "0.0 0.75" 23 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/Echo.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = echo 3 | 4 | # Somewhat fancy Echo filter. Can take any number of echo channels with varying delays (ms) and feedback factors. 5 | # Echo output from all channels can be fed back into each other to create a somewhat reverb-like effect if desired. 6 | 7 | # Defaults, 200 ms delay echo with feedback: 8 | # Delay in ms. Takes an array with multiple channels. 9 | # echo_delay = "200" 10 | # Feedback factor for echo. 11 | # echo_feedback = "0.5" 12 | # Overall echo amplification. If too high, the echo becomes unstable due to feedback. 13 | # echo_amp = "0.2" 14 | 15 | # Reverby preset. 16 | # echo_delay = " 60 80 120 172 200 320 380" 17 | # echo_feedback = "0.5 0.5 0.4 0.3 0.5 0.3 0.2" 18 | 19 | # echo_amp = "0.12" 20 | -------------------------------------------------------------------------------- /libretro-common/crt/string.c: -------------------------------------------------------------------------------- 1 | #ifdef _MSC_VER 2 | #include 3 | #endif 4 | #include 5 | #include 6 | 7 | void *memset(void *dst, int val, size_t count) 8 | { 9 | void *start = dst; 10 | 11 | #if defined(_M_IA64) || defined (_M_AMD64) || defined(_M_ALPHA) || defined (_M_PPC) 12 | extern void RtlFillMemory(void *, size_t count, char); 13 | 14 | RtlFillMemory(dst, count, (char)val); 15 | #else 16 | while (count--) 17 | { 18 | *(char*)dst = (char)val; 19 | dst = (char*)dst + 1; 20 | } 21 | #endif 22 | 23 | return start; 24 | } 25 | 26 | void *memcpy(void *dst, const void *src, size_t len) 27 | { 28 | size_t i; 29 | 30 | for (i = 0; i < len; i++) 31 | ((unsigned char *)dst)[i] = ((unsigned char *)src)[i]; 32 | 33 | return dst; 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libretro-mpv 2 | 3 | mpv media player as a libretro core. A proof of concept release is now available. 4 | 5 | Aims to use features already established in mpv that are not currently available in Retroarch movieplayer. 6 | 7 | I want to be able to use Retroarch as my movie player on my embedded devices (Raspberry Pi) and desktop using hardware acceleration without having to use Kodi or mpv directly. Thus allowing for a more integrated experience, and smaller root filesystem. 8 | 9 | ## Compiling 10 | 11 | Retroarch must be compiled with `--disable-ffmpeg` to stop the integrated movieplayer from playing the input file. 12 | 13 | FFmpeg (preferably master branch) must be compiled with `--enable-shared`. 14 | 15 | mpv must be compiled with `--enable-libmpv-shared`. 16 | 17 | Then run `make` in the mpv-libretro folder. 18 | -------------------------------------------------------------------------------- /libretro-common/samples/file/nbio/Makefile: -------------------------------------------------------------------------------- 1 | TARGET := nbio_test 2 | 3 | LIBRETRO_COMM_DIR := ../../.. 4 | 5 | SOURCES := \ 6 | nbio_test.c \ 7 | $(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \ 8 | $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \ 9 | $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \ 10 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_intf.c \ 11 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_linux.c \ 12 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_unixmmap.c \ 13 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_windowsmmap.c \ 14 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_stdio.c 15 | 16 | OBJS := $(SOURCES:.c=.o) 17 | 18 | CFLAGS += -Wall -pedantic -std=gnu99 -g -I$(LIBRETRO_COMM_DIR)/include 19 | 20 | all: $(TARGET) 21 | 22 | %.o: %.c 23 | $(CC) -c -o $@ $< $(CFLAGS) 24 | 25 | $(TARGET): $(OBJS) 26 | $(CC) -o $@ $^ $(LDFLAGS) 27 | 28 | clean: 29 | rm -f $(TARGET) $(OBJS) 30 | 31 | .PHONY: clean 32 | 33 | -------------------------------------------------------------------------------- /libretro-common/libco/libco.c: -------------------------------------------------------------------------------- 1 | /* 2 | libco 3 | auto-selection module 4 | license: public domain 5 | */ 6 | 7 | #if defined _MSC_VER 8 | #include 9 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 10 | #include "fiber.c" 11 | #elif defined _M_IX86 12 | #include "x86.c" 13 | #elif defined _M_AMD64 14 | #include "amd64.c" 15 | #else 16 | #include "fiber.c" 17 | #endif 18 | #elif defined __GNUC__ 19 | #if defined __i386__ 20 | #include "x86.c" 21 | #elif defined __amd64__ 22 | #include "amd64.c" 23 | #elif defined _ARCH_PPC 24 | #include "ppc.c" 25 | #elif defined(__aarch64__) 26 | #include "aarch64.c" 27 | #elif defined VITA 28 | #include "scefiber.c" 29 | #elif defined(__ARM_EABI__) || defined(__arm__) 30 | #include "armeabi.c" 31 | #else 32 | #include "sjlj.c" 33 | #endif 34 | #else 35 | #error "libco: unsupported processor, compiler or operating system" 36 | #endif 37 | -------------------------------------------------------------------------------- /libretro-common/utils/crc32.c: -------------------------------------------------------------------------------- 1 | /* gcc -O3 -o crc32 crc32.c -lz */ 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | int main(int argc, const char* argv[]) 10 | { 11 | if (argc != 2 ) 12 | { 13 | fprintf( stderr, "Usage: crc32 \n" ); 14 | return 1; 15 | } 16 | 17 | FILE *file = fopen(argv[1], "rb"); 18 | 19 | if (file) 20 | { 21 | uint32_t crc = encoding_crc32(0L, NULL, 0 ); 22 | 23 | for (;;) 24 | { 25 | uint8_t buffer[16384]; 26 | 27 | int numread = fread((void*)buffer, 1, sizeof(buffer), file); 28 | 29 | if (numread > 0) 30 | crc = encoding_crc32( crc, buffer, numread ); 31 | else 32 | break; 33 | } 34 | 35 | fclose(file); 36 | 37 | printf("%08x\n", crc); 38 | return 0; 39 | } 40 | 41 | fprintf(stderr, "Error opening input file: %s\n", strerror(errno)); 42 | return 1; 43 | } 44 | -------------------------------------------------------------------------------- /libretro-common/samples/net/udp-test.c: -------------------------------------------------------------------------------- 1 | /* public domain */ 2 | /* gcc -o udptest udp-test.c */ 3 | 4 | /* 5 | will send "RETROPAD RIGHT" indefinely to player 1 6 | to send to player 2 change port to 55401 and so on 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #define SERVER "127.0.0.1" 16 | #define PORT 55400 17 | 18 | void die(char *s) 19 | { 20 | perror(s); 21 | exit(1); 22 | } 23 | 24 | int main(void) 25 | { 26 | struct sockaddr_in si_other; 27 | int s, i, slen=sizeof(si_other); 28 | 29 | if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) 30 | { 31 | die("socket"); 32 | } 33 | 34 | memset((char *) &si_other, 0, sizeof(si_other)); 35 | si_other.sin_family = AF_INET; 36 | si_other.sin_port = htons(PORT); 37 | 38 | if (inet_aton(SERVER , &si_other.sin_addr) == 0) 39 | { 40 | fprintf(stderr, "inet_aton() failed\n"); 41 | exit(1); 42 | } 43 | while(1) 44 | { 45 | 46 | char message[10]="128"; 47 | //send the message 48 | if (sendto(s, message, strlen(message) , 0 , (struct sockaddr *) &si_other, slen)==-1) 49 | { 50 | die("sendto()"); 51 | } 52 | /* sleep for 1 frame (60hz) */ 53 | usleep(16*1000); 54 | 55 | } 56 | 57 | close(s); 58 | return 0; 59 | } -------------------------------------------------------------------------------- /libretro-common/include/libchdr/bitstream.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause 2 | * copyright-holders:Aaron Giles 3 | *************************************************************************** 4 | 5 | bitstream.h 6 | 7 | Helper classes for reading/writing at the bit level. 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __BITSTREAM_H__ 14 | #define __BITSTREAM_H__ 15 | 16 | #include 17 | 18 | /*************************************************************************** 19 | * TYPE DEFINITIONS 20 | *************************************************************************** 21 | */ 22 | 23 | /* helper class for reading from a bit buffer */ 24 | struct bitstream 25 | { 26 | uint32_t buffer; /* current bit accumulator */ 27 | int bits; /* number of bits in the accumulator */ 28 | const uint8_t * read; /* read pointer */ 29 | uint32_t doffset; /* byte offset within the data */ 30 | uint32_t dlength; /* length of the data */ 31 | }; 32 | 33 | struct bitstream* create_bitstream(const void *src, uint32_t srclength); 34 | int bitstream_overflow(struct bitstream* bitstream); 35 | uint32_t bitstream_read_offset(struct bitstream* bitstream); 36 | 37 | uint32_t bitstream_read(struct bitstream* bitstream, int numbits); 38 | uint32_t bitstream_peek(struct bitstream* bitstream, int numbits); 39 | void bitstream_remove(struct bitstream* bitstream, int numbits); 40 | uint32_t bitstream_flush(struct bitstream* bitstream); 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/EQ.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = eq 3 | 4 | # Defaults 5 | 6 | # Beta factor for Kaiser window. 7 | # Lower values will allow better frequency resolution, but more ripple. 8 | # eq_window_beta = 4.0 9 | 10 | # The block size on which FFT is done. 11 | # Too high value requires more processing as well as longer latency but 12 | # allows finer-grained control over the spectrum. 13 | # eq_block_size_log2 = 8 14 | 15 | # An array of which frequencies to control. 16 | # You can create an arbitrary amount of these sampling points. 17 | # The EQ will try to create a frequency response which fits well to these points. 18 | # The filter response is linearly interpolated between sampling points here. 19 | # 20 | # It is implied that 0 Hz (DC) and Nyquist have predefined gains of 0 dB which are interpolated against. 21 | # If you want a "peak" in the spectrum or similar, you have to define close points to say, 0 dB. 22 | # 23 | # E.g.: A boost of 3 dB at 1 kHz can be expressed as. 24 | # eq_frequencies = "500 1000 2000" 25 | # eq_gains = "0 3 0" 26 | # Due to frequency domain smearing, you will not get exactly +3 dB at 1 kHz. 27 | 28 | # By default, this filter has a flat frequency response. 29 | 30 | # Dumps the impulse response generated by the EQ as a plain-text file 31 | # with one coefficient per line. 32 | # eq_impulse_response_output = "eq_impulse.txt" 33 | # 34 | # Using GNU Octave or Matlab, you can plot the response with: 35 | # 36 | # f = fopen('/path/to/eq_impulse.txt'); 37 | # l = textscan(f, '%f'); 38 | # res = l{1}; 39 | # freqz(res, 1, 4096, 48000); 40 | # 41 | # It will give the response in Hz; 48000 is the default Output Rate of RetroArch 42 | -------------------------------------------------------------------------------- /libretro-common/samples/net/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS = http_test net_ifinfo 2 | 3 | LIBRETRO_COMM_DIR := ../.. 4 | 5 | INCFLAGS = -I$(LIBRETRO_COMM_DIR)/include 6 | 7 | ifeq ($(platform),) 8 | platform = unix 9 | ifeq ($(shell uname -a),) 10 | platform = win 11 | else ifneq ($(findstring Darwin,$(shell uname -a)),) 12 | platform = osx 13 | arch = intel 14 | ifeq ($(shell uname -p),powerpc) 15 | arch = ppc 16 | endif 17 | else ifneq ($(findstring MINGW,$(shell uname -a)),) 18 | platform = win 19 | endif 20 | endif 21 | 22 | ifeq ($(DEBUG),1) 23 | CFLAGS += -O0 -g 24 | else 25 | CFLAGS += -O2 26 | endif 27 | CFLAGS += -Wall -pedantic -std=gnu99 28 | 29 | HTTP_TEST_C = \ 30 | $(LIBRETRO_COMM_DIR)/net/net_http.c \ 31 | $(LIBRETRO_COMM_DIR)/net/net_compat.c \ 32 | $(LIBRETRO_COMM_DIR)/net/net_socket.c \ 33 | $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \ 34 | $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \ 35 | $(LIBRETRO_COMM_DIR)/string/stdstring.c \ 36 | net_http_test.c 37 | 38 | HTTP_TEST_OBJS := $(HTTP_TEST_C:.c=.o) 39 | 40 | NET_IFINFO_C = \ 41 | $(LIBRETRO_COMM_DIR)/net/net_ifinfo.c \ 42 | net_ifinfo_test.c 43 | 44 | ifeq ($(platform), win) 45 | CFLAGS += -liphlpapi -lws2_32 46 | endif 47 | 48 | NET_IFINFO_OBJS := $(NET_IFINFO_C:.c=.o) 49 | 50 | .PHONY: all clean 51 | 52 | all: $(TARGETS) 53 | 54 | %.o: %.c 55 | $(CC) $(INCFLAGS) $< -c $(CFLAGS) -o $@ 56 | 57 | http_test: $(HTTP_TEST_OBJS) 58 | $(CC) $(INCFLAGS) $(HTTP_TEST_OBJS) $(CFLAGS) -o $@ 59 | 60 | net_ifinfo: $(NET_IFINFO_OBJS) 61 | $(CC) $(INCFLAGS) $(NET_IFINFO_OBJS) $(CFLAGS) -o $@ 62 | 63 | clean: 64 | rm -rf $(TARGETS) $(HTTP_TEST_OBJS) $(NET_IFINFO_OBJS) 65 | -------------------------------------------------------------------------------- /libretro-common/include/compat/fnmatch.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fnmatch.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 24 | #define __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 25 | 26 | #define FNM_NOMATCH 1 27 | 28 | int rl_fnmatch(const char *pattern, const char *string, int flags); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libretro-common/libco/fiber.c: -------------------------------------------------------------------------------- 1 | /* 2 | libco.win (2008-01-28) 3 | authors: Nach, byuu 4 | license: public domain 5 | */ 6 | 7 | #define LIBCO_C 8 | #include 9 | #define WINVER 0x0400 10 | #define _WIN32_WINNT 0x0400 11 | #define WIN32_LEAN_AND_MEAN 12 | #include 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | static thread_local cothread_t co_active_ = 0; 19 | 20 | static void __stdcall co_thunk(void *coentry) 21 | { 22 | ((void (*)(void))coentry)(); 23 | } 24 | 25 | cothread_t co_active(void) 26 | { 27 | if(!co_active_) 28 | { 29 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 30 | ConvertThreadToFiberEx(0, FIBER_FLAG_FLOAT_SWITCH); 31 | #else 32 | ConvertThreadToFiber(0); 33 | #endif 34 | co_active_ = GetCurrentFiber(); 35 | } 36 | return co_active_; 37 | } 38 | 39 | cothread_t co_create(unsigned int heapsize, void (*coentry)(void)) 40 | { 41 | if(!co_active_) 42 | { 43 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 44 | ConvertThreadToFiberEx(0, FIBER_FLAG_FLOAT_SWITCH); 45 | #else 46 | ConvertThreadToFiber(0); 47 | #endif 48 | co_active_ = GetCurrentFiber(); 49 | } 50 | 51 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 52 | return (cothread_t)CreateFiberEx(heapsize, heapsize, FIBER_FLAG_FLOAT_SWITCH, co_thunk, (void*)coentry); 53 | #else 54 | return (cothread_t)CreateFiber(heapsize, co_thunk, (void*)coentry); 55 | #endif 56 | } 57 | 58 | void co_delete(cothread_t cothread) 59 | { 60 | DeleteFiber(cothread); 61 | } 62 | 63 | void co_switch(cothread_t cothread) 64 | { 65 | co_active_ = cothread; 66 | SwitchToFiber(cothread); 67 | } 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | -------------------------------------------------------------------------------- /libretro-common/include/utils/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. 3 | * MD5 Message-Digest Algorithm (RFC 1321). 4 | * 5 | * Homepage: 6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 7 | * 8 | * Author: 9 | * Alexander Peslyak, better known as Solar Designer 10 | * 11 | * This software was written by Alexander Peslyak in 2001. No copyright is 12 | * claimed, and the software is hereby placed in the public domain. 13 | * In case this attempt to disclaim copyright and place the software in the 14 | * public domain is deemed null and void, then the software is 15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the 16 | * general public under the following terms: 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted. 20 | * 21 | * There's ABSOLUTELY NO WARRANTY, express or implied. 22 | * 23 | * See md5.c for more information. 24 | */ 25 | 26 | #ifdef HAVE_OPENSSL 27 | #include 28 | #elif !defined(_MD5_H) 29 | #define _MD5_H 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | 36 | /* Any 32-bit or wider unsigned integer data type will do */ 37 | typedef unsigned int MD5_u32plus; 38 | 39 | typedef struct { 40 | MD5_u32plus lo, hi; 41 | MD5_u32plus a, b, c, d; 42 | unsigned char buffer[64]; 43 | MD5_u32plus block[16]; 44 | } MD5_CTX; 45 | 46 | extern void MD5_Init(MD5_CTX *ctx); 47 | extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); 48 | extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); 49 | 50 | RETRO_END_DECLS 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libretro-common/samples/file/nbio/nbio_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | static void nbio_write_test(void) 7 | { 8 | size_t size; 9 | bool looped = false; 10 | void* ptr = NULL; 11 | struct nbio_t* write = nbio_open("test.bin", NBIO_WRITE); 12 | if (!write) 13 | puts("[ERROR]: nbio_open failed (1)"); 14 | 15 | nbio_resize(write, 1024*1024); 16 | 17 | ptr = nbio_get_ptr(write, &size); 18 | if (size != 1024*1024) 19 | puts("[ERROR]: wrong size (1)"); 20 | 21 | memset(ptr, 0x42, 1024*1024); 22 | nbio_begin_write(write); 23 | 24 | while (!nbio_iterate(write)) 25 | looped=true; 26 | 27 | if (!looped) 28 | puts("[SUCCESS]: Write finished immediately."); 29 | 30 | nbio_free(write); 31 | } 32 | 33 | static void nbio_read_test(void) 34 | { 35 | size_t size; 36 | bool looped = false; 37 | struct nbio_t* read = nbio_open("test.bin", NBIO_READ); 38 | void* ptr = nbio_get_ptr(read, &size); 39 | if (!read) 40 | puts("[ERROR]: nbio_open failed (2)"); 41 | 42 | if (size != 1024*1024) 43 | puts("[ERROR]: wrong size (2)"); 44 | if (ptr) 45 | puts("[SUCCESS]: Read pointer is available before iterating."); 46 | 47 | nbio_begin_read(read); 48 | 49 | while (!nbio_iterate(read)) 50 | looped=true; 51 | 52 | if (!looped) 53 | puts("[SUCCESS]: Read finished immediately."); 54 | 55 | ptr = nbio_get_ptr(read, &size); 56 | 57 | if (size != 1024*1024) 58 | puts("[ERROR]: wrong size (3)"); 59 | if (*(char*)ptr != 0x42 || memcmp(ptr, (char*)ptr+1, 1024*1024-1)) 60 | puts("[ERROR]: wrong data"); 61 | 62 | nbio_free(read); 63 | } 64 | 65 | int main(void) 66 | { 67 | nbio_write_test(); 68 | nbio_read_test(); 69 | } 70 | -------------------------------------------------------------------------------- /libretro-common/include/encodings/crc32.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (crc32.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_ENCODINGS_CRC32_H 24 | #define _LIBRETRO_ENCODINGS_CRC32_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | RETRO_BEGIN_DECLS 32 | 33 | uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len); 34 | 35 | RETRO_END_DECLS 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libretro-common/include/gfx/scaler/filter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (filter.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_SCALER_FILTER_H__ 24 | #define __LIBRETRO_SDK_SCALER_FILTER_H__ 25 | 26 | #include 27 | 28 | RETRO_BEGIN_DECLS 29 | 30 | #include 31 | #include 32 | 33 | bool scaler_gen_filter(struct scaler_ctx *ctx); 34 | 35 | RETRO_END_DECLS 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /libretro-common/include/glsym/glsym.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_GLSYM_H__ 24 | #define __LIBRETRO_SDK_GLSYM_H__ 25 | 26 | #include "rglgen.h" 27 | 28 | #ifndef HAVE_PSGL 29 | #if defined(HAVE_OPENGLES2) 30 | #include "glsym_es2.h" 31 | #elif defined(HAVE_OPENGLES3) 32 | #include "glsym_es3.h" 33 | #else 34 | #include "glsym_gl.h" 35 | #endif 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /libretro-common/include/retro_assert.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_assert.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __RETRO_ASSERT_H 24 | #define __RETRO_ASSERT_H 25 | 26 | #include 27 | 28 | #ifdef RARCH_INTERNAL 29 | #define retro_assert(cond) do { \ 30 | if (!(cond)) { printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__); abort(); } \ 31 | } while(0) 32 | #else 33 | #define retro_assert(cond) assert(cond) 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /libretro-common/include/memalign.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memalign.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_MEMALIGN_H 24 | #define _LIBRETRO_MEMALIGN_H 25 | 26 | #include 27 | 28 | #include 29 | 30 | RETRO_BEGIN_DECLS 31 | 32 | void *memalign_alloc(size_t boundary, size_t size); 33 | 34 | void *memalign_alloc_aligned(size_t size); 35 | 36 | void memalign_free(void *ptr); 37 | 38 | RETRO_END_DECLS 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /libretro-common/include/streams/stdin_stream.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (stdin_stream.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef LIBRETRO_SDK_STDIN_STREAM_H__ 24 | #define LIBRETRO_SDK_STDIN_STREAM_H__ 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | size_t read_stdin(char *buf, size_t size); 36 | 37 | RETRO_END_DECLS 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /libretro-common/include/rthreads/async_job.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (async_job.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_ASYNC_JOB_H 24 | #define __LIBRETRO_SDK_ASYNC_JOB_H 25 | 26 | typedef struct async_job async_job_t; 27 | typedef void (*async_task_t)(void *payload); 28 | 29 | async_job_t *async_job_new(void); 30 | 31 | void async_job_free(async_job_t *ajob); 32 | 33 | int async_job_add(async_job_t *ajob, async_task_t task, void *payload); 34 | 35 | #endif /* __LIBRETRO_SDK_ASYNC_JOB_H */ 36 | -------------------------------------------------------------------------------- /libretro-common/include/retro_inline.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_inline.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_INLINE_H 24 | #define __LIBRETRO_SDK_INLINE_H 25 | 26 | #ifndef INLINE 27 | 28 | #if defined(_WIN32) || defined(__INTEL_COMPILER) 29 | #define INLINE __inline 30 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L 31 | #define INLINE inline 32 | #elif defined(__GNUC__) 33 | #define INLINE __inline__ 34 | #else 35 | #define INLINE 36 | #endif 37 | 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /libretro-common/samples/formats/png/Makefile: -------------------------------------------------------------------------------- 1 | TARGET := rpng 2 | 3 | CORE_DIR := . 4 | LIBRETRO_PNG_DIR := ../../../formats/png 5 | LIBRETRO_COMM_DIR := ../../.. 6 | 7 | HAVE_IMLIB2=0 8 | 9 | LDFLAGS += -lz 10 | 11 | ifeq ($(HAVE_IMLIB2),1) 12 | CFLAGS += -DHAVE_IMLIB2 13 | LDFLAGS += -lImlib2 14 | endif 15 | 16 | SOURCES_C := \ 17 | $(CORE_DIR)/rpng_test.c \ 18 | $(LIBRETRO_PNG_DIR)/rpng.c \ 19 | $(LIBRETRO_PNG_DIR)/rpng_encode.c \ 20 | $(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c \ 21 | $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \ 22 | $(LIBRETRO_COMM_DIR)/string/stdstring.c \ 23 | $(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \ 24 | $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \ 25 | $(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \ 26 | $(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \ 27 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_intf.c \ 28 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_stdio.c \ 29 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_linux.c \ 30 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_unixmmap.c \ 31 | $(LIBRETRO_COMM_DIR)/file/nbio/nbio_windowsmmap.c \ 32 | $(LIBRETRO_COMM_DIR)/file/archive_file.c \ 33 | $(LIBRETRO_COMM_DIR)/file/archive_file_zlib.c \ 34 | $(LIBRETRO_COMM_DIR)/file/file_path.c \ 35 | $(LIBRETRO_COMM_DIR)/streams/file_stream.c \ 36 | $(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \ 37 | $(LIBRETRO_COMM_DIR)/streams/trans_stream.c \ 38 | $(LIBRETRO_COMM_DIR)/streams/trans_stream_zlib.c \ 39 | $(LIBRETRO_COMM_DIR)/streams/trans_stream_pipe.c \ 40 | $(LIBRETRO_COMM_DIR)/lists/string_list.c 41 | 42 | OBJS := $(SOURCES_C:.c=.o) 43 | 44 | CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -DHAVE_ZLIB -DRPNG_TEST -I$(LIBRETRO_COMM_DIR)/include 45 | 46 | all: $(TARGET) 47 | 48 | %.o: %.c 49 | $(CC) -c -o $@ $< $(CFLAGS) 50 | 51 | $(TARGET): $(OBJS) 52 | $(CC) -o $@ $^ $(LDFLAGS) 53 | 54 | clean: 55 | rm -f $(TARGET) $(OBJS) 56 | 57 | .PHONY: clean 58 | 59 | -------------------------------------------------------------------------------- /libretro-common/include/boolean.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (boolean.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_BOOLEAN_H 24 | #define __LIBRETRO_SDK_BOOLEAN_H 25 | 26 | #ifndef __cplusplus 27 | 28 | #if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3) 29 | /* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */ 30 | #define bool unsigned char 31 | #define true 1 32 | #define false 0 33 | #else 34 | #include 35 | #endif 36 | 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libretro-common/include/compat/fopen_utf8.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H 24 | #define __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H 25 | 26 | #ifdef _WIN32 27 | /* Defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */ 28 | /* TODO: enable */ 29 | /* #define fopen (use fopen_utf8 instead) */ 30 | void *fopen_utf8(const char * filename, const char * mode); 31 | #else 32 | #define fopen_utf8 fopen 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/LowPassCPS.dsp: -------------------------------------------------------------------------------- 1 | filters = 1 2 | filter0 = eq 3 | 4 | eq_frequencies = "8000 10000 12500 16000 20000" 5 | eq_gains = "0 -30 -30 -30 -30" 6 | 7 | # Low pass filter for the QSound chip from CPS-1/2. 8 | # Some games have aliasing due low quality samples, so you can hear some annoying noisy near 11 kHz 9 | 10 | # Defaults 11 | 12 | # Beta factor for Kaiser window. 13 | # Lower values will allow better frequency resolution, but more ripple. 14 | # eq_window_beta = 4.0 15 | 16 | # The block size on which FFT is done. 17 | # Too high value requires more processing as well as longer latency but 18 | # allows finer-grained control over the spectrum. 19 | # eq_block_size_log2 = 8 20 | 21 | # An array of which frequencies to control. 22 | # You can create an arbitrary amount of these sampling points. 23 | # The EQ will try to create a frequency response which fits well to these points. 24 | # The filter response is linearly interpolated between sampling points here. 25 | # 26 | # It is implied that 0 Hz (DC) and Nyquist have predefined gains of 0 dB which are interpolated against. 27 | # If you want a "peak" in the spectrum or similar, you have to define close points to say, 0 dB. 28 | # 29 | # E.g.: A boost of 3 dB at 1 kHz can be expressed as. 30 | # eq_frequencies = "500 1000 2000" 31 | # eq_gains = "0 3 0" 32 | # Due to frequency domain smearing, you will not get exactly +3 dB at 1 kHz. 33 | 34 | # By default, this filter has a low pass response with cuttof frequency at ~8600 Hz. 35 | 36 | # Dumps the impulse response generated by the EQ as a plain-text file 37 | # with one coefficient per line. 38 | # eq_impulse_response_output = "eq_impulse.txt" 39 | # 40 | # Using GNU Octave or Matlab, you can plot the response with: 41 | # 42 | # f = fopen('/path/to/eq_impulse.txt'); 43 | # l = textscan(f, '%f'); 44 | # res = l{1}; 45 | # freqz(res, 1, 4096, 48000); 46 | # 47 | # It will give the response in Hz; 48000 is the default Output Rate of RetroArch 48 | -------------------------------------------------------------------------------- /libretro-common/samples/net/net_ifinfo_test.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2017 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (net_ifinfo_test.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | int main(int argc, const char *argv[]) 30 | { 31 | unsigned k = 0; 32 | net_ifinfo_t list; 33 | 34 | if (!net_ifinfo_new(&list)) 35 | return -1; 36 | 37 | for (k = 0; k < list.size; k++) 38 | { 39 | printf("%s:%s\n", list.entries[k].name, list.entries[k].host); 40 | } 41 | 42 | net_ifinfo_free(&list); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /libretro-common/glsym/rglgen.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 30 | const struct rglgen_sym_map *map) 31 | { 32 | for (; map->sym; map++) 33 | { 34 | rglgen_func_t func = proc(map->sym); 35 | memcpy(map->ptr, &func, sizeof(func)); 36 | } 37 | } 38 | 39 | void rglgen_resolve_symbols(rglgen_proc_address_t proc) 40 | { 41 | rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /libretro-common/include/retro_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_common.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_COMMON_RETRO_COMMON_H 24 | #define _LIBRETRO_COMMON_RETRO_COMMON_H 25 | 26 | /* 27 | This file is designed to normalize the libretro-common compiling environment. 28 | It is not to be used in public API headers, as they should be designed as leanly as possible. 29 | Nonetheless.. in the meantime, if you do something like use ssize_t, which is not fully portable, 30 | in a public API, you may need this. 31 | */ 32 | 33 | /* conditional compilation is handled inside here */ 34 | #include 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /libretro-common/compat/compat_vscprintf.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2017 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_snprintf.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | /* THIS FILE HAS NOT BEEN VALIDATED ON PLATFORMS BESIDES MSVC */ 24 | #ifdef _MSC_VER 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #if defined(_MSC_VER) && _MSC_VER < 1800 32 | #define va_copy(dst, src) ((dst) = (src)) 33 | #endif 34 | 35 | int c89_vscprintf_retro__(const char *format, va_list pargs) 36 | { 37 | int retval; 38 | va_list argcopy; 39 | va_copy(argcopy, pargs); 40 | retval = vsnprintf(NULL, 0, format, argcopy); 41 | va_end(argcopy); 42 | return retval; 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /libretro-common/include/formats/rtga.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtga.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_FORMAT_RTGA_H__ 24 | #define __LIBRETRO_SDK_FORMAT_RTGA_H__ 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | typedef struct rtga rtga_t; 36 | 37 | int rtga_process_image(rtga_t *rtga, void **buf, 38 | size_t size, unsigned *width, unsigned *height); 39 | 40 | bool rtga_set_buf_ptr(rtga_t *rtga, void *data); 41 | 42 | void rtga_free(rtga_t *rtga); 43 | 44 | rtga_t *rtga_alloc(void); 45 | 46 | RETRO_END_DECLS 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libretro-common/include/formats/rjpeg.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rjpeg.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_FORMAT_RJPEG_H__ 24 | #define __LIBRETRO_SDK_FORMAT_RJPEG_H__ 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | typedef struct rjpeg rjpeg_t; 36 | 37 | int rjpeg_process_image(rjpeg_t *rjpeg, void **buf, 38 | size_t size, unsigned *width, unsigned *height); 39 | 40 | bool rjpeg_set_buf_ptr(rjpeg_t *rjpeg, void *data); 41 | 42 | void rjpeg_free(rjpeg_t *rjpeg); 43 | 44 | rjpeg_t *rjpeg_alloc(void); 45 | 46 | RETRO_END_DECLS 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /libretro-common/include/glsym/rglgen.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef RGLGEN_H__ 24 | #define RGLGEN_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #include 31 | 32 | #include "rglgen_headers.h" 33 | 34 | RETRO_BEGIN_DECLS 35 | 36 | struct rglgen_sym_map; 37 | 38 | typedef void (*rglgen_func_t)(void); 39 | typedef rglgen_func_t (*rglgen_proc_address_t)(const char*); 40 | void rglgen_resolve_symbols(rglgen_proc_address_t proc); 41 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 42 | const struct rglgen_sym_map *map); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /libretro-common/include/compat/ifaddrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995, 1999 3 | * Berkeley Software Design, Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND 12 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 14 | * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 17 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 18 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 20 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 21 | * SUCH DAMAGE. 22 | * 23 | * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp 24 | */ 25 | 26 | #ifndef _IFADDRS_H_ 27 | #define _IFADDRS_H_ 28 | 29 | struct ifaddrs 30 | { 31 | struct ifaddrs *ifa_next; 32 | char *ifa_name; 33 | unsigned int ifa_flags; 34 | struct sockaddr *ifa_addr; 35 | struct sockaddr *ifa_netmask; 36 | struct sockaddr *ifa_dstaddr; 37 | void *ifa_data; 38 | }; 39 | 40 | /* 41 | * This may have been defined in . Note that if is 42 | * to be included it must be included before this header file. 43 | */ 44 | #ifndef ifa_broadaddr 45 | #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 46 | #endif 47 | 48 | #include 49 | 50 | extern int getifaddrs(struct ifaddrs **ifap); 51 | extern void freeifaddrs(struct ifaddrs *ifa); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /libretro-common/audio/dsp_filters/fft/fft.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fft.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef RARCH_FFT_H__ 24 | #define RARCH_FFT_H__ 25 | 26 | #include 27 | #include 28 | 29 | typedef struct fft fft_t; 30 | 31 | fft_t *fft_new(unsigned block_size_log2); 32 | 33 | void fft_free(fft_t *fft); 34 | 35 | void fft_process_forward_complex(fft_t *fft, 36 | fft_complex_t *out, const fft_complex_t *in, unsigned step); 37 | 38 | void fft_process_forward(fft_t *fft, 39 | fft_complex_t *out, const float *in, unsigned step); 40 | 41 | void fft_process_inverse(fft_t *fft, 42 | float *out, const fft_complex_t *in, unsigned step); 43 | 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /libretro-common/include/net/net_ifinfo.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (net_ifinfo.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_NET_IFINFO_H 24 | #define _LIBRETRO_NET_IFINFO_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | 36 | struct net_ifinfo_entry 37 | { 38 | char *name; 39 | char *host; 40 | }; 41 | 42 | struct net_ifinfo 43 | { 44 | struct net_ifinfo_entry *entries; 45 | size_t size; 46 | }; 47 | 48 | typedef struct net_ifinfo net_ifinfo_t; 49 | 50 | void net_ifinfo_free(net_ifinfo_t *list); 51 | 52 | bool net_ifinfo_new(net_ifinfo_t *list); 53 | 54 | RETRO_END_DECLS 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /libretro-common/include/compat/strcasestr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strcasestr.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRCASESTR_H 24 | #define __LIBRETRO_SDK_COMPAT_STRCASESTR_H 25 | 26 | #include 27 | 28 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 29 | #include "../../../config.h" 30 | #endif 31 | 32 | #ifndef HAVE_STRCASESTR 33 | 34 | #include 35 | 36 | RETRO_BEGIN_DECLS 37 | 38 | /* Avoid possible naming collisions during link 39 | * since we prefer to use the actual name. */ 40 | #define strcasestr(haystack, needle) strcasestr_retro__(haystack, needle) 41 | 42 | char *strcasestr(const char *haystack, const char *needle); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /libretro-common/include/gfx/scaler/scaler_int.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (scaler_int.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_SCALER_INT_H__ 24 | #define __LIBRETRO_SDK_SCALER_INT_H__ 25 | 26 | #include 27 | 28 | #include 29 | 30 | RETRO_BEGIN_DECLS 31 | 32 | void scaler_argb8888_vert(const struct scaler_ctx *ctx, 33 | void *output, int stride); 34 | 35 | void scaler_argb8888_horiz(const struct scaler_ctx *ctx, 36 | const void *input, int stride); 37 | 38 | void scaler_argb8888_point_special(const struct scaler_ctx *ctx, 39 | void *output, const void *input, 40 | int out_width, int out_height, 41 | int in_width, int in_height, 42 | int out_stride, int in_stride); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /libretro-common/include/rthreads/rsemaphore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rsemaphore.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_SEMAPHORE_H 24 | #define __LIBRETRO_SDK_SEMAPHORE_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | typedef struct ssem ssem_t; 31 | 32 | /** 33 | * ssem_create: 34 | * @value : initial value for the semaphore 35 | * 36 | * Create a new semaphore. 37 | * 38 | * Returns: pointer to new semaphore if successful, otherwise NULL. 39 | */ 40 | ssem_t *ssem_new(int value); 41 | 42 | void ssem_free(ssem_t *semaphore); 43 | 44 | int ssem_get(ssem_t *semaphore); 45 | 46 | void ssem_wait(ssem_t *semaphore); 47 | 48 | void ssem_signal(ssem_t *semaphore); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* __LIBRETRO_SDK_SEMAPHORE_H */ 55 | -------------------------------------------------------------------------------- /libretro-common/libco/ucontext.c: -------------------------------------------------------------------------------- 1 | /* 2 | libco.ucontext (2008-01-28) 3 | author: Nach 4 | license: public domain 5 | */ 6 | 7 | /* 8 | * WARNING: the overhead of POSIX ucontext is very high, 9 | * assembly versions of libco or libco_sjlj should be much faster 10 | * 11 | * This library only exists for two reasons: 12 | * 1 - as an initial test for the viability of a ucontext implementation 13 | * 2 - to demonstrate the power and speed of libco over existing implementations, 14 | * such as pth (which defaults to wrapping ucontext on unix targets) 15 | * 16 | * Use this library only as a *last resort* 17 | */ 18 | 19 | #define LIBCO_C 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | static thread_local ucontext_t co_primary; 29 | static thread_local ucontext_t *co_running = 0; 30 | 31 | cothread_t co_active(void) 32 | { 33 | if (!co_running) 34 | co_running = &co_primary; 35 | return (cothread_t)co_running; 36 | } 37 | 38 | cothread_t co_create(unsigned int heapsize, void (*coentry)(void)) 39 | { 40 | if (!co_running) 41 | co_running = &co_primary; 42 | ucontext_t *thread = (ucontext_t*)malloc(sizeof(ucontext_t)); 43 | 44 | if(thread) 45 | { 46 | if((!getcontext(thread) && !(thread->uc_stack.ss_sp = 0)) && (thread->uc_stack.ss_sp = malloc(heapsize))) 47 | { 48 | thread->uc_link = co_running; 49 | thread->uc_stack.ss_size = heapsize; 50 | makecontext(thread, coentry, 0); 51 | } 52 | else 53 | { 54 | co_delete((cothread_t)thread); 55 | thread = 0; 56 | } 57 | } 58 | return (cothread_t)thread; 59 | } 60 | 61 | void co_delete(cothread_t cothread) 62 | { 63 | if (!cothread) 64 | return; 65 | 66 | if(((ucontext_t*)cothread)->uc_stack.ss_sp) 67 | free(((ucontext_t*)cothread)->uc_stack.ss_sp); 68 | free(cothread); 69 | } 70 | 71 | void co_switch(cothread_t cothread) 72 | { 73 | ucontext_t *old_thread = co_running; 74 | 75 | co_running = (ucontext_t*)cothread; 76 | swapcontext(old_thread, co_running); 77 | } 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | -------------------------------------------------------------------------------- /libretro-common/include/audio/dsp_filter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (dsp_filter.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_AUDIO_DSP_FILTER_H 24 | #define __LIBRETRO_SDK_AUDIO_DSP_FILTER_H 25 | 26 | #include 27 | 28 | RETRO_BEGIN_DECLS 29 | 30 | typedef struct retro_dsp_filter retro_dsp_filter_t; 31 | 32 | retro_dsp_filter_t *retro_dsp_filter_new(const char *filter_config, 33 | void *string_data, float sample_rate); 34 | 35 | void retro_dsp_filter_free(retro_dsp_filter_t *dsp); 36 | 37 | struct retro_dsp_data 38 | { 39 | float *input; 40 | unsigned input_frames; 41 | 42 | /* Set by retro_dsp_filter_process(). */ 43 | float *output; 44 | unsigned output_frames; 45 | }; 46 | 47 | void retro_dsp_filter_process(retro_dsp_filter_t *dsp, 48 | struct retro_dsp_data *data); 49 | 50 | RETRO_END_DECLS 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /libretro-common/formats/png/rpng_internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rpng_internal.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _RPNG_COMMON_H 24 | #define _RPNG_COMMON_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #undef GOTO_END_ERROR 31 | #define GOTO_END_ERROR() do { \ 32 | fprintf(stderr, "[RPNG]: Error in line %d.\n", __LINE__); \ 33 | ret = false; \ 34 | goto end; \ 35 | } while(0) 36 | 37 | #ifndef ARRAY_SIZE 38 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 39 | #endif 40 | 41 | static const uint8_t png_magic[8] = { 42 | 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a, 43 | }; 44 | 45 | struct png_ihdr 46 | { 47 | uint32_t width; 48 | uint32_t height; 49 | uint8_t depth; 50 | uint8_t color_type; 51 | uint8_t compression; 52 | uint8_t filter; 53 | uint8_t interlace; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /libretro-common/include/math/fxp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fxp.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_MATH_FXP_H__ 24 | #define __LIBRETRO_SDK_MATH_FXP_H__ 25 | 26 | #include 27 | 28 | #ifdef _MSC_VER 29 | #include 30 | #endif 31 | 32 | #include 33 | 34 | static INLINE int64_t fx32_mul(const int32_t a, const int32_t b) 35 | { 36 | #ifdef _MSC_VER 37 | return __emul(a, b); 38 | #else 39 | return ((int64_t)a) * ((int64_t)b); 40 | #endif 41 | } 42 | 43 | static INLINE int32_t fx32_shiftdown(const int64_t a) 44 | { 45 | #ifdef _MSC_VER 46 | return (int32_t)__ll_rshift(a, 12); 47 | #else 48 | return (int32_t)(a >> 12); 49 | #endif 50 | } 51 | 52 | static INLINE int64_t fx32_shiftup(const int32_t a) 53 | { 54 | #ifdef _MSC_VER 55 | return __ll_lshift(a, 12); 56 | #else 57 | return ((int64_t)a) << 12; 58 | #endif 59 | } 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /libretro-common/audio/resampler/drivers/null_resampler.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (null_resampler.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include