├── .dir-locals.el ├── .github ├── ISSUE_TEMPLATE.md └── workflows │ ├── crowdin_prep.yml │ └── crowdin_translate.yml ├── .gitignore ├── .gitlab-ci.yml ├── .travis.yml ├── COPYING ├── Makefile ├── Makefile.common ├── README.md ├── appveyor.yml ├── beetle_psx_globals.c ├── beetle_psx_globals.h ├── beetle_psx_griffin.cpp ├── beetle_psx_griffin_c.c ├── deps ├── libchdr │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── README.md │ ├── include │ │ ├── dr_libs │ │ │ └── dr_flac.h │ │ └── libchdr │ │ │ ├── bitstream.h │ │ │ ├── cdrom.h │ │ │ ├── chd.h │ │ │ ├── chdconfig.h │ │ │ ├── coretypes.h │ │ │ ├── flac.h │ │ │ └── huffman.h │ └── src │ │ ├── libchdr_bitstream.c │ │ ├── libchdr_cdrom.c │ │ ├── libchdr_chd.c │ │ ├── libchdr_flac.c │ │ ├── libchdr_huffman.c │ │ └── link.T ├── libkirk │ ├── aes.c │ ├── aes.h │ ├── amctrl.c │ ├── amctrl.h │ ├── bn.c │ ├── des.c │ ├── des.h │ ├── ec.c │ ├── key_vault.h │ ├── kirk_engine.c │ ├── kirk_engine.h │ ├── psp_headers.h │ ├── sha1.c │ └── sha1.h ├── lightning │ ├── .gitattributes │ ├── .gitignore │ ├── .gitmodules │ ├── .gitrepo │ ├── AUTHORS │ ├── COPYING │ ├── COPYING.DOC │ ├── COPYING.LESSER │ ├── ChangeLog │ ├── NEWS │ ├── README │ ├── README-hacking │ ├── THANKS │ ├── TODO │ ├── include │ │ └── lightning │ │ │ ├── jit_aarch64.h │ │ │ ├── jit_alpha.h │ │ │ ├── jit_arm.h │ │ │ ├── jit_hppa.h │ │ │ ├── jit_ia64.h │ │ │ ├── jit_mips.h │ │ │ ├── jit_ppc.h │ │ │ ├── jit_private.h │ │ │ ├── jit_riscv.h │ │ │ ├── jit_s390.h │ │ │ ├── jit_sparc.h │ │ │ └── jit_x86.h │ └── lib │ │ ├── jit_aarch64-cpu.c │ │ ├── jit_aarch64-fpu.c │ │ ├── jit_aarch64-sz.c │ │ ├── jit_aarch64.c │ │ ├── jit_alpha-cpu.c │ │ ├── jit_alpha-fpu.c │ │ ├── jit_alpha-sz.c │ │ ├── jit_alpha.c │ │ ├── jit_arm-cpu.c │ │ ├── jit_arm-swf.c │ │ ├── jit_arm-sz.c │ │ ├── jit_arm-vfp.c │ │ ├── jit_arm.c │ │ ├── jit_hppa-cpu.c │ │ ├── jit_hppa-fpu.c │ │ ├── jit_hppa-sz.c │ │ ├── jit_hppa.c │ │ ├── jit_ia64-cpu.c │ │ ├── jit_ia64-fpu.c │ │ ├── jit_ia64-sz.c │ │ ├── jit_ia64.c │ │ ├── jit_memory.c │ │ ├── jit_mips-cpu.c │ │ ├── jit_mips-fpu.c │ │ ├── jit_mips-sz.c │ │ ├── jit_mips.c │ │ ├── jit_names.c │ │ ├── jit_note.c │ │ ├── jit_ppc-cpu.c │ │ ├── jit_ppc-fpu.c │ │ ├── jit_ppc-sz.c │ │ ├── jit_ppc.c │ │ ├── jit_rewind.c │ │ ├── jit_riscv-cpu.c │ │ ├── jit_riscv-fpu.c │ │ ├── jit_riscv-sz.c │ │ ├── jit_riscv.c │ │ ├── jit_s390-cpu.c │ │ ├── jit_s390-fpu.c │ │ ├── jit_s390-sz.c │ │ ├── jit_s390.c │ │ ├── jit_size.c │ │ ├── jit_sparc-cpu.c │ │ ├── jit_sparc-fpu.c │ │ ├── jit_sparc-sz.c │ │ ├── jit_sparc.c │ │ ├── jit_x86-cpu.c │ │ ├── jit_x86-sse.c │ │ ├── jit_x86-sz.c │ │ ├── jit_x86-x87.c │ │ ├── jit_x86.c │ │ └── lightning.c ├── lightrec │ ├── .gitignore │ ├── .gitrepo │ ├── CMakeLists.txt │ ├── COPYING │ ├── README.md │ ├── blockcache.c │ ├── blockcache.h │ ├── config.h.cmakein │ ├── debug.h │ ├── disassembler.c │ ├── disassembler.h │ ├── emitter.c │ ├── emitter.h │ ├── interpreter.c │ ├── interpreter.h │ ├── lightrec-private.h │ ├── lightrec.c │ ├── lightrec.h │ ├── memmanager.c │ ├── memmanager.h │ ├── optimizer.c │ ├── optimizer.h │ ├── reaper.c │ ├── reaper.h │ ├── recompiler.c │ ├── recompiler.h │ ├── regcache.c │ ├── regcache.h │ └── slist.h ├── lzma-19.00 │ ├── CMakeLists.txt │ ├── LICENSE │ ├── include │ │ ├── 7zTypes.h │ │ ├── Alloc.h │ │ ├── Bra.h │ │ ├── Compiler.h │ │ ├── CpuArch.h │ │ ├── Delta.h │ │ ├── LzFind.h │ │ ├── LzHash.h │ │ ├── Lzma86.h │ │ ├── LzmaDec.h │ │ ├── LzmaEnc.h │ │ ├── LzmaLib.h │ │ ├── Precomp.h │ │ └── Sort.h │ ├── lzma-history.txt │ ├── lzma.txt │ ├── lzma.vcxproj │ ├── lzma.vcxproj.filters │ └── src │ │ ├── Alloc.c │ │ ├── Bra86.c │ │ ├── BraIA64.c │ │ ├── CpuArch.c │ │ ├── Delta.c │ │ ├── LzFind.c │ │ ├── Lzma86Dec.c │ │ ├── Lzma86Enc.c │ │ ├── LzmaDec.c │ │ ├── LzmaEnc.c │ │ └── Sort.c ├── mman │ └── sys │ │ ├── .gitignore │ │ ├── .gitrepo │ │ ├── .vs │ │ └── mman │ │ │ └── v14 │ │ │ └── .suo │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── README.md │ │ ├── UpgradeLog.htm │ │ ├── configure │ │ ├── mman-win32.pro │ │ ├── mman.c │ │ ├── mman.h │ │ ├── mman.sln │ │ ├── mman.vcxproj │ │ ├── mman.vcxproj.filters │ │ ├── mman.vcxproj.user │ │ └── test.c ├── ugui │ ├── LICENSE.md │ ├── README.md │ ├── ugui.c │ ├── ugui.h │ └── ugui_config.h ├── wiiu │ ├── os │ │ ├── condition.h │ │ ├── mutex.h │ │ ├── thread.h │ │ └── time.h │ └── types.h └── zlib-1.2.11 │ ├── README │ ├── adler32.c │ ├── crc32.c │ ├── crc32.h │ ├── doc │ ├── algorithm.txt │ ├── rfc1950.txt │ ├── rfc1951.txt │ ├── rfc1952.txt │ └── txtvsbin.txt │ ├── gzguts.h │ ├── inffast.c │ ├── inffast.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── input.cpp ├── input.h ├── intl ├── .gitignore ├── core_option_regex.py ├── core_option_translation.py ├── crowdin.yaml ├── crowdin_prep.py ├── crowdin_source_upload.py ├── crowdin_translate.py ├── crowdin_translation_download.py ├── download_workflow.py ├── initial_sync.py ├── upload_workflow.py └── v1_to_v2_converter.py ├── jni ├── Android.mk └── Application.mk ├── libretro-common ├── cdrom │ └── cdrom.c ├── compat │ ├── compat_posix_string.c │ ├── compat_snprintf.c │ ├── compat_strcasestr.c │ ├── compat_strl.c │ └── fopen_utf8.c ├── encodings │ └── encoding_utf.c ├── file │ ├── file_path.c │ └── retro_dirent.c ├── glsm │ └── glsm.c ├── glsym │ ├── README.md │ ├── glgen.py │ ├── glsym_es2.c │ ├── glsym_es3.c │ ├── glsym_gl.c │ ├── rglgen.c │ └── rglgen.py ├── hash │ └── rhash.c ├── include │ ├── boolean.h │ ├── cdrom │ │ └── cdrom.h │ ├── compat │ │ ├── apple_compat.h │ │ ├── fnmatch.h │ │ ├── fopen_utf8.h │ │ ├── getopt.h │ │ ├── ifaddrs.h │ │ ├── intrinsics.h │ │ ├── msvc.h │ │ ├── msvc │ │ │ └── stdint.h │ │ ├── posix_string.h │ │ ├── strcasestr.h │ │ └── strl.h │ ├── encodings │ │ └── utf.h │ ├── file │ │ └── file_path.h │ ├── glsm │ │ ├── glsm.h │ │ └── glsmsym.h │ ├── glsym │ │ ├── glsym.h │ │ ├── glsym_es2.h │ │ ├── glsym_es3.h │ │ ├── glsym_gl.h │ │ ├── rglgen.h │ │ ├── rglgen_headers.h │ │ └── rglgen_private_headers.h │ ├── libretro.h │ ├── libretro_vulkan.h │ ├── lists │ │ ├── dir_list.h │ │ └── string_list.h │ ├── math │ │ └── float_minmax.h │ ├── memalign.h │ ├── memmap.h │ ├── retro_assert.h │ ├── retro_common.h │ ├── retro_common_api.h │ ├── retro_dirent.h │ ├── retro_endianness.h │ ├── retro_environment.h │ ├── retro_inline.h │ ├── retro_math.h │ ├── retro_miscellaneous.h │ ├── retro_timers.h │ ├── rhash.h │ ├── rthreads │ │ ├── rsemaphore.h │ │ └── rthreads.h │ ├── streams │ │ ├── file_stream.h │ │ └── file_stream_transforms.h │ ├── string │ │ └── stdstring.h │ ├── time │ │ └── rtime.h │ └── vfs │ │ ├── vfs.h │ │ ├── vfs_implementation.h │ │ └── vfs_implementation_cdrom.h ├── lists │ ├── dir_list.c │ └── string_list.c ├── memmap │ └── memalign.c ├── rthreads │ ├── gx_pthread.h │ ├── psp_pthread.h │ ├── rsemaphore.c │ ├── rthreads.c │ ├── wiiu_pthread.h │ └── xenon_sdl_threads.c ├── streams │ ├── file_stream.c │ └── file_stream_transforms.c ├── string │ └── stdstring.c ├── time │ └── rtime.c └── vfs │ ├── vfs_implementation.c │ └── vfs_implementation_cdrom.c ├── libretro.cpp ├── libretro.osx.def ├── libretro_cbs.c ├── libretro_cbs.h ├── libretro_core_options.h ├── libretro_core_options_intl.h ├── libretro_options.h ├── lightning-lightrec-include ├── config.h ├── debug.h └── lightning.h ├── link.T ├── mednafen ├── FileStream.cpp ├── FileStream.h ├── MemoryStream.cpp ├── MemoryStream.h ├── Stream.cpp ├── Stream.h ├── cdrom │ ├── CDAccess.cpp │ ├── CDAccess.h │ ├── CDAccess_CCD.cpp │ ├── CDAccess_CCD.h │ ├── CDAccess_CHD.cpp │ ├── CDAccess_CHD.h │ ├── CDAccess_Image.cpp │ ├── CDAccess_Image.h │ ├── CDAccess_PBP.cpp │ ├── CDAccess_PBP.h │ ├── CDUtility.c │ ├── CDUtility.h │ ├── SimpleFIFO.h │ ├── audioreader.cpp │ ├── audioreader.h │ ├── cdromif.cpp │ ├── cdromif.h │ ├── edc_crc32.c │ ├── edc_crc32.h │ ├── galois.c │ ├── galois.h │ ├── l-ec.c │ ├── l-ec.h │ ├── lec.c │ ├── lec.h │ ├── misc.cpp │ ├── misc.h │ ├── recover-raw.c │ └── recover-raw.h ├── clamp.h ├── error.cpp ├── error.h ├── general.cpp ├── general.h ├── git.h ├── masmem.h ├── math_ops.h ├── mednafen-endian.cpp ├── mednafen-endian.h ├── mednafen-types.h ├── mednafen.h ├── mempatcher-driver.h ├── mempatcher.cpp ├── mempatcher.h ├── psx │ ├── FastFIFO.h │ ├── cdc.cpp │ ├── cdc.h │ ├── cpu.cpp │ ├── cpu.h │ ├── debug.cpp │ ├── debug.h │ ├── decomp.cpp │ ├── dis.cpp │ ├── dis.h │ ├── dma.cpp │ ├── dma.h │ ├── frontio.cpp │ ├── frontio.h │ ├── gpu.cpp │ ├── gpu.h │ ├── gpu_common.h │ ├── gpu_line.cpp │ ├── gpu_polygon.cpp │ ├── gpu_polygon_sub.cpp │ ├── gpu_sprite.cpp │ ├── gte.cpp │ ├── gte.h │ ├── input │ │ ├── dualanalog.cpp │ │ ├── dualanalog.h │ │ ├── dualshock.cpp │ │ ├── dualshock.h │ │ ├── gamepad.cpp │ │ ├── gamepad.h │ │ ├── guncon.cpp │ │ ├── guncon.h │ │ ├── justifier.cpp │ │ ├── justifier.h │ │ ├── memcard.cpp │ │ ├── memcard.h │ │ ├── mouse.cpp │ │ ├── mouse.h │ │ ├── multitap.cpp │ │ ├── multitap.h │ │ ├── negcon.cpp │ │ ├── negcon.h │ │ ├── negconrumble.cpp │ │ └── negconrumble.h │ ├── irq.cpp │ ├── irq.h │ ├── mdec.cpp │ ├── mdec.h │ ├── notes │ │ ├── NOTES │ │ ├── PSX-TODO │ │ ├── SOURCES │ │ ├── SPU-IRQ │ │ └── tristep.cpp │ ├── psx.h │ ├── sio.cpp │ ├── sio.h │ ├── spu.cpp │ ├── spu.h │ ├── spu_fir_table.inc │ ├── timer.cpp │ └── timer.h ├── settings.c ├── settings.h ├── state.c ├── state.h ├── state_helpers.h ├── tremor │ ├── COPYING │ ├── README │ ├── asm_arm.h │ ├── backends.h │ ├── bitwise.c │ ├── block.c │ ├── block.h │ ├── codebook.c │ ├── codebook.h │ ├── codec_internal.h │ ├── floor0.c │ ├── floor1.c │ ├── framing.c │ ├── info.c │ ├── ivorbiscodec.h │ ├── ivorbisfile.h │ ├── lsp_lookup.h │ ├── mapping0.c │ ├── mdct.c │ ├── mdct.h │ ├── mdct_lookup.h │ ├── misc.h │ ├── ogg.h │ ├── os.h │ ├── registry.c │ ├── registry.h │ ├── res012.c │ ├── sharedbook.c │ ├── synthesis.c │ ├── vorbisfile.c │ ├── window.c │ ├── window.h │ └── window_lookup.h └── video │ ├── Deinterlacer.cpp │ ├── Deinterlacer.h │ ├── surface.cpp │ └── surface.h ├── parallel-psx ├── .clang-format ├── COPYING ├── README.md ├── SPIRV-Cross │ ├── GLSL.std.450.h │ ├── spirv.hpp │ ├── spirv_cfg.cpp │ ├── spirv_cfg.hpp │ ├── spirv_common.hpp │ ├── spirv_cross.cpp │ ├── spirv_cross.hpp │ ├── spirv_cross_parsed_ir.cpp │ ├── spirv_cross_parsed_ir.hpp │ ├── spirv_parser.cpp │ └── spirv_parser.hpp ├── atlas │ ├── atlas.cpp │ └── atlas.hpp ├── custom-textures │ ├── config_parser.cpp │ ├── config_parser.h │ ├── dbg_input_callback.h │ ├── image_io.cpp │ ├── image_io.hpp │ ├── texture_tracker.cpp │ └── texture_tracker.hpp ├── format_all.sh ├── glsl │ ├── Makefile │ ├── blit_vram.comp │ ├── blit_vram_cached.comp │ ├── common.h │ ├── copy_vram.comp │ ├── dither.h │ ├── hdtextures.h │ ├── mipmap.vert │ ├── mipmap_blur.frag │ ├── mipmap_energy.frag │ ├── mipmap_resolve.frag │ ├── prebuilt │ │ ├── blit_vram.cached.masked.scaled.comp.inc │ │ ├── blit_vram.cached.masked.unscaled.comp.inc │ │ ├── blit_vram.cached.scaled.comp.inc │ │ ├── blit_vram.cached.unscaled.comp.inc │ │ ├── blit_vram.masked.scaled.comp.inc │ │ ├── blit_vram.masked.unscaled.comp.inc │ │ ├── blit_vram.msaa.cached.masked.scaled.comp.inc │ │ ├── blit_vram.msaa.cached.scaled.comp.inc │ │ ├── blit_vram.msaa.masked.scaled.comp.inc │ │ ├── blit_vram.msaa.scaled.comp.inc │ │ ├── blit_vram.scaled.comp.inc │ │ ├── blit_vram.unscaled.comp.inc │ │ ├── bpp24.quad.frag.inc │ │ ├── bpp24.yuv.quad.frag.inc │ │ ├── copy_vram.comp.inc │ │ ├── copy_vram.masked.comp.inc │ │ ├── feedback.flat.frag.inc │ │ ├── feedback.frag.inc │ │ ├── feedback.msaa.flat.frag.inc │ │ ├── feedback.msaa.frag.inc │ │ ├── feedback.msaa.unscaled.frag.inc │ │ ├── feedback.unscaled.frag.inc │ │ ├── flat.frag.inc │ │ ├── flat.unscaled.vert.inc │ │ ├── flat.vert.inc │ │ ├── mipmap.dither.resolve.frag.inc │ │ ├── mipmap.energy.blur.frag.inc │ │ ├── mipmap.energy.first.frag.inc │ │ ├── mipmap.energy.frag.inc │ │ ├── mipmap.resolve.frag.inc │ │ ├── mipmap.shifted.vert.inc │ │ ├── mipmap.vert.inc │ │ ├── quad.vert.inc │ │ ├── resolve.msaa.scaled.comp.inc │ │ ├── resolve.msaa.unscaled.comp.inc │ │ ├── resolve.scaled.comp.inc │ │ ├── resolve.unscaled.comp.inc │ │ ├── scaled.dither.quad.frag.inc │ │ ├── scaled.quad.frag.inc │ │ ├── textured.frag.inc │ │ ├── textured.msaa.frag.inc │ │ ├── textured.msaa.unscaled.frag.inc │ │ ├── textured.unscaled.frag.inc │ │ ├── textured.unscaled.vert.inc │ │ ├── textured.vert.inc │ │ ├── unscaled.dither.quad.frag.inc │ │ └── unscaled.quad.frag.inc │ ├── primitive.frag │ ├── primitive.h │ ├── primitive.vert │ ├── primitive_feedback.frag │ ├── quad.frag │ ├── quad.vert │ ├── rebuild_shaders.sh │ ├── resolve.comp │ └── vram.h ├── khronos │ └── include │ │ └── vulkan │ │ ├── vk_icd.h │ │ ├── vk_layer.h │ │ ├── vk_platform.h │ │ ├── vk_platform_old.h │ │ ├── vk_sdk_platform.h │ │ ├── vulkan.h │ │ ├── vulkan_android.h │ │ ├── vulkan_core.h │ │ ├── vulkan_fuchsia.h │ │ ├── vulkan_intel.h │ │ ├── vulkan_ios.h │ │ ├── vulkan_macos.h │ │ ├── vulkan_mir.h │ │ ├── vulkan_old.h │ │ ├── vulkan_vi.h │ │ ├── vulkan_wayland.h │ │ ├── vulkan_win32.h │ │ ├── vulkan_xcb.h │ │ ├── vulkan_xlib.h │ │ └── vulkan_xlib_xrandr.h ├── main.cpp ├── renderer │ ├── renderer.cpp │ ├── renderer.hpp │ └── renderer_pipelines.hpp ├── stb │ ├── stb.c │ ├── stb_image.h │ └── stb_image_write.h ├── util │ ├── array_view.hpp │ ├── async_object_sink.hpp │ ├── cli_parser.cpp │ ├── cli_parser.hpp │ ├── compile_time_hash.hpp │ ├── dynamic_library.cpp │ ├── dynamic_library.hpp │ ├── enum_cast.hpp │ ├── hash.hpp │ ├── hashmap.hpp │ ├── intrusive.hpp │ ├── intrusive_hash_map.hpp │ ├── intrusive_list.hpp │ ├── object_pool.hpp │ ├── read_write_lock.hpp │ ├── stack_allocator.hpp │ ├── temporary_hashmap.hpp │ ├── timer.cpp │ ├── timer.hpp │ ├── unstable_remove_if.hpp │ ├── util.cpp │ ├── util.hpp │ ├── variant.hpp │ └── volatile_source.hpp ├── volk │ ├── volk.c │ └── volk.h └── vulkan │ ├── buffer.cpp │ ├── buffer.hpp │ ├── buffer_pool.cpp │ ├── buffer_pool.hpp │ ├── command_buffer.cpp │ ├── command_buffer.hpp │ ├── command_pool.cpp │ ├── command_pool.hpp │ ├── cookie.cpp │ ├── cookie.hpp │ ├── descriptor_set.cpp │ ├── descriptor_set.hpp │ ├── device.cpp │ ├── device.hpp │ ├── event_manager.cpp │ ├── event_manager.hpp │ ├── fence.cpp │ ├── fence.hpp │ ├── fence_manager.cpp │ ├── fence_manager.hpp │ ├── format.hpp │ ├── image.cpp │ ├── image.hpp │ ├── limits.hpp │ ├── managers │ ├── texture_manager.cpp │ └── texture_manager.hpp │ ├── memory_allocator.cpp │ ├── memory_allocator.hpp │ ├── pipeline_event.cpp │ ├── pipeline_event.hpp │ ├── query_pool.cpp │ ├── query_pool.hpp │ ├── quirks.hpp │ ├── render_pass.cpp │ ├── render_pass.hpp │ ├── sampler.cpp │ ├── sampler.hpp │ ├── semaphore.cpp │ ├── semaphore.hpp │ ├── semaphore_manager.cpp │ ├── semaphore_manager.hpp │ ├── shader.cpp │ ├── shader.hpp │ ├── texture_format.cpp │ ├── texture_format.hpp │ ├── type_to_string.hpp │ ├── vulkan.cpp │ ├── vulkan.hpp │ └── vulkan_common.hpp ├── pgxp ├── README.md ├── pgxp_cpu.c ├── pgxp_cpu.h ├── pgxp_debug.c ├── pgxp_debug.h ├── pgxp_gpu.c ├── pgxp_gpu.h ├── pgxp_gte.c ├── pgxp_gte.h ├── pgxp_main.c ├── pgxp_main.h ├── pgxp_mem.c ├── pgxp_mem.h ├── pgxp_types.h ├── pgxp_value.c └── pgxp_value.h ├── rsx ├── README.md ├── rsx_dump.cpp ├── rsx_dump.h ├── rsx_intf.cpp ├── rsx_intf.h ├── rsx_lib_gl.cpp ├── rsx_lib_gl.h ├── rsx_lib_vulkan.cpp ├── rsx_lib_vulkan.h └── shaders_gl │ ├── command_fragment.glsl.h │ ├── command_vertex.glsl.h │ ├── image_load_fragment.glsl.h │ ├── image_load_vertex.glsl.h │ ├── output_fragment.glsl.h │ ├── output_vertex.glsl.h │ └── shaders_common.h ├── scrc32.h ├── ugui_tools.c └── ugui_tools.h /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((c-mode . ((mode . c++))) 2 | (nil . ((indent-tabs-mode . nil) 3 | (c-basic-offset . 3))) 4 | ("rustation-libretro" . 5 | ((nil . ((indent-tabs-mode . nil) 6 | (c-basic-offset . 4)))))) 7 | -------------------------------------------------------------------------------- /.github/workflows/crowdin_prep.yml: -------------------------------------------------------------------------------- 1 | # Prepare source texts & upload them to Crowdin 2 | 3 | name: Crowdin Source Texts Upload 4 | 5 | # on change to the English texts 6 | on: 7 | push: 8 | branches: 9 | - master 10 | paths: 11 | - 'libretro_core_options.h' 12 | 13 | jobs: 14 | upload_source_file: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Setup Java JDK 18 | uses: actions/setup-java@v3 19 | with: 20 | java-version: 18 21 | distribution: zulu 22 | 23 | - name: Setup Python 24 | uses: actions/setup-python@v4 25 | with: 26 | python-version: '3.10' 27 | 28 | - name: Checkout 29 | uses: actions/checkout@v3 30 | 31 | - name: Upload Source 32 | shell: bash 33 | env: 34 | CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} 35 | run: | 36 | python3 intl/upload_workflow.py $CROWDIN_API_KEY "beetle-psx-libretro" "libretro_core_options.h" 37 | -------------------------------------------------------------------------------- /.github/workflows/crowdin_translate.yml: -------------------------------------------------------------------------------- 1 | # Download translations form Crowdin & Recreate libretro_core_options_intl.h 2 | 3 | name: Crowdin Translation Integration 4 | 5 | on: 6 | schedule: 7 | # please choose a random time & weekday to avoid all repos synching at the same time 8 | - cron: '30 8 * * 5' # Fridays at 8:30 AM, UTC 9 | 10 | jobs: 11 | create_intl_file: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Setup Java JDK 15 | uses: actions/setup-java@v3 16 | with: 17 | java-version: 18 18 | distribution: zulu 19 | 20 | - name: Setup Python 21 | uses: actions/setup-python@v4 22 | with: 23 | python-version: '3.10' 24 | 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | with: 28 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. 29 | fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. 30 | 31 | - name: Create intl file 32 | shell: bash 33 | env: 34 | CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }} 35 | run: | 36 | python3 intl/download_workflow.py $CROWDIN_API_KEY "beetle-psx-libretro" "libretro_core_options_intl.h" 37 | 38 | - name: Commit files 39 | run: | 40 | git config --local user.email "github-actions@github.com" 41 | git config --local user.name "github-actions[bot]" 42 | git add intl/*_workflow.py "libretro_core_options_intl.h" 43 | git commit -m "Fetch translations & Recreate libretro_core_options_intl.h" 44 | 45 | - name: GitHub Push 46 | uses: ad-m/github-push-action@v0.6.0 47 | with: 48 | github_token: ${{ secrets.GITHUB_TOKEN }} 49 | branch: ${{ github.ref }} 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *.so 4 | *.dll 5 | *.dylib 6 | *.lib 7 | *.pdb 8 | *.exp 9 | *.manifest 10 | nul 11 | /old 12 | 13 | /msvc/Debug 14 | /msvc/Release 15 | /msvc/*.suo 16 | /msvc/*.user 17 | /msvc/*.sdf 18 | /msvc/*.db 19 | /msvc/x64 20 | /msvc/.vs/msvc-2010/v14/*.suo 21 | /msvc/.vs/msvc-2015/v14/*.suo 22 | /msvc/msvc-2015.VC.VC.opendb 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | os: linux 3 | dist: trusty 4 | sudo: required 5 | addons: 6 | apt: 7 | packages: 8 | - g++-7 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | env: 12 | global: 13 | - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7 14 | matrix: 15 | - PLATFORM=linux_x64 CORE=mednafen_psx 16 | - PLATFORM=linux_x64 CORE=mednafen_psx_hw 17 | before_script: 18 | - pwd 19 | - mkdir -p ~/bin 20 | - ln -s /usr/bin/gcc-7 ~/bin/gcc 21 | - ln -s /usr/bin/g++-7 ~/bin/g++ 22 | - ln -s /usr/bin/cpp-7 ~/bin/cpp 23 | - export PATH=~/bin:$PATH 24 | - ls -l ~/bin 25 | - echo $PATH 26 | - g++-7 --version 27 | - g++ --version 28 | script: 29 | - cd ~/ 30 | - git clone --depth=50 https://github.com/libretro/libretro-super 31 | - cd libretro-super/travis 32 | - ./build.sh 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/libretro/beetle-psx-libretro.svg?branch=master)](https://travis-ci.org/libretro/beetle-psx-libretro) 2 | [![Build status](https://ci.appveyor.com/api/projects/status/qd1ew088woadbqhc/branch/master?svg=true)](https://ci.appveyor.com/project/bparker06/beetle-psx-libretro/branch/master) 3 | 4 | # Beetle PSX libretro 5 | 6 | Beetle PSX is a port/fork of Mednafen's PSX module to the libretro API. It can be compiled in C++98 mode, excluding the Vulkan renderer, which is written in C++11 for the time being. Beetle PSX currently runs on Linux, OSX and Windows. 7 | 8 | Notable additions in this fork are: 9 | * PBP and CHD file format support, developed by Zapeth; 10 | * Software renderer internal resolution upscaling, implemented by simias; 11 | * An OpenGL 3.3 renderer, developed by simias; 12 | * A Vulkan renderer, developed by TinyTiger; 13 | * PGXP perspective correct texturing and subpixel precision, developed by iCatButler; 14 | 15 | ## Building 16 | 17 | Beetle PSX can be built with `make`. To build with hardware renderer support, run `make HAVE_HW=1`. `make clean` is required when switching between HW and non-HW builds. 18 | 19 | ## Coding Style 20 | 21 | The preferred coding style for Beetle PSX is the libretro coding style. See: https://docs.libretro.com/development/coding-standards/. Preexisting Mednafen code and various subdirectories may adhere to different styles; in those instances the preexisting style is preferred. 22 | 23 | ## Documentation 24 | 25 | https://docs.libretro.com/library/beetle_psx/ 26 | 27 | https://docs.libretro.com/library/beetle_psx_hw/ 28 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.1.{build} 2 | 3 | shallow_clone: true 4 | 5 | image: Visual Studio 2017 6 | 7 | environment: 8 | makefile_location: "." 9 | makefile_name: Makefile 10 | target_name: mednafen_psx 11 | 12 | configuration: 13 | - release 14 | 15 | platform: 16 | - windows_msvc2017_uwp_x64 17 | - windows_msvc2017_uwp_x86 18 | - windows_msvc2017_uwp_arm 19 | - windows_msvc2017_desktop_x64 20 | - windows_msvc2017_desktop_x86 21 | 22 | init: 23 | - set Path=C:\msys64\usr\bin;%Path% 24 | 25 | build_script: 26 | - cd %makefile_location% 27 | - make -f %makefile_name% platform=%platform% 28 | 29 | artifacts: 30 | - path: '**\%target_name%*.dll' 31 | - path: '**\%target_name%*.lib' 32 | - path: '**\%target_name%*.pdb' 33 | - path: '**\libretro.h' -------------------------------------------------------------------------------- /beetle_psx_globals.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "beetle_psx_globals.h" 4 | 5 | bool content_is_pal = false; 6 | uint8_t widescreen_hack; 7 | uint8_t widescreen_hack_aspect_ratio_setting; 8 | uint8_t psx_gpu_upscale_shift; 9 | uint8_t psx_gpu_upscale_shift_hw; 10 | int line_render_mode; 11 | int filter_mode; 12 | bool opaque_check; 13 | bool semitrans_check; 14 | int crop_overscan = 0; 15 | 16 | int core_timing_fps_mode = FORCE_PROGRESSIVE_TIMING; 17 | bool currently_interlaced = false; 18 | bool interlace_setting_dirty = false; 19 | 20 | int aspect_ratio_setting = 0; 21 | bool aspect_ratio_dirty = false; 22 | bool is_monkey_hero = false; 23 | -------------------------------------------------------------------------------- /beetle_psx_globals.h: -------------------------------------------------------------------------------- 1 | #ifndef BEETLE_PSX_GLOBALS_H__ 2 | #define BEETLE_PSX_GLOBALS_H__ 3 | 4 | #include 5 | #include 6 | 7 | /* Global state variables used by the Beetle PSX Core. 8 | * These are typically set by core options and are used 9 | * by methods in the Mednafen PSX module that have been 10 | * modified for Beetle PSX. 11 | */ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | extern bool content_is_pal; 18 | extern uint8_t widescreen_hack; 19 | extern uint8_t widescreen_hack_aspect_ratio_setting; 20 | extern uint8_t psx_gpu_upscale_shift; 21 | extern uint8_t psx_gpu_upscale_shift_hw; 22 | extern int line_render_mode; 23 | extern int filter_mode; 24 | extern bool opaque_check; 25 | extern bool semitrans_check; 26 | extern int crop_overscan; 27 | 28 | enum core_timing_fps_modes 29 | { 30 | FORCE_PROGRESSIVE_TIMING = 0, 31 | FORCE_INTERLACED_TIMING, 32 | AUTO_TOGGLE_TIMING 33 | }; 34 | 35 | extern int core_timing_fps_mode; 36 | extern bool currently_interlaced; 37 | extern bool interlace_setting_dirty; 38 | 39 | extern int aspect_ratio_setting; 40 | extern bool aspect_ratio_dirty; 41 | extern bool is_monkey_hero; 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /beetle_psx_griffin.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mednafen/psx/irq.cpp" 3 | #include "mednafen/psx/timer.cpp" 4 | #include "mednafen/psx/frontio.cpp" 5 | #include "mednafen/psx/cpu.cpp" 6 | #include "mednafen/psx/gte.cpp" 7 | #include "mednafen/psx/dis.cpp" 8 | #include "mednafen/psx/cdc.cpp" 9 | #include "mednafen/psx/spu.cpp" 10 | #include "mednafen/psx/gpu.cpp" 11 | #include "mednafen/psx/mdec.cpp" 12 | #include "mednafen/psx/input/gamepad.cpp" 13 | #include "mednafen/psx/input/dualanalog.cpp" 14 | #include "mednafen/psx/input/dualshock.cpp" 15 | #include "mednafen/psx/input/justifier.cpp" 16 | #include "mednafen/psx/input/guncon.cpp" 17 | #include "mednafen/psx/input/negcon.cpp" 18 | #include "mednafen/psx/input/negconrumble.cpp" 19 | #include "mednafen/psx/input/memcard.cpp" 20 | #include "mednafen/psx/input/multitap.cpp" 21 | #include "mednafen/psx/input/mouse.cpp" 22 | 23 | #include "mednafen/error.cpp" 24 | #include "mednafen/settings.cpp" 25 | #include "mednafen/general.cpp" 26 | #include "mednafen/FileStream.cpp" 27 | #include "mednafen/MemoryStream.cpp" 28 | #include "mednafen/Stream.cpp" 29 | #include "mednafen/state.cpp" 30 | 31 | #ifdef NEED_CD 32 | #include "mednafen/cdrom/CDAccess.cpp" 33 | #include "mednafen/cdrom/CDAccess_Image.cpp" 34 | #include "mednafen/cdrom/CDAccess_CCD.cpp" 35 | #include "mednafen/cdrom/CDAccess_PBP.cpp" 36 | #include "mednafen/cdrom/SimpleFIFO.cpp" 37 | #include "mednafen/cdrom/audioreader.cpp" 38 | #include "mednafen/cdrom/cdromif.cpp" 39 | #include "mednafen/cdrom/misc.cpp" 40 | #endif 41 | 42 | #include "mednafen/mempatcher.cpp" 43 | #include "mednafen/video/Deinterlacer.cpp" 44 | #include "mednafen/video/surface.cpp" 45 | 46 | #include "libretro.cpp" 47 | #include "rsx/rsx_intf.cpp" 48 | -------------------------------------------------------------------------------- /beetle_psx_griffin_c.c: -------------------------------------------------------------------------------- 1 | #include "mednafen/tremor/codebook.c" 2 | #include "mednafen/tremor/floor0.c" 3 | #include "mednafen/tremor/floor1.c" 4 | #include "mednafen/tremor/mdct.c" 5 | #include "mednafen/tremor/registry.c" 6 | #include "mednafen/tremor/mapping0.c" 7 | #include "mednafen/tremor/info.c" 8 | #include "mednafen/tremor/res012.c" 9 | #include "mednafen/tremor/framing.c" 10 | #include "mednafen/tremor/block.c" 11 | #include "mednafen/tremor/sharedbook.c" 12 | #include "mednafen/tremor/synthesis.c" 13 | #include "mednafen/tremor/vorbisfile.c" 14 | #include "mednafen/tremor/bitwise.c" 15 | #include "mednafen/tremor/window.c" 16 | 17 | #include "mednafen/file.c" 18 | #include "mednafen/md5.c" 19 | #include "mednafen/mednafen-endian.c" 20 | 21 | #include "libretro_cbs.c" 22 | #include "libretro-common/streams/file_stream.c" 23 | #include "libretro-common/rthreads/rthreads.c" 24 | #include "libretro-common/string/stdstring.c" 25 | #include "scrc32.c" 26 | 27 | #include "rsx/rsx_lib_soft.c" 28 | 29 | #ifdef NEED_CD 30 | #include "mednafen/cdrom/CDUtility.c" 31 | #include "mednafen/cdrom/edc_crc32.c" 32 | #include "mednafen/cdrom/l-ec.c" 33 | #include "mednafen/cdrom/lec.c" 34 | #include "mednafen/cdrom/recover-raw.c" 35 | #include "mednafen/cdrom/galois.c" 36 | #endif 37 | 38 | #include "deps/libkirk/aes.c" 39 | #include "deps/libkirk/amctrl.c" 40 | #include "deps/libkirk/bn.c" 41 | #include "deps/libkirk/des.c" 42 | #include "deps/libkirk/ec.c" 43 | #include "deps/libkirk/kirk_engine.c" 44 | #include "deps/libkirk/sha1.c" 45 | -------------------------------------------------------------------------------- /deps/libchdr/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright Romain Tisserand 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /deps/libchdr/README.md: -------------------------------------------------------------------------------- 1 | # libchdr 2 | 3 | libchdr is a standalone library for reading MAME's CHDv1-v5 formats. 4 | 5 | The code is based off of MAME's old C codebase which read up to CHDv4 with OS-dependent features removed, and CHDv5 support backported from MAME's current C++ codebase. 6 | 7 | libchdr is licensed under the BSD 3-Clause (see [LICENSE.txt](LICENSE.txt)) and uses third party libraries that are each distributed under their own terms (see each library's license in [deps/](deps/)). 8 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/bitstream.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause 2 | * copyright-holders:Aaron Giles 3 | *************************************************************************** 4 | 5 | bitstream.h 6 | 7 | Helper classes for reading/writing at the bit level. 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __BITSTREAM_H__ 14 | #define __BITSTREAM_H__ 15 | 16 | #include 17 | 18 | /*************************************************************************** 19 | * TYPE DEFINITIONS 20 | *************************************************************************** 21 | */ 22 | 23 | /* helper class for reading from a bit buffer */ 24 | struct bitstream 25 | { 26 | uint32_t buffer; /* current bit accumulator */ 27 | int bits; /* number of bits in the accumulator */ 28 | const uint8_t * read; /* read pointer */ 29 | uint32_t doffset; /* byte offset within the data */ 30 | uint32_t dlength; /* length of the data */ 31 | }; 32 | 33 | struct bitstream* create_bitstream(const void *src, uint32_t srclength); 34 | int bitstream_overflow(struct bitstream* bitstream); 35 | uint32_t bitstream_read_offset(struct bitstream* bitstream); 36 | 37 | uint32_t bitstream_read(struct bitstream* bitstream, int numbits); 38 | uint32_t bitstream_peek(struct bitstream* bitstream, int numbits); 39 | void bitstream_remove(struct bitstream* bitstream, int numbits); 40 | uint32_t bitstream_flush(struct bitstream* bitstream); 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/chdconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef __CHDCONFIG_H__ 2 | #define __CHDCONFIG_H__ 3 | 4 | /* Configure CHDR features here */ 5 | #define WANT_RAW_DATA_SECTOR 1 6 | #define WANT_SUBCODE 1 7 | #define NEED_CACHE_HUNK 1 8 | #define VERIFY_BLOCK_CRC 1 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /deps/libchdr/include/libchdr/coretypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __CORETYPES_H__ 2 | #define __CORETYPES_H__ 3 | 4 | #include 5 | #include 6 | 7 | #ifdef USE_LIBRETRO_VFS 8 | #include 9 | #endif 10 | 11 | #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) 12 | 13 | typedef uint64_t UINT64; 14 | typedef uint32_t UINT32; 15 | typedef uint16_t UINT16; 16 | typedef uint8_t UINT8; 17 | 18 | typedef int64_t INT64; 19 | typedef int32_t INT32; 20 | typedef int16_t INT16; 21 | typedef int8_t INT8; 22 | 23 | #ifdef USE_LIBRETRO_VFS 24 | #define core_file RFILE 25 | #define core_fopen(file) rfopen(file, "rb") 26 | #define core_fseek rfseek 27 | #define core_ftell rftell 28 | #define core_fread(fc, buff, len) fread(buff, 1, len, fc) 29 | #define core_fclose rfclose 30 | #else /* USE_LIBRETRO_VFS */ 31 | #define core_file FILE 32 | #define core_fopen(file) fopen(file, "rb") 33 | #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WIN64__) 34 | #define core_fseek _fseeki64 35 | #define core_ftell _ftelli64 36 | #elif defined(_LARGEFILE_SOURCE) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 37 | #define core_fseek fseeko64 38 | #define core_ftell ftello64 39 | #else 40 | #define core_fseek fseeko 41 | #define core_ftell ftello 42 | #endif 43 | #define core_fread(fc, buff, len) fread(buff, 1, len, fc) 44 | #define core_fclose fclose 45 | #endif /* USE_LIBRETRO_VFS */ 46 | 47 | static UINT64 core_fsize(core_file* f) 48 | { 49 | UINT64 rv; 50 | UINT64 p = core_ftell(f); 51 | core_fseek(f, 0, SEEK_END); 52 | rv = core_ftell(f); 53 | core_fseek(f, p, SEEK_SET); 54 | return rv; 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /deps/libchdr/src/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: chd_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /deps/libkirk/aes.h: -------------------------------------------------------------------------------- 1 | #ifndef __RIJNDAEL_H 2 | #define __RIJNDAEL_H 3 | 4 | #include "kirk_engine.h" 5 | 6 | #define AES_KEY_LEN_128 (128) 7 | #define AES_KEY_LEN_192 (192) 8 | #define AES_KEY_LEN_256 (256) 9 | 10 | #define AES_BUFFER_SIZE (16) 11 | 12 | #define AES_MAXKEYBITS (256) 13 | #define AES_MAXKEYBYTES (AES_MAXKEYBITS/8) 14 | /* for 256-bit keys, fewer for less */ 15 | #define AES_MAXROUNDS 14 16 | #define pwuAESContextBuffer rijndael_ctx 17 | 18 | /* The structure for key information */ 19 | typedef struct 20 | { 21 | int enc_only; /* context contains only encrypt schedule */ 22 | int Nr; /* key-length-dependent number of rounds */ 23 | u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */ 24 | u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */ 25 | } rijndael_ctx; 26 | 27 | typedef struct 28 | { 29 | int enc_only; /* context contains only encrypt schedule */ 30 | int Nr; /* key-length-dependent number of rounds */ 31 | u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */ 32 | u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */ 33 | } AES_ctx; 34 | 35 | int rijndael_set_key(rijndael_ctx *, const u8 *, int); 36 | int rijndael_set_key_enc_only(rijndael_ctx *, const u8 *, int); 37 | void rijndael_decrypt(rijndael_ctx *, const u8 *, u8 *); 38 | void rijndael_encrypt(rijndael_ctx *, const u8 *, u8 *); 39 | 40 | int AES_set_key(AES_ctx *ctx, const u8 *key, int bits); 41 | void AES_encrypt(AES_ctx *ctx, const u8 *src, u8 *dst); 42 | void AES_decrypt(AES_ctx *ctx, const u8 *src, u8 *dst); 43 | void AES_cbc_encrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size); 44 | void AES_cbc_decrypt(AES_ctx *ctx, u8 *src, u8 *dst, int size); 45 | void AES_CMAC(AES_ctx *ctx, unsigned char *input, int length, unsigned char *mac); 46 | 47 | int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int); 48 | int rijndaelKeySetupDec(unsigned int [], const unsigned char [], int); 49 | void rijndaelEncrypt(const unsigned int [], int, const unsigned char [], unsigned char []); 50 | 51 | #endif /* __RIJNDAEL_H */ 52 | -------------------------------------------------------------------------------- /deps/libkirk/amctrl.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 tpu 2 | // Copyright (C) 2015 Hykem 3 | // Licensed under the terms of the GNU GPL, version 3 4 | // http://www.gnu.org/licenses/gpl-3.0.txt 5 | 6 | #ifndef AMCTRL_H 7 | #define AMCTRL_H 8 | 9 | typedef struct 10 | { 11 | int type; 12 | u8 key[16]; 13 | u8 pad[16]; 14 | int pad_size; 15 | } MAC_KEY; 16 | 17 | typedef struct 18 | { 19 | u32 type; 20 | u32 seed; 21 | u8 key[16]; 22 | } CIPHER_KEY; 23 | 24 | int sceDrmBBMacInit(MAC_KEY *mkey, int type); 25 | int sceDrmBBMacUpdate(MAC_KEY *mkey, u8 *buf, int size); 26 | int sceDrmBBMacFinal(MAC_KEY *mkey, u8 *buf, u8 *vkey); 27 | int sceDrmBBMacFinal2(MAC_KEY *mkey, u8 *out, u8 *vkey); 28 | 29 | int bbmac_build_final2(int type, u8 *mac); 30 | int bbmac_getkey(MAC_KEY *mkey, u8 *bbmac, u8 *vkey); 31 | int bbmac_forge(MAC_KEY *mkey, u8 *bbmac, u8 *vkey, u8 *buf); 32 | 33 | int sceDrmBBCipherInit(CIPHER_KEY *ckey, int type, int mode, u8 *header_key, u8 *version_key, u32 seed); 34 | int sceDrmBBCipherUpdate(CIPHER_KEY *ckey, u8 *data, int size); 35 | int sceDrmBBCipherFinal(CIPHER_KEY *ckey); 36 | 37 | int sceNpDrmGetFixedKey(u8 *key, char *npstr, int type); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /deps/libkirk/kirk_engine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-psx-libretro/67c0bb961e7679aa8f1882ee6411ce34cef084db/deps/libkirk/kirk_engine.h -------------------------------------------------------------------------------- /deps/libkirk/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef _GLOBAL_H_ 2 | #define _GLOBAL_H_ 1 3 | 4 | /* POINTER defines a generic pointer type */ 5 | typedef unsigned char *POINTER; 6 | 7 | /* UINT4 defines a four byte word */ 8 | typedef unsigned int UINT4; 9 | 10 | /* BYTE defines a unsigned character */ 11 | typedef unsigned char BYTE; 12 | 13 | #ifndef TRUE 14 | #define FALSE 0 15 | #define TRUE ( !FALSE ) 16 | #endif /* TRUE */ 17 | 18 | #endif /* end _GLOBAL_H_ */ 19 | 20 | /* sha.h */ 21 | 22 | #ifndef _SHA_H_ 23 | #define _SHA_H_ 1 24 | 25 | /* #include "global.h" */ 26 | 27 | /* The structure for storing SHS info */ 28 | 29 | typedef struct 30 | { 31 | UINT4 digest[ 5 ]; /* Message digest */ 32 | UINT4 countLo, countHi; /* 64-bit bit count */ 33 | UINT4 data[ 16 ]; /* SHS data buffer */ 34 | int Endianness; 35 | } SHA_CTX; 36 | 37 | /* Message digest functions */ 38 | 39 | void SHAInit(SHA_CTX *); 40 | void SHAUpdate(SHA_CTX *, BYTE *buffer, int count); 41 | void SHAFinal(BYTE *output, SHA_CTX *); 42 | 43 | #endif /* end _SHA_H_ */ 44 | 45 | /* endian.h */ 46 | 47 | #ifndef _ENDIAN_H_ 48 | #define _ENDIAN_H_ 1 49 | 50 | void endianTest(int *endianness); 51 | 52 | #endif /* end _ENDIAN_H_ */ 53 | -------------------------------------------------------------------------------- /deps/lightning/.gitattributes: -------------------------------------------------------------------------------- 1 | ChangeLog merge=merge-changelog 2 | -------------------------------------------------------------------------------- /deps/lightning/.gitignore: -------------------------------------------------------------------------------- 1 | +* 2 | autom4te.cache 3 | aclocal.m4 4 | depcomp 5 | INSTALL 6 | Makefile 7 | Makefile.in 8 | config.guess 9 | config.h 10 | config.h.in 11 | config.log 12 | config.status 13 | config.sub 14 | configure 15 | install-sh 16 | libtool 17 | lightning-*.tar.* 18 | ltmain.sh 19 | missing 20 | size 21 | stamp-h1 22 | test-driver 23 | check/.deps 24 | doc/.deps 25 | lib/.deps 26 | m4/libtool.m4 27 | m4/lt~obsolete.m4 28 | m4/ltoptions.m4 29 | m4/ltsugar.m4 30 | m4/ltversion.m4 31 | doc/mdate-sh 32 | doc/texinfo.tex 33 | lightning.pc 34 | -------------------------------------------------------------------------------- /deps/lightning/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "gnulib"] 2 | path = gnulib 3 | url = git://git.sv.gnu.org/gnulib.git 4 | -------------------------------------------------------------------------------- /deps/lightning/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://git.savannah.gnu.org/git/lightning.git 8 | branch = master 9 | commit = 876c1043bec5bfd594482b40700c84693e40d0eb 10 | parent = 9f797430963d9cf0fcef7d963466f9cac7026de2 11 | method = merge 12 | cmdver = 0.4.3 13 | -------------------------------------------------------------------------------- /deps/lightning/AUTHORS: -------------------------------------------------------------------------------- 1 | Paulo Cesar Pereira de Andrade 2 | 3 | Paolo Bonzini 4 | 5 | PPC assembler by Ian Piumarta 6 | 7 | i386 assembler by Ian Piumarta 8 | and Gwenole Beauchesne 9 | 10 | x86-64 backend by Matthew Flatt 11 | 12 | Major PPC contributions by Laurent Michel 13 | 14 | Major SPARC contributions by Ludovic Courtes 15 | -------------------------------------------------------------------------------- /deps/lightning/README: -------------------------------------------------------------------------------- 1 | GNU lightning is a library to aid in making portable programs 2 | that compile assembly code at run time. For more information, 3 | look at the info documentation. 4 | -------------------------------------------------------------------------------- /deps/lightning/THANKS: -------------------------------------------------------------------------------- 1 | Thanks to all the following people for their help in 2 | improving GNU lightning: 3 | 4 | Paolo Bonzini 5 | Eli Barzilay 6 | Ludovic Courtes 7 | Matthew Flatt 8 | Laurent Michel 9 | Paulo Cesar Pereira de Andrade 10 | Mike Spivey 11 | Basile Starynkevitch 12 | Sam Steingold 13 | Jens Troeger 14 | Tom Tromey 15 | Trent Nelson 16 | Vitaly Magerya 17 | Brandon Invergo 18 | Holger Hans Peter Freyther 19 | Jon Arintok 20 | Bruno Haible 21 | Marc Nieper-Wißkirchen 22 | -------------------------------------------------------------------------------- /deps/lightning/TODO: -------------------------------------------------------------------------------- 1 | * Validate that divrem in jit_x86-cpu.c is not modifying 2 | the non result arguments. This is not verified by clobber.tst, 3 | as it only checks registers not involved in the operation 4 | (because it does not know about values being set as input 5 | for the the operation). 6 | 7 | * Write a simple higher level language implementation generating 8 | jit with lightning, that could be some lisp or C like language. 9 | 10 | * rerun ./configure --enable-devel-get-jit-size and regenerate 11 | the related jit_$arch-sz.c for the ports where nodata is 12 | meaningful: 13 | hppa (done) 14 | i586 (done) 15 | ia64 16 | mips o32 (done) 17 | mips n32 18 | mips n64 19 | powerpc 32 (done) 20 | powerpc 64 (done) 21 | ppc 22 | s390x (done) 23 | sparc (done) 24 | x86_64 (done) 25 | Missing ones are due to no longer (remote) access to such hosts 26 | and may be broken with jit_set_data(..., JIT_DISABLE_DATA). 27 | (ia64 hp-ux or linx), (irix mips for 32 or 64 abi), and 28 | (darwin ppc). 29 | -------------------------------------------------------------------------------- /deps/lightrec/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so* 3 | -------------------------------------------------------------------------------- /deps/lightrec/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/pcercuei/lightrec.git 8 | branch = master 9 | commit = 0df4ec86ba664dad3b4cc24fd3199131e8e3219f 10 | parent = 364a705dc70b57a734b4e362226a386b34a008fb 11 | method = merge 12 | cmdver = 0.4.3 13 | -------------------------------------------------------------------------------- /deps/lightrec/blockcache.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2014-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __BLOCKCACHE_H__ 7 | #define __BLOCKCACHE_H__ 8 | 9 | #include "lightrec.h" 10 | 11 | struct blockcache; 12 | 13 | struct block * lightrec_find_block(struct blockcache *cache, u32 pc); 14 | struct block * lightrec_find_block_from_lut(struct blockcache *cache, 15 | u16 lut_entry, u32 addr_in_block); 16 | u16 lightrec_get_lut_entry(const struct block *block); 17 | 18 | void lightrec_register_block(struct blockcache *cache, struct block *block); 19 | void lightrec_unregister_block(struct blockcache *cache, struct block *block); 20 | 21 | struct blockcache * lightrec_blockcache_init(struct lightrec_state *state); 22 | void lightrec_free_block_cache(struct blockcache *cache); 23 | 24 | u32 lightrec_calculate_block_hash(const struct block *block); 25 | _Bool lightrec_block_is_outdated(struct lightrec_state *state, struct block *block); 26 | 27 | #endif /* __BLOCKCACHE_H__ */ 28 | -------------------------------------------------------------------------------- /deps/lightrec/config.h.cmakein: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2019-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __LIGHTREC_CONFIG_H__ 7 | #define __LIGHTREC_CONFIG_H__ 8 | 9 | #cmakedefine01 ENABLE_THREADED_COMPILER 10 | #cmakedefine01 ENABLE_FIRST_PASS 11 | #cmakedefine01 ENABLE_DISASSEMBLER 12 | #cmakedefine01 ENABLE_TINYMM 13 | 14 | #cmakedefine01 HAS_DEFAULT_ELM 15 | 16 | #cmakedefine01 OPT_REMOVE_DIV_BY_ZERO_SEQ 17 | #cmakedefine01 OPT_REPLACE_MEMSET 18 | #cmakedefine01 OPT_DETECT_IMPOSSIBLE_BRANCHES 19 | #cmakedefine01 OPT_TRANSFORM_OPS 20 | #cmakedefine01 OPT_LOCAL_BRANCHES 21 | #cmakedefine01 OPT_SWITCH_DELAY_SLOTS 22 | #cmakedefine01 OPT_FLAG_STORES 23 | #cmakedefine01 OPT_FLAG_MULT_DIV 24 | #cmakedefine01 OPT_EARLY_UNLOAD 25 | 26 | #endif /* __LIGHTREC_CONFIG_H__ */ 27 | 28 | -------------------------------------------------------------------------------- /deps/lightrec/emitter.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2014-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __EMITTER_H__ 7 | #define __EMITTER_H__ 8 | 9 | #include "lightrec.h" 10 | 11 | struct block; 12 | struct opcode; 13 | 14 | void lightrec_rec_opcode(struct lightrec_state *state, const struct block *block, 15 | u16 offset); 16 | void lightrec_emit_eob(struct lightrec_state *state, const struct block *block, 17 | u16 offset); 18 | 19 | #endif /* __EMITTER_H__ */ 20 | -------------------------------------------------------------------------------- /deps/lightrec/interpreter.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2019-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __LIGHTREC_INTERPRETER_H__ 7 | #define __LIGHTREC_INTERPRETER_H__ 8 | 9 | #include "lightrec.h" 10 | 11 | struct block; 12 | 13 | u32 lightrec_emulate_block(struct lightrec_state *state, struct block *block, u32 pc); 14 | 15 | #endif /* __LIGHTREC_INTERPRETER_H__ */ 16 | -------------------------------------------------------------------------------- /deps/lightrec/memmanager.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2019-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __MEMMANAGER_H__ 7 | #define __MEMMANAGER_H__ 8 | 9 | #include "lightrec.h" 10 | 11 | enum mem_type { 12 | MEM_FOR_CODE, 13 | MEM_FOR_MIPS_CODE, 14 | MEM_FOR_IR, 15 | MEM_FOR_LIGHTREC, 16 | MEM_TYPE_END, 17 | }; 18 | 19 | void * lightrec_malloc(struct lightrec_state *state, 20 | enum mem_type type, unsigned int len); 21 | void * lightrec_calloc(struct lightrec_state *state, 22 | enum mem_type type, unsigned int len); 23 | void lightrec_free(struct lightrec_state *state, 24 | enum mem_type type, unsigned int len, void *ptr); 25 | 26 | void lightrec_register(enum mem_type type, unsigned int len); 27 | void lightrec_unregister(enum mem_type type, unsigned int len); 28 | 29 | unsigned int lightrec_get_mem_usage(enum mem_type type); 30 | unsigned int lightrec_get_total_mem_usage(void); 31 | float lightrec_get_average_ipi(void); 32 | 33 | #endif /* __MEMMANAGER_H__ */ 34 | -------------------------------------------------------------------------------- /deps/lightrec/optimizer.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2014-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __OPTIMIZER_H__ 7 | #define __OPTIMIZER_H__ 8 | 9 | #include "disassembler.h" 10 | 11 | struct block; 12 | struct opcode; 13 | 14 | _Bool opcode_reads_register(union code op, u8 reg); 15 | _Bool opcode_writes_register(union code op, u8 reg); 16 | _Bool has_delay_slot(union code op); 17 | _Bool load_in_delay_slot(union code op); 18 | _Bool opcode_is_io(union code op); 19 | _Bool is_unconditional_jump(union code c); 20 | _Bool is_syscall(union code c); 21 | 22 | _Bool should_emulate(const struct opcode *op); 23 | 24 | int lightrec_optimize(struct lightrec_state *state, struct block *block); 25 | 26 | #endif /* __OPTIMIZER_H__ */ 27 | -------------------------------------------------------------------------------- /deps/lightrec/reaper.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2020-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __LIGHTREC_REAPER_H__ 7 | #define __LIGHTREC_REAPER_H__ 8 | 9 | struct lightrec_state; 10 | struct reaper; 11 | 12 | typedef void (*reap_func_t)(struct lightrec_state *state, void *); 13 | 14 | struct reaper *lightrec_reaper_init(struct lightrec_state *state); 15 | void lightrec_reaper_destroy(struct reaper *reaper); 16 | 17 | int lightrec_reaper_add(struct reaper *reaper, reap_func_t f, void *data); 18 | void lightrec_reaper_reap(struct reaper *reaper); 19 | 20 | #endif /* __LIGHTREC_REAPER_H__ */ 21 | -------------------------------------------------------------------------------- /deps/lightrec/recompiler.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2019-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __LIGHTREC_RECOMPILER_H__ 7 | #define __LIGHTREC_RECOMPILER_H__ 8 | 9 | struct block; 10 | struct lightrec_state; 11 | struct recompiler; 12 | 13 | struct recompiler *lightrec_recompiler_init(struct lightrec_state *state); 14 | void lightrec_free_recompiler(struct recompiler *rec); 15 | int lightrec_recompiler_add(struct recompiler *rec, struct block *block); 16 | void lightrec_recompiler_remove(struct recompiler *rec, struct block *block); 17 | 18 | void * lightrec_recompiler_run_first_pass(struct lightrec_state *state, 19 | struct block *block, u32 *pc); 20 | 21 | #endif /* __LIGHTREC_RECOMPILER_H__ */ 22 | -------------------------------------------------------------------------------- /deps/lightrec/slist.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2020-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __LIGHTREC_SLIST_H__ 7 | #define __LIGHTREC_SLIST_H__ 8 | 9 | #define container_of(ptr, type, member) \ 10 | ((type *)((void *)(ptr) - offsetof(type, member))) 11 | 12 | struct slist_elm { 13 | struct slist_elm *next; 14 | }; 15 | 16 | static inline void slist_init(struct slist_elm *head) 17 | { 18 | head->next = NULL; 19 | } 20 | 21 | static inline struct slist_elm * slist_first(struct slist_elm *head) 22 | { 23 | return head->next; 24 | } 25 | 26 | static inline _Bool slist_empty(const struct slist_elm *head) 27 | { 28 | return head->next == NULL; 29 | } 30 | 31 | static inline void slist_remove_next(struct slist_elm *elm) 32 | { 33 | if (elm->next) 34 | elm->next = elm->next->next; 35 | } 36 | 37 | static inline void slist_remove(struct slist_elm *head, struct slist_elm *elm) 38 | { 39 | struct slist_elm *prev; 40 | 41 | if (head->next == elm) { 42 | head->next = elm->next; 43 | } else { 44 | for (prev = head->next; prev && prev->next != elm; ) 45 | prev = prev->next; 46 | if (prev) 47 | slist_remove_next(prev); 48 | } 49 | } 50 | 51 | static inline void slist_append(struct slist_elm *head, struct slist_elm *elm) 52 | { 53 | elm->next = head->next; 54 | head->next = elm; 55 | } 56 | 57 | #endif /* __LIGHTREC_SLIST_H__ */ 58 | -------------------------------------------------------------------------------- /deps/lzma-19.00/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lzma STATIC 2 | include/7zTypes.h 3 | include/Alloc.h 4 | include/Bra.h 5 | include/Compiler.h 6 | include/CpuArch.h 7 | include/Delta.h 8 | include/LzFind.h 9 | include/LzHash.h 10 | include/Lzma86.h 11 | include/LzmaDec.h 12 | include/LzmaEnc.h 13 | include/LzmaLib.h 14 | include/Precomp.h 15 | include/Sort.h 16 | src/Alloc.c 17 | src/Bra86.c 18 | src/BraIA64.c 19 | src/CpuArch.c 20 | src/Delta.c 21 | src/LzFind.c 22 | src/Lzma86Dec.c 23 | src/LzmaDec.c 24 | src/LzmaEnc.c 25 | src/Sort.c 26 | ) 27 | 28 | target_compile_definitions(lzma PRIVATE _7ZIP_ST) 29 | 30 | target_include_directories(lzma PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include") 31 | target_include_directories(lzma INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") 32 | 33 | -------------------------------------------------------------------------------- /deps/lzma-19.00/LICENSE: -------------------------------------------------------------------------------- 1 | LZMA SDK is placed in the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original LZMA SDK code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2018-02-19 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void *MyAlloc(size_t size); 12 | void MyFree(void *address); 13 | 14 | #ifdef _WIN32 15 | 16 | void SetLargePageSize(); 17 | 18 | void *MidAlloc(size_t size); 19 | void MidFree(void *address); 20 | void *BigAlloc(size_t size); 21 | void BigFree(void *address); 22 | 23 | #else 24 | 25 | #define MidAlloc(size) MyAlloc(size) 26 | #define MidFree(address) MyFree(address) 27 | #define BigAlloc(size) MyAlloc(size) 28 | #define BigFree(address) MyFree(address) 29 | 30 | #endif 31 | 32 | extern const ISzAlloc g_Alloc; 33 | extern const ISzAlloc g_BigAlloc; 34 | extern const ISzAlloc g_MidAlloc; 35 | extern const ISzAlloc g_AlignedAlloc; 36 | 37 | 38 | typedef struct 39 | { 40 | ISzAlloc vt; 41 | ISzAllocPtr baseAlloc; 42 | unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */ 43 | size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */ 44 | } CAlignOffsetAlloc; 45 | 46 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p); 47 | 48 | 49 | EXTERN_C_END 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Compiler.h: -------------------------------------------------------------------------------- 1 | /* Compiler.h 2 | 2017-04-03 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_COMPILER_H 5 | #define __7Z_COMPILER_H 6 | 7 | #ifdef _MSC_VER 8 | 9 | #ifdef UNDER_CE 10 | #define RPC_NO_WINDOWS_H 11 | /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */ 12 | #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 13 | #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int 14 | #endif 15 | 16 | #if _MSC_VER >= 1300 17 | #pragma warning(disable : 4996) // This function or variable may be unsafe 18 | #else 19 | #pragma warning(disable : 4511) // copy constructor could not be generated 20 | #pragma warning(disable : 4512) // assignment operator could not be generated 21 | #pragma warning(disable : 4514) // unreferenced inline function has been removed 22 | #pragma warning(disable : 4702) // unreachable code 23 | #pragma warning(disable : 4710) // not inlined 24 | #pragma warning(disable : 4714) // function marked as __forceinline not inlined 25 | #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information 26 | #endif 27 | 28 | #endif 29 | 30 | #define UNUSED_VAR(x) (void)x; 31 | /* #define UNUSED_VAR(x) x=x; */ 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Delta.h: -------------------------------------------------------------------------------- 1 | /* Delta.h -- Delta converter 2 | 2013-01-18 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __DELTA_H 5 | #define __DELTA_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | #define DELTA_STATE_SIZE 256 12 | 13 | void Delta_Init(Byte *state); 14 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); 15 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); 16 | 17 | EXTERN_C_END 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2015-04-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZ_HASH_H 5 | #define __LZ_HASH_H 6 | 7 | #define kHash2Size (1 << 10) 8 | #define kHash3Size (1 << 16) 9 | #define kHash4Size (1 << 20) 10 | 11 | #define kFix3HashSize (kHash2Size) 12 | #define kFix4HashSize (kHash2Size + kHash3Size) 13 | #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 14 | 15 | #define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8); 16 | 17 | #define HASH3_CALC { \ 18 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 19 | h2 = temp & (kHash2Size - 1); \ 20 | hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } 21 | 22 | #define HASH4_CALC { \ 23 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 24 | h2 = temp & (kHash2Size - 1); \ 25 | temp ^= ((UInt32)cur[2] << 8); \ 26 | h3 = temp & (kHash3Size - 1); \ 27 | hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; } 28 | 29 | #define HASH5_CALC { \ 30 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 31 | h2 = temp & (kHash2Size - 1); \ 32 | temp ^= ((UInt32)cur[2] << 8); \ 33 | h3 = temp & (kHash3Size - 1); \ 34 | temp ^= (p->crc[cur[3]] << 5); \ 35 | h4 = temp & (kHash4Size - 1); \ 36 | hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; } 37 | 38 | /* #define HASH_ZIP_CALC hv = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ 39 | #define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; 40 | 41 | 42 | #define MT_HASH2_CALC \ 43 | h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); 44 | 45 | #define MT_HASH3_CALC { \ 46 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 47 | h2 = temp & (kHash2Size - 1); \ 48 | h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } 49 | 50 | #define MT_HASH4_CALC { \ 51 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 52 | h2 = temp & (kHash2Size - 1); \ 53 | temp ^= ((UInt32)cur[2] << 8); \ 54 | h3 = temp & (kHash3Size - 1); \ 55 | h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Precomp.h: -------------------------------------------------------------------------------- 1 | /* Precomp.h -- StdAfx 2 | 2013-11-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_PRECOMP_H 5 | #define __7Z_PRECOMP_H 6 | 7 | #include "Compiler.h" 8 | /* #include "7zTypes.h" */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /deps/lzma-19.00/include/Sort.h: -------------------------------------------------------------------------------- 1 | /* Sort.h -- Sort functions 2 | 2014-04-05 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_SORT_H 5 | #define __7Z_SORT_H 6 | 7 | #include "7zTypes.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | void HeapSort(UInt32 *p, size_t size); 12 | void HeapSort64(UInt64 *p, size_t size); 13 | 14 | /* void HeapSortRef(UInt32 *p, UInt32 *vals, size_t size); */ 15 | 16 | EXTERN_C_END 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma-history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-psx-libretro/67c0bb961e7679aa8f1882ee6411ce34cef084db/deps/lzma-19.00/lzma-history.txt -------------------------------------------------------------------------------- /deps/lzma-19.00/lzma.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Bra86.c: -------------------------------------------------------------------------------- 1 | /* Bra86.c -- Converter for x86 code (BCJ) 2 | 2017-04-03 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Bra.h" 7 | 8 | #define Test86MSByte(b) ((((b) + 1) & 0xFE) == 0) 9 | 10 | SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding) 11 | { 12 | SizeT pos = 0; 13 | UInt32 mask = *state & 7; 14 | if (size < 5) 15 | return 0; 16 | size -= 4; 17 | ip += 5; 18 | 19 | for (;;) 20 | { 21 | Byte *p = data + pos; 22 | const Byte *limit = data + size; 23 | for (; p < limit; p++) 24 | if ((*p & 0xFE) == 0xE8) 25 | break; 26 | 27 | { 28 | SizeT d = (SizeT)(p - data - pos); 29 | pos = (SizeT)(p - data); 30 | if (p >= limit) 31 | { 32 | *state = (d > 2 ? 0 : mask >> (unsigned)d); 33 | return pos; 34 | } 35 | if (d > 2) 36 | mask = 0; 37 | else 38 | { 39 | mask >>= (unsigned)d; 40 | if (mask != 0 && (mask > 4 || mask == 3 || Test86MSByte(p[(size_t)(mask >> 1) + 1]))) 41 | { 42 | mask = (mask >> 1) | 4; 43 | pos++; 44 | continue; 45 | } 46 | } 47 | } 48 | 49 | if (Test86MSByte(p[4])) 50 | { 51 | UInt32 v = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]); 52 | UInt32 cur = ip + (UInt32)pos; 53 | pos += 5; 54 | if (encoding) 55 | v += cur; 56 | else 57 | v -= cur; 58 | if (mask != 0) 59 | { 60 | unsigned sh = (mask & 6) << 2; 61 | if (Test86MSByte((Byte)(v >> sh))) 62 | { 63 | v ^= (((UInt32)0x100 << sh) - 1); 64 | if (encoding) 65 | v += cur; 66 | else 67 | v -= cur; 68 | } 69 | mask = 0; 70 | } 71 | p[1] = (Byte)v; 72 | p[2] = (Byte)(v >> 8); 73 | p[3] = (Byte)(v >> 16); 74 | p[4] = (Byte)(0 - ((v >> 24) & 1)); 75 | } 76 | else 77 | { 78 | mask = (mask >> 1) | 4; 79 | pos++; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/BraIA64.c: -------------------------------------------------------------------------------- 1 | /* BraIA64.c -- Converter for IA-64 code 2 | 2017-01-26 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "CpuArch.h" 7 | #include "Bra.h" 8 | 9 | SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) 10 | { 11 | SizeT i; 12 | if (size < 16) 13 | return 0; 14 | size -= 16; 15 | i = 0; 16 | do 17 | { 18 | unsigned m = ((UInt32)0x334B0000 >> (data[i] & 0x1E)) & 3; 19 | if (m) 20 | { 21 | m++; 22 | do 23 | { 24 | Byte *p = data + (i + (size_t)m * 5 - 8); 25 | if (((p[3] >> m) & 15) == 5 26 | && (((p[-1] | ((UInt32)p[0] << 8)) >> m) & 0x70) == 0) 27 | { 28 | unsigned raw = GetUi32(p); 29 | unsigned v = raw >> m; 30 | v = (v & 0xFFFFF) | ((v & (1 << 23)) >> 3); 31 | 32 | v <<= 4; 33 | if (encoding) 34 | v += ip + (UInt32)i; 35 | else 36 | v -= ip + (UInt32)i; 37 | v >>= 4; 38 | 39 | v &= 0x1FFFFF; 40 | v += 0x700000; 41 | v &= 0x8FFFFF; 42 | raw &= ~((UInt32)0x8FFFFF << m); 43 | raw |= (v << m); 44 | SetUi32(p, raw); 45 | } 46 | } 47 | while (++m <= 4); 48 | } 49 | i += 16; 50 | } 51 | while (i <= size); 52 | return i; 53 | } 54 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Delta.c: -------------------------------------------------------------------------------- 1 | /* Delta.c -- Delta converter 2 | 2009-05-26 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Delta.h" 7 | 8 | void Delta_Init(Byte *state) 9 | { 10 | unsigned i; 11 | for (i = 0; i < DELTA_STATE_SIZE; i++) 12 | state[i] = 0; 13 | } 14 | 15 | static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) 16 | { 17 | unsigned i; 18 | for (i = 0; i < size; i++) 19 | dest[i] = src[i]; 20 | } 21 | 22 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size) 23 | { 24 | Byte buf[DELTA_STATE_SIZE]; 25 | unsigned j = 0; 26 | MyMemCpy(buf, state, delta); 27 | { 28 | SizeT i; 29 | for (i = 0; i < size;) 30 | { 31 | for (j = 0; j < delta && i < size; i++, j++) 32 | { 33 | Byte b = data[i]; 34 | data[i] = (Byte)(b - buf[j]); 35 | buf[j] = b; 36 | } 37 | } 38 | } 39 | if (j == delta) 40 | j = 0; 41 | MyMemCpy(state, buf + j, delta - j); 42 | MyMemCpy(state + delta - j, buf, j); 43 | } 44 | 45 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) 46 | { 47 | Byte buf[DELTA_STATE_SIZE]; 48 | unsigned j = 0; 49 | MyMemCpy(buf, state, delta); 50 | { 51 | SizeT i; 52 | for (i = 0; i < size;) 53 | { 54 | for (j = 0; j < delta && i < size; i++, j++) 55 | { 56 | buf[j] = data[i] = (Byte)(buf[j] + data[i]); 57 | } 58 | } 59 | } 60 | if (j == delta) 61 | j = 0; 62 | MyMemCpy(state, buf + j, delta - j); 63 | MyMemCpy(state + delta - j, buf, j); 64 | } 65 | -------------------------------------------------------------------------------- /deps/lzma-19.00/src/Lzma86Dec.c: -------------------------------------------------------------------------------- 1 | /* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder 2 | 2016-05-16 : Igor Pavlov : Public domain */ 3 | 4 | #include "Precomp.h" 5 | 6 | #include "Lzma86.h" 7 | 8 | #include "Alloc.h" 9 | #include "Bra.h" 10 | #include "LzmaDec.h" 11 | 12 | SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) 13 | { 14 | unsigned i; 15 | if (srcLen < LZMA86_HEADER_SIZE) 16 | return SZ_ERROR_INPUT_EOF; 17 | *unpackSize = 0; 18 | for (i = 0; i < sizeof(UInt64); i++) 19 | *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i); 20 | return SZ_OK; 21 | } 22 | 23 | SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) 24 | { 25 | SRes res; 26 | int useFilter; 27 | SizeT inSizePure; 28 | ELzmaStatus status; 29 | 30 | if (*srcLen < LZMA86_HEADER_SIZE) 31 | return SZ_ERROR_INPUT_EOF; 32 | 33 | useFilter = src[0]; 34 | 35 | if (useFilter > 1) 36 | { 37 | *destLen = 0; 38 | return SZ_ERROR_UNSUPPORTED; 39 | } 40 | 41 | inSizePure = *srcLen - LZMA86_HEADER_SIZE; 42 | res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure, 43 | src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc); 44 | *srcLen = inSizePure + LZMA86_HEADER_SIZE; 45 | if (res != SZ_OK) 46 | return res; 47 | if (useFilter == 1) 48 | { 49 | UInt32 x86State; 50 | x86_Convert_Init(x86State); 51 | x86_Convert(dest, *destLen, 0, &x86State, 0); 52 | } 53 | return SZ_OK; 54 | } 55 | -------------------------------------------------------------------------------- /deps/mman/sys/.gitignore: -------------------------------------------------------------------------------- 1 | x64 2 | mman.VC.db -------------------------------------------------------------------------------- /deps/mman/sys/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/witwall/mman-win32.git 8 | branch = master 9 | commit = 2d1c576e62b99e85d99407e1a88794c6e44c3310 10 | parent = 9f797430963d9cf0fcef7d963466f9cac7026de2 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /deps/mman/sys/.vs/mman/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-psx-libretro/67c0bb961e7679aa8f1882ee6411ce34cef084db/deps/mman/sys/.vs/mman/v14/.suo -------------------------------------------------------------------------------- /deps/mman/sys/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project (mman-win32 C) 2 | 3 | cmake_minimum_required (VERSION 2.8) 4 | 5 | option (BUILD_SHARED_LIBS "shared/static libs" ON) 6 | option (BUILD_TESTS "tests?" OFF) 7 | 8 | set (headers mman.h) 9 | set (sources mman.c) 10 | 11 | add_library (mman ${sources}) 12 | 13 | if (BUILD_SHARED_LIBS) 14 | target_compile_definitions(mman 15 | PUBLIC MMAN_LIBRARY_DLL 16 | PRIVATE MMAN_LIBRARY 17 | ) 18 | endif() 19 | 20 | install (TARGETS mman RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib${LIB_SUFFIX} 22 | ARCHIVE DESTINATION lib${LIB_SUFFIX}) 23 | 24 | install (FILES ${headers} DESTINATION include/sys) 25 | 26 | if (BUILD_TESTS) 27 | enable_testing () 28 | add_executable (t_mman test.c) 29 | target_link_libraries (t_mman mman) 30 | add_test (NAME t_mman COMMAND t_mman${CMAKE_EXECUTABLE_SUFFIX}) 31 | endif () 32 | 33 | 34 | -------------------------------------------------------------------------------- /deps/mman/sys/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # mman-win32 (mingw32) Makefile 3 | # 4 | include config.mak 5 | 6 | CFLAGS=-Wall -O3 -fomit-frame-pointer 7 | 8 | ifeq ($(BUILD_STATIC),yes) 9 | TARGETS+=libmman.a 10 | INSTALL+=static-install 11 | endif 12 | 13 | ifeq ($(BUILD_SHARED),yes) 14 | TARGETS+=libmman.dll 15 | INSTALL+=shared-install 16 | CFLAGS+=-DMMAN_LIBRARY_DLL -DMMAN_LIBRARY 17 | endif 18 | 19 | ifeq ($(BUILD_MSVC),yes) 20 | SHFLAGS+=-Wl,--output-def,libmman.def 21 | INSTALL+=lib-install 22 | endif 23 | 24 | all: $(TARGETS) 25 | 26 | mman.o: mman.c mman.h 27 | $(CC) -o mman.o -c mman.c $(CFLAGS) 28 | 29 | libmman.a: mman.o 30 | $(AR) cru libmman.a mman.o 31 | $(RANLIB) libmman.a 32 | 33 | libmman.dll: mman.o 34 | $(CC) -shared -o libmman.dll mman.o -Wl,--out-implib,libmman.dll.a 35 | 36 | header-install: 37 | mkdir -p $(DESTDIR)$(incdir) 38 | cp mman.h $(DESTDIR)$(incdir) 39 | 40 | static-install: header-install 41 | mkdir -p $(DESTDIR)$(libdir) 42 | cp libmman.a $(DESTDIR)$(libdir) 43 | 44 | shared-install: header-install 45 | mkdir -p $(DESTDIR)$(libdir) 46 | cp libmman.dll.a $(DESTDIR)$(libdir) 47 | mkdir -p $(DESTDIR)$(bindir) 48 | cp libmman.dll $(DESTDIR)$(bindir) 49 | 50 | lib-install: 51 | mkdir -p $(DESTDIR)$(libdir) 52 | cp libmman.lib $(DESTDIR)$(libdir) 53 | 54 | install: $(INSTALL) 55 | 56 | test.exe: test.c mman.c mman.h 57 | $(CC) -o test.exe test.c -L. -lmman 58 | 59 | test: $(TARGETS) test.exe 60 | test.exe 61 | 62 | clean:: 63 | rm -f mman.o libmman.a libmman.dll.a libmman.dll libmman.def libmman.lib test.exe *.dat 64 | 65 | distclean: clean 66 | rm -f config.mak 67 | 68 | .PHONY: clean distclean install test 69 | -------------------------------------------------------------------------------- /deps/mman/sys/README.md: -------------------------------------------------------------------------------- 1 | mman-win32 2 | ========== 3 | 4 | mman library for Windows. mirror of https://code.google.com/p/mman-win32/ 5 | 6 | A light implementation of the mmap functions for MinGW. 7 | 8 | The mmap-win32 library implements a wrapper for mmap functions around the memory mapping Windows API. 9 | 10 | License: MIT License 11 | -------------------------------------------------------------------------------- /deps/mman/sys/UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-psx-libretro/67c0bb961e7679aa8f1882ee6411ce34cef084db/deps/mman/sys/UpgradeLog.htm -------------------------------------------------------------------------------- /deps/mman/sys/mman-win32.pro: -------------------------------------------------------------------------------- 1 | QT -= core gui 2 | 3 | TARGET = mman 4 | TEMPLATE = lib 5 | 6 | DEFINES += MMAN_LIBRARY_DLL 7 | DEFINES += MMAN_LIBRARY 8 | 9 | HEADERS += \ 10 | mman.h 11 | 12 | SOURCES += \ 13 | mman.c 14 | -------------------------------------------------------------------------------- /deps/mman/sys/mman.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mman", "mman.vcxproj", "{592F578E-6F24-47C0-9F6C-07BC9B730E27}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x64.ActiveCfg = Debug|x64 17 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x64.Build.0 = Debug|x64 18 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x86.ActiveCfg = Debug|Win32 19 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x86.Build.0 = Debug|Win32 20 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x64.ActiveCfg = Release|x64 21 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x64.Build.0 = Release|x64 22 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x86.ActiveCfg = Release|Win32 23 | {592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /deps/mman/sys/mman.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /deps/mman/sys/mman.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /deps/ugui/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | ## What is µGUI? 3 | µGUI is a free and open source graphic library for embedded systems. It is platform-independent 4 | and can be easily ported to almost any microcontroller system. As long as the display is capable 5 | of showing graphics, µGUI is not restricted to a certain display technology. Therefore, display 6 | technologies such as LCD, TFT, E-Paper, LED or OLED are supported. The whole module 7 | consists of three files: **ugui.c**, **ugui.h** and **ugui_config.h**. 8 | 9 | ## µGUI Features 10 | * µGUI supports any color, grayscale or monochrome display 11 | * µGUI supports any display resolution 12 | * µGUI supports multiple different displays 13 | * µGUI supports any touch screen technology (e.g. AR, PCAP) 14 | * µGUI supports windows and objects (e.g. button, textbox) 15 | * µGUI supports platform-specific hardware acceleration 16 | * 16 different fonts available 17 | * cyrillic fonts supported 18 | * TrueType font converter available ([https://github.com/AriZuu](https://github.com/AriZuu)) 19 | * integrated and free scalable system console 20 | * basic geometric functions (e.g. line, circle, frame etc.) 21 | * can be easily ported to almost any microcontroller system 22 | * no risky dynamic memory allocation required 23 | 24 | ## µGUI Requirements 25 | µGUI is platform-independent, so there is no need to use a certain embedded system. In order to 26 | use µGUI, only two requirements are necessary: 27 | * a C-function which is able to control pixels of the target display. 28 | * integer types for the target platform have to be adjusted in ugui_config.h. 29 | -------------------------------------------------------------------------------- /deps/ugui/ugui.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/beetle-psx-libretro/67c0bb961e7679aa8f1882ee6411ce34cef084db/deps/ugui/ugui.c -------------------------------------------------------------------------------- /deps/ugui/ugui_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __UGUI_CONFIG_H 2 | #define __UGUI_CONFIG_H 3 | 4 | /* -------------------------------------------------------------------------------- */ 5 | /* -- CONFIG SECTION -- */ 6 | /* -------------------------------------------------------------------------------- */ 7 | 8 | //#define USE_MULTITASKING 9 | 10 | /* Enable color mode */ 11 | #define USE_COLOR_RGB888 // RGB = 0xFF,0xFF,0xFF 12 | //#define USE_COLOR_RGB565 // RGB = 0bRRRRRGGGGGGBBBBB 13 | 14 | /* Enable needed fonts here */ 15 | //#define USE_FONT_4X6 16 | //#define USE_FONT_5X8 17 | //#define USE_FONT_5X12 18 | //#define USE_FONT_6X8 19 | //#define USE_FONT_6X10 20 | //#define USE_FONT_7X12 21 | #define USE_FONT_8X8 22 | //#define USE_FONT_8X12_CYRILLIC 23 | //#define USE_FONT_8X12 24 | //#define USE_FONT_8X12 25 | //#define USE_FONT_8X14 26 | //#define USE_FONT_10X16 27 | //#define USE_FONT_12X16 28 | //#define USE_FONT_12X20 29 | //#define USE_FONT_16X26 30 | //#define USE_FONT_22X36 31 | //#define USE_FONT_24X40 32 | //#define USE_FONT_32X53 33 | 34 | /* Specify platform-dependent integer types here */ 35 | 36 | #define __UG_FONT_DATA const 37 | /* 38 | typedef uint8_t UG_U8; 39 | typedef int8_t UG_S8; 40 | typedef uint16_t UG_U16; 41 | typedef int16_t UG_S16; 42 | typedef uint32_t UG_U32; 43 | typedef int32_t UG_S32; 44 | */ 45 | 46 | typedef unsigned char UG_U8; 47 | typedef signed char UG_S8; 48 | typedef unsigned int UG_U16; 49 | typedef signed int UG_S16; 50 | typedef unsigned long int UG_U32; 51 | typedef signed long int UG_S32; 52 | 53 | /* -------------------------------------------------------------------------------- */ 54 | /* -------------------------------------------------------------------------------- */ 55 | 56 | 57 | /* Feature enablers */ 58 | #define USE_PRERENDER_EVENT 59 | #define USE_POSTRENDER_EVENT 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /deps/wiiu/os/condition.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #define OS_CONDITION_TAG 0x634E6456u 10 | 11 | typedef struct OSCondition 12 | { 13 | uint32_t tag; 14 | const char *name; 15 | uint32_t __unknown; 16 | OSThreadQueue queue; 17 | }OSCondition; 18 | 19 | void OSInitCond(OSCondition *condition); 20 | void OSInitCondEx(OSCondition *condition, const char *name); 21 | void OSWaitCond(OSCondition *condition, OSMutex *mutex); 22 | void OSSignalCond(OSCondition *condition); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /deps/wiiu/os/mutex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct OSMutex OSMutex; 10 | 11 | typedef struct 12 | { 13 | OSMutex *next; 14 | OSMutex *prev; 15 | } OSMutexLink; 16 | 17 | #define OS_MUTEX_TAG 0x6D557458u 18 | typedef struct OSMutex 19 | { 20 | uint32_t tag; 21 | const char *name; 22 | uint32_t __unknown; 23 | OSThreadQueue queue; 24 | OSThread *owner; 25 | int32_t count; 26 | OSMutexLink link; 27 | } OSMutex; 28 | 29 | void OSInitMutex(OSMutex *mutex); 30 | void OSInitMutexEx(OSMutex *mutex, const char *name); 31 | void OSLockMutex(OSMutex *mutex); 32 | BOOL OSTryLockMutex(OSMutex *mutex); 33 | void OSUnlockMutex(OSMutex *mutex); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | /** @} */ 40 | -------------------------------------------------------------------------------- /deps/wiiu/types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #ifndef TRUE 6 | #define TRUE 1 7 | #endif 8 | 9 | #ifndef FALSE 10 | #define FALSE 0 11 | #endif 12 | 13 | typedef int BOOL; 14 | 15 | typedef uint8_t u8; 16 | typedef uint16_t u16; 17 | typedef uint32_t u32; 18 | typedef uint64_t u64; 19 | 20 | typedef int8_t s8; 21 | typedef int16_t s16; 22 | typedef int32_t s32; 23 | typedef int64_t s64; 24 | 25 | typedef volatile u8 vu8; 26 | typedef volatile u16 vu16; 27 | typedef volatile u32 vu32; 28 | typedef volatile u64 vu64; 29 | 30 | typedef volatile s8 vs8; 31 | typedef volatile s16 vs16; 32 | typedef volatile s32 vs32; 33 | typedef volatile s64 vs64; 34 | 35 | typedef float f32; 36 | typedef double f64; 37 | 38 | typedef volatile float vf32; 39 | typedef volatile double vf64; 40 | -------------------------------------------------------------------------------- /deps/zlib-1.2.11/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /input.h: -------------------------------------------------------------------------------- 1 | #ifndef __INPUT_H__ 2 | #define __INPUT_H__ 3 | 4 | #include 5 | #include 6 | #include "mednafen/psx/frontio.h" 7 | 8 | // These input routines tell libretro about PlayStation peripherals 9 | // and map input from the abstract 'retropad' into PlayStation land. 10 | 11 | extern void input_init_env( retro_environment_t environ_cb ); 12 | 13 | extern void input_init(); 14 | 15 | extern void input_set_fio( FrontIO* fio ); 16 | 17 | extern void input_init_calibration(); 18 | extern void input_enable_calibration( bool enable ); 19 | 20 | extern void input_set_env( retro_environment_t environ_cb ); 21 | 22 | extern void input_set_mouse_sensitivity( int percent ); 23 | extern void input_set_gun_cursor( int cursor ); 24 | 25 | extern void input_set_negcon_deadzone( int deadzone ); 26 | extern void input_set_negcon_linearity( int linearity ); 27 | 28 | extern void input_set_player_count( unsigned players ); 29 | 30 | extern unsigned input_get_player_count(); 31 | 32 | void input_update(bool supports_bitmasks, retro_input_state_t input_state_cb ); 33 | 34 | enum 35 | { 36 | SETTING_GUN_INPUT_LIGHTGUN, 37 | SETTING_GUN_INPUT_POINTER, 38 | }; 39 | extern int gun_input_mode; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /intl/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | crowdin-cli.jar 3 | *.h 4 | *.json 5 | -------------------------------------------------------------------------------- /intl/crowdin.yaml: -------------------------------------------------------------------------------- 1 | "project_id": "380544" 2 | "api_token": "_secret_" 3 | "base_url": "https://api.crowdin.com" 4 | "preserve_hierarchy": true 5 | 6 | "files": 7 | [ 8 | { 9 | "source": "/_core_name_/_us.json", 10 | "dest": "/_core_name_/_core_name_.json", 11 | "translation": "/_core_name_/_%two_letters_code%.json", 12 | }, 13 | ] 14 | -------------------------------------------------------------------------------- /intl/crowdin_prep.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import core_option_translation as t 4 | 5 | if __name__ == '__main__': 6 | try: 7 | if t.os.path.isfile(t.sys.argv[1]) or t.sys.argv[1].endswith('.h'): 8 | _temp = t.os.path.dirname(t.sys.argv[1]) 9 | else: 10 | _temp = t.sys.argv[1] 11 | while _temp.endswith('/') or _temp.endswith('\\'): 12 | _temp = _temp[:-1] 13 | TARGET_DIR_PATH = _temp 14 | except IndexError: 15 | TARGET_DIR_PATH = t.os.path.dirname(t.os.path.dirname(t.os.path.realpath(__file__))) 16 | print("No path provided, assuming parent directory:\n" + TARGET_DIR_PATH) 17 | 18 | CORE_NAME = t.clean_file_name(t.sys.argv[2]) 19 | DIR_PATH = t.os.path.dirname(t.os.path.realpath(__file__)) 20 | H_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options.h') 21 | 22 | print('Getting texts from libretro_core_options.h') 23 | with open(H_FILE_PATH, 'r+', encoding='utf-8') as _h_file: 24 | _main_text = _h_file.read() 25 | _hash_n_str = t.get_texts(_main_text) 26 | _files = t.create_msg_hash(DIR_PATH, CORE_NAME, _hash_n_str) 27 | 28 | _source_jsons = t.h2json(_files) 29 | 30 | print('\nAll done!') 31 | -------------------------------------------------------------------------------- /intl/crowdin_translate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import core_option_translation as t 4 | 5 | if __name__ == '__main__': 6 | try: 7 | if t.os.path.isfile(t.sys.argv[1]) or t.sys.argv[1].endswith('.h'): 8 | _temp = t.os.path.dirname(t.sys.argv[1]) 9 | else: 10 | _temp = t.sys.argv[1] 11 | while _temp.endswith('/') or _temp.endswith('\\'): 12 | _temp = _temp[:-1] 13 | TARGET_DIR_PATH = _temp 14 | except IndexError: 15 | TARGET_DIR_PATH = t.os.path.dirname(t.os.path.dirname(t.os.path.realpath(__file__))) 16 | print("No path provided, assuming parent directory:\n" + TARGET_DIR_PATH) 17 | 18 | CORE_NAME = t.clean_file_name(t.sys.argv[2]) 19 | DIR_PATH = t.os.path.dirname(t.os.path.realpath(__file__)) 20 | LOCALISATIONS_PATH = t.os.path.join(DIR_PATH, CORE_NAME) 21 | US_FILE_PATH = t.os.path.join(LOCALISATIONS_PATH, '_us.h') 22 | H_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options.h') 23 | INTL_FILE_PATH = t.os.path.join(TARGET_DIR_PATH, 'libretro_core_options_intl.h') 24 | 25 | print('Getting texts from libretro_core_options.h') 26 | with open(H_FILE_PATH, 'r+', encoding='utf-8') as _h_file: 27 | _main_text = _h_file.read() 28 | _hash_n_str = t.get_texts(_main_text) 29 | _files = t.create_msg_hash(DIR_PATH, CORE_NAME, _hash_n_str) 30 | _source_jsons = t.h2json(_files) 31 | 32 | print('Converting translations *.json to *.h:') 33 | localisation_files = t.os.scandir(LOCALISATIONS_PATH) 34 | t.json2h(LOCALISATIONS_PATH, localisation_files) 35 | 36 | print('Constructing libretro_core_options_intl.h') 37 | t.create_intl_file(INTL_FILE_PATH, LOCALISATIONS_PATH, _main_text, _files["_us"]) 38 | 39 | print('\nAll done!') 40 | -------------------------------------------------------------------------------- /intl/download_workflow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import subprocess 5 | 6 | try: 7 | api_key = sys.argv[1] 8 | core_name = sys.argv[2] 9 | dir_path = sys.argv[3] 10 | except IndexError as e: 11 | print('Please provide path to libretro_core_options.h, Crowdin API Token and core name!') 12 | raise e 13 | 14 | subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name]) 15 | subprocess.run(['python3', 'intl/crowdin_translation_download.py', api_key, core_name]) 16 | subprocess.run(['python3', 'intl/crowdin_translate.py', dir_path, core_name]) 17 | -------------------------------------------------------------------------------- /intl/upload_workflow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import subprocess 5 | 6 | try: 7 | api_key = sys.argv[1] 8 | core_name = sys.argv[2] 9 | dir_path = sys.argv[3] 10 | except IndexError as e: 11 | print('Please provide path to libretro_core_options.h, Crowdin API Token and core name!') 12 | raise e 13 | 14 | subprocess.run(['python3', 'intl/crowdin_prep.py', dir_path, core_name]) 15 | subprocess.run(['python3', 'intl/crowdin_source_upload.py', api_key, core_name]) 16 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := c++_static 2 | APP_ABI := all 3 | -------------------------------------------------------------------------------- /libretro-common/glsym/README.md: -------------------------------------------------------------------------------- 1 | # Autogenerate GL extension loaders 2 | 3 | ## OpenGL desktop 4 | 5 | Use Khronos' recent [header](www.opengl.org/registry/api/glext.h). 6 | 7 | ./glgen.py /usr/include/GL/glext.h glsym_gl.h glsym_gl.c 8 | 9 | ## OpenGL ES 10 | 11 | ./glgen.py /usr/include/GLES2/gl2ext.h glsym_es2.h glsym_es2.c 12 | -------------------------------------------------------------------------------- /libretro-common/glsym/rglgen.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 30 | const struct rglgen_sym_map *map) 31 | { 32 | for (; map->sym; map++) 33 | { 34 | rglgen_func_t func = proc(map->sym); 35 | memcpy(map->ptr, &func, sizeof(func)); 36 | } 37 | } 38 | 39 | void rglgen_resolve_symbols(rglgen_proc_address_t proc) 40 | { 41 | if (!proc) 42 | return; 43 | 44 | rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); 45 | } 46 | -------------------------------------------------------------------------------- /libretro-common/include/boolean.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (boolean.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_BOOLEAN_H 24 | #define __LIBRETRO_SDK_BOOLEAN_H 25 | 26 | #ifndef __cplusplus 27 | 28 | #if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3) 29 | /* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */ 30 | #define bool unsigned char 31 | #define true 1 32 | #define false 0 33 | #else 34 | #include 35 | #endif 36 | 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libretro-common/include/compat/fnmatch.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fnmatch.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 24 | #define __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 25 | 26 | #define FNM_NOMATCH 1 27 | 28 | int rl_fnmatch(const char *pattern, const char *string, int flags); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libretro-common/include/compat/fopen_utf8.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H 24 | #define __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H 25 | 26 | #ifdef _WIN32 27 | /* Defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */ 28 | /* TODO: enable */ 29 | /* #define fopen (use fopen_utf8 instead) */ 30 | void *fopen_utf8(const char * filename, const char * mode); 31 | #else 32 | #define fopen_utf8 fopen 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /libretro-common/include/compat/ifaddrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995, 1999 3 | * Berkeley Software Design, Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND 12 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 14 | * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 17 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 18 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 20 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 21 | * SUCH DAMAGE. 22 | * 23 | * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp 24 | */ 25 | 26 | #ifndef _IFADDRS_H_ 27 | #define _IFADDRS_H_ 28 | 29 | struct ifaddrs 30 | { 31 | struct ifaddrs *ifa_next; 32 | char *ifa_name; 33 | unsigned int ifa_flags; 34 | struct sockaddr *ifa_addr; 35 | struct sockaddr *ifa_netmask; 36 | struct sockaddr *ifa_dstaddr; 37 | void *ifa_data; 38 | }; 39 | 40 | /* 41 | * This may have been defined in . Note that if is 42 | * to be included it must be included before this header file. 43 | */ 44 | #ifndef ifa_broadaddr 45 | #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 46 | #endif 47 | 48 | #include 49 | 50 | extern int getifaddrs(struct ifaddrs **ifap); 51 | extern void freeifaddrs(struct ifaddrs *ifa); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /libretro-common/include/glsym/glsym.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_GLSYM_H__ 24 | #define __LIBRETRO_SDK_GLSYM_H__ 25 | 26 | #include "rglgen.h" 27 | 28 | #ifndef HAVE_PSGL 29 | #if defined(HAVE_OPENGLES2) 30 | #include "glsym_es2.h" 31 | #elif defined(HAVE_OPENGLES3) 32 | #include "glsym_es3.h" 33 | #else 34 | #ifdef HAVE_LIBNX 35 | #include "switch/nx_glsym.h" 36 | #endif 37 | #include "glsym_gl.h" 38 | #endif 39 | #endif 40 | 41 | #ifdef HAVE_GLSYM_PRIVATE 42 | #include "glsym_private.h" 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /libretro-common/include/glsym/rglgen.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef RGLGEN_H__ 24 | #define RGLGEN_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #include 31 | 32 | #include "rglgen_headers.h" 33 | 34 | RETRO_BEGIN_DECLS 35 | 36 | struct rglgen_sym_map; 37 | 38 | typedef void (*rglgen_func_t)(void); 39 | typedef rglgen_func_t (*rglgen_proc_address_t)(const char*); 40 | void rglgen_resolve_symbols(rglgen_proc_address_t proc); 41 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 42 | const struct rglgen_sym_map *map); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /libretro-common/include/memalign.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memalign.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_MEMALIGN_H 24 | #define _LIBRETRO_MEMALIGN_H 25 | 26 | #include 27 | 28 | #include 29 | 30 | RETRO_BEGIN_DECLS 31 | 32 | void *memalign_alloc(size_t boundary, size_t size); 33 | 34 | void *memalign_alloc_aligned(size_t size); 35 | 36 | void memalign_free(void *ptr); 37 | 38 | RETRO_END_DECLS 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /libretro-common/include/retro_assert.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_assert.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __RETRO_ASSERT_H 24 | #define __RETRO_ASSERT_H 25 | 26 | #include 27 | 28 | #ifdef RARCH_INTERNAL 29 | #include 30 | #define retro_assert(cond) ((void)( (cond) || (printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__), abort(), 0) )) 31 | #else 32 | #define retro_assert(cond) assert(cond) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /libretro-common/include/retro_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_common.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_COMMON_RETRO_COMMON_H 24 | #define _LIBRETRO_COMMON_RETRO_COMMON_H 25 | 26 | /* 27 | This file is designed to normalize the libretro-common compiling environment. 28 | It is not to be used in public API headers, as they should be designed as leanly as possible. 29 | Nonetheless.. in the meantime, if you do something like use ssize_t, which is not fully portable, 30 | in a public API, you may need this. 31 | */ 32 | 33 | /* conditional compilation is handled inside here */ 34 | #include 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /libretro-common/include/retro_inline.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_inline.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_INLINE_H 24 | #define __LIBRETRO_SDK_INLINE_H 25 | 26 | #ifndef INLINE 27 | 28 | #if defined(_WIN32) || defined(__INTEL_COMPILER) 29 | #define INLINE __inline 30 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L 31 | #define INLINE inline 32 | #elif defined(__GNUC__) 33 | #define INLINE __inline__ 34 | #else 35 | #define INLINE 36 | #endif 37 | 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /libretro.osx.def: -------------------------------------------------------------------------------- 1 | #LIBRARY "libretro" 2 | #EXPORTS 3 | _retro_set_environment 4 | _retro_set_video_refresh 5 | _retro_set_audio_sample 6 | _retro_set_audio_sample_batch 7 | _retro_set_input_poll 8 | _retro_set_input_state 9 | _retro_init 10 | _retro_deinit 11 | _retro_api_version 12 | _retro_get_system_info 13 | _retro_get_system_av_info 14 | _retro_set_controller_port_device 15 | _retro_reset 16 | _retro_run 17 | _retro_serialize_size 18 | _retro_serialize 19 | _retro_unserialize 20 | _retro_cheat_reset 21 | _retro_cheat_set 22 | _retro_load_game 23 | _retro_load_game_special 24 | _retro_unload_game 25 | _retro_get_region 26 | _retro_get_memory_data 27 | _retro_get_memory_size 28 | -------------------------------------------------------------------------------- /libretro_cbs.c: -------------------------------------------------------------------------------- 1 | #include "libretro.h" 2 | 3 | retro_video_refresh_t video_cb = NULL; 4 | retro_environment_t environ_cb = NULL; 5 | -------------------------------------------------------------------------------- /libretro_cbs.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBRETRO_CBS_H 2 | #define __LIBRETRO_CBS_H 3 | 4 | #include "libretro.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | extern retro_video_refresh_t video_cb; 11 | extern retro_environment_t environ_cb; 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /libretro_options.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBRETRO_OPTIONS_H__ 2 | #define LIBRETRO_OPTIONS_H__ 3 | 4 | #ifdef HAVE_OPENGLES3 5 | #define MEDNAFEN_CORE_RENDERER "-GLES3" 6 | #else 7 | #define MEDNAFEN_CORE_RENDERER "" 8 | #endif 9 | 10 | #define MEDNAFEN_CORE_SETVERSION "0.9.44.1" 11 | 12 | #define MEDNAFEN_CORE_NAME_MODULE "psx" 13 | #ifdef HAVE_HW 14 | #define MEDNAFEN_CORE_NAME "Beetle PSX HW" 15 | #define MEDNAFEN_CORE_VERSION MEDNAFEN_CORE_SETVERSION MEDNAFEN_CORE_RENDERER 16 | #else 17 | #define MEDNAFEN_CORE_NAME "Beetle PSX" 18 | #define MEDNAFEN_CORE_VERSION MEDNAFEN_CORE_SETVERSION 19 | #endif 20 | #define MEDNAFEN_CORE_EXTENSIONS "exe|cue|toc|ccd|m3u|pbp|chd" 21 | #define MEDNAFEN_CORE_GEOMETRY_BASE_W 320 22 | #define MEDNAFEN_CORE_GEOMETRY_BASE_H 240 23 | #define MEDNAFEN_CORE_GEOMETRY_MAX_W 700 24 | #define MEDNAFEN_CORE_GEOMETRY_MAX_H 576 25 | #define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO (4.0 / 3.0) 26 | 27 | #ifdef HAVE_HW 28 | #define BEETLE_OPT(_o) ("beetle_psx_hw_" # _o) 29 | #else 30 | #define BEETLE_OPT(_o) ("beetle_psx_" # _o) 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /lightning-lightrec-include/config.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2019-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef __LIGHTREC_CONFIG_H__ 7 | #define __LIGHTREC_CONFIG_H__ 8 | 9 | #define ENABLE_FIRST_PASS 1 10 | #define ENABLE_TINYMM 0 11 | 12 | #define OPT_REMOVE_DIV_BY_ZERO_SEQ 1 13 | #define OPT_REPLACE_MEMSET 1 14 | #define OPT_DETECT_IMPOSSIBLE_BRANCHES 1 15 | #define OPT_TRANSFORM_OPS 1 16 | #define OPT_LOCAL_BRANCHES 1 17 | #define OPT_SWITCH_DELAY_SLOTS 1 18 | #define OPT_FLAG_STORES 1 19 | #define OPT_FLAG_MULT_DIV 1 20 | #define OPT_EARLY_UNLOAD 1 21 | 22 | #endif /* __LIGHTREC_CONFIG_H__ */ 23 | -------------------------------------------------------------------------------- /lightning-lightrec-include/debug.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 | /* 3 | * Copyright (C) 2014-2021 Paul Cercueil 4 | */ 5 | 6 | #ifndef DEBUG_H 7 | #define DEBUG_H 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | extern retro_log_printf_t log_cb; 14 | 15 | #define NOLOG_L 0 16 | #define ERROR_L 1 17 | #define WARNING_L 2 18 | #define INFO_L 3 19 | #define DEBUG_L 4 20 | 21 | #ifndef LOG_LEVEL 22 | #define LOG_LEVEL INFO_L 23 | #endif 24 | 25 | // ------------- 26 | 27 | #if (LOG_LEVEL >= DEBUG_L) 28 | # define pr_debug(...) \ 29 | log_cb(RETRO_LOG_DEBUG, "[Lightrec]: " __VA_ARGS__) 30 | #else 31 | #define pr_debug(...) 32 | #endif 33 | 34 | #if (LOG_LEVEL >= INFO_L) 35 | # define pr_info(...) \ 36 | log_cb(RETRO_LOG_INFO, "[Lightrec]: " __VA_ARGS__) 37 | #else 38 | #define pr_info(...) 39 | #endif 40 | 41 | #if (LOG_LEVEL >= WARNING_L) 42 | # define pr_warn(...) \ 43 | log_cb(RETRO_LOG_WARN, "[Lightrec]: " __VA_ARGS__) 44 | #else 45 | #define pr_warn(...) 46 | #endif 47 | 48 | #if (LOG_LEVEL >= ERROR_L) 49 | # define pr_err(...) \ 50 | log_cb(RETRO_LOG_ERROR, "[Lightrec]: " __VA_ARGS__) 51 | #else 52 | #define pr_err(...) 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /mednafen/FileStream.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | // TODO/WIP 19 | 20 | #ifndef __MDFN_FILESTREAM_H 21 | #define __MDFN_FILESTREAM_H 22 | 23 | #include 24 | 25 | #include "Stream.h" 26 | 27 | class FileStream : public Stream 28 | { 29 | public: 30 | FileStream(const char *path, const int mode); 31 | virtual ~FileStream(); 32 | 33 | virtual uint64_t read(void *data, uint64_t count); 34 | virtual void write(const void *data, uint64_t count); 35 | virtual void seek(int64_t offset, int whence); 36 | virtual uint64_t tell(void); 37 | virtual uint64_t size(void); 38 | virtual void close(void); 39 | 40 | private: 41 | RFILE *fp; 42 | }; 43 | 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /mednafen/MemoryStream.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | // TODO/WIP 19 | 20 | #ifndef _MEMORY_STREAM_H 21 | #define _MEMORY_STREAM_H 22 | 23 | #include "Stream.h" 24 | 25 | class MemoryStream : public Stream 26 | { 27 | public: 28 | 29 | MemoryStream(); 30 | MemoryStream(uint64 size_hint); 31 | MemoryStream(Stream *stream); // Will create a MemoryStream equivalent of the contents of "stream", and then "delete stream". 32 | // Will only work if stream->tell() == 0, or if "stream" is seekable. 33 | // stream will be deleted even if this constructor throws. 34 | 35 | MemoryStream(const MemoryStream *zs); 36 | MemoryStream & operator=(const MemoryStream *zs); 37 | 38 | virtual ~MemoryStream(); 39 | 40 | virtual uint8 *map(void); 41 | virtual void unmap(void); 42 | 43 | virtual uint64 read(void *data, uint64 count); 44 | virtual void write(const void *data, uint64 count); 45 | virtual void seek(int64 offset, int whence); 46 | virtual uint64_t tell(void); 47 | virtual uint64_t size(void); 48 | virtual void close(void); 49 | 50 | virtual int get_line(std::string &str); 51 | 52 | private: 53 | uint8 *data_buffer; 54 | uint64 data_buffer_size; 55 | uint64 data_buffer_alloced; 56 | 57 | int64 position; 58 | 59 | void grow_if_necessary(uint64 new_required_size); 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /mednafen/Stream.cpp: -------------------------------------------------------------------------------- 1 | // TODO/WIP 2 | 3 | /* Mednafen - Multi-system Emulator 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "mednafen.h" 21 | #include "Stream.h" 22 | 23 | Stream::Stream() 24 | { 25 | 26 | } 27 | 28 | Stream::~Stream() 29 | { 30 | 31 | } 32 | 33 | int Stream::get_line(std::string &str) 34 | { 35 | uint8_t c; 36 | 37 | str.clear(); // or str.resize(0)?? 38 | 39 | while(read(&c, sizeof(c)) > 0) 40 | { 41 | if(c == '\r' || c == '\n' || c == 0) 42 | return(c); 43 | 44 | str.push_back(c); 45 | } 46 | 47 | return(-1); 48 | } 49 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDROMFILE_H 2 | #define __MDFN_CDROMFILE_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "CDUtility.h" 9 | #include "misc.h" 10 | 11 | class CDAccess 12 | { 13 | public: 14 | 15 | CDAccess(); 16 | virtual ~CDAccess(); 17 | 18 | virtual bool Read_Raw_Sector(uint8_t *buf, int32_t lba) = 0; 19 | 20 | virtual bool Read_Raw_PW(uint8_t *buf, int32_t lba); 21 | 22 | virtual bool Read_TOC(TOC *toc) = 0; 23 | 24 | virtual void Eject(bool eject_status) = 0; // Eject a disc if it's physical, otherwise NOP. Returns true on success(or NOP), false on error 25 | 26 | private: 27 | CDAccess(const CDAccess&); // No copy constructor. 28 | CDAccess& operator=(const CDAccess&); // No assignment operator. 29 | }; 30 | 31 | CDAccess *cdaccess_open_image(bool *success, const char *path, bool image_memcache); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess_CCD.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef _CDROM_CDACCESS_CCD_H_ 19 | #define _CDROM_CDACCESS_CCD_H_ 20 | 21 | #include "../FileStream.h" 22 | #include "../MemoryStream.h" 23 | #include "CDAccess.h" 24 | 25 | #include 26 | 27 | class CDAccess_CCD : public CDAccess 28 | { 29 | public: 30 | 31 | CDAccess_CCD(bool *success, const char *path, bool image_memcache); 32 | virtual ~CDAccess_CCD(); 33 | 34 | virtual bool Read_Raw_Sector(uint8_t *buf, int32_t lba); 35 | 36 | virtual bool Read_Raw_PW(uint8_t *buf, int32_t lba); 37 | 38 | virtual bool Read_TOC(TOC *toc); 39 | 40 | virtual void Eject(bool eject_status); 41 | 42 | private: 43 | 44 | bool Load(const char *path, bool image_memcache); 45 | void Cleanup(void); 46 | 47 | bool CheckSubQSanity(void); 48 | 49 | Stream* img_stream; 50 | Stream* sub_stream; 51 | size_t img_numsectors; 52 | TOC tocd; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /mednafen/cdrom/CDAccess_CHD.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDACCESS_CHD_H 2 | #define __MDFN_CDACCESS_CHD_H 3 | 4 | #include "CDAccess.h" 5 | #include "CDAccess_Image.h" 6 | 7 | #include 8 | 9 | class CDAccess_CHD : public CDAccess 10 | { 11 | public: 12 | 13 | CDAccess_CHD(const char *path, bool image_memcache); 14 | virtual ~CDAccess_CHD(); 15 | 16 | virtual bool Read_Raw_Sector(uint8_t *buf, int32_t lba); 17 | 18 | virtual bool Read_Raw_PW(uint8_t *buf, int32_t lba); 19 | 20 | virtual bool Read_TOC(TOC *toc); 21 | 22 | virtual void Eject(bool eject_status); 23 | 24 | private: 25 | chd_file *chd; 26 | /* hunk data cache */ 27 | uint8_t *hunkmem; 28 | /* last hunknum read */ 29 | int oldhunk; 30 | 31 | int32_t NumTracks; 32 | int32_t FirstTrack; 33 | int32_t LastTrack; 34 | int32_t total_sectors; 35 | TOC* ptoc; 36 | 37 | std::string sbi_path; 38 | 39 | bool ImageOpen(const char *path, bool image_memcache); 40 | int LoadSBI(const char* sbi_path); 41 | void Cleanup(void); 42 | 43 | CDRFILE_TRACK_INFO Tracks[100]; // Track #0(HMM?) through 99 44 | struct cpp11_array_doodad 45 | { 46 | uint8 data[12]; 47 | }; 48 | std::map SubQReplaceMap; 49 | int32_t MakeSubPQ(int32 lba, uint8 *SubPWBuf); 50 | }; 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /mednafen/cdrom/SimpleFIFO.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_SIMPLEFIFO_H 2 | #define __MDFN_SIMPLEFIFO_H 3 | 4 | #include "../math_ops.h" 5 | 6 | class SimpleFIFO 7 | { 8 | public: 9 | 10 | // Constructor 11 | SimpleFIFO(uint32 the_size) 12 | { 13 | /* Size should be a power of 2! */ 14 | data = (uint8*)malloc(the_size * sizeof(uint8)); 15 | size = the_size; 16 | read_pos = 0; 17 | write_pos = 0; 18 | in_count = 0; 19 | } 20 | 21 | // Destructor 22 | INLINE ~SimpleFIFO() 23 | { 24 | if (data) 25 | free(data); 26 | } 27 | 28 | INLINE uint32 CanWrite(void) 29 | { 30 | return(size - in_count); 31 | } 32 | 33 | INLINE uint8 ReadByte(void) 34 | { 35 | uint8 ret = data[read_pos]; 36 | read_pos = (read_pos + 1) & (size - 1); 37 | in_count--; 38 | return(ret); 39 | } 40 | 41 | INLINE void Write(const uint8 *happy_data, uint32 happy_count) 42 | { 43 | while(happy_count) 44 | { 45 | data[write_pos] = *happy_data; 46 | 47 | write_pos = (write_pos + 1) & (size - 1); 48 | in_count++; 49 | happy_data++; 50 | happy_count--; 51 | } 52 | } 53 | 54 | INLINE void WriteByte(const uint8 wr_data) 55 | { 56 | data[write_pos] = wr_data; 57 | write_pos = (write_pos + 1) & (size - 1); 58 | in_count++; 59 | } 60 | 61 | 62 | INLINE void Flush(void) 63 | { 64 | read_pos = 0; 65 | write_pos = 0; 66 | in_count = 0; 67 | } 68 | 69 | INLINE void SaveStatePostLoad(void) 70 | { 71 | read_pos %= size; 72 | write_pos %= size; 73 | in_count %= (size + 1); 74 | } 75 | 76 | uint8* data; 77 | uint32 size; 78 | uint32 read_pos; // Read position 79 | uint32 write_pos; // Write position 80 | uint32 in_count; // Number of units in the FIFO 81 | }; 82 | 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /mednafen/cdrom/audioreader.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_AUDIOREADER_H 2 | #define __MDFN_AUDIOREADER_H 3 | 4 | #include "../Stream.h" 5 | 6 | class AudioReader 7 | { 8 | public: 9 | AudioReader(); 10 | virtual ~AudioReader(); 11 | 12 | virtual int64_t FrameCount(void); 13 | INLINE int64_t Read(int64_t frame_offset, int16_t *buffer, int64_t frames) 14 | { 15 | int64_t ret; 16 | 17 | if(LastReadPos != frame_offset) 18 | { 19 | //puts("SEEK"); 20 | if(!Seek_(frame_offset)) 21 | return(0); 22 | LastReadPos = frame_offset; 23 | } 24 | 25 | ret = Read_(buffer, frames); 26 | LastReadPos += ret; 27 | return(ret); 28 | } 29 | 30 | private: 31 | virtual int64_t Read_(int16_t *buffer, int64_t frames); 32 | virtual bool Seek_(int64_t frame_offset); 33 | 34 | int64_t LastReadPos; 35 | }; 36 | 37 | // AR_Open(), and AudioReader, will NOT take "ownership" of the Stream object(IE it won't ever delete it). Though it does assume it has exclusive access 38 | // to it for as long as the AudioReader object exists. 39 | AudioReader *AR_Open(Stream *fp); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /mednafen/cdrom/edc_crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef _EDC_CRC32_H 2 | #define _EDC_CRC32_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | uint32_t EDCCrc32(const unsigned char*, int); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mednafen/cdrom/l-ec.h: -------------------------------------------------------------------------------- 1 | #ifndef _L_EC_H 2 | #define _L_EC_H 3 | 4 | #include 5 | #include "galois.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define N_P_VECTORS 86 /* 43 16bit p vectors */ 12 | #define P_VECTOR_SIZE 26 /* using RS(26,24) ECC */ 13 | 14 | #define N_Q_VECTORS 52 /* 26 16bit q vectors */ 15 | #define Q_VECTOR_SIZE 45 /* using RS(45,43) ECC */ 16 | 17 | #define P_PADDING 229 /* padding values for */ 18 | #define Q_PADDING 210 /* shortened RS code */ 19 | 20 | int PToByteIndex(int, int); 21 | int QToByteIndex(int, int); 22 | void ByteIndexToP(int, int*, int*); 23 | void ByteIndexToQ(int, int*, int*); 24 | 25 | void GetPVector(unsigned char*, unsigned char*, int); 26 | void SetPVector(unsigned char*, unsigned char*, int); 27 | void FillPVector(unsigned char*, unsigned char, int); 28 | void AndPVector(unsigned char*, unsigned char, int); 29 | void OrPVector(unsigned char*, unsigned char, int); 30 | 31 | void GetQVector(unsigned char*, unsigned char*, int); 32 | void SetQVector(unsigned char*, unsigned char*, int); 33 | void FillQVector(unsigned char*, unsigned char, int); 34 | void AndQVector(unsigned char*, unsigned char, int); 35 | void OrQVector(unsigned char*, unsigned char, int); 36 | 37 | int DecodePQ(ReedSolomonTables*, unsigned char*, int, int*, int); 38 | 39 | int CountC2Errors(unsigned char*); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /mednafen/cdrom/misc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "misc.h" 7 | 8 | void MDFN_strtoupper(char *str) 9 | { 10 | size_t x; 11 | for(x = 0; str[x]; x++) 12 | { 13 | if(str[x] >= 'a' && str[x] <= 'z') 14 | str[x] = str[x] - 'a' + 'A'; 15 | } 16 | } 17 | 18 | void MDFN_strtoupper(std::string &str) 19 | { 20 | size_t x; 21 | const size_t len = str.length(); 22 | 23 | for(x = 0; x < len; x++) 24 | { 25 | if(str[x] >= 'a' && str[x] <= 'z') 26 | str[x] = str[x] - 'a' + 'A'; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /mednafen/cdrom/misc.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CDROM_MISC_H 2 | #define __MDFN_CDROM_MISC_H 3 | 4 | void MDFN_strtoupper(std::string &str); 5 | void MDFN_strtoupper(char *str); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /mednafen/cdrom/recover-raw.h: -------------------------------------------------------------------------------- 1 | #ifndef _RECOVER_RAW_H 2 | #define _RECOVER_RAW_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define CD_RAW_SECTOR_SIZE 2352 12 | #define CD_RAW_C2_SECTOR_SIZE (2352+294) /* main channel plus C2 vector */ 13 | 14 | int CheckEDC(const unsigned char *a, bool b); 15 | int CheckMSF(unsigned char *a, int b); 16 | 17 | 18 | int ValidateRawSector(unsigned char *frame, bool xaMode); 19 | bool Init_LEC_Correct(void); 20 | void Kill_LEC_Correct(void); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /mednafen/clamp.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_CLAMP_H 2 | #define __MDFN_CLAMP_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #ifndef _WIN32 10 | #include 11 | #endif 12 | 13 | #ifdef _MSC_VER 14 | #include 15 | #endif 16 | 17 | static INLINE void clamp(int32_t *val, ssize_t min, ssize_t max) 18 | { 19 | if(*val < min) 20 | *val = min; 21 | if(*val > max) 22 | *val = max; 23 | } 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mednafen/error.cpp: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "mednafen.h" 19 | #include "error.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | extern retro_log_printf_t log_cb; 26 | 27 | MDFN_Error::MDFN_Error(int errno_code_new, const char *format, ...) 28 | { 29 | va_list ap; 30 | va_start(ap, format); 31 | error_message = (char*)malloc(4096 * sizeof(char)); 32 | vsnprintf(error_message, 4096, format, ap); 33 | va_end(ap); 34 | 35 | log_cb(RETRO_LOG_ERROR, "%s\n", error_message); 36 | } 37 | 38 | 39 | MDFN_Error::~MDFN_Error() 40 | { 41 | if(error_message) 42 | free(error_message); 43 | error_message = NULL; 44 | } 45 | -------------------------------------------------------------------------------- /mednafen/error.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_ERROR_H 2 | #define __MDFN_ERROR_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | 8 | class MDFN_Error 9 | { 10 | public: 11 | MDFN_Error(); 12 | MDFN_Error(int errno_code_new, const char *format, ...); 13 | ~MDFN_Error(); 14 | private: 15 | char *error_message; 16 | }; 17 | 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /mednafen/general.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENERAL_H 2 | #define _GENERAL_H 3 | 4 | #include 5 | 6 | // File-inclusion for-read-only path, for PSF and CUE/TOC sheet usage. 7 | bool MDFN_IsFIROPSafe(const std::string &path); 8 | 9 | std::string MDFN_MakeFName(int type, int id1, const char *cd1); 10 | 11 | void MDFN_trim(std::string &string); 12 | 13 | typedef enum 14 | { 15 | MDFNMKF_STATE = 0, 16 | MDFNMKF_SNAP, 17 | MDFNMKF_SAV, 18 | MDFNMKF_CHEAT, 19 | MDFNMKF_PALETTE, 20 | MDFNMKF_IPS, 21 | MDFNMKF_MOVIE, 22 | MDFNMKF_AUX, 23 | MDFNMKF_SNAP_DAT, 24 | MDFNMKF_CHEAT_TMP, 25 | MDFNMKF_FIRMWARE 26 | } MakeFName_Type; 27 | 28 | const char *MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1); 29 | 30 | void MDFN_GetFilePathComponents(const std::string &file_path, std::string *dir_path_out, std::string *file_base_out = NULL, std::string *file_ext_out = NULL); 31 | 32 | std::string MDFN_EvalFIP(const std::string &dir_path, const std::string &rel_path, bool skip_safety_check); 33 | #endif 34 | -------------------------------------------------------------------------------- /mednafen/mednafen.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEDNAFEN_H 2 | #define _MEDNAFEN_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include "mednafen-types.h" 9 | 10 | #ifdef _WIN32 11 | #define strcasecmp _stricmp 12 | #endif 13 | 14 | void MDFND_DispMessage( 15 | unsigned priority, enum retro_log_level level, 16 | enum retro_message_target target, enum retro_message_type type, 17 | const char *msg); 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | void MDFN_DispMessage( 23 | unsigned priority, enum retro_log_level level, 24 | enum retro_message_target target, enum retro_message_type type, 25 | const char *format, ...); 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | void MDFN_LoadGameCheats(void *override); 31 | void MDFN_FlushGameCheats(int nosave); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mednafen/mempatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_MEMPATCHER_H 2 | #define __MDFN_MEMPATCHER_H 3 | 4 | #include "mempatcher-driver.h" 5 | #include 6 | 7 | typedef struct __SUBCHEAT 8 | { 9 | uint32 addr; 10 | uint8 value; 11 | int compare; // < 0 on no compare 12 | } SUBCHEAT; 13 | 14 | bool MDFNMP_Init(uint32 ps, uint32 numpages); 15 | void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM); 16 | void MDFNMP_Kill(void); 17 | 18 | void MDFNMP_InstallReadPatches(void); 19 | void MDFNMP_RemoveReadPatches(void); 20 | 21 | void MDFNMP_ApplyPeriodicCheats(void); 22 | void MDFNMP_RegSearchable(uint32 addr, uint32 size); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mednafen/psx/FastFIFO.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_FASTFIFO_H 2 | #define __MDFN_FASTFIFO_H 3 | 4 | // size should be a power of 2. 5 | template 6 | class FastFIFO 7 | { 8 | public: 9 | 10 | FastFIFO() 11 | { 12 | memset(data, 0, sizeof(data)); 13 | read_pos = 0; 14 | write_pos = 0; 15 | in_count = 0; 16 | } 17 | 18 | INLINE ~FastFIFO() 19 | { 20 | 21 | } 22 | 23 | INLINE void SaveStatePostLoad(void) 24 | { 25 | read_pos %= size; 26 | write_pos %= size; 27 | in_count %= (size + 1); 28 | } 29 | 30 | INLINE uint32 CanWrite(void) 31 | { 32 | return(size - in_count); 33 | } 34 | 35 | INLINE T Peek(void) 36 | { 37 | return data[read_pos]; 38 | } 39 | 40 | INLINE T Read(void) 41 | { 42 | T ret = data[read_pos]; 43 | 44 | read_pos = (read_pos + 1) & (size - 1); 45 | in_count--; 46 | 47 | return(ret); 48 | } 49 | 50 | INLINE void Write(const T& wr_data) 51 | { 52 | data[write_pos] = wr_data; 53 | write_pos = (write_pos + 1) & (size - 1); 54 | in_count++; 55 | } 56 | 57 | INLINE void Flush(void) 58 | { 59 | read_pos = 0; 60 | write_pos = 0; 61 | in_count = 0; 62 | } 63 | 64 | T data[size]; 65 | uint32 read_pos; // Read position 66 | uint32 write_pos; // Write position 67 | uint32 in_count; // Number of units in the FIFO 68 | }; 69 | 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /mednafen/psx/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_DEBUG_H 2 | #define __MDFN_PSX_DEBUG_H 3 | 4 | #ifdef WANT_DEBUGGER 5 | 6 | extern DebuggerInfoStruct PSX_DBGInfo; 7 | 8 | bool DBG_Init(void); 9 | 10 | void DBG_Break(void); 11 | 12 | void DBG_GPUScanlineHook(unsigned scanline); 13 | 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mednafen/psx/dis.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_DIS_H 2 | #define __MDFN_PSX_DIS_H 3 | 4 | std::string DisassembleMIPS(uint32 PC, uint32 instr); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /mednafen/psx/dma.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_DMA_H 2 | #define __MDFN_PSX_DMA_H 3 | 4 | int32_t DMA_Update(const int32_t timestamp); 5 | void DMA_Write(const int32_t timestamp, uint32_t A, uint32_t V); 6 | uint32_t DMA_Read(const int32_t timestamp, uint32_t A); 7 | 8 | void DMA_ResetTS(void); 9 | 10 | void DMA_Power(void); 11 | 12 | void DMA_Init(void); 13 | void DMA_Kill(void); 14 | 15 | int DMA_StateAction(StateMem *sm, int load, int data_only); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /mednafen/psx/gte.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_GTE_H 2 | #define __MDFN_PSX_GTE_H 3 | 4 | #include "../state.h" 5 | 6 | void GTE_Init(void); 7 | void GTE_Power(void); 8 | int GTE_StateAction(StateMem *sm, int load, int data_only); 9 | 10 | int32 GTE_Instruction(uint32_t instr); 11 | 12 | void GTE_WriteCR(unsigned int which, uint32_t value); 13 | void GTE_WriteDR(unsigned int which, uint32_t value); 14 | 15 | uint32_t GTE_ReadCR(unsigned int which); 16 | uint32_t GTE_ReadDR(unsigned int which); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /mednafen/psx/input/dualanalog.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_DUALANALOG_H 2 | #define __MDFN_PSX_INPUT_DUALANALOG_H 3 | 4 | InputDevice *Device_DualAnalog_Create(bool joystick_mode); 5 | extern InputDeviceInputInfoStruct Device_DualAnalog_IDII[24]; 6 | extern InputDeviceInputInfoStruct Device_AnalogJoy_IDII[24]; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /mednafen/psx/input/dualshock.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_DUALSHOCK_H 2 | #define __MDFN_PSX_INPUT_DUALSHOCK_H 3 | 4 | #include 5 | 6 | InputDevice *Device_DualShock_Create(const std::string &name); 7 | extern InputDeviceInputInfoStruct Device_DualShock_IDII[26]; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /mednafen/psx/input/gamepad.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_GAMEPAD_H 2 | #define __MDFN_PSX_INPUT_GAMEPAD_H 3 | 4 | InputDevice *Device_Gamepad_Create(void); 5 | extern InputDeviceInputInfoStruct Device_Gamepad_IDII[16]; 6 | extern InputDeviceInputInfoStruct Device_Dancepad_IDII[16]; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /mednafen/psx/input/guncon.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_GUNCON_H 2 | #define __MDFN_PSX_INPUT_GUNCON_H 3 | 4 | InputDevice *Device_GunCon_Create(void); 5 | extern InputDeviceInputInfoStruct Device_GunCon_IDII[6]; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /mednafen/psx/input/justifier.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_JUSTIFIER_H 2 | #define __MDFN_PSX_INPUT_JUSTIFIER_H 3 | 4 | InputDevice *Device_Justifier_Create(void); 5 | extern InputDeviceInputInfoStruct Device_Justifier_IDII[6]; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /mednafen/psx/input/memcard.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_MEMCARD_H 2 | #define __MDFN_PSX_INPUT_MEMCARD_H 3 | 4 | InputDevice *Device_Memcard_Create(void); 5 | void Device_Memcard_Power(InputDevice* memcard); 6 | void Device_Memcard_Format(InputDevice *memcard); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /mednafen/psx/input/mouse.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_MOUSE_H 2 | #define __MDFN_PSX_INPUT_MOUSE_H 3 | 4 | InputDevice *Device_Mouse_Create(void); 5 | extern InputDeviceInputInfoStruct Device_Mouse_IDII[4]; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /mednafen/psx/input/multitap.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_MULTITAP_H 2 | #define __MDFN_PSX_INPUT_MULTITAP_H 3 | 4 | class InputDevice_Multitap : public InputDevice 5 | { 6 | public: 7 | 8 | InputDevice_Multitap(); 9 | virtual ~InputDevice_Multitap(); 10 | virtual void Power(void); 11 | virtual int StateAction(StateMem* sm, int load, int data_only, const char* section_name); 12 | 13 | void SetSubDevice(unsigned int sub_index, InputDevice *device, InputDevice *mc_device); 14 | 15 | // 16 | // 17 | // 18 | virtual void SetDTR(bool new_dtr); 19 | virtual bool GetDSR(void); 20 | virtual bool Clock(bool TxD, int32 &dsr_pulse_delay); 21 | 22 | private: 23 | 24 | InputDevice *pad_devices[4]; 25 | InputDevice *mc_devices[4]; 26 | 27 | bool dtr; 28 | 29 | int selected_device; 30 | bool full_mode_setting; 31 | 32 | bool full_mode; 33 | bool mc_mode; 34 | bool prev_fm_success; 35 | 36 | uint8 fm_dp; // Device-present. 37 | uint8 fm_buffer[4][8]; 38 | 39 | uint8 sb[4][8]; 40 | 41 | bool fm_command_error; 42 | 43 | uint8 command; 44 | uint8 receive_buffer; 45 | uint8 bit_counter; 46 | uint8 byte_counter; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /mednafen/psx/input/negcon.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_NEGCON_H 2 | #define __MDFN_PSX_INPUT_NEGCON_H 3 | 4 | InputDevice *Device_neGcon_Create(void); 5 | extern InputDeviceInputInfoStruct Device_neGcon_IDII[21]; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /mednafen/psx/input/negconrumble.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_INPUT_NEGCONRUMBLE_H 2 | #define __MDFN_PSX_INPUT_NEGCONRUMBLE_H 3 | 4 | #include 5 | 6 | InputDevice *Device_neGconRumble_Create(const std::string &name); 7 | extern InputDeviceInputInfoStruct Device_neGconRumble_IDII[22]; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /mednafen/psx/irq.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_IRQ_H 2 | #define __MDFN_PSX_IRQ_H 3 | 4 | #include 5 | 6 | enum 7 | { 8 | IRQ_VBLANK = 0, 9 | IRQ_GPU = 1, 10 | IRQ_CD = 2, 11 | IRQ_DMA = 3, 12 | IRQ_TIMER_0 = 4, 13 | IRQ_TIMER_1 = 5, 14 | IRQ_TIMER_2 = 6, 15 | IRQ_SIO = 7, 16 | IRQ_SPU = 9, 17 | IRQ_PIO = 10 18 | }; 19 | 20 | enum 21 | { 22 | IRQ_GSREG_ASSERTED = 0, 23 | IRQ_GSREG_STATUS = 1, 24 | IRQ_GSREG_MASK = 2 25 | }; 26 | 27 | void IRQ_Power(void); 28 | void IRQ_Assert(int which, bool asserted); 29 | 30 | void IRQ_Write(uint32_t A, uint32_t V); 31 | uint32_t IRQ_Read(uint32_t A); 32 | 33 | uint32_t IRQ_GetRegister(unsigned int which, char *special, const uint32_t special_len); 34 | void IRQ_SetRegister(unsigned int which, uint32_t value); 35 | 36 | int IRQ_StateAction(void *data, int load, int data_only); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /mednafen/psx/mdec.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_MDEC_H 2 | #define __MDFN_PSX_MDEC_H 3 | 4 | void MDEC_DMAWrite(uint32_t V); 5 | 6 | uint32_t MDEC_DMARead(uint32_t *offs); 7 | 8 | void MDEC_Write(const int32_t timestamp, uint32_t A, uint32_t V); 9 | uint32_t MDEC_Read(const int32_t timestamp, uint32_t A); 10 | 11 | void MDEC_Power(void); 12 | 13 | bool MDEC_DMACanWrite(void); 14 | bool MDEC_DMACanRead(void); 15 | void MDEC_Run(int32 clocks); 16 | 17 | int MDEC_StateAction(StateMem *sm, int load, int data_only); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /mednafen/psx/notes/NOTES: -------------------------------------------------------------------------------- 1 | Capcom games(MMX4, MMX5, etc) - Sensitive about CD access and XA timing(XA playback problems). 2 | 3 | Viewpoint - Extra-sensitive about GPU LL DMA timing? (It was generating exceptions for some timings...) 4 | -------------------------------------------------------------------------------- /mednafen/psx/notes/SOURCES: -------------------------------------------------------------------------------- 1 | Sources of helpful information used in PS1 emulation(though some of it, especially older compiled information, 2 | is wrong to some degree or incomplete, but it's still useful): 3 | 4 | PCSX(and derivatives/forks) 5 | MAME/MESS 6 | P.E.Op.S 7 | 8 | Blade Lib 9 | psxsdk 10 | 11 | doomed's PSX documents 12 | bITmASTER's document 13 | Neill Corlett's SPU documents 14 | T.Fujita's SIO documents 15 | ChrlyMac 16 | Exophase 17 | mizvekov 18 | notaz 19 | pSXAuthor 20 | smf(blog) 21 | shalma(forum posts, changelogs) 22 | drhell's site 23 | jac's CD-XA document 24 | "The PlayStation 1 Video (STR) Format" - M. Sabin 25 | Various PS1 emulator compatibility lists(for identifying problematic games) 26 | 27 | 28 | MIPS RISC Architecture - Gerry Kane (1st and 2nd editions) 29 | MIPS Programmer's Handbook, The 30 | 31 | ----------- 32 | General(non-PS1-specific) CD/CDROM information and code: 33 | 34 | SCSI-3 Multimedia Commands Revision 10A 35 | ECMA-130 36 | 37 | cdrdao 38 | dvdisaster 39 | -------------------------------------------------------------------------------- /mednafen/psx/notes/SPU-IRQ: -------------------------------------------------------------------------------- 1 | Castlevania Chronicles - Music. 2 | Chrono Cross - FMV. 3 | Dance Dance Revolution - Gameplay music. 4 | Dance Dance Revolution: Disney Mix - Gameplay music. 5 | Eithea - Sneaky evil usage, along with manual loop address override abuse. 6 | Koudelka 7 | Legend of Mana - FMV(really finicky about DMA timing). 8 | Medal of Honor 9 | Misadventures of Tron Bonne - Dialogue. 10 | Nicktoons Racing - FMV, gameplay music. 11 | Tales of Destiny - Battle voices. Japanese version 1.0 is particularly sensitive to how SPU IRQs are emulated, and tends to lock up after Mary's "Moushuuken" is used if emulated improperly. 12 | Thousand Arms - Dialogue. 13 | Um Jammer Lammy 14 | Valkyrie Profile - Used extensively for dialogue, in-battle and out. 15 | Wing Commander 4 - FMV. 16 | -------------------------------------------------------------------------------- /mednafen/psx/notes/tristep.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef int8_t int8; 6 | typedef int16_t int16; 7 | typedef int32_t int32; 8 | typedef int64_t int64; 9 | 10 | typedef uint8_t uint8; 11 | typedef uint16_t uint16; 12 | typedef uint32_t uint32; 13 | typedef uint64_t uint64; 14 | 15 | #define INLINE inline 16 | 17 | static INLINE int64 MakePolyXFP(int32 x) 18 | { 19 | return ((int64)x << 32) + ((1LL << 32) - (1 << 11)); 20 | } 21 | 22 | static INLINE int64 MakePolyXFPStep(int32 dx, int32 dy) 23 | { 24 | int64 ret; 25 | int64 dx_ex = (int64)dx << 32; 26 | 27 | if(dx_ex < 0) 28 | dx_ex -= dy - 1; 29 | 30 | if(dx_ex > 0) 31 | dx_ex += dy - 1; 32 | 33 | ret = dx_ex / dy; 34 | 35 | return(ret); 36 | } 37 | 38 | static INLINE int32 GetPolyXFP_Int(int64 xfp) 39 | { 40 | return(xfp >> 32); 41 | } 42 | 43 | 44 | // Test X delta of -1023 ... 1023 45 | // Test Y delta of 1 ... 511 46 | int main() 47 | { 48 | for(int xbase = -1; xbase < 1025; xbase += 1025) 49 | { 50 | for(int dx = -1023; dx <= 1023; dx++) 51 | { 52 | for(int dy = 1; dy <= 511; dy++) 53 | { 54 | int64 x_coord, x_step; 55 | int32 alt_x_coord; 56 | int32 alt_x_error; 57 | 58 | x_coord = MakePolyXFP(xbase); 59 | x_step = MakePolyXFPStep(dx, dy); 60 | 61 | alt_x_coord = xbase; 62 | 63 | if(dx >= 0) 64 | alt_x_error = dy - 1; 65 | else 66 | alt_x_error = 0; 67 | 68 | for(int step = 0; step < dy; step++) 69 | { 70 | if(GetPolyXFP_Int(x_coord) != alt_x_coord) 71 | { 72 | printf("xbase=%d, dx=%d, dy=%d, step=%d --- xfpx=%d, altx=%d\n", xbase, dx, dy, step, GetPolyXFP_Int(x_coord), alt_x_coord); 73 | } 74 | x_coord += x_step; 75 | 76 | alt_x_error += abs(dx); 77 | while(alt_x_error >= dy) 78 | { 79 | if(dx < 0) 80 | alt_x_coord--; 81 | else 82 | alt_x_coord++; 83 | alt_x_error -= dy; 84 | } 85 | } 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /mednafen/psx/sio.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_SIO_H 2 | #define __MDFN_PSX_SIO_H 3 | 4 | #include 5 | 6 | void SIO_Write(int32_t timestamp, uint32_t A, uint32_t V); 7 | uint32_t SIO_Read(int32_t timestamp, uint32_t A); 8 | void SIO_Power(void); 9 | 10 | int SIO_StateAction(void *data, int load, int data_only); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /mednafen/psx/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef __MDFN_PSX_TIMER_H 2 | #define __MDFN_PSX_TIMER_H 3 | 4 | #include 5 | 6 | enum 7 | { 8 | TIMER_GSREG_COUNTER0 = 0x00, 9 | TIMER_GSREG_MODE0, 10 | TIMER_GSREG_TARGET0, 11 | 12 | TIMER_GSREG_COUNTER1 = 0x10, 13 | TIMER_GSREG_MODE1, 14 | TIMER_GSREG_TARGET1, 15 | 16 | TIMER_GSREG_COUNTER2 = 0x20, 17 | TIMER_GSREG_MODE2, 18 | TIMER_GSREG_TARGET2 19 | }; 20 | 21 | uint32_t TIMER_GetRegister(unsigned int which, char *special, const uint32_t special_len); 22 | void TIMER_SetRegister(unsigned int which, uint32_t value); 23 | 24 | 25 | void MDFN_FASTCALL TIMER_Write(const int32_t timestamp, uint32_t A, uint16_t V); 26 | uint16_t MDFN_FASTCALL TIMER_Read(const int32_t timestamp, uint32_t A); 27 | 28 | void MDFN_FASTCALL TIMER_AddDotClocks(uint32_t count); 29 | void TIMER_ClockHRetrace(void); 30 | void MDFN_FASTCALL TIMER_SetHRetrace(bool status); 31 | void MDFN_FASTCALL TIMER_SetVBlank(bool status); 32 | 33 | int32_t MDFN_FASTCALL TIMER_Update(const int32_t); 34 | void TIMER_ResetTS(void); 35 | 36 | void TIMER_Power(void) MDFN_COLD; 37 | int TIMER_StateAction(void *sm, const unsigned load, const bool data_only); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /mednafen/settings.h: -------------------------------------------------------------------------------- 1 | #ifndef MDFN_SETTINGS_H 2 | #define MDFN_SETTINGS_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | extern uint32_t setting_psx_multitap_port_1; 14 | extern uint32_t setting_psx_multitap_port_2; 15 | extern uint32_t setting_psx_analog_toggle; 16 | extern uint32_t setting_psx_fastboot; 17 | extern int setting_initial_scanline; 18 | extern int setting_initial_scanline_pal; 19 | extern int setting_last_scanline; 20 | extern int setting_last_scanline_pal; 21 | extern int setting_crosshair_color_p1; 22 | extern int setting_crosshair_color_p2; 23 | 24 | /* This should assert() or something if the setting isn't found, 25 | * since it would be a totally tubular error! */ 26 | uint64_t MDFN_GetSettingUI(const char *name); 27 | int64_t MDFN_GetSettingI(const char *name); 28 | bool MDFN_GetSettingB(const char *name); 29 | const char *MDFN_GetSettingS(const char *name); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /mednafen/state.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATE_H 2 | #define _STATE_H 3 | 4 | #include 5 | #include 6 | 7 | typedef struct 8 | { 9 | uint8_t *data; 10 | uint32_t loc; 11 | uint32_t len; 12 | uint32_t malloced; 13 | uint32_t initial_malloc; /* A setting! */ 14 | } StateMem; 15 | 16 | typedef struct 17 | { 18 | void *v; /* Pointer to the variable/array */ 19 | uint32_t size; /* Length, in bytes, of the data to be saved EXCEPT: 20 | * In the case of MDFNSTATE_BOOL, 21 | * it is the number of bool elements to save 22 | * (bool is not always 1-byte). 23 | * If 0, the subchunk isn't saved. */ 24 | uint32_t flags; /* Flags */ 25 | const char *name; /* Name */ 26 | } SFORMAT; 27 | 28 | /* State-Section Descriptor */ 29 | struct SSDescriptor 30 | { 31 | SFORMAT *sf; 32 | const char *name; 33 | bool optional; 34 | }; 35 | 36 | /* Flag for a single, >= 1 byte native-endian variable */ 37 | #define MDFNSTATE_RLSB 0x80000000 38 | /* 32-bit native-endian elements */ 39 | #define MDFNSTATE_RLSB32 0x40000000 40 | /* 16-bit native-endian elements */ 41 | #define MDFNSTATE_RLSB16 0x20000000 42 | /* 64-bit native-endian elements */ 43 | #define MDFNSTATE_RLSB64 0x10000000 44 | 45 | #define MDFNSTATE_BOOL 0x08000000 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | int MDFNSS_SaveSM(void *st, int a, int b, const void *c, const void *d, const void *e); 52 | int MDFNSS_LoadSM(void *st, int a, int b); 53 | 54 | int MDFNSS_StateAction(void *st, int load, int data_only, 55 | SFORMAT *sf, const char *name); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /mednafen/tremor/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002, Xiph.org Foundation 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the Xiph.org Foundation nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /mednafen/tremor/block.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: shared block functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_BLOCK_ 19 | #define _V_BLOCK_ 20 | 21 | extern void _vorbis_block_ripcord(vorbis_block *vb); 22 | extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mednafen/tremor/mdct.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: modified discrete cosine transform prototypes 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _OGG_mdct_H_ 19 | #define _OGG_mdct_H_ 20 | 21 | #include "ivorbiscodec.h" 22 | #include "misc.h" 23 | 24 | #define DATA_TYPE int32_t 25 | #define REG_TYPE register int32_t 26 | 27 | #ifdef _LOW_ACCURACY_ 28 | #define cPI3_8 (0x0062) 29 | #define cPI2_8 (0x00b5) 30 | #define cPI1_8 (0x00ed) 31 | #else 32 | #define cPI3_8 (0x30fbc54d) 33 | #define cPI2_8 (0x5a82799a) 34 | #define cPI1_8 (0x7641af3d) 35 | #endif 36 | 37 | extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out); 38 | extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out); 39 | 40 | #endif 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /mednafen/tremor/os.h: -------------------------------------------------------------------------------- 1 | #ifndef _OS_H 2 | #define _OS_H 3 | /******************************************************************** 4 | * * 5 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 6 | * * 7 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 8 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 9 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 10 | * * 11 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 12 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 13 | * * 14 | ******************************************************************** 15 | 16 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 17 | 18 | ********************************************************************/ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #ifndef M_PI 26 | # define M_PI (3.1415926536f) 27 | #endif 28 | 29 | #ifdef _WIN32 30 | # include 31 | # define rint(x) (floor((x)+0.5f)) 32 | # define NO_FLOAT_MATH_LIB 33 | # define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b)) 34 | #endif 35 | 36 | #ifdef HAVE_ALLOCA_H 37 | # include 38 | #endif 39 | 40 | #ifdef USE_MEMORY_H 41 | # include 42 | #endif 43 | 44 | #endif /* _OS_H */ 45 | -------------------------------------------------------------------------------- /mednafen/tremor/registry.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #include "ivorbiscodec.h" 19 | #include "codec_internal.h" 20 | #include "registry.h" 21 | #include "misc.h" 22 | 23 | 24 | /* seems like major overkill now; the backend numbers will grow into 25 | the infrastructure soon enough */ 26 | 27 | extern vorbis_func_floor floor0_exportbundle; 28 | extern vorbis_func_floor floor1_exportbundle; 29 | extern vorbis_func_residue residue0_exportbundle; 30 | extern vorbis_func_residue residue1_exportbundle; 31 | extern vorbis_func_residue residue2_exportbundle; 32 | extern vorbis_func_mapping mapping0_exportbundle; 33 | 34 | vorbis_func_floor *_floor_P[]={ 35 | &floor0_exportbundle, 36 | &floor1_exportbundle, 37 | }; 38 | 39 | vorbis_func_residue *_residue_P[]={ 40 | &residue0_exportbundle, 41 | &residue1_exportbundle, 42 | &residue2_exportbundle, 43 | }; 44 | 45 | vorbis_func_mapping *_mapping_P[]={ 46 | &mapping0_exportbundle, 47 | }; 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /mednafen/tremor/registry.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for time, floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_REG_H_ 19 | #define _V_REG_H_ 20 | 21 | #define VI_TRANSFORMB 1 22 | #define VI_WINDOWB 1 23 | #define VI_TIMEB 1 24 | #define VI_FLOORB 2 25 | #define VI_RESB 3 26 | #define VI_MAPB 1 27 | 28 | #include "backends.h" 29 | 30 | #if defined(_WIN32) && defined(VORBISDLL_IMPORT) 31 | # define EXTERN __declspec(dllimport) extern 32 | #else 33 | # define EXTERN extern 34 | #endif 35 | 36 | EXTERN vorbis_func_floor *_floor_P[]; 37 | EXTERN vorbis_func_residue *_residue_P[]; 38 | EXTERN vorbis_func_mapping *_mapping_P[]; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /mednafen/tremor/window.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_WINDOW_ 19 | #define _V_WINDOW_ 20 | 21 | extern const void *_vorbis_window(int type,int left); 22 | extern void _vorbis_apply_window(int32_t *d,const void *window[2], 23 | long *blocksizes, 24 | int lW,int W,int nW); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /mednafen/video/Deinterlacer.h: -------------------------------------------------------------------------------- 1 | /* Mednafen - Multi-system Emulator 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef __MDFN_DEINTERLACER_H 19 | #define __MDFN_DEINTERLACER_H 20 | 21 | #include 22 | 23 | class Deinterlacer 24 | { 25 | public: 26 | 27 | Deinterlacer(); 28 | ~Deinterlacer(); 29 | 30 | enum 31 | { 32 | DEINT_BOB_OFFSET = 0, // Code will fall-through to this case under certain conditions, too. 33 | DEINT_BOB, 34 | DEINT_WEAVE, 35 | }; 36 | 37 | void SetType(unsigned t); 38 | inline unsigned GetType(void) 39 | { 40 | return(DeintType); 41 | } 42 | 43 | void Process(MDFN_Surface *surface, MDFN_Rect &DisplayRect, int32 *LineWidths, const bool field); 44 | 45 | void ClearState(void); 46 | 47 | private: 48 | 49 | template 50 | void InternalProcess(MDFN_Surface *surface, MDFN_Rect &DisplayRect, int32 *LineWidths, const bool field); 51 | 52 | MDFN_Surface *FieldBuffer; 53 | std::vector LWBuffer; 54 | bool StateValid; 55 | MDFN_Rect PrevDRect; 56 | unsigned DeintType; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /parallel-psx/COPYING: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2016, Tiny Tiger 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 8 | -------------------------------------------------------------------------------- /parallel-psx/custom-textures/config_parser.cpp: -------------------------------------------------------------------------------- 1 | #include "config_parser.h" 2 | #include 3 | #include 4 | #include 5 | 6 | int ignore_arg_to_number(std::string arg) { 7 | if (arg == "*") { 8 | return -1; 9 | } else { 10 | return atoi(arg.c_str()); 11 | } 12 | } 13 | 14 | std::vector parse_config_file(const char *path) { 15 | std::vector result; 16 | // https://stackoverflow.com/questions/7868936/read-file-line-by-line-using-ifstream-in-c 17 | std::string line; 18 | std::ifstream in(path); 19 | std::regex ignore_command("^\\s*ignore\\s+(\\d+|\\*)\\s*,\\s*(\\d+|\\*)\\s*,\\s*(\\d+|\\*)\\s*,\\s*(\\d+|\\*)\\s*(?:#.*)?$"); 20 | while (std::getline(in, line)) { 21 | std::smatch sm; 22 | if (std::regex_match(line, sm, ignore_command)) { 23 | result.push_back(PSX::RectMatch( 24 | ignore_arg_to_number(sm[1]), 25 | ignore_arg_to_number(sm[2]), 26 | ignore_arg_to_number(sm[3]), 27 | ignore_arg_to_number(sm[4]) 28 | )); 29 | } 30 | } 31 | return result; 32 | } -------------------------------------------------------------------------------- /parallel-psx/custom-textures/config_parser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../atlas/atlas.hpp" 4 | #include 5 | 6 | namespace PSX { 7 | class RectMatch { 8 | public: 9 | RectMatch(int x, int y, int w, int h): x(x), y(y), w(w), h(h) {} 10 | bool matches(Rect r) { 11 | return (x == -1 || x== r.x) && (y == -1 || y == r.y) && (w == -1 || w == r.width) && (h == -1 || h == r.height); 12 | } 13 | int x = -1; 14 | int y = -1; 15 | int w = -1; 16 | int h = -1; 17 | private: 18 | }; 19 | }; 20 | 21 | std::vector parse_config_file(const char *path); -------------------------------------------------------------------------------- /parallel-psx/custom-textures/dbg_input_callback.h: -------------------------------------------------------------------------------- 1 | #ifndef DBG_INPUT_CALLBACK_H 2 | #define DBG_INPUT_CALLBACK_H 3 | 4 | #include "libretro.h" 5 | extern retro_input_state_t dbg_input_state_cb; 6 | 7 | #endif -------------------------------------------------------------------------------- /parallel-psx/custom-textures/image_io.cpp: -------------------------------------------------------------------------------- 1 | #include "image_io.hpp" 2 | 3 | #define STB_IMAGE_WRITE_IMPLEMENTATION 4 | #include "../stb/stb_image_write.h" 5 | #define STB_IMAGE_IMPLEMENTATION 6 | #include "../stb/stb_image.h" 7 | 8 | RGBAImage::~RGBAImage() { 9 | if (this->data != nullptr) { 10 | stbi_image_free(this->data); 11 | } 12 | } 13 | 14 | std::unique_ptr load_image(const char *path) { 15 | auto ptr = std::unique_ptr(new RGBAImage); 16 | int channels; 17 | ptr->data = stbi_load(path, &ptr->width, &ptr->height, &channels, 4); 18 | return ptr; 19 | } 20 | bool write_image(const char *path, int width, int height, const void *data) { 21 | return stbi_write_png(path, width, height, 4, data, 4 * width); 22 | } -------------------------------------------------------------------------------- /parallel-psx/custom-textures/image_io.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct RGBAImage { 7 | uint8_t* data; 8 | int width; 9 | int height; 10 | 11 | ~RGBAImage(); 12 | }; 13 | 14 | std::unique_ptr load_image(const char *path); 15 | bool write_image(const char *path, int width, int height, const void *data); -------------------------------------------------------------------------------- /parallel-psx/format_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for file in vulkan/*.{cpp,hpp} vulkan/wsi/*.{cpp,hpp} *.cpp renderer/*.{cpp,hpp} atlas/*.{cpp,hpp} 4 | do 5 | echo "Formatting file: $file ..." 6 | clang-format -style=file -i $file 7 | done 8 | -------------------------------------------------------------------------------- /parallel-psx/glsl/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | ./rebuild_shaders.sh || exit 0 3 | -------------------------------------------------------------------------------- /parallel-psx/glsl/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | 4 | vec4 abgr1555(uint value) 5 | { 6 | // This rounding is very deliberate, we want 0b11111 to become 0b11111000 in UNORM. 7 | // We keep the msb/lsb separate to support palettes correctly as the msbs should be reinterpreted as 4x4 or 2x8 bits. 8 | // Overall, we get 10 bits of precision for RGB, weee! :3 9 | uvec4 msb = (uvec4(value) >> uvec4(0u, 5u, 10u, 15u)) & uvec4(31u, 31u, 31u, 1u); 10 | uvec3 lsb = (uvec3(value) >> uvec3(16u, 21u, 26u)) & uvec3(31u); 11 | uvec4 rgba = uvec4((msb.rgb << 5u) | lsb, msb.a); 12 | #define SCALING (1.0 / (4.0 * 255.0)) 13 | return vec4(rgba) * vec4(SCALING, SCALING, SCALING, 1.0); 14 | } 15 | 16 | uvec2 unpack2x16(uint x) 17 | { 18 | return uvec2(x & 0xffffu, x >> 16u); 19 | } 20 | 21 | uvec4 unpack4x8(uint x) 22 | { 23 | return (uvec4(x) >> uvec4(0u, 8u, 16u, 24u)) & 0xffu; 24 | } 25 | 26 | uint pack_abgr1555(vec4 value) 27 | { 28 | // This rounding is very deliberate, we want 0b11111 to become 0b11111000 in UNORM. 29 | // We keep the msb/lsb separate to support palettes correctly as the msbs should be reinterpreted as 4x4 or 2x8 bits. 30 | // Overall, we get 10 bits of precision for RGB, weee! :3 31 | #define INV_SCALING (4.0 * 255.0) 32 | 33 | // Need to make sure that we round so we can get a stable roundtrip with abgr1555 -> pack_abgr1555. 34 | uvec4 rgba = uvec4(round(clamp(value, vec4(0.0), vec4(1.0)) * vec4(INV_SCALING, INV_SCALING, INV_SCALING, 1.0))); 35 | uvec3 msb = rgba.rgb >> 5u; 36 | uvec3 lsb = rgba.rgb & 31u; 37 | return (msb.r << 0u) | (msb.g << 5u) | (msb.b << 10u) | (rgba.a << 15u) | (lsb.r << 16u) | (lsb.g << 21u) | (lsb.b << 26u); 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /parallel-psx/glsl/copy_vram.comp: -------------------------------------------------------------------------------- 1 | #version 450 2 | layout(local_size_x = 8, local_size_y = 8) in; 3 | layout(set = 0, binding = 0, r32ui) uniform uimage2D uFramebuffer; 4 | layout(set = 0, binding = 1) uniform usamplerBuffer uImage; 5 | 6 | layout(push_constant, std430) uniform Rect 7 | { 8 | uvec2 offset; 9 | uvec2 extent; 10 | uint view_offset; 11 | uint mask_or; 12 | } rect; 13 | 14 | void main() 15 | { 16 | if (all(lessThan(gl_GlobalInvocationID.xy, rect.extent))) 17 | { 18 | uint value = texelFetch(uImage, 19 | int(rect.view_offset + rect.extent.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x)).x; 20 | uvec2 coord = (gl_GlobalInvocationID.xy + rect.offset) & uvec2(1023u, 511u); 21 | #ifdef MASKED 22 | uint fbvalue = imageLoad(uFramebuffer, ivec2(coord)).x; 23 | if ((fbvalue & 0x8000u) == 0u) 24 | imageStore(uFramebuffer, ivec2(coord), uvec4(value | rect.mask_or)); 25 | #else 26 | imageStore(uFramebuffer, ivec2(coord), uvec4(value | rect.mask_or)); 27 | #endif 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /parallel-psx/glsl/dither.h: -------------------------------------------------------------------------------- 1 | #ifndef DITHER_H_ 2 | #define DITHER_H_ 3 | 4 | layout(set = 0, binding = 2) uniform mediump sampler2D uDitherLUT; 5 | layout(set = 0, binding = 3, std140) uniform DitherInfo 6 | { 7 | float range; 8 | float inv_range; 9 | float dither_scale; 10 | int dither_shift; 11 | } dither_info; 12 | 13 | mediump vec3 apply_dither(mediump vec3 color, ivec2 coord) 14 | { 15 | ivec2 wrapped_coord = (coord >> dither_info.dither_shift) & 3; // Dither LUT is 4x4. 16 | mediump float dither = texelFetch(uDitherLUT, wrapped_coord, 0).x * dither_info.dither_scale; 17 | mediump vec3 scaled_color = (color + dither) * dither_info.range; 18 | // Dither LUT is UNORM, round down here is equivalent to +/- dither and round-to-nearest. 19 | mediump vec3 rounded_color = floor(scaled_color); 20 | return rounded_color * dither_info.inv_range; 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /parallel-psx/glsl/mipmap.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | layout(location = 0) in vec2 Position; 3 | layout(location = 0) out vec2 vUV; 4 | 5 | layout(push_constant, std430) uniform Registers 6 | { 7 | vec2 offset; 8 | vec2 range; 9 | } registers; 10 | 11 | void main() 12 | { 13 | vec2 uv_range = 0.5 * Position + 0.5; 14 | vec2 shifted = uv_range * registers.range + registers.offset; 15 | #ifdef SHIFT_QUAD 16 | vec2 pos = shifted * 2.0 - 1.0; 17 | gl_Position = vec4(pos, 0.0, 1.0); 18 | #else 19 | gl_Position = vec4(Position, 0.0, 1.0); 20 | #endif 21 | vUV = shifted; 22 | } 23 | -------------------------------------------------------------------------------- /parallel-psx/glsl/mipmap_blur.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | precision highp float; 3 | precision highp int; 4 | 5 | layout(location = 0) out float FragColor; 6 | layout(set = 0, binding = 0) uniform sampler2D uTexture; 7 | layout(location = 0) in vec2 vUV; 8 | 9 | layout(push_constant, std430) uniform Registers 10 | { 11 | vec2 offset; 12 | vec2 range; 13 | vec2 inv_resolution; 14 | vec2 uv_min; 15 | vec2 uv_max; 16 | } registers; 17 | 18 | void main() 19 | { 20 | float bias = 0.0; 21 | const float w0 = 0.25; 22 | const float w1 = 0.125; 23 | const float w2 = 0.0625; 24 | #define UV(x, y) clamp((vUV + vec2(x, y) / vec2(1024.0, 512.0)), registers.uv_min, registers.uv_max) 25 | bias += w2 * textureLod(uTexture, UV(-1.0, -1.0), 0.0).a; 26 | bias += w2 * textureLod(uTexture, UV(+1.0, -1.0), 0.0).a; 27 | bias += w2 * textureLod(uTexture, UV(-1.0, +1.0), 0.0).a; 28 | bias += w2 * textureLod(uTexture, UV(+1.0, +1.0), 0.0).a; 29 | bias += w1 * textureLod(uTexture, UV( 0.0, -1.0), 0.0).a; 30 | bias += w1 * textureLod(uTexture, UV(-1.0, 0.0), 0.0).a; 31 | bias += w1 * textureLod(uTexture, UV(+1.0, 0.0), 0.0).a; 32 | bias += w1 * textureLod(uTexture, UV( 0.0, +1.0), 0.0).a; 33 | bias += w0 * textureLod(uTexture, UV( 0.0, 0.0), 0.0).a; 34 | FragColor = bias; 35 | } 36 | -------------------------------------------------------------------------------- /parallel-psx/glsl/mipmap_resolve.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | precision highp float; 3 | precision highp int; 4 | 5 | #if defined(DITHER) 6 | #include "dither.h" 7 | #endif 8 | 9 | layout(location = 0) out vec4 FragColor; 10 | layout(set = 0, binding = 0) uniform sampler2D uTexture; 11 | layout(set = 0, binding = 1) uniform sampler2D uLOD; 12 | layout(location = 0) in vec2 vUV; 13 | 14 | layout(push_constant, std430) uniform Registers 15 | { 16 | vec2 offset; 17 | vec2 range; 18 | vec2 uv_min; 19 | vec2 uv_max; 20 | float max_bias; 21 | } registers; 22 | 23 | void main() 24 | { 25 | vec2 lod_uv = clamp(vUV, registers.uv_min, registers.uv_max); 26 | float b = textureLod(uLOD, lod_uv, 0.0).x; 27 | mediump vec3 rgb = textureLod(uTexture, lod_uv, registers.max_bias * b).rgb; 28 | #if defined(DITHER) 29 | rgb = apply_dither(rgb, ivec2(gl_FragCoord.xy)); 30 | #endif 31 | FragColor = vec4(rgb, 1.0); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /parallel-psx/glsl/primitive.h: -------------------------------------------------------------------------------- 1 | #ifndef PRIMITIVE_H 2 | #define PRIMITIVE_H 3 | 4 | layout(location = 0) in mediump vec4 vColor; 5 | #ifdef TEXTURED 6 | #include "vram.h" 7 | #endif 8 | layout(location = 0) out vec4 FragColor; 9 | layout(set = 0, binding = 2) uniform sampler2D uDitherLUT; 10 | 11 | #if 0 12 | vec3 quantize_bgr555(vec3 color) 13 | { 14 | return round(color * 31.0) / 31.0; 15 | } 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /parallel-psx/glsl/primitive.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 Position; 4 | layout(location = 1) in vec4 Color; 5 | #ifdef TEXTURED 6 | layout(location = 2) in mediump uvec4 Window; 7 | layout(location = 3) in mediump ivec3 Param; 8 | layout(location = 4) in ivec4 UV; 9 | layout(location = 5) in mediump uvec4 UVRange; 10 | 11 | layout(location = 1) out mediump vec2 vUV; 12 | layout(location = 2) flat out mediump ivec3 vParam; 13 | layout(location = 3) flat out mediump ivec2 vBaseUV; 14 | layout(location = 4) flat out mediump ivec4 vWindow; 15 | layout(location = 5) flat out mediump ivec4 vTexLimits; 16 | #endif 17 | layout(location = 0) out mediump vec4 vColor; 18 | 19 | const vec2 FB_SIZE = vec2(1024.0, 512.0); 20 | //const vec4 texture_limits = vec4(0.0, 0.0, 1024.0, 1024.0); 21 | 22 | layout(constant_id = 5) const int OFFSET_UV = 0; 23 | 24 | void main() 25 | { 26 | vec2 off = vec2(0.5, 0.5); 27 | #ifdef UNSCALED 28 | gl_Position = vec4((Position.xy + off) / FB_SIZE * 2.0 - 1.0, Position.z, 1.0) * Position.w; 29 | #else 30 | gl_Position = vec4(Position.xy / FB_SIZE * 2.0 - 1.0, Position.z, 1.0) * Position.w; 31 | #endif 32 | vColor = Color; 33 | #ifdef TEXTURED 34 | // iCB: Offset UVs by half a pixel to account for rounding errors in projection 35 | #ifdef UNSCALED 36 | vUV = vec2(UV.xy) + off; 37 | #else 38 | if (OFFSET_UV > 0) 39 | vUV = vec2(UV.xy) + off; 40 | else 41 | vUV = vec2(UV.xy); 42 | #endif 43 | vParam = Param; 44 | vBaseUV = UV.zw; 45 | vWindow = ivec4(Window); 46 | vTexLimits = ivec4(UVRange); 47 | #endif 48 | } 49 | -------------------------------------------------------------------------------- /parallel-psx/glsl/quad.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec2 Position; 4 | layout(location = 0) out vec2 vUV; 5 | 6 | layout(push_constant, std430) uniform Registers 7 | { 8 | vec2 offset; 9 | vec2 range; 10 | } registers; 11 | 12 | void main() 13 | { 14 | vec2 uv_range = 0.5 * Position + 0.5; 15 | vec2 shifted = uv_range * registers.range + registers.offset; 16 | gl_Position = vec4(Position, 0.0, 1.0); 17 | vUV = shifted; 18 | } 19 | -------------------------------------------------------------------------------- /parallel-psx/khronos/include/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2018 The Khronos Group Inc. 6 | ** 7 | ** Licensed under the Apache License, Version 2.0 (the "License"); 8 | ** you may not use this file except in compliance with the License. 9 | ** You may obtain a copy of the License at 10 | ** 11 | ** http://www.apache.org/licenses/LICENSE-2.0 12 | ** 13 | ** Unless required by applicable law or agreed to in writing, software 14 | ** distributed under the License is distributed on an "AS IS" BASIS, 15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | ** See the License for the specific language governing permissions and 17 | ** limitations under the License. 18 | */ 19 | 20 | #include "vk_platform.h" 21 | #include "vulkan_core.h" 22 | 23 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 24 | #include "vulkan_android.h" 25 | #endif 26 | 27 | #ifdef VK_USE_PLATFORM_FUCHSIA 28 | #include 29 | #include "vulkan_fuchsia.h" 30 | #endif 31 | 32 | #ifdef VK_USE_PLATFORM_IOS_MVK 33 | #include "vulkan_ios.h" 34 | #endif 35 | 36 | 37 | #ifdef VK_USE_PLATFORM_MACOS_MVK 38 | #include "vulkan_macos.h" 39 | #endif 40 | 41 | 42 | #ifdef VK_USE_PLATFORM_VI_NN 43 | #include "vulkan_vi.h" 44 | #endif 45 | 46 | 47 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 48 | #include 49 | #include "vulkan_wayland.h" 50 | #endif 51 | 52 | 53 | #ifdef VK_USE_PLATFORM_WIN32_KHR 54 | #include 55 | #include "vulkan_win32.h" 56 | #endif 57 | 58 | 59 | #ifdef VK_USE_PLATFORM_XCB_KHR 60 | #include 61 | #include "vulkan_xcb.h" 62 | #endif 63 | 64 | 65 | #ifdef VK_USE_PLATFORM_XLIB_KHR 66 | #include 67 | #include "vulkan_xlib.h" 68 | #endif 69 | 70 | 71 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 72 | #include 73 | #include 74 | #include "vulkan_xlib_xrandr.h" 75 | #endif 76 | 77 | #endif // VULKAN_H_ 78 | -------------------------------------------------------------------------------- /parallel-psx/khronos/include/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | ** Copyright (c) 2015-2018 The Khronos Group Inc. 10 | ** 11 | ** Licensed under the Apache License, Version 2.0 (the "License"); 12 | ** you may not use this file except in compliance with the License. 13 | ** You may obtain a copy of the License at 14 | ** 15 | ** http://www.apache.org/licenses/LICENSE-2.0 16 | ** 17 | ** Unless required by applicable law or agreed to in writing, software 18 | ** distributed under the License is distributed on an "AS IS" BASIS, 19 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | ** See the License for the specific language governing permissions and 21 | ** limitations under the License. 22 | */ 23 | 24 | /* 25 | ** This header is generated from the Khronos Vulkan XML API Registry. 26 | ** 27 | */ 28 | 29 | 30 | #define VK_MVK_ios_surface 1 31 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 2 32 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 33 | 34 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 35 | 36 | typedef struct VkIOSSurfaceCreateInfoMVK { 37 | VkStructureType sType; 38 | const void* pNext; 39 | VkIOSSurfaceCreateFlagsMVK flags; 40 | const void* pView; 41 | } VkIOSSurfaceCreateInfoMVK; 42 | 43 | 44 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 45 | 46 | #ifndef VK_NO_PROTOTYPES 47 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 48 | VkInstance instance, 49 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 50 | const VkAllocationCallbacks* pAllocator, 51 | VkSurfaceKHR* pSurface); 52 | #endif 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /parallel-psx/khronos/include/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | ** Copyright (c) 2015-2018 The Khronos Group Inc. 10 | ** 11 | ** Licensed under the Apache License, Version 2.0 (the "License"); 12 | ** you may not use this file except in compliance with the License. 13 | ** You may obtain a copy of the License at 14 | ** 15 | ** http://www.apache.org/licenses/LICENSE-2.0 16 | ** 17 | ** Unless required by applicable law or agreed to in writing, software 18 | ** distributed under the License is distributed on an "AS IS" BASIS, 19 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | ** See the License for the specific language governing permissions and 21 | ** limitations under the License. 22 | */ 23 | 24 | /* 25 | ** This header is generated from the Khronos Vulkan XML API Registry. 26 | ** 27 | */ 28 | 29 | 30 | #define VK_MVK_macos_surface 1 31 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2 32 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 33 | 34 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 35 | 36 | typedef struct VkMacOSSurfaceCreateInfoMVK { 37 | VkStructureType sType; 38 | const void* pNext; 39 | VkMacOSSurfaceCreateFlagsMVK flags; 40 | const void* pView; 41 | } VkMacOSSurfaceCreateInfoMVK; 42 | 43 | 44 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 45 | 46 | #ifndef VK_NO_PROTOTYPES 47 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 48 | VkInstance instance, 49 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 50 | const VkAllocationCallbacks* pAllocator, 51 | VkSurfaceKHR* pSurface); 52 | #endif 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /parallel-psx/khronos/include/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | ** Copyright (c) 2015-2018 The Khronos Group Inc. 10 | ** 11 | ** Licensed under the Apache License, Version 2.0 (the "License"); 12 | ** you may not use this file except in compliance with the License. 13 | ** You may obtain a copy of the License at 14 | ** 15 | ** http://www.apache.org/licenses/LICENSE-2.0 16 | ** 17 | ** Unless required by applicable law or agreed to in writing, software 18 | ** distributed under the License is distributed on an "AS IS" BASIS, 19 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | ** See the License for the specific language governing permissions and 21 | ** limitations under the License. 22 | */ 23 | 24 | /* 25 | ** This header is generated from the Khronos Vulkan XML API Registry. 26 | ** 27 | */ 28 | 29 | 30 | #define VK_NN_vi_surface 1 31 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 32 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 33 | 34 | typedef VkFlags VkViSurfaceCreateFlagsNN; 35 | 36 | typedef struct VkViSurfaceCreateInfoNN { 37 | VkStructureType sType; 38 | const void* pNext; 39 | VkViSurfaceCreateFlagsNN flags; 40 | void* window; 41 | } VkViSurfaceCreateInfoNN; 42 | 43 | 44 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 45 | 46 | #ifndef VK_NO_PROTOTYPES 47 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 48 | VkInstance instance, 49 | const VkViSurfaceCreateInfoNN* pCreateInfo, 50 | const VkAllocationCallbacks* pAllocator, 51 | VkSurfaceKHR* pSurface); 52 | #endif 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /parallel-psx/stb/stb.c: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_IMPLEMENTATION 2 | #define STB_IMAGE_WRITE_IMPLEMENTATION 3 | #include "stb_image.h" 4 | #include "stb_image_write.h" 5 | 6 | -------------------------------------------------------------------------------- /parallel-psx/util/enum_cast.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | namespace Util 28 | { 29 | template 30 | constexpr typename std::underlying_type::type ecast(T x) 31 | { 32 | return static_cast::type>(x); 33 | } 34 | } -------------------------------------------------------------------------------- /parallel-psx/util/hashmap.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include "hash.hpp" 27 | 28 | namespace Util 29 | { 30 | struct UnityHasher 31 | { 32 | inline size_t operator()(uint64_t hash) const 33 | { 34 | return hash; 35 | } 36 | }; 37 | 38 | template 39 | using HashMap = std::unordered_map; 40 | } -------------------------------------------------------------------------------- /parallel-psx/util/stack_allocator.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | namespace Util 28 | { 29 | template 30 | class StackAllocator 31 | { 32 | public: 33 | T *allocate(size_t count) 34 | { 35 | if (count == 0) 36 | return nullptr; 37 | if (offset + count > N) 38 | return nullptr; 39 | 40 | T *ret = buffer + offset; 41 | offset += count; 42 | return ret; 43 | } 44 | 45 | T *allocate_cleared(size_t count) 46 | { 47 | T *ret = allocate(count); 48 | if (ret) 49 | std::fill(ret, ret + count, T()); 50 | return ret; 51 | } 52 | 53 | void reset() 54 | { 55 | offset = 0; 56 | } 57 | 58 | private: 59 | T buffer[N]; 60 | size_t offset = 0; 61 | }; 62 | } -------------------------------------------------------------------------------- /parallel-psx/util/timer.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | namespace Util 28 | { 29 | class FrameTimer 30 | { 31 | public: 32 | FrameTimer(); 33 | 34 | void reset(); 35 | double frame(); 36 | double frame(double frame_time); 37 | double get_elapsed() const; 38 | double get_frame_time() const; 39 | 40 | void enter_idle(); 41 | void leave_idle(); 42 | 43 | private: 44 | int64_t start; 45 | int64_t last; 46 | int64_t last_period; 47 | int64_t idle_start; 48 | int64_t idle_time = 0; 49 | int64_t get_time(); 50 | }; 51 | 52 | class Timer 53 | { 54 | public: 55 | void start(); 56 | double end(); 57 | 58 | private: 59 | int64_t t = 0; 60 | }; 61 | 62 | int64_t get_current_time_nsecs(); 63 | } -------------------------------------------------------------------------------- /parallel-psx/util/unstable_remove_if.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | namespace Util 28 | { 29 | template 30 | BidirectionalItr unstable_remove_if(BidirectionalItr first, BidirectionalItr last, UnaryPredicate &&p) 31 | { 32 | while (first != last) 33 | { 34 | if (p(*first)) 35 | { 36 | --last; 37 | std::swap(*first, *last); 38 | } 39 | else 40 | ++first; 41 | } 42 | 43 | return first; 44 | } 45 | } -------------------------------------------------------------------------------- /parallel-psx/vulkan/cookie.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "cookie.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | Cookie::Cookie(Device *device) 29 | : cookie(device->allocate_cookie()) 30 | { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/cookie.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include "hash.hpp" 27 | #include "intrusive_hash_map.hpp" 28 | 29 | namespace Vulkan 30 | { 31 | class Device; 32 | 33 | class Cookie 34 | { 35 | public: 36 | Cookie(Device *device); 37 | 38 | uint64_t get_cookie() const 39 | { 40 | return cookie; 41 | } 42 | 43 | private: 44 | uint64_t cookie; 45 | }; 46 | 47 | template 48 | using HashedObject = Util::IntrusiveHashMapEnabled; 49 | 50 | class InternalSyncEnabled 51 | { 52 | public: 53 | void set_internal_sync_object() 54 | { 55 | internal_sync = true; 56 | } 57 | 58 | protected: 59 | bool internal_sync = false; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/event_manager.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include "vulkan.hpp" 26 | #include 27 | 28 | namespace Vulkan 29 | { 30 | class Device; 31 | class EventManager 32 | { 33 | public: 34 | void init(Device *device); 35 | ~EventManager(); 36 | 37 | VkEvent request_cleared_event(); 38 | void recycle(VkEvent event); 39 | 40 | private: 41 | VkDevice device = VK_NULL_HANDLE; 42 | std::vector events; 43 | uint64_t workaround_counter = 0; 44 | bool workaround = false; 45 | }; 46 | } -------------------------------------------------------------------------------- /parallel-psx/vulkan/fence.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "fence.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | FenceHolder::~FenceHolder() 29 | { 30 | if (fence != VK_NULL_HANDLE) 31 | device->reset_fence(fence); 32 | } 33 | 34 | VkFence FenceHolder::get_fence() const 35 | { 36 | return fence; 37 | } 38 | 39 | void FenceHolder::wait() 40 | { 41 | if (vkWaitForFences(device->get_device(), 1, &fence, VK_TRUE, UINT64_MAX) != VK_SUCCESS) 42 | LOGE("Failed to wait for fence!\n"); 43 | } 44 | 45 | bool FenceHolder::wait_timeout(uint64_t timeout) 46 | { 47 | return vkWaitForFences(device->get_device(), 1, &fence, VK_TRUE, timeout) == VK_SUCCESS; 48 | } 49 | 50 | void FenceHolderDeleter::operator()(Vulkan::FenceHolder *fence) 51 | { 52 | fence->device->handle_pool.fences.free(fence); 53 | } 54 | } -------------------------------------------------------------------------------- /parallel-psx/vulkan/fence.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include "vulkan_common.hpp" 26 | #include "vulkan.hpp" 27 | #include "object_pool.hpp" 28 | 29 | namespace Vulkan 30 | { 31 | class Device; 32 | 33 | class FenceHolder; 34 | struct FenceHolderDeleter 35 | { 36 | void operator()(FenceHolder *fence); 37 | }; 38 | 39 | class FenceHolder : public Util::IntrusivePtrEnabled 40 | { 41 | public: 42 | friend struct FenceHolderDeleter; 43 | 44 | ~FenceHolder(); 45 | void wait(); 46 | 47 | bool wait_timeout(uint64_t nsec); 48 | 49 | VkFence get_fence() const; 50 | 51 | private: 52 | friend class Util::ObjectPool; 53 | FenceHolder(Device *device, VkFence fence) : device(device), fence(fence) 54 | { 55 | } 56 | 57 | Device *device; 58 | VkFence fence; 59 | }; 60 | 61 | using Fence = Util::IntrusivePtr; 62 | } 63 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/fence_manager.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "fence_manager.hpp" 24 | 25 | namespace Vulkan 26 | { 27 | void FenceManager::init(VkDevice device) 28 | { 29 | this->device = device; 30 | } 31 | 32 | VkFence FenceManager::request_cleared_fence() 33 | { 34 | if (!fences.empty()) 35 | { 36 | auto ret = fences.back(); 37 | fences.pop_back(); 38 | return ret; 39 | } 40 | else 41 | { 42 | VkFence fence; 43 | VkFenceCreateInfo info = { VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; 44 | vkCreateFence(device, &info, nullptr, &fence); 45 | return fence; 46 | } 47 | } 48 | 49 | void FenceManager::recycle_fence(VkFence fence) 50 | { 51 | fences.push_back(fence); 52 | } 53 | 54 | FenceManager::~FenceManager() 55 | { 56 | for (auto &fence : fences) 57 | vkDestroyFence(device, fence, nullptr); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/fence_manager.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include "vulkan.hpp" 26 | #include 27 | 28 | namespace Vulkan 29 | { 30 | class FenceManager 31 | { 32 | public: 33 | void init(VkDevice device); 34 | ~FenceManager(); 35 | 36 | VkFence request_cleared_fence(); 37 | void recycle_fence(VkFence fence); 38 | 39 | private: 40 | VkDevice device; 41 | std::vector fences; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/limits.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | namespace Vulkan 26 | { 27 | static const unsigned VULKAN_NUM_DESCRIPTOR_SETS = 4; 28 | static const unsigned VULKAN_NUM_BINDINGS = 16; 29 | static const unsigned VULKAN_NUM_ATTACHMENTS = 8; 30 | static const unsigned VULKAN_NUM_VERTEX_ATTRIBS = 16; 31 | static const unsigned VULKAN_NUM_VERTEX_BUFFERS = 4; 32 | static const unsigned VULKAN_PUSH_CONSTANT_SIZE = 128; 33 | static const unsigned VULKAN_UBO_SIZE = 16 * 1024; 34 | static const unsigned VULKAN_NUM_SPEC_CONSTANTS = 8; 35 | } 36 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/pipeline_event.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "pipeline_event.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | EventHolder::~EventHolder() 29 | { 30 | if (event) 31 | { 32 | if (internal_sync) 33 | device->destroy_event_nolock(event); 34 | else 35 | device->destroy_event(event); 36 | } 37 | } 38 | 39 | void EventHolderDeleter::operator()(Vulkan::EventHolder *event) 40 | { 41 | event->device->handle_pool.events.free(event); 42 | } 43 | } -------------------------------------------------------------------------------- /parallel-psx/vulkan/sampler.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "sampler.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | Sampler::Sampler(Device *device, VkSampler sampler, const SamplerCreateInfo &info) 29 | : Cookie(device) 30 | , device(device) 31 | , sampler(sampler) 32 | , create_info(info) 33 | { 34 | } 35 | 36 | Sampler::~Sampler() 37 | { 38 | if (sampler) 39 | { 40 | if (internal_sync) 41 | device->destroy_sampler_nolock(sampler); 42 | else 43 | device->destroy_sampler(sampler); 44 | } 45 | } 46 | 47 | void SamplerDeleter::operator()(Vulkan::Sampler *sampler) 48 | { 49 | sampler->device->handle_pool.samplers.free(sampler); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/semaphore.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "semaphore.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | SemaphoreHolder::~SemaphoreHolder() 29 | { 30 | if (semaphore) 31 | { 32 | if (internal_sync) 33 | { 34 | if (is_signalled()) 35 | device->destroy_semaphore_nolock(semaphore); 36 | else 37 | device->recycle_semaphore_nolock(semaphore); 38 | } 39 | else 40 | { 41 | if (is_signalled()) 42 | device->destroy_semaphore(semaphore); 43 | else 44 | device->recycle_semaphore(semaphore); 45 | } 46 | } 47 | } 48 | 49 | void SemaphoreHolderDeleter::operator()(Vulkan::SemaphoreHolder *semaphore) 50 | { 51 | semaphore->device->handle_pool.semaphores.free(semaphore); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/semaphore_manager.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include "vulkan.hpp" 26 | #include 27 | 28 | namespace Vulkan 29 | { 30 | class SemaphoreManager 31 | { 32 | public: 33 | void init(VkDevice device); 34 | ~SemaphoreManager(); 35 | 36 | VkSemaphore request_cleared_semaphore(); 37 | void recycle(VkSemaphore semaphore); 38 | 39 | private: 40 | VkDevice device = VK_NULL_HANDLE; 41 | std::vector semaphores; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /parallel-psx/vulkan/vulkan_common.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2018 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include "intrusive.hpp" 26 | #include "object_pool.hpp" 27 | #include "intrusive_hash_map.hpp" 28 | 29 | namespace Vulkan 30 | { 31 | #ifdef GRANITE_VULKAN_MT 32 | using HandleCounter = Util::MultiThreadCounter; 33 | #else 34 | using HandleCounter = Util::SingleThreadCounter; 35 | #endif 36 | 37 | #ifdef GRANITE_VULKAN_MT 38 | template 39 | using VulkanObjectPool = Util::ThreadSafeObjectPool; 40 | template 41 | using VulkanCache = Util::ThreadSafeIntrusiveHashMap; 42 | #else 43 | template 44 | using VulkanObjectPool = Util::ObjectPool; 45 | template 46 | using VulkanCache = Util::IntrusiveHashMap; 47 | #endif 48 | } -------------------------------------------------------------------------------- /pgxp/README.md: -------------------------------------------------------------------------------- 1 | Description based on iCatButler's original post: http://ngemu.com/threads/pcsxr-pgxp.186369/ 2 | 3 | ------- 4 | ## PGXP 5 | 6 | PGXP (Parallel/Precision Geometry Transform Pipeline) is an enhancement for PlayStation emulation that produces high precision fully 3D geometry data that was not available on the original console hardware. 7 | 8 | It is currently integrated with PCSX-Reloaded via Pete's OpenGL v1.78 plugin and Tapeq's Tweak extension to Pete's OpenGL v2.9 plugin, in addition to Beetle PSX 9 | 10 | Note: This project is still very much a work in progress. 11 | 12 | ### Features 13 | * High Precision Vertex Data (more stable geometry) 14 | * Reduced Triangle Culling (more detailed models) 15 | * Perspective Correct Texture Mapping (reduced texture distortion) 16 | 17 | Chrono Cross: Distortion of model geometry is significantly reduced, especially at a distance. 18 | 19 | 20 | Ridge Racer Type 4: Higher precision culling calculations mean that small triangles are no longer culled 21 | 22 | 23 | Tomb Raider: 3D vertex coordinates mean affine texture mapping can be replaced by perspective correct mapping 24 | 25 | 26 | ### Setup instructions 27 | In Beetle PSX, ensure you are using either the 'opengl' or 'vulkan' renderers. Then change the PGXP-related core options to your liking. 28 | 29 | **Thanks to:** 30 | 31 | Tapeq 32 | 33 | Pete Bernert 34 | 35 | Edgbla 36 | 37 | Simias 38 | 39 | The PCSX-R team 40 | 41 | And everyone who has provided feedback. 42 | -------------------------------------------------------------------------------- /pgxp/pgxp_main.c: -------------------------------------------------------------------------------- 1 | #include "pgxp_main.h" 2 | #include "pgxp_cpu.h" 3 | #include "pgxp_mem.h" 4 | #include "pgxp_gte.h" 5 | 6 | u32 static gMode = 0; 7 | 8 | void PGXP_Init() 9 | { 10 | PGXP_InitMem(); 11 | PGXP_InitCPU(); 12 | PGXP_InitGTE(); 13 | } 14 | 15 | void PGXP_SetModes(u32 modes) 16 | { 17 | gMode = modes; 18 | } 19 | 20 | u32 PGXP_GetModes() 21 | { 22 | return gMode; 23 | } 24 | 25 | void PGXP_EnableModes(u32 modes) 26 | { 27 | gMode |= modes; 28 | } 29 | 30 | void PGXP_DisableModes(u32 modes) 31 | { 32 | gMode = gMode & ~modes; 33 | } 34 | -------------------------------------------------------------------------------- /pgxp/pgxp_types.h: -------------------------------------------------------------------------------- 1 | #ifndef _PGXP_TYPES_H_ 2 | #define _PGXP_TYPES_H_ 3 | 4 | #include "stdint.h" 5 | 6 | typedef int8_t s8; 7 | typedef int16_t s16; 8 | typedef int32_t s32; 9 | typedef int64_t s64; 10 | typedef intptr_t sptr; 11 | 12 | typedef uint8_t u8; 13 | typedef uint16_t u16; 14 | typedef uint32_t u32; 15 | typedef uint64_t u64; 16 | typedef uintptr_t uptr; 17 | 18 | typedef struct PGXP_value_Tag 19 | { 20 | float x; 21 | float y; 22 | float z; 23 | union 24 | { 25 | unsigned int flags; 26 | unsigned char compFlags[4]; 27 | unsigned short halfFlags[2]; 28 | }; 29 | unsigned int count; 30 | unsigned int value; 31 | 32 | unsigned short gFlags; 33 | unsigned char lFlags; 34 | unsigned char hFlags; 35 | } PGXP_value; 36 | 37 | #endif//_PGXP_TYPES_H_ 38 | -------------------------------------------------------------------------------- /pgxp/pgxp_value.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pgxp_value.h" 4 | #include "limits.h" 5 | 6 | void SetValue(PGXP_value *pV, u32 psxV) 7 | { 8 | psx_value psx; 9 | psx.d = psxV; 10 | 11 | pV->x = psx.sw.l; 12 | pV->y = psx.sw.h; 13 | pV->z = 0.f; 14 | pV->flags = VALID_01; 15 | pV->value = psx.d; 16 | } 17 | 18 | void MakeValid(PGXP_value *pV, u32 psxV) 19 | { 20 | psx_value psx; 21 | psx.d = psxV; 22 | if (VALID_01 != (pV->flags & VALID_01)) 23 | { 24 | pV->x = psx.sw.l; 25 | pV->y = psx.sw.h; 26 | pV->z = 0.f; 27 | pV->flags |= VALID_01; 28 | pV->value = psx.d; 29 | } 30 | } 31 | 32 | void Validate(PGXP_value *pV, u32 psxV) 33 | { 34 | // assume pV is not NULL 35 | pV->flags &= (pV->value == psxV) ? ALL : INV_VALID_ALL; 36 | } 37 | 38 | void MaskValidate(PGXP_value *pV, u32 psxV, u32 mask, u32 validMask) 39 | { 40 | // assume pV is not NULL 41 | pV->flags &= ((pV->value & mask) == (psxV & mask)) ? ALL : (ALL ^ (validMask)); 42 | } 43 | 44 | u32 ValueToTolerance(PGXP_value *pV, u32 psxV, float tolerance) 45 | { 46 | psx_value psx; 47 | psx.d = psxV; 48 | u32 retFlags = VALID_ALL; 49 | 50 | if (fabs(pV->x - psx.sw.l) >= tolerance) 51 | retFlags = retFlags & (VALID_1 | VALID_2 | VALID_3); 52 | 53 | if (fabs(pV->y - psx.sw.h) >= tolerance) 54 | retFlags = retFlags & (VALID_0 | VALID_2 | VALID_3); 55 | 56 | return retFlags; 57 | } 58 | 59 | /// float logical arithmetic /// 60 | 61 | double f16Sign(double in) { u32 s = in * (double)((u32)1 << 16); return ((double)*((s32*)&s)) / (double)((s32)1 << 16); } 62 | double f16Unsign(double in) { return (in >= 0) ? in : ((double)in + (double)USHRT_MAX + 1); } 63 | double fu16Trunc(double in) { u32 u = in * (double)((u32)1 << 16); return (double)u / (double)((u32)1 << 16); } 64 | double f16Overflow(double in) 65 | { 66 | double out = 0; 67 | s64 v = ((s64)in) >> 16; 68 | out = v; 69 | return out; 70 | } 71 | -------------------------------------------------------------------------------- /rsx/README.md: -------------------------------------------------------------------------------- 1 | # RSX API and OpenGL 3.3 Renderer 2 | 3 | ## RSX API 4 | 5 | The RSX API is the means by which components of the Beetle PSX libretro core interface with the hardware renderers. The RSX API offers two general classes of functions for the core. The first class consists of various functions used to perform libretro-specific actions such as reading core options or preparing/finalizing the current emulation loop frame. The second class of functions consists of RSX interface functions that the emulated PSX GPU uses to issue commands to the hardware renderer. Not every emulated PSX GPU command has a corresponding RSX interface function, but the set of available functions can be extended or modified as necessary when bugs are discovered and higher accuracy is required. 6 | 7 | Each unique hardware renderer will implement RSX interface functions as another layer of function calls, typically but not necessarily one per RSX interface function. The RSX interface should then select the correct function to call based on the currently running hardware renderer. 8 | 9 | The RSX API also includes support for dumping RSX API calls to file, which can be utilized for debugging purposes by any renderers that implement RSX playback. 10 | 11 | ## OpenGL 3.3 Renderer 12 | 13 | The OpenGL renderer is currently implemented in `rsx_lib_gl.cpp` and can be called via the functions exposed in `rsx_lib_gl.h`. 14 | 15 | ## Building 16 | 17 | The RSX API and OpenGL renderer are components of the Beetle PSX libretro core. To build with OpenGL support, run `make HAVE_OPENGL=1` in the repository's top level directory. To build with all possible hardware renderers, instead run `make HAVE_HW=1`. To build with dump support, additionally pass `RSX_DUMP=1`. 18 | 19 | ## Coding Style 20 | 21 | The preferred coding style for the rsx subdirectory is the libretro coding style. See: https://docs.libretro.com/development/coding-standards/ 22 | 23 | ## Credits 24 | 25 | The OpenGL renderer was originally authored by simias as a port/plugin of Rustation's GL renderer to Beetle PSX. 26 | -------------------------------------------------------------------------------- /rsx/shaders_gl/image_load_fragment.glsl.h: -------------------------------------------------------------------------------- 1 | #include "shaders_common.h" 2 | 3 | static const char *image_load_fragment = GLSL_FRAGMENT( 4 | uniform sampler2D fb_texture; 5 | uniform uint internal_upscaling; 6 | in vec2 frag_fb_coord; 7 | out vec4 frag_color; 8 | 9 | // Read a pixel in VRAM 10 | vec4 vram_get_pixel(int x, int y) { 11 | return texelFetch(fb_texture, ivec2(x, y) * int(internal_upscaling), 0); 12 | } 13 | 14 | void main() { 15 | // GLES 5551 note: color reinterpretation can be done here 16 | frag_color = vram_get_pixel(int(frag_fb_coord.x), int(frag_fb_coord.y)); 17 | } 18 | ); 19 | -------------------------------------------------------------------------------- /rsx/shaders_gl/image_load_vertex.glsl.h: -------------------------------------------------------------------------------- 1 | #include "shaders_common.h" 2 | 3 | static const char *image_load_vertex = GLSL_VERTEX( 4 | // Vertex shader for uploading textures from the VRAM texture buffer 5 | // into the output framebuffer 6 | 7 | // The position in the input and output framebuffer are the same 8 | in uvec2 position; 9 | out vec2 frag_fb_coord; 10 | 11 | void main() { 12 | // Convert VRAM position into OpenGL coordinates 13 | float xpos = (float(position.x) / 512.) - 1.0; 14 | float ypos = (float(position.y) / 256.) - 1.0; 15 | 16 | gl_Position.xyzw = vec4(xpos, ypos, 0.0, 1.0); 17 | 18 | // frag_fb_coord will remain in PlayStation fb coordinates for 19 | // texelFetch 20 | frag_fb_coord = vec2(position); 21 | } 22 | ); 23 | -------------------------------------------------------------------------------- /rsx/shaders_gl/output_vertex.glsl.h: -------------------------------------------------------------------------------- 1 | #include "shaders_common.h" 2 | 3 | static const char *output_vertex = GLSL_VERTEX( 4 | // Vertex shader for rendering GPU draw commands in the framebuffer 5 | in vec2 position; 6 | in uvec2 fb_coord; 7 | 8 | out vec2 frag_fb_coord; 9 | 10 | void main() { 11 | gl_Position.xyzw = vec4(position, 0.0, 1.0); 12 | 13 | // Convert the PlayStation framebuffer coordinate into an OpenGL 14 | // texture coordinate 15 | float fb_x_coord = float(fb_coord.x) / 1024.; 16 | float fb_y_coord = float(fb_coord.y) / 512.; 17 | 18 | frag_fb_coord = vec2(fb_x_coord, fb_y_coord); 19 | } 20 | ); 21 | -------------------------------------------------------------------------------- /rsx/shaders_gl/shaders_common.h: -------------------------------------------------------------------------------- 1 | #ifndef _SHADERS_COMMON 2 | #define _SHADERS_COMMON 3 | 4 | #ifdef HAVE_OPENGLES3 5 | #define GLSL_VERTEX(src) "#version 300 es\n" #src 6 | #define GLSL_FRAGMENT(src) "#version 300 es\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#endif\n" #src 7 | #else 8 | #define GLSL_VERTEX(src) "#version 330 core\n" #src 9 | #define GLSL_FRAGMENT(src) "#version 330 core\n" #src 10 | #endif 11 | #define STRINGIZE(src) #src 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /scrc32.h: -------------------------------------------------------------------------------- 1 | #ifndef _S_CRC32_H 2 | #define _S_CRC32_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /ugui_tools.h: -------------------------------------------------------------------------------- 1 | #ifndef UGUI_TOOLS_H_ 2 | #define UGUI_TOOLS_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | /* bpp = bytes per pixel */ 10 | void gui_init(int width, int height, int bpp); 11 | 12 | void gui_draw(void); 13 | 14 | void gui_set_window_title(const char *title); 15 | 16 | void gui_set_message(const char *message); 17 | 18 | void gui_window_resize(int x, int y, int width, int height); 19 | 20 | unsigned* gui_get_framebuffer(void); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | --------------------------------------------------------------------------------