├── Makefile ├── jni ├── Application.mk └── Android.mk ├── .gitignore ├── LICENSE ├── readme.txt ├── libretro ├── link.T ├── libretro-common │ ├── include │ │ ├── retro_assert.h │ │ ├── retro_inline.h │ │ ├── boolean.h │ │ ├── compat │ │ │ ├── fopen_utf8.h │ │ │ ├── strcasestr.h │ │ │ ├── strl.h │ │ │ ├── posix_string.h │ │ │ ├── msvc.h │ │ │ └── msvc │ │ │ │ └── stdint.h │ │ ├── time │ │ │ └── rtime.h │ │ ├── streams │ │ │ ├── memory_stream.h │ │ │ ├── file_stream_transforms.h │ │ │ └── file_stream.h │ │ ├── encodings │ │ │ └── utf.h │ │ ├── vfs │ │ │ ├── vfs_implementation.h │ │ │ └── vfs.h │ │ ├── retro_environment.h │ │ ├── retro_common_api.h │ │ ├── retro_miscellaneous.h │ │ ├── string │ │ │ └── stdstring.h │ │ └── file │ │ │ └── file_path.h │ ├── compat │ │ ├── compat_strcasestr.c │ │ ├── compat_strl.c │ │ ├── fopen_utf8.c │ │ ├── compat_snprintf.c │ │ └── compat_posix_string.c │ ├── time │ │ └── rtime.c │ ├── file │ │ └── file_path_io.c │ ├── streams │ │ ├── file_stream_transforms.c │ │ └── memory_stream.c │ ├── encodings │ │ └── encoding_utf.c │ └── string │ │ └── stdstring.c ├── libretro_core_options_intl.h └── libretro_core_options.h ├── source ├── IOMap.h ├── MinxIO.c ├── MinxIO.h ├── Video.c ├── Video.h ├── Hardware.c ├── Hardware.h ├── Joystick.c ├── Joystick.h ├── MinxCPU.c ├── MinxIRQ.c ├── MinxIRQ.h ├── MinxLCD.c ├── MinxLCD.h ├── MinxPRC.c ├── MinxPRC.h ├── PMCommon.c ├── PMCommon.h ├── PokeMini.c ├── PokeMini.h ├── Video_x1.c ├── Video_x1.h ├── Video_x2.c ├── Video_x2.h ├── Video_x3.c ├── Video_x3.h ├── Video_x4.c ├── Video_x4.h ├── Video_x5.c ├── Video_x5.h ├── Video_x6.c ├── Video_x6.h ├── Video_x7.c ├── Video_x7.h ├── CommandLine.c ├── CommandLine.h ├── MinxAudio.c ├── MinxAudio.h ├── MinxCPU_CE.c ├── MinxCPU_CF.c ├── MinxCPU_SP.c ├── MinxCPU_XX.c ├── MinxTimers.c ├── Multicart.c ├── Multicart.h ├── MinxColorPRC.c ├── MinxColorPRC.h └── MinxTimers.h ├── freebios ├── gfx.bin ├── freebios.h ├── freebios.min └── makefile ├── readme_source.txt ├── readme_portable.txt ├── resource ├── PokeMini_ColorPal.c └── PokeMini_ColorPal.h ├── .travis.yml ├── history.txt └── .gitlab-ci.yml /Makefile: -------------------------------------------------------------------------------- 1 | include Makefile.libretro 2 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.so 4 | .vscode/ipch/* 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/LICENSE -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/readme.txt -------------------------------------------------------------------------------- /libretro/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /source/IOMap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/IOMap.h -------------------------------------------------------------------------------- /source/MinxIO.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxIO.c -------------------------------------------------------------------------------- /source/MinxIO.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxIO.h -------------------------------------------------------------------------------- /source/Video.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video.c -------------------------------------------------------------------------------- /source/Video.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video.h -------------------------------------------------------------------------------- /freebios/gfx.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/freebios/gfx.bin -------------------------------------------------------------------------------- /readme_source.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/readme_source.txt -------------------------------------------------------------------------------- /source/Hardware.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Hardware.c -------------------------------------------------------------------------------- /source/Hardware.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Hardware.h -------------------------------------------------------------------------------- /source/Joystick.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Joystick.c -------------------------------------------------------------------------------- /source/Joystick.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Joystick.h -------------------------------------------------------------------------------- /source/MinxCPU.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxCPU.c -------------------------------------------------------------------------------- /source/MinxIRQ.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxIRQ.c -------------------------------------------------------------------------------- /source/MinxIRQ.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxIRQ.h -------------------------------------------------------------------------------- /source/MinxLCD.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxLCD.c -------------------------------------------------------------------------------- /source/MinxLCD.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxLCD.h -------------------------------------------------------------------------------- /source/MinxPRC.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxPRC.c -------------------------------------------------------------------------------- /source/MinxPRC.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxPRC.h -------------------------------------------------------------------------------- /source/PMCommon.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/PMCommon.c -------------------------------------------------------------------------------- /source/PMCommon.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/PMCommon.h -------------------------------------------------------------------------------- /source/PokeMini.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/PokeMini.c -------------------------------------------------------------------------------- /source/PokeMini.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/PokeMini.h -------------------------------------------------------------------------------- /source/Video_x1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x1.c -------------------------------------------------------------------------------- /source/Video_x1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x1.h -------------------------------------------------------------------------------- /source/Video_x2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x2.c -------------------------------------------------------------------------------- /source/Video_x2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x2.h -------------------------------------------------------------------------------- /source/Video_x3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x3.c -------------------------------------------------------------------------------- /source/Video_x3.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x3.h -------------------------------------------------------------------------------- /source/Video_x4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x4.c -------------------------------------------------------------------------------- /source/Video_x4.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x4.h -------------------------------------------------------------------------------- /source/Video_x5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x5.c -------------------------------------------------------------------------------- /source/Video_x5.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x5.h -------------------------------------------------------------------------------- /source/Video_x6.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x6.c -------------------------------------------------------------------------------- /source/Video_x6.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x6.h -------------------------------------------------------------------------------- /source/Video_x7.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x7.c -------------------------------------------------------------------------------- /source/Video_x7.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Video_x7.h -------------------------------------------------------------------------------- /freebios/freebios.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/freebios/freebios.h -------------------------------------------------------------------------------- /readme_portable.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/readme_portable.txt -------------------------------------------------------------------------------- /source/CommandLine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/CommandLine.c -------------------------------------------------------------------------------- /source/CommandLine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/CommandLine.h -------------------------------------------------------------------------------- /source/MinxAudio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxAudio.c -------------------------------------------------------------------------------- /source/MinxAudio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxAudio.h -------------------------------------------------------------------------------- /source/MinxCPU_CE.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxCPU_CE.c -------------------------------------------------------------------------------- /source/MinxCPU_CF.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxCPU_CF.c -------------------------------------------------------------------------------- /source/MinxCPU_SP.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxCPU_SP.c -------------------------------------------------------------------------------- /source/MinxCPU_XX.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxCPU_XX.c -------------------------------------------------------------------------------- /source/MinxTimers.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxTimers.c -------------------------------------------------------------------------------- /source/Multicart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Multicart.c -------------------------------------------------------------------------------- /source/Multicart.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/Multicart.h -------------------------------------------------------------------------------- /freebios/freebios.min: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/freebios/freebios.min -------------------------------------------------------------------------------- /source/MinxColorPRC.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxColorPRC.c -------------------------------------------------------------------------------- /source/MinxColorPRC.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/source/MinxColorPRC.h -------------------------------------------------------------------------------- /resource/PokeMini_ColorPal.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/resource/PokeMini_ColorPal.c -------------------------------------------------------------------------------- /resource/PokeMini_ColorPal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/PokeMini/HEAD/resource/PokeMini_ColorPal.h -------------------------------------------------------------------------------- /freebios/makefile: -------------------------------------------------------------------------------- 1 | # FreeBIOS Makefile 2 | 3 | POKEROOT = ../ 4 | PMAS = $(POKEROOT)tools/pmas/pmas 5 | BIN2C = $(POKEROOT)tools/bin2c/bin2c 6 | 7 | .PHONY: all clean 8 | 9 | all: freebios.c 10 | 11 | freebios.c : freebios.asm 12 | $(PMAS) freebios.asm freebios.min 13 | $(BIN2C) freebios.min freebios.c FreeBIOS 14 | 15 | clean: 16 | -rm -f freebios.min freebios.c 17 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | CORE_DIR := $(LOCAL_PATH)/.. 4 | 5 | include $(CORE_DIR)/build/Makefile.common 6 | 7 | COREFLAGS := -ffast-math -funroll-loops -D__LIBRETRO__ $(INCFLAGS) 8 | 9 | include $(CLEAR_VARS) 10 | LOCAL_MODULE := retro 11 | LOCAL_SRC_FILES := $(SOURCES_C) 12 | LOCAL_CFLAGS := -std=gnu99 $(COREFLAGS) 13 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/libretro/link.T 14 | 15 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) 16 | LOCAL_ARM_NEON := true 17 | endif 18 | 19 | include $(BUILD_SHARED_LIBRARY) 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | os: linux 3 | dist: trusty 4 | sudo: required 5 | addons: 6 | apt: 7 | packages: 8 | - g++-7 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | env: 12 | global: 13 | - CORE=pokemini 14 | - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7 15 | matrix: 16 | - PLATFORM=linux_x64 17 | before_script: 18 | - pwd 19 | - mkdir -p ~/bin 20 | - ln -s /usr/bin/gcc-7 ~/bin/gcc 21 | - ln -s /usr/bin/g++-7 ~/bin/g++ 22 | - ln -s /usr/bin/cpp-7 ~/bin/cpp 23 | - export PATH=~/bin:$PATH 24 | - ls -l ~/bin 25 | - echo $PATH 26 | - g++-7 --version 27 | - g++ --version 28 | script: 29 | - cd ~/ 30 | - git clone --depth=50 https://github.com/libretro/libretro-super 31 | - cd libretro-super/travis 32 | - ./build.sh 33 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/retro_assert.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | #include 30 | #define retro_assert(cond) ((void)( (cond) || (printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__), abort(), 0) )) 31 | #else 32 | #define retro_assert(cond) assert(cond) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/retro_inline.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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/libretro-common/include/boolean.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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/libretro-common/include/compat/fopen_utf8.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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/libretro-common/include/time/rtime.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.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_RTIME_H__ 24 | #define __LIBRETRO_SDK_RTIME_H__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | /* TODO/FIXME: Move all generic time handling functions 35 | * to this file */ 36 | 37 | /* Must be called before using rtime_localtime() */ 38 | void rtime_init(void); 39 | 40 | /* Must be called upon program termination */ 41 | void rtime_deinit(void); 42 | 43 | /* Thread-safe wrapper for localtime() */ 44 | struct tm *rtime_localtime(const time_t *timep, struct tm *result); 45 | 46 | RETRO_END_DECLS 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/strcasestr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/strl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strl.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_STRL_H 24 | #define __LIBRETRO_SDK_COMPAT_STRL_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 30 | #include "../../../config.h" 31 | #endif 32 | 33 | #include 34 | 35 | RETRO_BEGIN_DECLS 36 | 37 | #ifdef __MACH__ 38 | #ifndef HAVE_STRL 39 | #define HAVE_STRL 40 | #endif 41 | #endif 42 | 43 | #ifndef HAVE_STRL 44 | /* Avoid possible naming collisions during link since 45 | * we prefer to use the actual name. */ 46 | #define strlcpy(dst, src, size) strlcpy_retro__(dst, src, size) 47 | 48 | #define strlcat(dst, src, size) strlcat_retro__(dst, src, size) 49 | 50 | size_t strlcpy(char *dest, const char *source, size_t size); 51 | size_t strlcat(char *dest, const char *source, size_t size); 52 | 53 | #endif 54 | 55 | char *strldup(const char *s, size_t n); 56 | 57 | RETRO_END_DECLS 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /libretro/libretro-common/compat/compat_strcasestr.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strcasestr.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 | 25 | #include 26 | 27 | /* Pretty much strncasecmp. */ 28 | static int casencmp(const char *a, const char *b, size_t n) 29 | { 30 | size_t i; 31 | 32 | for (i = 0; i < n; i++) 33 | { 34 | int a_lower = tolower(a[i]); 35 | int b_lower = tolower(b[i]); 36 | if (a_lower != b_lower) 37 | return a_lower - b_lower; 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | char *strcasestr_retro__(const char *haystack, const char *needle) 44 | { 45 | size_t i, search_off; 46 | size_t hay_len = strlen(haystack); 47 | size_t needle_len = strlen(needle); 48 | 49 | if (needle_len > hay_len) 50 | return NULL; 51 | 52 | search_off = hay_len - needle_len; 53 | for (i = 0; i <= search_off; i++) 54 | if (!casencmp(haystack + i, needle, needle_len)) 55 | return (char*)haystack + i; 56 | 57 | return NULL; 58 | } 59 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/posix_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (posix_string.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_POSIX_STRING_H 24 | #define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 25 | 26 | #include 27 | 28 | #ifdef _MSC_VER 29 | #include 30 | #endif 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | #ifdef _WIN32 35 | #undef strtok_r 36 | #define strtok_r(str, delim, saveptr) retro_strtok_r__(str, delim, saveptr) 37 | 38 | char *strtok_r(char *str, const char *delim, char **saveptr); 39 | #endif 40 | 41 | #ifdef _MSC_VER 42 | #undef strcasecmp 43 | #undef strdup 44 | #define strcasecmp(a, b) retro_strcasecmp__(a, b) 45 | #define strdup(orig) retro_strdup__(orig) 46 | int strcasecmp(const char *a, const char *b); 47 | char *strdup(const char *orig); 48 | 49 | /* isblank is available since MSVC 2013 */ 50 | #if _MSC_VER < 1800 51 | #undef isblank 52 | #define isblank(c) retro_isblank__(c) 53 | int isblank(int c); 54 | #endif 55 | 56 | #endif 57 | 58 | RETRO_END_DECLS 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libretro/libretro-common/compat/compat_strl.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strl.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 | 26 | #include 27 | 28 | /* Implementation of strlcpy()/strlcat() based on OpenBSD. */ 29 | 30 | #ifndef __MACH__ 31 | 32 | size_t strlcpy(char *dest, const char *source, size_t size) 33 | { 34 | size_t src_size = 0; 35 | size_t n = size; 36 | 37 | if (n) 38 | while (--n && (*dest++ = *source++)) src_size++; 39 | 40 | if (!n) 41 | { 42 | if (size) *dest = '\0'; 43 | while (*source++) src_size++; 44 | } 45 | 46 | return src_size; 47 | } 48 | 49 | size_t strlcat(char *dest, const char *source, size_t size) 50 | { 51 | size_t len = strlen(dest); 52 | 53 | dest += len; 54 | 55 | if (len > size) 56 | size = 0; 57 | else 58 | size -= len; 59 | 60 | return len + strlcpy(dest, source, size); 61 | } 62 | #endif 63 | 64 | char *strldup(const char *s, size_t n) 65 | { 66 | char *dst = (char*)malloc(sizeof(char) * (n + 1)); 67 | strlcpy(dst, s, n); 68 | return dst; 69 | } 70 | -------------------------------------------------------------------------------- /libretro/libretro-common/compat/fopen_utf8.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.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 | #include 27 | 28 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) 29 | #ifndef LEGACY_WIN32 30 | #define LEGACY_WIN32 31 | #endif 32 | #endif 33 | 34 | #ifdef _WIN32 35 | #undef fopen 36 | 37 | void *fopen_utf8(const char * filename, const char * mode) 38 | { 39 | #if defined(LEGACY_WIN32) 40 | FILE *ret = NULL; 41 | char * filename_local = utf8_to_local_string_alloc(filename); 42 | 43 | if (!filename_local) 44 | return NULL; 45 | ret = fopen(filename_local, mode); 46 | if (filename_local) 47 | free(filename_local); 48 | return ret; 49 | #else 50 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 51 | wchar_t * mode_w = utf8_to_utf16_string_alloc(mode); 52 | FILE* ret = NULL; 53 | 54 | if (filename_w && mode_w) 55 | ret = _wfopen(filename_w, mode_w); 56 | if (filename_w) 57 | free(filename_w); 58 | if (mode_w) 59 | free(mode_w); 60 | return ret; 61 | #endif 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/streams/memory_stream.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memory_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_FILE_MEMORY_STREAM_H 24 | #define _LIBRETRO_SDK_FILE_MEMORY_STREAM_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | RETRO_BEGIN_DECLS 32 | 33 | typedef struct memstream memstream_t; 34 | 35 | memstream_t *memstream_open(unsigned writing); 36 | 37 | void memstream_close(memstream_t *stream); 38 | 39 | uint64_t memstream_read(memstream_t *stream, void *data, uint64_t bytes); 40 | 41 | uint64_t memstream_write(memstream_t *stream, const void *data, uint64_t bytes); 42 | 43 | int memstream_getc(memstream_t *stream); 44 | 45 | void memstream_putc(memstream_t *stream, int c); 46 | 47 | char *memstream_gets(memstream_t *stream, char *buffer, size_t len); 48 | 49 | uint64_t memstream_pos(memstream_t *stream); 50 | 51 | void memstream_rewind(memstream_t *stream); 52 | 53 | int64_t memstream_seek(memstream_t *stream, int64_t offset, int whence); 54 | 55 | void memstream_set_buffer(uint8_t *buffer, uint64_t size); 56 | 57 | uint64_t memstream_get_last_size(void); 58 | 59 | uint64_t memstream_get_ptr(memstream_t *stream); 60 | 61 | RETRO_END_DECLS 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/encodings/utf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (utf.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_UTF_H 24 | #define _LIBRETRO_ENCODINGS_UTF_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | enum CodePage 36 | { 37 | CODEPAGE_LOCAL = 0, /* CP_ACP */ 38 | CODEPAGE_UTF8 = 65001 /* CP_UTF8 */ 39 | }; 40 | 41 | size_t utf8_conv_utf32(uint32_t *out, size_t out_chars, 42 | const char *in, size_t in_size); 43 | 44 | bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, 45 | const uint16_t *in, size_t in_size); 46 | 47 | size_t utf8len(const char *string); 48 | 49 | size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars); 50 | 51 | const char *utf8skip(const char *str, size_t chars); 52 | 53 | uint32_t utf8_walk(const char **string); 54 | 55 | bool utf16_to_char_string(const uint16_t *in, char *s, size_t len); 56 | 57 | char* utf8_to_local_string_alloc(const char *str); 58 | 59 | char* local_to_utf8_string_alloc(const char *str); 60 | 61 | wchar_t* utf8_to_utf16_string_alloc(const char *str); 62 | 63 | char* utf16_to_utf8_string_alloc(const wchar_t *str); 64 | 65 | RETRO_END_DECLS 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /libretro/libretro-common/time/rtime.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.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 | #ifdef HAVE_THREADS 24 | #include 25 | #include 26 | #include 27 | #endif 28 | 29 | #include 30 | #include