@patleeman/pi-boy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1361) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/index.ts +1 -0
  4. package/mgba-bridge/build.sh +31 -0
  5. package/mgba-bridge/src/main.c +740 -0
  6. package/mgba-bridge/vendor/mgba/.clang-format +34 -0
  7. package/mgba-bridge/vendor/mgba/.gitlab-ci.yml +267 -0
  8. package/mgba-bridge/vendor/mgba/CHANGES +2094 -0
  9. package/mgba-bridge/vendor/mgba/CMakeLists.txt +1373 -0
  10. package/mgba-bridge/vendor/mgba/CMakePresets.json +21 -0
  11. package/mgba-bridge/vendor/mgba/CONTRIBUTING.md +196 -0
  12. package/mgba-bridge/vendor/mgba/LICENSE +373 -0
  13. package/mgba-bridge/vendor/mgba/Makefile +1 -0
  14. package/mgba-bridge/vendor/mgba/Makefile.libretro +490 -0
  15. package/mgba-bridge/vendor/mgba/PORTING.md +21 -0
  16. package/mgba-bridge/vendor/mgba/README.md +270 -0
  17. package/mgba-bridge/vendor/mgba/README_DE.md +255 -0
  18. package/mgba-bridge/vendor/mgba/README_ES.md +255 -0
  19. package/mgba-bridge/vendor/mgba/README_JP.md +268 -0
  20. package/mgba-bridge/vendor/mgba/README_ZH_CN.md +268 -0
  21. package/mgba-bridge/vendor/mgba/Tupfile +3 -0
  22. package/mgba-bridge/vendor/mgba/include/mgba/core/bitmap-cache.h +64 -0
  23. package/mgba-bridge/vendor/mgba/include/mgba/core/cache-set.h +38 -0
  24. package/mgba-bridge/vendor/mgba/include/mgba/core/cheats.h +130 -0
  25. package/mgba-bridge/vendor/mgba/include/mgba/core/config.h +118 -0
  26. package/mgba-bridge/vendor/mgba/include/mgba/core/core.h +232 -0
  27. package/mgba-bridge/vendor/mgba/include/mgba/core/cpu.h +40 -0
  28. package/mgba-bridge/vendor/mgba/include/mgba/core/directories.h +42 -0
  29. package/mgba-bridge/vendor/mgba/include/mgba/core/input.h +91 -0
  30. package/mgba-bridge/vendor/mgba/include/mgba/core/interface.h +199 -0
  31. package/mgba-bridge/vendor/mgba/include/mgba/core/library.h +62 -0
  32. package/mgba-bridge/vendor/mgba/include/mgba/core/lockstep.h +77 -0
  33. package/mgba-bridge/vendor/mgba/include/mgba/core/log.h +88 -0
  34. package/mgba-bridge/vendor/mgba/include/mgba/core/map-cache.h +82 -0
  35. package/mgba-bridge/vendor/mgba/include/mgba/core/mem-search.h +62 -0
  36. package/mgba-bridge/vendor/mgba/include/mgba/core/rewind.h +47 -0
  37. package/mgba-bridge/vendor/mgba/include/mgba/core/scripting.h +65 -0
  38. package/mgba-bridge/vendor/mgba/include/mgba/core/serialize.h +61 -0
  39. package/mgba-bridge/vendor/mgba/include/mgba/core/sync.h +44 -0
  40. package/mgba-bridge/vendor/mgba/include/mgba/core/thread.h +135 -0
  41. package/mgba-bridge/vendor/mgba/include/mgba/core/tile-cache.h +63 -0
  42. package/mgba-bridge/vendor/mgba/include/mgba/core/timing.h +55 -0
  43. package/mgba-bridge/vendor/mgba/include/mgba/core/version.h +27 -0
  44. package/mgba-bridge/vendor/mgba/include/mgba/debugger/debugger.h +267 -0
  45. package/mgba-bridge/vendor/mgba/include/mgba/feature/commandline.h +71 -0
  46. package/mgba-bridge/vendor/mgba/include/mgba/feature/proxy-backend.h +83 -0
  47. package/mgba-bridge/vendor/mgba/include/mgba/feature/thread-proxy.h +41 -0
  48. package/mgba-bridge/vendor/mgba/include/mgba/feature/updater.h +51 -0
  49. package/mgba-bridge/vendor/mgba/include/mgba/feature/video-backend.h +81 -0
  50. package/mgba-bridge/vendor/mgba/include/mgba/feature/video-logger.h +145 -0
  51. package/mgba-bridge/vendor/mgba/include/mgba/gb/core.h +21 -0
  52. package/mgba-bridge/vendor/mgba/include/mgba/gb/interface.h +112 -0
  53. package/mgba-bridge/vendor/mgba/include/mgba/gba/core.h +21 -0
  54. package/mgba-bridge/vendor/mgba/include/mgba/gba/interface.h +168 -0
  55. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/arm.h +217 -0
  56. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/debugger/cli-debugger.h +18 -0
  57. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/debugger/debugger.h +52 -0
  58. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/debugger/memory-debugger.h +20 -0
  59. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/decoder-inlines.h +37 -0
  60. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/decoder.h +231 -0
  61. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/emitter-arm.h +336 -0
  62. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/emitter-inlines.h +32 -0
  63. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/emitter-thumb.h +113 -0
  64. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/isa-arm.h +22 -0
  65. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/isa-inlines.h +186 -0
  66. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/isa-thumb.h +20 -0
  67. package/mgba-bridge/vendor/mgba/include/mgba/internal/arm/macros.h +18 -0
  68. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/access-logger.h +57 -0
  69. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/cli-debugger.h +108 -0
  70. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/cli-el-backend.h +21 -0
  71. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/gdb-stub.h +62 -0
  72. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/parser.h +81 -0
  73. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/stack-trace.h +32 -0
  74. package/mgba-bridge/vendor/mgba/include/mgba/internal/debugger/symbols.h +29 -0
  75. package/mgba-bridge/vendor/mgba/include/mgba/internal/defines.h +31 -0
  76. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/audio.h +257 -0
  77. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/cheats.h +26 -0
  78. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/debugger/cli.h +28 -0
  79. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/debugger/debugger.h +20 -0
  80. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/debugger/symbols.h +19 -0
  81. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/gb.h +202 -0
  82. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/input.h +31 -0
  83. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/io.h +127 -0
  84. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/mbc.h +72 -0
  85. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/memory.h +385 -0
  86. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/overrides.h +21 -0
  87. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/renderers/cache-set.h +23 -0
  88. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/renderers/proxy.h +29 -0
  89. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/renderers/software.h +72 -0
  90. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/serialize.h +536 -0
  91. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/sio/lockstep.h +49 -0
  92. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/sio/printer.h +74 -0
  93. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/sio.h +52 -0
  94. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/timer.h +45 -0
  95. package/mgba-bridge/vendor/mgba/include/mgba/internal/gb/video.h +201 -0
  96. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/audio.h +291 -0
  97. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/bios.h +73 -0
  98. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/ereader.h +127 -0
  99. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/gpio.h +110 -0
  100. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/matrix.h +35 -0
  101. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cart/unlicensed.h +77 -0
  102. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/cheats.h +175 -0
  103. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/debugger/cli.h +30 -0
  104. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/dma.h +73 -0
  105. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/gba.h +194 -0
  106. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/input.h +34 -0
  107. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/io.h +190 -0
  108. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/memory.h +184 -0
  109. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/overrides.h +21 -0
  110. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/cache-set.h +22 -0
  111. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/common.h +27 -0
  112. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/gl.h +218 -0
  113. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/proxy.h +29 -0
  114. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/renderers/video-software.h +160 -0
  115. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/savedata.h +130 -0
  116. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/serialize.h +496 -0
  117. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sharkport.h +27 -0
  118. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio/dolphin.h +41 -0
  119. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio/gbp.h +38 -0
  120. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio/lockstep.h +95 -0
  121. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/sio.h +98 -0
  122. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/timer.h +36 -0
  123. package/mgba-bridge/vendor/mgba/include/mgba/internal/gba/video.h +251 -0
  124. package/mgba-bridge/vendor/mgba/include/mgba/internal/script/lua.h +12 -0
  125. package/mgba-bridge/vendor/mgba/include/mgba/internal/script/socket.h +31 -0
  126. package/mgba-bridge/vendor/mgba/include/mgba/internal/script/types.h +20 -0
  127. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/debugger/cli-debugger.h +18 -0
  128. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/debugger/debugger.h +43 -0
  129. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/debugger/memory-debugger.h +20 -0
  130. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/decoder.h +113 -0
  131. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/emitter-sm83.h +528 -0
  132. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/isa-sm83.h +20 -0
  133. package/mgba-bridge/vendor/mgba/include/mgba/internal/sm83/sm83.h +174 -0
  134. package/mgba-bridge/vendor/mgba/include/mgba/script/base.h +28 -0
  135. package/mgba-bridge/vendor/mgba/include/mgba/script/canvas.h +24 -0
  136. package/mgba-bridge/vendor/mgba/include/mgba/script/console.h +51 -0
  137. package/mgba-bridge/vendor/mgba/include/mgba/script/context.h +126 -0
  138. package/mgba-bridge/vendor/mgba/include/mgba/script/input.h +272 -0
  139. package/mgba-bridge/vendor/mgba/include/mgba/script/macros.h +680 -0
  140. package/mgba-bridge/vendor/mgba/include/mgba/script/storage.h +28 -0
  141. package/mgba-bridge/vendor/mgba/include/mgba/script/types.h +400 -0
  142. package/mgba-bridge/vendor/mgba/include/mgba/script.h +18 -0
  143. package/mgba-bridge/vendor/mgba/include/mgba-util/audio-buffer.h +34 -0
  144. package/mgba-bridge/vendor/mgba/include/mgba-util/audio-resampler.h +42 -0
  145. package/mgba-bridge/vendor/mgba/include/mgba-util/circle-buffer.h +39 -0
  146. package/mgba-bridge/vendor/mgba/include/mgba-util/common.h +352 -0
  147. package/mgba-bridge/vendor/mgba/include/mgba-util/configuration.h +50 -0
  148. package/mgba-bridge/vendor/mgba/include/mgba-util/convolve.h +33 -0
  149. package/mgba-bridge/vendor/mgba/include/mgba-util/crc32.h +26 -0
  150. package/mgba-bridge/vendor/mgba/include/mgba-util/dllexports.h +19 -0
  151. package/mgba-bridge/vendor/mgba/include/mgba-util/elf-read.h +45 -0
  152. package/mgba-bridge/vendor/mgba/include/mgba-util/formatting.h +36 -0
  153. package/mgba-bridge/vendor/mgba/include/mgba-util/geometry.h +31 -0
  154. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/file-select.h +21 -0
  155. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/font-metrics.h +15 -0
  156. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/font.h +149 -0
  157. package/mgba-bridge/vendor/mgba/include/mgba-util/gui/menu.h +126 -0
  158. package/mgba-bridge/vendor/mgba/include/mgba-util/gui.h +136 -0
  159. package/mgba-bridge/vendor/mgba/include/mgba-util/hash.h +17 -0
  160. package/mgba-bridge/vendor/mgba/include/mgba-util/image/export.h +20 -0
  161. package/mgba-bridge/vendor/mgba/include/mgba-util/image/png-io.h +54 -0
  162. package/mgba-bridge/vendor/mgba/include/mgba-util/image.h +442 -0
  163. package/mgba-bridge/vendor/mgba/include/mgba-util/interpolator.h +51 -0
  164. package/mgba-bridge/vendor/mgba/include/mgba-util/macros.h +92 -0
  165. package/mgba-bridge/vendor/mgba/include/mgba-util/math.h +145 -0
  166. package/mgba-bridge/vendor/mgba/include/mgba-util/md5.h +34 -0
  167. package/mgba-bridge/vendor/mgba/include/mgba-util/memory.h +18 -0
  168. package/mgba-bridge/vendor/mgba/include/mgba-util/patch/fast.h +38 -0
  169. package/mgba-bridge/vendor/mgba/include/mgba-util/patch/ips.h +19 -0
  170. package/mgba-bridge/vendor/mgba/include/mgba-util/patch/ups.h +19 -0
  171. package/mgba-bridge/vendor/mgba/include/mgba-util/patch.h +26 -0
  172. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/3ds/3ds-vfs.h +17 -0
  173. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/3ds/threading.h +88 -0
  174. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/posix/threading.h +125 -0
  175. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/psp2/sce-vfs.h +18 -0
  176. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/psp2/threading.h +161 -0
  177. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/switch/threading.h +88 -0
  178. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/windows/getopt.h +609 -0
  179. package/mgba-bridge/vendor/mgba/include/mgba-util/platform/windows/threading.h +106 -0
  180. package/mgba-bridge/vendor/mgba/include/mgba-util/ring-fifo.h +30 -0
  181. package/mgba-bridge/vendor/mgba/include/mgba-util/sfo.h +30 -0
  182. package/mgba-bridge/vendor/mgba/include/mgba-util/sha1.h +33 -0
  183. package/mgba-bridge/vendor/mgba/include/mgba-util/socket.h +542 -0
  184. package/mgba-bridge/vendor/mgba/include/mgba-util/string.h +55 -0
  185. package/mgba-bridge/vendor/mgba/include/mgba-util/table.h +93 -0
  186. package/mgba-bridge/vendor/mgba/include/mgba-util/text-codec.h +36 -0
  187. package/mgba-bridge/vendor/mgba/include/mgba-util/threading.h +123 -0
  188. package/mgba-bridge/vendor/mgba/include/mgba-util/vector.h +128 -0
  189. package/mgba-bridge/vendor/mgba/include/mgba-util/vfs.h +125 -0
  190. package/mgba-bridge/vendor/mgba/intl/activate.py +70 -0
  191. package/mgba-bridge/vendor/mgba/intl/core_option_regex.py +95 -0
  192. package/mgba-bridge/vendor/mgba/intl/core_option_translation.py +633 -0
  193. package/mgba-bridge/vendor/mgba/intl/crowdin.yaml +13 -0
  194. package/mgba-bridge/vendor/mgba/intl/crowdin_prep.py +30 -0
  195. package/mgba-bridge/vendor/mgba/intl/crowdin_source_upload.py +93 -0
  196. package/mgba-bridge/vendor/mgba/intl/crowdin_translate.py +39 -0
  197. package/mgba-bridge/vendor/mgba/intl/crowdin_translation_download.py +93 -0
  198. package/mgba-bridge/vendor/mgba/intl/download_workflow.py +16 -0
  199. package/mgba-bridge/vendor/mgba/intl/initial_sync.py +125 -0
  200. package/mgba-bridge/vendor/mgba/intl/remove_initial_cycle.py +30 -0
  201. package/mgba-bridge/vendor/mgba/intl/upload_workflow.py +15 -0
  202. package/mgba-bridge/vendor/mgba/intl/v1_to_v2_converter.py +483 -0
  203. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_arm64-v8a +96 -0
  204. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_armeabi +96 -0
  205. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_armeabi-v7a +96 -0
  206. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_mips +96 -0
  207. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_mips64 +96 -0
  208. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_x86 +96 -0
  209. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.android_x86_64 +96 -0
  210. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.common +156 -0
  211. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux-portable_x86 +96 -0
  212. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux-portable_x86_64 +96 -0
  213. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux_x86 +96 -0
  214. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.linux_x86_64 +96 -0
  215. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.mingw_x86 +96 -0
  216. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.mingw_x86_64 +96 -0
  217. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.osx_x86 +96 -0
  218. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.osx_x86_64 +96 -0
  219. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.rules +45 -0
  220. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.vita_arm +96 -0
  221. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.wii_ppc +96 -0
  222. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.windows_x86 +96 -0
  223. package/mgba-bridge/vendor/mgba/libretro-build/Makefile.windows_x86_64 +96 -0
  224. package/mgba-bridge/vendor/mgba/libretro-build/include/libz/zconf.h +511 -0
  225. package/mgba-bridge/vendor/mgba/libretro-build/jni/Android.mk +23 -0
  226. package/mgba-bridge/vendor/mgba/libretro-build/jni/Application.mk +2 -0
  227. package/mgba-bridge/vendor/mgba/libretro-build/link.T +5 -0
  228. package/mgba-bridge/vendor/mgba/link.T +4 -0
  229. package/mgba-bridge/vendor/mgba/opt/libgba/mgba.c +94 -0
  230. package/mgba-bridge/vendor/mgba/opt/libgba/mgba.h +46 -0
  231. package/mgba-bridge/vendor/mgba/src/arm/CMakeLists.txt +19 -0
  232. package/mgba-bridge/vendor/mgba/src/arm/arm.c +264 -0
  233. package/mgba-bridge/vendor/mgba/src/arm/debugger/cli-debugger.c +187 -0
  234. package/mgba-bridge/vendor/mgba/src/arm/debugger/debugger.c +588 -0
  235. package/mgba-bridge/vendor/mgba/src/arm/debugger/memory-debugger.c +158 -0
  236. package/mgba-bridge/vendor/mgba/src/arm/decoder-arm.c +466 -0
  237. package/mgba-bridge/vendor/mgba/src/arm/decoder-thumb.c +344 -0
  238. package/mgba-bridge/vendor/mgba/src/arm/decoder.c +601 -0
  239. package/mgba-bridge/vendor/mgba/src/arm/isa-arm.c +784 -0
  240. package/mgba-bridge/vendor/mgba/src/arm/isa-thumb.c +417 -0
  241. package/mgba-bridge/vendor/mgba/src/core/CMakeLists.txt +47 -0
  242. package/mgba-bridge/vendor/mgba/src/core/bitmap-cache.c +187 -0
  243. package/mgba-bridge/vendor/mgba/src/core/cache-set.c +83 -0
  244. package/mgba-bridge/vendor/mgba/src/core/cheats.c +807 -0
  245. package/mgba-bridge/vendor/mgba/src/core/config.c +548 -0
  246. package/mgba-bridge/vendor/mgba/src/core/core-serialize.c +585 -0
  247. package/mgba-bridge/vendor/mgba/src/core/core.c +539 -0
  248. package/mgba-bridge/vendor/mgba/src/core/directories.c +196 -0
  249. package/mgba-bridge/vendor/mgba/src/core/flags.h.in +204 -0
  250. package/mgba-bridge/vendor/mgba/src/core/input.c +677 -0
  251. package/mgba-bridge/vendor/mgba/src/core/interface.c +154 -0
  252. package/mgba-bridge/vendor/mgba/src/core/library.c +584 -0
  253. package/mgba-bridge/vendor/mgba/src/core/lockstep.c +43 -0
  254. package/mgba-bridge/vendor/mgba/src/core/log.c +294 -0
  255. package/mgba-bridge/vendor/mgba/src/core/map-cache.c +219 -0
  256. package/mgba-bridge/vendor/mgba/src/core/mem-search.c +342 -0
  257. package/mgba-bridge/vendor/mgba/src/core/rewind.c +186 -0
  258. package/mgba-bridge/vendor/mgba/src/core/scripting.c +1481 -0
  259. package/mgba-bridge/vendor/mgba/src/core/sync.c +121 -0
  260. package/mgba-bridge/vendor/mgba/src/core/thread.c +726 -0
  261. package/mgba-bridge/vendor/mgba/src/core/tile-cache.c +283 -0
  262. package/mgba-bridge/vendor/mgba/src/core/timing.c +137 -0
  263. package/mgba-bridge/vendor/mgba/src/core/version.c.in +14 -0
  264. package/mgba-bridge/vendor/mgba/src/debugger/CMakeLists.txt +30 -0
  265. package/mgba-bridge/vendor/mgba/src/debugger/access-logger.c +592 -0
  266. package/mgba-bridge/vendor/mgba/src/debugger/cli-debugger-scripting.c +137 -0
  267. package/mgba-bridge/vendor/mgba/src/debugger/cli-debugger.c +1482 -0
  268. package/mgba-bridge/vendor/mgba/src/debugger/cli-el-backend.c +248 -0
  269. package/mgba-bridge/vendor/mgba/src/debugger/debugger.c +327 -0
  270. package/mgba-bridge/vendor/mgba/src/debugger/gdb-stub.c +918 -0
  271. package/mgba-bridge/vendor/mgba/src/debugger/parser.c +902 -0
  272. package/mgba-bridge/vendor/mgba/src/debugger/stack-trace.c +133 -0
  273. package/mgba-bridge/vendor/mgba/src/debugger/symbols.c +109 -0
  274. package/mgba-bridge/vendor/mgba/src/feature/CMakeLists.txt +24 -0
  275. package/mgba-bridge/vendor/mgba/src/feature/commandline.c +404 -0
  276. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-common.h +95 -0
  277. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-decoder.c +204 -0
  278. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-decoder.h +45 -0
  279. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-encoder.c +960 -0
  280. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-encoder.h +91 -0
  281. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-scale.c +36 -0
  282. package/mgba-bridge/vendor/mgba/src/feature/ffmpeg/ffmpeg-scale.h +21 -0
  283. package/mgba-bridge/vendor/mgba/src/feature/gui/cheats.c +195 -0
  284. package/mgba-bridge/vendor/mgba/src/feature/gui/cheats.h +18 -0
  285. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-config.c +438 -0
  286. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-config.h +19 -0
  287. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-runner.c +853 -0
  288. package/mgba-bridge/vendor/mgba/src/feature/gui/gui-runner.h +114 -0
  289. package/mgba-bridge/vendor/mgba/src/feature/gui/remap.c +88 -0
  290. package/mgba-bridge/vendor/mgba/src/feature/gui/remap.h +27 -0
  291. package/mgba-bridge/vendor/mgba/src/feature/proxy-backend.c +286 -0
  292. package/mgba-bridge/vendor/mgba/src/feature/thread-proxy.c +213 -0
  293. package/mgba-bridge/vendor/mgba/src/feature/updater.c +227 -0
  294. package/mgba-bridge/vendor/mgba/src/feature/video-backend.c +45 -0
  295. package/mgba-bridge/vendor/mgba/src/feature/video-logger.c +1092 -0
  296. package/mgba-bridge/vendor/mgba/src/gb/CMakeLists.txt +53 -0
  297. package/mgba-bridge/vendor/mgba/src/gb/audio.c +1149 -0
  298. package/mgba-bridge/vendor/mgba/src/gb/cheats.c +190 -0
  299. package/mgba-bridge/vendor/mgba/src/gb/core.c +1539 -0
  300. package/mgba-bridge/vendor/mgba/src/gb/debugger/cli.c +115 -0
  301. package/mgba-bridge/vendor/mgba/src/gb/debugger/debugger.c +46 -0
  302. package/mgba-bridge/vendor/mgba/src/gb/debugger/symbols.c +61 -0
  303. package/mgba-bridge/vendor/mgba/src/gb/extra/proxy.c +328 -0
  304. package/mgba-bridge/vendor/mgba/src/gb/gb.c +1261 -0
  305. package/mgba-bridge/vendor/mgba/src/gb/input.c +29 -0
  306. package/mgba-bridge/vendor/mgba/src/gb/io.c +735 -0
  307. package/mgba-bridge/vendor/mgba/src/gb/mbc/huc-3.c +218 -0
  308. package/mgba-bridge/vendor/mgba/src/gb/mbc/licensed.c +84 -0
  309. package/mgba-bridge/vendor/mgba/src/gb/mbc/mbc-private.h +66 -0
  310. package/mgba-bridge/vendor/mgba/src/gb/mbc/mbc.c +583 -0
  311. package/mgba-bridge/vendor/mgba/src/gb/mbc/pocket-cam.c +142 -0
  312. package/mgba-bridge/vendor/mgba/src/gb/mbc/tama5.c +433 -0
  313. package/mgba-bridge/vendor/mgba/src/gb/mbc/unlicensed.c +601 -0
  314. package/mgba-bridge/vendor/mgba/src/gb/mbc.c +650 -0
  315. package/mgba-bridge/vendor/mgba/src/gb/memory.c +1079 -0
  316. package/mgba-bridge/vendor/mgba/src/gb/overrides.c +939 -0
  317. package/mgba-bridge/vendor/mgba/src/gb/renderers/cache-set.c +129 -0
  318. package/mgba-bridge/vendor/mgba/src/gb/renderers/software.c +1169 -0
  319. package/mgba-bridge/vendor/mgba/src/gb/serialize.c +310 -0
  320. package/mgba-bridge/vendor/mgba/src/gb/sio/lockstep.c +284 -0
  321. package/mgba-bridge/vendor/mgba/src/gb/sio/printer.c +237 -0
  322. package/mgba-bridge/vendor/mgba/src/gb/sio.c +106 -0
  323. package/mgba-bridge/vendor/mgba/src/gb/timer.c +150 -0
  324. package/mgba-bridge/vendor/mgba/src/gb/video.c +1216 -0
  325. package/mgba-bridge/vendor/mgba/src/gba/CMakeLists.txt +62 -0
  326. package/mgba-bridge/vendor/mgba/src/gba/audio.c +555 -0
  327. package/mgba-bridge/vendor/mgba/src/gba/bios.c +981 -0
  328. package/mgba-bridge/vendor/mgba/src/gba/cart/ereader.c +1639 -0
  329. package/mgba-bridge/vendor/mgba/src/gba/cart/gpio.c +584 -0
  330. package/mgba-bridge/vendor/mgba/src/gba/cart/matrix.c +134 -0
  331. package/mgba-bridge/vendor/mgba/src/gba/cart/unlicensed.c +255 -0
  332. package/mgba-bridge/vendor/mgba/src/gba/cart/vfame.c +320 -0
  333. package/mgba-bridge/vendor/mgba/src/gba/cheats/codebreaker.c +323 -0
  334. package/mgba-bridge/vendor/mgba/src/gba/cheats/gameshark.c +318 -0
  335. package/mgba-bridge/vendor/mgba/src/gba/cheats/gameshark.h +32 -0
  336. package/mgba-bridge/vendor/mgba/src/gba/cheats/parv3.c +442 -0
  337. package/mgba-bridge/vendor/mgba/src/gba/cheats/parv3.h +21 -0
  338. package/mgba-bridge/vendor/mgba/src/gba/cheats.c +386 -0
  339. package/mgba-bridge/vendor/mgba/src/gba/core.c +1822 -0
  340. package/mgba-bridge/vendor/mgba/src/gba/debugger/cli.c +116 -0
  341. package/mgba-bridge/vendor/mgba/src/gba/dma.c +363 -0
  342. package/mgba-bridge/vendor/mgba/src/gba/extra/battlechip.c +171 -0
  343. package/mgba-bridge/vendor/mgba/src/gba/extra/proxy.c +408 -0
  344. package/mgba-bridge/vendor/mgba/src/gba/gba.c +1095 -0
  345. package/mgba-bridge/vendor/mgba/src/gba/hle-bios-src.s +400 -0
  346. package/mgba-bridge/vendor/mgba/src/gba/hle-bios.c +103 -0
  347. package/mgba-bridge/vendor/mgba/src/gba/hle-bios.h +17 -0
  348. package/mgba-bridge/vendor/mgba/src/gba/hle-bios.make +18 -0
  349. package/mgba-bridge/vendor/mgba/src/gba/input.c +31 -0
  350. package/mgba-bridge/vendor/mgba/src/gba/io.c +1085 -0
  351. package/mgba-bridge/vendor/mgba/src/gba/memory.c +1974 -0
  352. package/mgba-bridge/vendor/mgba/src/gba/overrides.c +435 -0
  353. package/mgba-bridge/vendor/mgba/src/gba/renderers/cache-set.c +219 -0
  354. package/mgba-bridge/vendor/mgba/src/gba/renderers/common.c +59 -0
  355. package/mgba-bridge/vendor/mgba/src/gba/renderers/gl.c +2137 -0
  356. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-bg.c +228 -0
  357. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-mode0.c +576 -0
  358. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-obj.c +431 -0
  359. package/mgba-bridge/vendor/mgba/src/gba/renderers/software-private.h +283 -0
  360. package/mgba-bridge/vendor/mgba/src/gba/renderers/video-software.c +1117 -0
  361. package/mgba-bridge/vendor/mgba/src/gba/savedata.c +792 -0
  362. package/mgba-bridge/vendor/mgba/src/gba/serialize.c +242 -0
  363. package/mgba-bridge/vendor/mgba/src/gba/sharkport.c +389 -0
  364. package/mgba-bridge/vendor/mgba/src/gba/sio/dolphin.c +217 -0
  365. package/mgba-bridge/vendor/mgba/src/gba/sio/gbp.c +150 -0
  366. package/mgba-bridge/vendor/mgba/src/gba/sio/lockstep.c +1063 -0
  367. package/mgba-bridge/vendor/mgba/src/gba/sio.c +493 -0
  368. package/mgba-bridge/vendor/mgba/src/gba/timer.c +153 -0
  369. package/mgba-bridge/vendor/mgba/src/gba/video.c +470 -0
  370. package/mgba-bridge/vendor/mgba/src/platform/cmake/DMGOverrides.cmake.in +6 -0
  371. package/mgba-bridge/vendor/mgba/src/platform/cmake/DebugStrip.cmake +12 -0
  372. package/mgba-bridge/vendor/mgba/src/platform/cmake/ExportDirectory.cmake +7 -0
  373. package/mgba-bridge/vendor/mgba/src/platform/cmake/FindFeature.cmake +88 -0
  374. package/mgba-bridge/vendor/mgba/src/platform/cmake/FindFunction.cmake +14 -0
  375. package/mgba-bridge/vendor/mgba/src/platform/cmake/FindSDL2.cmake +164 -0
  376. package/mgba-bridge/vendor/mgba/src/platform/cmake/Findepoxy.cmake +10 -0
  377. package/mgba-bridge/vendor/mgba/src/platform/cmake/devkitPro.cmake +44 -0
  378. package/mgba-bridge/vendor/mgba/src/platform/example/client-server/client.c +160 -0
  379. package/mgba-bridge/vendor/mgba/src/platform/example/client-server/server.c +168 -0
  380. package/mgba-bridge/vendor/mgba/src/platform/headless-main.c +379 -0
  381. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro.c +2611 -0
  382. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro.h +7846 -0
  383. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro_core_options.h +721 -0
  384. package/mgba-bridge/vendor/mgba/src/platform/libretro/libretro_core_options_intl.h +17798 -0
  385. package/mgba-bridge/vendor/mgba/src/platform/libretro/memory.c +22 -0
  386. package/mgba-bridge/vendor/mgba/src/platform/libretro/retro_inline.h +39 -0
  387. package/mgba-bridge/vendor/mgba/src/platform/opengl/gl.c +304 -0
  388. package/mgba-bridge/vendor/mgba/src/platform/opengl/gl.h +40 -0
  389. package/mgba-bridge/vendor/mgba/src/platform/opengl/gles2.c +1230 -0
  390. package/mgba-bridge/vendor/mgba/src/platform/opengl/gles2.h +117 -0
  391. package/mgba-bridge/vendor/mgba/src/platform/posix/memory.c +37 -0
  392. package/mgba-bridge/vendor/mgba/src/script/CMakeLists.txt +38 -0
  393. package/mgba-bridge/vendor/mgba/src/script/canvas.c +292 -0
  394. package/mgba-bridge/vendor/mgba/src/script/console.c +141 -0
  395. package/mgba-bridge/vendor/mgba/src/script/context.c +492 -0
  396. package/mgba-bridge/vendor/mgba/src/script/engines/lua.c +1617 -0
  397. package/mgba-bridge/vendor/mgba/src/script/image.c +338 -0
  398. package/mgba-bridge/vendor/mgba/src/script/input.c +612 -0
  399. package/mgba-bridge/vendor/mgba/src/script/socket.c +284 -0
  400. package/mgba-bridge/vendor/mgba/src/script/stdlib.c +306 -0
  401. package/mgba-bridge/vendor/mgba/src/script/storage.c +557 -0
  402. package/mgba-bridge/vendor/mgba/src/script/test.h +29 -0
  403. package/mgba-bridge/vendor/mgba/src/script/types.c +1886 -0
  404. package/mgba-bridge/vendor/mgba/src/sm83/CMakeLists.txt +16 -0
  405. package/mgba-bridge/vendor/mgba/src/sm83/debugger/cli-debugger.c +110 -0
  406. package/mgba-bridge/vendor/mgba/src/sm83/debugger/debugger.c +266 -0
  407. package/mgba-bridge/vendor/mgba/src/sm83/debugger/memory-debugger.c +84 -0
  408. package/mgba-bridge/vendor/mgba/src/sm83/decoder.c +608 -0
  409. package/mgba-bridge/vendor/mgba/src/sm83/isa-sm83.c +817 -0
  410. package/mgba-bridge/vendor/mgba/src/sm83/sm83.c +199 -0
  411. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/.clang-format +92 -0
  412. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/CMakeLists.txt +18 -0
  413. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/LICENSE +19 -0
  414. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/README.md +152 -0
  415. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/discord_register.h +26 -0
  416. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/discord_rpc.h +87 -0
  417. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/LICENSE +24 -0
  418. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/README.md +41 -0
  419. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/condition_variable +549 -0
  420. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/mutex +474 -0
  421. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/shared_mutex +497 -0
  422. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/mingw-std-threads/thread +410 -0
  423. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/allocators.h +271 -0
  424. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/document.h +2573 -0
  425. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/encodedstream.h +299 -0
  426. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/encodings.h +716 -0
  427. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/error/en.h +74 -0
  428. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/error/error.h +155 -0
  429. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/filereadstream.h +99 -0
  430. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/filewritestream.h +104 -0
  431. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/fwd.h +151 -0
  432. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/biginteger.h +290 -0
  433. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/diyfp.h +258 -0
  434. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/dtoa.h +245 -0
  435. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/ieee754.h +78 -0
  436. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/itoa.h +304 -0
  437. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/meta.h +181 -0
  438. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/pow10.h +55 -0
  439. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/regex.h +701 -0
  440. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/stack.h +230 -0
  441. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/strfunc.h +55 -0
  442. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/strtod.h +269 -0
  443. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/internal/swap.h +46 -0
  444. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/istreamwrapper.h +115 -0
  445. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/license.txt +57 -0
  446. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/memorybuffer.h +70 -0
  447. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/memorystream.h +71 -0
  448. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/msinttypes/inttypes.h +316 -0
  449. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/msinttypes/stdint.h +300 -0
  450. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/ostreamwrapper.h +81 -0
  451. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/pointer.h +1358 -0
  452. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/prettywriter.h +255 -0
  453. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/rapidjson.h +615 -0
  454. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/reader.h +1879 -0
  455. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/schema.h +2006 -0
  456. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/stream.h +179 -0
  457. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/stringbuffer.h +117 -0
  458. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/include/rapidjson/writer.h +610 -0
  459. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/CMakeLists.txt +90 -0
  460. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/backoff.h +40 -0
  461. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/connection.h +19 -0
  462. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/connection_unix.cpp +125 -0
  463. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/connection_win.cpp +128 -0
  464. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_register_linux.cpp +102 -0
  465. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_register_osx.m +80 -0
  466. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_register_win.cpp +185 -0
  467. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/discord_rpc.cpp +504 -0
  468. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/dllmain.cpp +8 -0
  469. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/msg_queue.h +36 -0
  470. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/rpc_connection.cpp +137 -0
  471. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/rpc_connection.h +59 -0
  472. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/serialization.cpp +245 -0
  473. package/mgba-bridge/vendor/mgba/src/third-party/discord-rpc/src/serialization.h +215 -0
  474. package/mgba-bridge/vendor/mgba/src/third-party/inih/LICENSE.txt +27 -0
  475. package/mgba-bridge/vendor/mgba/src/third-party/inih/README.md +157 -0
  476. package/mgba-bridge/vendor/mgba/src/third-party/inih/ini.c +288 -0
  477. package/mgba-bridge/vendor/mgba/src/third-party/inih/ini.h +148 -0
  478. package/mgba-bridge/vendor/mgba/src/third-party/libpng/ANNOUNCE +47 -0
  479. package/mgba-bridge/vendor/mgba/src/third-party/libpng/AUTHORS +45 -0
  480. package/mgba-bridge/vendor/mgba/src/third-party/libpng/CHANGES +6109 -0
  481. package/mgba-bridge/vendor/mgba/src/third-party/libpng/CMakeLists.txt +931 -0
  482. package/mgba-bridge/vendor/mgba/src/third-party/libpng/INSTALL +465 -0
  483. package/mgba-bridge/vendor/mgba/src/third-party/libpng/LICENSE +134 -0
  484. package/mgba-bridge/vendor/mgba/src/third-party/libpng/Makefile.am +393 -0
  485. package/mgba-bridge/vendor/mgba/src/third-party/libpng/Makefile.in +2428 -0
  486. package/mgba-bridge/vendor/mgba/src/third-party/libpng/README +183 -0
  487. package/mgba-bridge/vendor/mgba/src/third-party/libpng/TODO +23 -0
  488. package/mgba-bridge/vendor/mgba/src/third-party/libpng/TRADEMARK +8 -0
  489. package/mgba-bridge/vendor/mgba/src/third-party/libpng/aclocal.m4 +1196 -0
  490. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/arm_init.c +136 -0
  491. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/filter_neon.S +253 -0
  492. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/filter_neon_intrinsics.c +402 -0
  493. package/mgba-bridge/vendor/mgba/src/third-party/libpng/arm/palette_neon_intrinsics.c +149 -0
  494. package/mgba-bridge/vendor/mgba/src/third-party/libpng/autogen.sh +225 -0
  495. package/mgba-bridge/vendor/mgba/src/third-party/libpng/compile +348 -0
  496. package/mgba-bridge/vendor/mgba/src/third-party/libpng/config.guess +1476 -0
  497. package/mgba-bridge/vendor/mgba/src/third-party/libpng/config.h.in +126 -0
  498. package/mgba-bridge/vendor/mgba/src/third-party/libpng/config.sub +1801 -0
  499. package/mgba-bridge/vendor/mgba/src/third-party/libpng/configure +16116 -0
  500. package/mgba-bridge/vendor/mgba/src/third-party/libpng/configure.ac +532 -0
  501. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/README.txt +5 -0
  502. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/README +83 -0
  503. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/android-ndk.c +39 -0
  504. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/linux-auxv.c +120 -0
  505. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/arm-neon/linux.c +161 -0
  506. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/README +49 -0
  507. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/pngcp.dfa +57 -0
  508. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/read.dfa +58 -0
  509. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/s_read.dfa +35 -0
  510. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/s_write.dfa +33 -0
  511. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/simple.dfa +36 -0
  512. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/conftest/write.dfa +45 -0
  513. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/README.txt +24 -0
  514. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/iccfrompng.c +185 -0
  515. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/pngpixel.c +371 -0
  516. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/pngtopng.c +98 -0
  517. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/examples/simpleover.c +648 -0
  518. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/COPYING +340 -0
  519. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/LICENSE +50 -0
  520. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.mingw32 +131 -0
  521. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.sgi +105 -0
  522. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.unx +134 -0
  523. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/Makefile.w32 +114 -0
  524. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/README +186 -0
  525. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/makevms.com +132 -0
  526. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng.c +323 -0
  527. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng.h +88 -0
  528. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng2.c +521 -0
  529. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readpng2.h +116 -0
  530. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/readppm.c +188 -0
  531. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng-win.c +735 -0
  532. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng-x.c +911 -0
  533. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng2-win.c +1261 -0
  534. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/rpng2-x.c +2143 -0
  535. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/toucan.png +0 -0
  536. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/wpng.c +865 -0
  537. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/writepng.c +401 -0
  538. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/gregbook/writepng.h +133 -0
  539. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/fakepng.c +65 -0
  540. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/gentests.sh +102 -0
  541. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/makepng.c +1941 -0
  542. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngimage.c +1712 -0
  543. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngstest-errors.h +165 -0
  544. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngstest.c +3828 -0
  545. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngunknown.c +1294 -0
  546. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/pngvalid.c +12230 -0
  547. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/readpng.c +115 -0
  548. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/tarith.c +999 -0
  549. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/libtests/timepng.c +608 -0
  550. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/mips-msa/README +83 -0
  551. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/mips-msa/linux.c +64 -0
  552. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/Dockerfile +25 -0
  553. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/README.txt +37 -0
  554. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/build.sh +51 -0
  555. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/libpng_read_fuzzer.cc +190 -0
  556. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/libpng_read_fuzzer.options +2 -0
  557. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/oss-fuzz/png.dict +39 -0
  558. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/README +5 -0
  559. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/README +10 -0
  560. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/makefile +151 -0
  561. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/pngusr.dfa +40 -0
  562. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/decoder/pngusr.h +23 -0
  563. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/README +10 -0
  564. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/makefile +150 -0
  565. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/pngusr.dfa +39 -0
  566. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/encoder/pngusr.h +23 -0
  567. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/README +15 -0
  568. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/makefile +166 -0
  569. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/pngusr.dfa +40 -0
  570. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminim/preader/pngusr.h +23 -0
  571. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/CHANGES.txt +13 -0
  572. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/CMakeLists.txt +24 -0
  573. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/LICENSE.txt +22 -0
  574. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/Makefile +62 -0
  575. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/README.txt +120 -0
  576. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/makevms.com +92 -0
  577. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/png2pnm.bat +41 -0
  578. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/png2pnm.c +427 -0
  579. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/png2pnm.sh +42 -0
  580. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pngminus.bat +4 -0
  581. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pngminus.sh +5 -0
  582. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pnm2png.bat +41 -0
  583. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pnm2png.c +620 -0
  584. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngminus/pnm2png.sh +42 -0
  585. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/README +107 -0
  586. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/bad_interlace_conversions.txt +9 -0
  587. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g01.png +0 -0
  588. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g02.png +0 -0
  589. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g04.png +0 -0
  590. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g08.png +0 -0
  591. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn0g16.png +0 -0
  592. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn2c08.png +0 -0
  593. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn2c16.png +0 -0
  594. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p01.png +0 -0
  595. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p02.png +0 -0
  596. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p04.png +0 -0
  597. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn3p08.png +0 -0
  598. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn4a08.png +0 -0
  599. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn4a16.png +0 -0
  600. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn6a08.png +0 -0
  601. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/basn6a16.png +0 -0
  602. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn0g01.png +0 -0
  603. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn0g02.png +0 -0
  604. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn0g04.png +0 -0
  605. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn2c16.png +0 -0
  606. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbbn3p08.png +0 -0
  607. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbgn2c16.png +0 -0
  608. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbgn3p08.png +0 -0
  609. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbrn2c08.png +0 -0
  610. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbwn0g16.png +0 -0
  611. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbwn3p08.png +0 -0
  612. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftbyn3p08.png +0 -0
  613. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp0n0g08.png +0 -0
  614. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp0n2c08.png +0 -0
  615. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp0n3p08.png +0 -0
  616. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ftp1n3p08.png +0 -0
  617. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn0g08.png +0 -0
  618. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn0g16.png +0 -0
  619. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn2c08.png +0 -0
  620. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn2c16.png +0 -0
  621. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn3p08.png +0 -0
  622. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn4a08.png +0 -0
  623. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn4a16.png +0 -0
  624. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn6a08.png +0 -0
  625. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/ibasn6a16.png +0 -0
  626. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbbn2c16.png +0 -0
  627. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbbn3p08.png +0 -0
  628. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbgn2c16.png +0 -0
  629. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbgn3p08.png +0 -0
  630. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbrn2c08.png +0 -0
  631. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbwn0g16.png +0 -0
  632. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbwn3p08.png +0 -0
  633. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftbyn3p08.png +0 -0
  634. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp0n0g08.png +0 -0
  635. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp0n2c08.png +0 -0
  636. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp0n3p08.png +0 -0
  637. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/iftp1n3p08.png +0 -0
  638. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/README +2 -0
  639. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn0g01.png +0 -0
  640. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn0g02.png +0 -0
  641. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn0g04.png +0 -0
  642. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn3p01.png +0 -0
  643. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn3p02.png +0 -0
  644. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/ibasn3p04.png +0 -0
  645. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/iftbbn0g01.png +0 -0
  646. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/iftbbn0g02.png +0 -0
  647. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/pngsuite/interlaced/iftbbn0g04.png +0 -0
  648. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/powerpc-vsx/README +81 -0
  649. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/powerpc-vsx/linux.c +57 -0
  650. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/powerpc-vsx/linux_aux.c +34 -0
  651. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/bad_iCCP.png +0 -0
  652. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/badadler.png +0 -0
  653. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/badcrc.png +0 -0
  654. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/empty_ancillary_chunks.png +0 -0
  655. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_IDAT.png +0 -0
  656. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_bKGD_chunk.png +0 -0
  657. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_cHRM_chunk.png +0 -0
  658. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_eXIf_chunk.png +0 -0
  659. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_gAMA_chunk.png +0 -0
  660. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_hIST_chunk.png +0 -0
  661. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_iCCP_chunk.png +0 -0
  662. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_iTXt_chunk.png +0 -0
  663. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_juNK_unsafe_to_copy.png +0 -0
  664. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_juNk_safe_to_copy.png +0 -0
  665. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_pCAL_chunk.png +0 -0
  666. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_pHYs_chunk.png +0 -0
  667. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sCAL_chunk.png +0 -0
  668. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sPLT_chunk.png +0 -0
  669. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sRGB_chunk.png +0 -0
  670. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_sTER_chunk.png +0 -0
  671. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_tEXt_chunk.png +0 -0
  672. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_tIME_chunk.png +0 -0
  673. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/crashers/huge_zTXt_chunk.png +0 -0
  674. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-1.8-tRNS.png +0 -0
  675. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-1.8.png +0 -0
  676. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-linear-tRNS.png +0 -0
  677. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-linear.png +0 -0
  678. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-sRGB-tRNS.png +0 -0
  679. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-sRGB.png +0 -0
  680. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1-tRNS.png +0 -0
  681. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-1.png +0 -0
  682. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-1.8-tRNS.png +0 -0
  683. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-1.8.png +0 -0
  684. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-linear-tRNS.png +0 -0
  685. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-linear.png +0 -0
  686. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-sRGB-tRNS.png +0 -0
  687. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-sRGB.png +0 -0
  688. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16-tRNS.png +0 -0
  689. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-16.png +0 -0
  690. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-1.8-tRNS.png +0 -0
  691. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-1.8.png +0 -0
  692. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-linear-tRNS.png +0 -0
  693. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-linear.png +0 -0
  694. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-sRGB-tRNS.png +0 -0
  695. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-sRGB.png +0 -0
  696. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2-tRNS.png +0 -0
  697. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-2.png +0 -0
  698. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-1.8-tRNS.png +0 -0
  699. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-1.8.png +0 -0
  700. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-linear-tRNS.png +0 -0
  701. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-linear.png +0 -0
  702. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-sRGB-tRNS.png +0 -0
  703. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-sRGB.png +0 -0
  704. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4-tRNS.png +0 -0
  705. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-4.png +0 -0
  706. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-1.8-tRNS.png +0 -0
  707. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-1.8.png +0 -0
  708. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-linear-tRNS.png +0 -0
  709. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-linear.png +0 -0
  710. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-sRGB-tRNS.png +0 -0
  711. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-sRGB.png +0 -0
  712. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8-tRNS.png +0 -0
  713. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-8.png +0 -0
  714. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16-1.8.png +0 -0
  715. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16-linear.png +0 -0
  716. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16-sRGB.png +0 -0
  717. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-16.png +0 -0
  718. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8-1.8.png +0 -0
  719. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8-linear.png +0 -0
  720. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8-sRGB.png +0 -0
  721. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/gray-alpha-8.png +0 -0
  722. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/makepngs.sh +94 -0
  723. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-1.8-tRNS.png +0 -0
  724. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-1.8.png +0 -0
  725. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-linear-tRNS.png +0 -0
  726. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-linear.png +0 -0
  727. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-sRGB-tRNS.png +0 -0
  728. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-sRGB.png +0 -0
  729. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1-tRNS.png +0 -0
  730. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-1.png +0 -0
  731. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-1.8-tRNS.png +0 -0
  732. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-1.8.png +0 -0
  733. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-linear-tRNS.png +0 -0
  734. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-linear.png +0 -0
  735. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-sRGB-tRNS.png +0 -0
  736. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-sRGB.png +0 -0
  737. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2-tRNS.png +0 -0
  738. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-2.png +0 -0
  739. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-1.8-tRNS.png +0 -0
  740. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-1.8.png +0 -0
  741. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-linear-tRNS.png +0 -0
  742. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-linear.png +0 -0
  743. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-sRGB-tRNS.png +0 -0
  744. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-sRGB.png +0 -0
  745. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4-tRNS.png +0 -0
  746. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-4.png +0 -0
  747. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-1.8-tRNS.png +0 -0
  748. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-1.8.png +0 -0
  749. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-linear-tRNS.png +0 -0
  750. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-linear.png +0 -0
  751. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-sRGB-tRNS.png +0 -0
  752. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-sRGB.png +0 -0
  753. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8-tRNS.png +0 -0
  754. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/palette-8.png +0 -0
  755. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-1.8-tRNS.png +0 -0
  756. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-1.8.png +0 -0
  757. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-linear-tRNS.png +0 -0
  758. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-linear.png +0 -0
  759. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-sRGB-tRNS.png +0 -0
  760. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-sRGB.png +0 -0
  761. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16-tRNS.png +0 -0
  762. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-16.png +0 -0
  763. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-1.8-tRNS.png +0 -0
  764. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-1.8.png +0 -0
  765. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-linear-tRNS.png +0 -0
  766. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-linear.png +0 -0
  767. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-sRGB-tRNS.png +0 -0
  768. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-sRGB.png +0 -0
  769. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8-tRNS.png +0 -0
  770. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-8.png +0 -0
  771. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16-1.8.png +0 -0
  772. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16-linear.png +0 -0
  773. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16-sRGB.png +0 -0
  774. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-16.png +0 -0
  775. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8-1.8.png +0 -0
  776. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8-linear.png +0 -0
  777. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8-sRGB.png +0 -0
  778. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/testpngs/rgb-alpha-8.png +0 -0
  779. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/README.txt +27 -0
  780. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/checksum-icc.c +102 -0
  781. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/chkfmt +144 -0
  782. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/cvtcolor.c +188 -0
  783. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/genpng.c +881 -0
  784. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/intgamma.sh +110 -0
  785. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/makesRGB.c +430 -0
  786. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/png-fix-itxt.c +164 -0
  787. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/pngcp.c +2453 -0
  788. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/pngfix.c +4049 -0
  789. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/reindent +25 -0
  790. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/tools/sRGB.h +48 -0
  791. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/PngFile.c +454 -0
  792. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/PngFile.h +30 -0
  793. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/README.txt +61 -0
  794. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.c +978 -0
  795. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.dsp +147 -0
  796. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.dsw +29 -0
  797. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.ico +0 -0
  798. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.png +0 -0
  799. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/VisualPng.rc +152 -0
  800. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/cexcept.h +248 -0
  801. package/mgba-bridge/vendor/mgba/src/third-party/libpng/contrib/visupng/resource.h +23 -0
  802. package/mgba-bridge/vendor/mgba/src/third-party/libpng/depcomp +791 -0
  803. package/mgba-bridge/vendor/mgba/src/third-party/libpng/example.c +1040 -0
  804. package/mgba-bridge/vendor/mgba/src/third-party/libpng/install-sh +518 -0
  805. package/mgba-bridge/vendor/mgba/src/third-party/libpng/intel/filter_sse2_intrinsics.c +391 -0
  806. package/mgba-bridge/vendor/mgba/src/third-party/libpng/intel/intel_init.c +52 -0
  807. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng-config.in +127 -0
  808. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng-manual.txt +5409 -0
  809. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng.3 +6052 -0
  810. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpng.pc.in +12 -0
  811. package/mgba-bridge/vendor/mgba/src/third-party/libpng/libpngpf.3 +24 -0
  812. package/mgba-bridge/vendor/mgba/src/third-party/libpng/ltmain.sh +11147 -0
  813. package/mgba-bridge/vendor/mgba/src/third-party/libpng/mips/filter_msa_intrinsics.c +808 -0
  814. package/mgba-bridge/vendor/mgba/src/third-party/libpng/mips/mips_init.c +130 -0
  815. package/mgba-bridge/vendor/mgba/src/third-party/libpng/missing +215 -0
  816. package/mgba-bridge/vendor/mgba/src/third-party/libpng/png.5 +84 -0
  817. package/mgba-bridge/vendor/mgba/src/third-party/libpng/png.c +4607 -0
  818. package/mgba-bridge/vendor/mgba/src/third-party/libpng/png.h +3247 -0
  819. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngbar.jpg +0 -0
  820. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngbar.png +0 -0
  821. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngconf.h +623 -0
  822. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngdebug.h +153 -0
  823. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngerror.c +963 -0
  824. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngget.c +1249 -0
  825. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pnginfo.h +267 -0
  826. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngmem.c +284 -0
  827. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngnow.png +0 -0
  828. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngpread.c +1096 -0
  829. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngpriv.h +2152 -0
  830. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngread.c +4225 -0
  831. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngrio.c +120 -0
  832. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngrtran.c +5044 -0
  833. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngrutil.c +4681 -0
  834. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngset.c +1802 -0
  835. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngstruct.h +489 -0
  836. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngtest.c +2158 -0
  837. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngtest.png +0 -0
  838. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngtrans.c +864 -0
  839. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngusr.dfa +14 -0
  840. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwio.c +168 -0
  841. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwrite.c +2395 -0
  842. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwtran.c +575 -0
  843. package/mgba-bridge/vendor/mgba/src/third-party/libpng/pngwutil.c +2781 -0
  844. package/mgba-bridge/vendor/mgba/src/third-party/libpng/powerpc/filter_vsx_intrinsics.c +768 -0
  845. package/mgba-bridge/vendor/mgba/src/third-party/libpng/powerpc/powerpc_init.c +126 -0
  846. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/libpng.tgt +383 -0
  847. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/libpng.wpj +112 -0
  848. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngconfig.mak +160 -0
  849. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngstest.tgt +219 -0
  850. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngtest.tgt +179 -0
  851. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/owatcom/pngvalid.tgt +210 -0
  852. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/PRJ0041.mak +21 -0
  853. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/README.txt +58 -0
  854. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/README_zlib.txt +44 -0
  855. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/libpng.sln +60 -0
  856. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/libpng.vcproj +419 -0
  857. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/pngtest.vcproj +267 -0
  858. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/visualc71/zlib.vcproj +391 -0
  859. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/libpng/libpng.vcxproj +234 -0
  860. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pnglibconf/pnglibconf.vcxproj +61 -0
  861. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngstest/pngstest.vcxproj +219 -0
  862. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngtest/pngtest.vcxproj +220 -0
  863. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngunknown/pngunknown.vcxproj +219 -0
  864. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/pngvalid/pngvalid.vcxproj +219 -0
  865. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/vstudio.sln +109 -0
  866. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/zlib/zlib.vcxproj +175 -0
  867. package/mgba-bridge/vendor/mgba/src/third-party/libpng/projects/vstudio/zlib.props +57 -0
  868. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/README.txt +79 -0
  869. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/SCOPTIONS.ppc +7 -0
  870. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/checksym.awk +173 -0
  871. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/descrip.mms +52 -0
  872. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/dfn.awk +203 -0
  873. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/genchk.cmake.in +37 -0
  874. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/genout.cmake.in +93 -0
  875. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/gensrc.cmake.in +138 -0
  876. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/intprefix.c +22 -0
  877. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libpng-config-body.in +96 -0
  878. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libpng-config-head.in +24 -0
  879. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libpng.pc.in +10 -0
  880. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/libtool.m4 +8369 -0
  881. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/ltoptions.m4 +437 -0
  882. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/ltsugar.m4 +124 -0
  883. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/ltversion.m4 +23 -0
  884. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/lt~obsolete.m4 +99 -0
  885. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/macro.lst +3 -0
  886. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.32sunu +244 -0
  887. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.64sunu +244 -0
  888. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.acorn +57 -0
  889. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.aix +116 -0
  890. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.amiga +58 -0
  891. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.atari +71 -0
  892. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.bc32 +158 -0
  893. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.beos +222 -0
  894. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.cegcc +116 -0
  895. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.clang +87 -0
  896. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.clang-asan +87 -0
  897. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.darwin +225 -0
  898. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.dec +210 -0
  899. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.dj2 +72 -0
  900. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.freebsd +69 -0
  901. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.gcc +87 -0
  902. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.gcc-asan +87 -0
  903. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.hp64 +231 -0
  904. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.hpgcc +234 -0
  905. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.hpux +229 -0
  906. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.ibmc +90 -0
  907. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.intel +115 -0
  908. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.linux +246 -0
  909. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.linux-opt +265 -0
  910. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.mips +103 -0
  911. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.msys +202 -0
  912. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.netbsd +55 -0
  913. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.openbsd +86 -0
  914. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sco +226 -0
  915. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sggcc +236 -0
  916. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sgi +237 -0
  917. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.so9 +247 -0
  918. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.solaris +243 -0
  919. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.std +134 -0
  920. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.sunos +115 -0
  921. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makefile.vcwin32 +113 -0
  922. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/makevms.com +142 -0
  923. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/options.awk +898 -0
  924. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pnglibconf.dfa +920 -0
  925. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pnglibconf.h.prebuilt +219 -0
  926. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pnglibconf.mak +55 -0
  927. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/pngwin.rc +112 -0
  928. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/prefix.c +24 -0
  929. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/smakefile.ppc +34 -0
  930. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/sym.c +15 -0
  931. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/symbols.c +58 -0
  932. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/symbols.def +255 -0
  933. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/test.cmake.in +31 -0
  934. package/mgba-bridge/vendor/mgba/src/third-party/libpng/scripts/vers.c +19 -0
  935. package/mgba-bridge/vendor/mgba/src/third-party/libpng/test-driver +148 -0
  936. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7z.h +202 -0
  937. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zAlloc.c +80 -0
  938. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zAlloc.h +19 -0
  939. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zArcIn.c +1771 -0
  940. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zBuf.c +36 -0
  941. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zBuf.h +35 -0
  942. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zBuf2.c +52 -0
  943. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zCrc.c +128 -0
  944. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zCrc.h +25 -0
  945. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zCrcOpt.c +115 -0
  946. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zDec.c +591 -0
  947. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zFile.c +286 -0
  948. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zFile.h +83 -0
  949. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zStream.c +176 -0
  950. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zTypes.h +375 -0
  951. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zVersion.h +27 -0
  952. package/mgba-bridge/vendor/mgba/src/third-party/lzma/7zVersion.rc +55 -0
  953. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Aes.c +306 -0
  954. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Aes.h +38 -0
  955. package/mgba-bridge/vendor/mgba/src/third-party/lzma/AesOpt.c +184 -0
  956. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Alloc.c +455 -0
  957. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Alloc.h +51 -0
  958. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bcj2.c +257 -0
  959. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bcj2.h +146 -0
  960. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bcj2Enc.c +311 -0
  961. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bra.c +230 -0
  962. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bra.h +64 -0
  963. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Bra86.c +82 -0
  964. package/mgba-bridge/vendor/mgba/src/third-party/lzma/BraIA64.c +53 -0
  965. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Compiler.h +33 -0
  966. package/mgba-bridge/vendor/mgba/src/third-party/lzma/CpuArch.c +218 -0
  967. package/mgba-bridge/vendor/mgba/src/third-party/lzma/CpuArch.h +336 -0
  968. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Delta.c +64 -0
  969. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Delta.h +19 -0
  970. package/mgba-bridge/vendor/mgba/src/third-party/lzma/DllSecur.c +108 -0
  971. package/mgba-bridge/vendor/mgba/src/third-party/lzma/DllSecur.h +20 -0
  972. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFind.c +1127 -0
  973. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFind.h +121 -0
  974. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFindMt.c +853 -0
  975. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzFindMt.h +101 -0
  976. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzHash.h +57 -0
  977. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Dec.c +488 -0
  978. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Dec.h +120 -0
  979. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2DecMt.c +1082 -0
  980. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2DecMt.h +79 -0
  981. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Enc.c +803 -0
  982. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma2Enc.h +55 -0
  983. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma86.h +111 -0
  984. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma86Dec.c +54 -0
  985. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Lzma86Enc.c +106 -0
  986. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaDec.c +1185 -0
  987. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaDec.h +234 -0
  988. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaEnc.c +2976 -0
  989. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaEnc.h +76 -0
  990. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaLib.c +40 -0
  991. package/mgba-bridge/vendor/mgba/src/third-party/lzma/LzmaLib.h +131 -0
  992. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtCoder.c +601 -0
  993. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtCoder.h +141 -0
  994. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtDec.c +1138 -0
  995. package/mgba-bridge/vendor/mgba/src/third-party/lzma/MtDec.h +201 -0
  996. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd.h +85 -0
  997. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7.c +712 -0
  998. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7.h +142 -0
  999. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7Dec.c +191 -0
  1000. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Ppmd7Enc.c +187 -0
  1001. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Precomp.h +10 -0
  1002. package/mgba-bridge/vendor/mgba/src/third-party/lzma/RotateDefs.h +30 -0
  1003. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sha256.c +248 -0
  1004. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sha256.h +26 -0
  1005. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sort.c +141 -0
  1006. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Sort.h +18 -0
  1007. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Threads.c +95 -0
  1008. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Threads.h +68 -0
  1009. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/7z.dsp +241 -0
  1010. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/7z.dsw +29 -0
  1011. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/7zMain.c +686 -0
  1012. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/Precomp.c +4 -0
  1013. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/Precomp.h +10 -0
  1014. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/makefile +40 -0
  1015. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/7z/makefile.gcc +75 -0
  1016. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/LzmaUtil.c +258 -0
  1017. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/LzmaUtil.dsp +168 -0
  1018. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/LzmaUtil.dsw +29 -0
  1019. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/makefile +28 -0
  1020. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/Lzma/makefile.gcc +44 -0
  1021. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLib.def +4 -0
  1022. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLib.dsp +178 -0
  1023. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLib.dsw +29 -0
  1024. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/LzmaLibExports.c +14 -0
  1025. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/makefile +34 -0
  1026. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/LzmaLib/resource.rc +3 -0
  1027. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/Precomp.c +4 -0
  1028. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/Precomp.h +10 -0
  1029. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/SfxSetup.c +640 -0
  1030. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/SfxSetup.dsp +231 -0
  1031. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/SfxSetup.dsw +29 -0
  1032. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/makefile +37 -0
  1033. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/makefile_con +38 -0
  1034. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/resource.rc +5 -0
  1035. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Util/SfxSetup/setup.ico +0 -0
  1036. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Xz.c +90 -0
  1037. package/mgba-bridge/vendor/mgba/src/third-party/lzma/Xz.h +460 -0
  1038. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzCrc64.c +86 -0
  1039. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzCrc64.h +26 -0
  1040. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzCrc64Opt.c +69 -0
  1041. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzDec.c +2766 -0
  1042. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzEnc.c +1329 -0
  1043. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzEnc.h +60 -0
  1044. package/mgba-bridge/vendor/mgba/src/third-party/lzma/XzIn.c +319 -0
  1045. package/mgba-bridge/vendor/mgba/src/third-party/zlib/CMakeLists.txt +249 -0
  1046. package/mgba-bridge/vendor/mgba/src/third-party/zlib/ChangeLog +1578 -0
  1047. package/mgba-bridge/vendor/mgba/src/third-party/zlib/FAQ +368 -0
  1048. package/mgba-bridge/vendor/mgba/src/third-party/zlib/INDEX +68 -0
  1049. package/mgba-bridge/vendor/mgba/src/third-party/zlib/Makefile +5 -0
  1050. package/mgba-bridge/vendor/mgba/src/third-party/zlib/Makefile.in +408 -0
  1051. package/mgba-bridge/vendor/mgba/src/third-party/zlib/README +118 -0
  1052. package/mgba-bridge/vendor/mgba/src/third-party/zlib/adler32.c +186 -0
  1053. package/mgba-bridge/vendor/mgba/src/third-party/zlib/amiga/Makefile.pup +69 -0
  1054. package/mgba-bridge/vendor/mgba/src/third-party/zlib/amiga/Makefile.sas +68 -0
  1055. package/mgba-bridge/vendor/mgba/src/third-party/zlib/compress.c +86 -0
  1056. package/mgba-bridge/vendor/mgba/src/third-party/zlib/configure +927 -0
  1057. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/README.contrib +57 -0
  1058. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/buffer_demo.adb +106 -0
  1059. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/mtest.adb +156 -0
  1060. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/read.adb +156 -0
  1061. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/readme.txt +65 -0
  1062. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/test.adb +463 -0
  1063. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-streams.adb +225 -0
  1064. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-streams.ads +114 -0
  1065. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-thin.adb +141 -0
  1066. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib-thin.ads +450 -0
  1067. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib.adb +701 -0
  1068. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib.ads +328 -0
  1069. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/ada/zlib.gpr +20 -0
  1070. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/Makefile +8 -0
  1071. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/README +4 -0
  1072. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/blast.c +466 -0
  1073. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/blast.h +83 -0
  1074. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/test.pk +0 -0
  1075. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/blast/test.txt +1 -0
  1076. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/ZLib.pas +557 -0
  1077. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/ZLibConst.pas +11 -0
  1078. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/readme.txt +76 -0
  1079. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/delphi/zlibd32.mak +99 -0
  1080. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
  1081. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
  1082. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
  1083. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
  1084. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
  1085. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
  1086. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
  1087. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
  1088. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
  1089. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
  1090. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib.build +33 -0
  1091. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib.chm +0 -0
  1092. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/DotZLib.sln +21 -0
  1093. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/LICENSE_1_0.txt +23 -0
  1094. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/dotzlib/readme.txt +58 -0
  1095. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/gcc_gvmat64/gvmat64.S +574 -0
  1096. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/README +1 -0
  1097. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/infback9.c +615 -0
  1098. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/infback9.h +37 -0
  1099. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inffix9.h +107 -0
  1100. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inflate9.h +47 -0
  1101. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inftree9.c +324 -0
  1102. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/infback9/inftree9.h +61 -0
  1103. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream/test.cpp +24 -0
  1104. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream/zfstream.cpp +329 -0
  1105. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream/zfstream.h +128 -0
  1106. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream2/zstream.h +307 -0
  1107. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream2/zstream_test.cpp +25 -0
  1108. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/README +35 -0
  1109. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/TODO +17 -0
  1110. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/test.cc +50 -0
  1111. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/zfstream.cc +479 -0
  1112. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/iostream3/zfstream.h +466 -0
  1113. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/Makefile +29 -0
  1114. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/Makefile.am +45 -0
  1115. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/MiniZip64_Changes.txt +6 -0
  1116. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/MiniZip64_info.txt +74 -0
  1117. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/configure.ac +32 -0
  1118. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/crypt.h +132 -0
  1119. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/ioapi.c +257 -0
  1120. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/ioapi.h +210 -0
  1121. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/iowin32.c +462 -0
  1122. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/iowin32.h +28 -0
  1123. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/make_vms.com +25 -0
  1124. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/miniunz.c +659 -0
  1125. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/miniunzip.1 +63 -0
  1126. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/minizip.1 +46 -0
  1127. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/minizip.c +521 -0
  1128. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/minizip.pc.in +12 -0
  1129. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/mztools.c +291 -0
  1130. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/mztools.h +37 -0
  1131. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/unzip.c +2128 -0
  1132. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/unzip.h +437 -0
  1133. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/zip.c +2007 -0
  1134. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/minizip/zip.h +367 -0
  1135. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/example.pas +599 -0
  1136. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/readme.txt +76 -0
  1137. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/zlibd32.mak +99 -0
  1138. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/pascal/zlibpas.pas +276 -0
  1139. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/Makefile +42 -0
  1140. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/README +63 -0
  1141. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/puff.c +840 -0
  1142. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/puff.h +35 -0
  1143. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/pufftest.c +165 -0
  1144. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/puff/zeros.raw +0 -0
  1145. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/testzlib/testzlib.c +275 -0
  1146. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/testzlib/testzlib.txt +10 -0
  1147. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/untgz/Makefile +14 -0
  1148. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/untgz/Makefile.msc +17 -0
  1149. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/untgz/untgz.c +674 -0
  1150. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/readme.txt +78 -0
  1151. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/miniunz.vcxproj +310 -0
  1152. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters +22 -0
  1153. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/minizip.vcxproj +307 -0
  1154. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters +22 -0
  1155. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlib.vcxproj +420 -0
  1156. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters +58 -0
  1157. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj +310 -0
  1158. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters +22 -0
  1159. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlib.rc +32 -0
  1160. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibstat.vcxproj +473 -0
  1161. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters +77 -0
  1162. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.def +158 -0
  1163. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.sln +135 -0
  1164. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.vcxproj +657 -0
  1165. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters +118 -0
  1166. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/miniunz.vcxproj +314 -0
  1167. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/minizip.vcxproj +311 -0
  1168. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/testzlib.vcxproj +426 -0
  1169. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj +314 -0
  1170. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlib.rc +32 -0
  1171. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibstat.vcxproj +464 -0
  1172. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibvc.def +158 -0
  1173. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibvc.sln +117 -0
  1174. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc11/zlibvc.vcxproj +688 -0
  1175. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/miniunz.vcxproj +316 -0
  1176. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/minizip.vcxproj +313 -0
  1177. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/testzlib.vcxproj +430 -0
  1178. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj +316 -0
  1179. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlib.rc +32 -0
  1180. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibstat.vcxproj +467 -0
  1181. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibvc.def +158 -0
  1182. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibvc.sln +119 -0
  1183. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc12/zlibvc.vcxproj +692 -0
  1184. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/miniunz.vcxproj +316 -0
  1185. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/minizip.vcxproj +313 -0
  1186. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/testzlib.vcxproj +430 -0
  1187. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj +316 -0
  1188. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlib.rc +32 -0
  1189. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibstat.vcxproj +467 -0
  1190. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibvc.def +158 -0
  1191. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibvc.sln +119 -0
  1192. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc14/zlibvc.vcxproj +692 -0
  1193. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/miniunz.vcproj +565 -0
  1194. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/minizip.vcproj +562 -0
  1195. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/testzlib.vcproj +852 -0
  1196. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/testzlibdll.vcproj +565 -0
  1197. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlib.rc +32 -0
  1198. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibstat.vcproj +835 -0
  1199. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibvc.def +158 -0
  1200. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibvc.sln +144 -0
  1201. package/mgba-bridge/vendor/mgba/src/third-party/zlib/contrib/vstudio/vc9/zlibvc.vcproj +1156 -0
  1202. package/mgba-bridge/vendor/mgba/src/third-party/zlib/crc32.c +1116 -0
  1203. package/mgba-bridge/vendor/mgba/src/third-party/zlib/crc32.h +9446 -0
  1204. package/mgba-bridge/vendor/mgba/src/third-party/zlib/deflate.c +2211 -0
  1205. package/mgba-bridge/vendor/mgba/src/third-party/zlib/deflate.h +346 -0
  1206. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/algorithm.txt +209 -0
  1207. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/crc-doc.1.0.pdf +0 -0
  1208. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/rfc1950.txt +619 -0
  1209. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/rfc1951.txt +955 -0
  1210. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/rfc1952.txt +675 -0
  1211. package/mgba-bridge/vendor/mgba/src/third-party/zlib/doc/txtvsbin.txt +107 -0
  1212. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/README.examples +54 -0
  1213. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/enough.c +597 -0
  1214. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/fitblk.c +233 -0
  1215. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gun.c +702 -0
  1216. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzappend.c +504 -0
  1217. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzjoin.c +449 -0
  1218. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzlog.c +1061 -0
  1219. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gzlog.h +91 -0
  1220. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/gznorm.c +470 -0
  1221. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zlib_how.html +545 -0
  1222. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zpipe.c +205 -0
  1223. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zran.c +479 -0
  1224. package/mgba-bridge/vendor/mgba/src/third-party/zlib/examples/zran.h +40 -0
  1225. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzclose.c +25 -0
  1226. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzguts.h +219 -0
  1227. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzlib.c +639 -0
  1228. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzread.c +652 -0
  1229. package/mgba-bridge/vendor/mgba/src/third-party/zlib/gzwrite.c +677 -0
  1230. package/mgba-bridge/vendor/mgba/src/third-party/zlib/infback.c +641 -0
  1231. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inffast.c +323 -0
  1232. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inffast.h +11 -0
  1233. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inffixed.h +94 -0
  1234. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inflate.c +1592 -0
  1235. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inflate.h +126 -0
  1236. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inftrees.c +304 -0
  1237. package/mgba-bridge/vendor/mgba/src/third-party/zlib/inftrees.h +62 -0
  1238. package/mgba-bridge/vendor/mgba/src/third-party/zlib/make_vms.com +867 -0
  1239. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.bor +115 -0
  1240. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.dj2 +104 -0
  1241. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.emx +69 -0
  1242. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.msc +112 -0
  1243. package/mgba-bridge/vendor/mgba/src/third-party/zlib/msdos/Makefile.tc +100 -0
  1244. package/mgba-bridge/vendor/mgba/src/third-party/zlib/nintendods/Makefile +126 -0
  1245. package/mgba-bridge/vendor/mgba/src/third-party/zlib/nintendods/README +5 -0
  1246. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/Makefile.emx +69 -0
  1247. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/Makefile.riscos +151 -0
  1248. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/README +3 -0
  1249. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/descrip.mms +48 -0
  1250. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/os2/Makefile.os2 +136 -0
  1251. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/os2/zlib.def +51 -0
  1252. package/mgba-bridge/vendor/mgba/src/third-party/zlib/old/visual-basic.txt +160 -0
  1253. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/README400 +48 -0
  1254. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/bndsrc +119 -0
  1255. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/make.sh +366 -0
  1256. package/mgba-bridge/vendor/mgba/src/third-party/zlib/os400/zlib.inc +527 -0
  1257. package/mgba-bridge/vendor/mgba/src/third-party/zlib/qnx/package.qpg +141 -0
  1258. package/mgba-bridge/vendor/mgba/src/third-party/zlib/treebuild.xml +116 -0
  1259. package/mgba-bridge/vendor/mgba/src/third-party/zlib/trees.c +1182 -0
  1260. package/mgba-bridge/vendor/mgba/src/third-party/zlib/trees.h +128 -0
  1261. package/mgba-bridge/vendor/mgba/src/third-party/zlib/uncompr.c +93 -0
  1262. package/mgba-bridge/vendor/mgba/src/third-party/zlib/watcom/watcom_f.mak +43 -0
  1263. package/mgba-bridge/vendor/mgba/src/third-party/zlib/watcom/watcom_l.mak +43 -0
  1264. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/DLL_FAQ.txt +397 -0
  1265. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/Makefile.bor +109 -0
  1266. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/Makefile.gcc +177 -0
  1267. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/Makefile.msc +159 -0
  1268. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/README-WIN32.txt +103 -0
  1269. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/VisualC.txt +3 -0
  1270. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/zlib.def +97 -0
  1271. package/mgba-bridge/vendor/mgba/src/third-party/zlib/win32/zlib1.rc +40 -0
  1272. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zconf.h +534 -0
  1273. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zconf.h.cmakein +536 -0
  1274. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zconf.h.in +534 -0
  1275. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.3 +149 -0
  1276. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.3.pdf +0 -0
  1277. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.h +1935 -0
  1278. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.map +100 -0
  1279. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.pc.cmakein +13 -0
  1280. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib.pc.in +13 -0
  1281. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zlib2ansi +152 -0
  1282. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zutil.c +325 -0
  1283. package/mgba-bridge/vendor/mgba/src/third-party/zlib/zutil.h +274 -0
  1284. package/mgba-bridge/vendor/mgba/src/tools/docgen.c +541 -0
  1285. package/mgba-bridge/vendor/mgba/src/tools/font-sdf.c +136 -0
  1286. package/mgba-bridge/vendor/mgba/src/tools/updater-main.c +377 -0
  1287. package/mgba-bridge/vendor/mgba/src/util/CMakeLists.txt +68 -0
  1288. package/mgba-bridge/vendor/mgba/src/util/audio-buffer.c +62 -0
  1289. package/mgba-bridge/vendor/mgba/src/util/audio-resampler.c +109 -0
  1290. package/mgba-bridge/vendor/mgba/src/util/circle-buffer.c +274 -0
  1291. package/mgba-bridge/vendor/mgba/src/util/configuration.c +233 -0
  1292. package/mgba-bridge/vendor/mgba/src/util/convolve.c +182 -0
  1293. package/mgba-bridge/vendor/mgba/src/util/crc32.c +138 -0
  1294. package/mgba-bridge/vendor/mgba/src/util/elf-read.c +128 -0
  1295. package/mgba-bridge/vendor/mgba/src/util/formatting.c +87 -0
  1296. package/mgba-bridge/vendor/mgba/src/util/gbk-table.c +129 -0
  1297. package/mgba-bridge/vendor/mgba/src/util/geometry.c +94 -0
  1298. package/mgba-bridge/vendor/mgba/src/util/gui/file-select.c +236 -0
  1299. package/mgba-bridge/vendor/mgba/src/util/gui/font-metrics.c +199 -0
  1300. package/mgba-bridge/vendor/mgba/src/util/gui/font.c +169 -0
  1301. package/mgba-bridge/vendor/mgba/src/util/gui/menu.c +412 -0
  1302. package/mgba-bridge/vendor/mgba/src/util/gui.c +81 -0
  1303. package/mgba-bridge/vendor/mgba/src/util/hash.c +108 -0
  1304. package/mgba-bridge/vendor/mgba/src/util/image/export.c +81 -0
  1305. package/mgba-bridge/vendor/mgba/src/util/image/font.c +274 -0
  1306. package/mgba-bridge/vendor/mgba/src/util/image/png-io.c +730 -0
  1307. package/mgba-bridge/vendor/mgba/src/util/image.c +1109 -0
  1308. package/mgba-bridge/vendor/mgba/src/util/interpolator.c +116 -0
  1309. package/mgba-bridge/vendor/mgba/src/util/md5.c +228 -0
  1310. package/mgba-bridge/vendor/mgba/src/util/memory.c +15 -0
  1311. package/mgba-bridge/vendor/mgba/src/util/patch-fast.c +130 -0
  1312. package/mgba-bridge/vendor/mgba/src/util/patch-ips.c +93 -0
  1313. package/mgba-bridge/vendor/mgba/src/util/patch-ups.c +254 -0
  1314. package/mgba-bridge/vendor/mgba/src/util/patch.c +25 -0
  1315. package/mgba-bridge/vendor/mgba/src/util/ring-fifo.c +104 -0
  1316. package/mgba-bridge/vendor/mgba/src/util/sfo.c +229 -0
  1317. package/mgba-bridge/vendor/mgba/src/util/sha1.c +258 -0
  1318. package/mgba-bridge/vendor/mgba/src/util/string.c +652 -0
  1319. package/mgba-bridge/vendor/mgba/src/util/table.c +682 -0
  1320. package/mgba-bridge/vendor/mgba/src/util/text-codec.c +197 -0
  1321. package/mgba-bridge/vendor/mgba/src/util/vector.c +18 -0
  1322. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-devlist.c +104 -0
  1323. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-dirent.c +173 -0
  1324. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-fd.c +282 -0
  1325. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-fifo.c +102 -0
  1326. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-file.c +159 -0
  1327. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-lzma.c +404 -0
  1328. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-mem.c +331 -0
  1329. package/mgba-bridge/vendor/mgba/src/util/vfs/vfs-zip.c +804 -0
  1330. package/mgba-bridge/vendor/mgba/src/util/vfs.c +320 -0
  1331. package/mgba-bridge/vendor/mgba/tools/deploy-mac.py +178 -0
  1332. package/mgba-bridge/vendor/mgba/tools/deploy-win.sh +27 -0
  1333. package/mgba-bridge/vendor/mgba/tools/dlls.gdb +3 -0
  1334. package/mgba-bridge/vendor/mgba/tools/make-dotcode.py +154 -0
  1335. package/mgba-bridge/vendor/mgba/tools/perf.py +230 -0
  1336. package/mgba-bridge/vendor/mgba/tools/sanitize-deb.sh +74 -0
  1337. package/mgba-bridge/vendor/mgba/tools/snes-tile.py +94 -0
  1338. package/mgba-bridge/vendor/mgba/version.cmake +62 -0
  1339. package/package.json +47 -0
  1340. package/src/audio-output.ts +387 -0
  1341. package/src/config.ts +114 -0
  1342. package/src/constants.ts +37 -0
  1343. package/src/extension.ts +570 -0
  1344. package/src/gameboy-mgba.ts +133 -0
  1345. package/src/gameboy-types.ts +24 -0
  1346. package/src/gameboy.ts +33 -0
  1347. package/src/index.ts +1 -0
  1348. package/src/mgba/bridge-bin.ts +66 -0
  1349. package/src/mgba/bridge.ts +145 -0
  1350. package/src/mgba/protocol.ts +30 -0
  1351. package/src/mgba/stdio.ts +74 -0
  1352. package/src/notify.ts +12 -0
  1353. package/src/pi-boy-component.ts +372 -0
  1354. package/src/render/ansi.ts +239 -0
  1355. package/src/render/kitty.ts +154 -0
  1356. package/src/roms.ts +163 -0
  1357. package/src/runtime.ts +36 -0
  1358. package/src/save-state.ts +94 -0
  1359. package/src/terminal.ts +18 -0
  1360. package/tsconfig.json +11 -0
  1361. package/types/shims.d.ts +121 -0
