├── jni ├── Application.mk └── Android.mk ├── link.T ├── intl ├── .gitignore ├── crowdin.yaml ├── upload_workflow.py ├── download_workflow.py ├── crowdin_prep.py ├── remove_initial_cycle.py ├── crowdin_translate.py └── activate.py ├── deps ├── libchdr │ ├── src │ │ └── link.T │ ├── include │ │ └── libchdr │ │ │ ├── chdconfig.h │ │ │ ├── bitstream.h │ │ │ ├── coretypes.h │ │ │ └── flac.h │ ├── README.md │ └── LICENSE.txt ├── 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 └── zlib-1.2.11 │ ├── inffast.h │ ├── crc32.c │ ├── zutil.h │ ├── inftrees.h │ └── adler32.c ├── .gitignore ├── mednafen ├── pcfx │ ├── input │ │ ├── mouse.h │ │ ├── gamepad.h │ │ └── mouse.cpp │ ├── huc6273.h │ ├── jrevdct.h │ ├── rainbow.h │ ├── interrupt.h │ ├── timer.h │ ├── soundbox.h │ ├── pcfx.h │ ├── input.h │ ├── king.h │ └── king_mix_body.inc ├── file.h ├── video │ ├── Deinterlacer.h │ └── surface.h ├── clamp.h ├── md5.h ├── mempatcher.h ├── mednafen.h ├── masmem.h ├── cdrom │ ├── CDAccess.h │ ├── CDAFReader_MPC.h │ ├── CDAFReader_Vorbis.h │ ├── galois-inlines.h │ ├── CDAccess.cpp │ ├── CDAccess_CCD.h │ ├── SimpleFIFO.h │ ├── CDAFReader.cpp │ ├── CDAFReader.h │ ├── cdromif.h │ ├── lec.h │ ├── CDAccess_Image.h │ └── CDAccess_CHD.h ├── general.h ├── settings.h ├── tremor │ ├── block.h │ ├── window.h │ ├── COPYING │ ├── os.h │ ├── registry.h │ ├── mdct.h │ ├── registry.c │ ├── README │ └── window.c ├── Stream.cpp ├── mempatcher-driver.h ├── math_ops.h ├── FileStream.h ├── state.h ├── mednafen-types.h ├── file.c ├── hw_cpu │ └── v810 │ │ ├── v810_fp_ops.h │ │ ├── v810_do_am.h │ │ └── v810_op_table.inc ├── state_helpers.h ├── lepacker.h ├── MemoryStream.h ├── msvc_compat.h ├── FileStream.cpp └── settings.c ├── readme.md ├── appveyor.yml ├── .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 ├── encodings │ └── crc32.h ├── retro_assert.h ├── memalign.h ├── retro_inline.h ├── boolean.h ├── retro_common.h ├── time │ └── rtime.h ├── memmap.h ├── retro_stat.h ├── vfs │ └── vfs_implementation_cdrom.h └── retro_dirent.h ├── compat ├── compat_strl.c ├── compat_strcasestr.c ├── fopen_utf8.c ├── compat_snprintf.c └── compat_posix_string.c ├── rthreads └── xenon_sdl_threads.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 | *.d 4 | *.dll 5 | *.dylib 6 | *.lib 7 | *.pdb 8 | *.exp 9 | *.manifest 10 | /new 11 | 12 | -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma-history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-pcfx-libretro/HEAD/deps/lzma-19.00/lzma-history.txt -------------------------------------------------------------------------------- /mednafen/pcfx/input/mouse.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_INPUT_MOUSE_H 2 | #define __PCFX_INPUT_MOUSE_H 3 | 4 | extern const InputDeviceInputInfoStruct PCFX_MouseIDII[4]; 5 | 6 | PCFX_Input_Device *PCFXINPUT_MakeMouse(int which); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Precomp.h: -------------------------------------------------------------------------------- 1 | /* Precomp.h -- StdAfx 2 | 2013-11-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_PRECOMP_H 5 | #define __7Z_PRECOMP_H 6 | 7 | #include "Compiler.h" 8 | /* #include "7zTypes.h" */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /deps/lzma-19.00/LICENSE: -------------------------------------------------------------------------------- 1 | LZMA SDK is placed in the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original LZMA SDK code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. -------------------------------------------------------------------------------- /deps/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 | -------------------------------------------------------------------------------- /mednafen/pcfx/input/gamepad.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_INPUT_GAMEPAD_H 2 | #define __PCFX_INPUT_GAMEPAD_H 3 | 4 | extern const InputDeviceInputInfoStruct PCFX_GamepadIDII[0xF]; 5 | extern const InputDeviceInputInfoStruct PCFX_GamepadIDII_DSR[0xF]; 6 | 7 | PCFX_Input_Device *PCFXINPUT_MakeGamepad(int which); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /mednafen/pcfx/huc6273.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_HUC6273_H 2 | #define __PCFX_HUC6273_H 3 | 4 | bool HuC6273_Init(void); 5 | 6 | uint8 HuC6273_Read8(uint32 A); 7 | uint16 HuC6273_Read16(uint32 A); 8 | void HuC6273_Write16(uint32 A, uint16 V); 9 | void HuC6273_Write8(uint32 A, uint8 V); 10 | void HuC6273_Reset(void); 11 | 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mednafen/pcfx/jrevdct.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_JREVDCT_H 2 | #define __MDFN_JREVDCT_H 3 | 4 | #include "../mednafen-types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef int32* DCTBLOCK; 11 | typedef int32 DCTELEM; 12 | 13 | void j_rev_dct(DCTBLOCK data); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/libretro/beetle-pcfx-libretro.svg?branch=master)](https://travis-ci.org/libretro/beetle-pcfx-libretro) 2 | [![Build status](https://ci.appveyor.com/api/projects/status/s9d2tymlinoe0ijn/branch/master?svg=true)](https://ci.appveyor.com/project/bparker06/beetle-pcfx-libretro/branch/master) 3 | 4 | # Beetle PC-FX 5 | -------------------------------------------------------------------------------- /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/lzma-19.00/include/Sort.h: -------------------------------------------------------------------------------- 1 | /* Sort.h -- Sort functions 2 | 2014-04-05 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_SORT_H 5 | #define __7Z_SORT_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void HeapSort(UInt32 *p, size_t size); 12 | void HeapSort64(UInt64 *p, size_t size); 13 | 14 | /* void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size); */ 15 | 16 | EXTERN_C_END 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Delta.h: -------------------------------------------------------------------------------- 1 | /* Delta.h -- Delta converter 2 | 2013-01-18 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __DELTA_H 5 | #define __DELTA_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | #define DELTA_STATE_SIZE 256 12 | 13 | void Delta_Init(Byte *state); 14 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); 15 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); 16 | 17 | EXTERN_C_END 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /deps/libchdr/README.md: -------------------------------------------------------------------------------- 1 | # libchdr 2 | 3 | libchdr is a standalone library for reading MAME's CHDv1-v5 formats. 4 | 5 | The code is based off of MAME's old C codebase which read up to CHDv4 with OS-dependent features removed, and CHDv5 support backported from MAME's current C++ codebase. 6 | 7 | libchdr is licensed under the BSD 3-Clause (see [LICENSE.txt](LICENSE.txt)) and uses third party libraries that are each distributed under their own terms (see each library's license in [deps/](deps/)). 8 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /intl/upload_workflow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import subprocess 5 | 6 | try: 7 | api_key = sys.argv[1] 8 | core_name = sys.argv[2] 9 | dir_path = sys.argv[3] 10 | except IndexError as e: 11 | print('Please provide path to libretro_core_options.h, Crowdin API Token and core name!') 12 | raise e 13 | 14 | subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name]) 15 | subprocess.run(['python3', 'intl/crowdin_source_upload.py', api_key, core_name]) 16 | -------------------------------------------------------------------------------- /mednafen/file.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_FILE_H 2 | #define MDFN_FILE_H 3 | 4 | #include 5 | 6 | #define MDFNFILE_EC_NOTFOUND 1 7 | #define MDFNFILE_EC_OTHER 2 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | struct MDFNFILE 14 | { 15 | uint8_t *data; 16 | int64_t size; 17 | char *ext; 18 | int64_t location; 19 | }; 20 | 21 | struct MDFNFILE *file_open(const char *path); 22 | 23 | int file_close(struct MDFNFILE *file); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mednafen/video/Deinterlacer.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_DEINTERLACER_H 2 | #define __MDFN_DEINTERLACER_H 3 | 4 | #include 5 | 6 | class Deinterlacer 7 | { 8 | public: 9 | 10 | Deinterlacer(); 11 | ~Deinterlacer(); 12 | 13 | void Process(MDFN_Surface *surface, const MDFN_Rect &DisplayRect, int32 *LineWidths, const bool field); 14 | 15 | void ClearState(void); 16 | 17 | private: 18 | 19 | MDFN_Surface FieldBuffer; 20 | std::vector LWBuffer; 21 | bool StateValid; 22 | int32 PrevHeight; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /mednafen/clamp.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CLAMP_H 2 | #define __MDFN_CLAMP_H 3 | 4 | static INLINE int32 clamp_to_u8(int32 i) 5 | { 6 | if(i & 0xFFFFFF00) 7 | i = (((~i) >> 30) & 0xFF); 8 | 9 | return(i); 10 | } 11 | 12 | 13 | static INLINE void clamp(int32_t *val, size_t, size_t) 14 | { 15 | if ( (int16_t) *val != *val ) 16 | *val = (*val >> 31) ^ 0x7FFF; 17 | } 18 | 19 | static INLINE void clamp(int64_t *val, size_t, size_t) 20 | { 21 | if ( (int16_t) *val != *val ) 22 | *val = (*val >> 31) ^ 0x7FFF; 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /mednafen/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef _MD5_H 2 | #define _MD5_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | struct md5_context 11 | { 12 | uint32_t total[2]; 13 | uint32_t state[4]; 14 | uint8_t buffer[64]; 15 | }; 16 | 17 | void mednafen_md5_starts(struct md5_context *ctx); 18 | void mednafen_md5_update_u32_as_lsb(struct md5_context *ctx, uint32_t input); 19 | void mednafen_md5_update(struct md5_context *ctx, uint8_t *input, uint32_t length); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif /* md5.h */ 26 | -------------------------------------------------------------------------------- /mednafen/mempatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEMPATCHER_H 2 | #define __MDFN_MEMPATCHER_H 3 | 4 | #include "mempatcher-driver.h" 5 | 6 | typedef struct __SUBCHEAT 7 | { 8 | uint32 addr; 9 | uint8 value; 10 | int compare; // < 0 on no compare 11 | } SUBCHEAT; 12 | 13 | bool MDFNMP_Init(uint32 ps, uint32 numpages); 14 | void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM); 15 | void MDFNMP_Kill(void); 16 | 17 | 18 | void MDFNMP_InstallReadPatches(void); 19 | void MDFNMP_RemoveReadPatches(void); 20 | 21 | void MDFNMP_ApplyPeriodicCheats(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /mednafen/mednafen.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEDNAFEN_H 2 | #define _MEDNAFEN_H 3 | 4 | #include "mednafen-types.h" 5 | #include 6 | #include 7 | 8 | #include "math_ops.h" 9 | #include "git.h" 10 | 11 | #include "settings.h" 12 | 13 | #ifdef _MSC_VER 14 | #include 15 | #endif 16 | 17 | #ifdef _WIN32 18 | #define strcasecmp _stricmp 19 | #endif 20 | 21 | extern MDFNGI EmulatedPCFX; 22 | 23 | void MDFN_DispMessage(const char *format, ...); 24 | 25 | void MDFN_LoadGameCheats(void *override); 26 | void MDFN_FlushGameCheats(int nosave); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /intl/download_workflow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import subprocess 5 | 6 | try: 7 | api_key = sys.argv[1] 8 | core_name = sys.argv[2] 9 | dir_path = sys.argv[3] 10 | except IndexError as e: 11 | print('Please provide path to libretro_core_options.h, Crowdin API Token and core name!') 12 | raise e 13 | 14 | subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name]) 15 | subprocess.run(['python3', 'intl/crowdin_translation_download.py', api_key, core_name]) 16 | subprocess.run(['python3', 'intl/crowdin_translate.py', dir_path, core_name]) 17 | -------------------------------------------------------------------------------- /mednafen/pcfx/rainbow.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_RAINBOW_H 2 | #define __PCFX_RAINBOW_H 3 | 4 | void RAINBOW_Write8(uint32 A, uint8 V); 5 | void RAINBOW_Write16(uint32 A, uint16 V); 6 | 7 | void RAINBOW_ForceTransferReset(void); 8 | void RAINBOW_SwapBuffers(void); 9 | void RAINBOW_DecodeBlock(bool arg_FirstDecode, bool Skip); 10 | 11 | int RAINBOW_FetchRaster(uint32 *, uint32 layer_or, uint32 *palette_ptr); 12 | int RAINBOW_StateAction(StateMem *sm, int load, int data_only); 13 | 14 | bool RAINBOW_Init(bool arg_ChromaIP); 15 | void RAINBOW_Close(void); 16 | void RAINBOW_Reset(void); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /mednafen/pcfx/interrupt.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_INTERRUPT_H 2 | #define __PCFX_INTERRUPT_H 3 | 4 | #define PCFXIRQ_SOURCE_TIMER 1 5 | #define PCFXIRQ_SOURCE_EX 2 6 | #define PCFXIRQ_SOURCE_INPUT 3 7 | #define PCFXIRQ_SOURCE_VDCA 4 8 | #define PCFXIRQ_SOURCE_KING 5 9 | #define PCFXIRQ_SOURCE_VDCB 6 10 | #define PCFXIRQ_SOURCE_HUC6273 7 11 | 12 | void PCFXIRQ_Assert(int source, bool assert); 13 | void PCFXIRQ_Write16(uint32 A, uint16 V); 14 | uint16 PCFXIRQ_Read16(uint32 A); 15 | uint8 PCFXIRQ_Read8(uint32 A); 16 | int PCFXIRQ_StateAction(StateMem *sm, int load, int data_only); 17 | 18 | void PCFXIRQ_Reset(void); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /mednafen/pcfx/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_TIMER_H 2 | #define __PCFX_TIMER_H 3 | 4 | void FXTIMER_Write16(uint32 A, uint16 V, const v810_timestamp_t timestamp); 5 | uint16 FXTIMER_Read16(uint32 A, const v810_timestamp_t timestamp); 6 | uint8 FXTIMER_Read8(uint32 A, const v810_timestamp_t timestamp); 7 | v810_timestamp_t FXTIMER_Update(const v810_timestamp_t timestamp); 8 | void FXTIMER_ResetTS(int32 ts_base); 9 | void FXTIMER_Reset(void); 10 | 11 | void FXTIMER_Init(void); 12 | 13 | int FXTIMER_StateAction(StateMem *sm, int load, int data_only); 14 | bool FXTIMER_GetRegister(const std::string &name, uint32 &value); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.1.{build} 2 | 3 | shallow_clone: true 4 | 5 | image: Visual Studio 2017 6 | 7 | environment: 8 | makefile_location: "." 9 | makefile_name: Makefile 10 | target_name: mednafen_pcfx 11 | 12 | configuration: 13 | - release 14 | 15 | platform: 16 | - windows_msvc2017_uwp_x64 17 | - windows_msvc2017_uwp_x86 18 | - windows_msvc2017_uwp_arm 19 | - windows_msvc2017_desktop_x64 20 | - windows_msvc2017_desktop_x86 21 | 22 | init: 23 | - set Path=C:\msys64\usr\bin;%Path% 24 | 25 | build_script: 26 | - cd %makefile_location% 27 | - make -f %makefile_name% platform=%platform% 28 | 29 | artifacts: 30 | - path: '**\%target_name%*.dll' 31 | - path: '**\%target_name%*.lib' 32 | - path: '**\%target_name%*.pdb' 33 | - path: '**\libretro.h' -------------------------------------------------------------------------------- /mednafen/masmem.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_MASMEM_H 2 | #define __MDFN_PSX_MASMEM_H 3 | 4 | // TODO, WIP (big-endian stores and loads not fully supported yet) 5 | 6 | #ifdef MSB_FIRST 7 | #define MAS_NATIVE_IS_BIGENDIAN 1 8 | #else 9 | #define MAS_NATIVE_IS_BIGENDIAN 0 10 | #endif 11 | 12 | static INLINE uint16 LoadU16_RBO(const uint16 *a) 13 | { 14 | #ifdef ARCH_POWERPC 15 | uint16 tmp; 16 | 17 | __asm__ ("lhbrx %0, %y1" : "=r"(tmp) : "Z"(*a)); 18 | 19 | return(tmp); 20 | 21 | #else 22 | uint16 tmp = *a; 23 | return((tmp << 8) | (tmp >> 8)); 24 | #endif 25 | } 26 | 27 | static INLINE uint16 LoadU16_LE(const uint16 *a) 28 | { 29 | #ifdef MSB_FIRST 30 | return LoadU16_RBO(a); 31 | #else 32 | return *a; 33 | #endif 34 | } 35 | 36 | #undef MAS_NATIVE_IS_BIGENDIAN 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /mednafen/pcfx/soundbox.h: -------------------------------------------------------------------------------- 1 | #ifndef _PCFX_SOUNDBOX_H 2 | #define _PCFX_SOUNDBOX_H 3 | 4 | bool SoundBox_SetSoundRate(uint32 rate); 5 | int32 SoundBox_Flush(const v810_timestamp_t timestamp, v810_timestamp_t* new_base_timestamp, int16 *SoundBuf, const int32 MaxSoundFrames); 6 | void SoundBox_Write(uint32 A, uint16 V, const v810_timestamp_t timestamp); 7 | int SoundBox_Init(bool arg_EmulateBuggyCodec, bool arg_ResetAntiClickEnabled); 8 | void SoundBox_Kill(void); 9 | 10 | void SoundBox_Reset(const v810_timestamp_t timestamp); 11 | 12 | int SoundBox_StateAction(StateMem *sm, int load, int data_only); 13 | 14 | void SoundBox_SetKINGADPCMControl(uint32); 15 | 16 | v810_timestamp_t SoundBox_ADPCMUpdate(const v810_timestamp_t timestamp); 17 | 18 | void SoundBox_ResetTS(const v810_timestamp_t ts_base); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /deps/lzma-19.00/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lzma STATIC 2 | include/7zTypes.h 3 | include/Alloc.h 4 | include/Bra.h 5 | include/Compiler.h 6 | include/CpuArch.h 7 | include/Delta.h 8 | include/LzFind.h 9 | include/LzHash.h 10 | include/Lzma86.h 11 | include/LzmaDec.h 12 | include/LzmaEnc.h 13 | include/LzmaLib.h 14 | include/Precomp.h 15 | include/Sort.h 16 | src/Alloc.c 17 | src/Bra86.c 18 | src/BraIA64.c 19 | src/CpuArch.c 20 | src/Delta.c 21 | src/LzFind.c 22 | src/Lzma86Dec.c 23 | src/LzmaDec.c 24 | src/LzmaEnc.c 25 | src/Sort.c 26 | ) 27 | 28 | target_compile_definitions(lzma PRIVATE _7ZIP_ST) 29 | 30 | target_include_directories(lzma PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") 31 | target_include_directories(lzma INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") 32 | 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | os: linux 3 | dist: trusty 4 | sudo: required 5 | addons: 6 | apt: 7 | packages: 8 | - g++-7 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | env: 12 | global: 13 | - CORE=mednafen_pcfx 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/cdrom/CDAccess.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDROMFILE_H 2 | #define __MDFN_CDROMFILE_H 3 | 4 | #include 5 | 6 | #include "CDUtility.h" 7 | 8 | class CDAccess 9 | { 10 | public: 11 | 12 | CDAccess(); 13 | virtual ~CDAccess(); 14 | 15 | virtual bool Read_Raw_Sector(uint8_t *buf, int32_t lba) = 0; 16 | 17 | // Returns false if the read wouldn't be "fast"(i.e. reading from a disk), 18 | // or if the read can't be done in a thread-safe re-entrant manner. 19 | // 20 | // Writes 96 bytes into pwbuf, and returns 'true' otherwise. 21 | virtual bool Fast_Read_Raw_PW_TSRE(uint8_t* pwbuf, int32_t lba) = 0; 22 | 23 | virtual bool Read_TOC(TOC *toc) = 0; 24 | 25 | private: 26 | CDAccess(const CDAccess&); // No copy constructor. 27 | CDAccess& operator=(const CDAccess&); // No assignment operator. 28 | }; 29 | 30 | CDAccess* CDAccess_Open(const std::string& path, bool image_memcache); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /mednafen/general.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENERAL_H 2 | #define _GENERAL_H 3 | 4 | #include 5 | 6 | void MDFN_ltrim(char *string); 7 | void MDFN_rtrim(char *string); 8 | void MDFN_trim(char *string); 9 | 10 | void MDFN_ltrim(std::string &string); 11 | void MDFN_rtrim(std::string &string); 12 | void MDFN_trim(std::string &string); 13 | 14 | typedef enum 15 | { 16 | MDFNMKF_STATE = 0, 17 | MDFNMKF_SNAP, 18 | MDFNMKF_SAV, 19 | MDFNMKF_CHEAT, 20 | MDFNMKF_PALETTE, 21 | MDFNMKF_IPS, 22 | MDFNMKF_MOVIE, 23 | MDFNMKF_AUX, 24 | MDFNMKF_SNAP_DAT, 25 | MDFNMKF_CHEAT_TMP, 26 | MDFNMKF_FIRMWARE 27 | } MakeFName_Type; 28 | 29 | 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); 30 | std::string MDFN_EvalFIP(const std::string &dir_path, const std::string &rel_path, bool skip_safety_check = false); 31 | #endif 32 | -------------------------------------------------------------------------------- /mednafen/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_SETTINGS_H 2 | #define MDFN_SETTINGS_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | extern int setting_initial_scanline; 12 | extern int setting_last_scanline; 13 | extern int setting_high_dotclock_width; 14 | extern int setting_nospritelimit; 15 | extern int setting_resamp_quality; 16 | extern int setting_suppress_channel_reset_clicks; 17 | extern int setting_emulate_buggy_codec; 18 | extern int setting_rainbow_chromaip; 19 | 20 | // This should assert() or something if the setting isn't found, since it would 21 | // be a totally tubular error! 22 | uint64_t MDFN_GetSettingUI(const char *name); 23 | int64_t MDFN_GetSettingI(const char *name); 24 | double MDFN_GetSettingF(const char *name); 25 | bool MDFN_GetSettingB(const char *name); 26 | const char *MDFN_GetSettingS(const char *name); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 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-pcfx-libretro" "libretro_core_options.h" 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/pcfx/pcfx.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_PCFX_H 2 | #define __PCFX_PCFX_H 3 | 4 | #include "../mednafen.h" 5 | #include "../state.h" 6 | #include "../general.h" 7 | #include "v810/v810_cpu.h" 8 | #include "../hw_video/huc6270/vdc.h" 9 | 10 | #define PCFX_MASTER_CLOCK 21477272.72 11 | 12 | static INLINE void MDFN_FastU32MemsetM8(uint32_t *array, uint32_t value_32, unsigned int u32len) 13 | { 14 | uint32_t *ai; 15 | 16 | for(ai = array; ai < array + u32len; ai += 2) 17 | { 18 | ai[0] = value_32; 19 | ai[1] = value_32; 20 | } 21 | } 22 | 23 | extern V810 PCFX_V810; 24 | 25 | uint8 MDFN_FASTCALL mem_peekbyte(const v810_timestamp_t timestamp, const uint32 A); 26 | uint16 MDFN_FASTCALL mem_peekhword(const v810_timestamp_t timestamp, const uint32 A); 27 | 28 | extern VDC *fx_vdc_chips[2]; 29 | 30 | #define REGSETHW(_reg, _data, _msh) { _reg &= 0xFFFF << (_msh ? 0 : 16); _reg |= _data << (_msh ? 16 : 0); } 31 | #define REGGETHW(_reg, _msh) ((_reg >> (_msh ? 16 : 0)) & 0xFFFF) 32 | 33 | enum 34 | { 35 | PCFX_EVENT_PAD = 0, 36 | PCFX_EVENT_TIMER, 37 | PCFX_EVENT_KING, 38 | PCFX_EVENT_ADPCM 39 | }; 40 | 41 | #define PCFX_EVENT_NONONO 0x7fffffff 42 | 43 | void PCFX_SetEvent(const int type, const v810_timestamp_t next_timestamp); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader_MPC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader_MPC.h: 5 | ** Copyright (C) 2015-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MDFN_CDAFREADER_MPC_H 23 | #define __MDFN_CDAFREADER_MPC_H 24 | 25 | CDAFReader* CDAFR_MPC_Open(Stream* fp); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2018-02-19 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void *MyAlloc(size_t size); 12 | void MyFree(void *address); 13 | 14 | #ifdef _WIN32 15 | 16 | void SetLargePageSize(); 17 | 18 | void *MidAlloc(size_t size); 19 | void MidFree(void *address); 20 | void *BigAlloc(size_t size); 21 | void BigFree(void *address); 22 | 23 | #else 24 | 25 | #define MidAlloc(size) MyAlloc(size) 26 | #define MidFree(address) MyFree(address) 27 | #define BigAlloc(size) MyAlloc(size) 28 | #define BigFree(address) MyFree(address) 29 | 30 | #endif 31 | 32 | extern const ISzAlloc g_Alloc; 33 | extern const ISzAlloc g_BigAlloc; 34 | extern const ISzAlloc g_MidAlloc; 35 | extern const ISzAlloc g_AlignedAlloc; 36 | 37 | 38 | typedef struct 39 | { 40 | ISzAlloc vt; 41 | ISzAllocPtr baseAlloc; 42 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */ 43 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */ 44 | } CAlignOffsetAlloc; 45 | 46 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p); 47 | 48 | 49 | EXTERN_C_END 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /mednafen/tremor/window.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_WINDOW_ 19 | #define _V_WINDOW_ 20 | 21 | extern const void *_vorbis_window(int type,int left); 22 | extern void _vorbis_apply_window(int32_t *d,const void *window[2], 23 | long *blocksizes, 24 | int lW,int W,int nW); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /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 | CACHE_CD := 0 8 | NEED_BPP := 32 9 | NEED_STEREO_SOUND := 1 10 | HAVE_THREADS := 1 11 | NEED_CD := 1 12 | NEED_SCSI_CD := 1 13 | NEED_TREMOR := 1 14 | HAVE_CHD := 1 15 | IS_X86 := 0 16 | FLAGS := 17 | 18 | ifeq ($(TARGET_ARCH),x86) 19 | IS_X86 := 1 20 | endif 21 | 22 | include $(CORE_DIR)/Makefile.common 23 | 24 | COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION_NUMERIC=926 -D__LIBRETRO__ -D_LOW_ACCURACY_ -DINLINE="inline" $(FLAGS) 25 | COREFLAGS += -DWANT_PCFX_EMU 26 | 27 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" 28 | ifneq ($(GIT_VERSION)," unknown") 29 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" 30 | endif 31 | 32 | include $(CLEAR_VARS) 33 | LOCAL_MODULE := retro 34 | LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) 35 | LOCAL_CFLAGS := $(COREFLAGS) 36 | LOCAL_CXXFLAGS := $(COREFLAGS) 37 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T 38 | LOCAL_CPP_FEATURES := exceptions 39 | include $(BUILD_SHARED_LIBRARY) 40 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader_Vorbis.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader_Vorbis.h: 5 | ** Copyright (C) 2015-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MDFN_CDAFREADER_VORBIS_H 23 | #define __MDFN_CDAFREADER_VORBIS_H 24 | 25 | CDAFReader* CDAFR_Vorbis_Open(Stream* fp); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /mednafen/Stream.cpp: -------------------------------------------------------------------------------- 1 | // TODO/WIP 2 | 3 | /* Mednafen - Multi-system Emulator 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "mednafen.h" 21 | #include "Stream.h" 22 | 23 | Stream::Stream() 24 | { 25 | 26 | } 27 | 28 | Stream::~Stream() 29 | { 30 | 31 | } 32 | 33 | int Stream::get_line(std::string &str) 34 | { 35 | uint8_t 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/pcfx/input.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_PAD_H 2 | #define __PCFX_PAD_H 3 | 4 | enum 5 | { 6 | FX_SIG_MOUSE = 0xD, 7 | FX_SIG_TAP = 0xE, 8 | FX_SIG_PAD = 0xF 9 | }; 10 | 11 | class PCFX_Input_Device 12 | { 13 | public: 14 | virtual ~PCFX_Input_Device(); 15 | 16 | virtual uint32 ReadTransferTime(void); 17 | virtual uint32 WriteTransferTime(void); 18 | 19 | virtual uint32 Read(void); 20 | virtual void Write(uint32 data); 21 | 22 | 23 | virtual void Power(void); 24 | 25 | virtual void Frame(const void *data); 26 | virtual int StateAction(StateMem *sm, int load, int data_only, const char *section_name); 27 | }; 28 | 29 | 30 | void FXINPUT_Init(void); 31 | void FXINPUT_SettingChanged(const char *name); 32 | 33 | 34 | void FXINPUT_SetInput(int port, const char *type, void *ptr); 35 | 36 | uint16 FXINPUT_Read16(uint32 A, const v810_timestamp_t timestamp); 37 | uint8 FXINPUT_Read8(uint32 A, const v810_timestamp_t timestamp); 38 | 39 | void FXINPUT_Write8(uint32 A, uint8 V, const v810_timestamp_t timestamp); 40 | void FXINPUT_Write16(uint32 A, uint16 V, const v810_timestamp_t timestamp); 41 | 42 | void FXINPUT_Frame(void); 43 | int FXINPUT_StateAction(StateMem *sm, int load, int data_only); 44 | 45 | v810_timestamp_t FXINPUT_Update(const v810_timestamp_t timestamp); 46 | void FXINPUT_ResetTS(int32 ts_base); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /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/mempatcher-driver.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEMPATCHER_DRIVER_HH 2 | #define __MDFN_MEMPATCHER_DRIVER_HH 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 | -------------------------------------------------------------------------------- /mednafen/pcfx/king.h: -------------------------------------------------------------------------------- 1 | #ifndef __PCFX_KING_H 2 | #define __PCFX_KING_H 3 | 4 | void KING_StartFrame(VDC **, EmulateSpecStruct *espec); //MDFN_Surface *surface, MDFN_Rect *DisplayRect, MDFN_Rect *LineWidths, int skip); 5 | void KING_SetPixelFormat(const MDFN_PixelFormat &format); //int rshift, int gshift, int bshift); 6 | uint16 FXVCE_Read16(uint32 A); 7 | void FXVCE_Write16(uint32 A, uint16 V); 8 | 9 | uint8 KING_Read8(const v810_timestamp_t timestamp, uint32 A); 10 | uint16 KING_Read16(const v810_timestamp_t timestamp, uint32 A); 11 | 12 | void KING_Write8(const v810_timestamp_t timestamp, uint32 A, uint8 V); 13 | void KING_Write16(const v810_timestamp_t timestamp, uint32 A, uint16 V); 14 | bool KING_Init(void); 15 | void KING_Close(void); 16 | void KING_Reset(const v810_timestamp_t timestamp); 17 | 18 | uint16 KING_GetADPCMHalfWord(int ch); 19 | 20 | uint8 KING_MemPeek(uint32 A); 21 | 22 | uint8 KING_RB_Fetch(); 23 | 24 | void KING_SetLayerEnableMask(uint64 mask); 25 | 26 | int KING_StateAction(StateMem *sm, int load, int data_only); 27 | 28 | void KING_SetGraphicsDecode(MDFN_Surface *surface, int line, int which, int xscroll, int yscroll, int pbn); 29 | 30 | void KING_NotifyOfBPE(bool read, bool write); 31 | 32 | void KING_SetLogFunc(void (*logfunc)(const char *, const char *, ...)); 33 | 34 | void KING_EndFrame(v810_timestamp_t timestamp); 35 | void KING_ResetTS(v810_timestamp_t ts_base); 36 | 37 | v810_timestamp_t MDFN_FASTCALL KING_Update(const v810_timestamp_t timestamp); 38 | #endif 39 | -------------------------------------------------------------------------------- /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/math_ops.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MATH_OPS_H 2 | #define __MDFN_MATH_OPS_H 3 | 4 | #include 5 | 6 | // Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 7 | // Rounds up to the nearest power of 2. 8 | static INLINE uint32 round_up_pow2(uint32 v) 9 | { 10 | v--; 11 | v |= v >> 1; 12 | v |= v >> 2; 13 | v |= v >> 4; 14 | v |= v >> 8; 15 | v |= v >> 16; 16 | v++; 17 | 18 | v += (v == 0); 19 | 20 | return(v); 21 | } 22 | 23 | // Some compilers' optimizers and some platforms might fubar the generated code from these macros, 24 | // so some tests are run in...tests.cpp 25 | #define sign_8_to_s16(_value) ((int16)(int8)(_value)) 26 | #define sign_9_to_s16(_value) (((int16)((unsigned int)(_value) << 7)) >> 7) 27 | #define sign_10_to_s16(_value) (((int16)((uint32)(_value) << 6)) >> 6) 28 | #define sign_11_to_s16(_value) (((int16)((uint32)(_value) << 5)) >> 5) 29 | #define sign_12_to_s16(_value) (((int16)((uint32)(_value) << 4)) >> 4) 30 | #define sign_13_to_s16(_value) (((int16)((uint32)(_value) << 3)) >> 3) 31 | #define sign_14_to_s16(_value) (((int16)((uint32)(_value) << 2)) >> 2) 32 | #define sign_15_to_s16(_value) (((int16)((uint32)(_value) << 1)) >> 1) 33 | 34 | // This obviously won't convert higher-than-32 bit numbers to signed 32-bit ;) 35 | // Also, this shouldn't be used for 8-bit and 16-bit signed numbers, since you can 36 | // convert those faster with typecasts... 37 | #define sign_x_to_s32(_bits, _value) (((int32)((uint32)(_value) << (32 - _bits))) >> (32 - _bits)) 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /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/FileStream.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | // TODO/WIP 19 | 20 | #ifndef __MDFN_FILESTREAM_H 21 | #define __MDFN_FILESTREAM_H 22 | 23 | #include 24 | 25 | #include "Stream.h" 26 | 27 | class FileStream : public Stream 28 | { 29 | public: 30 | FileStream(const char *path, const int mode); 31 | virtual ~FileStream(); 32 | 33 | virtual uint64_t read(void *data, uint64_t count); 34 | virtual void write(const void *data, uint64_t count); 35 | virtual void seek(int64_t offset, int whence); 36 | virtual void truncate(uint64_t length); 37 | virtual void flush(void); 38 | virtual uint64_t tell(void); 39 | virtual uint64_t size(void); 40 | virtual void close(void); 41 | 42 | private: 43 | RFILE *fp; 44 | }; 45 | 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /mednafen/state.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATE_H 2 | #define _STATE_H 3 | 4 | #include 5 | #include 6 | 7 | // Flag for a single, >= 1 byte native-endian variable 8 | #define MDFNSTATE_RLSB 0x80000000 9 | 10 | // 32-bit native-endian elements 11 | #define MDFNSTATE_RLSB32 0x40000000 12 | 13 | // 16-bit native-endian elements 14 | #define MDFNSTATE_RLSB16 0x20000000 15 | 16 | // 64-bit native-endian elements 17 | #define MDFNSTATE_RLSB64 0x10000000 18 | 19 | #define MDFNSTATE_BOOL 0x08000000 20 | 21 | typedef struct 22 | { 23 | uint8_t *data; 24 | uint32_t loc; 25 | uint32_t len; 26 | uint32_t malloced; 27 | uint32_t initial_malloc; // A setting! 28 | } StateMem; 29 | 30 | typedef struct 31 | { 32 | void *v; // Pointer to the variable/array 33 | uint32_t size; // Length, in bytes, of the data to be saved EXCEPT: 34 | // In the case of MDFNSTATE_BOOL, it is the number of bool elements to save(bool is not always 1-byte). 35 | // If 0, the subchunk isn't saved. 36 | uint32_t flags; // Flags 37 | const char *name; // Name 38 | } SFORMAT; 39 | 40 | /* State-Section Descriptor */ 41 | struct SSDescriptor 42 | { 43 | SFORMAT *sf; 44 | const char *name; 45 | bool optional; 46 | }; 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | int MDFNSS_SaveSM(void *st, int, int, const void*, const void*, const void*); 53 | int MDFNSS_LoadSM(void *st, int, int); 54 | 55 | int MDFNSS_StateAction(void *st, int load, int data_only, SFORMAT *sf, const char *name, bool optional); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "../mednafen.h" 19 | #include "CDAccess.h" 20 | #include "CDAccess_Image.h" 21 | #include "CDAccess_CCD.h" 22 | #ifdef HAVE_CHD 23 | #include "CDAccess_CHD.h" 24 | #endif 25 | 26 | CDAccess::CDAccess() 27 | { 28 | 29 | } 30 | 31 | CDAccess::~CDAccess() 32 | { 33 | 34 | } 35 | 36 | CDAccess* CDAccess_Open(const std::string& path, bool image_memcache) 37 | { 38 | CDAccess *ret = NULL; 39 | 40 | if(path.size() >= 4 && !strcasecmp(path.c_str() + path.size() - 4, ".ccd")) 41 | ret = new CDAccess_CCD(path, image_memcache); 42 | #ifdef HAVE_CHD 43 | else if(path.size() >= 4 && !strcasecmp(path.c_str() + path.size() - 4, ".chd")) 44 | ret = new CDAccess_CHD(path, image_memcache); 45 | #endif 46 | else 47 | ret = new CDAccess_Image(path, image_memcache); 48 | 49 | return ret; 50 | } 51 | 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 /* USE_LIBRETRO_VFS */ 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/video/surface.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_SURFACE_H 2 | #define __MDFN_SURFACE_H 3 | 4 | #include "../mednafen-types.h" 5 | 6 | // Core only supports 32bpp format 7 | 8 | #if defined(WANT_32BPP) 9 | typedef uint32 bpp_t; 10 | #define RED_SHIFT 16 11 | #define GREEN_SHIFT 8 12 | #define BLUE_SHIFT 0 13 | #define ALPHA_SHIFT 24 14 | #define MAKECOLOR(r, g, b, a) ((r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT) | (a << ALPHA_SHIFT)) 15 | #elif defined(WANT_16BPP) && defined(FRONTEND_SUPPORTS_RGB565) 16 | typedef uint16 bpp_t; 17 | #define RED_EXPAND 3 18 | #define GREEN_EXPAND 2 19 | #define BLUE_EXPAND 3 20 | #define RED_SHIFT 11 21 | #define GREEN_SHIFT 5 22 | #define BLUE_SHIFT 0 23 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) 24 | #endif 25 | 26 | typedef struct 27 | { 28 | int32 x, y, w, h; 29 | } MDFN_Rect; 30 | 31 | enum 32 | { 33 | MDFN_COLORSPACE_RGB = 0 34 | }; 35 | 36 | struct MDFN_PixelFormat 37 | { 38 | unsigned int bpp; 39 | unsigned int colorspace; 40 | 41 | uint8 Rshift; // Bit position of the lowest bit of the red component 42 | uint8 Gshift; // [...] green component 43 | uint8 Bshift; // [...] blue component 44 | uint8 Ashift; // [...] alpha component. 45 | }; // MDFN_PixelFormat; 46 | 47 | struct MDFN_Surface //typedef struct 48 | { 49 | bpp_t *pixels; 50 | 51 | // w, h, and pitch32 should always be > 0 52 | int32 w; 53 | int32 h; 54 | 55 | union 56 | { 57 | int32 pitch32; // In pixels, not in bytes. 58 | int32 pitchinpix; // New name, new code should use this. 59 | }; 60 | 61 | struct MDFN_PixelFormat format; 62 | }; 63 | 64 | #endif -------------------------------------------------------------------------------- /deps/zlib-1.2.11/crc32.c: -------------------------------------------------------------------------------- 1 | /* crc32.c -- compute the CRC-32 of a data stream 2 | * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | * 5 | * Thanks to Rodney Brown for his contribution of faster 6 | * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing 7 | * tables for updating the shift register in one step with three exclusive-ors 8 | * instead of four steps with four exclusive-ors. This results in about a 9 | * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. 10 | */ 11 | 12 | /* @(#) $Id$ */ 13 | 14 | #include "zutil.h" /* for STDC and FAR definitions */ 15 | 16 | /* Definitions for doing the crc four data bytes at a time. */ 17 | #define TBLS 1 18 | 19 | /* ======================================================================== 20 | * Tables of CRC-32s of all single-byte values, made by make_crc_table(). 21 | */ 22 | #include "crc32.h" 23 | 24 | /* ========================================================================= */ 25 | #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) 26 | #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 27 | 28 | /* ========================================================================= */ 29 | unsigned long ZEXPORT crc32(crc, buf, len) 30 | unsigned long crc; 31 | const unsigned char FAR *buf; 32 | uInt len; 33 | { 34 | if (buf == Z_NULL) 35 | return 0UL; 36 | 37 | crc = crc ^ 0xffffffffUL; 38 | while (len >= 8) { 39 | DO8; 40 | len -= 8; 41 | } 42 | if (len) do { 43 | DO1; 44 | } while (--len); 45 | return crc ^ 0xffffffffUL; 46 | } 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libretro-common/include/encodings/crc32.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (crc32.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_ENCODINGS_CRC32_H 24 | #define _LIBRETRO_ENCODINGS_CRC32_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | RETRO_BEGIN_DECLS 32 | 33 | uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len); 34 | 35 | RETRO_END_DECLS 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libretro-common/include/retro_assert.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_assert.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __RETRO_ASSERT_H 24 | #define __RETRO_ASSERT_H 25 | 26 | #include 27 | 28 | #ifdef RARCH_INTERNAL 29 | #include 30 | #define retro_assert(cond) ((void)( (cond) || (printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__), abort(), 0) )) 31 | #else 32 | #define retro_assert(cond) assert(cond) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /libretro-common/include/memalign.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memalign.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_MEMALIGN_H 24 | #define _LIBRETRO_MEMALIGN_H 25 | 26 | #include 27 | 28 | #include 29 | 30 | RETRO_BEGIN_DECLS 31 | 32 | void *memalign_alloc(size_t boundary, size_t size); 33 | 34 | void *memalign_alloc_aligned(size_t size); 35 | 36 | void memalign_free(void *ptr); 37 | 38 | RETRO_END_DECLS 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess_CCD.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAccess_CCD.h: 5 | ** Copyright (C) 2013-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "CDAccess.h" 26 | 27 | class CDAccess_CCD : public CDAccess 28 | { 29 | public: 30 | 31 | CDAccess_CCD(const std::string& path, bool image_memcache); 32 | virtual ~CDAccess_CCD(); 33 | 34 | virtual bool Read_Raw_Sector(uint8 *buf, int32 lba); 35 | 36 | virtual bool Fast_Read_Raw_PW_TSRE(uint8* pwbuf, int32 lba); 37 | 38 | virtual bool Read_TOC(TOC *toc); 39 | 40 | private: 41 | 42 | bool Load(const std::string& path, bool image_memcache); 43 | void Cleanup(void); 44 | 45 | bool CheckSubQSanity(void); 46 | 47 | Stream *img_stream; 48 | uint8_t *sub_data; 49 | 50 | size_t img_numsectors; 51 | TOC tocd; 52 | }; 53 | -------------------------------------------------------------------------------- /.github/workflows/crowdin_translate.yml: -------------------------------------------------------------------------------- 1 | # Download translations form Crowdin & Recreate libretro_core_options_intl.h 2 | 3 | name: Crowdin Translation Integration 4 | 5 | on: 6 | schedule: 7 | # please choose a random time & weekday to avoid all repos synching at the same time 8 | - cron: '5 22 * * 5' # Fridays at 10:05 PM, 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-pcfx-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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/mednafen-types.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_TYPES 2 | #define __MDFN_TYPES 3 | 4 | #include 5 | 6 | typedef int8_t int8; 7 | typedef int16_t int16; 8 | typedef int32_t int32; 9 | typedef int64_t int64; 10 | 11 | typedef uint8_t uint8; 12 | typedef uint16_t uint16; 13 | typedef uint32_t uint32; 14 | typedef uint64_t uint64; 15 | 16 | #ifdef __GNUC__ 17 | #define MDFN_UNLIKELY(n) __builtin_expect((n) != 0, 0) 18 | #define MDFN_LIKELY(n) __builtin_expect((n) != 0, 1) 19 | 20 | #define NO_INLINE __attribute__((noinline)) 21 | 22 | #if defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) 23 | #define MDFN_FASTCALL __attribute__((fastcall)) 24 | #else 25 | #define MDFN_FASTCALL 26 | #endif 27 | 28 | #define MDFN_ALIGN(n) __attribute__ ((aligned (n))) 29 | #define MDFN_FORMATSTR(a,b,c) __attribute__ ((format (a, b, c))); 30 | #define MDFN_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) 31 | #define MDFN_NOWARN_UNUSED __attribute__((unused)) 32 | 33 | #elif defined(_MSC_VER) 34 | #if _MSC_VER < 1800 35 | #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) 36 | #endif 37 | #define NO_INLINE 38 | #define MDFN_LIKELY(n) ((n) != 0) 39 | #define MDFN_UNLIKELY(n) ((n) != 0) 40 | 41 | #define MDFN_FASTCALL 42 | 43 | #define MDFN_ALIGN(n) __declspec(align(n)) 44 | 45 | #define MDFN_FORMATSTR(a,b,c) 46 | 47 | #define MDFN_WARN_UNUSED_RESULT 48 | #define MDFN_NOWARN_UNUSED 49 | 50 | #else 51 | #error "Not compiling with GCC nor MSVC" 52 | #define NO_INLINE 53 | 54 | #define MDFN_FASTCALL 55 | 56 | #define MDFN_ALIGN(n) // hence the #error. 57 | 58 | #define MDFN_FORMATSTR(a,b,c) 59 | 60 | #define MDFN_WARN_UNUSED_RESULT 61 | 62 | #endif 63 | 64 | #ifndef FALSE 65 | #define FALSE 0 66 | #endif 67 | 68 | #ifndef TRUE 69 | #define TRUE 1 70 | #endif 71 | 72 | #define MDFN_COLD 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mednafen/hw_cpu/v810/v810_fp_ops.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 | #include "mednafen/mednafen.h" 19 | 20 | class V810_FP_Ops 21 | { 22 | public: 23 | 24 | uint32 mul(uint32 a, uint32 b); 25 | uint32 div(uint32 a, uint32 b); 26 | uint32 add(uint32 a, uint32 b); 27 | uint32 sub(uint32 a, uint32 b); 28 | int cmp(uint32 a, uint32 b); 29 | 30 | uint32 itof(uint32 v); 31 | uint32 ftoi(uint32 v, bool truncate); 32 | 33 | enum 34 | { 35 | flag_invalid = 0x0001, 36 | flag_divbyzero = 0x0002, 37 | flag_overflow = 0x0004, 38 | flag_underflow = 0x0008, 39 | flag_inexact = 0x0010, 40 | flag_reserved = 0x0020 41 | }; 42 | 43 | inline uint32 get_flags(void) 44 | { 45 | return exception_flags; 46 | } 47 | 48 | inline void clear_flags(void) 49 | { 50 | exception_flags = 0; 51 | } 52 | 53 | private: 54 | 55 | unsigned exception_flags; 56 | 57 | struct fpim 58 | { 59 | uint64 f; 60 | int exp; 61 | bool sign; 62 | }; 63 | 64 | bool fp_is_zero(uint32 v); 65 | bool fp_is_inf_nan_sub(uint32 v); 66 | 67 | uint8 clz64(uint64 v); 68 | void fpim_decode(fpim* df, uint32 v); 69 | void fpim_round(fpim* df); 70 | void fpim_round_int(fpim* df, bool truncate = false); 71 | uint32 fpim_encode(fpim* df); 72 | }; 73 | 74 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2015-04-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZ_HASH_H 5 | #define __LZ_HASH_H 6 | 7 | #define kHash2Size (1 << 10) 8 | #define kHash3Size (1 << 16) 9 | #define kHash4Size (1 << 20) 10 | 11 | #define kFix3HashSize (kHash2Size) 12 | #define kFix4HashSize (kHash2Size + kHash3Size) 13 | #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 14 | 15 | #define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8); 16 | 17 | #define HASH3_CALC { \ 18 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 19 | h2 = temp & (kHash2Size - 1); \ 20 | hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } 21 | 22 | #define HASH4_CALC { \ 23 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 24 | h2 = temp & (kHash2Size - 1); \ 25 | temp ^= ((UInt32)cur[2] << 8); \ 26 | h3 = temp & (kHash3Size - 1); \ 27 | hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; } 28 | 29 | #define HASH5_CALC { \ 30 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 31 | h2 = temp & (kHash2Size - 1); \ 32 | temp ^= ((UInt32)cur[2] << 8); \ 33 | h3 = temp & (kHash3Size - 1); \ 34 | temp ^= (p->crc[cur[3]] << 5); \ 35 | h4 = temp & (kHash4Size - 1); \ 36 | hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; } 37 | 38 | /* #define HASH_ZIP_CALC hv = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ 39 | #define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; 40 | 41 | 42 | #define MT_HASH2_CALC \ 43 | h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); 44 | 45 | #define MT_HASH3_CALC { \ 46 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 47 | h2 = temp & (kHash2Size - 1); \ 48 | h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } 49 | 50 | #define MT_HASH4_CALC { \ 51 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 52 | h2 = temp & (kHash2Size - 1); \ 53 | temp ^= ((UInt32)cur[2] << 8); \ 54 | h3 = temp & (kHash3Size - 1); \ 55 | h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /mednafen/cdrom/SimpleFIFO.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_SIMPLEFIFO_H 2 | #define __MDFN_SIMPLEFIFO_H 3 | 4 | #include 5 | 6 | #include "../math_ops.h" 7 | 8 | template 9 | class SimpleFIFO 10 | { 11 | public: 12 | 13 | // Constructor 14 | SimpleFIFO(uint32 the_size) // Size should be a power of 2! 15 | { 16 | data.resize(round_up_pow2(the_size)); 17 | size = the_size; 18 | read_pos = 0; 19 | write_pos = 0; 20 | in_count = 0; 21 | } 22 | 23 | // Destructor 24 | INLINE ~SimpleFIFO() 25 | { 26 | 27 | } 28 | 29 | INLINE void SaveStatePostLoad(void) 30 | { 31 | read_pos %= data.size(); 32 | write_pos %= data.size(); 33 | in_count %= (data.size() + 1); 34 | } 35 | 36 | INLINE uint32 CanWrite(void) 37 | { 38 | return(size - in_count); 39 | } 40 | 41 | INLINE T ReadUnit(bool peek = false) 42 | { 43 | T ret = data[read_pos]; 44 | 45 | if(!peek) 46 | { 47 | read_pos = (read_pos + 1) & (data.size() - 1); 48 | in_count--; 49 | } 50 | 51 | return(ret); 52 | } 53 | 54 | INLINE uint8 ReadByte(bool peek = false) 55 | { 56 | return(ReadUnit(peek)); 57 | } 58 | 59 | INLINE void Write(const T *happy_data, uint32 happy_count) 60 | { 61 | while(happy_count) 62 | { 63 | data[write_pos] = *happy_data; 64 | 65 | write_pos = (write_pos + 1) & (data.size() - 1); 66 | in_count++; 67 | happy_data++; 68 | happy_count--; 69 | } 70 | } 71 | 72 | INLINE void WriteUnit(const T& wr_data) 73 | { 74 | Write(&wr_data, 1); 75 | } 76 | 77 | INLINE void WriteByte(const T& wr_data) 78 | { 79 | Write(&wr_data, 1); 80 | } 81 | 82 | 83 | INLINE void Flush(void) 84 | { 85 | read_pos = 0; 86 | write_pos = 0; 87 | in_count = 0; 88 | } 89 | 90 | //private: 91 | std::vector data; 92 | uint32 size; 93 | uint32 read_pos; // Read position 94 | uint32 write_pos; // Write position 95 | uint32 in_count; // Number of units in the FIFO 96 | }; 97 | 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /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/state_helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATE_HELPERS_H 2 | #define _STATE_HELPERS_H 3 | 4 | #include 5 | #include 6 | 7 | INLINE bool SF_IS_BOOL(bool *) { return(1); } 8 | INLINE bool SF_IS_BOOL(void *) { return(0); } 9 | 10 | INLINE uint32_t SF_FORCE_AB(bool *) { return(0); } 11 | 12 | INLINE uint32_t SF_FORCE_A8(int8_t *) { return(0); } 13 | INLINE uint32_t SF_FORCE_A8(uint8_t *) { return(0); } 14 | 15 | INLINE uint32_t SF_FORCE_A16(int16_t *) { return(0); } 16 | INLINE uint32_t SF_FORCE_A16(uint16_t *) { return(0); } 17 | 18 | INLINE uint32_t SF_FORCE_A32(int32_t *) { return(0); } 19 | INLINE uint32_t SF_FORCE_A32(uint32_t *) { return(0); } 20 | 21 | INLINE uint32_t SF_FORCE_A64(int64_t *) { return(0); } 22 | INLINE uint32_t SF_FORCE_A64(uint64_t *) { return(0); } 23 | 24 | INLINE uint32_t SF_FORCE_D(double *) { return(0); } 25 | 26 | #define SFVARN(x, n) { &(x), SF_IS_BOOL(&(x)) ? 1 : (uint32_t)sizeof(x), MDFNSTATE_RLSB | (SF_IS_BOOL(&(x)) ? MDFNSTATE_BOOL : 0), n } 27 | #define SFVAR(x) SFVARN((x), #x) 28 | 29 | #define SFARRAYN(x, l, n) { (x), (uint32_t)(l), 0 | SF_FORCE_A8(x), n } 30 | #define SFARRAY(x, l) SFARRAYN((x), (l), #x) 31 | 32 | #define SFARRAYBN(x, l, n) { (x), (uint32_t)(l), MDFNSTATE_BOOL | SF_FORCE_AB(x), n } 33 | #define SFARRAYB(x, l) SFARRAYBN((x), (l), #x) 34 | 35 | #define SFARRAY16N(x, l, n) { (x), (uint32_t)((l) * sizeof(uint16_t)), MDFNSTATE_RLSB16 | SF_FORCE_A16(x), n } 36 | #define SFARRAY16(x, l) SFARRAY16N((x), (l), #x) 37 | 38 | #define SFARRAY32N(x, l, n) { (x), (uint32_t)((l) * sizeof(uint32_t)), MDFNSTATE_RLSB32 | SF_FORCE_A32(x), n } 39 | #define SFARRAY32(x, l) SFARRAY32N((x), (l), #x) 40 | 41 | #define SFARRAY64N(x, l, n) { (x), (uint32_t)((l) * sizeof(uint64_t)), MDFNSTATE_RLSB64 | SF_FORCE_A64(x), n } 42 | #define SFARRAY64(x, l) SFARRAY64N((x), (l), #x) 43 | 44 | #define SFARRAYDN(x, l, n) { (x), (uint32_t)((l) * 8), MDFNSTATE_RLSB64 | SF_FORCE_D(x), n } 45 | #define SFARRAYD(x, l) SFARRAYDN((x), (l), #x) 46 | 47 | #define SFEND { 0, 0, 0, 0 } 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Bra86.c: -------------------------------------------------------------------------------- 1 | /* Bra86.c -- Converter for x86 code (BCJ) 2 | 2017-04-03 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Bra.h" 7 | 8 | #define Test86MSByte(b) ((((b) + 1) & 0xFE) == 0) 9 | 10 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) 11 | { 12 | SizeT pos = 0; 13 | UInt32 mask = *state & 7; 14 | if (size < 5) 15 | return 0; 16 | size -= 4; 17 | ip += 5; 18 | 19 | for (;;) 20 | { 21 | Byte *p = data + pos; 22 | const Byte *limit = data + size; 23 | for (; p < limit; p++) 24 | if ((*p & 0xFE) == 0xE8) 25 | break; 26 | 27 | { 28 | SizeT d = (SizeT)(p - data - pos); 29 | pos = (SizeT)(p - data); 30 | if (p >= limit) 31 | { 32 | *state = (d > 2 ? 0 : mask >> (unsigned)d); 33 | return pos; 34 | } 35 | if (d > 2) 36 | mask = 0; 37 | else 38 | { 39 | mask >>= (unsigned)d; 40 | if (mask != 0 && (mask > 4 || mask == 3 || Test86MSByte(p[(size_t)(mask >> 1) + 1]))) 41 | { 42 | mask = (mask >> 1) | 4; 43 | pos++; 44 | continue; 45 | } 46 | } 47 | } 48 | 49 | if (Test86MSByte(p[4])) 50 | { 51 | UInt32 v = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); 52 | UInt32 cur = ip + (UInt32)pos; 53 | pos += 5; 54 | if (encoding) 55 | v += cur; 56 | else 57 | v -= cur; 58 | if (mask != 0) 59 | { 60 | unsigned sh = (mask & 6) << 2; 61 | if (Test86MSByte((Byte)(v >> sh))) 62 | { 63 | v ^= (((UInt32)0x100 << sh) - 1); 64 | if (encoding) 65 | v += cur; 66 | else 67 | v -= cur; 68 | } 69 | mask = 0; 70 | } 71 | p[1] = (Byte)v; 72 | p[2] = (Byte)(v >> 8); 73 | p[3] = (Byte)(v >> 16); 74 | p[4] = (Byte)(0 - ((v >> 24) & 1)); 75 | } 76 | else 77 | { 78 | mask = (mask >> 1) | 4; 79 | pos++; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader.cpp: 5 | ** Copyright (C) 2010-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | // CDAFR_Open(), and CDAFReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access 23 | // to it for as long as the CDAFReader object exists. 24 | 25 | // Don't allow exceptions to propagate into the vorbis/musepack/etc. libraries, as it could easily leave the state of the library's decoder "object" in an 26 | // inconsistent state, which would cause all sorts of unfun when we try to destroy it while handling the exception farther up. 27 | 28 | #include 29 | #include "CDAFReader.h" 30 | #include "CDAFReader_Vorbis.h" 31 | #ifdef HAVE_MPC 32 | #include "CDAFReader_MPC.h" 33 | #endif 34 | 35 | CDAFReader::CDAFReader() : LastReadPos(0) 36 | { 37 | 38 | } 39 | 40 | CDAFReader::~CDAFReader() 41 | { 42 | 43 | } 44 | 45 | CDAFReader* CDAFR_Open(Stream* fp) 46 | { 47 | #ifdef HAVE_MPC 48 | return CDAFR_MPC_Open(fp); 49 | #else 50 | return CDAFR_Vorbis_Open(fp); 51 | #endif 52 | } 53 | 54 | -------------------------------------------------------------------------------- /libretro-common/include/time/rtime.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_RTIME_H__ 24 | #define __LIBRETRO_SDK_RTIME_H__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | /* TODO/FIXME: Move all generic time handling functions 35 | * to this file */ 36 | 37 | /* Must be called before using rtime_localtime() */ 38 | void rtime_init(void); 39 | 40 | /* Must be called upon program termination */ 41 | void rtime_deinit(void); 42 | 43 | /* Thread-safe wrapper for localtime() */ 44 | struct tm *rtime_localtime(const time_t *timep, struct tm *result); 45 | 46 | RETRO_END_DECLS 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /mednafen/tremor/README: -------------------------------------------------------------------------------- 1 | This README covers the Ogg Vorbis 'Tremor' integer playback codec 2 | source as of date 2002 09 02, version 1.0.0. 3 | 4 | ****** 5 | 6 | The C source in this package will build on any ANSI C compiler and 7 | function completely and properly on any platform. The included build 8 | system assumes GNU build system and make tools (m4, automake, 9 | autoconf, libtool and gmake). GCC is not required, although GCC is 10 | the most tested compiler. To build using GNU tools, type in the 11 | source directory: 12 | 13 | ./autogen.sh 14 | make 15 | 16 | Currently, the source implements playback in pure C on all platforms 17 | except ARM, where a [currently] small amount of assembly (see 18 | asm_arm.h) is used to implement 64 bit math operations and fast LSP 19 | computation. If building on ARM without the benefit of GNU build 20 | system tools, be sure that '_ARM_ASSEM_' is #defined by the build 21 | system if this assembly is desired, else the resulting library will 22 | use whatever 64 bit math builtins the compiler implements. 23 | 24 | No math library is required by this source. No floating point 25 | operations are used at any point in either setup or decode. This 26 | decoder library will properly decode any past, current or future 27 | Vorbis I file or stream. 28 | 29 | ******** 30 | 31 | The build system produces a static and [when supported by the OS] 32 | dynamic library named 'libvorbisidec'. This library exposes an API 33 | nearly identical to the BSD reference library's 'libvorbisfile', 34 | including all the features familiar to users of vorbisfile. This API 35 | is similar enough that the proper header file to include is named 36 | 'ivorbisfile.h' [included in the source build directory]. Lower level 37 | libvorbis-style headers and structures are in 'ivorbiscodec.h' 38 | [included in the source build directory]. A simple example program, 39 | ivorbisfile_example.c, can be built with 'make example'. 40 | 41 | ******** 42 | 43 | Detailed Tremor API Documentation begins at doc/index.html 44 | 45 | Monty 46 | xiph.org 47 | -------------------------------------------------------------------------------- /libretro-common/include/compat/strcasestr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strcasestr.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRCASESTR_H 24 | #define __LIBRETRO_SDK_COMPAT_STRCASESTR_H 25 | 26 | #include 27 | 28 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 29 | #include "../../../config.h" 30 | #endif 31 | 32 | #ifndef HAVE_STRCASESTR 33 | 34 | #include 35 | 36 | RETRO_BEGIN_DECLS 37 | 38 | /* Avoid possible naming collisions during link 39 | * since we prefer to use the actual name. */ 40 | #define strcasestr(haystack, needle) strcasestr_retro__(haystack, needle) 41 | 42 | char *strcasestr(const char *haystack, const char *needle); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Bra.h: -------------------------------------------------------------------------------- 1 | /* Bra.h -- Branch converters for executables 2 | 2013-01-18 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BRA_H 5 | #define __BRA_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | /* 12 | These functions convert relative addresses to absolute addresses 13 | in CALL instructions to increase the compression ratio. 14 | 15 | In: 16 | data - data buffer 17 | size - size of data 18 | ip - current virtual Instruction Pinter (IP) value 19 | state - state variable for x86 converter 20 | encoding - 0 (for decoding), 1 (for encoding) 21 | 22 | Out: 23 | state - state variable for x86 converter 24 | 25 | Returns: 26 | The number of processed bytes. If you call these functions with multiple calls, 27 | you must start next call with first byte after block of processed bytes. 28 | 29 | Type Endian Alignment LookAhead 30 | 31 | x86 little 1 4 32 | ARMT little 2 2 33 | ARM little 4 0 34 | PPC big 4 0 35 | SPARC big 4 0 36 | IA64 little 16 0 37 | 38 | size must be >= Alignment + LookAhead, if it's not last block. 39 | If (size < Alignment + LookAhead), converter returns 0. 40 | 41 | Example: 42 | 43 | UInt32 ip = 0; 44 | for () 45 | { 46 | ; size must be >= Alignment + LookAhead, if it's not last block 47 | SizeT processed = Convert(data, size, ip, 1); 48 | data += processed; 49 | size -= processed; 50 | ip += processed; 51 | } 52 | */ 53 | 54 | #define x86_Convert_Init(state) { state = 0; } 55 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding); 56 | SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 57 | SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 58 | SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 59 | SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 60 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding); 61 | 62 | EXTERN_C_END 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /mednafen/lepacker.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_LEPACKER_H 2 | #define __MDFN_LEPACKER_H 3 | 4 | #include "mednafen.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | /* Little-endian byte packer(and unpacker). */ 11 | 12 | namespace MDFN 13 | { 14 | 15 | class LEPacker; 16 | class LEPackable 17 | { 18 | public: 19 | virtual void pack(LEPacker &lep) = 0; 20 | }; 21 | 22 | class LEPacker : public std::vector 23 | { 24 | public: 25 | 26 | LEPacker() : read_mode(0), read_pos(0), randomize_read_mode(0) 27 | { 28 | 29 | } 30 | 31 | 32 | inline void set_read_mode(bool new_read_mode, bool new_randomize_read_mode = false) 33 | { 34 | read_mode = new_read_mode; 35 | randomize_read_mode = new_randomize_read_mode; 36 | } 37 | 38 | inline void reset_read_pos(void) 39 | { 40 | read_pos = 0; 41 | } 42 | 43 | void operator^(LEPackable &o) 44 | { 45 | o.pack(*this); 46 | } 47 | 48 | template INLINE void operator^(T &val) 49 | { 50 | size_type csize = size(); 51 | 52 | if(read_mode) 53 | { 54 | if((read_pos + sizeof(T)) > csize) 55 | throw(std::out_of_range("LEPacker::operator^")); 56 | 57 | uint8 *ptr = &(*this)[read_pos]; 58 | val = 0; 59 | 60 | if(randomize_read_mode) 61 | { 62 | for(unsigned int n = 0; n < sizeof(T); n++) 63 | val |= ((T)((rand() >> 4) & 0xFF)) << (n << 3); 64 | } 65 | else 66 | { 67 | for(unsigned int n = 0; n < sizeof(T); n++) 68 | val |= ((T)ptr[n]) << (n << 3); 69 | } 70 | 71 | read_pos += sizeof(T); 72 | } 73 | else 74 | { 75 | resize(csize + sizeof(T)); 76 | 77 | uint8 *ptr = &(*this)[csize]; 78 | 79 | for(unsigned int n = 0; n < sizeof(T); n++) 80 | ptr[n] = val >> (n << 3); 81 | } 82 | } 83 | 84 | INLINE void operator^(bool &val) 85 | { 86 | uint8 tmp = val; 87 | 88 | (*this) ^ tmp; 89 | 90 | if(read_mode) 91 | val = tmp; 92 | } 93 | 94 | private: 95 | 96 | bool read_mode; 97 | uint64 read_pos; 98 | bool randomize_read_mode; 99 | }; 100 | 101 | } 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /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 void truncate(uint64_t length); 47 | virtual void flush(void); 48 | virtual uint64_t tell(void); 49 | virtual uint64_t size(void); 50 | virtual void close(void); 51 | 52 | virtual int get_line(std::string &str); 53 | 54 | private: 55 | uint8 *data_buffer; 56 | uint64 data_buffer_size; 57 | uint64 data_buffer_alloced; 58 | 59 | int64 position; 60 | 61 | void grow_if_necessary(uint64 new_required_size); 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAFReader.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Mednafen - Multi-system Emulator */ 3 | /******************************************************************************/ 4 | /* CDAFReader.h: 5 | ** Copyright (C) 2010-2016 Mednafen Team 6 | ** 7 | ** This program is free software; you can redistribute it and/or 8 | ** modify it under the terms of the GNU General Public License 9 | ** as published by the Free Software Foundation; either version 2 10 | ** of the License, or (at your option) any later version. 11 | ** 12 | ** This program is distributed in the hope that it will be useful, 13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ** GNU General Public License for more details. 16 | ** 17 | ** You should have received a copy of the GNU General Public License 18 | ** along with this program; if not, write to the Free Software Foundation, Inc., 19 | ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MDFN_CDAFREADER_H 23 | #define __MDFN_CDAFREADER_H 24 | 25 | #include 26 | 27 | class CDAFReader 28 | { 29 | public: 30 | CDAFReader(); 31 | virtual ~CDAFReader(); 32 | 33 | virtual uint64_t FrameCount(void) = 0; 34 | INLINE uint64_t Read(uint64_t frame_offset, int16 *buffer, uint64_t frames) 35 | { 36 | uint64_t ret; 37 | 38 | if(LastReadPos != frame_offset) 39 | { 40 | if(!Seek_(frame_offset)) 41 | return(0); 42 | LastReadPos = frame_offset; 43 | } 44 | 45 | ret = Read_(buffer, frames); 46 | LastReadPos += ret; 47 | return(ret); 48 | } 49 | 50 | private: 51 | virtual uint64_t Read_(int16 *buffer, uint64_t frames) = 0; 52 | virtual bool Seek_(uint64_t frame_offset) = 0; 53 | 54 | uint64_t LastReadPos; 55 | }; 56 | 57 | // AR_Open(), and CDAFReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access 58 | // to it for as long as the CDAFReader object exists. 59 | CDAFReader *CDAFR_Open(Stream *fp); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /mednafen/msvc_compat.h: -------------------------------------------------------------------------------- 1 | /* RetroArch - A frontend for libretro. 2 | * Copyright (C) 2010-2012 - Hans-Kristian Arntzen 3 | * 4 | * RetroArch is free software: you can redistribute it and/or modify it under the terms 5 | * of the GNU General Public License as published by the Free Software Found- 6 | * ation, either version 3 of the License, or (at your option) any later version. 7 | * 8 | * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 9 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 10 | * PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with RetroArch. 13 | * If not, see . 14 | */ 15 | 16 | #ifndef __RARCH_MSVC_COMPAT_H 17 | #define __RARCH_MSVC_COMPAT_H 18 | 19 | #ifdef _MSC_VER 20 | 21 | #undef UNICODE // Do not bother with UNICODE at this time. 22 | #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 | #if (_MSC_VER < 1310) 44 | #include 45 | #define strlen _tcslen 46 | #endif 47 | 48 | # define S_IRUSR S_IREAD /* read, user */ 49 | # define S_IWUSR S_IWRITE /* write, user */ 50 | 51 | // Disable some of the annoying warnings. 52 | #pragma warning(disable : 4800) 53 | #pragma warning(disable : 4244) 54 | #pragma warning(disable : 4305) 55 | #pragma warning(disable : 4146) 56 | #pragma warning(disable : 4267) 57 | 58 | #if _MSC_VER < 1800 59 | #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) 60 | #endif 61 | 62 | #ifndef PATH_MAX 63 | #define PATH_MAX MAX_PATH 64 | #endif 65 | 66 | #endif 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /mednafen/pcfx/king_mix_body.inc: -------------------------------------------------------------------------------- 1 | if(fx_vce.dot_clock) // No cellophane in 7.16MHz pixel mode 2 | { 3 | if(HighDotClockWidth == 341) 4 | for(unsigned int x = 0; x < 341; x++) 5 | { 6 | LAYER_MIX_BODY(x * 256 / 341, x); 7 | LAYER_MIX_FINAL_NOCELLO; 8 | } 9 | else if(HighDotClockWidth == 256) 10 | for(unsigned int x = 0; x < 256; x++) 11 | { 12 | LAYER_MIX_BODY(x, x * 341 / 256); 13 | LAYER_MIX_FINAL_NOCELLO; 14 | } 15 | else 16 | for(unsigned int x = 0; x < 1024; x++) 17 | { 18 | LAYER_MIX_BODY(x / 4, x / 3); 19 | LAYER_MIX_FINAL_NOCELLO; 20 | } 21 | } 22 | else if((vce_rendercache.BLE & 0xC000) == 0xC000) // Front cellophane 23 | { 24 | uint8 CCR_Y_front = vce_rendercache.coefficient_mul_table_y[(vce_rendercache.coefficients[0] >> 8) & 0xF][(vce_rendercache.CCR >> 8) & 0xFF]; 25 | int8 CCR_U_front = vce_rendercache.coefficient_mul_table_uv[(vce_rendercache.coefficients[0] >> 4) & 0xF][(vce_rendercache.CCR & 0xF0)]; 26 | int8 CCR_V_front = vce_rendercache.coefficient_mul_table_uv[(vce_rendercache.coefficients[0] >> 0) & 0xF][(vce_rendercache.CCR << 4) & 0xF0]; 27 | 28 | BPC_Cache = 0x008080 | (LAYER_NONE << 28); 29 | 30 | for(unsigned int x = 0; x < 256; x++) 31 | { 32 | LAYER_MIX_BODY(x, x); 33 | LAYER_MIX_FINAL_FRONT_CELLO; 34 | } 35 | } 36 | else if((vce_rendercache.BLE & 0xC000) == 0x4000) // Back cellophane 37 | { 38 | BPC_Cache = ((vce_rendercache.CCR & 0xFF00) << 8) | ((vce_rendercache.CCR & 0xF0) << 8) | ((vce_rendercache.CCR & 0x0F) << 4) | (LAYER_NONE << 28); 39 | 40 | for(unsigned int x = 0; x < 256; x++) 41 | { 42 | LAYER_MIX_BODY(x, x); 43 | LAYER_MIX_FINAL_BACK_CELLO; 44 | } 45 | } 46 | else if(ble_cache_any) // No front/back cello, but cellophane on at least 1 layer 47 | { 48 | for(unsigned int x = 0; x < 256; x++) 49 | { 50 | LAYER_MIX_BODY(x, x); 51 | LAYER_MIX_FINAL_CELLO 52 | } 53 | } 54 | else // No cellophane at all 55 | { 56 | for(unsigned int x = 0; x < 256; x++) 57 | { 58 | LAYER_MIX_BODY(x, x); 59 | LAYER_MIX_FINAL_NOCELLO 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /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 23 | 24 | #include 25 | 26 | class CDIF 27 | { 28 | public: 29 | 30 | CDIF(); 31 | virtual ~CDIF(); 32 | 33 | static const int32_t LBA_Read_Minimum = -150; 34 | static const int32_t LBA_Read_Maximum = 449849; // 100 * 75 * 60 - 150 - 1 35 | 36 | inline void ReadTOC(TOC *read_target) 37 | { 38 | *read_target = disc_toc; 39 | } 40 | 41 | virtual void HintReadSector(int32_t lba) = 0; 42 | virtual bool ReadRawSector(uint8_t *buf, int32_t lba) = 0; // Reads 2352+96 bytes of data into buf. 43 | virtual bool ReadRawSectorPWOnly(uint8_t* pwbuf, int32_t lba, bool hint_fullread) = 0; // Reads 96 bytes(of raw subchannel PW data) into pwbuf. 44 | 45 | // Call for mode 1 or mode 2 form 1 only. 46 | bool ValidateRawSector(uint8_t *buf); 47 | 48 | // Utility/Wrapped functions 49 | // Reads mode 1 and mode2 form 1 sectors(2048 bytes per sector returned) 50 | // Will return the type(1, 2) of the first sector read to the buffer supplied, 0 on error 51 | int ReadSector(uint8_t* buf, int32_t lba, uint32_t sector_count, bool suppress_uncorrectable_message = false); 52 | 53 | protected: 54 | bool UnrecoverableError; 55 | TOC disc_toc; 56 | }; 57 | 58 | CDIF *CDIF_Open(const std::string& path, bool image_memcache); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libretro-common/compat/compat_strl.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strl.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | /* Implementation of strlcpy()/strlcat() based on OpenBSD. */ 29 | 30 | #ifndef __MACH__ 31 | 32 | size_t strlcpy(char *dest, const char *source, size_t size) 33 | { 34 | size_t src_size = 0; 35 | size_t n = size; 36 | 37 | if (n) 38 | while (--n && (*dest++ = *source++)) src_size++; 39 | 40 | if (!n) 41 | { 42 | if (size) *dest = '\0'; 43 | while (*source++) src_size++; 44 | } 45 | 46 | return src_size; 47 | } 48 | 49 | size_t strlcat(char *dest, const char *source, size_t size) 50 | { 51 | size_t len = strlen(dest); 52 | 53 | dest += len; 54 | 55 | if (len > size) 56 | size = 0; 57 | else 58 | size -= len; 59 | 60 | return len + strlcpy(dest, source, size); 61 | } 62 | #endif 63 | -------------------------------------------------------------------------------- /libretro-common/rthreads/xenon_sdl_threads.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (xenon_sdl_threads.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 | /* libSDLxenon doesn't implement this yet :[. Implement it very stupidly for now. ;) */ 24 | 25 | #include "SDL_thread.h" 26 | #include "SDL_mutex.h" 27 | #include 28 | #include 29 | 30 | SDL_cond *SDL_CreateCond(void) 31 | { 32 | bool *sleeping = calloc(1, sizeof(*sleeping)); 33 | return (SDL_cond*)sleeping; 34 | } 35 | 36 | void SDL_DestroyCond(SDL_cond *sleeping) 37 | { 38 | free(sleeping); 39 | } 40 | 41 | int SDL_CondWait(SDL_cond *cond, SDL_mutex *lock) 42 | { 43 | (void)lock; 44 | volatile bool *sleeping = (volatile bool*)cond; 45 | 46 | SDL_mutexV(lock); 47 | *sleeping = true; 48 | while (*sleeping); /* Yeah, we all love busyloops don't we? ._. */ 49 | SDL_mutexP(lock); 50 | 51 | return 0; 52 | } 53 | 54 | int SDL_CondSignal(SDL_cond *cond) 55 | { 56 | *(volatile bool*)cond = false; 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /mednafen/FileStream.cpp: -------------------------------------------------------------------------------- 1 | // TODO/WIP 2 | 3 | /* Mednafen - Multi-system Emulator 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "mednafen.h" 24 | #include "Stream.h" 25 | #include "FileStream.h" 26 | 27 | FileStream::FileStream(const char *path, const int mode) 28 | { 29 | fp = filestream_open(path, (mode == MODE_WRITE || mode == MODE_WRITE_INPLACE) ? RETRO_VFS_FILE_ACCESS_WRITE : RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE); 30 | } 31 | 32 | FileStream::~FileStream() 33 | { 34 | if (fp) 35 | { 36 | filestream_close(fp); 37 | fp = NULL; 38 | } 39 | } 40 | 41 | uint64_t FileStream::read(void *data, uint64_t count) 42 | { 43 | if (!fp) 44 | return 0; 45 | return filestream_read(fp, data, count); 46 | } 47 | 48 | void FileStream::write(const void *data, uint64_t count) 49 | { 50 | if (!fp) 51 | return; 52 | filestream_write(fp, data, count); 53 | } 54 | 55 | void FileStream::seek(int64_t offset, int whence) 56 | { 57 | if (!fp) 58 | return; 59 | filestream_seek(fp, offset, whence); 60 | } 61 | 62 | uint64_t FileStream::tell(void) 63 | { 64 | if (!fp) 65 | return -1; 66 | return filestream_tell(fp); 67 | } 68 | 69 | uint64_t FileStream::size(void) 70 | { 71 | if (!fp) 72 | return -1; 73 | return filestream_get_size(fp); 74 | } 75 | 76 | void FileStream::truncate(uint64_t length) 77 | { 78 | } 79 | 80 | void FileStream::flush(void) 81 | { 82 | } 83 | 84 | void FileStream::close(void) 85 | { 86 | if (!fp) 87 | return; 88 | filestream_close(fp); 89 | fp = NULL; 90 | } 91 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/flac.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause 2 | * copyright-holders:Aaron Giles 3 | *************************************************************************** 4 | 5 | flac.h 6 | 7 | FLAC compression wrappers 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __FLAC_H__ 14 | #define __FLAC_H__ 15 | 16 | #include 17 | 18 | /*************************************************************************** 19 | * TYPE DEFINITIONS 20 | *************************************************************************** 21 | */ 22 | 23 | typedef struct _flac_decoder flac_decoder; 24 | struct _flac_decoder { 25 | /* output state */ 26 | void * decoder; /* actual encoder */ 27 | uint32_t sample_rate; /* decoded sample rate */ 28 | uint8_t channels; /* decoded number of channels */ 29 | uint8_t bits_per_sample; /* decoded bits per sample */ 30 | uint32_t compressed_offset; /* current offset in compressed data */ 31 | const uint8_t * compressed_start; /* start of compressed data */ 32 | uint32_t compressed_length; /* length of compressed data */ 33 | const uint8_t * compressed2_start; /* start of compressed data */ 34 | uint32_t compressed2_length; /* length of compressed data */ 35 | int16_t * uncompressed_start[8]; /* pointer to start of uncompressed data (up to 8 streams) */ 36 | uint32_t uncompressed_offset; /* current position in uncompressed data */ 37 | uint32_t uncompressed_length; /* length of uncompressed data */ 38 | int uncompressed_swap; /* swap uncompressed sample data */ 39 | uint8_t custom_header[0x2a]; /* custom header */ 40 | }; 41 | 42 | /* ======================> flac_decoder */ 43 | 44 | int flac_decoder_init(flac_decoder* decoder); 45 | void flac_decoder_free(flac_decoder* decoder); 46 | int flac_decoder_reset(flac_decoder* decoder, uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length); 47 | int flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian); 48 | uint32_t flac_decoder_finish(flac_decoder* decoder); 49 | 50 | #endif /* __FLAC_H__ */ 51 | -------------------------------------------------------------------------------- /libretro-common/include/memmap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memmap.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_MEMMAP_H 24 | #define _LIBRETRO_MEMMAP_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(PSP) || defined(PS2) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) || defined(WIIU) || defined(SWITCH) || defined(HAVE_LIBNX) || defined(__PS3__) || defined(__PSL1GHT__) 30 | /* No mman available */ 31 | #elif defined(_WIN32) && !defined(_XBOX) 32 | #include 33 | #include 34 | #include 35 | #else 36 | #define HAVE_MMAN 37 | #include 38 | #endif 39 | 40 | #if !defined(HAVE_MMAN) || defined(_WIN32) 41 | void* mmap(void *addr, size_t len, int mmap_prot, int mmap_flags, int fildes, size_t off); 42 | 43 | int munmap(void *addr, size_t len); 44 | 45 | int mprotect(void *addr, size_t len, int prot); 46 | #endif 47 | 48 | int memsync(void *start, void *end); 49 | 50 | int memprotect(void *addr, size_t len); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /mednafen/cdrom/lec.h: -------------------------------------------------------------------------------- 1 | /* cdrdao - write audio CD-Rs in disc-at-once mode 2 | * 3 | * Copyright (C) 1998-2002 Andreas Mueller 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | */ 19 | 20 | #ifndef __LEC_H__ 21 | #define __LEC_H__ 22 | 23 | #include 24 | 25 | /* Encodes a MODE 0 sector. 26 | * 'adr' is the current physical sector address 27 | * 'sector' must be 2352 byte wide 28 | */ 29 | void lec_encode_mode0_sector(uint32_t adr, uint8_t *sector); 30 | 31 | /* Encodes a MODE 1 sector. 32 | * 'adr' is the current physical sector address 33 | * 'sector' must be 2352 byte wide containing 2048 bytes user data at 34 | * offset 16 35 | */ 36 | void lec_encode_mode1_sector(uint32_t adr, uint8_t *sector); 37 | 38 | /* Encodes a MODE 2 sector. 39 | * 'adr' is the current physical sector address 40 | * 'sector' must be 2352 byte wide containing 2336 bytes user data at 41 | * offset 16 42 | */ 43 | void lec_encode_mode2_sector(uint32_t adr, uint8_t *sector); 44 | 45 | /* Encodes a XA form 1 sector. 46 | * 'adr' is the current physical sector address 47 | * 'sector' must be 2352 byte wide containing 2048+8 bytes user data at 48 | * offset 16 49 | */ 50 | void lec_encode_mode2_form1_sector(uint32_t adr, uint8_t *sector); 51 | 52 | /* Encodes a XA form 2 sector. 53 | * 'adr' is the current physical sector address 54 | * 'sector' must be 2352 byte wide containing 2324+8 bytes user data at 55 | * offset 16 56 | */ 57 | void lec_encode_mode2_form2_sector(uint32_t adr, uint8_t *sector); 58 | 59 | /* Scrambles and byte swaps an encoded sector. 60 | * 'sector' must be 2352 byte wide. 61 | */ 62 | void lec_scramble(int8_t *sector); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /libretro-common/include/compat/strl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strl.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRL_H 24 | #define __LIBRETRO_SDK_COMPAT_STRL_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 30 | #include "../../../config.h" 31 | #endif 32 | 33 | #include 34 | 35 | RETRO_BEGIN_DECLS 36 | 37 | #ifdef __MACH__ 38 | #ifndef HAVE_STRL 39 | #define HAVE_STRL 40 | #endif 41 | #endif 42 | 43 | #ifndef HAVE_STRL 44 | /* Avoid possible naming collisions during link since 45 | * we prefer to use the actual name. */ 46 | #define strlcpy(dst, src, size) strlcpy_retro__(dst, src, size) 47 | 48 | #define strlcat(dst, src, size) strlcat_retro__(dst, src, size) 49 | 50 | size_t strlcpy(char *dest, const char *source, size_t size); 51 | size_t strlcat(char *dest, const char *source, size_t size); 52 | 53 | #endif 54 | 55 | char *strldup(const char *s, size_t n); 56 | 57 | RETRO_END_DECLS 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /libretro-common/compat/compat_strcasestr.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strcasestr.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | 27 | /* Pretty much strncasecmp. */ 28 | static int casencmp(const char *a, const char *b, size_t n) 29 | { 30 | size_t i; 31 | 32 | for (i = 0; i < n; i++) 33 | { 34 | int a_lower = tolower(a[i]); 35 | int b_lower = tolower(b[i]); 36 | if (a_lower != b_lower) 37 | return a_lower - b_lower; 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | char *strcasestr_retro__(const char *haystack, const char *needle) 44 | { 45 | size_t i, search_off; 46 | size_t hay_len = strlen(haystack); 47 | size_t needle_len = strlen(needle); 48 | 49 | if (needle_len > hay_len) 50 | return NULL; 51 | 52 | search_off = hay_len - needle_len; 53 | for (i = 0; i <= search_off; i++) 54 | if (!casencmp(haystack + i, needle, needle_len)) 55 | return (char*)haystack + i; 56 | 57 | return NULL; 58 | } 59 | -------------------------------------------------------------------------------- /libretro-common/include/retro_stat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2016 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_stat.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_STAT_H 24 | #define __RETRO_STAT_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | /** 36 | * path_is_directory: 37 | * @path : path 38 | * 39 | * Checks if path is a directory. 40 | * 41 | * Returns: true (1) if path is a directory, otherwise false (0). 42 | */ 43 | bool path_is_directory(const char *path); 44 | 45 | bool path_is_character_special(const char *path); 46 | 47 | bool path_is_valid(const char *path); 48 | 49 | int32_t path_get_size(const char *path); 50 | 51 | /** 52 | * path_mkdir_norecurse: 53 | * @dir : directory 54 | * 55 | * Create directory on filesystem. 56 | * 57 | * Returns: true (1) if directory could be created, otherwise false (0). 58 | **/ 59 | bool mkdir_norecurse(const char *dir); 60 | 61 | RETRO_END_DECLS 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libretro-common/include/compat/posix_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (posix_string.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 24 | #define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 25 | 26 | #include 27 | 28 | #ifdef _MSC_VER 29 | #include 30 | #endif 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | #ifdef _WIN32 35 | #undef strtok_r 36 | #define strtok_r(str, delim, saveptr) retro_strtok_r__(str, delim, saveptr) 37 | 38 | char *strtok_r(char *str, const char *delim, char **saveptr); 39 | #endif 40 | 41 | #ifdef _MSC_VER 42 | #undef strcasecmp 43 | #undef strdup 44 | #define strcasecmp(a, b) retro_strcasecmp__(a, b) 45 | #define strdup(orig) retro_strdup__(orig) 46 | int strcasecmp(const char *a, const char *b); 47 | char *strdup(const char *orig); 48 | 49 | /* isblank is available since MSVC 2013 */ 50 | #if _MSC_VER < 1800 51 | #undef isblank 52 | #define isblank(c) retro_isblank__(c) 53 | int isblank(int c); 54 | #endif 55 | 56 | #endif 57 | 58 | RETRO_END_DECLS 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /mednafen/tremor/window.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #include 19 | #include 20 | #include "misc.h" 21 | #include "window.h" 22 | #include "window_lookup.h" 23 | 24 | const void *_vorbis_window(int type, int left){ 25 | 26 | switch(type){ 27 | case 0: 28 | 29 | switch(left){ 30 | case 32: 31 | return vwin64; 32 | case 64: 33 | return vwin128; 34 | case 128: 35 | return vwin256; 36 | case 256: 37 | return vwin512; 38 | case 512: 39 | return vwin1024; 40 | case 1024: 41 | return vwin2048; 42 | case 2048: 43 | return vwin4096; 44 | case 4096: 45 | return vwin8192; 46 | default: 47 | return(0); 48 | } 49 | break; 50 | default: 51 | return(0); 52 | } 53 | } 54 | 55 | void _vorbis_apply_window(int32_t *d,const void *window_p[2], 56 | long *blocksizes, 57 | int lW,int W,int nW){ 58 | 59 | LOOKUP_T *window[2]={window_p[0],window_p[1]}; 60 | long n=blocksizes[W]; 61 | long ln=blocksizes[lW]; 62 | long rn=blocksizes[nW]; 63 | 64 | long leftbegin=n/4-ln/4; 65 | long leftend=leftbegin+ln/2; 66 | 67 | long rightbegin=n/2+n/4-rn/4; 68 | long rightend=rightbegin+rn/2; 69 | 70 | int i,p; 71 | 72 | for(i=0;i 27 | #include 28 | 29 | RETRO_BEGIN_DECLS 30 | 31 | int64_t retro_vfs_file_seek_cdrom(libretro_vfs_implementation_file *stream, int64_t offset, int whence); 32 | 33 | void retro_vfs_file_open_cdrom( 34 | libretro_vfs_implementation_file *stream, 35 | const char *path, unsigned mode, unsigned hints); 36 | 37 | int retro_vfs_file_close_cdrom(libretro_vfs_implementation_file *stream); 38 | 39 | int64_t retro_vfs_file_tell_cdrom(libretro_vfs_implementation_file *stream); 40 | 41 | int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream, 42 | void *s, uint64_t len); 43 | 44 | int retro_vfs_file_error_cdrom(libretro_vfs_implementation_file *stream); 45 | 46 | const cdrom_toc_t* retro_vfs_file_get_cdrom_toc(void); 47 | 48 | const vfs_cdrom_t* retro_vfs_file_get_cdrom_position(const libretro_vfs_implementation_file *stream); 49 | 50 | RETRO_END_DECLS 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libretro-common/compat/fopen_utf8.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) 29 | #ifndef LEGACY_WIN32 30 | #define LEGACY_WIN32 31 | #endif 32 | #endif 33 | 34 | #ifdef _WIN32 35 | #undef fopen 36 | 37 | void *fopen_utf8(const char * filename, const char * mode) 38 | { 39 | #if defined(LEGACY_WIN32) 40 | char * filename_local = utf8_to_local_string_alloc(filename); 41 | if (filename_local) 42 | { 43 | FILE *ret = fopen(filename_local, mode); 44 | free(filename_local); 45 | return ret; 46 | } 47 | #else 48 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 49 | if (filename_w) 50 | { 51 | FILE *ret = NULL; 52 | wchar_t *mode_w = utf8_to_utf16_string_alloc(mode); 53 | if (mode_w) 54 | { 55 | ret = _wfopen(filename_w, mode_w); 56 | free(mode_w); 57 | } 58 | free(filename_w); 59 | return ret; 60 | } 61 | #endif 62 | return NULL; 63 | } 64 | #endif 65 | -------------------------------------------------------------------------------- /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/hw_cpu/v810/v810_do_am.h: -------------------------------------------------------------------------------- 1 | #define DO_MOV_AM(); DO_AM_I(); 2 | #define DO_ADD_AM(); DO_AM_I(); 3 | #define DO_SUB_AM(); DO_AM_I(); 4 | #define DO_CMP_AM(); DO_AM_I(); 5 | #define DO_SHL_AM(); DO_AM_I(); 6 | #define DO_SHR_AM(); DO_AM_I(); 7 | #define DO_JMP_AM(); DO_AM_I(); 8 | #define DO_SAR_AM(); DO_AM_I(); 9 | #define DO_MUL_AM(); DO_AM_I(); 10 | #define DO_DIV_AM(); DO_AM_I(); 11 | #define DO_MULU_AM(); DO_AM_I(); 12 | #define DO_DIVU_AM(); DO_AM_I(); 13 | #define DO_OR_AM(); DO_AM_I(); 14 | #define DO_AND_AM(); DO_AM_I(); 15 | #define DO_XOR_AM(); DO_AM_I(); 16 | #define DO_NOT_AM(); DO_AM_I(); 17 | #define DO_MOV_I_AM(); DO_AM_II(); 18 | #define DO_ADD_I_AM(); DO_AM_II(); 19 | #define DO_SETF_AM(); DO_AM_II(); 20 | #define DO_CMP_I_AM(); DO_AM_II(); 21 | #define DO_SHL_I_AM(); DO_AM_II(); 22 | #define DO_SHR_I_AM(); DO_AM_II(); 23 | #define DO_EI_AM(); DO_AM_II(); 24 | #define DO_SAR_I_AM(); DO_AM_II(); 25 | #define DO_TRAP_AM(); DO_AM_II(); 26 | #define DO_RETI_AM(); DO_AM_IX(); 27 | #define DO_HALT_AM(); DO_AM_IX(); 28 | #define DO_LDSR_AM(); DO_AM_II(); 29 | #define DO_STSR_AM(); DO_AM_II(); 30 | #define DO_DI_AM(); DO_AM_II(); 31 | #define DO_BSTR_AM(); DO_AM_BSTR(); 32 | #define DO_MOVEA_AM(); DO_AM_V(); 33 | #define DO_ADDI_AM(); DO_AM_V(); 34 | #define DO_JR_AM(); DO_AM_IV(); 35 | #define DO_JAL_AM(); DO_AM_IV(); 36 | #define DO_ORI_AM(); DO_AM_V(); 37 | #define DO_ANDI_AM(); DO_AM_V(); 38 | #define DO_XORI_AM(); DO_AM_V(); 39 | #define DO_MOVHI_AM(); DO_AM_V(); 40 | #define DO_LD_B_AM(); DO_AM_VIa(); 41 | #define DO_LD_H_AM(); DO_AM_VIa(); 42 | #define DO_LD_W_AM(); DO_AM_VIa(); 43 | #define DO_ST_B_AM(); DO_AM_VIb(); 44 | #define DO_ST_H_AM(); DO_AM_VIb(); 45 | #define DO_ST_W_AM(); DO_AM_VIb(); 46 | #define DO_IN_B_AM(); DO_AM_VIa(); 47 | #define DO_IN_H_AM(); DO_AM_VIa(); 48 | #define DO_CAXI_AM(); DO_AM_VIa(); 49 | #define DO_IN_W_AM(); DO_AM_VIa(); 50 | #define DO_OUT_B_AM(); DO_AM_VIb(); 51 | #define DO_OUT_H_AM(); DO_AM_VIb(); 52 | #define DO_FPP_AM(); DO_AM_FPP(); 53 | #define DO_OUT_W_AM(); DO_AM_VIb(); 54 | #define DO_BV_AM(); DO_AM_III(); 55 | #define DO_BL_AM(); DO_AM_III(); 56 | #define DO_BE_AM(); DO_AM_III(); 57 | #define DO_BNH_AM(); DO_AM_III(); 58 | #define DO_BN_AM(); DO_AM_III(); 59 | #define DO_BR_AM(); DO_AM_III(); 60 | #define DO_BLT_AM(); DO_AM_III(); 61 | #define DO_BLE_AM(); DO_AM_III(); 62 | #define DO_BNV_AM(); DO_AM_III(); 63 | #define DO_BNL_AM(); DO_AM_III(); 64 | #define DO_BNE_AM(); DO_AM_III(); 65 | #define DO_BH_AM(); DO_AM_III(); 66 | #define DO_BP_AM(); DO_AM_III(); 67 | #define DO_NOP_AM(); DO_AM_III(); 68 | #define DO_BGE_AM(); DO_AM_III(); 69 | #define DO_BGT_AM(); DO_AM_III(); 70 | 71 | 72 | #define DO_INVALID_AM(); DO_AM_UDEF(); 73 | -------------------------------------------------------------------------------- /libretro-common/time/rtime.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifdef HAVE_THREADS 24 | #include 25 | #include 26 | #endif 27 | 28 | #include 29 | #include