├── .devcontainer ├── Dockerfile └── devcontainer.json ├── LICENSE ├── README.md ├── code ├── .gitattributes ├── .gitignore ├── Makefile ├── N64_Wasm.vcxproj ├── build.sh ├── cheat.txt ├── config.txt ├── minizip │ ├── crypt.h │ ├── ioapi.c │ ├── ioapi.h │ ├── iowin32.c │ ├── iowin32.h │ ├── miniunz.c │ ├── minizip.c │ ├── mztools.c │ ├── mztools.h │ ├── unzip.c │ ├── unzip.h │ ├── zip.c │ └── zip.h ├── mymain.cpp ├── neil_controller.h ├── overlay.png ├── res │ ├── arial.ttf │ └── font.ttf ├── shader_frag.hlsl ├── shader_vert.hlsl ├── src │ ├── .gitignore │ ├── Graphics │ │ ├── 3dmath.h │ │ ├── 3dmaths.c │ │ ├── GBI.h │ │ ├── HLE │ │ │ └── Microcode │ │ │ │ ├── Fast3D.c │ │ │ │ ├── Fast3D.h │ │ │ │ ├── S2DEX.h │ │ │ │ ├── ZSort.h │ │ │ │ └── turbo3d.h │ │ ├── RDP │ │ │ ├── RDP_state.c │ │ │ ├── RDP_state.h │ │ │ ├── gDP_funcs.cpp │ │ │ ├── gDP_funcs.h │ │ │ ├── gDP_funcs_C.c │ │ │ ├── gDP_funcs_C.h │ │ │ ├── gDP_funcs_prot.h │ │ │ ├── gDP_state.c │ │ │ └── gDP_state.h │ │ ├── RSP │ │ │ ├── RSP_state.c │ │ │ ├── RSP_state.h │ │ │ ├── gSP_funcs.cpp │ │ │ ├── gSP_funcs.h │ │ │ ├── gSP_funcs_C.c │ │ │ ├── gSP_funcs_C.h │ │ │ ├── gSP_funcs_prot.h │ │ │ ├── gSP_state.c │ │ │ └── gSP_state.h │ │ ├── image_convert.h │ │ ├── plugin.h │ │ └── plugins.c │ ├── gles2n64 │ │ └── src │ │ │ ├── 3DMath.c │ │ │ ├── 3DMath.h │ │ │ ├── COPYING │ │ │ ├── CRC.c │ │ │ ├── CRC.h │ │ │ ├── Combiner.h │ │ │ ├── Combiner_gles2n64.c │ │ │ ├── Common.h │ │ │ ├── Config.h │ │ │ ├── Debug.h │ │ │ ├── DepthBuffer.c │ │ │ ├── DepthBuffer.h │ │ │ ├── F3D.c │ │ │ ├── F3D.h │ │ │ ├── F3DDKR.c │ │ │ ├── F3DDKR.h │ │ │ ├── F3DEX.c │ │ │ ├── F3DEX.h │ │ │ ├── F3DEX2.c │ │ │ ├── F3DEX2.h │ │ │ ├── F3DEX2CBFD.c │ │ │ ├── F3DEX2CBFD.h │ │ │ ├── F3DPD.c │ │ │ ├── F3DPD.h │ │ │ ├── F3DSWSE.c │ │ │ ├── F3DSWSE.h │ │ │ ├── F3DWRUS.c │ │ │ ├── F3DWRUS.h │ │ │ ├── FrameBuffer.h │ │ │ ├── FrameBuffer_gles2n64.c │ │ │ ├── GBI.c │ │ │ ├── GBI.h │ │ │ ├── Hash.c │ │ │ ├── L3D.c │ │ │ ├── L3D.h │ │ │ ├── L3DEX.c │ │ │ ├── L3DEX.h │ │ │ ├── L3DEX2.c │ │ │ ├── L3DEX2.h │ │ │ ├── N64.c │ │ │ ├── N64.h │ │ │ ├── OpenGL.c │ │ │ ├── OpenGL.h │ │ │ ├── RDP.c │ │ │ ├── RDP.h │ │ │ ├── RSP.h │ │ │ ├── S2DEX.c │ │ │ ├── S2DEX.h │ │ │ ├── S2DEX2.c │ │ │ ├── S2DEX2.h │ │ │ ├── ShaderCombiner.c │ │ │ ├── ShaderCombiner.h │ │ │ ├── Textures.c │ │ │ ├── Textures.h │ │ │ ├── Turbo3D.c │ │ │ ├── Turbo3D.h │ │ │ ├── VI.c │ │ │ ├── VI.h │ │ │ ├── ZSort.c │ │ │ ├── ZSort.h │ │ │ ├── convert.h │ │ │ ├── gDP.h │ │ │ ├── gDP_gles2n64.c │ │ │ ├── gSP.h │ │ │ ├── gSP_gles2n64.c │ │ │ ├── glN64Config.c │ │ │ ├── gles2N64.c │ │ │ ├── gles2N64.h │ │ │ └── gles2n64_rsp.c │ ├── gles2rice │ │ ├── data │ │ │ └── RiceVideoLinux.ini │ │ └── src │ │ │ ├── Blender.cpp │ │ │ ├── Blender.h │ │ │ ├── COLOR.h │ │ │ ├── CSortedList.h │ │ │ ├── Combiner.cpp │ │ │ ├── Combiner.h │ │ │ ├── CombinerDefs.h │ │ │ ├── Config.h │ │ │ ├── ConvertImage.cpp │ │ │ ├── ConvertImage.h │ │ │ ├── ConvertImage16.cpp │ │ │ ├── Debugger.h │ │ │ ├── DecodedMux.cpp │ │ │ ├── DecodedMux.h │ │ │ ├── DeviceBuilder.cpp │ │ │ ├── DeviceBuilder.h │ │ │ ├── FrameBuffer.cpp │ │ │ ├── FrameBuffer.h │ │ │ ├── GraphicsContext.cpp │ │ │ ├── GraphicsContext.h │ │ │ ├── IColor.h │ │ │ ├── OGLCombiner.cpp │ │ │ ├── OGLCombiner.h │ │ │ ├── OGLDecodedMux.cpp │ │ │ ├── OGLDecodedMux.h │ │ │ ├── OGLES2FragmentShaders.cpp │ │ │ ├── OGLES2FragmentShaders.h │ │ │ ├── OGLExtCombiner.cpp │ │ │ ├── OGLExtCombiner.h │ │ │ ├── OGLExtRender.cpp │ │ │ ├── OGLExtRender.h │ │ │ ├── OGLGraphicsContext.cpp │ │ │ ├── OGLGraphicsContext.h │ │ │ ├── OGLRender.cpp │ │ │ ├── OGLRender.h │ │ │ ├── OGLRenderExt.cpp │ │ │ ├── OGLTexture.cpp │ │ │ ├── OGLTexture.h │ │ │ ├── RDP_Texture.h │ │ │ ├── RSP_GBI0.h │ │ │ ├── RSP_GBI1.h │ │ │ ├── RSP_GBI2.h │ │ │ ├── RSP_GBI2_ext.h │ │ │ ├── RSP_GBI_Others.h │ │ │ ├── RSP_GBI_Sprite2D.h │ │ │ ├── RSP_Parser.cpp │ │ │ ├── RSP_Parser.h │ │ │ ├── RSP_S2DEX.cpp │ │ │ ├── RSP_S2DEX.h │ │ │ ├── Render.cpp │ │ │ ├── Render.h │ │ │ ├── RenderBase.cpp │ │ │ ├── RenderBase.h │ │ │ ├── RenderExt.cpp │ │ │ ├── RenderTexture.cpp │ │ │ ├── RenderTexture.h │ │ │ ├── RiceConfig.cpp │ │ │ ├── RiceDebugger.cpp │ │ │ ├── Texture.cpp │ │ │ ├── Texture.h │ │ │ ├── TextureManager.cpp │ │ │ ├── TextureManager.h │ │ │ ├── Timing.h │ │ │ ├── UcodeDefs.h │ │ │ ├── VectorMath.cpp │ │ │ ├── VectorMath.h │ │ │ ├── Video.cpp │ │ │ ├── Video.h │ │ │ ├── arm_features.h │ │ │ ├── gDP_rice.cpp │ │ │ ├── gSP_rice.cpp │ │ │ ├── osal_opengl.h │ │ │ ├── osal_preproc.h │ │ │ ├── typedefs.h │ │ │ ├── ucode.h │ │ │ └── version.h │ ├── glide2gl │ │ └── src │ │ │ ├── Glide64 │ │ │ ├── 3dmath.h │ │ │ ├── CRC.h │ │ │ ├── Combine.c │ │ │ ├── Combine.h │ │ │ ├── Framebuffer_glide64.c │ │ │ ├── Framebuffer_glide64.h │ │ │ ├── Glide64_Ini.c │ │ │ ├── Glide64_Ini.h │ │ │ ├── Glide64_UCode.c │ │ │ ├── Glide64_UCode.h │ │ │ ├── GlideExtensions.h │ │ │ ├── Help │ │ │ │ ├── Glide64 Known Issues.html │ │ │ │ ├── Glide64 Readme.html │ │ │ │ └── Glide64 compatibility list.html │ │ │ ├── MiClWr.c │ │ │ ├── MiClWr.h │ │ │ ├── TexCache.c │ │ │ ├── TexCache.h │ │ │ ├── TexLoad.c │ │ │ ├── TexLoad.h │ │ │ ├── Util.h │ │ │ ├── glide64_3dmath.c │ │ │ ├── glide64_gDP.c │ │ │ ├── glide64_gDP.h │ │ │ ├── glide64_gSP.c │ │ │ ├── glide64_gSP.h │ │ │ ├── glide64_rdp.c │ │ │ ├── glide64_util.c │ │ │ ├── glidemain.c │ │ │ ├── rdp.h │ │ │ ├── turbo3D.h │ │ │ ├── ucode.h │ │ │ ├── ucode00.h │ │ │ ├── ucode01.h │ │ │ ├── ucode02.h │ │ │ ├── ucode03.h │ │ │ ├── ucode04.h │ │ │ ├── ucode05.h │ │ │ ├── ucode06.h │ │ │ ├── ucode07.h │ │ │ ├── ucode08.h │ │ │ ├── ucode09.h │ │ │ ├── ucode09rdp.h │ │ │ ├── ucodeFB.h │ │ │ ├── ucode_f3dex2acclaim.h │ │ │ └── ucode_f3dtexa.h │ │ │ └── Glitch64 │ │ │ ├── geometry.c │ │ │ ├── glide.h │ │ │ ├── glitch64_combiner.c │ │ │ ├── glitch64_textures.c │ │ │ ├── glitchmain.c │ │ │ ├── glitchmain.h │ │ │ └── uthash.h │ ├── include │ │ └── GL │ │ │ └── glext.h │ ├── libretro-common │ │ ├── audio │ │ │ ├── conversion │ │ │ │ ├── float_to_s16.c │ │ │ │ ├── float_to_s16_neon.S │ │ │ │ ├── float_to_s16_neon.c │ │ │ │ ├── s16_to_float.c │ │ │ │ ├── s16_to_float_neon.S │ │ │ │ └── s16_to_float_neon.c │ │ │ └── resampler │ │ │ │ ├── audio_resampler.c │ │ │ │ └── drivers │ │ │ │ ├── nearest_resampler.c │ │ │ │ ├── null_resampler.c │ │ │ │ ├── sinc_resampler.c │ │ │ │ └── sinc_resampler_neon.S │ │ ├── compat │ │ │ ├── compat_fnmatch.c │ │ │ ├── compat_getopt.c │ │ │ ├── compat_ifaddrs.c │ │ │ ├── compat_posix_string.c │ │ │ ├── compat_snprintf.c │ │ │ ├── compat_strcasestr.c │ │ │ ├── compat_strl.c │ │ │ └── fopen_utf8.c │ │ ├── encodings │ │ │ ├── encoding_crc32.c │ │ │ └── encoding_utf.c │ │ ├── features │ │ │ └── features_cpu.c │ │ ├── file │ │ │ ├── config_file.c │ │ │ ├── config_file_userdata.c │ │ │ └── file_path.c │ │ ├── gfx │ │ │ └── gl_capabilities.c │ │ ├── glsm │ │ │ └── glsm.c │ │ ├── glsym │ │ │ ├── README.md │ │ │ ├── glgen.py │ │ │ ├── glsym_es2.c │ │ │ ├── glsym_es3.c │ │ │ ├── glsym_gl.c │ │ │ ├── rglgen.c │ │ │ └── rglgen.py │ │ ├── hash │ │ │ └── rhash.c │ │ ├── include │ │ │ ├── audio │ │ │ │ ├── audio_resampler.h │ │ │ │ └── conversion │ │ │ │ │ ├── float_to_s16.h │ │ │ │ │ └── s16_to_float.h │ │ │ ├── boolean.h │ │ │ ├── clamping.h │ │ │ ├── compat │ │ │ │ ├── apple_compat.h │ │ │ │ ├── fnmatch.h │ │ │ │ ├── fopen_utf8.h │ │ │ │ ├── getopt.h │ │ │ │ ├── ifaddrs.h │ │ │ │ ├── intrinsics.h │ │ │ │ ├── msvc.h │ │ │ │ ├── msvc │ │ │ │ │ └── stdint.h │ │ │ │ ├── posix_string.h │ │ │ │ ├── strcasestr.h │ │ │ │ ├── strl.h │ │ │ │ ├── zlib.h │ │ │ │ └── zutil.h │ │ │ ├── encodings │ │ │ │ ├── crc32.h │ │ │ │ └── utf.h │ │ │ ├── features │ │ │ │ └── features_cpu.h │ │ │ ├── file │ │ │ │ ├── config_file.h │ │ │ │ ├── config_file_userdata.h │ │ │ │ └── file_path.h │ │ │ ├── filters.h │ │ │ ├── gfx │ │ │ │ └── gl_capabilities.h │ │ │ ├── glsm │ │ │ │ ├── glsm.h │ │ │ │ └── glsmsym.h │ │ │ ├── glsym │ │ │ │ ├── glsym.h │ │ │ │ ├── glsym_es2.h │ │ │ │ ├── glsym_gl.h │ │ │ │ ├── rglgen.h │ │ │ │ └── rglgen_headers.h │ │ │ ├── libco.h │ │ │ ├── libretro.h │ │ │ ├── lists │ │ │ │ └── string_list.h │ │ │ ├── memalign.h │ │ │ ├── memmap.h │ │ │ ├── retro_assert.h │ │ │ ├── retro_common.h │ │ │ ├── retro_common_api.h │ │ │ ├── retro_endianness.h │ │ │ ├── retro_inline.h │ │ │ ├── retro_math.h │ │ │ ├── retro_miscellaneous.h │ │ │ ├── retro_timers.h │ │ │ ├── rhash.h │ │ │ ├── streams │ │ │ │ └── file_stream.h │ │ │ ├── string │ │ │ │ └── stdstring.h │ │ │ └── vfs │ │ │ │ └── vfs_implementation.h │ │ ├── libco │ │ │ ├── aarch64.c │ │ │ ├── amd64.c │ │ │ ├── armeabi.c │ │ │ ├── fiber.c │ │ │ ├── libco.c │ │ │ ├── ppc.c │ │ │ ├── psp2.c │ │ │ ├── scefiber.c │ │ │ ├── sjlj.c │ │ │ ├── ucontext.c │ │ │ └── x86.c │ │ ├── lists │ │ │ └── string_list.c │ │ ├── memmap │ │ │ └── memalign.c │ │ ├── streams │ │ │ └── file_stream.c │ │ ├── string │ │ │ └── stdstring.c │ │ └── vfs │ │ │ └── vfs_implementation.c │ ├── libretro │ │ ├── brumme_crc.c │ │ ├── libretro.c │ │ ├── libretro_crc.c │ │ ├── libretro_memory.h │ │ ├── libretro_perf.h │ │ ├── libretro_private.h │ │ ├── libretronew.c │ │ ├── link.T │ │ ├── msvc │ │ │ ├── GL │ │ │ │ └── glext.h │ │ │ └── msvc-2013 │ │ │ │ └── libretro.def │ │ └── neil.h │ ├── mupen64plus-core │ │ ├── INSTALL │ │ ├── LICENSES │ │ ├── README │ │ ├── RELEASE │ │ ├── doc │ │ │ ├── emuwiki-api-doc │ │ │ │ ├── Mupen64Plus_Core_Parameters.txt │ │ │ │ ├── Mupen64Plus_Plugin_Parameters.txt │ │ │ │ ├── Mupen64Plus_v2.0_Core_API_v1.0.txt │ │ │ │ ├── Mupen64Plus_v2.0_Core_Basic.txt │ │ │ │ ├── Mupen64Plus_v2.0_Core_Config.txt │ │ │ │ ├── Mupen64Plus_v2.0_Core_Debugger.txt │ │ │ │ ├── Mupen64Plus_v2.0_Core_Front-End.txt │ │ │ │ ├── Mupen64Plus_v2.0_Core_Video_Extension.txt │ │ │ │ ├── Mupen64Plus_v2.0_Design_Proposal_3.txt │ │ │ │ ├── Mupen64Plus_v2.0_Plugin_API.txt │ │ │ │ └── Mupen64Plus_v2.0_headers.txt │ │ │ ├── font-license │ │ │ ├── gpl-license │ │ │ ├── lgpl-license │ │ │ ├── module-api-versions.txt │ │ │ └── new_dynarec.txt │ │ ├── src │ │ │ ├── ai │ │ │ │ ├── ai_controller.c │ │ │ │ └── ai_controller.h │ │ │ ├── api │ │ │ │ ├── Gfx_1.3.h │ │ │ │ ├── audio_backend.h │ │ │ │ ├── callbacks.c │ │ │ │ ├── callbacks.h │ │ │ │ ├── common.c │ │ │ │ ├── config.c │ │ │ │ ├── config.h │ │ │ │ ├── debugger.c │ │ │ │ ├── debugger.h │ │ │ │ ├── frontend.c │ │ │ │ ├── libretro_vulkan.h │ │ │ │ ├── m64p_common.h │ │ │ │ ├── m64p_config.h │ │ │ │ ├── m64p_debugger.h │ │ │ │ ├── m64p_frontend.h │ │ │ │ ├── m64p_plugin.h │ │ │ │ ├── m64p_types.h │ │ │ │ ├── m64p_vidext.h │ │ │ │ ├── msvc_compat.h │ │ │ │ ├── retro_inline.h │ │ │ │ ├── vidext.h │ │ │ │ └── vidext_libretro.c │ │ │ ├── dd │ │ │ │ ├── dd_controller.c │ │ │ │ ├── dd_controller.h │ │ │ │ ├── dd_disk.c │ │ │ │ ├── dd_disk.h │ │ │ │ ├── dd_rom.c │ │ │ │ └── dd_rom.h │ │ │ ├── debugger │ │ │ │ ├── dbg_breakpoints.c │ │ │ │ ├── dbg_breakpoints.h │ │ │ │ ├── dbg_decoder.c │ │ │ │ ├── dbg_decoder.h │ │ │ │ ├── dbg_decoder_local.h │ │ │ │ ├── dbg_memory.c │ │ │ │ ├── dbg_memory.h │ │ │ │ ├── dbg_types.h │ │ │ │ ├── debugger.c │ │ │ │ └── debugger.h │ │ │ ├── gb │ │ │ │ ├── gb_cart.c │ │ │ │ └── gb_cart.h │ │ │ ├── main │ │ │ │ ├── cheat.c │ │ │ │ ├── cheat.h │ │ │ │ ├── device.c │ │ │ │ ├── device.h │ │ │ │ ├── eventloop.c │ │ │ │ ├── eventloop.h │ │ │ │ ├── list.h │ │ │ │ ├── main.c │ │ │ │ ├── main.h │ │ │ │ ├── md5.c │ │ │ │ ├── md5.h │ │ │ │ ├── profile.c │ │ │ │ ├── profile.h │ │ │ │ ├── rom.c │ │ │ │ ├── rom.h │ │ │ │ ├── rom_luts.c │ │ │ │ ├── savestates.c │ │ │ │ ├── savestates.h │ │ │ │ ├── util.c │ │ │ │ ├── util.h │ │ │ │ └── version.h │ │ │ ├── memory │ │ │ │ ├── m64p_memory.c │ │ │ │ └── memory.h │ │ │ ├── osal │ │ │ │ └── preproc.h │ │ │ ├── pi │ │ │ │ ├── cart_rom.c │ │ │ │ ├── cart_rom.h │ │ │ │ ├── flashram.c │ │ │ │ ├── flashram.h │ │ │ │ ├── pi_controller.c │ │ │ │ ├── pi_controller.h │ │ │ │ ├── sram.c │ │ │ │ └── sram.h │ │ │ ├── pifbootrom │ │ │ │ ├── pifbootrom.c │ │ │ │ └── pifbootrom.h │ │ │ ├── plugin │ │ │ │ ├── audio_libretro │ │ │ │ │ ├── audio_backend_libretro.c │ │ │ │ │ └── audio_plugin.h │ │ │ │ ├── emulate_game_controller_via_input_plugin.c │ │ │ │ ├── emulate_game_controller_via_input_plugin.h │ │ │ │ ├── emulate_game_controller_via_libretro.c │ │ │ │ ├── get_time_using_C_localtime.c │ │ │ │ ├── get_time_using_C_localtime.h │ │ │ │ ├── plugin.c │ │ │ │ ├── plugin.h │ │ │ │ ├── rumble_via_input_plugin.c │ │ │ │ └── rumble_via_input_plugin.h │ │ │ ├── r4300 │ │ │ │ ├── cached_interp.c │ │ │ │ ├── cached_interp.h │ │ │ │ ├── cp0.c │ │ │ │ ├── cp0.h │ │ │ │ ├── cp0_private.h │ │ │ │ ├── cp1.c │ │ │ │ ├── cp1.h │ │ │ │ ├── cp1_private.h │ │ │ │ ├── empty_dynarec.c │ │ │ │ ├── exception.c │ │ │ │ ├── exception.h │ │ │ │ ├── fpu.h │ │ │ │ ├── hacktarux_dynarec │ │ │ │ │ ├── assemble.c │ │ │ │ │ ├── assemble.h │ │ │ │ │ ├── assemble_struct.h │ │ │ │ │ ├── dyna_start.S │ │ │ │ │ ├── dyna_start_nasm_x64.S │ │ │ │ │ ├── dyna_start_nasm_x86.S │ │ │ │ │ ├── hacktarux_dynarec.c │ │ │ │ │ ├── interpret.h │ │ │ │ │ ├── regcache.c │ │ │ │ │ └── regcache.h │ │ │ │ ├── instr_counters.c │ │ │ │ ├── instr_counters.h │ │ │ │ ├── interrupt.c │ │ │ │ ├── interrupt.h │ │ │ │ ├── macros.h │ │ │ │ ├── mi_controller.c │ │ │ │ ├── mi_controller.h │ │ │ │ ├── mips_instructions.def │ │ │ │ ├── new_dynarec │ │ │ │ │ ├── new_dynarec.c │ │ │ │ │ ├── new_dynarec.h │ │ │ │ │ └── new_dynarec_64.c │ │ │ │ ├── ops.h │ │ │ │ ├── pure_interp.c │ │ │ │ ├── pure_interp.h │ │ │ │ ├── r4300.c │ │ │ │ ├── r4300.h │ │ │ │ ├── r4300_core.c │ │ │ │ ├── r4300_core.h │ │ │ │ ├── recomp.c │ │ │ │ ├── recomp.h │ │ │ │ ├── recomp_types.h │ │ │ │ ├── recomph.h │ │ │ │ ├── reset.c │ │ │ │ ├── reset.h │ │ │ │ ├── tlb.c │ │ │ │ └── tlb.h │ │ │ ├── rdp │ │ │ │ ├── fb.c │ │ │ │ ├── fb.h │ │ │ │ ├── rdp_core.c │ │ │ │ └── rdp_core.h │ │ │ ├── ri │ │ │ │ ├── rdram.c │ │ │ │ ├── rdram.h │ │ │ │ ├── rdram_detection_hack.c │ │ │ │ ├── rdram_detection_hack.h │ │ │ │ ├── ri_controller.c │ │ │ │ └── ri_controller.h │ │ │ ├── rsp │ │ │ │ ├── rsp_core.c │ │ │ │ └── rsp_core.h │ │ │ ├── si │ │ │ │ ├── af_rtc.c │ │ │ │ ├── af_rtc.h │ │ │ │ ├── cic.c │ │ │ │ ├── cic.h │ │ │ │ ├── eeprom.c │ │ │ │ ├── eeprom.h │ │ │ │ ├── game_controller.c │ │ │ │ ├── game_controller.h │ │ │ │ ├── mempak.c │ │ │ │ ├── mempak.h │ │ │ │ ├── n64_cic_nus_6105.c │ │ │ │ ├── n64_cic_nus_6105.h │ │ │ │ ├── pif.c │ │ │ │ ├── pif.h │ │ │ │ ├── rumblepak.c │ │ │ │ ├── rumblepak.h │ │ │ │ ├── si_controller.c │ │ │ │ ├── si_controller.h │ │ │ │ ├── transferpak.c │ │ │ │ └── transferpak.h │ │ │ └── vi │ │ │ │ ├── vi_controller.c │ │ │ │ └── vi_controller.h │ │ └── tools │ │ │ ├── build_bundle_bin.sh │ │ │ ├── build_bundle_src.sh │ │ │ ├── build_modules_src.sh │ │ │ ├── cheat_code_convert.py │ │ │ ├── install_binary_bundle.sh │ │ │ ├── m64p_helper_scripts.tar.gz │ │ │ ├── profiling.txt │ │ │ ├── r4300prof.c │ │ │ ├── regtests │ │ │ ├── daily-tests.cfg │ │ │ └── regression-video.py │ │ │ ├── savestate_convert.c │ │ │ ├── savestate_convert.txt │ │ │ └── uninstall_binary_bundle.sh │ ├── mupen64plus-rsp-cxd4 │ │ ├── COPYING │ │ ├── README.md │ │ ├── config.h │ │ ├── module.c │ │ ├── module.h │ │ ├── my_types.h │ │ ├── rsp.c │ │ ├── rsp.h │ │ ├── rsp_dump.cpp │ │ ├── rsp_dump.h │ │ ├── sse2neon │ │ │ └── SSE2NEON.h │ │ ├── su.c │ │ ├── su.h │ │ └── vu │ │ │ ├── add.c │ │ │ ├── add.h │ │ │ ├── divide.c │ │ │ ├── divide.h │ │ │ ├── logical.c │ │ │ ├── logical.h │ │ │ ├── multiply.c │ │ │ ├── multiply.h │ │ │ ├── pack.h │ │ │ ├── select.c │ │ │ ├── select.h │ │ │ ├── vu.c │ │ │ └── vu.h │ ├── mupen64plus-rsp-hle │ │ ├── INSTALL │ │ ├── LICENSES │ │ ├── RELEASE │ │ └── src │ │ │ ├── alist.c │ │ │ ├── alist.h │ │ │ ├── alist_audio.c │ │ │ ├── alist_naudio.c │ │ │ ├── alist_nead.c │ │ │ ├── arithmetics.h │ │ │ ├── audio.c │ │ │ ├── audio.h │ │ │ ├── cicx105.c │ │ │ ├── common.h │ │ │ ├── hle.c │ │ │ ├── hle.h │ │ │ ├── hle_external.h │ │ │ ├── hle_internal.h │ │ │ ├── hle_memory.c │ │ │ ├── hle_plugin.c │ │ │ ├── jpeg.c │ │ │ ├── memory.h │ │ │ ├── mp3.c │ │ │ ├── musyx.c │ │ │ ├── re2.c │ │ │ ├── rsp_api_export.ver │ │ │ └── ucodes.h │ ├── mupen64plus-rsp-paraLLEl │ │ ├── .clang-format │ │ ├── .gitignore │ │ ├── .gitrepo │ │ ├── CMakeLists.txt │ │ ├── CREDITS.txt │ │ ├── LICENSE │ │ ├── LICENSE.LESSER │ │ ├── LICENSE.MIT │ │ ├── android_fuzz_runner.sh │ │ ├── android_test_runner.sh │ │ ├── arch │ │ │ └── simd │ │ │ │ └── rsp │ │ │ │ ├── SSE2NEON.h │ │ │ │ ├── clamp.h │ │ │ │ ├── rsp_common.h │ │ │ │ ├── rsp_core.cpp │ │ │ │ ├── rsp_impl.h │ │ │ │ ├── vabs.h │ │ │ │ ├── vadd.h │ │ │ │ ├── vaddc.h │ │ │ │ ├── vand.h │ │ │ │ ├── vch.h │ │ │ │ ├── vcl.h │ │ │ │ ├── vcmp.h │ │ │ │ ├── vcr.h │ │ │ │ ├── vdivh.h │ │ │ │ ├── vmac.h │ │ │ │ ├── vmov.h │ │ │ │ ├── vmrg.h │ │ │ │ ├── vmudh.h │ │ │ │ ├── vmul.h │ │ │ │ ├── vmulh.h │ │ │ │ ├── vmull.h │ │ │ │ ├── vmulm.h │ │ │ │ ├── vmuln.h │ │ │ │ ├── vor.h │ │ │ │ ├── vrcpsq.h │ │ │ │ ├── vrsq.h │ │ │ │ ├── vsub.h │ │ │ │ ├── vsubc.h │ │ │ │ └── vxor.h │ │ ├── build_android_aarch64.sh │ │ ├── build_native.sh │ │ ├── compare_test_results.sh │ │ ├── cpu_state.hpp │ │ ├── debug-toolchain │ │ │ ├── Makefile │ │ │ ├── Makefile.mips │ │ │ ├── add.s │ │ │ ├── addi.s │ │ │ ├── and.s │ │ │ ├── andi.s │ │ │ ├── beq-impossible-delay-slot-both-taken.s │ │ │ ├── beq-impossible-delay-slot-first-taken.s │ │ │ ├── beq-impossible-delay-slot-second-taken.s │ │ │ ├── bgez.s │ │ │ ├── bgezal.s │ │ │ ├── bgtz.s │ │ │ ├── blez.s │ │ │ ├── bltz.s │ │ │ ├── bltzal.s │ │ │ ├── bne.s │ │ │ ├── bug-shl-into-branch.s │ │ │ ├── cop0.s │ │ │ ├── cop2-basic.s │ │ │ ├── cop2-ls.s │ │ │ ├── cop2-vector.s │ │ │ ├── delay-slot-before-break.s │ │ │ ├── delay-slot-before-new-block-illegal.s │ │ │ ├── delay-slot-before-new-block-not-taken.s │ │ │ ├── delay-slot-before-new-block.s │ │ │ ├── j.s │ │ │ ├── jal-into-indirect-delay-slot.s │ │ │ ├── jal.s │ │ │ ├── jalr.s │ │ │ ├── jr.s │ │ │ ├── lb.s │ │ │ ├── lbu.s │ │ │ ├── lh-unaligned.s │ │ │ ├── lh.s │ │ │ ├── lhu-unaligned.s │ │ │ ├── lhu.s │ │ │ ├── lui.s │ │ │ ├── lw-unaligned-in-branch-delay.s │ │ │ ├── lw-unaligned.s │ │ │ ├── lw.s │ │ │ ├── main.c │ │ │ ├── nor.s │ │ │ ├── or.s │ │ │ ├── ori.s │ │ │ ├── rsp-mips.h │ │ │ ├── rsp-mips.ld │ │ │ ├── rsp-mips.s │ │ │ ├── sb.s │ │ │ ├── sh-unaligned.s │ │ │ ├── sh.s │ │ │ ├── sll.s │ │ │ ├── sllv.s │ │ │ ├── slt.s │ │ │ ├── slti.s │ │ │ ├── sltiu.s │ │ │ ├── sltu.s │ │ │ ├── sra.s │ │ │ ├── srav.s │ │ │ ├── srl.s │ │ │ ├── srlv.s │ │ │ ├── start.s │ │ │ ├── sub.s │ │ │ ├── sw-unaligned.s │ │ │ ├── sw.s │ │ │ ├── unconditional-delay-slot-before-break.s │ │ │ ├── xor.s │ │ │ └── xori.s │ │ ├── debug_jit.cpp │ │ ├── debug_jit.hpp │ │ ├── debug_rsp.cpp │ │ ├── debug_rsp.hpp │ │ ├── format_all.sh │ │ ├── jit_allocator.cpp │ │ ├── jit_allocator.hpp │ │ ├── lightning │ │ │ ├── .gitattributes │ │ │ ├── .gitignore │ │ │ ├── .gitrepo │ │ │ ├── AUTHORS │ │ │ ├── COPYING │ │ │ ├── COPYING.DOC │ │ │ ├── COPYING.LESSER │ │ │ ├── ChangeLog │ │ │ ├── Makefile.am │ │ │ ├── NEWS │ │ │ ├── README │ │ │ ├── THANKS │ │ │ ├── TODO │ │ │ ├── check │ │ │ │ ├── 3to2.ok │ │ │ │ ├── 3to2.tst │ │ │ │ ├── Makefile.am │ │ │ │ ├── add.ok │ │ │ │ ├── add.tst │ │ │ │ ├── align.ok │ │ │ │ ├── align.tst │ │ │ │ ├── all.tst │ │ │ │ ├── allocai.ok │ │ │ │ ├── allocai.tst │ │ │ │ ├── allocar.ok │ │ │ │ ├── allocar.tst │ │ │ │ ├── alu.inc │ │ │ │ ├── alu_add.ok │ │ │ │ ├── alu_add.tst │ │ │ │ ├── alu_and.ok │ │ │ │ ├── alu_and.tst │ │ │ │ ├── alu_com.ok │ │ │ │ ├── alu_com.tst │ │ │ │ ├── alu_div.ok │ │ │ │ ├── alu_div.tst │ │ │ │ ├── alu_lsh.ok │ │ │ │ ├── alu_lsh.tst │ │ │ │ ├── alu_mul.ok │ │ │ │ ├── alu_mul.tst │ │ │ │ ├── alu_neg.ok │ │ │ │ ├── alu_neg.tst │ │ │ │ ├── alu_or.ok │ │ │ │ ├── alu_or.tst │ │ │ │ ├── alu_rem.ok │ │ │ │ ├── alu_rem.tst │ │ │ │ ├── alu_rsb.ok │ │ │ │ ├── alu_rsb.tst │ │ │ │ ├── alu_rsh.ok │ │ │ │ ├── alu_rsh.tst │ │ │ │ ├── alu_sub.ok │ │ │ │ ├── alu_sub.tst │ │ │ │ ├── alu_xor.ok │ │ │ │ ├── alu_xor.tst │ │ │ │ ├── alux_add.ok │ │ │ │ ├── alux_add.tst │ │ │ │ ├── alux_sub.ok │ │ │ │ ├── alux_sub.tst │ │ │ │ ├── bp.ok │ │ │ │ ├── bp.tst │ │ │ │ ├── branch.ok │ │ │ │ ├── branch.tst │ │ │ │ ├── call.ok │ │ │ │ ├── call.tst │ │ │ │ ├── carg.c │ │ │ │ ├── carry.ok │ │ │ │ ├── carry.tst │ │ │ │ ├── ccall.c │ │ │ │ ├── check.arm.sh │ │ │ │ ├── check.arm.swf.sh │ │ │ │ ├── check.arm4.swf.sh │ │ │ │ ├── check.nodata.sh │ │ │ │ ├── check.sh │ │ │ │ ├── check.swf.sh │ │ │ │ ├── check.x87.nodata.sh │ │ │ │ ├── check.x87.sh │ │ │ │ ├── clobber.ok │ │ │ │ ├── clobber.tst │ │ │ │ ├── ctramp.c │ │ │ │ ├── cva_list.c │ │ │ │ ├── cvt.ok │ │ │ │ ├── cvt.tst │ │ │ │ ├── divi.ok │ │ │ │ ├── divi.tst │ │ │ │ ├── fib.ok │ │ │ │ ├── fib.tst │ │ │ │ ├── float.ok │ │ │ │ ├── float.tst │ │ │ │ ├── fop_abs.ok │ │ │ │ ├── fop_abs.tst │ │ │ │ ├── fop_sqrt.ok │ │ │ │ ├── fop_sqrt.tst │ │ │ │ ├── hton.ok │ │ │ │ ├── hton.tst │ │ │ │ ├── jmpr.ok │ │ │ │ ├── jmpr.tst │ │ │ │ ├── ldst.inc │ │ │ │ ├── ldsti.ok │ │ │ │ ├── ldsti.tst │ │ │ │ ├── ldstr-c.ok │ │ │ │ ├── ldstr-c.tst │ │ │ │ ├── ldstr.ok │ │ │ │ ├── ldstr.tst │ │ │ │ ├── ldstxi-c.ok │ │ │ │ ├── ldstxi-c.tst │ │ │ │ ├── ldstxi.ok │ │ │ │ ├── ldstxi.tst │ │ │ │ ├── ldstxr-c.ok │ │ │ │ ├── ldstxr-c.tst │ │ │ │ ├── ldstxr.ok │ │ │ │ ├── ldstxr.tst │ │ │ │ ├── lightning.c │ │ │ │ ├── nodata.c │ │ │ │ ├── put.ok │ │ │ │ ├── put.tst │ │ │ │ ├── qalu.inc │ │ │ │ ├── qalu_div.ok │ │ │ │ ├── qalu_div.tst │ │ │ │ ├── qalu_mul.ok │ │ │ │ ├── qalu_mul.tst │ │ │ │ ├── range.ok │ │ │ │ ├── range.tst │ │ │ │ ├── ranger.ok │ │ │ │ ├── ranger.tst │ │ │ │ ├── ret.ok │ │ │ │ ├── ret.tst │ │ │ │ ├── rpn.ok │ │ │ │ ├── rpn.tst │ │ │ │ ├── run-test │ │ │ │ ├── self.c │ │ │ │ ├── setcode.c │ │ │ │ ├── stack.ok │ │ │ │ ├── stack.tst │ │ │ │ ├── tramp.ok │ │ │ │ ├── tramp.tst │ │ │ │ ├── va_list.ok │ │ │ │ ├── va_list.tst │ │ │ │ ├── varargs.ok │ │ │ │ └── varargs.tst │ │ │ ├── configure.ac │ │ │ ├── doc │ │ │ │ ├── .cvsignore │ │ │ │ ├── .gitignore │ │ │ │ ├── Makefile.am │ │ │ │ ├── body.texi │ │ │ │ ├── fact.c │ │ │ │ ├── ifib.c │ │ │ │ ├── incr.c │ │ │ │ ├── lightning.texi │ │ │ │ ├── printf.c │ │ │ │ ├── rfib.c │ │ │ │ ├── rpn.c │ │ │ │ └── version.texi │ │ │ ├── include │ │ │ │ ├── Makefile.am │ │ │ │ ├── lightning.h │ │ │ │ ├── lightning.h.in │ │ │ │ └── lightning │ │ │ │ │ ├── Makefile.am │ │ │ │ │ ├── jit_aarch64.h │ │ │ │ │ ├── jit_alpha.h │ │ │ │ │ ├── jit_arm.h │ │ │ │ │ ├── jit_hppa.h │ │ │ │ │ ├── jit_ia64.h │ │ │ │ │ ├── jit_mips.h │ │ │ │ │ ├── jit_ppc.h │ │ │ │ │ ├── jit_private.h │ │ │ │ │ ├── jit_riscv.h │ │ │ │ │ ├── jit_s390.h │ │ │ │ │ ├── jit_sparc.h │ │ │ │ │ └── jit_x86.h │ │ │ ├── lib │ │ │ │ ├── Makefile.am │ │ │ │ ├── jit_aarch64-cpu.c │ │ │ │ ├── jit_aarch64-fpu.c │ │ │ │ ├── jit_aarch64-sz.c │ │ │ │ ├── jit_aarch64.c │ │ │ │ ├── jit_alpha-cpu.c │ │ │ │ ├── jit_alpha-fpu.c │ │ │ │ ├── jit_alpha-sz.c │ │ │ │ ├── jit_alpha.c │ │ │ │ ├── jit_arm-cpu.c │ │ │ │ ├── jit_arm-swf.c │ │ │ │ ├── jit_arm-sz.c │ │ │ │ ├── jit_arm-vfp.c │ │ │ │ ├── jit_arm.c │ │ │ │ ├── jit_disasm.c │ │ │ │ ├── jit_hppa-cpu.c │ │ │ │ ├── jit_hppa-fpu.c │ │ │ │ ├── jit_hppa-sz.c │ │ │ │ ├── jit_hppa.c │ │ │ │ ├── jit_ia64-cpu.c │ │ │ │ ├── jit_ia64-fpu.c │ │ │ │ ├── jit_ia64-sz.c │ │ │ │ ├── jit_ia64.c │ │ │ │ ├── jit_memory.c │ │ │ │ ├── jit_mips-cpu.c │ │ │ │ ├── jit_mips-fpu.c │ │ │ │ ├── jit_mips-sz.c │ │ │ │ ├── jit_mips.c │ │ │ │ ├── jit_names.c │ │ │ │ ├── jit_note.c │ │ │ │ ├── jit_ppc-cpu.c │ │ │ │ ├── jit_ppc-fpu.c │ │ │ │ ├── jit_ppc-sz.c │ │ │ │ ├── jit_ppc.c │ │ │ │ ├── jit_print.c │ │ │ │ ├── jit_rewind.c │ │ │ │ ├── jit_riscv-cpu.c │ │ │ │ ├── jit_riscv-fpu.c │ │ │ │ ├── jit_riscv-sz.c │ │ │ │ ├── jit_riscv.c │ │ │ │ ├── jit_s390-cpu.c │ │ │ │ ├── jit_s390-fpu.c │ │ │ │ ├── jit_s390-sz.c │ │ │ │ ├── jit_s390.c │ │ │ │ ├── jit_size.c │ │ │ │ ├── jit_sparc-cpu.c │ │ │ │ ├── jit_sparc-fpu.c │ │ │ │ ├── jit_sparc-sz.c │ │ │ │ ├── jit_sparc.c │ │ │ │ ├── jit_x86-cpu.c │ │ │ │ ├── jit_x86-sse.c │ │ │ │ ├── jit_x86-sz.c │ │ │ │ ├── jit_x86-x87.c │ │ │ │ ├── jit_x86.c │ │ │ │ └── lightning.c │ │ │ ├── lightning.pc.in │ │ │ ├── m4 │ │ │ │ └── .gitkeep │ │ │ └── size.c │ │ ├── llvm_jit.cpp │ │ ├── llvm_jit.hpp │ │ ├── main.cpp │ │ ├── parallel.cpp │ │ ├── rsp │ │ │ ├── cp0.cpp │ │ │ ├── cp2.cpp │ │ │ ├── ls.cpp │ │ │ ├── pipeline.h │ │ │ ├── reciprocal.cpp │ │ │ ├── reciprocal.h │ │ │ ├── registers.md │ │ │ └── vfunctions.cpp │ │ ├── rsp_1.1.h │ │ ├── rsp_disasm.cpp │ │ ├── rsp_disasm.hpp │ │ ├── rsp_jit.cpp │ │ ├── rsp_jit.hpp │ │ ├── rsp_op.hpp │ │ ├── rsp_vu_fuzzer.cpp │ │ ├── state.hpp │ │ └── win32 │ │ │ └── mman │ │ │ └── sys │ │ │ ├── .gitignore │ │ │ ├── .gitrepo │ │ │ ├── CMakeLists.txt │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── configure │ │ │ ├── mman-win32.pro │ │ │ └── test.c │ ├── mupen64plus-video-angrylion │ │ ├── Gfx #1.3.h │ │ ├── common.h │ │ ├── interface.c │ │ ├── msg.h │ │ ├── n64video.c │ │ ├── n64video.h │ │ ├── n64video │ │ │ ├── rdp.c │ │ │ ├── rdp │ │ │ │ ├── blender.c │ │ │ │ ├── combiner.c │ │ │ │ ├── coverage.c │ │ │ │ ├── dither.c │ │ │ │ ├── fbuffer.c │ │ │ │ ├── rasterizer.c │ │ │ │ ├── rdp.c │ │ │ │ ├── rdram.c │ │ │ │ ├── tcoord.c │ │ │ │ ├── tex.c │ │ │ │ ├── tmem.c │ │ │ │ └── zbuffer.c │ │ │ ├── vi.c │ │ │ └── vi │ │ │ │ ├── divot.c │ │ │ │ ├── fetch.c │ │ │ │ ├── gamma.c │ │ │ │ ├── lerp.c │ │ │ │ ├── restore.c │ │ │ │ ├── vi.c │ │ │ │ └── video.c │ │ ├── parallel_al.cpp │ │ ├── parallel_al.h │ │ ├── plugin.c │ │ ├── plugin.h │ │ ├── rdp.h │ │ ├── rdp_dump.c │ │ ├── rdp_dump.h │ │ ├── vdac.h │ │ └── version.h.in │ ├── mupen64plus-video-paraLLEl │ │ ├── .clang-format │ │ ├── DUMPING.md │ │ ├── Gfx #1.3.h │ │ ├── parallel-rdp │ │ │ ├── COMMIT │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── config.mk │ │ │ ├── parallel-rdp │ │ │ │ ├── command_ring.cpp │ │ │ │ ├── command_ring.hpp │ │ │ │ ├── luts.hpp │ │ │ │ ├── rdp_common.hpp │ │ │ │ ├── rdp_data_structures.hpp │ │ │ │ ├── rdp_device.cpp │ │ │ │ ├── rdp_device.hpp │ │ │ │ ├── rdp_renderer.cpp │ │ │ │ ├── rdp_renderer.hpp │ │ │ │ ├── shaders │ │ │ │ │ ├── binning.h │ │ │ │ │ ├── blender.h │ │ │ │ │ ├── clamping.h │ │ │ │ │ ├── clear_indirect_buffer.comp │ │ │ │ │ ├── clear_write_mask.comp │ │ │ │ │ ├── combiner.h │ │ │ │ │ ├── coverage.h │ │ │ │ │ ├── data_structures.h │ │ │ │ │ ├── data_structures_buffers.h │ │ │ │ │ ├── debug.h │ │ │ │ │ ├── depth_blend.comp │ │ │ │ │ ├── depth_test.h │ │ │ │ │ ├── dither.h │ │ │ │ │ ├── extract_vram.comp │ │ │ │ │ ├── fb_formats.h │ │ │ │ │ ├── fullscreen.vert │ │ │ │ │ ├── interpolation.h │ │ │ │ │ ├── load_attribute_setup.h │ │ │ │ │ ├── load_depth_blend_state.h │ │ │ │ │ ├── load_derived_setup.h │ │ │ │ │ ├── load_scissor_state.h │ │ │ │ │ ├── load_span_offsets.h │ │ │ │ │ ├── load_span_setup.h │ │ │ │ │ ├── load_static_raster_state.h │ │ │ │ │ ├── load_tile_info.h │ │ │ │ │ ├── load_triangle_setup.h │ │ │ │ │ ├── masked_rdram_resolve.comp │ │ │ │ │ ├── memory_interfacing.h │ │ │ │ │ ├── noise.h │ │ │ │ │ ├── perspective.h │ │ │ │ │ ├── rasterizer.comp │ │ │ │ │ ├── shading.h │ │ │ │ │ ├── slangmosh.hpp │ │ │ │ │ ├── slangmosh.json │ │ │ │ │ ├── small_types.h │ │ │ │ │ ├── span_setup.comp │ │ │ │ │ ├── store_span_setup.h │ │ │ │ │ ├── texture.h │ │ │ │ │ ├── tile_binning_combined.comp │ │ │ │ │ ├── tmem_update.comp │ │ │ │ │ ├── ubershader.comp │ │ │ │ │ ├── update_upscaled_domain_post.comp │ │ │ │ │ ├── update_upscaled_domain_pre.comp │ │ │ │ │ ├── vi_blend_fields.frag │ │ │ │ │ ├── vi_debug.h │ │ │ │ │ ├── vi_deinterlace.frag │ │ │ │ │ ├── vi_deinterlace.vert │ │ │ │ │ ├── vi_divot.frag │ │ │ │ │ ├── vi_fetch.frag │ │ │ │ │ ├── vi_scale.frag │ │ │ │ │ ├── vi_status.h │ │ │ │ │ └── z_encode.h │ │ │ │ ├── video_interface.cpp │ │ │ │ ├── video_interface.hpp │ │ │ │ └── worker_thread.hpp │ │ │ ├── spirv-cross │ │ │ │ ├── GLSL.std.450.h │ │ │ │ ├── spirv.h │ │ │ │ ├── spirv.hpp │ │ │ │ ├── spirv_cfg.cpp │ │ │ │ ├── spirv_cfg.hpp │ │ │ │ ├── spirv_common.hpp │ │ │ │ ├── spirv_cpp.hpp │ │ │ │ ├── spirv_cross.cpp │ │ │ │ ├── spirv_cross.hpp │ │ │ │ ├── spirv_cross_c.h │ │ │ │ ├── spirv_cross_containers.hpp │ │ │ │ ├── spirv_cross_error_handling.hpp │ │ │ │ ├── spirv_cross_parsed_ir.cpp │ │ │ │ ├── spirv_cross_parsed_ir.hpp │ │ │ │ ├── spirv_cross_util.hpp │ │ │ │ ├── spirv_glsl.hpp │ │ │ │ ├── spirv_hlsl.hpp │ │ │ │ ├── spirv_msl.hpp │ │ │ │ ├── spirv_parser.cpp │ │ │ │ ├── spirv_parser.hpp │ │ │ │ └── spirv_reflect.hpp │ │ │ ├── util │ │ │ │ ├── aligned_alloc.cpp │ │ │ │ ├── aligned_alloc.hpp │ │ │ │ ├── bitops.hpp │ │ │ │ ├── enum_cast.hpp │ │ │ │ ├── hash.hpp │ │ │ │ ├── intrusive.hpp │ │ │ │ ├── intrusive_hash_map.hpp │ │ │ │ ├── intrusive_list.hpp │ │ │ │ ├── logging.hpp │ │ │ │ ├── object_pool.hpp │ │ │ │ ├── read_write_lock.hpp │ │ │ │ ├── small_vector.hpp │ │ │ │ ├── stack_allocator.hpp │ │ │ │ ├── temporary_hashmap.hpp │ │ │ │ ├── timer.cpp │ │ │ │ └── timer.hpp │ │ │ ├── volk │ │ │ │ ├── volk.c │ │ │ │ └── volk.h │ │ │ ├── vulkan-headers │ │ │ │ └── include │ │ │ │ │ └── vulkan │ │ │ │ │ ├── vk_icd.h │ │ │ │ │ ├── vk_layer.h │ │ │ │ │ ├── vk_platform.h │ │ │ │ │ ├── vk_sdk_platform.h │ │ │ │ │ ├── vulkan.h │ │ │ │ │ ├── vulkan_android.h │ │ │ │ │ ├── vulkan_beta.h │ │ │ │ │ ├── vulkan_core.h │ │ │ │ │ ├── vulkan_fuchsia.h │ │ │ │ │ ├── vulkan_ggp.h │ │ │ │ │ ├── vulkan_ios.h │ │ │ │ │ ├── vulkan_macos.h │ │ │ │ │ ├── vulkan_metal.h │ │ │ │ │ ├── vulkan_vi.h │ │ │ │ │ ├── vulkan_wayland.h │ │ │ │ │ ├── vulkan_win32.h │ │ │ │ │ ├── vulkan_xcb.h │ │ │ │ │ ├── vulkan_xlib.h │ │ │ │ │ └── vulkan_xlib_xrandr.h │ │ │ └── vulkan │ │ │ │ ├── buffer.cpp │ │ │ │ ├── buffer.hpp │ │ │ │ ├── buffer_pool.cpp │ │ │ │ ├── buffer_pool.hpp │ │ │ │ ├── command_buffer.cpp │ │ │ │ ├── command_buffer.hpp │ │ │ │ ├── command_pool.cpp │ │ │ │ ├── command_pool.hpp │ │ │ │ ├── context.cpp │ │ │ │ ├── context.hpp │ │ │ │ ├── cookie.cpp │ │ │ │ ├── cookie.hpp │ │ │ │ ├── descriptor_set.cpp │ │ │ │ ├── descriptor_set.hpp │ │ │ │ ├── device.cpp │ │ │ │ ├── device.hpp │ │ │ │ ├── device_fossilize.cpp │ │ │ │ ├── event_manager.cpp │ │ │ │ ├── event_manager.hpp │ │ │ │ ├── fence.cpp │ │ │ │ ├── fence.hpp │ │ │ │ ├── fence_manager.cpp │ │ │ │ ├── fence_manager.hpp │ │ │ │ ├── format.hpp │ │ │ │ ├── image.cpp │ │ │ │ ├── image.hpp │ │ │ │ ├── limits.hpp │ │ │ │ ├── memory_allocator.cpp │ │ │ │ ├── memory_allocator.hpp │ │ │ │ ├── pipeline_event.cpp │ │ │ │ ├── pipeline_event.hpp │ │ │ │ ├── query_pool.cpp │ │ │ │ ├── query_pool.hpp │ │ │ │ ├── quirks.hpp │ │ │ │ ├── render_pass.cpp │ │ │ │ ├── render_pass.hpp │ │ │ │ ├── renderdoc_capture.cpp │ │ │ │ ├── sampler.cpp │ │ │ │ ├── sampler.hpp │ │ │ │ ├── semaphore.cpp │ │ │ │ ├── semaphore.hpp │ │ │ │ ├── semaphore_manager.cpp │ │ │ │ ├── semaphore_manager.hpp │ │ │ │ ├── shader.cpp │ │ │ │ ├── shader.hpp │ │ │ │ ├── texture_format.cpp │ │ │ │ ├── texture_format.hpp │ │ │ │ ├── thread_id.cpp │ │ │ │ ├── thread_id.hpp │ │ │ │ ├── type_to_string.hpp │ │ │ │ ├── vulkan_common.hpp │ │ │ │ ├── vulkan_headers.hpp │ │ │ │ ├── wsi.cpp │ │ │ │ ├── wsi.hpp │ │ │ │ ├── wsi_timing.cpp │ │ │ │ └── wsi_timing.hpp │ │ ├── parallel.cpp │ │ ├── parallel.h │ │ ├── rdp.cpp │ │ ├── rdp.hpp │ │ └── z64.h │ └── tools │ │ ├── Makefile │ │ ├── gas-preprocessor.pl │ │ ├── gen_romdb.py │ │ ├── m64pmigrate.c │ │ └── pj64tosrm.c ├── start_emc.sh ├── stb_image.h └── zlib │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── dist ├── assets.zip ├── index.html ├── input_controller.js ├── n64wasm.js ├── n64wasm.wasm ├── romlist.js ├── script.js └── settings.js ├── screenshots ├── server1.png └── server2.png └── server ├── .gitignore ├── README.md ├── app.js ├── app.js.map ├── app.ts ├── docker ├── dockerfile └── dockersettings.js ├── package.json ├── php ├── .htaccess ├── README.md ├── index.php ├── n64wasm-nginx.conf └── web.config └── tsconfig.json /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://mcr.microsoft.com/en-us/product/devcontainers/base/tags 2 | # NOTE: Ubuntu 24 doesn't have python anymore 3 | FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 4 | 5 | RUN git clone https://github.com/emscripten-core/emsdk.git \ 6 | && cd emsdk \ 7 | && ./emsdk install 2.0.7 \ 8 | && ./emsdk activate 2.0.7 \ 9 | && echo 'source "/emsdk/emsdk_env.sh"\n' >> /home/vscode/.bashrc \ 10 | && echo 'cd code\n' >> /home/vscode/.bashrc \ 11 | && echo 'echo "" && echo "Type 'make' to build N64Wasm"\n' >> /home/vscode/.bashrc 12 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp 3 | { 4 | "name": "N64Wasm", 5 | "build": { 6 | "dockerfile": "Dockerfile" 7 | } 8 | // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"], 9 | 10 | // Configure tool-specific properties. 11 | // "customizations": { 12 | // // Configure properties specific to VS Code. 13 | // "vscode": { 14 | // // Set *default* container specific settings.json values on container create. 15 | // "settings": {}, 16 | // // Add the IDs of extensions you want installed when the container is created. 17 | // "extensions": [ 18 | // "ms-vscode.cpptools" 19 | // ] 20 | // } 21 | // }, 22 | 23 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 24 | // "forwardPorts": [], 25 | 26 | // Use 'postCreateCommand' to run commands after the container is created. 27 | // "postCreateCommand": "echo 'run make to build N64Wasm'" 28 | 29 | // Comment out this line to run as root instead. 30 | // "remoteUser": "vscode" 31 | 32 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Neil Barkhina 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. -------------------------------------------------------------------------------- /code/build.sh: -------------------------------------------------------------------------------- 1 | # make clean 2 | make -------------------------------------------------------------------------------- /code/cheat.txt: -------------------------------------------------------------------------------- 1 | DE067000 2 | 0000 3 | 800CD3C8 4 | 0001 5 | -------------------------------------------------------------------------------- /code/config.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 13 3 | 14 4 | 15 5 | 0 6 | 2 7 | 9 8 | 4 9 | 6 10 | 5 11 | 11 12 | -1 13 | -1 14 | -1 15 | -1 16 | b 17 | n 18 | y 19 | h 20 | Enter 21 | i 22 | k 23 | j 24 | l 25 | a 26 | q 27 | e 28 | s 29 | d 30 | ` 31 | ArrowUp 32 | ArrowDown 33 | ArrowLeft 34 | ArrowRight 35 | 0 36 | 0 37 | 0 38 | 1 39 | 0 40 | 0 41 | 0 42 | 0 43 | 0 44 | 0 45 | 0 46 | 0 47 | 0 48 | 0 49 | -------------------------------------------------------------------------------- /code/minizip/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | */ 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); 23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); 24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /code/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /code/neil_controller.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct NeilButtons { 4 | int upKey; 5 | int downKey; 6 | int leftKey; 7 | int rightKey; 8 | int startKey; 9 | int selectKey; 10 | int rKey; 11 | int lKey; 12 | int zKey; 13 | int aKey; 14 | int bKey; 15 | int axis0; 16 | int axis1; 17 | int axis2; 18 | int axis3; 19 | int cbLeft; 20 | int cbRight; 21 | int cbUp; 22 | int cbDown; 23 | int mouseX; 24 | int mouseY; 25 | }; 26 | 27 | #define NEILNUMCONTROLLERS 4 -------------------------------------------------------------------------------- /code/overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/overlay.png -------------------------------------------------------------------------------- /code/res/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/res/arial.ttf -------------------------------------------------------------------------------- /code/res/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/res/font.ttf -------------------------------------------------------------------------------- /code/shader_frag.hlsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | precision highp float; 4 | 5 | //the texture coordinate that came 6 | //in from the vertex shader 7 | in vec2 v_TexCoord; 8 | 9 | //primary purpose of fragment shader is 10 | //to spit out a color for every pixel 11 | layout(location = 0) out vec4 color; 12 | 13 | // uniform vec4 u_Color; 14 | uniform sampler2D u_Texture; 15 | 16 | //fragment shader gets called once per pixel 17 | void main() 18 | { 19 | vec4 texColor = texture(u_Texture, v_TexCoord); 20 | color = texColor; 21 | } -------------------------------------------------------------------------------- /code/shader_vert.hlsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | precision highp float; 4 | 5 | //position and texture coordinates 6 | //come in from the application as inputs 7 | layout(location = 0) in vec4 position; 8 | layout(location = 1) in vec2 texCoord; 9 | 10 | //texture coordinate is just passthrough 11 | //to the fragment shader 12 | out vec2 v_TexCoord; 13 | 14 | //vertex shader gets called once per vertex 15 | void main() 16 | { 17 | //gl_Position is a built in property 18 | gl_Position = position; 19 | v_TexCoord = texCoord; 20 | } -------------------------------------------------------------------------------- /code/src/.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.o 3 | *.dll 4 | *.lib 5 | *.pdb 6 | *.exp 7 | *.manifest 8 | *.dylib 9 | *.so 10 | *.d 11 | *.js 12 | *.bc 13 | **/*.elf 14 | **/*.velf 15 | **/*.bin 16 | **/*.sfo 17 | **/*.vpk 18 | mupen64plus-rsp-paraLLEl/win32/mman/sys/mman.o 19 | mupen64plus-rsp-paraLLEl/win32/mman/sys/mman.c 20 | mupen64plus-rsp-paraLLEl/win32/mman/sys/mman.h 21 | 22 | # ========================== 23 | # Visual Studio files 24 | # ========================== 25 | Debug/ 26 | Release/ 27 | **/*.sln 28 | **/*.vcxproj 29 | **/*.vcxproj.filters 30 | -------------------------------------------------------------------------------- /code/src/Graphics/3dmath.h: -------------------------------------------------------------------------------- 1 | #ifndef _GRAPHICS_3DMATH_H 2 | #define _GRAPHICS_3DMATH_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | static INLINE float DotProduct(const float *v0, const float *v1) 15 | { 16 | return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2]; 17 | } 18 | 19 | static INLINE void CopyMatrix( float m0[4][4], float m1[4][4] ) 20 | { 21 | memcpy( m0, m1, 16 * sizeof( float ) ); 22 | } 23 | 24 | static INLINE void NormalizeVector(float *v) 25 | { 26 | float len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; 27 | if (len == 0.0f) 28 | return; 29 | len = sqrtf( len ); 30 | v[0] /= len; 31 | v[1] /= len; 32 | v[2] /= len; 33 | } 34 | 35 | void TransformVectorNormalize(float vec[3], float mtx[4][4]); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /code/src/Graphics/3dmaths.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "3dmath.h" 5 | 6 | void TransformVectorNormalize(float vec[3], float mtx[4][4]) 7 | { 8 | float len; 9 | float x = vec[0]; 10 | float y = vec[1]; 11 | float z = vec[2]; 12 | 13 | vec[0] = mtx[0][0] * x 14 | + mtx[1][0] * y 15 | + mtx[2][0] * z; 16 | 17 | vec[1] = mtx[0][1] *x 18 | + mtx[1][1] * y 19 | + mtx[2][1] * z; 20 | 21 | vec[2] = mtx[0][2] * x 22 | + mtx[1][2] * y 23 | + mtx[2][2] * z; 24 | 25 | len = vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]; 26 | 27 | if (len != 0.0) 28 | { 29 | len = sqrtf(len); 30 | vec[0] /= len; 31 | vec[1] /= len; 32 | vec[2] /= len; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /code/src/Graphics/HLE/Microcode/Fast3D.h: -------------------------------------------------------------------------------- 1 | #ifndef _GRAPHICS_HLE_MICROCODE_FAST3D_H 2 | #define _GRAPHICS_HLE_MICROCODE_FAST3D_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void F3D_EndDL(uint32_t w0, uint32_t w1); 11 | void F3D_MoveMem(uint32_t w0, uint32_t w1); 12 | void F3D_Reserved0(uint32_t w0, uint32_t w1); 13 | void F3D_Reserved1(uint32_t w0, uint32_t w1); 14 | void F3D_Reserved2(uint32_t w0, uint32_t w1); 15 | void F3D_Reserved3(uint32_t w0, uint32_t w1); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /code/src/Graphics/HLE/Microcode/turbo3d.h: -------------------------------------------------------------------------------- 1 | #ifndef _GRAPHICS_HLE_MICROCODE_TURBO3D_H 2 | #define _GRAPHICS_HLE_MICROCODE_TURBO3D_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /******************Turbo3D microcode*************************/ 11 | 12 | struct T3DGlobState 13 | { 14 | uint16_t pad0; 15 | uint16_t perspNorm; 16 | uint32_t flag; 17 | uint32_t othermode0; 18 | uint32_t othermode1; 19 | uint32_t segBases[16]; 20 | /* the viewport to use */ 21 | int16_t vsacle1; 22 | int16_t vsacle0; 23 | int16_t vsacle3; 24 | int16_t vsacle2; 25 | int16_t vtrans1; 26 | int16_t vtrans0; 27 | int16_t vtrans3; 28 | int16_t vtrans2; 29 | uint32_t rdpCmds; 30 | }; 31 | 32 | struct T3DState 33 | { 34 | uint32_t renderState; /* render state */ 35 | uint32_t textureState; /* texture state */ 36 | uint8_t flag; 37 | uint8_t triCount; /* how many triangles? */ 38 | uint8_t vtxV0; /* where to load vertices? */ 39 | uint8_t vtxCount; /* how many vertices? */ 40 | uint32_t rdpCmds; /* ptr (segment address) to RDP DL */ 41 | uint32_t othermode0; 42 | uint32_t othermode1; 43 | }; 44 | 45 | struct T3DTriN 46 | { 47 | uint8_t flag, v2, v1, v0; /* flag is which one for flat shade */ 48 | }; 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /code/src/Graphics/RDP/gDP_funcs.h: -------------------------------------------------------------------------------- 1 | #ifndef _GDP_FUNCS_H 2 | #define _GDP_FUNCS_H 3 | 4 | #include 5 | 6 | #include "gDP_funcs_prot.h" 7 | 8 | #define gDPSetScissor(mode, ulx, uly, lrx, lry) GDPSetScissor(mode, ulx, uly, lrx, lry) 9 | #define gDPLoadBlock(tile, ul_s, ul_t, lr_s, lr_t) GDPLoadBlock(tile, ul_s, ul_t, lr_s, lr_t) 10 | 11 | void GDPSetScissor(uint32_t mode, float ulx, float uly, float lrx, float lry ); 12 | void GDPLoadBlock(uint32_t tile, uint32_t ul_s, uint32_t ul_t, 13 | uint32_t lr_s, uint32_t dxt ); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /code/src/Graphics/RDP/gDP_funcs_C.h: -------------------------------------------------------------------------------- 1 | #ifndef _GDP_FUNCS_C_H 2 | #define _GDP_FUNCS_C_H 3 | 4 | #include 5 | 6 | #include "gDP_funcs_prot.h" 7 | 8 | #define gDPSetScissor(mode, ulx, uly, lrx, lry) GDPSetScissorC(mode, ulx, uly, lrx, lry) 9 | #define gDPLoadBlock(tile, ul_s, ul_t, lr_s, lr_t) GDPLoadBlockC(tile, ul_s, ul_t, lr_s, lr_t) 10 | 11 | void GDPSetScissorC(uint32_t mode, float ulx, float uly, float lrx, float lry ); 12 | void GDPLoadBlockC(uint32_t tile, uint32_t ul_s, uint32_t ul_t, 13 | uint32_t lr_s, uint32_t dxt ); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /code/src/Graphics/RDP/gDP_state.c: -------------------------------------------------------------------------------- 1 | #include "gDP_state.h" 2 | 3 | struct gDPInfo gDP; 4 | -------------------------------------------------------------------------------- /code/src/Graphics/RSP/RSP_state.c: -------------------------------------------------------------------------------- 1 | #include "RSP_state.h" 2 | 3 | RSPInfo __RSP; 4 | 5 | void RSP_CheckDLCounter(void) 6 | { 7 | if (__RSP.count != -1) 8 | { 9 | --__RSP.count; 10 | if (__RSP.count == 0) 11 | { 12 | __RSP.count = -1; 13 | --__RSP.PCi; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /code/src/Graphics/RSP/RSP_state.h: -------------------------------------------------------------------------------- 1 | #ifndef _RSP_STATE_H 2 | #define _RSP_STATE_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define MAX_DL_STACK_SIZE 32 13 | 14 | typedef struct 15 | { 16 | /* Display list stack */ 17 | uint32_t countdown[MAX_DL_STACK_SIZE]; 18 | uint32_t PC[MAX_DL_STACK_SIZE]; /* Display List Program Counter stack */ 19 | int64_t PCi; /* Current Program Counter index on the stack */ 20 | 21 | uint32_t busy; 22 | uint32_t halt; /* Marks the end of Display List execution */ 23 | uint32_t DList; 24 | uint32_t close; 25 | uint32_t uc_start; 26 | uint32_t uc_dstart; 27 | uint32_t cmd; 28 | uint32_t nextCmd; 29 | int32_t count; /* Number of instructions before returning */ 30 | bool bLLE; /* LLE mode enabled? */ 31 | 32 | /* Next command */ 33 | uint32_t w0; 34 | uint32_t w1; 35 | 36 | char romname[21]; 37 | } RSPInfo; 38 | 39 | extern RSPInfo __RSP; 40 | 41 | void RSP_CheckDLCounter(void); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /code/src/Graphics/RSP/gSP_funcs.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSP_FUNCS_H 2 | #define _GSP_FUNCS_H 3 | 4 | #include 5 | 6 | #include "gSP_funcs_prot.h" 7 | 8 | #define gSPCombineMatrices() GSPCombineMatrices() 9 | #define gSPClipVertex(v) GSPClipVertex(v) 10 | #define gSPLookAt(l, n) GSPLookAt(l, n) 11 | #define gSPLight(l, n) GSPLight(l, n) 12 | #define gSPLightColor(l, c) GSPLightColor(l, c) 13 | #define gSPViewport(v) GSPViewport(v) 14 | #define gSPForceMatrix(mptr) GSPForceMatrix(mptr) 15 | #define gSPEndDisplayList() GSPEndDisplayList() 16 | 17 | void GSPCombineMatrices(void); 18 | void GSPClipVertex(uint32_t v); 19 | void GSPLookAt(uint32_t l, uint32_t n); 20 | void GSPLight(uint32_t l, int32_t n); 21 | void GSPLightColor(uint32_t lightNum, uint32_t packedColor ); 22 | void GSPViewport(uint32_t v); 23 | void GSPForceMatrix(uint32_t mptr); 24 | void GSPEndDisplayList(void); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /code/src/Graphics/RSP/gSP_funcs_C.h: -------------------------------------------------------------------------------- 1 | #ifndef _GSP_FUNCS_C_H 2 | #define _GSP_FUNCS_C_H 3 | 4 | #include 5 | 6 | #include "gSP_funcs_prot.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define gSPCombineMatrices() GSPCombineMatricesC() 13 | #define gSPClipVertex(v) GSPClipVertexC(v) 14 | #define gSPLookAt(l, n) GSPLookAtC(l, n) 15 | #define gSPLight(l, n) GSPLightC(l, n) 16 | #define gSPLightColor(l, c) GSPLightColorC(l, c) 17 | #define gSPViewport(v) GSPViewportC(v) 18 | #define gSPForceMatrix(mptr) GSPForceMatrixC(mptr) 19 | #define gSPEndDisplayList() GSPEndDisplayListC() 20 | 21 | void GSPCombineMatricesC(void); 22 | void GSPClipVertexC(uint32_t v); 23 | void GSPLookAtC(uint32_t l, uint32_t n); 24 | void GSPLightC(uint32_t l, int32_t n); 25 | void GSPLightColorC(uint32_t lightNum, uint32_t packedColor ); 26 | void GSPViewportC(uint32_t v); 27 | void GSPForceMatrixC(uint32_t mptr); 28 | void GSPEndDisplayListC(void); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /code/src/Graphics/RSP/gSP_state.c: -------------------------------------------------------------------------------- 1 | #include "gSP_state.h" 2 | 3 | struct gSPInfo gSP; 4 | -------------------------------------------------------------------------------- /code/src/Graphics/plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef _3DMATH_H 2 | #define _3DMATH_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | enum gfx_plugin_type 9 | { 10 | GFX_GLIDE64 = 0, 11 | GFX_RICE, 12 | GFX_GLN64, 13 | GFX_ANGRYLION, 14 | GFX_PARALLEL 15 | }; 16 | 17 | enum rsp_plugin_type 18 | { 19 | RSP_HLE = 0, 20 | RSP_CXD4, 21 | RSP_PARALLEL 22 | }; 23 | 24 | extern enum gfx_plugin_type gfx_plugin; 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/src/Graphics/plugins.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "plugin.h" 4 | 5 | /* Just setting this to something, and GFX_GLIDE64 is 0 */ 6 | enum gfx_plugin_type gfx_plugin = GFX_GLIDE64; 7 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/3DMath.h: -------------------------------------------------------------------------------- 1 | #ifndef _GLES2N64_3DMATH_H 2 | #define _GLES2N64_3DMATH_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "../../Graphics/3dmath.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | void MultMatrix( float m0[4][4], float m1[4][4], float dest[4][4]); 17 | 18 | static INLINE void MultMatrix2( float m0[4][4], float m1[4][4] ) 19 | { 20 | float dst[4][4]; 21 | MultMatrix(m0, m1, dst); 22 | memcpy( m0, dst, sizeof(float) * 16 ); 23 | } 24 | 25 | static INLINE void Transpose3x3Matrix( float mtx[4][4] ) 26 | { 27 | float tmp = mtx[0][1]; 28 | mtx[0][1] = mtx[1][0]; 29 | mtx[1][0] = tmp; 30 | 31 | tmp = mtx[0][2]; 32 | mtx[0][2] = mtx[2][0]; 33 | mtx[2][0] = tmp; 34 | 35 | tmp = mtx[1][2]; 36 | mtx[1][2] = mtx[2][1]; 37 | mtx[2][1] = tmp; 38 | } 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/CRC.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | void CRC_BuildTable(void); 8 | 9 | uint32_t CRC_Calculate(void *buffer, uint32_t count); 10 | uint32_t Hash_CalculatePalette(void *buffer, uint32_t count); 11 | uint32_t Hash_Calculate(uint32_t hash, const void *buffer, uint32_t count); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/Common.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_H__ 2 | #define __COMMON_H__ 3 | 4 | #include 5 | 6 | #include 7 | 8 | #define LOG_NONE 0 9 | #define LOG_ERROR 1 10 | #define LOG_MINIMAL 2 11 | #define LOG_WARNING 3 12 | #define LOG_VERBOSE 4 13 | 14 | #define LOG_LEVEL LOG_WARNING 15 | 16 | //#define DBG_LOGS 17 | 18 | #ifdef DBG_LOGS 19 | #define LOG(A, ...) fprintf(stdout, __VA_ARGS__) 20 | #else 21 | #define LOG(A, ...) 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/Debug.h: -------------------------------------------------------------------------------- 1 | #if !defined( DEBUG_H ) && defined( DEBUG ) 2 | #define DEBUG_H 3 | 4 | #include 5 | 6 | #define DEBUG_LOW 0x1000 7 | #define DEBUG_MEDIUM 0x2000 8 | #define DEBUG_HIGH 0x4000 9 | #define DEBUG_DETAIL 0x8000 10 | 11 | #define DEBUG_HANDLED 0x0001 12 | #define DEBUG_UNHANDLED 0x0002 13 | #define DEBUG_IGNORED 0x0004 14 | #define DEBUG_UNKNOWN 0x0008 15 | #define DEBUG_ERROR 0x0010 16 | #define DEBUG_COMBINE 0x0020 17 | #define DEBUG_TEXTURE 0x0040 18 | #define DEBUG_VERTEX 0x0080 19 | #define DEBUG_TRIANGLE 0x0100 20 | #define DEBUG_MATRIX 0x0200 21 | 22 | #define OpenDebugDlg() 23 | #define CloseDebugDlg() 24 | #define StartDump(filename) 25 | #define EndDump() 26 | #define DebugMsg(type, format, ... ) printf(format, ## __VA_ARGS__) 27 | #define DebugRSPState(pci, pc, cmd, w0, w1) 28 | 29 | #endif // DEBUG_H 30 | 31 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/DepthBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef DEPTHBUFFER_H 2 | #define DEPTHBUFFER_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define depthBuffer gln64depthBuffer 11 | 12 | typedef struct DepthBuffer 13 | { 14 | struct DepthBuffer *higher, *lower; 15 | 16 | uint32_t address, cleared; 17 | } DepthBuffer; 18 | 19 | typedef struct 20 | { 21 | DepthBuffer *top, *bottom, *current; 22 | int numBuffers; 23 | } DepthBufferInfo; 24 | 25 | extern DepthBufferInfo depthBuffer; 26 | 27 | void DepthBuffer_Init(void); 28 | void DepthBuffer_Destroy(void); 29 | void DepthBuffer_SetBuffer( uint32_t address ); 30 | void DepthBuffer_RemoveBuffer( uint32_t address ); 31 | DepthBuffer *DepthBuffer_FindBuffer( uint32_t address ); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/F3DDKR.h: -------------------------------------------------------------------------------- 1 | #ifndef F3DDKR_H 2 | #define F3DDKR_H 3 | 4 | #define F3DDKR_VTX_APPEND 0x00010000 5 | 6 | #define F3DDKR_DMA_MTX 0x01 7 | #define F3DDKR_DMA_TEX_OFFSET 0x02 8 | #define F3DDKR_DMA_VTX 0x04 9 | #define F3DDKR_DMA_TRI 0x05 10 | #define F3DDKR_DMA_DL 0x07 11 | #define F3DDKR_DMA_OFFSETS 0xBF 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void F3DDKR_Init(void); 18 | 19 | void F3DJFG_Init(void); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/F3DEX2CBFD.h: -------------------------------------------------------------------------------- 1 | #ifndef F3DEX2CBFD_H 2 | #define F3DEX2CBFD_H 3 | 4 | #define F3DEX2CBFD_TRI4 16 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void F3DEX2CBFD_Init(void); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/F3DPD.h: -------------------------------------------------------------------------------- 1 | #ifndef F3DPD_H 2 | #define F3DPD_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #define F3DPD_VTXCOLORBASE 0x07 9 | 10 | void F3DPD_Init(void); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/F3DSWSE.h: -------------------------------------------------------------------------------- 1 | #ifndef F3DSWSE_H 2 | #define F3DSWSE_H 3 | 4 | void F3DSWSE_Init(); 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/F3DWRUS.h: -------------------------------------------------------------------------------- 1 | #ifndef F3DWRUS_H 2 | #define F3DWRUS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #define F3DWRUS_TRI2 0xB1 9 | void F3DWRUS_Init(void); 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/Hash.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | uint32_t Hash_CalculatePalette(void *buffer, uint32_t count) 4 | { 5 | unsigned int i; 6 | uint16_t *data = (uint16_t *) buffer; 7 | uint32_t hash = 0xffffffff; 8 | count /= 4; 9 | for(i = 0; i < count; ++i) { 10 | hash += data[i << 2]; 11 | hash += (hash << 10); 12 | hash ^= (hash >> 6); 13 | } 14 | hash += (hash << 3); 15 | hash ^= (hash >> 11); 16 | hash += (hash << 15); 17 | return hash; 18 | } 19 | 20 | uint32_t Hash_Calculate(uint32_t hash, void *buffer, uint32_t count) 21 | { 22 | unsigned int i; 23 | uint32_t *data = (uint32_t *) buffer; 24 | count /= 4; 25 | for(i = 0; i < count; ++i) { 26 | hash += data[i]; 27 | hash += (hash << 10); 28 | hash ^= (hash >> 6); 29 | } 30 | hash += (hash << 3); 31 | hash ^= (hash >> 11); 32 | hash += (hash << 15); 33 | return hash; 34 | } 35 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/L3D.h: -------------------------------------------------------------------------------- 1 | #ifndef L3D_H 2 | #define L3D_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | #define L3D_LINE3D 0xB5 11 | 12 | void L3D_Line3D( uint32_t w0, uint32_t w1 ); 13 | void L3D_Init(void); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/L3DEX.h: -------------------------------------------------------------------------------- 1 | #ifndef L3DEX_H 2 | #define L3DEX_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | void L3DEX_Line3D( uint32_t w0, uint32_t w1 ); 11 | void L3DEX_Init(void); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/L3DEX2.h: -------------------------------------------------------------------------------- 1 | #ifndef L3DEX2_H 2 | #define L3DEX2_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | #define L3DEX2_LINE3D 0x08 11 | 12 | void L3DEX2_Line3D( uint32_t w0, uint32_t w1 ); 13 | void L3DEX2_Init(); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/N64.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "N64.h" 3 | 4 | extern uint8_t *DMEM; 5 | uint64_t TMEM[512]; 6 | uint8_t *RDRAM; 7 | uint32_t RDRAMSize; 8 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/N64.h: -------------------------------------------------------------------------------- 1 | #ifndef N64_H 2 | #define N64_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include "m64p_plugin.h" 10 | 11 | #define MI_INTR_SP 0x1 // Bit 1: SP intr 12 | #define MI_INTR_DP 0x20 // Bit 5: DP intr 13 | 14 | extern uint64_t TMEM[512]; 15 | extern uint32_t RDRAMSize; 16 | 17 | extern GFX_INFO gfx_info; 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/RDP.h: -------------------------------------------------------------------------------- 1 | #ifndef _GLN64_RDP_H 2 | #define _GLN64_RDP_H 3 | 4 | #include 5 | 6 | #include "../../Graphics/RDP/RDP_state.h" 7 | 8 | #ifndef maxCMDMask 9 | #define maxCMDMask (MAXCMD - 1) 10 | #endif 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | void RDP_Init(void); 17 | void RDP_Half_1(uint32_t _c); 18 | void RDP_ProcessRDPList(); 19 | void RDP_RepeatLastLoadBlock(void); 20 | void RDP_SetScissor(uint32_t w0, uint32_t w1); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/RSP.h: -------------------------------------------------------------------------------- 1 | #ifndef RSP_H 2 | #define RSP_H 3 | 4 | #include 5 | #include 6 | 7 | #include "../../Graphics/RSP/RSP_state.h" 8 | 9 | #include "N64.h" 10 | #include "GBI.h" 11 | //#include "gSP.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #define RSPMSG_CLOSE 0 18 | #define RSPMSG_UPDATESCREEN 1 19 | #define RSPMSG_PROCESSDLIST 2 20 | #define RSPMSG_CAPTURESCREEN 3 21 | #define RSPMSG_DESTROYTEXTURES 4 22 | #define RSPMSG_INITTEXTURES 5 23 | 24 | extern uint32_t DepthClearColor; 25 | 26 | #define RSP_SegmentToPhysical( segaddr ) ((gSP.segment[(segaddr >> 24) & 0x0F] + (segaddr & 0x00FFFFFF)) & 0x00FFFFFF) 27 | 28 | void RSP_Init(void); 29 | void RSP_ProcessDList(void); 30 | void RSP_LoadMatrix( float mtx[4][4], uint32_t address ); 31 | void RSP_CheckDLCounter(); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/S2DEX.h: -------------------------------------------------------------------------------- 1 | #ifndef S2DEX_H 2 | #define S2DEX_H 3 | 4 | #include "../../Graphics/HLE/Microcode/S2DEX.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void S2DEX_BG_1Cyc( uint32_t w0, uint32_t w1 ); 11 | void S2DEX_BG_Copy( uint32_t w0, uint32_t w1 ); 12 | void S2DEX_Obj_Rectangle( uint32_t w0, uint32_t w1 ); 13 | void S2DEX_Obj_Sprite( uint32_t w0, uint32_t w1 ); 14 | void S2DEX_Obj_MoveMem( uint32_t w0, uint32_t w1 ); 15 | void S2DEX_Select_DL( uint32_t w0, uint32_t w1 ); 16 | void S2DEX_Obj_RenderMode( uint32_t w0, uint32_t w1 ); 17 | void S2DEX_Obj_Rectangle_R( uint32_t w0, uint32_t w1 ); 18 | void S2DEX_Obj_LoadTxtr( uint32_t w0, uint32_t w1 ); 19 | void S2DEX_Obj_LdTx_Sprite( uint32_t w0, uint32_t w1 ); 20 | void S2DEX_Obj_LdTx_Rect( uint32_t w0, uint32_t w1 ); 21 | void S2DEX_Obj_LdTx_Rect_R( uint32_t w0, uint32_t w1 ); 22 | void S2DEX_Init(void); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/S2DEX2.h: -------------------------------------------------------------------------------- 1 | #ifndef S2DEX2_H 2 | #define S2DEX2_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | void S2DEX2_Init(void); 9 | 10 | #define S2DEX2_OBJ_RECTANGLE_R 0xDA 11 | #define S2DEX2_OBJ_MOVEMEM 0xDC 12 | #define S2DEX2_RDPHALF_0 0xE4 13 | #define S2DEX2_OBJ_RECTANGLE 0x01 14 | #define S2DEX2_OBJ_SPRITE 0x02 15 | #define S2DEX2_SELECT_DL 0x04 16 | #define S2DEX2_OBJ_LOADTXTR 0x05 17 | #define S2DEX2_OBJ_LDTX_SPRITE 0x06 18 | #define S2DEX2_OBJ_LDTX_RECT 0x07 19 | #define S2DEX2_OBJ_LDTX_RECT_R 0x08 20 | #define S2DEX2_BG_1CYC 0x09 21 | #define S2DEX2_BG_COPY 0x0A 22 | #define S2DEX2_OBJ_RENDERMODE 0x0B 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/Turbo3D.h: -------------------------------------------------------------------------------- 1 | #ifndef GLN64_TURBO3D_H 2 | #define GLN64_TURBO3D_H 3 | 4 | void RunTurbo3D(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/VI.h: -------------------------------------------------------------------------------- 1 | #ifndef VI_H 2 | #define VI_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct 12 | { 13 | uint32_t width, widthPrev, height, real_height; 14 | float rwidth, rheight; 15 | uint32_t lastOrigin; 16 | 17 | uint32_t realWidth, realHeight; 18 | bool interlaced; 19 | bool PAL; 20 | 21 | struct{ 22 | uint32_t start, end; 23 | } display[16]; 24 | 25 | uint32_t displayNum; 26 | 27 | } VIInfo; 28 | 29 | extern VIInfo VI; 30 | 31 | void VI_UpdateSize(void); 32 | void VI_UpdateScreen(void); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/ZSort.h: -------------------------------------------------------------------------------- 1 | #ifndef GLN64_ZSORT_H 2 | #define GLN64_ZSORT_H 3 | 4 | void ZSort_Init(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /code/src/gles2n64/src/gles2N64.h: -------------------------------------------------------------------------------- 1 | #ifndef GLN64_H 2 | #define GLN64_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "m64p_config.h" 9 | #include "stdio.h" 10 | 11 | //#define DEBUG 12 | 13 | #define PLUGIN_NAME "gles2n64" 14 | #define PLUGIN_VERSION 0x000005 15 | #define PLUGIN_API_VERSION 0x020200 16 | 17 | #define renderCallback gln64RenderCallback 18 | 19 | extern void (*renderCallback)(); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /code/src/gles2rice/data/RiceVideoLinux.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/src/gles2rice/data/RiceVideoLinux.ini -------------------------------------------------------------------------------- /code/src/gles2rice/src/OGLDecodedMux.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2003 Rice1964 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "DecodedMux.h" 20 | 21 | #ifndef _OGL_DECODEDMUX_H_ 22 | #define _OGL_DECODEDMUX_H_ 23 | 24 | class COGLDecodedMux : public DecodedMux 25 | { 26 | protected: 27 | virtual void Simplify(void); 28 | virtual void Reformat(void); 29 | }; 30 | 31 | class COGLExtDecodedMux : public COGLDecodedMux 32 | { 33 | protected: 34 | virtual void FurtherFormatForOGL2(void); 35 | virtual void Simplify(void); 36 | }; 37 | 38 | #endif 39 | 40 | 41 | -------------------------------------------------------------------------------- /code/src/gles2rice/src/OGLTexture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2003 Rice1964 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef _OGL_TEXTURE_H_ 20 | #define _OGL_TEXTURE_H_ 21 | 22 | #include "osal_opengl.h" 23 | 24 | #include "TextureManager.h" 25 | 26 | class COGLTexture : public CTexture 27 | { 28 | friend class COGLRenderTexture; 29 | public: 30 | ~COGLTexture(); 31 | 32 | bool StartUpdate(DrawInfo *di); 33 | void EndUpdate(DrawInfo *di); 34 | 35 | GLuint m_dwTextureName; 36 | GLuint m_glFmt; 37 | protected: 38 | friend class OGLDeviceBuilder; 39 | COGLTexture(uint32_t dwWidth, uint32_t dwHeight, TextureUsage usage); 40 | }; 41 | 42 | 43 | #endif 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /code/src/gles2rice/src/RSP_GBI2_ext.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 Rice1964 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | */ 19 | 20 | // Some new GBI2 extension ucodes 21 | void RSP_GBI2_DL_Count(Gfx *gfx) 22 | { 23 | SP_Timing(DP_Minimal); 24 | DP_Timing(DP_Minimal); 25 | 26 | // This cmd is likely to execute number of ucode at the given address 27 | uint32_t dwAddr = RSPSegmentAddr((gfx->words.w1)); 28 | { 29 | __RSP.PCi++; 30 | __RSP.PC[__RSP.PCi] = dwAddr; 31 | __RSP.countdown[__RSP.PCi] = ((gfx->words.w0)&0xFFFF); 32 | } 33 | } 34 | 35 | 36 | void RSP_GBI2_0x8(Gfx *gfx) 37 | { 38 | if( ((gfx->words.w0)&0x00FFFFFF) == 0x2F && ((gfx->words.w1)&0xFF000000) == 0x80000000 ) 39 | { 40 | // V-Rally 64 41 | RSP_S2DEX_SPObjLoadTxRectR(gfx); 42 | } 43 | else 44 | { 45 | RSP_RDP_Nothing(gfx); 46 | } 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /code/src/gles2rice/src/arm_features.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARM_FEATURES_H__ 2 | #define __ARM_FEATURES_H__ 3 | 4 | #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ 5 | || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ 6 | || defined(__ARM_ARCH_7EM__) 7 | 8 | #define HAVE_ARMV7 9 | #define HAVE_ARMV6 10 | #define HAVE_ARMV5 11 | 12 | #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ 13 | || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ 14 | || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) 15 | 16 | #define HAVE_ARMV6 17 | #define HAVE_ARMV5 18 | 19 | #elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5E__) \ 20 | || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) 21 | 22 | #define HAVE_ARMV5 23 | 24 | #endif 25 | 26 | /* no need for HAVE_NEON - GCC defines __ARM_NEON__ consistently */ 27 | 28 | /* global function/external symbol */ 29 | #ifndef __MACH__ 30 | #define ESYM(name) name 31 | 32 | #define FUNCTION(name) \ 33 | .globl name; \ 34 | .type name, %function; \ 35 | name 36 | 37 | #define EXTRA_UNSAVED_REGS 38 | 39 | #else 40 | #define ESYM(name) _##name 41 | 42 | #define FUNCTION(name) \ 43 | .globl ESYM(name); \ 44 | name: \ 45 | ESYM(name) 46 | 47 | // r7 is preserved, but add it for EABI alignment.. 48 | #define EXTRA_UNSAVED_REGS r7, r9, 49 | 50 | #endif 51 | 52 | #endif /* __ARM_FEATURES_H__ */ 53 | -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/Glide64_Ini.h: -------------------------------------------------------------------------------- 1 | #ifndef _GLIDE64_INI_OVER_H 2 | #define _GLIDE64_INI_OVER_H 3 | 4 | void ReadSpecialSettings (const char * name); 5 | void ReadSettings(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/Help/Glide64 Known Issues.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/src/glide2gl/src/Glide64/Help/Glide64 Known Issues.html -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/Help/Glide64 compatibility list.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/src/glide2gl/src/Glide64/Help/Glide64 compatibility list.html -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/MiClWr.h: -------------------------------------------------------------------------------- 1 | #ifndef _GLIDE64_MICLWR_H 2 | #define _GLIDE64_MICLWR_H 3 | 4 | void ClampTex(uint8_t *tex, uint32_t width, 5 | uint32_t clamp_to, uint32_t real_width, uint32_t real_height, 6 | uint32_t size); 7 | 8 | void MirrorTex (uint8_t *tex, uint32_t mask, uint32_t max_width, 9 | uint32_t real_width, uint32_t height, uint32_t size); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/glide64_gDP.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "../../../Graphics/GBI.h" 6 | #include "Util.h" 7 | #include "TexLoad.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | extern int CI_SET; 14 | extern uint32_t swapped_addr; 15 | 16 | void glide64gDPSetTextureImage(int32_t fmt, int32_t siz, 17 | int32_t width, int32_t addr); 18 | void glide64gDPLoadBlock( uint32_t tile, uint32_t ul_s, uint32_t ul_t, 19 | uint32_t lr_s, uint32_t dxt ); 20 | void glide64gDPLoadTile(uint32_t tile, uint32_t ul_s, uint32_t ul_t, 21 | uint32_t lr_s, uint32_t lr_t); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/glide64_gSP.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../Glitch64/glide.h" 4 | #include "Combine.h" 5 | #include "rdp.h" 6 | #include "../../Graphics/GBI.h" 7 | #include "../../Graphics/RSP/gSP_funcs_C.h" 8 | #include "../../Graphics/RSP/RSP_state.h" 9 | 10 | typedef struct DRAWOBJECT_t 11 | { 12 | float objX; 13 | float objY; 14 | float scaleW; 15 | float scaleH; 16 | int16_t imageW; 17 | int16_t imageH; 18 | 19 | uint16_t imageStride; 20 | uint16_t imageAdrs; 21 | uint8_t imageFmt; 22 | uint8_t imageSiz; 23 | uint8_t imagePal; 24 | uint8_t imageFlags; 25 | } DRAWOBJECT; 26 | 27 | /* forward decls */ 28 | 29 | static void uc6_draw_polygons (VERTEX v[4]); 30 | static void uc6_read_object_data (DRAWOBJECT *d); 31 | static void uc6_init_tile(const DRAWOBJECT *d); 32 | extern int dzdx; 33 | extern int deltaZ; 34 | 35 | void cull_trianglefaces(VERTEX **v, unsigned iterations, bool do_update, bool do_cull, int32_t wd); 36 | void glide64gSPLightVertex(void *data); 37 | void glide64gSPDMATriangles(uint32_t tris, uint32_t n); 38 | void glide64gSPSetDMAOffsets(uint32_t mtxoffset, uint32_t vtxoffset); 39 | void glide64gSPDMAMatrix(uint32_t matrix, uint8_t index, uint8_t multiply); 40 | void glide64gSPDMAVertex(uint32_t v, uint32_t n, uint32_t v0); 41 | void glide64gSPCBFDVertex(uint32_t a, uint32_t n, uint32_t v0); 42 | void glide64gSPObjLoadTxtr(uint32_t tx); 43 | void glide64gSPCoordMod(uint32_t w0, uint32_t w1); 44 | void glide64gSPLightCBFD(uint32_t l, int32_t n); 45 | void glide64gSPSetVertexNormaleBase(uint32_t base); 46 | /* end forward decls */ 47 | 48 | -------------------------------------------------------------------------------- /code/src/glide2gl/src/Glide64/ucode_f3dtexa.h: -------------------------------------------------------------------------------- 1 | static void f3dttexa_loadtex(uint32_t w0, uint32_t w1) 2 | { 3 | rdp_settextureimage(0x3d100000, w1); 4 | 5 | rdp_settile(0x35100000, 0x07000000); 6 | 7 | rdp_loadblock(0x33000000, 8 | 0x27000000 | (w0 & 0x00FFFFFF) 9 | ); 10 | } 11 | 12 | static void f3dttexa_settilesize(uint32_t w0, uint32_t w1) 13 | { 14 | uint32_t firstHalf = (w1 & 0xFF000000) >> 15; 15 | 16 | rdp_settile(0x35400000 | firstHalf, 17 | w0 & 0x00FFFFFF); 18 | 19 | rdp_settilesize(0x32000000, 20 | w1 & 0x00FFFFFF); 21 | } 22 | -------------------------------------------------------------------------------- /code/src/libretro-common/glsym/README.md: -------------------------------------------------------------------------------- 1 | # Autogenerate GL extension loaders 2 | 3 | ## OpenGL desktop 4 | 5 | Use Khronos' recent [header](www.opengl.org/registry/api/glext.h). 6 | 7 | ./glgen.py /usr/include/GL/glext.h glsym_gl.h glsym_gl.c 8 | 9 | ## OpenGL ES 10 | 11 | ./glgen.py /usr/include/GLES2/gl2ext.h glsym_es2.h glsym_es2.c 12 | 13 | -------------------------------------------------------------------------------- /code/src/libretro-common/include/compat/fnmatch.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fnmatch.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 24 | #define __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 25 | 26 | #define FNM_NOMATCH 1 27 | 28 | int rl_fnmatch(const char *pattern, const char *string, int flags); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/src/libretro-common/libco/libco.c: -------------------------------------------------------------------------------- 1 | /* 2 | libco 3 | auto-selection module 4 | license: public domain 5 | */ 6 | 7 | #if defined _MSC_VER 8 | #include 9 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 10 | #include "fiber.c" 11 | #elif defined _M_IX86 12 | #include "x86.c" 13 | #elif defined _M_AMD64 14 | #include "amd64.c" 15 | #else 16 | #include "fiber.c" 17 | #endif 18 | #elif defined __GNUC__ 19 | #if defined __i386__ 20 | #include "x86.c" 21 | #elif defined __amd64__ 22 | #include "amd64.c" 23 | #elif defined _ARCH_PPC 24 | #include "ppc.c" 25 | #elif defined(__aarch64__) 26 | #include "aarch64.c" 27 | #elif defined VITA 28 | #include "scefiber.c" 29 | #elif defined(__ARM_EABI__) || defined(__arm__) 30 | #include "armeabi.c" 31 | #else 32 | #include "sjlj.c" 33 | #endif 34 | #else 35 | #error "libco: unsupported processor, compiler or operating system" 36 | #endif 37 | -------------------------------------------------------------------------------- /code/src/libretro/libretro_crc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CRC32_POLYNOMIAL 0x04C11DB7 5 | 6 | unsigned int CRCTable[ 256 ]; 7 | 8 | static uint32_t Reflect(uint32_t ref, char ch ) 9 | { 10 | char i; 11 | uint32_t value = 0; 12 | /* Swap bit 0 for bit 7. 13 | * bit 1 for bit 6, etc. 14 | */ 15 | for (i = 1; i < (ch + 1); i++) 16 | { 17 | if(ref & 1) 18 | value |= 1 << (ch - i); 19 | ref >>= 1; 20 | } 21 | return value; 22 | } 23 | 24 | void CRC_BuildTable(void) 25 | { 26 | int i, j; 27 | uint32_t crc; 28 | 29 | for (i = 0; i < 256; i++) 30 | { 31 | crc = Reflect( i, 8 ) << 24; 32 | for (j = 0; j < 8; j++) 33 | crc = (crc << 1) ^ (crc & (1 << 31) ? CRC32_POLYNOMIAL : 0); 34 | CRCTable[i] = Reflect( crc, 32 ); 35 | } 36 | } 37 | 38 | uint32_t CRC_Calculate(void *buffer, uint32_t count) 39 | { 40 | uint32_t crc = 0xffffffff; 41 | uint8_t *p = (uint8_t*) buffer; 42 | while (count--) 43 | crc = (crc >> 8) ^ CRCTable[(crc & 0xFF) ^ *p++]; 44 | return ~crc; 45 | } 46 | -------------------------------------------------------------------------------- /code/src/libretro/libretro_memory.h: -------------------------------------------------------------------------------- 1 | #ifndef M64P_LIBRETRO_MEMORY_H 2 | #define M64P_LIBRETRO_MEMORY_H 3 | 4 | #include 5 | 6 | typedef struct _save_memory_data 7 | { 8 | uint8_t eeprom[0x800]; 9 | uint8_t mempack[4][0x8000]; 10 | uint8_t sram[0x8000]; 11 | uint8_t flashram[0x20000]; 12 | uint8_t disk[0x0435B0C0]; 13 | } save_memory_data; 14 | 15 | extern save_memory_data saved_memory; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /code/src/libretro/libretro_perf.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBRETRO_PERF_H 2 | #define _LIBRETRO_PERF_H 3 | 4 | #include "libretro.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | extern struct retro_perf_callback perf_cb; 11 | 12 | #if 1 13 | #define RETRO_PERFORMANCE_INIT(perf_cb, name) static struct retro_perf_counter name = {#name}; if (!name.registered) perf_cb.perf_register(&(name)) 14 | #define RETRO_PERFORMANCE_START(perf_cb, name) perf_cb.perf_start(&(name)) 15 | #define RETRO_PERFORMANCE_STOP(perf_cb, name) perf_cb.perf_stop(&(name)) 16 | #else 17 | #define RETRO_PERFORMANCE_INIT(perf_cb, name) 18 | #define RETRO_PERFORMANCE_START(perf_cb, name) 19 | #define RETRO_PERFORMANCE_STOP(perf_cb, name) 20 | #endif 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /code/src/libretro/libretro_private.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBRETRO_PRIVATE_H_ 2 | #define _LIBRETRO_PRIVATE_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "libretro_perf.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | extern unsigned int FAKE_SDL_TICKS; 15 | 16 | extern retro_get_cpu_features_t perf_get_cpu_features_cb; 17 | extern retro_perf_get_counter_t perf_get_counter_cb; 18 | //extern retro_log_printf_t log_cb; 19 | extern retro_perf_register_t perf_register_cb; 20 | int retro_return(bool just_flipping); 21 | 22 | #define SDL_GetTicks() FAKE_SDL_TICKS 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #ifdef _MSC_VER 29 | #define strcasecmp stricmp 30 | #endif 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /code/src/libretro/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /code/src/libretro/msvc/msvc-2013/libretro.def: -------------------------------------------------------------------------------- 1 | LIBRARY "libretro" 2 | EXPORTS 3 | retro_set_environment 4 | retro_set_video_refresh 5 | retro_set_audio_sample 6 | retro_set_audio_sample_batch 7 | retro_set_input_poll 8 | retro_set_input_state 9 | retro_init 10 | retro_deinit 11 | retro_api_version 12 | retro_get_system_info 13 | retro_get_system_av_info 14 | retro_set_controller_port_device 15 | retro_reset 16 | retro_run 17 | retro_serialize_size 18 | retro_serialize 19 | retro_unserialize 20 | retro_cheat_reset 21 | retro_cheat_set 22 | retro_load_game 23 | retro_load_game_special 24 | retro_unload_game 25 | retro_get_region 26 | retro_get_memory_data 27 | retro_get_memory_size 28 | -------------------------------------------------------------------------------- /code/src/libretro/neil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | void neil_invoke_linker(); 3 | void retro_init(void); 4 | void retro_deinit(void); 5 | bool retro_load_game_new(uint8_t* romdata, int size, bool loadEep, bool loadSra, bool loadFla); 6 | void retro_run(void); 7 | void setDeviceId(int id); 8 | int getReadyToSwap(); 9 | void resetReadyToSwap(); 10 | int getVI_Count(); 11 | void resetVI_Count(); 12 | int getVIFPS_Count(); 13 | void resetVIFPS_Count(); 14 | bool neil_serialize(); 15 | bool neil_unserialize(); 16 | bool neil_export_eep(); 17 | bool neil_export_sra(); 18 | bool neil_export_fla(); 19 | void retro_reset_new(); 20 | int getRegionTiming(); 21 | uint32_t* get_video_buffer(); 22 | 23 | struct NeilCheats { 24 | uint32_t address; 25 | int value; 26 | }; 27 | 28 | extern struct NeilCheats neilCheats[]; 29 | extern int neilCheatsLength; -------------------------------------------------------------------------------- /code/src/mupen64plus-core/INSTALL: -------------------------------------------------------------------------------- 1 | Mupen64Plus-Core INSTALL 2 | ------------------------ 3 | 4 | This text file was written to explain the installation process of the 5 | Mupen64Plus-Core module. 6 | 7 | If this module is part of a Mupen64Plus source code bundle, the user should run 8 | the "m64p_install.sh" script in the root of the unzipped bundle to install all 9 | of the included modules in the bundle. 10 | 11 | If this module is a standalone source code release, you should build the library 12 | from source code and install it via the makefile, like this: 13 | 14 | $ cd projects/unix 15 | $ make all 16 | $ sudo make install 17 | 18 | If you want to build the Mupen64Plus-Core module for installation in a home 19 | folder for a single user, you may build it like this (replacing 20 | with your desired local installation path): 21 | 22 | $ cd projects/unix 23 | $ make all SHAREDIR= 24 | $ make install LIBDIR= SHAREDIR= 25 | 26 | 27 | -------------------------------------------------------------------------------- /code/src/mupen64plus-core/tools/m64p_helper_scripts.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/src/mupen64plus-core/tools/m64p_helper_scripts.tar.gz -------------------------------------------------------------------------------- /code/src/mupen64plus-core/tools/savestate_convert.txt: -------------------------------------------------------------------------------- 1 | ============================================================================== 2 | savestate_convert.txt - Mupen64Plus - July 12th, 2008 3 | 4 | This conversion tool was written to help users migrate their savestate files 5 | when there are changes to the savestate file format which break backward 6 | compatibility. 7 | 8 | To compile the conversion tool, open a console window, go to the root of your 9 | Mupen64Plus source code, and type: 10 | 11 | gcc -o savestate_convert -lz tools/savestate_convert.c 12 | 13 | This will create a small command-line application called 'savestate_convert'. 14 | This program takes only one command-line parameter, which is a path to the 15 | savestate file that you want to update. The old savestate file will be 16 | overwritten with the new one, so you may wish to first make a backup copy 17 | of the savestate file. If you update a savestate file to a newer version, 18 | older versions of Mupen64Plus will not be able to load it. 19 | 20 | If you wish to update all of the savestate files in your home directory, you 21 | may do so with the following bash command: 22 | 23 | for file in ~/.mupen64plus/save/*.st*; do ./savestate_convert "${file}"; done 24 | 25 | ============================================================================== 26 | Savestate File Format History: 27 | 28 | version 0: 29 | - Original (Unversioned) file format 30 | - used by Mupen64 v0.5 and Mupen64Plus up to v1.4 31 | 32 | version 1.0: 33 | - bugfix: TLB was not being entirely saved and restored 34 | - added small header with magic number and version number 35 | - introduced in rev 758 of Mupen64Plus SVN repository (trunk) 36 | 37 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-cxd4/rsp.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************\ 2 | * Project: Module Subsystem Interface to SP Interpreter Core * 3 | * Authors: Iconoclast * 4 | * Release: 2016.03.23 * 5 | * License: CC0 Public Domain Dedication * 6 | * * 7 | * To the extent possible under law, the author(s) have dedicated all copyright * 8 | * and related and neighboring rights to this software to the public domain * 9 | * worldwide. This software is distributed without any warranty. * 10 | * * 11 | * You should have received a copy of the CC0 Public Domain Dedication along * 12 | * with this software. * 13 | * If not, see . * 14 | \******************************************************************************/ 15 | 16 | #define LIBRETRO 17 | 18 | #if defined(USE_SSE2NEON) && defined(__ARM_NEON__) 19 | #include "sse2neon/SSE2NEON.h" 20 | #define ARCH_MIN_SSE2 21 | #endif 22 | 23 | #include "vu/add.c" 24 | #include "vu/divide.c" 25 | #include "vu/logical.c" 26 | #include "vu/multiply.c" 27 | #include "vu/select.c" 28 | #include "vu/vu.c" 29 | #include "su.c" 30 | #include "module.c" 31 | 32 | unsigned char rsp_conf[32]; 33 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-cxd4/rsp_dump.h: -------------------------------------------------------------------------------- 1 | #ifndef RSP_DUMP_H__ 2 | #define RSP_DUMP_H__ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void rsp_open_trace(const char *path); 11 | void rsp_close_trace(void); 12 | 13 | void rsp_dump_begin_trace(void); 14 | void rsp_dump_end_trace(void); 15 | 16 | void rsp_dump_block(const char *tag, const void *data, size_t size); 17 | 18 | void rsp_dump_begin_read_dma(void); 19 | void rsp_dump_poke_mem(unsigned base, const void *data, size_t size); 20 | void rsp_dump_end_read_dma(void); 21 | 22 | int rsp_dump_recording_trace(void); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-cxd4/vu/add.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************\ 2 | * Project: Instruction Mnemonics for Vector Unit Computational Adds * 3 | * Authors: Iconoclast * 4 | * Release: 2014.10.15 * 5 | * License: CC0 Public Domain Dedication * 6 | * * 7 | * To the extent possible under law, the author(s) have dedicated all copyright * 8 | * and related and neighboring rights to this software to the public domain * 9 | * worldwide. This software is distributed without any warranty. * 10 | * * 11 | * You should have received a copy of the CC0 Public Domain Dedication along * 12 | * with this software. * 13 | * If not, see . * 14 | \******************************************************************************/ 15 | 16 | #ifndef _ADD_H_ 17 | #define _ADD_H_ 18 | 19 | #include "vu.h" 20 | 21 | VECTOR_EXTERN 22 | VADD (v16 vs, v16 vt); 23 | VECTOR_EXTERN 24 | VSUB (v16 vs, v16 vt); 25 | VECTOR_EXTERN 26 | VABS (v16 vs, v16 vt); 27 | VECTOR_EXTERN 28 | VADDC (v16 vs, v16 vt); 29 | VECTOR_EXTERN 30 | VSUBC (v16 vs, v16 vt); 31 | VECTOR_EXTERN 32 | VSAW (v16 vs, v16 vt); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-cxd4/vu/logical.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************\ 2 | * Project: Instruction Mnemonics for Vector Unit Computational Bit-Wise Logic * 3 | * Authors: Iconoclast * 4 | * Release: 2014.10.15 * 5 | * License: CC0 Public Domain Dedication * 6 | * * 7 | * To the extent possible under law, the author(s) have dedicated all copyright * 8 | * and related and neighboring rights to this software to the public domain * 9 | * worldwide. This software is distributed without any warranty. * 10 | * * 11 | * You should have received a copy of the CC0 Public Domain Dedication along * 12 | * with this software. * 13 | * If not, see . * 14 | \******************************************************************************/ 15 | 16 | #ifndef _LOGICAL_H_ 17 | #define _LOGICAL_H_ 18 | 19 | #include "vu.h" 20 | 21 | VECTOR_EXTERN 22 | VAND (v16 vs, v16 vt); 23 | VECTOR_EXTERN 24 | VNAND (v16 vs, v16 vt); 25 | VECTOR_EXTERN 26 | VOR (v16 vs, v16 vt); 27 | VECTOR_EXTERN 28 | VNOR (v16 vs, v16 vt); 29 | VECTOR_EXTERN 30 | VXOR (v16 vs, v16 vt); 31 | VECTOR_EXTERN 32 | VNXOR (v16 vs, v16 vt); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-cxd4/vu/pack.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************\ 2 | * Project: Instruction Mnemonics for Vector Unit Computational Packs * 3 | * Authors: Iconoclast * 4 | * Release: 2014.10.15 * 5 | * License: CC0 Public Domain Dedication * 6 | * * 7 | * To the extent possible under law, the author(s) have dedicated all copyright * 8 | * and related and neighboring rights to this software to the public domain * 9 | * worldwide. This software is distributed without any warranty. * 10 | * * 11 | * You should have received a copy of the CC0 Public Domain Dedication along * 12 | * with this software. * 13 | * If not, see . * 14 | \******************************************************************************/ 15 | 16 | #ifndef _PACK_H_ 17 | #define _PACK_H_ 18 | 19 | #include "vu.h" 20 | 21 | VECTOR_EXTERN 22 | VEXTT (v16 vs, v16 vt); 23 | VECTOR_EXTERN 24 | VEXTQ (v16 vs, v16 vt); 25 | VECTOR_EXTERN 26 | VEXTN (v16 vs, v16 vt); 27 | VECTOR_EXTERN 28 | VINST (v16 vs, v16 vt); 29 | VECTOR_EXTERN 30 | VINSQ (v16 vs, v16 vt); 31 | VECTOR_EXTERN 32 | VINSN (v16 vs, v16 vt); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-hle/INSTALL: -------------------------------------------------------------------------------- 1 | Mupen64Plus-RSP-HLE INSTALL 2 | --------------------------- 3 | 4 | This text file was written to explain the installation process of the 5 | Mupen64Plus-RSP-HLE plugin. 6 | 7 | If this module is part of a Mupen64Plus source code bundle, the user should run 8 | the "m64p_install.sh" script in the root of the unzipped bundle to install all 9 | of the included modules in the bundle. 10 | 11 | If this module is a standalone source code release, you should build the library 12 | from source code and install it via the makefile, like this: 13 | 14 | $ cd projects/unix 15 | $ make all 16 | $ sudo make install 17 | 18 | If you want to build the Mupen64Plus-RSP-HLE module for installation in a home 19 | folder for a single user, you may build it like this (replacing 20 | with your desired local installation path): 21 | 22 | $ cd projects/unix 23 | $ make all 24 | $ make install LIBDIR= 25 | 26 | 27 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-hle/src/rsp_api_export.ver: -------------------------------------------------------------------------------- 1 | { global: 2 | PluginStartup; 3 | PluginShutdown; 4 | PluginGetVersion; 5 | DoRspCycles; 6 | InitiateRSP; 7 | RomClosed; 8 | local: *; }; 9 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *.bin 4 | *.elf 5 | /cmake-build-* 6 | /.idea 7 | *.iml 8 | /build-* 9 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/Themaister/parallel-rsp.git 8 | branch = master 9 | commit = efbf80b24f2fa56d20ae0f92d2ac30d249f72eb2 10 | parent = 42cba55909850bbcc648d7c6105769447387073c 11 | method = rebase 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/CREDITS.txt: -------------------------------------------------------------------------------- 1 | Written by Themaister. 2 | 3 | The code is heavily reliant on MarathonMan's CEN64 RSP implementation, as well as CXD4's RSP implementation. 4 | 5 | MIPS core: Rewritten from scratch 6 | CP0: Near copy-pasta from CEN64 7 | CP2: Near copy-pasta from CEN64 8 | LS pipe: Near copy-pasta from CXD4 9 | Mupen64plus glue code: Reused most of CXD4. 10 | Lightning jitter interface: Written from scratch 11 | 12 | The plugin's focus is to support dynamic recompilation for performance, 13 | instead of being pure interpreters as CEN64 and CXD4's implementations are. 14 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/LICENSE: -------------------------------------------------------------------------------- 1 | ============== 2 | parallel-rsp 3 | ============== 4 | 5 | This project is dual licensed under 6 | 7 | MIT (LICENSE.MIT) 8 | 9 | or 10 | 11 | LGPLv3 (LICENSE.LESSER) 12 | 13 | If statically linking against the GNU Lightning project (lightning/), 14 | note that Lightning is dual-licensed as GPLv3 or LGPLv3. 15 | parallel-rsp can be configured to dynamically link against Lightning or not link against Lightning at all. 16 | 17 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Hans-Kristian Arntzen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/android_fuzz_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RSP_FUZZ="$1" 4 | 5 | adb push "$RSP_FUZZ" /data/local/tmp/rsp-vu-fuzzer >/dev/null || exit 1 6 | adb shell chmod +x /data/local/tmp/rsp-vu-fuzzer >/dev/null || exit 1 7 | adb shell /data/local/tmp/rsp-vu-fuzzer || exit 1 8 | adb shell rm /data/local/tmp/rsp-vu-fuzzer || exit 1 9 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/android_test_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RSP_RUNNER="$1" 4 | RSP_BINFOLDER="$2" 5 | TEST_NAME="$3" 6 | 7 | adb push "$RSP_RUNNER" /data/local/tmp/rsp-runner >/dev/null || exit 1 8 | adb shell chmod +x /data/local/tmp/rsp-runner >/dev/null || exit 1 9 | adb push "$RSP_BINFOLDER"/"$TEST_NAME".global.bin /data/local/tmp/ >/dev/null || exit 1 10 | adb push "$RSP_BINFOLDER"/"$TEST_NAME".bin /data/local/tmp/ >/dev/null || exit 1 11 | adb shell /data/local/tmp/rsp-runner /data/local/tmp/"$TEST_NAME".global.bin /data/local/tmp/"$TEST_NAME".bin || exit 1 12 | adb shell rm /data/local/tmp/rsp-runner >/dev/null || exit 1 13 | adb shell rm /data/local/tmp/"$TEST_NAME".global.bin /data/local/tmp/"$TEST_NAME".bin >/dev/null || exit 1 14 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/clamp.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/clamp.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_sclamp_acc_tomd(__m128i acc_md, __m128i acc_hi) 9 | { 10 | __m128i l = _mm_unpacklo_epi16(acc_md, acc_hi); 11 | __m128i h = _mm_unpackhi_epi16(acc_md, acc_hi); 12 | return _mm_packs_epi32(l, h); 13 | } 14 | 15 | static inline __m128i rsp_uclamp_acc(__m128i val, __m128i acc_md, __m128i acc_hi, __m128i zero) 16 | { 17 | __m128i clamp_mask, clamped_val; 18 | __m128i hi_sign_check, md_sign_check; 19 | __m128i md_negative, hi_negative; 20 | __m128i tmp; 21 | 22 | hi_negative = _mm_srai_epi16(acc_hi, 15); 23 | md_negative = _mm_srai_epi16(acc_md, 15); 24 | 25 | // We don't have to clamp if the HI part of the 26 | // accumulator is sign-extended down to the MD part. 27 | hi_sign_check = _mm_cmpeq_epi16(hi_negative, acc_hi); 28 | md_sign_check = _mm_cmpeq_epi16(hi_negative, md_negative); 29 | clamp_mask = _mm_and_si128(md_sign_check, hi_sign_check); 30 | 31 | // Generate the value in the event we need to clamp. 32 | // * hi_negative, mid_sign => xxxx 33 | // * hi_negative, !mid_sign => 0000 34 | // * !hi_negative, mid_sign => FFFF 35 | // * !hi_negative, !mid_sign => xxxx 36 | clamped_val = _mm_cmpeq_epi16(hi_negative, zero); 37 | 38 | #ifndef __SSE4_1__ 39 | tmp = _mm_and_si128(clamp_mask, val); 40 | val = _mm_andnot_si128(clamp_mask, clamped_val); 41 | return _mm_or_si128(val, tmp); 42 | #else 43 | return _mm_blendv_epi8(clamped_val, val, clamp_mask); 44 | #endif 45 | } 46 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/rsp_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef RSP_IMPL_H 2 | #define RSP_IMPL_H 3 | 4 | #include "clamp.h" 5 | #include "vabs.h" 6 | #include "vadd.h" 7 | #include "vaddc.h" 8 | #include "vand.h" 9 | #include "vch.h" 10 | #include "vcl.h" 11 | #include "vcmp.h" 12 | #include "vcr.h" 13 | #include "vdivh.h" 14 | #include "vmac.h" 15 | #include "vmov.h" 16 | #include "vmrg.h" 17 | #include "vmul.h" 18 | #include "vmulh.h" 19 | #include "vmull.h" 20 | #include "vmulm.h" 21 | #include "vmuln.h" 22 | #include "vor.h" 23 | #include "vrcpsq.h" 24 | #include "vrsq.h" 25 | #include "vsub.h" 26 | #include "vsubc.h" 27 | #include "vxor.h" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vabs.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vabs.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vabs(__m128i vs, __m128i vt, __m128i *acc_lo) 9 | { 10 | __m128i vs_zero = _mm_cmpeq_epi16(vs, _mm_setzero_si128()); 11 | __m128i sign_lt = _mm_srai_epi16(vs, 15); 12 | __m128i vd = _mm_andnot_si128(vs_zero, vt); 13 | 14 | // Careful: if VT = 0x8000 and VS is negative, 15 | // acc_lo will be 0x8000 but vd will be 0x7FFF. 16 | vd = _mm_xor_si128(vd, sign_lt); 17 | *acc_lo = _mm_sub_epi16(vd, sign_lt); 18 | return _mm_subs_epi16(vd, sign_lt); 19 | } 20 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vadd.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vadd.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vadd(__m128i vs, __m128i vt, __m128i carry, __m128i *acc_lo) 9 | { 10 | __m128i vd, minimum, maximum; 11 | 12 | // VCC uses unsaturated arithmetic. 13 | vd = _mm_add_epi16(vs, vt); 14 | *acc_lo = _mm_sub_epi16(vd, carry); 15 | 16 | // VD is the signed sum of the two sources and the carry. Since we 17 | // have to saturate the sum of all three, we have to be clever. 18 | minimum = _mm_min_epi16(vs, vt); 19 | maximum = _mm_max_epi16(vs, vt); 20 | minimum = _mm_subs_epi16(minimum, carry); 21 | return _mm_adds_epi16(minimum, maximum); 22 | } 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vaddc.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vaddc.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vaddc(__m128i vs, __m128i vt, __m128i zero, __m128i *sn) 9 | { 10 | __m128i sat_sum, unsat_sum; 11 | 12 | sat_sum = _mm_adds_epu16(vs, vt); 13 | unsat_sum = _mm_add_epi16(vs, vt); 14 | 15 | *sn = _mm_cmpeq_epi16(sat_sum, unsat_sum); 16 | *sn = _mm_cmpeq_epi16(*sn, zero); 17 | 18 | return unsat_sum; 19 | } 20 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vand.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vand.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vand(__m128i vs, __m128i vt) 9 | { 10 | return _mm_and_si128(vs, vt); 11 | } 12 | 13 | static inline __m128i rsp_vnand(__m128i vs, __m128i vt) 14 | { 15 | __m128i vd = _mm_and_si128(vs, vt); 16 | return _mm_xor_si128(vd, _mm_set1_epi32(0xffffffffu)); 17 | } 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vcr.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vcr.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vcr(__m128i vs, __m128i vt, __m128i zero, __m128i *ge, __m128i *le) 9 | { 10 | __m128i diff_sel_mask, diff_gez, diff_lez; 11 | __m128i sign, sign_notvt; 12 | 13 | #ifdef INTENSE_DEBUG 14 | for (unsigned i = 0; i < 8; i++) 15 | fprintf(stderr, "VS[%d] = %d\n", i, reinterpret_cast(&vs)[i]); 16 | 17 | for (unsigned i = 0; i < 8; i++) 18 | fprintf(stderr, "VT[%d] = %d\n", i, reinterpret_cast(&vt)[i]); 19 | #endif 20 | 21 | // sign = (vs ^ vt) < 0 22 | sign = _mm_xor_si128(vs, vt); 23 | sign = _mm_srai_epi16(sign, 15); 24 | 25 | // Compute le 26 | diff_lez = _mm_and_si128(vs, sign); 27 | diff_lez = _mm_add_epi16(diff_lez, vt); 28 | *le = _mm_srai_epi16(diff_lez, 15); 29 | 30 | // Compute ge 31 | diff_gez = _mm_or_si128(vs, sign); 32 | diff_gez = _mm_min_epi16(diff_gez, vt); 33 | *ge = _mm_cmpeq_epi16(diff_gez, vt); 34 | 35 | // sign_notvt = sn ? ~vt : vt 36 | sign_notvt = _mm_xor_si128(vt, sign); 37 | 38 | // Compute result: 39 | #ifdef __SSE4_1__ 40 | diff_sel_mask = _mm_blendv_epi8(*ge, *le, sign); 41 | return _mm_blendv_epi8(vs, sign_notvt, diff_sel_mask); 42 | #else 43 | diff_sel_mask = _mm_sub_epi16(*le, *ge); 44 | diff_sel_mask = _mm_and_si128(diff_sel_mask, sign); 45 | diff_sel_mask = _mm_add_epi16(diff_sel_mask, *ge); 46 | 47 | zero = _mm_sub_epi16(sign_notvt, vs); 48 | zero = _mm_and_si128(zero, diff_sel_mask); 49 | return _mm_add_epi16(zero, vs); 50 | #endif 51 | } 52 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vdivh.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vrcp.c 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | inline __m128i rsp_vdivh(RSP::CPUState *rsp, unsigned src, unsigned e, unsigned dest, unsigned de) 9 | { 10 | 11 | // Get the element from VT. 12 | rsp->cp2.div_in = rsp->cp2.regs[src].e[e & 0x7]; 13 | 14 | // Write out the upper part of the result. 15 | rsp->cp2.regs[dest].e[de & 0x7] = rsp->cp2.div_out; 16 | return rsp_vect_load_unshuffled_operand(rsp->cp2.regs[dest].e); 17 | } 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vmov.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vmov.c 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | inline __m128i rsp_vmov(RSP::CPUState *rsp, unsigned src, unsigned e, unsigned dest, unsigned de) 9 | { 10 | uint16_t data; 11 | 12 | // Get the element from VT. 13 | data = rsp->cp2.regs[src].e[e & 0x7]; 14 | 15 | // Write out the upper part of the result. 16 | rsp->cp2.regs[dest].e[de & 0x7] = data; 17 | return rsp_vect_load_unshuffled_operand(rsp->cp2.regs[dest].e); 18 | } 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vmrg.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vmrg.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vmrg(__m128i vs, __m128i vt, __m128i le) 9 | { 10 | #ifdef __SSE4_1__ 11 | return _mm_blendv_epi8(vt, vs, le); 12 | #else 13 | vs = _mm_and_si128(le, vs); 14 | vt = _mm_andnot_si128(le, vt); 15 | return _mm_or_si128(vs, vt); 16 | #endif 17 | } 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vmudh.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vmudh.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vmudh(__m128i vs, __m128i vt, __m128i *acc_md, __m128i *acc_hi) 9 | { 10 | *acc_md = _mm_mullo_epi16(vs, vt); 11 | *acc_hi = _mm_mulhi_epi16(vs, vt); 12 | 13 | return rsp_sclamp_acc_tomd(*acc_md, *acc_hi); 14 | } 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vmul.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vmul.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | // 9 | // TODO: CHECK ME. 10 | // 11 | 12 | template 13 | static inline __m128i rsp_vmulf_vmulu(__m128i vs, __m128i vt, __m128i zero, __m128i *acc_lo, __m128i *acc_md, 14 | __m128i *acc_hi) 15 | { 16 | __m128i lo, hi, round, sign1, sign2, eq, neq, neg; 17 | 18 | lo = _mm_mullo_epi16(vs, vt); 19 | round = _mm_cmpeq_epi16(zero, zero); 20 | sign1 = _mm_srli_epi16(lo, 15); 21 | lo = _mm_add_epi16(lo, lo); 22 | round = _mm_slli_epi16(round, 15); 23 | hi = _mm_mulhi_epi16(vs, vt); 24 | sign2 = _mm_srli_epi16(lo, 15); 25 | *acc_lo = _mm_add_epi16(round, lo); 26 | sign1 = _mm_add_epi16(sign1, sign2); 27 | 28 | hi = _mm_slli_epi16(hi, 1); 29 | neq = eq = _mm_cmpeq_epi16(vs, vt); 30 | *acc_md = _mm_add_epi16(hi, sign1); 31 | 32 | neg = _mm_srai_epi16(*acc_md, 15); 33 | 34 | // VMULU 35 | if (VMULU) 36 | { 37 | *acc_hi = _mm_andnot_si128(eq, neg); 38 | hi = _mm_or_si128(*acc_md, neg); 39 | return _mm_andnot_si128(*acc_hi, hi); 40 | } 41 | 42 | // VMULF 43 | else 44 | { 45 | eq = _mm_and_si128(eq, neg); 46 | *acc_hi = _mm_andnot_si128(neq, neg); 47 | return _mm_add_epi16(*acc_md, eq); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vmulh.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vmulh.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | template 9 | static inline __m128i rsp_vmadh_vmudh(__m128i vs, __m128i vt, __m128i zero, __m128i *acc_lo, __m128i *acc_md, 10 | __m128i *acc_hi) 11 | { 12 | __m128i lo, hi, overflow_mask; 13 | 14 | lo = _mm_mullo_epi16(vs, vt); 15 | hi = _mm_mulhi_epi16(vs, vt); 16 | 17 | // VMADH 18 | if (VMADH) 19 | { 20 | // Tricky part: start accumulate everything. 21 | // Get/keep the carry as we'll add it in later. 22 | overflow_mask = _mm_adds_epu16(*acc_md, lo); 23 | *acc_md = _mm_add_epi16(*acc_md, lo); 24 | 25 | overflow_mask = _mm_cmpeq_epi16(*acc_md, overflow_mask); 26 | overflow_mask = _mm_cmpeq_epi16(overflow_mask, zero); 27 | 28 | hi = _mm_sub_epi16(hi, overflow_mask); 29 | *acc_hi = _mm_add_epi16(*acc_hi, hi); 30 | } 31 | 32 | // VMUDH 33 | else 34 | { 35 | *acc_lo = zero; 36 | *acc_md = lo; 37 | *acc_hi = hi; 38 | } 39 | 40 | return rsp_sclamp_acc_tomd(*acc_md, *acc_hi); 41 | } 42 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vor.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vor.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vor(__m128i vs, __m128i vt) 9 | { 10 | return _mm_or_si128(vs, vt); 11 | } 12 | 13 | static inline __m128i rsp_vnor(__m128i vs, __m128i vt) 14 | { 15 | __m128i vd = _mm_or_si128(vs, vt); 16 | return _mm_xor_si128(vd, _mm_set1_epi32(0xffffffffu)); 17 | } 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vsub.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vsub.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vsub(__m128i vs, __m128i vt, __m128i carry, __m128i *acc_lo) 9 | { 10 | __m128i unsat_diff, sat_diff, overflow, vd; 11 | 12 | // acc_lo uses saturated arithmetic. 13 | unsat_diff = _mm_sub_epi16(vt, carry); 14 | sat_diff = _mm_subs_epi16(vt, carry); 15 | 16 | *acc_lo = _mm_sub_epi16(vs, unsat_diff); 17 | vd = _mm_subs_epi16(vs, sat_diff); 18 | 19 | // VD is the signed diff of the two sources and the carry. Since we 20 | // have to saturate the diff of all three, we have to be clever. 21 | overflow = _mm_cmpgt_epi16(sat_diff, unsat_diff); 22 | return _mm_adds_epi16(vd, overflow); 23 | } 24 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vsubc.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vsubc.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vsubc(__m128i vs, __m128i vt, __m128i zero, __m128i *eq, __m128i *sn) 9 | { 10 | __m128i equal, sat_udiff, sat_udiff_zero; 11 | 12 | sat_udiff = _mm_subs_epu16(vs, vt); 13 | equal = _mm_cmpeq_epi16(vs, vt); 14 | sat_udiff_zero = _mm_cmpeq_epi16(sat_udiff, zero); 15 | 16 | *eq = _mm_cmpeq_epi16(equal, zero); 17 | *sn = _mm_andnot_si128(equal, sat_udiff_zero); 18 | 19 | return _mm_sub_epi16(vs, vt); 20 | } 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/arch/simd/rsp/vxor.h: -------------------------------------------------------------------------------- 1 | // 2 | // arch/x86_64/rsp/vxor.h 3 | // 4 | // This file is subject to the terms and conditions defined in 5 | // 'LICENSE', which is part of this source code package. 6 | // 7 | 8 | static inline __m128i rsp_vxor(__m128i vs, __m128i vt) 9 | { 10 | return _mm_xor_si128(vs, vt); 11 | } 12 | 13 | static inline __m128i rsp_vnxor(__m128i vs, __m128i vt) 14 | { 15 | __m128i vd = _mm_xor_si128(vs, vt); 16 | return _mm_xor_si128(vd, _mm_set1_epi32(0xffffffffu)); 17 | } 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/build_android_aarch64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z $ANDROID_HOME ]; then 4 | echo "Please define ANDROID_HOME environment variable to where Android SDK is installed, usually ~/Android/Sdk." 5 | exit 1 6 | fi 7 | 8 | mkdir -p build-android-aarch64 9 | cd build-android-aarch64 10 | cmake .. -DCMAKE_TOOLCHAIN_FILE="$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake" \ 11 | -DANDROID_ABI=arm64-v8a \ 12 | -DCMAKE_BUILD_TYPE=Release \ 13 | -DANDROID_PLATFORM=android-26 \ 14 | -DPARALLEL_RSP_DEBUG_JIT=OFF 15 | cmake --build . --parallel 16 | cd .. 17 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/build_native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p build-native 4 | cd build-native 5 | cmake .. -DCMAKE_BUILD_TYPE=Release -DPARALLEL_RSP_DEBUG_JIT=OFF 6 | cmake --build . --parallel 7 | cd .. 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/compare_test_results.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./build_android_aarch64.sh || exit 1 4 | cd build-android-aarch64 5 | echo "Running Android test suite ..." 6 | ctest --no-label-summary --verbose >android-aarch64.log || exit 1 7 | cd .. 8 | 9 | ./build_native.sh || exit 1 10 | cd build-native 11 | echo "Running native test suite ..." 12 | ctest --no-label-summary --verbose >native.log || exit 1 13 | cd .. 14 | 15 | echo "Comparing output ..." 16 | echo "==============================" 17 | diff -Naur build-native/native.log build-android-aarch64/android-aarch64.log 18 | echo "==============================" 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/cpu_state.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RSP_CPU_STATE_HPP 2 | #define RSP_CPU_STATE_HPP 3 | 4 | 5 | #endif -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/Makefile: -------------------------------------------------------------------------------- 1 | RSP_TEST = main 2 | 3 | PROGRAM = $(RSP_TEST) 4 | MIPS_OBJ = $(RSP_TEST).o 5 | 6 | include Makefile.mips 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/Makefile.mips: -------------------------------------------------------------------------------- 1 | #### 2 | ## Basic Makefile for RSP-MIPS 3 | ## 4 | ###### 5 | 6 | TARGET_ELF = $(PROGRAM).elf 7 | TARGET_BIN = $(PROGRAM).bin 8 | TARGET_GLOBAL_BIN = $(PROGRAM).global.bin 9 | MIPS_LD_SCRIPT = rsp-mips.ld 10 | 11 | MIPS_OBJCOPY = mipsel-linux-gnu-objcopy 12 | MIPS_CC = mipsel-linux-gnu-gcc 13 | MIPS_AS = mipsel-linux-gnu-as 14 | MIPS_LD = mipsel-linux-gnu-ld 15 | CRT_OBJ = start.o rsp-mips.o 16 | 17 | all: $(TARGET_BIN) $(TARGET_GLOBAL_BIN) 18 | 19 | crt-obj: $(CRT_OBJ) 20 | 21 | $(TARGET_BIN): $(TARGET_ELF) 22 | $(MIPS_OBJCOPY) -j .text $< $(TARGET_BIN) -O binary 23 | 24 | $(TARGET_GLOBAL_BIN): $(TARGET_ELF) 25 | $(MIPS_OBJCOPY) -j .data $< $(TARGET_GLOBAL_BIN) -O binary 26 | 27 | $(TARGET_ELF): $(MIPS_OBJ) $(CRT_OBJ) 28 | $(MIPS_LD) -T $(MIPS_LD_SCRIPT) -o $@ $(CRT_OBJ) $(MIPS_OBJ) -EB 29 | 30 | %.o: %.s 31 | $(MIPS_AS) -o $@ $< -EB -mabi=eabi -march=mips1 32 | 33 | %.o: %.c rsp-mips.h 34 | $(MIPS_CC) -c -o $@ $< -Os -EB -march=mips1 -mabi=eabi -mno-abicalls -std=gnu99 -nostdlib 35 | 36 | clean: 37 | rm -f $(MIPS_OBJ) $(CRT_OBJ) $(TARGET_ELF) $(TARGET_HEX) $(TARGET_GLOBAL_HEX) $(TARGET_BIN) $(TARGET_GLOBAL_BIN) 38 | 39 | .PHONY: all clean tools 40 | 41 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/add.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 40 5 | li $t1, -20 6 | add $t2, $t0, $t1 7 | addu $t3, $t0, $t1 8 | 9 | li $t0, -5 10 | li $t1, -4 11 | add $t2, $t0, $t1 12 | addu $t3, $t0, $t1 13 | break 14 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/addi.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 17 5 | addi $t0, $a0, -8 6 | addi $t1, $a0, 8 7 | addiu $t2, $a0, -8 8 | addiu $t3, $a0, 8 9 | break 10 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/and.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 17 5 | li $t1, 5 6 | and $t2, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/andi.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, -1 5 | andi $t0, $a0, 50000 6 | break 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/beq-impossible-delay-slot-both-taken.s: -------------------------------------------------------------------------------- 1 | # This works on the Lightning JIT, but hangs the reference. 2 | 3 | .text 4 | .set noreorder 5 | .global main 6 | main: 7 | li $t0, 1 8 | li $t1, 1 9 | li $t2, 2 10 | li $t3, 0 11 | beq $t0, $t1, taken0 # This will be taken. 12 | beq $t0, $t1, taken1 # This will also be taken. 13 | li $t3, 3 # This will not be executed. 14 | 15 | taken0: 16 | li $t6, 5 # This will be executed, the second branch then kicks in and runs taken1 path. 17 | break 18 | taken1: 19 | li $t4, 4 # This will be executed. 20 | break 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/beq-impossible-delay-slot-first-taken.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | li $t1, 1 7 | li $t2, 2 8 | li $t3, 0 9 | beq $t0, $t1, taken0 # This will be taken. 10 | beq $t0, $t2, taken1 # Will not be taken. 11 | li $t3, 3 12 | 13 | taken0: 14 | li $t4, 5 15 | break 16 | taken1: 17 | li $t4, 4 18 | break 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/beq-impossible-delay-slot-second-taken.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | li $t1, 1 7 | li $t2, 2 8 | li $t3, 0 9 | beq $t0, $t2, taken0 # This will not be taken, should be ignored. 10 | beq $t0, $t1, taken1 # This will be taken. 11 | li $t3, 3 12 | 13 | taken0: 14 | li $t4, 5 15 | break 16 | taken1: 17 | li $t4, 4 18 | break 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bgez.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, -1 6 | bgez $t0, taken1 # This will not be taken. 7 | li $t2, 10 8 | 9 | li $t0, 0 10 | bgez $t0, taken1 # This will be taken. 11 | li $t2, 20 12 | 13 | li $t0, 1 14 | bgez $t0, taken1 # This will be taken. 15 | li $t2, 30 16 | 17 | taken0: 18 | li $t4, 5 19 | break 20 | taken1: 21 | li $t4, 4 22 | break 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bgezal.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, -1 6 | bgezal $t0, taken1 # This will not be taken. 7 | li $t2, 10 8 | 9 | li $t0, 0 10 | bgezal $t0, taken1 # This will be taken. 11 | li $t2, 20 12 | 13 | li $t0, 1 14 | bgezal $t0, taken1 # This will be taken. 15 | li $t2, 30 16 | 17 | taken0: 18 | li $t4, 5 19 | break 20 | taken1: 21 | li $t4, 4 22 | break 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bgtz.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, -1 6 | bgtz $t0, taken1 # This will not be taken. 7 | li $t2, 10 8 | 9 | li $t0, 0 10 | bgtz $t0, taken1 # This will not be taken. 11 | li $t2, 20 12 | 13 | li $t0, 1 14 | bgtz $t0, taken1 # This will be taken. 15 | li $t2, 30 16 | 17 | taken0: 18 | li $t4, 5 19 | break 20 | taken1: 21 | li $t4, 4 22 | break 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/blez.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | blez $t0, taken1 # This will not be taken. 7 | li $t2, 10 8 | 9 | li $t0, 0 10 | blez $t0, taken1 # This will be taken. 11 | li $t2, 20 12 | 13 | li $t0, 0 14 | blez $t0, taken1 # This will be taken. 15 | li $t2, 30 16 | 17 | taken0: 18 | li $t4, 5 19 | break 20 | taken1: 21 | li $t4, 4 22 | break 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bltz.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | bltz $t0, taken1 # This will not be taken. 7 | li $t2, 10 8 | 9 | li $t0, 0 10 | bltz $t0, taken1 # This will not be taken. 11 | li $t2, 20 12 | 13 | li $t0, -1 14 | bltz $t0, taken1 # This will be taken. 15 | li $t2, 30 16 | 17 | taken0: 18 | li $t4, 5 19 | break 20 | taken1: 21 | li $t4, 4 22 | break 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bltzal.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | bltzal $t0, taken1 # This will not be taken. 7 | li $t2, 10 8 | 9 | li $t0, 0 10 | bltzal $t0, taken1 # This will not be taken. 11 | li $t2, 20 12 | 13 | li $t0, -1 14 | bltzal $t0, taken1 # This will be taken. 15 | li $t2, 30 16 | 17 | taken0: 18 | li $t4, 5 19 | break 20 | taken1: 21 | li $t4, 4 22 | break 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bne.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | li $t1, 1 7 | li $t2, 2 8 | li $t3, 0 9 | bne $t0, $t1, taken0 # This will not be taken. 10 | nop 11 | 12 | bne $t0, $t2, taken1 # Will be taken. 13 | li $t3, 3 14 | 15 | taken0: 16 | li $t4, 5 17 | break 18 | taken1: 19 | li $t4, 4 20 | break 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/bug-shl-into-branch.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t1, ((0x50000000) << 5) & 0xffffffff 5 | li $t0, 0x50000000 6 | sll $t0, $t0, 5 7 | bne $t0, $t1, error 8 | nop 9 | 10 | li $t2, 1 11 | break 12 | 13 | error: 14 | li $t2, 2 15 | break 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/cop0.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 100 6 | mtc0 $t0, $1 7 | bgez $t0, bar 8 | mfc0 $t1, $1 9 | li $t1, 200 # Should not execute. 10 | break 11 | 12 | bar: 13 | li $t2, 400 14 | break 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/cop2-basic.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 10 6 | li $t2, 10 7 | nop 8 | .word (0x12 << 26) | (4 << 21) | (2 << 11) | (8 << 16) | (4 << 7) 9 | .word (0x12 << 26) | (0 << 21) | (2 << 11) | (9 << 16) | (4 << 7) 10 | #mtc2 $t0, $2, 4 11 | #mfc2 $t1, $2, 4 12 | 13 | ctc2 $t2, $2 14 | cfc2 $t3, $2 15 | 16 | break 17 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/cop2-ls.s: -------------------------------------------------------------------------------- 1 | .data 2 | buffer: 3 | .hword 10, 20, 30, 40, 50, 60, 70, 80 4 | .hword 20, 30, 40, 50, 60, 70, 80, 90 5 | 6 | .text 7 | .set noreorder 8 | .global main 9 | main: 10 | la $t0, buffer 11 | # lqv 2, 0, 1(t0) 12 | .word (0x32 << 26) | (4 << 11) | (2 << 16) | (0 << 7) | (1 << 0) | (8 << 21) 13 | # sqv 2, 0, 2(t0) 14 | .word (0x3a << 26) | (4 << 11) | (2 << 16) | (0 << 7) | (2 << 0) | (8 << 21) 15 | break 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/cop2-vector.s: -------------------------------------------------------------------------------- 1 | .data 2 | buffer: 3 | .hword 10, 20, 30, 40, 50, 60, 70, 80 4 | .hword 20, 30, 40, 50, 60, 70, 80, 90 5 | 6 | .text 7 | .set noreorder 8 | .global main 9 | main: 10 | la $t0, buffer 11 | # lqv 2, 0, 0(t0) 12 | .word (0x32 << 26) | (4 << 11) | (2 << 16) | (0 << 7) | (0 << 0) | (8 << 21) 13 | # lqv 3, 0, 1(t0) 14 | .word (0x32 << 26) | (4 << 11) | (3 << 16) | (0 << 7) | (1 << 0) | (8 << 21) 15 | 16 | .word (0x25 << 25) | (4 << 6) | (2 << 11) | (3 << 16) | (17 << 0) | (0 << 21) 17 | # vsub v4, v2, v3, 0 18 | break 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/delay-slot-before-break.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | blez $t0, foo 7 | break 8 | 9 | nop 10 | nop 11 | nop 12 | nop 13 | 14 | foo: 15 | break 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/delay-slot-before-new-block-illegal.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | .align 10 5 | main: 6 | li $t0, 1 7 | .rept 126 8 | nop 9 | .endr 10 | bgtz $t0, foobar 11 | # New block begins here, 12 | j foobar2 13 | li $t2, 2 # This should not execute 14 | 15 | foobar: 16 | li $t3, 3 # This should execute, then we move to foobar2 17 | break 18 | 19 | foobar2: 20 | li $t4, 4 # This executes. 21 | break 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/delay-slot-before-new-block-not-taken.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | .align 10 5 | main: 6 | li $t0, 0 7 | .rept 126 8 | nop 9 | .endr 10 | bgtz $t0, foobar 11 | # New block begins here, 12 | # last instruction will be bgtz which needs to promote its delay slot 13 | # into a new block. 14 | # First instruction of any block have to handle potential latent delay slots like these. 15 | li $t1, 1 16 | li $t2, 2 # This should execute 17 | 18 | foobar: 19 | break 20 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/delay-slot-before-new-block.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | .align 10 5 | main: 6 | li $t0, 1 7 | .rept 126 8 | nop 9 | .endr 10 | bgtz $t0, foobar 11 | # New block begins here, 12 | # last instruction will be bgtz which needs to promote its delay slot 13 | # into a new block. 14 | # First instruction of any block have to handle potential latent delay slots like these. 15 | li $t1, 1 16 | li $t2, 2 # This should not execute 17 | 18 | foobar: 19 | break 20 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/j.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | j indelay 6 | nop 7 | 8 | j die # Test to make sure this becomes a conditional branch. 9 | 10 | indelay: 11 | j notdie 12 | li $t0, 1 13 | 14 | die: 15 | li $t0, 0x10000 16 | 17 | notdie: 18 | li $t1, 2 19 | break 20 | 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/jal-into-indirect-delay-slot.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | li $t0, 1 6 | bgtz $0, dummy 7 | jal callsite 8 | li $t5, 10 9 | 10 | jr $s5 11 | callsite: 12 | lw $t2, 184($0) 13 | li $t1, 10 14 | break 15 | 16 | dummy: 17 | nop 18 | break 19 | 20 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/jal.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | jal indelay 6 | nop 7 | 8 | jal die # Test to make sure this becomes a conditional branch. 9 | 10 | indelay: 11 | jal notdie 12 | move $t2, $ra 13 | li $t0, 1 14 | 15 | die: 16 | li $t0, 0x10000 17 | 18 | notdie: 19 | li $t1, 2 20 | break 21 | 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/jalr.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | la $t5, notdie 6 | la $ra, indelay 7 | jalr $a0, $ra 8 | move $ra, $a0 9 | 10 | j die # Test to make sure this becomes a conditional branch. 11 | 12 | indelay: 13 | jalr $a0, $t5 14 | move $t0, $a0 15 | 16 | die: 17 | li $t0, 0x10000 18 | 19 | notdie: 20 | li $t1, 2 21 | break 22 | 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/jr.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | la $t5, notdie 6 | la $ra, indelay 7 | jr $ra 8 | nop 9 | 10 | j die # Test to make sure this becomes a conditional branch. 11 | 12 | indelay: 13 | jr $t5 14 | li $t0, 1 15 | 16 | die: 17 | li $t0, 0x10000 18 | 19 | notdie: 20 | li $t1, 2 21 | break 22 | 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lb.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0 3 | foobar: 4 | .byte 0x72, 0x91 5 | 6 | .text 7 | .global main 8 | main: 9 | la $t1, foobar 10 | lb $t0, 1($t1) 11 | break 12 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lbu.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0 3 | foobar: 4 | .byte 0x72, 0x91 5 | 6 | .text 7 | .global main 8 | main: 9 | la $t1, foobar 10 | lbu $t0, 1($t1) 11 | break 12 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lh-unaligned.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0, 0 3 | foobar: 4 | .byte 0 5 | .byte 0x92, 0x70 6 | 7 | .text 8 | .global main 9 | main: 10 | la $t1, foobar 11 | lh $t0, 1($t1) 12 | break 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lh.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0, 0 3 | foobar: 4 | .byte 0x92, 0x70 5 | 6 | .text 7 | .global main 8 | main: 9 | la $t1, foobar 10 | lh $t0, 0($t1) 11 | break 12 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lhu-unaligned.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0, 0 3 | foobar: 4 | .byte 0 5 | .byte 0x92, 0x70 6 | 7 | .text 8 | .global main 9 | main: 10 | la $t1, foobar 11 | lhu $t0, 1($t1) 12 | break 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lhu.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0, 0 3 | foobar: 4 | .byte 0x92, 0x70 5 | 6 | .text 7 | .global main 8 | main: 9 | la $t1, foobar 10 | lhu $t0, 0($t1) 11 | break 12 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lui.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | lui $t0, 50000 5 | break 6 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lw-unaligned-in-branch-delay.s: -------------------------------------------------------------------------------- 1 | .data 2 | foo: 3 | .byte 0 4 | .byte 0xaa, 0xbb, 0xcc, 0xdd 5 | 6 | .text 7 | .set noreorder 8 | .global main 9 | main: 10 | li $t0, 1 11 | la $t1, foo 12 | bgtz $t0, taken1 13 | lw $t1, 1($t1) 14 | 15 | taken0: 16 | li $t5, 100 17 | break 18 | 19 | taken1: 20 | break 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lw-unaligned.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0, 0 3 | foobar: 4 | .word 12345678 5 | .word 30 6 | 7 | .text 8 | .global main 9 | main: 10 | la $t1, foobar 11 | lw $t0, 0($t1) 12 | lw $t1, 1($t1) 13 | lw $t2, 2($t1) 14 | lw $t3, 3($t1) 15 | break 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/lw.s: -------------------------------------------------------------------------------- 1 | .data 2 | .byte 0, 0, 0, 0 3 | foobar: 4 | .word 12345678 5 | .word 30 6 | 7 | .text 8 | .global main 9 | main: 10 | la $t1, foobar 11 | lw $t0, 4($t1) 12 | break 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/main.c: -------------------------------------------------------------------------------- 1 | #include "rsp-mips.h" 2 | 3 | u8 data[4] = { 0x10, 0x20, 0x30, 0x40 }; 4 | 5 | __attribute__((noinline)) 6 | int load_byte(int i) 7 | { 8 | return data[i]; 9 | } 10 | 11 | int count = 3; 12 | 13 | int main(void) 14 | { 15 | int res = 0; 16 | for (int i = 0; i < 3; i++) 17 | { 18 | res += load_byte(i); 19 | } 20 | rsp_debug_break(res, res, res, res); 21 | } 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/nor.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 17 5 | li $t1, 5 6 | nor $t2, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/or.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 8 5 | li $t1, 50 6 | or $t2, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/ori.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 500 5 | ori $t0, $a0, 50000 6 | break 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/rsp-mips.h: -------------------------------------------------------------------------------- 1 | #ifndef __RSP_MIPS_H 2 | #define __RSP_MIPS_H 3 | 4 | typedef signed char s8; 5 | typedef unsigned char u8; 6 | typedef signed short s16; 7 | typedef unsigned short u16; 8 | typedef signed int s32; 9 | typedef unsigned int u32; 10 | typedef signed long long s64; 11 | typedef unsigned long long u64; 12 | typedef u32 size_t; 13 | 14 | void rsp_break(void); 15 | void rsp_debug_break(u32 a, u32 b, u32 c, u32 d); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/rsp-mips.ld: -------------------------------------------------------------------------------- 1 | SECTIONS { 2 | ENTRY(rsp_mips_start) 3 | . = 0x00400000; 4 | .text : { start.o (.text); * (.text*); } 5 | 6 | . = 0x00700000; 7 | .data : { * (.data); * (.rodata*); * (.sbss); * (.scommon); } 8 | .bss : { * (.bss); } 9 | } 10 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/rsp-mips.s: -------------------------------------------------------------------------------- 1 | .text 2 | .section .text 3 | 4 | .global rsp_break 5 | .ent rsp_break 6 | .type rsp_break, @function 7 | rsp_break: 8 | break 9 | jr $ra 10 | .end rsp_break 11 | .size rsp_break, .-rsp_break 12 | 13 | .global rsp_debug_break 14 | .ent rsp_debug_break 15 | .type rsp_debug_break, @function 16 | rsp_debug_break: 17 | break 18 | jr $ra 19 | .end rsp_debug_break 20 | .size rsp_debug_break, .-rsp_debug_break 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sb.s: -------------------------------------------------------------------------------- 1 | .data 2 | foobar: 3 | .word 0 4 | .word 0 5 | .word 0 6 | .word 0 7 | .word 0 8 | .word 0 9 | .word 0 10 | .word 0 11 | 12 | .text 13 | .global main 14 | main: 15 | li $t0, 0xaabbccdd 16 | la $t1, foobar 17 | sb $t0, 0($t1) 18 | sb $t0, 1($t1) 19 | sb $t0, 3($t1) 20 | break 21 | 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sh-unaligned.s: -------------------------------------------------------------------------------- 1 | .data 2 | foobar: 3 | .word 0 4 | .word 0 5 | .word 0 6 | .word 0 7 | .word 0 8 | .word 0 9 | .word 0 10 | .word 0 11 | 12 | .text 13 | .global main 14 | main: 15 | li $t0, 0xaabbccdd 16 | la $t1, foobar 17 | sh $t0, 0($t1) 18 | sh $t0, 3($t1) 19 | break 20 | 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sh.s: -------------------------------------------------------------------------------- 1 | .data 2 | foobar: 3 | .word 0 4 | .word 0 5 | .word 0 6 | .word 0 7 | .word 0 8 | .word 0 9 | .word 0 10 | .word 0 11 | 12 | .text 13 | .global main 14 | main: 15 | li $t0, 0xaabbccdd 16 | la $t1, foobar 17 | sh $t0, 0($t1) 18 | sh $t0, 2($t1) 19 | sh $t0, 6($t1) 20 | break 21 | 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sll.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 40 5 | sll $t0, $t0, 20 6 | break 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sllv.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 40 5 | li $t1, 20 6 | sllv $t0, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/slt.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 17 5 | li $a1, 5 6 | li $a2, -17 7 | li $a3, -5 8 | slt $t0, $a0, $a1 9 | slt $t1, $a3, $a0 10 | slt $t2, $a2, $a3 11 | slt $t3, $a2, $a1 12 | break 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/slti.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 100000 5 | li $a1, -100000 6 | slti $t0, $a0, -40 7 | slti $t1, $a0, 40 8 | slti $t2, $a1, -40 9 | slti $t3, $a1, 40 10 | break 11 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sltiu.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 100000 5 | li $a1, -100000 6 | sltiu $t0, $a0, -40 7 | sltiu $t1, $a0, 40 8 | sltiu $t2, $a1, -40 9 | sltiu $t3, $a1, 40 10 | break 11 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sltu.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 17 5 | li $a1, 5 6 | li $a2, -17 7 | li $a3, -5 8 | sltu $t0, $a0, $a1 9 | sltu $t1, $a3, $a0 10 | sltu $t2, $a2, $a3 11 | sltu $t3, $a2, $a1 12 | break 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sra.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, -15254 5 | sra $t0, $t0, 20 6 | break 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/srav.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, -15254 5 | li $t1, 20 6 | srav $t0, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/srl.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, -15254 5 | srl $t0, $t0, 20 6 | break 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/srlv.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, -15254 5 | li $t1, 20 6 | srlv $t0, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/start.s: -------------------------------------------------------------------------------- 1 | ### 2 | ## 3 | # Entry point and setup for our RSP 4 | ## 5 | 6 | .equ RAM_SIZE, 4096 7 | 8 | .text 9 | .align 2 10 | .section .text 11 | .global rsp_mips_start 12 | .extern main 13 | .ent rsp_mips_start 14 | .type rsp_mips_start, @function 15 | 16 | rsp_mips_start: 17 | nop 18 | redo: 19 | li $a0, 0 # argc = 0, it will never be used anyways on this stuff. :D 20 | li $a1, 0 # argv = 0 21 | li $sp, (0x00700000 + RAM_SIZE - 4) # Set up stack. 22 | 23 | jal main 24 | j redo 25 | 26 | .end rsp_mips_start 27 | .size rsp_mips_start, .-rsp_mips_start 28 | 29 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sub.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 40 5 | li $t1, -20 6 | sub $t2, $t0, $t1 7 | subu $t3, $t0, $t1 8 | 9 | li $t0, -5 10 | li $t1, -4 11 | sub $t2, $t0, $t1 12 | subu $t3, $t0, $t1 13 | 14 | break 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sw-unaligned.s: -------------------------------------------------------------------------------- 1 | .data 2 | foobar: 3 | .word 0 4 | .word 0 5 | .word 0 6 | .word 0 7 | .word 0 8 | .word 0 9 | .word 0 10 | .word 0 11 | 12 | .text 13 | .global main 14 | main: 15 | li $t0, 0xaabbccdd 16 | la $t1, foobar 17 | sw $t0, 0($t1) 18 | sw $t0, 5($t1) 19 | sw $t0, 10($t1) 20 | sw $t0, 15($t1) 21 | break 22 | 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/sw.s: -------------------------------------------------------------------------------- 1 | .data 2 | foobar: 3 | .word 0 4 | .word 0 5 | .word 0 6 | .word 0 7 | .word 0 8 | .word 0 9 | .word 0 10 | .word 0 11 | 12 | .text 13 | .global main 14 | main: 15 | li $t0, 0xaabbccdd 16 | la $t1, foobar 17 | sw $t0, 0($t1) 18 | sw $t0, 4($t1) 19 | sw $t0, 12($t1) 20 | break 21 | 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/unconditional-delay-slot-before-break.s: -------------------------------------------------------------------------------- 1 | .text 2 | .set noreorder 3 | .global main 4 | main: 5 | jal foo 6 | break 7 | 8 | nop 9 | nop 10 | nop 11 | nop 12 | 13 | foo: 14 | break 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/xor.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $t0, 17 5 | li $t1, 5 6 | xor $t2, $t0, $t1 7 | break 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug-toolchain/xori.s: -------------------------------------------------------------------------------- 1 | .text 2 | .global main 3 | main: 4 | li $a0, 500 5 | xori $t0, $a0, 50000 6 | break 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/debug_jit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEBUG_JIT_HPP__ 2 | #define DEBUG_JIT_HPP__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace JIT 10 | { 11 | using Func = void (*)(void *, void *); 12 | class DebugBlock 13 | { 14 | public: 15 | DebugBlock(const std::unordered_map &symbol_table); 16 | ~DebugBlock(); 17 | 18 | bool compile(uint64_t hash, const std::string &source); 19 | Func get_func() const 20 | { 21 | return block; 22 | } 23 | 24 | private: 25 | struct Impl; 26 | std::unique_ptr impl; 27 | Func block = nullptr; 28 | }; 29 | } // namespace JIT 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/format_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for file in arch/*/*/*.{cpp,h} *.{cpp,hpp,h} rsp/*.{cpp,h} 4 | do 5 | echo "Formatting file: $file ..." 6 | clang-format -style=file -i $file 7 | done 8 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/jit_allocator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace RSP 7 | { 8 | namespace JIT 9 | { 10 | class Allocator 11 | { 12 | public: 13 | Allocator() = default; 14 | ~Allocator(); 15 | void operator=(const Allocator &) = delete; 16 | Allocator(const Allocator &) = delete; 17 | 18 | void *allocate_code(size_t size); 19 | static bool commit_code(void *code, size_t size); 20 | 21 | private: 22 | struct Block 23 | { 24 | uint8_t *code = nullptr; 25 | size_t size = 0; 26 | size_t offset = 0; 27 | }; 28 | std::vector blocks; 29 | 30 | static Block reserve_block(size_t size); 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/.gitattributes: -------------------------------------------------------------------------------- 1 | ChangeLog merge=merge-changelog 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/.gitignore: -------------------------------------------------------------------------------- 1 | +* 2 | autom4te.cache 3 | aclocal.m4 4 | depcomp 5 | INSTALL 6 | Makefile 7 | Makefile.in 8 | config.guess 9 | config.h 10 | config.h.in 11 | config.log 12 | config.status 13 | config.sub 14 | configure 15 | install-sh 16 | libtool 17 | lightning-*.tar.* 18 | ltmain.sh 19 | missing 20 | size 21 | stamp-h1 22 | test-driver 23 | check/.deps 24 | doc/.deps 25 | lib/.deps 26 | m4/libtool.m4 27 | m4/lt~obsolete.m4 28 | m4/ltoptions.m4 29 | m4/ltsugar.m4 30 | m4/ltversion.m4 31 | doc/mdate-sh 32 | doc/texinfo.tex 33 | lightning.pc 34 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://git.savannah.gnu.org/git/lightning.git 8 | branch = master 9 | commit = b0b8eb5e856c0d29053dc842e1919a2eb58c8cda 10 | parent = 9f797430963d9cf0fcef7d963466f9cac7026de2 11 | method = merge 12 | cmdver = 0.4.1 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/AUTHORS: -------------------------------------------------------------------------------- 1 | Paulo Cesar Pereira de Andrade 2 | 3 | Paolo Bonzini 4 | 5 | PPC assembler by Ian Piumarta 6 | 7 | i386 assembler by Ian Piumarta 8 | and Gwenole Beauchesne 9 | 10 | x86-64 backend by Matthew Flatt 11 | 12 | Major PPC contributions by Laurent Michel 13 | 14 | Major SPARC contributions by Ludovic Courtes 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/src/mupen64plus-rsp-paraLLEl/lightning/ChangeLog -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2000, 2001, 2002, 2012-2019 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU lightning. 5 | # 6 | # GNU lightning is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as published 8 | # by the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU lightning is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | # License for more details. 15 | # 16 | 17 | ACLOCAL_AMFLAGS = -I m4 18 | 19 | SUBDIRS = \ 20 | check \ 21 | doc \ 22 | include \ 23 | lib 24 | 25 | pkgconfiglibdir = $(libdir)/pkgconfig 26 | pkgconfiglib_DATA = lightning.pc 27 | 28 | if get_jit_size 29 | JIT_SIZE_PATH = "$(top_builddir)/jit_$(cpu)-sz.c" 30 | AM_CPPFLAGS=-DGET_JIT_SIZE=1 -DJIT_SIZE_PATH='$(JIT_SIZE_PATH)' 31 | AM_CFLAGS = -I$(top_srcdir)/include -D_GNU_SOURCE $(LIGHTNING_CFLAGS) 32 | 33 | noinst_PROGRAMS = size 34 | size_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 35 | size_SOURCES = size.c 36 | 37 | get_jit_size:: $(JIT_SIZE_PATH) 38 | 39 | $(JIT_SIZE_PATH): 40 | make clean 41 | make check 42 | $(top_builddir)/size 43 | 44 | CLEANFILES = $(JIT_SIZE_PATH) 45 | endif 46 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/README: -------------------------------------------------------------------------------- 1 | GNU lightning is a library to aid in making portable programs 2 | that compile assembly code at run time. For more information, 3 | look at the info documentation. 4 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/THANKS: -------------------------------------------------------------------------------- 1 | Thanks to all the following people for their help in 2 | improving GNU lightning: 3 | 4 | Paolo Bonzini 5 | Eli Barzilay 6 | Ludovic Courtes 7 | Matthew Flatt 8 | Laurent Michel 9 | Paulo Cesar Pereira de Andrade 10 | Mike Spivey 11 | Basile Starynkevitch 12 | Sam Steingold 13 | Jens Troeger 14 | Tom Tromey 15 | Trent Nelson 16 | Vitaly Magerya 17 | Brandon Invergo 18 | Holger Hans Peter Freyther 19 | Jon Arintok 20 | Bruno Haible 21 | Marc Nieper-Wißkirchen 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/TODO: -------------------------------------------------------------------------------- 1 | * Validate that divrem in jit_x86-cpu.c is not modifying 2 | the non result arguments. This is not verified by clobber.tst, 3 | as it only checks registers not involved in the operation 4 | (because it does not know about values being set as input 5 | for the the operation). 6 | 7 | * Write a simple higher level language implementation generating 8 | jit with lightning, that could be some lisp or C like language. 9 | 10 | * rerun ./configure --enable-devel-get-jit-size and regenerate 11 | the related jit_$arch-sz.c for the ports where nodata is 12 | meaningful: 13 | hppa (done) 14 | i586 (done) 15 | ia64 16 | mips o32 (done) 17 | mips n32 18 | mips n64 19 | powerpc 32 (done) 20 | powerpc 64 (done) 21 | ppc 22 | s390x (done) 23 | sparc (done) 24 | x86_64 (done) 25 | Missing ones are due to no longer (remote) access to such hosts 26 | and may be broken with jit_set_data(..., JIT_DISABLE_DATA). 27 | (ia64 hp-ux or linx), (irix mips for 32 or 64 abi), and 28 | (darwin ppc). 29 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/3to2.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 1 4 | 1 5 | 0 6 | 1 7 | 1 8 | 1 9 | 0 10 | 1 11 | 1 12 | 0 13 | 1 14 | 1 15 | 1 16 | 0 17 | 1 18 | 1 19 | 1 20 | 0 21 | 1 22 | 1 23 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/add.ok: -------------------------------------------------------------------------------- 1 | 5 + 4 = 9 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/add.tst: -------------------------------------------------------------------------------- 1 | .data 32 2 | fmt: 3 | .c "%d + %d = %d\n" 4 | 5 | .code 6 | jmpi main 7 | 8 | name test 9 | test: 10 | prolog 11 | arg $i0 12 | arg $i1 13 | getarg %r0 $i0 14 | getarg %r1 $i1 15 | addr %r0 %r0 %r1 16 | retr %r0 17 | epilog 18 | 19 | name main 20 | main: 21 | prolog 22 | prepare 23 | pushargi 5 24 | pushargi 4 25 | finishi test 26 | retval %r0 27 | prepare 28 | pushargi fmt 29 | ellipsis 30 | pushargi 5 31 | pushargi 4 32 | pushargr %r0 33 | finishi @printf 34 | ret 35 | epilog 36 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/align.ok: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/align.tst: -------------------------------------------------------------------------------- 1 | .data 32 2 | fmt: 3 | .c "%d\n" 4 | .code 5 | prolog 6 | movi %r0 1 7 | jmpi L1 /* should not generate this */ 8 | align $(__WORDSIZE / 8) /* possible nops */ 9 | L1: 10 | bgei L4 %r0 10 11 | addi %r0 %r0 1 12 | jmpi L2 13 | movr %r1 %r0 /* to force jump generation */ 14 | align $(__WORDSIZE / 8) /* possible nops */ 15 | L2: 16 | bgti L4 %r0 10 /* never executed */ 17 | align $(__WORDSIZE / 8) /* possible nops */ 18 | L3: 19 | jmpi L1 20 | align $(__WORDSIZE / 8) /* possible nops */ 21 | L4: 22 | prepare 23 | pushargi fmt 24 | ellipsis 25 | pushargr %r0 26 | finishi @printf 27 | ret 28 | epilog 29 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/allocai.ok: -------------------------------------------------------------------------------- 1 | received 7777 2 | succeeded 3 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/allocar.ok: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 3 4 5 3 | 5 6 7 4 | 7 8 9 5 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_add.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_and.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_and.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define AND(N, I0, I1, V) ALU(N, , and, I0, I1, V) 7 | 8 | AND(0, 0x7fffffff, 1, 1) 9 | AND(1, 1, 0x7fffffff, 1) 10 | AND(2, 0x80000000, 1, 0) 11 | AND(3, 1, 0x80000000, 0) 12 | AND(4, 0x7fffffff, 0x80000000, 0) 13 | AND(5, 0x80000000, 0x7fffffff, 0) 14 | AND(6, 0x7fffffff, 0xffffffff, 0x7fffffff) 15 | AND(7, 0xffffffff, 0x7fffffff, 0x7fffffff) 16 | AND(8, 0xffffffff, 0xffffffff, 0xffffffff) 17 | AND(9, 0x7fffffff, 0, 0) 18 | AND(10, 0, 0x7fffffff, 0) 19 | #if __WORDSIZE == 64 20 | AND(11, 0x7fffffffffffffff, 1, 1) 21 | AND(12, 1, 0x7fffffffffffffff, 1) 22 | AND(13, 0x8000000000000000, 1, 0) 23 | AND(14, 1, 0x8000000000000000, 0) 24 | AND(15, 0x7fffffffffffffff, 0x8000000000000000, 0) 25 | AND(16, 0x8000000000000000, 0x7fffffffffffffff, 0) 26 | AND(17, 0x7fffffffffffffff, 0xffffffffffffffff, 0x7fffffffffffffff) 27 | AND(18, 0xffffffffffffffff, 0x7fffffffffffffff, 0x7fffffffffffffff) 28 | AND(19, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff) 29 | #endif 30 | 31 | prepare 32 | pushargi ok 33 | ellipsis 34 | finishi @printf 35 | ret 36 | epilog 37 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_com.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_com.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define COM(N, I0, V) UN(N, com, I0, V) 7 | 8 | #if __WORDSIZE == 32 9 | COM(0, 0, 0xffffffff) 10 | COM(1, 1, 0xfffffffe) 11 | COM(2, 0xffffffff, 0) 12 | COM(3, 0x80000000, 0x7fffffff) 13 | COM(4, 0x7fffffff, 0x80000000) 14 | COM(5, 0x80000001, 0x7ffffffe) 15 | #else 16 | COM(0, 0, 0xffffffffffffffff) 17 | COM(1, 1, 0xfffffffffffffffe) 18 | COM(2, 0xffffffff, 0xffffffff00000000) 19 | COM(3, 0x80000000, 0xffffffff7fffffff) 20 | COM(4, 0x7fffffff, 0xffffffff80000000) 21 | COM(5, 0x80000001, 0xffffffff7ffffffe) 22 | COM(6, 0xffffffffffffffff, 0) 23 | COM(7, 0x8000000000000000, 0x7fffffffffffffff) 24 | COM(8, 0x7fffffffffffffff, 0x8000000000000000) 25 | COM(9, 0x8000000000000001, 0x7ffffffffffffffe) 26 | #endif 27 | 28 | prepare 29 | pushargi ok 30 | ellipsis 31 | finishi @printf 32 | ret 33 | epilog 34 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_div.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_lsh.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_mul.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_neg.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_neg.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define NEG(N, I, V) UN(N, neg, I, V) 7 | 8 | NEG(0, 0, 0) 9 | #if __WORDSIZE == 32 10 | NEG(1, 1, 0xffffffff) 11 | NEG(2, 0xffffffff, 1) 12 | NEG(3, 0x80000000, 0x80000000) 13 | NEG(4, 0x7fffffff, 0x80000001) 14 | NEG(5, 0x80000001, 0x7fffffff) 15 | #else 16 | NEG(1, 1, 0xffffffffffffffff) 17 | NEG(2, 0xffffffff, 0xffffffff00000001) 18 | NEG(3, 0x80000000, 0xffffffff80000000) 19 | NEG(4, 0x7fffffff, 0xffffffff80000001) 20 | NEG(5, 0x80000001, 0xffffffff7fffffff) 21 | NEG(6, 0xffffffffffffffff, 1) 22 | NEG(7, 0x8000000000000000, 0x8000000000000000) 23 | NEG(8, 0x7fffffffffffffff, 0x8000000000000001) 24 | #endif 25 | 26 | #undef NEG 27 | #define NEG(N, T, I, V) FUN(N, T, neg, I, V) 28 | NEG(0, _f, 0.0, -0.0) 29 | NEG(1, _f, 0.5, -0.5) 30 | NEG(2, _f, $(1 / 0.0), $(-1.0 / 0)) 31 | NEG(3, _f, -1.25, 1.25) 32 | NEG(0, _d, 0.0, -0.0) 33 | NEG(1, _d, 0.5, -0.5) 34 | NEG(2, _d, $(1.0 / 0), $(-1 / 0.0)) 35 | NEG(3, _d, -1.25, 1.25) 36 | 37 | prepare 38 | pushargi ok 39 | ellipsis 40 | finishi @printf 41 | ret 42 | epilog 43 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_or.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_or.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define OR(N, I0, I1, V) ALU(N, , or, I0, I1, V) 7 | 8 | OR(0, 0x7fffffff, 1, 0x7fffffff) 9 | OR(1, 1, 0x7fffffff, 0x7fffffff) 10 | OR(2, 0x80000000, 1, 0x80000001) 11 | OR(3, 1, 0x80000000, 0x80000001) 12 | OR(4, 0x7fffffff, 0x80000000, 0xffffffff) 13 | OR(5, 0x80000000, 0x7fffffff, 0xffffffff) 14 | OR(6, 0x7fffffff, 0xffffffff, 0xffffffff) 15 | OR(7, 0xffffffff, 0x7fffffff, 0xffffffff) 16 | OR(8, 0xffffffff, 0xffffffff, 0xffffffff) 17 | OR(9, 0x7fffffff, 0, 0x7fffffff) 18 | OR(10, 0, 0x7fffffff, 0x7fffffff) 19 | #if __WORDSIZE == 64 20 | OR(11, 0x7fffffffffffffff, 1, 0x7fffffffffffffff) 21 | OR(12, 1, 0x7fffffffffffffff, 0x7fffffffffffffff) 22 | OR(13, 0x8000000000000000, 1, 0x8000000000000001) 23 | OR(14, 1, 0x8000000000000000, 0x8000000000000001) 24 | OR(15, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff) 25 | OR(16, 0x8000000000000000, 0x7fffffffffffffff, 0xffffffffffffffff) 26 | OR(17, 0x7fffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff) 27 | OR(18, 0xffffffffffffffff, 0x7fffffffffffffff, 0xffffffffffffffff) 28 | OR(19, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff) 29 | #endif 30 | 31 | prepare 32 | pushargi ok 33 | ellipsis 34 | finishi @printf 35 | ret 36 | epilog 37 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_rem.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_rsb.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_rsh.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_sub.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_xor.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alu_xor.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define XOR(N, I0, I1, V) ALU(N, , xor, I0, I1, V) 7 | 8 | XOR(0, 0x7fffffff, 1, 0x7ffffffe) 9 | XOR(1, 1, 0x7fffffff, 0x7ffffffe) 10 | XOR(2, 0x80000000, 1, 0x80000001) 11 | XOR(3, 1, 0x80000000, 0x80000001) 12 | XOR(4, 0x7fffffff, 0x80000000, 0xffffffff) 13 | XOR(5, 0x80000000, 0x7fffffff, 0xffffffff) 14 | XOR(6, 0x7fffffff, 0xffffffff, 0x80000000) 15 | XOR(7, 0xffffffff, 0x7fffffff, 0x80000000) 16 | XOR(9, 0xffffffff, 0xffffffff, 0) 17 | XOR(10, 0x7fffffff, 0, 0x7fffffff) 18 | XOR(11, 0, 0x7fffffff, 0x7fffffff) 19 | #if __WORDSIZE == 64 20 | XOR(12, 0x7fffffffffffffff, 1, 0x7ffffffffffffffe) 21 | XOR(13, 1, 0x7fffffffffffffff, 0x7ffffffffffffffe) 22 | XOR(14, 0x8000000000000000, 1, 0x8000000000000001) 23 | XOR(15, 1, 0x8000000000000000, 0x8000000000000001) 24 | XOR(16, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff) 25 | XOR(17, 0x8000000000000000, 0x7fffffffffffffff, 0xffffffffffffffff) 26 | XOR(18, 0x7fffffffffffffff, 0xffffffffffffffff, 0x8000000000000000) 27 | XOR(19, 0xffffffffffffffff, 0x7fffffffffffffff, 0x8000000000000000) 28 | XOR(20, 0xffffffffffffffff, 0xffffffffffffffff, 0) 29 | #endif 30 | 31 | prepare 32 | pushargi ok 33 | ellipsis 34 | finishi @printf 35 | ret 36 | epilog 37 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alux_add.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alux_add.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define ADDX(N, I0, I1, V) ALUX(N, add, I0, I1, V) 7 | 8 | /* nothing */ 9 | ADDX(0, 0, 0, 0) 10 | #if __WORDSIZE == 32 11 | /* carry */ 12 | ADDX(1, 0xffffffff, 0xffffffff, 1) 13 | /* overflow */ 14 | ADDX(2, 0x7fffffff, 1, 0) 15 | /* overflow */ 16 | ADDX(3, 0x7fffffff, 0x7fffffff, 0) 17 | /* carry */ 18 | ADDX(4, 0x7fffffff, 0x80000000, 0) 19 | /* carry+overflow */ 20 | ADDX(5, 0x80000000, 0x80000000, 1) 21 | #else 22 | /* nothing */ 23 | ADDX(1, 0xffffffff, 0xffffffff, 0) 24 | /* nothing */ 25 | ADDX(2, 0x7fffffff, 1, 0) 26 | /* nothing */ 27 | ADDX(3, 0x7fffffff, 0x7fffffff, 0) 28 | /* nothing */ 29 | ADDX(4, 0x7fffffff, 0x80000000, 0) 30 | /* nothing */ 31 | ADDX(5, 0x80000000, 0x80000000, 0) 32 | /* carry */ 33 | ADDX(6, 0xffffffffffffffff, 0xffffffffffffffff, 1) 34 | /* overflow */ 35 | ADDX(7, 0x7fffffffffffffff, 1, 0) 36 | /* overflow */ 37 | ADDX(8, 0x7fffffffffffffff, 0x7fffffffffffffff, 0) 38 | /* overflow */ 39 | ADDX(9, 0x7fffffffffffffff, 0x8000000000000000, 0) 40 | /* carry+overflow */ 41 | ADDX(10,0x8000000000000000, 0x8000000000000000, 1) 42 | #endif 43 | 44 | prepare 45 | pushargi ok 46 | ellipsis 47 | finishi @printf 48 | ret 49 | epilog 50 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alux_sub.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/alux_sub.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | 6 | #define SUBX(N, I0, I1, V) ALUX(N, sub, I0, I1, V) 7 | 8 | /* nothing */ 9 | SUBX(0, 0, 0, 0) 10 | #if __WORDSIZE == 32 11 | /* carry */ 12 | SUBX(1, 0x7fffffff, 0xffffffff, 0xffffffff) 13 | /* overflow */ 14 | SUBX(2, 0x80000000, 1, 0) 15 | /* carry */ 16 | SUBX(3, 0x7fffffff, 0x80000000, 0xffffffff) 17 | /* overflow */ 18 | SUBX(4, 0x80000000, 0x7fffffff, 0) 19 | /* carry+overflow */ 20 | SUBX(5, 1, 0x80000000, 0xffffffff) 21 | #else 22 | /* carry */ 23 | SUBX(1, 0x7fffffff, 0xffffffff, -1) 24 | /* nothing */ 25 | SUBX(2, 0x80000000, 1, 0) 26 | /* carry */ 27 | SUBX(3, 0x7fffffff, 0x80000000, -1) 28 | /* nothing */ 29 | SUBX(4, 0x80000000, 0x7fffffff, 0) 30 | /* carry */ 31 | SUBX(5, 1, 0x80000000, -1) 32 | /* carry */ 33 | SUBX(6, 0x7fffffffffffffff, 0xffffffffffffffff, -1) 34 | /* overflow */ 35 | SUBX(7, 0x8000000000000000, 1, 0) 36 | /* carry */ 37 | SUBX(8, 0x7fffffffffffffff, 0x8000000000000000, -1) 38 | /* overflow */ 39 | SUBX(9, 0x8000000000000000, 0x7fffffffffffffff, 0) 40 | /* carry+overflow */ 41 | SUBX(10,1, 0x8000000000000000, -1) 42 | #endif 43 | 44 | prepare 45 | pushargi ok 46 | ellipsis 47 | finishi @printf 48 | ret 49 | epilog 50 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/bp.ok: -------------------------------------------------------------------------------- 1 | nfibs(32) = 2178309 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/bp.tst: -------------------------------------------------------------------------------- 1 | .data 32 2 | fmt: 3 | .c "nfibs(%d) = %d\n" 4 | 5 | .code 6 | jmpi main 7 | 8 | name rfibs 9 | rfibs: 10 | prolog 11 | arg $in 12 | getarg %r0 $in /* R0 = N */ 13 | beqi out %r0 0 14 | movr %v0 %r0 /* V0 = R0 */ 15 | movi %r0 1 16 | blei_u out %v0 2 17 | subi %v1 %v0 1 /* V1 = N-1 */ 18 | subi %v2 %v0 2 /* V1 = N-2 */ 19 | prepare 20 | pushargr %v1 21 | finishi rfibs 22 | retval %v1 /* V1 = rfibs(N-1) */ 23 | prepare 24 | pushargr %v2 25 | finishi rfibs 26 | retval %r0 /* R0 = rfibs(N-2) */ 27 | addr %r0 %r0 %v1 28 | out: 29 | retr %r0 30 | epilog 31 | 32 | name main 33 | main: 34 | prolog 35 | prepare 36 | pushargi 32 37 | finishi rfibs 38 | retval %v0 39 | prepare 40 | pushargi fmt 41 | ellipsis 42 | pushargi 32 43 | pushargr %v0 44 | finishi @printf 45 | ret 46 | epilog 47 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/branch.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/call.ok: -------------------------------------------------------------------------------- 1 | forward 2 | backward 3 | forward 4 | backward 5 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/carry.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.arm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.arm$||'` 3 | ./lightning -mthumb=0 $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.arm.swf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.arm\.swf$||'` 3 | ./lightning -mthumb=0 -mvfp=0 $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.arm4.swf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.arm4\.swf$||'` 3 | ./lightning -mcpu=4 -mthumb=0 -mvfp=0 $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.nodata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.nodata$||'` 3 | ./lightning -d $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0` 3 | ./lightning $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.swf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.swf$||'` 3 | ./lightning -mvfp=0 $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.x87.nodata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.x87.nodata$||'` 3 | ./lightning -data=0 -mx87=1 $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/check.x87.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | test=`basename $0 | sed -e 's|\.x87$||'` 3 | ./lightning -mx87=1 $srcdir/$test.tst | tr -d \\r > $test.out 4 | if test $? != 0; then 5 | exit $? 6 | fi 7 | 8 | cmp -s $srcdir/$test.ok $test.out 9 | result=$? 10 | if test $result != 0; then 11 | diff $srcdir/$test.ok $test.out 12 | rm $test.out 13 | exit 1 14 | fi 15 | rm $test.out 16 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/clobber.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/cvt.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/divi.ok: -------------------------------------------------------------------------------- 1 | 40/8 = 5 (expected 5) 2 | 64/8 = 8 (expected 8) 3 | 80/8 = 10 (expected 10) 4 | 98304/32768 = 3 (expected 3) 5 | 65536/32768 = 2 (expected 2) 6 | 163840/32768 = 5 (expected 5) 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/fib.ok: -------------------------------------------------------------------------------- 1 | nfibs(32) = 2178309 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/fib.tst: -------------------------------------------------------------------------------- 1 | .data 32 2 | format: 3 | .c "nfibs(%d) = %d\n" 4 | 5 | .code 6 | jmpi main 7 | 8 | name nfibs 9 | nfibs: 10 | prolog 11 | arg $in 12 | getarg %r0 $in // R0 = n 13 | beqi ref %r0 0 14 | movr %r1 %r0 15 | movi %r0 1 16 | blei_u ref %r1 2 17 | subi %r2 %r1 2 18 | movr %r1 %r0 19 | loop: 20 | subi %r2 %r2 1 // decr. counter 21 | movr %v0 %r0 // V0 = R0 22 | addr %r0 %r0 %r1 // R0 = R0 + R1 23 | movr %r1 %v0 // R1 = V0 24 | bnei loop %r2 0 // if (R2) goto loop 25 | ref: 26 | retr %r0 // RET = R0 27 | epilog 28 | 29 | name main 30 | main: 31 | prolog 32 | arg $argc 33 | arg $argv 34 | 35 | getarg_i %r0 $argc 36 | blei default %r0 1 37 | getarg %r0 $argv 38 | addi %r0 %r0 $(__WORDSIZE >> 3) 39 | ldr %r0 %r0 40 | prepare 41 | pushargr %r0 42 | finishi @atoi 43 | retval %r0 44 | jmpi call 45 | 46 | default: 47 | movi %r0 32 48 | 49 | call: 50 | movr %v0 %r0 51 | prepare 52 | pushargr %r0 53 | finishi nfibs 54 | retval %r0 55 | prepare 56 | pushargi format 57 | ellipsis 58 | pushargr %v0 59 | pushargr %r0 60 | finishi @printf 61 | ret 62 | epilog 63 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/float.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/fop_abs.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/fop_abs.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | #define ABS(N, T, I, V) FUN(N, T, abs, I, V) 6 | #define UABS(N, T, I, V) UFUN(N, T, abs, I, V) 7 | ABS(0, _f, -0.0, 0.0) 8 | ABS(1, _f, 0.5, 0.5) 9 | ABS(2, _f, -0.5, 0.5) 10 | ABS(3, _f, $Inf, $Inf) 11 | ABS(4, _f, $nInf, $Inf) 12 | ABS(5, _f, 1.25, 1.25) 13 | ABS(6, _f, -1.25, 1.25) 14 | ABS(7, _f, $nInf, $Inf) 15 | UABS(0, _f, $NaN, $NaN) 16 | ABS(0, _d, -0.0, 0.0) 17 | ABS(1, _d, 0.5, 0.5) 18 | ABS(2, _d, -0.5, 0.5) 19 | ABS(3, _d, $Inf, $Inf) 20 | ABS(4, _d, $nInf, $Inf) 21 | ABS(5, _d, 1.25, 1.25) 22 | ABS(6, _d, -1.25, 1.25) 23 | ABS(7, _d, $nInf, $Inf) 24 | UABS(0, _d, $NaN, $NaN) 25 | 26 | prepare 27 | pushargi ok 28 | ellipsis 29 | finishi @printf 30 | ret 31 | epilog 32 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/fop_sqrt.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/fop_sqrt.tst: -------------------------------------------------------------------------------- 1 | #include "alu.inc" 2 | 3 | .code 4 | prolog 5 | #define SQRT(N, T, I, V) FUN(N, T, sqrt, I, V) 6 | #define USQRT(N, T, I, V) UFUN(N, T, sqrt, I, V) 7 | SQRT(0, _f, -0.0, 0.0) 8 | SQRT(1, _f, 4.0, 2.0) 9 | SQRT(2, _f, 2.25, 1.5) 10 | SQRT(3, _f, $Inf, $Inf) 11 | USQRT(0, _f, $NaN, $NaN) 12 | SQRT(0, _d, -0.0, 0.0) 13 | SQRT(1, _d, 4.0, 2.0) 14 | SQRT(2, _d, 2.25, 1.5) 15 | SQRT(3, _d, $Inf, $Inf) 16 | USQRT(0, _d, $NaN, $NaN) 17 | 18 | prepare 19 | pushargi ok 20 | ellipsis 21 | finishi @printf 22 | ret 23 | epilog 24 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/hton.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/jmpr.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldsti.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldstr-c.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldstr.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldstxi-c.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldstxi.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldstxr-c.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ldstxr.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/put.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/qalu_div.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/qalu_div.tst: -------------------------------------------------------------------------------- 1 | #include "qalu.inc" 2 | 3 | .code 4 | prolog 5 | #define QDIV(N, I0, I1, LO, HI) QALU(N, , qdiv, I0, I1, LO, HI) 6 | #define UQDIV(N, I0, I1, LO, HI) QALU(N, _u, qdiv, I0, I1, LO, HI) 7 | QDIV(0, 10, 3, 3, 1) 8 | QDIV(1, -33, 9, -3, -6) 9 | QDIV(2, -41, -7, 5, -6) 10 | QDIV(3, 65536, 4096, 16, 0) 11 | UQDIV(4, -1, -2, 1, 1) 12 | UQDIV(5, -2, -5, 1, 3) 13 | prepare 14 | pushargi ok 15 | ellipsis 16 | finishi @printf 17 | ret 18 | epilog 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/qalu_mul.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/qalu_mul.tst: -------------------------------------------------------------------------------- 1 | #include "qalu.inc" 2 | 3 | .code 4 | prolog 5 | #define QMUL(N, I0, I1, LO, HI) QALU(N, , qmul, I0, I1, LO, HI) 6 | #define UQMUL(N, I0, I1, LO, HI) QALU(N, _u, qmul, I0, I1, LO, HI) 7 | QMUL(0, -2, -1, 2, 0) 8 | QMUL(1, 0, -1, 0, 0) 9 | QMUL(2, -1, 0, 0, 0) 10 | QMUL(3, 1, -1, -1, -1) 11 | #if __WORDSIZE == 32 12 | QMUL(4, 0x7ffff, 0x7ffff, 0xfff00001, 0x3f) 13 | UQMUL(5, 0xffffff, 0xffffff, 0xfe000001, 0xffff) 14 | QMUL(6, 0x80000000, -2, 0, 1) 15 | QMUL(7, 0x80000000, 2, 0, -1) 16 | QMUL(8, 0x80000001, 3, 0x80000003, -2) 17 | QMUL(9, 0x80000001, -3, 0x7ffffffd, 1) 18 | #else 19 | QMUL(4, 0x7ffffffff, 0x7ffffffff, 0xfffffff000000001, 0x3f) 20 | UQMUL(5, 0xffffffffff, 0xffffffffff, 0xfffffe0000000001, 0xffff) 21 | QMUL(6, 0x8000000000000000, -2, 0, 1) 22 | QMUL(7, 0x8000000000000000, 2, 0, -1) 23 | QMUL(8, 0x8000000000000001, 3, 0x8000000000000003, -2) 24 | QMUL(9, 0x8000000000000001, -3, 0x7ffffffffffffffd, 1) 25 | #endif 26 | prepare 27 | pushargi ok 28 | ellipsis 29 | finishi @printf 30 | ret 31 | epilog 32 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/range.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ranger.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ret.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/ret.tst: -------------------------------------------------------------------------------- 1 | .data 16 2 | ok: 3 | .c "ok" 4 | 5 | .code 6 | jmpi main 7 | 8 | /* 9 | * very simple test on purpose because otherwise it would not trigger 10 | * the bug where the retr %r0 or retr_d %f0 would be omitted because 11 | * the argument was already the return register, but the register end 12 | * clobbered by another instruction, like the div*, and the wrong 13 | * value returned because the retr* was removed and this way, lost 14 | * information that the register was live at function exit. 15 | */ 16 | 17 | check_r0: 18 | prolog 19 | movi %r0 1 20 | movi %r2 10 21 | // on x86 this changes %rax on other arches could use %r0 as temporary 22 | divi %r1 %r2 3 23 | // %r0 must still be 1 24 | retr %r0 25 | epilog 26 | 27 | check_f0: 28 | prolog 29 | movi_d %f0 0.5 30 | movi_d %f2 10 31 | divi_d %f1 %f2 3 32 | retr_d %f0 33 | epilog 34 | 35 | main: 36 | prolog 37 | calli check_r0 38 | retval %r1 39 | beqi r0_ok %r1 1 40 | calli @abort 41 | r0_ok: 42 | calli check_f0 43 | retval_d %f1 44 | beqi_d f0_ok %f1 0.5 45 | calli @abort 46 | f0_ok: 47 | prepare 48 | pushargi ok 49 | finishi @puts 50 | ret 51 | epilog 52 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/rpn.ok: -------------------------------------------------------------------------------- 1 | 2 | C: 0 10 20 30 40 50 60 70 80 90 100 3 | F: 32 50 68 86 104 122 140 158 176 194 212 4 | 5 | F: 32 50 68 86 104 122 140 158 176 194 212 6 | C: 0 10 20 30 40 50 60 70 80 90 100 7 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/run-test: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ok=`echo $1 | sed -e 's@\.\(x87\|arm\|swf\)@@'` 4 | $1 | tr -d \\r > $1.log 5 | if cmp -s $srcdir/$ok.ok $1.log; then 6 | rm $1.log 7 | else 8 | diff $srcdir/$ok.ok $1.log 9 | exit 1 10 | fi 11 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/stack.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/tramp.ok: -------------------------------------------------------------------------------- 1 | xfibs(32) = 7049155 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/va_list.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/check/varargs.ok: -------------------------------------------------------------------------------- 1 | 0 1 2 3 4 5 6 7 8 9 2 | 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 3 | 0 0.0 1 1.0 2 2.0 3 3.0 4 4.0 5 5.0 6 6.0 7 7.0 8 8.0 9 9.0 4 | 0.0 0 1.0 1 2.0 2 3.0 3 4.0 4 5.0 5 6.0 6 7.0 7 8.0 8 9.0 9 5 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/doc/.cvsignore: -------------------------------------------------------------------------------- 1 | *.info* 2 | stamp-* 3 | version.texi 4 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/doc/.gitignore: -------------------------------------------------------------------------------- 1 | *.info* 2 | stamp-* 3 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012-2019 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU lightning. 5 | # 6 | # GNU lightning is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as published 8 | # by the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU lightning is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | # License for more details. 15 | # 16 | 17 | AM_CFLAGS = -I$(top_srcdir)/include -D_GNU_SOURCE 18 | 19 | info_TEXINFOS = lightning.texi 20 | MOSTLYCLEANFILES = lightning.tmp 21 | 22 | lightning_TEXINFOS = body.texi version.texi 23 | 24 | noinst_PROGRAMS = incr printf rpn rfib ifib fact 25 | 26 | $(top_builddir)/lib/liblightning.la: 27 | cd $(top_builddir)/lib; $(MAKE) $(AM_MAKEFLAGS) liblightning.la 28 | 29 | incr_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 30 | incr_SOURCES = incr.c 31 | 32 | printf_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 33 | printf_SOURCES = printf.c 34 | 35 | rpn_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 36 | rpn_SOURCES = rpn.c 37 | 38 | rfib_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 39 | rfib_SOURCES = rfib.c 40 | 41 | ifib_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 42 | ifib_SOURCES = ifib.c 43 | 44 | fact_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB) 45 | fact_SOURCES = fact.c 46 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/doc/incr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static jit_state_t *_jit; 5 | 6 | typedef int (*pifi)(int); /* Pointer to Int Function of Int */ 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | jit_node_t *in; 11 | pifi incr; 12 | 13 | init_jit(argv[0]); 14 | _jit = jit_new_state(); 15 | 16 | jit_prolog(); /* @t{ prolog } */ 17 | in = jit_arg(); /* @t{ in = arg } */ 18 | jit_getarg(JIT_R0, in); /* @t{ getarg R0 } */ 19 | jit_addi(JIT_R0, JIT_R0, 1); /* @t{ addi R0\, R0\, 1 } */ 20 | jit_retr(JIT_R0); /* @t{ retr R0 } */ 21 | 22 | incr = jit_emit(); 23 | jit_clear_state(); 24 | 25 | /* call the generated code\, passing 5 as an argument */ 26 | printf("%d + 1 = %d\n", 5, incr(5)); 27 | 28 | jit_destroy_state(); 29 | finish_jit(); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/doc/printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static jit_state_t *_jit; 5 | 6 | typedef void (*pvfi)(int); /* Pointer to Void Function of Int */ 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | pvfi myFunction; /* ptr to generated code */ 11 | jit_node_t *start, *end; /* a couple of labels */ 12 | jit_node_t *in; /* to get the argument */ 13 | 14 | init_jit(argv[0]); 15 | _jit = jit_new_state(); 16 | 17 | start = jit_note(__FILE__, __LINE__); 18 | jit_prolog(); 19 | in = jit_arg(); 20 | jit_getarg(JIT_R1, in); 21 | jit_prepare(); 22 | jit_pushargi((jit_word_t)"generated %d bytes\n"); 23 | jit_ellipsis(); 24 | jit_pushargr(JIT_R1); 25 | jit_finishi(printf); 26 | jit_ret(); 27 | jit_epilog(); 28 | end = jit_note(__FILE__, __LINE__); 29 | 30 | myFunction = jit_emit(); 31 | 32 | /* call the generated code, passing its size as argument */ 33 | myFunction((char*)jit_address(end) - (char*)jit_address(start)); 34 | jit_clear_state(); 35 | 36 | jit_disassemble(); 37 | 38 | jit_destroy_state(); 39 | finish_jit(); 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/doc/version.texi: -------------------------------------------------------------------------------- 1 | @set UPDATED 3 October 2017 2 | @set UPDATED-MONTH October 2017 3 | @set EDITION 2.1.3 4 | @set VERSION 2.1.3 5 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2000, 2001, 2002, 2012-2019 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU lightning. 5 | # 6 | # GNU lightning is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as published 8 | # by the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU lightning is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | # License for more details. 15 | # 16 | 17 | SUBDIRS = \ 18 | lightning 19 | 20 | nodist_include_HEADERS = lightning.h 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/include/lightning/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2000, 2001, 2002, 2012-2019 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU lightning. 5 | # 6 | # GNU lightning is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU Lesser General Public License as published 8 | # by the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU lightning is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 | # License for more details. 15 | # 16 | 17 | lightning_includedir = $(includedir)/lightning 18 | 19 | EXTRA_DIST = \ 20 | jit_private.h 21 | 22 | if cpu_arm 23 | lightning_include_HEADERS = \ 24 | jit_arm.h 25 | endif 26 | if cpu_mips 27 | lightning_include_HEADERS = \ 28 | jit_mips.h 29 | endif 30 | if cpu_ppc 31 | lightning_include_HEADERS = \ 32 | jit_ppc.h 33 | endif 34 | if cpu_sparc 35 | lightning_include_HEADERS = \ 36 | jit_sparc.h 37 | endif 38 | if cpu_x86 39 | lightning_include_HEADERS = \ 40 | jit_x86.h 41 | endif 42 | if cpu_ia64 43 | lightning_include_HEADERS = \ 44 | jit_ia64.h 45 | endif 46 | if cpu_hppa 47 | lightning_include_HEADERS = \ 48 | jit_hppa.h 49 | endif 50 | if cpu_aarch64 51 | lightning_include_HEADERS = \ 52 | jit_aarch64.h 53 | endif 54 | if cpu_s390 55 | lightning_include_HEADERS = \ 56 | jit_s390.h 57 | endif 58 | if cpu_alpha 59 | lightning_include_HEADERS = \ 60 | jit_alpha.h 61 | endif 62 | if cpu_riscv 63 | lightning_include_HEADERS = \ 64 | jit_riscv.h 65 | endif 66 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/lightning.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: GNU Lightning 7 | Description: JIT library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -llightning 10 | Cflags: -I${includedir}/ 11 | 12 | 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/lightning/m4/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/code/src/mupen64plus-rsp-paraLLEl/lightning/m4/.gitkeep -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/llvm_jit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef JIT_HPP 2 | #define JIT_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace JIT 9 | { 10 | using Func = void (*)(void *, void *); 11 | class LLVMEngine 12 | { 13 | public: 14 | LLVMEngine(const std::unordered_map &symbol_table); 15 | ~LLVMEngine(); 16 | 17 | private: 18 | friend class Block; 19 | struct Impl; 20 | std::unique_ptr impl; 21 | }; 22 | 23 | class Block 24 | { 25 | public: 26 | Block(LLVMEngine &engine); 27 | ~Block(); 28 | bool compile(uint64_t hash, const std::string &source); 29 | Func get_func() const 30 | { 31 | return block; 32 | } 33 | 34 | private: 35 | struct Impl; 36 | std::unique_ptr impl; 37 | Func block = nullptr; 38 | size_t block_size = 0; 39 | }; 40 | } // namespace JIT 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/rsp/cp2.cpp: -------------------------------------------------------------------------------- 1 | #include "../state.hpp" 2 | 3 | extern "C" 4 | { 5 | 6 | void RSP_CFC2(RSP::CPUState *rsp, unsigned rt, unsigned rd) 7 | { 8 | unsigned src = rd & 3; 9 | if (src == 3) 10 | src = 2; 11 | 12 | int16_t res = rsp_get_flags(rsp->cp2.flags[src].e); 13 | if (rt) 14 | rsp->sr[rt] = res; 15 | } 16 | 17 | void RSP_CTC2(RSP::CPUState *rsp, unsigned rt, unsigned rd) 18 | { 19 | rt = rsp->sr[rt] & 0xffff; 20 | 21 | unsigned dst = rd & 3; 22 | if (dst >= 2) 23 | { 24 | rt &= 0xff; 25 | dst = 2; 26 | } 27 | rsp_set_flags(rsp->cp2.flags[dst].e, rt); 28 | } 29 | 30 | void RSP_MTC2(RSP::CPUState *rsp, unsigned rt, unsigned rd, unsigned element) 31 | { 32 | uint16_t *e = rsp->cp2.regs[rd].e; 33 | 34 | #ifdef INTENSE_DEBUG 35 | fprintf(stderr, "MTC2, rt = %u, [rt] = 0x%x, rd = %u, e = %u\n", rt, rsp->sr[rt], rd, element); 36 | #endif 37 | 38 | unsigned lo = element >> 1; 39 | rt = rsp->sr[rt]; 40 | 41 | if (element & 1) 42 | { 43 | unsigned hi = (element + 1) >> 1; 44 | e[lo] = (e[lo] & 0xff00) | ((rt >> 8) & 0xff); 45 | e[hi] = (e[lo] & 0x00ff) | ((rt & 0xff) << 8); 46 | } 47 | else 48 | e[lo] = rt; 49 | } 50 | 51 | void RSP_MFC2(RSP::CPUState *rsp, unsigned rt, unsigned rd, unsigned element) 52 | { 53 | if (rt == 0) 54 | return; 55 | 56 | const uint16_t *e = rsp->cp2.regs[rd].e; 57 | unsigned lo = element >> 1; 58 | 59 | if (element & 1) 60 | { 61 | unsigned hi = ((element + 1) >> 1) & 7; 62 | uint16_t high = e[lo] << 8; 63 | uint8_t low = e[hi] >> 8; 64 | rsp->sr[rt] = int16_t(high | low); 65 | } 66 | else 67 | rsp->sr[rt] = int16_t(e[lo]); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/rsp/reciprocal.h: -------------------------------------------------------------------------------- 1 | // 2 | // common/reciprocal.h: RSP reciprocal ROM contents. 3 | // 4 | // CEN64: Cycle-Accurate Nintendo 64 Emulator. 5 | // Copyright (C) 2015, Tyler J. Stachecki. 6 | // 7 | // This file is subject to the terms and conditions defined in 8 | // 'LICENSE', which is part of this source code package. 9 | // 10 | 11 | #ifndef __common_reciprocal_h__ 12 | #define __common_reciprocal_h__ 13 | #include 14 | 15 | extern const uint16_t rsp_reciprocal_rom[1024]; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/rsp/registers.md: -------------------------------------------------------------------------------- 1 | // 2 | // rsp/registers.md: RSP register enumerations. 3 | // 4 | // CEN64: Cycle-Accurate Nintendo 64 Emulator. 5 | // Copyright (C) 2015, Tyler J. Stachecki. 6 | // 7 | // This file is subject to the terms and conditions defined in 8 | // 'LICENSE', which is part of this source code package. 9 | // 10 | 11 | #ifndef SP_REGISTER_LIST 12 | #define SP_REGISTER_LIST \ 13 | X(SP_MEM_ADDR_REG) \ 14 | X(SP_DRAM_ADDR_REG) \ 15 | X(SP_RD_LEN_REG) \ 16 | X(SP_WR_LEN_REG) \ 17 | X(SP_STATUS_REG) \ 18 | X(SP_DMA_FULL_REG) \ 19 | X(SP_DMA_BUSY_REG) \ 20 | X(SP_SEMAPHORE_REG) \ 21 | X(CMD_START) \ 22 | X(CMD_END) \ 23 | X(CMD_CURRENT) \ 24 | X(CMD_STATUS) \ 25 | X(CMD_CLOCK) \ 26 | X(CMD_BUSY) \ 27 | X(CMD_PIPE_BUSY) \ 28 | X(CMD_TMEM_BUSY) \ 29 | X(SP_PC_REG) \ 30 | X(SP_IBIST_REG) 31 | #endif 32 | 33 | SP_REGISTER_LIST 34 | 35 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/rsp_disasm.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RSP_DISASM_HPP_ 2 | #define RSP_DISASM_HPP_ 3 | 4 | #include 5 | 6 | namespace RSP 7 | { 8 | std::string disassemble(uint32_t pc, uint32_t instr); 9 | const char *register_name(unsigned reg_index); 10 | } 11 | 12 | #endif -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/win32/mman/sys/.gitignore: -------------------------------------------------------------------------------- 1 | x64 2 | mman.VC.db -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/win32/mman/sys/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/witwall/mman-win32.git 8 | branch = master 9 | commit = 2d1c576e62b99e85d99407e1a88794c6e44c3310 10 | parent = 9f797430963d9cf0fcef7d963466f9cac7026de2 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/win32/mman/sys/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project (mman-win32 C) 2 | 3 | cmake_minimum_required (VERSION 2.8) 4 | 5 | option (BUILD_SHARED_LIBS "shared/static libs" ON) 6 | option (BUILD_TESTS "tests?" OFF) 7 | 8 | set (headers mman.h) 9 | set (sources mman.c) 10 | 11 | add_library (mman ${sources}) 12 | 13 | if (BUILD_SHARED_LIBS) 14 | target_compile_definitions(mman 15 | PUBLIC MMAN_LIBRARY_DLL 16 | PRIVATE MMAN_LIBRARY 17 | ) 18 | endif() 19 | 20 | install (TARGETS mman RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib${LIB_SUFFIX} 22 | ARCHIVE DESTINATION lib${LIB_SUFFIX}) 23 | 24 | install (FILES ${headers} DESTINATION include/sys) 25 | 26 | if (BUILD_TESTS) 27 | enable_testing () 28 | add_executable (t_mman test.c) 29 | target_link_libraries (t_mman mman) 30 | add_test (NAME t_mman COMMAND t_mman${CMAKE_EXECUTABLE_SUFFIX}) 31 | endif () 32 | 33 | 34 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/win32/mman/sys/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # mman-win32 (mingw32) Makefile 3 | # 4 | include config.mak 5 | 6 | CFLAGS=-Wall -O3 -fomit-frame-pointer 7 | 8 | ifeq ($(BUILD_STATIC),yes) 9 | TARGETS+=libmman.a 10 | INSTALL+=static-install 11 | endif 12 | 13 | ifeq ($(BUILD_SHARED),yes) 14 | TARGETS+=libmman.dll 15 | INSTALL+=shared-install 16 | CFLAGS+=-DMMAN_LIBRARY_DLL -DMMAN_LIBRARY 17 | endif 18 | 19 | ifeq ($(BUILD_MSVC),yes) 20 | SHFLAGS+=-Wl,--output-def,libmman.def 21 | INSTALL+=lib-install 22 | endif 23 | 24 | all: $(TARGETS) 25 | 26 | mman.o: mman.c mman.h 27 | $(CC) -o mman.o -c mman.c $(CFLAGS) 28 | 29 | libmman.a: mman.o 30 | $(AR) cru libmman.a mman.o 31 | $(RANLIB) libmman.a 32 | 33 | libmman.dll: mman.o 34 | $(CC) -shared -o libmman.dll mman.o -Wl,--out-implib,libmman.dll.a 35 | 36 | header-install: 37 | mkdir -p $(DESTDIR)$(incdir) 38 | cp mman.h $(DESTDIR)$(incdir) 39 | 40 | static-install: header-install 41 | mkdir -p $(DESTDIR)$(libdir) 42 | cp libmman.a $(DESTDIR)$(libdir) 43 | 44 | shared-install: header-install 45 | mkdir -p $(DESTDIR)$(libdir) 46 | cp libmman.dll.a $(DESTDIR)$(libdir) 47 | mkdir -p $(DESTDIR)$(bindir) 48 | cp libmman.dll $(DESTDIR)$(bindir) 49 | 50 | lib-install: 51 | mkdir -p $(DESTDIR)$(libdir) 52 | cp libmman.lib $(DESTDIR)$(libdir) 53 | 54 | install: $(INSTALL) 55 | 56 | test.exe: test.c mman.c mman.h 57 | $(CC) -o test.exe test.c -L. -lmman 58 | 59 | test: $(TARGETS) test.exe 60 | test.exe 61 | 62 | clean:: 63 | rm -f mman.o libmman.a libmman.dll.a libmman.dll libmman.def libmman.lib test.exe *.dat 64 | 65 | distclean: clean 66 | rm -f config.mak 67 | 68 | .PHONY: clean distclean install test 69 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/win32/mman/sys/README.md: -------------------------------------------------------------------------------- 1 | mman-win32 2 | ========== 3 | 4 | mman library for Windows. mirror of https://code.google.com/p/mman-win32/ 5 | 6 | A light implementation of the mmap functions for MinGW. 7 | 8 | The mmap-win32 library implements a wrapper for mmap functions around the memory mapping Windows API. 9 | 10 | License: MIT License 11 | -------------------------------------------------------------------------------- /code/src/mupen64plus-rsp-paraLLEl/win32/mman/sys/mman-win32.pro: -------------------------------------------------------------------------------- 1 | QT -= core gui 2 | 3 | TARGET = mman 4 | TEMPLATE = lib 5 | 6 | DEFINES += MMAN_LIBRARY_DLL 7 | DEFINES += MMAN_LIBRARY 8 | 9 | HEADERS += \ 10 | mman.h 11 | 12 | SOURCES += \ 13 | mman.c 14 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* endianness */ 4 | #ifdef MSB_FIRST 5 | #define BYTE_XOR_DWORD_SWAP 4 6 | #define WORD_XOR_DWORD_SWAP 2 7 | #define BYTE_ADDR_XOR 0 8 | #define WORD_ADDR_XOR 0 9 | #define BYTE4_XOR_BE(a) (a) 10 | #else 11 | #define BYTE_ADDR_XOR 3 12 | #define WORD_ADDR_XOR 1 13 | #define BYTE4_XOR_BE(a) ((a) ^ BYTE_ADDR_XOR) 14 | #define BYTE_XOR_DWORD_SWAP 7 15 | #define WORD_XOR_DWORD_SWAP 3 16 | #endif 17 | 18 | #define DWORD_XOR_DWORD_SWAP 1 19 | 20 | // inlining 21 | #define INLINE inline 22 | 23 | #ifdef _MSC_VER 24 | #define STRICTINLINE __forceinline 25 | #elif defined(__GNUC__) 26 | #define STRICTINLINE __attribute__((always_inline)) inline 27 | #else 28 | #define STRICTINLINE inline 29 | #endif 30 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/msg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void msg_error(const char * err, ...); 4 | void msg_warning(const char* err, ...); 5 | void msg_debug(const char* err, ...); 6 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/n64video/vi/divot.c: -------------------------------------------------------------------------------- 1 | static STRICTINLINE void divot_filter(struct rgba* final, struct rgba center, struct rgba left, struct rgba right) 2 | { 3 | *final = center; 4 | 5 | if ((center.a & left.a & right.a) == 7) 6 | { 7 | return; 8 | } 9 | 10 | if ((left.r >= center.r && right.r >= left.r) || (left.r >= right.r && center.r >= left.r)) 11 | final->r = left.r; 12 | else if ((right.r >= center.r && left.r >= right.r) || (right.r >= left.r && center.r >= right.r)) 13 | final->r = right.r; 14 | 15 | if ((left.g >= center.g && right.g >= left.g) || (left.g >= right.g && center.g >= left.g)) 16 | final->g = left.g; 17 | else if ((right.g >= center.g && left.g >= right.g) || (right.g >= left.g && center.g >= right.g)) 18 | final->g = right.g; 19 | 20 | if ((left.b >= center.b && right.b >= left.b) || (left.b >= right.b && center.b >= left.b)) 21 | final->b = left.b; 22 | else if ((right.b >= center.b && left.b >= right.b) || (right.b >= left.b && center.b >= right.b)) 23 | final->b = right.b; 24 | } 25 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/n64video/vi/lerp.c: -------------------------------------------------------------------------------- 1 | static STRICTINLINE void vi_vl_lerp(struct rgba* up, struct rgba down, uint32_t frac) 2 | { 3 | uint32_t r0, g0, b0; 4 | if (!frac) 5 | return; 6 | 7 | r0 = up->r; 8 | g0 = up->g; 9 | b0 = up->b; 10 | 11 | up->r = ((((down.r - r0) * frac + 16) >> 5) + r0) & 0xff; 12 | up->g = ((((down.g - g0) * frac + 16) >> 5) + g0) & 0xff; 13 | up->b = ((((down.b - b0) * frac + 16) >> 5) + b0) & 0xff; 14 | } 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/parallel_al.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | 9 | #define PARALLEL_MAX_WORKERS 64u 10 | 11 | void parallel_alinit(uint32_t num); 12 | 13 | void parallel_run(void task(uint32_t)); 14 | 15 | uint32_t parallel_num_workers(void); 16 | 17 | void parallel_close(void); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/plugin.c: -------------------------------------------------------------------------------- 1 | #include "plugin.h" 2 | #include "common.h" 3 | 4 | #include 5 | 6 | static char filter_char(char c) 7 | { 8 | if (isalnum(c) || c == '_' || c == '-') { 9 | return c; 10 | } else { 11 | return ' '; 12 | } 13 | } 14 | 15 | uint32_t plugin_get_rom_name(char* name, uint32_t name_size) 16 | { 17 | if (name_size < 21) { 18 | // buffer too small 19 | return 0; 20 | } 21 | 22 | uint8_t* rom_header = plugin_get_rom_header(); 23 | if (!rom_header) { 24 | // not available 25 | return 0; 26 | } 27 | 28 | // copy game name from ROM header, which is encoded in Shift_JIS. 29 | // most games just use the ASCII subset, so filter out the rest. 30 | int i = 0; 31 | for (; i < 20; i++) { 32 | name[i] = filter_char(rom_header[(32 + i) ^ BYTE_ADDR_XOR]); 33 | } 34 | 35 | // make sure there's at least one whitespace that will terminate the string 36 | // below 37 | name[i] = ' '; 38 | 39 | // trim trailing whitespaces 40 | for (; i > 0; i--) { 41 | if (name[i] != ' ') { 42 | break; 43 | } 44 | name[i] = 0; 45 | } 46 | 47 | // game title is empty or invalid, use safe fallback using the four-character 48 | // game ID 49 | if (i == 0) { 50 | for (; i < 4; i++) { 51 | name[i] = filter_char(rom_header[(59 + i) ^ BYTE_ADDR_XOR]); 52 | } 53 | name[i] = 0; 54 | } 55 | 56 | return i; 57 | } 58 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/plugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void plugin_init(void); 6 | void plugin_sync_dp(void); 7 | uint32_t** plugin_get_dp_registers(void); 8 | uint32_t** plugin_get_vi_registers(void); 9 | uint8_t* plugin_get_rdram(void); 10 | uint32_t plugin_get_rdram_size(void); 11 | uint8_t* plugin_get_dmem(void); 12 | uint8_t* plugin_get_rom_header(void); 13 | uint32_t plugin_get_rom_name(char* name, uint32_t name_size); 14 | void plugin_close(void); 15 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/rdp_dump.h: -------------------------------------------------------------------------------- 1 | #ifndef RDP_DUMP_H 2 | #define RDP_DUMP_H 3 | 4 | #include 5 | #include 6 | 7 | bool rdp_dump_init(const char *path, uint32_t dram_size, uint32_t hidden_dram_size); 8 | void rdp_dump_end(void); 9 | void rdp_dump_flush_dram(const void *dram, uint32_t size); 10 | void rdp_dump_flush_hidden_dram(const void *dram, uint32_t size); 11 | 12 | void rdp_dump_signal_complete(void); 13 | void rdp_dump_emit_command(uint32_t command, const uint32_t *cmd_data, uint32_t cmd_words); 14 | 15 | void rdp_dump_set_vi_register(uint32_t vi_register, uint32_t value); 16 | void rdp_dump_end_frame(void); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/vdac.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "n64video.h" 4 | 5 | #include 6 | #include 7 | 8 | struct rgba 9 | { 10 | uint8_t b; 11 | uint8_t g; 12 | uint8_t r; 13 | uint8_t a; 14 | }; 15 | 16 | struct frame_buffer 17 | { 18 | struct rgba* pixels; 19 | uint32_t width; 20 | uint32_t height; 21 | uint32_t height_out; 22 | uint32_t pitch; 23 | }; 24 | 25 | void vdac_init(struct n64video_config* config); 26 | void vdac_read(struct frame_buffer* fb, bool alpha); 27 | void vdac_write(struct frame_buffer* fb); 28 | void vdac_sync(bool invaid); 29 | void vdac_close(void); 30 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-angrylion/version.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define GIT_BRANCH "@GIT_BRANCH@" 4 | #define GIT_TAG "@GIT_TAG@" 5 | #define GIT_COMMIT_HASH "@GIT_COMMIT_HASH@" 6 | #define GIT_COMMIT_DATE "@GIT_COMMIT_DATE@" 7 | 8 | #define CORE_BASE_NAME "angrylion's RDP Plus" 9 | 10 | #ifdef _DEBUG 11 | #define CORE_NAME CORE_BASE_NAME " " GIT_TAG " (Debug)" 12 | #else 13 | #define CORE_NAME CORE_BASE_NAME " " GIT_TAG 14 | #endif 15 | 16 | #define CORE_SIMPLE_NAME "angrylion-plus" 17 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/DUMPING.md: -------------------------------------------------------------------------------- 1 | # How to debug RDP dumps 2 | 3 | ## Build 4 | 5 | Make sure to build parallel-n64 with `make HAVE_PARALLEL=1 HAVE_PARALLEL_RSP=1 HAVE_RDP_DUMP=1`. 6 | Build `git://github.com/Themaister/parallel-rdp` as instructed in the repo. You should have a `rdp-validate-dump` binary. 7 | 8 | ## Workflow 9 | 10 | - Find place in game that shows a difference with Angrylion vs parallel-RDP. 11 | - Make savestate close to where issue happens. 12 | - Switch plugin to Angrylion. 13 | - Exit RetroArch 14 | - Set environment variable `RDP_DUMP` to something like `dump.rdp`. E.g. `RDP_DUMP=dump.rdp ./retroarch`. 15 | - Run game, it should run quite slow, as multithreading is forced off when dumping. 16 | - You should now have a dump where you pointed `RDP_DUMP` to. 17 | - Run `rdp-validate-dump dump.rdp`. If it passes without error, draw calls are bitexact with Angrylion. 18 | - Also to be sure, run `rdp-validate-dump dump.rdp --sync-only`. This catches batching-related bugs. This should run much faster. 19 | - If both pass without error, you can be confident parallel-RDP was bitexact. If an error is found, it should be reported with the dump. 20 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/COMMIT: -------------------------------------------------------------------------------- 1 | 7a3e561e89d35f7e221770d21e7efa970b496a1e 2 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Themaister 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/clear_indirect_buffer.comp: -------------------------------------------------------------------------------- 1 | #version 450 2 | /* Copyright (c) 2020 Themaister 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | layout(local_size_x_id = 0) in; 24 | 25 | layout(set = 0, binding = 0, std430) writeonly buffer ClearIndirectBuffer 26 | { 27 | uvec4 indirects[]; 28 | }; 29 | 30 | void main() 31 | { 32 | indirects[gl_GlobalInvocationID.x] = uvec4(0, 1, 1, 0); 33 | } -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/fb_formats.h: -------------------------------------------------------------------------------- 1 | #ifndef FB_FORMATS_H_ 2 | #define FB_FORMATS_H_ 3 | 4 | const int FB_FMT_I4 = 0; 5 | const int FB_FMT_I8 = 1; 6 | const int FB_FMT_RGBA5551 = 2; 7 | const int FB_FMT_IA88 = 3; 8 | const int FB_FMT_RGBA8888 = 4; 9 | 10 | #endif -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/fullscreen.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | /* Copyright (c) 2020 Themaister 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | void main() 25 | { 26 | if (gl_VertexIndex == 0) 27 | gl_Position = vec4(-1.0, -1.0, 0.0, 1.0); 28 | else if (gl_VertexIndex == 1) 29 | gl_Position = vec4(-1.0, +3.0, 0.0, 1.0); 30 | else 31 | gl_Position = vec4(+3.0, -1.0, 0.0, 1.0); 32 | } 33 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/load_attribute_setup.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 Themaister 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef LOAD_ATTRIBUTE_SETUP_H_ 24 | #define LOAD_ATTRIBUTE_SETUP_H_ 25 | 26 | AttributeSetup load_attribute_setup(uint index) 27 | { 28 | return attribute_setup.elems[index]; 29 | } 30 | 31 | #endif -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/load_scissor_state.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 Themaister 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef LOAD_SCISSOR_STATE_H_ 24 | #define LOAD_SCISSOR_STATE_H_ 25 | 26 | ScissorState load_scissor_state(uint index) 27 | { 28 | ivec4 values = scissor_state.elems[index]; 29 | return ScissorState(values.x, values.y, values.z, values.w); 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/load_span_offsets.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 Themaister 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef LOAD_SPAN_OFFSETS_H_ 24 | #define LOAD_SPAN_OFFSETS_H_ 25 | 26 | SpanInfoOffsets load_span_offsets(uint index) 27 | { 28 | return span_offsets.elems[index]; 29 | } 30 | 31 | #endif -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/vi_blend_fields.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | /* Copyright (c) 2020 Themaister 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | #extension GL_EXT_samplerless_texture_functions : require 24 | 25 | layout(location = 0) out vec4 FragColor; 26 | layout(set = 0, binding = 0) uniform texture2D uImage; 27 | 28 | void main() 29 | { 30 | // A persistent pixel does not propagate more than one frame. 31 | vec4 input_pixel = texelFetch(uImage, ivec2(gl_FragCoord.xy), 0); 32 | FragColor = vec4(input_pixel.rgb * input_pixel.a, 0.0); 33 | } -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/parallel-rdp/shaders/vi_deinterlace.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | /* Copyright (c) 2020 Themaister 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | layout(location = 0) in vec2 vUV; 25 | layout(set = 0, binding = 0) uniform sampler2D uSampler; 26 | layout(location = 0) out vec4 FragColor; 27 | 28 | void main() 29 | { 30 | FragColor = textureLod(uSampler, vUV, 0.0); 31 | } -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/spirv-cross/spirv_cross_util.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2020 Arm Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SPIRV_CROSS_UTIL_HPP 18 | #define SPIRV_CROSS_UTIL_HPP 19 | 20 | #include "spirv_cross.hpp" 21 | 22 | namespace spirv_cross_util 23 | { 24 | void rename_interface_variable(SPIRV_CROSS_NAMESPACE::Compiler &compiler, 25 | const SPIRV_CROSS_NAMESPACE::SmallVector &resources, 26 | uint32_t location, const std::string &name); 27 | void inherit_combined_sampler_bindings(SPIRV_CROSS_NAMESPACE::Compiler &compiler); 28 | } // namespace spirv_cross_util 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/util/enum_cast.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | namespace Util 28 | { 29 | template 30 | constexpr typename std::underlying_type::type ecast(T x) 31 | { 32 | return static_cast::type>(x); 33 | } 34 | } -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/vulkan/cookie.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "cookie.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | Cookie::Cookie(Device *device) 29 | : cookie(device->allocate_cookie()) 30 | { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/vulkan/pipeline_event.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "pipeline_event.hpp" 24 | #include "device.hpp" 25 | 26 | namespace Vulkan 27 | { 28 | EventHolder::~EventHolder() 29 | { 30 | if (event) 31 | { 32 | if (internal_sync) 33 | device->destroy_event_nolock(event); 34 | else 35 | device->destroy_event(event); 36 | } 37 | } 38 | 39 | void EventHolderDeleter::operator()(Vulkan::EventHolder *event) 40 | { 41 | event->device->handle_pool.events.free(event); 42 | } 43 | } -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/parallel-rdp/vulkan/thread_id.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-2020 Hans-Kristian Arntzen 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining 4 | * a copy of this software and associated documentation files (the 5 | * "Software"), to deal in the Software without restriction, including 6 | * without limitation the rights to use, copy, modify, merge, publish, 7 | * distribute, sublicense, and/or sell copies of the Software, and to 8 | * permit persons to whom the Software is furnished to do so, subject to 9 | * the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be 12 | * included in all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #pragma once 24 | 25 | namespace Vulkan 26 | { 27 | unsigned get_current_thread_index(); 28 | void register_thread_index(unsigned thread_index); 29 | } -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/rdp.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PARALLEL_RDP_HPP 2 | #define PARALLEL_RDP_HPP 3 | 4 | #include "vulkan_headers.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "rdp_device.hpp" 12 | #include "context.hpp" 13 | #include "device.hpp" 14 | 15 | namespace RDP 16 | { 17 | bool init(); 18 | void deinit(); 19 | void begin_frame(); 20 | 21 | void process_commands(); 22 | extern const struct retro_hw_render_interface_vulkan *vulkan; 23 | 24 | extern unsigned width; 25 | extern unsigned height; 26 | extern unsigned upscaling; 27 | extern unsigned downscaling_steps; 28 | extern unsigned overscan; 29 | extern bool synchronous, divot_filter, gamma_dither, vi_aa, vi_scale, dither_filter, interlacing; 30 | extern bool native_texture_lod, native_tex_rect; 31 | 32 | void complete_frame(); 33 | void deinit(); 34 | 35 | void profile_refresh_begin(); 36 | void profile_refresh_end(); 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /code/src/mupen64plus-video-paraLLEl/z64.h: -------------------------------------------------------------------------------- 1 | #ifndef __Z64_H__ 2 | #define __Z64_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define SP_INTERRUPT 0x1 10 | #define SI_INTERRUPT 0x2 11 | #define AI_INTERRUPT 0x4 12 | #define VI_INTERRUPT 0x8 13 | #define PI_INTERRUPT 0x10 14 | #define DP_INTERRUPT 0x20 15 | 16 | #define SP_STATUS_HALT 0x0001 17 | #define SP_STATUS_BROKE 0x0002 18 | #define SP_STATUS_DMABUSY 0x0004 19 | #define SP_STATUS_DMAFULL 0x0008 20 | #define SP_STATUS_IOFULL 0x0010 21 | #define SP_STATUS_SSTEP 0x0020 22 | #define SP_STATUS_INTR_BREAK 0x0040 23 | #define SP_STATUS_SIGNAL0 0x0080 24 | #define SP_STATUS_SIGNAL1 0x0100 25 | #define SP_STATUS_SIGNAL2 0x0200 26 | #define SP_STATUS_SIGNAL3 0x0400 27 | #define SP_STATUS_SIGNAL4 0x0800 28 | #define SP_STATUS_SIGNAL5 0x1000 29 | #define SP_STATUS_SIGNAL6 0x2000 30 | #define SP_STATUS_SIGNAL7 0x4000 31 | 32 | #define DP_STATUS_XBUS_DMA 0x01 33 | #define DP_STATUS_FREEZE 0x02 34 | #define DP_STATUS_FLUSH 0x04 35 | #define DP_STATUS_START_GCLK 0x008 36 | #define DP_STATUS_TMEM_BUSY 0x010 37 | #define DP_STATUS_PIPE_BUSY 0x020 38 | #define DP_STATUS_CMD_BUSY 0x040 39 | #define DP_STATUS_CBUF_READY 0x080 40 | #define DP_STATUS_DMA_BUSY 0x100 41 | #define DP_STATUS_END_VALID 0x200 42 | #define DP_STATUS_START_VALID 0x400 43 | 44 | #define GET_GFX_INFO(member) (gfx_info.member) 45 | 46 | #define DRAM GET_GFX_INFO(RDRAM) 47 | #define SP_DMEM GET_GFX_INFO(DMEM) 48 | #define SP_IMEM GET_GFX_INFO(IMEM) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /code/src/tools/Makefile: -------------------------------------------------------------------------------- 1 | binext := 2 | 3 | ifeq ($(platform),win32) 4 | binext := .exe 5 | static := 1 6 | endif 7 | 8 | ifeq ($(static),1) 9 | lflags += -static-libgcc -static 10 | endif 11 | 12 | cflags += -O2 -g -Wall $(extracflags) 13 | lflags += 14 | libs += -lm 15 | bins += pj64tosrm$(binext) m64pmigrate$(binext) 16 | 17 | .PHONY: all clean 18 | 19 | all: $(bins) 20 | clean: 21 | -rm -f $(bins) 22 | 23 | pj64tosrm$(binext): pj64tosrm.c 24 | $(CC) $(cflags) -o$@ $(lflags) $< $(libs) 25 | 26 | m64pmigrate$(binext): m64pmigrate.c 27 | $(CC) $(cflags) -o$@ $(lflags) $< $(libs) 28 | 29 | %.o: %.c 30 | $(CC) $(cflags) -c -o $@ $< 31 | 32 | -------------------------------------------------------------------------------- /code/start_emc.sh: -------------------------------------------------------------------------------- 1 | cd /home/nbarkhina/emscripten/emsdk/ 2 | source ./emsdk_env.sh 3 | cd "/mnt/e/Dev/N64_Parallel_Github/code" -------------------------------------------------------------------------------- /code/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /code/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /dist/assets.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/dist/assets.zip -------------------------------------------------------------------------------- /dist/n64wasm.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/dist/n64wasm.wasm -------------------------------------------------------------------------------- /dist/romlist.js: -------------------------------------------------------------------------------- 1 | var ROMLIST = [ 2 | /* 3 | {url:"roms/rom1.z64",title:"Game 1"}, 4 | {url:"roms/rom2.v64",title:"Game 2"}, 5 | {url:"roms/rom3.v64",title:"Game 3"}, 6 | */ 7 | ]; -------------------------------------------------------------------------------- /dist/settings.js: -------------------------------------------------------------------------------- 1 | var N64WASMSETTINGS = { 2 | CLOUDSAVEURL: "", 3 | SHOWADVANCED: false, //set this to true to enable importing of save files (eep, sra, fla) 4 | SHOWOPTIONS: false //set this to true to add options for reset and toggling fps 5 | } -------------------------------------------------------------------------------- /screenshots/server1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/screenshots/server1.png -------------------------------------------------------------------------------- /screenshots/server2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nbarkhina/N64Wasm/bfac222f8a27287022844b47000328531834e9c1/screenshots/server2.png -------------------------------------------------------------------------------- /server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | n64db.sqlite 3 | sample.sqlite 4 | roms -------------------------------------------------------------------------------- /server/docker/dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:latest 2 | 3 | WORKDIR "/home/node" 4 | 5 | RUN git clone https://github.com/nbarkhina/N64Wasm 6 | 7 | WORKDIR "/home/node/N64Wasm/server" 8 | 9 | RUN npm install 10 | 11 | RUN mkdir wwwroot 12 | 13 | RUN mkdir roms 14 | 15 | RUN cp ../dist/* ./wwwroot/ 16 | 17 | COPY dockersettings.js "/home/node/N64Wasm/server/wwwroot/settings.js" 18 | 19 | EXPOSE 5500 20 | 21 | CMD ["npm","start"] 22 | 23 | # TO BUILD AND RUN 24 | # docker build -t n64wasmserver . 25 | # docker run -p 80:5500 -d n64wasmserver 26 | # (open a browser to port 80) -------------------------------------------------------------------------------- /server/docker/dockersettings.js: -------------------------------------------------------------------------------- 1 | var N64WASMSETTINGS = { 2 | CLOUDSAVEURL: "api", 3 | SHOWADVANCED: false, 4 | SHOWFPS: true 5 | } -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "n64node", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "start": "node app.js", 8 | "nodemon": "node .\\node_modules\\nodemon\\bin\\nodemon.js .\\app.js", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "@types/express": "^4.17.13", 15 | "@types/node": "^16.11.7", 16 | "@types/sqlite3": "^3.1.7", 17 | "body-parser": "^1.19.0", 18 | "express": "^4.17.1", 19 | "nodemon": "^2.0.15", 20 | "sqlite3": "^5.0.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /server/php/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | RewriteRule ^(.+)$ index.php [QSA,L] 4 | -------------------------------------------------------------------------------- /server/php/README.md: -------------------------------------------------------------------------------- 1 | # Cloud save states with PHP Backend 2 | 3 | - unzip `dist` folder to document root 4 | - unzip `server/php` to document root/api/ 5 | - enable sqlite3 extension in your php.ini 6 | - Create password at bcrypt-generator.com or run `php -r "print password_hash('YOUR_PASSWORD', PASSWORD_BCRYPT);"` and replace BCRYPT_PASSWORD_HASH in index.php 7 | - Update the CLOUDSAVEURL setting in your `settings.js` to "api" 8 | - Place roms in document root/roms/ and update romlist.js 9 | - Update `$baseurl` in `index.php` (if you serve from a subpath like /Home/n64wasm) 10 | - Enjoy! 11 | -------------------------------------------------------------------------------- /server/php/n64wasm-nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name sub.domain.tld; 4 | 5 | root /path/to/n64wasm; 6 | index index.html index.php; 7 | 8 | location /api { 9 | rewrite ^/api/ /api/index.php; 10 | } 11 | 12 | location ~ [^/]\.php(/|$) { 13 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 14 | fastcgi_index index.php; 15 | include fastcgi_params; 16 | fastcgi_param HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerability. 17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 18 | if ( -f $document_root$fastcgi_script_name ) { 19 | fastcgi_pass unix:/var/run/php8-fpm.sock; 20 | } 21 | } 22 | # deny access to .htaccess (Apache) 23 | location ~ /\.ht { 24 | deny all; 25 | } 26 | # deny access to web.config (IIS) 27 | location ~ /web\.config { 28 | deny all; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /server/php/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es6", 7 | "dom" 8 | ], 9 | "strict": false, 10 | "esModuleInterop": true, 11 | "resolveJsonModule": true, 12 | "sourceMap": true, 13 | }, 14 | "exclude": [ 15 | "wwwroot/*" 16 | ] 17 | } --------------------------------------------------------------------------------