@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,2395 @@
1
+
2
+ /* pngwrite.c - general routines to write a PNG file
3
+ *
4
+ * Copyright (c) 2018-2019 Cosmin Truta
5
+ * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
6
+ * Copyright (c) 1996-1997 Andreas Dilger
7
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
8
+ *
9
+ * This code is released under the libpng license.
10
+ * For conditions of distribution and use, see the disclaimer
11
+ * and license in png.h
12
+ */
13
+
14
+ #include "pngpriv.h"
15
+ #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
16
+ # include <errno.h>
17
+ #endif /* SIMPLIFIED_WRITE_STDIO */
18
+
19
+ #ifdef PNG_WRITE_SUPPORTED
20
+
21
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
22
+ /* Write out all the unknown chunks for the current given location */
23
+ static void
24
+ write_unknown_chunks(png_structrp png_ptr, png_const_inforp info_ptr,
25
+ unsigned int where)
26
+ {
27
+ if (info_ptr->unknown_chunks_num != 0)
28
+ {
29
+ png_const_unknown_chunkp up;
30
+
31
+ png_debug(5, "writing extra chunks");
32
+
33
+ for (up = info_ptr->unknown_chunks;
34
+ up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
35
+ ++up)
36
+ if ((up->location & where) != 0)
37
+ {
38
+ /* If per-chunk unknown chunk handling is enabled use it, otherwise
39
+ * just write the chunks the application has set.
40
+ */
41
+ #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
42
+ int keep = png_handle_as_unknown(png_ptr, up->name);
43
+
44
+ /* NOTE: this code is radically different from the read side in the
45
+ * matter of handling an ancillary unknown chunk. In the read side
46
+ * the default behavior is to discard it, in the code below the default
47
+ * behavior is to write it. Critical chunks are, however, only
48
+ * written if explicitly listed or if the default is set to write all
49
+ * unknown chunks.
50
+ *
51
+ * The default handling is also slightly weird - it is not possible to
52
+ * stop the writing of all unsafe-to-copy chunks!
53
+ *
54
+ * TODO: REVIEW: this would seem to be a bug.
55
+ */
56
+ if (keep != PNG_HANDLE_CHUNK_NEVER &&
57
+ ((up->name[3] & 0x20) /* safe-to-copy overrides everything */ ||
58
+ keep == PNG_HANDLE_CHUNK_ALWAYS ||
59
+ (keep == PNG_HANDLE_CHUNK_AS_DEFAULT &&
60
+ png_ptr->unknown_default == PNG_HANDLE_CHUNK_ALWAYS)))
61
+ #endif
62
+ {
63
+ /* TODO: review, what is wrong with a zero length unknown chunk? */
64
+ if (up->size == 0)
65
+ png_warning(png_ptr, "Writing zero-length unknown chunk");
66
+
67
+ png_write_chunk(png_ptr, up->name, up->data, up->size);
68
+ }
69
+ }
70
+ }
71
+ }
72
+ #endif /* WRITE_UNKNOWN_CHUNKS */
73
+
74
+ /* Writes all the PNG information. This is the suggested way to use the
75
+ * library. If you have a new chunk to add, make a function to write it,
76
+ * and put it in the correct location here. If you want the chunk written
77
+ * after the image data, put it in png_write_end(). I strongly encourage
78
+ * you to supply a PNG_INFO_ flag, and check info_ptr->valid before writing
79
+ * the chunk, as that will keep the code from breaking if you want to just
80
+ * write a plain PNG file. If you have long comments, I suggest writing
81
+ * them in png_write_end(), and compressing them.
82
+ */
83
+ void PNGAPI
84
+ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
85
+ {
86
+ png_debug(1, "in png_write_info_before_PLTE");
87
+
88
+ if (png_ptr == NULL || info_ptr == NULL)
89
+ return;
90
+
91
+ if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
92
+ {
93
+ /* Write PNG signature */
94
+ png_write_sig(png_ptr);
95
+
96
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
97
+ if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
98
+ png_ptr->mng_features_permitted != 0)
99
+ {
100
+ png_warning(png_ptr,
101
+ "MNG features are not allowed in a PNG datastream");
102
+ png_ptr->mng_features_permitted = 0;
103
+ }
104
+ #endif
105
+
106
+ /* Write IHDR information. */
107
+ png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
108
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
109
+ info_ptr->filter_type,
110
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
111
+ info_ptr->interlace_type
112
+ #else
113
+ 0
114
+ #endif
115
+ );
116
+
117
+ /* The rest of these check to see if the valid field has the appropriate
118
+ * flag set, and if it does, writes the chunk.
119
+ *
120
+ * 1.6.0: COLORSPACE support controls the writing of these chunks too, and
121
+ * the chunks will be written if the WRITE routine is there and
122
+ * information * is available in the COLORSPACE. (See
123
+ * png_colorspace_sync_info in png.c for where the valid flags get set.)
124
+ *
125
+ * Under certain circumstances the colorspace can be invalidated without
126
+ * syncing the info_struct 'valid' flags; this happens if libpng detects
127
+ * an error and calls png_error while the color space is being set, yet
128
+ * the application continues writing the PNG. So check the 'invalid'
129
+ * flag here too.
130
+ */
131
+ #ifdef PNG_GAMMA_SUPPORTED
132
+ # ifdef PNG_WRITE_gAMA_SUPPORTED
133
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
134
+ (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 &&
135
+ (info_ptr->valid & PNG_INFO_gAMA) != 0)
136
+ png_write_gAMA_fixed(png_ptr, info_ptr->colorspace.gamma);
137
+ # endif
138
+ #endif
139
+
140
+ #ifdef PNG_COLORSPACE_SUPPORTED
141
+ /* Write only one of sRGB or an ICC profile. If a profile was supplied
142
+ * and it matches one of the known sRGB ones issue a warning.
143
+ */
144
+ # ifdef PNG_WRITE_iCCP_SUPPORTED
145
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
146
+ (info_ptr->valid & PNG_INFO_iCCP) != 0)
147
+ {
148
+ # ifdef PNG_WRITE_sRGB_SUPPORTED
149
+ if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
150
+ png_app_warning(png_ptr,
151
+ "profile matches sRGB but writing iCCP instead");
152
+ # endif
153
+
154
+ png_write_iCCP(png_ptr, info_ptr->iccp_name,
155
+ info_ptr->iccp_profile);
156
+ }
157
+ # ifdef PNG_WRITE_sRGB_SUPPORTED
158
+ else
159
+ # endif
160
+ # endif
161
+
162
+ # ifdef PNG_WRITE_sRGB_SUPPORTED
163
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
164
+ (info_ptr->valid & PNG_INFO_sRGB) != 0)
165
+ png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
166
+ # endif /* WRITE_sRGB */
167
+ #endif /* COLORSPACE */
168
+
169
+ #ifdef PNG_WRITE_sBIT_SUPPORTED
170
+ if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
171
+ png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
172
+ #endif
173
+
174
+ #ifdef PNG_COLORSPACE_SUPPORTED
175
+ # ifdef PNG_WRITE_cHRM_SUPPORTED
176
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
177
+ (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
178
+ (info_ptr->valid & PNG_INFO_cHRM) != 0)
179
+ png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
180
+ # endif
181
+ #endif
182
+
183
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
184
+ write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
185
+ #endif
186
+
187
+ png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
188
+ }
189
+ }
190
+
191
+ void PNGAPI
192
+ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
193
+ {
194
+ #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
195
+ int i;
196
+ #endif
197
+
198
+ png_debug(1, "in png_write_info");
199
+
200
+ if (png_ptr == NULL || info_ptr == NULL)
201
+ return;
202
+
203
+ png_write_info_before_PLTE(png_ptr, info_ptr);
204
+
205
+ if ((info_ptr->valid & PNG_INFO_PLTE) != 0)
206
+ png_write_PLTE(png_ptr, info_ptr->palette,
207
+ (png_uint_32)info_ptr->num_palette);
208
+
209
+ else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
210
+ png_error(png_ptr, "Valid palette required for paletted images");
211
+
212
+ #ifdef PNG_WRITE_tRNS_SUPPORTED
213
+ if ((info_ptr->valid & PNG_INFO_tRNS) !=0)
214
+ {
215
+ #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
216
+ /* Invert the alpha channel (in tRNS) */
217
+ if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0 &&
218
+ info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
219
+ {
220
+ int j, jend;
221
+
222
+ jend = info_ptr->num_trans;
223
+ if (jend > PNG_MAX_PALETTE_LENGTH)
224
+ jend = PNG_MAX_PALETTE_LENGTH;
225
+
226
+ for (j = 0; j<jend; ++j)
227
+ info_ptr->trans_alpha[j] =
228
+ (png_byte)(255 - info_ptr->trans_alpha[j]);
229
+ }
230
+ #endif
231
+ png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
232
+ info_ptr->num_trans, info_ptr->color_type);
233
+ }
234
+ #endif
235
+ #ifdef PNG_WRITE_bKGD_SUPPORTED
236
+ if ((info_ptr->valid & PNG_INFO_bKGD) != 0)
237
+ png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
238
+ #endif
239
+
240
+ #ifdef PNG_WRITE_eXIf_SUPPORTED
241
+ if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
242
+ png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
243
+ #endif
244
+
245
+ #ifdef PNG_WRITE_hIST_SUPPORTED
246
+ if ((info_ptr->valid & PNG_INFO_hIST) != 0)
247
+ png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
248
+ #endif
249
+
250
+ #ifdef PNG_WRITE_oFFs_SUPPORTED
251
+ if ((info_ptr->valid & PNG_INFO_oFFs) != 0)
252
+ png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset,
253
+ info_ptr->offset_unit_type);
254
+ #endif
255
+
256
+ #ifdef PNG_WRITE_pCAL_SUPPORTED
257
+ if ((info_ptr->valid & PNG_INFO_pCAL) != 0)
258
+ png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0,
259
+ info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
260
+ info_ptr->pcal_units, info_ptr->pcal_params);
261
+ #endif
262
+
263
+ #ifdef PNG_WRITE_sCAL_SUPPORTED
264
+ if ((info_ptr->valid & PNG_INFO_sCAL) != 0)
265
+ png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit,
266
+ info_ptr->scal_s_width, info_ptr->scal_s_height);
267
+ #endif /* sCAL */
268
+
269
+ #ifdef PNG_WRITE_pHYs_SUPPORTED
270
+ if ((info_ptr->valid & PNG_INFO_pHYs) != 0)
271
+ png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit,
272
+ info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
273
+ #endif /* pHYs */
274
+
275
+ #ifdef PNG_WRITE_tIME_SUPPORTED
276
+ if ((info_ptr->valid & PNG_INFO_tIME) != 0)
277
+ {
278
+ png_write_tIME(png_ptr, &(info_ptr->mod_time));
279
+ png_ptr->mode |= PNG_WROTE_tIME;
280
+ }
281
+ #endif /* tIME */
282
+
283
+ #ifdef PNG_WRITE_sPLT_SUPPORTED
284
+ if ((info_ptr->valid & PNG_INFO_sPLT) != 0)
285
+ for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
286
+ png_write_sPLT(png_ptr, info_ptr->splt_palettes + i);
287
+ #endif /* sPLT */
288
+
289
+ #ifdef PNG_WRITE_TEXT_SUPPORTED
290
+ /* Check to see if we need to write text chunks */
291
+ for (i = 0; i < info_ptr->num_text; i++)
292
+ {
293
+ png_debug2(2, "Writing header text chunk %d, type %d", i,
294
+ info_ptr->text[i].compression);
295
+ /* An internationalized chunk? */
296
+ if (info_ptr->text[i].compression > 0)
297
+ {
298
+ #ifdef PNG_WRITE_iTXt_SUPPORTED
299
+ /* Write international chunk */
300
+ png_write_iTXt(png_ptr,
301
+ info_ptr->text[i].compression,
302
+ info_ptr->text[i].key,
303
+ info_ptr->text[i].lang,
304
+ info_ptr->text[i].lang_key,
305
+ info_ptr->text[i].text);
306
+ /* Mark this chunk as written */
307
+ if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
308
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
309
+ else
310
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
311
+ #else
312
+ png_warning(png_ptr, "Unable to write international text");
313
+ #endif
314
+ }
315
+
316
+ /* If we want a compressed text chunk */
317
+ else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt)
318
+ {
319
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
320
+ /* Write compressed chunk */
321
+ png_write_zTXt(png_ptr, info_ptr->text[i].key,
322
+ info_ptr->text[i].text, info_ptr->text[i].compression);
323
+ /* Mark this chunk as written */
324
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
325
+ #else
326
+ png_warning(png_ptr, "Unable to write compressed text");
327
+ #endif
328
+ }
329
+
330
+ else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
331
+ {
332
+ #ifdef PNG_WRITE_tEXt_SUPPORTED
333
+ /* Write uncompressed chunk */
334
+ png_write_tEXt(png_ptr, info_ptr->text[i].key,
335
+ info_ptr->text[i].text,
336
+ 0);
337
+ /* Mark this chunk as written */
338
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
339
+ #else
340
+ /* Can't get here */
341
+ png_warning(png_ptr, "Unable to write uncompressed text");
342
+ #endif
343
+ }
344
+ }
345
+ #endif /* tEXt */
346
+
347
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
348
+ write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_PLTE);
349
+ #endif
350
+ }
351
+
352
+ /* Writes the end of the PNG file. If you don't want to write comments or
353
+ * time information, you can pass NULL for info. If you already wrote these
354
+ * in png_write_info(), do not write them again here. If you have long
355
+ * comments, I suggest writing them here, and compressing them.
356
+ */
357
+ void PNGAPI
358
+ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
359
+ {
360
+ png_debug(1, "in png_write_end");
361
+
362
+ if (png_ptr == NULL)
363
+ return;
364
+
365
+ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
366
+ png_error(png_ptr, "No IDATs written into file");
367
+
368
+ #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
369
+ if (png_ptr->num_palette_max > png_ptr->num_palette)
370
+ png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
371
+ #endif
372
+
373
+ /* See if user wants us to write information chunks */
374
+ if (info_ptr != NULL)
375
+ {
376
+ #ifdef PNG_WRITE_TEXT_SUPPORTED
377
+ int i; /* local index variable */
378
+ #endif
379
+ #ifdef PNG_WRITE_tIME_SUPPORTED
380
+ /* Check to see if user has supplied a time chunk */
381
+ if ((info_ptr->valid & PNG_INFO_tIME) != 0 &&
382
+ (png_ptr->mode & PNG_WROTE_tIME) == 0)
383
+ png_write_tIME(png_ptr, &(info_ptr->mod_time));
384
+
385
+ #endif
386
+ #ifdef PNG_WRITE_TEXT_SUPPORTED
387
+ /* Loop through comment chunks */
388
+ for (i = 0; i < info_ptr->num_text; i++)
389
+ {
390
+ png_debug2(2, "Writing trailer text chunk %d, type %d", i,
391
+ info_ptr->text[i].compression);
392
+ /* An internationalized chunk? */
393
+ if (info_ptr->text[i].compression > 0)
394
+ {
395
+ #ifdef PNG_WRITE_iTXt_SUPPORTED
396
+ /* Write international chunk */
397
+ png_write_iTXt(png_ptr,
398
+ info_ptr->text[i].compression,
399
+ info_ptr->text[i].key,
400
+ info_ptr->text[i].lang,
401
+ info_ptr->text[i].lang_key,
402
+ info_ptr->text[i].text);
403
+ /* Mark this chunk as written */
404
+ if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
405
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
406
+ else
407
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
408
+ #else
409
+ png_warning(png_ptr, "Unable to write international text");
410
+ #endif
411
+ }
412
+
413
+ else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt)
414
+ {
415
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
416
+ /* Write compressed chunk */
417
+ png_write_zTXt(png_ptr, info_ptr->text[i].key,
418
+ info_ptr->text[i].text, info_ptr->text[i].compression);
419
+ /* Mark this chunk as written */
420
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
421
+ #else
422
+ png_warning(png_ptr, "Unable to write compressed text");
423
+ #endif
424
+ }
425
+
426
+ else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
427
+ {
428
+ #ifdef PNG_WRITE_tEXt_SUPPORTED
429
+ /* Write uncompressed chunk */
430
+ png_write_tEXt(png_ptr, info_ptr->text[i].key,
431
+ info_ptr->text[i].text, 0);
432
+ /* Mark this chunk as written */
433
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
434
+ #else
435
+ png_warning(png_ptr, "Unable to write uncompressed text");
436
+ #endif
437
+ }
438
+ }
439
+ #endif
440
+
441
+ #ifdef PNG_WRITE_eXIf_SUPPORTED
442
+ if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
443
+ png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
444
+ #endif
445
+
446
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
447
+ write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
448
+ #endif
449
+ }
450
+
451
+ png_ptr->mode |= PNG_AFTER_IDAT;
452
+
453
+ /* Write end of PNG file */
454
+ png_write_IEND(png_ptr);
455
+
456
+ /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
457
+ * and restored again in libpng-1.2.30, may cause some applications that
458
+ * do not set png_ptr->output_flush_fn to crash. If your application
459
+ * experiences a problem, please try building libpng with
460
+ * PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to
461
+ * png-mng-implement at lists.sf.net .
462
+ */
463
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
464
+ # ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED
465
+ png_flush(png_ptr);
466
+ # endif
467
+ #endif
468
+ }
469
+
470
+ #ifdef PNG_CONVERT_tIME_SUPPORTED
471
+ void PNGAPI
472
+ png_convert_from_struct_tm(png_timep ptime, const struct tm * ttime)
473
+ {
474
+ png_debug(1, "in png_convert_from_struct_tm");
475
+
476
+ ptime->year = (png_uint_16)(1900 + ttime->tm_year);
477
+ ptime->month = (png_byte)(ttime->tm_mon + 1);
478
+ ptime->day = (png_byte)ttime->tm_mday;
479
+ ptime->hour = (png_byte)ttime->tm_hour;
480
+ ptime->minute = (png_byte)ttime->tm_min;
481
+ ptime->second = (png_byte)ttime->tm_sec;
482
+ }
483
+
484
+ void PNGAPI
485
+ png_convert_from_time_t(png_timep ptime, time_t ttime)
486
+ {
487
+ struct tm *tbuf;
488
+
489
+ png_debug(1, "in png_convert_from_time_t");
490
+
491
+ tbuf = gmtime(&ttime);
492
+ png_convert_from_struct_tm(ptime, tbuf);
493
+ }
494
+ #endif
495
+
496
+ /* Initialize png_ptr structure, and allocate any memory needed */
497
+ PNG_FUNCTION(png_structp,PNGAPI
498
+ png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
499
+ png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
500
+ {
501
+ #ifndef PNG_USER_MEM_SUPPORTED
502
+ png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
503
+ error_fn, warn_fn, NULL, NULL, NULL);
504
+ #else
505
+ return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
506
+ warn_fn, NULL, NULL, NULL);
507
+ }
508
+
509
+ /* Alternate initialize png_ptr structure, and allocate any memory needed */
510
+ PNG_FUNCTION(png_structp,PNGAPI
511
+ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
512
+ png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
513
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
514
+ {
515
+ png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
516
+ error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
517
+ #endif /* USER_MEM */
518
+ if (png_ptr != NULL)
519
+ {
520
+ /* Set the zlib control values to defaults; they can be overridden by the
521
+ * application after the struct has been created.
522
+ */
523
+ png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
524
+
525
+ /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
526
+ * pngwutil.c defaults it according to whether or not filters will be
527
+ * used, and ignores this setting.
528
+ */
529
+ png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
530
+ png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
531
+ png_ptr->zlib_mem_level = 8;
532
+ png_ptr->zlib_window_bits = 15;
533
+ png_ptr->zlib_method = 8;
534
+
535
+ #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
536
+ png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
537
+ png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
538
+ png_ptr->zlib_text_mem_level = 8;
539
+ png_ptr->zlib_text_window_bits = 15;
540
+ png_ptr->zlib_text_method = 8;
541
+ #endif /* WRITE_COMPRESSED_TEXT */
542
+
543
+ /* This is a highly dubious configuration option; by default it is off,
544
+ * but it may be appropriate for private builds that are testing
545
+ * extensions not conformant to the current specification, or of
546
+ * applications that must not fail to write at all costs!
547
+ */
548
+ #ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
549
+ /* In stable builds only warn if an application error can be completely
550
+ * handled.
551
+ */
552
+ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
553
+ #endif
554
+
555
+ /* App warnings are warnings in release (or release candidate) builds but
556
+ * are errors during development.
557
+ */
558
+ #if PNG_RELEASE_BUILD
559
+ png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
560
+ #endif
561
+
562
+ /* TODO: delay this, it can be done in png_init_io() (if the app doesn't
563
+ * do it itself) avoiding setting the default function if it is not
564
+ * required.
565
+ */
566
+ png_set_write_fn(png_ptr, NULL, NULL, NULL);
567
+ }
568
+
569
+ return png_ptr;
570
+ }
571
+
572
+
573
+ /* Write a few rows of image data. If the image is interlaced,
574
+ * either you will have to write the 7 sub images, or, if you
575
+ * have called png_set_interlace_handling(), you will have to
576
+ * "write" the image seven times.
577
+ */
578
+ void PNGAPI
579
+ png_write_rows(png_structrp png_ptr, png_bytepp row,
580
+ png_uint_32 num_rows)
581
+ {
582
+ png_uint_32 i; /* row counter */
583
+ png_bytepp rp; /* row pointer */
584
+
585
+ png_debug(1, "in png_write_rows");
586
+
587
+ if (png_ptr == NULL)
588
+ return;
589
+
590
+ /* Loop through the rows */
591
+ for (i = 0, rp = row; i < num_rows; i++, rp++)
592
+ {
593
+ png_write_row(png_ptr, *rp);
594
+ }
595
+ }
596
+
597
+ /* Write the image. You only need to call this function once, even
598
+ * if you are writing an interlaced image.
599
+ */
600
+ void PNGAPI
601
+ png_write_image(png_structrp png_ptr, png_bytepp image)
602
+ {
603
+ png_uint_32 i; /* row index */
604
+ int pass, num_pass; /* pass variables */
605
+ png_bytepp rp; /* points to current row */
606
+
607
+ if (png_ptr == NULL)
608
+ return;
609
+
610
+ png_debug(1, "in png_write_image");
611
+
612
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
613
+ /* Initialize interlace handling. If image is not interlaced,
614
+ * this will set pass to 1
615
+ */
616
+ num_pass = png_set_interlace_handling(png_ptr);
617
+ #else
618
+ num_pass = 1;
619
+ #endif
620
+ /* Loop through passes */
621
+ for (pass = 0; pass < num_pass; pass++)
622
+ {
623
+ /* Loop through image */
624
+ for (i = 0, rp = image; i < png_ptr->height; i++, rp++)
625
+ {
626
+ png_write_row(png_ptr, *rp);
627
+ }
628
+ }
629
+ }
630
+
631
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
632
+ /* Performs intrapixel differencing */
633
+ static void
634
+ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
635
+ {
636
+ png_debug(1, "in png_do_write_intrapixel");
637
+
638
+ if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
639
+ {
640
+ int bytes_per_pixel;
641
+ png_uint_32 row_width = row_info->width;
642
+ if (row_info->bit_depth == 8)
643
+ {
644
+ png_bytep rp;
645
+ png_uint_32 i;
646
+
647
+ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
648
+ bytes_per_pixel = 3;
649
+
650
+ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
651
+ bytes_per_pixel = 4;
652
+
653
+ else
654
+ return;
655
+
656
+ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
657
+ {
658
+ *(rp) = (png_byte)(*rp - *(rp + 1));
659
+ *(rp + 2) = (png_byte)(*(rp + 2) - *(rp + 1));
660
+ }
661
+ }
662
+
663
+ #ifdef PNG_WRITE_16BIT_SUPPORTED
664
+ else if (row_info->bit_depth == 16)
665
+ {
666
+ png_bytep rp;
667
+ png_uint_32 i;
668
+
669
+ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
670
+ bytes_per_pixel = 6;
671
+
672
+ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
673
+ bytes_per_pixel = 8;
674
+
675
+ else
676
+ return;
677
+
678
+ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
679
+ {
680
+ png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
681
+ png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
682
+ png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
683
+ png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
684
+ png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
685
+ *(rp ) = (png_byte)(red >> 8);
686
+ *(rp + 1) = (png_byte)red;
687
+ *(rp + 4) = (png_byte)(blue >> 8);
688
+ *(rp + 5) = (png_byte)blue;
689
+ }
690
+ }
691
+ #endif /* WRITE_16BIT */
692
+ }
693
+ }
694
+ #endif /* MNG_FEATURES */
695
+
696
+ /* Called by user to write a row of image data */
697
+ void PNGAPI
698
+ png_write_row(png_structrp png_ptr, png_const_bytep row)
699
+ {
700
+ /* 1.5.6: moved from png_struct to be a local structure: */
701
+ png_row_info row_info;
702
+
703
+ if (png_ptr == NULL)
704
+ return;
705
+
706
+ png_debug2(1, "in png_write_row (row %u, pass %d)",
707
+ png_ptr->row_number, png_ptr->pass);
708
+
709
+ /* Initialize transformations and other stuff if first time */
710
+ if (png_ptr->row_number == 0 && png_ptr->pass == 0)
711
+ {
712
+ /* Make sure we wrote the header info */
713
+ if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
714
+ png_error(png_ptr,
715
+ "png_write_info was never called before png_write_row");
716
+
717
+ /* Check for transforms that have been set but were defined out */
718
+ #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
719
+ if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
720
+ png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined");
721
+ #endif
722
+
723
+ #if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
724
+ if ((png_ptr->transformations & PNG_FILLER) != 0)
725
+ png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined");
726
+ #endif
727
+ #if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
728
+ defined(PNG_READ_PACKSWAP_SUPPORTED)
729
+ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
730
+ png_warning(png_ptr,
731
+ "PNG_WRITE_PACKSWAP_SUPPORTED is not defined");
732
+ #endif
733
+
734
+ #if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
735
+ if ((png_ptr->transformations & PNG_PACK) != 0)
736
+ png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined");
737
+ #endif
738
+
739
+ #if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED)
740
+ if ((png_ptr->transformations & PNG_SHIFT) != 0)
741
+ png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined");
742
+ #endif
743
+
744
+ #if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED)
745
+ if ((png_ptr->transformations & PNG_BGR) != 0)
746
+ png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined");
747
+ #endif
748
+
749
+ #if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED)
750
+ if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
751
+ png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined");
752
+ #endif
753
+
754
+ png_write_start_row(png_ptr);
755
+ }
756
+
757
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
758
+ /* If interlaced and not interested in row, return */
759
+ if (png_ptr->interlaced != 0 &&
760
+ (png_ptr->transformations & PNG_INTERLACE) != 0)
761
+ {
762
+ switch (png_ptr->pass)
763
+ {
764
+ case 0:
765
+ if ((png_ptr->row_number & 0x07) != 0)
766
+ {
767
+ png_write_finish_row(png_ptr);
768
+ return;
769
+ }
770
+ break;
771
+
772
+ case 1:
773
+ if ((png_ptr->row_number & 0x07) != 0 || png_ptr->width < 5)
774
+ {
775
+ png_write_finish_row(png_ptr);
776
+ return;
777
+ }
778
+ break;
779
+
780
+ case 2:
781
+ if ((png_ptr->row_number & 0x07) != 4)
782
+ {
783
+ png_write_finish_row(png_ptr);
784
+ return;
785
+ }
786
+ break;
787
+
788
+ case 3:
789
+ if ((png_ptr->row_number & 0x03) != 0 || png_ptr->width < 3)
790
+ {
791
+ png_write_finish_row(png_ptr);
792
+ return;
793
+ }
794
+ break;
795
+
796
+ case 4:
797
+ if ((png_ptr->row_number & 0x03) != 2)
798
+ {
799
+ png_write_finish_row(png_ptr);
800
+ return;
801
+ }
802
+ break;
803
+
804
+ case 5:
805
+ if ((png_ptr->row_number & 0x01) != 0 || png_ptr->width < 2)
806
+ {
807
+ png_write_finish_row(png_ptr);
808
+ return;
809
+ }
810
+ break;
811
+
812
+ case 6:
813
+ if ((png_ptr->row_number & 0x01) == 0)
814
+ {
815
+ png_write_finish_row(png_ptr);
816
+ return;
817
+ }
818
+ break;
819
+
820
+ default: /* error: ignore it */
821
+ break;
822
+ }
823
+ }
824
+ #endif
825
+
826
+ /* Set up row info for transformations */
827
+ row_info.color_type = png_ptr->color_type;
828
+ row_info.width = png_ptr->usr_width;
829
+ row_info.channels = png_ptr->usr_channels;
830
+ row_info.bit_depth = png_ptr->usr_bit_depth;
831
+ row_info.pixel_depth = (png_byte)(row_info.bit_depth * row_info.channels);
832
+ row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
833
+
834
+ png_debug1(3, "row_info->color_type = %d", row_info.color_type);
835
+ png_debug1(3, "row_info->width = %u", row_info.width);
836
+ png_debug1(3, "row_info->channels = %d", row_info.channels);
837
+ png_debug1(3, "row_info->bit_depth = %d", row_info.bit_depth);
838
+ png_debug1(3, "row_info->pixel_depth = %d", row_info.pixel_depth);
839
+ png_debug1(3, "row_info->rowbytes = %lu", (unsigned long)row_info.rowbytes);
840
+
841
+ /* Copy user's row into buffer, leaving room for filter byte. */
842
+ memcpy(png_ptr->row_buf + 1, row, row_info.rowbytes);
843
+
844
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
845
+ /* Handle interlacing */
846
+ if (png_ptr->interlaced && png_ptr->pass < 6 &&
847
+ (png_ptr->transformations & PNG_INTERLACE) != 0)
848
+ {
849
+ png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
850
+ /* This should always get caught above, but still ... */
851
+ if (row_info.width == 0)
852
+ {
853
+ png_write_finish_row(png_ptr);
854
+ return;
855
+ }
856
+ }
857
+ #endif
858
+
859
+ #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
860
+ /* Handle other transformations */
861
+ if (png_ptr->transformations != 0)
862
+ png_do_write_transformations(png_ptr, &row_info);
863
+ #endif
864
+
865
+ /* At this point the row_info pixel depth must match the 'transformed' depth,
866
+ * which is also the output depth.
867
+ */
868
+ if (row_info.pixel_depth != png_ptr->pixel_depth ||
869
+ row_info.pixel_depth != png_ptr->transformed_pixel_depth)
870
+ png_error(png_ptr, "internal write transform logic error");
871
+
872
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
873
+ /* Write filter_method 64 (intrapixel differencing) only if
874
+ * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
875
+ * 2. Libpng did not write a PNG signature (this filter_method is only
876
+ * used in PNG datastreams that are embedded in MNG datastreams) and
877
+ * 3. The application called png_permit_mng_features with a mask that
878
+ * included PNG_FLAG_MNG_FILTER_64 and
879
+ * 4. The filter_method is 64 and
880
+ * 5. The color_type is RGB or RGBA
881
+ */
882
+ if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
883
+ (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
884
+ {
885
+ /* Intrapixel differencing */
886
+ png_do_write_intrapixel(&row_info, png_ptr->row_buf + 1);
887
+ }
888
+ #endif
889
+
890
+ /* Added at libpng-1.5.10 */
891
+ #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
892
+ /* Check for out-of-range palette index */
893
+ if (row_info.color_type == PNG_COLOR_TYPE_PALETTE &&
894
+ png_ptr->num_palette_max >= 0)
895
+ png_do_check_palette_indexes(png_ptr, &row_info);
896
+ #endif
897
+
898
+ /* Find a filter if necessary, filter the row and write it out. */
899
+ png_write_find_filter(png_ptr, &row_info);
900
+
901
+ if (png_ptr->write_row_fn != NULL)
902
+ (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
903
+ }
904
+
905
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
906
+ /* Set the automatic flush interval or 0 to turn flushing off */
907
+ void PNGAPI
908
+ png_set_flush(png_structrp png_ptr, int nrows)
909
+ {
910
+ png_debug(1, "in png_set_flush");
911
+
912
+ if (png_ptr == NULL)
913
+ return;
914
+
915
+ png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows);
916
+ }
917
+
918
+ /* Flush the current output buffers now */
919
+ void PNGAPI
920
+ png_write_flush(png_structrp png_ptr)
921
+ {
922
+ png_debug(1, "in png_write_flush");
923
+
924
+ if (png_ptr == NULL)
925
+ return;
926
+
927
+ /* We have already written out all of the data */
928
+ if (png_ptr->row_number >= png_ptr->num_rows)
929
+ return;
930
+
931
+ png_compress_IDAT(png_ptr, NULL, 0, Z_SYNC_FLUSH);
932
+ png_ptr->flush_rows = 0;
933
+ png_flush(png_ptr);
934
+ }
935
+ #endif /* WRITE_FLUSH */
936
+
937
+ /* Free any memory used in png_ptr struct without freeing the struct itself. */
938
+ static void
939
+ png_write_destroy(png_structrp png_ptr)
940
+ {
941
+ png_debug(1, "in png_write_destroy");
942
+
943
+ /* Free any memory zlib uses */
944
+ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
945
+ deflateEnd(&png_ptr->zstream);
946
+
947
+ /* Free our memory. png_free checks NULL for us. */
948
+ png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
949
+ png_free(png_ptr, png_ptr->row_buf);
950
+ png_ptr->row_buf = NULL;
951
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
952
+ png_free(png_ptr, png_ptr->prev_row);
953
+ png_free(png_ptr, png_ptr->try_row);
954
+ png_free(png_ptr, png_ptr->tst_row);
955
+ png_ptr->prev_row = NULL;
956
+ png_ptr->try_row = NULL;
957
+ png_ptr->tst_row = NULL;
958
+ #endif
959
+
960
+ #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
961
+ png_free(png_ptr, png_ptr->chunk_list);
962
+ png_ptr->chunk_list = NULL;
963
+ #endif
964
+
965
+ /* The error handling and memory handling information is left intact at this
966
+ * point: the jmp_buf may still have to be freed. See png_destroy_png_struct
967
+ * for how this happens.
968
+ */
969
+ }
970
+
971
+ /* Free all memory used by the write.
972
+ * In libpng 1.6.0 this API changed quietly to no longer accept a NULL value for
973
+ * *png_ptr_ptr. Prior to 1.6.0 it would accept such a value and it would free
974
+ * the passed in info_structs but it would quietly fail to free any of the data
975
+ * inside them. In 1.6.0 it quietly does nothing (it has to be quiet because it
976
+ * has no png_ptr.)
977
+ */
978
+ void PNGAPI
979
+ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
980
+ {
981
+ png_debug(1, "in png_destroy_write_struct");
982
+
983
+ if (png_ptr_ptr != NULL)
984
+ {
985
+ png_structrp png_ptr = *png_ptr_ptr;
986
+
987
+ if (png_ptr != NULL) /* added in libpng 1.6.0 */
988
+ {
989
+ png_destroy_info_struct(png_ptr, info_ptr_ptr);
990
+
991
+ *png_ptr_ptr = NULL;
992
+ png_write_destroy(png_ptr);
993
+ png_destroy_png_struct(png_ptr);
994
+ }
995
+ }
996
+ }
997
+
998
+ /* Allow the application to select one or more row filters to use. */
999
+ void PNGAPI
1000
+ png_set_filter(png_structrp png_ptr, int method, int filters)
1001
+ {
1002
+ png_debug(1, "in png_set_filter");
1003
+
1004
+ if (png_ptr == NULL)
1005
+ return;
1006
+
1007
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
1008
+ if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
1009
+ (method == PNG_INTRAPIXEL_DIFFERENCING))
1010
+ method = PNG_FILTER_TYPE_BASE;
1011
+
1012
+ #endif
1013
+ if (method == PNG_FILTER_TYPE_BASE)
1014
+ {
1015
+ switch (filters & (PNG_ALL_FILTERS | 0x07))
1016
+ {
1017
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
1018
+ case 5:
1019
+ case 6:
1020
+ case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
1021
+ #endif /* WRITE_FILTER */
1022
+ /* FALLTHROUGH */
1023
+ case PNG_FILTER_VALUE_NONE:
1024
+ png_ptr->do_filter = PNG_FILTER_NONE; break;
1025
+
1026
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
1027
+ case PNG_FILTER_VALUE_SUB:
1028
+ png_ptr->do_filter = PNG_FILTER_SUB; break;
1029
+
1030
+ case PNG_FILTER_VALUE_UP:
1031
+ png_ptr->do_filter = PNG_FILTER_UP; break;
1032
+
1033
+ case PNG_FILTER_VALUE_AVG:
1034
+ png_ptr->do_filter = PNG_FILTER_AVG; break;
1035
+
1036
+ case PNG_FILTER_VALUE_PAETH:
1037
+ png_ptr->do_filter = PNG_FILTER_PAETH; break;
1038
+
1039
+ default:
1040
+ png_ptr->do_filter = (png_byte)filters; break;
1041
+ #else
1042
+ default:
1043
+ png_app_error(png_ptr, "Unknown row filter for method 0");
1044
+ #endif /* WRITE_FILTER */
1045
+ }
1046
+
1047
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
1048
+ /* If we have allocated the row_buf, this means we have already started
1049
+ * with the image and we should have allocated all of the filter buffers
1050
+ * that have been selected. If prev_row isn't already allocated, then
1051
+ * it is too late to start using the filters that need it, since we
1052
+ * will be missing the data in the previous row. If an application
1053
+ * wants to start and stop using particular filters during compression,
1054
+ * it should start out with all of the filters, and then remove them
1055
+ * or add them back after the start of compression.
1056
+ *
1057
+ * NOTE: this is a nasty constraint on the code, because it means that the
1058
+ * prev_row buffer must be maintained even if there are currently no
1059
+ * 'prev_row' requiring filters active.
1060
+ */
1061
+ if (png_ptr->row_buf != NULL)
1062
+ {
1063
+ int num_filters;
1064
+ png_alloc_size_t buf_size;
1065
+
1066
+ /* Repeat the checks in png_write_start_row; 1 pixel high or wide
1067
+ * images cannot benefit from certain filters. If this isn't done here
1068
+ * the check below will fire on 1 pixel high images.
1069
+ */
1070
+ if (png_ptr->height == 1)
1071
+ filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
1072
+
1073
+ if (png_ptr->width == 1)
1074
+ filters &= ~(PNG_FILTER_SUB|PNG_FILTER_AVG|PNG_FILTER_PAETH);
1075
+
1076
+ if ((filters & (PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH)) != 0
1077
+ && png_ptr->prev_row == NULL)
1078
+ {
1079
+ /* This is the error case, however it is benign - the previous row
1080
+ * is not available so the filter can't be used. Just warn here.
1081
+ */
1082
+ png_app_warning(png_ptr,
1083
+ "png_set_filter: UP/AVG/PAETH cannot be added after start");
1084
+ filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
1085
+ }
1086
+
1087
+ num_filters = 0;
1088
+
1089
+ if (filters & PNG_FILTER_SUB)
1090
+ num_filters++;
1091
+
1092
+ if (filters & PNG_FILTER_UP)
1093
+ num_filters++;
1094
+
1095
+ if (filters & PNG_FILTER_AVG)
1096
+ num_filters++;
1097
+
1098
+ if (filters & PNG_FILTER_PAETH)
1099
+ num_filters++;
1100
+
1101
+ /* Allocate needed row buffers if they have not already been
1102
+ * allocated.
1103
+ */
1104
+ buf_size = PNG_ROWBYTES(png_ptr->usr_channels * png_ptr->usr_bit_depth,
1105
+ png_ptr->width) + 1;
1106
+
1107
+ if (png_ptr->try_row == NULL)
1108
+ png_ptr->try_row = png_voidcast(png_bytep,
1109
+ png_malloc(png_ptr, buf_size));
1110
+
1111
+ if (num_filters > 1)
1112
+ {
1113
+ if (png_ptr->tst_row == NULL)
1114
+ png_ptr->tst_row = png_voidcast(png_bytep,
1115
+ png_malloc(png_ptr, buf_size));
1116
+ }
1117
+ }
1118
+ png_ptr->do_filter = (png_byte)filters;
1119
+ #endif
1120
+ }
1121
+ else
1122
+ png_error(png_ptr, "Unknown custom filter method");
1123
+ }
1124
+
1125
+ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
1126
+ /* Provide floating and fixed point APIs */
1127
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
1128
+ void PNGAPI
1129
+ png_set_filter_heuristics(png_structrp png_ptr, int heuristic_method,
1130
+ int num_weights, png_const_doublep filter_weights,
1131
+ png_const_doublep filter_costs)
1132
+ {
1133
+ PNG_UNUSED(png_ptr)
1134
+ PNG_UNUSED(heuristic_method)
1135
+ PNG_UNUSED(num_weights)
1136
+ PNG_UNUSED(filter_weights)
1137
+ PNG_UNUSED(filter_costs)
1138
+ }
1139
+ #endif /* FLOATING_POINT */
1140
+
1141
+ #ifdef PNG_FIXED_POINT_SUPPORTED
1142
+ void PNGAPI
1143
+ png_set_filter_heuristics_fixed(png_structrp png_ptr, int heuristic_method,
1144
+ int num_weights, png_const_fixed_point_p filter_weights,
1145
+ png_const_fixed_point_p filter_costs)
1146
+ {
1147
+ PNG_UNUSED(png_ptr)
1148
+ PNG_UNUSED(heuristic_method)
1149
+ PNG_UNUSED(num_weights)
1150
+ PNG_UNUSED(filter_weights)
1151
+ PNG_UNUSED(filter_costs)
1152
+ }
1153
+ #endif /* FIXED_POINT */
1154
+ #endif /* WRITE_WEIGHTED_FILTER */
1155
+
1156
+ #ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
1157
+ void PNGAPI
1158
+ png_set_compression_level(png_structrp png_ptr, int level)
1159
+ {
1160
+ png_debug(1, "in png_set_compression_level");
1161
+
1162
+ if (png_ptr == NULL)
1163
+ return;
1164
+
1165
+ png_ptr->zlib_level = level;
1166
+ }
1167
+
1168
+ void PNGAPI
1169
+ png_set_compression_mem_level(png_structrp png_ptr, int mem_level)
1170
+ {
1171
+ png_debug(1, "in png_set_compression_mem_level");
1172
+
1173
+ if (png_ptr == NULL)
1174
+ return;
1175
+
1176
+ png_ptr->zlib_mem_level = mem_level;
1177
+ }
1178
+
1179
+ void PNGAPI
1180
+ png_set_compression_strategy(png_structrp png_ptr, int strategy)
1181
+ {
1182
+ png_debug(1, "in png_set_compression_strategy");
1183
+
1184
+ if (png_ptr == NULL)
1185
+ return;
1186
+
1187
+ /* The flag setting here prevents the libpng dynamic selection of strategy.
1188
+ */
1189
+ png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
1190
+ png_ptr->zlib_strategy = strategy;
1191
+ }
1192
+
1193
+ /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
1194
+ * smaller value of window_bits if it can do so safely.
1195
+ */
1196
+ void PNGAPI
1197
+ png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
1198
+ {
1199
+ if (png_ptr == NULL)
1200
+ return;
1201
+
1202
+ /* Prior to 1.6.0 this would warn but then set the window_bits value. This
1203
+ * meant that negative window bits values could be selected that would cause
1204
+ * libpng to write a non-standard PNG file with raw deflate or gzip
1205
+ * compressed IDAT or ancillary chunks. Such files can be read and there is
1206
+ * no warning on read, so this seems like a very bad idea.
1207
+ */
1208
+ if (window_bits > 15)
1209
+ {
1210
+ png_warning(png_ptr, "Only compression windows <= 32k supported by PNG");
1211
+ window_bits = 15;
1212
+ }
1213
+
1214
+ else if (window_bits < 8)
1215
+ {
1216
+ png_warning(png_ptr, "Only compression windows >= 256 supported by PNG");
1217
+ window_bits = 8;
1218
+ }
1219
+
1220
+ png_ptr->zlib_window_bits = window_bits;
1221
+ }
1222
+
1223
+ void PNGAPI
1224
+ png_set_compression_method(png_structrp png_ptr, int method)
1225
+ {
1226
+ png_debug(1, "in png_set_compression_method");
1227
+
1228
+ if (png_ptr == NULL)
1229
+ return;
1230
+
1231
+ /* This would produce an invalid PNG file if it worked, but it doesn't and
1232
+ * deflate will fault it, so it is harmless to just warn here.
1233
+ */
1234
+ if (method != 8)
1235
+ png_warning(png_ptr, "Only compression method 8 is supported by PNG");
1236
+
1237
+ png_ptr->zlib_method = method;
1238
+ }
1239
+ #endif /* WRITE_CUSTOMIZE_COMPRESSION */
1240
+
1241
+ /* The following were added to libpng-1.5.4 */
1242
+ #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
1243
+ void PNGAPI
1244
+ png_set_text_compression_level(png_structrp png_ptr, int level)
1245
+ {
1246
+ png_debug(1, "in png_set_text_compression_level");
1247
+
1248
+ if (png_ptr == NULL)
1249
+ return;
1250
+
1251
+ png_ptr->zlib_text_level = level;
1252
+ }
1253
+
1254
+ void PNGAPI
1255
+ png_set_text_compression_mem_level(png_structrp png_ptr, int mem_level)
1256
+ {
1257
+ png_debug(1, "in png_set_text_compression_mem_level");
1258
+
1259
+ if (png_ptr == NULL)
1260
+ return;
1261
+
1262
+ png_ptr->zlib_text_mem_level = mem_level;
1263
+ }
1264
+
1265
+ void PNGAPI
1266
+ png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
1267
+ {
1268
+ png_debug(1, "in png_set_text_compression_strategy");
1269
+
1270
+ if (png_ptr == NULL)
1271
+ return;
1272
+
1273
+ png_ptr->zlib_text_strategy = strategy;
1274
+ }
1275
+
1276
+ /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
1277
+ * smaller value of window_bits if it can do so safely.
1278
+ */
1279
+ void PNGAPI
1280
+ png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
1281
+ {
1282
+ if (png_ptr == NULL)
1283
+ return;
1284
+
1285
+ if (window_bits > 15)
1286
+ {
1287
+ png_warning(png_ptr, "Only compression windows <= 32k supported by PNG");
1288
+ window_bits = 15;
1289
+ }
1290
+
1291
+ else if (window_bits < 8)
1292
+ {
1293
+ png_warning(png_ptr, "Only compression windows >= 256 supported by PNG");
1294
+ window_bits = 8;
1295
+ }
1296
+
1297
+ png_ptr->zlib_text_window_bits = window_bits;
1298
+ }
1299
+
1300
+ void PNGAPI
1301
+ png_set_text_compression_method(png_structrp png_ptr, int method)
1302
+ {
1303
+ png_debug(1, "in png_set_text_compression_method");
1304
+
1305
+ if (png_ptr == NULL)
1306
+ return;
1307
+
1308
+ if (method != 8)
1309
+ png_warning(png_ptr, "Only compression method 8 is supported by PNG");
1310
+
1311
+ png_ptr->zlib_text_method = method;
1312
+ }
1313
+ #endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
1314
+ /* end of API added to libpng-1.5.4 */
1315
+
1316
+ void PNGAPI
1317
+ png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
1318
+ {
1319
+ if (png_ptr == NULL)
1320
+ return;
1321
+
1322
+ png_ptr->write_row_fn = write_row_fn;
1323
+ }
1324
+
1325
+ #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
1326
+ void PNGAPI
1327
+ png_set_write_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
1328
+ write_user_transform_fn)
1329
+ {
1330
+ png_debug(1, "in png_set_write_user_transform_fn");
1331
+
1332
+ if (png_ptr == NULL)
1333
+ return;
1334
+
1335
+ png_ptr->transformations |= PNG_USER_TRANSFORM;
1336
+ png_ptr->write_user_transform_fn = write_user_transform_fn;
1337
+ }
1338
+ #endif
1339
+
1340
+
1341
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
1342
+ void PNGAPI
1343
+ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
1344
+ int transforms, voidp params)
1345
+ {
1346
+ if (png_ptr == NULL || info_ptr == NULL)
1347
+ return;
1348
+
1349
+ if ((info_ptr->valid & PNG_INFO_IDAT) == 0)
1350
+ {
1351
+ png_app_error(png_ptr, "no rows for png_write_image to write");
1352
+ return;
1353
+ }
1354
+
1355
+ /* Write the file header information. */
1356
+ png_write_info(png_ptr, info_ptr);
1357
+
1358
+ /* ------ these transformations don't touch the info structure ------- */
1359
+
1360
+ /* Invert monochrome pixels */
1361
+ if ((transforms & PNG_TRANSFORM_INVERT_MONO) != 0)
1362
+ #ifdef PNG_WRITE_INVERT_SUPPORTED
1363
+ png_set_invert_mono(png_ptr);
1364
+ #else
1365
+ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_MONO not supported");
1366
+ #endif
1367
+
1368
+ /* Shift the pixels up to a legal bit depth and fill in
1369
+ * as appropriate to correctly scale the image.
1370
+ */
1371
+ if ((transforms & PNG_TRANSFORM_SHIFT) != 0)
1372
+ #ifdef PNG_WRITE_SHIFT_SUPPORTED
1373
+ if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
1374
+ png_set_shift(png_ptr, &info_ptr->sig_bit);
1375
+ #else
1376
+ png_app_error(png_ptr, "PNG_TRANSFORM_SHIFT not supported");
1377
+ #endif
1378
+
1379
+ /* Pack pixels into bytes */
1380
+ if ((transforms & PNG_TRANSFORM_PACKING) != 0)
1381
+ #ifdef PNG_WRITE_PACK_SUPPORTED
1382
+ png_set_packing(png_ptr);
1383
+ #else
1384
+ png_app_error(png_ptr, "PNG_TRANSFORM_PACKING not supported");
1385
+ #endif
1386
+
1387
+ /* Swap location of alpha bytes from ARGB to RGBA */
1388
+ if ((transforms & PNG_TRANSFORM_SWAP_ALPHA) != 0)
1389
+ #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
1390
+ png_set_swap_alpha(png_ptr);
1391
+ #else
1392
+ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ALPHA not supported");
1393
+ #endif
1394
+
1395
+ /* Remove a filler (X) from XRGB/RGBX/AG/GA into to convert it into
1396
+ * RGB, note that the code expects the input color type to be G or RGB; no
1397
+ * alpha channel.
1398
+ */
1399
+ if ((transforms & (PNG_TRANSFORM_STRIP_FILLER_AFTER|
1400
+ PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
1401
+ {
1402
+ #ifdef PNG_WRITE_FILLER_SUPPORTED
1403
+ if ((transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) != 0)
1404
+ {
1405
+ if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
1406
+ png_app_error(png_ptr,
1407
+ "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
1408
+
1409
+ /* Continue if ignored - this is the pre-1.6.10 behavior */
1410
+ png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
1411
+ }
1412
+
1413
+ else if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
1414
+ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
1415
+ #else
1416
+ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_FILLER not supported");
1417
+ #endif
1418
+ }
1419
+
1420
+ /* Flip BGR pixels to RGB */
1421
+ if ((transforms & PNG_TRANSFORM_BGR) != 0)
1422
+ #ifdef PNG_WRITE_BGR_SUPPORTED
1423
+ png_set_bgr(png_ptr);
1424
+ #else
1425
+ png_app_error(png_ptr, "PNG_TRANSFORM_BGR not supported");
1426
+ #endif
1427
+
1428
+ /* Swap bytes of 16-bit files to most significant byte first */
1429
+ if ((transforms & PNG_TRANSFORM_SWAP_ENDIAN) != 0)
1430
+ #ifdef PNG_WRITE_SWAP_SUPPORTED
1431
+ png_set_swap(png_ptr);
1432
+ #else
1433
+ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
1434
+ #endif
1435
+
1436
+ /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
1437
+ if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
1438
+ #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
1439
+ png_set_packswap(png_ptr);
1440
+ #else
1441
+ png_app_error(png_ptr, "PNG_TRANSFORM_PACKSWAP not supported");
1442
+ #endif
1443
+
1444
+ /* Invert the alpha channel from opacity to transparency */
1445
+ if ((transforms & PNG_TRANSFORM_INVERT_ALPHA) != 0)
1446
+ #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
1447
+ png_set_invert_alpha(png_ptr);
1448
+ #else
1449
+ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_ALPHA not supported");
1450
+ #endif
1451
+
1452
+ /* ----------------------- end of transformations ------------------- */
1453
+
1454
+ /* Write the bits */
1455
+ png_write_image(png_ptr, info_ptr->row_pointers);
1456
+
1457
+ /* It is REQUIRED to call this to finish writing the rest of the file */
1458
+ png_write_end(png_ptr, info_ptr);
1459
+
1460
+ PNG_UNUSED(params)
1461
+ }
1462
+ #endif
1463
+
1464
+
1465
+ #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
1466
+ /* Initialize the write structure - general purpose utility. */
1467
+ static int
1468
+ png_image_write_init(png_imagep image)
1469
+ {
1470
+ png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, image,
1471
+ png_safe_error, png_safe_warning);
1472
+
1473
+ if (png_ptr != NULL)
1474
+ {
1475
+ png_infop info_ptr = png_create_info_struct(png_ptr);
1476
+
1477
+ if (info_ptr != NULL)
1478
+ {
1479
+ png_controlp control = png_voidcast(png_controlp,
1480
+ png_malloc_warn(png_ptr, (sizeof *control)));
1481
+
1482
+ if (control != NULL)
1483
+ {
1484
+ memset(control, 0, (sizeof *control));
1485
+
1486
+ control->png_ptr = png_ptr;
1487
+ control->info_ptr = info_ptr;
1488
+ control->for_write = 1;
1489
+
1490
+ image->opaque = control;
1491
+ return 1;
1492
+ }
1493
+
1494
+ /* Error clean up */
1495
+ png_destroy_info_struct(png_ptr, &info_ptr);
1496
+ }
1497
+
1498
+ png_destroy_write_struct(&png_ptr, NULL);
1499
+ }
1500
+
1501
+ return png_image_error(image, "png_image_write_: out of memory");
1502
+ }
1503
+
1504
+ /* Arguments to png_image_write_main: */
1505
+ typedef struct
1506
+ {
1507
+ /* Arguments: */
1508
+ png_imagep image;
1509
+ png_const_voidp buffer;
1510
+ png_int_32 row_stride;
1511
+ png_const_voidp colormap;
1512
+ int convert_to_8bit;
1513
+ /* Local variables: */
1514
+ png_const_voidp first_row;
1515
+ ptrdiff_t row_bytes;
1516
+ png_voidp local_row;
1517
+ /* Byte count for memory writing */
1518
+ png_bytep memory;
1519
+ png_alloc_size_t memory_bytes; /* not used for STDIO */
1520
+ png_alloc_size_t output_bytes; /* running total */
1521
+ } png_image_write_control;
1522
+
1523
+ /* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
1524
+ * do any necessary byte swapping. The component order is defined by the
1525
+ * png_image format value.
1526
+ */
1527
+ static int
1528
+ png_write_image_16bit(png_voidp argument)
1529
+ {
1530
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
1531
+ argument);
1532
+ png_imagep image = display->image;
1533
+ png_structrp png_ptr = image->opaque->png_ptr;
1534
+
1535
+ png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
1536
+ display->first_row);
1537
+ png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
1538
+ png_uint_16p row_end;
1539
+ unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
1540
+ 3 : 1;
1541
+ int aindex = 0;
1542
+ png_uint_32 y = image->height;
1543
+
1544
+ if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
1545
+ {
1546
+ # ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
1547
+ if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
1548
+ {
1549
+ aindex = -1;
1550
+ ++input_row; /* To point to the first component */
1551
+ ++output_row;
1552
+ }
1553
+ else
1554
+ aindex = (int)channels;
1555
+ # else
1556
+ aindex = (int)channels;
1557
+ # endif
1558
+ }
1559
+
1560
+ else
1561
+ png_error(png_ptr, "png_write_image: internal call error");
1562
+
1563
+ /* Work out the output row end and count over this, note that the increment
1564
+ * above to 'row' means that row_end can actually be beyond the end of the
1565
+ * row; this is correct.
1566
+ */
1567
+ row_end = output_row + image->width * (channels+1);
1568
+
1569
+ for (; y > 0; --y)
1570
+ {
1571
+ png_const_uint_16p in_ptr = input_row;
1572
+ png_uint_16p out_ptr = output_row;
1573
+
1574
+ while (out_ptr < row_end)
1575
+ {
1576
+ png_uint_16 alpha = in_ptr[aindex];
1577
+ png_uint_32 reciprocal = 0;
1578
+ int c;
1579
+
1580
+ out_ptr[aindex] = alpha;
1581
+
1582
+ /* Calculate a reciprocal. The correct calculation is simply
1583
+ * component/alpha*65535 << 15. (I.e. 15 bits of precision); this
1584
+ * allows correct rounding by adding .5 before the shift. 'reciprocal'
1585
+ * is only initialized when required.
1586
+ */
1587
+ if (alpha > 0 && alpha < 65535)
1588
+ reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
1589
+
1590
+ c = (int)channels;
1591
+ do /* always at least one channel */
1592
+ {
1593
+ png_uint_16 component = *in_ptr++;
1594
+
1595
+ /* The following gives 65535 for an alpha of 0, which is fine,
1596
+ * otherwise if 0/0 is represented as some other value there is more
1597
+ * likely to be a discontinuity which will probably damage
1598
+ * compression when moving from a fully transparent area to a
1599
+ * nearly transparent one. (The assumption here is that opaque
1600
+ * areas tend not to be 0 intensity.)
1601
+ */
1602
+ if (component >= alpha)
1603
+ component = 65535;
1604
+
1605
+ /* component<alpha, so component/alpha is less than one and
1606
+ * component*reciprocal is less than 2^31.
1607
+ */
1608
+ else if (component > 0 && alpha < 65535)
1609
+ {
1610
+ png_uint_32 calc = component * reciprocal;
1611
+ calc += 16384; /* round to nearest */
1612
+ component = (png_uint_16)(calc >> 15);
1613
+ }
1614
+
1615
+ *out_ptr++ = component;
1616
+ }
1617
+ while (--c > 0);
1618
+
1619
+ /* Skip to next component (skip the intervening alpha channel) */
1620
+ ++in_ptr;
1621
+ ++out_ptr;
1622
+ }
1623
+
1624
+ png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
1625
+ input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
1626
+ }
1627
+
1628
+ return 1;
1629
+ }
1630
+
1631
+ /* Given 16-bit input (1 to 4 channels) write 8-bit output. If an alpha channel
1632
+ * is present it must be removed from the components, the components are then
1633
+ * written in sRGB encoding. No components are added or removed.
1634
+ *
1635
+ * Calculate an alpha reciprocal to reverse pre-multiplication. As above the
1636
+ * calculation can be done to 15 bits of accuracy; however, the output needs to
1637
+ * be scaled in the range 0..255*65535, so include that scaling here.
1638
+ */
1639
+ # define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+((alpha)>>1))/(alpha))
1640
+
1641
+ static png_byte
1642
+ png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
1643
+ png_uint_32 reciprocal/*from the above macro*/)
1644
+ {
1645
+ /* The following gives 1.0 for an alpha of 0, which is fine, otherwise if 0/0
1646
+ * is represented as some other value there is more likely to be a
1647
+ * discontinuity which will probably damage compression when moving from a
1648
+ * fully transparent area to a nearly transparent one. (The assumption here
1649
+ * is that opaque areas tend not to be 0 intensity.)
1650
+ *
1651
+ * There is a rounding problem here; if alpha is less than 128 it will end up
1652
+ * as 0 when scaled to 8 bits. To avoid introducing spurious colors into the
1653
+ * output change for this too.
1654
+ */
1655
+ if (component >= alpha || alpha < 128)
1656
+ return 255;
1657
+
1658
+ /* component<alpha, so component/alpha is less than one and
1659
+ * component*reciprocal is less than 2^31.
1660
+ */
1661
+ else if (component > 0)
1662
+ {
1663
+ /* The test is that alpha/257 (rounded) is less than 255, the first value
1664
+ * that becomes 255 is 65407.
1665
+ * NOTE: this must agree with the PNG_DIV257 macro (which must, therefore,
1666
+ * be exact!) [Could also test reciprocal != 0]
1667
+ */
1668
+ if (alpha < 65407)
1669
+ {
1670
+ component *= reciprocal;
1671
+ component += 64; /* round to nearest */
1672
+ component >>= 7;
1673
+ }
1674
+
1675
+ else
1676
+ component *= 255;
1677
+
1678
+ /* Convert the component to sRGB. */
1679
+ return (png_byte)PNG_sRGB_FROM_LINEAR(component);
1680
+ }
1681
+
1682
+ else
1683
+ return 0;
1684
+ }
1685
+
1686
+ static int
1687
+ png_write_image_8bit(png_voidp argument)
1688
+ {
1689
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
1690
+ argument);
1691
+ png_imagep image = display->image;
1692
+ png_structrp png_ptr = image->opaque->png_ptr;
1693
+
1694
+ png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
1695
+ display->first_row);
1696
+ png_bytep output_row = png_voidcast(png_bytep, display->local_row);
1697
+ png_uint_32 y = image->height;
1698
+ unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
1699
+ 3 : 1;
1700
+
1701
+ if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
1702
+ {
1703
+ png_bytep row_end;
1704
+ int aindex;
1705
+
1706
+ # ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
1707
+ if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
1708
+ {
1709
+ aindex = -1;
1710
+ ++input_row; /* To point to the first component */
1711
+ ++output_row;
1712
+ }
1713
+
1714
+ else
1715
+ # endif
1716
+ aindex = (int)channels;
1717
+
1718
+ /* Use row_end in place of a loop counter: */
1719
+ row_end = output_row + image->width * (channels+1);
1720
+
1721
+ for (; y > 0; --y)
1722
+ {
1723
+ png_const_uint_16p in_ptr = input_row;
1724
+ png_bytep out_ptr = output_row;
1725
+
1726
+ while (out_ptr < row_end)
1727
+ {
1728
+ png_uint_16 alpha = in_ptr[aindex];
1729
+ png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
1730
+ png_uint_32 reciprocal = 0;
1731
+ int c;
1732
+
1733
+ /* Scale and write the alpha channel. */
1734
+ out_ptr[aindex] = alphabyte;
1735
+
1736
+ if (alphabyte > 0 && alphabyte < 255)
1737
+ reciprocal = UNP_RECIPROCAL(alpha);
1738
+
1739
+ c = (int)channels;
1740
+ do /* always at least one channel */
1741
+ *out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
1742
+ while (--c > 0);
1743
+
1744
+ /* Skip to next component (skip the intervening alpha channel) */
1745
+ ++in_ptr;
1746
+ ++out_ptr;
1747
+ } /* while out_ptr < row_end */
1748
+
1749
+ png_write_row(png_ptr, png_voidcast(png_const_bytep,
1750
+ display->local_row));
1751
+ input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
1752
+ } /* while y */
1753
+ }
1754
+
1755
+ else
1756
+ {
1757
+ /* No alpha channel, so the row_end really is the end of the row and it
1758
+ * is sufficient to loop over the components one by one.
1759
+ */
1760
+ png_bytep row_end = output_row + image->width * channels;
1761
+
1762
+ for (; y > 0; --y)
1763
+ {
1764
+ png_const_uint_16p in_ptr = input_row;
1765
+ png_bytep out_ptr = output_row;
1766
+
1767
+ while (out_ptr < row_end)
1768
+ {
1769
+ png_uint_32 component = *in_ptr++;
1770
+
1771
+ component *= 255;
1772
+ *out_ptr++ = (png_byte)PNG_sRGB_FROM_LINEAR(component);
1773
+ }
1774
+
1775
+ png_write_row(png_ptr, output_row);
1776
+ input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
1777
+ }
1778
+ }
1779
+
1780
+ return 1;
1781
+ }
1782
+
1783
+ static void
1784
+ png_image_set_PLTE(png_image_write_control *display)
1785
+ {
1786
+ png_imagep image = display->image;
1787
+ const void *cmap = display->colormap;
1788
+ int entries = image->colormap_entries > 256 ? 256 :
1789
+ (int)image->colormap_entries;
1790
+
1791
+ /* NOTE: the caller must check for cmap != NULL and entries != 0 */
1792
+ png_uint_32 format = image->format;
1793
+ unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
1794
+
1795
+ # if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
1796
+ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
1797
+ int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
1798
+ (format & PNG_FORMAT_FLAG_ALPHA) != 0;
1799
+ # else
1800
+ # define afirst 0
1801
+ # endif
1802
+
1803
+ # ifdef PNG_FORMAT_BGR_SUPPORTED
1804
+ int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
1805
+ # else
1806
+ # define bgr 0
1807
+ # endif
1808
+
1809
+ int i, num_trans;
1810
+ png_color palette[256];
1811
+ png_byte tRNS[256];
1812
+
1813
+ memset(tRNS, 255, (sizeof tRNS));
1814
+ memset(palette, 0, (sizeof palette));
1815
+
1816
+ for (i=num_trans=0; i<entries; ++i)
1817
+ {
1818
+ /* This gets automatically converted to sRGB with reversal of the
1819
+ * pre-multiplication if the color-map has an alpha channel.
1820
+ */
1821
+ if ((format & PNG_FORMAT_FLAG_LINEAR) != 0)
1822
+ {
1823
+ png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
1824
+
1825
+ entry += (unsigned int)i * channels;
1826
+
1827
+ if ((channels & 1) != 0) /* no alpha */
1828
+ {
1829
+ if (channels >= 3) /* RGB */
1830
+ {
1831
+ palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
1832
+ entry[(2 ^ bgr)]);
1833
+ palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
1834
+ entry[1]);
1835
+ palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
1836
+ entry[bgr]);
1837
+ }
1838
+
1839
+ else /* Gray */
1840
+ palette[i].blue = palette[i].red = palette[i].green =
1841
+ (png_byte)PNG_sRGB_FROM_LINEAR(255 * *entry);
1842
+ }
1843
+
1844
+ else /* alpha */
1845
+ {
1846
+ png_uint_16 alpha = entry[afirst ? 0 : channels-1];
1847
+ png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
1848
+ png_uint_32 reciprocal = 0;
1849
+
1850
+ /* Calculate a reciprocal, as in the png_write_image_8bit code above
1851
+ * this is designed to produce a value scaled to 255*65535 when
1852
+ * divided by 128 (i.e. asr 7).
1853
+ */
1854
+ if (alphabyte > 0 && alphabyte < 255)
1855
+ reciprocal = (((0xffff*0xff)<<7)+(alpha>>1))/alpha;
1856
+
1857
+ tRNS[i] = alphabyte;
1858
+ if (alphabyte < 255)
1859
+ num_trans = i+1;
1860
+
1861
+ if (channels >= 3) /* RGB */
1862
+ {
1863
+ palette[i].blue = png_unpremultiply(entry[afirst + (2 ^ bgr)],
1864
+ alpha, reciprocal);
1865
+ palette[i].green = png_unpremultiply(entry[afirst + 1], alpha,
1866
+ reciprocal);
1867
+ palette[i].red = png_unpremultiply(entry[afirst + bgr], alpha,
1868
+ reciprocal);
1869
+ }
1870
+
1871
+ else /* gray */
1872
+ palette[i].blue = palette[i].red = palette[i].green =
1873
+ png_unpremultiply(entry[afirst], alpha, reciprocal);
1874
+ }
1875
+ }
1876
+
1877
+ else /* Color-map has sRGB values */
1878
+ {
1879
+ png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
1880
+
1881
+ entry += (unsigned int)i * channels;
1882
+
1883
+ switch (channels)
1884
+ {
1885
+ case 4:
1886
+ tRNS[i] = entry[afirst ? 0 : 3];
1887
+ if (tRNS[i] < 255)
1888
+ num_trans = i+1;
1889
+ /* FALLTHROUGH */
1890
+ case 3:
1891
+ palette[i].blue = entry[afirst + (2 ^ bgr)];
1892
+ palette[i].green = entry[afirst + 1];
1893
+ palette[i].red = entry[afirst + bgr];
1894
+ break;
1895
+
1896
+ case 2:
1897
+ tRNS[i] = entry[1 ^ afirst];
1898
+ if (tRNS[i] < 255)
1899
+ num_trans = i+1;
1900
+ /* FALLTHROUGH */
1901
+ case 1:
1902
+ palette[i].blue = palette[i].red = palette[i].green =
1903
+ entry[afirst];
1904
+ break;
1905
+
1906
+ default:
1907
+ break;
1908
+ }
1909
+ }
1910
+ }
1911
+
1912
+ # ifdef afirst
1913
+ # undef afirst
1914
+ # endif
1915
+ # ifdef bgr
1916
+ # undef bgr
1917
+ # endif
1918
+
1919
+ png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
1920
+ entries);
1921
+
1922
+ if (num_trans > 0)
1923
+ png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
1924
+ num_trans, NULL);
1925
+
1926
+ image->colormap_entries = (png_uint_32)entries;
1927
+ }
1928
+
1929
+ static int
1930
+ png_image_write_main(png_voidp argument)
1931
+ {
1932
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
1933
+ argument);
1934
+ png_imagep image = display->image;
1935
+ png_structrp png_ptr = image->opaque->png_ptr;
1936
+ png_inforp info_ptr = image->opaque->info_ptr;
1937
+ png_uint_32 format = image->format;
1938
+
1939
+ /* The following four ints are actually booleans */
1940
+ int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
1941
+ int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
1942
+ int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
1943
+ int write_16bit = linear && (display->convert_to_8bit == 0);
1944
+
1945
+ # ifdef PNG_BENIGN_ERRORS_SUPPORTED
1946
+ /* Make sure we error out on any bad situation */
1947
+ png_set_benign_errors(png_ptr, 0/*error*/);
1948
+ # endif
1949
+
1950
+ /* Default the 'row_stride' parameter if required, also check the row stride
1951
+ * and total image size to ensure that they are within the system limits.
1952
+ */
1953
+ {
1954
+ unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
1955
+
1956
+ if (image->width <= 0x7fffffffU/channels) /* no overflow */
1957
+ {
1958
+ png_uint_32 check;
1959
+ png_uint_32 png_row_stride = image->width * channels;
1960
+
1961
+ if (display->row_stride == 0)
1962
+ display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
1963
+
1964
+ if (display->row_stride < 0)
1965
+ check = (png_uint_32)(-display->row_stride);
1966
+
1967
+ else
1968
+ check = (png_uint_32)display->row_stride;
1969
+
1970
+ if (check >= png_row_stride)
1971
+ {
1972
+ /* Now check for overflow of the image buffer calculation; this
1973
+ * limits the whole image size to 32 bits for API compatibility with
1974
+ * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
1975
+ */
1976
+ if (image->height > 0xffffffffU/png_row_stride)
1977
+ png_error(image->opaque->png_ptr, "memory image too large");
1978
+ }
1979
+
1980
+ else
1981
+ png_error(image->opaque->png_ptr, "supplied row stride too small");
1982
+ }
1983
+
1984
+ else
1985
+ png_error(image->opaque->png_ptr, "image row stride too large");
1986
+ }
1987
+
1988
+ /* Set the required transforms then write the rows in the correct order. */
1989
+ if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
1990
+ {
1991
+ if (display->colormap != NULL && image->colormap_entries > 0)
1992
+ {
1993
+ png_uint_32 entries = image->colormap_entries;
1994
+
1995
+ png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
1996
+ entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
1997
+ PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
1998
+ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
1999
+
2000
+ png_image_set_PLTE(display);
2001
+ }
2002
+
2003
+ else
2004
+ png_error(image->opaque->png_ptr,
2005
+ "no color-map for color-mapped image");
2006
+ }
2007
+
2008
+ else
2009
+ png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
2010
+ write_16bit ? 16 : 8,
2011
+ ((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
2012
+ ((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
2013
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
2014
+
2015
+ /* Counter-intuitively the data transformations must be called *after*
2016
+ * png_write_info, not before as in the read code, but the 'set' functions
2017
+ * must still be called before. Just set the color space information, never
2018
+ * write an interlaced image.
2019
+ */
2020
+
2021
+ if (write_16bit != 0)
2022
+ {
2023
+ /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
2024
+ png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
2025
+
2026
+ if ((image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB) == 0)
2027
+ png_set_cHRM_fixed(png_ptr, info_ptr,
2028
+ /* color x y */
2029
+ /* white */ 31270, 32900,
2030
+ /* red */ 64000, 33000,
2031
+ /* green */ 30000, 60000,
2032
+ /* blue */ 15000, 6000
2033
+ );
2034
+ }
2035
+
2036
+ else if ((image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB) == 0)
2037
+ png_set_sRGB(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
2038
+
2039
+ /* Else writing an 8-bit file and the *colors* aren't sRGB, but the 8-bit
2040
+ * space must still be gamma encoded.
2041
+ */
2042
+ else
2043
+ png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE);
2044
+
2045
+ /* Write the file header. */
2046
+ png_write_info(png_ptr, info_ptr);
2047
+
2048
+ /* Now set up the data transformations (*after* the header is written),
2049
+ * remove the handled transformations from the 'format' flags for checking.
2050
+ *
2051
+ * First check for a little endian system if writing 16-bit files.
2052
+ */
2053
+ if (write_16bit != 0)
2054
+ {
2055
+ png_uint_16 le = 0x0001;
2056
+
2057
+ if ((*(png_const_bytep) & le) != 0)
2058
+ png_set_swap(png_ptr);
2059
+ }
2060
+
2061
+ # ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
2062
+ if ((format & PNG_FORMAT_FLAG_BGR) != 0)
2063
+ {
2064
+ if (colormap == 0 && (format & PNG_FORMAT_FLAG_COLOR) != 0)
2065
+ png_set_bgr(png_ptr);
2066
+ format &= ~PNG_FORMAT_FLAG_BGR;
2067
+ }
2068
+ # endif
2069
+
2070
+ # ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
2071
+ if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
2072
+ {
2073
+ if (colormap == 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
2074
+ png_set_swap_alpha(png_ptr);
2075
+ format &= ~PNG_FORMAT_FLAG_AFIRST;
2076
+ }
2077
+ # endif
2078
+
2079
+ /* If there are 16 or fewer color-map entries we wrote a lower bit depth
2080
+ * above, but the application data is still byte packed.
2081
+ */
2082
+ if (colormap != 0 && image->colormap_entries <= 16)
2083
+ png_set_packing(png_ptr);
2084
+
2085
+ /* That should have handled all (both) the transforms. */
2086
+ if ((format & ~(png_uint_32)(PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_LINEAR |
2087
+ PNG_FORMAT_FLAG_ALPHA | PNG_FORMAT_FLAG_COLORMAP)) != 0)
2088
+ png_error(png_ptr, "png_write_image: unsupported transformation");
2089
+
2090
+ {
2091
+ png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
2092
+ ptrdiff_t row_bytes = display->row_stride;
2093
+
2094
+ if (linear != 0)
2095
+ row_bytes *= (sizeof (png_uint_16));
2096
+
2097
+ if (row_bytes < 0)
2098
+ row += (image->height-1) * (-row_bytes);
2099
+
2100
+ display->first_row = row;
2101
+ display->row_bytes = row_bytes;
2102
+ }
2103
+
2104
+ /* Apply 'fast' options if the flag is set. */
2105
+ if ((image->flags & PNG_IMAGE_FLAG_FAST) != 0)
2106
+ {
2107
+ png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, PNG_NO_FILTERS);
2108
+ /* NOTE: determined by experiment using pngstest, this reflects some
2109
+ * balance between the time to write the image once and the time to read
2110
+ * it about 50 times. The speed-up in pngstest was about 10-20% of the
2111
+ * total (user) time on a heavily loaded system.
2112
+ */
2113
+ # ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
2114
+ png_set_compression_level(png_ptr, 3);
2115
+ # endif
2116
+ }
2117
+
2118
+ /* Check for the cases that currently require a pre-transform on the row
2119
+ * before it is written. This only applies when the input is 16-bit and
2120
+ * either there is an alpha channel or it is converted to 8-bit.
2121
+ */
2122
+ if ((linear != 0 && alpha != 0 ) ||
2123
+ (colormap == 0 && display->convert_to_8bit != 0))
2124
+ {
2125
+ png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
2126
+ png_get_rowbytes(png_ptr, info_ptr)));
2127
+ int result;
2128
+
2129
+ display->local_row = row;
2130
+ if (write_16bit != 0)
2131
+ result = png_safe_execute(image, png_write_image_16bit, display);
2132
+ else
2133
+ result = png_safe_execute(image, png_write_image_8bit, display);
2134
+ display->local_row = NULL;
2135
+
2136
+ png_free(png_ptr, row);
2137
+
2138
+ /* Skip the 'write_end' on error: */
2139
+ if (result == 0)
2140
+ return 0;
2141
+ }
2142
+
2143
+ /* Otherwise this is the case where the input is in a format currently
2144
+ * supported by the rest of the libpng write code; call it directly.
2145
+ */
2146
+ else
2147
+ {
2148
+ png_const_bytep row = png_voidcast(png_const_bytep, display->first_row);
2149
+ ptrdiff_t row_bytes = display->row_bytes;
2150
+ png_uint_32 y = image->height;
2151
+
2152
+ for (; y > 0; --y)
2153
+ {
2154
+ png_write_row(png_ptr, row);
2155
+ row += row_bytes;
2156
+ }
2157
+ }
2158
+
2159
+ png_write_end(png_ptr, info_ptr);
2160
+ return 1;
2161
+ }
2162
+
2163
+
2164
+ static void (PNGCBAPI
2165
+ image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data, size_t size)
2166
+ {
2167
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
2168
+ png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
2169
+ png_alloc_size_t ob = display->output_bytes;
2170
+
2171
+ /* Check for overflow; this should never happen: */
2172
+ if (size <= ((png_alloc_size_t)-1) - ob)
2173
+ {
2174
+ /* I don't think libpng ever does this, but just in case: */
2175
+ if (size > 0)
2176
+ {
2177
+ if (display->memory_bytes >= ob+size) /* writing */
2178
+ memcpy(display->memory+ob, data, size);
2179
+
2180
+ /* Always update the size: */
2181
+ display->output_bytes = ob+size;
2182
+ }
2183
+ }
2184
+
2185
+ else
2186
+ png_error(png_ptr, "png_image_write_to_memory: PNG too big");
2187
+ }
2188
+
2189
+ static void (PNGCBAPI
2190
+ image_memory_flush)(png_structp png_ptr)
2191
+ {
2192
+ PNG_UNUSED(png_ptr)
2193
+ }
2194
+
2195
+ static int
2196
+ png_image_write_memory(png_voidp argument)
2197
+ {
2198
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
2199
+ argument);
2200
+
2201
+ /* The rest of the memory-specific init and write_main in an error protected
2202
+ * environment. This case needs to use callbacks for the write operations
2203
+ * since libpng has no built in support for writing to memory.
2204
+ */
2205
+ png_set_write_fn(display->image->opaque->png_ptr, display/*io_ptr*/,
2206
+ image_memory_write, image_memory_flush);
2207
+
2208
+ return png_image_write_main(display);
2209
+ }
2210
+
2211
+ int PNGAPI
2212
+ png_image_write_to_memory(png_imagep image, void *memory,
2213
+ png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
2214
+ const void *buffer, png_int_32 row_stride, const void *colormap)
2215
+ {
2216
+ /* Write the image to the given buffer, or count the bytes if it is NULL */
2217
+ if (image != NULL && image->version == PNG_IMAGE_VERSION)
2218
+ {
2219
+ if (memory_bytes != NULL && buffer != NULL)
2220
+ {
2221
+ /* This is to give the caller an easier error detection in the NULL
2222
+ * case and guard against uninitialized variable problems:
2223
+ */
2224
+ if (memory == NULL)
2225
+ *memory_bytes = 0;
2226
+
2227
+ if (png_image_write_init(image) != 0)
2228
+ {
2229
+ png_image_write_control display;
2230
+ int result;
2231
+
2232
+ memset(&display, 0, (sizeof display));
2233
+ display.image = image;
2234
+ display.buffer = buffer;
2235
+ display.row_stride = row_stride;
2236
+ display.colormap = colormap;
2237
+ display.convert_to_8bit = convert_to_8bit;
2238
+ display.memory = png_voidcast(png_bytep, memory);
2239
+ display.memory_bytes = *memory_bytes;
2240
+ display.output_bytes = 0;
2241
+
2242
+ result = png_safe_execute(image, png_image_write_memory, &display);
2243
+ png_image_free(image);
2244
+
2245
+ /* write_memory returns true even if we ran out of buffer. */
2246
+ if (result)
2247
+ {
2248
+ /* On out-of-buffer this function returns '0' but still updates
2249
+ * memory_bytes:
2250
+ */
2251
+ if (memory != NULL && display.output_bytes > *memory_bytes)
2252
+ result = 0;
2253
+
2254
+ *memory_bytes = display.output_bytes;
2255
+ }
2256
+
2257
+ return result;
2258
+ }
2259
+
2260
+ else
2261
+ return 0;
2262
+ }
2263
+
2264
+ else
2265
+ return png_image_error(image,
2266
+ "png_image_write_to_memory: invalid argument");
2267
+ }
2268
+
2269
+ else if (image != NULL)
2270
+ return png_image_error(image,
2271
+ "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
2272
+
2273
+ else
2274
+ return 0;
2275
+ }
2276
+
2277
+ #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
2278
+ int PNGAPI
2279
+ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
2280
+ const void *buffer, png_int_32 row_stride, const void *colormap)
2281
+ {
2282
+ /* Write the image to the given (FILE*). */
2283
+ if (image != NULL && image->version == PNG_IMAGE_VERSION)
2284
+ {
2285
+ if (file != NULL && buffer != NULL)
2286
+ {
2287
+ if (png_image_write_init(image) != 0)
2288
+ {
2289
+ png_image_write_control display;
2290
+ int result;
2291
+
2292
+ /* This is slightly evil, but png_init_io doesn't do anything other
2293
+ * than this and we haven't changed the standard IO functions so
2294
+ * this saves a 'safe' function.
2295
+ */
2296
+ image->opaque->png_ptr->io_ptr = file;
2297
+
2298
+ memset(&display, 0, (sizeof display));
2299
+ display.image = image;
2300
+ display.buffer = buffer;
2301
+ display.row_stride = row_stride;
2302
+ display.colormap = colormap;
2303
+ display.convert_to_8bit = convert_to_8bit;
2304
+
2305
+ result = png_safe_execute(image, png_image_write_main, &display);
2306
+ png_image_free(image);
2307
+ return result;
2308
+ }
2309
+
2310
+ else
2311
+ return 0;
2312
+ }
2313
+
2314
+ else
2315
+ return png_image_error(image,
2316
+ "png_image_write_to_stdio: invalid argument");
2317
+ }
2318
+
2319
+ else if (image != NULL)
2320
+ return png_image_error(image,
2321
+ "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
2322
+
2323
+ else
2324
+ return 0;
2325
+ }
2326
+
2327
+ int PNGAPI
2328
+ png_image_write_to_file(png_imagep image, const char *file_name,
2329
+ int convert_to_8bit, const void *buffer, png_int_32 row_stride,
2330
+ const void *colormap)
2331
+ {
2332
+ /* Write the image to the named file. */
2333
+ if (image != NULL && image->version == PNG_IMAGE_VERSION)
2334
+ {
2335
+ if (file_name != NULL && buffer != NULL)
2336
+ {
2337
+ FILE *fp = fopen(file_name, "wb");
2338
+
2339
+ if (fp != NULL)
2340
+ {
2341
+ if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer,
2342
+ row_stride, colormap) != 0)
2343
+ {
2344
+ int error; /* from fflush/fclose */
2345
+
2346
+ /* Make sure the file is flushed correctly. */
2347
+ if (fflush(fp) == 0 && ferror(fp) == 0)
2348
+ {
2349
+ if (fclose(fp) == 0)
2350
+ return 1;
2351
+
2352
+ error = errno; /* from fclose */
2353
+ }
2354
+
2355
+ else
2356
+ {
2357
+ error = errno; /* from fflush or ferror */
2358
+ (void)fclose(fp);
2359
+ }
2360
+
2361
+ (void)remove(file_name);
2362
+ /* The image has already been cleaned up; this is just used to
2363
+ * set the error (because the original write succeeded).
2364
+ */
2365
+ return png_image_error(image, strerror(error));
2366
+ }
2367
+
2368
+ else
2369
+ {
2370
+ /* Clean up: just the opened file. */
2371
+ (void)fclose(fp);
2372
+ (void)remove(file_name);
2373
+ return 0;
2374
+ }
2375
+ }
2376
+
2377
+ else
2378
+ return png_image_error(image, strerror(errno));
2379
+ }
2380
+
2381
+ else
2382
+ return png_image_error(image,
2383
+ "png_image_write_to_file: invalid argument");
2384
+ }
2385
+
2386
+ else if (image != NULL)
2387
+ return png_image_error(image,
2388
+ "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
2389
+
2390
+ else
2391
+ return 0;
2392
+ }
2393
+ #endif /* SIMPLIFIED_WRITE_STDIO */
2394
+ #endif /* SIMPLIFIED_WRITE */
2395
+ #endif /* WRITE */