From 0478c13e4503a8c1a75155b1e277b8cc53ce149a Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Wed, 4 Nov 2026 22:16:41 +0300 Subject: [PATCH] Import the base tree (MIT, see LICENSE) --- .gitattributes | 8 + .githooks/pre-commit | 3 + .github/FUNDING.yml | 1 + .github/ISSUE_TEMPLATE/1-crash.yml | 100 + .github/ISSUE_TEMPLATE/2-graphics.yml | 74 + .github/ISSUE_TEMPLATE/3-performance.yml | 108 + .github/ISSUE_TEMPLATE/4-bug.yml | 94 + .github/ISSUE_TEMPLATE/5-feature.yml | 17 + .github/ISSUE_TEMPLATE/config.yml | 5 + .github/workflows/content-guard.yml | 15 + .gitignore | 76 + AGENTS.md | 34 + CLAUDE.md | 1 + CONTRIBUTING.md | 42 + LICENSE | 21 + README.md | 92 + THIRD_PARTY_NOTICES.md | 107 + VERSION | 1 + config.example.toml | 18 + docs/architecture.md | 148 + docs/building.md | 263 + docs/cheats.md | 74 + docs/controls.md | 183 + docs/installer.md | 238 + docs/maxwell.md | 235 + docs/mods.md | 107 + docs/tester-guide.md | 109 + installer/__init__.py | 11 + installer/__main__.py | 5 + installer/cli.py | 94 + installer/events.py | 123 + installer/gui.py | 679 + installer/guilogic.py | 405 + installer/hostcheck.c | 98 + installer/ini.py | 78 + installer/launcher/launcher.c | 51 + installer/launcher/launcher.rc | 3 + installer/layout.py | 193 + installer/runner.py | 151 + installer/state.py | 54 + installer/steps.py | 1267 ++ installer/text/en.json | 208 + installer/text/pt-BR.json | 208 + installer/text/ru.json | 208 + installer/text/zh-Hans.json | 208 + nx2navi.ini.example | 386 + recomp/flags.py | 144 + recomp/gen.py | 818 + recomp/jumptables.py | 1345 ++ recomp/layout.py | 61 + recomp/lifter.py | 805 + recomp/module.py | 112 + recomp/nso.py | 134 + recomp/patches-v110.txt | 957 + recomp/patches-v121.txt | 980 + recomp/patches-v143.txt | 1003 + recomp/patches.py | 158 + recomp/regs.py | 107 + recomp/simd_c.py | 1157 ++ runtime/amiibo.c | 400 + runtime/amiibo.h | 87 + runtime/astc_decode_spv.h | 1711 ++ runtime/astc_probe.c | 396 + runtime/audio_effects.c | 188 + runtime/audio_effects.h | 36 + runtime/audio_mixer.c | 971 + runtime/audio_reverb.c | 83 + runtime/audio_reverb.h | 19 + runtime/audren.c | 501 + runtime/audren.h | 189 + runtime/bc3_encode_spv.h | 253 + runtime/boot.c | 364 + runtime/camera_speed.c | 159 + runtime/cfg.c | 710 + runtime/cfg.h | 62 + runtime/cfg_probe.c | 475 + runtime/cheats.c | 667 + runtime/cheats.h | 48 + runtime/color_grade_spv.h | 71 + runtime/contact_shadow_spv.h | 156 + runtime/cpu.h | 361 + runtime/discord_rpc.c | 259 + runtime/dispatch.c | 219 + runtime/dispatch.h | 53 + runtime/dlaa_mask_spv.h | 66 + runtime/dlaa_mv_spv.h | 162 + runtime/dpi_probe_win.c | 33 + runtime/flight.c | 368 + runtime/flight.h | 22 + runtime/fma.c | 246 + runtime/folder_pick.h | 18 + runtime/folder_pick_sdl.c | 42 + runtime/folder_pick_win.cpp | 84 + runtime/frame_rate.c | 292 + runtime/fs.h | 60 + runtime/fs_host.c | 1791 ++ runtime/fsr_easu_spv.h | 1832 ++ runtime/fsr_rcas_spv.h | 424 + runtime/gfx.h | 147 + runtime/gfx_abi_probe.c | 128 + runtime/gfx_null.c | 157 + runtime/gfx_present.c | 836 + runtime/gfx_shader.c | 2143 ++ runtime/gfx_shader_probe.c | 228 + runtime/gfx_window_probe.c | 218 + runtime/gfx_window_sdl.c | 340 + runtime/gfx_window_win.c | 396 + runtime/gfx_wsys.h | 25 + runtime/hdr_encode_spv.h | 97 + runtime/hdr_fullscreen_spv.h | 36 + runtime/hdr_tonemap_spv.h | 290 + runtime/hdr_ui_spv.h | 73 + runtime/host.h | 327 + runtime/hostfn.c | 229 + runtime/input.c | 872 + runtime/input.h | 102 + runtime/input_map.c | 397 + runtime/input_map.h | 143 + runtime/input_sdl.c | 227 + runtime/input_sdl.h | 26 + runtime/input_win.c | 239 + runtime/input_win.h | 9 + runtime/input_wsys.h | 20 + runtime/ipc.c | 797 + runtime/ipc.h | 68 + runtime/kernel.c | 2299 +++ runtime/kernel.h | 40 + runtime/kernel_probe.c | 756 + runtime/loader.c | 737 + runtime/main.c | 586 + runtime/memory.c | 669 + runtime/menu_cursor.c | 340 + runtime/mods.c | 457 + runtime/mods.h | 57 + runtime/mods_probe.c | 130 + runtime/motion_fusion.c | 154 + runtime/mouse_direct.c | 340 + runtime/movie.h | 38 + runtime/movie_probe.c | 478 + runtime/nfp.c | 230 + runtime/nfp.h | 14 + runtime/nvn.h | 1757 ++ runtime/nvn_api.h | 117 + runtime/nvn_api_cmd.c | 1222 ++ runtime/nvn_api_core.c | 638 + runtime/nvn_api_obj.c | 715 + runtime/nvn_ext.c | 425 + runtime/nvn_hmap.h | 76 + runtime/nvn_obj.h | 161 + runtime/nvn_pool_index.h | 93 + runtime/nvn_probe.c | 934 + runtime/nvn_procs.c | 78 + runtime/nvn_procs.inc | 538 + runtime/nvn_tex.c | 187 + runtime/nvn_tex.h | 22 + runtime/nvn_tex_probe.c | 104 + runtime/nx2navi.ico | Bin 0 -> 124342 bytes runtime/nx2navi.manifest | 24 + runtime/nx2navi.rc | 5 + runtime/ov.h | 14 + runtime/ov_gfx.c | 126 + runtime/ov_input.c | 515 + runtime/ov_media.c | 175 + runtime/ov_movie.c | 875 + runtime/ov_probe.c | 1092 + runtime/ov_system.c | 946 + runtime/ov_zstd.c | 248 + runtime/patches.c | 84 + runtime/perf.c | 325 + runtime/perfmon.c | 393 + runtime/perfmon.h | 55 + runtime/platform/common.c | 88 + runtime/platform/fp_x86.h | 12 + runtime/platform/linux.c | 1842 ++ runtime/platform/platform.h | 442 + runtime/platform/win32.c | 1787 ++ runtime/prof.h | 12 + runtime/prof_win.c | 371 + runtime/rdoc.c | 91 + runtime/resolution.c | 481 + runtime/restbl.c | 236 + runtime/restbl.h | 33 + runtime/romfs.c | 1177 ++ runtime/romfs_path.h | 31 + runtime/sha256.c | 130 + runtime/sha256.h | 16 + runtime/shaders/astc_decode.comp | 429 + runtime/shaders/bc3_encode.comp | 89 + runtime/shaders/color_grade.comp | 23 + runtime/shaders/contact_shadow.comp | 67 + runtime/shaders/dlaa_mv.comp | 63 + runtime/shaders/ffx/LICENSE.txt | 19 + runtime/shaders/ffx/ffx_a.h | 2656 +++ runtime/shaders/ffx/ffx_fsr1.h | 1199 ++ runtime/shaders/fsr_easu.comp | 46 + runtime/shaders/fsr_rcas.comp | 41 + runtime/shaders/hdr_encode.comp | 34 + runtime/shaders/hdr_fullscreen.vert | 8 + runtime/shaders/hdr_tonemap.frag | 74 + runtime/shaders/hdr_ui.frag | 27 + runtime/shaders/wb_merge.comp | 27 + runtime/simd.h | 841 + runtime/simd_fp.h | 412 + runtime/svc.c | 226 + runtime/swkbd.c | 208 + runtime/swkbd.h | 28 + runtime/swkbd_sdl.c | 21 + runtime/swkbd_win.c | 184 + runtime/sysinfo.c | 93 + runtime/sysinfo.h | 21 + runtime/tex.h | 68 + runtime/tex_astc.c | 525 + runtime/tex_astc_mt.c | 114 + runtime/tex_deswizzle.c | 130 + runtime/tex_probe.c | 602 + runtime/third_party/imgui/LICENSE.txt | 21 + .../imgui/backends/imgui_impl_vulkan.cpp | 1689 ++ .../imgui/backends/imgui_impl_vulkan.h | 222 + runtime/third_party/imgui/imconfig.h | 141 + runtime/third_party/imgui/imgui.cpp | 17060 ++++++++++++++++ runtime/third_party/imgui/imgui.h | 3765 ++++ runtime/third_party/imgui/imgui_draw.cpp | 4828 +++++ runtime/third_party/imgui/imgui_internal.h | 3636 ++++ runtime/third_party/imgui/imgui_tables.cpp | 4525 ++++ runtime/third_party/imgui/imgui_widgets.cpp | 10451 ++++++++++ runtime/third_party/imgui/imstb_rectpack.h | 627 + runtime/third_party/imgui/imstb_textedit.h | 1469 ++ runtime/third_party/imgui/imstb_truetype.h | 5085 +++++ runtime/ui/amiibo_page.cpp | 305 + runtime/ui/amiibo_page.h | 4 + runtime/ui/binds_page.cpp | 249 + runtime/ui/binds_page.h | 10 + runtime/ui/cheats_tab.cpp | 66 + runtime/ui/fonts/LICENSE-Roboto.txt | 69 + runtime/ui/fonts/Roboto-Medium.ttf | Bin 0 -> 162588 bytes runtime/ui/menu.cpp | 1586 ++ runtime/ui/menu.h | 74 + runtime/ui/menu_sdl.cpp | 82 + runtime/ui/menu_win.cpp | 88 + runtime/ui/option_rows.cpp | 476 + runtime/ui/option_rows.h | 83 + runtime/ui_text.c | 2137 ++ runtime/ui_text.h | 267 + runtime/utf16.h | 59 + runtime/vk.h | 586 + runtime/vk_astc.c | 639 + runtime/vk_backend.c | 542 + runtime/vk_caps.c | 153 + runtime/vk_color.c | 188 + runtime/vk_contact.c | 188 + runtime/vk_crumbs.c | 265 + runtime/vk_device.c | 518 + runtime/vk_dlaa.c | 1273 ++ runtime/vk_dlaa.h | 48 + runtime/vk_dump.c | 924 + runtime/vk_exec.c | 975 + runtime/vk_exec.h | 202 + runtime/vk_exec_draw.c | 3279 +++ runtime/vk_exec_probe.c | 1038 + runtime/vk_exec_xfer.c | 618 + runtime/vk_formats.c | 170 + runtime/vk_fsr.c | 231 + runtime/vk_hdr.c | 659 + runtime/vk_headroom.c | 140 + runtime/vk_memory.c | 2407 +++ runtime/vk_mvcheck.c | 474 + runtime/vk_mvobj_fs.h | 39 + runtime/vk_mvprev.c | 219 + runtime/vk_mvsurvey.c | 258 + runtime/vk_pipeline.c | 3516 ++++ runtime/vk_rec.c | 725 + runtime/vk_rec.h | 163 + runtime/vk_sync.c | 554 + runtime/vk_texture.c | 1969 ++ runtime/vk_usnap.c | 356 + runtime/vk_vma.cpp | 7 + runtime/wb_merge_spv.h | 72 + tests/diff/atomic.py | 221 + tests/diff/common.py | 276 + tests/diff/func.py | 428 + tests/diff/harness.c | 162 + tests/diff/lift.py | 249 + tests/diff/simd.py | 242 + tests/excl_mt.py | 147 + tests/flags_check.c | 111 + tests/flags_check.py | 32 + tests/installer_e2e.py | 79 + tests/installer_gui_test.py | 451 + tests/installer_test.py | 655 + tests/jumptables_check.py | 809 + tests/mods_romfs_check.py | 178 + tests/mouse_direct_check.py | 311 + tests/ncz_test.py | 173 + tests/pack_shader_cache_test.py | 111 + tests/romfs_prompts_test.py | 590 + tests/spin_waits_test.py | 80 + tests/worktree_test.py | 130 + tools/ab_summary.py | 42 + tools/build_game.py | 974 + tools/build_hactool.py | 94 + tools/build_shaders.py | 89 + tools/build_xlate.py | 186 + tools/button_icons.py | 490 + tools/cheats.py | 374 + tools/check_content.py | 94 + tools/check_isa.py | 154 + tools/check_platform.py | 93 + tools/crit_path.py | 120 + tools/data/expected-v1.0.0.json | 32 + tools/data/expected-v1.1.0.json | 25 + tools/data/expected-v1.1.2.json | 30 + tools/data/expected-v1.2.1.json | 30 + tools/data/expected-v1.4.3.json | 30 + tools/exefs_patches.py | 230 + tools/extract.py | 349 + tools/extract_fonts.py | 49 + tools/fetch_refs.sh | 40 + tools/flight_view.py | 136 + tools/gen_nvn_procs.py | 52 + tools/hactool/mbedtls-asm-clobbers.patch | 20 + tools/hactool/portable.patch | 43 + tools/hactool/unicode.patch | 62 + tools/hostmem.py | 52 + tools/input/load_save.txt | 5 + tools/make_dlaa_mask.py | 203 + tools/make_mvobj_fs.py | 163 + tools/make_release.py | 618 + tools/make_release_linux.py | 594 + tools/make_romfs_patches.py | 370 + tools/ncz.py | 231 + tools/pack_shader_cache.py | 145 + tools/package_build.py | 113 + tools/perf_summary.py | 124 + tools/pgo.py | 84 + tools/prepare_shaders.py | 221 + tools/prof_report.py | 142 + tools/requirements-installer.txt | 9 + tools/requirements-py314.txt | 20 + tools/requirements.txt | 36 + tools/romfs_index.py | 110 + tools/run_game.py | 209 + tools/shader_census.py | 359 + tools/shader_list.py | 32 + tools/spin_waits.py | 431 + tools/ultrawide_layout.py | 289 + tools/vendor/macnativegames/LICENSE | 21 + tools/vendor/macnativegames/README.md | 14 + tools/vendor/macnativegames/extract_exefs.py | 250 + tools/vendor/macnativegames/extract_romfs.py | 83 + .../macnativegames/extract_shared_fonts.py | 202 + .../macnativegames/extract_update_romfs.py | 141 + tools/vendor/ryujinx/.gitignore | 2 + tools/vendor/ryujinx/Directory.Build.props | 7 + tools/vendor/ryujinx/Directory.Packages.props | 104 + tools/vendor/ryujinx/LICENSE.txt | 9 + tools/vendor/ryujinx/README.md | 8 + .../src/Ryujinx.Common/AsyncWorkQueue.cs | 102 + .../src/Ryujinx.Common/Collections/BitMap.cs | 226 + .../Collections/IntervalTree.cs | 507 + .../Collections/IntrusiveRedBlackTree.cs | 353 + .../Collections/IntrusiveRedBlackTreeImpl.cs | 361 + .../Collections/IntrusiveRedBlackTreeNode.cs | 15 + .../Collections/TreeDictionary.cs | 632 + .../Configuration/AntiAliasing.cs | 15 + .../Configuration/AppDataManager.cs | 328 + .../Configuration/AspectRatioExtensions.cs | 70 + .../Configuration/BackendThreading.cs | 12 + .../Ryujinx.Common/Configuration/DirtyHack.cs | 62 + .../DownloadableContentContainer.cs | 13 + ...ownloadableContentJsonSerializerContext.cs | 11 + .../Configuration/DownloadableContentNca.cs | 14 + .../Configuration/GraphicsBackend.cs | 11 + .../Configuration/GraphicsDebugLevel.cs | 13 + .../Configuration/Hid/AssignedInputDevice.cs | 11 + .../Hid/AssignedInputDeviceType.cs | 11 + .../Hid/Controller/GamepadInputId.cs | 58 + .../GenericControllerInputConfig.cs | 87 + .../Controller/JoyconConfigControllerStick.cs | 13 + .../Hid/Controller/LedConfigController.cs | 25 + .../Motion/CemuHookMotionConfigController.cs | 30 + .../JsonMotionConfigControllerConverter.cs | 79 + .../Motion/MotionConfigController.cs | 25 + .../MotionConfigJsonSerializerContext.cs | 12 + .../Motion/MotionInputBackendType.cs | 12 + .../Motion/StandardMotionConfigController.cs | 4 + .../Hid/Controller/RumbleConfigController.cs | 25 + .../StandardControllerInputConfig.cs | 4 + .../Hid/Controller/StickInputId.cs | 14 + .../Configuration/Hid/ControllerType.cs | 22 + .../Hid/GenericInputConfigurationCommon.cs | 15 + .../Configuration/Hid/InputBackendType.cs | 13 + .../Configuration/Hid/InputConfig.cs | 52 + .../Hid/InputConfigJsonSerializerContext.cs | 14 + .../Hid/JsonInputConfigConverter.cs | 81 + .../Ryujinx.Common/Configuration/Hid/Key.cs | 142 + .../Keyboard/GenericKeyboardInputConfig.cs | 15 + .../Hid/Keyboard/JoyconConfigKeyboardStick.cs | 11 + .../Keyboard/StandardKeyboardInputConfig.cs | 4 + .../Configuration/Hid/KeyboardHotkeys.cs | 19 + .../Hid/LeftJoyconCommonConfig.cs | 15 + .../Configuration/Hid/PhysicalKey.cs | 142 + .../Configuration/Hid/PlayerIndex.cs | 21 + .../Hid/PlayerInputAssignment.cs | 13 + .../Hid/PlayerInputAssignmentHelper.cs | 166 + .../Hid/RightJoyconCommonConfig.cs | 15 + .../Configuration/HideCursorMode.cs | 9 + .../Configuration/MemoryManagerMode.cs | 12 + .../src/Ryujinx.Common/Configuration/Mod.cs | 9 + .../Configuration/ModMetadata.cs | 14 + .../ModMetadataJsonSerializerContext.cs | 10 + .../Multiplayer/MultiplayerMode.cs | 9 + .../Configuration/ScalingFilter.cs | 13 + .../Configuration/TitleUpdateMetadata.cs | 10 + ...itleUpdateMetadataJsonSerializerContext.cs | 10 + .../Ryujinx.Common/Configuration/VSyncMode.cs | 21 + .../Extensions/BinaryReaderExtensions.cs | 14 + .../Extensions/BinaryWriterExtensions.cs | 27 + .../Extensions/SequenceReaderExtensions.cs | 182 + .../Extensions/StreamExtensions.cs | 138 + .../GraphicsDriver/DriverUtilities.cs | 42 + .../GraphicsDriver/NVAPI/Nvapi.cs | 11 + .../NVAPI/NvapiUnicodeString.cs | 42 + .../NVAPI/NvdrsApplicationV4.cs | 17 + .../GraphicsDriver/NVAPI/NvdrsProfile.cs | 15 + .../GraphicsDriver/NVAPI/NvdrsSetting.cs | 49 + .../GraphicsDriver/NVThreadedOptimization.cs | 161 + .../ryujinx/src/Ryujinx.Common/Hash128.cs | 739 + .../Ryujinx.Common/Helpers/ConsoleHelper.cs | 64 + .../Helpers/FileAssociationHelper.cs | 195 + .../src/Ryujinx.Common/Helpers/LinuxHelper.cs | 62 + .../src/Ryujinx.Common/Helpers/ObjectiveC.cs | 159 + .../src/Ryujinx.Common/Helpers/OpenHelper.cs | 115 + .../src/Ryujinx.Common/Helpers/Patterns.cs | 126 + .../src/Ryujinx.Common/Helpers/RefEvent.cs | 58 + .../Ryujinx.Common/Helpers/RunningPlatform.cs | 46 + .../Logging/Formatters/DefaultLogFormatter.cs | 51 + .../Formatters/DynamicObjectFormatter.cs | 84 + .../Logging/Formatters/ILogFormatter.cs | 7 + .../src/Ryujinx.Common/Logging/LogClass.cs | 79 + .../Ryujinx.Common/Logging/LogEventArgs.cs | 23 + .../src/Ryujinx.Common/Logging/LogLevel.cs | 19 + .../src/Ryujinx.Common/Logging/Logger.cs | 266 + .../Logging/Targets/AsyncLogTargetWrapper.cs | 117 + .../Logging/Targets/ConsoleLogTarget.cs | 44 + .../Logging/Targets/FileLogTarget.cs | 109 + .../Logging/Targets/ILogTarget.cs | 11 + .../Logging/XCIFileTrimmerLog.cs | 30 + .../src/Ryujinx.Common/Memory/ArrayPtr.cs | 123 + .../ryujinx/src/Ryujinx.Common/Memory/Box.cs | 12 + .../src/Ryujinx.Common/Memory/IArray.cs | 28 + .../src/Ryujinx.Common/Memory/MemoryOwner.cs | 256 + .../Memory/MemoryStreamManager.cs | 114 + .../PartialUnmaps/NativeReaderWriterLock.cs | 85 + .../PartialUnmaps/PartialUnmapHelpers.cs | 20 + .../Memory/PartialUnmaps/PartialUnmapState.cs | 161 + .../Memory/PartialUnmaps/ThreadLocalMap.cs | 95 + .../ryujinx/src/Ryujinx.Common/Memory/Ptr.cs | 68 + .../src/Ryujinx.Common/Memory/SpanOwner.cs | 114 + .../src/Ryujinx.Common/Memory/SpanReader.cs | 74 + .../src/Ryujinx.Common/Memory/SpanWriter.cs | 45 + .../Memory/StructArrayHelpers.cs | 847 + .../Memory/StructByteArrayHelpers.cs | 89 + .../src/Ryujinx.Common/PerformanceCounter.cs | 82 + .../src/Ryujinx.Common/Pools/ObjectPool.cs | 34 + .../src/Ryujinx.Common/Pools/SharedPools.cs | 17 + .../Ryujinx.Common/Pools/ThreadStaticArray.cs | 17 + .../PreciseSleep/IPreciseSleepEvent.cs | 38 + .../Ryujinx.Common/PreciseSleep/Nanosleep.cs | 160 + .../PreciseSleep/NanosleepEvent.cs | 85 + .../PreciseSleep/NanosleepPool.cs | 228 + .../PreciseSleep/PreciseSleepHelper.cs | 104 + .../Ryujinx.Common/PreciseSleep/SleepEvent.cs | 51 + .../PreciseSleep/WindowsGranularTimer.cs | 220 + .../PreciseSleep/WindowsSleepEvent.cs | 92 + .../src/Ryujinx.Common/ReactiveObject.cs | 89 + .../src/Ryujinx.Common/ReleaseInformation.cs | 37 + .../src/Ryujinx.Common/Ryujinx.Common.csproj | 17 + .../src/Ryujinx.Common/RyujinxException.cs | 10 + .../src/Ryujinx.Common/SharedConstants.cs | 19 + .../SystemInterop/DisplaySleep.cs | 35 + .../SystemInterop/ForceDpiAware.cs | 97 + .../SystemInterop/GdiPlusHelper.cs | 76 + .../SystemInterop/StdErrAdapter.cs | 103 + .../WindowsMultimediaTimerResolution.cs | 114 + .../ryujinx/src/Ryujinx.Common/TitleIDs.cs | 253 + .../src/Ryujinx.Common/UI/UserError.cs | 39 + .../src/Ryujinx.Common/Utilities/BitUtils.cs | 76 + .../Utilities/BitfieldExtensions.cs | 57 + .../src/Ryujinx.Common/Utilities/Buffers.cs | 59 + .../Utilities/CommonJsonContext.cs | 11 + .../Utilities/EmbeddedResources.cs | 152 + .../Utilities/FileSystemUtils.cs | 56 + .../src/Ryujinx.Common/Utilities/HexUtils.cs | 90 + .../Ryujinx.Common/Utilities/JsonHelper.cs | 86 + .../Utilities/MessagePackObjectFormatter.cs | 299 + .../Utilities/NetworkHelpers.cs | 89 + .../src/Ryujinx.Common/Utilities/OsUtils.cs | 49 + .../src/Ryujinx.Common/Utilities/Rainbow.cs | 131 + .../Ryujinx.Common/Utilities/SpanHelpers.cs | 61 + .../Ryujinx.Common/Utilities/StreamUtils.cs | 90 + .../Ryujinx.Common/Utilities/UInt128Utils.cs | 20 + .../Utilities/XCIFileTrimmer.cs | 524 + .../Ryujinx.Graphics.Shader/AlphaTestOp.cs | 14 + .../Ryujinx.Graphics.Shader/AttributeType.cs | 45 + .../BufferDescriptor.cs | 34 + .../BufferUsageFlags.cs | 18 + .../CodeGen/CodeGenParameters.cs | 31 + .../CodeGen/Glsl/CodeGenContext.cs | 105 + .../CodeGen/Glsl/Declarations.cs | 659 + .../CodeGen/Glsl/DefaultNames.cs | 15 + .../CodeGen/Glsl/GlslGenerator.cs | 177 + .../HelperFunctions/HelperFunctionNames.cs | 10 + .../Glsl/HelperFunctions/MultiplyHighS32.glsl | 7 + .../Glsl/HelperFunctions/MultiplyHighU32.glsl | 7 + .../Glsl/HelperFunctions/SwizzleAdd.glsl | 7 + .../CodeGen/Glsl/Instructions/InstGen.cs | 208 + .../Glsl/Instructions/InstGenBallot.cs | 28 + .../CodeGen/Glsl/Instructions/InstGenCall.cs | 29 + .../CodeGen/Glsl/Instructions/InstGenFSI.cs | 29 + .../Glsl/Instructions/InstGenHelper.cs | 222 + .../Glsl/Instructions/InstGenMemory.cs | 701 + .../Glsl/Instructions/InstGenPacking.cs | 56 + .../Glsl/Instructions/InstGenShuffle.cs | 25 + .../Glsl/Instructions/InstGenVector.cs | 32 + .../CodeGen/Glsl/Instructions/InstInfo.cs | 18 + .../CodeGen/Glsl/Instructions/InstType.cs | 33 + .../CodeGen/Glsl/Instructions/IoMap.cs | 144 + .../CodeGen/Glsl/NumberFormatter.cs | 104 + .../CodeGen/Glsl/OperandManager.cs | 178 + .../CodeGen/Glsl/TypeConversion.cs | 93 + .../CodeGen/Spirv/CodeGenContext.cs | 375 + .../CodeGen/Spirv/Declarations.cs | 659 + .../CodeGen/Spirv/EnumConversion.cs | 22 + .../CodeGen/Spirv/ImageDeclaration.cs | 20 + .../CodeGen/Spirv/Instructions.cs | 2190 ++ .../CodeGen/Spirv/IoMap.cs | 124 + .../CodeGen/Spirv/OperationResult.cs | 19 + .../CodeGen/Spirv/SamplerDeclaration.cs | 27 + .../CodeGen/Spirv/SpirvDelegates.cs | 228 + .../CodeGen/Spirv/SpirvGenerator.cs | 425 + .../src/Ryujinx.Graphics.Shader/Constants.cs | 14 + .../Ryujinx.Graphics.Shader/Decoders/Block.cs | 168 + .../Decoders/DecodedFunction.cs | 48 + .../Decoders/DecodedProgram.cs | 78 + .../Decoders/Decoder.cs | 911 + .../Decoders/FunctionType.cs | 10 + .../Decoders/InstDecoders.cs | 5394 +++++ .../Decoders/InstName.cs | 188 + .../Decoders/InstOp.cs | 27 + .../Decoders/InstProps.cs | 31 + .../Decoders/InstTable.cs | 392 + .../Decoders/Register.cs | 36 + .../Decoders/RegisterConsts.cs | 13 + .../Decoders/RegisterType.cs | 9 + .../GpuGraphicsState.cs | 177 + .../Ryujinx.Graphics.Shader/IGpuAccessor.cs | 502 + .../src/Ryujinx.Graphics.Shader/ILogger.cs | 17 + .../Ryujinx.Graphics.Shader/InputTopology.cs | 47 + .../Instructions/AttributeMap.cs | 351 + .../Instructions/InstEmit.cs | 359 + .../Instructions/InstEmitAluHelper.cs | 159 + .../Instructions/InstEmitAttribute.cs | 409 + .../Instructions/InstEmitBarrier.cs | 46 + .../Instructions/InstEmitBitfield.cs | 194 + .../Instructions/InstEmitConditionCode.cs | 86 + .../Instructions/InstEmitConversion.cs | 424 + .../Instructions/InstEmitFloatArithmetic.cs | 531 + .../Instructions/InstEmitFloatComparison.cs | 570 + .../Instructions/InstEmitFloatMinMax.cs | 106 + .../Instructions/InstEmitFlowControl.cs | 328 + .../Instructions/InstEmitHelper.cs | 260 + .../Instructions/InstEmitIntegerArithmetic.cs | 701 + .../Instructions/InstEmitIntegerComparison.cs | 319 + .../Instructions/InstEmitIntegerLogical.cs | 166 + .../Instructions/InstEmitIntegerMinMax.cs | 71 + .../Instructions/InstEmitMemory.cs | 604 + .../Instructions/InstEmitMove.cs | 278 + .../Instructions/InstEmitMultifunction.cs | 97 + .../Instructions/InstEmitNop.cs | 15 + .../Instructions/InstEmitPredicate.cs | 116 + .../Instructions/InstEmitShift.cs | 249 + .../Instructions/InstEmitSurface.cs | 799 + .../Instructions/InstEmitTexture.cs | 1336 ++ .../Instructions/InstEmitVideoArithmetic.cs | 117 + .../Instructions/InstEmitVideoMinMax.cs | 183 + .../Instructions/InstEmitWarp.cs | 144 + .../Instructions/InstEmitter.cs | 6 + .../Instructions/Lop3Expression.cs | 142 + .../IntermediateRepresentation/BasicBlock.cs | 91 + .../IntermediateRepresentation/CommentNode.cs | 12 + .../IntermediateRepresentation/Function.cs | 23 + .../IntermediateRepresentation/INode.cs | 15 + .../IntermediateRepresentation/Instruction.cs | 197 + .../IntermediateRepresentation/IoVariable.cs | 49 + .../IntermediateRepresentation/IrConsts.cs | 8 + .../IntermediateRepresentation/Operand.cs | 79 + .../OperandHelper.cs | 62 + .../IntermediateRepresentation/OperandType.cs | 13 + .../IntermediateRepresentation/Operation.cs | 294 + .../IntermediateRepresentation/PhiNode.cs | 104 + .../IntermediateRepresentation/StorageKind.cs | 45 + .../TextureFlags.cs | 32 + .../TextureOperation.cs | 69 + .../Ryujinx.Graphics.Shader/OutputTopology.cs | 24 + .../ResourceReservationCounts.cs | 22 + .../Ryujinx.Graphics.Shader.csproj | 18 + .../Ryujinx.Graphics.Shader/SamplerType.cs | 168 + .../Ryujinx.Graphics.Shader/SetBindingPair.cs | 4 + .../Ryujinx.Graphics.Shader/ShaderProgram.cs | 35 + .../ShaderProgramInfo.cs | 57 + .../Ryujinx.Graphics.Shader/ShaderStage.cs | 36 + .../StructuredIr/AstAssignment.cs | 35 + .../StructuredIr/AstBlock.cs | 117 + .../StructuredIr/AstBlockType.cs | 12 + .../StructuredIr/AstBlockVisitor.cs | 68 + .../StructuredIr/AstComment.cs | 12 + .../StructuredIr/AstHelper.cs | 75 + .../StructuredIr/AstNode.cs | 11 + .../StructuredIr/AstOperand.cs | 38 + .../StructuredIr/AstOperation.cs | 94 + .../StructuredIr/AstOptimizer.cs | 154 + .../StructuredIr/AstTextureOperation.cs | 49 + .../StructuredIr/BufferDefinition.cs | 20 + .../StructuredIr/BufferLayout.cs | 8 + .../StructuredIr/GotoElimination.cs | 458 + .../StructuredIr/GotoStatement.cs | 23 + .../StructuredIr/HelperFunctionsMask.cs | 13 + .../StructuredIr/IAstNode.cs | 11 + .../StructuredIr/InstructionInfo.cs | 208 + .../StructuredIr/IoDefinition.cs | 44 + .../StructuredIr/MemoryDefinition.cs | 18 + .../StructuredIr/OperandInfo.cs | 32 + .../StructuredIr/PhiFunctions.cs | 49 + .../StructuredIr/ShaderProperties.cs | 110 + .../StructuredIr/StructureType.cs | 28 + .../StructuredIr/StructuredFunction.cs | 42 + .../StructuredIr/StructuredProgram.cs | 467 + .../StructuredIr/StructuredProgramContext.cs | 354 + .../StructuredIr/StructuredProgramInfo.cs | 20 + .../StructuredIr/TextureDefinition.cs | 43 + .../Ryujinx.Graphics.Shader/SupportBuffer.cs | 99 + .../Ryujinx.Graphics.Shader/TessPatchType.cs | 22 + .../Ryujinx.Graphics.Shader/TessSpacing.cs | 22 + .../TextureDescriptor.cs | 43 + .../Ryujinx.Graphics.Shader/TextureFormat.cs | 130 + .../Ryujinx.Graphics.Shader/TextureHandle.cs | 125 + .../TextureUsageFlags.cs | 19 + .../Translation/AggregateType.cs | 59 + .../Translation/AttributeConsts.cs | 38 + .../Translation/AttributeUsage.cs | 168 + .../Translation/ControlFlowGraph.cs | 176 + .../Translation/Dominance.cs | 94 + .../Translation/EmitterContext.cs | 628 + .../Translation/EmitterContextInsts.cs | 1045 + .../Translation/FeatureFlags.cs | 30 + .../Translation/FunctionMatch.cs | 865 + .../Translation/HelperFunctionManager.cs | 474 + .../Translation/HelperFunctionName.cs | 20 + .../Translation/HostCapabilities.cs | 40 + .../Translation/IoUsage.cs | 28 + .../Optimizations/BindlessElimination.cs | 494 + .../Optimizations/BindlessToArray.cs | 238 + .../Optimizations/BranchElimination.cs | 60 + .../Optimizations/ConstantFolding.cs | 352 + .../Optimizations/DoubleToFloat.cs | 70 + .../Optimizations/GlobalToStorage.cs | 1177 ++ .../Translation/Optimizations/Optimizer.cs | 458 + .../Optimizations/Simplification.cs | 236 + .../Translation/Optimizations/Utils.cs | 202 + .../Optimizations/XmadOptimizer.cs | 342 + .../Translation/RegisterUsage.cs | 491 + .../Translation/ResourceManager.cs | 649 + .../Translation/ResourceReservations.cs | 203 + .../Translation/ShaderDefinitions.cs | 355 + .../Translation/ShaderHeader.cs | 170 + .../Translation/Ssa.cs | 375 + .../Translation/TargetApi.cs | 8 + .../Translation/TargetLanguage.cs | 9 + .../Translation/TransformContext.cs | 39 + .../Translation/TransformFeedbackOutput.cs | 18 + .../Transforms/DrawParametersReplace.cs | 93 + .../Transforms/ForcePreciseEnable.cs | 36 + .../Transforms/GeometryToCompute.cs | 380 + .../Translation/Transforms/ITransformPass.cs | 11 + .../Transforms/SharedAtomicSignedCas.cs | 58 + .../Transforms/SharedStoreSmallIntCas.cs | 57 + .../Translation/Transforms/ShufflePass.cs | 52 + .../Translation/Transforms/TexturePass.cs | 749 + .../Translation/Transforms/TransformPasses.cs | 44 + .../Transforms/VectorComponentSelect.cs | 96 + .../Translation/Transforms/VertexToCompute.cs | 369 + .../Translation/TranslationFlags.cs | 14 + .../Translation/TranslationOptions.cs | 16 + .../Translation/Translator.cs | 397 + .../Translation/TranslatorContext.cs | 674 + .../VertexInfoBuffer.cs | 58 + .../Autogenerated/CoreGrammar.cs | 5387 +++++ .../Autogenerated/GlslStd450Grammar.cs | 438 + .../Autogenerated/OpenClGrammar.cs | 840 + .../ryujinx/src/Spv.Generator/ConstantKey.cs | 30 + .../Spv.Generator/DeterministicHashCode.cs | 109 + .../Spv.Generator/DeterministicStringKey.cs | 29 + .../src/Spv.Generator/GeneratorPool.cs | 56 + .../ryujinx/src/Spv.Generator/IOperand.cs | 14 + .../ryujinx/src/Spv.Generator/Instruction.cs | 247 + .../src/Spv.Generator/InstructionOperands.cs | 72 + .../vendor/ryujinx/src/Spv.Generator/LICENSE | 23 + .../src/Spv.Generator/LiteralInteger.cs | 105 + .../src/Spv.Generator/LiteralString.cs | 54 + .../ryujinx/src/Spv.Generator/Module.cs | 368 + .../ryujinx/src/Spv.Generator/OperandType.cs | 10 + .../src/Spv.Generator/Spv.Generator.csproj | 7 + .../src/Spv.Generator/TypeDeclarationKey.cs | 30 + .../vendor/ryujinx/src/Spv.Generator/spirv.cs | 1624 ++ tools/worktree.py | 169 + tools/xlate/LICENSE | 21 + tools/xlate/Program.cs | 195 + tools/xlate/nx2navi_xlate.csproj | 16 + ...001-keep-call-arguments-in-variables.patch | 15 + ...call-sources-when-removing-dead-node.patch | 20 + ...ect-assignments-in-the-ast-optimizer.patch | 57 + .../patches/0004-no-else-if-flattening.patch | 26 + ...e-storage-image-write-without-format.patch | 36 + ...6-initialise-unlinked-vertex-outputs.patch | 40 + .../0007-position-always-invariant.patch | 25 + .../0008-point-size-from-support-buffer.patch | 40 + ...09-round-d16-array-compare-reference.patch | 21 + .../0010-pcss-for-cascade-compares.patch | 135 + .../patches/0011-shadow-filter-spread.patch | 82 + .../0012-bitfield-fields-past-bit-31.patch | 64 + .../patches/0013-funnel-shift-by-zero.patch | 32 + .../0015-motion-previous-position.patch | 376 + .../patches/0016-zero-locals-job-flag.patch | 71 + tools/xlate_smoke.py | 77 + 734 files changed, 233953 insertions(+) create mode 100644 .gitattributes create mode 100644 .githooks/pre-commit create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/1-crash.yml create mode 100644 .github/ISSUE_TEMPLATE/2-graphics.yml create mode 100644 .github/ISSUE_TEMPLATE/3-performance.yml create mode 100644 .github/ISSUE_TEMPLATE/4-bug.yml create mode 100644 .github/ISSUE_TEMPLATE/5-feature.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/workflows/content-guard.yml create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 CLAUDE.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 THIRD_PARTY_NOTICES.md create mode 100644 VERSION create mode 100644 config.example.toml create mode 100644 docs/architecture.md create mode 100644 docs/building.md create mode 100644 docs/cheats.md create mode 100644 docs/controls.md create mode 100644 docs/installer.md create mode 100644 docs/maxwell.md create mode 100644 docs/mods.md create mode 100644 docs/tester-guide.md create mode 100644 installer/__init__.py create mode 100644 installer/__main__.py create mode 100644 installer/cli.py create mode 100644 installer/events.py create mode 100644 installer/gui.py create mode 100644 installer/guilogic.py create mode 100644 installer/hostcheck.c create mode 100644 installer/ini.py create mode 100644 installer/launcher/launcher.c create mode 100644 installer/launcher/launcher.rc create mode 100644 installer/layout.py create mode 100644 installer/runner.py create mode 100644 installer/state.py create mode 100644 installer/steps.py create mode 100644 installer/text/en.json create mode 100644 installer/text/pt-BR.json create mode 100644 installer/text/ru.json create mode 100644 installer/text/zh-Hans.json create mode 100644 nx2navi.ini.example create mode 100644 recomp/flags.py create mode 100644 recomp/gen.py create mode 100644 recomp/jumptables.py create mode 100644 recomp/layout.py create mode 100644 recomp/lifter.py create mode 100644 recomp/module.py create mode 100644 recomp/nso.py create mode 100644 recomp/patches-v110.txt create mode 100644 recomp/patches-v121.txt create mode 100644 recomp/patches-v143.txt create mode 100644 recomp/patches.py create mode 100644 recomp/regs.py create mode 100644 recomp/simd_c.py create mode 100644 runtime/amiibo.c create mode 100644 runtime/amiibo.h create mode 100644 runtime/astc_decode_spv.h create mode 100644 runtime/astc_probe.c create mode 100644 runtime/audio_effects.c create mode 100644 runtime/audio_effects.h create mode 100644 runtime/audio_mixer.c create mode 100644 runtime/audio_reverb.c create mode 100644 runtime/audio_reverb.h create mode 100644 runtime/audren.c create mode 100644 runtime/audren.h create mode 100644 runtime/bc3_encode_spv.h create mode 100644 runtime/boot.c create mode 100644 runtime/camera_speed.c create mode 100644 runtime/cfg.c create mode 100644 runtime/cfg.h create mode 100644 runtime/cfg_probe.c create mode 100644 runtime/cheats.c create mode 100644 runtime/cheats.h create mode 100644 runtime/color_grade_spv.h create mode 100644 runtime/contact_shadow_spv.h create mode 100644 runtime/cpu.h create mode 100644 runtime/discord_rpc.c create mode 100644 runtime/dispatch.c create mode 100644 runtime/dispatch.h create mode 100644 runtime/dlaa_mask_spv.h create mode 100644 runtime/dlaa_mv_spv.h create mode 100644 runtime/dpi_probe_win.c create mode 100644 runtime/flight.c create mode 100644 runtime/flight.h create mode 100644 runtime/fma.c create mode 100644 runtime/folder_pick.h create mode 100644 runtime/folder_pick_sdl.c create mode 100644 runtime/folder_pick_win.cpp create mode 100644 runtime/frame_rate.c create mode 100644 runtime/fs.h create mode 100644 runtime/fs_host.c create mode 100644 runtime/fsr_easu_spv.h create mode 100644 runtime/fsr_rcas_spv.h create mode 100644 runtime/gfx.h create mode 100644 runtime/gfx_abi_probe.c create mode 100644 runtime/gfx_null.c create mode 100644 runtime/gfx_present.c create mode 100644 runtime/gfx_shader.c create mode 100644 runtime/gfx_shader_probe.c create mode 100644 runtime/gfx_window_probe.c create mode 100644 runtime/gfx_window_sdl.c create mode 100644 runtime/gfx_window_win.c create mode 100644 runtime/gfx_wsys.h create mode 100644 runtime/hdr_encode_spv.h create mode 100644 runtime/hdr_fullscreen_spv.h create mode 100644 runtime/hdr_tonemap_spv.h create mode 100644 runtime/hdr_ui_spv.h create mode 100644 runtime/host.h create mode 100644 runtime/hostfn.c create mode 100644 runtime/input.c create mode 100644 runtime/input.h create mode 100644 runtime/input_map.c create mode 100644 runtime/input_map.h create mode 100644 runtime/input_sdl.c create mode 100644 runtime/input_sdl.h create mode 100644 runtime/input_win.c create mode 100644 runtime/input_win.h create mode 100644 runtime/input_wsys.h create mode 100644 runtime/ipc.c create mode 100644 runtime/ipc.h create mode 100644 runtime/kernel.c create mode 100644 runtime/kernel.h create mode 100644 runtime/kernel_probe.c create mode 100644 runtime/loader.c create mode 100644 runtime/main.c create mode 100644 runtime/memory.c create mode 100644 runtime/menu_cursor.c create mode 100644 runtime/mods.c create mode 100644 runtime/mods.h create mode 100644 runtime/mods_probe.c create mode 100644 runtime/motion_fusion.c create mode 100644 runtime/mouse_direct.c create mode 100644 runtime/movie.h create mode 100644 runtime/movie_probe.c create mode 100644 runtime/nfp.c create mode 100644 runtime/nfp.h create mode 100644 runtime/nvn.h create mode 100644 runtime/nvn_api.h create mode 100644 runtime/nvn_api_cmd.c create mode 100644 runtime/nvn_api_core.c create mode 100644 runtime/nvn_api_obj.c create mode 100644 runtime/nvn_ext.c create mode 100644 runtime/nvn_hmap.h create mode 100644 runtime/nvn_obj.h create mode 100644 runtime/nvn_pool_index.h create mode 100644 runtime/nvn_probe.c create mode 100644 runtime/nvn_procs.c create mode 100644 runtime/nvn_procs.inc create mode 100644 runtime/nvn_tex.c create mode 100644 runtime/nvn_tex.h create mode 100644 runtime/nvn_tex_probe.c create mode 100644 runtime/nx2navi.ico create mode 100644 runtime/nx2navi.manifest create mode 100644 runtime/nx2navi.rc create mode 100644 runtime/ov.h create mode 100644 runtime/ov_gfx.c create mode 100644 runtime/ov_input.c create mode 100644 runtime/ov_media.c create mode 100644 runtime/ov_movie.c create mode 100644 runtime/ov_probe.c create mode 100644 runtime/ov_system.c create mode 100644 runtime/ov_zstd.c create mode 100644 runtime/patches.c create mode 100644 runtime/perf.c create mode 100644 runtime/perfmon.c create mode 100644 runtime/perfmon.h create mode 100644 runtime/platform/common.c create mode 100644 runtime/platform/fp_x86.h create mode 100644 runtime/platform/linux.c create mode 100644 runtime/platform/platform.h create mode 100644 runtime/platform/win32.c create mode 100644 runtime/prof.h create mode 100644 runtime/prof_win.c create mode 100644 runtime/rdoc.c create mode 100644 runtime/resolution.c create mode 100644 runtime/restbl.c create mode 100644 runtime/restbl.h create mode 100644 runtime/romfs.c create mode 100644 runtime/romfs_path.h create mode 100644 runtime/sha256.c create mode 100644 runtime/sha256.h create mode 100644 runtime/shaders/astc_decode.comp create mode 100644 runtime/shaders/bc3_encode.comp create mode 100644 runtime/shaders/color_grade.comp create mode 100644 runtime/shaders/contact_shadow.comp create mode 100644 runtime/shaders/dlaa_mv.comp create mode 100644 runtime/shaders/ffx/LICENSE.txt create mode 100644 runtime/shaders/ffx/ffx_a.h create mode 100644 runtime/shaders/ffx/ffx_fsr1.h create mode 100644 runtime/shaders/fsr_easu.comp create mode 100644 runtime/shaders/fsr_rcas.comp create mode 100644 runtime/shaders/hdr_encode.comp create mode 100644 runtime/shaders/hdr_fullscreen.vert create mode 100644 runtime/shaders/hdr_tonemap.frag create mode 100644 runtime/shaders/hdr_ui.frag create mode 100644 runtime/shaders/wb_merge.comp create mode 100644 runtime/simd.h create mode 100644 runtime/simd_fp.h create mode 100644 runtime/svc.c create mode 100644 runtime/swkbd.c create mode 100644 runtime/swkbd.h create mode 100644 runtime/swkbd_sdl.c create mode 100644 runtime/swkbd_win.c create mode 100644 runtime/sysinfo.c create mode 100644 runtime/sysinfo.h create mode 100644 runtime/tex.h create mode 100644 runtime/tex_astc.c create mode 100644 runtime/tex_astc_mt.c create mode 100644 runtime/tex_deswizzle.c create mode 100644 runtime/tex_probe.c create mode 100644 runtime/third_party/imgui/LICENSE.txt create mode 100644 runtime/third_party/imgui/backends/imgui_impl_vulkan.cpp create mode 100644 runtime/third_party/imgui/backends/imgui_impl_vulkan.h create mode 100644 runtime/third_party/imgui/imconfig.h create mode 100644 runtime/third_party/imgui/imgui.cpp create mode 100644 runtime/third_party/imgui/imgui.h create mode 100644 runtime/third_party/imgui/imgui_draw.cpp create mode 100644 runtime/third_party/imgui/imgui_internal.h create mode 100644 runtime/third_party/imgui/imgui_tables.cpp create mode 100644 runtime/third_party/imgui/imgui_widgets.cpp create mode 100644 runtime/third_party/imgui/imstb_rectpack.h create mode 100644 runtime/third_party/imgui/imstb_textedit.h create mode 100644 runtime/third_party/imgui/imstb_truetype.h create mode 100644 runtime/ui/amiibo_page.cpp create mode 100644 runtime/ui/amiibo_page.h create mode 100644 runtime/ui/binds_page.cpp create mode 100644 runtime/ui/binds_page.h create mode 100644 runtime/ui/cheats_tab.cpp create mode 100644 runtime/ui/fonts/LICENSE-Roboto.txt create mode 100644 runtime/ui/fonts/Roboto-Medium.ttf create mode 100644 runtime/ui/menu.cpp create mode 100644 runtime/ui/menu.h create mode 100644 runtime/ui/menu_sdl.cpp create mode 100644 runtime/ui/menu_win.cpp create mode 100644 runtime/ui/option_rows.cpp create mode 100644 runtime/ui/option_rows.h create mode 100644 runtime/ui_text.c create mode 100644 runtime/ui_text.h create mode 100644 runtime/utf16.h create mode 100644 runtime/vk.h create mode 100644 runtime/vk_astc.c create mode 100644 runtime/vk_backend.c create mode 100644 runtime/vk_caps.c create mode 100644 runtime/vk_color.c create mode 100644 runtime/vk_contact.c create mode 100644 runtime/vk_crumbs.c create mode 100644 runtime/vk_device.c create mode 100644 runtime/vk_dlaa.c create mode 100644 runtime/vk_dlaa.h create mode 100644 runtime/vk_dump.c create mode 100644 runtime/vk_exec.c create mode 100644 runtime/vk_exec.h create mode 100644 runtime/vk_exec_draw.c create mode 100644 runtime/vk_exec_probe.c create mode 100644 runtime/vk_exec_xfer.c create mode 100644 runtime/vk_formats.c create mode 100644 runtime/vk_fsr.c create mode 100644 runtime/vk_hdr.c create mode 100644 runtime/vk_headroom.c create mode 100644 runtime/vk_memory.c create mode 100644 runtime/vk_mvcheck.c create mode 100644 runtime/vk_mvobj_fs.h create mode 100644 runtime/vk_mvprev.c create mode 100644 runtime/vk_mvsurvey.c create mode 100644 runtime/vk_pipeline.c create mode 100644 runtime/vk_rec.c create mode 100644 runtime/vk_rec.h create mode 100644 runtime/vk_sync.c create mode 100644 runtime/vk_texture.c create mode 100644 runtime/vk_usnap.c create mode 100644 runtime/vk_vma.cpp create mode 100644 runtime/wb_merge_spv.h create mode 100644 tests/diff/atomic.py create mode 100644 tests/diff/common.py create mode 100644 tests/diff/func.py create mode 100644 tests/diff/harness.c create mode 100644 tests/diff/lift.py create mode 100644 tests/diff/simd.py create mode 100644 tests/excl_mt.py create mode 100644 tests/flags_check.c create mode 100644 tests/flags_check.py create mode 100644 tests/installer_e2e.py create mode 100644 tests/installer_gui_test.py create mode 100644 tests/installer_test.py create mode 100644 tests/jumptables_check.py create mode 100644 tests/mods_romfs_check.py create mode 100644 tests/mouse_direct_check.py create mode 100644 tests/ncz_test.py create mode 100644 tests/pack_shader_cache_test.py create mode 100644 tests/romfs_prompts_test.py create mode 100644 tests/spin_waits_test.py create mode 100644 tests/worktree_test.py create mode 100644 tools/ab_summary.py create mode 100644 tools/build_game.py create mode 100644 tools/build_hactool.py create mode 100644 tools/build_shaders.py create mode 100644 tools/build_xlate.py create mode 100644 tools/button_icons.py create mode 100644 tools/cheats.py create mode 100644 tools/check_content.py create mode 100644 tools/check_isa.py create mode 100644 tools/check_platform.py create mode 100644 tools/crit_path.py create mode 100644 tools/data/expected-v1.0.0.json create mode 100644 tools/data/expected-v1.1.0.json create mode 100644 tools/data/expected-v1.1.2.json create mode 100644 tools/data/expected-v1.2.1.json create mode 100644 tools/data/expected-v1.4.3.json create mode 100644 tools/exefs_patches.py create mode 100644 tools/extract.py create mode 100644 tools/extract_fonts.py create mode 100644 tools/fetch_refs.sh create mode 100644 tools/flight_view.py create mode 100644 tools/gen_nvn_procs.py create mode 100644 tools/hactool/mbedtls-asm-clobbers.patch create mode 100644 tools/hactool/portable.patch create mode 100644 tools/hactool/unicode.patch create mode 100644 tools/hostmem.py create mode 100644 tools/input/load_save.txt create mode 100644 tools/make_dlaa_mask.py create mode 100644 tools/make_mvobj_fs.py create mode 100644 tools/make_release.py create mode 100644 tools/make_release_linux.py create mode 100644 tools/make_romfs_patches.py create mode 100644 tools/ncz.py create mode 100644 tools/pack_shader_cache.py create mode 100644 tools/package_build.py create mode 100644 tools/perf_summary.py create mode 100644 tools/pgo.py create mode 100644 tools/prepare_shaders.py create mode 100644 tools/prof_report.py create mode 100644 tools/requirements-installer.txt create mode 100644 tools/requirements-py314.txt create mode 100644 tools/requirements.txt create mode 100644 tools/romfs_index.py create mode 100644 tools/run_game.py create mode 100644 tools/shader_census.py create mode 100644 tools/shader_list.py create mode 100644 tools/spin_waits.py create mode 100644 tools/ultrawide_layout.py create mode 100644 tools/vendor/macnativegames/LICENSE create mode 100644 tools/vendor/macnativegames/README.md create mode 100644 tools/vendor/macnativegames/extract_exefs.py create mode 100644 tools/vendor/macnativegames/extract_romfs.py create mode 100644 tools/vendor/macnativegames/extract_shared_fonts.py create mode 100644 tools/vendor/macnativegames/extract_update_romfs.py create mode 100644 tools/vendor/ryujinx/.gitignore create mode 100644 tools/vendor/ryujinx/Directory.Build.props create mode 100644 tools/vendor/ryujinx/Directory.Packages.props create mode 100644 tools/vendor/ryujinx/LICENSE.txt create mode 100644 tools/vendor/ryujinx/README.md create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/AsyncWorkQueue.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Collections/BitMap.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Collections/IntervalTree.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Collections/IntrusiveRedBlackTree.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeImpl.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Collections/IntrusiveRedBlackTreeNode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Collections/TreeDictionary.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/AntiAliasing.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/AppDataManager.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/BackendThreading.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/DirtyHack.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/DownloadableContentContainer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/DownloadableContentJsonSerializerContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/DownloadableContentNca.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/GraphicsBackend.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/GraphicsDebugLevel.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/AssignedInputDevice.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/AssignedInputDeviceType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/JoyconConfigControllerStick.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/LedConfigController.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/CemuHookMotionConfigController.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/JsonMotionConfigControllerConverter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionConfigController.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionConfigJsonSerializerContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/MotionInputBackendType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/Motion/StandardMotionConfigController.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/RumbleConfigController.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/StandardControllerInputConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Controller/StickInputId.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/ControllerType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/GenericInputConfigurationCommon.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/InputBackendType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/InputConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/InputConfigJsonSerializerContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/JsonInputConfigConverter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Key.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Keyboard/GenericKeyboardInputConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Keyboard/JoyconConfigKeyboardStick.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/Keyboard/StandardKeyboardInputConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/PhysicalKey.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/PlayerIndex.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/PlayerInputAssignment.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/PlayerInputAssignmentHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Hid/RightJoyconCommonConfig.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/HideCursorMode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/MemoryManagerMode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Mod.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/ModMetadata.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/ModMetadataJsonSerializerContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/Multiplayer/MultiplayerMode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/ScalingFilter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/TitleUpdateMetadata.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/TitleUpdateMetadataJsonSerializerContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Configuration/VSyncMode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Extensions/BinaryWriterExtensions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Extensions/StreamExtensions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/DriverUtilities.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/NVAPI/Nvapi.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/NVAPI/NvapiUnicodeString.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/NVAPI/NvdrsApplicationV4.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/NVAPI/NvdrsProfile.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/NVAPI/NvdrsSetting.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Hash128.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/ConsoleHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/FileAssociationHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/LinuxHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/ObjectiveC.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/OpenHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/Patterns.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/RefEvent.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Helpers/RunningPlatform.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Formatters/DefaultLogFormatter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Formatters/DynamicObjectFormatter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Formatters/ILogFormatter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/LogClass.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/LogEventArgs.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/LogLevel.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Logger.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/Targets/ILogTarget.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Logging/XCIFileTrimmerLog.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/ArrayPtr.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/Box.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/IArray.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/MemoryOwner.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/MemoryStreamManager.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/PartialUnmaps/NativeReaderWriterLock.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapHelpers.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/Ptr.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/SpanOwner.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/SpanReader.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/SpanWriter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/StructArrayHelpers.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Memory/StructByteArrayHelpers.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PerformanceCounter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Pools/ObjectPool.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Pools/SharedPools.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Pools/ThreadStaticArray.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/IPreciseSleepEvent.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/Nanosleep.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/NanosleepEvent.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/NanosleepPool.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/PreciseSleepHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/SleepEvent.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/WindowsGranularTimer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/PreciseSleep/WindowsSleepEvent.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/ReactiveObject.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/ReleaseInformation.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Ryujinx.Common.csproj create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/RyujinxException.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/SharedConstants.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/SystemInterop/DisplaySleep.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/SystemInterop/ForceDpiAware.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/SystemInterop/GdiPlusHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/SystemInterop/StdErrAdapter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/SystemInterop/WindowsMultimediaTimerResolution.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/TitleIDs.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/UI/UserError.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/BitUtils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/BitfieldExtensions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/Buffers.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/CommonJsonContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/EmbeddedResources.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/FileSystemUtils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/HexUtils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/JsonHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/NetworkHelpers.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/OsUtils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/Rainbow.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/SpanHelpers.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/StreamUtils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/UInt128Utils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/AlphaTestOp.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/AttributeType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/BufferDescriptor.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/BufferUsageFlags.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/CodeGenParameters.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/CodeGenContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/DefaultNames.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/GlslGenerator.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/HelperFunctionNames.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighS32.glsl create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/MultiplyHighU32.glsl create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/HelperFunctions/SwizzleAdd.glsl create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenBallot.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenFSI.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenPacking.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenShuffle.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenVector.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstInfo.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/IoMap.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/NumberFormatter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/TypeConversion.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/EnumConversion.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/ImageDeclaration.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/IoMap.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/OperationResult.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SamplerDeclaration.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvDelegates.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Constants.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/Block.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/DecodedFunction.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/DecodedProgram.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/Decoder.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/FunctionType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/InstDecoders.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/InstName.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/InstOp.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/InstProps.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/InstTable.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/Register.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/RegisterConsts.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Decoders/RegisterType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/GpuGraphicsState.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IGpuAccessor.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/ILogger.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/InputTopology.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/AttributeMap.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmit.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAluHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBarrier.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitBitfield.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitConditionCode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitConversion.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitFloatArithmetic.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitFloatComparison.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitFloatMinMax.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitFlowControl.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerArithmetic.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerComparison.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerLogical.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitIntegerMinMax.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMultifunction.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitNop.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitPredicate.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitShift.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitSurface.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitTexture.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitVideoArithmetic.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitVideoMinMax.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitWarp.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/InstEmitter.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Instructions/Lop3Expression.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/BasicBlock.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/CommentNode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Function.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/INode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/IoVariable.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/IrConsts.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operand.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/PhiNode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/StorageKind.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureFlags.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/TextureOperation.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/OutputTopology.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/ResourceReservationCounts.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/SamplerType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/SetBindingPair.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/ShaderProgram.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/ShaderProgramInfo.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/ShaderStage.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstAssignment.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstBlock.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstBlockType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstBlockVisitor.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstComment.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstHelper.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstNode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstOperand.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstOperation.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstOptimizer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/BufferDefinition.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/BufferLayout.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/GotoElimination.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/GotoStatement.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/HelperFunctionsMask.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/IAstNode.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/IoDefinition.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/MemoryDefinition.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/OperandInfo.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/PhiFunctions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/ShaderProperties.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/StructureType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredFunction.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/StructuredIr/TextureDefinition.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/SupportBuffer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/TessPatchType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/TessSpacing.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/TextureDescriptor.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/TextureFormat.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/TextureHandle.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/TextureUsageFlags.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/AggregateType.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/AttributeConsts.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/AttributeUsage.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Dominance.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/FeatureFlags.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/HelperFunctionManager.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/HelperFunctionName.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/HostCapabilities.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/IoUsage.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessToArray.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BranchElimination.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/ConstantFolding.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/DoubleToFloat.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Simplification.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Optimizations/XmadOptimizer.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/RegisterUsage.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/ResourceReservations.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/ShaderDefinitions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/ShaderHeader.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Ssa.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TargetApi.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TargetLanguage.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TransformContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TransformFeedbackOutput.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/DrawParametersReplace.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/ForcePreciseEnable.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/GeometryToCompute.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/ITransformPass.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/SharedAtomicSignedCas.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/SharedStoreSmallIntCas.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/ShufflePass.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/TexturePass.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/TransformPasses.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/VectorComponentSelect.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Transforms/VertexToCompute.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TranslationFlags.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TranslationOptions.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/Translator.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs create mode 100644 tools/vendor/ryujinx/src/Ryujinx.Graphics.Shader/VertexInfoBuffer.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/Autogenerated/CoreGrammar.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/Autogenerated/GlslStd450Grammar.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/Autogenerated/OpenClGrammar.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/ConstantKey.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/DeterministicHashCode.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/DeterministicStringKey.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/GeneratorPool.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/IOperand.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/Instruction.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/InstructionOperands.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/LICENSE create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/LiteralInteger.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/LiteralString.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/Module.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/OperandType.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/Spv.Generator.csproj create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/TypeDeclarationKey.cs create mode 100644 tools/vendor/ryujinx/src/Spv.Generator/spirv.cs create mode 100644 tools/worktree.py create mode 100644 tools/xlate/LICENSE create mode 100644 tools/xlate/Program.cs create mode 100644 tools/xlate/nx2navi_xlate.csproj create mode 100644 tools/xlate/patches/0001-keep-call-arguments-in-variables.patch create mode 100644 tools/xlate/patches/0002-keep-live-call-sources-when-removing-dead-node.patch create mode 100644 tools/xlate/patches/0003-keep-side-effect-assignments-in-the-ast-optimizer.patch create mode 100644 tools/xlate/patches/0004-no-else-if-flattening.patch create mode 100644 tools/xlate/patches/0005-declare-storage-image-write-without-format.patch create mode 100644 tools/xlate/patches/0006-initialise-unlinked-vertex-outputs.patch create mode 100644 tools/xlate/patches/0007-position-always-invariant.patch create mode 100644 tools/xlate/patches/0008-point-size-from-support-buffer.patch create mode 100644 tools/xlate/patches/0009-round-d16-array-compare-reference.patch create mode 100644 tools/xlate/patches/0010-pcss-for-cascade-compares.patch create mode 100644 tools/xlate/patches/0011-shadow-filter-spread.patch create mode 100644 tools/xlate/patches/0012-bitfield-fields-past-bit-31.patch create mode 100644 tools/xlate/patches/0013-funnel-shift-by-zero.patch create mode 100644 tools/xlate/patches/0015-motion-previous-position.patch create mode 100644 tools/xlate/patches/0016-zero-locals-job-flag.patch create mode 100644 tools/xlate_smoke.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..e6204710 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +* text=auto eol=lf + +*.ps1 text eol=crlf +*.bat text eol=crlf +*.cmd text eol=crlf + +*.png binary +*.jpg binary diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100644 index 00000000..224fbcbb --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh +# Enable once per clone: git config core.hooksPath .githooks +exec python tools/check_content.py --staged diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..0a441a73 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: ['https://www.donationalerts.com/r/another project'] diff --git a/.github/ISSUE_TEMPLATE/1-crash.yml b/.github/ISSUE_TEMPLATE/1-crash.yml new file mode 100644 index 00000000..dcf4f25b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-crash.yml @@ -0,0 +1,100 @@ +name: Crash +description: The game closes, freezes or shows a FATAL message. +labels: [bug, crash] +body: + - type: markdown + attributes: + value: | + Check the pinned issues at the top of the issue list first: they cover the known crashes and their workarounds. + + Do not attach or link game files, keys, firmware or builds. Issues that do are closed. + - type: checkboxes + id: duplicates + attributes: + label: Existing issues + options: + - label: I read the pinned issues and [searched open and closed issues](https://github.com/another recompilation project/issues?q=is%3Aissue) for this crash. + required: true + - type: input + id: version + attributes: + label: Version + description: The title line of the settings menu (F1), for example "NX2navi Recomp 0.1.0, game 1.4.3". + validations: + required: true + - type: input + id: last-good + attributes: + label: Last version that worked + description: If an earlier version did not crash at this point, which one. + - type: textarea + id: system + attributes: + label: System info + description: Paste what Copy system info (F1, Advanced tab) puts on the clipboard. On a Steam Deck, add LCD or OLED. + render: text + validations: + required: true + - type: textarea + id: mods + attributes: + label: Mods and cheats + description: The folders in mods/ with their download links, or "none". Say whether it also crashes without them. + validations: + required: true + - type: dropdown + id: when + attributes: + label: When does it crash? + options: + - At startup, before the Nintendo logo + - Between the Nintendo logo and the title screen + - While loading a save + - In gameplay + - In a cutscene + validations: + required: true + - type: dropdown + id: blocker + attributes: + label: Can you keep playing? + options: + - "Yes, it does not happen again after a restart, or I can avoid it" + - "No, it happens every time at the same point" + validations: + required: true + - type: textarea + id: steps + attributes: + label: What you did before the crash + validations: + required: true + - type: markdown + attributes: + value: | + ### The log + + - The log of the run that crashed is `logs\nx2navi.log` in the folder of `nx2navi.exe` (F1, Advanced tab, Open log folder). Copy it before you start the game again: the next start renames it to `nx2navi.1.log`, and after five starts it is gone. + - Attach the whole file. Do not cut or edit it: the crash report is at the end, the GPU and driver lines are at the start. + - The log says `device lost` or `VK_ERROR_DEVICE_LOST` and the GPU is an NVIDIA one: set GPU pass marks to On (F1, Advanced tab, Diagnostics), restart the game, make it crash again and attach that log. The `vk: pass marks` lines then name what the GPU was drawing. + - type: textarea + id: log + attributes: + label: Log + description: Drag nx2navi.log into this field. + validations: + required: true + - type: markdown + attributes: + value: | + ### Save and input recording + + When the crash comes back at one place in the game (an area, a shrine, a cutscene, a quest step), the save that gets there lets us crash it on our machine. + + 1. Zip the `profile` folder next to `nx2navi.exe` and attach it. Say which slot you load, or that you use the autosave. + 2. If it takes more than walking a few steps from the save: turn on Input recording (F1, Advanced tab, Diagnostics), restart the game, load the save, make it crash, and attach `input-record.txt` from the logs folder together with the `nx2navi.log` of that run. + - type: textarea + id: save + attributes: + label: Save and input recording + description: Drag the zipped profile folder and input-record.txt into this field, when the crash comes back at one place. diff --git a/.github/ISSUE_TEMPLATE/2-graphics.yml b/.github/ISSUE_TEMPLATE/2-graphics.yml new file mode 100644 index 00000000..5fbf4312 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-graphics.yml @@ -0,0 +1,74 @@ +name: Graphics glitch +description: Artifacts, missing or broken textures, flicker, wrong colours or shadows. +labels: [bug, graphics] +body: + - type: markdown + attributes: + value: | + Check the pinned issues at the top of the issue list first: they cover the known glitches on each GPU. + + Do not attach or link game files, keys, firmware or builds. Issues that do are closed. + - type: checkboxes + id: duplicates + attributes: + label: Existing issues + options: + - label: I read the pinned issues and [searched open and closed issues](https://github.com/another recompilation project/issues?q=is%3Aissue) for this glitch. + required: true + - type: input + id: version + attributes: + label: Version + description: The title line of the settings menu (F1), for example "NX2navi Recomp 0.1.0, game 1.4.3". + validations: + required: true + - type: input + id: last-good + attributes: + label: Last version that worked + description: If an earlier version drew this correctly, which one. + - type: textarea + id: system + attributes: + label: System info + description: Paste what Copy system info (F1, Advanced tab) puts on the clipboard. It lists the settings you changed too. On a Steam Deck, add LCD or OLED. + render: text + validations: + required: true + - type: textarea + id: mods + attributes: + label: Mods and cheats + description: The folders in mods/ with their download links, or "none". Say whether the glitch also shows without them. Turn off ReShade and other overlays that draw into the game before you report. + validations: + required: true + - type: textarea + id: screenshot + attributes: + label: Screenshot or video + description: Drag the file into this field. Say where in the game it was taken. Flicker needs a video. + validations: + required: true + - type: textarea + id: details + attributes: + label: What looks wrong and when + description: Does it show all the time, in one place, or after some time in play? Does it go away after a restart, or when you change a setting? + validations: + required: true + - type: dropdown + id: blocker + attributes: + label: Can you keep playing? + options: + - "Yes" + - "No, I cannot see enough to play" + validations: + required: true + - type: textarea + id: log + attributes: + label: Log + description: Drag logs\nx2navi.log from the folder of nx2navi.exe into this field, from the run that showed the glitch. Copy it before you start the game again. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/3-performance.yml b/.github/ISSUE_TEMPLATE/3-performance.yml new file mode 100644 index 00000000..28759d85 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3-performance.yml @@ -0,0 +1,108 @@ +name: Performance +description: Low frame rate, freezes, hitches, stutter or long loading. +labels: [performance] +body: + - type: markdown + attributes: + value: | + Check the pinned issues at the top of the issue list first. + + Shaders the setup did not prepare are built the first time they are needed, so a short hitch the first time an area or effect shows is expected. Report it when it happens again in the same place. + + Do not attach or link game files, keys, firmware or builds. Issues that do are closed. + - type: checkboxes + id: duplicates + attributes: + label: Existing issues + options: + - label: I read the pinned issues and [searched open and closed issues](https://github.com/another recompilation project/issues?q=is%3Aissue) for this problem. + required: true + - type: input + id: version + attributes: + label: Version + description: The title line of the settings menu (F1), for example "NX2navi Recomp 0.1.0, game 1.4.3". + validations: + required: true + - type: input + id: last-good + attributes: + label: Last version that ran better + description: If an earlier version was faster in the same place, which one. + - type: textarea + id: system + attributes: + label: System info + description: Paste what Copy system info (F1, Advanced tab) puts on the clipboard. It lists the settings you changed too. On a Steam Deck, add LCD or OLED. + render: text + validations: + required: true + - type: dropdown + id: machine + attributes: + label: Machine + options: + - Desktop PC + - Laptop, on mains power + - Laptop, on battery + - Steam Deck + - Other handheld PC + validations: + required: true + - type: textarea + id: mods + attributes: + label: Mods and cheats + description: The folders in mods/ with their download links, or "none". + validations: + required: true + - type: dropdown + id: kind + attributes: + label: What kind of problem? + options: + - The frame rate is low all the time + - Short freezes or hitches that come back in the same place + - The frame rate is fine, but motion is not smooth + - It gets slower the longer I play + - Loading takes long + validations: + required: true + - type: textarea + id: where + attributes: + label: Where and what you were doing + description: For example "Lookout Landing, walking to the tower", "the Depths below Hyrule Castle", "fighting a Talus in the Sky". How long into the session it started. + validations: + required: true + - type: textarea + id: overlay + attributes: + label: Performance overlay + description: Press F10 twice (or both stick clicks) for the full panel. Stay a minute in the place and write down the frame rate, the mean and the longest frame time, or attach a screenshot of the panel. + validations: + required: true + - type: markdown + attributes: + value: | + ### Recording the log + + 1. In the settings menu (F1), Advanced tab, Diagnostics: turn on Performance log. For freezes and hitches, also turn on Flight recorder. Restart the game: both take effect at the next start. + 2. Play at least three minutes in the place where it happens. The log gets a frame-time summary every 60 s, and a line for every frame over 50 ms that names what the frame waited for. + 3. With the flight recorder on, press F8 right after a hitch. It also saves on its own after every frame longer than the freeze threshold (100 ms), at most once per 10 s. + 4. Close the game with Quit game in the menu or the window's close button. Do not end it from Task Manager: the last summary is written when the game exits. + 5. Copy `logs\nx2navi.log` from the folder of `nx2navi.exe` before you start the game again. + 6. Each flight recorder save is a folder; the log line `flight: dump` names it. Zip the folders and attach them. + 7. Turn both off again afterwards: they cost a little frame time. + - type: textarea + id: log + attributes: + label: Log + description: Drag nx2navi.log into this field. + validations: + required: true + - type: textarea + id: flight + attributes: + label: Flight recorder saves + description: Drag the zipped folders into this field, for freezes and hitches. diff --git a/.github/ISSUE_TEMPLATE/4-bug.yml b/.github/ISSUE_TEMPLATE/4-bug.yml new file mode 100644 index 00000000..7ab51031 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4-bug.yml @@ -0,0 +1,94 @@ +name: Other bug +description: Sound, controls, the settings menu, the installer, or game logic. +labels: [bug] +body: + - type: markdown + attributes: + value: | + Check the pinned issues at the top of the issue list first. Crashes, graphics glitches and performance have their own templates. + + Do not attach or link game files, keys, firmware or builds. Issues that do are closed. + - type: checkboxes + id: duplicates + attributes: + label: Existing issues + options: + - label: I read the pinned issues and [searched open and closed issues](https://github.com/another recompilation project/issues?q=is%3Aissue) for this bug. + required: true + - type: dropdown + id: area + attributes: + label: Area + options: + - Audio + - Controls and input + - Settings menu and overlay + - Installer + - Game logic and physics + - Something else + validations: + required: true + - type: input + id: version + attributes: + label: Version + description: The title line of the settings menu (F1), for example "NX2navi Recomp 0.1.0, game 1.4.3". For the installer, the version of NX2navi-Setup. + validations: + required: true + - type: input + id: last-good + attributes: + label: Last version that worked + description: If an earlier version did this correctly, which one. + - type: textarea + id: system + attributes: + label: System info + description: Paste what Copy system info (F1, Advanced tab) puts on the clipboard. On a Steam Deck, add LCD or OLED. For the installer, write your OS and the install disk. + render: text + validations: + required: true + - type: textarea + id: mods + attributes: + label: Mods and cheats + description: The folders in mods/ with their download links, or "none". Say whether it also happens without them. + validations: + required: true + - type: dropdown + id: blocker + attributes: + label: Can you keep playing? + options: + - "Yes" + - "No, it stops the game or a quest" + validations: + required: true + - type: textarea + id: steps + attributes: + label: What happened and how to reproduce it + description: What you expected, what happened instead, and the steps that lead there. + validations: + required: true + - type: markdown + attributes: + value: | + ### What to attach for your area + + Close the game with Quit game in the menu or the window's close button, then copy `logs\nx2navi.log` from the folder of `nx2navi.exe` before you start the game again. + + **Audio.** Open `nx2navi.ini` in the folder of `nx2navi.exe` and add the line `trace = audio`; when the file already has `trace = perf` (Performance log on), change it to `trace = perf,audio`. Start the game, play at least two minutes where the sound goes wrong and close the game. The log then has an `audio:` line every 5 s with the buffer underruns. Name the output device and how it is connected (speakers, headphones, USB, Bluetooth, HDMI), and attach a short video with sound if you can. Remove the line afterwards. + + **Controls and input.** Name the controller and how it is connected (USB, Bluetooth, Steam Input). Does it also happen with keyboard and mouse? + + **Controls, game logic, anything you can trigger again.** Turn on Input recording (F1, Advanced tab, Diagnostics), restart the game, load a save, make the bug happen and close the game. Attach `input-record.txt` from the logs folder and a zip of the save you loaded: the `profile` folder next to `nx2navi.exe`. The recording replays what you did, so we can see the bug on our machine. + + **Installer.** Attach the newest `install-*.log` from `temp\logs` in the folder of `NX2navi-Setup.exe` (on Linux: `.setup-temp/logs` in the install folder), and the log file the error message names. + - type: textarea + id: log + attributes: + label: Log and other files + description: Drag nx2navi.log and the files your area asks for into this field. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/5-feature.yml b/.github/ISSUE_TEMPLATE/5-feature.yml new file mode 100644 index 00000000..5ff0f34b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/5-feature.yml @@ -0,0 +1,17 @@ +name: Feature request +description: A setting, option or support for something the port does not do yet. +labels: [enhancement] +body: + - type: checkboxes + id: duplicates + attributes: + label: Existing issues + options: + - label: I [searched open and closed issues](https://github.com/another recompilation project/issues?q=is%3Aissue) and the Planned section of the README for this request. + required: true + - type: textarea + id: request + attributes: + label: What you want and why + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..d5dc6718 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Question or help with setup + url: https://github.com/another recompilation project/discussions + about: Installing, updating and configuring the port. Ask in Discussions. diff --git a/.github/workflows/content-guard.yml b/.github/workflows/content-guard.yml new file mode 100644 index 00000000..f8ff2b68 --- /dev/null +++ b/.github/workflows/content-guard.yml @@ -0,0 +1,15 @@ +name: Content guard + +on: + push: + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: python tools/check_content.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e365e074 --- /dev/null +++ b/.gitignore @@ -0,0 +1,76 @@ +# Reference checkouts of upstream projects (cloned locally, never committed) +/refs/ + +# Downloaded toolchain binaries and Python environments +/toolchain/ +/.venv/ +/.venv-py314/ +__pycache__/ + +# Personal paths to game files and keys +/config.local.toml + +# Game inputs and everything derived from them. Never commit these. +# tools/check_content.py enforces the same rule in CI and the pre-commit hook. +/game/ +/build/ +/generated/ +*.xci +*.xcz +*.nsp +*.nsz +*.nca +*.ncz +*.tik +*.keys +*.nso +*.npdm +*.zs +*.pack +*.sarc +*.bfres +*.bntx +*.bnsh +*.webm + +# Build outputs +*.exe +*.dll +*.pdb +*.ilk +*.obj +*.o +*.lib +*.a +*.so +*.so.* +*.AppImage + +# .NET build output of the shader translator (tools/build_xlate.py) +/tools/xlate/bin/ +/tools/xlate/obj/ + +# Coding-agent setup and working notes (skills, hooks, playbook, backlog, research notes, milestone plans): local to +# the maintainer's machine. tools/worktree.py links .claude and notes into task worktrees. +/.claude/ +/.agents/ +/CLAUDE.local.md +/skills-lock.json +/notes/ +/docs/milestones/ + +# Editor settings +.vs/ +.vscode/ +.idea/ + +# Patch leftovers, logs and OS files +*.orig +*.rej +*.log +Thumbs.db +desktop.ini +.DS_Store + +# Agent task worktrees (tools/worktree.py) +/.worktrees/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..c5fadaf7 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,34 @@ +# NX2navi Recomp + +Static recompilation of *Ocarina of Time* (Switch, ARM64) into a native Windows x86-64 exe with a Vulkan renderer. Design: [docs/architecture.md](docs/architecture.md). Toolchain, build commands and tests: [docs/building.md](docs/building.md). + +## Game content boundary + +This repository is public. Game data lives outside it and every derived file stays in ignored folders. + +- The user's game and key paths are in `config.local.toml` (ignored). Pass the keys file path to tools; the tools read it themselves. Key values stay out of your output, logs, commands and files. +- Everything extracted or generated goes under `build/` or `generated/`. +- Every file the code generator emits carries the marker defined as `GENERATED_MARKER` in `tools/check_content.py`. +- Run `python tools/check_content.py --staged` before proposing a commit. It is the same check CI runs. + +## Reusing code + +`refs/` holds the upstream checkouts (`tools/fetch_refs.sh` recreates it). Read-only. + +- Copy only MIT, BSD, ISC, zlib or Apache-2.0 code, keep its header, and add a row to `THIRD_PARTY_NOTICES.md`. +- the hardware, suyu, OpenSmash-Ultimate and other GPL code: read for behaviour, write our own. +- `tools/vendor/` stays byte-identical to upstream; Windows changes go in `tools/extract.py`. + +## Code + +- Build C with MSYS2 UCRT64 Clang (`C:\msys64\ucrt64\bin`). Generated C uses GNU extensions, so `cl.exe` is out. Call Ninja from that directory by full path or put it first on PATH. +- Two Python environments: `.venv` (3.12) for the lifter and the build, `.venv-py314` for the extraction and shader scripts, which need `compression.zstd`. +- Generated C is never edited by hand: change the generator (`recomp/`). +- Every lifter change passes the differential tests against Unicorn ([docs/building.md](docs/building.md), "Checks"). After changing `recomp/jumptables.py`, `tests\jumptables_check.py` reports 0 disagreements on 1.2.1 and 1.4.3. +- `recomp/layout.py` alone decides module bases. +- Graphics bugs: [docs/maxwell.md](docs/maxwell.md) lists the Maxwell behaviour the Vulkan path must match and the NX2navi bugs other ports fixed. +- Comments say what the code does and why, in words that stand on their own. Cite our code by file plus function (a line number may follow as a hint) and upstream code by project, file and function: `refs/` moves, so its line numbers rot. Commit hashes belong to the attribution of copied code. + +## Writing + +Code, comments, docs and commit messages are in English. Commit messages are plain sentences without type prefixes. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..43c994c2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ceabb907 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing + +## The one hard rule + +Nothing that came out of the game goes into the repository: no game files, keys, extracted data, recompiled C, compiled binaries, shaders, shader caches, fonts, audio or movies. Not in commits, not in issues, not in pull requests. Only information about the game goes in: addresses, hashes, patch code we wrote, shader and bind-state identifiers. + +Two checks enforce this: + +- CI runs `tools/check_content.py` on every push and pull request. +- The same check runs before each local commit once you enable the hook: + + ```sh + git config core.hooksPath .githooks + ``` + +A failing check is never bypassed with `--no-verify`. If it flags a file by mistake, change the check in a separate pull request and say why. + +Links to game files, keys or firmware in issues or pull requests get the issue closed and the content removed. + +## Code from other projects + +Code may be copied only from projects under MIT, BSD, ISC, zlib or Apache-2.0. Each copy keeps its original header and gets a row in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) with the source commit. + +GPL projects (the hardware, suyu, OpenSmash-Ultimate, Unicorn inside the game binary) can be read to understand behaviour, but their code is not copied. Unicorn is fine as a separate test tool. + +## Reporting bugs + +Use the issue form. Include the port version and game update from the title line of the settings menu (F1), your GPU and driver (Copy system info in the menu's Advanced tab copies them), the log (`logs\nx2navi.log` next to `nx2navi.exe`; after a crash, copy it before you start the game again), and the steps to reproduce. Screenshots are fine; recordings of long gameplay are not needed. + +## Pull requests + +- One topic per pull request. +- Describe the problem, then what changed. +- Say how you tested it: which version, which scene, how long. +- A change to the lifter (`recomp/`) or the CPU headers passes the differential tests in [docs/building.md](docs/building.md), "Checks". +- Commit messages are plain sentences, without `feat:` or other prefixes. +- AI-assisted code is welcome. You are responsible for having read and run it. + +## Code and docs + +- Code, comments, commit messages and documentation are in English. +- Generated code is never edited by hand: change the generator. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..afa9602f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Valiantsin Dzerakh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..de331713 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +# NX2navi Recomp + +**NX2navi Recomp** is a static recompilation of *The Legend of Zelda: Ocarina of Time* (Nintendo Switch, 2023) into a native x86-64 application for Windows and Linux ([docs/architecture.md](docs/architecture.md)). + +> [!IMPORTANT] +> **No game files are included.** You need your own legally obtained copy of *Ocarina of Time*, dumped from your own console: the base game and the 1.1.0, 1.2.1 or 1.4.3 update. Instructions for obtaining those files will not be provided. +> +> The game is built from your files on your machine, so the result contains the game. It is for your own use. Do not share it. + +## Status + +Early development. The game is playable on Windows and Linux; visual bugs and crashes are still expected. + +Report problems as issues, following [CONTRIBUTING.md](CONTRIBUTING.md). + +## Features + +- Native code, not emulation +- Game updates 1.1.0, 1.2.1 and 1.4.3; 1.2.1 and 1.4.3 saves carry over between them +- Takes NSP and XCI game files, and compressed NSZ and XCZ as they are: the setup unpacks them itself +- 60 fps by default; up to 144 fps or the monitor's refresh rate (experimental) +- Custom resolutions (1080p, 2k...), supersampling and AMD FSR 1 upscaling +- NVIDIA DLSS / DLAA on RTX GPUs: the setup downloads `nvngx_dlss.dll` from NVIDIA's DLSS SDK repository + (github.com/NVIDIA/DLSS, NVIDIA RTX SDK license) when it finds an RTX GPU; untick it in the setup to skip it +- HDR10 output with peak, game and HUD brightness settings +- 16:10 (Steam Deck, handhelds), 3:2 (Surface, Framework), 21:9 and 32:9 (ultrawide) game resolutions, with the camera and the interface in that shape +- Anisotropic texture filtering up to 16x, for sharp ground into the distance +- In-game settings menu (F1) and performance overlay (F10) +- Discord Rich Presence ("Playing NX2navi Recomp" with the play time), off by default, own application id supported +- Setup and in-game menu in English, Russian, Brazilian Portuguese and Simplified Chinese +- Keyboard, mouse and gamepad with remapping, rumble and gyro +- Stereo or 5.1 surround sound output +- Xbox button prompts: LB, RB, LT, RT, Menu and View, and A, B, X and Y as labelled on the button to press, with either button layout +- Shaders prepared at install instead of during play +- Mods made for emulators: unpack a mod into the `mods` folder next to `nx2navi.exe`; switch and order them in the menu. RomFS + mods, a mod manager's merged output and ExeFS code patches (`.ips`, `.pchtxt`) work; the game rebuilds itself for code patches + ([docs/mods.md](docs/mods.md)) +- Atmosphère cheats: put a cheat file into a mod and switch its cheats in the menu ([docs/cheats.md](docs/cheats.md)) + +## Planned + +- VRR + +## Installing + +### Windows + +Requirements: Windows 10 or later, an x86-64 CPU with SSE4.2 (AVX2/FMA machines get a faster build), a GPU with Vulkan 1.3 and `VK_EXT_external_memory_host`, about 36 GiB free during setup (20 GiB after). + +1. Download `NX2navi-Setup--windows.zip` from [Releases](../../releases/latest) and unpack it. +2. Start `NX2navi-Setup.exe`. If SmartScreen warns about an unsigned app, choose *More info*, then *Run anyway*. +3. Pick your game files, the language and an install folder, and press *Start*. The setup builds the game once. With + an NVIDIA RTX GPU it also downloads NVIDIA DLSS, unless you untick *Download NVIDIA DLSS*; turn DLSS on in the + menu (F1). +4. Play `nx2navi.exe` from the install folder. + +### Linux + +Requirements: as on Windows, plus Linux 6.7 or later and glibc 2.34 or later (Ubuntu 22.04, Debian 12, Fedora 35, SteamOS 3). + +1. Download `NX2navi-Setup-x86_64.AppImage` from [Releases](../../releases/latest), or build it ([docs/installer.md](docs/installer.md), "Linux release"). +2. Make it executable (`chmod +x NX2navi-Setup-x86_64.AppImage`) and start it. On a Steam Deck, do this in Desktop Mode. +3. Pick your game files, the language and an install folder, and press *Start*. +4. Play `nx2navi` from the install folder. + +To update, run a newer setup on the same folder; saves and settings are kept. Settings are in the in-game menu and in `nx2navi.ini` ([nx2navi.ini.example](nx2navi.ini.example) lists every key). Controls: [docs/controls.md](docs/controls.md). + +## Credits + +NX2navi Recomp builds on the projects below. What was taken from each, with its license, is listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). + +- [LAS Recomp](https://github.com/peiikai/LASRecomp) +- [MacNativeGames](https://github.com/ly05010419/MacNativeGames) +- [d2r-mobile](https://github.com/jhaizhou-ops/d2r-mobile) and [nxnative](https://github.com/seedds/nxnative) +- [SavageWindRecomp](https://github.com/Revivedx/SavageWindRecomp) +- [Ryujinx](https://github.com/Ryujinx/Ryujinx) +- [deko3d](https://github.com/devkitPro/deko3d) +- [hactool](https://github.com/SciresM/hactool) +- [SDL 3](https://libsdl.org), [Dear ImGui](https://github.com/ocornut/imgui), [AMD FSR 1](https://github.com/GPUOpen-Effects/FidelityFX-FSR), [Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator), [libopus](https://opus-codec.org), [libvpx](https://chromium.googlesource.com/webm/libvpx), [Zstandard](https://github.com/facebook/zstd) +- [Switchbrew](https://switchbrew.org) and the Switch homebrew community + +## License + +The project's own code is under the [MIT License](LICENSE); third-party code keeps its own license ([THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)). The license grants nothing for Nintendo's game. + +NX2navi Recomp is an independent, non-commercial fan project, not affiliated with or endorsed by Nintendo. *The Legend of Zelda*, *Ocarina of Time* and *Nintendo Switch* are trademarks of Nintendo. + +## Building from source + +[docs/building.md](docs/building.md) lists the toolchain and the steps. Everything the build writes stays under `build\` and `generated\`, which git ignores; run `tools/check_content.py` before a commit. Testers: [docs/tester-guide.md](docs/tester-guide.md). + +Most of the code and documentation is written by AI coding agents (Claude Code) under the maintainer's direction; the maintainer plays every build and decides what is merged. [AGENTS.md](AGENTS.md) holds the rules they work under. diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md new file mode 100644 index 00000000..e86ac095 --- /dev/null +++ b/THIRD_PARTY_NOTICES.md @@ -0,0 +1,107 @@ +# Third-party notices + +Code copied or adapted from another project is listed here with its source, the exact commit, its license, and the files it went into. Each copied file keeps its original copyright header. + +| Component | Source and commit | License | Used in | +|---|---|---|---| +| MacNativeGames extraction scripts and verification hashes | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11`, Copyright (c) 2026 MacNativeGames contributors | MIT | `tools/vendor/macnativegames/` (unmodified), `tools/data/expected-v*.json` | +| LAS Recomp lifter, code generator, FP/SIMD lowering, CPU headers and differential tests | https://github.com/peiikai/LASRecomp @ `da35b83a9611d046a9a681aae668d7085954d37f`, Copyright (c) 2026 Peiikai | MIT | `recomp/lifter.py`, `recomp/simd_c.py`, `recomp/nso.py`, `recomp/gen.py`, `recomp/module.py`, `tests/jumptables_check.py`, `runtime/cpu.h`, `runtime/simd.h`, `runtime/simd_fp.h`, `tests/diff/` | +| LAS Recomp host runtime: NSO loader, host-function table, guest-space reservation and re-execution, guest thread start | https://github.com/peiikai/LASRecomp @ `da35b83a9611d046a9a681aae668d7085954d37f`, Copyright (c) 2026 Peiikai | MIT | `runtime/loader.c`, `runtime/hostfn.c`, `runtime/memory.c`; `runtime/kernel.c`, `runtime/boot.c`; `runtime/vk_device.c`, `runtime/gfx_window.c`, `runtime/tex_astc.c` (`runtime/nvn/astc.c`; its decode ported to GLSL in `runtime/shaders/astc_decode.comp`, compiled into `runtime/astc_decode_spv.h`, and its tables copied into `runtime/vk_astc.c`), `runtime/vk_formats.c` (format table of `runtime/nvn/vulkan/textures.c`), `runtime/vk_memory.c` (page write generations of `runtime/nvn/vulkan/exec.c`, deferred destruction of `textures.c`), `runtime/vk_texture.c` (image creation, uploads and samplers of `runtime/nvn/vulkan/textures.c`), `runtime/vk_sync.c` (timeline submissions and waits of `runtime/nvn/vulkan/exec.c`), `runtime/vk_pipeline.c` (blend, compare and stencil mappings, vertex format table with its 3-component fallback and pipeline cache file of `runtime/nvn/vulkan/exec.c` and `device.c`), `runtime/vk_exec.c` (pass begin and end, scissor clip and attachment clears of `runtime/nvn/vulkan/exec.c`), `runtime/vk_exec_xfer.c` (copies of `runtime/nvn/vulkan/exec.c`), `runtime/vk_exec_draw.c` (uniform buffer spans, texture and sampler descriptors and dispatch flow of `runtime/nvn/vulkan/exec.c`); in-game menu: `runtime/ui/menu.cpp` (Dear ImGui Vulkan set-up of `runtime/nvn/vulkan/imgui_glue.cpp`) | +| MacNativeGames NX2navi host runtime: dynamic linking, identity check, module permissions, guest memory and SVCs, threads, IPC, audio renderer, system services, RomFS and save storage, boot sequence, the NVN proc name list | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//runtime/`, `games//scripts/prepare_runtime.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `runtime/loader.c`, `runtime/memory.c`; `runtime/kernel.c`, `runtime/svc.c`, `runtime/ipc.c`, `runtime/ipc.h`, `runtime/audren.c`, `runtime/audren.h`, `runtime/audio_mixer.c`, `runtime/audio_effects.c`, `runtime/audio_effects.h`, `runtime/audio_reverb.c`, `runtime/audio_reverb.h` (SDL3 output replaces CoreAudio), `runtime/ov_system.c` (also `shared_font.c`: the BFTTF layout behind nn::pl), `runtime/ov_input.c` (also `hid_feedback.c`: vibration and six-axis handles and calls), `runtime/motion_fusion.c` (six-axis fusion of `motion_fusion.c`), `runtime/ov_media.c` (hardware Opus decoder over libopus), `runtime/swkbd_win.c` (`swkbd_host.c`: ShowKeyboardArg offsets, UTF-8/UTF-16 conversion, disabled-key filter, result codes; Win32 window replaces the macOS text bar), `runtime/ov_gfx.c`, `runtime/romfs.c`, `runtime/romfs_path.h`, `runtime/fs_host.c`, `runtime/fs.h`, `runtime/boot.c`; `runtime/gfx_window.c`; `tools/gen_nvn_procs.py`, `runtime/nvn_procs.inc` (`NVN/names.txt` and the `NVN_EXTRA` names of `nx2navi_nvn_ext.c`) | +| MacNativeGames NX2navi frame-rate patches: 60 fps present-interval controller, real-time frame step and its present sampling, hair and cloth clock, trampoline slow-motion check (instruction words and 1.2.1 sites), player position chain; quick-menu capture background RomFS overlay | https://github.com/ly05010419/MacNativeGames @ `ebe621de99bfc48f3c42f2d2aa73e04fbcc6eae2` (`games//runtime/game_patches.c`, `game_version.h`, `world_survey.c`, `games//scripts/make_romfs_patches.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `runtime/frame_rate.c`, `recomp/patches-v121.txt`, `tools/make_romfs_patches.py` | +| MacNativeGames NX2navi 1.4.3 fade fix: the four distance / LOD and pre-actor fade sites, their instruction words and the floor of the fade step at 1 | https://github.com/ly05010419/MacNativeGames @ `3e9e7f67fdfdd3404134dcfa0f24969a9425a33f` (`games//runtime/game_patches_v143.c` patch_fade_increment), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v143.txt` (set fade; the floor without flags, clz >> 5, as in pull request #78) | +| MacNativeGames NX2navi 1.2.1 cursor and aim steps: the map cursor, vertical object aim and vertical gyro aim sites, their instruction words and the step scaled by the frame ratio | https://github.com/ly05010419/MacNativeGames @ `363a6eb50434387f7d623349934bcf1e910be48f` (`games//runtime/game_patches.c` patch_cursor_speed), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v121.txt` (set cursor) | +| MacNativeGames NX2navi aspect ratio: the camera and viewport sites that hand the perspective projection its aspect ratio, and the UI layout edits for a canvas wider than 16:9 | https://github.com/ly05010419/MacNativeGames @ `933b6a0d1438de160208a0a13eb5e8d7a2cb8094` (`games//runtime/aspect_patch.h`, `aspect_math.h`, `game_patches_v143.c`, `games//scripts/ultrawide_layout.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v143.txt` (set aspect), `tools/ultrawide_layout.py`, `tools/make_romfs_patches.py` (--aspect) | +| MacNativeGames NX2navi button icons: the Xbox controller's shoulder buttons, triggers, Menu, View and d-pad drawn with letters from the game's own text fonts, the .bfotf key, the button guide's images and their block-linear layout, the resource size table raised for the archives that grew | https://github.com/ly05010419/MacNativeGames @ `933b6a0d1438de160208a0a13eb5e8d7a2cb8094` (`games//scripts/make_button_icons.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `tools/button_icons.py`, `tools/make_romfs_patches.py` (--prompts) | +| RenoDX NX2navi mod (game mod by souperman9, tonemapper by Musa, RenoDX framework by ShortFuse, RenoVK fork by Ritsu): the approach of the HDR tonemap (the game's 1 - e^-x curve kept below a pivot and continued along its tangent above it, the saturation grade applied to the colour scaled into 0..1) and the observation that the passes after the tonemap keep values above 1. No code copied; the shader is our own | https://github.com/clshortfuse/renodx @ `b6f87272ad1bfdc0e6444910a93606815944a085` (`src/games//tonemap.slang`, `addon.cpp`), Copyright (c) 2025 Carlos Lopez Jr. | MIT | `runtime/shaders/hdr_tonemap.frag`, `runtime/vk_hdr.c` | +| an ultrawide mod, the community mod for emulators: the list of UI panes the ultrawide layout edits and the distances they move (data only, no code copied; the edit code is our own, and MacNativeGames' `ultrawide_layout.py` in the row above already carries the same values). The mod's repository URL and licence version are not recorded in this repository | an ultrawide mod (community mod; URL not recorded here) | GPL (version not recorded here) | `tools/ultrawide_layout.py` (`KEEP_ROOT`, `edits`, `anim_edits`) | +| MacNativeGames NX2navi virtual-core preemption: asynchronous preemption of an owner in top-level game code, priority inheritance through guest mutexes, the SDK's preemption-disable protocol (TLR+0x100/+0x102, SVC 0x36), the core-wait diagnostics | https://github.com/ly05010419/MacNativeGames @ `33e8fa83052ea1ae09a3583137008e9797e12950` (`games//runtime/threads.c`, commits 8bf0893 and 19730cd), Copyright (c) 2026 MacNativeGames contributors | MIT | `runtime/kernel.c` (SuspendThread and a register-saving stub replace SIGUSR2), `runtime/hostfn.c`, `runtime/svc.c` (host depth) | +| MacNativeGames RomFS index builder (`NX2NAVIRFS1` layout) | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//scripts/prepare_romfs_backend.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `tools/romfs_index.py` | +| d2r-mobile host thread environment (TLR, TLS, thread object), the origin of MacNativeGames' thread layer; d2r-mobile NVN host object layouts, command record format and NVN front end, as adapted for NX2navi in MacNativeGames' `d2r_gfx` copy | https://github.com/jhaizhou-ops/d2r-mobile @ `53e7c5bb9ca3ea53e2160005be8fbe920cd9cb53` (`dm/host/thread.c`, `dm/host/hle_thread.c`); the NVN layouts and front end via https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//third_party/d2r_gfx/gfx/nvn/nvn_obj.h`, the two types of `nvn_tex.h`, `hle_nvn.c`, `nx2navi_nvn_ext.c`, `nvn_impl.h`, `nvn_hmap.h`, `nvn_pool_index.h`, the request checks and mapping semantics of `nx2navi_vpool.c`, the generation stamps of `nvn_dirty.c`, texture mirroring and texel copies of `nvn_mtl.m`; licence in `games//third_party/d2r_gfx/LICENSE`), Copyright (c) 2026 jhaizhou | MIT | `runtime/kernel.c`; `runtime/nvn_obj.h`; `runtime/nvn_api.h`, `runtime/nvn_api_core.c`, `runtime/nvn_hmap.h`, `runtime/nvn_pool_index.h`; `runtime/nvn_api_obj.c` (also `nvn_pace.h`); `runtime/nvn_api_cmd.c`, `runtime/nvn_ext.c`; `runtime/vk_memory.c`, `runtime/vk_texture.c`; `runtime/vk_sync.c` (side effects written after GPU completion, `hle_nvn.c`); `runtime/vk_pipeline.c` (pipeline key and state mapping of `nvn_mtl.m` `pso_key_fill` / `pso_desc`, its `vfmt` vertex formats and the missing-varying fix-up of `msl_varyings`); `runtime/vk_exec.c`, `runtime/vk_exec.h` (op loop, pure-state ops and state defaults of `nvn_mtl.m` `mtl_exec` / `state_op` / `state_reset`); `runtime/vk_exec_xfer.c` (copy, clear, event, counter and conditional-render semantics of `nvn_mtl.m` `copy_t2b` / `copy_b2t` / `copy_t2t` / `clear_tex` / `cond_eval`); `runtime/vk_exec_draw.c` (bind ops, draw and dispatch flow, vertex streams of `nvn_mtl.m` `state_op` / `bind_vertex_streams` / `draw_inner` / `dispatch`) | +| nxnative NVN front end (d2r-mobile's successor): texture view depth-stencil mode bits, stencil-view rule, `Downsample` and indirect draw and dispatch records | https://github.com/seedds/nxnative @ `d5b380b3a80495609c2e751bb994911a638935ad` (`dm/gfx/nvn/hle_nvn.c`, `nvn_obj.h`, `nvn_mtl.m`), Copyright (c) 2026 jhaizhou | MIT | `runtime/nvn_obj.h`, `runtime/nvn_ext.c`, `runtime/nvn_api_cmd.c`, `runtime/vk_exec_draw.c` | +| nxnative spin wait search and gate: loops that only another thread can end, polls that take a spin lock, the gate's wait and hand-off rule; MacNativeGames' NX2navi port of the gate | https://github.com/seedds/nxnative @ `6d349844880eb0527be77d7e0e4b8d999c0ae2f4` (`dm/tools/patch_nso.py` "Spin waits", `dm/tools/tests/test_spin_waits.py`, `dm/host/hle_thread.c` dm_spin_wait), Copyright (c) 2026 seedds; https://github.com/ly05010419/MacNativeGames @ `a038e6be7608e6f4eba6fc0381026cebf24ef4a3` (`games//runtime/threads.c` runtime_spin_wait), Copyright (c) 2026 MacNativeGames contributors | MIT | `tools/spin_waits.py`, `tests/spin_waits_test.py`, `runtime/kernel.c` (rt_spin_gate) | +| NVN type definitions reconstructed from Darksiders II DWARF information, with MacNativeGames' NX2navi size annotations | h1k421, via https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//third_party/d2r_gfx/gfx/nvn/include/nvn.h`), Copyright (c) 2020 h1k421 | MIT | `runtime/nvn.h` (unmodified) | +| Ryujinx.Audio voice state and effects, as ported in MacNativeGames' audio renderer | https://github.com/Ryujinx/Ryujinx, via MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//runtime/audio_renderer.c`, `audio_effects.c`, `audio_reverb.c`; licence text in `games//third_party/licenses/Ryujinx-Audio.txt`), Copyright (c) Ryujinx Team and Contributors | MIT | `runtime/audren.c` | +| REA agent skill `reverse-engineer-anything` | https://github.com/morluto/rea @ `799e8265b254e225dc1dabdd25e56f0ab7f86bd3`, Copyright (c) 2026 morluto | MIT | `.claude/skills/reverse-engineer-anything/`, `.agents/skills/reverse-engineer-anything/` (pinned in `.claude/skills/skills-lock.json`) | +| Ryujinx shader translator 1.3.2 (`Ryujinx.Graphics.Shader`, `Spv.Generator`, `Ryujinx.Common`) with MacNativeGames' four optimizer patches and `nx2navi_xlate` tool | https://github.com/Ryujinx/Ryujinx, via MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`vendor/ryujinx`, `games//tools/nx2navi_xlate/`), Copyright (c) Ryujinx Team and Contributors; tool Copyright (c) 2026 jhaizhou | MIT | `tools/vendor/ryujinx/` (unmodified), `tools/xlate/`, `runtime/gfx_shader.c` (job layout from `tools/shader_census.py`; c2 handle ranges of `nx2navi_xlate/Service.cs` for the reflection), `runtime/vk_pipeline.c` (the translator's set/binding and support-buffer conventions) | +| deko3d block-linear image layout, as ported in MacNativeGames' `nvn_tex.c` (Apple parts dropped, layout math unchanged; licence text in `games//third_party/d2r_gfx/LICENSE.deko3d`, reproduced in the file header) | https://github.com/devkitPro/deko3d (`source/dk_image.cpp`), via MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//third_party/d2r_gfx/gfx/nvn/nvn_tex.c`, `nvn_tex.h`), Copyright (C) 2018-2020 fincs | zlib | `runtime/nvn_tex.c`, `runtime/nvn_tex.h` | +| MacNativeGames texture auto-layout goldens (40 original-SDK size and block-height cases) | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//tests/texture_auto_layout/probe.c`), Copyright (c) 2026 jhaizhou | MIT | `runtime/nvn_tex_probe.c`; `runtime/nvn_probe.c` (four of the cases, through the procs) | +| MacNativeGames block-linear deswizzler (address function; copy loop split out as `tex_bl_copy`) | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//third_party/d2r_gfx/gfx/tex/nvn_deswizzle.c`), Copyright (c) 2026 jhaizhou | MIT | `runtime/tex_deswizzle.c`, `runtime/tex.h` | +| SDL 3.4.18, dynamic link, `SDL3.dll` copied next to `nx2navi.exe`. Developer builds use the MSYS2 build (`mingw-w64-ucrt-x86_64-sdl3`, which imports `libiconv-2.dll`, LGPL-2.1, unmodified, copied beside it); the installer release ships the upstream release `SDL3-3.4.18-win32-x64.zip`, which imports no libiconv | https://libsdl.org, Copyright (c) 1997-2026 Sam Lantinga | zlib | `runtime/input_win.c` (gamepad input, rumble, gyro and accelerometer) | +| libopus (MSYS2 `mingw-w64-ucrt-x86_64-opus`), dynamic link, `libopus-0.dll` copied next to `nx2navi.exe` | https://opus-codec.org, Copyright (c) 2001-2023 Xiph.Org, Skype Limited, Octasic, Jean-Marc Valin, Timothy B. Terriberry, CSIRO, Gregory Maxwell, Mark Borgerding, Erik de Castro Lopo, Mozilla, Amazon | BSD-3-Clause | `runtime/ov_media.c` (nn::codec hardware Opus decoder) | +| Dear ImGui 1.91.9 (core and Vulkan back end, unmodified), as vendored by LAS Recomp | https://github.com/ocornut/imgui, via https://github.com/peiikai/LASRecomp @ `da35b83a9611d046a9a681aae668d7085954d37f` (`third_party/imgui/`), Copyright (c) 2014-2025 Omar Cornut | MIT | `runtime/third_party/imgui/` (compiled into `nx2navi.exe` for the in-game menu, `runtime/ui/`) | +| SavageWindRecomp settings menu: two-pane option rows (row look, left / right stepping, hold speed-up, description pane), the menu style and tab bar | https://github.com/Revivedx/SavageWindRecomp @ `575ad88e02f9a89a9a885d90039d48af33c982f4` (`runtime/ui/option_rows.mm`, `runtime/ui/menu.mm`), Copyright (c) 2026 Revivedx and the Savage Wind Recomp contributors, Copyright (c) 2026 Peiikai | MIT | `runtime/ui/option_rows.cpp`, `runtime/ui/option_rows.h`, `runtime/ui/menu.cpp` | +| SavageWindRecomp performance overlay: the frame ring and its one-second summary, the NVML calls, the sampling loop, the full panel's layout | https://github.com/Revivedx/SavageWindRecomp @ `575ad88e02f9a89a9a885d90039d48af33c982f4` (`runtime/perfmon.c`, `runtime/perfmon.h`, `perf_overlay_draw` in `runtime/ui/menu.mm`), Copyright (c) 2026 Revivedx and the Savage Wind Recomp contributors, Copyright (c) 2026 Peiikai | MIT | `runtime/perfmon.c`, `runtime/perfmon.h`, `runtime/ui/menu.cpp` | +| Roboto Medium font (Dear ImGui's `misc/fonts/Roboto-Medium.ttf`, unmodified) | https://fonts.google.com/specimen/Roboto, via https://github.com/peiikai/LASRecomp @ `da35b83a9611d046a9a681aae668d7085954d37f` (`third_party/imgui/misc/fonts/`), Copyright 2011 Google Inc. | Apache-2.0 | `runtime/ui/fonts/Roboto-Medium.ttf` (licence text in `runtime/ui/fonts/LICENSE-Roboto.txt`), embedded by `runtime/ui/menu.cpp` | +| Vulkan Memory Allocator 3.4.0 (MSYS2 `mingw-w64-ucrt-x86_64-vulkan-memory-allocator`), header-only, compiled into `nx2navi.exe` | https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator, Copyright (c) 2017-2026 Advanced Micro Devices, Inc. | MIT | `runtime/vk_vma.cpp` (the allocator behind `runtime/vk_memory.c`) | +| MacNativeGames host movie decoder (`movie::Decoder` for VP9 over libvpx: entry list, buffer and event semantics, NV12 output format, PTS pacing) | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//runtime/movie_host.c`, `movie_host.h`), Copyright (c) 2026 MacNativeGames contributors | MIT | `runtime/ov_movie.c`, `runtime/movie.h` | +| libvpx 1.17.0 (MSYS2 `mingw-w64-ucrt-x86_64-libvpx`), static link (`libvpx.a`), no DLL shipped; the release notices must carry its BSD licence text and the WebM Project's `PATENTS` grant | https://chromium.googlesource.com/webm/libvpx, Copyright (c) 2010, The WebM Project authors | BSD-3-Clause | `runtime/ov_movie.c` (VP9 decoding of the `Event/Movie` WebM files) | +| MacNativeGames NX2navi resolution patches: output, swapchain and scene size sites and instruction words for 1.2.1 and 1.4.3, the data-page layout, the HeapDef heap names and sizes | https://github.com/ly05010419/MacNativeGames @ `aaf6ba1f494fabaa209d049e528d6f923dfe822a` (`games//runtime/game_patches.c`, `game_patches_v143.c`, `game_version.h`, `games//scripts/make_output_res_overlay.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v121.txt`, `recomp/patches-v143.txt`, `runtime/resolution.c` | +| AMD FidelityFX Super Resolution 1.0 (`ffx_a.h`, `ffx_fsr1.h`, unmodified; licence text in `runtime/shaders/ffx/LICENSE.txt`) | https://github.com/GPUOpen-Effects/FidelityFX-FSR @ `a21ffb8f6c13233ba336352bdff293894c706575`, Copyright (c) 2021 Advanced Micro Devices, Inc. | MIT | `runtime/shaders/ffx/`, `runtime/shaders/fsr_easu.comp`, `runtime/shaders/fsr_rcas.comp` (compiled into `runtime/fsr_easu_spv.h`, `runtime/fsr_rcas_spv.h`) | +| AMD Display Library (ADL) declarations: `AdapterInfo`, `ADLSingleSensorData`, `ADLPMLogDataOutput`, the `ADL_PMLOG_*` sensor numbers and the `ADL2_*` function signatures | https://github.com/GPUOpen-LibrariesAndSDKs/display-library @ `84c881cb2136f04287eb3af12de00a9e2867aa9e` (`include/adl_structures.h`, `include/adl_defines.h`, `include/adl_sdk.h`), Copyright (c) 2016 - 2022 Advanced Micro Devices, Inc. | MIT | `runtime/perfmon.c` | +| Zstandard 1.5.7 (MSYS2 `mingw-w64-ucrt-x86_64-zstd`), static link | https://github.com/facebook/zstd, Copyright (c) Meta Platforms, Inc. and affiliates | BSD-3-Clause | `runtime/resolution.c` (the HeapDef table), `runtime/ov_zstd.c` (the game's zstd frames decoded on the host) | +| musl `fma.c`, `fmaf.c` and `scalbn.c`, adapted into one file for the x86-64-v2 build | https://github.com/kraj/musl @ `5a56ad13e1e0790c06122978aad2a14d6b9efc1a` (mirror of https://git.musl-libc.org/cgit/musl), Copyright (c) 2005-2020 Rich Felker and contributors | MIT | `runtime/fma.c` (the correctly rounded fma/fmaf the FP lowering needs on CPUs without FMA3) | + +## Compiler runtime in a source build + +A build with the MSYS2 UCRT64 toolchain of `docs/building.md` links these into `nx2navi.exe`. The installer release builds with llvm-mingw instead (its row below). + +| Component | Version | License | How it is used | +|---|---|---|---| +| GCC runtime (`libstdc++`) | 16.2.0 | GPL-3.0 with the GCC Runtime Library Exception | linked into `nx2navi.exe` | +| winpthreads (mingw-w64) | 14.0.0 | MIT / BSD | linked into `nx2navi.exe` | +| libiconv | 1.19 | LGPL-2.1+ | `libiconv-2.dll`, unmodified, next to `nx2navi.exe`: MSYS2's `SDL3.dll` imports it | + +## Build-time tools (not distributed) + +These tools run on the developer's or player's machine during the build. They are not part of this repository or of any release. + +| Tool | Source | License | Purpose | +|---|---|---|---| +| hactool (the installer release ships it, see below) | https://github.com/SciresM/hactool @ `1d64a83450e025622f3468c28fc4164dad2c5ef6`, with patches from MacNativeGames | ISC | NCA and update container extraction | +| Capstone | https://www.capstone-engine.org | BSD-3-Clause | ARM64 disassembly for analysis | +| Unicorn | https://www.unicorn-engine.org | GPL-2.0 (Python bindings BSD) | Differential testing of the lifter; never linked into the game | + +## Distributed in the installer release + +`tools/make_release.py` assembles these into the release folder of `docs/installer.md`. Versions and sha256 of every download are pinned in that script; licence texts are in the folder's `licenses/` and in each component's own folder. + +| Component | Source | License | Where in the release | +|---|---|---|---| +| Tcl/Tk 9.0.4, rebuilt with Xft for the Linux installer | https://github.com/tcltk/tcl and https://github.com/tcltk/tk, tag `core-9-0-4`; archives pinned by SHA-256 in `tools/make_release_linux.py` | Tcl/Tk licence (BSD-style) | `python/lib/`; licence texts in `licenses/tcl-license.terms` and `licenses/tk-license.terms` | +| libXft 2 and libXrender 1, the sniper SDK sysroot's shared libraries, bundled beside the Xft Tk of the Linux installer; their Debian `copyright` files go into `licenses/` | https://repo.steampowered.com/steamrt-images-sniper/snapshots/3.0.20261021.266025/ | HPND (MIT-style) | `python/lib/`; `licenses/libXft-copyright.txt`, `licenses/libXrender-copyright.txt` | +| CPython 3.14.9 embeddable package, with `tkinter` and Tcl/Tk 9.0.4 taken from the python.org 3.14.9 installer's component MSI (unpacked, never run); includes `vcruntime140*.dll` (Microsoft, redistributable with Python), OpenSSL, libffi, SQLite, zlib, libtommath | https://www.python.org/downloads/release/python-3149/ | PSF-2.0 (Tcl/Tk: Tcl/Tk licence, BSD-style) | `python/` | +| numpy 2.5.4 (with its bundled OpenBLAS), lz4 4.4.5, cryptography 50.0.2 (with its bundled OpenSSL), fontTools 4.68.0, cffi 2.1.1, pycparser 3.11 | PyPI binary wheels, pins in `tools/requirements-installer.txt` | BSD-3-Clause; lz4 BSD-3-Clause; cryptography Apache-2.0 OR BSD-3-Clause; fontTools MIT; cffi MIT; pycparser BSD-3-Clause | `python/Lib/site-packages/` | +| llvm-mingw 20261020 (LLVM/Clang/LLD 23, mingw-w64, libc++, libunwind, compiler-rt), x86_64 subset | https://github.com/mstorsjo/llvm-mingw/releases/tag/20261020 | Apache-2.0 with LLVM exception; mingw-w64 ZPL-2.1/BSD/public domain; libc++ and libunwind Apache-2.0 with LLVM exception and MIT/UIUC; winpthreads MIT | `llvm/` | +| SDL 3.4.18 upstream Windows release (`SDL3.dll`) and mingw development package (headers, `libSDL3.dll.a`) | https://github.com/libsdl-org/SDL/releases/tag/release-3.4.18 | zlib | `bin/SDL3.dll`, `runtime/deps/` | +| libopus 1.6.1 (MSYS2 `mingw-w64-ucrt-x86_64-opus` 1.6.1-2; `libopus-0.dll` imports only KERNEL32 and the UCRT api-ms-win-crt DLLs), headers and import library | https://repo.msys2.org/mingw/ucrt64/ | BSD-3-Clause | `bin/libopus-0.dll`, `runtime/deps/` | +| libvpx 1.17.0 (MSYS2 `mingw-w64-ucrt-x86_64-libvpx` 1.17.0-1), headers and static library compiled into `nx2navi.exe`; `libvpx-LICENSE.txt` and `libvpx-PATENTS.txt` come from the v1.17.0 source tag | https://github.com/webmproject/libvpx | BSD-3-Clause with the WebM patent grant | `runtime/deps/`, `licenses/` | +| Zstandard 1.5.7 (MSYS2 `mingw-w64-ucrt-x86_64-zstd` 1.5.7-2), headers and static library compiled into `nx2navi.exe`; `zstd-LICENSE.txt` from the package | https://github.com/facebook/zstd | BSD-3-Clause | `runtime/deps/`, `licenses/` | +| Vulkan-Headers and Vulkan-Loader 1.4.363.0 (MSYS2 packages; headers and `libvulkan-1.dll.a` only, no loader DLL) | https://github.com/KhronosGroup | Apache-2.0 OR MIT | `runtime/deps/` | +| Vulkan Memory Allocator 3.4.0 (MSYS2 package), header | https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator | MIT | `runtime/deps/` | +| Ninja 1.13.2 (`ninja-win.zip`) | https://github.com/ninja-build/ninja/releases/tag/v1.13.2 | Apache-2.0 | `bin/ninja.exe` | +| hactool (SciresM @ `1d64a83450e025622f3468c28fc4164dad2c5ef6` plus `tools/hactool/portable.patch`, from MacNativeGames' `build_hactool()`: `MNG_TITLE_KEYS` and relaxed BKTR layout checks; our `tools/hactool/unicode.patch`: an embedded manifest that makes UTF-8 the process code page; our `tools/hactool/mbedtls-asm-clobbers.patch`: the clobbers the bundled mbedtls's x86-64 multiply asm lacks), built by `tools/build_hactool.py` with MSYS2 UCRT64 gcc; imports only KERNEL32 and the UCRT | https://github.com/SciresM/hactool | ISC | `bin/hactool.exe` | +| `nx2navi_xlate.exe` (Ryujinx shader translator, NativeAOT build of `tools/xlate/`, see the Ryujinx row above) | built by `tools/build_xlate.py` | MIT | `bin/nx2navi_xlate.exe` | +| MacNativeGames shader variant list | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games//assets/shader_list.tsv`), Copyright (c) 2026 MacNativeGames contributors | MIT | `data/shader_list.tsv` | + +## Distributed in the Linux release (AppImage) + +`tools/make_release_linux.py` assembles these into the folder of `docs/installer.md` ("Linux release") and packs it as +`NX2navi-Setup-x86_64.AppImage`. Versions and sha256 of every download are pinned in that script; licence texts are in the +folder's `licenses/` and in each component's own folder. + +| Component | Source | License | Where in the release | +|---|---|---|---| +| CPython 3.14.10, python-build-standalone 20261026 `install_only` build, with `tkinter` and the libraries it bundles (OpenSSL, libffi, SQLite, zlib, Tcl/Tk and others; their licences ship in the folder) | https://github.com/astral-sh/python-build-standalone/releases/tag/20261026 | PSF-2.0; bundled libraries under their own licences | `python/` | +| numpy 2.5.4 (with the libraries its manylinux wheel bundles), lz4 4.4.5, cryptography 50.0.2, cffi 2.1.1, pycparser 3.11 | PyPI binary wheels, pins in `tools/requirements-installer.txt` | as in the installer release row above | `python/lib/python3.14/site-packages/` | +| LLVM 23.1.4 official Linux X64 release: `clang`, `lld`, `llvm-ar`, `llvm-ranlib`, `llvm-objcopy`, `llvm-strip` and the clang resource headers; `llvm-LICENSE.txt` from the `llvmorg-23.1.4` source tag | https://github.com/llvm/llvm-project/releases/tag/llvmorg-23.1.4 | Apache-2.0 with LLVM exception | `llvm/` | +| Steam Runtime 3 "sniper" SDK sysroot 3.0.20261021.266025 (Debian 11 based), only the headers, libraries and objects a game build reads: glibc 2.31 (headers, `crt*.o`, `libc_nonshared.a`, link libraries), GCC 10 `libstdc++.a` and `libgcc`, SDL 3.4.18, libopus, libvpx 1.9 (static), the Vulkan loader's link library; their Debian `copyright` files go into `licenses/` | https://repo.steampowered.com/steamrt-images-sniper/snapshots/3.0.20261021.266025/ | glibc LGPL-2.1+; libstdc++ and libgcc GPL-3.0 with the GCC Runtime Library Exception; SDL zlib; libopus BSD-3-Clause; libvpx BSD-3-Clause with the WebM patent grant (`libvpx-PATENTS.txt` from the v1.17.0 source tag); Vulkan loader Apache-2.0 | `llvm/sysroot/`, `bin/libSDL3.so.0` (the sysroot's, copied next to the game by the setup), `licenses/` | +| Vulkan-Headers 1.4.363 (source tag) | https://github.com/KhronosGroup/Vulkan-Headers/tree/v1.4.363 | Apache-2.0 OR MIT | `runtime/deps/include/` | +| Vulkan Memory Allocator 3.4.0, header (the licence text is its header comment) | https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/tree/v3.4.0 | MIT | `runtime/deps/include/vma/` | +| Zstandard 1.5.7, built from the release tarball into a static `libzstd.a` with the folder's clang and sysroot | https://github.com/facebook/zstd/releases/tag/v1.5.7 | BSD-3-Clause | `runtime/deps/` | +| Ninja 1.13.2 (`ninja-linux.zip`) | https://github.com/ninja-build/ninja/releases/tag/v1.13.2 | Apache-2.0 | `bin/ninja` | +| hactool (as in the installer release row above), built by `tools/build_hactool.py --cc` with the folder's clang and sysroot; includes its bundled mbedtls | https://github.com/SciresM/hactool | ISC; mbedtls Apache-2.0 | `bin/hactool` | +| `nx2navi_xlate` (NativeAOT linux-x64 build of `tools/xlate/`, linked with the folder's clang, lld and sysroot) | built by `tools/build_xlate.py --llvm --sysroot` | MIT | `bin/nx2navi_xlate` | +| AppImage type-2 runtime (static; includes libfuse and squashfuse), the AppImage's first part; appimagetool packs the folder and is not distributed | https://github.com/AppImage/type2-runtime | MIT; libfuse LGPL-2.1; squashfuse BSD-2-Clause | the AppImage header | +| MacNativeGames shader variant list | as in the installer release row above | MIT | `data/shader_list.tsv` | +| Weeping of the Empire menu cursor: eui's focus box read through ScreenMgr, BoxCursorMgr and the screens' node lists, AnimButton's hit test, the stale-hit-pane fallback to the parts panes, the three writes of moveBoxCursor, the structure offsets (1.0.0; the ScreenMgr instance placed in 1.4.3 by us) | https://github.com/daniel-madrid-07/weeping-of-the-empire @ `df0586cdc5702ca19bbebfa59697e0b6980f6237` (`engine/runtime/nx2navi_menu_cursor.cpp`), Copyright (c) 2026 daniel-madrid-07 | MIT | `runtime/menu_cursor.c` | diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..5503126d --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.10 diff --git a/config.example.toml b/config.example.toml new file mode 100644 index 00000000..0f1e2a53 --- /dev/null +++ b/config.example.toml @@ -0,0 +1,18 @@ +# Copy to config.local.toml (ignored by git) and point it at your own files. + +[input] +# Base game 1.0.0, title id 0100F2C0115B6000, as NSP or XCI. +base = 'C:\Games\NX2navi\base.nsp' +# Cumulative update NSPs, title id 0100F2C0115B6800. Each is identified by its code hash; 1.4.3 and 1.2.1 are supported. +# Leave the list empty for 1.0.0 only. +updates = ['C:\Games\NX2navi\update-1.4.3.nsp'] +# Keys dumped from your own console. Never printed or copied by the tools. +keys = 'C:\Switch\prod.keys' +# Optional: a firmware NCA directory (an unpacked firmware, or an emulator's installed registered/ directory). +# tools/extract_fonts.py takes the system shared fonts from it; the game needs them only with Chinese or Korean text. +# The installer asks for the same folder (--firmware) when the language needs those fonts. +# firmware = 'C:\Switch\firmware' + +[work] +# Extracted files, generated C and builds go here. Allow about 60 GB. +dir = 'build' diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 00000000..a64bfb68 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,148 @@ +# Architecture + +How the Switch build of *Ocarina of Time* becomes a native Windows x86-64 program. The upstream projects it builds on are listed under Credits in the [README](../README.md). + +## Starting points + +Two MIT projects cover different halves of the problem: + +| | LAS Recomp | MacNativeGames | +|---|---|---| +| Game | *Link's Awakening* | *Ocarina of Time* 1.0.0–1.4.3 | +| CPU | ARM64 lifted to C, runs on x86-64 | Original ARM64 code runs directly on Apple silicon | +| OS boundary | IPC services and SVCs | ~163 `nn::*` SDK functions replaced by symbol, 38 SVCs | +| Graphics | Own NVN layer on Vulkan, own Maxwell translator | NVN front end + Metal 4 back end, Ryujinx translator | +| Useful to us | Lifter, NEON-to-C lowering, Windows memory layer, tests | Everything NX2navi-specific: host behaviour, NVN front end, version tables, patches, shader list | + +MacNativeGames cannot run on x86-64 as is: its CPU path executes ARM64 code natively. LAS Recomp's host only covers what *Link's Awakening* calls. The port takes the CPU half from LAS Recomp and the game half from MacNativeGames, and writes the parts neither has: a lifter that scales to NX2navi, and a Vulkan back end for the NVN front end. + +## Pipeline + +### 1. Input + +- Base 1.0.0 (`0100F2C0115B6000`) and one cumulative update (`0100F2C0115B6800`), NSP or XCI, plus the keys of the user's console. +- ExeFS and RomFS extraction: MacNativeGames' Python extractor (Python 3.14 for `compression.zstd`, `.venv-py314`). +- Update merging: hactool at `1d64a83` with MacNativeGames' BKTR patches, built by `tools/build_hactool.py`. +- Verification: MacNativeGames' `expected-v*.json` hashes of ExeFS, RomFS and fonts. +- Primary version: 1.4.3, the last update; performance work targets it. It replaced all three modules of the earlier updates (new SDK 20.5.22, RELR relocations, audio renderer REV15) and builds with `--version v143`, `recomp/patches-v143.txt`. 1.2.1 is a second target on the same build path; 1.0.0, 1.1.2 and 1.2.1 share `sdk`, `subsdk0` and `rtld` byte for byte, so only `main` differs among them. Saves load on either. +- Windows driver: `tools/extract.py` runs the vendored extractors (`tools/vendor/macnativegames/`) and identifies the update by the SHA-256 of its `main`. hactool has no Darwin `funopen` here, so the base Program NCA is copied out of the NSP before the BKTR merge (about 17 GB of temporary space). + +### 2. CPU: lift ARM64 to C + +- Modules: `main`, `sdk`, `subsdk0`. `rtld` is dropped and linking is done by the host, as MacNativeGames does. +- Base: LAS Recomp's hand-written decoder (`lifter.py`) and NEON/FP lowering (`simd_c.py`, `simd.h`), MIT. Output: one C function per guest function, direct calls for `BL`, an address-keyed table for indirect branches. +- Rewritten for NX2navi scale: + - generator runs in parallel processes, with bounded memory per worker; + - jump tables resolved by our own symbolic pass instead of Unicorn, which keeps GPL code out of the shipped generator; + - `LDXP`/`STXP` (128-bit exclusive pairs) supported; + - no 64 MB limit on `main`; `subsdk*` loaded; + - NZCV and the six most used general registers of each function kept in C locals instead of the `Cpu` + (`recomp/flags.py`, `recomp/regs.py`): registers are stored back where they changed, before calls, SVCs and + exits, and reloaded after them. A call reloads only X0-X18 and X30, as AAPCS64 has the callee preserve X19-X29 and + SP; `gen.py --no-callee-saved-trust` reloads those too. +- Coverage oracle: MacNativeGames' NSO rewriter lists every site where game code touches the OS (SVCs, TLS reads, counter reads, `x18`, exclusive windows, jump tables): 68,968 sites in 1.4.3 `main`. The lifter must handle every one. +- Memory: guest address equals host address, all below 2^39 (IPC encodes 39-bit addresses). The heap, stacks and the alias region are reserved with `MEM_WRITE_WATCH`, so the graphics back end can ask which pages the CPU wrote since the last upload (`runtime/memory.c`). +- Indirect branches go through `rt_dispatch` (`runtime/dispatch.c`), which looks the target up in the address table and tail-calls it. +- Testing: LAS Recomp's differential harness, every lifted instruction class checked against Unicorn (test-only, never linked into the game). + +### 3. Host + +- Portable C from MacNativeGames: threads and synchronisation, IPC, memory services, fs/RomFS, time, account, applet, audio renderer and effects. The Apple pieces (mach VM, CommonCrypto, AudioToolbox, GameController) are replaced with Win32 and SDL3. +- SDK boundary at the `nn::*` function level, matching MacNativeGames. Only `audren:u` and `sm:` are real IPC services. +- Window, keyboard and mouse: Win32 (`gfx_window.c`, `input_win.c`). Gamepad and audio output: SDL3. Voice: libopus (BSD). Movies: the SDK's `movie::Decoder` is replaced by a host VP9 decoder over libvpx (BSD, static; `runtime/ov_movie.c`), because FFmpeg from MSYS2 is a GPL build. +- zstd: most RomFS files of 1.4.3 are zstd frames. The patch set `zstd` sends the game's two decoder entry points to + libzstd on the host (`ov_zstd.c`, `NX2NAVI_ZSTD_NATIVE`); the lifted decoder took almost three times as long. +- Settings and menu: every key with its default is in one table (`cfg.c`), read from `nx2navi.ini` and `NX2NAVI_*` + variables and written back when the in-game menu changes it. The menu and the performance overlay are Dear ImGui, + drawn into the swapchain image (`runtime/ui/`); their text is in `ui_text.c` (English, Russian, Brazilian Portuguese, + Simplified Chinese). The Chinese glyphs come from a system font (Microsoft YaHei, `plat_font_path`) merged into the + font atlas. +- OS calls the host makes go through `runtime/platform/` (`platform.h`, `win32.c`), so a Linux or macOS host adds one file instead of touching the rest. The split is not finished: `tools/check_platform.py` lists the Win32 uses left in the other files. + +#### Threads and cores + +Every guest thread is a host thread. NX2navi assumes Horizon's scheduler: three application cores, a thread runs only on a core in its affinity mask, and a higher-priority thread takes a core from a lower-priority one. The game keeps per-core data without locks and relies on that, so the host models it (`runtime/kernel.c`): + +- Three virtual cores. A guest thread runs guest code only while it holds a core; the others wait in a priority-ordered list. +- Preemption. When a waiting thread has a better priority than a holder on a core it may use, exactly one holder is flagged. The holder checks the flag at its next SVC and at every indirect call (`rt_dispatch`: two loads when nobody waits), checks again under the kernel lock that a better thread still waits, and only then hands its core over. The indirect-call check comes from SavageWindRecomp's BotW port; checking only at SVCs left a better thread waiting up to 26 ms. +- Asynchronous preemption (from MacNativeGames 8bf0893, on unless `NX2NAVI_ASYNC_PREEMPT=0`). Game code can run for + milliseconds with neither (`NX2NAVI_CORE_DIAG=1` measures it): a waiter that has spun 250 us suspends the holder and, + if its host rip is in lifted code at host depth 0 (not inside a host call or SVC), moves it to `kern_ap_stub`, which + saves the volatile registers and gives the core up there. A holder of a guest mutex counts at the priority of its + best waiter, and one inside an SDK spin lock (TLR+0x100 `disable_count`) is not preempted: its interrupt flag is set + and the switch happens at SVC 0x36. `NX2NAVI_ASYNC_PREEMPT=2` keeps those two without interrupting. The interruption is + Win32 (SuspendThread, SetThreadContext); another host needs a signal handler there, as MacNativeGames has. +- Host work gives the core back. Queue submits, presents, GPU waits, shader translation, `nn::fs` calls and NVN memory pool setup run without a core (`NVN_BLOCKING`, `kern_core_away`), as the Switch blocks those threads in IPC, so a thread blocked in the driver or on a file does not hold up guest threads. +- Spin waits. Loops that only another thread can end (857 in 1.4.3, 864 in 1.2.1, found by `tools/spin_waits.py`, the + nxnative search) send their back-edges through `rt_spin_gate`, which pauses the core once per pass and hands it to a + waiter after 50 us of polling (`NX2NAVI_SPIN`, `NX2NAVI_SPIN_HANDOFF_US`). +- `free_cores = 1` (`NX2NAVI_FREE_CORES=1`) turns the gate off, for experiments only: the game crashes or hangs, usually + at start, because its job workers all report core 0 and share per-core memory (#212). + +### 4. Graphics + +- NVN front end from MacNativeGames (`nvn_api_*.c`, `nvn_obj.h`, texture layout and deswizzle). The game records command buffers through it; nothing reaches the GPU until the game submits. +- Vulkan 1.3 back end in place of MacNativeGames' Metal one. At `QueueSubmitCommands` the recorded NVN commands are replayed into Vulkan command buffers (`vk_exec*.c`). +- Memory pools. Apple's unified memory let MacNativeGames use the game's pools zero-copy. The back end imports the pools as host memory (`VK_EXT_external_memory_host`). On a discrete GPU, pools bound as buffers are mirrored in device-local memory and the pages the CPU wrote (write watch, above) are uploaded before a replay; idle pool regions are made read-only so the write-watch queries skip them (`vk_memory.c`). GPU-rendered textures are written back when the CPU reads them: on a pool invalidate, on a CPU copy, and for small targets once the CPU waits for a fence (`vk_texture.c`). +- Replay thread. `NX2NAVI_REPLAY_ASYNC=1` moves the replay off the submitting thread onto a queue at most one frame behind the game; reads of GPU results wait for the newest writer instead of draining the queue (`vk_backend.c`). It is off by default. Where the game waits for the GPU it overlaps the replay with the game threads (a GTX 1650 in the Depths, issue #88), a gain measured only there; while it was the default, a GTX 1660 Ti at the 60 fps cap with the GPU at 26 % reported uneven motion (#659). It adds up to a frame of latency; `replay_async = 1` turns it on. +- Recorder thread. The Vulkan calls the replay makes into its command buffer are made by a thread of their own (`vk_rec.c`, after Savage Wind Recomp and LAS Recomp): each `vkCmd*` copies its arguments into a packet of a ring and the recorder makes the calls in order; calls into other command buffers are made at once; the recorder also ends the command buffer, and the submit waits until it has. In the town on an RX 9070 the replay takes 17% less time on the submitting thread. It is off by default on AMD GPUs, where the driver loses the device or hangs the GPU at startup with it (`NX2NAVI_VK_RECORDER=1` forces it on, `=0` makes every call on the submitting thread). +- Uniform snapshot. The game rewrites per-object uniform blocks on other threads soon after it submits the frame + that reads them, while the replay still records it. At the start of a submission's replay every uniform range it + binds from CPU-written pools is copied, and the draws bind the copy (`vk_usnap.c`, after MacNativeGames' + `NX2NAVI_UBO_SNAPSHOT`); without it, late draws read another object's matrix. +- Driver data. The NVN driver keeps a per-stage constant bank (c0) that shaders read for things like point size, dispatch size and base instance. The back end fills it the way the driver does. +- Shaders: the Ryujinx translator 1.3.2 with MacNativeGames' patches and ours (`tools/xlate/patches/`), built with .NET 10 NativeAOT as `nx2navi_xlate.exe` and run as a separate process. Its SPIR-V goes to Vulkan directly. `tools/prepare_shaders.py` and `nx2navi.exe --prepare-shaders` translate and compile the variants of MacNativeGames' shared list ahead of play (29,587 for 1.4.3); the rest are translated on first use and cached on disk. +- Pipelines: `VK_EXT_graphics_pipeline_library` where the driver has it. Shader stages are compiled ahead into libraries; a draw that meets a new state links them at once (fast link), and an optimised pipeline replaces the linked one when a background thread finishes it. Pipeline keys seen in play are saved and built at boot. A draw whose pipeline is not ready is skipped when one of its pass's targets was rendered in the previous frame, and waits otherwise, so one-shot passes are never lost; a full-screen draw is skipped as well rather than waiting (`NX2NAVI_PIPE_SKIP`); the stage libraries a waiting draw needs are built on idle workers in parallel (`NX2NAVI_PIPE_WAIT`). Without the extension, a missing pipeline is built on a worker and the draw waits or is skipped by the same rule. +- Resolution. Patch sets make the game read its output, swapchain and scene sizes from the patch page + (MacNativeGames' sites); `resolution.c` sets them from `output_res` and `render_scale` and grows the texture heap + and the application pool to match. When the window is larger than the output, `vk_fsr.c` runs AMD FSR 1 (EASU, + RCAS) on the present. An `output_res` that is not 16:9 (more than 1% off, `res_is_16x9`) also switches on the + `aspect` patch set, which hands the output's ratio to the camera, and `romfs.c` `overlay_init` loads the + `romfs-patches-x` overlay for it when it exists (`tools/make_romfs_patches.py --aspect`, laid out by + `tools/ultrawide_layout.py`; the installer builds fifteen sizes: 21:9 2560x1080, 3440x1440, 3840x1600, 5120x2160, + 32:9 3840x1080, 5120x1440, 16:10 1280x800, 1680x1050, 1920x1200, 2560x1600 and 3:2 1920x1280, 2160x1440, 2256x1504, + 2880x1920, 3000x2000). A wider layout moves the HUD to the + screen's corners, a narrower one to its top and bottom edges. Other sizes get the camera of their shape and the 16:9 + HUD stretched over it. The `aspect` setting (`fit`, the default; `stretch`) decides what the present does + when the window's shape differs from the output's: `fit` letterboxes, where a 16:9 game in a wider window used to be + stretched. +- HDR (`hdr = 1`, `vk_hdr.c`). The game tonemaps its scene into an r11g11b10f target, upscales it and draws the HUD + into another float target, and a last draw copies that into the 8-bit sRGB window texture it presents. With HDR on, + the tonemap's fragment shader (recognised by its constants and resource names, not a hash) runs as + `shaders/hdr_tonemap.frag`, which keeps highlights up to the display's peak; the present reads the float target the + window texture was copied from (any other last draw into it, such as a menu or a movie, leaves the window texture, + shown at the HUD's white); a compute pass turns the picture into PQ code values in Rec. 2020 for an HDR10 + swapchain, which FSR 1 or the blit then scale; the in-game menu is drawn into an RGBA8 image and blended on at the + HUD's white. Without an HDR10 surface format (Windows with "Use HDR" off, a compositor without colour management) + the swapchain stays SDR. `NX2NAVI_SHOTS` reads the window texture, so its pictures clip highlights in HDR. +- DLAA (`vk_dlaa.c`, `dlaa`, off by default). NVIDIA DLSS at the scene's own size, through the driver's NGX core loaded + at run time (no SDK code compiled in). It runs on the R11G11B10F light target right before the bloom chain's first + pass, so post effects and the HUD read the anti-aliased picture. The scene's draws get a sub-pixel Halton viewport + jitter; camera motion vectors are reprojected from the scene depth through this and last frame's view-projection of + the scene camera block (constant bank c4), in double precision on the CPU. Per-object motion (`dlaa_objmv`, + `vk_mvprev.c`, the per-object section of `vk_exec_draw.c`, translator patch 0015): solid scene draws whose position + reads an object's own uniform blocks (bones c5, place c7, c6) are drawn a second time with a vertex shader variant + that computes last frame's position from last frame's blocks (the game writes them into two copies that take turns; + the uniform snapshot keeps both) and writes the difference into the motion image. `NX2NAVI_MV_CHECK` measures the + vectors against the picture, `NX2NAVI_DLAA_TIMES` times the passes on the GPU. `fxaa` switches the game's own FXAA pass. +- Occlusion queries never block the CPU; a result that is not ready counts as visible. +- ASTC textures are uploaded as they are where the device reports `textureCompressionASTC_LDR`, and decoded by a compute shader everywhere else (`vk_astc.c`, `NX2NAVI_ASTC`). The CPU decoder (`tex_astc*.c`) is the fallback and the test oracle. +- Draw state. A draw whose program, bound state and textures repeat reuses the previous draw's shaders and skips rebuilding its descriptor sets; descriptor sets are written through update templates (`vk_exec_draw.c`, `vk_pipeline.c`). +- Allocation: Vulkan Memory Allocator. Debugging: Vulkan validation layers, per-pass frame dumps (`NX2NAVI_DUMP`, `vk_dump.c`) and a flight recorder (`NX2NAVI_FLIGHT`). RenderDoc cannot capture, because it hides `VK_EXT_external_memory_host` from the application. + +Maxwell behaviour the back end has to match, and the NX2navi bugs other ports fixed: [maxwell.md](maxwell.md). + +Why Vulkan rather than D3D12 or wgpu: + +- The translator emits SPIR-V, which Vulkan consumes as is. D3D12 would add a SPIR-V to DXIL step; wgpu would add SPIR-V to WGSL through Naga and drop features the game uses (bindless textures, some atomics). +- LAS Recomp's Vulkan back end is a working reference on Windows. +- The same back end runs on Linux. + +### 5. Toolchain + +- Generated C: MSYS2 UCRT64 Clang + LLD. The generated code uses GNU extensions (`__int128`, `musttail`, vector types) that `cl.exe` cannot compile. +- Host code: the same Clang, C11. +- Builds: `tools/build_game.py` writes a Ninja file and runs MSYS2 Ninja. Every object is hashed before linking, because a faulty RAM module once flipped bits in stored objects. +- Analysis: Ghidra with the Switch loader, Capstone, `llvm-objdump`. +- Players: the installer ([installer.md](installer.md)) builds the game code on the player's machine with a bundled llvm-mingw, so no recompiled code is ever distributed. + diff --git a/docs/building.md b/docs/building.md new file mode 100644 index 00000000..7eead6c4 --- /dev/null +++ b/docs/building.md @@ -0,0 +1,263 @@ +# Building from source + +Windows 10 or later, an x86-64 CPU with SSE4.2, and a GPU with Vulkan 1.3 and `VK_EXT_external_memory_host`. The +default build targets x86-64-v3 (AVX2/FMA); a CPU without them builds with `--cpu v2` instead and runs slower (see +"Build"). Allow about 60 GB for the work folder. Extraction wants about 55 GB free while it runs and keeps about 35 GB +afterwards. + +Players who only want to play can use the [installer](installer.md) instead: it builds the game on their machine +without this toolchain. + +## Toolchain + +Versions are the ones the build was verified with; newer patch releases are fine. + +| Tool | Version | Install | Used for | +|---|---|---|---| +| MSYS2 UCRT64 | clang/lld 23.1.3 | msys2.org installer to `C:\msys64`, packages below | compiling the generated C and the runtime | +| Visual Studio Build Tools | 2026, C++ workload, Windows SDK 10.0.26100 | winget `Microsoft.VisualStudio.BuildTools` with `--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended` | the linker .NET NativeAOT calls | +| .NET SDK | 10.0 | winget `Microsoft.DotNet.SDK.10` | the shader translator (`nx2navi_xlate.exe`) | +| Vulkan SDK | 1.4.363 | winget `KhronosGroup.VulkanSDK` | validation layers, `vulkaninfo` | +| uv | 0.13 | standalone installer from astral.sh | the two Python environments | +| hactool | 1.4.0 @ `1d64a83` | `.venv\Scripts\python tools\build_hactool.py`, see below | NCA and update extraction | + +MSYS2 packages, after `pacman -Syuu` (run it twice; the first pass updates the core and exits): + +```sh +pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-{clang,lld,ninja,gcc,make,pkgconf,sdl3,opus,libvpx,zstd,vulkan-devel,\ +vulkan-memory-allocator,vulkan-validation-layers,shaderc,spirv-tools} base-devel git unzip +``` + +`ffmpeg` from MSYS2 is a GPLv3 build and is never linked; the movies go through libvpx. + +PATH: + +- Add `C:\Program Files (x86)\Microsoft Visual Studio\Installer` to the user PATH: NativeAOT needs `vswhere.exe`, or + the publish fails at the link step (MSB3073). +- Another `cmake` or `ninja` earlier on PATH (a 32-bit winlibs MinGW, for example) is picked up by accident. The build + scripts call Ninja from `C:\msys64\ucrt64\bin` themselves; from a shell, put `C:\msys64\ucrt64\bin` first. + +### hactool + +`tools/build_hactool.py` fetches SciresM/hactool at `1d64a83` into `toolchain\src\hactool`, applies the three patches in +`tools/hactool/` and builds a static `toolchain\hactool\hactool.exe` with MSYS2 UCRT64 gcc (a few seconds): + +- `portable.patch`: the parts of MacNativeGames' `build_hactool()` that run on Windows, the `MNG_TITLE_KEYS` variable and + the two BKTR fixes in `nca.c` for the subsection table padding and the subsection layout of newer cumulative updates; +- `unicode.patch`: a manifest with `UTF-8`, so paths under a non-ASCII user profile + reach it intact; +- `mbedtls-asm-clobbers.patch`: the `memory` and `cc` clobbers the bundled mbedtls 2.6.1's x86-64 multiply asm lacks. + Without them a clang build (the Linux release) fails every RSA signature check and the update merge stops. + +hactool reads `-k `; MSYS2 shells set `HOME`, which hides its default key location, so pass `-k` there. + +## Build + +From the repository root, in PowerShell. Every step that depends on the game version takes it as ``: `v143` for +1.4.3, `v121` for 1.2.1 or `v110` for 1.1.0. The tools default to `v121` when `--version` is left out. Saves load on any +of them. + +1. Python environments (once). `.venv` runs the lifter and the build; `.venv-py314` runs the extraction scripts, which + need the stdlib `compression.zstd` of Python 3.14: + + ```powershell + uv venv --python 3.12 .venv + uv pip install --python .venv/Scripts/python.exe -r tools/requirements.txt + uv venv --python 3.14 .venv-py314 + uv pip install --python .venv-py314/Scripts/python.exe -r tools/requirements-py314.txt + ``` + +2. Copy `config.example.toml` to `config.local.toml` and set the paths to your base game, the update and your console's + keys file. `config.local.toml` is ignored by git. The tools read the keys file themselves. + +3. Extract and verify. This writes `build\extracted\v0` (1.0.0) and `build\extracted\` for each update in + `updates`, identified by its hash; a hash mismatch stops the run. With another `[work] dir` in `config.local.toml`, + `extracted` goes there instead, and `build_game.py` reads the ExeFS and RomFS from there: + + ```powershell + .venv-py314\Scripts\python tools\extract.py + ``` + +4. Shader translator (no game files; again after a change to its sources, and `tools\make_release.py` stops on an older + one). This publishes `build\xlate\nx2navi_xlate.exe`: + + ```powershell + .venv\Scripts\python tools\build_xlate.py + ``` + +5. Lift the modules to C, write the RomFS overlay (the frame-rate fix), then compile and link + `build\\nx2navi.exe`: + + ```powershell + .venv\Scripts\python recomp\gen.py --exefs build\extracted\\exefs --out generated\ --patches recomp\patches-.txt + .venv-py314\Scripts\python tools\make_romfs_patches.py --version + .venv\Scripts\python tools\build_game.py --version + ``` + + `--cpu v2` targets x86-64-v2 (SSE4.2, no AVX2/FMA) for older CPUs; the default `v3` needs AVX2. The v2 build links + `runtime/fma.c`, a correctly rounded software fma the FP lowering needs, and runs slower. Inline assembly, + target attributes and intrinsics are not bound by `-march`, so a v2 build runs `tools/check_isa.py` over the runtime + objects before it links: any AVX, BMI or other instruction above x86-64-v2 outside a function listed there as + dispatched by a runtime CPU check stops the build. + + `gen.py` sizes its emit pool from the CPU count and the free memory; `--jobs N` sets it, and so does the environment variable `NX2NAVI_LIFT_JOBS=N`, which the installer's lift step honours too (it has no `--jobs`). When a worker runs out of memory, the pool restarts with half the workers (`emit: out of memory with N workers, retrying with M`), down to one; only an out-of-memory error with one worker fails the step. + + Lifting takes about 15 s, a clean compile about 200 s on 24 threads; later builds recompile only what changed. + A compiler cache in front of clang shortens it further: with `SCCACHE` set to an sccache executable, `build_game.py` + writes it into the ninja file ahead of `cc`, and every lift rewrites the generated chunks with the same contents, so + a second build of the same version hits all of their objects: + + ```powershell + $env:SCCACHE = "path\to\sccache.exe" + .venv\Scripts\python tools\build_game.py --version + ``` + `--patches` builds in the frame-rate, resolution and other patch sets, switchable at run time. The link copies + `SDL3.dll`, `libiconv-2.dll` and `libopus-0.dll` next to the exe. + For Xbox button prompts, run `make_romfs_patches.py` twice more, with `--prompts xbox` and `--prompts xbox-label`: + they write `build\\romfs-patches-xbox` and `romfs-patches-xbox-label` ([controls.md](controls.md), "Xbox + button prompts"), which `build_game.py` copies next to `nx2navi.exe` like `romfs-patches`. `--prompts pc` writes + `romfs-patches-pc`, the keyboard and mouse prompts ([controls.md](controls.md), "PC button prompts"). + +6. Prepare the shaders (once per build folder and translator). It needs `refs\MacNativeGames` (`tools\fetch_refs.sh`) + for the shared shader list: + + ```powershell + .venv-py314\Scripts\python tools\prepare_shaders.py build\ --version + ``` + + Without this step the first launch compiles shaders and pipelines during play and stutters until the caches fill. + The AMD driver keeps its pipeline cache per exe path and holds a limited amount: preparing another build folder can + evict this one's. `nx2navi.exe --warm-shaders` rebuilds it from the shader cache. + When the driver's shader compiler crashes on a variant (NVIDIA 615.78.08 on an RTX 5080 does, issue #30), + `prepare_shaders.py` runs the driver step again with `--warm-shaders`, up to three times, without the variants the + driver was building at the crash. `shader-prepare-skip.txt` next to the exe lists them with the GPU and driver + version; they build at their first draw instead, another driver version builds them again, and so does deleting the + file. + +7. Run. The game keeps running when its window loses the focus (`assume_focus = 1` in `nx2navi.ini`, the default; the + Game tab switches it). With 0 it pauses, as it does on the Switch when Home is pressed. + + ```powershell + build\\nx2navi.exe + ``` + +Settings live in `nx2navi.ini` next to `nx2navi.exe` ([nx2navi.ini.example](../nx2navi.ini.example) lists them). Saves go to +`build\profile` for `v121` and `build\profile-` for other versions (`build_game.py --profile` changes it). + +### Portable folder + +`.venv\Scripts\python tools\package_build.py --version ` writes `build\-portable`, which runs on another of +your machines without MSYS2, Python or .NET. `romfs.bin` stays out unless you pass `--with-romfs`; otherwise put it in +`romfs\` next to the exe or point `NX2NAVI_ROMFS` at its folder. Run `nx2navi.exe --prepare-shaders` once in the copied +folder. The folder holds code and data derived from your game: for your own machines only. + +### Profile-guided build + +`build_game.py --pgo .profdata` compiles the generated code at -O2 with an execution profile, and the runtime +with it too: hot paths laid out straight, hot calls inlined, code that never ran compiled for size. On 1.4.3 the fight +bench ran 12-15% faster per frame and a fight outside the training about 6%. The installer builds with +`data/pgo-.profdata` of the release when the update has one, else at -O1. + +A profile only fits the generated C it was trained on: functions are matched by name and control-flow hash, so a +function whose C changes loses its counts without a warning. Retrain after a lifter or generator change, from a clean +`recomp/`. The instrumented build needs llvm-mingw, as MSYS2's clang has no profile runtime: + +```powershell +$llvm = "toolchain\llvm-mingw-\llvm-mingw--ucrt-x86_64" +.venv\Scripts\python tools\build_game.py --version v143 --out build\v143-pgogen --toolchain $llvm --pgo gen +``` + +Play `build\v143-pgogen\nx2navi.exe` through varied scenes (fights, towns, riding, building, the Depths, menus) for 20-30 +minutes; it is slower than a normal build. It writes `build\v143-pgogen\pgo\*.profraw` every minute and at exit. +Scripted runs from saves (`tools/run_game.py`) add to the same file. Then: + +```powershell +.venv\Scripts\python tools\pgo.py merge build\v143-pgogen --version v143 +``` + +writes `build\pgo\pgo-v143.profdata` and its record (`.json`: the `recomp/` tree it fits). `make_release.py` ships every +profile of `build\pgo` in `data\` and warns when a record names another `recomp/` tree than the one released. + +## Linux (in progress) + +The runtime builds and runs on x86-64 Linux with a window, input and menu on SDL3 (`*_sdl.c`) in place of the Win32 +files (`*_win.c`); `runtime/platform/linux.c` implements `platform.h`. Status: the selftest and the probes pass; 1.2.1 +plays at 60 fps on RADV (RX 7800 XT) and NVIDIA (RTX 3060); 1.4.3 builds, probes and plays on RADV (RX 6600, and the +Vega 7 of a Ryzen 5 4600G at about 34 fps). Long play sessions and the Steam Deck itself are not verified yet. + +Requirements: + +- Linux 6.7 or later: the write watch uses userfaultfd write protection with `PAGEMAP_SCAN`. SteamOS 3.8 qualifies. +- A Vulkan 1.3 driver with `VK_EXT_external_memory_host` (RADV, NVIDIA). +- Packages on Arch: + + ```sh + pacman -S --needed clang lld ninja make sdl3 opus libvpx zstd vulkan-headers vulkan-icd-loader \ + vulkan-validation-layers shaderc spirv-tools dotnet-sdk uv git + ``` + + Vulkan Memory Allocator is a single header (AUR `vulkan-memory-allocator`). Without it, `build_game.py` fetches the + version the Windows release pins (3.4.0) into `toolchain/vma/` on first use and checks its hash. + +The steps are the Windows ones with POSIX paths: `.venv/bin/python` in place of `.venv\Scripts\python`, and `nx2navi` in +place of `nx2navi.exe`. `build_game.py` takes clang, lld and Ninja from PATH (or the ones in `/bin` with +`--toolchain `) and links against the system libraries, with `libstdc++` static and an `$ORIGIN` rpath; +`build_hactool.py` builds `hactool` with make. `tools/prepare_shaders.py` reads the shader list from +`refs/MacNativeGames` at `origin/HEAD`, which must be the pinned commit with its history (the list format changed later). + +The probes open a window, so from an SSH session they need the desktop session's display, or they stop at `gpu 0 +skipped: no graphics+compute+present queue family`: on Wayland `XDG_RUNTIME_DIR=/run/user/$(id -u) +WAYLAND_DISPLAY=wayland-1 SDL_VIDEODRIVER=wayland` (the socket name is in `$XDG_RUNTIME_DIR`), on X11 `DISPLAY=:0`. + +Memory: on Windows the GPU imports guest memory and `GetWriteWatch` tracks the CPU's writes to it. On Linux, +re-protecting imported memory invalidates the driver's userptr buffer on every submit (about 1.3 ms per 16 MiB on +amdgpu), and importing pins the pages, which drops their write protection. Each CPU-visible pool therefore gets a +host-visible copy (shadow storage, `runtime/vk_memory.c`): the pages the CPU wrote go in before each submit, and the GPU's +writes come back at its fence. In play that costs about 0.2 ms a frame and doubles the memory of those pools (about +1.1 GB). `NX2NAVI_SHADOW=1` turns it on under Windows too. The Steam Deck's RADV has `VK_EXT_external_memory_host` as +well: the shadow copies are chosen for the measured cost above, not for a missing extension. + +The Deck's GPU (Van Gogh) has no native ASTC, so its textures go through the compute decoder (`runtime/vk_astc.c`, +`NX2NAVI_ASTC`) as on desktop AMD GPUs without it; frame times measured there include it. + +## Checks + +Before a commit: + +- `python tools/check_content.py --staged`: nothing game-derived is staged. CI runs the same check; + `git config core.hooksPath .githooks` runs it before each local commit. +- `build\\nx2navi.exe --selftest`: layout, dispatch table and host-function registry, without game files. + +A change to the button prompts (`tools/make_romfs_patches.py --prompts`, `tools/button_icons.py`) passes +`.venv-py314\Scripts\python tests\romfs_prompts_test.py`, which runs the tool on a RomFS it makes itself (no game +files); a change to the settings passes `nx2navi.exe --probe-cfg`. + +The lifter (`recomp/`) and the CPU headers (`runtime/cpu.h`, `runtime/simd.h`) are checked against Unicorn. Every lifter +change passes these, all run with `.venv`: + +| Test | Checks | Game files | +|---|---|---| +| `tests\diff\lift.py` | instructions sampled from the extracted modules; `--coverage` lists every word the lifter rejects or traps | yes | +| `tests\diff\simd.py` | the whole FP/SIMD encoding space | no | +| `tests\diff\atomic.py` | exclusive load/store sequences and ARMv8.1 atomics | no | +| `tests\diff\func.py` | whole functions as the generator emits them, loops, jump tables and calls included (calls go to a stub that checks the registers at the call) | yes | +| `tests\flags_check.py` | the function-local flag helpers of `runtime\cpu.h` against its packed ones | no | +| `tests\excl_mt.py` | the exclusive monitor helpers under contention and ABA, on several threads | no | +| `tests\jumptables_check.py` | `recomp/jumptables.py` against a Unicorn oracle; must report 0 disagreements, on 1.4.3 too | yes | + +A `--cpu v2` build passes the same differential tests with `--cflags=-march=x86-64-v2`; they compile `runtime/fma.c` +too, so they check the software fma the v2 build links rather than the C runtime's. + +Runtime probes, each a mode of `nx2navi.exe` (the list is at the top of `runtime/main.c`): `--probe-kernel`, +`--probe-vkexec`, `--probe-nvn-tex` and `--probe-shader` cover most runtime changes. `--probe-shader` and the draw +part of `--probe-vkexec` translate shaders of the census below: they look for `build//shaders/jobs.json` of the +exe's own version first, then of the other one. + +Shaders: `.venv-py314\Scripts\python tools\shader_census.py --version --translate` extracts every Maxwell shader +to `build\\shaders\` and runs it through the translator and `spirv-val`; failure groups go to `failures.txt`. +`tools\xlate_smoke.py` checks the translator alone, without game files. + +## Reverse engineering (optional) + +- Ghidra 12.1.2 with Adubbz's Ghidra-Switch-Loader in `toolchain\ghidra\` (JDK 21) opens the game modules (NSO). +- `tools\fetch_refs.sh` clones the upstream projects this port builds on into `refs\`, read-only. diff --git a/docs/cheats.md b/docs/cheats.md new file mode 100644 index 00000000..5ba2f3c2 --- /dev/null +++ b/docs/cheats.md @@ -0,0 +1,74 @@ +# Cheats + +The port reads Atmosphère cheat files, the format Switch homebrew and the emulators use. It ships no cheat files: a cheat file goes into a mod in the `mods` folder next to `nx2navi.exe`, like any other mod ([mods.md](mods.md)). Open the menu (F1) and switch the cheats on the Cheats tab. The switches are saved under `[cheats]` in `nx2navi.ini`. + +## Adding a cheat file + +1. Find the cheat file for your update. Cheat sites and collections name it after the first 8 bytes of the game's build id: + + | Update | File | + |---|---| + | 1.2.1 | `9B4E43650501A4D4.txt` | + | 1.4.3 | `277178B7DBA1B6D4.txt` | + + The Cheats tab names the file the installed game reads when no mod holds one, and `logs\nx2navi.log` says `cheats: no enabled mod holds cheats/.txt`. +2. Put it in the `cheats` folder of a mod, a folder of its own under `mods`: + + ``` + mods\ + My cheats\ + cheats\ + 277178B7DBA1B6D4.txt + ``` + + A download laid out for the Switch's SD card or an emulator works as it is: unpack it into a folder of its own under `mods`, and the port finds `atmosphere\contents\0100F2C0115B6000\cheats`, `contents\0100F2C0115B6000\cheats` or `0100F2C0115B6000\cheats` inside it. The file name's case does not matter. +3. Start the game. Cheats that write the game's memory work now. +4. Cheats that change the game's code need the game rebuilt with them. When the game starts and finds such cheats it did not build, it opens the setup's rebuild window, which builds them in (a few minutes; the shaders stay prepared) and starts the game again. Until then they are greyed out with "after the rebuild". When the rebuild fails or you cancel it, the game starts without them and does not try again for the same cheats; "Rebuild the game now" on the Cheats tab tries again. `mods_rebuild = off` under `[mods]` in `nx2navi.ini` turns the automatic rebuild off; running `NX2navi-Setup.exe` on the same folder does the same job by hand. Saves and settings are kept. +5. Switch the cheats on the Cheats tab of the menu. + +The Cheats tab lists the cheats grouped by mod, in the order of the Mods tab. A mod switched off on the Mods tab, or one the port cannot use, contributes no cheats; the change applies at the next start. The Mods tab says how many cheats each mod brought. + +## The file format + +Standard Atmosphère: a `[name]` line starts a cheat, `{name}` a master cheat that is always on, and the cheat's opcodes follow as 8-digit hex words. A name with no opcodes is shown as a heading. The file's title line (the one with `TID=`) is not shown. + +``` +[The Legend of Zelda: Ocarina of Time v1.4.3 TID=0100F2C0115B6000 BID=277178B7DBA1B6D4] + +[Player] +[A code cheat] +040A0000 XXXXXXXX YYYYYYYY + +[A data cheat (Hold ZL+X)] +80000104 +580F0000 XXXXXXXX +640F0000 00000000 YYYYYYYY +20000000 +``` + +The words above are placeholders: `XXXXXXXX` an offset, `YYYYYYYY` a value. + +Each cheat's switch is `cheat_ = 1`, where the hash is FNV-1a 32 of `/`. A name repeated in one file gets `#2`, `#3` and so on. The build names each code cheat the same way, so renaming a mod's folder resets its cheats' switches to off and makes the next start rebuild its code cheats. Rename the folder before you switch its cheats on. + +## How cheats run + +The game's code is compiled ahead of time, so a cheat cannot write new instructions into it while the game runs. The port sorts each cheat by what it writes (`tools/cheats.py` at setup, `runtime/cheats.c` in game): + +| Kind | What the cheat does | How the port runs it | +|---|---|---| +| code | Opcode 0 writes into main's code | Built into the game at setup as a patch set (`recomp/patches.py`); switches at once. | +| key | Code writes inside a button condition (`8` mask, writes, `21` else, the original words, `20`) | A patch set that is on while the cheat is on and the buttons are held. | +| data | Writes data only: heap, main's data, pointer chains, button conditions | Runs in a cheat VM after dmnt's, opcodes 0 to A, every presented frame while on. | +| master | `{name}` with code writes | A patch set that is always on. | +| restore | Writes back only the game's original instructions | Not needed: switching a cheat off restores them. Greyed out. | + +A cheat whose code writes call or jump into a code cave the cheat writes itself (into main's zero padding) gets the cave inlined at the call site. The setup builds the code cheats of every mod in the `mods` folder, switched on or off, so switching a mod on later needs only a restart. A code cheat added or edited after the last build waits for the rebuild; a data cheat runs at the next start. + +Not supported, and shown greyed out with the reason: + +- the 0xC and 0xF opcode extensions; +- opcode 5 with a register offset; +- code writes mixed with other opcodes, except the button pattern above; +- code writes that change the CPU flags differently from the game's instruction, or code caves with branches or pc-relative instructions. + +`build-cache\cheats.status` next to `nx2navi.exe`, written by the setup, records which cheats were built and how; the log line `cheats: ...` sums them up at start. When the code cheats cannot be built, the setup warns and installs the game without them. diff --git a/docs/controls.md b/docs/controls.md new file mode 100644 index 00000000..3569604a --- /dev/null +++ b/docs/controls.md @@ -0,0 +1,183 @@ +# Controls + +Input comes from the first SDL3 gamepad, the keyboard and the mouse, merged into one Switch controller (`runtime/input_win.c`). Buttons are ORed; each stick takes the source with the larger deflection. Keys and mouse buttons count only while the game window is in the foreground. `NX2NAVI_INPUT=none` disables both (automated runs). `NX2NAVI_*` settings can also be set in `nx2navi.ini` next to `nx2navi.exe` (`input = none`, `motion = 0`, `rumble = 0`); the environment overrides the file. `NX2NAVI_RUMBLE_STRENGTH` is the rumble strength in percent (0 to 300, default 130; 0 is the same as `rumble = 0`). `NX2NAVI_RUMBLE_CURVE` is the exponent applied to the amplitude before the strength (0.2 to 1.5, default 0.6; lower makes weak pulses stronger, 1 is linear). `NX2NAVI_RUMBLE_TRIGGERS=1` also drives the impulse triggers of an Xbox pad. + +`NX2NAVI_PAD_LAYOUT` (`pad_layout`, the *Button layout* row on the Controls tab, live) picks which face button is Switch A: + +- `nintendo`: by position, as on a Switch (the table below). +- `xbox`: south A, east B, west X, north Y, as an Xbox pad labels them; on a PlayStation pad cross is A, circle B, square X, triangle Y. +- `auto` (default): `nintendo` for a pad whose east button SDL reports labelled A (Switch Pro Controller, Nintendo-layout pads), `xbox` for the others. + +The log names the layout in effect (`input: gamepad layout ...`); the menu shows it under *Automatic*. Which controller's buttons the game's prompts show is `NX2NAVI_PROMPTS` (see Xbox button prompts below). 0.1.9's `pad_layout = xbox_prompts` is read as `pad_layout = nintendo` with `prompts = xbox`, and the menu writes it that way. + +| Switch | Gamepad (by position, Nintendo layout) | Keyboard and mouse | Action in the world | +|---|---|---|---| +| Left stick | left stick | W A S D | move | +| Right stick | right stick | mouse; arrow keys as a second source | camera | +| Y | west | left mouse button | attack | +| ZL | left trigger (over 50%) | right mouse button, Z | shield, lock on | +| ZR | right trigger (over 50%) | F, X | bow | +| X | north | Space | jump | +| B | south | Left Shift | run, cancel | +| A | east | E | interact, pick up | +| L | left shoulder | Q | abilities | +| R | right shoulder | R | throw weapon | +| Left stick click | left stick click | Left Ctrl | crouch | +| Right stick click | right stick click | C | first-person view | +| D-pad left, up, right, down | D-pad | 1 2 3 4 | quick-select | +| Plus | Start | Tab | menu, inventory | +| Minus | Back | M | map | +| Right stick shaken left and right | shake the right stick | G | detach a fused part from what object holds | + +Esc is unbound in the game; it opens the settings menu and releases the mouse cursor (see Mouse camera). Z and X duplicate ZL and ZR so menu pages turn with two neighbouring keys; the menu tabs (L, R) are Q and R. The mouse wheel is unbound. The bindings are the tables of `input_map` in `runtime/input_map.c`: the keys (platform-neutral key ids) and one gamepad table per layout (gamepad inputs by position); `runtime/input_win.c` translates Win32 virtual keys and SDL buttons. + +## Xbox button prompts + +`NX2NAVI_PROMPTS` (`prompts`, the *Button prompts* row on the Controls tab, read at start) picks the controller whose buttons the game's prompts show: `nintendo` (default) keeps the game's own, `xbox` shows an Xbox controller's, `pc` the keyboard and mouse (PC button prompts, below). + +- L, R, ZL, ZR, Plus and Minus become LB, RB, LT, RT, Menu and View, and the d-pad prompts a cross with an arrow for each direction meant. The letters on the keys are cut out in the game's own text font. +- A, B, X and Y name the label of the button the pad layout presses, so each prompt names the button to press. `pad_layout = nintendo` plays an Xbox pad by position: the right button, labelled B, does Switch A (interact, confirm), and the bottom one, labelled A, does Switch B (run, cancel), so the prompts swap A with B and X with Y. `xbox` and `auto` put Switch A on the button labelled A, and the letters stay. + +| Switch | `nintendo` layout | `xbox` or `auto` layout | +|---|---|---| +| A, B, X, Y | B, A, Y, X | A, B, X, Y | +| L, R | LB, RB | LB, RB | +| ZL, ZR | LT, RT | LT, RT | +| Plus, Minus | Menu, View | Menu, View | +| D-pad | cross | cross | + +The action prompt (`DoCommand_00`) shows its button in a diamond whose shape gives the face buttons' positions as on a Switch, with the other three letters around it. With `nintendo` its letters are swapped with the rest and every one names the button in that place. With `xbox` and `auto` the letters are right but the diamond keeps the Switch positions: A shows on its right, while the button labelled A is at the bottom. The sticks keep the Switch icons, and so do prompts drawn as fixed images (some tutorial animations). + +The prompts are part of the game's fonts, textures and messages, so they follow the layout and not the bindings. A button remapped with a `bind_` line or on the Controls tab keeps the prompt the game draws for it, which then names the wrong button. Use the Xbox prompts with the default bindings. + +The game reads its UI archive and fonts once at boot, so the prompts change at the next start, also after `pad_layout` changes between `nintendo` and the others (the menu says *prompts change after restart*); the buttons change at once. Under that note the menu offers *Restart now*: after a confirmation it writes `nx2navi.ini`, closes the game as *Quit game* does and starts the game again with the same command line, which waits until the old process is gone before it opens the log and the saves (`runtime/gfx_present.c`, `gfx_window_closed`; `plat_restart` and `plat_restart_wait` in `runtime/platform/win32.c` and `linux.c`). Progress since the last save is lost, as with *Quit game*; while the game writes a save, the confirmation waits. With `prompts = xbox` the game loads `romfs-patches-xbox` (`pad_layout = nintendo`) or `romfs-patches-xbox-label` (`xbox`, `auto`) next to `romfs-index.bin` in place of `romfs-patches` (`runtime/romfs.c`, `overlay_init`; `runtime/input_map.c`, `input_prompts_folder`): the same 60 fps patches, with the prompts drawn from the game's own files by `tools/make_romfs_patches.py --prompts xbox` or `--prompts xbox-label` (`tools/button_icons.py`, after MacNativeGames' `make_button_icons.py`), which the setup runs next to the plain one: + +- every prompt but the button guide in play is text in the button font, `scft/External.bfotf` in each `Font/Font*.Nin_NX_NVN.bfarc.zs`: glyphs U+E040 to U+E043 (A B X Y), U+E044 to U+E047 (L R ZL ZR), U+E04B and U+E04C (Plus, Minus), U+E049 and U+E060 to U+E065 (the d-pad). fontTools writes the font again, so the archives grow and the folder also carries the resource size table (`System/Resource/ResourceSizeTable.Product....rsizetable.zs`) with their entries raised by as much; without that the game stops at start. +- the button guide in play draws L and ZL from the images `Nt_KeyTexL_00` and `Nt_KeyTexZL_00` of the Common archive's `timg/__Combined.bntx`, painted with the same icons. The action prompt draws its button from `Nt_KeyTexA/B/X/Y_00`, whose image data is swapped for `nintendo`, and the diamond's letters are text the game takes from `LayoutMsg/DoCommand_00.msbt` of each language's `Mals` archive (and the layout's own text panes behind it), swapped the same way. + +The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay: ...` line in the log, when the folder is missing (an install made by an older setup, or one where the setup could not prepare it and showed a warning; running the setup again on the install folder writes it), when it fails its check, with a game resolution of another shape than 16:9 (its own UI layout wins; 16:10 and 21:9), and when the `romfs_mods` folder replaces one of its files: `romfs-patches` then loads in its place, where two overlays replacing one file would stop the game. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version --prompts xbox` (and `--prompts xbox-label`) writes `build\\romfs-patches-xbox` (`-label`); it needs fontTools from `tools/requirements-py314.txt`. `--xbox-prompts` is the older name of `--prompts xbox`. + +## PC button prompts + +`prompts = pc` (*PC* on the *Button prompts* row) shows the key or mouse button the default keyboard bindings press each Switch button with, whatever the pad layout. The game loads `romfs-patches-pc` in place of `romfs-patches`, written by `tools/make_romfs_patches.py --prompts pc` (`button_icons.py`, `pc_icons`), which the setup runs next to the Xbox ones: + +| Switch | Prompt | +|---|---| +| A, B, X, Y | E, Shift, Space, left click | +| L, R, ZL, ZR | Q, R, right click, F | +| Plus, Minus | Tab, M | +| D-pad | 1 (left), 2 (up), 3 (right), 4 (down), as a cross or the keys of the directions meant | +| Left stick, its press | W A S D (or the keys of the directions meant), Ctrl | +| Right stick, its press | the mouse, with an arrow for each direction meant, C | + +- The glyphs keep the width of the game's own, so the right-aligned guides do not run into their text. A key is a rounded square with its label cut out in the game's own text fonts; a mouse button is a mouse with that button filled and the others hollow. +- The button guide in play draws every button from images of the Common archive (`Nt_KeyTexA/B/X/Y/L/ZL_00`, `Nt_KeyTexLSt_00` and `_01`, the stick tilted and pressed): all of them are painted with the same icons. The letters of the action prompt's diamond are one character of the Normal font each: E, an arrow for Shift, a bar for Space, L and R for the mouse buttons. +- Like the Xbox prompts they follow the defaults and not the bindings. `--binds ` draws the first key of each `bind_` line of that file instead, for a folder made by hand. +- At a game resolution of another shape than 16:9 the game loads `romfs-patches-pc-x` in place of `romfs-patches-x` when it is there: the same prompts with that shape's UI layout, `make_romfs_patches.py --prompts pc --aspect x --out \romfs-patches-pc-x`. The setup does not write those, so without one the Switch prompts stay (*off at a game resolution not 16:9*). + +## Window keys + +| Key | Gamepad | Action | +|---|---|---| +| F1 or Esc | Minus and Plus together | open or close the settings menu; the game gets no input while it is open | +| F10 | L3 + R3 (both stick clicks) | performance overlay: off, frame rate, full panel | +| F11 | | borderless fullscreen on or off, saved to `nx2navi.ini` | + +The Minus+Plus combo never reaches the game. In the menu the arrow keys, the D-pad or the left stick move, Enter or A selects, Q and E or L and R switch tabs, Esc or B goes back (Switch button names, as in the table above). + +## Remapping + +The *Controls* tab of the settings menu lists, under the button layout, every Switch button, the eight stick directions the keys drive (movement and camera) and the shake key, each with two key cells and a controller cell. Select a cell, press A or Enter, then press the new key, mouse button or controller button; Esc or five seconds without a press cancel, and a controller button cancels a key cell. Delete, Backspace or X clears the selected cell. A key another action has moves to the new one (the description names the action it left); a controller button swaps with the one it replaces. A remapped controller button is physical: from then on the face buttons (A B X Y) stay where they are in both layouts, until the buttons are put back as the layout in use has them or *Reset all buttons* is chosen. F1, F8, F10, F11 and Esc cannot be bound (the menu, the flight recorder and the window keep them). Punctuation keys are named by their place on a US keyboard; the menu shows the character the keyboard layout in use puts there. + +The tab writes `nx2navi.ini` lines, one per Switch button or stick direction: `bind_