├── .github └── workflows │ └── close.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── common.mk ├── common ├── compile_flags.txt ├── crt0 │ ├── README.md │ ├── crt0.s │ ├── crt0cxx.s │ ├── cxxglue.c │ ├── memory-c.c │ ├── memory-s.s │ └── uC-sdk-crt0.s ├── hardware │ ├── cdrom.h │ ├── cop0.h │ ├── counters.h │ ├── dma.h │ ├── flushcache.s │ ├── gpu.h │ ├── hwregs.h │ ├── hwregs.inc │ ├── irq.h │ ├── pcsxhw.h │ ├── sio.h │ ├── spu.h │ └── util.h ├── kernel │ ├── events.h │ ├── openbios.h │ ├── pcdrv.h │ └── threads.h ├── psxlibc │ ├── circularbuffer.h │ ├── device.h │ ├── direntry.h │ ├── fastmemset.s │ ├── handlers.h │ ├── ioctl.h │ ├── psxexe.h │ ├── setjmp.h │ ├── stdio.h │ ├── string.h │ ├── ucontext.h │ └── ucontext.s ├── syscalls │ ├── printf.s │ └── syscalls.h └── util │ ├── bitfield.hh │ ├── buffer.hh │ ├── decoder.hh │ ├── djbhash.h │ ├── encoder.hh │ ├── mips.hh │ ├── sjis-table.h │ └── util.h ├── cpe.ld ├── crc32 ├── Makefile ├── crc32.c ├── crc32.h └── main.c ├── cube ├── Makefile └── cube.c ├── cxxhello ├── Makefile └── main.cpp ├── doc └── README.md ├── dockermake-cross.bat ├── dockermake-cross.sh ├── dockermake.bat ├── dockermake.sh ├── dockershell.bat ├── dockershell.sh ├── helloworld ├── Makefile └── main │ └── main.c ├── lz4 ├── lz4.c └── lz4.h ├── modplayer ├── Makefile ├── README.md ├── demo.c ├── modplayer.c ├── modplayer.h └── timewarped.hit ├── nooverlay.ld ├── openbios ├── Makefile ├── README.md ├── boot │ ├── psx.s │ └── system573.s ├── build.bat ├── build.sh ├── card │ ├── backupunit.c │ ├── backupunit.h │ ├── card.h │ └── device.c ├── cdrom │ ├── cdrom.c │ ├── cdrom.h │ ├── events.c │ ├── events.h │ ├── filesystem.c │ ├── filesystem.h │ ├── helpers.c │ ├── helpers.h │ ├── statemachine.c │ └── statemachine.h ├── charset │ ├── README.md │ ├── font1.raw │ ├── font2.raw │ ├── sjis.c │ └── sjis.h ├── compile_flags.txt ├── fileio │ ├── fileio.h │ ├── filesystem.c │ ├── misc.c │ └── stdio.c ├── gpu │ ├── gpu.c │ └── gpu.h ├── handlers │ ├── handlers.h │ ├── irq.c │ ├── setup.c │ └── syscall.c ├── kernel │ ├── alloc.c │ ├── alloc.h │ ├── events.c │ ├── events.h │ ├── flushcache.h │ ├── flushcache.s │ ├── globals.h │ ├── handlers.c │ ├── handlers.h │ ├── libcmisc.c │ ├── libcmisc.h │ ├── misc.c │ ├── misc.h │ ├── psxexe.c │ ├── psxexe.h │ ├── psxexec.s │ ├── setjmp.h │ ├── setjmp.s │ ├── threads.c │ ├── threads.h │ ├── util.c │ ├── util.h │ └── vectors.s ├── main │ ├── main.c │ ├── main.h │ ├── splash.c │ └── splash.h ├── patches │ ├── Makefile │ ├── clear_card_1.c │ ├── custom_handler_1.c │ ├── generate.c │ ├── hash.c │ ├── hash.h │ ├── initgun_1.c │ ├── patch_card2_1.c │ ├── patch_card2_2.c │ ├── patch_card_1.c │ ├── patch_card_2.c │ ├── patch_card_info_1.c │ ├── patch_gte_1.c │ ├── patch_gte_2.c │ ├── patch_gte_3.c │ ├── patch_pad_1.c │ ├── patch_pad_2.c │ ├── patch_pad_3.c │ ├── patches.c │ ├── patches.h │ ├── remove_ChgclrPAD_1.c │ ├── remove_ChgclrPAD_2.c │ ├── send_pad_1.c │ └── send_pad_2.c ├── pio │ ├── pio.c │ └── pio.h ├── psx-bios-as-cart.ld ├── psx-bios.ld ├── shell │ ├── shell.c │ └── shell.h ├── sio0 │ ├── busyloop.s │ ├── card.c │ ├── card.h │ ├── cardfasttrack.s │ ├── driver.c │ ├── pad.c │ ├── pad.h │ └── sio0.h ├── tty │ ├── tty.c │ └── tty.h └── uC-sdk-glue │ ├── BoardConsole.c │ ├── BoardConsole.h │ ├── BoardInit.c │ ├── FreeRTOS.h │ ├── init.c │ └── semphr.h ├── ps-exe.ld ├── psyq ├── README.md └── include │ └── inline_n.h ├── psyqo-lua ├── Makefile ├── README.md ├── compile_flags.txt ├── examples │ └── hello │ │ ├── Makefile │ │ └── hello.cpp ├── lua.hh ├── psyqo-lua.mk └── src │ └── lua.cpp ├── psyqo-paths ├── Makefile ├── README.md ├── archive-manager.hh ├── cdrom-loader.hh ├── compile_flags.txt ├── examples │ └── cdrom-loader │ │ ├── Makefile │ │ └── cdrom-loader.cpp ├── psyqo-paths.mk ├── src │ ├── archive-manager.cpp │ └── cdrom-loader.cpp └── tools │ └── mkarchive.lua ├── psyqo ├── CONCEPTS.md ├── GETTING_STARTED.md ├── Makefile ├── README.md ├── adler32.hh ├── advancedpad.hh ├── alloc.h ├── application.hh ├── bezier.hh ├── buffer.hh ├── bump-allocator.hh ├── cdrom-commandbuffer.hh ├── cdrom-device.hh ├── cdrom.hh ├── compile_flags.txt ├── coroutine.hh ├── examples │ ├── bezier │ │ ├── Makefile │ │ └── bezier.cpp │ ├── cdda │ │ ├── Makefile │ │ └── cdda.cpp │ ├── cdrom-demo │ │ ├── Makefile │ │ └── cdrom-demo.cpp │ ├── coroutine-demo-2 │ │ ├── Makefile │ │ └── coroutine-demo-2.cpp │ ├── coroutine-demo-3 │ │ ├── Makefile │ │ └── coroutine-demo-3.cpp │ ├── coroutine-demo │ │ ├── Makefile │ │ └── coroutine-demo.cpp │ ├── cube │ │ ├── Makefile │ │ └── cube.cpp │ ├── gte │ │ ├── Makefile │ │ └── gte.cpp │ ├── hello-alloc │ │ ├── Makefile │ │ └── hello.cpp │ ├── hello-chained │ │ ├── Makefile │ │ └── hello-chained.cpp │ ├── hello-nokernel │ │ ├── Makefile │ │ └── hello.cpp │ ├── hello │ │ ├── Makefile │ │ └── hello.cpp │ ├── lines │ │ ├── Makefile │ │ └── lines.cpp │ ├── math │ │ ├── Makefile │ │ └── math.cpp │ ├── multitap │ │ ├── Makefile │ │ └── multitap.cpp │ ├── padtest │ │ ├── Makefile │ │ └── padtest.cpp │ ├── pcsxlua │ │ ├── Makefile │ │ ├── pcsxlua.cpp │ │ └── pcsxlua.lua │ ├── proctex │ │ ├── Makefile │ │ └── proctex.cpp │ ├── task-demo │ │ ├── Makefile │ │ └── task-demo.cpp │ ├── tetris │ │ ├── Makefile │ │ ├── README.md │ │ ├── constants.hh │ │ ├── credits.cpp │ │ ├── credits.hh │ │ ├── game.cpp │ │ ├── game.hh │ │ ├── gameover.cpp │ │ ├── gameover.hh │ │ ├── mainmenu.cpp │ │ ├── mainmenu.hh │ │ ├── musix-oh-amiga-with-effects.hit │ │ ├── options.cpp │ │ ├── options.hh │ │ ├── pause.cpp │ │ ├── pause.hh │ │ ├── pieces.cpp │ │ ├── pieces.hh │ │ ├── playfield.hh │ │ ├── rand.cpp │ │ ├── rand.hh │ │ ├── sound.cpp │ │ ├── sound.hh │ │ ├── splash.cpp │ │ ├── splash.hh │ │ ├── tetris.cpp │ │ └── tetris.hh │ ├── timers │ │ ├── Makefile │ │ └── timers.cpp │ └── torus │ │ ├── Makefile │ │ ├── README.md │ │ ├── presets.hh │ │ └── torus.cpp ├── fixed-point.hh ├── font.hh ├── fragment-concept.hh ├── fragments.hh ├── gpu.hh ├── gte-kernels.hh ├── gte-registers.hh ├── hardware │ ├── cdrom.hh │ ├── cpu.hh │ ├── gpu.hh │ ├── hwregs.hh │ ├── sbus.hh │ └── sio.hh ├── internal │ └── gpu │ │ └── configuration.hh ├── iso9660-parser.hh ├── kernel.hh ├── mainpage.dox ├── matrix.hh ├── msf.hh ├── ordering-table.hh ├── primitive-concept.hh ├── primitives.hh ├── primitives │ ├── common.hh │ ├── control.hh │ ├── lines.hh │ ├── misc.hh │ ├── quads.hh │ ├── rectangles.hh │ ├── sprites.hh │ └── triangles.hh ├── psyqo.mk ├── scene.hh ├── shared.hh ├── simplepad.hh ├── soft-math.hh ├── spu.hh ├── src │ ├── adler32.cpp │ ├── advancedpad.cpp │ ├── alloc.c │ ├── application.cpp │ ├── bezier.cpp │ ├── cdrom-device-cdda.cpp │ ├── cdrom-device-muteunmute.cpp │ ├── cdrom-device-readsectors.cpp │ ├── cdrom-device-reset.cpp │ ├── cdrom-device-test.cpp │ ├── cdrom-device-toc.cpp │ ├── cdrom-device.cpp │ ├── cdrom.cpp │ ├── coroutine.cpp │ ├── crash-handler.cpp │ ├── eastl-glue.cpp │ ├── fixed-point.cpp │ ├── font-compress.lua │ ├── font.cpp │ ├── gpu.cpp │ ├── hardware │ │ ├── cdrom.cpp │ │ ├── cpu.cpp │ │ ├── gpu.cpp │ │ ├── sbus.cpp │ │ └── sio.cpp │ ├── iso9660-parser.cpp │ ├── kernel.cpp │ ├── msf.cpp │ ├── ordering-table.cpp │ ├── simplepad.cpp │ ├── soft-math.cpp │ ├── spu.cpp │ ├── system-font.inc │ ├── task.cpp │ ├── trigonometry.cpp │ ├── vector.s │ └── xprintf.c ├── strings-helpers.hh ├── task.hh ├── trigonometry.hh ├── utility-polyfill.h ├── vector.hh └── xprintf.h ├── scratchstack ├── Makefile └── main.c ├── shell ├── Makefile ├── blip.hit ├── cdrom.c ├── cdrom.h ├── dcos.c ├── dcos.h ├── gpu.c ├── gpu.h ├── hull.c ├── hull.h ├── main.c ├── math.c ├── math.h ├── shell.ld ├── spu.c └── spu.h ├── tests ├── Makefile ├── basic │ ├── Makefile │ └── basic.c ├── cop0 │ ├── Makefile │ ├── cester-cop0.c │ ├── cop0.c │ └── exceptions.cpp ├── cpu │ ├── Makefile │ ├── branchbranch.s │ ├── cpu.c │ ├── links.s │ ├── loads.s │ └── lwlr.s ├── dma │ ├── Makefile │ └── dma.c ├── gpu │ ├── Makefile │ └── gpu.c ├── libc │ ├── Makefile │ ├── libc.c │ ├── longjmp.c │ ├── qsort.c │ └── string.c ├── memcpy │ ├── Makefile │ └── memcpy.c ├── memset │ ├── Makefile │ └── memset.c ├── pcdrv │ ├── Makefile │ └── pcdrv.c └── uC-sdk-glue │ ├── BoardConsole.c │ ├── BoardConsole.h │ ├── BoardInit.c │ ├── FreeRTOS.h │ ├── init.c │ └── semphr.h ├── third_party ├── EABase │ ├── .gitignore │ ├── .gitmodules │ ├── .p4ignore │ ├── .travis.yml │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── doc │ │ └── EABase.html │ ├── include │ │ └── Common │ │ │ └── EABase │ │ │ ├── config │ │ │ ├── eacompiler.h │ │ │ ├── eacompilertraits.h │ │ │ └── eaplatform.h │ │ │ ├── eabase.h │ │ │ ├── eahave.h │ │ │ ├── earesult.h │ │ │ ├── eastdarg.h │ │ │ ├── eaunits.h │ │ │ ├── int128.h │ │ │ ├── nullptr.h │ │ │ └── version.h │ └── test │ │ ├── CMakeLists.txt │ │ └── source │ │ ├── CEntryPoint.cpp │ │ ├── TestEABase.cpp │ │ ├── TestEABase.h │ │ ├── TestEABaseC.c │ │ └── TestEABaseSeparate.cpp └── EASTL │ ├── .clang-format │ ├── .gitattributes │ ├── .github │ └── workflows │ │ └── c-cpp.yml │ ├── .gitignore │ ├── .gitmodules │ ├── .p4ignore │ ├── .travis.yml │ ├── 3RDPARTYLICENSES.TXT │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── _config.yml │ ├── benchmark │ ├── CMakeLists.txt │ └── source │ │ ├── BenchmarkAlgorithm.cpp │ │ ├── BenchmarkBitset.cpp │ │ ├── BenchmarkDeque.cpp │ │ ├── BenchmarkHash.cpp │ │ ├── BenchmarkHeap.cpp │ │ ├── BenchmarkList.cpp │ │ ├── BenchmarkMap.cpp │ │ ├── BenchmarkSet.cpp │ │ ├── BenchmarkSort.cpp │ │ ├── BenchmarkString.cpp │ │ ├── BenchmarkTupleVector.cpp │ │ ├── BenchmarkVector.cpp │ │ ├── EASTLBenchmark.cpp │ │ ├── EASTLBenchmark.h │ │ └── main.cpp │ ├── doc │ ├── Benchmarks.md │ ├── BestPractices.md │ ├── Bonus │ │ └── tuple_vector_readme.md │ ├── CMake │ │ └── EASTL_Project_Integration.md │ ├── Design.md │ ├── EASTL-n2271.pdf │ ├── EASTL.natvis │ ├── FAQ.md │ ├── Glossary.md │ ├── Gotchas.md │ ├── Introduction.md │ ├── Maintenance.md │ ├── Modules.md │ ├── html │ │ ├── EASTL Benchmarks.html │ │ ├── EASTL Best Practices.html │ │ ├── EASTL Design.html │ │ ├── EASTL FAQ.html │ │ ├── EASTL Glossary.html │ │ ├── EASTL Gotchas.html │ │ ├── EASTL Introduction.html │ │ ├── EASTL Maintenance.html │ │ ├── EASTL Modules.html │ │ └── EASTLDoc.css │ └── quick-reference.pdf │ ├── include │ └── EASTL │ │ ├── algorithm.h │ │ ├── allocator.h │ │ ├── allocator_malloc.h │ │ ├── any.h │ │ ├── array.h │ │ ├── atomic.h │ │ ├── bit.h │ │ ├── bitset.h │ │ ├── bitvector.h │ │ ├── bonus │ │ ├── adaptors.h │ │ ├── call_traits.h │ │ ├── compressed_pair.h │ │ ├── fixed_ring_buffer.h │ │ ├── fixed_tuple_vector.h │ │ ├── intrusive_sdlist.h │ │ ├── intrusive_slist.h │ │ ├── list_map.h │ │ ├── lru_cache.h │ │ ├── ring_buffer.h │ │ ├── sort_extra.h │ │ └── tuple_vector.h │ │ ├── chrono.h │ │ ├── core_allocator.h │ │ ├── core_allocator_adapter.h │ │ ├── deque.h │ │ ├── finally.h │ │ ├── fixed_allocator.h │ │ ├── fixed_function.h │ │ ├── fixed_hash_map.h │ │ ├── fixed_hash_set.h │ │ ├── fixed_list.h │ │ ├── fixed_map.h │ │ ├── fixed_set.h │ │ ├── fixed_slist.h │ │ ├── fixed_string.h │ │ ├── fixed_substring.h │ │ ├── fixed_vector.h │ │ ├── functional.h │ │ ├── hash_map.h │ │ ├── hash_set.h │ │ ├── heap.h │ │ ├── initializer_list.h │ │ ├── internal │ │ ├── atomic │ │ │ ├── arch │ │ │ │ ├── arch.h │ │ │ │ ├── arch_add_fetch.h │ │ │ │ ├── arch_and_fetch.h │ │ │ │ ├── arch_cmpxchg_strong.h │ │ │ │ ├── arch_cmpxchg_weak.h │ │ │ │ ├── arch_compiler_barrier.h │ │ │ │ ├── arch_cpu_pause.h │ │ │ │ ├── arch_exchange.h │ │ │ │ ├── arch_fetch_add.h │ │ │ │ ├── arch_fetch_and.h │ │ │ │ ├── arch_fetch_or.h │ │ │ │ ├── arch_fetch_sub.h │ │ │ │ ├── arch_fetch_xor.h │ │ │ │ ├── arch_load.h │ │ │ │ ├── arch_memory_barrier.h │ │ │ │ ├── arch_or_fetch.h │ │ │ │ ├── arch_signal_fence.h │ │ │ │ ├── arch_store.h │ │ │ │ ├── arch_sub_fetch.h │ │ │ │ ├── arch_thread_fence.h │ │ │ │ ├── arch_xor_fetch.h │ │ │ │ ├── arm │ │ │ │ │ ├── arch_arm.h │ │ │ │ │ ├── arch_arm_load.h │ │ │ │ │ ├── arch_arm_memory_barrier.h │ │ │ │ │ ├── arch_arm_store.h │ │ │ │ │ └── arch_arm_thread_fence.h │ │ │ │ └── x86 │ │ │ │ │ ├── arch_x86.h │ │ │ │ │ ├── arch_x86_add_fetch.h │ │ │ │ │ ├── arch_x86_and_fetch.h │ │ │ │ │ ├── arch_x86_cmpxchg_strong.h │ │ │ │ │ ├── arch_x86_cmpxchg_weak.h │ │ │ │ │ ├── arch_x86_exchange.h │ │ │ │ │ ├── arch_x86_fetch_add.h │ │ │ │ │ ├── arch_x86_fetch_and.h │ │ │ │ │ ├── arch_x86_fetch_or.h │ │ │ │ │ ├── arch_x86_fetch_sub.h │ │ │ │ │ ├── arch_x86_fetch_xor.h │ │ │ │ │ ├── arch_x86_load.h │ │ │ │ │ ├── arch_x86_memory_barrier.h │ │ │ │ │ ├── arch_x86_or_fetch.h │ │ │ │ │ ├── arch_x86_store.h │ │ │ │ │ ├── arch_x86_sub_fetch.h │ │ │ │ │ ├── arch_x86_thread_fence.h │ │ │ │ │ └── arch_x86_xor_fetch.h │ │ │ ├── atomic.h │ │ │ ├── atomic_asserts.h │ │ │ ├── atomic_base_width.h │ │ │ ├── atomic_casts.h │ │ │ ├── atomic_flag.h │ │ │ ├── atomic_flag_standalone.h │ │ │ ├── atomic_integral.h │ │ │ ├── atomic_macros.h │ │ │ ├── atomic_macros │ │ │ │ ├── atomic_macros.h │ │ │ │ ├── atomic_macros_add_fetch.h │ │ │ │ ├── atomic_macros_and_fetch.h │ │ │ │ ├── atomic_macros_base.h │ │ │ │ ├── atomic_macros_cmpxchg_strong.h │ │ │ │ ├── atomic_macros_cmpxchg_weak.h │ │ │ │ ├── atomic_macros_compiler_barrier.h │ │ │ │ ├── atomic_macros_cpu_pause.h │ │ │ │ ├── atomic_macros_exchange.h │ │ │ │ ├── atomic_macros_fetch_add.h │ │ │ │ ├── atomic_macros_fetch_and.h │ │ │ │ ├── atomic_macros_fetch_or.h │ │ │ │ ├── atomic_macros_fetch_sub.h │ │ │ │ ├── atomic_macros_fetch_xor.h │ │ │ │ ├── atomic_macros_load.h │ │ │ │ ├── atomic_macros_memory_barrier.h │ │ │ │ ├── atomic_macros_or_fetch.h │ │ │ │ ├── atomic_macros_signal_fence.h │ │ │ │ ├── atomic_macros_store.h │ │ │ │ ├── atomic_macros_sub_fetch.h │ │ │ │ ├── atomic_macros_thread_fence.h │ │ │ │ └── atomic_macros_xor_fetch.h │ │ │ ├── atomic_memory_order.h │ │ │ ├── atomic_pointer.h │ │ │ ├── atomic_pop_compiler_options.h │ │ │ ├── atomic_push_compiler_options.h │ │ │ ├── atomic_size_aligned.h │ │ │ ├── atomic_standalone.h │ │ │ └── compiler │ │ │ │ ├── compiler.h │ │ │ │ ├── compiler_add_fetch.h │ │ │ │ ├── compiler_and_fetch.h │ │ │ │ ├── compiler_barrier.h │ │ │ │ ├── compiler_cmpxchg_strong.h │ │ │ │ ├── compiler_cmpxchg_weak.h │ │ │ │ ├── compiler_cpu_pause.h │ │ │ │ ├── compiler_exchange.h │ │ │ │ ├── compiler_fetch_add.h │ │ │ │ ├── compiler_fetch_and.h │ │ │ │ ├── compiler_fetch_or.h │ │ │ │ ├── compiler_fetch_sub.h │ │ │ │ ├── compiler_fetch_xor.h │ │ │ │ ├── compiler_load.h │ │ │ │ ├── compiler_memory_barrier.h │ │ │ │ ├── compiler_or_fetch.h │ │ │ │ ├── compiler_signal_fence.h │ │ │ │ ├── compiler_store.h │ │ │ │ ├── compiler_sub_fetch.h │ │ │ │ ├── compiler_thread_fence.h │ │ │ │ ├── compiler_xor_fetch.h │ │ │ │ ├── gcc │ │ │ │ ├── compiler_gcc.h │ │ │ │ ├── compiler_gcc_add_fetch.h │ │ │ │ ├── compiler_gcc_and_fetch.h │ │ │ │ ├── compiler_gcc_barrier.h │ │ │ │ ├── compiler_gcc_cmpxchg_strong.h │ │ │ │ ├── compiler_gcc_cmpxchg_weak.h │ │ │ │ ├── compiler_gcc_cpu_pause.h │ │ │ │ ├── compiler_gcc_exchange.h │ │ │ │ ├── compiler_gcc_fetch_add.h │ │ │ │ ├── compiler_gcc_fetch_and.h │ │ │ │ ├── compiler_gcc_fetch_or.h │ │ │ │ ├── compiler_gcc_fetch_sub.h │ │ │ │ ├── compiler_gcc_fetch_xor.h │ │ │ │ ├── compiler_gcc_load.h │ │ │ │ ├── compiler_gcc_or_fetch.h │ │ │ │ ├── compiler_gcc_signal_fence.h │ │ │ │ ├── compiler_gcc_store.h │ │ │ │ ├── compiler_gcc_sub_fetch.h │ │ │ │ ├── compiler_gcc_thread_fence.h │ │ │ │ └── compiler_gcc_xor_fetch.h │ │ │ │ └── msvc │ │ │ │ ├── compiler_msvc.h │ │ │ │ ├── compiler_msvc_add_fetch.h │ │ │ │ ├── compiler_msvc_and_fetch.h │ │ │ │ ├── compiler_msvc_barrier.h │ │ │ │ ├── compiler_msvc_cmpxchg_strong.h │ │ │ │ ├── compiler_msvc_cmpxchg_weak.h │ │ │ │ ├── compiler_msvc_cpu_pause.h │ │ │ │ ├── compiler_msvc_exchange.h │ │ │ │ ├── compiler_msvc_fetch_add.h │ │ │ │ ├── compiler_msvc_fetch_and.h │ │ │ │ ├── compiler_msvc_fetch_or.h │ │ │ │ ├── compiler_msvc_fetch_sub.h │ │ │ │ ├── compiler_msvc_fetch_xor.h │ │ │ │ ├── compiler_msvc_or_fetch.h │ │ │ │ ├── compiler_msvc_signal_fence.h │ │ │ │ ├── compiler_msvc_sub_fetch.h │ │ │ │ └── compiler_msvc_xor_fetch.h │ │ ├── char_traits.h │ │ ├── config.h │ │ ├── copy_help.h │ │ ├── enable_shared.h │ │ ├── fill_help.h │ │ ├── fixed_pool.h │ │ ├── function.h │ │ ├── function_detail.h │ │ ├── function_help.h │ │ ├── functional_base.h │ │ ├── generic_iterator.h │ │ ├── hashtable.h │ │ ├── in_place_t.h │ │ ├── integer_sequence.h │ │ ├── intrusive_hashtable.h │ │ ├── mem_fn.h │ │ ├── memory_base.h │ │ ├── move_help.h │ │ ├── pair_fwd_decls.h │ │ ├── piecewise_construct_t.h │ │ ├── red_black_tree.h │ │ ├── smart_ptr.h │ │ ├── thread_support.h │ │ ├── tuple_fwd_decls.h │ │ ├── type_compound.h │ │ ├── type_fundamental.h │ │ ├── type_pod.h │ │ ├── type_properties.h │ │ └── type_transformations.h │ │ ├── intrusive_hash_map.h │ │ ├── intrusive_hash_set.h │ │ ├── intrusive_list.h │ │ ├── intrusive_ptr.h │ │ ├── iterator.h │ │ ├── linked_array.h │ │ ├── linked_ptr.h │ │ ├── list.h │ │ ├── map.h │ │ ├── memory.h │ │ ├── meta.h │ │ ├── numeric.h │ │ ├── numeric_limits.h │ │ ├── optional.h │ │ ├── priority_queue.h │ │ ├── queue.h │ │ ├── random.h │ │ ├── ratio.h │ │ ├── safe_ptr.h │ │ ├── scoped_array.h │ │ ├── scoped_ptr.h │ │ ├── segmented_vector.h │ │ ├── set.h │ │ ├── shared_array.h │ │ ├── shared_ptr.h │ │ ├── slist.h │ │ ├── sort.h │ │ ├── span.h │ │ ├── stack.h │ │ ├── string.h │ │ ├── string_hash_map.h │ │ ├── string_map.h │ │ ├── string_view.h │ │ ├── tuple.h │ │ ├── type_traits.h │ │ ├── unique_ptr.h │ │ ├── unordered_map.h │ │ ├── unordered_set.h │ │ ├── utility.h │ │ ├── variant.h │ │ ├── vector.h │ │ ├── vector_map.h │ │ ├── vector_multimap.h │ │ ├── vector_multiset.h │ │ ├── vector_set.h │ │ ├── version.h │ │ └── weak_ptr.h │ ├── scripts │ ├── CMake │ │ └── CommonCppFlags.cmake │ └── build.sh │ ├── source │ ├── allocator_eastl.cpp │ ├── assert.cpp │ ├── atomic.cpp │ ├── fixed_pool.cpp │ ├── hashtable.cpp │ ├── intrusive_list.cpp │ ├── numeric_limits.cpp │ ├── red_black_tree.cpp │ ├── string.cpp │ └── thread_support.cpp │ └── test │ ├── CMakeLists.txt │ └── source │ ├── ConceptImpls.h │ ├── EASTLTest.cpp │ ├── EASTLTest.h │ ├── EASTLTestAllocator.cpp │ ├── EASTLTestAllocator.h │ ├── GetTypeName.h │ ├── TestAlgorithm.cpp │ ├── TestAllocator.cpp │ ├── TestAny.cpp │ ├── TestArray.cpp │ ├── TestAtomicAsm.cpp │ ├── TestAtomicBasic.cpp │ ├── TestBitVector.cpp │ ├── TestBitcast.cpp │ ├── TestBitset.cpp │ ├── TestCharTraits.cpp │ ├── TestChrono.cpp │ ├── TestCppCXTypeTraits.cpp │ ├── TestDeque.cpp │ ├── TestExtra.cpp │ ├── TestFinally.cpp │ ├── TestFixedFunction.cpp │ ├── TestFixedHash.cpp │ ├── TestFixedList.cpp │ ├── TestFixedMap.cpp │ ├── TestFixedSList.cpp │ ├── TestFixedSet.cpp │ ├── TestFixedString.cpp │ ├── TestFixedTupleVector.cpp │ ├── TestFixedVector.cpp │ ├── TestFunctional.cpp │ ├── TestHash.cpp │ ├── TestHeap.cpp │ ├── TestIntrusiveHash.cpp │ ├── TestIntrusiveList.cpp │ ├── TestIntrusiveSDList.cpp │ ├── TestIntrusiveSList.cpp │ ├── TestIterator.cpp │ ├── TestList.cpp │ ├── TestListMap.cpp │ ├── TestLruCache.cpp │ ├── TestMap.cpp │ ├── TestMap.h │ ├── TestMemory.cpp │ ├── TestMeta.cpp │ ├── TestNumericLimits.cpp │ ├── TestOptional.cpp │ ├── TestRandom.cpp │ ├── TestRatio.cpp │ ├── TestRingBuffer.cpp │ ├── TestSList.cpp │ ├── TestSegmentedVector.cpp │ ├── TestSet.cpp │ ├── TestSet.h │ ├── TestSmartPtr.cpp │ ├── TestSort.cpp │ ├── TestSpan.cpp │ ├── TestString.cpp │ ├── TestString.inl │ ├── TestStringHashMap.cpp │ ├── TestStringMap.cpp │ ├── TestStringView.cpp │ ├── TestStringView.inl │ ├── TestTuple.cpp │ ├── TestTupleVector.cpp │ ├── TestTypeTraits.cpp │ ├── TestUtility.cpp │ ├── TestVariant.cpp │ ├── TestVariant2.cpp │ ├── TestVector.cpp │ ├── TestVectorMap.cpp │ ├── TestVectorSet.cpp │ └── main.cpp └── ucl-demo ├── Makefile ├── README.md ├── compress.lua ├── n2e-d.S ├── n2e-d.h └── ucl-demo.cpp /.github/workflows/close.yml: -------------------------------------------------------------------------------- 1 | name: Close Pull Request 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened] 6 | 7 | jobs: 8 | run: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: superbrothers/close-pull-request@v3 12 | with: 13 | comment: "Thank you for your pull request, but this repository is a read-only mirror of the [mips](https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips) subdirectory of the [pcsx-redux](https://github.com/grumpycoders/pcsx-redux) project. Please open your pull request there instead." 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Clion 2 | .idea/ 3 | cmake-build-*/ 4 | 5 | *.bin 6 | *.elf 7 | *.map 8 | *.cpe 9 | *.ps-exe 10 | 11 | # for nugget mirror 12 | *.dep 13 | *.o 14 | *.a 15 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/uC-sdk"] 2 | path = third_party/uC-sdk 3 | url = https://github.com/grumpycoders/uC-sdk.git 4 | [submodule "third_party/psxlua"] 5 | path = third_party/psxlua 6 | url = https://github.com/grumpycoders/psxlua.git 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 PCSX-Redux authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, 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 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PCSX-Redux's mips code 2 | 3 | This repository is a read-only mirror of 4 | [PCSX-Redux's mips folder](https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips). 5 | Its purpose is to be used as a submodule for projects that want to use the various parts 6 | contained herein without bringing the whole of PCSX-Redux's codebase. 7 | 8 | Check the [doc](doc/README.md) folder for more information. 9 | -------------------------------------------------------------------------------- /common/compile_flags.txt: -------------------------------------------------------------------------------- 1 | -m32 2 | -I. 3 | -I.. 4 | -I../../../third_party/uC-sdk/libc/include 5 | -------------------------------------------------------------------------------- /common/crt0/README.md: -------------------------------------------------------------------------------- 1 | # Limited C runtime 2 | 3 | This directory contains some limited C runtime features. It will take care of booting the binary, setting up some minimal environment and then call the main function. It also contains some basic implementations of standard C functions which are required by the compiler when doing self-hosted compilation. 4 | 5 | ## Using very bare C runtime 6 | The file `crt0.s` is the entry point of the C runtime. It will set up the stack, and call the `main` function. It will not perform any other initialization beyond clearing the BSS section. 7 | 8 | ## Using C++ runtime 9 | The file `crt0cxx.s` is the entry point of the C++ runtime. It will set up the stack, and then go to the `cxxglue.c` file for further initialization, which will then call the `main` function. The `cxxglue.c` file also contains the minimal implementation of the C++ runtime that is required by the C++ compiler. 10 | 11 | ## Memory C runtime functions 12 | The files `memory-c.c` and `memory-s.s` contain the 4 basic memory functions that are required by the self-hosted C and C++ compilers. These are `memcpy`, `memset`, `memcmp`, and `memmove`. These are implemented in a very basic way, being very small, and are not optimized for speed. They also contain optimized versions of `memcpy` and `memset` for the MIPS architecture, available using the LDFLAGS `-Wl,-wrap,memcpy` and `-Wl,-wrap,memset` toggles. They are somewhat bigger, but much faster. Note that these 4 functions are available directly when writing C or C++ code using the `__builtin_memcpy`, `__builtin_memset`, `__builtin_memcmp` and `__builtin_memmove` functions, with no need to include any header file. 13 | -------------------------------------------------------------------------------- /common/hardware/cop0.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | static __inline__ uint32_t readCOP0Status() { 32 | uint32_t ret; 33 | asm("mfc0 %0, $12\nnop\n" : "=r"(ret)); 34 | return ret; 35 | } 36 | 37 | static __inline__ void writeCOP0Status(uint32_t status) { asm("mtc0 %0, $12\nnop\n" : : "r"(status)); } 38 | -------------------------------------------------------------------------------- /common/hardware/counters.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | struct Counter { 32 | uint16_t value; 33 | uint16_t padding1; 34 | uint16_t mode; 35 | uint16_t padding2; 36 | uint16_t target; 37 | uint8_t padding[6]; 38 | }; 39 | 40 | #define COUNTERS ((volatile struct Counter *)0xbf801100) 41 | -------------------------------------------------------------------------------- /common/hardware/dma.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | struct DMARegisters { 32 | uintptr_t MADR; 33 | uint32_t BCR, CHCR, padding; 34 | }; 35 | 36 | #define DMA_CTRL ((volatile struct DMARegisters *)0x1f801080) 37 | 38 | enum { 39 | DMA_MDECIN = 0, 40 | DMA_MDECOUT = 1, 41 | DMA_GPU = 2, 42 | DMA_CDROM = 3, 43 | DMA_SPU = 4, 44 | DMA_PIO = 5, 45 | DMA_GPUOTC = 6, 46 | }; 47 | -------------------------------------------------------------------------------- /common/hardware/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | static void __inline__ flushWriteQueue() { *((volatile uint8_t *)0xbfc00000); } 30 | -------------------------------------------------------------------------------- /common/psxlibc/circularbuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | enum { 32 | PSXCIRC_RAW = 1, 33 | PSXCIRC_STOPPED = 2, 34 | PSXCIRC_BREAK = 4, 35 | }; 36 | 37 | struct CircularBuffer { 38 | uint32_t flags; 39 | uint8_t *start, *end; 40 | uint8_t buffer[256]; 41 | }; 42 | -------------------------------------------------------------------------------- /common/psxlibc/direntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | struct DirEntry; 32 | 33 | struct DirEntry { 34 | char name[20]; 35 | uint32_t attributes; 36 | uint32_t size; 37 | struct DirEntry* next; 38 | uint32_t LBA; 39 | char fourcc[4]; 40 | }; 41 | -------------------------------------------------------------------------------- /common/psxlibc/handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | struct HandlerInfo; 32 | 33 | struct HandlerInfo { 34 | struct HandlerInfo* next; 35 | void (*handler)(int); 36 | int (*verifier)(); 37 | uint32_t padding; 38 | }; 39 | 40 | struct HandlersStorage { 41 | struct HandlerInfo* first; 42 | uint32_t padding; 43 | }; 44 | -------------------------------------------------------------------------------- /common/psxlibc/psxexe.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | struct psxExeHeader { 32 | uint32_t pc; 33 | uint32_t gp; 34 | uint32_t text_addr; 35 | uint32_t text_size; 36 | uint32_t data_addr; 37 | uint32_t data_size; 38 | uint32_t bss_addr; 39 | uint32_t bss_size; 40 | uint32_t stack_start; 41 | uint32_t stack_size; 42 | uint32_t savedSP; 43 | uint32_t savedS8; 44 | uint32_t savedGP; 45 | uint32_t savedRA; 46 | uint32_t savedS0; 47 | uint32_t unknown; 48 | }; 49 | -------------------------------------------------------------------------------- /common/psxlibc/setjmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | struct JmpBuf { 32 | uint32_t ra, sp, s8, s0, s1, s2, s3, s4, s5, s6, s7, gp; 33 | }; 34 | -------------------------------------------------------------------------------- /common/psxlibc/string.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include 31 | 32 | static __attribute__((always_inline)) void* safeMemZero(void* ptr_, int size) { 33 | uint8_t* ptr = (uint8_t*)ptr_; 34 | if (!ptr || size <= 0) return NULL; 35 | uint8_t* orig = ptr; 36 | for (; size > 0; ptr++) { 37 | size--; 38 | *ptr = 0; 39 | } 40 | return orig; 41 | } 42 | -------------------------------------------------------------------------------- /common/syscalls/printf.s: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | .set push 28 | .set noreorder 29 | .section .ramtext, "ax", @progbits 30 | .align 2 31 | .global ramsyscall_printf 32 | .type ramsyscall_printf, @function 33 | 34 | ramsyscall_printf: 35 | li $t2, 0xa0 36 | jr $t2 37 | li $t1, 0x3f 38 | -------------------------------------------------------------------------------- /crc32/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = crc32 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | ../common/syscalls/printf.s \ 6 | ../common/crt0/crt0.s \ 7 | main.c \ 8 | crc32.c \ 9 | 10 | include ../common.mk 11 | -------------------------------------------------------------------------------- /crc32/crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | void init_crc32(); 32 | static inline uint32_t start_crc32() { return 0xffffffff; } 33 | uint32_t process_crc32_unaligned(uint8_t *data, unsigned len, uint32_t crc); 34 | uint32_t process_crc32_aligned(uint32_t *data, unsigned len, uint32_t crc); 35 | static inline uint32_t finish_crc32(uint32_t crc) { return crc ^ 0xffffffff; } 36 | -------------------------------------------------------------------------------- /crc32/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "common/syscalls/syscalls.h" 28 | #include "crc32/crc32.h" 29 | 30 | static uint32_t bios_crc32() { 31 | uint32_t crc = start_crc32(); 32 | crc = process_crc32_aligned((uint32_t *)0x1fc00000, 512 * 1024 / 4, crc); 33 | return finish_crc32(crc); 34 | } 35 | 36 | int main() { 37 | init_crc32(); 38 | 39 | ramsyscall_printf("BIOS' CRC32: %08x\n", bios_crc32()); 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /cube/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = cube 2 | TYPE = ps-exe 3 | 4 | SRCS = cube.c \ 5 | ../common/crt0/crt0.s \ 6 | 7 | CPPFLAGS += -I../psyq/include 8 | LDFLAGS += -L../psyq/lib 9 | LDFLAGS += -Wl,--start-group 10 | LDFLAGS += -lapi 11 | LDFLAGS += -lc 12 | LDFLAGS += -lc2 13 | LDFLAGS += -lcard 14 | LDFLAGS += -lcomb 15 | LDFLAGS += -lds 16 | LDFLAGS += -letc 17 | LDFLAGS += -lgpu 18 | LDFLAGS += -lgs 19 | LDFLAGS += -lgte 20 | LDFLAGS += -lgun 21 | LDFLAGS += -lhmd 22 | LDFLAGS += -lmath 23 | LDFLAGS += -lmcrd 24 | LDFLAGS += -lmcx 25 | LDFLAGS += -lpad 26 | LDFLAGS += -lpress 27 | LDFLAGS += -lsio 28 | LDFLAGS += -lsnd 29 | LDFLAGS += -lspu 30 | LDFLAGS += -ltap 31 | LDFLAGS += -Wl,--end-group 32 | 33 | include ../common.mk 34 | -------------------------------------------------------------------------------- /cxxhello/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = cxx 2 | TYPE = ps-exe 3 | 4 | CXXFLAGS = -std=c++17 5 | 6 | SRCS = \ 7 | ../common/syscalls/printf.s \ 8 | ../common/crt0/crt0cxx.s \ 9 | ../common/crt0/cxxglue.c \ 10 | ../common/crt0/memory-c.c \ 11 | ../common/crt0/memory-s.s \ 12 | main.cpp \ 13 | 14 | include ../common.mk 15 | -------------------------------------------------------------------------------- /dockermake-cross.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set OLDCWD=%cd% 3 | cd %~dp0 4 | set ROOT=%cd% 5 | cd %OLDCWD% 6 | 7 | set REL=%OLDCWD% 8 | 9 | SETLOCAL EnableDelayedExpansion 10 | 11 | set MAT= 12 | set UPP= 13 | for /f "tokens=*" %%a in ('echo.%ROOT:\=^&echo.%') do ( 14 | set SUB=!SUB!%%a\ 15 | call set TMP=%%src:!SUB!=%% 16 | set MAT=!SUB! 17 | ) 18 | set REL=%UPP%!REL:%MAT%=! 19 | if "!REL!" EQU "!ROOT!" (set REL=) ELSE (set "REL=!REL:\=/!") 20 | set REL=/!REL! 21 | 22 | docker pull ghcr.io/grumpycoders/pcsx-redux-build-cross:latest 23 | docker run --rm --env-file "%ROOT%/cross-env.list" -i -w"/project%REL%" -v "%ROOT%:/project" ghcr.io/grumpycoders/pcsx-redux-build-cross make CROSS=arm64 %* 24 | -------------------------------------------------------------------------------- /dockermake-cross.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ROOT=$(dirname $0) 4 | CWD=$(pwd) 5 | cd $ROOT 6 | ROOT=$(pwd) 7 | cd $CWD 8 | 9 | docker pull ghcr.io/grumpycoders/pcsx-redux-build-cross:latest 10 | docker run --rm --env-file ${ROOT}/cross-env.list -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` ghcr.io/grumpycoders/pcsx-redux-build-cross make CROSS=arm64 $@ 11 | -------------------------------------------------------------------------------- /dockermake.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set OLDCWD=%cd% 3 | cd %~dp0 4 | set ROOT=%cd% 5 | cd %OLDCWD% 6 | 7 | set REL=%OLDCWD% 8 | 9 | SETLOCAL EnableDelayedExpansion 10 | 11 | set MAT= 12 | set UPP= 13 | for /f "tokens=*" %%a in ('echo.%ROOT:\=^&echo.%') do ( 14 | set SUB=!SUB!%%a\ 15 | call set TMP=%%src:!SUB!=%% 16 | set MAT=!SUB! 17 | ) 18 | set REL=%UPP%!REL:%MAT%=! 19 | if "!REL!" EQU "!ROOT!" (set REL=) ELSE (set "REL=!REL:\=/!") 20 | set REL=/!REL! 21 | 22 | docker pull ghcr.io/grumpycoders/pcsx-redux-build:latest 23 | docker run --rm --env-file "%ROOT%/env.list" -i -w"/project%REL%" -v "%ROOT%:/project" ghcr.io/grumpycoders/pcsx-redux-build:latest make %* 24 | -------------------------------------------------------------------------------- /dockermake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ROOT=$(dirname $0) 4 | CWD=$(pwd) 5 | cd $ROOT 6 | ROOT=$(pwd) 7 | cd $CWD 8 | 9 | docker pull ghcr.io/grumpycoders/pcsx-redux-build:latest 10 | docker run --rm --env-file ${ROOT}/env.list -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` ghcr.io/grumpycoders/pcsx-redux-build:latest make $@ 11 | -------------------------------------------------------------------------------- /dockershell.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set OLDCWD=%cd% 3 | cd %~dp0 4 | set ROOT=%cd% 5 | cd %OLDCWD% 6 | 7 | set REL=%OLDCWD% 8 | 9 | SETLOCAL EnableDelayedExpansion 10 | 11 | set MAT= 12 | set UPP= 13 | for /f "tokens=*" %%a in ('echo.%ROOT:\=^&echo.%') do ( 14 | set SUB=!SUB!%%a\ 15 | call set TMP=%%src:!SUB!=%% 16 | set MAT=!SUB! 17 | ) 18 | set REL=%UPP%!REL:%MAT%=! 19 | if "!REL!" EQU "!ROOT!" (set REL=) ELSE (set "REL=!REL:\=/!") 20 | set REL=/!REL! 21 | 22 | docker pull ghcr.io/grumpycoders/pcsx-redux-build:latest 23 | docker run --rm --env-file "%ROOT%/env.list" -t -i -w"/project%REL%" -v "%ROOT%:/project" ghcr.io/grumpycoders/pcsx-redux-build:latest bash -l 24 | -------------------------------------------------------------------------------- /dockershell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ROOT=$(dirname $0) 4 | CWD=$(pwd) 5 | cd $ROOT 6 | ROOT=$(pwd) 7 | cd $CWD 8 | 9 | docker pull ghcr.io/grumpycoders/pcsx-redux-build:latest 10 | docker run --rm --env-file ${ROOT}/env.list -t -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` ghcr.io/grumpycoders/pcsx-redux-build:latest bash -l 11 | -------------------------------------------------------------------------------- /helloworld/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = helloworld 2 | 3 | SRCS = \ 4 | ../common/syscalls/printf.s \ 5 | ../common/crt0/crt0.s \ 6 | main/main.c \ 7 | 8 | include ../common.mk 9 | -------------------------------------------------------------------------------- /helloworld/main/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "common/syscalls/syscalls.h" 28 | 29 | int main() { 30 | ramsyscall_printf("Hello world\n"); 31 | while (1); 32 | } 33 | -------------------------------------------------------------------------------- /modplayer/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = modplay-demo 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | ../common/crt0/crt0.s \ 6 | ../common/syscalls/printf.s \ 7 | demo.c \ 8 | modplayer.c \ 9 | timewarped.o \ 10 | 11 | include ../common.mk 12 | 13 | %.o: %.hit 14 | $(PREFIX)-objcopy -I binary --set-section-alignment .data=4 --rename-section .data=.rodata,alloc,load,readonly,data,contents -O $(FORMAT) -B mips $< $@ 15 | -------------------------------------------------------------------------------- /modplayer/README.md: -------------------------------------------------------------------------------- 1 | # Modplayer 2 | 3 | This code is a reverse engineering of the file MODPLAY.BIN, located in the zip file "Asm-Mod" from http://hitmen.c02.at/html/psx_tools.html, that has the CRC32 bb91769f. 4 | 5 | The current API behaves roughly the same the original one. The code should provide information about the alterations made to it. 6 | 7 | The demo song, "timewarped", written by [Jesster](https://modarchive.org/index.php?request=view_profile&query=69138), comes from [the modarchive](https://modarchive.org/index.php?request=view_by_moduleid&query=106481) with a [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/) license, allowing non-commercial adaptations. The file has been converted from MOD to HIT using the MODCONV.EXE software provided by Hitmen. 8 | 9 | A modern recreation of the MODCONV.EXE software is available within the PCSX-Redux project itself. See the [modconv](https://github.com/grumpycoders/pcsx-redux/tree/main/tools/modconv) folder for more information. 10 | -------------------------------------------------------------------------------- /modplayer/timewarped.hit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/modplayer/timewarped.hit -------------------------------------------------------------------------------- /nooverlay.ld: -------------------------------------------------------------------------------- 1 | __heap_base = __bss_end; -------------------------------------------------------------------------------- /openbios/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set OLDCWD=%cd% 3 | cd %~dp0 4 | cd ..\..\.. 5 | set ROOT=%cd% 6 | cd %OLDCWD% 7 | %ROOT%\dockermake.bat all -j4 8 | -------------------------------------------------------------------------------- /openbios/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ROOT=$(dirname $0)/../../.. 4 | cd $ROOT 5 | ROOT=$(pwd) 6 | cd src/mips/openbios 7 | 8 | $ROOT/dockermake.sh all -j4 9 | -------------------------------------------------------------------------------- /openbios/cdrom/cdrom.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void initCDRom(); 30 | void deinitCDRom(); 31 | int cdromBlockGetStatus(); 32 | int addCDRomDevice(); 33 | 34 | int cdromReadTOC(); 35 | int cdromReset(); 36 | 37 | void initializeCDRomHandlersAndEvents(); 38 | -------------------------------------------------------------------------------- /openbios/cdrom/events.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | #include "openbios/kernel/events.h" 32 | 33 | extern uint32_t g_cdEventACK; 34 | extern uint32_t g_cdEventDNE; 35 | extern uint32_t g_cdEventRDY; 36 | extern uint32_t g_cdEventEND; 37 | extern uint32_t g_cdEventERR; 38 | 39 | void cdromUndeliverAllExceptAckAndRdy(); 40 | void cdromUndeliverAll(); 41 | -------------------------------------------------------------------------------- /openbios/cdrom/helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | int cdromBlockReading(int count, int sector, char* buffer); 30 | -------------------------------------------------------------------------------- /openbios/charset/README.md: -------------------------------------------------------------------------------- 1 | # OpenBIOS fonts 2 | 3 | The font files from this directory have this information attached to them: 4 | 5 | ``` 6 | This file is adapted from: 7 | 8 | Shinonome 14dot font for JISX 0208, 1983/1990 9 | 10 | The original is k14goth by 11 | Yasuyuki Furukawa , 2000. 12 | (Public Domain) 13 | 14 | > Donated by H. Kagotani ; 15 | > public domainfont from Japan 16 | > JIS X 0208-1990 design is made by 17 | > TAKADA Toshihiro . 18 | > Modified for gothic like by Yasuyuki Furukawa 19 | 20 | Modified and Maintained by /efont/. 21 | 22 | (c) /efont/ -- Efont Open Laboratory 2001 23 | http://openlab.ring.gr.jp/efont/ 24 | 25 | Converted to binary format by Wei Mingzhi . 26 | ``` 27 | -------------------------------------------------------------------------------- /openbios/charset/font1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/openbios/charset/font1.raw -------------------------------------------------------------------------------- /openbios/charset/font2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/openbios/charset/font2.raw -------------------------------------------------------------------------------- /openbios/charset/sjis.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2021 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | // The normal API uses uint16_t as arguments, but 32 | // some games like GT2 will call these functions 33 | // with int16_t values instead, which then causes 34 | // all sorts of complications down the line when 35 | // used with modern compilers. So we're going to 36 | // use uint32_t instead, and cast to uint16_t 37 | // inside the functions to ensure the values 38 | // are always positive. 39 | const uint8_t* Krom2RawAdd(uint32_t c); 40 | uint16_t Krom2Offset(uint32_t c); 41 | -------------------------------------------------------------------------------- /openbios/compile_flags.txt: -------------------------------------------------------------------------------- 1 | -m32 2 | -I. 3 | -I.. 4 | -I../../../third_party/uC-sdk/libc/include 5 | -I../../../third_party/uC-sdk/os/include 6 | -IuC-sdk-glue 7 | -------------------------------------------------------------------------------- /openbios/gpu/gpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | void GPU_dw(unsigned x, unsigned y, unsigned w, unsigned h, const void* src); 32 | void GPU_mem2vram(); 33 | void GPU_send(uint32_t cmd); 34 | int GPU_cw(uint32_t cmd); 35 | void GPU_cwb(uint32_t* cmds, int count); 36 | void GPU_sendPackets(uint32_t* start); 37 | void GPU_abort(); 38 | uint32_t GPU_getStatus(); 39 | int GPU_sync(); 40 | -------------------------------------------------------------------------------- /openbios/kernel/alloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2021 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | void* user_malloc(size_t size); 32 | void user_free(void* ptr); 33 | void* user_realloc(void* ptr, size_t size); 34 | void user_initheap(void* base, size_t size); 35 | 36 | void* kern_malloc(size_t size); 37 | void kern_free(void* ptr); 38 | void* kern_realloc(void* ptr, size_t size); 39 | void kern_initheap(void* base, size_t size); 40 | -------------------------------------------------------------------------------- /openbios/kernel/events.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | #include "common/kernel/events.h" 32 | 33 | int initEvents(int count); 34 | uint32_t openEvent(uint32_t class, uint32_t spec, uint32_t mode, void (*handler)()); 35 | void deliverEvent(uint32_t class, uint32_t spec); 36 | void undeliverEvent(uint32_t class, uint32_t spec); 37 | int testEvent(uint32_t event); 38 | int enableEvent(uint32_t event); 39 | int disableEvent(uint32_t event); 40 | int closeEvent(uint32_t event); 41 | int waitEvent(uint32_t event); 42 | int getFreeEvCBSlot(); 43 | -------------------------------------------------------------------------------- /openbios/kernel/flushcache.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void flushCache(void); 30 | -------------------------------------------------------------------------------- /openbios/kernel/handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void installKernelHandlers(); 30 | void copyDataAndInitializeBSS(); 31 | void copyA0table(); 32 | 33 | void __attribute__((noreturn)) returnFromException(); 34 | -------------------------------------------------------------------------------- /openbios/kernel/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void setMemSize(int memSize); 30 | -------------------------------------------------------------------------------- /openbios/kernel/psxexe.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "common/psxlibc/psxexe.h" 30 | 31 | int loadExeHeader(const char* filename, struct psxExeHeader* header); 32 | int loadExe(const char* filename, struct psxExeHeader* header); 33 | int exec(struct psxExeHeader* header, int argc, char** argv); 34 | void loadAndExec(const char* filename, uint32_t stackStart, uint32_t stackSize); 35 | -------------------------------------------------------------------------------- /openbios/kernel/setjmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "common/psxlibc/setjmp.h" 30 | 31 | __attribute__((returns_twice)) int psxsetjmp(struct JmpBuf* buf); 32 | __attribute__((noreturn)) void psxlongjmp(struct JmpBuf* buf, int ret); 33 | -------------------------------------------------------------------------------- /openbios/kernel/threads.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | #pragma once 27 | 28 | #include 29 | 30 | #include "common/kernel/threads.h" 31 | 32 | int initThreads(int processCount, int threadCount); 33 | 34 | int getFreeTCBslot(); 35 | int openThread(uint32_t pc, uint32_t sp, uint32_t gp); 36 | int closeThread(int threadId); 37 | int changeThread(int threadId); 38 | -------------------------------------------------------------------------------- /openbios/kernel/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "openbios/kernel/util.h" 28 | 29 | uint8_t g_readBuffer[2048]; 30 | -------------------------------------------------------------------------------- /openbios/kernel/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | extern uint8_t g_readBuffer[2048]; 32 | -------------------------------------------------------------------------------- /openbios/main/splash.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2024 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void drawSplashScreen(); 30 | -------------------------------------------------------------------------------- /openbios/patches/Makefile: -------------------------------------------------------------------------------- 1 | PATCHES = \ 2 | clear_card_1.c \ 3 | custom_handler_1.c \ 4 | initgun_1.c \ 5 | patch_card_info_1.c \ 6 | patch_card_1.c \ 7 | patch_card_2.c \ 8 | patch_card2_1.c \ 9 | patch_card2_2.c \ 10 | patch_gte_1.c \ 11 | patch_gte_2.c \ 12 | patch_gte_3.c \ 13 | patch_pad_1.c \ 14 | patch_pad_2.c \ 15 | patch_pad_3.c \ 16 | remove_ChgclrPAD_1.c \ 17 | remove_ChgclrPAD_2.c \ 18 | send_pad_1.c \ 19 | send_pad_2.c \ 20 | 21 | 22 | CC ?= cc 23 | 24 | all: 25 | $(CC) -g -o generate generate.c hash.c -I../.. -DGENERATE_HASHES $(PATCHES) 26 | -------------------------------------------------------------------------------- /openbios/patches/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2021 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | uint32_t patch_hash(const uint32_t* ptr, const void* mask, unsigned len); 32 | -------------------------------------------------------------------------------- /openbios/pio/pio.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void runExp1PreHook(); 30 | void runExp1PostHook(); 31 | -------------------------------------------------------------------------------- /openbios/shell/shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | int startShell(uint32_t arg); 32 | -------------------------------------------------------------------------------- /openbios/sio0/sio0.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "common/psxlibc/handlers.h" 30 | 31 | int setSIO0AutoAck(int value); 32 | 33 | // internals 34 | extern struct HandlerInfo g_sio0HandlerInfo; 35 | extern uint32_t g_sio0Mask; 36 | -------------------------------------------------------------------------------- /openbios/tty/tty.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "common/psxlibc/device.h" 30 | #include "common/psxlibc/stdio.h" 31 | 32 | int addDummyConsoleDevice(); 33 | int addConsoleDevice(); 34 | 35 | extern int g_cachedInstallTTY; 36 | extern int g_installTTY; 37 | 38 | void dev_tty_init(); 39 | int dev_tty_open(struct File *file, const char *filename, int mode); 40 | int dev_tty_action(struct File *file, enum FileAction action); 41 | int dev_tty_ioctl(struct File *file, int req, int arg); 42 | -------------------------------------------------------------------------------- /openbios/uC-sdk-glue/BoardConsole.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | void BoardConsoleInit(); 32 | void BoardConsolePuts(const char* str); 33 | void BoardConsolePutc(int); 34 | void BoardConsolePrintf(const char* fmt, ...) __attribute__((format(printf, 1, 2))); 35 | void BoardConsoleVPrintf(const char* fmt, va_list ap); 36 | -------------------------------------------------------------------------------- /openbios/uC-sdk-glue/BoardInit.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | void BoardEarlyInit() {} 28 | 29 | void BoardInit() {} 30 | 31 | void BoardLateInit() {} 32 | 33 | void BoardShutdown() {} 34 | 35 | void BoardExceptionHandler(int code) { while (1); } 36 | -------------------------------------------------------------------------------- /openbios/uC-sdk-glue/FreeRTOS.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | -------------------------------------------------------------------------------- /openbios/uC-sdk-glue/init.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | void cpu_early_init() {} 28 | 29 | void cpu_init() {} 30 | 31 | void cpu_late_init() {} 32 | 33 | void __sinit(void* reent) {} 34 | -------------------------------------------------------------------------------- /openbios/uC-sdk-glue/semphr.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | #define portMAX_DELAY 0 32 | 33 | typedef void* xSemaphoreHandle; 34 | static __inline void* xSemaphoreCreateMutex() { return NULL; } 35 | static __inline void xSemaphoreTake(void* semaphore, unsigned timeout) {} 36 | static __inline void xSemaphoreGive(void* semaphore) {} 37 | -------------------------------------------------------------------------------- /psyqo-lua/Makefile: -------------------------------------------------------------------------------- 1 | PSYQOLUADIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 2 | 3 | TARGET = psyqo-lua 4 | TYPE = library 5 | 6 | SRCS = \ 7 | src/lua.cpp \ 8 | 9 | CPPFLAGS += -I$(PSYQOLUADIR)../third_party/psxlua/src 10 | CPPFLAGS += -DLUA_TARGET_PSX 11 | 12 | EXTRA_DEPS += $(PSYQOLUADIR)Makefile 13 | 14 | include ../psyqo/psyqo.mk 15 | -------------------------------------------------------------------------------- /psyqo-lua/compile_flags.txt: -------------------------------------------------------------------------------- 1 | -m32 2 | -std=c++20 3 | -fcoroutines-ts 4 | -I. 5 | -I.. 6 | -I../../../third_party/EASTL/include 7 | -I../../../third_party/EABase/include/Common 8 | -I../../../third_party/psxlua/src 9 | 10 | -------------------------------------------------------------------------------- /psyqo-lua/examples/hello/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = hello 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | hello.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo-lua.mk 13 | -------------------------------------------------------------------------------- /psyqo-lua/psyqo-lua.mk: -------------------------------------------------------------------------------- 1 | ifndef PSYQOLUADIR 2 | PSYQOLUADIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 3 | 4 | LIBRARIES += $(PSYQOLUADIR)libpsyqo-lua.a $(PSYQOLUADIR)../third_party/psxlua/src/liblua.a 5 | 6 | CPPFLAGS += -I$(PSYQOLUADIR)../third_party/psxlua/src 7 | CPPFLAGS += -DLUA_TARGET_PSX 8 | 9 | LDFLAGS += \ 10 | -Wl,--defsym,luaI_sprintf=sprintf_for_Lua \ 11 | -Wl,--defsym,luaI_realloc=psyqo_realloc \ 12 | -Wl,--defsym,luaI_free=psyqo_free \ 13 | 14 | include $(PSYQOLUADIR)../psyqo/psyqo.mk 15 | 16 | $(PSYQOLUADIR)libpsyqo-lua.a: 17 | $(MAKE) -C $(PSYQOLUADIR) BUILD=$(BUILD) CPPFLAGS_$(BUILD)="$(CPPFLAGS_$(BUILD))" LDFLAGS_$(BUILD)="$(LDFLAGS_$(BUILD))" 18 | 19 | $(PSYQOLUADIR)../third_party/psxlua/src/liblua.a: 20 | $(MAKE) -C $(PSYQOLUADIR)../third_party/psxlua/ psx 21 | 22 | clean:: 23 | $(MAKE) -C $(PSYQOLUADIR) clean 24 | $(MAKE) -C $(PSYQOLUADIR)../third_party/psxlua/ clean 25 | 26 | .PHONY: clean $(PSYQOLUADIR)libpsyqo-lua.a $(PSYQOLUADIR)../third_party/psxlua/src/liblua.a 27 | endif 28 | -------------------------------------------------------------------------------- /psyqo-paths/Makefile: -------------------------------------------------------------------------------- 1 | PSYQOPATHSDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 2 | 3 | TARGET = psyqo-paths 4 | TYPE = library 5 | 6 | SRCS = \ 7 | src/cdrom-loader.cpp \ 8 | src/archive-manager.cpp \ 9 | ../ucl-demo/n2e-d.S \ 10 | 11 | EXTRA_DEPS += $(PSYQOPATHSDIR)Makefile 12 | 13 | include ../psyqo/psyqo.mk 14 | -------------------------------------------------------------------------------- /psyqo-paths/README.md: -------------------------------------------------------------------------------- 1 | While the [PSYQo](../psyqo) library is still very light, and not really opinionated on how to process certain operations, it means it can be tedious and verbose to write certain things. This is where the PSYQo Paths library comes in: it provides a set of functions called "Paths" to help with common operations, such as loading a file from CD-Rom. 2 | 3 | The point is to provide a set of functions that are easy to use, but are also too generic to be included in the PSYQo library itself. Using them comes with the caveat that they are not optimized for any specific use case, and may not be the best solution for your specific problem. However, they should be good enough for most cases, and can be used as a starting point for more specific implementations. 4 | 5 | ## Loading a file from CD-Rom 6 | 7 | This Path will allow you to load a file from CD-Rom, and return a vector containing the file's data. As with the rest of PSYQo, the loading is still going to be done asynchronously, so you will need to either pass a callback to the class' method, or use the `schedule` version of the method using the task scheduler. 8 | 9 | See [the example](examples/cdrom-loader) for a full usage example. 10 | -------------------------------------------------------------------------------- /psyqo-paths/compile_flags.txt: -------------------------------------------------------------------------------- 1 | -m32 2 | -std=c++20 3 | -fcoroutines-ts 4 | -I. 5 | -I.. 6 | -I../../../third_party/EASTL/include 7 | -I../../../third_party/EABase/include/Common 8 | -------------------------------------------------------------------------------- /psyqo-paths/examples/cdrom-loader/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = cdrom-loader 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | cdrom-loader.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo-paths.mk 13 | -------------------------------------------------------------------------------- /psyqo-paths/psyqo-paths.mk: -------------------------------------------------------------------------------- 1 | ifndef PSYQOPATHSDIR 2 | PSYQOPATHSDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 3 | 4 | LIBRARIES += $(PSYQOPATHSDIR)libpsyqo-paths.a 5 | 6 | include $(PSYQOPATHSDIR)../psyqo/psyqo.mk 7 | 8 | $(PSYQOPATHSDIR)libpsyqo-paths.a: 9 | $(MAKE) -C $(PSYQOPATHSDIR) BUILD=$(BUILD) CPPFLAGS_$(BUILD)="$(CPPFLAGS_$(BUILD))" LDFLAGS_$(BUILD)="$(LDFLAGS_$(BUILD))" 10 | 11 | clean:: 12 | $(MAKE) -C $(PSYQOPATHSDIR) clean 13 | 14 | .PHONY: clean $(PSYQOPATHSDIR)libpsyqo-paths.a 15 | endif 16 | -------------------------------------------------------------------------------- /psyqo/Makefile: -------------------------------------------------------------------------------- 1 | PSYQODIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 2 | 3 | TARGET = psyqo 4 | TYPE = library 5 | 6 | SRCS = \ 7 | $(wildcard ../third_party/EASTL/source/*.cpp) \ 8 | ../common/crt0/crt0cxx.s \ 9 | ../common/crt0/cxxglue.c \ 10 | ../common/crt0/memory-c.c \ 11 | ../common/crt0/memory-s.s \ 12 | ../common/hardware/flushcache.s \ 13 | ../common/psxlibc/ucontext.s \ 14 | ../common/syscalls/printf.s \ 15 | $(wildcard src/hardware/*.cpp) \ 16 | $(wildcard src/*.cpp) \ 17 | $(wildcard src/*.c) \ 18 | $(wildcard src/*.s) \ 19 | 20 | CPPFLAGS = -I../third_party/EASTL/include -I../third_party/EABase/include/Common 21 | CXXFLAGS = -std=c++20 22 | 23 | ifeq ($(TEST),true) 24 | CPPFLAGS += -Werror 25 | endif 26 | 27 | EXTRA_DEPS += $(PSYQODIR)Makefile 28 | 29 | include ../common.mk 30 | -------------------------------------------------------------------------------- /psyqo/compile_flags.txt: -------------------------------------------------------------------------------- 1 | -m32 2 | -std=c++20 3 | -fcoroutines-ts 4 | -I. 5 | -I.. 6 | -I../../../third_party/EASTL/include 7 | -I../../../third_party/EABase/include/Common 8 | -------------------------------------------------------------------------------- /psyqo/examples/bezier/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = bezier 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | bezier.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/cdda/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = cdda 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | cdda.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/cdrom-demo/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = cdrom-demo 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | cdrom-demo.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/coroutine-demo-2/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = coroutine-demo-2 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | coroutine-demo-2.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 -fcoroutines 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/coroutine-demo-3/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = coroutine-demo-3 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | coroutine-demo-3.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 -fcoroutines 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/coroutine-demo/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = coroutine-demo 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | coroutine-demo.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 -fcoroutines 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/cube/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = cube 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | cube.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/gte/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = gte 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | gte.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/hello-alloc/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = hello 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | hello.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/hello-chained/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = hello-chained 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | hello-chained.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/hello-nokernel/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = hello 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | hello.cpp \ 6 | 7 | LDFLAGS += -Xlinker --defsym=TLOAD_ADDR=0x80001000 8 | 9 | ifeq ($(TEST),true) 10 | CPPFLAGS = -Werror 11 | endif 12 | CXXFLAGS = -std=c++20 13 | 14 | include ../../psyqo.mk 15 | -------------------------------------------------------------------------------- /psyqo/examples/hello/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = hello 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | hello.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/lines/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = lines 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | lines.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/math/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = math 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | math.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/multitap/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = multitap 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | multitap.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/padtest/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = padtest 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | padtest.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/pcsxlua/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = pcsxlua 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | pcsxlua.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/proctex/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = proctex 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | proctex.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/task-demo/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = task-demo 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | task-demo.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = tetris 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | ../../../modplayer/modplayer.c \ 6 | \ 7 | musix-oh-amiga-with-effects.o \ 8 | \ 9 | credits.cpp \ 10 | game.cpp \ 11 | gameover.cpp \ 12 | mainmenu.cpp \ 13 | options.cpp \ 14 | pause.cpp \ 15 | pieces.cpp \ 16 | rand.cpp \ 17 | sound.cpp \ 18 | splash.cpp \ 19 | tetris.cpp \ 20 | 21 | ifeq ($(TEST),true) 22 | CPPFLAGS = -Werror 23 | endif 24 | CXXFLAGS = -std=c++20 25 | 26 | include ../../psyqo.mk 27 | 28 | %.o: %.hit 29 | $(PREFIX)-objcopy -I binary --set-section-alignment .data=4 --rename-section .data=.rodata,alloc,load,readonly,data,contents -O $(FORMAT) -B mips $< $@ 30 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/README.md: -------------------------------------------------------------------------------- 1 | # PSYQo Tetris example 2 | 3 | This is the most complex example so far. It exercises the library to basically do everything. 4 | 5 | The code is thoroughly documented in order to explain the theory behind it. The entry point is located in the [`tetris.cpp`](tetris.cpp) file. 6 | 7 | The game in itself may need some improvements, but is very playable and enjoyable. Things that can be improved: 8 | - The controls feel a little bit kludgy. The tetrominos won't move repeatedly when the player leaves the left or right buttons pressed down. 9 | - The blocks could use some texturing. 10 | - A option menu during the Pause scene would be great to change the volume, or restart the game. 11 | - The background could use some love with some 3D effects. 12 | - Maybe add typical gameplay improvements such as displaying the upcoming piece. 13 | 14 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/credits.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/scene.hh" 30 | 31 | // The Credits scene is simply a splash screen, really. 32 | class Credits final : public psyqo::Scene { 33 | void start(Scene::StartReason reason) override; 34 | void frame() override; 35 | void teardown(Scene::TearDownReason reason) override; 36 | 37 | bool m_leave = false; 38 | }; 39 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/gameover.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/scene.hh" 30 | 31 | // The game over scene. It is very similar to the `Pause` scene. 32 | class GameOver final : public psyqo::Scene { 33 | void start(Scene::StartReason reason) override; 34 | void frame() override; 35 | void teardown(Scene::TearDownReason reason) override; 36 | 37 | bool m_unpause = false; 38 | }; 39 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/musix-oh-amiga-with-effects.hit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/psyqo/examples/tetris/musix-oh-amiga-with-effects.hit -------------------------------------------------------------------------------- /psyqo/examples/tetris/pause.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/scene.hh" 30 | 31 | // The pause scene. See the file pause.cpp for more information. 32 | class Pause final : public psyqo::Scene { 33 | void start(Scene::StartReason reason) override; 34 | void frame() override; 35 | void teardown(Scene::TearDownReason reason) override; 36 | 37 | bool m_unpause = false; 38 | }; 39 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/pieces.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | // The tetromino shapes are defined with all their possible 32 | // rotations. The definition of this array is in the file `pieces.cpp`. 33 | // The first element of the array is the tetromino number, between 34 | // 0 and 6. The second and third elements are the y, x accessors in 35 | // a 4x4 matrix. The fourth element is the rotation number, between 0 and 3. 36 | extern const uint8_t PIECES[7][4][4][4]; 37 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/rand.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "rand.hh" 28 | 29 | uint32_t Rand::rand() { 30 | unsigned int a = m_seed; 31 | a *= 3148259783UL; 32 | m_seed = a; 33 | return a; 34 | } 35 | 36 | void Rand::seed(uint32_t seed) { m_seed = INITIAL_SEED * seed; } 37 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/sound.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | // This is a kludge for now. This will most likely change in the future. 30 | class Sound { 31 | public: 32 | Sound() { m_volume = 63; } 33 | void playClick(); 34 | void playFlip(int pitch); 35 | void playDrop(unsigned volume); 36 | 37 | unsigned m_volume = 0; 38 | }; 39 | -------------------------------------------------------------------------------- /psyqo/examples/tetris/splash.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/scene.hh" 30 | 31 | // This is a simple scene that will display the 32 | // logo, and wait for the user to press the start 33 | // button to go to the main menu. See the implementation 34 | // code in splash.cpp for details. 35 | class SplashScreen final : public psyqo::Scene { 36 | void start(Scene::StartReason reason) override; 37 | void frame() override; 38 | void teardown(Scene::TearDownReason reason) override; 39 | 40 | bool m_startPressed = false; 41 | }; 42 | -------------------------------------------------------------------------------- /psyqo/examples/timers/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = timers 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | timers.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | include ../../psyqo.mk 13 | -------------------------------------------------------------------------------- /psyqo/examples/torus/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = torus 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | torus.cpp \ 6 | 7 | ifeq ($(TEST),true) 8 | CPPFLAGS = -Werror 9 | endif 10 | CXXFLAGS = -std=c++20 11 | 12 | LDFLAGS += -Wl,-wrap,memcpy -Wl,-wrap,memset 13 | 14 | include ../../psyqo.mk 15 | -------------------------------------------------------------------------------- /psyqo/examples/torus/README.md: -------------------------------------------------------------------------------- 1 | # Torus example 2 | 3 | This example contains a very extensive example of how to do 3D using psyqo. It'll render an animated torus with a texture on it, as well as a projected shadow underneath. The code is extensively commented. 4 | 5 | The triangle and cross buttons of the pad can be used to change its color. 6 | -------------------------------------------------------------------------------- /psyqo/hardware/gpu.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/hardware/hwregs.hh" 30 | 31 | namespace psyqo::Hardware::GPU { 32 | 33 | extern Register<0x0810> Data; 34 | extern Register<0x0814> Ctrl; 35 | 36 | } // namespace psyqo::Hardware::GPU 37 | -------------------------------------------------------------------------------- /psyqo/hardware/sbus.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/hardware/hwregs.hh" 30 | 31 | namespace psyqo::Hardware::SBus { 32 | 33 | extern Register<0x0014> Dev4Ctrl; 34 | extern Register<0x0018> Dev5Ctrl; 35 | extern Register<0x0020> ComCtrl; 36 | 37 | } // namespace psyqo::Hardware::SBus 38 | -------------------------------------------------------------------------------- /psyqo/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @mainpage 4 | 5 | This is the online documentation for the PS1 collection of projects named 6 | "nugget", 7 | and in particular, the "psyqo" 8 | project itself. 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /psyqo/matrix.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "psyqo/vector.hh" 30 | 31 | namespace psyqo { 32 | 33 | struct Matrix33 { 34 | Vec3 vs[3]; 35 | }; 36 | 37 | } // namespace psyqo 38 | -------------------------------------------------------------------------------- /psyqo/primitive-concept.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | namespace psyqo { 30 | 31 | /** 32 | * @brief The Primitive concept. 33 | * @details This concept can be used as a template type constraint 34 | * to ensure that a type is a valid primitive. 35 | */ 36 | 37 | template 38 | concept Primitive = requires { 39 | { (alignof(Prim) & 3) == 0 }; 40 | { (sizeof(Prim) & 3) == 0 }; 41 | { 42 | !requires { typename Prim::head; } 43 | }; 44 | }; 45 | 46 | } // namespace psyqo 47 | -------------------------------------------------------------------------------- /psyqo/primitives.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | /** 30 | * @file primitives.hh 31 | * @brief This file is a convenience header that includes all the primitive 32 | * headers. 33 | */ 34 | 35 | #include "psyqo/primitives/control.hh" 36 | #include "psyqo/primitives/lines.hh" 37 | #include "psyqo/primitives/misc.hh" 38 | #include "psyqo/primitives/quads.hh" 39 | #include "psyqo/primitives/rectangles.hh" 40 | #include "psyqo/primitives/sprites.hh" 41 | #include "psyqo/primitives/triangles.hh" 42 | -------------------------------------------------------------------------------- /psyqo/psyqo.mk: -------------------------------------------------------------------------------- 1 | ifndef PSYQODIR 2 | PSYQODIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 3 | 4 | LIBRARIES += $(PSYQODIR)libpsyqo.a 5 | CPPFLAGS += -I$(PSYQODIR)../third_party/EASTL/include -I$(PSYQODIR)../third_party/EABase/include/Common 6 | CXXFLAGS += -std=c++20 7 | 8 | include $(PSYQODIR)../common.mk 9 | 10 | $(PSYQODIR)libpsyqo.a: 11 | $(MAKE) -C $(PSYQODIR) BUILD=$(BUILD) CPPFLAGS_$(BUILD)="$(CPPFLAGS_$(BUILD))" LDFLAGS_$(BUILD)="$(LDFLAGS_$(BUILD))" 12 | 13 | clean:: 14 | $(MAKE) -C $(PSYQODIR) clean 15 | 16 | .PHONY: clean $(PSYQODIR)libpsyqo.a 17 | endif 18 | -------------------------------------------------------------------------------- /psyqo/shared.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2025 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | namespace psyqo { 30 | 31 | /** 32 | * @brief Shared type for safe and unsafe operations throughout the codebase. 33 | */ 34 | enum class Safe : unsigned { No, Yes }; 35 | 36 | } // namespace psyqo 37 | -------------------------------------------------------------------------------- /psyqo/spu.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2024 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | namespace psyqo { 30 | 31 | class SPU { 32 | public: 33 | static void reset(); 34 | static void resetVoice(unsigned voice); 35 | 36 | private: 37 | static void waitIdle(); 38 | }; 39 | 40 | } // namespace psyqo 41 | -------------------------------------------------------------------------------- /psyqo/src/eastl-glue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "psyqo/xprintf.h" 28 | 29 | int Vsnprintf8(char* pDestination, size_t n, const char* pFormat, va_list arguments) { 30 | return vsnprintf(pDestination, n, pFormat, arguments); 31 | } 32 | -------------------------------------------------------------------------------- /psyqo/src/hardware/cpu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "psyqo/hardware/cpu.hh" 28 | 29 | psyqo::Hardware::CPU::IRQReg<0x0070> psyqo::Hardware::CPU::IReg; 30 | psyqo::Hardware::CPU::IRQReg<0x0074> psyqo::Hardware::CPU::IMask; 31 | psyqo::Hardware::Register<0x00f0> psyqo::Hardware::CPU::DPCR; 32 | psyqo::Hardware::Register<0x00f4> psyqo::Hardware::CPU::DICR; 33 | 34 | psyqo::Hardware::Register<0x0000, uint32_t, psyqo::Hardware::WriteQueue::Bypass> 35 | psyqo::Hardware::CPU::WriteQueueFlusher; 36 | -------------------------------------------------------------------------------- /psyqo/src/hardware/gpu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "psyqo/hardware/gpu.hh" 28 | 29 | psyqo::Hardware::Register<0x0810> psyqo::Hardware::GPU::Data; 30 | psyqo::Hardware::Register<0x0814> psyqo::Hardware::GPU::Ctrl; 31 | -------------------------------------------------------------------------------- /psyqo/src/hardware/sbus.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "psyqo/hardware/sbus.hh" 28 | 29 | psyqo::Hardware::Register<0x0014> psyqo::Hardware::SBus::Dev4Ctrl; 30 | psyqo::Hardware::Register<0x0018> psyqo::Hardware::SBus::Dev5Ctrl; 31 | psyqo::Hardware::Register<0x0020> psyqo::Hardware::SBus::ComCtrl; 32 | -------------------------------------------------------------------------------- /psyqo/src/ordering-table.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2024 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "psyqo/ordering-table.hh" 28 | 29 | void psyqo::OrderingTableBase::clear(uint32_t* table, size_t size) { 30 | table[0] = 0xffffff; 31 | for (size_t i = 1; i <= size; i++) { 32 | table[i] = reinterpret_cast(&table[i - 1]) & 0xffffff; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /psyqo/strings-helpers.hh: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2022 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include 31 | 32 | namespace psyqo { 33 | 34 | static inline bool startsWith(const eastl::string_view &s1, const eastl::string_view &s2) { 35 | return s1.rfind(s2, 0) == 0; 36 | } 37 | 38 | } // namespace psyqo 39 | -------------------------------------------------------------------------------- /psyqo/utility-polyfill.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2025 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include 31 | 32 | namespace psyqo { 33 | 34 | template 35 | concept Enum = std::is_enum_v; 36 | 37 | template 38 | constexpr std::underlying_type_t toUnderlying(E v) { 39 | return static_cast>(v); 40 | } 41 | 42 | } // namespace psyqo -------------------------------------------------------------------------------- /scratchstack/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = scratchstack 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | ../common/syscalls/printf.s \ 6 | ../common/crt0/crt0.s \ 7 | ../common/crt0/memory-c.c \ 8 | ../common/crt0/memory-s.s \ 9 | main.c \ 10 | 11 | include ../common.mk 12 | -------------------------------------------------------------------------------- /shell/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = shell 2 | ifeq ($(PACK_SHELL),true) 3 | TYPE = ps-exe 4 | 5 | shell.bin: shell.ps-exe 6 | ../../../ps1-packer shell.ps-exe -tload 0x80030000 -raw -o shell.bin 7 | else 8 | TYPE = bin 9 | LDSCRIPT = shell.ld 10 | endif 11 | 12 | SRCS = \ 13 | ../common/crt0/crt0.s \ 14 | ../common/crt0/memory-c.c \ 15 | ../common/crt0/memory-s.s \ 16 | ../common/syscalls/printf.s \ 17 | blip.hit \ 18 | cdrom.c \ 19 | dcos.c \ 20 | gpu.c \ 21 | hull.c \ 22 | main.c \ 23 | math.c \ 24 | spu.c \ 25 | ../modplayer/modplayer.c \ 26 | 27 | include ../common.mk 28 | 29 | shell_data.o: shell.bin 30 | $(PREFIX)-objcopy -I binary --set-section-alignment .data=4 --rename-section .data=.rodata,alloc,load,readonly,data,contents -O $(FORMAT) -B mips $< $@ 31 | 32 | blip.o: blip.hit 33 | $(PREFIX)-objcopy -I binary --set-section-alignment .data=4 --rename-section .data=.rodata,alloc,load,readonly,data,contents -O $(FORMAT) -B mips $< $@ 34 | -------------------------------------------------------------------------------- /shell/blip.hit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/shell/blip.hit -------------------------------------------------------------------------------- /shell/cdrom.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2021 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void initCD(); 30 | void checkCD(unsigned fps); 31 | int isCDError(); 32 | int isCDSuccess(); 33 | int isCDAudio(); 34 | -------------------------------------------------------------------------------- /shell/hull.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2021 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "shell/math.h" 30 | 31 | int convexHull(struct Vertex2D *v, int n); 32 | -------------------------------------------------------------------------------- /shell/spu.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2021 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | void initSPU(); 30 | void checkSPU(); 31 | void uninitSPU(); 32 | 33 | void spuSchedulePing(); 34 | void spuScheduleIdle(); 35 | void spuScheduleOutro(); 36 | void spuScheduleError(); 37 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -C basic all 3 | $(MAKE) -C cpu all 4 | $(MAKE) -C cop0 all 5 | $(MAKE) -C dma all 6 | $(MAKE) -C libc all 7 | $(MAKE) -C memcpy all 8 | $(MAKE) -C memset all 9 | $(MAKE) -C pcdrv all 10 | 11 | clean: 12 | $(MAKE) -C basic clean 13 | $(MAKE) -C cpu clean 14 | $(MAKE) -C cop0 clean 15 | $(MAKE) -C dma clean 16 | $(MAKE) -C libc clean 17 | $(MAKE) -C memcpy clean 18 | $(MAKE) -C memset clean 19 | $(MAKE) -C pcdrv clean 20 | -------------------------------------------------------------------------------- /tests/basic/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = basic 2 | USE_FUNCTION_SECTIONS = false 3 | TYPE = ps-exe 4 | 5 | SRCS = \ 6 | ../uC-sdk-glue/BoardConsole.c \ 7 | ../uC-sdk-glue/BoardInit.c \ 8 | ../uC-sdk-glue/init.c \ 9 | \ 10 | ../../third_party/uC-sdk/libc/src/cxx-glue.c \ 11 | ../../third_party/uC-sdk/libc/src/errno.c \ 12 | ../../third_party/uC-sdk/libc/src/initfini.c \ 13 | ../../third_party/uC-sdk/libc/src/malloc.c \ 14 | ../../third_party/uC-sdk/libc/src/qsort.c \ 15 | ../../third_party/uC-sdk/libc/src/rand.c \ 16 | ../../third_party/uC-sdk/libc/src/reent.c \ 17 | ../../third_party/uC-sdk/libc/src/stdio.c \ 18 | ../../third_party/uC-sdk/libc/src/string.c \ 19 | ../../third_party/uC-sdk/libc/src/strto.c \ 20 | ../../third_party/uC-sdk/libc/src/unistd.c \ 21 | ../../third_party/uC-sdk/libc/src/xprintf.c \ 22 | ../../third_party/uC-sdk/libc/src/xscanf.c \ 23 | ../../third_party/uC-sdk/libc/src/yscanf.c \ 24 | ../../third_party/uC-sdk/os/src/devfs.c \ 25 | ../../third_party/uC-sdk/os/src/filesystem.c \ 26 | ../../third_party/uC-sdk/os/src/fio.c \ 27 | ../../third_party/uC-sdk/os/src/hash-djb2.c \ 28 | ../../third_party/uC-sdk/os/src/init.c \ 29 | ../../third_party/uC-sdk/os/src/osdebug.c \ 30 | ../../third_party/uC-sdk/os/src/romfs.c \ 31 | ../../third_party/uC-sdk/os/src/sbrk.c \ 32 | 33 | 34 | CPPFLAGS = -DNOFLOATINGPOINT 35 | CPPFLAGS += -I. 36 | CPPFLAGS += -I../../third_party/uC-sdk/libc/include 37 | CPPFLAGS += -I../../third_party/uC-sdk/os/include 38 | CPPFLAGS += -I../../../../third_party/libcester/include 39 | CPPFLAGS += -I../../openbios/uC-sdk-glue 40 | 41 | SRCS += \ 42 | ../../common/syscalls/printf.s \ 43 | ../../common/crt0/uC-sdk-crt0.s \ 44 | basic.c \ 45 | 46 | include ../../common.mk 47 | -------------------------------------------------------------------------------- /tests/gpu/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = gpu 2 | TYPE = ps-exe 3 | 4 | SRCS += \ 5 | ../../common/syscalls/printf.s \ 6 | ../../common/crt0/memory-s.s \ 7 | ../../common/crt0/memory-c.c \ 8 | ../../common/crt0/crt0.s \ 9 | gpu.c \ 10 | 11 | include ../../common.mk 12 | -------------------------------------------------------------------------------- /tests/libc/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = libc 2 | USE_FUNCTION_SECTIONS = false 3 | TYPE = ps-exe 4 | 5 | SRCS = \ 6 | ../uC-sdk-glue/BoardConsole.c \ 7 | ../uC-sdk-glue/BoardInit.c \ 8 | ../uC-sdk-glue/init.c \ 9 | \ 10 | ../../third_party/uC-sdk/libc/src/cxx-glue.c \ 11 | ../../third_party/uC-sdk/libc/src/errno.c \ 12 | ../../third_party/uC-sdk/libc/src/initfini.c \ 13 | ../../third_party/uC-sdk/libc/src/malloc.c \ 14 | ../../third_party/uC-sdk/libc/src/qsort.c \ 15 | ../../third_party/uC-sdk/libc/src/rand.c \ 16 | ../../third_party/uC-sdk/libc/src/reent.c \ 17 | ../../third_party/uC-sdk/libc/src/stdio.c \ 18 | ../../third_party/uC-sdk/libc/src/string.c \ 19 | ../../third_party/uC-sdk/libc/src/strto.c \ 20 | ../../third_party/uC-sdk/libc/src/unistd.c \ 21 | ../../third_party/uC-sdk/libc/src/xprintf.c \ 22 | ../../third_party/uC-sdk/libc/src/xscanf.c \ 23 | ../../third_party/uC-sdk/libc/src/yscanf.c \ 24 | ../../third_party/uC-sdk/os/src/devfs.c \ 25 | ../../third_party/uC-sdk/os/src/filesystem.c \ 26 | ../../third_party/uC-sdk/os/src/fio.c \ 27 | ../../third_party/uC-sdk/os/src/hash-djb2.c \ 28 | ../../third_party/uC-sdk/os/src/init.c \ 29 | ../../third_party/uC-sdk/os/src/osdebug.c \ 30 | ../../third_party/uC-sdk/os/src/romfs.c \ 31 | ../../third_party/uC-sdk/os/src/sbrk.c \ 32 | 33 | 34 | CPPFLAGS = -DNOFLOATINGPOINT 35 | CPPFLAGS += -I. 36 | CPPFLAGS += -I../../third_party/uC-sdk/libc/include 37 | CPPFLAGS += -I../../third_party/uC-sdk/os/include 38 | CPPFLAGS += -I../../../../third_party/libcester/include 39 | CPPFLAGS += -I../../openbios/uC-sdk-glue 40 | 41 | SRCS += \ 42 | ../../common/syscalls/printf.s \ 43 | ../../common/crt0/uC-sdk-crt0.s \ 44 | libc.c \ 45 | 46 | include ../../common.mk 47 | -------------------------------------------------------------------------------- /tests/libc/libc.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #undef unix 28 | #define CESTER_NO_SIGNAL 29 | #define CESTER_NO_TIME 30 | #define EXIT_SUCCESS 0 31 | #define EXIT_FAILURE 1 32 | #include "exotic/cester.h" 33 | #include "longjmp.c" 34 | #include "qsort.c" 35 | #include "string.c" 36 | -------------------------------------------------------------------------------- /tests/libc/longjmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2020 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "common/psxlibc/setjmp.h" 28 | #include "common/syscalls/syscalls.h" 29 | 30 | // clang-format off 31 | 32 | CESTER_BODY( 33 | static struct JmpBuf jmpbuf; 34 | static int count = 0; 35 | ) 36 | 37 | CESTER_TEST(basicSetJmpLongJmp, test_instance, 38 | int r = syscall_setjmp(&jmpbuf); 39 | count++; 40 | 41 | if (r == 0) syscall_longjmp(&jmpbuf, 1); 42 | 43 | cester_assert_int_eq(1, r); 44 | cester_assert_int_eq(2, count); 45 | ) 46 | -------------------------------------------------------------------------------- /tests/memcpy/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = memcpy 2 | USE_FUNCTION_SECTIONS = false 3 | TYPE = ps-exe 4 | 5 | SRCS = \ 6 | ../uC-sdk-glue/BoardConsole.c \ 7 | ../uC-sdk-glue/BoardInit.c \ 8 | ../uC-sdk-glue/init.c \ 9 | \ 10 | ../../third_party/uC-sdk/libc/src/cxx-glue.c \ 11 | ../../third_party/uC-sdk/libc/src/errno.c \ 12 | ../../third_party/uC-sdk/libc/src/initfini.c \ 13 | ../../third_party/uC-sdk/libc/src/malloc.c \ 14 | ../../third_party/uC-sdk/libc/src/qsort.c \ 15 | ../../third_party/uC-sdk/libc/src/rand.c \ 16 | ../../third_party/uC-sdk/libc/src/reent.c \ 17 | ../../third_party/uC-sdk/libc/src/stdio.c \ 18 | ../../third_party/uC-sdk/libc/src/string.c \ 19 | ../../third_party/uC-sdk/libc/src/strto.c \ 20 | ../../third_party/uC-sdk/libc/src/unistd.c \ 21 | ../../third_party/uC-sdk/libc/src/xprintf.c \ 22 | ../../third_party/uC-sdk/libc/src/xscanf.c \ 23 | ../../third_party/uC-sdk/libc/src/yscanf.c \ 24 | ../../third_party/uC-sdk/os/src/devfs.c \ 25 | ../../third_party/uC-sdk/os/src/filesystem.c \ 26 | ../../third_party/uC-sdk/os/src/fio.c \ 27 | ../../third_party/uC-sdk/os/src/hash-djb2.c \ 28 | ../../third_party/uC-sdk/os/src/init.c \ 29 | ../../third_party/uC-sdk/os/src/osdebug.c \ 30 | ../../third_party/uC-sdk/os/src/romfs.c \ 31 | ../../third_party/uC-sdk/os/src/sbrk.c \ 32 | 33 | 34 | CPPFLAGS = -DNOFLOATINGPOINT 35 | CPPFLAGS += -I. 36 | CPPFLAGS += -I../../third_party/uC-sdk/libc/include 37 | CPPFLAGS += -I../../third_party/uC-sdk/os/include 38 | CPPFLAGS += -I../../../../third_party/libcester/include 39 | CPPFLAGS += -I../../openbios/uC-sdk-glue 40 | 41 | SRCS += \ 42 | ../../common/syscalls/printf.s \ 43 | ../../common/crt0/uC-sdk-crt0.s \ 44 | ../../common/crt0/memory-s.s \ 45 | memcpy.c \ 46 | 47 | include ../../common.mk 48 | -------------------------------------------------------------------------------- /tests/memset/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = memset 2 | USE_FUNCTION_SECTIONS = false 3 | TYPE = ps-exe 4 | 5 | SRCS = \ 6 | ../uC-sdk-glue/BoardConsole.c \ 7 | ../uC-sdk-glue/BoardInit.c \ 8 | ../uC-sdk-glue/init.c \ 9 | \ 10 | ../../third_party/uC-sdk/libc/src/cxx-glue.c \ 11 | ../../third_party/uC-sdk/libc/src/errno.c \ 12 | ../../third_party/uC-sdk/libc/src/initfini.c \ 13 | ../../third_party/uC-sdk/libc/src/malloc.c \ 14 | ../../third_party/uC-sdk/libc/src/qsort.c \ 15 | ../../third_party/uC-sdk/libc/src/rand.c \ 16 | ../../third_party/uC-sdk/libc/src/reent.c \ 17 | ../../third_party/uC-sdk/libc/src/stdio.c \ 18 | ../../third_party/uC-sdk/libc/src/string.c \ 19 | ../../third_party/uC-sdk/libc/src/strto.c \ 20 | ../../third_party/uC-sdk/libc/src/unistd.c \ 21 | ../../third_party/uC-sdk/libc/src/xprintf.c \ 22 | ../../third_party/uC-sdk/libc/src/xscanf.c \ 23 | ../../third_party/uC-sdk/libc/src/yscanf.c \ 24 | ../../third_party/uC-sdk/os/src/devfs.c \ 25 | ../../third_party/uC-sdk/os/src/filesystem.c \ 26 | ../../third_party/uC-sdk/os/src/fio.c \ 27 | ../../third_party/uC-sdk/os/src/hash-djb2.c \ 28 | ../../third_party/uC-sdk/os/src/init.c \ 29 | ../../third_party/uC-sdk/os/src/osdebug.c \ 30 | ../../third_party/uC-sdk/os/src/romfs.c \ 31 | ../../third_party/uC-sdk/os/src/sbrk.c \ 32 | 33 | 34 | CPPFLAGS = -DNOFLOATINGPOINT 35 | CPPFLAGS += -I. 36 | CPPFLAGS += -I../../third_party/uC-sdk/libc/include 37 | CPPFLAGS += -I../../third_party/uC-sdk/os/include 38 | CPPFLAGS += -I../../../../third_party/libcester/include 39 | CPPFLAGS += -I../../openbios/uC-sdk-glue 40 | 41 | SRCS += \ 42 | ../../common/syscalls/printf.s \ 43 | ../../common/crt0/uC-sdk-crt0.s \ 44 | ../../common/crt0/memory-s.s \ 45 | memset.c \ 46 | 47 | include ../../common.mk 48 | -------------------------------------------------------------------------------- /tests/pcdrv/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = pcdrv 2 | USE_FUNCTION_SECTIONS = false 3 | TYPE = ps-exe 4 | 5 | SRCS = \ 6 | ../uC-sdk-glue/BoardConsole.c \ 7 | ../uC-sdk-glue/BoardInit.c \ 8 | ../uC-sdk-glue/init.c \ 9 | \ 10 | ../../third_party/uC-sdk/libc/src/cxx-glue.c \ 11 | ../../third_party/uC-sdk/libc/src/errno.c \ 12 | ../../third_party/uC-sdk/libc/src/initfini.c \ 13 | ../../third_party/uC-sdk/libc/src/malloc.c \ 14 | ../../third_party/uC-sdk/libc/src/qsort.c \ 15 | ../../third_party/uC-sdk/libc/src/rand.c \ 16 | ../../third_party/uC-sdk/libc/src/reent.c \ 17 | ../../third_party/uC-sdk/libc/src/stdio.c \ 18 | ../../third_party/uC-sdk/libc/src/string.c \ 19 | ../../third_party/uC-sdk/libc/src/strto.c \ 20 | ../../third_party/uC-sdk/libc/src/unistd.c \ 21 | ../../third_party/uC-sdk/libc/src/xprintf.c \ 22 | ../../third_party/uC-sdk/libc/src/xscanf.c \ 23 | ../../third_party/uC-sdk/libc/src/yscanf.c \ 24 | ../../third_party/uC-sdk/os/src/devfs.c \ 25 | ../../third_party/uC-sdk/os/src/filesystem.c \ 26 | ../../third_party/uC-sdk/os/src/fio.c \ 27 | ../../third_party/uC-sdk/os/src/hash-djb2.c \ 28 | ../../third_party/uC-sdk/os/src/init.c \ 29 | ../../third_party/uC-sdk/os/src/osdebug.c \ 30 | ../../third_party/uC-sdk/os/src/romfs.c \ 31 | ../../third_party/uC-sdk/os/src/sbrk.c \ 32 | 33 | 34 | CPPFLAGS = -DNOFLOATINGPOINT 35 | CPPFLAGS += -I. 36 | CPPFLAGS += -I../../third_party/uC-sdk/libc/include 37 | CPPFLAGS += -I../../third_party/uC-sdk/os/include 38 | CPPFLAGS += -I../../../../third_party/libcester/include 39 | CPPFLAGS += -I../../openbios/uC-sdk-glue 40 | 41 | SRCS += \ 42 | ../../common/syscalls/printf.s \ 43 | ../../common/crt0/uC-sdk-crt0.s \ 44 | pcdrv.c \ 45 | 46 | include ../../common.mk 47 | -------------------------------------------------------------------------------- /tests/uC-sdk-glue/BoardConsole.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | void BoardConsoleInit(); 32 | void BoardConsolePuts(const char* str); 33 | void BoardConsolePutc(int); 34 | void BoardConsolePrintf(const char* fmt, ...) __attribute__((format(printf, 1, 2))); 35 | void BoardConsoleVPrintf(const char* fmt, va_list ap); 36 | -------------------------------------------------------------------------------- /tests/uC-sdk-glue/BoardInit.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #include "common/hardware/pcsxhw.h" 28 | #include "common/syscalls/syscalls.h" 29 | 30 | void BoardEarlyInit() {} 31 | 32 | void BoardInit() {} 33 | 34 | void BoardLateInit() {} 35 | 36 | void BoardShutdown() { 37 | pcsx_exit(0); 38 | syscall__exit(0); 39 | } 40 | 41 | void BoardExceptionHandler(int code) { 42 | pcsx_exit(code); 43 | syscall__exit(code); 44 | } 45 | -------------------------------------------------------------------------------- /tests/uC-sdk-glue/FreeRTOS.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | -------------------------------------------------------------------------------- /tests/uC-sdk-glue/semphr.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | #define portMAX_DELAY 0 32 | 33 | typedef void* xSemaphoreHandle; 34 | static __inline void* xSemaphoreCreateMutex() { return NULL; } 35 | static __inline void xSemaphoreTake(void* semaphore, unsigned timeout) {} 36 | static __inline void xSemaphoreGive(void* semaphore) {} 37 | -------------------------------------------------------------------------------- /third_party/EABase/.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | cscope.out 3 | **/*.swp 4 | **/*.swo 5 | .swp 6 | *.swp 7 | .swo 8 | .TMP 9 | -.d 10 | eastl_build_out 11 | build_bench 12 | bench.bat 13 | build.bat 14 | .p4config 15 | 16 | ## CMake generated files 17 | CMakeCache.txt 18 | cmake_install.cmake 19 | 20 | ## Patch files 21 | *.patch 22 | 23 | ## For Visual Studio Generated projects 24 | *.sln 25 | **/*.vcxproj 26 | **/*.vcxproj.filters 27 | *.VC.opendb 28 | *.sdf 29 | **/*.suo 30 | **/*.user 31 | .vs/* 32 | **/Debug/* 33 | CMakeFiles/* 34 | EASTL.dir/** 35 | RelWithDebInfo/* 36 | Release/* 37 | Win32/* 38 | x64/* 39 | MinSizeRel/* 40 | build*/* 41 | Testing/* 42 | %ALLUSERSPROFILE%/* 43 | 44 | # Buck 45 | /buck-out/ 46 | /.buckd/ 47 | /buckaroo/ 48 | .buckconfig.local 49 | BUCKAROO_DEPS 50 | -------------------------------------------------------------------------------- /third_party/EABase/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/packages/EAMain"] 2 | path = test/packages/EAMain 3 | url = git@github.com:electronicarts/EAMain.git 4 | [submodule "test/packages/EATest"] 5 | path = test/packages/EATest 6 | url = git@github.com:electronicarts/EATest.git 7 | [submodule "test/packages/EAStdC"] 8 | path = test/packages/EAStdC 9 | url = git@github.com:electronicarts/EAStdC.git 10 | [submodule "test/packages/EAAssert"] 11 | path = test/packages/EAAssert 12 | url = git@github.com:electronicarts/EAAssert.git 13 | [submodule "test/packages/EAThread"] 14 | path = test/packages/EAThread 15 | url = git@github.com:electronicarts/EAThread.git 16 | [submodule "test/packages/EASTL"] 17 | path = test/packages/EASTL 18 | url = git@github.com:electronicarts/EASTL.git 19 | -------------------------------------------------------------------------------- /third_party/EABase/.p4ignore: -------------------------------------------------------------------------------- 1 | tags 2 | 3 | .p4config 4 | /.git/ 5 | -------------------------------------------------------------------------------- /third_party/EABase/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2017 Electronic Arts Inc. 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 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. 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 | 3. Neither the name of Electronic Arts, Inc. ("EA") nor the names of 14 | its contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | -------------------------------------------------------------------------------- /third_party/EABase/README.md: -------------------------------------------------------------------------------- 1 | # EABase 2 | 3 | [![Build Status](https://travis-ci.org/electronicarts/EABase.svg?branch=master)](https://travis-ci.org/electronicarts/EABase) 4 | 5 | EABase is a small set of header files that define platform-independent data types and macros. 6 | 7 | 8 | ## Documentation 9 | 10 | Please see [Introduction](doc/EABase.html). 11 | 12 | 13 | ## Compiling sources 14 | 15 | Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on compiling and testing the source. 16 | 17 | 18 | ## Credits 19 | 20 | Roberto Parolin is the current EABase owner within EA and is responsible for the open source repository. 21 | 22 | 23 | ## License 24 | 25 | Modified BSD License (3-Clause BSD license) see the file LICENSE in the project root. 26 | 27 | -------------------------------------------------------------------------------- /third_party/EABase/include/Common/EABase/config/eaplatform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define EA_PLATFORM_NAME "PS1" 4 | #define EA_SYSTEM_LITTLE_ENDIAN 1 5 | #define EA_PLATFORM_DESCRIPTION "PS1" 6 | #define EA_PLATFORM_CONSOLE 1 7 | #define EA_PLATFORM_SONY 1 8 | #define EA_PROCESSOR_MIPS 1 9 | #define EA_PROCESSOR_MIPS_32 1 10 | #define EA_PLATFORM_PTR_SIZE 4 11 | #define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE 12 | #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8 13 | #define EA_MISALIGNED_SUPPORT_LEVEL 0 14 | #define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value. 15 | -------------------------------------------------------------------------------- /third_party/EABase/include/Common/EABase/earesult.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * earesult.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #ifndef INCLUDED_earesult_H 9 | #define INCLUDED_earesult_H 10 | 11 | 12 | #include 13 | 14 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 15 | #pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */ 16 | #endif 17 | 18 | 19 | 20 | /* This result type is width-compatible with most systems. */ 21 | typedef int32_t ea_result_type; 22 | 23 | 24 | namespace EA 25 | { 26 | typedef int32_t result_type; 27 | 28 | enum 29 | { 30 | #ifndef SUCCESS 31 | // Deprecated 32 | // Note: a public MS header has created a define of this name which causes a build error. Fortunately they 33 | // define it to 0 which is compatible. 34 | // see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h 35 | SUCCESS = 0, 36 | #endif 37 | // Deprecated 38 | FAILURE = -1, 39 | 40 | // These values are now the preferred constants 41 | EA_SUCCESS = 0, 42 | EA_FAILURE = -1, 43 | }; 44 | } 45 | 46 | 47 | /* Macro to simplify testing for success. */ 48 | #ifndef EA_SUCCEEDED 49 | #define EA_SUCCEEDED(result) ((result) >= 0) 50 | #endif 51 | 52 | /* Macro to simplfify testing for general failure. */ 53 | #ifndef EA_FAILED 54 | #define EA_FAILED(result) ((result) < 0) 55 | #endif 56 | 57 | 58 | #endif 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /third_party/EABase/include/Common/EABase/version.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * version.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | #ifndef INCLUDED_EABASE_VERSION_H 8 | #define INCLUDED_EABASE_VERSION_H 9 | 10 | /////////////////////////////////////////////////////////////////////////////// 11 | // EABASE_VERSION 12 | // 13 | // We more or less follow the conventional EA packaging approach to versioning 14 | // here. A primary distinction here is that minor versions are defined as two 15 | // digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic 16 | // here is that the value is a counter and not a floating point fraction. 17 | // Note that the major version doesn't have leading zeros. 18 | // 19 | // Example version strings: 20 | // "0.91.00" // Major version 0, minor version 91, patch version 0. 21 | // "1.00.00" // Major version 1, minor and patch version 0. 22 | // "3.10.02" // Major version 3, minor version 10, patch version 02. 23 | // "12.03.01" // Major version 12, minor version 03, patch version 24 | // 25 | // Example usage: 26 | // printf("EABASE version: %s", EABASE_VERSION); 27 | // printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100); 28 | // 29 | /////////////////////////////////////////////////////////////////////////////// 30 | 31 | #ifndef EABASE_VERSION 32 | #define EABASE_VERSION "2.09.12" 33 | #define EABASE_VERSION_N 20912 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /third_party/EABase/test/source/CEntryPoint.cpp: -------------------------------------------------------------------------------- 1 | // EAMain/EAEntryPointMain.inl contains C++ code but it exposes the application entry point with C linkage. 2 | 3 | #include "EAMain/EAEntryPointMain.inl" 4 | #include "EATest/EASTLNewOperatorGuard.inl" 5 | -------------------------------------------------------------------------------- /third_party/EABase/test/source/TestEABase.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #include 6 | #include 7 | 8 | 9 | // What we do here is verify that EA_PRAGMA_ONCE_SUPPORTED works as intended. 10 | // This header file should be #included two times by TestEABase.cpp 11 | // in order to test this. 12 | 13 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 14 | #pragma once 15 | const int EABaseOncePerTranslationUnitTestVariable = 0; // This should get compiled only once ever for a compilation unit. 16 | #else 17 | // Just implement a classic manual header include guard. 18 | // In this case we aren't really testing anything. 19 | #ifndef TESTEABASE_H 20 | #define TESTEABASE_H 21 | const int EABaseOncePerTranslationUnitTestVariable = 0; 22 | #endif 23 | #endif 24 | 25 | 26 | 27 | // EA_EXTERN_TEMPLATE / EA_COMPILER_NO_EXTERN_TEMPLATE 28 | 29 | #if defined(__cplusplus) 30 | template 31 | struct eabase_template 32 | { 33 | T value; 34 | T GetValue() const { return value; } 35 | }; 36 | 37 | EA_EXTERN_TEMPLATE(struct eabase_template); 38 | #endif 39 | 40 | 41 | -------------------------------------------------------------------------------- /third_party/EABase/test/source/TestEABaseSeparate.cpp: -------------------------------------------------------------------------------- 1 | // The purpose of this compilation unit is to test EABase in the absence of other system headers. 2 | // For example TestEABase.cpp directly includes system headers like ctype.h, stddef.h, stdarg, etc. 3 | // However, these headers make it impossible to verify that certain definitions are being provided 4 | // by EABase instead of the system headers being included directly. 5 | 6 | #include 7 | 8 | // This structure tests that EABase types are properly defined. 9 | struct EABaseDefinedTypesStruct 10 | { 11 | char8_t mChar8_t; 12 | char16_t mChar16_t; 13 | char32_t mChar32_t; 14 | wchar_t mWchar_t; 15 | bool8_t mBool8_t; 16 | int8_t mInt8_t; 17 | int16_t mInt16_t; 18 | int32_t mInt32_t; 19 | int64_t mInt64_t; 20 | uint8_t mUint8_t; 21 | uint16_t mUint16_t; 22 | uint32_t mUint32_t; 23 | uint64_t mUint64_t; 24 | intmax_t mIntmax_t; 25 | uintmax_t mUintmax_t; 26 | size_t mSize_t; 27 | ssize_t mSsize_t; 28 | float_t mFloat_t; 29 | double_t mDouble_t; 30 | intptr_t mIntptr_t; 31 | uintptr_t mUintptr_t; 32 | ptrdiff_t mPtrdiff_t; 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /third_party/EASTL/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | # http://git-scm.com/docs/gitattributes 3 | * text=auto 4 | .appveyor.yml -text eol=crlf 5 | .appveyor-mingw.yml -text eol=crlf 6 | ci-*.cmd -text eol=crlf -------------------------------------------------------------------------------- /third_party/EASTL/.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | cscope.out 3 | **/*.swp 4 | **/*.swo 5 | .swp 6 | *.swp 7 | .swo 8 | .TMP 9 | -.d 10 | eastl_build_out 11 | build_bench 12 | bench.bat 13 | build.bat 14 | .p4config 15 | 16 | ## CMake generated files 17 | CMakeCache.txt 18 | cmake_install.cmake 19 | 20 | ## Patch files 21 | *.patch 22 | 23 | ## For Visual Studio Generated projects 24 | *.sln 25 | **/*.vcxproj 26 | **/*.vcxproj.filters 27 | *.VC.opendb 28 | *.sdf 29 | **/*.suo 30 | **/*.user 31 | .vs/* 32 | **/Debug/* 33 | CMakeFiles/* 34 | EASTL.dir/** 35 | RelWithDebInfo/* 36 | Release/* 37 | Win32/* 38 | x64/* 39 | MinSizeRel/* 40 | build*/* 41 | Testing/* 42 | %ALLUSERSPROFILE%/* 43 | 44 | # Buck 45 | /buck-out/ 46 | /.buckd/ 47 | /buckaroo/ 48 | .buckconfig.local 49 | BUCKAROO_DEPS 50 | -------------------------------------------------------------------------------- /third_party/EASTL/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/packages/EABase"] 2 | path = test/packages/EABase 3 | url = ../EABase.git 4 | [submodule "test/packages/EAAssert"] 5 | path = test/packages/EAAssert 6 | url = ../EAAssert.git 7 | [submodule "test/packages/EAMain"] 8 | path = test/packages/EAMain 9 | url = ../EAMain.git 10 | [submodule "test/packages/EAStdC"] 11 | path = test/packages/EAStdC 12 | url = ../EAStdC.git 13 | [submodule "test/packages/EATest"] 14 | path = test/packages/EATest 15 | url = ../EATest.git 16 | [submodule "test/packages/EAThread"] 17 | path = test/packages/EAThread 18 | url = ../EAThread.git 19 | -------------------------------------------------------------------------------- /third_party/EASTL/.p4ignore: -------------------------------------------------------------------------------- 1 | /.git/ 2 | tags 3 | .gitignore 4 | cscope.out 5 | -------------------------------------------------------------------------------- /third_party/EASTL/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Electronic Arts 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /third_party/EASTL/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /third_party/EASTL/doc/EASTL-n2271.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/third_party/EASTL/doc/EASTL-n2271.pdf -------------------------------------------------------------------------------- /third_party/EASTL/doc/html/EASTLDoc.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | font-family: Georgia, "Times New Roman", Times, serif; 4 | font-size: 12pt; 5 | } 6 | 7 | h1 8 | { 9 | font-family: Verdana, Arial, Helvetica, sans-serif; 10 | display: block; 11 | background-color: #BBCCDD; 12 | border: 2px solid #000000; 13 | font-size: 16pt; 14 | font-weight: bold; 15 | padding: 6px; 16 | } 17 | 18 | h2 19 | { 20 | font-size: 14pt; 21 | font-family: Verdana; 22 | border-bottom: 2px solid black; 23 | } 24 | 25 | h3 26 | { 27 | font-family: Verdana; 28 | font-size: 13pt; 29 | font-weight: bold; 30 | } 31 | 32 | .code-example 33 | { 34 | display: block; 35 | background-color: #D1DDE9; 36 | margin-left: 3em; 37 | margin-right: 3em; 38 | margin-top: 1em; 39 | margin-bottom: 1em; 40 | padding: 8px; 41 | border: 2px solid #7993C8; 42 | font-family: "Courier New", Courier, mono; 43 | font-size: 10pt; 44 | white-space: pre; 45 | } 46 | 47 | .code-example-span 48 | { 49 | font-family: "Courier New", Courier, mono; 50 | font-size: 10pt; 51 | white-space: pre; 52 | } 53 | 54 | .code-example-comment 55 | { 56 | background-color: #e0e0f0; 57 | padding: 0px 0px; 58 | font-family: "Courier New", Courier, mono; 59 | font-size: 10pt; 60 | white-space: pre; 61 | color: #999999; 62 | margin: auto auto; 63 | } 64 | 65 | 66 | .faq-question 67 | { 68 | background-color: #D9E2EC; 69 | font-size: 12pt; 70 | font-weight: bold; 71 | margin-top: 0em; 72 | padding-left:5px; 73 | padding-right:8px; 74 | padding-top:2px; 75 | padding-bottom:3px; 76 | margin-bottom: 0.5em; 77 | } 78 | 79 | .faq-answer 80 | { 81 | display: block; 82 | margin: 4pt 1em 0.8em; 83 | } 84 | .indented { 85 | margin-left: 50px; 86 | } 87 | -------------------------------------------------------------------------------- /third_party/EASTL/doc/quick-reference.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcsx-redux/nugget/99b6f2d5922ebd1f8580bdcf6d9ad3a621e8fa8d/third_party/EASTL/doc/quick-reference.pdf -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arch.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // Include the architecture specific implementations 17 | // 18 | #if defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64) 19 | 20 | #include "x86/arch_x86.h" 21 | 22 | #elif defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) 23 | 24 | #include "arm/arch_arm.h" 25 | 26 | #endif 27 | 28 | 29 | ///////////////////////////////////////////////////////////////////////////////// 30 | 31 | 32 | #include "arch_fetch_add.h" 33 | #include "arch_fetch_sub.h" 34 | 35 | #include "arch_fetch_and.h" 36 | #include "arch_fetch_xor.h" 37 | #include "arch_fetch_or.h" 38 | 39 | #include "arch_add_fetch.h" 40 | #include "arch_sub_fetch.h" 41 | 42 | #include "arch_and_fetch.h" 43 | #include "arch_xor_fetch.h" 44 | #include "arch_or_fetch.h" 45 | 46 | #include "arch_exchange.h" 47 | 48 | #include "arch_cmpxchg_weak.h" 49 | #include "arch_cmpxchg_strong.h" 50 | 51 | #include "arch_load.h" 52 | #include "arch_store.h" 53 | 54 | #include "arch_compiler_barrier.h" 55 | 56 | #include "arch_cpu_pause.h" 57 | 58 | #include "arch_memory_barrier.h" 59 | 60 | #include "arch_signal_fence.h" 61 | 62 | #include "arch_thread_fence.h" 63 | 64 | 65 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_H */ 66 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arch_compiler_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_COMPILER_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_COMPILER_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | #define EASTL_ARCH_ATOMIC_COMPILER_BARRIER_AVAILABLE 0 15 | 16 | #define EASTL_ARCH_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_AVAILABLE 0 17 | 18 | 19 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_COMPILER_BARRIER_H */ 20 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arch_cpu_pause.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // copyright (c) electronic arts inc. all rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_CPU_PAUSE_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_CPU_PAUSE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ARCH_ATOMIC_CPU_PAUSE() 17 | // 18 | #if defined(EASTL_ARCH_ATOMIC_CPU_PAUSE) 19 | #define EASTL_ARCH_ATOMIC_CPU_PAUSE_AVAILABLE 1 20 | #else 21 | #define EASTL_ARCH_ATOMIC_CPU_PAUSE_AVAILABLE 0 22 | #endif 23 | 24 | 25 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_CPU_PAUSE_H */ 26 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arch_memory_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_MEMORY_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_MEMORY_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ARCH_ATOMIC_CPU_MB() 17 | // 18 | #if defined(EASTL_ARCH_ATOMIC_CPU_MB) 19 | #define EASTL_ARCH_ATOMIC_CPU_MB_AVAILABLE 1 20 | #else 21 | #define EASTL_ARCH_ATOMIC_CPU_MB_AVAILABLE 0 22 | #endif 23 | 24 | 25 | ///////////////////////////////////////////////////////////////////////////////// 26 | // 27 | // void EASTL_ARCH_ATOMIC_CPU_WMB() 28 | // 29 | #if defined(EASTL_ARCH_ATOMIC_CPU_WMB) 30 | #define EASTL_ARCH_ATOMIC_CPU_WMB_AVAILABLE 1 31 | #else 32 | #define EASTL_ARCH_ATOMIC_CPU_WMB_AVAILABLE 0 33 | #endif 34 | 35 | 36 | ///////////////////////////////////////////////////////////////////////////////// 37 | // 38 | // void EASTL_ARCH_ATOMIC_CPU_RMB() 39 | // 40 | #if defined(EASTL_ARCH_ATOMIC_CPU_RMB) 41 | #define EASTL_ARCH_ATOMIC_CPU_RMB_AVAILABLE 1 42 | #else 43 | #define EASTL_ARCH_ATOMIC_CPU_RMB_AVAILABLE 0 44 | #endif 45 | 46 | 47 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_MEMORY_BARRIER_H */ 48 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arch_signal_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_SIGNAL_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_SIGNAL_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_RELAXED_AVAILABLE 0 15 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_ACQUIRE_AVAILABLE 0 16 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_RELEASE_AVAILABLE 0 17 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_ACQ_REL_AVAILABLE 0 18 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_SEQ_CST_AVAILABLE 0 19 | 20 | 21 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_SIGNAL_FENCE_H */ 22 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arch_thread_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_THREAD_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_THREAD_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ARCH_ATOMIC_THREAD_FENCE_*() 17 | // 18 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED) 19 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED_AVAILABLE 1 20 | #else 21 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED_AVAILABLE 0 22 | #endif 23 | 24 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE) 25 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE_AVAILABLE 1 26 | #else 27 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE_AVAILABLE 0 28 | #endif 29 | 30 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE) 31 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE_AVAILABLE 1 32 | #else 33 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE_AVAILABLE 0 34 | #endif 35 | 36 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL) 37 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL_AVAILABLE 1 38 | #else 39 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL_AVAILABLE 0 40 | #endif 41 | 42 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST) 43 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST_AVAILABLE 1 44 | #else 45 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST_AVAILABLE 0 46 | #endif 47 | 48 | 49 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_THREAD_FENCE_H */ 50 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/arm/arch_arm_thread_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_ARM_THREAD_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_ARM_THREAD_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ARCH_ATOMIC_THREAD_FENCE_*() 17 | // 18 | #if defined(EA_COMPILER_MSVC) 19 | 20 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED() 21 | 22 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE() \ 23 | EASTL_ATOMIC_CPU_MB() 24 | 25 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE() \ 26 | EASTL_ATOMIC_CPU_MB() 27 | 28 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL() \ 29 | EASTL_ATOMIC_CPU_MB() 30 | 31 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST() \ 32 | EASTL_ATOMIC_CPU_MB() 33 | 34 | #endif 35 | 36 | 37 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_ARM_THREAD_FENCE_H */ 38 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/arch/x86/arch_x86_thread_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_ARCH_X86_THREAD_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_ARCH_X86_THREAD_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ARCH_ATOMIC_THREAD_FENCE_*() 17 | // 18 | #if defined(EA_COMPILER_MSVC) 19 | 20 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED() 21 | 22 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE() \ 23 | EASTL_ATOMIC_COMPILER_BARRIER() 24 | 25 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE() \ 26 | EASTL_ATOMIC_COMPILER_BARRIER() 27 | 28 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL() \ 29 | EASTL_ATOMIC_COMPILER_BARRIER() 30 | 31 | #endif 32 | 33 | 34 | #if defined(EA_COMPILER_MSVC) || defined(__clang__) || defined(EA_COMPILER_GNUC) 35 | 36 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST() \ 37 | EASTL_ATOMIC_CPU_MB() 38 | 39 | #endif 40 | 41 | 42 | #endif /* EASTL_ATOMIC_INTERNAL_ARCH_X86_THREAD_FENCE_H */ 43 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_macros/atomic_macros_compiler_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_MACROS_COMPILER_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_MACROS_COMPILER_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ATOMIC_COMPILER_BARRIER() 17 | // 18 | #define EASTL_ATOMIC_COMPILER_BARRIER() \ 19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_COMPILER_BARRIER)() 20 | 21 | 22 | ///////////////////////////////////////////////////////////////////////////////// 23 | // 24 | // void EASTL_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type) 25 | // 26 | #define EASTL_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(val, type) \ 27 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY)(val, type) 28 | 29 | 30 | #endif /* EASTL_ATOMIC_INTERNAL_MACROS_COMPILER_BARRIER_H */ 31 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_macros/atomic_macros_cpu_pause.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_MACROS_CPU_PAUSE_H 7 | #define EASTL_ATOMIC_INTERNAL_MACROS_CPU_PAUSE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ATOMIC_CPU_PAUSE() 17 | // 18 | #define EASTL_ATOMIC_CPU_PAUSE() \ 19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_PAUSE)() 20 | 21 | 22 | #endif /* EASTL_ATOMIC_INTERNAL_MACROS_CPU_PAUSE_H */ 23 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_macros/atomic_macros_memory_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_MACROS_MEMORY_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_MACROS_MEMORY_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ATOMIC_CPU_MB() 17 | // 18 | #define EASTL_ATOMIC_CPU_MB() \ 19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_MB)() 20 | 21 | 22 | ///////////////////////////////////////////////////////////////////////////////// 23 | // 24 | // void EASTL_ATOMIC_CPU_WMB() 25 | // 26 | #define EASTL_ATOMIC_CPU_WMB() \ 27 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_WMB)() 28 | 29 | 30 | ///////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // void EASTL_ATOMIC_CPU_RMB() 33 | // 34 | #define EASTL_ATOMIC_CPU_RMB() \ 35 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_RMB)() 36 | 37 | 38 | #endif /* EASTL_ATOMIC_INTERNAL_MACROS_MEMORY_BARRIER_H */ 39 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_macros/atomic_macros_signal_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_MACROS_SIGNAL_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_MACROS_SIGNAL_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ATOMIC_SIGNAL_FENCE_*() 17 | // 18 | #define EASTL_ATOMIC_SIGNAL_FENCE_RELAXED() \ 19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_RELAXED)() 20 | 21 | #define EASTL_ATOMIC_SIGNAL_FENCE_ACQUIRE() \ 22 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_ACQUIRE)() 23 | 24 | #define EASTL_ATOMIC_SIGNAL_FENCE_RELEASE() \ 25 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_RELEASE)() 26 | 27 | #define EASTL_ATOMIC_SIGNAL_FENCE_ACQ_REL() \ 28 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_ACQ_REL)() 29 | 30 | #define EASTL_ATOMIC_SIGNAL_FENCE_SEQ_CST() \ 31 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_SEQ_CST)() 32 | 33 | 34 | #endif /* EASTL_ATOMIC_INTERNAL_MACROS_SIGNAL_FENCE_H */ 35 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_macros/atomic_macros_thread_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_MACROS_THREAD_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_MACROS_THREAD_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_ATOMIC_THREAD_FENCE_*() 17 | // 18 | #define EASTL_ATOMIC_THREAD_FENCE_RELAXED() \ 19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_RELAXED)() 20 | 21 | #define EASTL_ATOMIC_THREAD_FENCE_ACQUIRE() \ 22 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_ACQUIRE)() 23 | 24 | #define EASTL_ATOMIC_THREAD_FENCE_RELEASE() \ 25 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_RELEASE)() 26 | 27 | #define EASTL_ATOMIC_THREAD_FENCE_ACQ_REL() \ 28 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_ACQ_REL)() 29 | 30 | #define EASTL_ATOMIC_THREAD_FENCE_SEQ_CST() \ 31 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_SEQ_CST)() 32 | 33 | 34 | #endif /* EASTL_ATOMIC_INTERNAL_MACROS_THREAD_FENCE_H */ 35 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_memory_order.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_MEMORY_ORDER_H 7 | #define EASTL_ATOMIC_INTERNAL_MEMORY_ORDER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | namespace eastl 15 | { 16 | 17 | 18 | namespace internal 19 | { 20 | 21 | 22 | struct memory_order_relaxed_s {}; 23 | struct memory_order_read_depends_s {}; 24 | struct memory_order_acquire_s {}; 25 | struct memory_order_release_s {}; 26 | struct memory_order_acq_rel_s {}; 27 | struct memory_order_seq_cst_s {}; 28 | 29 | 30 | } // namespace internal 31 | 32 | 33 | EASTL_CPP17_INLINE_VARIABLE EA_CONSTEXPR auto memory_order_relaxed = internal::memory_order_relaxed_s{}; 34 | EASTL_CPP17_INLINE_VARIABLE EA_CONSTEXPR auto memory_order_read_depends = internal::memory_order_read_depends_s{}; 35 | EASTL_CPP17_INLINE_VARIABLE EA_CONSTEXPR auto memory_order_acquire = internal::memory_order_acquire_s{}; 36 | EASTL_CPP17_INLINE_VARIABLE EA_CONSTEXPR auto memory_order_release = internal::memory_order_release_s{}; 37 | EASTL_CPP17_INLINE_VARIABLE EA_CONSTEXPR auto memory_order_acq_rel = internal::memory_order_acq_rel_s{}; 38 | EASTL_CPP17_INLINE_VARIABLE EA_CONSTEXPR auto memory_order_seq_cst = internal::memory_order_seq_cst_s{}; 39 | 40 | 41 | } // namespace eastl 42 | 43 | 44 | #endif /* EASTL_ATOMIC_INTERNAL_MEMORY_ORDER_H */ 45 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_pop_compiler_options.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | /* NOTE: No Header Guard */ 7 | 8 | 9 | EA_RESTORE_VC_WARNING(); 10 | 11 | EA_RESTORE_CLANG_WARNING(); 12 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/atomic_push_compiler_options.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | /* NOTE: No Header Guard */ 7 | 8 | 9 | // 'class' : multiple assignment operators specified 10 | EA_DISABLE_VC_WARNING(4522); 11 | 12 | // misaligned atomic operation may incur significant performance penalty 13 | // The above warning is emitted in earlier versions of clang incorrectly. 14 | // All eastl::atomic objects are size aligned. 15 | // This is static and runtime asserted. 16 | // Thus we disable this warning. 17 | EA_DISABLE_CLANG_WARNING(-Watomic-alignment); 18 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/compiler_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() 17 | // 18 | #if defined(EASTL_COMPILER_ATOMIC_COMPILER_BARRIER) 19 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_AVAILABLE 1 20 | #else 21 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_AVAILABLE 0 22 | #endif 23 | 24 | 25 | ///////////////////////////////////////////////////////////////////////////////// 26 | // 27 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type) 28 | // 29 | #if defined(EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY) 30 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_AVAILABLE 1 31 | #else 32 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_AVAILABLE 0 33 | #endif 34 | 35 | 36 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_BARRIER_H */ 37 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/compiler_cpu_pause.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_CPU_PAUSE_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_CPU_PAUSE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_CPU_PAUSE() 17 | // 18 | #if defined(EASTL_COMPILER_ATOMIC_CPU_PAUSE) 19 | 20 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE_AVAILABLE 1 21 | 22 | #else 23 | 24 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \ 25 | ((void)0) 26 | 27 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE_AVAILABLE 1 28 | 29 | #endif 30 | 31 | 32 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_CPU_PAUSE_H */ 33 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/compiler_memory_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_MEMORY_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_MEMORY_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_CPU_MB() 17 | // 18 | #if defined(EASTL_COMPILER_ATOMIC_CPU_MB) 19 | #define EASTL_COMPILER_ATOMIC_CPU_MB_AVAILABLE 1 20 | #else 21 | #define EASTL_COMPILER_ATOMIC_CPU_MB_AVAILABLE 0 22 | #endif 23 | 24 | 25 | ///////////////////////////////////////////////////////////////////////////////// 26 | // 27 | // void EASTL_COMPILER_ATOMIC_CPU_WMB() 28 | // 29 | #if defined(EASTL_COMPILER_ATOMIC_CPU_WMB) 30 | #define EASTL_COMPILER_ATOMIC_CPU_WMB_AVAILABLE 1 31 | #else 32 | #define EASTL_COMPILER_ATOMIC_CPU_WMB_AVAILABLE 0 33 | #endif 34 | 35 | 36 | ///////////////////////////////////////////////////////////////////////////////// 37 | // 38 | // void EASTL_COMPILER_ATOMIC_CPU_RMB() 39 | // 40 | #if defined(EASTL_COMPILER_ATOMIC_CPU_RMB) 41 | #define EASTL_COMPILER_ATOMIC_CPU_RMB_AVAILABLE 1 42 | #else 43 | #define EASTL_COMPILER_ATOMIC_CPU_RMB_AVAILABLE 0 44 | #endif 45 | 46 | 47 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_MEMORY_BARRIER_H */ 48 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_GCC_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_GCC_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() 17 | // 18 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() \ 19 | __asm__ __volatile__ ("" ::: "memory") 20 | 21 | 22 | ///////////////////////////////////////////////////////////////////////////////// 23 | // 24 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type) 25 | // 26 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(val, type) \ 27 | __asm__ __volatile__ ("" : /* Output Operands */ : "r"(&(val)) : "memory") 28 | 29 | 30 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_GCC_BARRIER_H */ 31 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_cpu_pause.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_GCC_CPU_PAUSE_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_GCC_CPU_PAUSE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_CPU_PAUSE() 17 | // 18 | #if defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64) 19 | 20 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \ 21 | __asm__ __volatile__ ("pause") 22 | 23 | #elif defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) 24 | 25 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \ 26 | __asm__ __volatile__ ("yield") 27 | 28 | #endif 29 | 30 | 31 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_GCC_CPU_PAUSE_H */ 32 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_signal_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_GCC_SIGNAL_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_GCC_SIGNAL_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | #define EASTL_GCC_ATOMIC_SIGNAL_FENCE(gccMemoryOrder) \ 15 | __atomic_signal_fence(gccMemoryOrder) 16 | 17 | 18 | ///////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // void EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_*() 21 | // 22 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED() \ 23 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_RELAXED) 24 | 25 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE() \ 26 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_ACQUIRE) 27 | 28 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE() \ 29 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_RELEASE) 30 | 31 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL() \ 32 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_ACQ_REL) 33 | 34 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST() \ 35 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_SEQ_CST) 36 | 37 | 38 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_GCC_SIGNAL_FENCE_H */ 39 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_thread_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_GCC_THREAD_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_GCC_THREAD_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | #define EASTL_GCC_ATOMIC_THREAD_FENCE(gccMemoryOrder) \ 15 | __atomic_thread_fence(gccMemoryOrder) 16 | 17 | 18 | ///////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // void EASTL_COMPILER_ATOMIC_THREAD_FENCE_*() 21 | // 22 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELAXED() \ 23 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_RELAXED) 24 | 25 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQUIRE() \ 26 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_ACQUIRE) 27 | 28 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELEASE() \ 29 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_RELEASE) 30 | 31 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQ_REL() \ 32 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_ACQ_REL) 33 | 34 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_SEQ_CST() \ 35 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_SEQ_CST) 36 | 37 | 38 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_GCC_THREAD_FENCE_H */ 39 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_barrier.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_BARRIER_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_BARRIER_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() 17 | // 18 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() \ 19 | EA_DISABLE_CLANG_WARNING(-Wdeprecated-declarations) \ 20 | _ReadWriteBarrier() \ 21 | EA_RESTORE_CLANG_WARNING() 22 | 23 | 24 | ///////////////////////////////////////////////////////////////////////////////// 25 | // 26 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type) 27 | // 28 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(val, type) \ 29 | EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_FUNC(const_cast(eastl::addressof((val)))); \ 30 | EASTL_ATOMIC_COMPILER_BARRIER() 31 | 32 | 33 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_BARRIER_H */ 34 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_cpu_pause.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // copyright (c) electronic arts inc. all rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_CPU_PAUSE_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_CPU_PAUSE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_CPU_PAUSE() 17 | // 18 | // NOTE: 19 | // Rather obscure macro in Windows.h that expands to pause or rep; nop on 20 | // compatible x86 cpus or the arm yield on compatible arm processors. 21 | // This is nicer than switching on platform specific intrinsics. 22 | // 23 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \ 24 | YieldProcessor() 25 | 26 | 27 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_CPU_PAUSE_H */ 28 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_signal_fence.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_SIGNAL_FENCE_H 7 | #define EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_SIGNAL_FENCE_H 8 | 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | 14 | ///////////////////////////////////////////////////////////////////////////////// 15 | // 16 | // void EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_*() 17 | // 18 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED() \ 19 | EASTL_ATOMIC_COMPILER_BARRIER() 20 | 21 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE() \ 22 | EASTL_ATOMIC_COMPILER_BARRIER() 23 | 24 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE() \ 25 | EASTL_ATOMIC_COMPILER_BARRIER() 26 | 27 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL() \ 28 | EASTL_ATOMIC_COMPILER_BARRIER() 29 | 30 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST() \ 31 | EASTL_ATOMIC_COMPILER_BARRIER() 32 | 33 | 34 | #endif /* EASTL_ATOMIC_INTERNAL_COMPILER_MSVC_SIGNAL_FENCE_H */ 35 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/function_help.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTERNAL_FUNCTION_HELP_H 6 | #define EASTL_INTERNAL_FUNCTION_HELP_H 7 | 8 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 9 | #pragma once 10 | #endif 11 | 12 | #include 13 | #include 14 | 15 | namespace eastl 16 | { 17 | namespace internal 18 | { 19 | 20 | ////////////////////////////////////////////////////////////////////// 21 | // is_null 22 | // 23 | template 24 | bool is_null(const T&) 25 | { 26 | return false; 27 | } 28 | 29 | template 30 | bool is_null(Result (*const& function_pointer)(Arguments...)) 31 | { 32 | return function_pointer == nullptr; 33 | } 34 | 35 | template 36 | bool is_null(Result (Class::*const& function_pointer)(Arguments...)) 37 | { 38 | return function_pointer == nullptr; 39 | } 40 | 41 | template 42 | bool is_null(Result (Class::*const& function_pointer)(Arguments...) const) 43 | { 44 | return function_pointer == nullptr; 45 | } 46 | 47 | } // namespace internal 48 | } // namespace eastl 49 | 50 | #endif // Header include guard 51 | 52 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/memory_base.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTERNAL_MEMORY_BASE_H 6 | #define EASTL_INTERNAL_MEMORY_BASE_H 7 | 8 | #include 9 | 10 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 11 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 12 | #endif 13 | 14 | 15 | //////////////////////////////////////////////////////////////////////////////////////////// 16 | // This file contains basic functionality found in the standard library 'memory' header that 17 | // have limited or no dependencies. This allows us to utilize these utilize these functions 18 | // in other EASTL code while avoid circular dependencies. 19 | //////////////////////////////////////////////////////////////////////////////////////////// 20 | 21 | namespace eastl 22 | { 23 | /// addressof 24 | /// 25 | /// From the C++11 Standard, section 20.6.12.1 26 | /// Returns the actual address of the object or function referenced by r, even in the presence of an overloaded operator&. 27 | /// 28 | template 29 | T* addressof(T& value) EA_NOEXCEPT 30 | { 31 | return reinterpret_cast(&const_cast(reinterpret_cast(value))); 32 | } 33 | 34 | } // namespace eastl 35 | 36 | #endif // EASTL_INTERNAL_MEMORY_BASE_H 37 | 38 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/pair_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_PAIR_FWD_DECLS_H 6 | #define EASTL_PAIR_FWD_DECLS_H 7 | 8 | #include 9 | 10 | namespace eastl 11 | { 12 | template 13 | struct pair; 14 | } 15 | 16 | #endif // EASTL_PAIR_FWD_DECLS_H 17 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/internal/piecewise_construct_t.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_PIECEWISE_CONSTRUCT_T_H 7 | #define EASTL_INTERNAL_PIECEWISE_CONSTRUCT_T_H 8 | 9 | 10 | #include 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | /////////////////////////////////////////////////////////////////////////////// 18 | /// piecewise_construct_t 19 | /// 20 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct_t 21 | /// 22 | struct piecewise_construct_t 23 | { 24 | explicit piecewise_construct_t() = default; 25 | }; 26 | 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | /// piecewise_construct 30 | /// 31 | /// A tag type used to disambiguate between function overloads that take two tuple arguments. 32 | /// 33 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct 34 | /// 35 | EA_CONSTEXPR piecewise_construct_t piecewise_construct = eastl::piecewise_construct_t(); 36 | 37 | } // namespace eastl 38 | 39 | 40 | #endif // Header include guard 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/version.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_VERSION_H 6 | #define EASTL_VERSION_H 7 | 8 | #include 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /third_party/EASTL/include/EASTL/weak_ptr.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_WEAK_PTR_H 7 | #define EASTL_WEAK_PTR_H 8 | 9 | 10 | // This header file is deprecated. The implementation has moved: 11 | #include 12 | 13 | 14 | #endif 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /third_party/EASTL/scripts/build.sh: -------------------------------------------------------------------------------- 1 | build_folder=build 2 | 3 | rm -rf $build_folder 4 | mkdir $build_folder 5 | pushd $build_folder 6 | 7 | cmake .. -DEASTL_BUILD_TESTS:BOOL=OFF -DEASTL_BUILD_BENCHMARK:BOOL=ON 8 | cmake --build . --config Release -- -j 32 9 | 10 | cmake .. -DEASTL_BUILD_TESTS:BOOL=OFF -DEASTL_BUILD_BENCHMARK:BOOL=OFF 11 | cmake --build . --config Release -- -j 32 12 | 13 | cmake .. -DEASTL_BUILD_TESTS:BOOL=ON -DEASTL_BUILD_BENCHMARK:BOOL=OFF 14 | cmake --build . --config Release -- -j 32 15 | 16 | cmake .. -DEASTL_BUILD_TESTS:BOOL=ON -DEASTL_BUILD_BENCHMARK:BOOL=ON 17 | cmake --build . --config Release -- -j 32 18 | cmake --build . --config Debug -- -j 32 19 | cmake --build . --config RelWithDebInfo -- -j 32 20 | cmake --build . --config MinSizeRel -- -j 32 21 | pushd test 22 | ctest -C Release -V 23 | ctest -C Debug -V 24 | ctest -C RelWithDebInfo -V 25 | ctest -C MinSizeRel -V 26 | popd 27 | popd 28 | -------------------------------------------------------------------------------- /third_party/EASTL/source/allocator_eastl.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include 7 | #include 8 | 9 | 10 | /////////////////////////////////////////////////////////////////////////////// 11 | // ReadMe 12 | // 13 | // This file implements the default application allocator. 14 | // You can replace this allocator.cpp file with a different one, 15 | // you can define EASTL_USER_DEFINED_ALLOCATOR below to ignore this file, 16 | // or you can modify the EASTL config.h file to redefine how allocators work. 17 | /////////////////////////////////////////////////////////////////////////////// 18 | 19 | 20 | #ifndef EASTL_USER_DEFINED_ALLOCATOR // If the user hasn't declared that he has defined an allocator implementation elsewhere... 21 | 22 | namespace eastl 23 | { 24 | 25 | /// gDefaultAllocator 26 | /// Default global allocator instance. 27 | EASTL_API allocator gDefaultAllocator; 28 | EASTL_API allocator* gpDefaultAllocator = &gDefaultAllocator; 29 | 30 | EASTL_API allocator* GetDefaultAllocator() 31 | { 32 | return gpDefaultAllocator; 33 | } 34 | 35 | EASTL_API allocator* SetDefaultAllocator(allocator* pAllocator) 36 | { 37 | allocator* const pPrevAllocator = gpDefaultAllocator; 38 | gpDefaultAllocator = pAllocator; 39 | return pPrevAllocator; 40 | } 41 | 42 | } // namespace eastl 43 | 44 | 45 | #endif // EASTL_USER_DEFINED_ALLOCATOR 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /third_party/EASTL/source/atomic.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include 7 | 8 | 9 | namespace eastl 10 | { 11 | 12 | namespace internal 13 | { 14 | 15 | 16 | static void EastlCompilerBarrierDataDependencyFunc(void*) 17 | { 18 | } 19 | 20 | volatile CompilerBarrierDataDependencyFuncPtr gCompilerBarrierDataDependencyFunc = &EastlCompilerBarrierDataDependencyFunc; 21 | 22 | 23 | } // namespace internal 24 | 25 | } // namespace eastl 26 | -------------------------------------------------------------------------------- /third_party/EASTL/test/source/EASTLTestAllocator.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTLTEST_ALLOCATOR_H 7 | #define EASTLTEST_ALLOCATOR_H 8 | 9 | #include 10 | #include 11 | 12 | void* operator new(size_t size); 13 | void* operator new[](size_t size); 14 | void* operator new[](size_t size, const char* /*name*/, int /*flags*/, unsigned /*debugFlags*/, const char* /*file*/, int /*line*/); 15 | void* operator new[](size_t size, size_t alignment, size_t /*alignmentOffset*/, const char* /*name*/, int /*flags*/, unsigned /*debugFlags*/, const char* /*file*/, int /*line*/); 16 | void* operator new(size_t size, size_t alignment); 17 | void* operator new(size_t size, size_t alignment, const std::nothrow_t&) EA_THROW_SPEC_NEW_NONE(); 18 | void* operator new[](size_t size, size_t alignment); 19 | void* operator new[](size_t size, size_t alignment, const std::nothrow_t&)EA_THROW_SPEC_NEW_NONE(); 20 | void operator delete(void* p) EA_THROW_SPEC_DELETE_NONE(); 21 | void operator delete[](void* p) EA_THROW_SPEC_DELETE_NONE(); 22 | void EASTLTest_SetGeneralAllocator(); 23 | bool EASTLTest_ValidateHeap(); 24 | 25 | 26 | #endif // Header include guard 27 | -------------------------------------------------------------------------------- /third_party/EASTL/test/source/TestBitcast.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include "EASTLTest.h" 7 | #include 8 | 9 | using namespace eastl; 10 | 11 | 12 | int TestBitcast() 13 | { 14 | int nErrorCount = 0; 15 | 16 | { 17 | uint32_t int32Value = 0x12345678; 18 | float floatValue = eastl::bit_cast(int32Value); 19 | VERIFY(memcmp(&int32Value, &floatValue, sizeof(float)) == 0); 20 | } 21 | 22 | { 23 | struct IntFloatStruct 24 | { 25 | uint32_t i = 0x87654321; 26 | float f = 10.f; 27 | }; 28 | struct CharIntStruct 29 | { 30 | char c1; 31 | char c2; 32 | char c3; 33 | char c4; 34 | uint32_t i; 35 | }; 36 | 37 | IntFloatStruct ifStruct; 38 | CharIntStruct ciStruct = eastl::bit_cast(ifStruct); 39 | VERIFY(memcmp(&ifStruct, &ciStruct, sizeof(IntFloatStruct)) == 0); 40 | } 41 | 42 | #if EASTL_CONSTEXPR_BIT_CAST_SUPPORTED 43 | { 44 | constexpr uint32_t int32Value = 40; 45 | constexpr float floatValue = eastl::bit_cast(int32Value); 46 | VERIFY(memcmp(&int32Value, &floatValue, sizeof(float)) == 0); 47 | } 48 | #endif 49 | 50 | 51 | return nErrorCount; 52 | } 53 | -------------------------------------------------------------------------------- /third_party/EASTL/test/source/TestCharTraits.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #include "EASTLTest.h" 6 | #include 7 | #include 8 | 9 | 10 | template 11 | int TestCharTraits() 12 | { 13 | int nErrorCount = 0; 14 | return nErrorCount; 15 | } 16 | 17 | 18 | int TestCharTraits() 19 | { 20 | using namespace eastl; 21 | 22 | int nErrorCount = 0; 23 | 24 | nErrorCount += TestCharTraits(); 25 | nErrorCount += TestCharTraits(); 26 | nErrorCount += TestCharTraits(); 27 | nErrorCount += TestCharTraits(); 28 | 29 | return nErrorCount; 30 | } 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /third_party/EASTL/test/source/TestCppCXTypeTraits.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include "EASTLTest.h" 7 | #include 8 | 9 | using namespace eastl; 10 | 11 | #if defined(__cplusplus_winrt) 12 | ref class Foo 13 | { 14 | 15 | }; 16 | #endif 17 | 18 | int TestCppCXTypeTraits() 19 | { 20 | int nErrorCount = 0; 21 | 22 | // We can only build this code if C++/CX is enabled 23 | #if defined(__cplusplus_winrt) 24 | { 25 | Foo^ foo = ref new Foo(); 26 | static_assert(eastl::is_pod::value == false, "Ref types are not POD"); 27 | static_assert(eastl::is_trivially_destructible::value == false, "Ref types cannot be trivially destructible"); 28 | static_assert(eastl::is_trivially_constructible::value == false, "Ref types cannot be trivially constructible"); 29 | static_assert(eastl::is_trivially_copy_constructible::value == false, "Ref types cannot be trivially copyable"); 30 | static_assert(eastl::is_trivially_copy_assignable::value == false, "Ref types cannot be trivially copyable"); 31 | } 32 | #endif 33 | 34 | return nErrorCount; 35 | } 36 | -------------------------------------------------------------------------------- /third_party/EASTL/test/source/TestIntrusiveSList.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include "EASTLTest.h" 7 | #include 8 | #include 9 | 10 | 11 | 12 | // Template instantations. 13 | // These tell the compiler to compile all the functions for the given class. 14 | //template class intrusive_slist; 15 | 16 | 17 | 18 | int TestIntrusiveSList() 19 | { 20 | int nErrorCount = 0; 21 | 22 | // As of this writing, we don't yet have a completed intrusive_slist implementation. 23 | // The interface is in place but the implementation hasn't been done yet. 24 | 25 | return nErrorCount; 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /ucl-demo/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = ucl-demo 2 | TYPE = ps-exe 3 | 4 | SRCS = \ 5 | ucl-demo.cpp \ 6 | n2e-d.S \ 7 | ../psyqo/src/adler32.cpp \ 8 | ../common/syscalls/printf.s \ 9 | ../common/crt0/crt0.s \ 10 | 11 | CPPFLAGS = -I../third_party/EASTL/include -I../third_party/EABase/include/Common 12 | 13 | include ../common.mk 14 | -------------------------------------------------------------------------------- /ucl-demo/README.md: -------------------------------------------------------------------------------- 1 | This small demo shows how to use the UCL library to compress and decompress data. It is based on the [UCL library](http://www.oberhumer.com/opensource/ucl/) by Markus F.X.J. Oberhumer. 2 | 3 | While the UCL library itself is GPL licensed, the decompression code in this demo has been written from scratch, and is released under the MIT license. 4 | 5 | The file `ucl-demo.cpp` contains the code for the demo, and should have most of the required documentation to explain how this works. The file `ne2-d.S` contains the decompression code. The file `n2e-d.h` contains the decompression code's header file. 6 | 7 | Creating a compressed file can be done using the `compress.lua` script, which for example can be run as follows to compress the `compress.lua` script itself: 8 | 9 | ``` 10 | pcsx-redux -cli -exec "dofile 'compress.lua' compress('compress.lua', 'demo.bin') PCSX.quit()" 11 | ``` 12 | 13 | Then, once the demo.bin file is created, running the demo can be done as follows: 14 | 15 | ``` 16 | pcsx-redux -stdout -noupdate -pcdrv -pcdrvbase . -run -exe ucl-demo.ps-exe 17 | ``` 18 | 19 | The compression code which is bound to Lua simply uses the `ucl_nrv2e_99_compress` API function call from the UCL library, and can be used independently in other projects to create more custom assets. 20 | -------------------------------------------------------------------------------- /ucl-demo/n2e-d.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 PCSX-Redux authors 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | 27 | #pragma once 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | void n2e_decompress(const void* src, void* dst); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | --------------------------------------------------------------------------------