├── .DS_Store
├── .github
└── workflows
│ └── compilation.yml
├── .gitignore
├── .gitlab-ci.yml
├── ISSUE_TEMPLATE.md
├── LICENSE
├── Makefile
├── Makefile.common
├── README.md
├── jni
├── Android.mk
└── Application.mk
├── link.T
├── metadata
├── Mattel Intellivision - Firmware (TOSEC-v2014-01-18_CM).dat
└── Mattel Intellivision - Games (TOSEC-v2014-01-18_CM).dat
├── open-content
└── 4-Tris
│ ├── 4-tris.bin
│ ├── 4-tris.cfg
│ ├── 4-tris.rom
│ ├── COPYING.txt
│ ├── README.txt
│ ├── SOURCE.txt
│ ├── images
│ ├── 4_tris_easter_egg.png
│ ├── 4_tris_game_over.png
│ ├── 4_tris_in_game.png
│ ├── 4_tris_sound_test.png
│ ├── 4_tris_title_screen.png
│ └── boxart_front.png
│ └── src
│ ├── 4-tris.asm
│ ├── 4-tris.lst
│ ├── _
│ ├── behappy.asm
│ ├── behappy3.txt
│ ├── chindnce.asm
│ ├── chindnce.txt
│ ├── digits
│ ├── facefont
│ ├── font.asm
│ ├── miscfont
│ ├── mkfont16.c
│ ├── nut1mrch.asm
│ ├── nut1mrch.txt
│ ├── pm16.c
│ └── trisfont
├── retropie
├── emulators.cfg
├── retroarch.cfg
└── retropie.txt
└── src
├── .DS_Store
├── cart.c
├── cart.h
├── controller.c
├── controller.h
├── cp1610.c
├── cp1610.h
├── deps
└── libretro-common
│ ├── compat
│ ├── compat_fnmatch.c
│ ├── compat_getopt.c
│ ├── compat_ifaddrs.c
│ ├── compat_posix_string.c
│ ├── compat_snprintf.c
│ ├── compat_strcasestr.c
│ ├── compat_strl.c
│ └── fopen_utf8.c
│ ├── encodings
│ └── encoding_utf.c
│ ├── file
│ └── file_path.c
│ ├── include
│ ├── boolean.h
│ ├── compat
│ │ ├── apple_compat.h
│ │ ├── fnmatch.h
│ │ ├── fopen_utf8.h
│ │ ├── getopt.h
│ │ ├── ifaddrs.h
│ │ ├── intrinsics.h
│ │ ├── msvc.h
│ │ ├── msvc
│ │ │ └── stdint.h
│ │ ├── posix_string.h
│ │ ├── strcasestr.h
│ │ ├── strl.h
│ │ ├── zconf.h
│ │ ├── zconf.h.in
│ │ ├── zlib.h
│ │ └── zutil.h
│ ├── encodings
│ │ └── utf.h
│ ├── file
│ │ └── file_path.h
│ ├── libretro.h
│ ├── memmap.h
│ ├── retro_assert.h
│ ├── retro_common.h
│ ├── retro_common_api.h
│ ├── retro_environment.h
│ ├── retro_inline.h
│ ├── retro_miscellaneous.h
│ ├── string
│ │ └── stdstring.h
│ ├── time
│ │ └── rtime.h
│ └── vfs
│ │ ├── vfs.h
│ │ ├── vfs_implementation.h
│ │ └── vfs_implementation_cdrom.h
│ ├── string
│ └── stdstring.c
│ └── time
│ └── rtime.c
├── intv.c
├── intv.h
├── ivoice.c
├── ivoice.h
├── libretro.c
├── libretro_core_options.h
├── libretro_core_options_intl.h
├── memory.c
├── memory.h
├── osd.c
├── osd.h
├── psg.c
├── psg.h
├── stic.c
└── stic.h
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/.DS_Store
--------------------------------------------------------------------------------
/.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 | - name: Install dependencies
15 | run: |
16 | apk add build-base git zip
17 |
18 | - uses: actions/checkout@v2
19 | - run: |
20 | git fetch --prune --unshallow
21 |
22 | - name: Compile project
23 | run: |
24 | make platform=ps2 clean all
25 |
26 | - name: Get short SHA
27 | id: slug
28 | run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
29 |
30 | - name: Upload artifacts
31 | if: ${{ success() }}
32 | uses: actions/upload-artifact@v2
33 | with:
34 | name: freeintv_libretro_ps2-${{ steps.slug.outputs.sha8 }}
35 | path: freeintv_libretro_ps2.a
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *.dylib
3 |
4 |
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | # DESCRIPTION: GitLab CI/CD for libRetro (NOT FOR GitLab-proper)
2 |
3 | ##############################################################################
4 | ################################# BOILERPLATE ################################
5 | ##############################################################################
6 |
7 | # Core definitions
8 | .core-defs:
9 | variables:
10 | JNI_PATH: .
11 | CORENAME: freeintv
12 |
13 | include:
14 | ################################## DESKTOPS ################################
15 | # Windows 64-bit
16 | - project: 'libretro-infrastructure/ci-templates'
17 | file: '/windows-x64-mingw.yml'
18 |
19 | # Windows 32-bit
20 | - project: 'libretro-infrastructure/ci-templates'
21 | file: '/windows-i686-mingw.yml'
22 |
23 | # Windows msvc10 64-bit
24 | - project: 'libretro-infrastructure/ci-templates'
25 | file: '/windows-x64-msvc10-msys2.yml'
26 |
27 | # Windows msvc10 32-bit
28 | - project: 'libretro-infrastructure/ci-templates'
29 | file: '/windows-i686-msvc10-msys2.yml'
30 |
31 | # Windows msvc05 32-bit
32 | - project: 'libretro-infrastructure/ci-templates'
33 | file: '/windows-i686-msvc05-msys2.yml'
34 |
35 | # Linux 64-bit
36 | - project: 'libretro-infrastructure/ci-templates'
37 | file: '/linux-x64.yml'
38 |
39 | # Linux 32-bit
40 | - project: 'libretro-infrastructure/ci-templates'
41 | file: '/linux-i686.yml'
42 |
43 | # MacOS 64-bit
44 | - project: 'libretro-infrastructure/ci-templates'
45 | file: '/osx-x64.yml'
46 |
47 | # MacOS ARM 64-bit
48 | - project: 'libretro-infrastructure/ci-templates'
49 | file: '/osx-arm64.yml'
50 |
51 | ################################## CELLULAR ################################
52 | # Android
53 | - project: 'libretro-infrastructure/ci-templates'
54 | file: '/android-jni.yml'
55 |
56 | # iOS
57 | - project: 'libretro-infrastructure/ci-templates'
58 | file: '/ios-arm64.yml'
59 |
60 | # iOS (armv7)
61 | - project: 'libretro-infrastructure/ci-templates'
62 | file: '/ios9.yml'
63 |
64 | ################################## CONSOLES ################################
65 | # Nintendo 3DS
66 | - project: 'libretro-infrastructure/ci-templates'
67 | file: '/ctr-static.yml'
68 |
69 | # Nintendo GameCube
70 | - project: 'libretro-infrastructure/ci-templates'
71 | file: '/ngc-static.yml'
72 |
73 | # Nintendo Wii
74 | - project: 'libretro-infrastructure/ci-templates'
75 | file: '/wii-static.yml'
76 |
77 | # Nintendo WiiU
78 | - project: 'libretro-infrastructure/ci-templates'
79 | file: '/wiiu-static.yml'
80 |
81 | # Nintendo Switch
82 | - project: 'libretro-infrastructure/ci-templates'
83 | file: '/libnx-static.yml'
84 |
85 | # PlayStation Portable
86 | - project: 'libretro-infrastructure/ci-templates'
87 | file: '/psp-static.yml'
88 |
89 | # PlayStation Vita
90 | - project: 'libretro-infrastructure/ci-templates'
91 | file: '/vita-static.yml'
92 |
93 | # PlayStation2
94 | - project: 'libretro-infrastructure/ci-templates'
95 | file: '/ps2-static.yml'
96 |
97 | # OpenDingux
98 | - project: 'libretro-infrastructure/ci-templates'
99 | file: '/dingux-mips32.yml'
100 |
101 | # OpenDingux (ARM)
102 | - project: 'libretro-infrastructure/ci-templates'
103 | file: '/dingux-arm32.yml'
104 |
105 | # tvOS (AppleTV)
106 | - project: 'libretro-infrastructure/ci-templates'
107 | file: '/tvos-arm64.yml'
108 |
109 | #################################### MISC ##################################
110 |
111 | # Stages for building
112 | stages:
113 | - build-prepare
114 | - build-shared
115 | - build-static
116 |
117 | ##############################################################################
118 | #################################### STAGES ##################################
119 | ##############################################################################
120 | #
121 | ################################### DESKTOPS #################################
122 | # Windows 64-bit
123 | libretro-build-windows-x64:
124 | extends:
125 | - .libretro-windows-x64-mingw-make-default
126 | - .core-defs
127 |
128 | # Windows 32-bit
129 | libretro-build-windows-i686:
130 | extends:
131 | - .libretro-windows-i686-mingw-make-default
132 | - .core-defs
133 |
134 | # Windows msvc10 64-bit
135 | libretro-build-windows-msvc10-x64:
136 | extends:
137 | - .libretro-windows-x64-msvc10-msys2-make-default
138 | - .core-defs
139 |
140 | # Windows msvc10 32-bit
141 | libretro-build-windows-msvc10-i686:
142 | extends:
143 | - .libretro-windows-i686-msvc10-msys2-make-default
144 | - .core-defs
145 |
146 | # Windows msvc05 32-bit
147 | libretro-build-windows-msvc05-i686:
148 | extends:
149 | - .libretro-windows-i686-msvc05-msys2-make-default
150 | - .core-defs
151 |
152 | # Linux 64-bit
153 | libretro-build-linux-x64:
154 | extends:
155 | - .libretro-linux-x64-make-default
156 | - .core-defs
157 |
158 | # Linux 32-bit
159 | libretro-build-linux-i686:
160 | extends:
161 | - .libretro-linux-i686-make-default
162 | - .core-defs
163 |
164 | # MacOS 64-bit
165 | libretro-build-osx-x64:
166 | extends:
167 | - .libretro-osx-x64-make-10-7
168 | - .core-defs
169 |
170 | # MacOS ARM 64-bit
171 | libretro-build-osx-arm64:
172 | extends:
173 | - .libretro-osx-arm64-make-default
174 | - .core-defs
175 |
176 | ################################### CELLULAR #################################
177 | # Android ARMv7a
178 | android-armeabi-v7a:
179 | extends:
180 | - .libretro-android-jni-armeabi-v7a
181 | - .core-defs
182 |
183 | # Android ARMv8a
184 | android-arm64-v8a:
185 | extends:
186 | - .libretro-android-jni-arm64-v8a
187 | - .core-defs
188 |
189 | # Android 64-bit x86
190 | android-x86_64:
191 | extends:
192 | - .libretro-android-jni-x86_64
193 | - .core-defs
194 |
195 | # Android 32-bit x86
196 | android-x86:
197 | extends:
198 | - .libretro-android-jni-x86
199 | - .core-defs
200 |
201 | # iOS
202 | libretro-build-ios-arm64:
203 | extends:
204 | - .libretro-ios-arm64-make-default
205 | - .core-defs
206 |
207 | # iOS (armv7) [iOS 9 and up]
208 | libretro-build-ios9:
209 | extends:
210 | - .libretro-ios9-make-default
211 | - .core-defs
212 |
213 | # tvOS
214 | libretro-build-tvos-arm64:
215 | extends:
216 | - .libretro-tvos-arm64-make-default
217 | - .core-defs
218 |
219 | ################################### CONSOLES #################################
220 | # PlayStation Portable
221 | libretro-build-psp:
222 | extends:
223 | - .libretro-psp-static-retroarch-master
224 | - .core-defs
225 |
226 | # PlayStation Vita
227 | libretro-build-vita:
228 | extends:
229 | - .libretro-vita-static-retroarch-master
230 | - .core-defs
231 |
232 | # PlayStation2
233 | libretro-build-ps2:
234 | extends:
235 | - .libretro-ps2-static-retroarch-master
236 | - .core-defs
237 |
238 | # Nintendo 3DS
239 | libretro-build-ctr:
240 | extends:
241 | - .libretro-ctr-static-retroarch-master
242 | - .core-defs
243 |
244 | # Nintendo GameCube
245 | libretro-build-ngc:
246 | extends:
247 | - .libretro-ngc-static-retroarch-master
248 | - .core-defs
249 |
250 | # Nintendo Wii
251 | libretro-build-wii:
252 | extends:
253 | - .libretro-wii-static-retroarch-master
254 | - .core-defs
255 |
256 | # Nintendo WiiU
257 | libretro-build-wiiu:
258 | extends:
259 | - .libretro-wiiu-static-retroarch-master
260 | - .core-defs
261 |
262 | # Nintendo Switch
263 | libretro-build-libnx-aarch64:
264 | extends:
265 | - .libretro-libnx-static-retroarch-master
266 | - .core-defs
267 |
268 | # RetroFW
269 | libretro-build-retrofw-mips32:
270 | extends:
271 | - .libretro-retrofw-mips32-make-default
272 | - .core-defs
273 |
274 | # Miyoo
275 | libretro-build-miyoo-arm32:
276 | extends:
277 | - .libretro-miyoo-arm32-make-default
278 | - .core-defs
279 |
--------------------------------------------------------------------------------
/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | This issue tracker is NOT for help or support. Please use the libretro forums (https://forums.libretro.com/) for those kinds of posts.
2 |
3 | BEFORE you report a bug make sure you have tried the latest buildbot version of FreeIntv or compiled it from source. Your bug might be already fixed.
4 |
5 | If you are sure that it's a bug, please answer the following questions:
6 | - Which version of RetroArch are you using?
7 | - What system hardware are you using?
8 | - What did you do?
9 | - What did you expect to happen?
10 | - What happened instead?
11 |
12 | It is important to provide logs for debugging as part of your report. Instructions for generating logs vary depending on the libretro frontend being used. Instructions for generating logs in RetroArch can be found here: https://buildbot.libretro.com/.docs/guides/troubleshooting-retroarch/#creating-log-files-in-linux
13 |
14 | Please delete this text before posting.
15 |
--------------------------------------------------------------------------------
/Makefile.common:
--------------------------------------------------------------------------------
1 | LIBRETRO_COMM_DIR = $(SOURCE_DIR)/deps/libretro-common
2 |
3 | INCFLAGS := -I$(SOURCE_DIR) \
4 | -I$(LIBRETRO_COMM_DIR)/include
5 |
6 | SOURCES_CXX :=
7 | SOURCES_C := \
8 | $(SOURCE_DIR)/libretro.c \
9 | $(SOURCE_DIR)/intv.c \
10 | $(SOURCE_DIR)/memory.c \
11 | $(SOURCE_DIR)/cp1610.c \
12 | $(SOURCE_DIR)/cart.c \
13 | $(SOURCE_DIR)/controller.c \
14 | $(SOURCE_DIR)/osd.c \
15 | $(SOURCE_DIR)/ivoice.c \
16 | $(SOURCE_DIR)/psg.c \
17 | $(SOURCE_DIR)/stic.c
18 |
19 | ifeq ($(STATIC_LINKING),1)
20 | else
21 | SOURCES_C += $(LIBRETRO_COMM_DIR)/file/file_path.c \
22 | $(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
23 | $(LIBRETRO_COMM_DIR)/compat/compat_snprintf.c \
24 | $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
25 | $(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \
26 | $(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
27 | $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
28 | $(LIBRETRO_COMM_DIR)/string/stdstring.c \
29 | $(LIBRETRO_COMM_DIR)/time/rtime.c
30 |
31 | endif
32 |
33 | SOURCES_CXX :=
34 |
35 | INCLUDES := -I$(LIBRETRO_COMM_DIR)/include
36 |
37 | ifneq (,$(findstring msvc200,$(platform)))
38 | INCLUDES += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
39 | endif
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FreeIntv
2 | FreeIntv is a libretro emulation core for the Mattel Intellivision designed to be compatible with joypads from the SNES era forward even if they originally required a number pad.
3 |
4 | ## Authors
5 |
6 | FreeIntv was created by David Richardson.
7 | The PSG and STIC emulation was made closer to hardware and optimized by Oscar Toledo G. (nanochess), who also added save states.
8 |
9 | The Intellivoice code has been contributed by Joe Zbiciak (author of jzintv), and adapted by Oscar Toledo G. (nanochess)
10 |
11 | ## License
12 | The FreeIntv core is licensed under GPLv2+. More information at https://github.com/libretro/FreeIntv/blob/master/LICENSE
13 |
14 | ## BIOS
15 | FreeIntv requires two Intellivision BIOS files to be placed in the libretro 'system' folder:
16 |
17 | | Function | Filename* | MD5 Hash |
18 | | --- | --- | --- |
19 | | Executive ROM | `exec.bin` | `62e761035cb657903761800f4437b8af` |
20 | | Graphics ROM | `grom.bin` | `0cd5946c6473e42e8e4c2137785e427f` |
21 |
22 | * BIOS filenames are case-sensitive
23 |
24 | ## Entertainment Computer System
25 | FreeIntv does not currently support Entertainment Computer System (ECS) functionality. Contributions to the code are welcome!
26 |
27 | ## Controller overlays
28 | Mattel Intellivision games were often meant to be played with game-specific cards overlaid on the numeric keypad. These overlays convey information which can be very useful in gameplay. Images of a limited selection of Intellivision titles are available at: http://www.intellivisionlives.com/bluesky/games/instructions.shtml
29 |
30 | ## Controls
31 |
32 | * **Mini-Keypad** - allows the user to view and select keys from a small Intellivision pad in the lower corner of the display.
33 | * **Controller Swap** - Some Intellivision games expect the left controller to be player one, others expect the right controller. This isn't a problem if you have two controllers (and don't mind juggling them) but users with only one controller or using a portable setup would be effectively locked out of some games. Controller Swap swaps the two controller interfaces so that the player does not have to physically swap controllers.
34 |
35 | | RetroPad | FreeIntv Function |
36 | | --- | --- |
37 | | D-Pad| 8-way movement |
38 | | Left Analog Stick | 16-way disc |
39 | | Right Analog Stick | 8-way keypad |
40 | | L3 | Keypad 0 |
41 | | R3 | Keypad 5 |
42 | | L2 | Keypad Clear |
43 | | R2 | Keypad Enter |
44 | | A | Left Action Button |
45 | | B | Right Action Button |
46 | | Y | Top Action Button |
47 | | X | Use the Last Selected Intellivision Keypad Button. In Astrosmash, for example, you can leave "3" selected to enable instant access to hyperspace. |
48 | | L/R | Activate the Mini-Keypad |
49 | | Start | Pause Game |
50 | | Select | Controller Swap |
51 |
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | CORE_DIR := $(LOCAL_PATH)/..
4 | SOURCE_DIR := $(CORE_DIR)/src
5 | INCLUDES :=
6 | SOURCES_C :=
7 | SOURCES_CXX :=
8 |
9 | include $(CORE_DIR)/Makefile.common
10 |
11 | COREFLAGS := -DANDROID -D__LIBRETRO__ -DHAVE_STRINGS_H -DRIGHTSHIFT_IS_SAR $(INCFLAGS)
12 |
13 | include $(CLEAR_VARS)
14 | LOCAL_MODULE := retro
15 | LOCAL_SRC_FILES := $(SOURCES_C)
16 | LOCAL_CFLAGS := $(COREFLAGS)
17 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T
18 | include $(BUILD_SHARED_LIBRARY)
19 |
--------------------------------------------------------------------------------
/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := c++_static
2 | APP_ABI := all
3 |
--------------------------------------------------------------------------------
/link.T:
--------------------------------------------------------------------------------
1 | {
2 | global: retro_*;
3 | local: *;
4 | };
5 |
6 |
--------------------------------------------------------------------------------
/metadata/Mattel Intellivision - Firmware (TOSEC-v2014-01-18_CM).dat:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Mattel Intellivision - Firmware
7 | Mattel Intellivision - Firmware (TOSEC-v2014-01-18)
8 | TOSEC
9 | 2014-01-18
10 | Grendel - Sea7 - Cassiel - mictlantecuhtle
11 | contact@tosecdev.org
12 | TOSEC
13 | http://www.tosecdev.org/
14 |
15 |
16 | Entertainment Computer System's EXEC-BASIC ROM, The (1978)(Mattel)
17 |
18 |
19 |
20 | Executive ROM, The (1978)(Mattel)
21 |
22 |
23 |
24 | GROM, The (1978)(General Instruments)
25 |
26 |
27 |
28 | IntelliVoice BIOS (1981)(Mattel)
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/open-content/4-Tris/4-tris.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/4-tris.bin
--------------------------------------------------------------------------------
/open-content/4-Tris/4-tris.cfg:
--------------------------------------------------------------------------------
1 | ;;==========================================================================;;
2 | ;; Joe Zbiciak's 4-TRIS, A "Falling Tetrominoes" Game for Intellivision. ;;
3 | ;; Copyright 2000, Joe Zbiciak, im14u2c@primenet.com. ;;
4 | ;; http://www.primenet.com/~im14u2c/intv/ ;;
5 | ;;==========================================================================;;
6 | [mapping]
7 | $0000-$1FFF = $5000 ; $5000-$6FFF
8 |
9 | ;;===========================================================================;;
10 | ;; Some interesting 4-TRIS internal variables. ;;
11 | ;;===========================================================================;;
12 | [macro]
13 | @w TASKQ $320-$32F ; 16-entry task queue
14 | @w TASKQPTRS $1EE,$1EF ; Head/Tail pointers in task queue
15 | @w TASKQOVER $1A0 ; # of task-queue overflows (should always be 0.)
16 | @w TASKS $330-$33F ; Task state
17 | @w MUSIC $340-$343 ; Music state
18 | @w SNDFX $344-$347 ; Sound effect state
19 | @w SCORE $352-$355 ; Score
20 | @w LINES $356 ; # of lines cleared
21 | @w PIECE $13B-$13E ; Current piece data
22 | @w HEIGHT $1EC ; 21 - height of pieces in well
23 |
--------------------------------------------------------------------------------
/open-content/4-Tris/4-tris.rom:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/4-tris.rom
--------------------------------------------------------------------------------
/open-content/4-Tris/README.txt:
--------------------------------------------------------------------------------
1 | ;;===========================================================================;;
2 | ;; Joe Zbiciak's 4-Tris -- A "Falling Tetrominoes" Game for Intellivision ;;
3 | ;; Copyright 2000, Joe Zbiciak, im14u2c@primenet.com ;;
4 | ;; http://www.primenet.com/~im14u2c/intv/ ;;
5 | ;;===========================================================================;;
6 |
7 | ----------------
8 | Emulator Notes
9 | ----------------
10 |
11 | -- The Numeric Keypad is reversed. Intellivision keypads put [1], [2],
12 | and [3] in the top row of the keypad, much like a telephone. The
13 | emulator retains this spatial relationship, despite the fact that
14 | PC's put [7], [8] and [9] in the top row. So, you will need to
15 | remember this little tidbit when starting the game or using the
16 | sound-test screen.
17 |
18 | -- On INTVPC, the [0] key on the keypad is mapped to the Intellivision's
19 | [0] and the [.] key is mapped to the Intellivision's [C]. On jzIntv,
20 | it's the other way around.
21 |
22 | -- The "Action Buttons" are mapped to Ctrl, Shift, and Alt.
23 |
24 | -- The "Disc" is mapped to the arrow keys (the Inverted-T, NOT the ones
25 | on the number-pad)!
26 |
27 | -------------------
28 | Game Instructions
29 | -------------------
30 |
31 | At the title screen, press a number from [1]-[9] or [C] on the keypad
32 | to select a starting level. (Buttons [1] through [9] start you at
33 | levels 1 through 9, and [C] starts you at Level 10.) If you press
34 | [0] at the title screen, you will be taken to a "Sound Test" screen.
35 | (See "Sound Test" below for more details.) Any other input on the
36 | controller starts you at Level 4. (Level 4 seemed like a good mid-way
37 | default level.)
38 |
39 | In the game, the controllers are set up like so:
40 |
41 | DISC: Moves piece left, right or down
42 | Action Buttons: Rotates piece. Top button rotates counter-clockwise,
43 | bottom buttons rotate clockwise.
44 | [4], [6], or [C] Toggles "Next Piece" display
45 | [7] or [9] Mutes/un-mutes background music.
46 |
47 | Pieces fall until they hit an obstruction which keeps them from falling.
48 | When a piece can't fall any further, it is "placed", and a score is
49 | assessed for that piece's placement.
50 |
51 | First, the player is awarded a small number of points for each downward
52 | move that the player made with the piece. The player is awarded 5
53 | pts/move if the next piece was displayed at while this piece was falling,
54 | 10 pts/move otherwise. This rewards fast play. Next, any completed
55 | lines are cleared away, and a cleared-line bonus is awarded. The table
56 | below illustrates the line clear bonuses. Notice that it's worth your
57 | while to clear more lines at a time.
58 |
59 | Line Clear Bonuses:
60 |
61 | +-----------------+---------------------------------- -------------------+
62 | | Number of | Level Number...... ... |
63 | | Lines Cleared | 1 | 2 | 3 | 4 | ... | n |
64 | |-----------------+--------+-------+-------+-------+- -+-----------------+
65 | | 1 | 1000 | 1500 | 2000 | 2500 | ... | 500 * (n + 1) |
66 | | 2 | 3000 | 4500 | 6000 | 7500 | ... | 1500 * (n + 1) |
67 | | 3 | 6000 | 9000 | 12000 | 15000 | ... | 3000 * (n + 1) |
68 | | 4 | 12000 | 18000 | 24000 | 30000 | ... | 6000 * (n + 1) |
69 | +-----------------+--------+-------+-------+-------+- -+-----------------+
70 |
71 | As lines are cleared, the player is moved up in level. Each level has
72 | a maximum number of lines associated with it, which is "10 * level".
73 | When that maximum is reached, the player is moved to the next level.
74 | For example, when a player reaches 40 lines, the player moves from Level
75 | 4 to Level 5 (if the player didn't start at a higher level number).
76 |
77 | ------------
78 | Sound Test
79 | ------------
80 |
81 | The Sound Test screen allows the player to just play around with the
82 | sound effects that are embedded in the 4-Tris ROM image. Press buttons
83 | on the keypad to trigger sound effects and music. Use the action
84 | buttons to toggle the music playback speed. Press Disc to exit.
85 |
86 | -------------
87 | Source Code
88 | -------------
89 |
90 | See the file "SOURCE.txt" for information on 4-Tris' source code.
91 |
--------------------------------------------------------------------------------
/open-content/4-Tris/images/4_tris_easter_egg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/images/4_tris_easter_egg.png
--------------------------------------------------------------------------------
/open-content/4-Tris/images/4_tris_game_over.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/images/4_tris_game_over.png
--------------------------------------------------------------------------------
/open-content/4-Tris/images/4_tris_in_game.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/images/4_tris_in_game.png
--------------------------------------------------------------------------------
/open-content/4-Tris/images/4_tris_sound_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/images/4_tris_sound_test.png
--------------------------------------------------------------------------------
/open-content/4-Tris/images/4_tris_title_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/images/4_tris_title_screen.png
--------------------------------------------------------------------------------
/open-content/4-Tris/images/boxart_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/open-content/4-Tris/images/boxart_front.png
--------------------------------------------------------------------------------
/open-content/4-Tris/src/behappy3.txt:
--------------------------------------------------------------------------------
1 | ;tempo=428571 division=120
2 | tempo=380000 division=120
3 | zero_merge=1
4 | always_zero=0
5 | always_volume=0
6 | space=8
7 | Chn 1 Note On B3=72 Time=5
8 | Chn 3 Note On B6=72 Time=8
9 | Chn 2 Note On F#5=72 Time=126
10 | Chn 2 Note On F#5=0 Time=145
11 | Chn 2 Note On F#5=72 Time=207
12 | Chn 2 Note On F#5=0 Time=226
13 | Chn 3 Note On B6=0 Time=232
14 | Chn 3 Note On G#6=72 Time=243
15 | Chn 1 Note On B3=0 Time=246
16 | Chn 1 Note On G#3=72 Time=246
17 | Chn 1 Note On G#3=0 Time=341
18 | Chn 3 Note On G#6=0 Time=352
19 | Chn 3 Note On F#6=72 Time=361
20 | Chn 1 Note On F#3=72 Time=364
21 | Chn 2 Note On F#5=72 Time=364
22 | Chn 2 Note On F#5=0 Time=386
23 | Chn 2 Note On F#5=72 Time=445
24 | Chn 1 Note On F#3=0 Time=462
25 | Chn 2 Note On F#5=0 Time=464
26 | Chn 3 Note On F#6=0 Time=478
27 | Chn 3 Note On G#6=72 Time=481
28 | Chn 3 Note On G#6=0 Time=546
29 | Chn 3 Note On C#6=72 Time=562
30 | Chn 3 Note On D#6=72 Time=602
31 | Chn 2 Note On F#5=72 Time=607
32 | Chn 3 Note On C#6=0 Time=607
33 | Chn 2 Note On F#5=0 Time=627
34 | Chn 2 Note On F#5=72 Time=686
35 | Chn 2 Note On F#5=0 Time=705
36 | Chn 3 Note On D#6=0 Time=705
37 | Chn 3 Note On F#6=72 Time=722
38 | Chn 1 Note On G#3=72 Time=725
39 | Chn 3 Note On F#6=0 Time=798
40 | Chn 3 Note On D#6=72 Time=803
41 | Chn 3 Note On C#6=72 Time=842
42 | Chn 2 Note On F#5=72 Time=845
43 | Chn 3 Note On D#6=0 Time=845
44 | Chn 2 Note On F#5=0 Time=865
45 | Chn 1 Note On G#3=0 Time=904
46 | Chn 3 Note On C#6=0 Time=912
47 | Chn 3 Note On B5=72 Time=921
48 | Chn 1 Note On D#4=72 Time=926
49 | Chn 2 Note On F#5=72 Time=926
50 | Chn 2 Note On F#5=0 Time=946
51 | Chn 3 Note On B5=0 Time=954
52 | Chn 3 Note On C#6=72 Time=960
53 | Chn 1 Note On D#4=0 Time=966
54 | Chn 1 Note On C#4=72 Time=966
55 | Chn 3 Note On C#6=0 Time=1041
56 | Chn 3 Note On D#6=72 Time=1041
57 | Chn 3 Note On D#6=0 Time=1078
58 | Chn 1 Note On C#4=0 Time=1083
59 | Chn 1 Note On C#4=72 Time=1083
60 | Chn 2 Note On G#5=72 Time=1083
61 | Chn 3 Note On C#6=72 Time=1083
62 | Chn 2 Note On G#5=0 Time=1106
63 | Chn 2 Note On G#5=72 Time=1164
64 | Chn 2 Note On G#5=0 Time=1187
65 | Chn 1 Note On C#4=0 Time=1206
66 | Chn 1 Note On G#3=72 Time=1206
67 | Chn 2 Note On G#5=72 Time=1327
68 | Chn 1 Note On G#3=0 Time=1344
69 | Chn 2 Note On G#5=0 Time=1344
70 | Chn 2 Note On G#5=72 Time=1405
71 | Chn 2 Note On G#5=0 Time=1425
72 | Chn 2 Note On G#5=72 Time=1565
73 | Chn 3 Note On C#6=0 Time=1576
74 | Chn 2 Note On G#5=0 Time=1584
75 | Chn 2 Note On G#5=72 Time=1646
76 | Chn 2 Note On G#5=0 Time=1666
77 | Chn 3 Note On F#6=72 Time=1682
78 | Chn 1 Note On B3=72 Time=1685
79 | Chn 3 Note On F#6=0 Time=1747
80 | Chn 3 Note On D#6=72 Time=1761
81 | Chn 3 Note On C#6=72 Time=1803
82 | Chn 2 Note On G#5=72 Time=1806
83 | Chn 3 Note On D#6=0 Time=1811
84 | Chn 2 Note On G#5=0 Time=1825
85 | Chn 3 Note On C#6=0 Time=1876
86 | Chn 3 Note On B5=72 Time=1881
87 | Chn 1 Note On B3=0 Time=1887
88 | Chn 1 Note On G#3=72 Time=1887
89 | Chn 2 Note On G#5=72 Time=1887
90 | Chn 2 Note On G#5=0 Time=1904
91 | Chn 3 Note On B5=0 Time=1923
92 | Chn 3 Note On C#6=72 Time=1923
93 | Chn 1 Note On G#3=0 Time=1926
94 | Chn 1 Note On E3=72 Time=1926
95 | Chn 3 Note On D#6=72 Time=2002
96 | Chn 3 Note On C#6=0 Time=2007
97 | Chn 3 Note On D#6=0 Time=2035
98 | Chn 3 Note On C#6=72 Time=2041
99 | Chn 1 Note On E3=0 Time=2046
100 | Chn 1 Note On E3=72 Time=2046
101 | Chn 2 Note On G#5=72 Time=2046
102 | Chn 2 Note On G#5=0 Time=2066
103 | Chn 2 Note On G#5=72 Time=2125
104 | Chn 2 Note On G#5=0 Time=2147
105 | Chn 1 Note On E3=0 Time=2167
106 | Chn 1 Note On B3=72 Time=2167
107 | Chn 1 Note On B3=0 Time=2284
108 | Chn 2 Note On G#5=72 Time=2287
109 | Chn 2 Note On G#5=0 Time=2307
110 | Chn 2 Note On G#5=72 Time=2366
111 | Chn 2 Note On G#5=0 Time=2385
112 | Chn 3 Note On C#6=0 Time=2508
113 | Chn 2 Note On G#5=72 Time=2525
114 | Chn 2 Note On G#5=0 Time=2545
115 | Chn 1 Note On B3=72 Time=2606
116 | Chn 2 Note On G#5=72 Time=2606
117 | Chn 2 Note On G#5=0 Time=2626
118 | Chn 3 Note On D6=72 Time=2640
119 | Chn 1 Note On B3=0 Time=2646
120 | Chn 1 Note On F#3=72 Time=2646
121 | Chn 3 Note On D6=0 Time=2710
122 | Chn 3 Note On C#6=72 Time=2721
123 | Chn 1 Note On F#3=0 Time=2727
124 | Chn 1 Note On G#3=72 Time=2727
125 | Chn 1 Note On G#3=0 Time=2763
126 | Chn 1 Note On B3=72 Time=2763
127 | Chn 2 Note On G#5=72 Time=2763
128 | Chn 3 Note On C#6=0 Time=2763
129 | Chn 3 Note On B5=72 Time=2763
130 | Chn 2 Note On G#5=0 Time=2786
131 | Chn 3 Note On G#5=72 Time=2842
132 | Chn 1 Note On G#3=72 Time=2844
133 | Chn 1 Note On B3=0 Time=2847
134 | Chn 2 Note On G#5=72 Time=2847
135 | Chn 3 Note On B5=0 Time=2847
136 | Chn 2 Note On G#5=0 Time=2867
137 | Chn 3 Note On G#5=0 Time=2867
138 | Chn 3 Note On B5=72 Time=2881
139 | Chn 1 Note On G#3=0 Time=2884
140 | Chn 1 Note On B3=72 Time=2884
141 | Chn 1 Note On B5=0 Time=3052
142 | Chn 1 Note On B3=0 Time=3052
143 |
--------------------------------------------------------------------------------
/open-content/4-Tris/src/digits:
--------------------------------------------------------------------------------
1 | CHAR '0'
2 | ........
3 | ..####..
4 | .#....#.
5 | .#....#.
6 | ........
7 | .#....#.
8 | .#....#.
9 | ..####..
10 |
11 | CHAR '1'
12 | ........
13 | ........
14 | ......#.
15 | ......#.
16 | ........
17 | ......#.
18 | ......#.
19 | ........
20 |
21 | CHAR '2'
22 | ........
23 | ..####..
24 | ......#.
25 | ......#.
26 | ..####..
27 | .#......
28 | .#......
29 | ..####..
30 |
31 | CHAR '3'
32 | ........
33 | ..####..
34 | ......#.
35 | ......#.
36 | ..####..
37 | ......#.
38 | ......#.
39 | ..####..
40 |
41 | CHAR '4'
42 | ........
43 | ........
44 | .#....#.
45 | .#....#.
46 | ..####..
47 | ......#.
48 | ......#.
49 | ........
50 |
51 | CHAR '5'
52 | ........
53 | ..####..
54 | .#......
55 | .#......
56 | ..####..
57 | ......#.
58 | ......#.
59 | ..####..
60 |
61 | CHAR '6'
62 | ........
63 | ..####..
64 | .#......
65 | .#......
66 | ..####..
67 | .#....#.
68 | .#....#.
69 | ..####..
70 |
71 | CHAR '7'
72 | ........
73 | ..####..
74 | ......#.
75 | ......#.
76 | ........
77 | ......#.
78 | ......#.
79 | ........
80 |
81 | CHAR '8'
82 | ........
83 | ..####..
84 | .#....#.
85 | .#....#.
86 | ..####..
87 | .#....#.
88 | .#....#.
89 | ..####..
90 |
91 | CHAR '9'
92 | ........
93 | ..####..
94 | .#....#.
95 | .#....#.
96 | ..####..
97 | ......#.
98 | ......#.
99 | ..####..
100 |
101 |
--------------------------------------------------------------------------------
/open-content/4-Tris/src/facefont:
--------------------------------------------------------------------------------
1 | CHAR #32 ; [ 0, 0]
2 | ........
3 | ........
4 | ........
5 | ........
6 | .......#
7 | ......##
8 | .....###
9 | .....###
10 | CHAR #33 ; [ 8, 0]
11 | ........
12 | .....###
13 | ...#####
14 | ..######
15 | ########
16 | ########
17 | ########
18 | ########
19 | CHAR #34 ; [16, 0]
20 | ..######
21 | ########
22 | ########
23 | ########
24 | ########
25 | ########
26 | ########
27 | ########
28 | CHAR #35 ; [24, 0]
29 | ##......
30 | ####....
31 | ########
32 | ########
33 | ########
34 | ########
35 | #######.
36 | ######.#
37 | CHAR #36 ; [32, 0]
38 | ........
39 | ........
40 | ........
41 | ###.....
42 | #.#.....
43 | .####...
44 | ######..
45 | #######.
46 | CHAR #37 ; [ 0, 8]
47 | ....####
48 | ....####
49 | ...#####
50 | ...#####
51 | ...#####
52 | ..######
53 | .#######
54 | .#######
55 | CHAR #38 ; [16, 8]
56 | ########
57 | ########
58 | ########
59 | ########
60 | ########
61 | #######.
62 | #####...
63 | ####....
64 | CHAR #39 ; [24, 8]
65 | ######.#
66 | #####.##
67 | #####.##
68 | ####.###
69 | ###.####
70 | .#.#####
71 | ...#####
72 | ...#####
73 | CHAR #40 ; [32, 8]
74 | #######.
75 | ########
76 | ########
77 | ########
78 | ########
79 | ########
80 | ########
81 | ########
82 | CHAR #41 ; [40, 8]
83 | ........
84 | ........
85 | ........
86 | #.......
87 | #.......
88 | #.......
89 | #.......
90 | #.......
91 | CHAR #42 ; [ 0, 16]
92 | ########
93 | ########
94 | ######..
95 | #####...
96 | #####...
97 | ####....
98 | ####....
99 | ###.....
100 | CHAR #43 ; [ 8, 16]
101 | ########
102 | #...####
103 | ....####
104 | ######..
105 | ###.....
106 | ........
107 | ........
108 | ........
109 | CHAR #44 ; [16, 16]
110 | ####....
111 | ##......
112 | ........
113 | ........
114 | ........
115 | ........
116 | ........
117 | ........
118 | CHAR #45 ; [24, 16]
119 | .....###
120 | ......##
121 | ......##
122 | ........
123 | ........
124 | ........
125 | ........
126 | ........
127 | CHAR #46 ; [32, 16]
128 | ########
129 | ########
130 | ########
131 | ########
132 | ########
133 | .#######
134 | ..######
135 | ..######
136 | CHAR #47 ; [40, 16]
137 | ##......
138 | ##......
139 | ##......
140 | ##......
141 | ##......
142 | ##......
143 | ##......
144 | ##......
145 | CHAR #48 ; [ 0, 24]
146 | ###.....
147 | ##......
148 | .#......
149 | .#......
150 | .#......
151 | .#......
152 | .#......
153 | ..#.....
154 | CHAR #49 ; [32, 24]
155 | ..######
156 | ..######
157 | ..######
158 | ..######
159 | ..######
160 | ...#####
161 | ...#####
162 | ...#####
163 | CHAR #50 ; [40, 24]
164 | ##......
165 | ##......
166 | #.......
167 | #.......
168 | ........
169 | ........
170 | ........
171 | ........
172 | CHAR #51 ; [ 0, 32]
173 | ..#..###
174 | ..#.....
175 | ..#..###
176 | ..#..#..
177 | ..#.....
178 | ..#.....
179 | ..#.....
180 | ..#.....
181 | CHAR #52 ; [ 8, 32]
182 | ###.....
183 | ..###...
184 | ....#...
185 | ##..#...
186 | ##......
187 | .....#..
188 | .....#..
189 | .....#..
190 | CHAR #53 ; [16, 32]
191 | .....###
192 | ....##..
193 | ...#..##
194 | .....#..
195 | .......#
196 | .......#
197 | ........
198 | ........
199 | CHAR #54 ; [24, 32]
200 | ##......
201 | ........
202 | #.......
203 | .#.#....
204 | #...#...
205 | #.......
206 | ........
207 | ........
208 | CHAR #55 ; [32, 32]
209 | ...####.
210 | ....##..
211 | ....#...
212 | ....#...
213 | ....#...
214 | ....#...
215 | ....#...
216 | ....#...
217 | CHAR #56 ; [40, 32]
218 | ##......
219 | ..#.....
220 | ..#.....
221 | ..#.....
222 | ..#.....
223 | ..#.....
224 | ..#.....
225 | ..#.....
226 | CHAR #57 ; [ 0, 40]
227 | ..#.....
228 | ..#.....
229 | ..#.....
230 | ..#.....
231 | ..#.....
232 | ...#....
233 | ...#....
234 | ...#....
235 | CHAR #58 ; [ 8, 40]
236 | ....##..
237 | ....#...
238 | ....#...
239 | ....#...
240 | ...#....
241 | ...#....
242 | ...#....
243 | ...#....
244 | CHAR #59 ; [16, 40]
245 | ........
246 | ........
247 | ........
248 | ........
249 | ........
250 | ........
251 | ..#.....
252 | .##.....
253 | CHAR #60 ; [32, 40]
254 | ....#...
255 | ...#....
256 | ...#....
257 | ...#....
258 | ...#...#
259 | ...#..#.
260 | ..#.###.
261 | ..#.....
262 | CHAR #61 ; [40, 40]
263 | .#......
264 | .#......
265 | ##......
266 | #.......
267 | ........
268 | ........
269 | ........
270 | ........
271 | CHAR #62 ; [ 0, 48]
272 | ...#....
273 | ...#....
274 | ...#....
275 | ...#....
276 | ...#....
277 | ...##...
278 | ....#...
279 | ....#...
280 | CHAR #63 ; [ 8, 48]
281 | ...#####
282 | ..######
283 | .#######
284 | ##.#####
285 | ..#.....
286 | ..#.....
287 | ...#....
288 | ....####
289 | CHAR #64 ; [16, 48]
290 | #.......
291 | #####.#.
292 | ######.#
293 | #.#.###.
294 | .......#
295 | .....##.
296 | ..####..
297 | ##......
298 | CHAR #65 ; [24, 48]
299 | ........
300 | ........
301 | ........
302 | ........
303 | ........
304 | ........
305 | ........
306 | .......#
307 | CHAR #66 ; [32, 48]
308 | ..#.....
309 | ..#.....
310 | ..#.....
311 | ..#.....
312 | .#......
313 | #.......
314 | #.......
315 | #.......
316 | CHAR #67 ; [ 0, 56]
317 | ....##..
318 | .....#..
319 | ......#.
320 | ......#.
321 | ......#.
322 | .......#
323 | ........
324 | ........
325 | CHAR #68 ; [ 8, 56]
326 | ........
327 | ........
328 | ........
329 | ........
330 | ......#.
331 | .....##.
332 | #....#..
333 | .#...#..
334 | CHAR #69 ; [24, 56]
335 | .......#
336 | ......#.
337 | .....#..
338 | .....#..
339 | ...##...
340 | .##.....
341 | #.......
342 | ........
343 | CHAR #70 ; [ 8, 64]
344 | ..#..#..
345 | ...###..
346 | ......##
347 | ........
348 | ........
349 | ........
350 | ........
351 | ........
352 | CHAR #71 ; [16, 64]
353 | .....##.
354 | ...##...
355 | ####....
356 | ........
357 | ........
358 | ........
359 | ........
360 | ........
361 |
--------------------------------------------------------------------------------
/open-content/4-Tris/src/miscfont:
--------------------------------------------------------------------------------
1 | CHAR # 33
2 | ........
3 | ........
4 | .##...##
5 | .##...#.
6 | .##...##
7 | .##...#.
8 | .####.##
9 | ........
10 | CHAR # 34
11 | ........
12 | ........
13 | #.#...#.
14 | ..#...#.
15 | ...#.#..
16 | ...#.#..
17 | #...#...
18 | ........
19 | CHAR # 35
20 | ........
21 | ........
22 | ###.#...
23 | #...#...
24 | ##..#...
25 | #...#...
26 | ###.###.
27 | ........
28 | CHAR # 36
29 | ........
30 | ........
31 | ##...###
32 | ##....#.
33 | ##....#.
34 | ##....#.
35 | ####.###
36 | ........
37 | CHAR # 37
38 | ........
39 | ........
40 | .#...#.#
41 | .##..#.#
42 | .#.#.#.#
43 | .#..##.#
44 | .#...#.#
45 | ........
46 | CHAR # 38
47 | ........
48 | ........
49 | ##.####.
50 | ...#....
51 | #..####.
52 | ......#.
53 | ##.####.
54 | ........
55 | CHAR # 39
56 | ........
57 | ........
58 | ....##..
59 | ....###.
60 | ....##.#
61 | ....##..
62 | ....##..
63 | ........
64 | CHAR # 40
65 | ........
66 | ........
67 | .#.###.#
68 | .#.#....
69 | .#.##...
70 | ##.#....
71 | .#.###.#
72 | ........
73 | CHAR # 41
74 | ........
75 | ........
76 | ...#.###
77 | #.#...#.
78 | .#....#.
79 | #.#...#.
80 | ...#..#.
81 | ........
82 | CHAR # 58
83 | ..####..
84 | .#....#.
85 | #..##..#
86 | #.#....#
87 | #.#....#
88 | #..##..#
89 | .#....#.
90 | ..####..
91 |
--------------------------------------------------------------------------------
/open-content/4-Tris/src/mkfont16.c:
--------------------------------------------------------------------------------
1 | /* mkfont
2 | *
3 | * read files of the following format and outputs a bunch of DECLE
4 | * directives for the resulting font. Outputs a complete GRAM image
5 | * (512 decles == 64 characters * 8 decles/character). A grom image may
6 | * be generated by specifying a '-' as the first argument to the program.
7 | *
8 | * CHAR 'X'
9 | * ##...##.
10 | * ##...##.
11 | * .##.##..
12 | * ..###...
13 | * ..###...
14 | * .##.##..
15 | * ##...##.
16 | * ........
17 | *
18 | * or
19 | *
20 | * CHAR # 88
21 | * ##...##.
22 | * ##...##.
23 | * .##.##..
24 | * ..###...
25 | * ..###...
26 | * .##.##..
27 | * ##...##.
28 | * ........
29 | *
30 | * Exactly 8 lines must follow a CHAR directive. Dots/spaces/0
31 | * become zero-bits, everything else becomes 1-bits. Short lines are
32 | * padded with zero-bits. Characters beyond the 8th position are ignored.
33 | * Leading whitespace IS NOT. Nothing intelligent is done with tabs.
34 | *
35 | * An offset 32 is subtracted from the ASCII value for the character by
36 | * default. This can be changed with an "OFFSET" directive. All character
37 | * numbers are taken modulo 64. (Note: The offset is reset to 32 for each
38 | * file.)
39 | */
40 |
41 | #include
42 | #include
43 | #include
44 | #include
45 |
46 | int offset = 32;
47 | int numchars = 64;
48 |
49 | #define NA (-10000)
50 |
51 | int font[256 * 8];
52 | int name[256];
53 | char buf1[1024];
54 | char buf2[1024];
55 |
56 | int handle_char(FILE *f, int chnum, int numeric)
57 | {
58 | int i, j, idx, eof = 0;
59 | unsigned row;
60 | char cbuf[9], *s;
61 |
62 | idx = (((unsigned)chnum - offset) % numchars) << 3;
63 | name[idx >> 3] = numeric ? ~chnum : chnum;
64 |
65 | for (i = 0; i < 8; i++, idx++)
66 | {
67 | if (fgets(buf1, 1024, f) == NULL)
68 | {
69 | eof = -1;
70 | buf1[0] = '\0';
71 | }
72 | buf1[8] = 0;
73 |
74 | /* trim trailing newline */
75 | s = buf1;
76 | while (*s)
77 | {
78 | if (*s == '\n' || *s == '\r') *s = 0;
79 | else s++;
80 | }
81 |
82 | sprintf(cbuf, "%-.8s", buf1);
83 |
84 | for (j = row = 0; j < 8; j++)
85 | {
86 | row <<= 1;
87 | if (cbuf[j] != '.' &&
88 | cbuf[j] != ' ' &&
89 | cbuf[j] != '0') row++;
90 | }
91 | font[idx] = row;
92 | }
93 |
94 | return eof;
95 | }
96 |
97 | void trim_whitespace(void)
98 | {
99 | char *s1;
100 |
101 | s1 = buf1;
102 |
103 | while (isspace(*s1)) s1++;
104 | strncpy(buf2, s1, sizeof(buf2));
105 | s1 = buf2 + strlen(buf2) - 1;
106 | while (s1 > buf2 && isspace(*s1)) s1--;
107 | *++s1 = 0;
108 |
109 | }
110 |
111 | int main(int argc, char *argv[])
112 | {
113 | FILE * f;
114 | int val = 0;
115 | int eof = 0;
116 | int skip = 0;
117 | int decle = 0, chars = 0;
118 | int lineno;
119 | int i, j, k, idx;
120 | int suppress = 0;
121 | int rle_ok = 0;
122 | int gramfont = 1;
123 | int font16 = 1;
124 |
125 | if (argc == 1 || (argc==2 && argv[1][0] == '-'))
126 | {
127 | fprintf(stderr, "usage: mkfont [-] in1 [in2 [...]]"
128 | " > font.asm\n");
129 | exit(1);
130 | }
131 |
132 |
133 | if (argv[1][0] == '-') { numchars = 256; argv++; }
134 | gramfont = numchars == 64;
135 |
136 |
137 | if (gramfont)
138 | {
139 | for (i = 0; i < 256; i++) name[i] = NA;
140 | for (i = 0; i < 256 * 8; i++) font[i] = NA;
141 | } else
142 | {
143 | for (i = 0; i < 256; i++) name[i] = ~i;
144 | for (i = 0; i < 256 * 8; i++) font[i] = 0;
145 | }
146 |
147 | while (*++argv)
148 | {
149 | f = fopen(argv[0], "r");
150 | if (!f)
151 | {
152 | perror("fopen()");
153 | fprintf(stderr, "Could not open %s for reading.\n",
154 | argv[0]);
155 | exit(1);
156 | }
157 |
158 | offset = 32;
159 | lineno = 0;
160 | eof = 0;
161 |
162 | fprintf(stderr, "Processing file: %s\n", argv[0]);
163 | while (!eof && fgets(buf1, 1024, f) != NULL)
164 | {
165 | lineno++;
166 | trim_whitespace();
167 |
168 | if (buf2[0] == ';' || strlen(buf2) == 0) continue;
169 | if (sscanf(buf2, "CHAR '%c'", &val) == 1)
170 | {
171 | eof = handle_char(f, val, 0);
172 | } else
173 | if (sscanf(buf2, "CHAR # %d", &val) == 1)
174 | {
175 | eof = handle_char(f, val, 1);
176 | } else
177 | if (sscanf(buf2, "OFFSET %d", &val) == 1)
178 | {
179 | offset = val;
180 | } else
181 | {
182 | fprintf(stderr, "Warning: Ignoring line %d "
183 | "of file %s\n",
184 | lineno, argv[0]);
185 | }
186 | }
187 | fclose(f);
188 | }
189 |
190 | fprintf(stderr, "Generating font.\n");
191 | if (gramfont)
192 | printf("FONT: PROC\n");
193 | else
194 | printf(" ORG $3000\nGROM: PROC\n");
195 | for (i = 0; i < numchars; i++)
196 | {
197 | if (gramfont && name[i] == NA) { skip++; continue; }
198 |
199 | if (gramfont && (skip || !i))
200 | {
201 | int span;
202 |
203 | for (j = i + 1; j < numchars; j++)
204 | if (name[j] == NA) break;
205 |
206 | span = j - i;
207 |
208 | printf(";; Skipped %d indices.\n", skip);
209 | printf(";; Encoding span of %d %s\n",
210 | span, span != 1 ? "entries" : "entry");
211 |
212 | /* We output skip * 8 since it makes the ASM easier */
213 | /* Likewise for span length. This works because */
214 | /* neither can get larger than 64. */
215 | if (font16)
216 | {
217 | unsigned int x;
218 | x = (0xFF00 & (skip << 8)) | (0x00FF & span);
219 | x = (0xFFF8 & (x << 3)) | (0x0007 & (x >> 13));
220 | printf(" DECLE $%.4X\n\n", x);
221 | decle++;
222 | } else
223 | {
224 | printf(" DECLE $%.3X, $%.3X\n\n",
225 | skip*8, span*8);
226 | decle += 2;
227 | }
228 | skip = 0;
229 | }
230 |
231 | if (name[i] < 0)
232 | printf(";; Character #%d, GR%cM character index %d\n",
233 | ~name[i], gramfont ?'A':'O', i);
234 | else
235 | printf(";; Character '%c', GR%cM character index %d\n",
236 | name[i], gramfont ? 'A':'O', i);
237 | chars++;
238 | if (font16)
239 | {
240 | for (j = 0, idx = i << 3; j < 8; j += 2, idx += 2)
241 | {
242 | printf(" DECLE $%.4X ;",
243 | ((0xFF & font[idx + 1]) << 8) | (0xFF & font[idx]));
244 |
245 | for (k = 7; k >= 0; k--)
246 | putchar((1 & (font[idx ] >> k))?'#':'.');
247 | putchar('\n');
248 |
249 | printf("; - - - ;");
250 |
251 | for (k = 7; k >= 0; k--)
252 | putchar((1 & (font[idx + 1] >> k))?'#':'.');
253 | putchar('\n');
254 | decle++;
255 | }
256 | } else
257 | {
258 | for (j = 0, idx = i << 3; j < 8; j++, idx++)
259 | {
260 | printf(suppress > 0 ? "; - - - "
261 | : " DECLE ");
262 | if (rle_ok && suppress <= 0)
263 | {
264 | decle++;
265 | for(suppress = 0; suppress < 3; suppress++)
266 | if (font[idx] != font[1+idx+suppress])
267 | break;
268 |
269 | printf(" $%.3X ; ",
270 | (suppress << 8) | font[idx]);
271 | } else
272 | {
273 | suppress--;
274 | printf(" $%.3X ; ", font[idx]);
275 | }
276 |
277 | for (k = 7; k >= 0; k--)
278 | putchar((1 & (font[idx] >> k))?'#':'.');
279 | putchar('\n');
280 | }
281 | }
282 | putchar('\n');
283 | }
284 |
285 | printf("\n;; End of font.\n");
286 | if (gramfont)
287 | {
288 | if (font16)
289 | {
290 | printf(" DECLE $0000\n\n");
291 | decle++;
292 | } else
293 | {
294 | printf(" BYTE $00, $00\n\n");
295 | decle += 2;
296 | }
297 | }
298 | printf(";; Total chars: %10d characters\n", chars);
299 | printf(";; Total length: %10d decles\n", decle);
300 | printf(";; Decles/char: %10.3f decles/character\n",
301 | (double)decle/chars);
302 | printf(" ENDP\n");
303 |
304 | return 0;
305 | }
306 |
--------------------------------------------------------------------------------
/open-content/4-Tris/src/trisfont:
--------------------------------------------------------------------------------
1 | CHAR # 42
2 | .##..##
3 | .##..##.
4 | .##..##.
5 | .######.
6 | .....##.
7 | .....##.
8 | .....##.
9 | ........
10 |
11 | CHAR 'T'
12 | .######.
13 | .#.##.#.
14 | ...##...
15 | ...##...
16 | ...##...
17 | ...##...
18 | ..####..
19 | ........
20 |
21 | CHAR 'R'
22 | ..#####.
23 | .##..##.
24 | .##..##.
25 | ..#####.
26 | .##..##.
27 | .##..##.
28 | .##..##.
29 | ........
30 |
31 | CHAR 'I'
32 | .######.
33 | .#.##.#.
34 | ...##...
35 | ...##...
36 | ...##...
37 | .#.##.#.
38 | .######.
39 | ........
40 |
41 | CHAR 'S'
42 | .######.
43 | .##...#.
44 | .##.....
45 | .######.
46 | .....##.
47 | .#...##.
48 | .######.
49 | ........
50 |
--------------------------------------------------------------------------------
/retropie/emulators.cfg:
--------------------------------------------------------------------------------
1 | lr-freeintv = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-freeintv/freeintv_libretro.so --config /opt/retropie/configs/intellivision/retroarch.cfg %ROM%"
2 | jzintv = "/opt/retropie/emulators/jzintv/bin/jzintv -p /home/pi/RetroPie/BIOS -q --kbdhackfile=/home/pi/RetroPie/roms/intellivision/hackfile.cfg %ROM%"
3 | default="lr-freeintv"
4 |
--------------------------------------------------------------------------------
/retropie/retroarch.cfg:
--------------------------------------------------------------------------------
1 | # Settings made here will only override settings in the global retroarch.cfg if placed above the #include line
2 |
3 | input_remapping_directory = /opt/retropie/configs/intellivision/
4 |
5 | rewind_enable = false
6 |
7 | system_directory = /home/pi/RetroPie/BIOS/
8 |
9 | #include "/opt/retropie/configs/all/retroarch.cfg"
10 |
--------------------------------------------------------------------------------
/retropie/retropie.txt:
--------------------------------------------------------------------------------
1 | -----------------------------------------------------------------
2 | To Install FreeIntv on RetroPie 4.2:
3 | -----------------------------------------------------------------
4 |
5 | Installing FreeIntv is simple, though you'll need a basic
6 | understanding of file system operations and be comfortable
7 | working from the command line.
8 |
9 | Specifically, you'll need to know how to change directories,
10 | how to move or copy files, and how to edit text files.
11 |
12 | -----------------------------------------------------------------
13 | Step 1: Create the necessary directories
14 | -----------------------------------------------------------------
15 |
16 | > sudo mkdir /opt/retropie/libretrocores/lr-freeintv
17 |
18 | -----------------------------------------------------------------
19 | Step 2: Install the libreto core
20 | -----------------------------------------------------------------
21 |
22 | Copy the file:
23 |
24 | freeintv_libretro.so
25 | to:
26 | /opt/retropie/libretrocores/lr-freeintv
27 |
28 | Be sure to set permissions to 755:
29 |
30 | > sudo chmod 755 /opt/retropie/libretrocores/lr-freeintv/*
31 |
32 | -----------------------------------------------------------------
33 | Step 3: Add the retroarch config file
34 | -----------------------------------------------------------------
35 |
36 | Add the file:
37 |
38 | retroarch.cfg
39 | to:
40 | /opt/retropie/configs/intellivision
41 |
42 | Be sure to set permissions to 755:
43 |
44 | > sudo chmod 755 /opt/retropie/configs/intellivision/*
45 |
46 | -----------------------------------------------------------------
47 | Step 4:
48 | -----------------------------------------------------------------
49 |
50 | If you're already using an Intellivision emulator, add the line:
51 |
52 | lr-freeintv = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-freeintv/freeintv_libretro.so --config /opt/retropie//configs/intellivision/retroarch.cfg %ROM%"
53 |
54 | to the top of the file:
55 |
56 | /opt/retropie/configs/intellivision/emulators.cfg
57 |
58 | Optionally, you can choose to set it as default, as is the case for
59 | the included emulators.cfg file.
60 |
61 | If not, copy the included emulators.cfg file to:
62 |
63 | /opt/retropie/configs/intellivision/
64 |
65 | Be sure to set permissions to 755:
66 |
67 | > sudo chmod 755 /opt/retropie/configs/intellivision/*
68 |
69 | -----------------------------------------------------------------
70 | Step 5: Restart EmulationStation and play some Intellivision!
71 | -----------------------------------------------------------------
72 |
73 | George Plimpton would approve.
74 |
75 | ----------------------------------------------------------------
76 | Remember that FreeIntv is free software
77 | ----------------------------------------------------------------
78 |
79 | FreeIntv is free software: you can redistribute it and/or modify
80 | it under the terms of the GNU General Public License as published by
81 | the Free Software Foundation, either version 3 of the License, or
82 | (at your option) any later version.
83 |
84 | FreeIntv is distributed in the hope that it will be useful,
85 | but WITHOUT ANY WARRANTY; without even the implied warranty of
86 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87 | GNU General Public License for more details.
88 |
89 | You should have received a copy of the GNU General Public License
90 | along with FreeIntv. If not, see http://www.gnu.org/licenses/
91 |
--------------------------------------------------------------------------------
/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/libretro/FreeIntv/6efc4b8fd4c7423ec1f5ff1913b854529135b565/src/.DS_Store
--------------------------------------------------------------------------------
/src/cart.h:
--------------------------------------------------------------------------------
1 | #ifndef CART_H
2 | #define CART_H
3 | /*
4 | This file is part of FreeIntv.
5 |
6 | FreeIntv is free software; you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation; either version 2 of the License, or
9 | (at your option) any later version.
10 |
11 | FreeIntv is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License along
17 | with FreeIntv; if not, write to the Free Software Foundation, Inc.,
18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 | */
20 |
21 | int LoadCart(const char *path);
22 |
23 | #endif
--------------------------------------------------------------------------------
/src/controller.c:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of FreeIntv.
3 |
4 | FreeIntv is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | FreeIntv is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License along
15 | with FreeIntv; if not, write to the Free Software Foundation, Inc.,
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 | */
18 | #include
19 | #include "controller.h"
20 | #include "memory.h"
21 |
22 | const double PI = 3.14159265358979323846;
23 |
24 | #define K_1 0x81
25 | #define K_2 0x41
26 | #define K_3 0x21
27 | #define K_4 0x82
28 | #define K_5 0x42
29 | #define K_6 0x22
30 | #define K_7 0x84
31 | #define K_8 0x44
32 | #define K_9 0x24
33 | #define K_0 0x48
34 | #define K_C 0x88
35 | #define K_E 0x28
36 |
37 | #define B_TOP 0xA0
38 | #define B_LEFT 0x60
39 | #define B_RIGHT 0xC0
40 |
41 | #define D_N 0x04
42 | #define D_NNE 0x14
43 | #define D_NE 0x16
44 | #define D_ENE 0x06
45 | #define D_E 0x02
46 | #define D_ESE 0x12
47 | #define D_SE 0x13
48 | #define D_SSE 0x03
49 | #define D_S 0x01
50 | #define D_SSW 0x11
51 | #define D_SW 0x19
52 | #define D_WSW 0x09
53 | #define D_W 0x08
54 | #define D_WNW 0x18
55 | #define D_NW 0x1C
56 | #define D_NNW 0x0C
57 |
58 |
59 | int controllerSwap;
60 |
61 | // 16-way DISC directions, clockwise from North
62 | int discDirections[16] ={ D_N, D_NNE, D_NE, D_ENE, D_E, D_ESE, D_SE, D_SSE, D_S, D_SSW, D_SW, D_WSW, D_W, D_WNW, D_NW, D_NNW };
63 | int keypadDirections[8]={ K_2, K_3, K_6, K_9, K_8, K_7, K_4, K_1 };
64 |
65 | // keypad states: 1,2,3, 4,5,6, 7,8,9, C,0,E
66 | int keypadStates[12]={ K_1, K_2, K_3, K_4, K_5, K_6, K_7, K_8, K_9, K_C, K_0, K_E };
67 |
68 | int cursor[4] = { 0, 0, 0, 0 }; // mini keypad cursor (button row/column p0x,p0y p1x,p1y)
69 |
70 | int getQuickKeypadState(int player);
71 |
72 | void controllerInit()
73 | {
74 | controllerSwap = 0;
75 | // by default input 0 maps to Right Controller (0x1FE)
76 | // and input 1 maps to Left Controller (0x1FF)
77 | // pressing select (freeintv_libretro.c) will
78 | // swap the left and right controllers
79 | }
80 |
81 | void setControllerInput(int player, int state)
82 | {
83 | Memory[(player^controllerSwap) + 0x1FE] = (state^0xFF) & 0xFF;
84 | }
85 |
86 | int getControllerState(int joypad[], int player)
87 | {
88 | // converts joypad input for use by system
89 | int Lx = 0; // left analog X
90 | int Ly = 0; // left analog Y
91 | int Rx = 0; // right analog X
92 | int Ry = 0; // right analog Y
93 | double theta; // analog joy angle
94 | int norm; // theta, normalized
95 |
96 | int state = 0; //0xFF;
97 |
98 | if(joypad[0]!=0) { state |= D_N; } // 0xFB - Up
99 | if(joypad[1]!=0) { state |= D_S; } // 0xFE - Down
100 | if(joypad[2]!=0) { state |= D_W; } // 0xF7 - Left
101 | if(joypad[3]!=0) { state |= D_E; } // 0xFD - Right
102 |
103 | if(joypad[0]!=0 && joypad[2]!=0) { state |= D_NW; } // 0xE3 - Up+Left
104 | if(joypad[0]!=0 && joypad[3]!=0) { state |= D_NE; } // 0xE9 - Up+Right
105 | if(joypad[1]!=0 && joypad[2]!=0) { state |= D_SW; } // 0x36 - Down+Left
106 | if(joypad[1]!=0 && joypad[3]!=0) { state |= D_SE; } // 0x3C - Down+Right
107 |
108 | if(joypad[7]!=0) { state |= B_TOP; } // 0x5F - Button Top
109 | if(joypad[4]!=0) { state |= B_LEFT; } // 0x9F - Button Left
110 | if(joypad[5]!=0) { state |= B_RIGHT; } // 0x3F - Button Right
111 |
112 | if(joypad[6]!=0) { state |= getQuickKeypadState(player); }
113 |
114 | /* Analog Controls for 16-way disc control */
115 |
116 | Lx = joypad[14] / 8192;
117 | Ly = joypad[15] / 8192;
118 | if(Lx != 0 || Ly != 0)
119 | {
120 | // find angle
121 | theta = atan2((double)Ly, (double)Lx) + PI;
122 | // normalize
123 | if(theta<0.0) { theta = 0.0; }
124 | norm = floor((theta/(2*PI))*15.0);
125 | norm -= 3;
126 | if(norm<0) { norm += 16; }
127 | state |= discDirections[norm & 0x0F];
128 | }
129 |
130 | // Right-analog to keypad mapping (for Tron Deadly Discs)
131 | Rx = joypad[16] / 8192;
132 | Ry = joypad[17] / 8192;
133 | if(Rx != 0 || Ry != 0)
134 | {
135 | // find angle
136 | theta = atan2((double)Ry, (double)Rx) + PI;
137 | // normalize
138 | if(theta<0.0) { theta = 0.0; }
139 | norm = floor((theta/(2*PI))*7.0);
140 | norm -= 1;
141 | if(norm<0) { norm += 8; }
142 | state |= keypadDirections[norm & 0x07];
143 | }
144 |
145 | // Thumbsticks for Keypad 0/5
146 | if(joypad[18]!=0) { state |= K_0; } // 0x48 - Keypad 0
147 | if(joypad[19]!=0) { state |= K_5; } // 0x42 - Keypad 5
148 |
149 | // L/R triggers for Keypad Enter/Clear
150 | if(joypad[12]!=0) { state |= K_C; } // 0x88 - Keypad Clear
151 | if(joypad[13]!=0) { state |= K_E; } // 0x28 - Keypad Enter
152 |
153 | return state;
154 | }
155 |
156 | // Mini keypads, displayed in the corner using a shoulder button,
157 | // should better enable controller-only play.
158 |
159 | /* 39 x 27*/
160 | int miniKeypadImage[1053] =
161 | {
162 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
163 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
164 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
165 | 0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,0,0,1,0,0,1,1,1,0,0,1,0,
166 | 0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,
167 | 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,1,0,0,1,0,
168 | 0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,
169 | 0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,
170 | 0,1,0,0,0,1,0,0,0,1,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,1,0,
171 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
172 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
173 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
174 | 0,1,0,1,0,0,1,0,0,1,0,0,1,1,1,1,0,1,0,0,0,1,1,1,0,1,0,
175 | 0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,
176 | 0,1,0,1,1,1,1,1,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,
177 | 0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,
178 | 0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,
179 | 0,1,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0,0,1,0,
180 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
181 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
182 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
183 | 0,1,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,
184 | 0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,
185 | 0,1,0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,1,0,1,0,
186 | 0,1,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,
187 | 0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,
188 | 0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,
189 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
190 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
191 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
192 | 0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,1,1,1,1,1,0,1,0,
193 | 0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,
194 | 0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,1,1,1,0,0,1,0,
195 | 0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,
196 | 0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,
197 | 0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,0,1,1,1,1,1,0,1,0,
198 | 0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
199 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
200 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
201 | };
202 |
203 | int getKeypadState(int player, int joypad[], int joypre[])
204 | {
205 | int cursorX = cursor[player*2];
206 | int cursorY = cursor[player*2+1];
207 | int state = 0x0;
208 |
209 | // move cursor only on button down
210 | if(joypre[0]==0 && joypad[0]!=0) { cursorY--; if(cursorY<0) { cursorY = 3; } } // up
211 | if(joypre[1]==0 && joypad[1]!=0) { cursorY++; if(cursorY>3) { cursorY = 0; } } // down
212 | if(joypre[2]==0 && joypad[2]!=0) { cursorX--; if(cursorX<0) { cursorX = 2; } } // left
213 | if(joypre[3]==0 && joypad[3]!=0) { cursorX++; if(cursorX>2) { cursorX = 0; } } // right
214 |
215 | cursor[player*2] = cursorX;
216 | cursor[player*2+1] = cursorY;
217 |
218 | // let any face button press keypad
219 | if(joypad[4]!=0 || joypad[5]!=0 || joypad[6]!=0 || joypad[7]!=0)
220 | {
221 | state = keypadStates[(cursorY*3)+cursorX];
222 | }
223 | return state;
224 | }
225 |
226 | int getQuickKeypadState(int player)
227 | {
228 | int cursorX = cursor[player*2];
229 | int cursorY = cursor[player*2+1];
230 | return keypadStates[(cursorY*3)+cursorX];
231 | }
232 |
233 | void drawMiniKeypad(int player, unsigned int frame[])
234 | {
235 | int i, j, k;
236 | int cursorX = cursor[player*2];
237 | int cursorY = cursor[player*2+1];
238 |
239 | // draw keypad //
240 | int offset = 65120 + (player*325);
241 | k = 0;
242 | for(i=0; i<39; i++)
243 | {
244 | for(j=0; j<27; j++)
245 | {
246 | frame[offset+j] = miniKeypadImage[k]*0xFFFFFF;
247 | k++;
248 | }
249 | offset+=352;
250 | }
251 |
252 | // draw cursor
253 | offset = 65120 + (player*325) + (2*352) + 2;
254 | offset = offset + (8*cursorX) + ((9*352)*cursorY);
255 | for(i=0; i<7; i++)
256 | {
257 | frame[offset+i] = 0x00FF00;
258 | }
259 | for(i=0; i<6; i++)
260 | {
261 | offset+=352;
262 | frame[offset] = 0x00FF00;
263 | frame[offset+6] = 0x00FF00;
264 | }
265 | offset+=352;
266 | for(i=0; i<7; i++)
267 | {
268 | frame[offset+i] = 0x00FF00;
269 | }
270 | }
271 |
--------------------------------------------------------------------------------
/src/controller.h:
--------------------------------------------------------------------------------
1 | #ifndef CONTROLLER_H
2 | #define CONTROLLER_H
3 | /*
4 | This file is part of FreeIntv.
5 |
6 | FreeIntv is free software; you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation; either version 2 of the License, or
9 | (at your option) any later version.
10 |
11 | FreeIntv is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License along
17 | with FreeIntv; if not, write to the Free Software Foundation, Inc.,
18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 | */
20 |
21 | extern int controllerSwap;
22 |
23 | extern int keypadStates[];
24 |
25 | void controllerInit(void);
26 |
27 | int getControllerState(int joypad[], int player);
28 |
29 | int getKeypadState(int player, int joypad[], int joypre[]);
30 |
31 | void setControllerInput(int player, int state);
32 |
33 | void drawMiniKeypad(int player, unsigned int frame[]);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/cp1610.h:
--------------------------------------------------------------------------------
1 | #ifndef CP1610_H
2 | #define CP1610_H
3 | /*
4 | This file is part of FreeIntv.
5 |
6 | FreeIntv is free software; you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation; either version 2 of the License, or
9 | (at your option) any later version.
10 |
11 | FreeIntv is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License along
17 | with FreeIntv; if not, write to the Free Software Foundation, Inc.,
18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 | */
20 |
21 | struct CP1610serialized {
22 | int Flag_DoubleByteData;
23 | int Flag_InteruptEnable;
24 | int Flag_Carry;
25 | int Flag_Sign;
26 | int Flag_Zero;
27 | int Flag_Overflow;
28 | unsigned int R[8];
29 | };
30 |
31 | void CP1610Serialize(struct CP1610serialized *);
32 | void CP1610Unserialize(const struct CP1610serialized *);
33 |
34 | void CP1610Init(void); // Adds opcodes to lookup tables
35 |
36 | void CP1610Reset(void); // reset cpu
37 |
38 | int CP1610Tick(int debug); // execute a single instruction, return cycles used
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/compat/compat_fnmatch.c:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (compat_fnmatch.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 | /* Implemnentation of fnmatch(3) so it can be
28 | * distributed to non *nix platforms.
29 | *
30 | * No flags are implemented ATM.
31 | * We don't use them. Add flags as needed. */
32 |
33 | int rl_fnmatch(const char *pattern, const char *string, int flags)
34 | {
35 | int rv;
36 | const char *c = NULL;
37 | int charmatch = 0;
38 |
39 | for (c = pattern; *c != '\0'; c++)
40 | {
41 | /* String ended before pattern */
42 | if ((*c != '*') && (*string == '\0'))
43 | return FNM_NOMATCH;
44 |
45 | switch (*c)
46 | {
47 | /* Match any number of unknown chars */
48 | case '*':
49 | /* Find next node in the pattern
50 | * ignoring multiple asterixes
51 | */
52 | do {
53 | c++;
54 | if (*c == '\0')
55 | return 0;
56 | } while (*c == '*');
57 |
58 | /* Match the remaining pattern
59 | * ignoring more and more characters. */
60 | do {
61 | /* We reached the end of the string without a
62 | * match. There is a way to optimize this by
63 | * calculating the minimum chars needed to
64 | * match the remaining pattern but I don't
65 | * think it is worth the work ATM.
66 | */
67 | if (*string == '\0')
68 | return FNM_NOMATCH;
69 |
70 | rv = rl_fnmatch(c, string, flags);
71 | string++;
72 | } while (rv != 0);
73 |
74 | return 0;
75 | /* Match char from list */
76 | case '[':
77 | charmatch = 0;
78 | for (c++; *c != ']'; c++)
79 | {
80 | /* Bad format */
81 | if (*c == '\0')
82 | return FNM_NOMATCH;
83 |
84 | /* Match already found */
85 | if (charmatch)
86 | continue;
87 |
88 | if (*c == *string)
89 | charmatch = 1;
90 | }
91 |
92 | /* No match in list */
93 | if (!charmatch)
94 | return FNM_NOMATCH;
95 |
96 | string++;
97 | break;
98 | /* Has any character */
99 | case '?':
100 | string++;
101 | break;
102 | /* Match following character verbatim */
103 | case '\\':
104 | c++;
105 | /* Dangling escape at end of pattern.
106 | * FIXME: Was c == '\0' (makes no sense).
107 | * Not sure if c == NULL or *c == '\0'
108 | * is intended. Assuming *c due to c++ right before. */
109 | if (*c == '\0')
110 | return FNM_NOMATCH;
111 | default:
112 | if (*c != *string)
113 | return FNM_NOMATCH;
114 | string++;
115 | }
116 | }
117 |
118 | /* End of string and end of pattend */
119 | if (*string == '\0')
120 | return 0;
121 | return FNM_NOMATCH;
122 | }
123 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/compat/compat_getopt.c:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (compat_getopt.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 | #include
28 | #include
29 | #include
30 |
31 | #include
32 |
33 | #include
34 | #include
35 | #include
36 | #include
37 |
38 | #include
39 |
40 | char *optarg;
41 | int optind, opterr, optopt;
42 |
43 | static bool is_short_option(const char *str)
44 | {
45 | return str[0] == '-' && str[1] != '-';
46 | }
47 |
48 | static bool is_long_option(const char *str)
49 | {
50 | return str[0] == '-' && str[1] == '-';
51 | }
52 |
53 | static int find_short_index(char * const *argv)
54 | {
55 | int idx;
56 | for (idx = 0; argv[idx]; idx++)
57 | {
58 | if (is_short_option(argv[idx]))
59 | return idx;
60 | }
61 |
62 | return -1;
63 | }
64 |
65 | static int find_long_index(char * const *argv)
66 | {
67 | int idx;
68 | for (idx = 0; argv[idx]; idx++)
69 | {
70 | if (is_long_option(argv[idx]))
71 | return idx;
72 | }
73 |
74 | return -1;
75 | }
76 |
77 | static int parse_short(const char *optstring, char * const *argv)
78 | {
79 | bool extra_opt, takes_arg, embedded_arg;
80 | const char *opt = NULL;
81 | char arg = argv[0][1];
82 |
83 | if (arg == ':')
84 | return '?';
85 |
86 | opt = strchr(optstring, arg);
87 | if (!opt)
88 | return '?';
89 |
90 | extra_opt = argv[0][2];
91 | takes_arg = opt[1] == ':';
92 |
93 | /* If we take an argument, and we see additional characters,
94 | * this is in fact the argument (i.e. -cfoo is same as -c foo). */
95 | embedded_arg = extra_opt && takes_arg;
96 |
97 | if (takes_arg)
98 | {
99 | if (embedded_arg)
100 | {
101 | optarg = argv[0] + 2;
102 | optind++;
103 | }
104 | else
105 | {
106 | optarg = argv[1];
107 | optind += 2;
108 | }
109 |
110 | return optarg ? opt[0] : '?';
111 | }
112 |
113 | if (embedded_arg)
114 | {
115 | /* If we see additional characters,
116 | * and they don't take arguments, this
117 | * means we have multiple flags in one. */
118 | memmove(&argv[0][1], &argv[0][2], strlen(&argv[0][2]) + 1);
119 | return opt[0];
120 | }
121 |
122 | optind++;
123 | return opt[0];
124 | }
125 |
126 | static int parse_long(const struct option *longopts, char * const *argv)
127 | {
128 | size_t indice;
129 | const struct option *opt = NULL;
130 | for (indice = 0; longopts[indice].name; indice++)
131 | {
132 | if (!strcmp(longopts[indice].name, &argv[0][2]))
133 | {
134 | opt = &longopts[indice];
135 | break;
136 | }
137 | }
138 |
139 | if (!opt)
140 | return '?';
141 |
142 | /* getopt_long has an "optional" arg, but we don't bother with that. */
143 | if (opt->has_arg && !argv[1])
144 | return '?';
145 |
146 | if (opt->has_arg)
147 | {
148 | optarg = argv[1];
149 | optind += 2;
150 | }
151 | else
152 | optind++;
153 |
154 | if (opt->flag)
155 | {
156 | *opt->flag = opt->val;
157 | return 0;
158 | }
159 |
160 | return opt->val;
161 | }
162 |
163 | static void shuffle_block(char **begin, char **last, char **end)
164 | {
165 | ptrdiff_t len = last - begin;
166 | const char **tmp = (const char**)calloc(len, sizeof(const char*));
167 |
168 | retro_assert(tmp);
169 |
170 | memcpy((void*)tmp, begin, len * sizeof(const char*));
171 | memmove(begin, last, (end - last) * sizeof(const char*));
172 | memcpy(end - len, tmp, len * sizeof(const char*));
173 |
174 | free((void*)tmp);
175 | }
176 |
177 | int getopt_long(int argc, char *argv[],
178 | const char *optstring, const struct option *longopts, int *longindex)
179 | {
180 | int short_index, long_index;
181 |
182 | (void)longindex;
183 |
184 | if (optind == 0)
185 | optind = 1;
186 |
187 | if (argc < 2)
188 | return -1;
189 |
190 | short_index = find_short_index(&argv[optind]);
191 | long_index = find_long_index(&argv[optind]);
192 |
193 | /* We're done here. */
194 | if (short_index == -1 && long_index == -1)
195 | return -1;
196 |
197 | /* Reorder argv so that non-options come last.
198 | * Non-POSIXy, but that's what getopt does by default. */
199 | if ((short_index > 0) && ((short_index < long_index) || (long_index == -1)))
200 | {
201 | shuffle_block(&argv[optind], &argv[optind + short_index], &argv[argc]);
202 | short_index = 0;
203 | }
204 | else if ((long_index > 0) && ((long_index < short_index)
205 | || (short_index == -1)))
206 | {
207 | shuffle_block(&argv[optind], &argv[optind + long_index], &argv[argc]);
208 | long_index = 0;
209 | }
210 |
211 | retro_assert(short_index == 0 || long_index == 0);
212 |
213 | if (short_index == 0)
214 | return parse_short(optstring, &argv[optind]);
215 | if (long_index == 0)
216 | return parse_long(longopts, &argv[optind]);
217 |
218 | return '?';
219 | }
220 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/compat/compat_posix_string.c:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (compat_posix_string.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 | #ifdef _WIN32
28 |
29 | #undef strcasecmp
30 | #undef strdup
31 | #undef isblank
32 | #undef strtok_r
33 | #include
34 | #include
35 | #include
36 | #include
37 |
38 | #include
39 |
40 | int retro_strcasecmp__(const char *a, const char *b)
41 | {
42 | while (*a && *b)
43 | {
44 | int a_ = tolower(*a);
45 | int b_ = tolower(*b);
46 |
47 | if (a_ != b_)
48 | return a_ - b_;
49 |
50 | a++;
51 | b++;
52 | }
53 |
54 | return tolower(*a) - tolower(*b);
55 | }
56 |
57 | char *retro_strdup__(const char *orig)
58 | {
59 | size_t len = strlen(orig) + 1;
60 | char *ret = (char*)malloc(len);
61 | if (!ret)
62 | return NULL;
63 |
64 | strlcpy(ret, orig, len);
65 | return ret;
66 | }
67 |
68 | int retro_isblank__(int c)
69 | {
70 | return (c == ' ') || (c == '\t');
71 | }
72 |
73 | char *retro_strtok_r__(char *str, const char *delim, char **saveptr)
74 | {
75 | char *first = NULL;
76 | if (!saveptr || !delim)
77 | return NULL;
78 |
79 | if (str)
80 | *saveptr = str;
81 |
82 | do
83 | {
84 | char *ptr = NULL;
85 | first = *saveptr;
86 | while (*first && strchr(delim, *first))
87 | *first++ = '\0';
88 |
89 | if (*first == '\0')
90 | return NULL;
91 |
92 | ptr = first + 1;
93 |
94 | while (*ptr && !strchr(delim, *ptr))
95 | ptr++;
96 |
97 | *saveptr = ptr + (*ptr ? 1 : 0);
98 | *ptr = '\0';
99 | } while (strlen(first) == 0);
100 |
101 | return first;
102 | }
103 |
104 | #endif
105 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/compat/compat_snprintf.c:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (compat_snprintf.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 | /* THIS FILE HAS NOT BEEN VALIDATED ON PLATFORMS BESIDES MSVC */
24 | #ifdef _MSC_VER
25 |
26 | #include
27 | #include
28 |
29 | #if _MSC_VER < 1800
30 | #define va_copy(dst, src) ((dst) = (src))
31 | #endif
32 |
33 | #if _MSC_VER < 1300
34 | #define _vscprintf c89_vscprintf_retro__
35 |
36 | static int c89_vscprintf_retro__(const char *fmt, va_list pargs)
37 | {
38 | int retval;
39 | va_list argcopy;
40 | va_copy(argcopy, pargs);
41 | retval = vsnprintf(NULL, 0, fmt, argcopy);
42 | va_end(argcopy);
43 | return retval;
44 | }
45 | #endif
46 |
47 | /* http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 */
48 |
49 | int c99_vsnprintf_retro__(char *s, size_t len, const char *fmt, va_list ap)
50 | {
51 | int count = -1;
52 |
53 | if (len != 0)
54 | {
55 | #if (_MSC_VER <= 1310)
56 | count = _vsnprintf(s, len - 1, fmt, ap);
57 | #else
58 | count = _vsnprintf_s(s, len, len - 1, fmt, ap);
59 | #endif
60 | }
61 |
62 | if (count == -1)
63 | count = _vscprintf(fmt, ap);
64 |
65 | /* there was no room for a NULL, so truncate the last character */
66 | if (count == len && len)
67 | s[len - 1] = '\0';
68 |
69 | return count;
70 | }
71 |
72 | int c99_snprintf_retro__(char *s, size_t len, const char *fmt, ...)
73 | {
74 | int count;
75 | va_list ap;
76 |
77 | va_start(ap, fmt);
78 | count = c99_vsnprintf_retro__(s, len, fmt, ap);
79 | va_end(ap);
80 |
81 | return count;
82 | }
83 | #endif
84 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/compat/apple_compat.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (apple_compat.h).
5 | * ---------------------------------------------------------------------------------------
6 | *
7 | * Permission is hereby granted, free of charge,
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 | * to deal in the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | */
22 |
23 | #ifndef __APPLE_COMPAT_H
24 | #define __APPLE_COMPAT_H
25 |
26 | #ifdef __APPLE__
27 | #include
28 | #endif
29 |
30 | #ifdef __OBJC__
31 |
32 | #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4)
33 | typedef int NSInteger;
34 | typedef unsigned NSUInteger;
35 | typedef float CGFloat;
36 | #endif
37 |
38 | #ifndef __has_feature
39 | /* Compatibility with non-Clang compilers. */
40 | #define __has_feature(x) 0
41 | #endif
42 |
43 | #ifndef CF_RETURNS_RETAINED
44 | #if __has_feature(attribute_cf_returns_retained)
45 | #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
46 | #else
47 | #define CF_RETURNS_RETAINED
48 | #endif
49 | #endif
50 |
51 | #ifndef NS_INLINE
52 | #define NS_INLINE inline
53 | #endif
54 |
55 | NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetainCompat(id X)
56 | {
57 | #if __has_feature(objc_arc)
58 | return (__bridge_retained CFTypeRef)X;
59 | #else
60 | return X;
61 | #endif
62 | }
63 |
64 | #endif
65 |
66 | #ifdef IOS
67 | #ifndef __IPHONE_5_0
68 | #warning "This project uses features only available in iOS SDK 5.0 and later."
69 | #endif
70 |
71 | #ifdef __OBJC__
72 | #import
73 | #import
74 | #import
75 | #endif
76 |
77 | #else
78 |
79 | #ifdef __OBJC__
80 | #include
81 | #endif
82 | #endif
83 |
84 | #endif
85 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/compat/getopt.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (getopt.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_GETOPT_H
24 | #define __LIBRETRO_SDK_COMPAT_GETOPT_H
25 |
26 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H)
27 | #include "../../../config.h"
28 | #endif
29 |
30 | /* Custom implementation of the GNU getopt_long for portability.
31 | * Not designed to be fully compatible, but compatible with
32 | * the features RetroArch uses. */
33 |
34 | #ifdef HAVE_GETOPT_LONG
35 | #include
36 | #else
37 | /* Avoid possible naming collisions during link since we
38 | * prefer to use the actual name. */
39 | #define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_retro(argc, argv, optstring, longopts, longindex)
40 |
41 | #include
42 |
43 | RETRO_BEGIN_DECLS
44 |
45 | struct option
46 | {
47 | const char *name;
48 | int has_arg;
49 | int *flag;
50 | int val;
51 | };
52 |
53 | /* argv[] is declared with char * const argv[] in GNU,
54 | * but this makes no sense, as non-POSIX getopt_long
55 | * mutates argv (non-opts are moved to the end). */
56 | int getopt_long(int argc, char *argv[],
57 | const char *optstring, const struct option *longopts, int *longindex);
58 | extern char *optarg;
59 | extern int optind, opterr, optopt;
60 |
61 | RETRO_END_DECLS
62 |
63 | /* If these are variously #defined, then we have bigger problems */
64 | #ifndef no_argument
65 | #define no_argument 0
66 | #define required_argument 1
67 | #define optional_argument 2
68 | #endif
69 |
70 | /* HAVE_GETOPT_LONG */
71 | #endif
72 |
73 | /* pragma once */
74 | #endif
75 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/compat/intrinsics.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (intrinsics.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_INTRINSICS_H
24 | #define __LIBRETRO_SDK_COMPAT_INTRINSICS_H
25 |
26 | #include
27 | #include
28 | #include
29 |
30 | #include
31 | #include
32 |
33 | #if defined(_MSC_VER) && !defined(_XBOX)
34 | #if (_MSC_VER > 1310)
35 | #include
36 | #endif
37 | #endif
38 |
39 | RETRO_BEGIN_DECLS
40 |
41 | /* Count Leading Zero, unsigned 16bit input value */
42 | static INLINE unsigned compat_clz_u16(uint16_t val)
43 | {
44 | #if defined(__GNUC__)
45 | return __builtin_clz(val << 16 | 0x8000);
46 | #else
47 | unsigned ret = 0;
48 |
49 | while(!(val & 0x8000) && ret < 16)
50 | {
51 | val <<= 1;
52 | ret++;
53 | }
54 |
55 | return ret;
56 | #endif
57 | }
58 |
59 | /* Count Trailing Zero */
60 | static INLINE int compat_ctz(unsigned x)
61 | {
62 | #if defined(__GNUC__) && !defined(RARCH_CONSOLE)
63 | return __builtin_ctz(x);
64 | #elif _MSC_VER >= 1400 && !defined(_XBOX) && !defined(__WINRT__)
65 | unsigned long r = 0;
66 | _BitScanForward((unsigned long*)&r, x);
67 | return (int)r;
68 | #else
69 | int count = 0;
70 | if (!(x & 0xffff))
71 | {
72 | x >>= 16;
73 | count |= 16;
74 | }
75 | if (!(x & 0xff))
76 | {
77 | x >>= 8;
78 | count |= 8;
79 | }
80 | if (!(x & 0xf))
81 | {
82 | x >>= 4;
83 | count |= 4;
84 | }
85 | if (!(x & 0x3))
86 | {
87 | x >>= 2;
88 | count |= 2;
89 | }
90 | if (!(x & 0x1))
91 | count |= 1;
92 |
93 | return count;
94 | #endif
95 | }
96 |
97 | RETRO_END_DECLS
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/compat/msvc.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (msvc.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_MSVC_H
24 | #define __LIBRETRO_SDK_COMPAT_MSVC_H
25 |
26 | #ifdef _MSC_VER
27 |
28 | #ifdef __cplusplus
29 | extern "C" {
30 | #endif
31 |
32 | /* Pre-MSVC 2015 compilers don't implement snprintf, vsnprintf in a cross-platform manner. */
33 | #if _MSC_VER < 1900
34 | #include
35 | #include
36 | #include
37 |
38 | #ifndef snprintf
39 | #define snprintf c99_snprintf_retro__
40 | #endif
41 | int c99_snprintf_retro__(char *outBuf, size_t size, const char *format, ...);
42 |
43 | #ifndef vsnprintf
44 | #define vsnprintf c99_vsnprintf_retro__
45 | #endif
46 | int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list ap);
47 | #endif
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 | #undef UNICODE /* Do not bother with UNICODE at this time. */
54 | #include
55 | #include
56 |
57 | #define _USE_MATH_DEFINES
58 | #include
59 |
60 | /* Python headers defines ssize_t and sets HAVE_SSIZE_T.
61 | * Cannot duplicate these efforts.
62 | */
63 | #ifndef HAVE_SSIZE_T
64 | #if defined(_WIN64)
65 | typedef __int64 ssize_t;
66 | #elif defined(_WIN32)
67 | typedef int ssize_t;
68 | #endif
69 | #endif
70 |
71 | #define mkdir(dirname, unused) _mkdir(dirname)
72 | #define strtoull _strtoui64
73 | #undef strcasecmp
74 | #define strcasecmp _stricmp
75 | #undef strncasecmp
76 | #define strncasecmp _strnicmp
77 |
78 | /* Disable some of the annoying warnings. */
79 | #pragma warning(disable : 4800)
80 | #pragma warning(disable : 4805)
81 | #pragma warning(disable : 4244)
82 | #pragma warning(disable : 4305)
83 | #pragma warning(disable : 4146)
84 | #pragma warning(disable : 4267)
85 | #pragma warning(disable : 4723)
86 | #pragma warning(disable : 4996)
87 |
88 | /* roundf and va_copy is available since MSVC 2013 */
89 | #if _MSC_VER < 1800
90 | #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f))
91 | #define va_copy(x, y) ((x) = (y))
92 | #endif
93 |
94 | #if _MSC_VER <= 1310
95 | #ifndef __cplusplus
96 | /* VC6 math.h doesn't define some functions when in C mode.
97 | * Trying to define a prototype gives "undefined reference".
98 | * But providing an implementation then gives "function already has body".
99 | * So the equivalent of the implementations from math.h are used as
100 | * defines here instead, and it seems to work.
101 | */
102 | #define cosf(x) ((float)cos((double)x))
103 | #define powf(x, y) ((float)pow((double)x, (double)y))
104 | #define sinf(x) ((float)sin((double)x))
105 | #define ceilf(x) ((float)ceil((double)x))
106 | #define floorf(x) ((float)floor((double)x))
107 | #define sqrtf(x) ((float)sqrt((double)x))
108 | #define fabsf(x) ((float)fabs((double)(x)))
109 | #endif
110 |
111 | #ifndef _strtoui64
112 | #define _strtoui64(x, y, z) (_atoi64(x))
113 | #endif
114 |
115 | #endif
116 |
117 | #ifndef PATH_MAX
118 | #define PATH_MAX _MAX_PATH
119 | #endif
120 |
121 | #ifndef SIZE_MAX
122 | #define SIZE_MAX _UI32_MAX
123 | #endif
124 |
125 | #endif
126 | #endif
127 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/compat/msvc/stdint.h:
--------------------------------------------------------------------------------
1 | /* ISO C9x compliant stdint.h for Microsoft Visual Studio
2 | * Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3 | *
4 | * Copyright (c) 2006-2008 Alexander Chemeris
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * 3. The name of the author may be used to endorse or promote products
17 | * derived from this software without specific prior written permission.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
20 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | */
30 |
31 | #ifndef __RARCH_STDINT_H
32 | #define __RARCH_STDINT_H
33 |
34 | #if _MSC_VER && (_MSC_VER < 1600)
35 | /* Pre-MSVC 2010 needs an implementation of stdint.h. */
36 |
37 | #if _MSC_VER > 1000
38 | #pragma once
39 | #endif
40 |
41 | #include
42 |
43 | /* For Visual Studio 6 in C++ mode and for many Visual Studio versions when
44 | * compiling for ARM we should wrap include with 'extern "C++" {}'
45 | * or compiler give many errors like this:
46 | *
47 | * error C2733: second C linkage of overloaded function 'wmemchr' not allowed
48 | */
49 | #ifdef __cplusplus
50 | #if _MSC_VER <= 1200
51 | extern "C++" {
52 | #else
53 | extern "C" {
54 | #endif
55 | #endif
56 | # include
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | /* Define _W64 macros to mark types changing their size, like intptr_t. */
62 | #ifndef _W64
63 | # if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
64 | # define _W64 __w64
65 | # else
66 | # define _W64
67 | # endif
68 | #endif
69 |
70 | /* 7.18.1 Integer types. */
71 |
72 | /* 7.18.1.1 Exact-width integer types. */
73 |
74 | /* Visual Studio 6 and Embedded Visual C++ 4 doesn't
75 | * realize that, e.g. char has the same size as __int8
76 | * so we give up on __intX for them.
77 | */
78 | #if (_MSC_VER < 1300)
79 | typedef signed char int8_t;
80 | typedef signed short int16_t;
81 | typedef signed int int32_t;
82 | typedef unsigned char uint8_t;
83 | typedef unsigned short uint16_t;
84 | typedef unsigned int uint32_t;
85 | #else
86 | typedef signed __int8 int8_t;
87 | typedef signed __int16 int16_t;
88 | typedef signed __int32 int32_t;
89 | typedef unsigned __int8 uint8_t;
90 | typedef unsigned __int16 uint16_t;
91 | typedef unsigned __int32 uint32_t;
92 | #endif
93 | typedef signed __int64 int64_t;
94 | typedef unsigned __int64 uint64_t;
95 |
96 | /* 7.18.1.2 Minimum-width integer types. */
97 | typedef int8_t int_least8_t;
98 | typedef int16_t int_least16_t;
99 | typedef int32_t int_least32_t;
100 | typedef int64_t int_least64_t;
101 | typedef uint8_t uint_least8_t;
102 | typedef uint16_t uint_least16_t;
103 | typedef uint32_t uint_least32_t;
104 | typedef uint64_t uint_least64_t;
105 |
106 | /* 7.18.1.3 Fastest minimum-width integer types. */
107 | typedef int8_t int_fast8_t;
108 | typedef int16_t int_fast16_t;
109 | typedef int32_t int_fast32_t;
110 | typedef int64_t int_fast64_t;
111 | typedef uint8_t uint_fast8_t;
112 | typedef uint16_t uint_fast16_t;
113 | typedef uint32_t uint_fast32_t;
114 | typedef uint64_t uint_fast64_t;
115 |
116 | /* 7.18.1.4 Integer types capable of holding object pointers. */
117 | #ifdef _WIN64 /* [ */
118 | typedef signed __int64 intptr_t;
119 | typedef unsigned __int64 uintptr_t;
120 | #else /* _WIN64 ][ */
121 | typedef _W64 signed int intptr_t;
122 | typedef _W64 unsigned int uintptr_t;
123 | #endif /* _WIN64 ] */
124 |
125 | /* 7.18.1.5 Greatest-width integer types. */
126 | typedef int64_t intmax_t;
127 | typedef uint64_t uintmax_t;
128 |
129 | /* 7.18.2 Limits of specified-width integer types. */
130 |
131 | #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
132 | /* [ See footnote 220 at page 257 and footnote 221 at page 259. */
133 |
134 | /* 7.18.2.1 Limits of exact-width integer types. */
135 | #define INT8_MIN ((int8_t)_I8_MIN)
136 | #define INT8_MAX _I8_MAX
137 | #define INT16_MIN ((int16_t)_I16_MIN)
138 | #define INT16_MAX _I16_MAX
139 | #define INT32_MIN ((int32_t)_I32_MIN)
140 | #define INT32_MAX _I32_MAX
141 | #define INT64_MIN ((int64_t)_I64_MIN)
142 | #define INT64_MAX _I64_MAX
143 | #define UINT8_MAX _UI8_MAX
144 | #define UINT16_MAX _UI16_MAX
145 | #define UINT32_MAX _UI32_MAX
146 | #define UINT64_MAX _UI64_MAX
147 |
148 | /* 7.18.2.2 Limits of minimum-width integer types. */
149 | #define INT_LEAST8_MIN INT8_MIN
150 | #define INT_LEAST8_MAX INT8_MAX
151 | #define INT_LEAST16_MIN INT16_MIN
152 | #define INT_LEAST16_MAX INT16_MAX
153 | #define INT_LEAST32_MIN INT32_MIN
154 | #define INT_LEAST32_MAX INT32_MAX
155 | #define INT_LEAST64_MIN INT64_MIN
156 | #define INT_LEAST64_MAX INT64_MAX
157 | #define UINT_LEAST8_MAX UINT8_MAX
158 | #define UINT_LEAST16_MAX UINT16_MAX
159 | #define UINT_LEAST32_MAX UINT32_MAX
160 | #define UINT_LEAST64_MAX UINT64_MAX
161 |
162 | /* 7.18.2.3 Limits of fastest minimum-width integer types. */
163 | #define INT_FAST8_MIN INT8_MIN
164 | #define INT_FAST8_MAX INT8_MAX
165 | #define INT_FAST16_MIN INT16_MIN
166 | #define INT_FAST16_MAX INT16_MAX
167 | #define INT_FAST32_MIN INT32_MIN
168 | #define INT_FAST32_MAX INT32_MAX
169 | #define INT_FAST64_MIN INT64_MIN
170 | #define INT_FAST64_MAX INT64_MAX
171 | #define UINT_FAST8_MAX UINT8_MAX
172 | #define UINT_FAST16_MAX UINT16_MAX
173 | #define UINT_FAST32_MAX UINT32_MAX
174 | #define UINT_FAST64_MAX UINT64_MAX
175 |
176 | /* 7.18.2.4 Limits of integer types capable of holding object pointers. */
177 | #ifdef _WIN64 /* [ */
178 | # define INTPTR_MIN INT64_MIN
179 | # define INTPTR_MAX INT64_MAX
180 | # define UINTPTR_MAX UINT64_MAX
181 | #else /* _WIN64 ][ */
182 | # define INTPTR_MIN INT32_MIN
183 | # define INTPTR_MAX INT32_MAX
184 | # define UINTPTR_MAX UINT32_MAX
185 | #endif /* _WIN64 ] */
186 |
187 | /* 7.18.2.5 Limits of greatest-width integer types */
188 | #define INTMAX_MIN INT64_MIN
189 | #define INTMAX_MAX INT64_MAX
190 | #define UINTMAX_MAX UINT64_MAX
191 |
192 | /* 7.18.3 Limits of other integer types */
193 |
194 | #ifdef _WIN64 /* [ */
195 | # define PTRDIFF_MIN _I64_MIN
196 | # define PTRDIFF_MAX _I64_MAX
197 | #else /* _WIN64 ][ */
198 | # define PTRDIFF_MIN _I32_MIN
199 | # define PTRDIFF_MAX _I32_MAX
200 | #endif /* _WIN64 ] */
201 |
202 | #define SIG_ATOMIC_MIN INT_MIN
203 | #define SIG_ATOMIC_MAX INT_MAX
204 |
205 | #ifndef SIZE_MAX /* [ */
206 | # ifdef _WIN64 /* [ */
207 | # define SIZE_MAX _UI64_MAX
208 | # else /* _WIN64 ][ */
209 | # define SIZE_MAX _UI32_MAX
210 | # endif /* _WIN64 ] */
211 | #endif /* SIZE_MAX ] */
212 |
213 | /* WCHAR_MIN and WCHAR_MAX are also defined in */
214 | #ifndef WCHAR_MIN /* [ */
215 | # define WCHAR_MIN 0
216 | #endif /* WCHAR_MIN ] */
217 | #ifndef WCHAR_MAX // [
218 | # define WCHAR_MAX _UI16_MAX
219 | #endif /* WCHAR_MAX ] */
220 |
221 | #define WINT_MIN 0
222 | #define WINT_MAX _UI16_MAX
223 |
224 | #endif /* __STDC_LIMIT_MACROS ] */
225 |
226 | /* 7.18.4 Limits of other integer types */
227 |
228 | #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
229 | /* [ See footnote 224 at page 260 */
230 |
231 | /* 7.18.4.1 Macros for minimum-width integer constants */
232 |
233 | #define INT8_C(val) val##i8
234 | #define INT16_C(val) val##i16
235 | #define INT32_C(val) val##i32
236 | #define INT64_C(val) val##i64
237 |
238 | #define UINT8_C(val) val##ui8
239 | #define UINT16_C(val) val##ui16
240 | #define UINT32_C(val) val##ui32
241 | #define UINT64_C(val) val##ui64
242 |
243 | /* 7.18.4.2 Macros for greatest-width integer constants */
244 | #define INTMAX_C INT64_C
245 | #define UINTMAX_C UINT64_C
246 |
247 | #endif
248 | /* __STDC_CONSTANT_MACROS ] */
249 |
250 | #else
251 | /* Sanity for everything else. */
252 | #include
253 | #endif
254 |
255 | #endif
256 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/compat/zutil.h:
--------------------------------------------------------------------------------
1 | #ifndef _COMPAT_ZUTIL_H
2 | #define _COMPAT_ZUTIL_H
3 |
4 | #ifdef WANT_ZLIB
5 |
6 | /* zutil.h -- internal interface and configuration of the compression library
7 | * Copyright (C) 1995-2013 Jean-loup Gailly.
8 | * For conditions of distribution and use, see copyright notice in zlib.h
9 | */
10 |
11 | /* WARNING: this file should *not* be used by applications. It is
12 | part of the implementation of the compression library and is
13 | subject to change. Applications should only use zlib.h.
14 | */
15 |
16 | /* @(#) $Id$ */
17 |
18 | #ifndef ZUTIL_H
19 | #define ZUTIL_H
20 |
21 | #ifdef HAVE_HIDDEN
22 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
23 | #else
24 | # define ZLIB_INTERNAL
25 | #endif
26 |
27 | #include
28 |
29 | #if defined(STDC) && !defined(Z_SOLO)
30 | # if !(defined(_WIN32_WCE) && defined(_MSC_VER))
31 | # include
32 | # endif
33 | # include
34 | # include
35 | #endif
36 |
37 | #ifdef Z_SOLO
38 | typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
39 | #endif
40 |
41 | #ifndef local
42 | # define local static
43 | #endif
44 | /* compile with -Dlocal if your debugger can't find static symbols */
45 |
46 | typedef unsigned char uch;
47 | typedef uch FAR uchf;
48 | typedef unsigned short ush;
49 | typedef ush FAR ushf;
50 | typedef unsigned long ulg;
51 |
52 | extern char z_errmsg[10][21]; /* indexed by 2-zlib_error */
53 | /* (array size given to avoid silly warnings with Visual C++) */
54 | /* (array entry size given to avoid silly string cast warnings) */
55 |
56 | #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
57 |
58 | #define ERR_RETURN(strm,err) \
59 | return (strm->msg = ERR_MSG(err), (err))
60 | /* To be used only when the state is known to be valid */
61 |
62 | /* common constants */
63 |
64 | #ifndef DEF_WBITS
65 | # define DEF_WBITS MAX_WBITS
66 | #endif
67 | /* default windowBits for decompression. MAX_WBITS is for compression only */
68 |
69 | #if MAX_MEM_LEVEL >= 8
70 | # define DEF_MEM_LEVEL 8
71 | #else
72 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL
73 | #endif
74 | /* default memLevel */
75 |
76 | #define STORED_BLOCK 0
77 | #define STATIC_TREES 1
78 | #define DYN_TREES 2
79 | /* The three kinds of block type */
80 |
81 | #define MIN_MATCH 3
82 | #define MAX_MATCH 258
83 | /* The minimum and maximum match lengths */
84 |
85 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
86 |
87 | /* target dependencies */
88 |
89 | #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
90 | # define OS_CODE 0x00
91 | # ifndef Z_SOLO
92 | # if defined(__TURBOC__) || defined(__BORLANDC__)
93 | # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
94 | /* Allow compilation with ANSI keywords only enabled */
95 | void _Cdecl farfree( void *block );
96 | void *_Cdecl farmalloc( unsigned long nbytes );
97 | # else
98 | # include
99 | # endif
100 | # else /* MSC or DJGPP */
101 | # include
102 | # endif
103 | # endif
104 | #endif
105 |
106 | #ifdef AMIGA
107 | # define OS_CODE 0x01
108 | #endif
109 |
110 | #if defined(VAXC) || defined(VMS)
111 | # define OS_CODE 0x02
112 | # define F_OPEN(name, mode) \
113 | fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
114 | #endif
115 |
116 | #if defined(ATARI) || defined(atarist)
117 | # define OS_CODE 0x05
118 | #endif
119 |
120 | #ifdef OS2
121 | # define OS_CODE 0x06
122 | # if defined(M_I86) && !defined(Z_SOLO)
123 | # include
124 | # endif
125 | #endif
126 |
127 | #if defined(MACOS) || defined(TARGET_OS_MAC)
128 | # define OS_CODE 0x07
129 | # ifndef Z_SOLO
130 | # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
131 | # include /* for fdopen */
132 | # else
133 | # ifndef fdopen
134 | # define fdopen(fd,mode) NULL /* No fdopen() */
135 | # endif
136 | # endif
137 | # endif
138 | #endif
139 |
140 | #ifdef TOPS20
141 | # define OS_CODE 0x0a
142 | #endif
143 |
144 | #ifdef WIN32
145 | # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
146 | # define OS_CODE 0x0b
147 | # endif
148 | #endif
149 |
150 | #ifdef __50SERIES /* Prime/PRIMOS */
151 | # define OS_CODE 0x0f
152 | #endif
153 |
154 | #if defined(_BEOS_) || defined(RISCOS)
155 | # define fdopen(fd,mode) NULL /* No fdopen() */
156 | #endif
157 |
158 | #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
159 | # if defined(_WIN32_WCE)
160 | # define fdopen(fd,mode) NULL /* No fdopen() */
161 | # ifndef _PTRDIFF_T_DEFINED
162 | typedef int ptrdiff_t;
163 | # define _PTRDIFF_T_DEFINED
164 | # endif
165 | # else
166 | # define fdopen(fd,type) _fdopen(fd,type)
167 | # endif
168 | #endif
169 |
170 | #if defined(__BORLANDC__) && !defined(MSDOS)
171 | #pragma warn -8004
172 | #pragma warn -8008
173 | #pragma warn -8066
174 | #endif
175 |
176 | /* provide prototypes for these when building zlib without LFS */
177 | #if !defined(_WIN32) && \
178 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
179 | uLong adler32_combine64 (uLong, uLong, z_off_t);
180 | uLong crc32_combine64 (uLong, uLong, z_off_t);
181 | #endif
182 |
183 | /* common defaults */
184 |
185 | #ifndef OS_CODE
186 | # define OS_CODE 0x03 /* assume Unix */
187 | #endif
188 |
189 | #ifndef F_OPEN
190 | # define F_OPEN(name, mode) fopen((name), (mode))
191 | #endif
192 |
193 | /* functions */
194 |
195 | #if defined(pyr) || defined(Z_SOLO)
196 | # define NO_MEMCPY
197 | #endif
198 | #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
199 | /* Use our own functions for small and medium model with MSC <= 5.0.
200 | * You may have to use the same strategy for Borland C (untested).
201 | * The __SC__ check is for Symantec.
202 | */
203 | # define NO_MEMCPY
204 | #endif
205 | #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
206 | # define HAVE_MEMCPY
207 | #endif
208 | #ifdef HAVE_MEMCPY
209 | # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
210 | # define zmemcpy _fmemcpy
211 | # define zmemcmp _fmemcmp
212 | # define zmemzero(dest, len) _fmemset(dest, 0, len)
213 | # else
214 | # define zmemcpy memcpy
215 | # define zmemcmp memcmp
216 | # define zmemzero(dest, len) memset(dest, 0, len)
217 | # endif
218 | #else
219 | void ZLIB_INTERNAL zmemcpy (Bytef* dest, const Bytef* source, uInt len);
220 | int ZLIB_INTERNAL zmemcmp (const Bytef* s1, const Bytef* s2, uInt len);
221 | void ZLIB_INTERNAL zmemzero (Bytef* dest, uInt len);
222 | #endif
223 |
224 | /* Diagnostic functions */
225 | # define Assert(cond,msg)
226 | # define Trace(x)
227 | # define Tracev(x)
228 | # define Tracevv(x)
229 | # define Tracec(c,x)
230 | # define Tracecv(c,x)
231 |
232 | #ifndef Z_SOLO
233 | voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items,
234 | unsigned size);
235 | void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr);
236 | #endif
237 |
238 | #define ZALLOC(strm, items, size) \
239 | (*((strm)->zalloc))((strm)->opaque, (items), (size))
240 | #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
241 | #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
242 |
243 | /* Reverse the bytes in a 32-bit value */
244 | #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
245 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
246 |
247 | #endif /* ZUTIL_H */
248 |
249 | #else
250 | #include
251 | #endif
252 |
253 | #endif
254 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/retro_common_api.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (retro_common_api.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_API_H
24 | #define _LIBRETRO_COMMON_RETRO_COMMON_API_H
25 |
26 | /*
27 | This file is designed to normalize the libretro-common compiling environment
28 | for public API headers. This should be leaner than a normal compiling environment,
29 | since it gets #included into other project's sources.
30 | */
31 |
32 | /* ------------------------------------ */
33 |
34 | /*
35 | Ordinarily we want to put #ifdef __cplusplus extern "C" in C library
36 | headers to enable them to get used by c++ sources.
37 | However, we want to support building this library as C++ as well, so a
38 | special technique is called for.
39 | */
40 |
41 | #define RETRO_BEGIN_DECLS
42 | #define RETRO_END_DECLS
43 |
44 | #ifdef __cplusplus
45 |
46 | #ifdef CXX_BUILD
47 | /* build wants everything to be built as c++, so no extern "C" */
48 | #else
49 | #undef RETRO_BEGIN_DECLS
50 | #undef RETRO_END_DECLS
51 | #define RETRO_BEGIN_DECLS extern "C" {
52 | #define RETRO_END_DECLS }
53 | #endif
54 |
55 | #else
56 |
57 | /* header is included by a C source file, so no extern "C" */
58 |
59 | #endif
60 |
61 | /*
62 | IMO, this non-standard ssize_t should not be used.
63 | However, it's a good example of how to handle something like this.
64 | */
65 | #ifdef _MSC_VER
66 | #ifndef HAVE_SSIZE_T
67 | #define HAVE_SSIZE_T
68 | #if defined(_WIN64)
69 | typedef __int64 ssize_t;
70 | #elif defined(_WIN32)
71 | typedef int ssize_t;
72 | #endif
73 | #endif
74 | #elif defined(__MACH__)
75 | #include
76 | #endif
77 |
78 | #ifdef _MSC_VER
79 | #if _MSC_VER >= 1800
80 | #include
81 | #else
82 | #ifndef PRId64
83 | #define PRId64 "I64d"
84 | #define PRIu64 "I64u"
85 | #define PRIuPTR "Iu"
86 | #endif
87 | #endif
88 | #else
89 | /* C++11 says this one isn't needed, but apparently (some versions of) mingw require it anyways */
90 | /* https://stackoverflow.com/questions/8132399/how-to-printf-uint64-t-fails-with-spurious-trailing-in-format */
91 | /* https://github.com/libretro/RetroArch/issues/6009 */
92 | #ifndef __STDC_FORMAT_MACROS
93 | #define __STDC_FORMAT_MACROS 1
94 | #endif
95 | #include
96 | #endif
97 | #ifndef PRId64
98 | #error "inttypes.h is being screwy"
99 | #endif
100 | #define STRING_REP_INT64 "%" PRId64
101 | #define STRING_REP_UINT64 "%" PRIu64
102 | #define STRING_REP_USIZE "%" PRIuPTR
103 |
104 | /*
105 | I would like to see retro_inline.h moved in here; possibly boolean too.
106 |
107 | rationale: these are used in public APIs, and it is easier to find problems
108 | and write code that works the first time portably when theyre included uniformly
109 | than to do the analysis from scratch each time you think you need it, for each feature.
110 |
111 | Moreover it helps force you to make hard decisions: if you EVER bring in boolean.h,
112 | then you should pay the price everywhere, so you can see how much grief it will cause.
113 |
114 | Of course, another school of thought is that you should do as little damage as possible
115 | in as few places as possible...
116 | */
117 |
118 | /* _LIBRETRO_COMMON_RETRO_COMMON_API_H */
119 | #endif
120 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/retro_environment.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (retro_environment.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_ENVIRONMENT_H
24 | #define __LIBRETRO_SDK_ENVIRONMENT_H
25 |
26 | /*
27 | This file is designed to create a normalized environment for compiling
28 | libretro-common's private implementations, or any other sources which might
29 | enjoy use of it's environment (RetroArch for instance).
30 | This should be an elaborately crafted environment so that sources don't
31 | need to be full of platform-specific workarounds.
32 | */
33 |
34 | #if defined (__cplusplus)
35 | #if 0
36 | printf("This is C++, version %d.\n", __cplusplus);
37 | #endif
38 | /* The expected values would be
39 | * 199711L, for ISO/IEC 14882:1998 or 14882:2003
40 | */
41 |
42 | #elif defined(__STDC__)
43 | /* This is standard C. */
44 |
45 | #if (__STDC__ == 1)
46 | /* The implementation is ISO-conforming. */
47 | #define __STDC_ISO__
48 | #else
49 | /* The implementation is not ISO-conforming. */
50 | #endif
51 |
52 | #if defined(__STDC_VERSION__)
53 | #if (__STDC_VERSION__ >= 201112L)
54 | /* This is C11. */
55 | #define __STDC_C11__
56 | #elif (__STDC_VERSION__ >= 199901L)
57 | /* This is C99. */
58 | #define __STDC_C99__
59 | #elif (__STDC_VERSION__ >= 199409L)
60 | /* This is C89 with amendment 1. */
61 | #define __STDC_C89__
62 | #define __STDC_C89_AMENDMENT_1__
63 | #else
64 | /* This is C89 without amendment 1. */
65 | #define __STDC_C89__
66 | #endif
67 | #else /* !defined(__STDC_VERSION__) */
68 | /* This is C89. __STDC_VERSION__ is not defined. */
69 | #define __STDC_C89__
70 | #endif
71 |
72 | #else /* !defined(__STDC__) */
73 | /* This is not standard C. __STDC__ is not defined. */
74 | #endif
75 |
76 | #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
77 | /* Try to find out if we're compiling for WinRT or non-WinRT */
78 | #if defined(_MSC_VER) && defined(__has_include)
79 | #if __has_include()
80 | #define HAVE_WINAPIFAMILY_H 1
81 | #else
82 | #define HAVE_WINAPIFAMILY_H 0
83 | #endif
84 |
85 | /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
86 | #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
87 | #define HAVE_WINAPIFAMILY_H 1
88 | #else
89 | #define HAVE_WINAPIFAMILY_H 0
90 | #endif
91 |
92 | #if HAVE_WINAPIFAMILY_H
93 | #include
94 | #define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
95 | #else
96 | #define WINAPI_FAMILY_WINRT 0
97 | #endif /* HAVE_WINAPIFAMILY_H */
98 |
99 | #if WINAPI_FAMILY_WINRT
100 | #undef __WINRT__
101 | #define __WINRT__ 1
102 | #endif
103 |
104 | /* MSVC obviously has to have some non-standard constants... */
105 | #if _M_IX86_FP == 1
106 | #define __SSE__ 1
107 | #elif _M_IX86_FP == 2 || (defined(_M_AMD64) || defined(_M_X64))
108 | #define __SSE__ 1
109 | #define __SSE2__ 1
110 | #endif
111 |
112 | #endif
113 |
114 | #endif
115 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/retro_miscellaneous.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (retro_miscellaneous.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 __RARCH_MISCELLANEOUS_H
24 | #define __RARCH_MISCELLANEOUS_H
25 |
26 | #define RARCH_MAX_SUBSYSTEMS 10
27 | #define RARCH_MAX_SUBSYSTEM_ROMS 10
28 |
29 | #include
30 | #include
31 | #include
32 |
33 | #if defined(_WIN32)
34 |
35 | #if defined(_XBOX)
36 | #include
37 | #else
38 | #ifndef WIN32_LEAN_AND_MEAN
39 | #define WIN32_LEAN_AND_MEAN
40 | #endif
41 | #include
42 | #endif
43 |
44 | #endif
45 |
46 | #include
47 |
48 | #ifdef _MSC_VER
49 | #include
50 | #endif
51 |
52 | static INLINE void bits_or_bits(uint32_t *a, uint32_t *b, uint32_t count)
53 | {
54 | uint32_t i;
55 | for (i = 0; i < count;i++)
56 | a[i] |= b[i];
57 | }
58 |
59 | static INLINE void bits_clear_bits(uint32_t *a, uint32_t *b, uint32_t count)
60 | {
61 | uint32_t i;
62 | for (i = 0; i < count;i++)
63 | a[i] &= ~b[i];
64 | }
65 |
66 | static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
67 | {
68 | uint32_t i;
69 | for (i = 0; i < count; i++)
70 | {
71 | if (ptr[i] != 0)
72 | return true;
73 | }
74 | return false;
75 | }
76 |
77 | #ifndef PATH_MAX_LENGTH
78 | #if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(ORBIS) || defined(__PSL1GHT__) || defined(__PS3__)
79 | #define PATH_MAX_LENGTH 512
80 | #else
81 | #define PATH_MAX_LENGTH 4096
82 | #endif
83 | #endif
84 |
85 | #ifndef NAME_MAX_LENGTH
86 | #define NAME_MAX_LENGTH 256
87 | #endif
88 |
89 | #ifndef MAX
90 | #define MAX(a, b) ((a) > (b) ? (a) : (b))
91 | #endif
92 |
93 | #ifndef MIN
94 | #define MIN(a, b) ((a) < (b) ? (a) : (b))
95 | #endif
96 |
97 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
98 |
99 | #define BITS_GET_ELEM(a, i) ((a).data[i])
100 | #define BITS_GET_ELEM_PTR(a, i) ((a)->data[i])
101 |
102 | #define BIT_SET(a, bit) ((a)[(bit) >> 3] |= (1 << ((bit) & 7)))
103 | #define BIT_CLEAR(a, bit) ((a)[(bit) >> 3] &= ~(1 << ((bit) & 7)))
104 | #define BIT_GET(a, bit) (((a)[(bit) >> 3] >> ((bit) & 7)) & 1)
105 |
106 | #define BIT16_SET(a, bit) ((a) |= (1 << ((bit) & 15)))
107 | #define BIT16_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 15)))
108 | #define BIT16_GET(a, bit) (((a) >> ((bit) & 15)) & 1)
109 | #define BIT16_CLEAR_ALL(a) ((a) = 0)
110 |
111 | #define BIT32_SET(a, bit) ((a) |= (UINT32_C(1) << ((bit) & 31)))
112 | #define BIT32_CLEAR(a, bit) ((a) &= ~(UINT32_C(1) << ((bit) & 31)))
113 | #define BIT32_GET(a, bit) (((a) >> ((bit) & 31)) & 1)
114 | #define BIT32_CLEAR_ALL(a) ((a) = 0)
115 |
116 | #define BIT64_SET(a, bit) ((a) |= (UINT64_C(1) << ((bit) & 63)))
117 | #define BIT64_CLEAR(a, bit) ((a) &= ~(UINT64_C(1) << ((bit) & 63)))
118 | #define BIT64_GET(a, bit) (((a) >> ((bit) & 63)) & 1)
119 | #define BIT64_CLEAR_ALL(a) ((a) = 0)
120 |
121 | #define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (UINT32_C(1) << ((bit) & 31)))
122 | #define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(UINT32_C(1) << ((bit) & 31)))
123 | #define BIT128_GET(a, bit) (((a).data[(bit) >> 5] >> ((bit) & 31)) & 1)
124 | #define BIT128_CLEAR_ALL(a) memset(&(a), 0, sizeof(a))
125 |
126 | #define BIT128_SET_PTR(a, bit) BIT128_SET(*a, bit)
127 | #define BIT128_CLEAR_PTR(a, bit) BIT128_CLEAR(*a, bit)
128 | #define BIT128_GET_PTR(a, bit) BIT128_GET(*a, bit)
129 | #define BIT128_CLEAR_ALL_PTR(a) BIT128_CLEAR_ALL(*a)
130 |
131 | #define BIT256_SET(a, bit) BIT128_SET(a, bit)
132 | #define BIT256_CLEAR(a, bit) BIT128_CLEAR(a, bit)
133 | #define BIT256_GET(a, bit) BIT128_GET(a, bit)
134 | #define BIT256_CLEAR_ALL(a) BIT128_CLEAR_ALL(a)
135 |
136 | #define BIT256_SET_PTR(a, bit) BIT256_SET(*a, bit)
137 | #define BIT256_CLEAR_PTR(a, bit) BIT256_CLEAR(*a, bit)
138 | #define BIT256_GET_PTR(a, bit) BIT256_GET(*a, bit)
139 | #define BIT256_CLEAR_ALL_PTR(a) BIT256_CLEAR_ALL(*a)
140 |
141 | #define BIT512_SET(a, bit) BIT256_SET(a, bit)
142 | #define BIT512_CLEAR(a, bit) BIT256_CLEAR(a, bit)
143 | #define BIT512_GET(a, bit) BIT256_GET(a, bit)
144 | #define BIT512_CLEAR_ALL(a) BIT256_CLEAR_ALL(a)
145 |
146 | #define BIT512_SET_PTR(a, bit) BIT512_SET(*a, bit)
147 | #define BIT512_CLEAR_PTR(a, bit) BIT512_CLEAR(*a, bit)
148 | #define BIT512_GET_PTR(a, bit) BIT512_GET(*a, bit)
149 | #define BIT512_CLEAR_ALL_PTR(a) BIT512_CLEAR_ALL(*a)
150 |
151 | #define BITS_COPY16_PTR(a,bits) \
152 | { \
153 | BIT128_CLEAR_ALL_PTR(a); \
154 | BITS_GET_ELEM_PTR(a, 0) = (bits) & 0xffff; \
155 | }
156 |
157 | #define BITS_COPY32_PTR(a,bits) \
158 | { \
159 | BIT128_CLEAR_ALL_PTR(a); \
160 | BITS_GET_ELEM_PTR(a, 0) = (bits); \
161 | }
162 |
163 | #define BITS_COPY64_PTR(a,bits) \
164 | { \
165 | BIT128_CLEAR_ALL_PTR(a); \
166 | BITS_GET_ELEM_PTR(a, 0) = (bits); \
167 | BITS_GET_ELEM_PTR(a, 1) = (bits >> 32); \
168 | }
169 |
170 | /* Helper macros and struct to keep track of many booleans. */
171 | /* This struct has 256 bits. */
172 | typedef struct
173 | {
174 | uint32_t data[8];
175 | } retro_bits_t;
176 |
177 | /* This struct has 512 bits. */
178 | typedef struct
179 | {
180 | uint32_t data[16];
181 | } retro_bits_512_t;
182 |
183 | #ifdef _WIN32
184 | # ifdef _WIN64
185 | # define PRI_SIZET PRIu64
186 | # else
187 | # if _MSC_VER == 1800
188 | # define PRI_SIZET PRIu32
189 | # else
190 | # define PRI_SIZET "u"
191 | # endif
192 | # endif
193 | #elif defined(PS2)
194 | # define PRI_SIZET "u"
195 | #else
196 | # if (SIZE_MAX == 0xFFFF)
197 | # define PRI_SIZET "hu"
198 | # elif (SIZE_MAX == 0xFFFFFFFF)
199 | # define PRI_SIZET "u"
200 | # elif (SIZE_MAX == 0xFFFFFFFFFFFFFFFF)
201 | # define PRI_SIZET "lu"
202 | # else
203 | # error PRI_SIZET: unknown SIZE_MAX
204 | # endif
205 | #endif
206 |
207 | #endif
208 |
--------------------------------------------------------------------------------
/src/deps/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 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/vfs/vfs.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (vfs_implementation.h).
5 | * ---------------------------------------------------------------------------------------
6 | *
7 | * Permission is hereby granted, free of charge,
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 | * to deal in the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | */
22 |
23 | #ifndef __LIBRETRO_SDK_VFS_H
24 | #define __LIBRETRO_SDK_VFS_H
25 |
26 | #include
27 | #include
28 |
29 | #ifdef RARCH_INTERNAL
30 | #ifndef VFS_FRONTEND
31 | #define VFS_FRONTEND
32 | #endif
33 | #endif
34 |
35 | RETRO_BEGIN_DECLS
36 |
37 | #ifdef _WIN32
38 | typedef void* HANDLE;
39 | #endif
40 |
41 | #ifdef HAVE_CDROM
42 | typedef struct
43 | {
44 | int64_t byte_pos;
45 | char *cue_buf;
46 | size_t cue_len;
47 | unsigned cur_lba;
48 | unsigned last_frame_lba;
49 | unsigned char cur_min;
50 | unsigned char cur_sec;
51 | unsigned char cur_frame;
52 | unsigned char cur_track;
53 | unsigned char last_frame[2352];
54 | char drive;
55 | bool last_frame_valid;
56 | } vfs_cdrom_t;
57 | #endif
58 |
59 | enum vfs_scheme
60 | {
61 | VFS_SCHEME_NONE = 0,
62 | VFS_SCHEME_CDROM
63 | };
64 |
65 | #ifndef __WINRT__
66 | #ifdef VFS_FRONTEND
67 | struct retro_vfs_file_handle
68 | #else
69 | struct libretro_vfs_implementation_file
70 | #endif
71 | {
72 | #ifdef HAVE_CDROM
73 | vfs_cdrom_t cdrom; /* int64_t alignment */
74 | #endif
75 | int64_t size;
76 | uint64_t mappos;
77 | uint64_t mapsize;
78 | FILE *fp;
79 | #ifdef _WIN32
80 | HANDLE fh;
81 | #endif
82 | char *buf;
83 | char* orig_path;
84 | uint8_t *mapped;
85 | int fd;
86 | unsigned hints;
87 | enum vfs_scheme scheme;
88 | };
89 | #endif
90 |
91 | /* Replace the following symbol with something appropriate
92 | * to signify the file is being compiled for a front end instead of a core.
93 | * This allows the same code to act as reference implementation
94 | * for VFS and as fallbacks for when the front end does not provide VFS functionality.
95 | */
96 |
97 | #ifdef VFS_FRONTEND
98 | typedef struct retro_vfs_file_handle libretro_vfs_implementation_file;
99 | #else
100 | typedef struct libretro_vfs_implementation_file libretro_vfs_implementation_file;
101 | #endif
102 |
103 | #ifdef VFS_FRONTEND
104 | typedef struct retro_vfs_dir_handle libretro_vfs_implementation_dir;
105 | #else
106 | typedef struct libretro_vfs_implementation_dir libretro_vfs_implementation_dir;
107 | #endif
108 |
109 | RETRO_END_DECLS
110 |
111 | #endif
112 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/vfs/vfs_implementation.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (vfs_implementation.h).
5 | * ---------------------------------------------------------------------------------------
6 | *
7 | * Permission is hereby granted, free of charge,
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 | * to deal in the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | */
22 |
23 | #ifndef __LIBRETRO_SDK_VFS_IMPLEMENTATION_H
24 | #define __LIBRETRO_SDK_VFS_IMPLEMENTATION_H
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | RETRO_BEGIN_DECLS
33 |
34 | libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, unsigned mode, unsigned hints);
35 |
36 | int retro_vfs_file_close_impl(libretro_vfs_implementation_file *stream);
37 |
38 | int retro_vfs_file_error_impl(libretro_vfs_implementation_file *stream);
39 |
40 | int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream);
41 |
42 | int64_t retro_vfs_file_truncate_impl(libretro_vfs_implementation_file *stream, int64_t length);
43 |
44 | int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream);
45 |
46 | int64_t retro_vfs_file_seek_impl(libretro_vfs_implementation_file *stream, int64_t offset, int seek_position);
47 |
48 | int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream, void *s, uint64_t len);
49 |
50 | int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len);
51 |
52 | int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream);
53 |
54 | int retro_vfs_file_remove_impl(const char *path);
55 |
56 | int retro_vfs_file_rename_impl(const char *old_path, const char *new_path);
57 |
58 | const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *stream);
59 |
60 | int retro_vfs_stat_impl(const char *path, int32_t *size);
61 |
62 | int retro_vfs_mkdir_impl(const char *dir);
63 |
64 | libretro_vfs_implementation_dir *retro_vfs_opendir_impl(const char *dir, bool include_hidden);
65 |
66 | bool retro_vfs_readdir_impl(libretro_vfs_implementation_dir *dirstream);
67 |
68 | const char *retro_vfs_dirent_get_name_impl(libretro_vfs_implementation_dir *dirstream);
69 |
70 | bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *dirstream);
71 |
72 | int retro_vfs_closedir_impl(libretro_vfs_implementation_dir *dirstream);
73 |
74 | RETRO_END_DECLS
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/src/deps/libretro-common/include/vfs/vfs_implementation_cdrom.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010-2020 The RetroArch team
2 | *
3 | * ---------------------------------------------------------------------------------------
4 | * The following license statement only applies to this file (vfs_implementation_cdrom.h).
5 | * ---------------------------------------------------------------------------------------
6 | *
7 | * Permission is hereby granted, free of charge,
8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 | * to deal in the Software without restriction, including without limitation the rights to
10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | */
22 |
23 | #ifndef __LIBRETRO_SDK_VFS_IMPLEMENTATION_CDROM_H
24 | #define __LIBRETRO_SDK_VFS_IMPLEMENTATION_CDROM_H
25 |
26 | #include
27 | #include
28 |
29 | RETRO_BEGIN_DECLS
30 |
31 | int64_t retro_vfs_file_seek_cdrom(libretro_vfs_implementation_file *stream, int64_t offset, int whence);
32 |
33 | void retro_vfs_file_open_cdrom(
34 | libretro_vfs_implementation_file *stream,
35 | const char *path, unsigned mode, unsigned hints);
36 |
37 | int retro_vfs_file_close_cdrom(libretro_vfs_implementation_file *stream);
38 |
39 | int64_t retro_vfs_file_tell_cdrom(libretro_vfs_implementation_file *stream);
40 |
41 | int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
42 | void *s, uint64_t len);
43 |
44 | int retro_vfs_file_error_cdrom(libretro_vfs_implementation_file *stream);
45 |
46 | const cdrom_toc_t* retro_vfs_file_get_cdrom_toc(void);
47 |
48 | const vfs_cdrom_t* retro_vfs_file_get_cdrom_position(const libretro_vfs_implementation_file *stream);
49 |
50 | RETRO_END_DECLS
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/src/deps/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