Neo 53d32a761e Improve "Add raw copy dependencies for incompatible textures"
Initial PR was made by Avan for Ryubing.

This allows for Trails in the Sky 1st Chapter (and by extension Trails through Daybreak, Trails through Daybreak II, Trails Beyond the Horizon, and the future Trails in the Sky 2nd Chapter – tested via demo – to be fully playable.

Initial PR caused issues on macOS devices, specifically crashing in certain games (such as Mario Kart 8 Deluxe and the aforementioned Trails games). It was reverted on the original Ryubing project (at the time of writing this description) for causing small rendering issues on The Legend of Zelda: Breath of the Wild.

The rendering issues do not appear on macOS.

This commit improves the original PR by eliminating said macOS crash.

Trails in the Sky 1st writes its exposure/brightness value through an R32G32Float 1x1 texture and later reads the raw bits back through an R32Uint 2x1 texture mapped to the same guest memory. The two texture formats/dimensions are fully incompatible as texture views, so they end
up as separate host textures, and nothing kept their contents coherent - the reader saw stale zeroed data, making the exposure calculation (and the rendered image) too dark. (This is the initial fix for the game)

TextureGroup already had a raw-copy dependency mechanism intended to
handle this class of alias (TextureDependency, TextureGroupHandle
raw-copy plumbing), gated by CanCreateRawCopyDependency's strict same-guest-memory checks. This commit fixes three bugs that kept that mechanism from working correctly (and thus crashing Trails and other games, such as Mario Kart 8 Deluxe):

(1) TextureGroup.InitializeOverlaps() and TextureGroup.RegisterIncompatibleOverlap() only forwarded overlaps to CreateCopyDependency() when compatibility was LayoutIncompatible or better, silently excluding the fully Incompatible case the raw-copy path exists for. Widened both guards to let Incompatible overlaps through so CanCreateRawCopyDependency actually gets a chance to run.

(2) Once Incompatible overlaps were allowed through, CreateCopyDependency(TextureGroup, ...) could still fall back to a regular, non-raw textureCopy for such pairs, since ViewLayoutCompatible/CopySizeMatches only check byte size and were never meant to reason about fully incompatible pairs (e.g. a depth format aliasing a color format with the same byte size). On Vulkan running through MoltenVK on macOS, that non-raw copy path requires a pixel-format-reinterpreting texture view, and MoltenVK/Metal refuses to create any view onto a depth-format texture ("not castable"), aborting emulation. textureCopy is now forced false for Incompatible pairs, leaving raw copy (which already excludes depth/stencil formats) as the only route for that severity level.

(3) TextureGroupHandle.Inherit() copied a handle's pending DeferredCopy to the new handle when a view was recreated, but did not copy DeferredCopyRaw alongside it. A handle that inherited a pending raw copy would then execute it through the regular (non-raw) CopyTo path once acknowledged, reinterpreting the source bytes with the wrong row layout and corrupting the image - visible as vertical flickering stripes whenever a view happened to be recreated with a raw copy still pending. DeferredCopyRaw is now carried over together with DeferredCopy.

(As mentioned earlier, vertical stripes aren't present on macOS, so (3) doesn't negatively have an effect on macOS in any way).
2026-08-29 10:49:56 -05:00
2026-05-16 18:25:16 -05:00
2023-01-10 19:00:14 +01:00
2025-05-17 20:53:45 -05:00
2022-12-02 15:22:21 +01:00
2026-01-21 10:03:25 -06:00
2026-01-21 10:03:25 -06:00
2026-05-16 17:27:40 -05:00
2026-01-21 10:03:25 -06:00
2026-05-16 18:25:16 -05:00
2026-05-16 18:25:16 -05:00


Kenji-NX
Kenji-NX

Latest Desktop Release Latest Android Release
Discord

Kenji-NX is an open-source Nintendo Switch emulator, originally created by gdkchan, written in C#. This emulator aims at providing excellent accuracy and performance, a user-friendly interface and consistent builds. It was written from scratch and development on the project began in September 2017. Kenji-NX is available on GitHub under the MIT license.

On October 1st 2024, Ryujinx was discontinued as the creator was forced to abandon the project.

This fork is not a Ryujinx revival project; it aims to be a middle ground between GreemDev's Ryujinx fork and the more preservative ryujinx-mirror fork. It brings over many of the front-facing features from the aforementioned forks with additional contributions from KeatonTheBot and others.

Compatibility

As of May 2024, Ryujinx has been tested on approximately 4,300 titles; over 4,100 boot past menus and into gameplay, with roughly 3,550 of those being considered playable.

Anyone is free to submit a new game test or update an existing game test entry; simply follow the new issue template and testing guidelines, or post as a reply to the applicable game issue. Use the search function to see if a game has been tested already!

Usage

To run this emulator, your PC must be equipped with at least 8GiB of RAM; failing to meet this requirement may result in a poor gameplay experience or unexpected crashes.

Latest build

These builds are compiled automatically for each commit on the master branch. While we strive to ensure optimal stability and performance prior to pushing an update, our automated builds may be unstable or completely broken.

Automated builds are temporarily disabled, but builds for all platforms will be manually compiled and uploaded until the workflows are fixed.

Documentation

If you are planning to contribute or just want to learn more about this project please read through our documentation.

Building

If you wish to build the emulator yourself, follow these steps:

Step 1

Install the .NET 10.0 (or higher) SDK. Make sure your SDK version is higher or equal to the required version specified in global.json.

Step 2

Either use git clone https://git.ryujinx.app/projects/Kenji-NX on the command line to clone the repository or use Code --> Download zip button to get the files.

Step 3

To build Kenji-NX, open a command prompt inside the project directory. You can quickly access it on Windows by holding shift in File Explorer, then right clicking and selecting Open command window here. Then type the following command: dotnet build -c Release -o build the built files will be found in the newly created build directory.

System files are stored in the Ryujinx folder. This folder is located in the user folder, which can be accessed by clicking Open Ryujinx Folder under the File menu in the GUI.

Features

  • Audio

    Audio output is entirely supported, audio input (microphone) isn't supported. We use C# wrappers for OpenAL, and SDL2 & libsoundio as fallbacks.

  • CPU

    The CPU emulator, ARMeilleure, emulates an ARMv8 CPU and currently has support for most 64-bit ARMv8 and some of the ARMv7 (and older) instructions, including partial 32-bit support. It translates the ARM code to a custom IR, performs a few optimizations, and turns that into x86 code. There are three memory manager options available depending on the user's preference, leveraging both software-based (slower) and host-mapped modes (much faster). The fastest option (host, unchecked) is set by default. Kenji-NX also features an optional Profiled Persistent Translation Cache, which essentially caches translated functions so that they do not need to be translated every time the game loads. The net result is a significant reduction in load times (the amount of time between launching a game and arriving at the title screen) for nearly every game. NOTE: This feature is enabled by default in the Options menu > System tab. You must launch the game at least twice to the title screen or beyond before performance improvements are unlocked on the third launch! These improvements are permanent and do not require any extra launches going forward.

  • GPU

    The GPU emulator emulates the Switch's Maxwell GPU using either the OpenGL (version 4.5 minimum), Vulkan, or Metal (via MoltenVK) APIs through a custom build of OpenTK or Silk.NET respectively. There are currently six graphics enhancements available to the end user in Kenji-NX: Disk Shader Caching, Resolution Scaling, Anti-Aliasing, Scaling Filters (including FSR), Anisotropic Filtering and Aspect Ratio Adjustment. These enhancements can be adjusted or toggled as desired in the GUI.

  • Input

    We currently have support for keyboard, mouse, touch input, JoyCon input support, and nearly all controllers. Motion controls are natively supported in most cases; for dual-JoyCon motion support, DS4Windows or BetterJoy are currently required. In all scenarios, you can set up everything inside the input configuration menu.

  • DLC & Modifications

    Kenji-NX is able to manage add-on content/downloadable content through the GUI. Mods (romfs, exefs, and runtime mods such as cheats) are also supported; the GUI contains a shortcut to open the respective mods folder for a particular game.

  • Configuration

    The emulator has settings for enabling or disabling some logging, remapping controllers, and more. You can configure all of them through the graphical interface or manually through the config file, Config.json, found in the user folder which can be accessed by clicking Open Ryujinx Folder under the File menu in the GUI.

License

This software is licensed under the terms of the MIT license. This project makes use of code authored by the libvpx project, licensed under BSD and the ffmpeg project, licensed under LGPLv3. See LICENSE.txt and THIRDPARTY.md for more details.

Credits

  • LibHac is used for our file-system.
  • AmiiboAPI is used in our Amiibo emulation.
  • ldn_mitm is used for one of our available multiplayer modes.
  • ShellLink is used for Windows shortcut generation.
S
Description
No description provided
Readme
64 MiB
Languages
C# 95.3%
GLSL 3.3%
C 1.1%
HLSL 0.2%