├── .gitignore ├── jni ├── Application.mk └── Android.mk ├── intl ├── .gitignore ├── crowdin.yaml ├── upload_workflow.py ├── download_workflow.py ├── crowdin_prep.py ├── remove_initial_cycle.py ├── crowdin_translate.py ├── crowdin_source_upload.py ├── crowdin_translation_download.py ├── initial_sync.py └── core_option_regex.py ├── libretro ├── link.T └── handy.h ├── README.md ├── .travis.yml ├── .github └── workflows │ ├── compilation.yml │ ├── crowdin_prep.yml │ └── crowdin_translate.yml ├── lynx ├── license.txt ├── memfault.h ├── errorinterface.h ├── lynxbase.h ├── cart_db.h ├── eeprom.h ├── sysbase.h ├── memmap.h ├── machine.h ├── ram.h ├── rom.h ├── scrc32.h ├── ram.cpp ├── rom.cpp ├── cart.h ├── memmap.cpp ├── lynxdec.cpp └── lynxdef.h ├── Makefile.common ├── libretro-common ├── include │ ├── retro_assert.h │ ├── retro_inline.h │ ├── boolean.h │ ├── compat │ │ ├── fopen_utf8.h │ │ ├── strcasestr.h │ │ ├── strl.h │ │ ├── posix_string.h │ │ ├── msvc.h │ │ └── msvc │ │ │ └── stdint.h │ ├── time │ │ └── rtime.h │ ├── encodings │ │ └── utf.h │ ├── streams │ │ ├── file_stream_transforms.h │ │ └── file_stream.h │ ├── vfs │ │ ├── vfs_implementation.h │ │ └── vfs.h │ ├── retro_environment.h │ ├── retro_common_api.h │ └── retro_miscellaneous.h ├── compat │ ├── compat_strcasestr.c │ ├── compat_strl.c │ ├── fopen_utf8.c │ ├── compat_snprintf.c │ └── compat_posix_string.c ├── time │ └── rtime.c ├── file │ └── file_path_io.c └── streams │ └── file_stream_transforms.c ├── blip ├── Stereo_Buffer.h ├── Stereo_Buffer.cpp └── Blip_Buffer.cpp └── .gitlab-ci.yml /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := c++_static 2 | APP_ABI := all 3 | -------------------------------------------------------------------------------- /intl/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | crowdin-cli.jar 3 | *.h 4 | *.json 5 | -------------------------------------------------------------------------------- /libretro/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | libretro-handy 2 | ============== 3 | K. Wilkins' Atari Lynx emultor Handy (http://handy.sourceforge.net/) for libretro 4 | -------------------------------------------------------------------------------- /libretro/handy.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "system.h" 5 | #include "lynxdef.h" 6 | 7 | #define HANDYVER "0.97" 8 | #define ROM_FILE "lynxboot.img" 9 | 10 | void handy_log(enum retro_log_level level, const char *format, ...); 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | CORE_DIR := $(LOCAL_PATH)/.. 4 | 5 | include $(CORE_DIR)/Makefile.common 6 | 7 | COREFLAGS := -DANDROID -D__LIBRETRO__ -DHAVE_STRINGS_H -DHAVE_STDINT_H -DWANT_CRC32 $(INCFLAGS) 8 | 9 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" 10 | ifneq ($(GIT_VERSION)," unknown") 11 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" 12 | endif 13 | 14 | include $(CLEAR_VARS) 15 | LOCAL_MODULE := retro 16 | LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) 17 | LOCAL_CXXFLAGS := $(COREFLAGS) 18 | LOCAL_CFLAGS := $(COREFLAGS) 19 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/libretro/link.T 20 | LOCAL_LDLIBS := -lz 21 | include $(BUILD_SHARED_LIBRARY) 22 | -------------------------------------------------------------------------------- /.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=handy 14 | - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7 15 | matrix: 16 | - PLATFORM=linux_x64 17 | before_script: 18 | - pwd 19 | - mkdir -p ~/bin 20 | - ln -s /usr/bin/gcc-7 ~/bin/gcc 21 | - ln -s /usr/bin/g++-7 ~/bin/g++ 22 | - ln -s /usr/bin/cpp-7 ~/bin/cpp 23 | - export PATH=~/bin:$PATH 24 | - ls -l ~/bin 25 | - echo $PATH 26 | - g++-7 --version 27 | - g++ --version 28 | script: 29 | - cd ~/ 30 | - git clone --depth=50 https://github.com/libretro/libretro-super 31 | - cd libretro-super/travis 32 | - ./build.sh 33 | -------------------------------------------------------------------------------- /.github/workflows/compilation.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | pull_request: 6 | repository_dispatch: 7 | types: [run_build] 8 | 9 | jobs: 10 | build-ps2: 11 | runs-on: ubuntu-latest 12 | container: ps2dev/ps2dev:latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Install dependencies 17 | run: | 18 | apk add build-base git bash 19 | 20 | - name: Compile project 21 | run: | 22 | make platform=ps2 -j$(nproc) clean && make platform=ps2 -j$(nproc) 23 | 24 | - name: Get short SHA 25 | id: slug 26 | run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" 27 | 28 | - name: Upload artifacts 29 | if: ${{ success() }} 30 | uses: actions/upload-artifact@v4 31 | with: 32 | name: handy_libretro_ps2-${{ steps.slug.outputs.sha8 }} 33 | path: handy_libretro_ps2.a 34 | -------------------------------------------------------------------------------- /.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/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@v1 19 | with: 20 | java-version: 1.8 21 | 22 | - name: Setup Python 23 | uses: actions/setup-python@v2 24 | 25 | - name: Checkout 26 | uses: actions/checkout@v2 27 | 28 | - name: Upload Source 29 | shell: bash 30 | env: 31 | CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} 32 | run: | 33 | python3 intl/upload_workflow.py $CROWDIN_API_KEY "libretro-handy" "libretro/libretro_core_options.h" 34 | -------------------------------------------------------------------------------- /lynx/license.txt: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 K. Wilkins 3 | // 4 | // This software is provided 'as-is', without any express or implied warranty. 5 | // In no event will the authors be held liable for any damages arising from 6 | // the use of this software. 7 | // 8 | // Permission is granted to anyone to use this software for any purpose, 9 | // including commercial applications, and to alter it and redistribute it 10 | // freely, subject to the following restrictions: 11 | // 12 | // 1. The origin of this software must not be misrepresented; you must not 13 | // claim that you wrote the original software. If you use this software 14 | // in a product, an acknowledgment in the product documentation would be 15 | // appreciated but is not required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not 18 | // be misrepresented as being the original software. 19 | // 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | // -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lynx/memfault.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 K. Wilkins 3 | // 4 | // This software is provided 'as-is', without any express or implied warranty. 5 | // In no event will the authors be held liable for any damages arising from 6 | // the use of this software. 7 | // 8 | // Permission is granted to anyone to use this software for any purpose, 9 | // including commercial applications, and to alter it and redistribute it 10 | // freely, subject to the following restrictions: 11 | // 12 | // 1. The origin of this software must not be misrepresented; you must not 13 | // claim that you wrote the original software. If you use this software 14 | // in a product, an acknowledgment in the product documentation would be 15 | // appreciated but is not required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not 18 | // be misrepresented as being the original software. 19 | // 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | // 22 | 23 | // 24 | // Bad memory access class. 25 | // 26 | 27 | #ifndef BADACCESS_H 28 | #define BADACCESS_H 29 | 30 | class CMemFaultObj : public CLynxBase 31 | { 32 | // Function members 33 | 34 | public: 35 | CMemFaultObj() {}; 36 | ~CMemFaultObj() {}; 37 | 38 | public: 39 | void Poke(ULONG addr,UBYTE data) { } 40 | UBYTE Peek(ULONG addr) { return 0xEE; } 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lynx/errorinterface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 K. Wilkins 3 | // 4 | // This software is provided 'as-is', without any express or implied warranty. 5 | // In no event will the authors be held liable for any damages arising from 6 | // the use of this software. 7 | // 8 | // Permission is granted to anyone to use this software for any purpose, 9 | // including commercial applications, and to alter it and redistribute it 10 | // freely, subject to the following restrictions: 11 | // 12 | // 1. The origin of this software must not be misrepresented; you must not 13 | // claim that you wrote the original software. If you use this software 14 | // in a product, an acknowledgment in the product documentation would be 15 | // appreciated but is not required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not 18 | // be misrepresented as being the original software. 19 | // 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | // 22 | 23 | // ErrorInterface.h: interface for the ErrorInterface class. 24 | // 25 | ////////////////////////////////////////////////////////////////////// 26 | 27 | #if !defined(AFX_ERRORINTERFACE_H__A3B25DE2_6F78_11D2_8E90_444553540000__INCLUDED_) 28 | #define AFX_ERRORINTERFACE_H__A3B25DE2_6F78_11D2_8E90_444553540000__INCLUDED_ 29 | 30 | #if _MSC_VER > 1000 31 | #pragma once 32 | #endif // _MSC_VER > 1000 33 | 34 | class CErrorInterface 35 | { 36 | public: 37 | virtual ~CErrorInterface() {}; 38 | 39 | public: 40 | virtual int Warning(const char *message) { return 0; }; 41 | virtual int Fatal(const char *message) { return 0; }; 42 | }; 43 | 44 | #endif // !defined(AFX_ERRORINTERFACE_H__A3B25DE2_6F78_11D2_8E90_444553540000__INCLUDED_) 45 | -------------------------------------------------------------------------------- /Makefile.common: -------------------------------------------------------------------------------- 1 | LIBRETRO_COMM_DIR := $(CORE_DIR)/libretro-common 2 | 3 | INCFLAGS = -I$(CORE_DIR)/lynx \ 4 | -I$(CORE_DIR)/libretro \ 5 | -I$(CORE_DIR) \ 6 | -I$(LIBRETRO_COMM_DIR)/include \ 7 | 8 | ifneq (,$(findstring msvc2003,$(platform))) 9 | INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc 10 | endif 11 | 12 | ifeq ($(FRONTEND_SUPPORTS_RGB565), 1) 13 | FLAGS += -DFRONTEND_SUPPORTS_RGB565 14 | endif 15 | 16 | ifeq ($(FRONTEND_SUPPORTS_XRGB8888), 1) 17 | FLAGS += -DFRONTEND_SUPPORTS_XRGB8888 18 | endif 19 | 20 | SOURCES_CXX := \ 21 | $(CORE_DIR)/lynx/lynxdec.cpp \ 22 | $(CORE_DIR)/lynx/cart.cpp \ 23 | $(CORE_DIR)/lynx/memmap.cpp \ 24 | $(CORE_DIR)/lynx/mikie.cpp \ 25 | $(CORE_DIR)/lynx/ram.cpp \ 26 | $(CORE_DIR)/lynx/rom.cpp \ 27 | $(CORE_DIR)/lynx/susie.cpp \ 28 | $(CORE_DIR)/lynx/system.cpp \ 29 | $(CORE_DIR)/lynx/eeprom.cpp \ 30 | $(CORE_DIR)/libretro/libretro.cpp \ 31 | $(CORE_DIR)/blip/Blip_Buffer.cpp \ 32 | $(CORE_DIR)/blip/Stereo_Buffer.cpp 33 | 34 | ifneq ($(STATIC_LINKING), 1) 35 | SOURCES_C := \ 36 | $(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \ 37 | $(LIBRETRO_COMM_DIR)/compat/compat_snprintf.c \ 38 | $(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \ 39 | $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \ 40 | $(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \ 41 | $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \ 42 | $(LIBRETRO_COMM_DIR)/file/file_path.c \ 43 | $(LIBRETRO_COMM_DIR)/file/file_path_io.c \ 44 | $(LIBRETRO_COMM_DIR)/streams/file_stream.c \ 45 | $(LIBRETRO_COMM_DIR)/streams/file_stream_transforms.c \ 46 | $(LIBRETRO_COMM_DIR)/string/stdstring.c \ 47 | $(LIBRETRO_COMM_DIR)/time/rtime.c \ 48 | $(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c 49 | endif 50 | -------------------------------------------------------------------------------- /.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: '20 20 * * 5' # Fridays at 8:20 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@v1 16 | with: 17 | java-version: 1.8 18 | 19 | - name: Setup Python 20 | uses: actions/setup-python@v2 21 | 22 | - name: Checkout 23 | uses: actions/checkout@v2 24 | with: 25 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. 26 | fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. 27 | 28 | - name: Create intl file 29 | shell: bash 30 | env: 31 | CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} 32 | run: | 33 | python3 intl/download_workflow.py $CROWDIN_API_KEY "libretro-handy" "libretro/libretro_core_options_intl.h" 34 | 35 | - name: Commit files 36 | run: | 37 | git config --local user.email "github-actions@github.com" 38 | git config --local user.name "github-actions[bot]" 39 | git add intl/*_workflow.py "libretro/libretro_core_options_intl.h" 40 | git commit -m "Fetch translations & Recreate libretro_core_options_intl.h" 41 | 42 | - name: GitHub Push 43 | uses: ad-m/github-push-action@v0.6.0 44 | with: 45 | github_token: ${{ secrets.GITHUB_TOKEN }} 46 | branch: ${{ github.ref }} 47 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lynx/lynxbase.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 K. Wilkins 3 | // 4 | // This software is provided 'as-is', without any express or implied warranty. 5 | // In no event will the authors be held liable for any damages arising from 6 | // the use of this software. 7 | // 8 | // Permission is granted to anyone to use this software for any purpose, 9 | // including commercial applications, and to alter it and redistribute it 10 | // freely, subject to the following restrictions: 11 | // 12 | // 1. The origin of this software must not be misrepresented; you must not 13 | // claim that you wrote the original software. If you use this software 14 | // in a product, an acknowledgment in the product documentation would be 15 | // appreciated but is not required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not 18 | // be misrepresented as being the original software. 19 | // 20 | // 3. This notice may not be removed or altered from any source distribution. 21 | // 22 | 23 | // 24 | // Generic Lynx base class. 25 | // 26 | 27 | #ifndef LYNXBASE_H 28 | #define LYNXBASE_H 29 | 30 | // bank0 - Cartridge bank 0 31 | // bank1 - Cartridge bank 1 32 | // ram - all ram 33 | // cpu - system memory as viewed by the cpu 34 | 35 | enum EMMODE {bank0,bank1,ram,cpu}; 36 | 37 | class CLynxBase 38 | { 39 | // Function members 40 | 41 | public: 42 | virtual ~CLynxBase() {}; 43 | 44 | public: 45 | virtual void Reset(void) {}; 46 | virtual bool ContextLoad(LSS_FILE *fp) { return 0; }; 47 | virtual bool ContextSave(LSS_FILE *fp) { return 0; }; 48 | 49 | virtual void Poke(ULONG addr,UBYTE data)=0; 50 | virtual UBYTE Peek(ULONG addr)=0; 51 | virtual void PokeW(ULONG addr,UWORD data) {}; // ONLY mSystem overloads these, they are never use by the clients 52 | virtual UWORD PeekW(ULONG addr) {return 0;}; 53 | virtual void BankSelect(EMMODE newbank){}; 54 | virtual ULONG ObjectSize(void) {return 1;}; 55 | 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /blip/Stereo_Buffer.h: -------------------------------------------------------------------------------- 1 | 2 | // Simple stereo Blip_Buffer for sound emulators whose oscillators output 3 | // either on the left only, center, or right only. 4 | 5 | // Blip_Buffer 0.3.0. Copyright (C) 2003-2004 Shay Green. GNU GPL license. 6 | 7 | #ifndef STEREO_BUFFER_H 8 | #define STEREO_BUFFER_H 9 | 10 | #include "Blip_Buffer.h" 11 | 12 | class Stereo_Buffer { 13 | public: 14 | Stereo_Buffer(); 15 | ~Stereo_Buffer(); 16 | 17 | // Same as in Blip_Buffer (see Blip_Buffer.h) 18 | bool set_sample_rate( long, int msec = 0 ); 19 | void clock_rate( long ); 20 | void bass_freq( int ); 21 | void clear(); 22 | 23 | // Buffers to output synthesis to 24 | Blip_Buffer* left(); 25 | Blip_Buffer* center(); 26 | Blip_Buffer* right(); 27 | 28 | // Same as in Blip_Buffer. For more efficient operation, pass false 29 | // for was_stereo if the left and right buffers had nothing added 30 | // to them for this frame. 31 | void end_frame( blip_time_t, bool was_stereo = true ); 32 | 33 | // Output is stereo with channels interleved, left before right. Counts 34 | // are in samples, *not* pairs. 35 | long samples_avail() const; 36 | long read_samples( blip_sample_t*, long ); 37 | 38 | private: 39 | // noncopyable 40 | Stereo_Buffer( const Stereo_Buffer& ); 41 | Stereo_Buffer& operator = ( const Stereo_Buffer& ); 42 | 43 | enum { buf_count = 3 }; 44 | Blip_Buffer bufs [buf_count]; 45 | bool stereo_added; 46 | bool was_stereo; 47 | 48 | void mix_stereo( blip_sample_t*, long ); 49 | void mix_mono( blip_sample_t*, long ); 50 | void mix_stereo( float*, long ); 51 | void mix_mono( float*, long ); 52 | }; 53 | 54 | inline Blip_Buffer* Stereo_Buffer::left() { 55 | return &bufs [1]; 56 | } 57 | 58 | inline Blip_Buffer* Stereo_Buffer::center() { 59 | return &bufs [0]; 60 | } 61 | 62 | inline Blip_Buffer* Stereo_Buffer::right() { 63 | return &bufs [2]; 64 | } 65 | 66 | inline long Stereo_Buffer::samples_avail() const { 67 | return bufs [0].samples_avail(); 68 | } 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /libretro-common/include/time/rtime.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_RTIME_H__ 24 | #define __LIBRETRO_SDK_RTIME_H__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | /* TODO/FIXME: Move all generic time handling functions 35 | * to this file */ 36 | 37 | /* Must be called before using rtime_localtime() */ 38 | void rtime_init(void); 39 | 40 | /* Must be called upon program termination */ 41 | void rtime_deinit(void); 42 | 43 | /* Thread-safe wrapper for localtime() */ 44 | struct tm *rtime_localtime(const time_t *timep, struct tm *result); 45 | 46 | RETRO_END_DECLS 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libretro-common/include/compat/strcasestr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strcasestr.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRCASESTR_H 24 | #define __LIBRETRO_SDK_COMPAT_STRCASESTR_H 25 | 26 | #include 27 | 28 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 29 | #include "../../../config.h" 30 | #endif 31 | 32 | #ifndef HAVE_STRCASESTR 33 | 34 | #include 35 | 36 | RETRO_BEGIN_DECLS 37 | 38 | /* Avoid possible naming collisions during link 39 | * since we prefer to use the actual name. */ 40 | #define strcasestr(haystack, needle) strcasestr_retro__(haystack, needle) 41 | 42 | char *strcasestr(const char *haystack, const char *needle); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libretro-common/include/compat/strl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strl.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRL_H 24 | #define __LIBRETRO_SDK_COMPAT_STRL_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 30 | #include "../../../config.h" 31 | #endif 32 | 33 | #include 34 | 35 | RETRO_BEGIN_DECLS 36 | 37 | #ifdef __MACH__ 38 | #ifndef HAVE_STRL 39 | #define HAVE_STRL 40 | #endif 41 | #endif 42 | 43 | #ifndef HAVE_STRL 44 | /* Avoid possible naming collisions during link since 45 | * we prefer to use the actual name. */ 46 | #define strlcpy(dst, src, size) strlcpy_retro__(dst, src, size) 47 | 48 | #define strlcat(dst, src, size) strlcat_retro__(dst, src, size) 49 | 50 | size_t strlcpy(char *dest, const char *source, size_t size); 51 | size_t strlcat(char *dest, const char *source, size_t size); 52 | 53 | #endif 54 | 55 | char *strldup(const char *s, size_t n); 56 | 57 | RETRO_END_DECLS 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /libretro-common/compat/compat_strcasestr.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strcasestr.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | 27 | /* Pretty much strncasecmp. */ 28 | static int casencmp(const char *a, const char *b, size_t n) 29 | { 30 | size_t i; 31 | 32 | for (i = 0; i < n; i++) 33 | { 34 | int a_lower = tolower(a[i]); 35 | int b_lower = tolower(b[i]); 36 | if (a_lower != b_lower) 37 | return a_lower - b_lower; 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | char *strcasestr_retro__(const char *haystack, const char *needle) 44 | { 45 | size_t i, search_off; 46 | size_t hay_len = strlen(haystack); 47 | size_t needle_len = strlen(needle); 48 | 49 | if (needle_len > hay_len) 50 | return NULL; 51 | 52 | search_off = hay_len - needle_len; 53 | for (i = 0; i <= search_off; i++) 54 | if (!casencmp(haystack + i, needle, needle_len)) 55 | return (char*)haystack + i; 56 | 57 | return NULL; 58 | } 59 | -------------------------------------------------------------------------------- /libretro-common/include/compat/posix_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (posix_string.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 24 | #define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 25 | 26 | #include 27 | 28 | #ifdef _MSC_VER 29 | #include 30 | #endif 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | #ifdef _WIN32 35 | #undef strtok_r 36 | #define strtok_r(str, delim, saveptr) retro_strtok_r__(str, delim, saveptr) 37 | 38 | char *strtok_r(char *str, const char *delim, char **saveptr); 39 | #endif 40 | 41 | #ifdef _MSC_VER 42 | #undef strcasecmp 43 | #undef strdup 44 | #define strcasecmp(a, b) retro_strcasecmp__(a, b) 45 | #define strdup(orig) retro_strdup__(orig) 46 | int strcasecmp(const char *a, const char *b); 47 | char *strdup(const char *orig); 48 | 49 | /* isblank is available since MSVC 2013 */ 50 | #if _MSC_VER < 1800 51 | #undef isblank 52 | #define isblank(c) retro_isblank__(c) 53 | int isblank(int c); 54 | #endif 55 | 56 | #endif 57 | 58 | RETRO_END_DECLS 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libretro-common/compat/compat_strl.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strl.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | /* Implementation of strlcpy()/strlcat() based on OpenBSD. */ 29 | 30 | #ifndef __MACH__ 31 | 32 | size_t strlcpy(char *dest, const char *source, size_t size) 33 | { 34 | size_t src_size = 0; 35 | size_t n = size; 36 | 37 | if (n) 38 | while (--n && (*dest++ = *source++)) src_size++; 39 | 40 | if (!n) 41 | { 42 | if (size) *dest = '\0'; 43 | while (*source++) src_size++; 44 | } 45 | 46 | return src_size; 47 | } 48 | 49 | size_t strlcat(char *dest, const char *source, size_t size) 50 | { 51 | size_t len = strlen(dest); 52 | 53 | dest += len; 54 | 55 | if (len > size) 56 | size = 0; 57 | else 58 | size -= len; 59 | 60 | return len + strlcpy(dest, source, size); 61 | } 62 | #endif 63 | 64 | char *strldup(const char *s, size_t n) 65 | { 66 | char *dst = (char*)malloc(sizeof(char) * (n + 1)); 67 | strlcpy(dst, s, n); 68 | return dst; 69 | } 70 | -------------------------------------------------------------------------------- /libretro-common/compat/fopen_utf8.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) 29 | #ifndef LEGACY_WIN32 30 | #define LEGACY_WIN32 31 | #endif 32 | #endif 33 | 34 | #ifdef _WIN32 35 | #undef fopen 36 | 37 | void *fopen_utf8(const char * filename, const char * mode) 38 | { 39 | #if defined(LEGACY_WIN32) 40 | FILE *ret = NULL; 41 | char * filename_local = utf8_to_local_string_alloc(filename); 42 | 43 | if (!filename_local) 44 | return NULL; 45 | ret = fopen(filename_local, mode); 46 | if (filename_local) 47 | free(filename_local); 48 | return ret; 49 | #else 50 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 51 | wchar_t * mode_w = utf8_to_utf16_string_alloc(mode); 52 | FILE* ret = NULL; 53 | 54 | if (filename_w && mode_w) 55 | ret = _wfopen(filename_w, mode_w); 56 | if (filename_w) 57 | free(filename_w); 58 | if (mode_w) 59 | free(mode_w); 60 | return ret; 61 | #endif 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /libretro-common/include/encodings/utf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (utf.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_ENCODINGS_UTF_H 24 | #define _LIBRETRO_ENCODINGS_UTF_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | enum CodePage 36 | { 37 | CODEPAGE_LOCAL = 0, /* CP_ACP */ 38 | CODEPAGE_UTF8 = 65001 /* CP_UTF8 */ 39 | }; 40 | 41 | size_t utf8_conv_utf32(uint32_t *out, size_t out_chars, 42 | const char *in, size_t in_size); 43 | 44 | bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, 45 | const uint16_t *in, size_t in_size); 46 | 47 | size_t utf8len(const char *string); 48 | 49 | size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars); 50 | 51 | const char *utf8skip(const char *str, size_t chars); 52 | 53 | uint32_t utf8_walk(const char **string); 54 | 55 | bool utf16_to_char_string(const uint16_t *in, char *s, size_t len); 56 | 57 | char* utf8_to_local_string_alloc(const char *str); 58 | 59 | char* local_to_utf8_string_alloc(const char *str); 60 | 61 | wchar_t* utf8_to_utf16_string_alloc(const char *str); 62 | 63 | char* utf16_to_utf8_string_alloc(const wchar_t *str); 64 | 65 | RETRO_END_DECLS 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /lynx/cart_db.h: -------------------------------------------------------------------------------- 1 | /* 2 | CRC32 hash 3 | 4 | Software title 5 | File size 6 | 7 | Bank0 size: 8 | C64K = 0x100 9 | C128K = 0x200 10 | C256K = 0x400 11 | C512K = 0x800 12 | C1024K = 0x1000 13 | 14 | Bank1 size 15 | 16 | Rotation 17 | Audin 18 | Eeprom 19 | */ 20 | 21 | 22 | static LYNX_DB lynxDB[] = { 23 | 24 | { 0x9d09bc4c, "8-Bit Slicks (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 25 | { 0x95a1ea09, "Alpine Games (World) (Aftermarket) (Unl)", 524288, C256K, 0, 0, CART_AUDIN, CART_EEPROM_93C46 }, 26 | { 0x427d0e97, "A Bug's Trip Redux (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 27 | { 0x97501709, "Centipede (USA) (Proto)", 131072, C128K, 0, CART_ROTATE_RIGHT, 0, 0 }, 28 | { 0x6bceaa9c, "Eye of the Beholder (USA) (Proto)", 131072, C128K, 0, 0, 0, 0 }, //16K NVRAM 29 | { 0xae8c70f0, "Eye of the Beholder (USA) (Proto)", 524288, C512K, 0, 0, 0, 0 }, //16K NVRAM 30 | { 0xf1b307cb, "Eye of the Beholder (USA)", 524352, C512K, 0, 0, 0, 0 }, //16K NVRAM 31 | { 0xdcd723e3, "Gauntlet - The Third Encounter (USA, Europe) (Beta) (1990-06-04)", 131072, C128K, 0, CART_ROTATE_LEFT, 0, 0 }, 32 | { 0x7f0ec7ad, "Gauntlet - The Third Encounter (USA, Europe)", 131072, C128K, 0, CART_ROTATE_LEFT, 0, 0 }, 33 | { 0x4d5d94f4, "Klax (USA, Europe) (Beta)", 262144, C256K, 0, CART_ROTATE_LEFT, 0, 0 }, 34 | { 0xa53649f1, "Klax (USA, Europe)", 262144, C256K, 0, CART_ROTATE_LEFT, 0, 0 }, 35 | { 0x0271b6e9, "Lexis (USA)", 262144, C256K, 0, CART_ROTATE_RIGHT, 0, 0 }, 36 | { 0xca7cf30b, "MegaPak 1 (World) (Aftermarket) (Unl)", 262144, C256K, 0, 0, 0, CART_EEPROM_93C46 }, 37 | { 0x006fd398, "NFL Football (USA, Europe)", 262144, C256K, 0, CART_ROTATE_RIGHT, 0, 0 }, 38 | { 0xbb27e6f0, "Ponx (World) (Aftermarket) (Unl)", 131072, C256K, 0, 0, 0, 0 }, 39 | { 0xbcd10c3a, "Raiden (USA) (Proto)", 262144, C256K, 0, CART_ROTATE_RIGHT, 0, 0 }, 40 | { 0x689f31a4, "Raiden (World) (Aftermarket) (Unl)", 524288, C512K, 0, CART_ROTATE_RIGHT, 0, 0 }, 41 | { 0xb8879506, "Sky Raider Redux (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 42 | { 0xb2fa93d3, "Unnamed (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 43 | { 0x50b0575a, "Vikings Saga - Protect The Love (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 44 | { 0x18b006a9, "Vikings Saga - Save The Love (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 45 | { 0x7f8b5efa, "Wyvern Tales (World) (Aftermarket) (Unl)", 524288, C512K, 0, 0, 0, CART_EEPROM_93C46 }, 46 | 47 | // auto-detect 48 | { 0, NULL, 0, 0, 0, 0, 0, 0 }, 49 | }; 50 | -------------------------------------------------------------------------------- /lynx/eeprom.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // Lynx 3wire EEPROM class header file // 3 | ////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EEPROM_H 7 | #define EEPROM_H 8 | 9 | #include 10 | #include 11 | 12 | #ifndef PATH_MAX_LENGTH 13 | #if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__) 14 | #define PATH_MAX_LENGTH 512 15 | #else 16 | #define PATH_MAX_LENGTH 4096 17 | #endif 18 | #endif 19 | 20 | #ifndef __min 21 | #define __min(a,b) \ 22 | ({ __typeof__ (a) _a = (a); \ 23 | __typeof__ (b) _b = (b); \ 24 | _a > _b ? _b : _a; }) 25 | #endif 26 | 27 | enum {EE_NONE=0, EE_START, EE_DATA, EE_BUSY, EE_WAIT}; 28 | 29 | class CEEPROM : public CLynxBase 30 | { 31 | // Function members 32 | 33 | public: 34 | CEEPROM(); 35 | ~CEEPROM(); 36 | 37 | bool ContextSave(LSS_FILE *fp); 38 | bool ContextLoad(LSS_FILE *fp); 39 | void Reset(void); 40 | 41 | bool Available(void){ return ((type != 0) && !string_is_empty(filename)); }; 42 | void ProcessEepromIO(UBYTE iodir,UBYTE iodat); 43 | void ProcessEepromCounter(UWORD cnt); 44 | void ProcessEepromBusy(void); 45 | bool OutputBit(void) 46 | { 47 | return mAUDIN_ext; 48 | }; 49 | void SetEEPROMType(UBYTE b); 50 | int Size(void); 51 | void InitFrom(char *data,int count){ memcpy(romdata,data,__min(count,Size()));}; 52 | 53 | void Poke(ULONG addr,UBYTE data) { }; 54 | UBYTE Peek(ULONG addr) 55 | { 56 | return(0); 57 | }; 58 | 59 | void SetFilename(const char *f) 60 | { 61 | if (!string_is_empty(f)) 62 | strlcpy(filename, f, PATH_MAX_LENGTH); 63 | else 64 | *filename='\0'; 65 | }; 66 | char* GetFilename(void){ return filename;}; 67 | 68 | void Load(void); 69 | void Save(void); 70 | 71 | private: 72 | char filename[PATH_MAX_LENGTH]; 73 | 74 | void UpdateEeprom(UWORD cnt); 75 | UBYTE type; // 0 ... no eeprom 76 | 77 | UWORD ADDR_MASK; 78 | UBYTE CMD_BITS; 79 | UBYTE ADDR_BITS; 80 | ULONG DONE_MASK; 81 | 82 | UBYTE iodir, iodat; 83 | UWORD counter; 84 | int busy_count; 85 | int state; 86 | UWORD readdata; 87 | 88 | ULONG data; 89 | UWORD romdata[1024];// 128, 256, 512, 1024 WORDS bzw 128 bytes fuer byte zugriff 90 | UWORD addr; 91 | int sendbits; 92 | bool readonly; 93 | 94 | bool mAUDIN_ext;// OUTPUT 95 | 96 | public: 97 | }; 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /libretro-common/time/rtime.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifdef HAVE_THREADS 24 | #include 25 | #include 26 | #include 27 | #endif 28 | 29 | #include 30 | #include