├── 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 │ │ ├── libchdr_bitstream.d │ │ ├── libchdr_flac.d │ │ ├── libchdr_cdrom.d │ │ ├── libchdr_huffman.d │ │ └── libchdr_chd.d │ ├── include │ │ └── libchdr │ │ │ ├── chdconfig.h │ │ │ ├── bitstream.h │ │ │ ├── coretypes.h │ │ │ ├── flac.h │ │ │ └── huffman.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 │ └── LzmaEnc.h │ ├── LICENSE │ ├── lzma.vcxproj.filters │ ├── CMakeLists.txt │ └── src │ ├── BraIA64.c │ ├── Lzma86Dec.c │ ├── Delta.c │ └── Bra86.c ├── .gitignore ├── mednafen ├── cdrom │ ├── edc_crc32.h │ ├── audioreader_opus.h │ ├── recover-raw.h │ ├── CDAccess.h │ ├── audioreader.h │ ├── l-ec.h │ ├── galois-inlines.h │ ├── CDAccess_CCD.h │ ├── CDAccess.cpp │ ├── SimpleFIFO.h │ ├── galois.h │ ├── CDAccess_Image.h │ ├── cdromif.h │ ├── lec.h │ └── CDAccess_CHD.h ├── file.h ├── pce_fast │ ├── input.h │ ├── pcecd.h │ ├── huc.h │ ├── pce.h │ ├── vpc_mix_inner.inc │ └── psg.h ├── mempatcher.h ├── mednafen.h ├── general.h ├── tremor │ ├── block.h │ ├── window.h │ ├── COPYING │ ├── os.h │ ├── registry.h │ ├── mdct.h │ ├── registry.c │ ├── README │ ├── window.c │ └── codec_internal.h ├── Stream.cpp ├── error.h ├── settings.h ├── hw_misc │ └── arcade_card │ │ └── arcade_card.h ├── mempatcher-driver.h ├── okiadpcm.cpp ├── FileStream.h ├── FileWrapper.h ├── file.c ├── MemoryStream.h ├── math_ops.h ├── msvc_compat.h ├── FileStream.cpp ├── mednafen-types.h ├── video │ ├── surface.cpp │ └── surface.h ├── settings-common.h └── state.h ├── README.md ├── .travis.yml ├── .github └── workflows │ ├── crowdin_prep.yml │ └── crowdin_translate.yml └── 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 ├── retro_assert.h ├── memalign.h ├── retro_inline.h ├── boolean.h ├── retro_common.h ├── time │ └── rtime.h ├── memmap.h ├── vfs │ └── vfs_implementation_cdrom.h ├── encodings │ └── utf.h ├── retro_dirent.h └── streams │ └── file_stream_transforms.h ├── compat ├── compat_strcasestr.c ├── compat_strl.c ├── fopen_utf8.c ├── compat_snprintf.c └── compat_posix_string.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | *.dll 4 | *.dylib 5 | /old 6 | .clang-format 7 | .vdcode 8 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/zlib.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-supergrafx-libretro/HEAD/deps/zlib-1.2.11/zlib.3.pdf -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma-history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-supergrafx-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 | -------------------------------------------------------------------------------- /deps/libchdr/src/libchdr_bitstream.d: -------------------------------------------------------------------------------- 1 | deps/libchdr/src/libchdr_bitstream.o: \ 2 | deps/libchdr/src/libchdr_bitstream.c \ 3 | deps/libchdr/include/libchdr/bitstream.h 4 | -------------------------------------------------------------------------------- /deps/libchdr/src/libchdr_flac.d: -------------------------------------------------------------------------------- 1 | deps/libchdr/src/libchdr_flac.o: deps/libchdr/src/libchdr_flac.c \ 2 | deps/libchdr/include/libchdr/flac.h \ 3 | deps/libchdr/include/dr_libs/dr_flac.h 4 | -------------------------------------------------------------------------------- /deps/libchdr/src/libchdr_cdrom.d: -------------------------------------------------------------------------------- 1 | deps/libchdr/src/libchdr_cdrom.o: deps/libchdr/src/libchdr_cdrom.c \ 2 | deps/libchdr/include/libchdr/cdrom.h \ 3 | deps/libchdr/include/libchdr/chdconfig.h 4 | -------------------------------------------------------------------------------- /deps/libchdr/src/libchdr_huffman.d: -------------------------------------------------------------------------------- 1 | deps/libchdr/src/libchdr_huffman.o: deps/libchdr/src/libchdr_huffman.c \ 2 | deps/libchdr/include/libchdr/huffman.h \ 3 | deps/libchdr/include/libchdr/bitstream.h 4 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /mednafen/cdrom/edc_crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef _EDC_CRC32_H 2 | #define _EDC_CRC32_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | uint32_t EDCCrc32(const unsigned char*, int); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/chdconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef __CHDCONFIG_H__ 2 | #define __CHDCONFIG_H__ 3 | 4 | /* Configure CHDR features here */ 5 | #define WANT_RAW_DATA_SECTOR 1 6 | #define WANT_SUBCODE 1 7 | #define NEED_CACHE_HUNK 1 8 | #define VERIFY_BLOCK_CRC 1 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/cdrom/audioreader_opus.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_AUDIOREADER_OPUS_H 2 | #define __MDFN_AUDIOREADER_OPUS_H 3 | 4 | #include 5 | 6 | class OggOpusReader : public AudioReader 7 | { 8 | public: 9 | OggOpusReader(Stream *fp); 10 | ~OggOpusReader(); 11 | 12 | int64 Read_(int16 *buffer, int64 frames); 13 | bool Seek_(int64 frame_offset); 14 | int64 FrameCount(void); 15 | 16 | private: 17 | OggOpus_File *opfile; 18 | Stream *fw; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | uint64_t size; 17 | char *ext; 18 | uint64_t location; 19 | }; 20 | 21 | struct MDFNFILE *file_open(const char *path); 22 | 23 | int file_close(struct MDFNFILE *file); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/pce_fast/input.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCE_INPUT_H 2 | #define __PCE_INPUT_H 3 | 4 | void PCEINPUT_Init(void); 5 | void PCEINPUT_SettingChanged(const char *name); 6 | void INPUT_TransformInput(void); 7 | void PCEINPUT_SetInput(unsigned port, const char *type, uint8 *ptr); 8 | uint8 INPUT_Read(unsigned int A); 9 | void INPUT_Write(unsigned int A, uint8 V); 10 | void INPUT_Frame(void); 11 | int INPUT_StateAction(StateMem *sm, int load, int data_only); 12 | extern InputInfoStruct PCEInputInfo; 13 | extern bool AVPad6Enabled[5]; 14 | void INPUT_FixTS(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /deps/libchdr/src/libchdr_chd.d: -------------------------------------------------------------------------------- 1 | deps/libchdr/src/libchdr_chd.o: deps/libchdr/src/libchdr_chd.c \ 2 | deps/libchdr/include/libchdr/chd.h \ 3 | deps/libchdr/include/libchdr/coretypes.h \ 4 | deps/libchdr/include/libchdr/chdconfig.h \ 5 | deps/libchdr/include/libchdr/cdrom.h deps/libchdr/include/libchdr/flac.h \ 6 | deps/libchdr/include/libchdr/huffman.h \ 7 | deps/libchdr/include/libchdr/bitstream.h \ 8 | deps/lzma-19.00/include/LzmaEnc.h deps/lzma-19.00/include/7zTypes.h \ 9 | deps/lzma-19.00/include/LzmaDec.h deps/zlib-1.2.11/zlib.h \ 10 | deps/zlib-1.2.11/zconf.h 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/libretro/beetle-supergrafx-libretro.svg?branch=master)](https://travis-ci.org/libretro/beetle-supergrafx-libretro) 2 | 3 | # Beetle PC Engine SuperGrafx libretro 4 | 5 | Beetle PC Engine SuperGrafx is a port/fork of Mednafen's PC Engine PCE_Fast module to the libretro API. This libretro core contains CD-ROM2 support and plays SuperGrafx hucards and CD games. 6 | 7 | ## Building 8 | 9 | The PC Engine SuperGrafx core can be built with `make` in the `master`. 10 | 11 | ## Documentation 12 | 13 | https://docs.libretro.com/library/beetle_sgx/ 14 | -------------------------------------------------------------------------------- /mednafen/cdrom/recover-raw.h: -------------------------------------------------------------------------------- 1 | #ifndef _RECOVER_RAW_H 2 | #define _RECOVER_RAW_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define CD_RAW_SECTOR_SIZE 2352 12 | #define CD_RAW_C2_SECTOR_SIZE (2352+294) /* main channel plus C2 vector */ 13 | 14 | int CheckEDC(const unsigned char *a, bool b); 15 | int CheckMSF(unsigned char *a, int b); 16 | 17 | 18 | int ValidateRawSector(unsigned char *frame, bool xaMode); 19 | bool Init_LEC_Correct(void); 20 | void Kill_LEC_Correct(void); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /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 | extern MDFNSetting MDFNMP_Settings[]; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDROMFILE_H 2 | #define __MDFN_CDROMFILE_H 3 | 4 | #include "CDUtility.h" 5 | 6 | class CDAccess 7 | { 8 | public: 9 | 10 | CDAccess(); 11 | virtual ~CDAccess(); 12 | 13 | virtual void Read_Raw_Sector(uint8 *buf, int32 lba) = 0; 14 | 15 | virtual void Read_TOC(TOC *toc) = 0; 16 | 17 | virtual void Eject(bool eject_status) = 0; // Eject a disc if it's physical, otherwise NOP. Returns true on success(or NOP), false on error 18 | 19 | private: 20 | CDAccess(const CDAccess&); // No copy constructor. 21 | CDAccess& operator=(const CDAccess&); // No assignment operator. 22 | }; 23 | 24 | CDAccess *cdaccess_open_image(const char *path, bool image_memcache); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /mednafen/mednafen.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEDNAFEN_H 2 | #define _MEDNAFEN_H 3 | 4 | #include "mednafen-types.h" 5 | #include 6 | #include 7 | 8 | #define _(String) (String) 9 | 10 | #include "math_ops.h" 11 | #include "git.h" 12 | 13 | #ifdef _WIN32 14 | #define strcasecmp _stricmp 15 | #endif 16 | 17 | extern MDFNGI *MDFNGameInfo; 18 | 19 | #include "settings.h" 20 | 21 | void MDFN_printf(const char *format, ...); 22 | void MDFN_DispMessage(const char *format, ...); 23 | 24 | void MDFN_LoadGameCheats(void *override); 25 | void MDFN_FlushGameCheats(int nosave); 26 | 27 | void MDFN_MidSync(EmulateSpecStruct *espec); 28 | void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y); 29 | 30 | #include "mednafen-endian.h" 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/general.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENERAL_H 2 | #define _GENERAL_H 3 | 4 | #include 5 | 6 | extern uint32 MDFN_RoundUpPow2(uint32); 7 | 8 | void GetFileBase(const char *f); 9 | 10 | // File-inclusion for-read-only path, for PSF and CUE/TOC sheet usage. 11 | bool MDFN_IsFIROPSafe(const std::string &path); 12 | 13 | void MDFN_ltrim(char *string); 14 | void MDFN_rtrim(char *string); 15 | void MDFN_trim(char *string); 16 | 17 | void MDFN_ltrim(std::string &string); 18 | void MDFN_rtrim(std::string &string); 19 | void MDFN_trim(std::string &string); 20 | 21 | 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); 22 | std::string MDFN_EvalFIP(const std::string &dir_path, const std::string &rel_path, bool skip_safety_check = false); 23 | #endif 24 | -------------------------------------------------------------------------------- /.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_supergrafx 14 | - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7 15 | matrix: 16 | - PLATFORM=linux_x64 17 | - PLATFORM=ngc 18 | - PLATFORM=wii 19 | - PLATFORM=wiiu 20 | before_script: 21 | - pwd 22 | - mkdir -p ~/bin 23 | - ln -s /usr/bin/gcc-7 ~/bin/gcc 24 | - ln -s /usr/bin/g++-7 ~/bin/g++ 25 | - ln -s /usr/bin/cpp-7 ~/bin/cpp 26 | - export PATH=~/bin:$PATH 27 | - ls -l ~/bin 28 | - echo $PATH 29 | - g++-7 --version 30 | - g++ --version 31 | script: 32 | - cd ~/ 33 | - git clone --depth=50 https://github.com/libretro/libretro-super 34 | - cd libretro-super/travis 35 | - ./build.sh 36 | -------------------------------------------------------------------------------- /mednafen/pce_fast/pcecd.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCE_CDROM_H 2 | #define __PCE_CDROM_H 3 | 4 | #include 5 | 6 | typedef struct 7 | { 8 | float CDDA_Volume; // Max 2.000... 9 | float ADPCM_Volume; // Max 2.000... 10 | 11 | unsigned int CD_Speed; 12 | 13 | bool ADPCM_LPF; 14 | } PCECD_Settings; 15 | 16 | void PCECD_Run(uint32 in_timestamp); 17 | void PCECD_ResetTS(void); 18 | 19 | bool PCECD_Init(const PCECD_Settings *settings, void (*irqcb)(bool), double master_clock, unsigned int ocm, Blip_Buffer* soundbufs) MDFN_COLD; 20 | bool PCECD_SetSettings(const PCECD_Settings *settings) MDFN_COLD; 21 | void PCECD_Close(void) MDFN_COLD; 22 | void PCECD_Power(uint32 timestamp) MDFN_COLD; 23 | 24 | 25 | uint8 PCECD_Read(uint32 timestamp, uint32); 26 | void PCECD_Write(uint32 timestamp, uint32, uint8 data); 27 | 28 | bool PCECD_IsBRAMEnabled(void); 29 | 30 | int PCECD_StateAction(StateMem *sm, int load, int data_only); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /.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-supergrafx-libretro" "libretro_core_options.h" 37 | -------------------------------------------------------------------------------- /mednafen/cdrom/audioreader.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_AUDIOREADER_H 2 | #define __MDFN_AUDIOREADER_H 3 | 4 | #include "../Stream.h" 5 | 6 | class AudioReader 7 | { 8 | public: 9 | AudioReader(); 10 | virtual ~AudioReader(); 11 | 12 | virtual int64 FrameCount(void); 13 | INLINE int64 Read(int64 frame_offset, int16 *buffer, int64 frames) 14 | { 15 | int64 ret; 16 | 17 | //if(frame_offset >= 0) 18 | { 19 | if(LastReadPos != frame_offset) 20 | { 21 | if(!Seek_(frame_offset)) 22 | return(0); 23 | LastReadPos = frame_offset; 24 | } 25 | } 26 | ret = Read_(buffer, frames); 27 | LastReadPos += ret; 28 | return(ret); 29 | } 30 | 31 | private: 32 | virtual int64 Read_(int16 *buffer, int64 frames); 33 | virtual bool Seek_(int64 frame_offset); 34 | 35 | int64 LastReadPos; 36 | }; 37 | 38 | // AR_Open(), and AudioReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access 39 | // to it for as long as the AudioReader object exists. 40 | AudioReader *AR_Open(Stream *fp); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /mednafen/pce_fast/huc.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 __PCE_HUC_H 19 | #define __PCE_HUC_H 20 | 21 | uint32 HuC_Load(const uint8_t *data, size_t size); 22 | int HuC_LoadCD(const char *bios_path); 23 | void HuC_SaveNV(void) MDFN_COLD; 24 | void HuC_Kill(void) MDFN_COLD; 25 | 26 | int HuC_StateAction(StateMem *sm, int load, int data_only); 27 | 28 | void HuC_Power(void) MDFN_COLD; 29 | 30 | extern bool IsPopulous; 31 | extern bool PCE_IsCD; 32 | 33 | extern uint8 SaveRAM[2048]; 34 | 35 | #endif // __PCE_HUC_H 36 | -------------------------------------------------------------------------------- /mednafen/pce_fast/pce.h: -------------------------------------------------------------------------------- 1 | #ifndef _PCE_H 2 | #define _PCE_H 3 | 4 | #include 5 | 6 | #include "../mednafen-types.h" 7 | #include "../mednafen.h" 8 | #include "../state.h" 9 | #include "../general.h" 10 | #include "psg.h" 11 | 12 | #define PCE_MASTER_CLOCK 21477272.727273 13 | 14 | #define DECLFR(x) uint8 MDFN_FASTCALL x (uint32 A) 15 | #define DECLFW(x) void MDFN_FASTCALL x (uint32 A, uint8 V) 16 | 17 | extern uint8 ROMSpace[0x88 * 8192 + 8192]; 18 | 19 | typedef void (MDFN_FASTCALL *writefunc)(uint32 A, uint8 V); 20 | typedef uint8 (MDFN_FASTCALL *readfunc)(uint32 A); 21 | 22 | extern uint8 PCEIODataBuffer; 23 | 24 | bool PCE_InitCD(void) MDFN_COLD; 25 | 26 | #include "huc6280.h" 27 | 28 | extern bool PCE_ACEnabled; // Arcade Card emulation enabled? 29 | void PCE_Power(void) MDFN_COLD; 30 | 31 | extern int pce_overclocked; 32 | 33 | extern uint8 BaseRAM[32768 + 8192]; 34 | extern bool PCE_IsCD; 35 | 36 | int LoadCD(std::vector *CDInterfaces); 37 | void Load(const uint8_t *data, size_t size, const char *ext); 38 | void DoSimpleCommand(int cmd); 39 | void CloseGame(void); 40 | void Emulate(EmulateSpecStruct *espec); 41 | 42 | extern PCEFast_PSG *psg; 43 | extern bool IsSGX; 44 | 45 | extern uint8 ROMSpace[0x88 * 8192 + 8192]; 46 | extern uint8 BaseRAM[32768 + 8192]; 47 | 48 | #endif 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_BPP := 16 8 | NEED_BLIP := 1 9 | NEED_CD := 1 10 | NEED_STEREO_SOUND := 1 11 | NEED_THREADING := 0 12 | NEED_TREMOR := 1 13 | NEED_CRC32 := 1 14 | HAVE_CHD := 1 15 | IS_X86 := 0 16 | FLAGS := 17 | 18 | 19 | ifeq ($(TARGET_ARCH),x86) 20 | IS_X86 := 1 21 | endif 22 | 23 | include $(CORE_DIR)/Makefile.common 24 | 25 | COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DMEDNAFEN_VERSION_NUMERIC=926 -D__LIBRETRO__ -D_LOW_ACCURACY_ -DINLINE="inline" $(FLAGS) 26 | COREFLAGS += -DWANT_PCE_FAST_EMU 27 | 28 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" 29 | ifneq ($(GIT_VERSION)," unknown") 30 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" 31 | endif 32 | 33 | include $(CLEAR_VARS) 34 | LOCAL_MODULE := retro 35 | LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) 36 | LOCAL_CFLAGS := $(COREFLAGS) 37 | LOCAL_CXXFLAGS := $(COREFLAGS) 38 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T 39 | LOCAL_CPP_FEATURES := exceptions 40 | include $(BUILD_SHARED_LIBRARY) 41 | -------------------------------------------------------------------------------- /mednafen/pce_fast/vpc_mix_inner.inc: -------------------------------------------------------------------------------- 1 | 2 | uint16 vdc2_pixel, vdc1_pixel; 3 | 4 | vdc2_pixel = vdc1_pixel = vce.color_table_cache[0]; 5 | 6 | if(pb & 1) 7 | vdc1_pixel = lb0[x]; 8 | 9 | if(pb & 2) 10 | vdc2_pixel = lb1[x]; 11 | 12 | /* Dai MakaiMura uses setting 1, and expects VDC #2 sprites in front of VDC #1 background, but 13 | behind VDC #1's sprites. 14 | */ 15 | switch(pb >> 2) 16 | { 17 | case 1: 18 | //if((vdc2_pixel & (ALPHA_MASK << 2)) && !(vdc1_pixel & (ALPHA_MASK << 2))) 19 | // vdc1_pixel |= ALPHA_MASK; 20 | vdc1_pixel |= (((vdc2_pixel ^ vdc1_pixel) & vdc2_pixel) >> 2) & ALPHA_MASK; 21 | break; 22 | 23 | case 2: 24 | //if((vdc1_pixel & (ALPHA_MASK << 2)) && !(vdc2_pixel & (ALPHA_MASK << 2)) && !(vdc2_pixel & ALPHA_MASK)) 25 | // vdc1_pixel |= ALPHA_MASK; 26 | // TODO: Verify that this is correct logic. 27 | { 28 | const uint16 intermediate = ((vdc1_pixel ^ vdc2_pixel) & vdc1_pixel) >> 2; 29 | vdc1_pixel |= (intermediate ^ vdc2_pixel) & intermediate & ALPHA_MASK; 30 | } 31 | break; 32 | } 33 | 34 | const uint16 *cm16 = systemColorMap16[vce.CR >> 7]; 35 | if (vdc1_pixel & ALPHA_MASK) 36 | target[x] = cm16[vdc2_pixel & 0x1ff]; 37 | else 38 | target[x] = cm16[vdc1_pixel & 0x1ff]; 39 | -------------------------------------------------------------------------------- /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/error.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_ERROR_H 2 | #define __MDFN_ERROR_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #ifdef __cplusplus 9 | 10 | class ErrnoHolder; 11 | class MDFN_Error : public std::exception 12 | { 13 | public: 14 | 15 | MDFN_Error() throw(); 16 | 17 | MDFN_Error(int errno_code_new, const char *format, ...) throw(); 18 | MDFN_Error(const ErrnoHolder &enh); 19 | 20 | ~MDFN_Error() throw(); 21 | 22 | MDFN_Error(const MDFN_Error &ze_error) throw(); 23 | MDFN_Error & operator=(const MDFN_Error &ze_error) throw(); 24 | 25 | virtual const char *what(void) const throw(); 26 | int GetErrno(void) const throw(); 27 | 28 | private: 29 | 30 | int errno_code; 31 | char *error_message; 32 | }; 33 | 34 | class ErrnoHolder 35 | { 36 | public: 37 | 38 | ErrnoHolder() 39 | { 40 | local_errno = 0; 41 | local_strerror[0] = 0; 42 | } 43 | 44 | ErrnoHolder(int the_errno) 45 | { 46 | SetErrno(the_errno); 47 | } 48 | 49 | inline int Errno(void) const 50 | { 51 | return(local_errno); 52 | } 53 | 54 | const char *StrError(void) const 55 | { 56 | return(local_strerror); 57 | } 58 | 59 | void operator=(int the_errno) 60 | { 61 | SetErrno(the_errno); 62 | } 63 | 64 | private: 65 | 66 | void SetErrno(int the_errno); 67 | 68 | int local_errno; 69 | char local_strerror[256]; 70 | }; 71 | 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /mednafen/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_SETTINGS_H 2 | #define MDFN_SETTINGS_H 3 | 4 | extern bool setting_pce_fast_gexpress; 5 | extern bool setting_pce_fast_forcesgx; 6 | extern bool setting_pce_fast_nospritelimit; 7 | extern bool setting_pce_fast_multitap; 8 | extern bool setting_pce_fast_softreset; 9 | extern int setting_initial_scanline; 10 | extern int setting_last_scanline; 11 | extern int setting_pce_overclocked; 12 | extern int setting_pce_hoverscan; 13 | extern int setting_pce_fast_cddavolume; 14 | extern int setting_pce_fast_adpcmvolume; 15 | extern int setting_pce_fast_cdpsgvolume; 16 | extern int setting_pce_fast_cdspeed; 17 | extern const char *setting_pce_fast_cdbios; 18 | extern bool OrderOfGriffonFix; 19 | 20 | bool MDFN_LoadSettings(const char *path, const char *section = NULL, bool override = false); 21 | bool MDFN_MergeSettings(const void*); 22 | bool MDFN_MergeSettings(const std::vector &); 23 | bool MDFN_SaveSettings(const char *path); 24 | 25 | void MDFN_KillSettings(void); // Free any resources acquired. 26 | 27 | // This should assert() or something if the setting isn't found, since it would 28 | // be a totally tubular error! 29 | uint64 MDFN_GetSettingUI(const char *name); 30 | int64 MDFN_GetSettingI(const char *name); 31 | double MDFN_GetSettingF(const char *name); 32 | bool MDFN_GetSettingB(const char *name); 33 | const char *MDFN_GetSettingS(const char *name); 34 | #endif 35 | -------------------------------------------------------------------------------- /mednafen/cdrom/l-ec.h: -------------------------------------------------------------------------------- 1 | #ifndef _L_EC_H 2 | #define _L_EC_H 3 | 4 | #include 5 | #include "galois.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define N_P_VECTORS 86 /* 43 16bit p vectors */ 12 | #define P_VECTOR_SIZE 26 /* using RS(26,24) ECC */ 13 | 14 | #define N_Q_VECTORS 52 /* 26 16bit q vectors */ 15 | #define Q_VECTOR_SIZE 45 /* using RS(45,43) ECC */ 16 | 17 | #define P_PADDING 229 /* padding values for */ 18 | #define Q_PADDING 210 /* shortened RS code */ 19 | 20 | int PToByteIndex(int, int); 21 | int QToByteIndex(int, int); 22 | void ByteIndexToP(int, int*, int*); 23 | void ByteIndexToQ(int, int*, int*); 24 | 25 | void GetPVector(unsigned char*, unsigned char*, int); 26 | void SetPVector(unsigned char*, unsigned char*, int); 27 | void FillPVector(unsigned char*, unsigned char, int); 28 | void AndPVector(unsigned char*, unsigned char, int); 29 | void OrPVector(unsigned char*, unsigned char, int); 30 | 31 | void GetQVector(unsigned char*, unsigned char*, int); 32 | void SetQVector(unsigned char*, unsigned char*, int); 33 | void FillQVector(unsigned char*, unsigned char, int); 34 | void AndQVector(unsigned char*, unsigned char, int); 35 | void OrQVector(unsigned char*, unsigned char, int); 36 | 37 | int DecodePQ(ReedSolomonTables*, unsigned char*, int, int*, int); 38 | 39 | int CountC2Errors(unsigned char*); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /mednafen/hw_misc/arcade_card/arcade_card.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PCE_ARCADE_CARD_H 2 | #define __MDFN_PCE_ARCADE_CARD_H 3 | 4 | #include "../../mednafen-types.h" 5 | #include "../../state.h" 6 | 7 | typedef struct 8 | { 9 | uint32 base; // 24 bits 10 | uint16 offset; // 16 bits 11 | uint16 increment; // 16 bits 12 | uint8 control; // 7 bits 13 | } ACPort_t; 14 | 15 | typedef struct 16 | { 17 | ACPort_t ports[4]; 18 | uint32 shift_latch; // 32 bits 19 | uint8 shift_bits; // signed 4-bit value 20 | uint8 rotate_bits; // same 21 | } ArcadeCard_t; 22 | 23 | class ArcadeCard 24 | { 25 | public: 26 | 27 | ArcadeCard(void); 28 | ~ArcadeCard(); 29 | 30 | void Power(void); 31 | int StateAction(StateMem *sm, int load, int data_only); 32 | 33 | 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). 34 | void Write(uint32 A, uint8 V); 35 | 36 | INLINE void PhysWrite(uint32 A, uint8 V) 37 | { 38 | Write(0x1a00 | ((A >> 9) & 0x30), V); 39 | } 40 | 41 | INLINE uint8 PhysRead(uint32 A, bool peek = false) 42 | { 43 | return(Read(0x1a00 | ((A >> 9) & 0x30), peek)); 44 | } 45 | 46 | 47 | void PeekRAM(uint32 Address, uint32 Length, uint8 *Buffer); 48 | void PokeRAM(uint32 Address, uint32 Length, const uint8 *Buffer); 49 | 50 | private: 51 | 52 | ArcadeCard_t AC; 53 | 54 | bool ACRAMUsed; 55 | uint8 ACRAM[0x200000]; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess_CCD.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 CDACCESS_CCD_H 19 | #define CDACCESS_CCD_H 20 | 21 | #include "../FileStream.h" 22 | #include "../MemoryStream.h" 23 | #include "CDAccess.h" 24 | 25 | #include 26 | 27 | class CDAccess_CCD : public CDAccess 28 | { 29 | public: 30 | 31 | CDAccess_CCD(const char *path, bool image_memcache); 32 | virtual ~CDAccess_CCD(); 33 | 34 | virtual void Read_Raw_Sector(uint8 *buf, int32 lba); 35 | 36 | virtual void Read_TOC(TOC *toc); 37 | 38 | virtual void Eject(bool eject_status); 39 | 40 | private: 41 | 42 | void Load(const char *path, bool image_memcache); 43 | void Cleanup(void); 44 | 45 | void CheckSubQSanity(void); 46 | 47 | Stream* img_stream; 48 | Stream* sub_stream; 49 | size_t img_numsectors; 50 | TOC tocd; 51 | }; 52 | 53 | #endif /* CDACCESS_CCD_H */ -------------------------------------------------------------------------------- /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 | #ifndef __MDFN_FILESTREAM_H 19 | #define __MDFN_FILESTREAM_H 20 | 21 | #include 22 | 23 | #include "Stream.h" 24 | #include "FileWrapper.h" 25 | 26 | class FileStream : public Stream 27 | { 28 | public: 29 | 30 | enum 31 | { 32 | MODE_READ = FileWrapper::MODE_READ, 33 | MODE_WRITE = FileWrapper::MODE_WRITE, 34 | MODE_WRITE_SAFE = FileWrapper::MODE_WRITE_SAFE, 35 | }; 36 | 37 | FileStream(const char *path, const int mode); 38 | virtual ~FileStream(); 39 | 40 | virtual uint64 read(void *data, uint64 count); 41 | virtual void write(const void *data, uint64 count); 42 | virtual void seek(int64 offset, int whence); 43 | virtual int64 tell(void); 44 | virtual int64 size(void); 45 | virtual void close(void); 46 | 47 | private: 48 | RFILE *fp; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/coretypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __CORETYPES_H__ 2 | #define __CORETYPES_H__ 3 | 4 | #include 5 | #include 6 | 7 | #ifdef USE_LIBRETRO_VFS 8 | #include 9 | #endif 10 | 11 | #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) 12 | 13 | typedef uint64_t UINT64; 14 | typedef uint32_t UINT32; 15 | typedef uint16_t UINT16; 16 | typedef uint8_t UINT8; 17 | 18 | typedef int64_t INT64; 19 | typedef int32_t INT32; 20 | typedef int16_t INT16; 21 | typedef int8_t INT8; 22 | 23 | #ifdef USE_LIBRETRO_VFS 24 | #define core_file RFILE 25 | #define core_fopen(file) rfopen(file, "rb") 26 | #define core_fseek rfseek 27 | #define core_ftell rftell 28 | #define core_fread(fc, buff, len) fread(buff, 1, len, fc) 29 | #define core_fclose rfclose 30 | #else 31 | #define core_file FILE 32 | #define core_fopen(file) fopen(file, "rb") 33 | #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__) 34 | #define core_fseek _fseeki64 35 | #define core_ftell _ftelli64 36 | #elif defined(_LARGEFILE_SOURCE) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 37 | #define core_fseek fseeko64 38 | #define core_ftell ftello64 39 | #else 40 | #define core_fseek fseeko 41 | #define core_ftell ftello 42 | #endif 43 | #define core_fread(fc, buff, len) fread(buff, 1, len, fc) 44 | #define core_fclose fclose 45 | #endif /* USE_LIBRETRO_VFS */ 46 | 47 | static UINT64 core_fsize(core_file *f) 48 | { 49 | UINT64 rv; 50 | UINT64 p = core_ftell(f); 51 | core_fseek(f, 0, SEEK_END); 52 | rv = core_ftell(f); 53 | core_fseek(f, p, SEEK_SET); 54 | return rv; 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 19 | #include 20 | #ifdef _WIN32 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | #include "../mednafen.h" 27 | 28 | #include "CDAccess.h" 29 | #include "CDAccess_Image.h" 30 | #include "CDAccess_CCD.h" 31 | #include "CDAccess_CHD.h" 32 | 33 | CDAccess::CDAccess() 34 | { 35 | 36 | } 37 | 38 | CDAccess::~CDAccess() 39 | { 40 | 41 | } 42 | 43 | CDAccess *cdaccess_open_image(const char *path, bool image_memcache) 44 | { 45 | CDAccess *ret = NULL; 46 | 47 | if(strlen(path) >= 4 && !strcasecmp(path + strlen(path) - 4, ".ccd")) 48 | ret = new CDAccess_CCD(path, image_memcache); 49 | #ifdef HAVE_CHD 50 | else if(strlen(path) >= 4 && !strcasecmp(path + strlen(path) - 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/FileWrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_FILEWRAPPER_H 2 | #define __MDFN_FILEWRAPPER_H 3 | 4 | #include 5 | 6 | // An RFILE wrapper(with some BSD and POSIXisms, and a little dash of Win32, thrown in for special behaviors) 7 | class FileWrapper 8 | { 9 | public: 10 | 11 | enum 12 | { 13 | MODE_READ = 0, 14 | MODE_WRITE, 15 | MODE_WRITE_SAFE // Will throw an exception instead of overwriting an existing file. 16 | }; 17 | 18 | FileWrapper(const char *path, const int mode, const char *purpose = NULL); 19 | ~FileWrapper(); 20 | 21 | uint64 read(void *data, uint64 count, bool error_on_eof = true); 22 | 23 | void write(const void *data, uint64 count); 24 | 25 | void put_char(int c); 26 | 27 | void put_string(const char *str); 28 | void put_string(const std::string &str); 29 | 30 | char *get_line(char *s, int size); // Same semantics as fgets(), for now 31 | 32 | void seek(int64 offset, int whence); 33 | 34 | int64 tell(void); 35 | 36 | int64 size(void); 37 | 38 | void close(void); // Flushes and closes the underlying OS/C lib file. Calling any other method of this class after a call to 39 | // this method is illegal(except for the implicit call to the destructor). 40 | // 41 | // This is necessary since there can be errors when closing a file, and we can't safely throw an 42 | // exception from the destructor. 43 | // 44 | // Manually calling this method isn't strictly necessary, it'll be called from the destructor 45 | // automatically, but calling is strongly recommended when the file is opened for writing. 46 | private: 47 | 48 | FileWrapper & operator=(const FileWrapper &); // Assignment operator 49 | FileWrapper(const FileWrapper &); // Copy constructor 50 | 51 | RFILE *fp; 52 | const int OpenedMode; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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: '15 1 * * 5' # Fridays at 1:15 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-supergrafx-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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/file.c: -------------------------------------------------------------------------------- 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 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #include "file.h" 26 | #include "mednafen-endian.h" 27 | 28 | struct MDFNFILE *file_open(const char *path) 29 | { 30 | int64_t size = 0; 31 | const char *ld = NULL; 32 | struct MDFNFILE *file = (struct MDFNFILE*)calloc(1, sizeof(*file)); 33 | 34 | if (!file) 35 | return NULL; 36 | 37 | if (!filestream_read_file(path, (void**)&file->data, &size)) 38 | goto error; 39 | 40 | ld = (const char*)strrchr(path, '.'); 41 | file->size = size; 42 | file->ext = strdup(ld ? ld + 1 : ""); 43 | 44 | return file; 45 | 46 | error: 47 | if (file) 48 | free(file); 49 | return NULL; 50 | } 51 | 52 | int file_close(struct MDFNFILE *file) 53 | { 54 | if (!file) 55 | return 0; 56 | 57 | if (file->ext) 58 | free(file->ext); 59 | file->ext = NULL; 60 | 61 | if (file->data) 62 | free(file->data); 63 | file->data = NULL; 64 | 65 | free(file); 66 | 67 | return 1; 68 | } 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 "Stream.h" 24 | 25 | class MemoryStream : public Stream 26 | { 27 | public: 28 | 29 | MemoryStream(); 30 | MemoryStream(uint64 size_hint); 31 | MemoryStream(Stream *stream); // Will create a MemoryStream equivalent of the contents of "stream", and then "delete stream". 32 | // Will only work if stream->tell() == 0, or if "stream" is seekable. 33 | // stream will be deleted even if this constructor throws. 34 | 35 | MemoryStream(const MemoryStream &zs); 36 | MemoryStream & operator=(const MemoryStream &zs); 37 | 38 | virtual ~MemoryStream(); 39 | 40 | virtual uint8 *map(void); 41 | virtual void unmap(void); 42 | 43 | virtual uint64 read(void *data, uint64 count); 44 | virtual void write(const void *data, uint64 count); 45 | virtual void seek(int64 offset, int whence); 46 | virtual int64 tell(void); 47 | virtual int64 size(void); 48 | virtual void close(void); 49 | 50 | virtual int get_line(std::string &str); 51 | 52 | private: 53 | uint8 *data_buffer; 54 | uint64 data_buffer_size; 55 | uint64 data_buffer_alloced; 56 | 57 | int64 position; 58 | 59 | void grow_if_necessary(uint64 new_required_size); 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /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/math_ops.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MATH_OPS_H 2 | #define __MDFN_MATH_OPS_H 3 | 4 | // Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 5 | // Rounds up to the nearest power of 2. 6 | static INLINE uint64 round_up_pow2(uint64 v) 7 | { 8 | v--; 9 | v |= v >> 1; 10 | v |= v >> 2; 11 | v |= v >> 4; 12 | v |= v >> 8; 13 | v |= v >> 16; 14 | v |= v >> 32; 15 | v++; 16 | 17 | v += (v == 0); 18 | 19 | return(v); 20 | } 21 | 22 | static INLINE uint32 uilog2(uint32 v) 23 | { 24 | // http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn 25 | 26 | static const uint32 MultiplyDeBruijnBitPosition[32] = 27 | { 28 | 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 29 | 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 30 | }; 31 | 32 | v |= v >> 1; // first round down to one less than a power of 2 33 | v |= v >> 2; 34 | v |= v >> 4; 35 | v |= v >> 8; 36 | v |= v >> 16; 37 | 38 | return MultiplyDeBruijnBitPosition[(uint32_t)(v * 0x07C4ACDDU) >> 27]; 39 | } 40 | 41 | // Some compilers' optimizers and some platforms might fubar the generated code from these macros, 42 | // so some tests are run in...tests.cpp 43 | #define sign_8_to_s16(_value) ((int16)(int8)(_value)) 44 | #define sign_9_to_s16(_value) (((int16)((unsigned int)(_value) << 7)) >> 7) 45 | #define sign_10_to_s16(_value) (((int16)((uint32)(_value) << 6)) >> 6) 46 | #define sign_11_to_s16(_value) (((int16)((uint32)(_value) << 5)) >> 5) 47 | #define sign_12_to_s16(_value) (((int16)((uint32)(_value) << 4)) >> 4) 48 | #define sign_13_to_s16(_value) (((int16)((uint32)(_value) << 3)) >> 3) 49 | #define sign_14_to_s16(_value) (((int16)((uint32)(_value) << 2)) >> 2) 50 | #define sign_15_to_s16(_value) (((int16)((uint32)(_value) << 1)) >> 1) 51 | 52 | // This obviously won't convert higher-than-32 bit numbers to signed 32-bit ;) 53 | // Also, this shouldn't be used for 8-bit and 16-bit signed numbers, since you can 54 | // convert those faster with typecasts... 55 | #define sign_x_to_s32(_bits, _value) (((int32)((uint32)(_value) << (32 - _bits))) >> (32 - _bits)) 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /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/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 | #include 23 | #include 24 | #include 25 | 26 | // Python headers defines ssize_t and sets HAVE_SSIZE_T. Cannot duplicate these efforts. 27 | #ifndef HAVE_SSIZE_T 28 | #if defined(_WIN64) 29 | typedef __int64 ssize_t; 30 | #elif defined(_WIN32) 31 | typedef int ssize_t; 32 | #endif 33 | #endif 34 | 35 | #define snprintf _snprintf 36 | #define strtoll _strtoi64 37 | #define strtoull _strtoui64 38 | #define strcasecmp _stricmp 39 | #define strncasecmp _strnicmp 40 | #define strdup _strdup 41 | #define lseek _lseek 42 | 43 | #include 44 | #define strlen _tcslen 45 | 46 | # define S_IRUSR S_IREAD /* read, user */ 47 | # define S_IWUSR S_IWRITE /* write, user */ 48 | 49 | // Disable some of the annoying warnings. 50 | #pragma warning(disable : 4800) 51 | #pragma warning(disable : 4244) 52 | #pragma warning(disable : 4305) 53 | #pragma warning(disable : 4146) 54 | #pragma warning(disable : 4267) 55 | 56 | #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) 57 | 58 | #ifndef PATH_MAX 59 | #define PATH_MAX MAX_PATH 60 | #endif 61 | 62 | #endif 63 | #endif 64 | 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 | -------------------------------------------------------------------------------- /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 uint32 CanRead(void) 31 | { 32 | return(in_count); 33 | } 34 | 35 | INLINE uint32 CanWrite(void) 36 | { 37 | return(size - in_count); 38 | } 39 | 40 | INLINE T ReadUnit(bool peek = false) 41 | { 42 | T ret; 43 | 44 | assert(in_count > 0); 45 | 46 | ret = data[read_pos]; 47 | 48 | if(!peek) 49 | { 50 | read_pos = (read_pos + 1) & (data.size() - 1); 51 | in_count--; 52 | } 53 | 54 | return(ret); 55 | } 56 | 57 | INLINE uint8 ReadByte(bool peek = false) 58 | { 59 | assert(sizeof(T) == 1); 60 | 61 | return(ReadUnit(peek)); 62 | } 63 | 64 | INLINE void Write(const T *happy_data, uint32 happy_count) 65 | { 66 | assert(CanWrite() >= happy_count); 67 | 68 | while(happy_count) 69 | { 70 | data[write_pos] = *happy_data; 71 | 72 | write_pos = (write_pos + 1) & (data.size() - 1); 73 | in_count++; 74 | happy_data++; 75 | happy_count--; 76 | } 77 | } 78 | 79 | INLINE void WriteUnit(const T& wr_data) 80 | { 81 | Write(&wr_data, 1); 82 | } 83 | 84 | INLINE void WriteByte(const T& wr_data) 85 | { 86 | assert(sizeof(T) == 1); 87 | Write(&wr_data, 1); 88 | } 89 | 90 | 91 | INLINE void Flush(void) 92 | { 93 | read_pos = 0; 94 | write_pos = 0; 95 | in_count = 0; 96 | } 97 | 98 | //private: 99 | std::vector data; 100 | uint32 size; 101 | uint32 read_pos; // Read position 102 | uint32 write_pos; // Write position 103 | uint32 in_count; // Number of units in the FIFO 104 | }; 105 | 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /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/galois.h: -------------------------------------------------------------------------------- 1 | #ifndef _GALOIS_H 2 | #define _GALOIS_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /*** 12 | *** galois.c 13 | *** 14 | * This is currently the hardcoded GF(2**8). 15 | * int32_t gives abundant space for the GF. 16 | * Squeezing it down to uint8 won't probably gain much, 17 | * so we implement this defensively here. 18 | * 19 | * Note that some performance critical stuff needs to 20 | * be #included from galois-inlines.h 21 | */ 22 | 23 | /* Galois field parameters for 8bit symbol Reed-Solomon code */ 24 | 25 | #define GF_SYMBOLSIZE 8 26 | #define GF_FIELDSIZE (1<= GF_FIELDMAX) 58 | { 59 | x -= GF_FIELDMAX; 60 | x = (x >> GF_SYMBOLSIZE) + (x & GF_FIELDMAX); 61 | } 62 | 63 | return x; 64 | } 65 | 66 | GaloisTables* CreateGaloisTables(int32_t a); 67 | void FreeGaloisTables(GaloisTables *a); 68 | 69 | ReedSolomonTables *CreateReedSolomonTables(GaloisTables *a, int32_t b, int32_t c, int d); 70 | void FreeReedSolomonTables(ReedSolomonTables *a); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/FileStream.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 "Stream.h" 20 | #include "FileStream.h" 21 | 22 | #include 23 | #include 24 | 25 | extern "C" { 26 | RFILE* rfopen(const char *path, const char *mode); 27 | int rfclose(RFILE* stream); 28 | int64_t rfread(void* buffer, 29 | size_t elem_size, size_t elem_count, RFILE* stream); 30 | int64_t rfwrite(void const* buffer, 31 | size_t elem_size, size_t elem_count, RFILE* stream); 32 | int64_t rfseek(RFILE* stream, int64_t offset, int origin); 33 | int64_t rftell(RFILE* stream); 34 | } 35 | 36 | FileStream::FileStream(const char *path, const int mode) 37 | { 38 | if(mode == FileStream::MODE_WRITE) 39 | fp = rfopen(path, "wb"); 40 | else 41 | fp = rfopen(path, "rb"); 42 | } 43 | 44 | FileStream::~FileStream() 45 | { 46 | close(); 47 | } 48 | 49 | uint64 FileStream::read(void *data, uint64 count) 50 | { 51 | return rfread(data, 1, count, fp); 52 | } 53 | 54 | void FileStream::write(const void *data, uint64 count) 55 | { 56 | rfwrite(data, 1, count, fp); 57 | } 58 | 59 | void FileStream::seek(int64 offset, int whence) 60 | { 61 | rfseek(fp, offset, whence); 62 | } 63 | 64 | int64 FileStream::tell(void) 65 | { 66 | return rftell(fp); 67 | } 68 | 69 | int64 FileStream::size(void) 70 | { 71 | return filestream_get_size(fp); 72 | } 73 | 74 | void FileStream::close(void) 75 | { 76 | if(!fp) 77 | return; 78 | 79 | RFILE *tmp = fp; 80 | fp = NULL; 81 | rfclose(tmp); 82 | } 83 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess_Image.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDACCESS_IMAGE_H 2 | #define __MDFN_CDACCESS_IMAGE_H 3 | 4 | #include 5 | 6 | class Stream; 7 | class AudioReader; 8 | 9 | struct CDRFILE_TRACK_INFO 10 | { 11 | int32 LBA; 12 | 13 | uint32 DIFormat; 14 | uint8 subq_control; 15 | 16 | int32 pregap; 17 | int32 pregap_dv; 18 | 19 | int32 postgap; 20 | 21 | int32 index[2]; 22 | 23 | int32 sectors; // Not including pregap sectors! 24 | Stream *fp; 25 | bool FirstFileInstance; 26 | bool RawAudioMSBFirst; 27 | long FileOffset; 28 | unsigned int SubchannelMode; 29 | 30 | uint32 LastSamplePos; 31 | 32 | AudioReader *AReader; 33 | }; 34 | #if 0 35 | struct Medium_Chunk 36 | { 37 | int64 Offset; // Offset in [..TODO..] 38 | uint32 DIFormat; 39 | 40 | FILE *fp; 41 | bool FirstFileInstance; 42 | bool RawAudioMSBFirst; 43 | unsigned int SubchannelMode; 44 | 45 | uint32 LastSamplePos; 46 | AudioReader *AReader; 47 | }; 48 | 49 | struct CD_Chunk 50 | { 51 | int32 LBA; 52 | int32 Track; 53 | int32 Index; 54 | bool DataType; 55 | 56 | Medium_Chunk Medium; 57 | }; 58 | 59 | static std::vector Chunks; 60 | #endif 61 | 62 | class CDAccess_Image : public CDAccess 63 | { 64 | public: 65 | 66 | CDAccess_Image(const char *path, bool image_memcache); 67 | virtual ~CDAccess_Image(); 68 | 69 | virtual void Read_Raw_Sector(uint8 *buf, int32 lba); 70 | 71 | virtual void Read_TOC(TOC *toc); 72 | 73 | virtual void Eject(bool eject_status); 74 | private: 75 | 76 | int32 NumTracks; 77 | int32 FirstTrack; 78 | int32 LastTrack; 79 | int32 total_sectors; 80 | uint8 disc_type; 81 | CDRFILE_TRACK_INFO Tracks[100]; // Track #0(HMM?) through 99 82 | 83 | std::string base_dir; 84 | 85 | void ImageOpen(const char *path, bool image_memcache); 86 | void Cleanup(void); 87 | 88 | // MakeSubPQ will OR the simulated P and Q subchannel data into SubPWBuf. 89 | void MakeSubPQ(int32 lba, uint8 *SubPWBuf); 90 | 91 | void ParseTOCFileLineInfo(CDRFILE_TRACK_INFO *track, const int tracknum, const std::string &filename, const char *binoffset, const char *msfoffset, const char *length, bool image_memcache, std::map &toc_streamcache); 92 | uint32 GetSectorCount(CDRFILE_TRACK_INFO *track); 93 | }; 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /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) 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 | -------------------------------------------------------------------------------- /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/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 24 | #include 25 | 26 | #include 27 | 28 | /* Implementation of strlcpy()/strlcat() based on OpenBSD. */ 29 | 30 | #ifndef __MACH__ 31 | 32 | size_t strlcpy(char *dest, const char *source, size_t size) 33 | { 34 | size_t src_size = 0; 35 | size_t n = size; 36 | 37 | if (n) 38 | while (--n && (*dest++ = *source++)) src_size++; 39 | 40 | if (!n) 41 | { 42 | if (size) *dest = '\0'; 43 | while (*source++) src_size++; 44 | } 45 | 46 | return src_size; 47 | } 48 | 49 | size_t strlcat(char *dest, const char *source, size_t size) 50 | { 51 | size_t len = strlen(dest); 52 | 53 | dest += len; 54 | 55 | if (len > size) 56 | size = 0; 57 | else 58 | size -= len; 59 | 60 | return len + strlcpy(dest, source, size); 61 | } 62 | #endif 63 | 64 | char *strldup(const char *s, size_t n) 65 | { 66 | char *dst = (char*)malloc(sizeof(char) * (n + 1)); 67 | strlcpy(dst, s, n); 68 | return dst; 69 | } 70 | -------------------------------------------------------------------------------- /libretro-common/include/vfs/vfs_implementation_cdrom.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (vfs_implementation_cdrom.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_VFS_IMPLEMENTATION_CDROM_H 24 | #define __LIBRETRO_SDK_VFS_IMPLEMENTATION_CDROM_H 25 | 26 | #include 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 | -------------------------------------------------------------------------------- /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 "../Stream.h" 23 | 24 | #include 25 | 26 | class CDIF 27 | { 28 | public: 29 | 30 | CDIF(); 31 | virtual ~CDIF(); 32 | 33 | inline void ReadTOC(TOC *read_target) 34 | { 35 | *read_target = disc_toc; 36 | } 37 | 38 | virtual void HintReadSector(uint32 lba) = 0; 39 | virtual bool ReadRawSector(uint8 *buf, uint32 lba) = 0; 40 | 41 | // Call for mode 1 or mode 2 form 1 only. 42 | bool ValidateRawSector(uint8 *buf); 43 | 44 | // Utility/Wrapped functions 45 | // Reads mode 1 and mode2 form 1 sectors(2048 bytes per sector returned) 46 | // Will return the type(1, 2) of the first sector read to the buffer supplied, 0 on error 47 | int ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors); 48 | 49 | // Return true if operation succeeded or it was a NOP(either due to not being implemented, or the current status matches eject_status). 50 | // Returns false on failure(usually drive error of some kind; not completely fatal, can try again). 51 | virtual bool Eject(bool eject_status) = 0; 52 | 53 | inline bool IsPhysical(void) { return(is_phys_cache); } 54 | 55 | // For Mode 1, or Mode 2 Form 1. 56 | // No reference counting or whatever is done, so if you destroy the CDIF object before you destroy the returned Stream, things will go BOOM. 57 | Stream *MakeStream(uint32 lba, uint32 sector_count); 58 | 59 | protected: 60 | bool UnrecoverableError; 61 | bool is_phys_cache; 62 | TOC disc_toc; 63 | bool DiscEjected; 64 | }; 65 | 66 | CDIF *CDIF_Open(const char *path, const bool is_device, bool image_memcache); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /libretro-common/compat/fopen_utf8.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) 29 | #ifndef LEGACY_WIN32 30 | #define LEGACY_WIN32 31 | #endif 32 | #endif 33 | 34 | #ifdef _WIN32 35 | #undef fopen 36 | 37 | void *fopen_utf8(const char * filename, const char * mode) 38 | { 39 | #if defined(LEGACY_WIN32) 40 | FILE *ret = NULL; 41 | char * filename_local = utf8_to_local_string_alloc(filename); 42 | 43 | if (!filename_local) 44 | return NULL; 45 | ret = fopen(filename_local, mode); 46 | if (filename_local) 47 | free(filename_local); 48 | return ret; 49 | #else 50 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 51 | wchar_t * mode_w = utf8_to_utf16_string_alloc(mode); 52 | FILE* ret = NULL; 53 | 54 | if (filename_w && mode_w) 55 | ret = _wfopen(filename_w, mode_w); 56 | if (filename_w) 57 | free(filename_w); 58 | if (mode_w) 59 | free(mode_w); 60 | return ret; 61 | #endif 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /libretro-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 | -------------------------------------------------------------------------------- /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 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #ifndef TRUE 31 | #define TRUE 1 32 | #endif 33 | 34 | /* Encodes a MODE 0 sector. 35 | * 'adr' is the current physical sector address 36 | * 'sector' must be 2352 byte wide 37 | */ 38 | void lec_encode_mode0_sector(uint32_t adr, uint8_t *sector); 39 | 40 | /* Encodes a MODE 1 sector. 41 | * 'adr' is the current physical sector address 42 | * 'sector' must be 2352 byte wide containing 2048 bytes user data at 43 | * offset 16 44 | */ 45 | void lec_encode_mode1_sector(uint32_t adr, uint8_t *sector); 46 | 47 | /* Encodes a MODE 2 sector. 48 | * 'adr' is the current physical sector address 49 | * 'sector' must be 2352 byte wide containing 2336 bytes user data at 50 | * offset 16 51 | */ 52 | void lec_encode_mode2_sector(uint32_t adr, uint8_t *sector); 53 | 54 | /* Encodes a XA form 1 sector. 55 | * 'adr' is the current physical sector address 56 | * 'sector' must be 2352 byte wide containing 2048+8 bytes user data at 57 | * offset 16 58 | */ 59 | void lec_encode_mode2_form1_sector(uint32_t adr, uint8_t *sector); 60 | 61 | /* Encodes a XA form 2 sector. 62 | * 'adr' is the current physical sector address 63 | * 'sector' must be 2352 byte wide containing 2324+8 bytes user data at 64 | * offset 16 65 | */ 66 | void lec_encode_mode2_form2_sector(uint32_t adr, uint8_t *sector); 67 | 68 | /* Scrambles and byte swaps an encoded sector. 69 | * 'sector' must be 2352 byte wide. 70 | */ 71 | void lec_scramble(uint8_t *sector); 72 | 73 | void lec_tables_init(void); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /libretro-common/include/encodings/utf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (utf.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_ENCODINGS_UTF_H 24 | #define _LIBRETRO_ENCODINGS_UTF_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | enum CodePage 36 | { 37 | CODEPAGE_LOCAL = 0, /* CP_ACP */ 38 | CODEPAGE_UTF8 = 65001 /* CP_UTF8 */ 39 | }; 40 | 41 | size_t utf8_conv_utf32(uint32_t *out, size_t out_chars, 42 | const char *in, size_t in_size); 43 | 44 | bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, 45 | const uint16_t *in, size_t in_size); 46 | 47 | size_t utf8len(const char *string); 48 | 49 | size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars); 50 | 51 | const char *utf8skip(const char *str, size_t chars); 52 | 53 | uint32_t utf8_walk(const char **string); 54 | 55 | bool utf16_to_char_string(const uint16_t *in, char *s, size_t len); 56 | 57 | char* utf8_to_local_string_alloc(const char *str); 58 | 59 | char* local_to_utf8_string_alloc(const char *str); 60 | 61 | wchar_t* utf8_to_utf16_string_alloc(const char *str); 62 | 63 | char* utf16_to_utf8_string_alloc(const wchar_t *str); 64 | 65 | RETRO_END_DECLS 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /libretro-common/include/compat/apple_compat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (apple_compat.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 __APPLE_COMPAT_H 24 | #define __APPLE_COMPAT_H 25 | 26 | #ifdef __APPLE__ 27 | #include 28 | #endif 29 | 30 | #ifdef __OBJC__ 31 | 32 | #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4) 33 | typedef int NSInteger; 34 | typedef unsigned NSUInteger; 35 | typedef float CGFloat; 36 | #endif 37 | 38 | #ifndef __has_feature 39 | /* Compatibility with non-Clang compilers. */ 40 | #define __has_feature(x) 0 41 | #endif 42 | 43 | #ifndef CF_RETURNS_RETAINED 44 | #if __has_feature(attribute_cf_returns_retained) 45 | #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) 46 | #else 47 | #define CF_RETURNS_RETAINED 48 | #endif 49 | #endif 50 | 51 | #ifndef NS_INLINE 52 | #define NS_INLINE inline 53 | #endif 54 | 55 | NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetainCompat(id X) 56 | { 57 | #if __has_feature(objc_arc) 58 | return (__bridge_retained CFTypeRef)X; 59 | #else 60 | return X; 61 | #endif 62 | } 63 | 64 | #endif 65 | 66 | #ifdef IOS 67 | #ifndef __IPHONE_5_0 68 | #warning "This project uses features only available in iOS SDK 5.0 and later." 69 | #endif 70 | 71 | #ifdef __OBJC__ 72 | #import 73 | #import 74 | #import 75 | #endif 76 | 77 | #else 78 | 79 | #ifdef __OBJC__ 80 | #include 81 | #endif 82 | #endif 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /libretro-common/time/rtime.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifdef HAVE_THREADS 24 | #include 25 | #include 26 | #include 27 | #endif 28 | 29 | #include 30 | #include