@@ -0,0 +1,2611 @@
1
+ /* Copyright (c) 2013-2015 Jeffrey Pfau
2
+ *
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
+ #include "libretro.h"
7
+
8
+ #include <mgba-util/common.h>
9
+
10
+ #include <mgba/core/cheats.h>
11
+ #include <mgba/core/core.h>
12
+ #include <mgba/core/log.h>
13
+ #include <mgba/core/serialize.h>
14
+ #include <mgba/core/version.h>
15
+ #include <mgba-util/audio-buffer.h>
16
+ #include <mgba-util/audio-resampler.h>
17
+ #ifdef M_CORE_GB
18
+ #include <mgba/gb/core.h>
19
+ #include <mgba/internal/gb/gb.h>
20
+ #include <mgba/internal/gb/mbc.h>
21
+ #include <mgba/internal/gb/overrides.h>
22
+ #endif
23
+ #ifdef M_CORE_GBA
24
+ #include <mgba/gba/core.h>
25
+ #include <mgba/gba/interface.h>
26
+ #include <mgba/internal/gba/gba.h>
27
+ #endif
28
+ #include <mgba-util/memory.h>
29
+ #include <mgba-util/vfs.h>
30
+
31
+ #ifndef __LIBRETRO__
32
+ #error "Can't compile the libretro core as anything other than libretro."
33
+ #endif
34
+
35
+ #ifdef _3DS
36
+ #include <3ds.h>
37
+ FS_Archive sdmcArchive;
38
+ #endif
39
+
40
+ #ifdef HAVE_LIBNX
41
+ #include <switch.h>
42
+ #endif
43
+
44
+ #include "libretro_core_options.h"
45
+
46
+ #define GBA_RESAMPLED_RATE 65536
47
+ static unsigned targetSampleRate = GBA_RESAMPLED_RATE;
48
+ #define GB_SAMPLES 512
49
+ /* An alpha factor of 1/180 is *somewhat* equivalent
50
+ * to calculating the average for the last 180
51
+ * frames, or 3 seconds of runtime... */
52
+ #define SAMPLES_PER_FRAME_MOVING_AVG_ALPHA (1.0f / 180.0f)
53
+ #define EVENT_RATE 60
54
+
55
+ #define VIDEO_WIDTH_MAX 256
56
+ #define VIDEO_HEIGHT_MAX 224
57
+ #define VIDEO_BUFF_SIZE (VIDEO_WIDTH_MAX * VIDEO_HEIGHT_MAX * sizeof(mColor))
58
+
59
+ static retro_environment_t environCallback;
60
+ static retro_video_refresh_t videoCallback;
61
+ static retro_audio_sample_batch_t audioCallback;
62
+ static retro_input_poll_t inputPollCallback;
63
+ static retro_input_state_t inputCallback;
64
+ static retro_log_printf_t logCallback;
65
+ static retro_set_rumble_state_t rumbleCallback;
66
+ static retro_sensor_get_input_t sensorGetCallback;
67
+ static retro_set_sensor_state_t sensorStateCallback;
68
+
69
+ static bool libretro_supports_bitmasks = false;
70
+
71
+ static void GBARetroLog(struct mLogger* logger, int category, enum mLogLevel level, const char* format, va_list args);
72
+
73
+ static void _postAudioBuffer(struct mAVStream*, struct mAudioBuffer*);
74
+ static void _audioRateChanged(struct mAVStream*, unsigned rate);
75
+ static void _setRumble(struct mRumbleIntegrator*, float level);
76
+ static uint8_t _readLux(struct GBALuminanceSource* lux);
77
+ static void _updateLux(struct GBALuminanceSource* lux);
78
+ static void _updateCamera(const uint32_t* buffer, unsigned width, unsigned height, size_t pitch);
79
+ static void _startImage(struct mImageSource*, unsigned w, unsigned h, int colorFormats);
80
+ static void _stopImage(struct mImageSource*);
81
+ static void _requestImage(struct mImageSource*, const void** buffer, size_t* stride, enum mColorFormat* colorFormat);
82
+ static void _updateRotation(struct mRotationSource* source);
83
+ static int32_t _readTiltX(struct mRotationSource* source);
84
+ static int32_t _readTiltY(struct mRotationSource* source);
85
+ static int32_t _readGyroZ(struct mRotationSource* source);
86
+ static void _setupMaps(struct mCore* core);
87
+
88
+ static struct mCore* core;
89
+ static mColor* outputBuffer = NULL;
90
+ struct mAudioBuffer audioResampleBuffer;
91
+ struct mAudioResampler audioResampler;
92
+ static int16_t *audioSampleBuffer = NULL;
93
+ static size_t audioSampleBufferSize;
94
+ static void* data;
95
+ static size_t dataSize;
96
+ static void* savedata;
97
+ static struct mAVStream stream;
98
+ static bool sensorsInitDone;
99
+ static bool rumbleInitDone;
100
+ static struct mRumbleIntegrator rumble;
101
+ static struct GBALuminanceSource lux;
102
+ static struct mRotationSource rotation;
103
+ static bool tiltEnabled;
104
+ static bool gyroEnabled;
105
+ static int luxLevelIndex;
106
+ static uint8_t luxLevel;
107
+ static bool luxSensorEnabled;
108
+ static bool luxSensorUsed;
109
+ static struct mLogger logger;
110
+ static struct retro_camera_callback cam;
111
+ static struct mImageSource imageSource;
112
+ static uint32_t* camData = NULL;
113
+ static unsigned camWidth;
114
+ static unsigned camHeight;
115
+ static unsigned imcapWidth;
116
+ static unsigned imcapHeight;
117
+ static size_t camStride;
118
+ static bool envVarsUpdated;
119
+ static unsigned frameskipType;
120
+ static unsigned frameskipThreshold;
121
+ static uint16_t frameskipCounter;
122
+ static bool retroAudioBuffActive;
123
+ static unsigned retroAudioBuffOccupancy;
124
+ static bool retroAudioBuffUnderrun;
125
+ static unsigned retroAudioLatency;
126
+ static bool updateAudioLatency;
127
+ static bool updateAudioRate;
128
+ static bool deferredSetup = false;
129
+ static bool useBitmasks = true;
130
+ static bool envVarsUpdated;
131
+ static int32_t tiltX = 0;
132
+ static int32_t tiltY = 0;
133
+ static int32_t gyroZ = 0;
134
+ static bool audioLowPassEnabled = false;
135
+ static int32_t audioLowPassRange = 0;
136
+ static int32_t audioLowPassLeftPrev = 0;
137
+ static int32_t audioLowPassRightPrev = 0;
138
+
139
+ static const int keymap[] = {
140
+ RETRO_DEVICE_ID_JOYPAD_A,
141
+ RETRO_DEVICE_ID_JOYPAD_B,
142
+ RETRO_DEVICE_ID_JOYPAD_SELECT,
143
+ RETRO_DEVICE_ID_JOYPAD_START,
144
+ RETRO_DEVICE_ID_JOYPAD_RIGHT,
145
+ RETRO_DEVICE_ID_JOYPAD_LEFT,
146
+ RETRO_DEVICE_ID_JOYPAD_UP,
147
+ RETRO_DEVICE_ID_JOYPAD_DOWN,
148
+ RETRO_DEVICE_ID_JOYPAD_R,
149
+ RETRO_DEVICE_ID_JOYPAD_L,
150
+ };
151
+
152
+ #ifndef GIT_VERSION
153
+ #define GIT_VERSION ""
154
+ #endif
155
+ const char* const projectVersion = "0.11-dev" GIT_VERSION;
156
+ const char* const projectName = "mGBA";
157
+
158
+ /* Maximum number of consecutive frames that
159
+ * can be skipped */
160
+ #define RETRO_FRAMESKIP_MAX 30
161
+
162
+ /* Frame skipping functions */
163
+
164
+ static void _retroAudioBuffStatusCallback(bool active, unsigned occupancy, bool underrunLikely) {
165
+ retroAudioBuffActive = active;
166
+ retroAudioBuffOccupancy = occupancy;
167
+ retroAudioBuffUnderrun = underrunLikely;
168
+ }
169
+
170
+ static void _initFrameskip(void) {
171
+
172
+ if (frameskipType > 0) {
173
+
174
+ bool calculateAudioLatency = true;
175
+
176
+ if (frameskipType == 3) { /* Fixed Interval */
177
+ environCallback(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK, NULL);
178
+ } else {
179
+
180
+ struct retro_audio_buffer_status_callback BuffStatusCb;
181
+ BuffStatusCb.callback = _retroAudioBuffStatusCallback;
182
+
183
+ if (!environCallback(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK, &BuffStatusCb)) {
184
+
185
+ if (logCallback)
186
+ logCallback(RETRO_LOG_WARN, "Frameskip disabled - frontend does not support audio buffer status monitoring.\n");
187
+
188
+ retroAudioBuffActive = false;
189
+ retroAudioBuffOccupancy = 0;
190
+ retroAudioBuffUnderrun = false;
191
+ retroAudioLatency = 0;
192
+ calculateAudioLatency = false;
193
+ }
194
+ }
195
+
196
+ if (calculateAudioLatency) {
197
+
198
+ /* Frameskip is enabled - increase frontend
199
+ * audio latency to minimise potential
200
+ * buffer underruns */
201
+ float frameTimeMsec = 1000.0f * (float)core->frameCycles(core) /
202
+ (float)core->frequency(core);
203
+
204
+ /* Set latency to 6x current frame time... */
205
+ retroAudioLatency = (unsigned)((6.0f * frameTimeMsec) + 0.5f);
206
+
207
+ /* ...then round up to nearest multiple of 32 */
208
+ retroAudioLatency = (retroAudioLatency + 0x1F) & ~0x1F;
209
+ }
210
+
211
+ } else {
212
+ environCallback(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK, NULL);
213
+ retroAudioLatency = 0;
214
+ }
215
+
216
+ updateAudioLatency = true;
217
+ }
218
+
219
+ static void _loadFrameskipSettings(struct mCoreOptions *opts) {
220
+
221
+ struct retro_variable var;
222
+ unsigned oldFrameskipType;
223
+ unsigned frameskipInterval;
224
+
225
+ var.key = "mgba_frameskip";
226
+ var.value = 0;
227
+
228
+ oldFrameskipType = frameskipType;
229
+ frameskipType = 0;
230
+
231
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
232
+ if (strcmp(var.value, "auto") == 0) {
233
+ frameskipType = 1;
234
+ } else if (strcmp(var.value, "auto_threshold") == 0) {
235
+ frameskipType = 2;
236
+ } else if (strcmp(var.value, "fixed_interval") == 0) {
237
+ frameskipType = 3;
238
+ }
239
+ }
240
+
241
+ var.key = "mgba_frameskip_threshold";
242
+ var.value = 0;
243
+
244
+ frameskipThreshold = 33;
245
+
246
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
247
+ frameskipThreshold = strtol(var.value, NULL, 10);
248
+
249
+ var.key = "mgba_frameskip_interval";
250
+ var.value = 0;
251
+
252
+ frameskipInterval = 0;
253
+
254
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
255
+ frameskipInterval = strtol(var.value, NULL, 10);
256
+
257
+ /* Update internal (mGBA config) frameskip value */
258
+ if (opts) {
259
+ opts->frameskip = (frameskipType == 3) ?
260
+ frameskipInterval : 0;
261
+ } else {
262
+ mCoreConfigSetUIntValue(&core->config, "frameskip",
263
+ (frameskipType == 3) ? frameskipInterval : 0);
264
+ mCoreLoadConfig(core);
265
+ }
266
+
267
+ /* (Re)initialise frameskipping, if required */
268
+ if (opts || (frameskipType != oldFrameskipType)) {
269
+ _initFrameskip();
270
+ }
271
+ }
272
+
273
+ /* Audio post processing */
274
+ static void _audioLowPassFilter(int16_t *buffer, int count) {
275
+
276
+ int samples = count;
277
+ int16_t *out = buffer;
278
+
279
+ /* Restore previous samples */
280
+ int32_t audioLowPassLeft = audioLowPassLeftPrev;
281
+ int32_t audioLowPassRight = audioLowPassRightPrev;
282
+
283
+ /* Single-pole low-pass filter (6 dB/octave) */
284
+ int32_t factorA = audioLowPassRange;
285
+ int32_t factorB = 0x10000 - factorA;
286
+
287
+ do {
288
+ /* Apply low-pass filter */
289
+ audioLowPassLeft = (audioLowPassLeft * factorA) + (*out * factorB);
290
+ audioLowPassRight = (audioLowPassRight * factorA) + (*(out + 1) * factorB);
291
+
292
+ /* 16.16 fixed point */
293
+ audioLowPassLeft >>= 16;
294
+ audioLowPassRight >>= 16;
295
+
296
+ /* Update sound buffer */
297
+ *out++ = (int16_t) audioLowPassLeft;
298
+ *out++ = (int16_t) audioLowPassRight;
299
+ } while (--samples);
300
+
301
+ /* Save last samples for next frame */
302
+ audioLowPassLeftPrev = audioLowPassLeft;
303
+ audioLowPassRightPrev = audioLowPassRight;
304
+ }
305
+
306
+ static void _loadAudioLowPassFilterSettings(void) {
307
+
308
+ struct retro_variable var;
309
+ audioLowPassEnabled = false;
310
+ audioLowPassRange = (60 * 0x10000) / 100;
311
+
312
+ var.key = "mgba_audio_low_pass_filter";
313
+ var.value = 0;
314
+
315
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
316
+ if (strcmp(var.value, "enabled") == 0) {
317
+ audioLowPassEnabled = true;
318
+ }
319
+ }
320
+
321
+ var.key = "mgba_audio_low_pass_range";
322
+ var.value = 0;
323
+
324
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
325
+ audioLowPassRange = (strtol(var.value, NULL, 10) * 0x10000) / 100;
326
+ }
327
+ }
328
+
329
+ /* Video post processing */
330
+ #if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
331
+
332
+ /* Colour correction */
333
+ #define CC_TARGET_GAMMA 2.2f
334
+ #define CC_RGB_MAX 31.0f
335
+
336
+ /* > Note: GBC and GBA share almost identical
337
+ * colour space, but we maintain independent
338
+ * values in case of future adjustments */
339
+ #define GBC_CC_LUM 0.94f
340
+ #define GBC_CC_R 0.82f
341
+ #define GBC_CC_G 0.665f
342
+ #define GBC_CC_B 0.73f
343
+ #define GBC_CC_RG 0.125f
344
+ #define GBC_CC_RB 0.195f
345
+ #define GBC_CC_GR 0.24f
346
+ #define GBC_CC_GB 0.075f
347
+ #define GBC_CC_BR -0.06f
348
+ #define GBC_CC_BG 0.21f
349
+ #define GBC_CC_GAMMA_ADJ -0.5f
350
+
351
+ #define GBA_CC_LUM 0.94f
352
+ #define GBA_CC_R 0.82f
353
+ #define GBA_CC_G 0.665f
354
+ #define GBA_CC_B 0.73f
355
+ #define GBA_CC_RG 0.125f
356
+ #define GBA_CC_RB 0.195f
357
+ #define GBA_CC_GR 0.24f
358
+ #define GBA_CC_GB 0.075f
359
+ #define GBA_CC_BR -0.06f
360
+ #define GBA_CC_BG 0.21f
361
+ #define GBA_CC_GAMMA_ADJ 1.0f
362
+
363
+ static mColor* ccLUT = NULL;
364
+ static unsigned ccType = 0;
365
+ static bool colorCorrectionEnabled = false;
366
+
367
+ static void _initColorCorrection(void) {
368
+
369
+ /* Constants */
370
+ static const float displayGammaInv = 1.0f / CC_TARGET_GAMMA;
371
+ static const float rgbMaxInv = 1.0f / CC_RGB_MAX;
372
+
373
+ /* Variables */
374
+ enum GBModel model = GB_MODEL_AUTODETECT;
375
+ float ccLum;
376
+ float ccR;
377
+ float ccG;
378
+ float ccB;
379
+ float ccRG;
380
+ float ccRB;
381
+ float ccGR;
382
+ float ccGB;
383
+ float ccBR;
384
+ float ccBG;
385
+ float adjustedGamma;
386
+ size_t color;
387
+
388
+ /* Set colour correction parameters */
389
+ colorCorrectionEnabled = false;
390
+ switch (ccType) {
391
+ case 1:
392
+ model = GB_MODEL_AGB;
393
+ break;
394
+ case 2:
395
+ model = GB_MODEL_CGB;
396
+ break;
397
+ case 3:
398
+ {
399
+ /* Autodetect
400
+ * (Note: This is somewhat clumsy due to the
401
+ * M_CORE_GBA & M_CORE_GB defines... */
402
+ #ifdef M_CORE_GBA
403
+ if (core->platform(core) == mPLATFORM_GBA) {
404
+ model = GB_MODEL_AGB;
405
+ }
406
+ #endif
407
+
408
+ #ifdef M_CORE_GB
409
+ if (model != GB_MODEL_AGB) {
410
+ if (core->platform(core) == mPLATFORM_GB) {
411
+
412
+ const char* modelName = mCoreConfigGetValue(&core->config, "gb.model");
413
+ struct GB* gb = core->board;
414
+
415
+ if (modelName) {
416
+ gb->model = GBNameToModel(modelName);
417
+ } else {
418
+ GBDetectModel(gb);
419
+ }
420
+
421
+ if (gb->model == GB_MODEL_CGB) {
422
+ model = GB_MODEL_CGB;
423
+ }
424
+ }
425
+ }
426
+ #endif
427
+ }
428
+ break;
429
+ default:
430
+ return;
431
+ }
432
+
433
+ switch (model) {
434
+ case GB_MODEL_AGB:
435
+ ccLum = GBA_CC_LUM;
436
+ ccR = GBA_CC_R;
437
+ ccG = GBA_CC_G;
438
+ ccB = GBA_CC_B;
439
+ ccRG = GBA_CC_RG;
440
+ ccRB = GBA_CC_RB;
441
+ ccGR = GBA_CC_GR;
442
+ ccGB = GBA_CC_GB;
443
+ ccBR = GBA_CC_BR;
444
+ ccBG = GBA_CC_BG;
445
+ adjustedGamma = CC_TARGET_GAMMA + GBA_CC_GAMMA_ADJ;
446
+ break;
447
+ case GB_MODEL_CGB:
448
+ ccLum = GBC_CC_LUM;
449
+ ccR = GBC_CC_R;
450
+ ccG = GBC_CC_G;
451
+ ccB = GBC_CC_B;
452
+ ccRG = GBC_CC_RG;
453
+ ccRB = GBC_CC_RB;
454
+ ccGR = GBC_CC_GR;
455
+ ccGB = GBC_CC_GB;
456
+ ccBR = GBC_CC_BR;
457
+ ccBG = GBC_CC_BG;
458
+ adjustedGamma = CC_TARGET_GAMMA + GBC_CC_GAMMA_ADJ;
459
+ break;
460
+ default:
461
+ return;
462
+ }
463
+
464
+ /* Allocate look-up table buffer, if required */
465
+ if (!ccLUT) {
466
+ size_t lutSize = 65536 * sizeof(mColor);
467
+ ccLUT = malloc(lutSize);
468
+ if (!ccLUT) {
469
+ return;
470
+ }
471
+ memset(ccLUT, 0xFF, lutSize);
472
+ }
473
+
474
+ /* If we get this far, then colour correction is enabled... */
475
+ colorCorrectionEnabled = true;
476
+
477
+ /* Populate colour correction look-up table
478
+ * Note: This is somewhat slow (~100 ms on desktop),
479
+ * but using precompiled look-up tables would double
480
+ * the memory requirements, and make updating colour
481
+ * correction parameters an absolute nightmare...) */
482
+ for (color = 0; color < 65536; color++) {
483
+ unsigned rFinal = 0;
484
+ unsigned gFinal = 0;
485
+ unsigned bFinal = 0;
486
+ /* Extract values from RGB565 input */
487
+ const unsigned r = color >> 11 & 0x1F;
488
+ const unsigned g = color >> 6 & 0x1F;
489
+ const unsigned b = color & 0x1F;
490
+ /* Perform gamma expansion */
491
+ float rFloat = pow((float)r * rgbMaxInv, adjustedGamma);
492
+ float gFloat = pow((float)g * rgbMaxInv, adjustedGamma);
493
+ float bFloat = pow((float)b * rgbMaxInv, adjustedGamma);
494
+ /* Perform colour mangling */
495
+ float rCorrect = ccLum * ((ccR * rFloat) + (ccGR * gFloat) + (ccBR * bFloat));
496
+ float gCorrect = ccLum * ((ccRG * rFloat) + (ccG * gFloat) + (ccBG * bFloat));
497
+ float bCorrect = ccLum * ((ccRB * rFloat) + (ccGB * gFloat) + (ccB * bFloat));
498
+ /* Range check... */
499
+ rCorrect = rCorrect > 0.0f ? rCorrect : 0.0f;
500
+ gCorrect = gCorrect > 0.0f ? gCorrect : 0.0f;
501
+ bCorrect = bCorrect > 0.0f ? bCorrect : 0.0f;
502
+ /* Perform gamma compression */
503
+ rCorrect = pow(rCorrect, displayGammaInv);
504
+ gCorrect = pow(gCorrect, displayGammaInv);
505
+ bCorrect = pow(bCorrect, displayGammaInv);
506
+ /* Range check... */
507
+ rCorrect = rCorrect > 1.0f ? 1.0f : rCorrect;
508
+ gCorrect = gCorrect > 1.0f ? 1.0f : gCorrect;
509
+ bCorrect = bCorrect > 1.0f ? 1.0f : bCorrect;
510
+ /* Convert back to RGB565 */
511
+ rFinal = (unsigned)((rCorrect * CC_RGB_MAX) + 0.5f) & 0x1F;
512
+ gFinal = (unsigned)((gCorrect * CC_RGB_MAX) + 0.5f) & 0x1F;
513
+ bFinal = (unsigned)((bCorrect * CC_RGB_MAX) + 0.5f) & 0x1F;
514
+ ccLUT[color] = rFinal << 11 | gFinal << 6 | bFinal;
515
+ }
516
+ }
517
+
518
+ static void _loadColorCorrectionSettings(void) {
519
+ struct retro_variable var;
520
+ unsigned oldCcType = ccType;
521
+ ccType = 0;
522
+
523
+ var.key = "mgba_color_correction";
524
+ var.value = 0;
525
+
526
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
527
+ if (strcmp(var.value, "GBA") == 0) {
528
+ ccType = 1;
529
+ } else if (strcmp(var.value, "GBC") == 0) {
530
+ ccType = 2;
531
+ } else if (strcmp(var.value, "Auto") == 0) {
532
+ ccType = 3;
533
+ }
534
+ }
535
+
536
+ if (ccType == 0) {
537
+ colorCorrectionEnabled = false;
538
+ } else if (ccType != oldCcType) {
539
+ _initColorCorrection();
540
+ }
541
+ }
542
+
543
+ /* Interframe blending */
544
+ #define LCD_RESPONSE_TIME 0.333f
545
+ /* > 'LCD Ghosting (Fast)' method does not
546
+ * correctly interpret the set response time,
547
+ * leading to an artificially subdued blur effect.
548
+ * We have to compensate for this by increasing
549
+ * the response time, hence this 'fake' value */
550
+ #define LCD_RESPONSE_TIME_FAKE 0.5f
551
+
552
+ enum frame_blend_method
553
+ {
554
+ FRAME_BLEND_NONE = 0,
555
+ FRAME_BLEND_MIX,
556
+ FRAME_BLEND_MIX_SMART,
557
+ FRAME_BLEND_LCD_GHOSTING,
558
+ FRAME_BLEND_LCD_GHOSTING_FAST
559
+ };
560
+
561
+ static enum frame_blend_method frameBlendType = FRAME_BLEND_NONE;
562
+ static bool frameBlendEnabled = false;
563
+ static mColor* outputBufferPrev1 = NULL;
564
+ static mColor* outputBufferPrev2 = NULL;
565
+ static mColor* outputBufferPrev3 = NULL;
566
+ static mColor* outputBufferPrev4 = NULL;
567
+ static float* outputBufferAccR = NULL;
568
+ static float* outputBufferAccG = NULL;
569
+ static float* outputBufferAccB = NULL;
570
+ static float frameBlendResponse[4] = {0.0f};
571
+ static bool frameBlendResponseSet = false;
572
+
573
+ static bool _allocateOutputBufferPrev(mColor** buf) {
574
+ if (!*buf) {
575
+ *buf = malloc(VIDEO_BUFF_SIZE);
576
+ if (!*buf) {
577
+ return false;
578
+ }
579
+ }
580
+ memset(*buf, 0xFFFF, VIDEO_BUFF_SIZE);
581
+ return true;
582
+ }
583
+
584
+ static bool _allocateOutputBufferAcc(void) {
585
+ size_t i;
586
+ size_t buf_size = VIDEO_WIDTH_MAX * VIDEO_HEIGHT_MAX * sizeof(float);
587
+
588
+ if (!outputBufferAccR) {
589
+ outputBufferAccR = malloc(buf_size);
590
+ if (!outputBufferAccR) {
591
+ return false;
592
+ }
593
+ }
594
+
595
+ if (!outputBufferAccG) {
596
+ outputBufferAccG = malloc(buf_size);
597
+ if (!outputBufferAccG) {
598
+ return false;
599
+ }
600
+ }
601
+
602
+ if (!outputBufferAccB) {
603
+ outputBufferAccB = malloc(buf_size);
604
+ if (!outputBufferAccB) {
605
+ return false;
606
+ }
607
+ }
608
+
609
+ /* Cannot use memset() on arrays of floats... */
610
+ for (i = 0; i < (VIDEO_WIDTH_MAX * VIDEO_HEIGHT_MAX); i++) {
611
+ outputBufferAccR[i] = 1.0f;
612
+ outputBufferAccG[i] = 1.0f;
613
+ outputBufferAccB[i] = 1.0f;
614
+ }
615
+ return true;
616
+ }
617
+
618
+ static void _initFrameBlend(void) {
619
+
620
+ frameBlendEnabled = false;
621
+
622
+ /* Allocate interframe blending buffers, as required
623
+ * NOTE: In all cases, any used buffers are 'reset'
624
+ * (filled with 0xFF) to avoid drawing garbage on
625
+ * the next frame */
626
+ switch (frameBlendType) {
627
+ case FRAME_BLEND_MIX:
628
+ /* Simple 50:50 blending requires a single buffer */
629
+ if (!_allocateOutputBufferPrev(&outputBufferPrev1)) {
630
+ return;
631
+ }
632
+ break;
633
+ case FRAME_BLEND_MIX_SMART:
634
+ /* Smart 50:50 blending requires three buffers */
635
+ if (!_allocateOutputBufferPrev(&outputBufferPrev1)) {
636
+ return;
637
+ }
638
+ if (!_allocateOutputBufferPrev(&outputBufferPrev2)) {
639
+ return;
640
+ }
641
+ if (!_allocateOutputBufferPrev(&outputBufferPrev3)) {
642
+ return;
643
+ }
644
+ break;
645
+ case FRAME_BLEND_LCD_GHOSTING:
646
+ /* 'Accurate' LCD ghosting requires four buffers */
647
+ if (!_allocateOutputBufferPrev(&outputBufferPrev1)) {
648
+ return;
649
+ }
650
+ if (!_allocateOutputBufferPrev(&outputBufferPrev2)) {
651
+ return;
652
+ }
653
+ if (!_allocateOutputBufferPrev(&outputBufferPrev3)) {
654
+ return;
655
+ }
656
+ if (!_allocateOutputBufferPrev(&outputBufferPrev4)) {
657
+ return;
658
+ }
659
+ break;
660
+ case FRAME_BLEND_LCD_GHOSTING_FAST:
661
+ /* 'Fast' LCD ghosting requires three (RGB)
662
+ * 'accumulator' buffers */
663
+ if (!_allocateOutputBufferAcc()) {
664
+ return;
665
+ }
666
+ break;
667
+ case FRAME_BLEND_NONE:
668
+ default:
669
+ /* Error condition - cannot happen
670
+ * > Just leave frameBlendEnabled set to false */
671
+ return;
672
+ }
673
+
674
+ /* Set LCD ghosting response time factors,
675
+ * if required */
676
+ if ((frameBlendType == FRAME_BLEND_LCD_GHOSTING) &&
677
+ !frameBlendResponseSet) {
678
+
679
+ /* For the default response time of 0.333,
680
+ * only four previous samples are required
681
+ * since the response factor for the fifth
682
+ * is:
683
+ * pow(LCD_RESPONSE_TIME, 5.0f) -> 0.00409
684
+ * ...which is less than half a percent, and
685
+ * therefore irrelevant.
686
+ * If the response time were significantly
687
+ * increased, we may need to rethink this
688
+ * (but more samples == greater performance
689
+ * overheads) */
690
+ frameBlendResponse[0] = LCD_RESPONSE_TIME;
691
+ frameBlendResponse[1] = pow(LCD_RESPONSE_TIME, 2.0f);
692
+ frameBlendResponse[2] = pow(LCD_RESPONSE_TIME, 3.0f);
693
+ frameBlendResponse[3] = pow(LCD_RESPONSE_TIME, 4.0f);
694
+
695
+ frameBlendResponseSet = true;
696
+ }
697
+
698
+ /* If we get this far, then interframe blending is enabled... */
699
+ frameBlendEnabled = true;
700
+ }
701
+
702
+ static void _loadFrameBlendSettings(void) {
703
+
704
+ struct retro_variable var;
705
+ enum frame_blend_method oldFrameBlendType = frameBlendType;
706
+ frameBlendType = FRAME_BLEND_NONE;
707
+
708
+ var.key = "mgba_interframe_blending";
709
+ var.value = 0;
710
+
711
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
712
+ if (strcmp(var.value, "mix") == 0) {
713
+ frameBlendType = FRAME_BLEND_MIX;
714
+ } else if (strcmp(var.value, "mix_smart") == 0) {
715
+ frameBlendType = FRAME_BLEND_MIX_SMART;
716
+ } else if (strcmp(var.value, "lcd_ghosting") == 0) {
717
+ frameBlendType = FRAME_BLEND_LCD_GHOSTING;
718
+ } else if (strcmp(var.value, "lcd_ghosting_fast") == 0) {
719
+ frameBlendType = FRAME_BLEND_LCD_GHOSTING_FAST;
720
+ }
721
+ }
722
+
723
+ if (frameBlendType == FRAME_BLEND_NONE) {
724
+ frameBlendEnabled = false;
725
+ } else if (frameBlendType != oldFrameBlendType) {
726
+ _initFrameBlend();
727
+ }
728
+ }
729
+
730
+ /* General post processing buffers/functions */
731
+ static mColor* ppOutputBuffer = NULL;
732
+
733
+ static void (*videoPostProcess)(unsigned width, unsigned height) = NULL;
734
+
735
+ /* > Note: The individual post processing functions
736
+ * are somewhat WET (Write Everything Twice), in that
737
+ * we duplicate the entire nested for loop.
738
+ * This code is performance-critical, so we want to
739
+ * minimise logic in the inner loops where possible */
740
+ static void videoPostProcessCc(unsigned width, unsigned height) {
741
+
742
+ mColor *src = outputBuffer;
743
+ mColor *dst = ppOutputBuffer;
744
+ size_t x, y;
745
+
746
+ for (y = 0; y < height; y++) {
747
+ for (x = 0; x < width; x++) {
748
+ *(dst + x) = *(ccLUT + *(src + x));
749
+ }
750
+ src += VIDEO_WIDTH_MAX;
751
+ dst += VIDEO_WIDTH_MAX;
752
+ }
753
+ }
754
+
755
+ static void videoPostProcessMix(unsigned width, unsigned height) {
756
+
757
+ mColor *srcCurr = outputBuffer;
758
+ mColor *srcPrev = outputBufferPrev1;
759
+ mColor *dst = ppOutputBuffer;
760
+ size_t x, y;
761
+
762
+ for (y = 0; y < height; y++) {
763
+ for (x = 0; x < width; x++) {
764
+
765
+ /* Get colours from current + previous frames */
766
+ mColor rgbCurr = *(srcCurr + x);
767
+ mColor rgbPrev = *(srcPrev + x);
768
+
769
+ /* Store colours for next frame */
770
+ *(srcPrev + x) = rgbCurr;
771
+
772
+ /* Mix colours
773
+ * > "Mixing Packed RGB Pixels Efficiently"
774
+ * http://blargg.8bitalley.com/info/rgb_mixing.html */
775
+ mColor rgbMix = (rgbCurr + rgbPrev + ((rgbCurr ^ rgbPrev) & 0x821)) >> 1;
776
+
777
+ /* Assign colours for current frame */
778
+ *(dst + x) = colorCorrectionEnabled ?
779
+ *(ccLUT + rgbMix) : rgbMix;
780
+ }
781
+ srcCurr += VIDEO_WIDTH_MAX;
782
+ srcPrev += VIDEO_WIDTH_MAX;
783
+ dst += VIDEO_WIDTH_MAX;
784
+ }
785
+ }
786
+
787
+ static void videoPostProcessMixSmart(unsigned width, unsigned height) {
788
+
789
+ mColor *srcCurr = outputBuffer;
790
+ mColor *srcPrev1 = outputBufferPrev1;
791
+ mColor *srcPrev2 = outputBufferPrev2;
792
+ mColor *srcPrev3 = outputBufferPrev3;
793
+ mColor *dst = ppOutputBuffer;
794
+ size_t x, y;
795
+
796
+ for (y = 0; y < height; y++) {
797
+ for (x = 0; x < width; x++) {
798
+
799
+ /* Get colours from current + previous frames */
800
+ mColor rgbCurr = *(srcCurr + x);
801
+ mColor rgbPrev1 = *(srcPrev1 + x);
802
+ mColor rgbPrev2 = *(srcPrev2 + x);
803
+ mColor rgbPrev3 = *(srcPrev3 + x);
804
+
805
+ /* Store colours for next frame */
806
+ *(srcPrev1 + x) = rgbCurr;
807
+ *(srcPrev2 + x) = rgbPrev1;
808
+ *(srcPrev3 + x) = rgbPrev2;
809
+
810
+ /* Determine whether mixing is required
811
+ * i.e. whether alternate frames have the same pixel colour,
812
+ * but adjacent frames do not */
813
+ if (((rgbCurr == rgbPrev2) || (rgbPrev1 == rgbPrev3)) &&
814
+ (rgbCurr != rgbPrev1) &&
815
+ (rgbCurr != rgbPrev3) &&
816
+ (rgbPrev1 != rgbPrev2)) {
817
+
818
+ /* Mix colours
819
+ * > "Mixing Packed RGB Pixels Efficiently"
820
+ * http://blargg.8bitalley.com/info/rgb_mixing.html */
821
+ mColor rgbMix = (rgbCurr + rgbPrev1 + ((rgbCurr ^ rgbPrev1) & 0x821)) >> 1;
822
+
823
+ /* Assign colours for current frame */
824
+ *(dst + x) = colorCorrectionEnabled ?
825
+ *(ccLUT + rgbMix) : rgbMix;
826
+
827
+ } else {
828
+ /* Just use colours for current frame */
829
+ *(dst + x) = colorCorrectionEnabled ?
830
+ *(ccLUT + rgbCurr) : rgbCurr;
831
+ }
832
+ }
833
+ srcCurr += VIDEO_WIDTH_MAX;
834
+ srcPrev1 += VIDEO_WIDTH_MAX;
835
+ srcPrev2 += VIDEO_WIDTH_MAX;
836
+ srcPrev3 += VIDEO_WIDTH_MAX;
837
+ dst += VIDEO_WIDTH_MAX;
838
+ }
839
+ }
840
+
841
+ static void videoPostProcessLcdGhost(unsigned width, unsigned height) {
842
+
843
+ mColor *srcCurr = outputBuffer;
844
+ mColor *srcPrev1 = outputBufferPrev1;
845
+ mColor *srcPrev2 = outputBufferPrev2;
846
+ mColor *srcPrev3 = outputBufferPrev3;
847
+ mColor *srcPrev4 = outputBufferPrev4;
848
+ mColor *dst = ppOutputBuffer;
849
+ float *response = frameBlendResponse;
850
+ size_t x, y;
851
+
852
+ for (y = 0; y < height; y++) {
853
+ for (x = 0; x < width; x++) {
854
+
855
+ /* Get colours from current + previous frames */
856
+ mColor rgbCurr = *(srcCurr + x);
857
+ mColor rgbPrev1 = *(srcPrev1 + x);
858
+ mColor rgbPrev2 = *(srcPrev2 + x);
859
+ mColor rgbPrev3 = *(srcPrev3 + x);
860
+ mColor rgbPrev4 = *(srcPrev4 + x);
861
+
862
+ /* Store colours for next frame */
863
+ *(srcPrev1 + x) = rgbCurr;
864
+ *(srcPrev2 + x) = rgbPrev1;
865
+ *(srcPrev3 + x) = rgbPrev2;
866
+ *(srcPrev4 + x) = rgbPrev3;
867
+
868
+ /* Unpack colours and convert to float */
869
+ float rCurr = (float)(rgbCurr >> 11 & 0x1F);
870
+ float gCurr = (float)(rgbCurr >> 6 & 0x1F);
871
+ float bCurr = (float)(rgbCurr & 0x1F);
872
+
873
+ float rPrev1 = (float)(rgbPrev1 >> 11 & 0x1F);
874
+ float gPrev1 = (float)(rgbPrev1 >> 6 & 0x1F);
875
+ float bPrev1 = (float)(rgbPrev1 & 0x1F);
876
+
877
+ float rPrev2 = (float)(rgbPrev2 >> 11 & 0x1F);
878
+ float gPrev2 = (float)(rgbPrev2 >> 6 & 0x1F);
879
+ float bPrev2 = (float)(rgbPrev2 & 0x1F);
880
+
881
+ float rPrev3 = (float)(rgbPrev3 >> 11 & 0x1F);
882
+ float gPrev3 = (float)(rgbPrev3 >> 6 & 0x1F);
883
+ float bPrev3 = (float)(rgbPrev3 & 0x1F);
884
+
885
+ float rPrev4 = (float)(rgbPrev4 >> 11 & 0x1F);
886
+ float gPrev4 = (float)(rgbPrev4 >> 6 & 0x1F);
887
+ float bPrev4 = (float)(rgbPrev4 & 0x1F);
888
+
889
+ /* Mix colours for current frame and convert back to mColor
890
+ * > Response time effect implemented via an exponential
891
+ * drop-off algorithm, taken from the 'Gameboy Classic Shader'
892
+ * by Harlequin:
893
+ * https://github.com/libretro/glsl-shaders/blob/master/handheld/shaders/gameboy/shader-files/gb-pass0.glsl */
894
+ rCurr += (rPrev1 - rCurr) * *response;
895
+ rCurr += (rPrev2 - rCurr) * *(response + 1);
896
+ rCurr += (rPrev3 - rCurr) * *(response + 2);
897
+ rCurr += (rPrev4 - rCurr) * *(response + 3);
898
+ mColor rMix = (mColor)(rCurr + 0.5f) & 0x1F;
899
+
900
+ gCurr += (gPrev1 - gCurr) * *response;
901
+ gCurr += (gPrev2 - gCurr) * *(response + 1);
902
+ gCurr += (gPrev3 - gCurr) * *(response + 2);
903
+ gCurr += (gPrev4 - gCurr) * *(response + 3);
904
+ mColor gMix = (mColor)(gCurr + 0.5f) & 0x1F;
905
+
906
+ bCurr += (bPrev1 - bCurr) * *response;
907
+ bCurr += (bPrev2 - bCurr) * *(response + 1);
908
+ bCurr += (bPrev3 - bCurr) * *(response + 2);
909
+ bCurr += (bPrev4 - bCurr) * *(response + 3);
910
+ mColor bMix = (mColor)(bCurr + 0.5f) & 0x1F;
911
+
912
+ /* Repack colours for current frame */
913
+ *(dst + x) = colorCorrectionEnabled ?
914
+ *(ccLUT + (rMix << 11 | gMix << 6 | bMix)) :
915
+ rMix << 11 | gMix << 6 | bMix;
916
+ }
917
+ srcCurr += VIDEO_WIDTH_MAX;
918
+ srcPrev1 += VIDEO_WIDTH_MAX;
919
+ srcPrev2 += VIDEO_WIDTH_MAX;
920
+ srcPrev3 += VIDEO_WIDTH_MAX;
921
+ srcPrev4 += VIDEO_WIDTH_MAX;
922
+ dst += VIDEO_WIDTH_MAX;
923
+ }
924
+ }
925
+
926
+ static void videoPostProcessLcdGhostFast(unsigned width, unsigned height) {
927
+
928
+ mColor *srcCurr = outputBuffer;
929
+ float *srcPrevR = outputBufferAccR;
930
+ float *srcPrevG = outputBufferAccG;
931
+ float *srcPrevB = outputBufferAccB;
932
+ mColor *dst = ppOutputBuffer;
933
+ size_t x, y;
934
+
935
+ for (y = 0; y < height; y++) {
936
+ for (x = 0; x < width; x++) {
937
+
938
+ /* Get colours from current + previous frames */
939
+ mColor rgbCurr = *(srcCurr + x);
940
+ float rPrev = *(srcPrevR + x);
941
+ float gPrev = *(srcPrevG + x);
942
+ float bPrev = *(srcPrevB + x);
943
+
944
+ /* Unpack current colours and convert to float */
945
+ float rCurr = (float)(rgbCurr >> 11 & 0x1F);
946
+ float gCurr = (float)(rgbCurr >> 6 & 0x1F);
947
+ float bCurr = (float)(rgbCurr & 0x1F);
948
+
949
+ /* Mix colours for current frame */
950
+ float rMix = (rCurr * (1.0f - LCD_RESPONSE_TIME_FAKE)) + (LCD_RESPONSE_TIME_FAKE * rPrev);
951
+ float gMix = (gCurr * (1.0f - LCD_RESPONSE_TIME_FAKE)) + (LCD_RESPONSE_TIME_FAKE * gPrev);
952
+ float bMix = (bCurr * (1.0f - LCD_RESPONSE_TIME_FAKE)) + (LCD_RESPONSE_TIME_FAKE * bPrev);
953
+
954
+ /* Store colours for next frame */
955
+ *(srcPrevR + x) = rMix;
956
+ *(srcPrevG + x) = gMix;
957
+ *(srcPrevB + x) = bMix;
958
+
959
+ /* Convert and repack current frame colours */
960
+ mColor rgbMix = ((mColor)(rMix + 0.5f) & 0x1F) << 11
961
+ | ((mColor)(gMix + 0.5f) & 0x1F) << 6
962
+ | ((mColor)(bMix + 0.5f) & 0x1F);
963
+
964
+ /* Assign colours for current frame */
965
+ *(dst + x) = colorCorrectionEnabled ?
966
+ *(ccLUT + rgbMix) : rgbMix;
967
+ }
968
+ srcCurr += VIDEO_WIDTH_MAX;
969
+ srcPrevR += VIDEO_WIDTH_MAX;
970
+ srcPrevG += VIDEO_WIDTH_MAX;
971
+ srcPrevB += VIDEO_WIDTH_MAX;
972
+ dst += VIDEO_WIDTH_MAX;
973
+ }
974
+ }
975
+
976
+ static void _initPostProcessing(void) {
977
+
978
+ /* Early return if all post processing elements
979
+ * are disabled */
980
+ videoPostProcess = NULL;
981
+ if (!colorCorrectionEnabled && !frameBlendEnabled) {
982
+ return;
983
+ }
984
+
985
+ /* Allocate output buffer, if required */
986
+ if (!ppOutputBuffer) {
987
+ #ifdef _3DS
988
+ ppOutputBuffer = linearMemAlign(VIDEO_BUFF_SIZE, 0x80);
989
+ #else
990
+ ppOutputBuffer = malloc(VIDEO_BUFF_SIZE);
991
+ #endif
992
+ if (!ppOutputBuffer) {
993
+ return;
994
+ }
995
+ memset(ppOutputBuffer, 0xFFFF, VIDEO_BUFF_SIZE);
996
+ }
997
+
998
+ /* Assign post processing function */
999
+ if (frameBlendEnabled) {
1000
+ switch (frameBlendType) {
1001
+ case FRAME_BLEND_MIX:
1002
+ videoPostProcess = videoPostProcessMix;
1003
+ return;
1004
+ case FRAME_BLEND_MIX_SMART:
1005
+ videoPostProcess = videoPostProcessMixSmart;
1006
+ return;
1007
+ case FRAME_BLEND_LCD_GHOSTING:
1008
+ videoPostProcess = videoPostProcessLcdGhost;
1009
+ return;
1010
+ case FRAME_BLEND_LCD_GHOSTING_FAST:
1011
+ videoPostProcess = videoPostProcessLcdGhostFast;
1012
+ return;
1013
+ case FRAME_BLEND_NONE:
1014
+ default:
1015
+ /* Cannot happen */
1016
+ videoPostProcess = colorCorrectionEnabled ?
1017
+ videoPostProcessCc : NULL;
1018
+ return;
1019
+ }
1020
+ } else if (colorCorrectionEnabled) {
1021
+ videoPostProcess = videoPostProcessCc;
1022
+ }
1023
+ }
1024
+
1025
+ static void _loadPostProcessingSettings(void) {
1026
+
1027
+ /* Load settings and initialise individual
1028
+ * post processing elements */
1029
+ _loadColorCorrectionSettings();
1030
+ _loadFrameBlendSettings();
1031
+
1032
+ /* Initialise post processing buffers/functions
1033
+ * based on configured options */
1034
+ _initPostProcessing();
1035
+ }
1036
+
1037
+ static void _deinitPostProcessing(void) {
1038
+
1039
+ ccType = 0;
1040
+ frameBlendType = FRAME_BLEND_NONE;
1041
+ colorCorrectionEnabled = false;
1042
+ frameBlendEnabled = false;
1043
+ videoPostProcess = NULL;
1044
+
1045
+ /* Free all allocated buffers */
1046
+ if (ppOutputBuffer) {
1047
+ #ifdef _3DS
1048
+ linearFree(ppOutputBuffer);
1049
+ #else
1050
+ free(ppOutputBuffer);
1051
+ #endif
1052
+ ppOutputBuffer = NULL;
1053
+ }
1054
+
1055
+ /* > Colour correction */
1056
+ if (ccLUT) {
1057
+ free(ccLUT);
1058
+ ccLUT = NULL;
1059
+ }
1060
+
1061
+ /* > Interframe blending */
1062
+ if (outputBufferPrev1) {
1063
+ free(outputBufferPrev1);
1064
+ outputBufferPrev1 = NULL;
1065
+ }
1066
+
1067
+ if (outputBufferPrev2) {
1068
+ free(outputBufferPrev2);
1069
+ outputBufferPrev2 = NULL;
1070
+ }
1071
+
1072
+ if (outputBufferPrev3) {
1073
+ free(outputBufferPrev3);
1074
+ outputBufferPrev3 = NULL;
1075
+ }
1076
+
1077
+ if (outputBufferPrev4) {
1078
+ free(outputBufferPrev4);
1079
+ outputBufferPrev4 = NULL;
1080
+ }
1081
+
1082
+ if (outputBufferAccR) {
1083
+ free(outputBufferAccR);
1084
+ outputBufferAccR = NULL;
1085
+ }
1086
+
1087
+ if (outputBufferAccG) {
1088
+ free(outputBufferAccG);
1089
+ outputBufferAccG = NULL;
1090
+ }
1091
+
1092
+ if (outputBufferAccB) {
1093
+ free(outputBufferAccB);
1094
+ outputBufferAccB = NULL;
1095
+ }
1096
+ }
1097
+
1098
+ #endif
1099
+
1100
+ static void _initSensors(void) {
1101
+ if (sensorsInitDone) {
1102
+ return;
1103
+ }
1104
+
1105
+ struct retro_sensor_interface sensorInterface;
1106
+ if (environCallback(RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE, &sensorInterface)) {
1107
+ sensorGetCallback = sensorInterface.get_sensor_input;
1108
+ sensorStateCallback = sensorInterface.set_sensor_state;
1109
+
1110
+ if (sensorStateCallback && sensorGetCallback) {
1111
+ if (sensorStateCallback(0, RETRO_SENSOR_ACCELEROMETER_ENABLE, EVENT_RATE)) {
1112
+ tiltEnabled = true;
1113
+ }
1114
+
1115
+ if (sensorStateCallback(0, RETRO_SENSOR_GYROSCOPE_ENABLE, EVENT_RATE)) {
1116
+ gyroEnabled = true;
1117
+ }
1118
+
1119
+ if (sensorStateCallback(0, RETRO_SENSOR_ILLUMINANCE_ENABLE, EVENT_RATE)) {
1120
+ luxSensorEnabled = true;
1121
+ }
1122
+ }
1123
+ }
1124
+
1125
+ sensorsInitDone = true;
1126
+ }
1127
+
1128
+ static void _initRumble(void) {
1129
+ if (rumbleInitDone) {
1130
+ return;
1131
+ }
1132
+
1133
+ struct retro_rumble_interface rumbleInterface;
1134
+ if (environCallback(RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE, &rumbleInterface)) {
1135
+ rumbleCallback = rumbleInterface.set_rumble_state;
1136
+ }
1137
+
1138
+ rumbleInitDone = true;
1139
+ }
1140
+
1141
+ #ifdef M_CORE_GB
1142
+ static void _updateGbPal(void) {
1143
+ struct retro_variable var;
1144
+ var.key = "mgba_gb_colors";
1145
+ var.value = 0;
1146
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1147
+ const struct GBColorPreset* presets;
1148
+ size_t listSize = GBColorPresetList(&presets);
1149
+ size_t i;
1150
+ for (i = 0; i < listSize; ++i) {
1151
+ if (strcmp(presets[i].name, var.value) != 0) {
1152
+ continue;
1153
+ }
1154
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[0]", presets[i].colors[0] & 0xFFFFFF);
1155
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[1]", presets[i].colors[1] & 0xFFFFFF);
1156
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[2]", presets[i].colors[2] & 0xFFFFFF);
1157
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[3]", presets[i].colors[3] & 0xFFFFFF);
1158
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[4]", presets[i].colors[4] & 0xFFFFFF);
1159
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[5]", presets[i].colors[5] & 0xFFFFFF);
1160
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[6]", presets[i].colors[6] & 0xFFFFFF);
1161
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[7]", presets[i].colors[7] & 0xFFFFFF);
1162
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[8]", presets[i].colors[8] & 0xFFFFFF);
1163
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[9]", presets[i].colors[9] & 0xFFFFFF);
1164
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[10]", presets[i].colors[10] & 0xFFFFFF);
1165
+ mCoreConfigSetUIntValue(&core->config, "gb.pal[11]", presets[i].colors[11] & 0xFFFFFF);
1166
+ core->reloadConfigOption(core, "gb.pal", NULL);
1167
+ break;
1168
+ }
1169
+ }
1170
+ }
1171
+ #endif
1172
+
1173
+ static void _reloadSettings(void) {
1174
+ struct mCoreOptions opts = {
1175
+ .useBios = true,
1176
+ .volume = 0x100,
1177
+ };
1178
+
1179
+ struct retro_variable var;
1180
+ #ifdef M_CORE_GB
1181
+ enum GBModel model;
1182
+ const char* modelName;
1183
+
1184
+ var.key = "mgba_gb_model";
1185
+ var.value = 0;
1186
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1187
+ if (strcmp(var.value, "Game Boy") == 0) {
1188
+ model = GB_MODEL_DMG;
1189
+ } else if (strcmp(var.value, "Super Game Boy") == 0) {
1190
+ model = GB_MODEL_SGB;
1191
+ } else if (strcmp(var.value, "Game Boy Color") == 0) {
1192
+ model = GB_MODEL_CGB;
1193
+ } else if (strcmp(var.value, "Super Game Boy Color") == 0) {
1194
+ model = GB_MODEL_SCGB;
1195
+ } else if (strcmp(var.value, "Game Boy Advance") == 0) {
1196
+ model = GB_MODEL_AGB;
1197
+ } else {
1198
+ model = GB_MODEL_AUTODETECT;
1199
+ }
1200
+
1201
+ modelName = GBModelToName(model);
1202
+ mCoreConfigSetDefaultValue(&core->config, "gb.model", modelName);
1203
+ mCoreConfigSetDefaultValue(&core->config, "sgb.model", modelName);
1204
+ mCoreConfigSetDefaultValue(&core->config, "cgb.model", modelName);
1205
+ mCoreConfigSetDefaultValue(&core->config, "cgb.hybridModel", modelName);
1206
+ mCoreConfigSetDefaultValue(&core->config, "cgb.sgbModel", modelName);
1207
+ }
1208
+
1209
+ var.key = "mgba_sgb_borders";
1210
+ var.value = 0;
1211
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1212
+ mCoreConfigSetDefaultIntValue(&core->config, "sgb.borders", strcmp(var.value, "ON") == 0);
1213
+ }
1214
+
1215
+ var.key = "mgba_gb_colors_preset";
1216
+ var.value = 0;
1217
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1218
+ mCoreConfigSetDefaultIntValue(&core->config, "gb.colors", strtol(var.value, NULL, 10));
1219
+ }
1220
+
1221
+ _updateGbPal();
1222
+ #endif
1223
+
1224
+ var.key = "mgba_use_bios";
1225
+ var.value = 0;
1226
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1227
+ opts.useBios = strcmp(var.value, "ON") == 0;
1228
+ }
1229
+
1230
+ var.key = "mgba_skip_bios";
1231
+ var.value = 0;
1232
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1233
+ opts.skipBios = strcmp(var.value, "ON") == 0;
1234
+ }
1235
+
1236
+ #ifdef M_CORE_GB
1237
+ var.key = "mgba_sgb_borders";
1238
+ var.value = 0;
1239
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1240
+ mCoreConfigSetDefaultIntValue(&core->config, "sgb.borders", strcmp(var.value, "ON") == 0);
1241
+ }
1242
+ #endif
1243
+
1244
+ _loadFrameskipSettings(&opts);
1245
+ _loadAudioLowPassFilterSettings();
1246
+
1247
+ var.key = "mgba_idle_optimization";
1248
+ var.value = 0;
1249
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1250
+ if (strcmp(var.value, "Don't Remove") == 0) {
1251
+ mCoreConfigSetDefaultValue(&core->config, "idleOptimization", "ignore");
1252
+ } else if (strcmp(var.value, "Remove Known") == 0) {
1253
+ mCoreConfigSetDefaultValue(&core->config, "idleOptimization", "remove");
1254
+ } else if (strcmp(var.value, "Detect and Remove") == 0) {
1255
+ mCoreConfigSetDefaultValue(&core->config, "idleOptimization", "detect");
1256
+ }
1257
+ }
1258
+
1259
+ #ifdef M_CORE_GBA
1260
+ var.key = "mgba_force_gbp";
1261
+ var.value = 0;
1262
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1263
+ mCoreConfigSetDefaultIntValue(&core->config, "gba.forceGbp", strcmp(var.value, "ON") == 0);
1264
+ }
1265
+ #endif
1266
+
1267
+ mCoreConfigLoadDefaults(&core->config, &opts);
1268
+ mCoreLoadConfig(core);
1269
+ }
1270
+
1271
+ static void _doDeferredSetup(void) {
1272
+ // Libretro API doesn't let you know when it's done copying data into the save buffers.
1273
+ // On the off-hand chance that a core actually expects its buffers to be populated when
1274
+ // you actually first get them, you're out of luck without workarounds. Yup, seriously.
1275
+ // Here's that workaround, but really the API needs to be thrown out and rewritten.
1276
+ struct VFile* save = VFileFromMemory(savedata, GBA_SIZE_FLASH1M);
1277
+
1278
+ /* need to defer resetting the core on start so drivers are initialized */
1279
+ core->reset(core);
1280
+ _setupMaps(core);
1281
+
1282
+ #if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
1283
+ _loadPostProcessingSettings();
1284
+ #endif
1285
+
1286
+ if (!core->loadSave(core, save)) {
1287
+ save->close(save);
1288
+ }
1289
+ deferredSetup = false;
1290
+ }
1291
+
1292
+ unsigned retro_api_version(void) {
1293
+ return RETRO_API_VERSION;
1294
+ }
1295
+
1296
+ void retro_set_environment(retro_environment_t env)
1297
+ {
1298
+ environCallback = env;
1299
+
1300
+ #ifdef M_CORE_GB
1301
+ const struct GBColorPreset* presets;
1302
+ size_t listSize = GBColorPresetList(&presets);
1303
+
1304
+ size_t colorOpt;
1305
+ for (colorOpt = 0; option_defs_us[colorOpt].key; ++colorOpt) {
1306
+ if (strcmp(option_defs_us[colorOpt].key, "mgba_gb_colors") == 0) {
1307
+ break;
1308
+ }
1309
+ }
1310
+ size_t i;
1311
+ for (i = 0; i < listSize && i < RETRO_NUM_CORE_OPTION_VALUES_MAX; ++i) {
1312
+ option_defs_us[colorOpt].values[i].value = presets[i].name;
1313
+ }
1314
+ #endif
1315
+
1316
+ bool categoriesSupported;
1317
+ libretro_set_core_options(environCallback, &categoriesSupported);
1318
+ }
1319
+
1320
+ void retro_set_video_refresh(retro_video_refresh_t video) {
1321
+ videoCallback = video;
1322
+ }
1323
+
1324
+ void retro_set_audio_sample(retro_audio_sample_t audio) {
1325
+ UNUSED(audio);
1326
+ }
1327
+
1328
+ void retro_set_audio_sample_batch(retro_audio_sample_batch_t audioBatch) {
1329
+ audioCallback = audioBatch;
1330
+ }
1331
+
1332
+ void retro_set_input_poll(retro_input_poll_t inputPoll) {
1333
+ inputPollCallback = inputPoll;
1334
+ }
1335
+
1336
+ void retro_set_input_state(retro_input_state_t input) {
1337
+ inputCallback = input;
1338
+ }
1339
+
1340
+ void retro_get_system_info(struct retro_system_info* info) {
1341
+ #ifdef GEKKO
1342
+ info->need_fullpath = true;
1343
+ #else
1344
+ info->need_fullpath = false;
1345
+ #endif
1346
+ #ifdef M_CORE_GB
1347
+ info->valid_extensions = "gba|gb|gbc|sgb";
1348
+ #else
1349
+ info->valid_extensions = "gba";
1350
+ #endif
1351
+ info->library_version = projectVersion;
1352
+ info->library_name = projectName;
1353
+ info->block_extract = false;
1354
+ }
1355
+
1356
+ void retro_get_system_av_info(struct retro_system_av_info* info) {
1357
+ unsigned width, height;
1358
+ core->currentVideoSize(core, &width, &height);
1359
+ info->geometry.base_width = width;
1360
+ info->geometry.base_height = height;
1361
+
1362
+ core->baseVideoSize(core, &width, &height);
1363
+ info->geometry.max_width = width;
1364
+ info->geometry.max_height = height;
1365
+
1366
+ info->geometry.aspect_ratio = width / (double) height;
1367
+ info->timing.fps = core->frequency(core) / (float) core->frameCycles(core);
1368
+
1369
+ #ifdef M_CORE_GBA
1370
+ if (core->platform(core) == mPLATFORM_GBA) {
1371
+ info->timing.sample_rate = targetSampleRate;
1372
+ } else {
1373
+ #endif
1374
+ info->timing.sample_rate = core->audioSampleRate(core);
1375
+ #ifdef M_CORE_GBA
1376
+ }
1377
+ #endif
1378
+ }
1379
+
1380
+ void retro_init(void) {
1381
+ enum retro_pixel_format fmt;
1382
+ #ifdef COLOR_16_BIT
1383
+ #if defined(COLOR_5_6_5) || defined(PS2)
1384
+ fmt = RETRO_PIXEL_FORMAT_RGB565;
1385
+ #else
1386
+ #warning This pixel format is unsupported. Please use -DCOLOR_16-BIT -DCOLOR_5_6_5
1387
+ fmt = RETRO_PIXEL_FORMAT_0RGB1555;
1388
+ #endif
1389
+ #else
1390
+ #warning This pixel format is unsupported. Please use -DCOLOR_16-BIT -DCOLOR_5_6_5
1391
+ fmt = RETRO_PIXEL_FORMAT_XRGB8888;
1392
+ #endif
1393
+ environCallback(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt);
1394
+
1395
+ struct retro_input_descriptor inputDescriptors[] = {
1396
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" },
1397
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" },
1398
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Turbo A" },
1399
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Turbo B" },
1400
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
1401
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },
1402
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
1403
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
1404
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
1405
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
1406
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" },
1407
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" },
1408
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "Turbo R" },
1409
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Turbo L" },
1410
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "Brighten Solar Sensor" },
1411
+ { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "Darken Solar Sensor" },
1412
+ { 0 }
1413
+ };
1414
+ environCallback(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, &inputDescriptors);
1415
+
1416
+ useBitmasks = environCallback(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL);
1417
+
1418
+ // TODO: RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME when BIOS booting is supported
1419
+
1420
+ rumbleInitDone = false;
1421
+ mRumbleIntegratorInit(&rumble);
1422
+ rumble.setRumble = _setRumble;
1423
+ rumbleCallback = 0;
1424
+
1425
+ sensorsInitDone = false;
1426
+ sensorGetCallback = 0;
1427
+ sensorStateCallback = 0;
1428
+
1429
+ tiltEnabled = false;
1430
+ gyroEnabled = false;
1431
+ rotation.sample = _updateRotation;
1432
+ rotation.readTiltX = _readTiltX;
1433
+ rotation.readTiltY = _readTiltY;
1434
+ rotation.readGyroZ = _readGyroZ;
1435
+
1436
+ envVarsUpdated = true;
1437
+ luxSensorUsed = false;
1438
+ luxSensorEnabled = false;
1439
+ luxLevelIndex = 0;
1440
+ luxLevel = 0;
1441
+ lux.readLuminance = _readLux;
1442
+ lux.sample = _updateLux;
1443
+ _updateLux(&lux);
1444
+
1445
+ struct retro_log_callback log;
1446
+ if (environCallback(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) {
1447
+ logCallback = log.log;
1448
+ } else {
1449
+ logCallback = 0;
1450
+ }
1451
+ logger.log = GBARetroLog;
1452
+ mLogSetDefaultLogger(&logger);
1453
+
1454
+ stream.videoDimensionsChanged = NULL;
1455
+ stream.postAudioFrame = NULL;
1456
+ stream.postAudioBuffer = NULL;
1457
+ stream.postVideoFrame = NULL;
1458
+ stream.audioRateChanged = _audioRateChanged;
1459
+
1460
+ imageSource.startRequestImage = _startImage;
1461
+ imageSource.stopRequestImage = _stopImage;
1462
+ imageSource.requestImage = _requestImage;
1463
+
1464
+ if (environCallback(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL))
1465
+ libretro_supports_bitmasks = true;
1466
+
1467
+ frameskipType = 0;
1468
+ frameskipThreshold = 0;
1469
+ frameskipCounter = 0;
1470
+ retroAudioBuffActive = false;
1471
+ retroAudioBuffOccupancy = 0;
1472
+ retroAudioBuffUnderrun = false;
1473
+ retroAudioLatency = 0;
1474
+ updateAudioLatency = false;
1475
+ updateAudioRate = false;
1476
+ }
1477
+
1478
+ void retro_deinit(void) {
1479
+ if (outputBuffer) {
1480
+ #ifdef _3DS
1481
+ linearFree(outputBuffer);
1482
+ #else
1483
+ free(outputBuffer);
1484
+ #endif
1485
+ outputBuffer = NULL;
1486
+ }
1487
+ #if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
1488
+ _deinitPostProcessing();
1489
+ #endif
1490
+
1491
+ mAudioBufferDeinit(&audioResampleBuffer);
1492
+ mAudioResamplerDeinit(&audioResampler);
1493
+
1494
+ if (audioSampleBuffer) {
1495
+ free(audioSampleBuffer);
1496
+ audioSampleBuffer = NULL;
1497
+ }
1498
+ audioSampleBufferSize = 0;
1499
+
1500
+ if (sensorStateCallback) {
1501
+ sensorStateCallback(0, RETRO_SENSOR_ACCELEROMETER_DISABLE, EVENT_RATE);
1502
+ sensorStateCallback(0, RETRO_SENSOR_GYROSCOPE_DISABLE, EVENT_RATE);
1503
+ sensorStateCallback(0, RETRO_SENSOR_ILLUMINANCE_DISABLE, EVENT_RATE);
1504
+ sensorGetCallback = NULL;
1505
+ sensorStateCallback = NULL;
1506
+ }
1507
+
1508
+ tiltEnabled = false;
1509
+ gyroEnabled = false;
1510
+ luxSensorEnabled = false;
1511
+ sensorsInitDone = false;
1512
+ useBitmasks = false;
1513
+
1514
+ audioLowPassEnabled = false;
1515
+ audioLowPassRange = 0;
1516
+ audioLowPassLeftPrev = 0;
1517
+ audioLowPassRightPrev = 0;
1518
+ }
1519
+
1520
+ static int turboclock = 0;
1521
+ static bool indownstate = true;
1522
+
1523
+ int16_t cycleturbo(bool a, bool b, bool l, bool r) {
1524
+ int16_t buttons = 0;
1525
+ turboclock++;
1526
+ if (turboclock >= 2) {
1527
+ turboclock = 0;
1528
+ indownstate = !indownstate;
1529
+ }
1530
+
1531
+ if (a) {
1532
+ buttons |= indownstate << 0;
1533
+ }
1534
+
1535
+ if (b) {
1536
+ buttons |= indownstate << 1;
1537
+ }
1538
+
1539
+ if (l) {
1540
+ buttons |= indownstate << 9;
1541
+ }
1542
+
1543
+ if (r) {
1544
+ buttons |= indownstate << 8;
1545
+ }
1546
+
1547
+ return buttons;
1548
+ }
1549
+
1550
+ void retro_run(void) {
1551
+ if (deferredSetup) {
1552
+ _doDeferredSetup();
1553
+ }
1554
+ uint16_t keys;
1555
+ bool skipFrame = false;
1556
+
1557
+ inputPollCallback();
1558
+
1559
+ bool updated = false;
1560
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) {
1561
+ envVarsUpdated = true;
1562
+
1563
+ struct retro_variable var = {
1564
+ .key = "mgba_allow_opposing_directions",
1565
+ .value = 0
1566
+ };
1567
+ if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
1568
+ mCoreConfigSetIntValue(&core->config, "allowOpposingDirections", strcmp(var.value, "yes") == 0);
1569
+ core->reloadConfigOption(core, "allowOpposingDirections", NULL);
1570
+ }
1571
+
1572
+ _loadFrameskipSettings(NULL);
1573
+ _loadAudioLowPassFilterSettings();
1574
+
1575
+ #if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
1576
+ _loadPostProcessingSettings();
1577
+ #endif
1578
+ #ifdef M_CORE_GB
1579
+ _updateGbPal();
1580
+ #endif
1581
+ }
1582
+
1583
+ keys = 0;
1584
+ int i;
1585
+ if (useBitmasks) {
1586
+ int16_t joypadMask = inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK);
1587
+ for (i = 0; i < sizeof(keymap) / sizeof(*keymap); ++i) {
1588
+ keys |= ((joypadMask >> keymap[i]) & 1) << i;
1589
+ }
1590
+ // XXX: turbo keys, should be moved to frontend
1591
+ #define JOYPAD_BIT(BUTTON) (1 << RETRO_DEVICE_ID_JOYPAD_ ## BUTTON)
1592
+ keys |= cycleturbo(joypadMask & JOYPAD_BIT(X), joypadMask & JOYPAD_BIT(Y), joypadMask & JOYPAD_BIT(L2), joypadMask & JOYPAD_BIT(R2));
1593
+ #undef JOYPAD_BIT
1594
+ } else {
1595
+ for (i = 0; i < sizeof(keymap) / sizeof(*keymap); ++i) {
1596
+ keys |= (!!inputCallback(0, RETRO_DEVICE_JOYPAD, 0, keymap[i])) << i;
1597
+ }
1598
+ // XXX: turbo keys, should be moved to frontend
1599
+ keys |= cycleturbo(
1600
+ inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X),
1601
+ inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y),
1602
+ inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2),
1603
+ inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2)
1604
+ );
1605
+ }
1606
+
1607
+ core->setKeys(core, keys);
1608
+
1609
+ if (!luxSensorUsed) {
1610
+ static bool wasAdjustingLux = false;
1611
+ if (wasAdjustingLux) {
1612
+ wasAdjustingLux = inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3) ||
1613
+ inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3);
1614
+ } else {
1615
+ if (inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3)) {
1616
+ ++luxLevelIndex;
1617
+ if (luxLevelIndex > 10) {
1618
+ luxLevelIndex = 10;
1619
+ }
1620
+ wasAdjustingLux = true;
1621
+ } else if (inputCallback(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3)) {
1622
+ --luxLevelIndex;
1623
+ if (luxLevelIndex < 0) {
1624
+ luxLevelIndex = 0;
1625
+ }
1626
+ wasAdjustingLux = true;
1627
+ }
1628
+ }
1629
+ }
1630
+
1631
+ /* Check whether current frame should
1632
+ * be skipped */
1633
+ if ((frameskipType > 0) &&
1634
+ (frameskipType != 3) && /* Ignore 'Fixed Interval' - handled internally */
1635
+ retroAudioBuffActive) {
1636
+
1637
+ switch (frameskipType) {
1638
+ case 1: /* Auto */
1639
+ skipFrame = retroAudioBuffUnderrun;
1640
+ break;
1641
+ case 2: /* Auto (Threshold) */
1642
+ skipFrame = (retroAudioBuffOccupancy < frameskipThreshold);
1643
+ break;
1644
+ default:
1645
+ skipFrame = false;
1646
+ break;
1647
+ }
1648
+
1649
+ if (skipFrame) {
1650
+ if(frameskipCounter < RETRO_FRAMESKIP_MAX) {
1651
+
1652
+ switch (core->platform(core)) {
1653
+ #ifdef M_CORE_GBA
1654
+ case mPLATFORM_GBA:
1655
+ ((struct GBA*) core->board)->video.frameskipCounter = 1;
1656
+ break;
1657
+ #endif
1658
+ #ifdef M_CORE_GB
1659
+ case mPLATFORM_GB:
1660
+ ((struct GB*) core->board)->video.frameskipCounter = 1;
1661
+ break;
1662
+ #endif
1663
+ default:
1664
+ break;
1665
+ }
1666
+ frameskipCounter++;
1667
+
1668
+ } else {
1669
+ frameskipCounter = 0;
1670
+ skipFrame = false;
1671
+ }
1672
+ } else {
1673
+ frameskipCounter = 0;
1674
+ }
1675
+ }
1676
+
1677
+ /* If frameskip settings have changed, update
1678
+ * frontend audio latency */
1679
+ if (updateAudioLatency)
1680
+ {
1681
+ environCallback(RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY,
1682
+ &retroAudioLatency);
1683
+ updateAudioLatency = false;
1684
+ }
1685
+
1686
+ core->runFrame(core);
1687
+ unsigned width, height;
1688
+ core->currentVideoSize(core, &width, &height);
1689
+
1690
+ /* If using 'Fixed Interval' frameskipping, check
1691
+ * whether a frame is currently available */
1692
+ if (frameskipType == 3) {
1693
+ switch (core->platform(core)) {
1694
+ #ifdef M_CORE_GBA
1695
+ case mPLATFORM_GBA:
1696
+ skipFrame = ((struct GBA*) core->board)->video.frameskipCounter > 0;
1697
+ break;
1698
+ #endif
1699
+ #ifdef M_CORE_GB
1700
+ case mPLATFORM_GB:
1701
+ skipFrame = ((struct GB*) core->board)->video.frameskipCounter > 0;
1702
+ break;
1703
+ #endif
1704
+ default:
1705
+ break;
1706
+ }
1707
+ }
1708
+
1709
+ if (!skipFrame) {
1710
+ #if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
1711
+ if (videoPostProcess) {
1712
+ videoPostProcess(width, height);
1713
+ videoCallback(ppOutputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
1714
+ } else
1715
+ #endif
1716
+ videoCallback(outputBuffer, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
1717
+ } else {
1718
+ videoCallback(NULL, width, height, VIDEO_WIDTH_MAX * sizeof(mColor));
1719
+ }
1720
+
1721
+ /* Check whether audio sample rate has changed */
1722
+ if (updateAudioRate) {
1723
+ struct retro_system_av_info info;
1724
+ retro_get_system_av_info(&info);
1725
+ environCallback(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &info);
1726
+ updateAudioRate = false;
1727
+ }
1728
+
1729
+ #ifdef M_CORE_GBA
1730
+ if (core->platform(core) == mPLATFORM_GBA) {
1731
+ struct mAudioBuffer *coreBuffer = core->getAudioBuffer(core);
1732
+ int coreSamplesAvail = mAudioBufferAvailable(coreBuffer);
1733
+ if (coreSamplesAvail > 0) {
1734
+ unsigned coreSampleRate = core->audioSampleRate(core);
1735
+ size_t samplesProduced;
1736
+ if (coreSampleRate != targetSampleRate) {
1737
+ /* Resample generated audio */
1738
+ mAudioResamplerSetSource(&audioResampler, coreBuffer, coreSampleRate, true);
1739
+ mAudioResamplerProcess(&audioResampler);
1740
+ /* Output resampled audio */
1741
+ size_t samplesAvail = mAudioBufferAvailable(&audioResampleBuffer);
1742
+ samplesProduced = mAudioBufferRead(&audioResampleBuffer, audioSampleBuffer, samplesAvail);
1743
+ } else {
1744
+ samplesProduced = mAudioBufferRead(coreBuffer, audioSampleBuffer, coreSamplesAvail);
1745
+ }
1746
+ if (samplesProduced > 0) {
1747
+ if (audioLowPassEnabled) {
1748
+ _audioLowPassFilter(audioSampleBuffer, samplesProduced);
1749
+ }
1750
+ audioCallback(audioSampleBuffer, samplesProduced);
1751
+ }
1752
+ }
1753
+ }
1754
+ #endif
1755
+ }
1756
+
1757
+ static void _setupMaps(struct mCore* core) {
1758
+ #ifdef M_CORE_GBA
1759
+ if (core->platform(core) == mPLATFORM_GBA) {
1760
+ struct GBA* gba = core->board;
1761
+ struct retro_memory_descriptor descs[11];
1762
+ struct retro_memory_map mmaps;
1763
+ size_t romSize = gba->memory.romSize + (gba->memory.romSize & 1);
1764
+
1765
+ memset(descs, 0, sizeof(descs));
1766
+ size_t savedataSize = retro_get_memory_size(RETRO_MEMORY_SAVE_RAM);
1767
+
1768
+ /* Map internal working RAM */
1769
+ descs[0].ptr = gba->memory.iwram;
1770
+ descs[0].start = GBA_BASE_IWRAM;
1771
+ descs[0].len = GBA_SIZE_IWRAM;
1772
+ descs[0].select = 0xFF000000;
1773
+ descs[0].flags = RETRO_MEMDESC_SYSTEM_RAM; // Allow RetroArch to access this memory for cheats
1774
+
1775
+ /* Map working RAM */
1776
+ descs[1].ptr = gba->memory.wram;
1777
+ descs[1].start = GBA_BASE_EWRAM;
1778
+ descs[1].len = GBA_SIZE_EWRAM;
1779
+ descs[1].select = 0xFF000000;
1780
+ descs[1].flags = RETRO_MEMDESC_SYSTEM_RAM; // Allow RetroArch to access this memory for cheats
1781
+
1782
+ /* Map save RAM */
1783
+ /* TODO: if SRAM is flash, use start=0 addrspace="S" instead */
1784
+ descs[2].ptr = savedataSize ? savedata : NULL;
1785
+ descs[2].start = GBA_BASE_SRAM;
1786
+ descs[2].len = savedataSize;
1787
+
1788
+ /* Map ROM */
1789
+ descs[3].ptr = gba->memory.rom;
1790
+ descs[3].start = GBA_BASE_ROM0;
1791
+ descs[3].len = romSize;
1792
+ descs[3].flags = RETRO_MEMDESC_CONST;
1793
+
1794
+ descs[4].ptr = gba->memory.rom;
1795
+ descs[4].start = GBA_BASE_ROM1;
1796
+ descs[4].len = romSize;
1797
+ descs[4].flags = RETRO_MEMDESC_CONST;
1798
+
1799
+ descs[5].ptr = gba->memory.rom;
1800
+ descs[5].start = GBA_BASE_ROM2;
1801
+ descs[5].len = romSize;
1802
+ descs[5].flags = RETRO_MEMDESC_CONST;
1803
+
1804
+ /* Map BIOS */
1805
+ descs[6].ptr = gba->memory.bios;
1806
+ descs[6].start = GBA_BASE_BIOS;
1807
+ descs[6].len = GBA_SIZE_BIOS;
1808
+ descs[6].flags = RETRO_MEMDESC_CONST;
1809
+
1810
+ /* Map VRAM */
1811
+ descs[7].ptr = gba->video.vram;
1812
+ descs[7].start = GBA_BASE_VRAM;
1813
+ descs[7].len = GBA_SIZE_VRAM;
1814
+ descs[7].select = 0xFF000000;
1815
+
1816
+ /* Map palette RAM */
1817
+ descs[8].ptr = gba->video.palette;
1818
+ descs[8].start = GBA_BASE_PALETTE_RAM;
1819
+ descs[8].len = GBA_SIZE_PALETTE_RAM;
1820
+ descs[8].select = 0xFF000000;
1821
+
1822
+ /* Map OAM */
1823
+ descs[9].ptr = &gba->video.oam; /* video.oam is a structure */
1824
+ descs[9].start = GBA_BASE_OAM;
1825
+ descs[9].len = GBA_SIZE_OAM;
1826
+ descs[9].select = 0xFF000000;
1827
+
1828
+ /* Map mmapped I/O */
1829
+ descs[10].ptr = gba->memory.io;
1830
+ descs[10].start = GBA_BASE_IO;
1831
+ descs[10].len = GBA_SIZE_IO;
1832
+
1833
+ mmaps.descriptors = descs;
1834
+ mmaps.num_descriptors = sizeof(descs) / sizeof(descs[0]);
1835
+
1836
+ bool yes = true;
1837
+ environCallback(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &mmaps);
1838
+ environCallback(RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS, &yes);
1839
+ }
1840
+ #endif
1841
+ #ifdef M_CORE_GB
1842
+ if (core->platform(core) == mPLATFORM_GB) {
1843
+ struct GB* gb = core->board;
1844
+ struct retro_memory_descriptor descs[12];
1845
+ struct retro_memory_map mmaps;
1846
+
1847
+ memset(descs, 0, sizeof(descs));
1848
+ size_t savedataSize = retro_get_memory_size(RETRO_MEMORY_SAVE_RAM);
1849
+
1850
+ unsigned i = 0;
1851
+
1852
+ /* Map ROM */
1853
+ descs[i].ptr = gb->memory.rom;
1854
+ descs[i].start = GB_BASE_CART_BANK0;
1855
+ descs[i].len = GB_SIZE_CART_BANK0;
1856
+ descs[i].flags = RETRO_MEMDESC_CONST;
1857
+ i++;
1858
+
1859
+ descs[i].ptr = gb->memory.rom;
1860
+ descs[i].offset = GB_SIZE_CART_BANK0;
1861
+ descs[i].start = GB_BASE_CART_BANK1;
1862
+ descs[i].len = GB_SIZE_CART_BANK0;
1863
+ descs[i].flags = RETRO_MEMDESC_CONST;
1864
+ i++;
1865
+
1866
+ /* Map VRAM */
1867
+ descs[i].ptr = gb->video.vram;
1868
+ descs[i].start = GB_BASE_VRAM;
1869
+ descs[i].len = GB_SIZE_VRAM_BANK0;
1870
+ i++;
1871
+
1872
+ /* Map working RAM */
1873
+ descs[i].ptr = gb->memory.wram;
1874
+ descs[i].start = GB_BASE_WORKING_RAM_BANK0;
1875
+ descs[i].len = GB_SIZE_WORKING_RAM_BANK0;
1876
+ descs[i].flags = RETRO_MEMDESC_SYSTEM_RAM; // Allow RetroArch to access this memory for cheats
1877
+ i++;
1878
+
1879
+ descs[i].ptr = gb->memory.wram;
1880
+ descs[i].offset = GB_SIZE_WORKING_RAM_BANK0;
1881
+ descs[i].start = GB_BASE_WORKING_RAM_BANK1;
1882
+ descs[i].len = GB_SIZE_WORKING_RAM_BANK0;
1883
+ descs[i].flags = RETRO_MEMDESC_SYSTEM_RAM; // Allow RetroArch to access this memory for cheats
1884
+ i++;
1885
+
1886
+ /* Map OAM */
1887
+ descs[i].ptr = &gb->video.oam; /* video.oam is a structure */
1888
+ descs[i].start = GB_BASE_OAM;
1889
+ descs[i].len = GB_SIZE_OAM;
1890
+ descs[i].select = 0xFFFFFF60;
1891
+ i++;
1892
+
1893
+ /* Map mmapped I/O */
1894
+ descs[i].ptr = gb->memory.io;
1895
+ descs[i].start = GB_BASE_IO;
1896
+ descs[i].len = GB_SIZE_IO;
1897
+ i++;
1898
+
1899
+ /* Map High RAM */
1900
+ descs[i].ptr = gb->memory.hram;
1901
+ descs[i].start = GB_BASE_HRAM;
1902
+ descs[i].len = GB_SIZE_HRAM;
1903
+ descs[i].select = 0xFFFFFF80;
1904
+ descs[i].flags = RETRO_MEMDESC_SYSTEM_RAM; // Allow RetroArch to access this memory for cheats
1905
+ i++;
1906
+
1907
+ /* Map IE Register */
1908
+ descs[i].ptr = &gb->memory.ie;
1909
+ descs[i].start = GB_BASE_IE;
1910
+ descs[i].len = 1;
1911
+ i++;
1912
+
1913
+ /* Map External RAM */
1914
+ if (savedataSize) {
1915
+ descs[i].ptr = savedata;
1916
+ descs[i].start = GB_BASE_EXTERNAL_RAM;
1917
+ descs[i].len = savedataSize < GB_SIZE_EXTERNAL_RAM ? savedataSize : GB_SIZE_EXTERNAL_RAM;
1918
+ i++;
1919
+
1920
+ if ((savedataSize & ~0xFF) > GB_SIZE_EXTERNAL_RAM) {
1921
+ descs[i].ptr = savedata;
1922
+ descs[i].offset = GB_SIZE_EXTERNAL_RAM;
1923
+ descs[i].start = 0x16000;
1924
+ descs[i].len = savedataSize - GB_SIZE_EXTERNAL_RAM;
1925
+ i++;
1926
+ }
1927
+ }
1928
+
1929
+ if (gb->model >= GB_MODEL_CGB) {
1930
+ /* Map working RAM */
1931
+ /* banks 2-7 of wram mapped in virtual address so it can be
1932
+ * accessed without bank switching, GBC only */
1933
+ descs[i].ptr = gb->memory.wram + 0x2000;
1934
+ descs[i].start = 0x10000;
1935
+ descs[i].len = GB_SIZE_WORKING_RAM - 0x2000;
1936
+ descs[i].flags = RETRO_MEMDESC_SYSTEM_RAM; // Allow RetroArch to access this memory for cheats
1937
+ i++;
1938
+ }
1939
+
1940
+ mmaps.descriptors = descs;
1941
+ mmaps.num_descriptors = i;
1942
+
1943
+ bool yes = true;
1944
+ environCallback(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &mmaps);
1945
+ environCallback(RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS, &yes);
1946
+ }
1947
+ #endif
1948
+ }
1949
+
1950
+ void retro_reset(void) {
1951
+ core->reset(core);
1952
+ mRumbleIntegratorReset(&rumble);
1953
+ _setupMaps(core);
1954
+ }
1955
+
1956
+ #ifdef GEKKO
1957
+ static size_t _readRomFile(const char *path, void **buf) {
1958
+ size_t rc;
1959
+ long len;
1960
+ FILE *file = fopen(path, "rb");
1961
+
1962
+ if (!file) {
1963
+ goto error;
1964
+ }
1965
+
1966
+ fseek(file, 0, SEEK_END);
1967
+ len = ftell(file);
1968
+ rewind(file);
1969
+ *buf = anonymousMemoryMap(len);
1970
+ if (!*buf) {
1971
+ goto error;
1972
+ }
1973
+
1974
+ if ((rc = fread(*buf, 1, len, file)) < len) {
1975
+ goto error;
1976
+ }
1977
+
1978
+ fclose(file);
1979
+ return rc;
1980
+
1981
+ error:
1982
+ if (file) {
1983
+ fclose(file);
1984
+ }
1985
+ mappedMemoryFree(*buf, len);
1986
+ *buf = NULL;
1987
+ return -1;
1988
+ }
1989
+ #endif
1990
+
1991
+ bool retro_load_game(const struct retro_game_info* game) {
1992
+ struct VFile* rom;
1993
+
1994
+ if (!game) {
1995
+ return false;
1996
+ }
1997
+
1998
+ if (game->data) {
1999
+ data = anonymousMemoryMap(game->size);
2000
+ dataSize = game->size;
2001
+ memcpy(data, game->data, game->size);
2002
+ rom = VFileFromMemory(data, game->size);
2003
+ #ifdef ENABLE_VFS
2004
+ } else {
2005
+ #ifdef GEKKO
2006
+ if ((dataSize = _readRomFile(game->path, &data)) == -1) {
2007
+ return false;
2008
+ }
2009
+ rom = VFileFromMemory(data, dataSize);
2010
+ #else
2011
+ data = NULL;
2012
+ rom = VFileOpen(game->path, O_RDONLY);
2013
+ #endif
2014
+ #endif
2015
+ }
2016
+ if (!rom) {
2017
+ return false;
2018
+ }
2019
+
2020
+ core = mCoreFindVF(rom);
2021
+ if (!core) {
2022
+ rom->close(rom);
2023
+ mappedMemoryFree(data, game->size);
2024
+ return false;
2025
+ }
2026
+ mCoreInitConfig(core, NULL);
2027
+ core->init(core);
2028
+
2029
+ #ifdef _3DS
2030
+ outputBuffer = linearMemAlign(VIDEO_BUFF_SIZE, 0x80);
2031
+ #else
2032
+ outputBuffer = malloc(VIDEO_BUFF_SIZE);
2033
+ #endif
2034
+ memset(outputBuffer, 0xFFFF, VIDEO_BUFF_SIZE);
2035
+ core->setVideoBuffer(core, outputBuffer, VIDEO_WIDTH_MAX);
2036
+
2037
+ #ifdef M_CORE_GBA
2038
+ /* GBA emulation produces a fairly regular number
2039
+ * of audio samples per frame that is consistent
2040
+ * with the set sample rate. We therefore consume
2041
+ * audio samples in retro_run() to achieve the
2042
+ * best possible frame pacing */
2043
+ if (core->platform(core) == mPLATFORM_GBA) {
2044
+ size_t audioSamplesPerFrame, audioBufferSize;
2045
+ if (!environCallback(RETRO_ENVIRONMENT_GET_TARGET_SAMPLE_RATE, &targetSampleRate))
2046
+ targetSampleRate = GBA_RESAMPLED_RATE;
2047
+ /* Get nominal output samples per frame */
2048
+ audioSamplesPerFrame = (size_t)(
2049
+ ((float) targetSampleRate * (float) core->frameCycles(core) /
2050
+ (float)core->frequency(core)) + 0.5f);
2051
+ /* Round up to nearest multiple of 1024
2052
+ * > This is more than we need, but
2053
+ * no harm in being safe... */
2054
+ audioBufferSize = ((audioSamplesPerFrame + 1024 - 1) / 1024) * 1024;
2055
+ /* Initialise resample buffer */
2056
+ mAudioBufferInit(&audioResampleBuffer, audioBufferSize, 2);
2057
+ /* Initialise resampler */
2058
+ mAudioResamplerInit(&audioResampler, mINTERPOLATOR_SINC);
2059
+ mAudioResamplerSetDestination(&audioResampler, &audioResampleBuffer, targetSampleRate);
2060
+ /* Initialise output sample buffer
2061
+ * > Multiply size by 2 (channels) */
2062
+ audioSampleBufferSize = audioBufferSize * 2;
2063
+ audioSampleBuffer = malloc(audioSampleBufferSize * sizeof(int16_t));
2064
+ } else
2065
+ #endif
2066
+ {
2067
+ /* GB/GBC emulation does not produce a number
2068
+ * of samples per frame that is consistent with
2069
+ * the set sample rate, and so it is unclear how
2070
+ * best to handle this. We therefore fallback to
2071
+ * using the regular stream-set _postAudioBuffer()
2072
+ * callback with a fixed buffer size, which seems
2073
+ * (historically) to produce adequate results */
2074
+ stream.postAudioBuffer = _postAudioBuffer;
2075
+ audioSampleBufferSize = GB_SAMPLES * 2;
2076
+ audioSampleBuffer = malloc(audioSampleBufferSize * sizeof(int16_t));
2077
+ core->setAudioBufferSize(core, GB_SAMPLES);
2078
+ }
2079
+
2080
+ core->setAVStream(core, &stream);
2081
+ core->setPeripheral(core, mPERIPH_RUMBLE, &rumble);
2082
+ core->setPeripheral(core, mPERIPH_ROTATION, &rotation);
2083
+
2084
+ savedata = anonymousMemoryMap(GBA_SIZE_FLASH1M);
2085
+ memset(savedata, 0xFF, GBA_SIZE_FLASH1M);
2086
+
2087
+ _reloadSettings();
2088
+ core->loadROM(core, rom);
2089
+ deferredSetup = true;
2090
+
2091
+ const char* sysDir = 0;
2092
+ const char* biosName = 0;
2093
+ char biosPath[PATH_MAX];
2094
+ environCallback(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &sysDir);
2095
+
2096
+ #ifdef M_CORE_GBA
2097
+ if (core->platform(core) == mPLATFORM_GBA) {
2098
+ core->setPeripheral(core, mPERIPH_GBA_LUMINANCE, &lux);
2099
+ biosName = "gba_bios.bin";
2100
+ }
2101
+ #endif
2102
+
2103
+ #ifdef M_CORE_GB
2104
+ if (core->platform(core) == mPLATFORM_GB) {
2105
+ memset(&cam, 0, sizeof(cam));
2106
+ cam.height = GBCAM_HEIGHT;
2107
+ cam.width = GBCAM_WIDTH;
2108
+ cam.caps = 1 << RETRO_CAMERA_BUFFER_RAW_FRAMEBUFFER;
2109
+ cam.frame_raw_framebuffer = _updateCamera;
2110
+ if (environCallback(RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE, &cam)) {
2111
+ core->setPeripheral(core, mPERIPH_IMAGE_SOURCE, &imageSource);
2112
+ }
2113
+
2114
+ const char* modelName = mCoreConfigGetValue(&core->config, "gb.model");
2115
+ struct GB* gb = core->board;
2116
+
2117
+ if (modelName) {
2118
+ gb->model = GBNameToModel(modelName);
2119
+ } else {
2120
+ GBDetectModel(gb);
2121
+ }
2122
+
2123
+ switch (gb->model) {
2124
+ case GB_MODEL_AGB:
2125
+ case GB_MODEL_CGB:
2126
+ case GB_MODEL_SCGB:
2127
+ biosName = "gbc_bios.bin";
2128
+ break;
2129
+ case GB_MODEL_SGB:
2130
+ biosName = "sgb_bios.bin";
2131
+ break;
2132
+ case GB_MODEL_DMG:
2133
+ default:
2134
+ biosName = "gb_bios.bin";
2135
+ break;
2136
+ }
2137
+ }
2138
+ #endif
2139
+
2140
+ #ifdef ENABLE_VFS
2141
+ if (core->opts.useBios && sysDir && biosName) {
2142
+ snprintf(biosPath, sizeof(biosPath), "%s%s%s", sysDir, PATH_SEP, biosName);
2143
+ struct VFile* bios = VFileOpen(biosPath, O_RDONLY);
2144
+ if (bios) {
2145
+ core->loadBIOS(core, bios, 0);
2146
+ }
2147
+ }
2148
+ #endif
2149
+
2150
+ return true;
2151
+ }
2152
+
2153
+ void retro_unload_game(void) {
2154
+ if (!core) {
2155
+ return;
2156
+ }
2157
+ mCoreConfigDeinit(&core->config);
2158
+ core->deinit(core);
2159
+ mappedMemoryFree(data, dataSize);
2160
+ data = 0;
2161
+ mappedMemoryFree(savedata, GBA_SIZE_FLASH1M);
2162
+ savedata = 0;
2163
+ }
2164
+
2165
+ size_t retro_serialize_size(void) {
2166
+ if (deferredSetup) {
2167
+ _doDeferredSetup();
2168
+ }
2169
+ struct VFile* vfm = VFileMemChunk(NULL, 0);
2170
+ mCoreSaveStateNamed(core, vfm, SAVESTATE_SAVEDATA | SAVESTATE_RTC);
2171
+ size_t size = vfm->size(vfm);
2172
+ vfm->close(vfm);
2173
+ return size;
2174
+ }
2175
+
2176
+ bool retro_serialize(void* data, size_t size) {
2177
+ if (deferredSetup) {
2178
+ _doDeferredSetup();
2179
+ }
2180
+ struct VFile* vfm = VFileMemChunk(NULL, 0);
2181
+ mCoreSaveStateNamed(core, vfm, SAVESTATE_SAVEDATA | SAVESTATE_RTC);
2182
+ if ((ssize_t) size > vfm->size(vfm)) {
2183
+ size = vfm->size(vfm);
2184
+ } else if ((ssize_t) size < vfm->size(vfm)) {
2185
+ vfm->close(vfm);
2186
+ return false;
2187
+ }
2188
+ vfm->seek(vfm, 0, SEEK_SET);
2189
+ vfm->read(vfm, data, size);
2190
+ vfm->close(vfm);
2191
+ return true;
2192
+ }
2193
+
2194
+ bool retro_unserialize(const void* data, size_t size) {
2195
+ if (deferredSetup) {
2196
+ _doDeferredSetup();
2197
+ }
2198
+ struct VFile* vfm = VFileFromConstMemory(data, size);
2199
+ bool success = mCoreLoadStateNamed(core, vfm, SAVESTATE_RTC);
2200
+ vfm->close(vfm);
2201
+ return success;
2202
+ }
2203
+
2204
+ void retro_cheat_reset(void) {
2205
+ mCheatDeviceClear(core->cheatDevice(core));
2206
+ }
2207
+
2208
+ void retro_cheat_set(unsigned index, bool enabled, const char* code) {
2209
+ UNUSED(index);
2210
+ UNUSED(enabled);
2211
+ struct mCheatDevice* device = core->cheatDevice(core);
2212
+ struct mCheatSet* cheatSet = NULL;
2213
+ if (mCheatSetsSize(&device->cheats)) {
2214
+ cheatSet = *mCheatSetsGetPointer(&device->cheats, 0);
2215
+ } else {
2216
+ cheatSet = device->createSet(device, NULL);
2217
+ mCheatAddSet(device, cheatSet);
2218
+ }
2219
+ // Convert the super wonky unportable libretro format to something normal
2220
+ #ifdef M_CORE_GBA
2221
+ if (core->platform(core) == mPLATFORM_GBA) {
2222
+ char realCode[] = "XXXXXXXX XXXXXXXX";
2223
+ size_t len = strlen(code) + 1; // Include null terminator
2224
+ size_t i, pos;
2225
+ for (i = 0, pos = 0; i < len; ++i) {
2226
+ if (isspace((int) code[i]) || code[i] == '+') {
2227
+ realCode[pos] = ' ';
2228
+ } else {
2229
+ realCode[pos] = code[i];
2230
+ }
2231
+ if ((pos == 13 && (realCode[pos] == ' ' || !realCode[pos])) || pos == 17) {
2232
+ realCode[pos] = '\0';
2233
+ mCheatAddLine(cheatSet, realCode, 0);
2234
+ pos = 0;
2235
+ continue;
2236
+ }
2237
+ ++pos;
2238
+ }
2239
+ }
2240
+ #endif
2241
+ #ifdef M_CORE_GB
2242
+ if (core->platform(core) == mPLATFORM_GB) {
2243
+ char realCode[] = "XXX-XXX-XXX";
2244
+ size_t len = strlen(code) + 1; // Include null terminator
2245
+ size_t i, pos;
2246
+ for (i = 0, pos = 0; i < len; ++i) {
2247
+ if (isspace((int) code[i]) || code[i] == '+') {
2248
+ realCode[pos] = '\0';
2249
+ } else {
2250
+ realCode[pos] = code[i];
2251
+ }
2252
+
2253
+ if (pos == 11 || !realCode[pos]) {
2254
+ realCode[pos] = '\0';
2255
+ mCheatAddLine(cheatSet, realCode, 0);
2256
+ pos = 0;
2257
+ continue;
2258
+ }
2259
+ ++pos;
2260
+ }
2261
+ }
2262
+ #endif
2263
+ if (cheatSet->refresh) {
2264
+ cheatSet->refresh(cheatSet, device);
2265
+ }
2266
+ }
2267
+
2268
+ unsigned retro_get_region(void) {
2269
+ return RETRO_REGION_NTSC; // TODO: This isn't strictly true
2270
+ }
2271
+
2272
+ void retro_set_controller_port_device(unsigned port, unsigned device) {
2273
+ UNUSED(port);
2274
+ UNUSED(device);
2275
+ }
2276
+
2277
+ bool retro_load_game_special(unsigned game_type, const struct retro_game_info* info, size_t num_info) {
2278
+ UNUSED(game_type);
2279
+ UNUSED(info);
2280
+ UNUSED(num_info);
2281
+ return false;
2282
+ }
2283
+
2284
+ void* retro_get_memory_data(unsigned id) {
2285
+ switch (id) {
2286
+ case RETRO_MEMORY_SAVE_RAM:
2287
+ return savedata;
2288
+ case RETRO_MEMORY_RTC:
2289
+ switch (core->platform(core)) {
2290
+ #ifdef M_CORE_GB
2291
+ case mPLATFORM_GB:
2292
+ switch (((struct GB*) core->board)->memory.mbcType) {
2293
+ case GB_MBC3_RTC:
2294
+ return &((uint8_t*) savedata)[((struct GB*) core->board)->sramSize];
2295
+ default:
2296
+ break;
2297
+ }
2298
+ #endif
2299
+ default:
2300
+ break;
2301
+ }
2302
+ case RETRO_MEMORY_SYSTEM_RAM:
2303
+ switch (core->platform(core)) {
2304
+ #ifdef M_CORE_GB
2305
+ case mPLATFORM_GB:
2306
+ return ((struct GB*)core->board)->memory.wram;
2307
+ #endif
2308
+ #ifdef M_CORE_GBA
2309
+ case mPLATFORM_GBA:
2310
+ return ((struct GBA*)core->board)->memory.wram;
2311
+ #endif
2312
+ default:
2313
+ break;
2314
+ }
2315
+ break;
2316
+ case RETRO_MEMORY_VIDEO_RAM:
2317
+ switch (core->platform(core)) {
2318
+ #ifdef M_CORE_GB
2319
+ case mPLATFORM_GB:
2320
+ return ((struct GB*)core->board)->video.renderer->vram;
2321
+ #endif
2322
+ #ifdef M_CORE_GBA
2323
+ case mPLATFORM_GBA:
2324
+ return ((struct GBA*)core->board)->video.renderer->vram;
2325
+ #endif
2326
+ default:
2327
+ break;
2328
+ }
2329
+ break;
2330
+ default:
2331
+ break;
2332
+ }
2333
+ return NULL;
2334
+ }
2335
+
2336
+ size_t retro_get_memory_size(unsigned id) {
2337
+ switch (id) {
2338
+ case RETRO_MEMORY_SAVE_RAM:
2339
+ switch (core->platform(core)) {
2340
+ #ifdef M_CORE_GBA
2341
+ case mPLATFORM_GBA:
2342
+ switch (((struct GBA*) core->board)->memory.savedata.type) {
2343
+ case GBA_SAVEDATA_AUTODETECT:
2344
+ return GBA_SIZE_FLASH1M;
2345
+ default:
2346
+ return GBASavedataSize(&((struct GBA*) core->board)->memory.savedata);
2347
+ }
2348
+ #endif
2349
+ #ifdef M_CORE_GB
2350
+ case mPLATFORM_GB:
2351
+ return ((struct GB*) core->board)->sramSize;
2352
+ #endif
2353
+ default:
2354
+ break;
2355
+ }
2356
+ break;
2357
+ case RETRO_MEMORY_RTC:
2358
+ switch (core->platform(core)) {
2359
+ #ifdef M_CORE_GB
2360
+ case mPLATFORM_GB:
2361
+ switch (((struct GB*) core->board)->memory.mbcType) {
2362
+ case GB_MBC3_RTC:
2363
+ return sizeof(struct GBMBCRTCSaveBuffer);
2364
+ default:
2365
+ break;
2366
+ }
2367
+ #endif
2368
+ default:
2369
+ break;
2370
+ }
2371
+ break;
2372
+ case RETRO_MEMORY_SYSTEM_RAM:
2373
+ return GB_SIZE_WORKING_RAM;
2374
+ case RETRO_MEMORY_VIDEO_RAM:
2375
+ return GBA_SIZE_VRAM;
2376
+ default:
2377
+ break;
2378
+ }
2379
+ return 0;
2380
+ }
2381
+
2382
+ void GBARetroLog(struct mLogger* logger, int category, enum mLogLevel level, const char* format, va_list args) {
2383
+ UNUSED(logger);
2384
+ if (!logCallback) {
2385
+ return;
2386
+ }
2387
+
2388
+ char message[128];
2389
+ vsnprintf(message, sizeof(message), format, args);
2390
+
2391
+ enum retro_log_level retroLevel = RETRO_LOG_INFO;
2392
+ switch (level) {
2393
+ case mLOG_ERROR:
2394
+ case mLOG_FATAL:
2395
+ case mLOG_ALL:
2396
+ retroLevel = RETRO_LOG_ERROR;
2397
+ break;
2398
+ case mLOG_WARN:
2399
+ retroLevel = RETRO_LOG_WARN;
2400
+ break;
2401
+ case mLOG_INFO:
2402
+ retroLevel = RETRO_LOG_INFO;
2403
+ break;
2404
+ case mLOG_GAME_ERROR:
2405
+ case mLOG_STUB:
2406
+ #ifdef NDEBUG
2407
+ return;
2408
+ #else
2409
+ retroLevel = RETRO_LOG_DEBUG;
2410
+ break;
2411
+ #endif
2412
+ case mLOG_DEBUG:
2413
+ retroLevel = RETRO_LOG_DEBUG;
2414
+ break;
2415
+ }
2416
+ #ifdef NDEBUG
2417
+ static int biosCat = -1;
2418
+ if (biosCat < 0) {
2419
+ biosCat = mLogCategoryById("gba.bios");
2420
+ }
2421
+
2422
+ if (category == biosCat) {
2423
+ return;
2424
+ }
2425
+ #endif
2426
+ logCallback(retroLevel, "%s: %s\n", mLogCategoryName(category), message);
2427
+ }
2428
+
2429
+ /* Used only for GB/GBC content */
2430
+ static void _postAudioBuffer(struct mAVStream* stream, struct mAudioBuffer* buffer) {
2431
+ UNUSED(stream);
2432
+ int produced = mAudioBufferRead(buffer, audioSampleBuffer, GB_SAMPLES);
2433
+ if (produced > 0) {
2434
+ if (audioLowPassEnabled) {
2435
+ _audioLowPassFilter(audioSampleBuffer, produced);
2436
+ }
2437
+ audioCallback(audioSampleBuffer, (size_t)produced);
2438
+ }
2439
+ }
2440
+
2441
+ static void _audioRateChanged(struct mAVStream* stream, unsigned rate) {
2442
+ UNUSED(stream);
2443
+ /* For GBA content, audio is resampled
2444
+ * to a fixed output rate so internal
2445
+ * rate changes do not require frontend
2446
+ * notification */
2447
+ #ifdef M_CORE_GBA
2448
+ if (core->platform(core) != mPLATFORM_GBA) {
2449
+ #endif
2450
+ updateAudioRate = true;
2451
+ #ifdef M_CORE_GBA
2452
+ }
2453
+ #endif
2454
+ }
2455
+
2456
+ static void _setRumble(struct mRumbleIntegrator* rumble, float level) {
2457
+ UNUSED(rumble);
2458
+ if (!rumbleInitDone) {
2459
+ _initRumble();
2460
+ }
2461
+ if (!rumbleCallback) {
2462
+ return;
2463
+ }
2464
+
2465
+ rumbleCallback(0, RETRO_RUMBLE_STRONG, level * 0xFFFF);
2466
+ rumbleCallback(0, RETRO_RUMBLE_WEAK, level * 0xFFFF);
2467
+ }
2468
+
2469
+ static void _updateLux(struct GBALuminanceSource* lux) {
2470
+ UNUSED(lux);
2471
+ struct retro_variable var = {
2472
+ .key = "mgba_solar_sensor_level",
2473
+ .value = 0
2474
+ };
2475
+ bool luxVarUpdated = envVarsUpdated;
2476
+
2477
+ if (luxVarUpdated && (!environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || !var.value)) {
2478
+ luxVarUpdated = false;
2479
+ }
2480
+
2481
+ if (luxVarUpdated) {
2482
+ luxSensorUsed = strcmp(var.value, "sensor") == 0;
2483
+ }
2484
+
2485
+ if (luxSensorUsed) {
2486
+ _initSensors();
2487
+ float fLux = luxSensorEnabled ? sensorGetCallback(0, RETRO_SENSOR_ILLUMINANCE) : 0.0f;
2488
+ luxLevel = cbrtf(fLux) * 8;
2489
+ } else {
2490
+ if (luxVarUpdated) {
2491
+ char* end;
2492
+ int newLuxLevelIndex = strtol(var.value, &end, 10);
2493
+
2494
+ if (!*end) {
2495
+ if (newLuxLevelIndex > 10) {
2496
+ luxLevelIndex = 10;
2497
+ } else if (newLuxLevelIndex < 0) {
2498
+ luxLevelIndex = 0;
2499
+ } else {
2500
+ luxLevelIndex = newLuxLevelIndex;
2501
+ }
2502
+ }
2503
+ }
2504
+
2505
+ luxLevel = 0x16;
2506
+ if (luxLevelIndex > 0) {
2507
+ luxLevel += GBA_LUX_LEVELS[luxLevelIndex - 1];
2508
+ }
2509
+ }
2510
+
2511
+ envVarsUpdated = false;
2512
+ }
2513
+
2514
+ static uint8_t _readLux(struct GBALuminanceSource* lux) {
2515
+ UNUSED(lux);
2516
+ return 0xFF - luxLevel;
2517
+ }
2518
+
2519
+ static void _updateCamera(const uint32_t* buffer, unsigned width, unsigned height, size_t pitch) {
2520
+ if (!camData || width > camWidth || height > camHeight) {
2521
+ if (camData) {
2522
+ free(camData);
2523
+ camData = NULL;
2524
+ }
2525
+ unsigned bufPitch = pitch / sizeof(*buffer);
2526
+ unsigned bufHeight = height;
2527
+ if (imcapWidth > bufPitch) {
2528
+ bufPitch = imcapWidth;
2529
+ }
2530
+ if (imcapHeight > bufHeight) {
2531
+ bufHeight = imcapHeight;
2532
+ }
2533
+ camData = malloc(sizeof(*buffer) * bufHeight * bufPitch);
2534
+ memset(camData, 0xFF, sizeof(*buffer) * bufHeight * bufPitch);
2535
+ camWidth = width;
2536
+ camHeight = bufHeight;
2537
+ camStride = bufPitch;
2538
+ }
2539
+ size_t i;
2540
+ for (i = 0; i < height; ++i) {
2541
+ memcpy(&camData[camStride * i], &buffer[pitch * i / sizeof(*buffer)], pitch);
2542
+ }
2543
+ }
2544
+
2545
+ static void _startImage(struct mImageSource* image, unsigned w, unsigned h, int colorFormats) {
2546
+ UNUSED(image);
2547
+ UNUSED(colorFormats);
2548
+
2549
+ if (camData) {
2550
+ free(camData);
2551
+ }
2552
+ camData = NULL;
2553
+ imcapWidth = w;
2554
+ imcapHeight = h;
2555
+ cam.start();
2556
+ }
2557
+
2558
+ static void _stopImage(struct mImageSource* image) {
2559
+ UNUSED(image);
2560
+ cam.stop();
2561
+ }
2562
+
2563
+ static void _requestImage(struct mImageSource* image, const void** buffer, size_t* stride, enum mColorFormat* colorFormat) {
2564
+ UNUSED(image);
2565
+ if (!camData) {
2566
+ cam.start();
2567
+ *buffer = NULL;
2568
+ return;
2569
+ }
2570
+ size_t offset = 0;
2571
+ if (imcapWidth < camWidth) {
2572
+ offset += (camWidth - imcapWidth) / 2;
2573
+ }
2574
+ if (imcapHeight < camHeight) {
2575
+ offset += (camHeight - imcapHeight) / 2 * camStride;
2576
+ }
2577
+
2578
+ *buffer = &camData[offset];
2579
+ *stride = camStride;
2580
+ *colorFormat = mCOLOR_XRGB8;
2581
+ }
2582
+
2583
+ static void _updateRotation(struct mRotationSource* source) {
2584
+ UNUSED(source);
2585
+ tiltX = 0;
2586
+ tiltY = 0;
2587
+ gyroZ = 0;
2588
+ _initSensors();
2589
+ if (tiltEnabled) {
2590
+ tiltX = sensorGetCallback(0, RETRO_SENSOR_ACCELEROMETER_X) * 3e8f;
2591
+ tiltY = sensorGetCallback(0, RETRO_SENSOR_ACCELEROMETER_Y) * -3e8f;
2592
+ }
2593
+ if (gyroEnabled) {
2594
+ gyroZ = sensorGetCallback(0, RETRO_SENSOR_GYROSCOPE_Z) * -5.5e8f;
2595
+ }
2596
+ }
2597
+
2598
+ static int32_t _readTiltX(struct mRotationSource* source) {
2599
+ UNUSED(source);
2600
+ return tiltX;
2601
+ }
2602
+
2603
+ static int32_t _readTiltY(struct mRotationSource* source) {
2604
+ UNUSED(source);
2605
+ return tiltY;
2606
+ }
2607
+
2608
+ static int32_t _readGyroZ(struct mRotationSource* source) {
2609
+ UNUSED(source);
2610
+ return gyroZ;
2611
+ }