├── jni ├── Application.mk └── Android.mk ├── link.T ├── intl ├── .gitignore ├── crowdin.yaml ├── upload_workflow.py ├── download_workflow.py ├── crowdin_prep.py ├── remove_initial_cycle.py ├── crowdin_translate.py └── activate.py ├── deps ├── libchdr │ ├── src │ │ └── link.T │ ├── include │ │ └── libchdr │ │ │ ├── chdconfig.h │ │ │ ├── bitstream.h │ │ │ ├── coretypes.h │ │ │ └── flac.h │ ├── README.md │ └── LICENSE.txt ├── zlib-1.2.11 │ ├── zlib.3.pdf │ ├── Makefile │ ├── zlib.pc.in │ ├── zlib.pc.cmakein │ ├── inffast.h │ ├── CMakeLists.txt │ ├── zlib.map │ ├── INDEX │ └── inftrees.h ├── lzma-19.00 │ ├── lzma-history.txt │ ├── include │ │ ├── Precomp.h │ │ ├── Sort.h │ │ ├── Delta.h │ │ ├── Alloc.h │ │ ├── Compiler.h │ │ ├── LzHash.h │ │ └── Bra.h │ ├── LICENSE │ ├── lzma.vcxproj.filters │ ├── CMakeLists.txt │ └── src │ │ ├── BraIA64.c │ │ ├── Lzma86Dec.c │ │ ├── Delta.c │ │ ├── Bra86.c │ │ └── Lzma86Enc.c └── zstd │ ├── CODE_OF_CONDUCT.md │ ├── lib │ ├── common │ │ ├── xxhash.c │ │ ├── debug.c │ │ ├── allocations.h │ │ ├── zstd_common.c │ │ ├── pool.h │ │ └── zstd_deps.h │ └── decompress │ │ ├── zstd_ddict.h │ │ └── zstd_decompress_block.h │ ├── Package.swift │ ├── LICENSE │ └── TESTING.md ├── .gitignore ├── mednafen ├── pce │ ├── input │ │ ├── mouse.h │ │ ├── gamepad.h │ │ └── tsushinkb.h │ ├── tsushin.h │ ├── huc.h │ ├── pce.h │ ├── tsushin.cpp │ ├── input.h │ └── pcecd.h ├── mednafen-driver.h ├── mempatcher.h ├── file.h ├── cdrom │ ├── CDAccess.h │ ├── CDAFReader_MPC.h │ ├── CDAFReader_Vorbis.h │ ├── galois-inlines.h │ ├── CDAccess_CCD.h │ ├── CDAccess.cpp │ ├── CDAFReader.cpp │ ├── CDAFReader.h │ ├── SimpleFIFO.h │ ├── lec.h │ ├── cdromif.h │ ├── CDAccess_Image.h │ └── CDAccess_CHD.h ├── general.h ├── mednafen.h ├── math_ops.h ├── sound │ ├── OwlResampler_neon.inc │ ├── okiadpcm.cpp │ └── OwlResampler_altivec.inc ├── settings.h ├── tremor │ ├── block.h │ ├── window.h │ ├── COPYING │ ├── os.h │ ├── registry.h │ ├── mdct.h │ ├── registry.c │ ├── README │ └── window.c ├── Stream.cpp ├── hw_misc │ └── arcade_card │ │ └── arcade_card.h ├── cputest │ ├── cputest.c │ └── cputest.h ├── mempatcher-driver.h ├── FileStream.h ├── video.h ├── lepacker.h ├── MemoryStream.h ├── msvc_compat.h ├── FileStream.cpp └── mednafen-types.h ├── appveyor.yml ├── .travis.yml ├── .github └── workflows │ ├── crowdin_prep.yml │ └── crowdin_translate.yml ├── README.md └── libretro-common ├── include ├── compat │ ├── fnmatch.h │ ├── fopen_utf8.h │ ├── ifaddrs.h │ ├── strcasestr.h │ ├── strl.h │ ├── posix_string.h │ ├── apple_compat.h │ ├── getopt.h │ └── intrinsics.h ├── encodings │ └── crc32.h ├── retro_assert.h ├── memalign.h ├── retro_inline.h ├── boolean.h ├── retro_common.h ├── time │ └── rtime.h ├── memmap.h ├── vfs │ └── vfs_implementation_cdrom.h └── retro_dirent.h ├── compat ├── compat_strl.c ├── compat_strcasestr.c ├── fopen_utf8.c └── compat_snprintf.c ├── memmap └── memalign.c └── time └── rtime.c /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := c++_static 2 | APP_ABI := all 3 | -------------------------------------------------------------------------------- /link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /intl/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | crowdin-cli.jar 3 | *.h 4 | *.json 5 | -------------------------------------------------------------------------------- /deps/libchdr/src/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: chd_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/zlib.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-pce-libretro/HEAD/deps/zlib-1.2.11/zlib.3.pdf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.dll 4 | *.dylib 5 | *.lib 6 | *.pdb 7 | *.exp 8 | *.manifest 9 | /old 10 | 11 | -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma-history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-pce-libretro/HEAD/deps/lzma-19.00/lzma-history.txt -------------------------------------------------------------------------------- /deps/zlib-1.2.11/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | -@echo "Please use ./configure first. Thank you." 3 | 4 | distclean: 5 | make -f Makefile.in distclean 6 | -------------------------------------------------------------------------------- /mednafen/pce/input/mouse.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCE_INPUT_MOUSE_H 2 | #define __PCE_INPUT_MOUSE_H 3 | 4 | PCE_Input_Device *PCEINPUT_MakeMouse(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /mednafen/pce/input/gamepad.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCE_INPUT_GAMEPAD_H 2 | #define __PCE_INPUT_GAMEPAD_H 3 | 4 | PCE_Input_Device *PCEINPUT_MakeGamepad(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /mednafen/pce/tsushin.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_TSUSHIN_H 2 | #define __MDFN_PCE_TSUSHIN_H 3 | 4 | DECLFR(PCE_TsushinRead); 5 | DECLFW(PCE_TsushinWrite); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /mednafen/pce/input/tsushinkb.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCE_INPUT_TSUSHINKB_H 2 | #define __PCE_INPUT_TSUSHINKB_H 3 | 4 | PCE_Input_Device *PCEINPUT_MakeTsushinKB(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /mednafen/mednafen-driver.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEDNAFEN_DRIVER_H 2 | #define __MDFN_MEDNAFEN_DRIVER_H 3 | 4 | #include 5 | 6 | void MDFN_DispMessage(const char *format, ...); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Precomp.h: -------------------------------------------------------------------------------- 1 | /* Precomp.h -- StdAfx 2 | 2013-11-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_PRECOMP_H 5 | #define __7Z_PRECOMP_H 6 | 7 | #include "Compiler.h" 8 | /* #include "7zTypes.h" */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /deps/lzma-19.00/LICENSE: -------------------------------------------------------------------------------- 1 | LZMA SDK is placed in the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original LZMA SDK code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. -------------------------------------------------------------------------------- /deps/zstd/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. 4 | Please read the [full text](https://code.fb.com/codeofconduct/) 5 | so that you can understand what actions will and will not be tolerated. 6 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/zlib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | sharedlibdir=@sharedlibdir@ 5 | includedir=@includedir@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/chdconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef __CHDCONFIG_H__ 2 | #define __CHDCONFIG_H__ 3 | 4 | #include 5 | 6 | /* Configure CHDR features here */ 7 | #define WANT_RAW_DATA_SECTOR 1 8 | #define WANT_SUBCODE 1 9 | #define NEED_CACHE_HUNK 1 10 | #define VERIFY_BLOCK_CRC 1 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /intl/crowdin.yaml: -------------------------------------------------------------------------------- 1 | "project_id": "380544" 2 | "api_token": "_secret_" 3 | "base_url": "https://api.crowdin.com" 4 | "preserve_hierarchy": true 5 | 6 | "files": 7 | [ 8 | { 9 | "source": "/_core_name_/_us.json", 10 | "dest": "/_core_name_/_core_name_.json", 11 | "translation": "/_core_name_/_%two_letters_code%.json", 12 | }, 13 | ] 14 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/zlib.pc.cmakein: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@INSTALL_LIB_DIR@ 4 | sharedlibdir=@INSTALL_LIB_DIR@ 5 | includedir=@INSTALL_INC_DIR@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Sort.h: -------------------------------------------------------------------------------- 1 | /* Sort.h -- Sort functions 2 | 2014-04-05 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_SORT_H 5 | #define __7Z_SORT_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void HeapSort(UInt32 *p, size_t size); 12 | void HeapSort64(UInt64 *p, size_t size); 13 | 14 | /* void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size); */ 15 | 16 | EXTERN_C_END 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Delta.h: -------------------------------------------------------------------------------- 1 | /* Delta.h -- Delta converter 2 | 2013-01-18 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __DELTA_H 5 | #define __DELTA_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | #define DELTA_STATE_SIZE 256 12 | 13 | void Delta_Init(Byte *state); 14 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); 15 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); 16 | 17 | EXTERN_C_END 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /deps/libchdr/README.md: -------------------------------------------------------------------------------- 1 | # libchdr 2 | 3 | libchdr is a standalone library for reading MAME's CHDv1-v5 formats. 4 | 5 | The code is based off of MAME's old C codebase which read up to CHDv4 with OS-dependent features removed, and CHDv5 support backported from MAME's current C++ codebase. 6 | 7 | libchdr is licensed under the BSD 3-Clause (see [LICENSE.txt](LICENSE.txt)) and uses third party libraries that are each distributed under their own terms (see each library's license in [deps/](deps/)). 8 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /intl/upload_workflow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import subprocess 5 | 6 | try: 7 | api_key = sys.argv[1] 8 | core_name = sys.argv[2] 9 | dir_path = sys.argv[3] 10 | except IndexError as e: 11 | print('Please provide path to libretro_core_options.h, Crowdin API Token and core name!') 12 | raise e 13 | 14 | subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name]) 15 | subprocess.run(['python3', 'intl/crowdin_source_upload.py', api_key, core_name]) 16 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(zlib STATIC 2 | zconf.h 3 | zlib.h 4 | adler32.c 5 | compress.c 6 | crc32.c 7 | crc32.h 8 | deflate.c 9 | deflate.h 10 | gzguts.h 11 | infback.c 12 | inffast.c 13 | inffast.h 14 | inffixed.h 15 | inflate.c 16 | inflate.h 17 | inftrees.c 18 | inftrees.h 19 | trees.c 20 | trees.h 21 | uncompr.c 22 | zutil.c 23 | zutil.h 24 | ) 25 | 26 | target_include_directories(zlib PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") 27 | target_include_directories(zlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") 28 | -------------------------------------------------------------------------------- /intl/download_workflow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import subprocess 5 | 6 | try: 7 | api_key = sys.argv[1] 8 | core_name = sys.argv[2] 9 | dir_path = sys.argv[3] 10 | except IndexError as e: 11 | print('Please provide path to libretro_core_options.h, Crowdin API Token and core name!') 12 | raise e 13 | 14 | subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name]) 15 | subprocess.run(['python3', 'intl/crowdin_translation_download.py', api_key, core_name]) 16 | subprocess.run(['python3', 'intl/crowdin_translate.py', dir_path, core_name]) 17 | -------------------------------------------------------------------------------- /mednafen/mempatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEMPATCHER_H 2 | #define __MDFN_MEMPATCHER_H 3 | 4 | #include "mempatcher-driver.h" 5 | #include 6 | 7 | typedef struct __SUBCHEAT 8 | { 9 | uint32 addr; 10 | uint8 value; 11 | int compare; // < 0 on no compare 12 | } SUBCHEAT; 13 | 14 | extern std::vector SubCheats[8]; 15 | extern bool SubCheatsOn; 16 | 17 | bool MDFNMP_Init(uint32 ps, uint32 numpages); 18 | void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM); 19 | void MDFNMP_Kill(void); 20 | 21 | 22 | void MDFNMP_InstallReadPatches(void); 23 | void MDFNMP_RemoveReadPatches(void); 24 | 25 | void MDFNMP_ApplyPeriodicCheats(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.1.{build} 2 | 3 | shallow_clone: true 4 | 5 | image: Visual Studio 2017 6 | 7 | environment: 8 | makefile_location: "." 9 | makefile_name: Makefile 10 | target_name: mednafen_pce 11 | 12 | configuration: 13 | - release 14 | 15 | platform: 16 | - windows_msvc2017_uwp_x64 17 | - windows_msvc2017_uwp_x86 18 | - windows_msvc2017_uwp_arm 19 | - windows_msvc2017_desktop_x64 20 | - windows_msvc2017_desktop_x86 21 | 22 | init: 23 | - set Path=C:\msys64\usr\bin;%Path% 24 | 25 | build_script: 26 | - cd %makefile_location% 27 | - make -f %makefile_name% platform=%platform% 28 | 29 | artifacts: 30 | - path: '**\%target_name%*.dll' 31 | - path: '**\%target_name%*.lib' 32 | - path: '**\%target_name%*.pdb' 33 | - path: '**\libretro.h' 34 | -------------------------------------------------------------------------------- /mednafen/file.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_FILE_H 2 | #define MDFN_FILE_H 3 | 4 | #include 5 | 6 | #define MDFNFILE_EC_NOTFOUND 1 7 | #define MDFNFILE_EC_OTHER 2 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | struct MDFNFILE 14 | { 15 | uint8_t *data; 16 | int64_t size; 17 | char *ext; 18 | int64_t location; 19 | }; 20 | 21 | struct MDFNFILE *file_open(const char *path); 22 | 23 | int file_close(struct MDFNFILE *file); 24 | 25 | uint64_t file_read(struct MDFNFILE *file, void *ptr, 26 | size_t element_size, size_t nmemb); 27 | 28 | int file_seek(struct MDFNFILE *file, int64_t offset, int whence); 29 | 30 | char *file_fgets(struct MDFNFILE *file, char *s, int buffer_size); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /deps/lzma-19.00/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lzma STATIC 2 | include/7zTypes.h 3 | include/Alloc.h 4 | include/Bra.h 5 | include/Compiler.h 6 | include/CpuArch.h 7 | include/Delta.h 8 | include/LzFind.h 9 | include/LzHash.h 10 | include/Lzma86.h 11 | include/LzmaDec.h 12 | include/LzmaEnc.h 13 | include/LzmaLib.h 14 | include/Precomp.h 15 | include/Sort.h 16 | src/Alloc.c 17 | src/Bra86.c 18 | src/BraIA64.c 19 | src/CpuArch.c 20 | src/Delta.c 21 | src/LzFind.c 22 | src/Lzma86Dec.c 23 | src/LzmaDec.c 24 | src/LzmaEnc.c 25 | src/Sort.c 26 | ) 27 | 28 | target_compile_definitions(lzma PRIVATE _7ZIP_ST) 29 | 30 | target_include_directories(lzma PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") 31 | target_include_directories(lzma INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") 32 | 33 | -------------------------------------------------------------------------------- /.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=mednafen_pce 14 | - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7 15 | matrix: 16 | - PLATFORM=3ds 17 | - PLATFORM=linux_x64 18 | - PLATFORM=ngc 19 | - PLATFORM=wii 20 | - PLATFORM=wiiu 21 | before_script: 22 | - pwd 23 | - mkdir -p ~/bin 24 | - ln -s /usr/bin/gcc-7 ~/bin/gcc 25 | - ln -s /usr/bin/g++-7 ~/bin/g++ 26 | - ln -s /usr/bin/cpp-7 ~/bin/cpp 27 | - export PATH=~/bin:$PATH 28 | - ls -l ~/bin 29 | - echo $PATH 30 | - g++-7 --version 31 | - g++ --version 32 | script: 33 | - cd ~/ 34 | - git clone --depth=50 https://github.com/libretro/libretro-super 35 | - cd libretro-super/travis 36 | - ./build.sh 37 | -------------------------------------------------------------------------------- /deps/zstd/lib/common/xxhash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xxHash - Fast Hash algorithm 3 | * Copyright (c) Meta Platforms, Inc. and affiliates. 4 | * 5 | * You can contact the author at : 6 | * - xxHash homepage: https://cyan4973.github.io/xxHash/ 7 | * - xxHash source repository : https://github.com/Cyan4973/xxHash 8 | * 9 | * This source code is licensed under both the BSD-style license (found in the 10 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 11 | * in the COPYING file in the root directory of this source tree). 12 | * You may select, at your option, one of the above-listed licenses. 13 | */ 14 | 15 | 16 | 17 | /* 18 | * xxhash.c instantiates functions defined in xxhash.h 19 | */ 20 | 21 | #define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ 22 | #define XXH_IMPLEMENTATION /* access definitions */ 23 | 24 | #include "xxhash.h" 25 | -------------------------------------------------------------------------------- /mednafen/pce/huc.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_HUC_H 2 | #define __MDFN_PCE_HUC_H 3 | 4 | #include 5 | 6 | typedef enum 7 | { 8 | SYSCARD_NONE = 0, 9 | SYSCARD_1, 10 | SYSCARD_2, 11 | SYSCARD_3, 12 | SYSCARD_ARCADE // 3.0 + extras 13 | } SysCardType; 14 | 15 | uint32 HuC_Load(const uint8_t *data, size_t size, bool DisableBRAM = false, SysCardType syscard = SYSCARD_NONE) MDFN_COLD; 16 | void HuC_SaveNV(void); 17 | void HuC_Kill(void) MDFN_COLD; 18 | 19 | void HuC_Update(int32 timestamp); 20 | void HuC_ResetTS(int32 ts_base); 21 | 22 | int HuC_StateAction(StateMem *sm, const unsigned load, const bool data_only); 23 | 24 | void HuC_Power(void); 25 | 26 | DECLFR(PCE_ACRead); 27 | DECLFW(PCE_ACWrite); 28 | 29 | extern bool PCE_IsCD; 30 | extern bool IsPopulous; 31 | extern bool IsTsushin; 32 | 33 | extern uint8 *TsushinRAM; 34 | extern uint8 *PopRAM; 35 | extern uint8 SaveRAM[2048]; 36 | extern uint8 *CDRAM; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDROMFILE_H 2 | #define __MDFN_CDROMFILE_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "CDUtility.h" 9 | 10 | class CDAccess 11 | { 12 | public: 13 | 14 | CDAccess(); 15 | virtual ~CDAccess(); 16 | 17 | virtual bool Read_Raw_Sector(uint8_t *buf, int32_t lba) = 0; 18 | 19 | // Returns false if the read wouldn't be "fast"(i.e. reading from a disk), 20 | // or if the read can't be done in a thread-safe re-entrant manner. 21 | // 22 | // Writes 96 bytes into pwbuf, and returns 'true' otherwise. 23 | virtual bool Fast_Read_Raw_PW_TSRE(uint8_t* pwbuf, int32_t lba) = 0; 24 | 25 | virtual bool Read_TOC(TOC *toc) = 0; 26 | 27 | private: 28 | CDAccess(const CDAccess&); // No copy constructor. 29 | CDAccess& operator=(const CDAccess&); // No assignment operator. 30 | }; 31 | 32 | CDAccess* CDAccess_Open(const std::string& path, bool image_memcache); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /deps/zstd/lib/common/debug.c: -------------------------------------------------------------------------------- 1 | /* ****************************************************************** 2 | * debug 3 | * Part of FSE library 4 | * Copyright (c) Meta Platforms, Inc. and affiliates. 5 | * 6 | * You can contact the author at : 7 | * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy 8 | * 9 | * This source code is licensed under both the BSD-style license (found in the 10 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 11 | * in the COPYING file in the root directory of this source tree). 12 | * You may select, at your option, one of the above-listed licenses. 13 | ****************************************************************** */ 14 | 15 | 16 | /* 17 | * This module only hosts one global variable 18 | * which can be used to dynamically influence the verbosity of traces, 19 | * such as DEBUGLOG and RAWLOG 20 | */ 21 | 22 | #include "debug.h" 23 | 24 | int g_debuglevel = DEBUGLEVEL; 25 | -------------------------------------------------------------------------------- /.github/workflows/crowdin_prep.yml: -------------------------------------------------------------------------------- 1 | # Prepare source texts & upload them to Crowdin 2 | 3 | name: Crowdin Source Texts Upload 4 | 5 | # on change to the English texts 6 | on: 7 | push: 8 | branches: 9 | - master 10 | paths: 11 | - 'libretro_core_options.h' 12 | 13 | jobs: 14 | upload_source_file: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Setup Java JDK 18 | uses: actions/setup-java@v3 19 | with: 20 | java-version: 18 21 | distribution: zulu 22 | 23 | - name: Setup Python 24 | uses: actions/setup-python@v4 25 | with: 26 | python-version: '3.10' 27 | 28 | - name: Checkout 29 | uses: actions/checkout@v3 30 | 31 | - name: Upload Source 32 | shell: bash 33 | env: 34 | CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} 35 | run: | 36 | python3 intl/upload_workflow.py $CROWDIN_API_KEY "beetle-pce-libretro" "libretro_core_options.h" 37 | -------------------------------------------------------------------------------- /mednafen/general.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENERAL_H 2 | #define _GENERAL_H 3 | 4 | #include 5 | 6 | // File-inclusion for-read-only path, for PSF and CUE/TOC sheet usage. 7 | bool MDFN_IsFIROPSafe(const std::string &path); 8 | 9 | std::string MDFN_MakeFName(int type, int id1, const char *cd1); 10 | 11 | void MDFN_ltrim(std::string &string); 12 | void MDFN_rtrim(std::string &string); 13 | void MDFN_trim(std::string &string); 14 | 15 | typedef enum 16 | { 17 | MDFNMKF_STATE = 0, 18 | MDFNMKF_SNAP, 19 | MDFNMKF_CHEAT, 20 | MDFNMKF_PALETTE, 21 | MDFNMKF_IPS, 22 | MDFNMKF_MOVIE, 23 | MDFNMKF_AUX, 24 | MDFNMKF_SNAP_DAT, 25 | MDFNMKF_CHEAT_TMP, 26 | MDFNMKF_FIRMWARE 27 | } MakeFName_Type; 28 | 29 | std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1); 30 | 31 | void MDFN_GetFilePathComponents(const std::string &file_path, std::string *dir_path_out, std::string *file_base_out = NULL, std::string *file_ext_out = NULL); 32 | std::string MDFN_EvalFIP(const std::string &dir_path, const std::string &rel_path, bool skip_safety_check = false); 33 | #endif 34 | -------------------------------------------------------------------------------- /mednafen/pce/pce.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_PCE_H 2 | #define __MDFN_PCE_PCE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define PCE_MASTER_CLOCK 21477272.727273 12 | 13 | #define DECLFR(x) MDFN_FASTCALL uint8 x (uint32 A) 14 | #define DECLFW(x) MDFN_FASTCALL void x (uint32 A, uint8 V) 15 | 16 | #include "huc6280.h" 17 | 18 | extern HuC6280 HuCPU; 19 | extern uint8 BaseRAM[32768]; 20 | 21 | extern bool PCE_ACEnabled; // Arcade Card emulation enabled? 22 | extern void PCE_Power(void); 23 | 24 | extern MDFN_COLD int PCE_Load(const uint8_t *data, size_t size, const char *ext); 25 | extern MDFN_COLD int PCE_LoadCD(std::vector *CDInterfaces); 26 | extern MDFN_COLD void PCE_CloseGame(void); 27 | 28 | extern void Emulate(EmulateSpecStruct *espec); 29 | extern int StateAction(StateMem *sm, int load, int data_only); 30 | extern void DoSimpleCommand(int cmd); 31 | extern void SettingsChanged(void); 32 | 33 | extern uint8 MemRead(uint32 addr); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /mednafen/mednafen.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEDNAFEN_H 2 | #define _MEDNAFEN_H 3 | 4 | #include "mednafen-types.h" 5 | #include 6 | #include 7 | #include 8 | 9 | #define _(String) (String) 10 | 11 | #include "math_ops.h" 12 | #include "git.h" 13 | 14 | #ifdef _WIN32 15 | #define strcasecmp _stricmp 16 | #endif 17 | 18 | template 19 | static INLINE T min_T(T x, T y) 20 | { 21 | return (x < y) ? x : y; 22 | } 23 | 24 | template 25 | static INLINE T max_T(T x, T y) 26 | { 27 | return (x > y) ? x : y; 28 | } 29 | 30 | template 31 | static INLINE void swap_T(T& t1, T& t2) 32 | { 33 | T tmp(t1); 34 | t1 = t2; 35 | t2 = tmp; 36 | } 37 | 38 | #include "settings.h" 39 | 40 | void MDFN_DispMessage(const char *format, ...); 41 | 42 | void MDFN_LoadGameCheats(void *override); 43 | void MDFN_FlushGameCheats(int nosave); 44 | 45 | void MDFN_MidSync(EmulateSpecStruct *espec); 46 | void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y); 47 | 48 | #include "mednafen-driver.h" 49 | 50 | #include "mednafen-endian.h" 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /mednafen/math_ops.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MATH_OPS_H 2 | #define __MDFN_MATH_OPS_H 3 | 4 | // Some compilers' optimizers and some platforms might fubar the generated code from these macros, 5 | // so some tests are run in...tests.cpp 6 | #define sign_8_to_s16(_value) ((int16)(int8)(_value)) 7 | #define sign_9_to_s16(_value) (((int16)((unsigned int)(_value) << 7)) >> 7) 8 | #define sign_10_to_s16(_value) (((int16)((uint32)(_value) << 6)) >> 6) 9 | #define sign_11_to_s16(_value) (((int16)((uint32)(_value) << 5)) >> 5) 10 | #define sign_12_to_s16(_value) (((int16)((uint32)(_value) << 4)) >> 4) 11 | #define sign_13_to_s16(_value) (((int16)((uint32)(_value) << 3)) >> 3) 12 | #define sign_14_to_s16(_value) (((int16)((uint32)(_value) << 2)) >> 2) 13 | #define sign_15_to_s16(_value) (((int16)((uint32)(_value) << 1)) >> 1) 14 | 15 | // This obviously won't convert higher-than-32 bit numbers to signed 32-bit ;) 16 | // Also, this shouldn't be used for 8-bit and 16-bit signed numbers, since you can 17 | // convert those faster with typecasts... 18 | #define sign_x_to_s32(_bits, _value) (((int32)((uint32)(_value) << (32 - _bits))) >> (32 - _bits)) 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /mednafen/sound/OwlResampler_neon.inc: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // 4 | static INLINE void DoMAC_NEON(float* wave, float* coeffs, int32 count, int32* accum_output) 5 | { 6 | float32x4_t acc0, acc1, acc2, acc3; 7 | acc0 = acc1 = acc2 = acc3 = vdupq_n_f32(0); 8 | 9 | count >>= 4; 10 | 11 | do 12 | { 13 | acc0 = vmlaq_f32(acc0, vld1q_f32(MDFN_ASSUME_ALIGNED(coeffs + 0, sizeof(float32x4_t))), vld1q_f32(wave + 0)); 14 | acc1 = vmlaq_f32(acc1, vld1q_f32(MDFN_ASSUME_ALIGNED(coeffs + 4, sizeof(float32x4_t))), vld1q_f32(wave + 4)); 15 | acc2 = vmlaq_f32(acc2, vld1q_f32(MDFN_ASSUME_ALIGNED(coeffs + 8, sizeof(float32x4_t))), vld1q_f32(wave + 8)); 16 | acc3 = vmlaq_f32(acc3, vld1q_f32(MDFN_ASSUME_ALIGNED(coeffs + 12, sizeof(float32x4_t))), vld1q_f32(wave + 12)); 17 | 18 | coeffs += 16; 19 | wave += 16; 20 | } while(MDFN_LIKELY(--count)); 21 | // 22 | // 23 | // 24 | float32x4_t sum4; 25 | float32x2_t sum2; 26 | 27 | sum4 = vaddq_f32(vaddq_f32(acc0, acc1), vaddq_f32(acc2, acc3)); 28 | sum2 = vadd_f32(vget_high_f32(sum4), vget_low_f32(sum4)); 29 | sum2 = vpadd_f32(sum2, sum2); 30 | 31 | vst1_lane_s32(accum_output, vcvt_s32_f32(sum2), 0); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /intl/crowdin_prep.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import core_option_translation as t 4 | 5 | if __name__ == '__main__': 6 | try: 7 | if t.os.path.isfile(t.sys.argv[1]) or t.sys.argv[1].endswith('.h'): 8 | _temp = t.os.path.dirname(t.sys.argv[1]) 9 | else: 10 | _temp = t.sys.argv[1] 11 | while _temp.endswith('/') or _temp.endswith('\\'): 12 | _temp = _temp[:-1] 13 | TARGET_DIR_PATH = _temp 14 | except IndexError: 15 | TARGET_DIR_PATH = t.os.path.dirname(t.os.path.dirname(t.os.path.realpath(__file__))) 16 | print("No path provided, assuming parent directory:\n" + TARGET_DIR_PATH) 17 | 18 | CORE_NAME = t.clean_file_name(t.sys.argv[2]) 19 | DIR_PATH = t.os.path.dirname(t.os.path.realpath(__file__)) 20 | H_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options.h') 21 | 22 | print('Getting texts from libretro_core_options.h') 23 | with open(H_FILE_PATH, 'r+', encoding='utf-8') as _h_file: 24 | _main_text = _h_file.read() 25 | _hash_n_str = t.get_texts(_main_text) 26 | _files = t.create_msg_hash(DIR_PATH, CORE_NAME, _hash_n_str) 27 | 28 | _source_jsons = t.h2json(_files) 29 | 30 | print('\nAll done!') 31 | -------------------------------------------------------------------------------- /mednafen/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_SETTINGS_H 2 | #define MDFN_SETTINGS_H 3 | 4 | #include 5 | 6 | extern int setting_pce_arcadecard; 7 | extern int setting_pce_initial_scanline; 8 | extern int setting_pce_last_scanline; 9 | extern int setting_pce_nospritelimit; 10 | extern int setting_pce_overclocked; 11 | extern int setting_pce_h_overscan; 12 | extern int setting_pce_crop_h_overscan; 13 | extern int setting_pce_psgrevision; 14 | extern int setting_pce_cddavolume; 15 | extern int setting_pce_adpcmvolume; 16 | extern int setting_pce_cdpsgvolume; 17 | extern int setting_pce_adpcmextraprec; 18 | extern int setting_pce_resamp_quality; 19 | extern int setting_pce_multitap; 20 | extern int setting_pce_scaling; 21 | extern uint32_t setting_pce_cdspeed; 22 | extern std::string setting_pce_cdbios; 23 | extern std::string setting_pce_gecdbios; 24 | 25 | // This should assert() or something if the setting isn't found, since it would 26 | // be a totally tubular error! 27 | uint64 MDFN_GetSettingUI(const char *name); 28 | int64 MDFN_GetSettingI(const char *name); 29 | double MDFN_GetSettingF(const char *name); 30 | bool MDFN_GetSettingB(const char *name); 31 | std::string MDFN_GetSettingS(const char *name); 32 | #endif 33 | -------------------------------------------------------------------------------- /mednafen/tremor/block.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: shared block functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_BLOCK_ 19 | #define _V_BLOCK_ 20 | 21 | extern void _vorbis_block_ripcord(vorbis_block *vb); 22 | extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader_MPC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader_MPC.h: 5 | ** Copyright (C) 2015-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MDFN_CDAFREADER_MPC_H 23 | #define __MDFN_CDAFREADER_MPC_H 24 | 25 | CDAFReader* CDAFR_MPC_Open(Stream* fp); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2018-02-19 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void *MyAlloc(size_t size); 12 | void MyFree(void *address); 13 | 14 | #ifdef _WIN32 15 | 16 | void SetLargePageSize(); 17 | 18 | void *MidAlloc(size_t size); 19 | void MidFree(void *address); 20 | void *BigAlloc(size_t size); 21 | void BigFree(void *address); 22 | 23 | #else 24 | 25 | #define MidAlloc(size) MyAlloc(size) 26 | #define MidFree(address) MyFree(address) 27 | #define BigAlloc(size) MyAlloc(size) 28 | #define BigFree(address) MyFree(address) 29 | 30 | #endif 31 | 32 | extern const ISzAlloc g_Alloc; 33 | extern const ISzAlloc g_BigAlloc; 34 | extern const ISzAlloc g_MidAlloc; 35 | extern const ISzAlloc g_AlignedAlloc; 36 | 37 | 38 | typedef struct 39 | { 40 | ISzAlloc vt; 41 | ISzAllocPtr baseAlloc; 42 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */ 43 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */ 44 | } CAlignOffsetAlloc; 45 | 46 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p); 47 | 48 | 49 | EXTERN_C_END 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /mednafen/tremor/window.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_WINDOW_ 19 | #define _V_WINDOW_ 20 | 21 | extern const void *_vorbis_window(int type,int left); 22 | extern void _vorbis_apply_window(int32_t *d,const void *window[2], 23 | long *blocksizes, 24 | int lW,int W,int nW); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /mednafen/pce/tsushin.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | 19 | #include "pce.h" 20 | 21 | /* 22 | Startup: 23 | 0x80 -> $1830 24 | 0x40 -> $1823 25 | 0x50 -> $1823 26 | 0x02 -> $1821 27 | 0x40 -> $1823 28 | 29 | Read from $1822 16 times, expecting (return value & 0xC0) == 0x80 each time 30 | 31 | 0x50 -> $1823 32 | 0x01 -> $1821 33 | 0x40 -> $1823 34 | 0x04 -> $1822 35 | */ 36 | 37 | DECLFR(PCE_TsushinRead) 38 | { 39 | return(0x80); 40 | } 41 | 42 | DECLFW(PCE_TsushinWrite) 43 | { 44 | } 45 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader_Vorbis.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader_Vorbis.h: 5 | ** Copyright (C) 2015-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MDFN_CDAFREADER_VORBIS_H 23 | #define __MDFN_CDAFREADER_VORBIS_H 24 | 25 | CDAFReader* CDAFR_Vorbis_Open(Stream* fp); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /mednafen/Stream.cpp: -------------------------------------------------------------------------------- 1 | // TODO/WIP 2 | 3 | /* Mednafen - Multi-system Emulator 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "mednafen.h" 21 | #include "Stream.h" 22 | 23 | Stream::Stream() 24 | { 25 | 26 | } 27 | 28 | Stream::~Stream() 29 | { 30 | 31 | } 32 | 33 | int Stream::get_line(std::string &str) 34 | { 35 | uint8 c; 36 | 37 | str.clear(); // or str.resize(0)?? 38 | 39 | while(read(&c, sizeof(c)) > 0) 40 | { 41 | if(c == '\r' || c == '\n' || c == 0) 42 | return(c); 43 | 44 | str.push_back(c); 45 | } 46 | 47 | return(-1); 48 | } 49 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | CORE_DIR := $(LOCAL_PATH)/.. 4 | 5 | DEBUG := 0 6 | FRONTEND_SUPPORTS_RGB565 := 1 7 | NEED_CD := 1 8 | NEED_BPP := 16 9 | NEED_BLIP := 1 10 | NEED_STEREO_SOUND := 1 11 | NEED_THREADING := 1 12 | NEED_TREMOR := 1 13 | NEED_CRC32 := 1 14 | HAVE_CHD := 1 15 | IS_X86 := 0 16 | FLAGS := 17 | 18 | ifeq ($(TARGET_ARCH),x86) 19 | IS_X86 := 1 20 | endif 21 | 22 | include $(CORE_DIR)/Makefile.common 23 | 24 | COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION=\"0.9.48\" -DMEDNAFEN_VERSION_NUMERIC=948 -D__LIBRETRO__ -D_LOW_ACCURACY_ -DINLINE="inline" $(FLAGS) 25 | COREFLAGS += -DWANT_PCE_FAST 26 | 27 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" 28 | ifneq ($(GIT_VERSION)," unknown") 29 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" 30 | endif 31 | 32 | include $(CLEAR_VARS) 33 | LOCAL_MODULE := retro 34 | LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) 35 | LOCAL_CFLAGS := $(COREFLAGS) 36 | LOCAL_CXXFLAGS := $(COREFLAGS) 37 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T 38 | LOCAL_CPP_FEATURES := exceptions 39 | include $(BUILD_SHARED_LIBRARY) 40 | -------------------------------------------------------------------------------- /mednafen/pce/input.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_INPUT_H 2 | #define __MDFN_PCE_INPUT_H 3 | 4 | class PCE_Input_Device 5 | { 6 | public: 7 | // PCE_Input_Device(int which); // "which" is advisory and only should be used in status messages. 8 | virtual ~PCE_Input_Device(); 9 | virtual void TransformInput(uint8* data, const bool DisableSR); 10 | virtual void AdjustTS(int32 delta); 11 | virtual void Write(int32 timestamp, bool old_SEL, bool new_SEL, bool old_CLR, bool new_CLR); 12 | virtual uint8 Read(int32 timestamp); 13 | virtual void Power(int32 timestamp); 14 | virtual void Update(const uint8 *data, bool start_frame); 15 | virtual int StateAction(StateMem *sm, int load, int data_only, const char *section_name); 16 | }; 17 | 18 | void PCEINPUT_Power(int32 timestamp); 19 | void PCEINPUT_Init(void) MDFN_COLD; 20 | void PCEINPUT_SettingChanged(const char *name); 21 | void PCEINPUT_TransformInput(void); 22 | void PCEINPUT_SetInput(unsigned port, const char *type, uint8 *ptr); 23 | 24 | uint8 INPUT_Read(int32 timestamp, unsigned int A); 25 | void INPUT_Write(int32 timestamp, unsigned int A, uint8 V); 26 | void INPUT_Frame(bool start_frame); 27 | int INPUT_StateAction(StateMem *sm, int load, int data_only); 28 | extern const std::vector PCEPortInfo; 29 | void INPUT_AdjustTS(int32 delta_timestamp); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/BraIA64.c: -------------------------------------------------------------------------------- 1 | /* BraIA64.c -- Converter for IA-64 code 2 | 2017-01-26 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "CpuArch.h" 7 | #include "Bra.h" 8 | 9 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 10 | { 11 | SizeT i; 12 | if (size < 16) 13 | return 0; 14 | size -= 16; 15 | i = 0; 16 | do 17 | { 18 | unsigned m = ((UInt32)0x334B0000 >> (data[i] & 0x1E)) & 3; 19 | if (m) 20 | { 21 | m++; 22 | do 23 | { 24 | Byte *p = data + (i + (size_t)m * 5 - 8); 25 | if (((p[3] >> m) & 15) == 5 26 | && (((p[-1] | ((UInt32)p[0] << 8)) >> m) & 0x70) == 0) 27 | { 28 | unsigned raw = GetUi32(p); 29 | unsigned v = raw >> m; 30 | v = (v & 0xFFFFF) | ((v & (1 << 23)) >> 3); 31 | 32 | v <<= 4; 33 | if (encoding) 34 | v += ip + (UInt32)i; 35 | else 36 | v -= ip + (UInt32)i; 37 | v >>= 4; 38 | 39 | v &= 0x1FFFFF; 40 | v += 0x700000; 41 | v &= 0x8FFFFF; 42 | raw &= ~((UInt32)0x8FFFFF << m); 43 | raw |= (v << m); 44 | SetUi32(p, raw); 45 | } 46 | } 47 | while (++m <= 4); 48 | } 49 | i += 16; 50 | } 51 | while (i <= size); 52 | return i; 53 | } 54 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Compiler.h: -------------------------------------------------------------------------------- 1 | /* Compiler.h 2 | 2017-04-03 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_COMPILER_H 5 | #define __7Z_COMPILER_H 6 | 7 | #ifdef _MSC_VER 8 | 9 | #ifdef UNDER_CE 10 | #define RPC_NO_WINDOWS_H 11 | /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */ 12 | #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 13 | #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int 14 | #endif 15 | 16 | #if _MSC_VER >= 1300 17 | #pragma warning(disable : 4996) // This function or variable may be unsafe 18 | #else 19 | #pragma warning(disable : 4511) // copy constructor could not be generated 20 | #pragma warning(disable : 4512) // assignment operator could not be generated 21 | #pragma warning(disable : 4514) // unreferenced inline function has been removed 22 | #pragma warning(disable : 4702) // unreachable code 23 | #pragma warning(disable : 4710) // not inlined 24 | #pragma warning(disable : 4714) // function marked as __forceinline not inlined 25 | #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information 26 | #endif 27 | 28 | #endif 29 | 30 | #define UNUSED_VAR(x) (void)x; 31 | /* #define UNUSED_VAR(x) x=x; */ 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /intl/remove_initial_cycle.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | with open('intl/upload_workflow.py', 'r') as workflow: 4 | workflow_config = workflow.read() 5 | 6 | workflow_config = workflow_config.replace( 7 | "subprocess.run(['python3', 'intl/core_option_translation.py', dir_path, core_name])", 8 | "subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name])" 9 | ) 10 | workflow_config = workflow_config.replace( 11 | "subprocess.run(['python3', 'intl/initial_sync.py', api_key, core_name])", 12 | "subprocess.run(['python3', 'intl/crowdin_source_upload.py', api_key, core_name])" 13 | ) 14 | with open('intl/upload_workflow.py', 'w') as workflow: 15 | workflow.write(workflow_config) 16 | 17 | 18 | with open('intl/download_workflow.py', 'r') as workflow: 19 | workflow_config = workflow.read() 20 | 21 | workflow_config = workflow_config.replace( 22 | "subprocess.run(['python3', 'intl/core_option_translation.py', dir_path, core_name])", 23 | "subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name])" 24 | ) 25 | workflow_config = workflow_config.replace( 26 | "subprocess.run(['python3', 'intl/initial_sync.py', api_key, core_name])", 27 | "subprocess.run(['python3', 'intl/crowdin_translation_download.py', api_key, core_name])" 28 | ) 29 | with open('intl/download_workflow.py', 'w') as workflow: 30 | workflow.write(workflow_config) 31 | -------------------------------------------------------------------------------- /mednafen/hw_misc/arcade_card/arcade_card.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_ARCADE_CARD_H 2 | #define __MDFN_PCE_ARCADE_CARD_H 3 | 4 | typedef struct 5 | { 6 | uint32 base; // 24 bits 7 | uint16 offset; // 16 bits 8 | uint16 increment; // 16 bits 9 | uint8 control; // 7 bits 10 | } ACPort_t; 11 | 12 | typedef struct 13 | { 14 | ACPort_t ports[4]; 15 | uint32 shift_latch; // 32 bits 16 | uint8 shift_bits; // signed 4-bit value 17 | uint8 rotate_bits; // same 18 | } ArcadeCard_t; 19 | 20 | class ArcadeCard 21 | { 22 | public: 23 | 24 | ArcadeCard(void); 25 | ~ArcadeCard(); 26 | 27 | void Power(void); 28 | int StateAction(StateMem *sm, int load, int data_only); 29 | 30 | uint8 Read(uint32 A, bool peek = false); // Pass peek as true if you don't want side-effects from this read(IE in a debugger). 31 | void Write(uint32 A, uint8 V); 32 | 33 | INLINE void PhysWrite(uint32 A, uint8 V) 34 | { 35 | Write(0x1a00 | ((A >> 9) & 0x30), V); 36 | } 37 | 38 | INLINE uint8 PhysRead(uint32 A, bool peek = false) 39 | { 40 | return(Read(0x1a00 | ((A >> 9) & 0x30), peek)); 41 | } 42 | 43 | 44 | void PeekRAM(uint32 Address, uint32 Length, uint8 *Buffer); 45 | void PokeRAM(uint32 Address, uint32 Length, const uint8 *Buffer); 46 | 47 | private: 48 | 49 | ArcadeCard_t AC; 50 | 51 | bool ACRAMUsed; 52 | uint8 ACRAM[0x200000]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /deps/zstd/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "zstd", 8 | platforms: [ 9 | .macOS(.v10_10), .iOS(.v9), .tvOS(.v9) 10 | ], 11 | products: [ 12 | // Products define the executables and libraries a package produces, and make them visible to other packages. 13 | .library( 14 | name: "libzstd", 15 | targets: [ "libzstd" ]) 16 | ], 17 | dependencies: [ 18 | // Dependencies declare other packages that this package depends on. 19 | // .package(url: /* package url */, from: "1.0.0"), 20 | ], 21 | targets: [ 22 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 23 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 24 | .target( 25 | name: "libzstd", 26 | path: "lib", 27 | sources: [ "common", "compress", "decompress", "dictBuilder" ], 28 | publicHeadersPath: ".", 29 | cSettings: [ 30 | .headerSearchPath(".") 31 | ]) 32 | ], 33 | swiftLanguageVersions: [.v5], 34 | cLanguageStandard: .gnu11, 35 | cxxLanguageStandard: .gnucxx14 36 | ) 37 | -------------------------------------------------------------------------------- /mednafen/cputest/cputest.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include "cputest.h" 20 | #ifdef HAVE_CONFIG_H 21 | #include 22 | #endif 23 | 24 | static int flags, checked = 0; 25 | 26 | 27 | void cputest_force_flags(int arg) 28 | { 29 | flags = arg; 30 | checked = 1; 31 | } 32 | 33 | int cputest_get_flags(void) 34 | { 35 | if (checked) 36 | return flags; 37 | 38 | // if (ARCH_ARM) flags = ff_get_cpu_flags_arm(); 39 | #if ARCH_POWERPC 40 | flags = ff_get_cpu_flags_ppc(); 41 | #endif 42 | 43 | #if ARCH_X86 44 | flags = ff_get_cpu_flags_x86(); 45 | #endif 46 | 47 | checked = 1; 48 | return flags; 49 | } 50 | -------------------------------------------------------------------------------- /mednafen/mempatcher-driver.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEMPATCHER_DRIVER_H 2 | #define __MDFN_MEMPATCHER_DRIVER_H 3 | 4 | int MDFNI_DecodePAR(const char *code, uint32 *a, uint8 *v, uint8 *c, char *type); 5 | int MDFNI_DecodeGG(const char *str, uint32 *a, uint8 *v, uint8 *c, char *type); 6 | int MDFNI_AddCheat(const char *name, uint32 addr, uint64 val, uint64 compare, char type, unsigned int length, bool bigendian); 7 | int MDFNI_DelCheat(uint32 which); 8 | int MDFNI_ToggleCheat(uint32 which); 9 | 10 | int32 MDFNI_CheatSearchGetCount(void); 11 | void MDFNI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current)); 12 | void MDFNI_CheatSearchGet(int (*callb)(uint32 a, uint64 last, uint64 current, void *data), void *data); 13 | void MDFNI_CheatSearchBegin(void); 14 | void MDFNI_CheatSearchEnd(int type, uint64 v1, uint64 v2, unsigned int bytelen, bool bigendian); 15 | void MDFNI_ListCheats(int (*callb)(char *name, uint32 a, uint64 v, uint64 compare, int s, char type, unsigned int length, bool bigendian, void *data), void *data); 16 | 17 | int MDFNI_GetCheat(uint32 which, char **name, uint32 *a, uint64 *v, uint64 *compare, int *s, char *type, unsigned int *length, bool *bigendian); 18 | int MDFNI_SetCheat(uint32 which, const char *name, uint32 a, uint64 v, uint64 compare, int s, char type, unsigned int length, bool bigendian); 19 | 20 | void MDFNI_CheatSearchShowExcluded(void); 21 | void MDFNI_CheatSearchSetCurrentAsOriginal(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/libretro/beetle-pce-libretro.svg?branch=master)](https://travis-ci.org/libretro/beetle-pce-libretro) 2 | 3 | # Beetle PC Engine libretro 4 | 5 | Beetle PC Engine is a port/fork of Mednafen's PC Engine "pce" module to the libretro API. This core supports both CD-ROM2 and SuperGrafx emulation. 6 | 7 | This PC Engine module is more accurate than the Fast module, which trades away typically unneeded accuracy in favor of speed. Unlike [Beetle PCE Fast](https://github.com/libretro/beetle-pce-fast-libretro), Beetle PCE retains built-in SuperGrafx support. SuperGrafx support can alternatively be found in the [Beetle SuperGrafx core](https://github.com/libretro/beetle-supergrafx-libretro). 8 | 9 | Features: 10 | - Sub-instruction timing granularity (but greater than cycle granularity) 11 | - All sprite sizes supported. 12 | - 16-sprites per line limit emulated. 13 | - Accurate HuC6280 flags emulation. 14 | - Dot-clock emulation for more accurate aspect ratios. 15 | - Support for Street Fighter 2's HuCard hardware. 16 | - Support for Populous's backup RAM. 17 | - 6-button pad emulation. 18 | - Mouse emulation. 19 | - Working CD+G playback. 20 | 21 | ## Building 22 | 23 | This core can be built with `make`. 24 | 25 | ## Documentation 26 | 27 | TBD 28 | 29 | ## Related Cores 30 | 31 | Beetle PC Engine Fast: https://github.com/libretro/beetle-pce-fast-libretro 32 | 33 | Beetle SuperGrafx: https://github.com/libretro/beetle-supergrafx-libretro 34 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Lzma86Dec.c: -------------------------------------------------------------------------------- 1 | /* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder 2 | 2016-05-16 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Lzma86.h" 7 | 8 | #include "Alloc.h" 9 | #include "Bra.h" 10 | #include "LzmaDec.h" 11 | 12 | SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) 13 | { 14 | unsigned i; 15 | if (srcLen < LZMA86_HEADER_SIZE) 16 | return SZ_ERROR_INPUT_EOF; 17 | *unpackSize = 0; 18 | for (i = 0; i < sizeof(UInt64); i++) 19 | *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i); 20 | return SZ_OK; 21 | } 22 | 23 | SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) 24 | { 25 | SRes res; 26 | int useFilter; 27 | SizeT inSizePure; 28 | ELzmaStatus status; 29 | 30 | if (*srcLen < LZMA86_HEADER_SIZE) 31 | return SZ_ERROR_INPUT_EOF; 32 | 33 | useFilter = src[0]; 34 | 35 | if (useFilter > 1) 36 | { 37 | *destLen = 0; 38 | return SZ_ERROR_UNSUPPORTED; 39 | } 40 | 41 | inSizePure = *srcLen - LZMA86_HEADER_SIZE; 42 | res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure, 43 | src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc); 44 | *srcLen = inSizePure + LZMA86_HEADER_SIZE; 45 | if (res != SZ_OK) 46 | return res; 47 | if (useFilter == 1) 48 | { 49 | UInt32 x86State; 50 | x86_Convert_Init(x86State); 51 | x86_Convert(dest, *destLen, 0, &x86State, 0); 52 | } 53 | return SZ_OK; 54 | } 55 | -------------------------------------------------------------------------------- /mednafen/sound/okiadpcm.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "mednafen.h" 19 | #include "okiadpcm.h" 20 | #include 21 | 22 | const int OKIADPCM_StepSizes[49] = 23 | { 24 | 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 25 | 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 26 | 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 27 | 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 28 | }; 29 | 30 | const int OKIADPCM_StepIndexDeltas[16] = 31 | { 32 | -1, -1, -1, -1, 2, 4, 6, 8, 33 | -1, -1, -1, -1, 2, 4, 6, 8 34 | }; 35 | 36 | const int32 OKIADPCM_DeltaTable[49][16] = 37 | { 38 | #ifndef OKIADPCM_GENERATE_DELTATABLE 39 | #include "okiadpcm-deltatable.h" 40 | #endif 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /deps/zstd/lib/decompress/zstd_ddict.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | 12 | #ifndef ZSTD_DDICT_H 13 | #define ZSTD_DDICT_H 14 | 15 | /*-******************************************************* 16 | * Dependencies 17 | *********************************************************/ 18 | #include "../common/zstd_deps.h" /* size_t */ 19 | #include "../zstd.h" /* ZSTD_DDict, and several public functions */ 20 | 21 | 22 | /*-******************************************************* 23 | * Interface 24 | *********************************************************/ 25 | 26 | /* note: several prototypes are already published in `zstd.h` : 27 | * ZSTD_createDDict() 28 | * ZSTD_createDDict_byReference() 29 | * ZSTD_createDDict_advanced() 30 | * ZSTD_freeDDict() 31 | * ZSTD_initStaticDDict() 32 | * ZSTD_sizeof_DDict() 33 | * ZSTD_estimateDDictSize() 34 | * ZSTD_getDictID_fromDict() 35 | */ 36 | 37 | const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict); 38 | size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict); 39 | 40 | void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); 41 | 42 | 43 | 44 | #endif /* ZSTD_DDICT_H */ 45 | -------------------------------------------------------------------------------- /mednafen/FileStream.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | // TODO/WIP 19 | 20 | #ifndef __MDFN_FILESTREAM_H 21 | #define __MDFN_FILESTREAM_H 22 | 23 | #include 24 | 25 | #include "Stream.h" 26 | 27 | class FileStream : public Stream 28 | { 29 | public: 30 | FileStream(const char *path, const int mode); 31 | virtual ~FileStream(); 32 | 33 | virtual uint64_t read(void *data, uint64_t count); 34 | virtual void write(const void *data, uint64_t count); 35 | virtual void seek(int64_t offset, int whence); 36 | virtual int64_t tell(void); 37 | virtual int64_t size(void); 38 | virtual void close(void); 39 | 40 | private: 41 | RFILE *fp; 42 | }; 43 | 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Delta.c: -------------------------------------------------------------------------------- 1 | /* Delta.c -- Delta converter 2 | 2009-05-26 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Delta.h" 7 | 8 | void Delta_Init(Byte *state) 9 | { 10 | unsigned i; 11 | for (i = 0; i < DELTA_STATE_SIZE; i++) 12 | state[i] = 0; 13 | } 14 | 15 | static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) 16 | { 17 | unsigned i; 18 | for (i = 0; i < size; i++) 19 | dest[i] = src[i]; 20 | } 21 | 22 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size) 23 | { 24 | Byte buf[DELTA_STATE_SIZE]; 25 | unsigned j = 0; 26 | MyMemCpy(buf, state, delta); 27 | { 28 | SizeT i; 29 | for (i = 0; i < size;) 30 | { 31 | for (j = 0; j < delta && i < size; i++, j++) 32 | { 33 | Byte b = data[i]; 34 | data[i] = (Byte)(b - buf[j]); 35 | buf[j] = b; 36 | } 37 | } 38 | } 39 | if (j == delta) 40 | j = 0; 41 | MyMemCpy(state, buf + j, delta - j); 42 | MyMemCpy(state + delta - j, buf, j); 43 | } 44 | 45 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) 46 | { 47 | Byte buf[DELTA_STATE_SIZE]; 48 | unsigned j = 0; 49 | MyMemCpy(buf, state, delta); 50 | { 51 | SizeT i; 52 | for (i = 0; i < size;) 53 | { 54 | for (j = 0; j < delta && i < size; i++, j++) 55 | { 56 | buf[j] = data[i] = (Byte)(buf[j] + data[i]); 57 | } 58 | } 59 | } 60 | if (j == delta) 61 | j = 0; 62 | MyMemCpy(state, buf + j, delta - j); 63 | MyMemCpy(state + delta - j, buf, j); 64 | } 65 | -------------------------------------------------------------------------------- /mednafen/tremor/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002, Xiph.org Foundation 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the Xiph.org Foundation nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /deps/libchdr/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright Romain Tisserand 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /mednafen/cdrom/galois-inlines.h: -------------------------------------------------------------------------------- 1 | /* dvdisaster: Additional error correction for optical media. 2 | * Copyright (C) 2004-2007 Carsten Gnoerlich. 3 | * Project home page: http://www.dvdisaster.com 4 | * Email: carsten@dvdisaster.com -or- cgnoerlich@fsfe.org 5 | * 6 | * The Reed-Solomon error correction draws a lot of inspiration - and even code - 7 | * from Phil Karn's excellent Reed-Solomon library: http://www.ka9q.net/code/fec/ 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, 22 | * or direct your browser at http://www.gnu.org. 23 | */ 24 | 25 | #include "dvdisaster.h" 26 | 27 | /* 28 | * The following routine is performance critical. 29 | */ 30 | 31 | static inline int mod_fieldmax(int x) 32 | { 33 | while (x >= GF_FIELDMAX) 34 | { 35 | x -= GF_FIELDMAX; 36 | x = (x >> GF_SYMBOLSIZE) + (x & GF_FIELDMAX); 37 | } 38 | 39 | return x; 40 | } 41 | -------------------------------------------------------------------------------- /mednafen/tremor/os.h: -------------------------------------------------------------------------------- 1 | #ifndef _OS_H 2 | #define _OS_H 3 | /******************************************************************** 4 | * * 5 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 6 | * * 7 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 8 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 9 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 10 | * * 11 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 12 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 13 | * * 14 | ******************************************************************** 15 | 16 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 17 | 18 | ********************************************************************/ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #ifndef M_PI 26 | # define M_PI (3.1415926536f) 27 | #endif 28 | 29 | #ifdef _WIN32 30 | # include 31 | # define rint(x) (floor((x)+0.5f)) 32 | # define NO_FLOAT_MATH_LIB 33 | # define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b)) 34 | #endif 35 | 36 | #ifdef HAVE_ALLOCA_H 37 | # include 38 | #endif 39 | 40 | #ifdef USE_MEMORY_H 41 | # include 42 | #endif 43 | 44 | #endif /* _OS_H */ 45 | -------------------------------------------------------------------------------- /mednafen/tremor/registry.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for time, floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_REG_H_ 19 | #define _V_REG_H_ 20 | 21 | #define VI_TRANSFORMB 1 22 | #define VI_WINDOWB 1 23 | #define VI_TIMEB 1 24 | #define VI_FLOORB 2 25 | #define VI_RESB 3 26 | #define VI_MAPB 1 27 | 28 | #include "backends.h" 29 | 30 | #if defined(_WIN32) && defined(VORBISDLL_IMPORT) 31 | # define EXTERN __declspec(dllimport) extern 32 | #else 33 | # define EXTERN extern 34 | #endif 35 | 36 | EXTERN vorbis_func_floor *_floor_P[]; 37 | EXTERN vorbis_func_residue *_residue_P[]; 38 | EXTERN vorbis_func_mapping *_mapping_P[]; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /deps/libchdr/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 | -------------------------------------------------------------------------------- /deps/zstd/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Zstandard software 4 | 5 | Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook, nor Meta, nor the names of its contributors may 18 | be used to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /mednafen/tremor/mdct.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: modified discrete cosine transform prototypes 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _OGG_mdct_H_ 19 | #define _OGG_mdct_H_ 20 | 21 | #include "ivorbiscodec.h" 22 | #include "misc.h" 23 | 24 | #define DATA_TYPE int32_t 25 | #define REG_TYPE register int32_t 26 | 27 | #ifdef _LOW_ACCURACY_ 28 | #define cPI3_8 (0x0062) 29 | #define cPI2_8 (0x00b5) 30 | #define cPI1_8 (0x00ed) 31 | #else 32 | #define cPI3_8 (0x30fbc54d) 33 | #define cPI2_8 (0x5a82799a) 34 | #define cPI1_8 (0x7641af3d) 35 | #endif 36 | 37 | extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out); 38 | extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out); 39 | 40 | #endif 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /libretro-common/include/compat/fnmatch.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /intl/crowdin_translate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import core_option_translation as t 4 | 5 | if __name__ == '__main__': 6 | try: 7 | if t.os.path.isfile(t.sys.argv[1]) or t.sys.argv[1].endswith('.h'): 8 | _temp = t.os.path.dirname(t.sys.argv[1]) 9 | else: 10 | _temp = t.sys.argv[1] 11 | while _temp.endswith('/') or _temp.endswith('\\'): 12 | _temp = _temp[:-1] 13 | TARGET_DIR_PATH = _temp 14 | except IndexError: 15 | TARGET_DIR_PATH = t.os.path.dirname(t.os.path.dirname(t.os.path.realpath(__file__))) 16 | print("No path provided, assuming parent directory:\n" + TARGET_DIR_PATH) 17 | 18 | CORE_NAME = t.clean_file_name(t.sys.argv[2]) 19 | DIR_PATH = t.os.path.dirname(t.os.path.realpath(__file__)) 20 | LOCALISATIONS_PATH = t.os.path.join(DIR_PATH, CORE_NAME) 21 | US_FILE_PATH = t.os.path.join(LOCALISATIONS_PATH, '_us.h') 22 | H_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options.h') 23 | INTL_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options_intl.h') 24 | 25 | print('Getting texts from libretro_core_options.h') 26 | with open(H_FILE_PATH, 'r+', encoding='utf-8') as _h_file: 27 | _main_text = _h_file.read() 28 | _hash_n_str = t.get_texts(_main_text) 29 | _files = t.create_msg_hash(DIR_PATH, CORE_NAME, _hash_n_str) 30 | _source_jsons = t.h2json(_files) 31 | 32 | print('Converting translations *.json to *.h:') 33 | localisation_files = t.os.scandir(LOCALISATIONS_PATH) 34 | t.json2h(LOCALISATIONS_PATH, localisation_files) 35 | 36 | print('Constructing libretro_core_options_intl.h') 37 | t.create_intl_file(INTL_FILE_PATH, LOCALISATIONS_PATH, _main_text, _files["_us"]) 38 | 39 | print('\nAll done!') 40 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/coretypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __CORETYPES_H__ 2 | #define __CORETYPES_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #ifdef USE_LIBRETRO_VFS 8 | #include 9 | #endif 10 | 11 | #ifndef ARRAY_LENGTH 12 | #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) 13 | #endif 14 | 15 | typedef struct chd_core_file { 16 | /* 17 | * arbitrary pointer to data the implementation uses to implement the below functions 18 | */ 19 | void *argp; 20 | 21 | /* 22 | * return the size of a given file as a 64-bit unsigned integer. 23 | * the position of the file pointer after calling this function is 24 | * undefined because many implementations will seek to the end of the 25 | * file and call ftell. 26 | * 27 | * on error, (uint64_t)-1 is returned. 28 | */ 29 | uint64_t(*fsize)(struct chd_core_file*); 30 | 31 | /* 32 | * should match the behavior of fread, except the FILE* argument at the end 33 | * will be replaced with a struct chd_core_file*. 34 | */ 35 | size_t(*fread)(void*,size_t,size_t,struct chd_core_file*); 36 | 37 | /* closes the given file. */ 38 | int (*fclose)(struct chd_core_file*); 39 | 40 | /* fseek clone */ 41 | int (*fseek)(struct chd_core_file*, int64_t, int); 42 | } core_file; 43 | 44 | static INLINE int core_fclose(core_file *fp) { 45 | return fp->fclose(fp); 46 | } 47 | 48 | static INLINE size_t core_fread(core_file *fp, void *ptr, size_t len) { 49 | return fp->fread(ptr, 1, len, fp); 50 | } 51 | 52 | static INLINE int core_fseek(core_file* fp, int64_t offset, int whence) { 53 | return fp->fseek(fp, offset, whence); 54 | } 55 | 56 | static INLINE uint64_t core_fsize(core_file *fp) 57 | { 58 | return fp->fsize(fp); 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /libretro-common/include/encodings/crc32.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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/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-common/include/memalign.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess_CCD.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAccess_CCD.h: 5 | ** Copyright (C) 2013-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "CDAccess.h" 26 | 27 | class CDAccess_CCD : public CDAccess 28 | { 29 | public: 30 | 31 | CDAccess_CCD(const std::string& path, bool image_memcache); 32 | virtual ~CDAccess_CCD(); 33 | 34 | virtual bool Read_Raw_Sector(uint8 *buf, int32 lba); 35 | 36 | virtual bool Fast_Read_Raw_PW_TSRE(uint8* pwbuf, int32 lba); 37 | 38 | virtual bool Read_TOC(TOC *toc); 39 | 40 | private: 41 | 42 | bool Load(const std::string& path, bool image_memcache); 43 | void Cleanup(void); 44 | 45 | bool CheckSubQSanity(void); 46 | 47 | Stream *img_stream; 48 | uint8_t *sub_data; 49 | 50 | size_t img_numsectors; 51 | TOC tocd; 52 | }; 53 | -------------------------------------------------------------------------------- /mednafen/video.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_VIDEO_H 2 | #define __MDFN_VIDEO_H 3 | 4 | #include 5 | 6 | #if defined(WANT_32BPP) 7 | #define RED_SHIFT 16 8 | #define GREEN_SHIFT 8 9 | #define BLUE_SHIFT 0 10 | #define ALPHA_SHIFT 24 11 | #define MAKECOLOR(r, g, b, a) ((r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT) | (a << ALPHA_SHIFT)) 12 | typedef uint32_t bpp_t; 13 | #elif defined(FRONTEND_SUPPORTS_RGB565) 14 | /* 16bit color - RGB565 */ 15 | #define RED_MASK 0xf800 16 | #define GREEN_MASK 0x7e0 17 | #define BLUE_MASK 0x1f 18 | #define RED_EXPAND 3 19 | #define GREEN_EXPAND 2 20 | #define BLUE_EXPAND 3 21 | #define RED_SHIFT 11 22 | #define GREEN_SHIFT 5 23 | #define BLUE_SHIFT 0 24 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) 25 | typedef uint16_t bpp_t; 26 | #else 27 | /* 16bit color - RGB555 */ 28 | #define RED_MASK 0x7c00 29 | #define GREEN_MASK 0x3e0 30 | #define BLUE_MASK 0x1f 31 | #define RED_EXPAND 3 32 | #define GREEN_EXPAND 3 33 | #define BLUE_EXPAND 3 34 | #define RED_SHIFT 10 35 | #define GREEN_SHIFT 5 36 | #define BLUE_SHIFT 0 37 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) 38 | typedef uint16_t bpp_t; 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef struct 46 | { 47 | int32_t x, y, w, h; 48 | } MDFN_Rect; 49 | 50 | typedef struct 51 | { 52 | unsigned int colorspace; 53 | uint8_t r_shift; 54 | uint8_t g_shift; 55 | uint8_t b_shift; 56 | uint8_t a_shift; 57 | } MDFN_PixelFormat; 58 | 59 | typedef struct 60 | { 61 | bpp_t *pixels; 62 | int32_t width; 63 | int32_t height; 64 | int32_t pitch; 65 | } MDFN_Surface; 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /.github/workflows/crowdin_translate.yml: -------------------------------------------------------------------------------- 1 | # Download translations form Crowdin & Recreate libretro_core_options_intl.h 2 | 3 | name: Crowdin Translation Integration 4 | 5 | on: 6 | schedule: 7 | # please choose a random time & weekday to avoid all repos synching at the same time 8 | - cron: '5 0 * * 5' # Fridays at 0:5 AM, UTC 9 | 10 | jobs: 11 | create_intl_file: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Setup Java JDK 15 | uses: actions/setup-java@v3 16 | with: 17 | java-version: 18 18 | distribution: zulu 19 | 20 | - name: Setup Python 21 | uses: actions/setup-python@v4 22 | with: 23 | python-version: '3.10' 24 | 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | with: 28 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. 29 | fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. 30 | 31 | - name: Create intl file 32 | shell: bash 33 | env: 34 | CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} 35 | run: | 36 | python3 intl/download_workflow.py $CROWDIN_API_KEY "beetle-pce-libretro" "libretro_core_options_intl.h" 37 | 38 | - name: Commit files 39 | run: | 40 | git config --local user.email "github-actions@github.com" 41 | git config --local user.name "github-actions[bot]" 42 | git add intl/*_workflow.py "libretro_core_options_intl.h" 43 | git commit -m "Fetch translations & Recreate libretro_core_options_intl.h" 44 | 45 | - name: GitHub Push 46 | uses: ad-m/github-push-action@v0.6.0 47 | with: 48 | github_token: ${{ secrets.GITHUB_TOKEN }} 49 | branch: ${{ github.ref }} 50 | -------------------------------------------------------------------------------- /deps/zstd/lib/common/allocations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | /* This file provides custom allocation primitives 12 | */ 13 | 14 | #define ZSTD_DEPS_NEED_MALLOC 15 | #include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */ 16 | 17 | #include "mem.h" /* MEM_STATIC */ 18 | #define ZSTD_STATIC_LINKING_ONLY 19 | #include "../zstd.h" /* ZSTD_customMem */ 20 | 21 | #ifndef ZSTD_ALLOCATIONS_H 22 | #define ZSTD_ALLOCATIONS_H 23 | 24 | /* custom memory allocation functions */ 25 | 26 | MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem) 27 | { 28 | if (customMem.customAlloc) 29 | return customMem.customAlloc(customMem.opaque, size); 30 | return ZSTD_malloc(size); 31 | } 32 | 33 | MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem) 34 | { 35 | if (customMem.customAlloc) { 36 | /* calloc implemented as malloc+memset; 37 | * not as efficient as calloc, but next best guess for custom malloc */ 38 | void* const ptr = customMem.customAlloc(customMem.opaque, size); 39 | ZSTD_memset(ptr, 0, size); 40 | return ptr; 41 | } 42 | return ZSTD_calloc(1, size); 43 | } 44 | 45 | MEM_STATIC void ZSTD_customFree(void* ptr, ZSTD_customMem customMem) 46 | { 47 | if (ptr!=NULL) { 48 | if (customMem.customFree) 49 | customMem.customFree(customMem.opaque, ptr); 50 | else 51 | ZSTD_free(ptr); 52 | } 53 | } 54 | 55 | #endif /* ZSTD_ALLOCATIONS_H */ 56 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/zlib.map: -------------------------------------------------------------------------------- 1 | ZLIB_1.2.0 { 2 | global: 3 | compressBound; 4 | deflateBound; 5 | inflateBack; 6 | inflateBackEnd; 7 | inflateBackInit_; 8 | inflateCopy; 9 | local: 10 | deflate_copyright; 11 | inflate_copyright; 12 | inflate_fast; 13 | inflate_table; 14 | zcalloc; 15 | zcfree; 16 | z_errmsg; 17 | gz_error; 18 | gz_intmax; 19 | _*; 20 | }; 21 | 22 | ZLIB_1.2.0.2 { 23 | gzclearerr; 24 | gzungetc; 25 | zlibCompileFlags; 26 | } ZLIB_1.2.0; 27 | 28 | ZLIB_1.2.0.8 { 29 | deflatePrime; 30 | } ZLIB_1.2.0.2; 31 | 32 | ZLIB_1.2.2 { 33 | adler32_combine; 34 | crc32_combine; 35 | deflateSetHeader; 36 | inflateGetHeader; 37 | } ZLIB_1.2.0.8; 38 | 39 | ZLIB_1.2.2.3 { 40 | deflateTune; 41 | gzdirect; 42 | } ZLIB_1.2.2; 43 | 44 | ZLIB_1.2.2.4 { 45 | inflatePrime; 46 | } ZLIB_1.2.2.3; 47 | 48 | ZLIB_1.2.3.3 { 49 | adler32_combine64; 50 | crc32_combine64; 51 | gzopen64; 52 | gzseek64; 53 | gztell64; 54 | inflateUndermine; 55 | } ZLIB_1.2.2.4; 56 | 57 | ZLIB_1.2.3.4 { 58 | inflateReset2; 59 | inflateMark; 60 | } ZLIB_1.2.3.3; 61 | 62 | ZLIB_1.2.3.5 { 63 | gzbuffer; 64 | gzoffset; 65 | gzoffset64; 66 | gzclose_r; 67 | gzclose_w; 68 | } ZLIB_1.2.3.4; 69 | 70 | ZLIB_1.2.5.1 { 71 | deflatePending; 72 | } ZLIB_1.2.3.5; 73 | 74 | ZLIB_1.2.5.2 { 75 | deflateResetKeep; 76 | gzgetc_; 77 | inflateResetKeep; 78 | } ZLIB_1.2.5.1; 79 | 80 | ZLIB_1.2.7.1 { 81 | inflateGetDictionary; 82 | gzvprintf; 83 | } ZLIB_1.2.5.2; 84 | 85 | ZLIB_1.2.9 { 86 | inflateCodesUsed; 87 | inflateValidate; 88 | uncompress2; 89 | gzfread; 90 | gzfwrite; 91 | deflateGetDictionary; 92 | adler32_z; 93 | crc32_z; 94 | } ZLIB_1.2.7.1; 95 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /deps/zstd/lib/common/zstd_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under both the BSD-style license (found in the 6 | * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7 | * in the COPYING file in the root directory of this source tree). 8 | * You may select, at your option, one of the above-listed licenses. 9 | */ 10 | 11 | 12 | 13 | /*-************************************* 14 | * Dependencies 15 | ***************************************/ 16 | #define ZSTD_DEPS_NEED_MALLOC 17 | #include "error_private.h" 18 | #include "zstd_internal.h" 19 | 20 | 21 | /*-**************************************** 22 | * Version 23 | ******************************************/ 24 | unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; } 25 | 26 | const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; } 27 | 28 | 29 | /*-**************************************** 30 | * ZSTD Error Management 31 | ******************************************/ 32 | #undef ZSTD_isError /* defined within zstd_internal.h */ 33 | /*! ZSTD_isError() : 34 | * tells if a return value is an error code 35 | * symbol is required for external callers */ 36 | unsigned ZSTD_isError(size_t code) { return ERR_isError(code); } 37 | 38 | /*! ZSTD_getErrorName() : 39 | * provides error code string from function result (useful for debugging) */ 40 | const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); } 41 | 42 | /*! ZSTD_getError() : 43 | * convert a `size_t` function result into a proper ZSTD_errorCode enum */ 44 | ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } 45 | 46 | /*! ZSTD_getErrorString() : 47 | * provides error code string from enum */ 48 | const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); } 49 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "../mednafen.h" 19 | #include "CDAccess.h" 20 | #include "CDAccess_Image.h" 21 | #include "CDAccess_CCD.h" 22 | #ifdef HAVE_PBP 23 | #include "CDAccess_PBP.h" 24 | #endif 25 | #ifdef HAVE_CHD 26 | #include "CDAccess_CHD.h" 27 | #endif 28 | 29 | CDAccess::CDAccess() 30 | { 31 | 32 | } 33 | 34 | CDAccess::~CDAccess() 35 | { 36 | 37 | } 38 | 39 | CDAccess* CDAccess_Open(const std::string& path, bool image_memcache) 40 | { 41 | CDAccess *ret = NULL; 42 | 43 | if(path.size() >= 4 && !strcasecmp(path.c_str() + path.size() - 4, ".ccd")) 44 | ret = new CDAccess_CCD(path, image_memcache); 45 | #ifdef HAVE_PBP 46 | else if(path.size() >= 4 && !strcasecmp(path.c_str() + path.size() - 4, ".pbp")) 47 | ret = new CDAccess_PBP(path, image_memcache); 48 | #endif 49 | #ifdef HAVE_CHD 50 | else if(path.size() >= 4 && !strcasecmp(path.c_str() + path.size() - 4, ".chd")) 51 | ret = new CDAccess_CHD(path, image_memcache); 52 | #endif 53 | else 54 | ret = new CDAccess_Image(path, image_memcache); 55 | 56 | return ret; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/tremor/registry.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #include "ivorbiscodec.h" 19 | #include "codec_internal.h" 20 | #include "registry.h" 21 | #include "misc.h" 22 | 23 | 24 | /* seems like major overkill now; the backend numbers will grow into 25 | the infrastructure soon enough */ 26 | 27 | extern vorbis_func_floor floor0_exportbundle; 28 | extern vorbis_func_floor floor1_exportbundle; 29 | extern vorbis_func_residue residue0_exportbundle; 30 | extern vorbis_func_residue residue1_exportbundle; 31 | extern vorbis_func_residue residue2_exportbundle; 32 | extern vorbis_func_mapping mapping0_exportbundle; 33 | 34 | vorbis_func_floor *_floor_P[]={ 35 | &floor0_exportbundle, 36 | &floor1_exportbundle, 37 | }; 38 | 39 | vorbis_func_residue *_residue_P[]={ 40 | &residue0_exportbundle, 41 | &residue1_exportbundle, 42 | &residue2_exportbundle, 43 | }; 44 | 45 | vorbis_func_mapping *_mapping_P[]={ 46 | &mapping0_exportbundle, 47 | }; 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /mednafen/pce/pcecd.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_PCECD_H 2 | #define __MDFN_PCE_PCECD_H 3 | 4 | typedef struct 5 | { 6 | double CDDA_Volume; 7 | double ADPCM_Volume; 8 | bool ADPCM_ExtraPrecision; 9 | unsigned int CD_Speed; 10 | } PCECD_Settings; 11 | 12 | enum 13 | { 14 | CD_GSREG_BSY = 0, 15 | CD_GSREG_REQ, // RO 16 | CD_GSREG_MSG, // RO 17 | CD_GSREG_CD, // RO 18 | CD_GSREG_IO, // RO 19 | CD_GSREG_SEL, 20 | 21 | CD_GSREG_ADPCM_CONTROL, 22 | CD_GSREG_ADPCM_FREQ, 23 | CD_GSREG_ADPCM_CUR, 24 | CD_GSREG_ADPCM_WRADDR, 25 | CD_GSREG_ADPCM_RDADDR, 26 | CD_GSREG_ADPCM_LENGTH, 27 | CD_GSREG_ADPCM_PLAYNIBBLE, 28 | 29 | CD_GSREG_ADPCM_PLAYING, 30 | CD_GSREG_ADPCM_HALFREACHED, 31 | CD_GSREG_ADPCM_ENDREACHED, 32 | }; 33 | 34 | uint32 PCECD_GetRegister(const unsigned int id); 35 | void PCECD_SetRegister(const unsigned int id, const uint32 value); 36 | 37 | 38 | int32 MDFN_FASTCALL PCECD_Run(uint32 in_timestamp); 39 | void PCECD_ResetTS(uint32 ts_base = 0); 40 | void PCECD_ProcessADPCMBuffer(const uint32 rsc); 41 | 42 | void PCECD_Init(const PCECD_Settings *settings, void (*irqcb)(bool), double master_clock, int32* adbuf, int32* hrbuf_l, int32* hrbuf_r) MDFN_COLD; 43 | bool PCECD_SetSettings(const PCECD_Settings *settings); 44 | 45 | void PCECD_Close() MDFN_COLD; 46 | 47 | // Returns number of cycles until next CD event. 48 | int32 PCECD_Power(uint32 timestamp); 49 | 50 | uint8 MDFN_FASTCALL PCECD_Read(uint32 timestamp, uint32, int32 &next_event, const bool PeekMode = false); 51 | int32 MDFN_FASTCALL PCECD_Write(uint32 timestamp, uint32, uint8 data) MDFN_WARN_UNUSED_RESULT; 52 | 53 | bool PCECD_IsBRAMEnabled(); 54 | 55 | int PCECD_StateAction(StateMem *sm, const unsigned load, const bool data_only); 56 | 57 | void ADPCM_PeekRAM(uint32 Address, uint32 Length, uint8 *Buffer); 58 | void ADPCM_PokeRAM(uint32 Address, uint32 Length, const uint8 *Buffer); 59 | 60 | void StuffSubchannel(uint8 meow, int subindex); 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /deps/zstd/TESTING.md: -------------------------------------------------------------------------------- 1 | Testing 2 | ======= 3 | 4 | Zstandard CI testing is split up into three sections: 5 | short, medium, and long tests. 6 | 7 | Short Tests 8 | ----------- 9 | Short tests run on CircleCI for new commits on every branch and pull request. 10 | They consist of the following tests: 11 | - Compilation on all supported targets (x86, x86_64, ARM, AArch64, PowerPC, and PowerPC64) 12 | - Compilation on various versions of gcc, clang, and g++ 13 | - `tests/playTests.sh` on x86_64, without the tests on long data (CLI tests) 14 | - Small tests (`tests/legacy.c`, `tests/longmatch.c`) on x64_64 15 | 16 | Medium Tests 17 | ------------ 18 | Medium tests run on every commit and pull request to `dev` branch, on TravisCI. 19 | They consist of the following tests: 20 | - The following tests run with UBsan and Asan on x86_64 and x86, as well as with 21 | Msan on x86_64 22 | - `tests/playTests.sh --test-large-data` 23 | - Fuzzer tests: `tests/fuzzer.c`, `tests/zstreamtest.c`, and `tests/decodecorpus.c` 24 | - `tests/zstreamtest.c` under Tsan (streaming mode, including multithreaded mode) 25 | - Valgrind Test (`make -C tests test-valgrind`) (testing CLI and fuzzer under `valgrind`) 26 | - Fuzzer tests (see above) on ARM, AArch64, PowerPC, and PowerPC64 27 | 28 | Long Tests 29 | ---------- 30 | Long tests run on all commits to `release` branch, 31 | and once a day on the current version of `dev` branch, 32 | on TravisCI. 33 | They consist of the following tests: 34 | - Entire test suite (including fuzzers and some other specialized tests) on: 35 | - x86_64 and x86 with UBsan and Asan 36 | - x86_64 with Msan 37 | - ARM, AArch64, PowerPC, and PowerPC64 38 | - Streaming mode fuzzer with Tsan (for the `zstdmt` testing) 39 | - ZlibWrapper tests, including under valgrind 40 | - Versions test (ensuring `zstd` can decode files from all previous versions) 41 | - `pzstd` with asan and tsan, as well as in 32-bits mode 42 | - Testing `zstd` with legacy mode off 43 | - Entire test suite and make install on macOS 44 | -------------------------------------------------------------------------------- /libretro-common/include/retro_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2015-04-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZ_HASH_H 5 | #define __LZ_HASH_H 6 | 7 | #define kHash2Size (1 << 10) 8 | #define kHash3Size (1 << 16) 9 | #define kHash4Size (1 << 20) 10 | 11 | #define kFix3HashSize (kHash2Size) 12 | #define kFix4HashSize (kHash2Size + kHash3Size) 13 | #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 14 | 15 | #define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8); 16 | 17 | #define HASH3_CALC { \ 18 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 19 | h2 = temp & (kHash2Size - 1); \ 20 | hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } 21 | 22 | #define HASH4_CALC { \ 23 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 24 | h2 = temp & (kHash2Size - 1); \ 25 | temp ^= ((UInt32)cur[2] << 8); \ 26 | h3 = temp & (kHash3Size - 1); \ 27 | hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; } 28 | 29 | #define HASH5_CALC { \ 30 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 31 | h2 = temp & (kHash2Size - 1); \ 32 | temp ^= ((UInt32)cur[2] << 8); \ 33 | h3 = temp & (kHash3Size - 1); \ 34 | temp ^= (p->crc[cur[3]] << 5); \ 35 | h4 = temp & (kHash4Size - 1); \ 36 | hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; } 37 | 38 | /* #define HASH_ZIP_CALC hv = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ 39 | #define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; 40 | 41 | 42 | #define MT_HASH2_CALC \ 43 | h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); 44 | 45 | #define MT_HASH3_CALC { \ 46 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 47 | h2 = temp & (kHash2Size - 1); \ 48 | h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } 49 | 50 | #define MT_HASH4_CALC { \ 51 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 52 | h2 = temp & (kHash2Size - 1); \ 53 | temp ^= ((UInt32)cur[2] << 8); \ 54 | h3 = temp & (kHash3Size - 1); \ 55 | h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /mednafen/lepacker.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_LEPACKER_H 2 | #define __MDFN_LEPACKER_H 3 | 4 | #include 5 | #include "mednafen.h" 6 | 7 | /* Little-endian byte packer(and unpacker). */ 8 | 9 | namespace MDFN 10 | { 11 | 12 | class LEPacker; 13 | class LEPackable 14 | { 15 | public: 16 | virtual void pack(LEPacker &lep) = 0; 17 | }; 18 | 19 | class LEPacker : public std::vector 20 | { 21 | public: 22 | 23 | LEPacker() : read_mode(0), read_pos(0), randomize_read_mode(0) 24 | { 25 | 26 | } 27 | 28 | 29 | inline void set_read_mode(bool new_read_mode, bool new_randomize_read_mode = false) 30 | { 31 | read_mode = new_read_mode; 32 | randomize_read_mode = new_randomize_read_mode; 33 | } 34 | 35 | inline void reset_read_pos(void) 36 | { 37 | read_pos = 0; 38 | } 39 | 40 | void operator^(LEPackable &o) 41 | { 42 | o.pack(*this); 43 | } 44 | 45 | template INLINE void operator^(T &val) 46 | { 47 | size_type csize = size(); 48 | 49 | if(read_mode) 50 | { 51 | if((read_pos + sizeof(T)) > csize) 52 | return; 53 | 54 | uint8 *ptr = &(*this)[read_pos]; 55 | val = 0; 56 | 57 | if(randomize_read_mode) 58 | { 59 | for(unsigned int n = 0; n < sizeof(T); n++) 60 | val |= ((T)((rand() >> 4) & 0xFF)) << (n << 3); 61 | } 62 | else 63 | { 64 | for(unsigned int n = 0; n < sizeof(T); n++) 65 | val |= ((T)ptr[n]) << (n << 3); 66 | } 67 | 68 | read_pos += sizeof(T); 69 | } 70 | else 71 | { 72 | resize(csize + sizeof(T)); 73 | 74 | uint8 *ptr = &(*this)[csize]; 75 | 76 | for(unsigned int n = 0; n < sizeof(T); n++) 77 | ptr[n] = val >> (n << 3); 78 | } 79 | } 80 | 81 | INLINE void operator^(bool &val) 82 | { 83 | uint8 tmp = val; 84 | 85 | (*this) ^ tmp; 86 | 87 | if(read_mode) 88 | val = tmp; 89 | } 90 | 91 | private: 92 | 93 | bool read_mode; 94 | uint64 read_pos; 95 | bool randomize_read_mode; 96 | }; 97 | 98 | } 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Bra86.c: -------------------------------------------------------------------------------- 1 | /* Bra86.c -- Converter for x86 code (BCJ) 2 | 2017-04-03 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Bra.h" 7 | 8 | #define Test86MSByte(b) ((((b) + 1) & 0xFE) == 0) 9 | 10 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) 11 | { 12 | SizeT pos = 0; 13 | UInt32 mask = *state & 7; 14 | if (size < 5) 15 | return 0; 16 | size -= 4; 17 | ip += 5; 18 | 19 | for (;;) 20 | { 21 | Byte *p = data + pos; 22 | const Byte *limit = data + size; 23 | for (; p < limit; p++) 24 | if ((*p & 0xFE) == 0xE8) 25 | break; 26 | 27 | { 28 | SizeT d = (SizeT)(p - data - pos); 29 | pos = (SizeT)(p - data); 30 | if (p >= limit) 31 | { 32 | *state = (d > 2 ? 0 : mask >> (unsigned)d); 33 | return pos; 34 | } 35 | if (d > 2) 36 | mask = 0; 37 | else 38 | { 39 | mask >>= (unsigned)d; 40 | if (mask != 0 && (mask > 4 || mask == 3 || Test86MSByte(p[(size_t)(mask >> 1) + 1]))) 41 | { 42 | mask = (mask >> 1) | 4; 43 | pos++; 44 | continue; 45 | } 46 | } 47 | } 48 | 49 | if (Test86MSByte(p[4])) 50 | { 51 | UInt32 v = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); 52 | UInt32 cur = ip + (UInt32)pos; 53 | pos += 5; 54 | if (encoding) 55 | v += cur; 56 | else 57 | v -= cur; 58 | if (mask != 0) 59 | { 60 | unsigned sh = (mask & 6) << 2; 61 | if (Test86MSByte((Byte)(v >> sh))) 62 | { 63 | v ^= (((UInt32)0x100 << sh) - 1); 64 | if (encoding) 65 | v += cur; 66 | else 67 | v -= cur; 68 | } 69 | mask = 0; 70 | } 71 | p[1] = (Byte)v; 72 | p[2] = (Byte)(v >> 8); 73 | p[3] = (Byte)(v >> 16); 74 | p[4] = (Byte)(0 - ((v >> 24) & 1)); 75 | } 76 | else 77 | { 78 | mask = (mask >> 1) | 4; 79 | pos++; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader.cpp: 5 | ** Copyright (C) 2010-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | // CDAFR_Open(), and CDAFReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access 23 | // to it for as long as the CDAFReader object exists. 24 | 25 | // Don't allow exceptions to propagate into the vorbis/musepack/etc. libraries, as it could easily leave the state of the library's decoder "object" in an 26 | // inconsistent state, which would cause all sorts of unfun when we try to destroy it while handling the exception farther up. 27 | 28 | #include 29 | #include "CDAFReader.h" 30 | #include "CDAFReader_Vorbis.h" 31 | #ifdef HAVE_MPC 32 | #include "CDAFReader_MPC.h" 33 | #endif 34 | 35 | CDAFReader::CDAFReader() : LastReadPos(0) 36 | { 37 | 38 | } 39 | 40 | CDAFReader::~CDAFReader() 41 | { 42 | 43 | } 44 | 45 | CDAFReader* CDAFR_Open(Stream* fp) 46 | { 47 | #ifdef HAVE_MPC 48 | return CDAFR_MPC_Open(fp); 49 | #else 50 | return CDAFR_Vorbis_Open(fp); 51 | #endif 52 | } 53 | 54 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/MemoryStream.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | // TODO/WIP 19 | 20 | #ifndef _MEMORY_STREAM_H 21 | #define _MEMORY_STREAM_H 22 | 23 | #include 24 | 25 | #include "Stream.h" 26 | 27 | class MemoryStream : public Stream 28 | { 29 | public: 30 | 31 | MemoryStream(); 32 | MemoryStream(uint64 size_hint); 33 | MemoryStream(Stream *stream); // Will create a MemoryStream equivalent of the contents of "stream", and then "delete stream". 34 | // Will only work if stream->tell() == 0, or if "stream" is seekable. 35 | // stream will be deleted even if this constructor throws. 36 | 37 | MemoryStream(const MemoryStream &zs); 38 | MemoryStream & operator=(const MemoryStream &zs); 39 | 40 | virtual ~MemoryStream(); 41 | 42 | virtual uint8 *map(void); 43 | virtual void unmap(void); 44 | 45 | virtual uint64 read(void *data, uint64 count); 46 | virtual void write(const void *data, uint64 count); 47 | virtual void seek(int64 offset, int whence); 48 | virtual int64 tell(void); 49 | virtual int64 size(void); 50 | virtual void close(void); 51 | 52 | virtual int get_line(std::string &str); 53 | 54 | private: 55 | uint8 *data_buffer; 56 | uint64 data_buffer_size; 57 | uint64 data_buffer_alloced; 58 | 59 | int64 position; 60 | 61 | void grow_if_necessary(uint64 new_required_size); 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /mednafen/tremor/README: -------------------------------------------------------------------------------- 1 | This README covers the Ogg Vorbis 'Tremor' integer playback codec 2 | source as of date 2002 09 02, version 1.0.0. 3 | 4 | ****** 5 | 6 | The C source in this package will build on any ANSI C compiler and 7 | function completely and properly on any platform. The included build 8 | system assumes GNU build system and make tools (m4, automake, 9 | autoconf, libtool and gmake). GCC is not required, although GCC is 10 | the most tested compiler. To build using GNU tools, type in the 11 | source directory: 12 | 13 | ./autogen.sh 14 | make 15 | 16 | Currently, the source implements playback in pure C on all platforms 17 | except ARM, where a [currently] small amount of assembly (see 18 | asm_arm.h) is used to implement 64 bit math operations and fast LSP 19 | computation. If building on ARM without the benefit of GNU build 20 | system tools, be sure that '_ARM_ASSEM_' is #defined by the build 21 | system if this assembly is desired, else the resulting library will 22 | use whatever 64 bit math builtins the compiler implements. 23 | 24 | No math library is required by this source. No floating point 25 | operations are used at any point in either setup or decode. This 26 | decoder library will properly decode any past, current or future 27 | Vorbis I file or stream. 28 | 29 | ******** 30 | 31 | The build system produces a static and [when supported by the OS] 32 | dynamic library named 'libvorbisidec'. This library exposes an API 33 | nearly identical to the BSD reference library's 'libvorbisfile', 34 | including all the features familiar to users of vorbisfile. This API 35 | is similar enough that the proper header file to include is named 36 | 'ivorbisfile.h' [included in the source build directory]. Lower level 37 | libvorbis-style headers and structures are in 'ivorbiscodec.h' 38 | [included in the source build directory]. A simple example program, 39 | ivorbisfile_example.c, can be built with 'make example'. 40 | 41 | ******** 42 | 43 | Detailed Tremor API Documentation begins at doc/index.html 44 | 45 | Monty 46 | xiph.org 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Bra.h: -------------------------------------------------------------------------------- 1 | /* Bra.h -- Branch converters for executables 2 | 2013-01-18 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BRA_H 5 | #define __BRA_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | /* 12 | These functions convert relative addresses to absolute addresses 13 | in CALL instructions to increase the compression ratio. 14 | 15 | In: 16 | data - data buffer 17 | size - size of data 18 | ip - current virtual Instruction Pinter (IP) value 19 | state - state variable for x86 converter 20 | encoding - 0 (for decoding), 1 (for encoding) 21 | 22 | Out: 23 | state - state variable for x86 converter 24 | 25 | Returns: 26 | The number of processed bytes. If you call these functions with multiple calls, 27 | you must start next call with first byte after block of processed bytes. 28 | 29 | Type Endian Alignment LookAhead 30 | 31 | x86 little 1 4 32 | ARMT little 2 2 33 | ARM little 4 0 34 | PPC big 4 0 35 | SPARC big 4 0 36 | IA64 little 16 0 37 | 38 | size must be >= Alignment + LookAhead, if it's not last block. 39 | If (size < Alignment + LookAhead), converter returns 0. 40 | 41 | Example: 42 | 43 | UInt32 ip = 0; 44 | for () 45 | { 46 | ; size must be >= Alignment + LookAhead, if it's not last block 47 | SizeT processed = Convert(data, size, ip, 1); 48 | data += processed; 49 | size -= processed; 50 | ip += processed; 51 | } 52 | */ 53 | 54 | #define x86_Convert_Init(state) { state = 0; } 55 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); 56 | SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 57 | SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 58 | SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 59 | SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 60 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 61 | 62 | EXTERN_C_END 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader.h: 5 | ** Copyright (C) 2010-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MDFN_CDAFREADER_H 23 | #define __MDFN_CDAFREADER_H 24 | 25 | #include 26 | 27 | class CDAFReader 28 | { 29 | public: 30 | CDAFReader(); 31 | virtual ~CDAFReader(); 32 | 33 | virtual uint64_t FrameCount(void) = 0; 34 | INLINE uint64_t Read(uint64_t frame_offset, int16 *buffer, uint64_t frames) 35 | { 36 | uint64_t ret; 37 | 38 | if(LastReadPos != frame_offset) 39 | { 40 | if(!Seek_(frame_offset)) 41 | return(0); 42 | LastReadPos = frame_offset; 43 | } 44 | 45 | ret = Read_(buffer, frames); 46 | LastReadPos += ret; 47 | return(ret); 48 | } 49 | 50 | private: 51 | virtual uint64_t Read_(int16 *buffer, uint64_t frames) = 0; 52 | virtual bool Seek_(uint64_t frame_offset) = 0; 53 | 54 | uint64_t LastReadPos; 55 | }; 56 | 57 | // AR_Open(), and CDAFReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access 58 | // to it for as long as the CDAFReader object exists. 59 | CDAFReader *CDAFR_Open(Stream *fp); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /mednafen/msvc_compat.h: -------------------------------------------------------------------------------- 1 | /* RetroArch - A frontend for libretro. 2 | * Copyright (C) 2010-2012 - Hans-Kristian Arntzen 3 | * 4 | * RetroArch is free software: you can redistribute it and/or modify it under the terms 5 | * of the GNU General Public License as published by the Free Software Found- 6 | * ation, either version 3 of the License, or (at your option) any later version. 7 | * 8 | * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 9 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 10 | * PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with RetroArch. 13 | * If not, see . 14 | */ 15 | 16 | #ifndef __RARCH_MSVC_COMPAT_H 17 | #define __RARCH_MSVC_COMPAT_H 18 | 19 | #ifdef _MSC_VER 20 | 21 | #undef UNICODE // Do not bother with UNICODE at this time. 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | // Python headers defines ssize_t and sets HAVE_SSIZE_T. Cannot duplicate these efforts. 28 | #ifndef HAVE_SSIZE_T 29 | #if defined(_WIN64) 30 | typedef __int64 ssize_t; 31 | #elif defined(_WIN32) 32 | typedef int ssize_t; 33 | #endif 34 | #endif 35 | 36 | #define snprintf _snprintf 37 | #define strtoll _strtoi64 38 | #define strtoull _strtoui64 39 | #define strcasecmp _stricmp 40 | #define strncasecmp _strnicmp 41 | #define strdup _strdup 42 | #define lseek _lseek 43 | 44 | #if (_MSC_VER < 1310) 45 | #include 46 | #define strlen _tcslen 47 | #endif 48 | 49 | # define S_IRUSR S_IREAD /* read, user */ 50 | # define S_IWUSR S_IWRITE /* write, user */ 51 | 52 | // Disable some of the annoying warnings. 53 | #pragma warning(disable : 4800) 54 | #pragma warning(disable : 4244) 55 | #pragma warning(disable : 4305) 56 | #pragma warning(disable : 4146) 57 | #pragma warning(disable : 4267) 58 | 59 | #if _MSC_VER < 1800 60 | #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) 61 | #endif 62 | 63 | #ifndef PATH_MAX 64 | #define PATH_MAX MAX_PATH 65 | #endif 66 | 67 | #endif 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /mednafen/cdrom/SimpleFIFO.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_SIMPLEFIFO_H 2 | #define __MDFN_SIMPLEFIFO_H 3 | 4 | #include 5 | #include 6 | 7 | #include "../math_ops.h" 8 | 9 | template 10 | class SimpleFIFO 11 | { 12 | public: 13 | 14 | // Constructor 15 | SimpleFIFO(uint32 the_size) // Size should be a power of 2! 16 | { 17 | data.resize(round_up_pow2(the_size)); 18 | size = the_size; 19 | read_pos = 0; 20 | write_pos = 0; 21 | in_count = 0; 22 | } 23 | 24 | // Destructor 25 | INLINE ~SimpleFIFO() 26 | { 27 | 28 | } 29 | 30 | INLINE void SaveStatePostLoad(void) 31 | { 32 | read_pos %= data.size(); 33 | write_pos %= data.size(); 34 | in_count %= (data.size() + 1); 35 | } 36 | 37 | INLINE uint32 CanWrite(void) 38 | { 39 | return(size - in_count); 40 | } 41 | 42 | INLINE T ReadUnit(bool peek = false) 43 | { 44 | T ret; 45 | 46 | assert(in_count > 0); 47 | 48 | ret = data[read_pos]; 49 | 50 | if(!peek) 51 | { 52 | read_pos = (read_pos + 1) & (data.size() - 1); 53 | in_count--; 54 | } 55 | 56 | return(ret); 57 | } 58 | 59 | INLINE uint8 ReadByte(bool peek = false) 60 | { 61 | assert(sizeof(T) == 1); 62 | 63 | return(ReadUnit(peek)); 64 | } 65 | 66 | INLINE void Write(const T *happy_data, uint32 happy_count) 67 | { 68 | assert(CanWrite() >= happy_count); 69 | 70 | while(happy_count) 71 | { 72 | data[write_pos] = *happy_data; 73 | 74 | write_pos = (write_pos + 1) & (data.size() - 1); 75 | in_count++; 76 | happy_data++; 77 | happy_count--; 78 | } 79 | } 80 | 81 | INLINE void WriteUnit(const T& wr_data) 82 | { 83 | Write(&wr_data, 1); 84 | } 85 | 86 | INLINE void WriteByte(const T& wr_data) 87 | { 88 | assert(sizeof(T) == 1); 89 | Write(&wr_data, 1); 90 | } 91 | 92 | 93 | INLINE void Flush(void) 94 | { 95 | read_pos = 0; 96 | write_pos = 0; 97 | in_count = 0; 98 | } 99 | 100 | //private: 101 | std::vector data; 102 | uint32 size; 103 | uint32 read_pos; // Read position 104 | uint32 write_pos; // Write position 105 | uint32 in_count; // Number of units in the FIFO 106 | }; 107 | 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /mednafen/FileStream.cpp: -------------------------------------------------------------------------------- 1 | // TODO/WIP 2 | 3 | /* Mednafen - Multi-system Emulator 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | 21 | #include "mednafen.h" 22 | #include "Stream.h" 23 | #include "FileStream.h" 24 | 25 | #include 26 | #include 27 | 28 | FileStream::FileStream(const char *path, const int mode) 29 | { 30 | fp = filestream_open(path, (mode == MODE_WRITE) ? RETRO_VFS_FILE_ACCESS_WRITE : RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE); 31 | } 32 | 33 | FileStream::~FileStream() 34 | { 35 | if (fp) 36 | { 37 | filestream_close(fp); 38 | fp = NULL; 39 | } 40 | } 41 | 42 | uint64_t FileStream::read(void *data, uint64_t count) 43 | { 44 | if (!fp) 45 | return 0; 46 | return filestream_read(fp, data, count); 47 | } 48 | 49 | void FileStream::write(const void *data, uint64_t count) 50 | { 51 | if (!fp) 52 | return; 53 | filestream_write(fp, data, count); 54 | } 55 | 56 | void FileStream::seek(int64_t offset, int whence) 57 | { 58 | if (!fp) 59 | return; 60 | filestream_seek(fp, offset, whence); 61 | } 62 | 63 | int64_t FileStream::tell(void) 64 | { 65 | if (!fp) 66 | return -1; 67 | return filestream_tell(fp); 68 | } 69 | 70 | int64_t FileStream::size(void) 71 | { 72 | if (!fp) 73 | return -1; 74 | return filestream_get_size(fp); 75 | } 76 | 77 | void FileStream::close(void) 78 | { 79 | if (!fp) 80 | return; 81 | filestream_close(fp); 82 | fp = NULL; 83 | } 84 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/INDEX: -------------------------------------------------------------------------------- 1 | CMakeLists.txt cmake build file 2 | ChangeLog history of changes 3 | FAQ Frequently Asked Questions about zlib 4 | INDEX this file 5 | Makefile dummy Makefile that tells you to ./configure 6 | Makefile.in template for Unix Makefile 7 | README guess what 8 | configure configure script for Unix 9 | make_vms.com makefile for VMS 10 | test/example.c zlib usages examples for build testing 11 | test/minigzip.c minimal gzip-like functionality for build testing 12 | test/infcover.c inf*.c code coverage for build coverage testing 13 | treebuild.xml XML description of source file dependencies 14 | zconf.h.cmakein zconf.h template for cmake 15 | zconf.h.in zconf.h template for configure 16 | zlib.3 Man page for zlib 17 | zlib.3.pdf Man page in PDF format 18 | zlib.map Linux symbol information 19 | zlib.pc.in Template for pkg-config descriptor 20 | zlib.pc.cmakein zlib.pc template for cmake 21 | zlib2ansi perl script to convert source files for C++ compilation 22 | 23 | amiga/ makefiles for Amiga SAS C 24 | as400/ makefiles for AS/400 25 | doc/ documentation for formats and algorithms 26 | msdos/ makefiles for MSDOS 27 | nintendods/ makefile for Nintendo DS 28 | old/ makefiles for various architectures and zlib documentation 29 | files that have not yet been updated for zlib 1.2.x 30 | qnx/ makefiles for QNX 31 | watcom/ makefiles for OpenWatcom 32 | win32/ makefiles for Windows 33 | 34 | zlib public header files (required for library use): 35 | zconf.h 36 | zlib.h 37 | 38 | private source files used to build the zlib library: 39 | adler32.c 40 | compress.c 41 | crc32.c 42 | crc32.h 43 | deflate.c 44 | deflate.h 45 | gzclose.c 46 | gzguts.h 47 | gzlib.c 48 | gzread.c 49 | gzwrite.c 50 | infback.c 51 | inffast.c 52 | inffast.h 53 | inffixed.h 54 | inflate.c 55 | inflate.h 56 | inftrees.c 57 | inftrees.h 58 | trees.c 59 | trees.h 60 | uncompr.c 61 | zutil.c 62 | zutil.h 63 | 64 | source files for sample programs 65 | See examples/README.examples 66 | 67 | unsupported contributions by third parties 68 | See contrib/README.contrib 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/flac.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause 2 | * copyright-holders:Aaron Giles 3 | *************************************************************************** 4 | 5 | flac.h 6 | 7 | FLAC compression wrappers 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __FLAC_H__ 14 | #define __FLAC_H__ 15 | 16 | #include 17 | 18 | /*************************************************************************** 19 | * TYPE DEFINITIONS 20 | *************************************************************************** 21 | */ 22 | 23 | typedef struct _flac_decoder flac_decoder; 24 | struct _flac_decoder { 25 | /* output state */ 26 | void * decoder; /* actual encoder */ 27 | uint32_t sample_rate; /* decoded sample rate */ 28 | uint8_t channels; /* decoded number of channels */ 29 | uint8_t bits_per_sample; /* decoded bits per sample */ 30 | uint32_t compressed_offset; /* current offset in compressed data */ 31 | const uint8_t * compressed_start; /* start of compressed data */ 32 | uint32_t compressed_length; /* length of compressed data */ 33 | const uint8_t * compressed2_start; /* start of compressed data */ 34 | uint32_t compressed2_length; /* length of compressed data */ 35 | int16_t * uncompressed_start[8]; /* pointer to start of uncompressed data (up to 8 streams) */ 36 | uint32_t uncompressed_offset; /* current position in uncompressed data */ 37 | uint32_t uncompressed_length; /* length of uncompressed data */ 38 | int uncompressed_swap; /* swap uncompressed sample data */ 39 | uint8_t custom_header[0x2a]; /* custom header */ 40 | }; 41 | 42 | /* ======================> flac_decoder */ 43 | 44 | int flac_decoder_init(flac_decoder* decoder); 45 | void flac_decoder_free(flac_decoder* decoder); 46 | int flac_decoder_reset(flac_decoder* decoder, uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length); 47 | int flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian); 48 | uint32_t flac_decoder_finish(flac_decoder* decoder); 49 | 50 | #endif /* __FLAC_H__ */ 51 | -------------------------------------------------------------------------------- /libretro-common/include/memmap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memmap.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_MEMMAP_H 24 | #define _LIBRETRO_MEMMAP_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(PSP) || defined(PS2) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) || defined(WIIU) || defined(SWITCH) || defined(HAVE_LIBNX) || defined(__PS3__) || defined(__PSL1GHT__) 30 | /* No mman available */ 31 | #elif defined(_WIN32) && !defined(_XBOX) 32 | #include 33 | #include 34 | #include 35 | #else 36 | #define HAVE_MMAN 37 | #include 38 | #endif 39 | 40 | #if !defined(HAVE_MMAN) || defined(_WIN32) 41 | void* mmap(void *addr, size_t len, int mmap_prot, int mmap_flags, int fildes, size_t off); 42 | 43 | int munmap(void *addr, size_t len); 44 | 45 | int mprotect(void *addr, size_t len, int prot); 46 | #endif 47 | 48 | int memsync(void *start, void *end); 49 | 50 | int memprotect(void *addr, size_t len); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /mednafen/sound/OwlResampler_altivec.inc: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // 4 | static INLINE void DoMAC_AltiVec(float* wave, float* coeffs, int32 count, int32* accum_output) 5 | { 6 | vector float acc0, acc1, acc2, acc3; 7 | 8 | acc0 = (vector float)vec_splat_u8(0); 9 | acc1 = acc0; 10 | acc2 = acc0; 11 | acc3 = acc0; 12 | 13 | 14 | count >>= 4; 15 | 16 | if(!((uint64)wave & 0xF)) 17 | { 18 | vector float w, c; 19 | do 20 | { 21 | w = vec_ld(0, wave); 22 | c = vec_ld(0, coeffs); 23 | acc0 = vec_madd(w, c, acc0); 24 | 25 | w = vec_ld(16, wave); 26 | c = vec_ld(16, coeffs); 27 | acc1 = vec_madd(w, c, acc1); 28 | 29 | w = vec_ld(32, wave); 30 | c = vec_ld(32, coeffs); 31 | acc2 = vec_madd(w, c, acc2); 32 | 33 | w = vec_ld(48, wave); 34 | c = vec_ld(48, coeffs); 35 | acc3 = vec_madd(w, c, acc3); 36 | 37 | coeffs += 16; 38 | wave += 16; 39 | } while(--count); 40 | } 41 | else 42 | { 43 | vector unsigned char lperm; 44 | vector float loado; 45 | 46 | lperm = vec_lvsl(0, wave); 47 | loado = vec_ld(0, wave); 48 | 49 | do 50 | { 51 | vector float tl; 52 | vector float w; 53 | vector float c; 54 | 55 | tl = vec_ld(15 + 0, wave); 56 | w = vec_perm(loado, tl, lperm); 57 | c = vec_ld(0, coeffs); 58 | loado = tl; 59 | acc0 = vec_madd(w, c, acc0); 60 | 61 | tl = vec_ld(15 + 16, wave); 62 | w = vec_perm(loado, tl, lperm); 63 | c = vec_ld(16, coeffs); 64 | loado = tl; 65 | acc1 = vec_madd(w, c, acc1); 66 | 67 | tl = vec_ld(15 + 32, wave); 68 | w = vec_perm(loado, tl, lperm); 69 | c = vec_ld(32, coeffs); 70 | loado = tl; 71 | acc2 = vec_madd(w, c, acc2); 72 | 73 | tl = vec_ld(15 + 48, wave); 74 | w = vec_perm(loado, tl, lperm); 75 | c = vec_ld(48, coeffs); 76 | loado = tl; 77 | acc3 = vec_madd(w, c, acc3); 78 | 79 | coeffs += 16; 80 | wave += 16; 81 | } while(--count); 82 | } 83 | 84 | { 85 | vector float sum; 86 | vector float sums0; 87 | vector signed int sum_i; 88 | 89 | sum = vec_add(vec_add(acc0, acc1), vec_add(acc2, acc3)); 90 | sums0 = vec_sld(sum, sum, 8); 91 | sum = vec_add(sum, sums0); 92 | sums0 = vec_sld(sum, sum, 4); 93 | sum = vec_add(sum, sums0); 94 | 95 | sum_i = vec_cts(sum, 0); 96 | vec_ste(sum_i, 0, accum_output); 97 | } 98 | } 99 | 100 | -------------------------------------------------------------------------------- /mednafen/cdrom/lec.h: -------------------------------------------------------------------------------- 1 | /* cdrdao - write audio CD-Rs in disc-at-once mode 2 | * 3 | * Copyright (C) 1998-2002 Andreas Mueller 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | */ 19 | 20 | #ifndef __LEC_H__ 21 | #define __LEC_H__ 22 | 23 | #include 24 | 25 | /* Encodes a MODE 0 sector. 26 | * 'adr' is the current physical sector address 27 | * 'sector' must be 2352 byte wide 28 | */ 29 | void lec_encode_mode0_sector(uint32_t adr, uint8_t *sector); 30 | 31 | /* Encodes a MODE 1 sector. 32 | * 'adr' is the current physical sector address 33 | * 'sector' must be 2352 byte wide containing 2048 bytes user data at 34 | * offset 16 35 | */ 36 | void lec_encode_mode1_sector(uint32_t adr, uint8_t *sector); 37 | 38 | /* Encodes a MODE 2 sector. 39 | * 'adr' is the current physical sector address 40 | * 'sector' must be 2352 byte wide containing 2336 bytes user data at 41 | * offset 16 42 | */ 43 | void lec_encode_mode2_sector(uint32_t adr, uint8_t *sector); 44 | 45 | /* Encodes a XA form 1 sector. 46 | * 'adr' is the current physical sector address 47 | * 'sector' must be 2352 byte wide containing 2048+8 bytes user data at 48 | * offset 16 49 | */ 50 | void lec_encode_mode2_form1_sector(uint32_t adr, uint8_t *sector); 51 | 52 | /* Encodes a XA form 2 sector. 53 | * 'adr' is the current physical sector address 54 | * 'sector' must be 2352 byte wide containing 2324+8 bytes user data at 55 | * offset 16 56 | */ 57 | void lec_encode_mode2_form2_sector(uint32_t adr, uint8_t *sector); 58 | 59 | /* Scrambles and byte swaps an encoded sector. 60 | * 'sector' must be 2352 byte wide. 61 | */ 62 | void lec_scramble(int8_t *sector); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /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-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-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 | -------------------------------------------------------------------------------- /mednafen/tremor/window.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #include 19 | #include 20 | #include "misc.h" 21 | #include "window.h" 22 | #include "window_lookup.h" 23 | 24 | const void *_vorbis_window(int type, int left){ 25 | 26 | switch(type){ 27 | case 0: 28 | 29 | switch(left){ 30 | case 32: 31 | return vwin64; 32 | case 64: 33 | return vwin128; 34 | case 128: 35 | return vwin256; 36 | case 256: 37 | return vwin512; 38 | case 512: 39 | return vwin1024; 40 | case 1024: 41 | return vwin2048; 42 | case 2048: 43 | return vwin4096; 44 | case 4096: 45 | return vwin8192; 46 | default: 47 | return(0); 48 | } 49 | break; 50 | default: 51 | return(0); 52 | } 53 | } 54 | 55 | void _vorbis_apply_window(int32_t *d,const void *window_p[2], 56 | long *blocksizes, 57 | int lW,int W,int nW){ 58 | 59 | LOOKUP_T *window[2]={window_p[0],window_p[1]}; 60 | long n=blocksizes[W]; 61 | long ln=blocksizes[lW]; 62 | long rn=blocksizes[nW]; 63 | 64 | long leftbegin=n/4-ln/4; 65 | long leftend=leftbegin+ln/2; 66 | 67 | long rightbegin=n/2+n/4-rn/4; 68 | long rightend=rightbegin+rn/2; 69 | 70 | int i,p; 71 | 72 | for(i=0;i 27 | #include 28 | 29 | RETRO_BEGIN_DECLS 30 | 31 | int64_t retro_vfs_file_seek_cdrom(libretro_vfs_implementation_file *stream, int64_t offset, int whence); 32 | 33 | void retro_vfs_file_open_cdrom( 34 | libretro_vfs_implementation_file *stream, 35 | const char *path, unsigned mode, unsigned hints); 36 | 37 | int retro_vfs_file_close_cdrom(libretro_vfs_implementation_file *stream); 38 | 39 | int64_t retro_vfs_file_tell_cdrom(libretro_vfs_implementation_file *stream); 40 | 41 | int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream, 42 | void *s, uint64_t len); 43 | 44 | int retro_vfs_file_error_cdrom(libretro_vfs_implementation_file *stream); 45 | 46 | const cdrom_toc_t* retro_vfs_file_get_cdrom_toc(void); 47 | 48 | const vfs_cdrom_t* retro_vfs_file_get_cdrom_position(const libretro_vfs_implementation_file *stream); 49 | 50 | RETRO_END_DECLS 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /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 | char * filename_local = utf8_to_local_string_alloc(filename); 41 | if (filename_local) 42 | { 43 | FILE *ret = fopen(filename_local, mode); 44 | free(filename_local); 45 | return ret; 46 | } 47 | #else 48 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 49 | if (filename_w) 50 | { 51 | FILE *ret = NULL; 52 | wchar_t *mode_w = utf8_to_utf16_string_alloc(mode); 53 | if (mode_w) 54 | { 55 | ret = _wfopen(filename_w, mode_w); 56 | free(mode_w); 57 | } 58 | free(filename_w); 59 | return ret; 60 | } 61 | #endif 62 | return NULL; 63 | } 64 | #endif 65 | -------------------------------------------------------------------------------- /mednafen/cdrom/cdromif.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef __MDFN_CDROM_CDROMIF_H 19 | #define __MDFN_CDROM_CDROMIF_H 20 | 21 | #include "CDUtility.h" 22 | #include "CDAccess.h" 23 | #include 24 | 25 | #include 26 | 27 | class CDIF 28 | { 29 | public: 30 | 31 | CDIF(CDAccess *cda); 32 | virtual ~CDIF(); 33 | 34 | static const int32_t LBA_Read_Minimum = -150; 35 | static const int32_t LBA_Read_Maximum = 449849; // 100 * 75 * 60 - 150 - 1 36 | 37 | inline void ReadTOC(TOC *read_target) 38 | { 39 | *read_target = disc_toc; 40 | } 41 | 42 | virtual void HintReadSector(int32_t lba) = 0; 43 | virtual bool ReadRawSector(uint8_t *buf, int32_t lba) = 0; // Reads 2352+96 bytes of data into buf. 44 | virtual bool ReadRawSectorPWOnly(uint8_t* pwbuf, int32_t lba, bool hint_fullread) = 0; // Reads 96 bytes(of raw subchannel PW data) into pwbuf. 45 | 46 | // Call for mode 1 or mode 2 form 1 only. 47 | bool ValidateRawSector(uint8_t *buf); 48 | 49 | // Utility/Wrapped functions 50 | // Reads mode 1 and mode2 form 1 sectors(2048 bytes per sector returned) 51 | // Will return the type(1, 2) of the first sector read to the buffer supplied, 0 on error 52 | int ReadSector(uint8_t* buf, int32_t lba, uint32_t sector_count, bool suppress_uncorrectable_message = false); 53 | 54 | // For Mode 1, or Mode 2 Form 1. 55 | // No reference counting or whatever is done, so if you destroy the CDIF object before you destroy the returned Stream, things will go BOOM. 56 | Stream *MakeStream(int32_t lba, uint32_t sector_count); 57 | 58 | protected: 59 | bool UnrecoverableError; 60 | TOC disc_toc; 61 | CDAccess *disc_cdaccess; 62 | }; 63 | 64 | CDIF *CDIF_Open(const std::string& path, bool image_memcache); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /libretro-common/memmap/memalign.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memalign.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 | void *memalign_alloc(size_t boundary, size_t size) 29 | { 30 | void **place = NULL; 31 | uintptr_t addr = 0; 32 | void *ptr = (void*)malloc(boundary + size + sizeof(uintptr_t)); 33 | if (!ptr) 34 | return NULL; 35 | 36 | addr = ((uintptr_t)ptr + sizeof(uintptr_t) + boundary) 37 | & ~(boundary - 1); 38 | place = (void**)addr; 39 | place[-1] = ptr; 40 | 41 | return (void*)addr; 42 | } 43 | 44 | void memalign_free(void *ptr) 45 | { 46 | void **p = NULL; 47 | if (!ptr) 48 | return; 49 | 50 | p = (void**)ptr; 51 | free(p[-1]); 52 | } 53 | 54 | void *memalign_alloc_aligned(size_t size) 55 | { 56 | #if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_M_X64) || defined(_WIN64) 57 | return memalign_alloc(64, size); 58 | #elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(GEKKO) || defined(_M_IX86) 59 | return memalign_alloc(32, size); 60 | #else 61 | return memalign_alloc(32, size); 62 | #endif 63 | } 64 | -------------------------------------------------------------------------------- /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 | #endif 27 | 28 | #include 29 | #include