laitimes

Switch Simulator YUZU Progress Report 2022-January

author:YUZU
Switch Simulator YUZU Progress Report 2022-January

Switch Simulator YUZU Progress Report 2022-January

Hello everyone, this time, we have a lot of kernel changes, input fixes and new features for you, as well as many more NVIDIA driver fixes, user interface changes and more!

PSA for NVIDIA users: Part 3

As you know, regular NVIDIA desktop and laptop GPUs do not support decoding ASTC textures, so yuzu uses the computing power of the GPU to parallelize processing. However, the recently released 511.XX driver introduces an issue that affects our accelerated ASTC texture decoding based on compute shaders.

Switch Simulator YUZU Progress Report 2022-January

Super Mario Odyssey

Switch Simulator YUZU Progress Report 2022-January

Super Mario Odyssey

After some investigation, it was found that the cause of the bug was that the new driver introduced over-optimization (optimization of one scenario would lead to problems in another). We made minor changes and solved the problem.

Users playing Zelda Invincible: Apocalypse or Luigi Haunted House 3 should stick with 47X. XX series drivers, because any newer version than it will have several rendering issues. Don't worry, we're investigating the cause! The late 5XX.XX series driver will be better.

Switch Simulator YUZU Progress Report 2022-January

Zelda Matchless: Apocalypse of Calamity

Version 511.65, on the other hand, includes support for the recently released Vulkan 1.3 and significantly improves performance when using this API. Some games have a performance boost of up to 24%!

New legends

Finally, after more than two decades, the Pokémon series got rid of its antiquated formula and made a major change in gameplay in the recently released game Pokémon Legends: Al Zeus.

In addition to the disappointing graphics, the release of this game exposed several issues with Yuzu and even helped us solve long-standing problems that affected more games.

The deadlock we found in the code migrates threads between kernels , which leads to some notable soft locks appearing in Pokémon Legends: Al Zeus.

The problem can be summarized as follows: one thread (thread A) will wait for another (thread B) to release the lock, and conversely, thread B will wait for thread A to release another lock, resulting in a deadlock.

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

Starting with kernel issues, epicboy implements various GPU changes.

He found that reducing the number of buffer allocations at the beginning, not just at the end, prevented the game from crashing at some point.

Some Vulkan drivers, notably Intel Windows drivers, cannot handle 64-bit atomic operations (operations that can run independently of any other process). epicboy added support for unsigned 2x32-bit atomic operations in yuzu because this is a fallback option used by such drivers. With this change, the game will be able to launch on Intel GPUs using Vulkan.

AMD has a long-standing issue with Transform Feedback in their official Windows and Linux drivers, resulting in rendering issues in countless games. Although this issue was recently addressed in the Linux AMDVLK driver, it is still necessary to tell the AMD Windows driver which Execution Mode will be used next time.

Before getting started with Xfb Execution Mode, Transform Feedback solves all the issues associated with it on the AMD Windows Vulkan driver, benefiting not only Pokémon Legends: Al Zeus, but also games like Xenoblade 2, Xenoblade: Decisive Edition, Hellblade: Xena's Sacrifice, Donkey Kong: Tropical Cold Current, Pokémon Tekken DX, and many other games.

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

Switch Simulator YUZU Progress Report 2022-January

Xenoblade: Decisive Edition

Switch Simulator YUZU Progress Report 2022-January

Xenoblade: Decisive Edition

Switch Simulator YUZU Progress Report 2022-January

Donkey Kong: Tropical freeze

Switch Simulator YUZU Progress Report 2022-January

Donkey Kong: Tropical freeze

Pokémon Legends: Arzeus is affected by the apex explosion, taking on a texture that looks like a random stretch. The bad news is that this is a problem with Buffer Cache, and it will take quite a long time to fix it.

The good news is that, with the help of Blinkhawk, an ad hoc solution was managed to avoid the problem, and a permanent solution began to take shape. Flushing buffers before writing saves us from polygon hell with minimal performance cost.

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

From this day on, we will start planning another buffer cache rewrite.

Initially, Arceus' VRAM usage was significantly higher than normal, causing 2GB GPU users to crash in cutscenes. Blinkhawk's solution is to extend the specific direction of buffer cache increments, rather than the previous method of doubling the size. This allows 2GB users to play the game normally, while 4GB users can scale up to 2x without worrying about crashes.

Here are some general recommendations:

Saving from previous Switch Pokémon games will unlock special costume options after the tutorial is over.

We tested the (current) latest 22.2.1 AMD Windows driver with a small performance improvement, as mentioned earlier, with a 24% improvement in the 511.65 NVIDIA Windows driver. Thanks to the help provided by Vulkan 1.3.

Regarding GPU precision, while Normal produces the highest performance, High allows correct particle rendering, so if you want extra precision and have spare performance, use High.

Effects, particles, and some attacks don't seem to render correctly at resolutions above native 1x. While we're investigating what's causing this, it also seems to be happening on the Switch itself, so this could just be the essence of these shaders (which feel reminiscent of 3DS Pokémon games), so if you want the right rendering, opt for 1X mode.

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

The default setting for yuzu is to use GLASM to run the game in OpenGL, often referred to as an assembly shader. These settings can create strange shadows on the character, and the solution is to use GLSL instead of GLASM, or follow our advice and switch to Vulkan completely.

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

Switch Simulator YUZU Progress Report 2022-January

Pokémon Legend: Arzeus

Users of Radeon GPUs running Windows earlier than the 400 series will experience crashes due to outdated and unsupported drivers. Even a modified driver doesn't seem to help, so the only solution is Linux with the still supported and faster Mesa driver.

Finally, overuse of mod or higher for heterosexual filtering can cause some GPUs to cause video memory overflow. We are still investigating the cause of this.

Other graphic fixes

Blinkhawk has made some changes to the garbage collector (GC) with many bug fixes, improved algorithms to make it clean up memory in a smarter way, and made it more efficient for iGPUs.

The minimal, expected, and critical thresholds have been rebalanced so it won't be as aggressive on GPUs with more video memory, while it can still do the job within the acceptable range of low-memory graphics cards. In addition, yuzu can now query the size of GPU memory instead of estimating it, allowing the GC to make better decisions when cleaning. These changes are designed to maximize the benefits of both low-end and high-end GPUs without negatively impacting either side.

Special consideration is given to ASTC textures because they place a very heavy load on memory. This GC cleans them up prematurely, resulting in graphics corruption in games that use these resources. For this reason, determining when to clean up ASTC textures becomes less restrictive, which should alleviate the problem in most cases.

Although these changes were originally YFC projects, Blinkhawk decided to implement these changes now to alleviate GC executions with issues related to the past. There's a lot more to do on this project, so stay tuned for more information in future updates.

Keep in mind that special cases such as Xeno Locks still require 3GB or more of video memory to emulate correctly.

On the other hand, some games, such as super mario 64 ports (home-made simulation software), will encounter stuckness in some GPU models, especially iGPU.

Blinkhawk investigated the problem and noticed that it was in our Vulkan scheduler, which was a problem with abstract command buffers, so it could perform OpenGL-like operations in the Vulkan environment.

Because the scheduler manages the order in which it must queue GPU commands before sending them to the device, the correct timing of the guard logic used to determine this is critical.

Previously, the scheduler would only queue commands blocks with type offsets that were not zero. The problem occurs because there is a particular valid type of command whose offset is actually zero. Not considering this situation hinders the scheduler's isolation logic from performing its work properly.

Thankfully, the solution doesn't require any difficult changes, and Blinkhawk was able to solve this particular problem by submitting a simple patch.

Switch Simulator YUZU Progress Report 2022-January

Super Mario 64

Kernel changes

The code for memory management (one of the features of the kernel) was originally written in early 2020 based on information available at the time. Since then, the operating system of the Nintendo Switch has undergone several updates, as well as new files obtained through reverse engineering.

For this reason, Bunnei has been examining every part of the code used to manage memory, focusing on improving the stability and accuracy of the kernel.

These changes involve refreshing memory property definitions and permissions, so they match the latest behavior of HorizonOS (the translation layer of the switich system) a little closer. Most of the code used to map and unmap memory has been collated, and various features have been renamed to match the official name. Code for allocating and clearing heap memory Review complete.

This new implementation should perform better and also make the code easier to read and navigate.

In an investigation with Pokémon Swords/Shields, Bunnei found that they were related to competitive conditions.

The first occurs when a new session is opened for the service: that is, yuzu creates a host thread (non-impersonated thread) where service session requests can be dispatched asynchronously. At the end of the meeting, host thread removed the end session from the trace list while adding a new session, which led to a race condition.

When a game wants to send some audio to the speakers for playback, requests that some graphics be loaded into memory, the game requests service. Pokémon Sword/Shield in particular, it opens and closes LDN service sessions very frequently, which is why it is one of the most affected games.

By introducing worker threads to manage the list of services, only one thread is now able to create or destroy service sessions, preventing crashes.

After this, Bunnei revisits the code used to exit the thread and discovers that another race condition has occurred, where thread references are broken while they can still be selected for scheduling, resulting in a crash.

The solution is to more accurately reimplement the thread termination code to match HorizonOS. yuzu now waits for the thread to unschedulate from all cores before closing it, so that it is destroyed only if it is no longer running.

Another long-standing problem is that the Pokémon Sword/Shield is related to code for advanced emulation (HLE) service thread management.

When a game requests certain services, instead of emulating the internal logic of the Nintendo Switch operating system (which would be low-level emulation, LLE), yuzu runs an implementation written by a developer that performs the same job on the user's computer.

These HLE services need to be able to interact with the emulated kernel in order to acquire locks and triggers for rescheduling, and so on. Yuzu uses dummy threads, which are created as simulated KThread entities.

A dummy thread creates a host thread for each person to run in the user's computer service interface so that whenever the kernel needs to work with the host thread, it can be used through these dummy threads.

Previously, these dummy threads were not released when their main thread was destroyed, so they accumulated over time. Because the kernel has a limit on the number of threads a process can create, yuzu ultimately cannot create more threads to open the service interface during a long game session. In addition, these virtual threads may inadvertently be scheduled on the emulated kernel, causing crashes because they are not really threads to run.

After investigating these issues, Bunnei implemented various fixes and checks to correct this erroneous behavior and prevent resource leaks and crashes.

Next, bunnei fixed the KThread counter increment/decrement operation because the old implementation was incorrect and could occasionally underflow. This is the previously mentioned counter that tracks all KThreads in one process, ensuring that the restrictions imposed by the kernel are not violated.

epicboy also took a look at the kernel and added a new shutdown method to properly synchronize threads before they shut down. This change fixes a hang that could occur when the simulation is stopped in yuzu.

User interface improvements

In a series of minor changes, many contributors decided to improve and correct some of the elements displayed on our interface, as well as the way users interact with them.

German77 noted that certain items, such as the Stop and Start buttons, would not be disabled once the simulation process stopped, and fixed this error behavior in time .

He also went on to implement a UDP where the controller shows the battery level. Although this code has been in yuzu's source code for some time, preparing the appropriate front-end graphics and subsequent implementations in the UI has been unsolved.

Switch Simulator YUZU Progress Report 2022-January

Updated the AMD FidelityFX Super Resolution (FSR) dependency to the latest version, Moonlacer changed the text string to replace the parentheses around the parentheses Vulkan Only parentheses message to be consistent with all other text in our interface.

Similarly, gidoly corrected a series of spelling errors in the string describing the name of the commercial gamepad, namely the PlayStation and Xbox controllers.

According to our discord server, gidoly has also made the necessary changes to make the Dark Colorful theme the default theme to use when running yuzu on Windows for the first time.

v1993 has also made changes to now use a color theme that allows Qt to use system-wide colors on *NIX systems instead of forcing black.

Switch Simulator YUZU Progress Report 2022-January

Of course, users can still change the theme through the configuration settings if needed.

Input changes

Users report that the game Pocket Power Baseball R, as well as other games of Live Power Baseball, crash in the game. This is done by the SetNpadAnalogStickUseCenterClamp service capable of initializing the applet_resource subsystem even if it was not initialized before. Emulating this behavior resolves the issue and makes certain game modes playable . However, some game modes still show that yuzu lacks support for certain vertex formats, resulting in crashes.

Switch Simulator YUZU Progress Report 2022-January

Pocket Power Baseball R

yuzu will now show only the controller types supported by the game, depending on the compatibility report for each game.

Fullkey is the code name used by Nintendo to refer to a generic type of controller that reports itself as a Pro Controller if you connect an "unsupported" gamepad. This can be referred to the GameCube, NES, SNES, N64, and Sega Genesis controllers. If a problem occurs, the console falls back to reporting Pro controllers for these types of controllers. German77 has also added this feature .

Added support to allow devices that only have accelerometers to act as somatosensory devices . While this means broader support, the lack of gyroscopes means poor somatosensory results because certain axis movements are not recorded.

With the help of v1993, german77 fixed the mapping of UDP controllers (any device connected using the cemuhook protocol). Motion now maps automatically correctly, and manual mapping does not reset the devices in the input list.

In a separate PR, at the request of v1993, german77 added support for the Home and Touch buttons on UDP connections.

Some somatosensory devices can enter very precise values, and if the threshold is too high, the somatosensory values will be ignored. Lowering the threshold for gyro data fixes this issue.

While playing Mario Tennis in swing mode, the somatosensory may suddenly stop working. This is because the update rate interval for somatosensory data is set too high. Reduces the somatosensory update rate to 10 ms recoverable function .

Also related to somatosensory simulation, the quality and sensitivity of the device also affect gameplay. As a way of compensating, german77 introduces an option to configure gyro thresholds, which you can find if you have a controller that supports somatosensory (dual Joy-Cons in the example). Configure the > Settings in Simulation... > Control.

Switch Simulator YUZU Progress Report 2022-January

Configure gyro thresholds

Enter 2-player Pokémon Let's Go! Pikachu · Let's Go! Ibrahimovic needs to make a shaking motion. The analog vibrations on the keyboard are too weak to be recorded by the game, so its "force" is increased to shake things to allow for local multiplayer gaming.

One of the features missing at the time of release project kraken, input override, is mouse somatosensory support. German77 reintroduced support for it, now using the mouse wheel as input to the Z axis. In addition, the mouse buttons get their correct names when they are mapped.

Another feature that somehow missed memos is the stick modifier for keyboard input , holding down the map key to lower the restriction on moving the analog stick. For example, when using the default keyboard mapping, if you hold down shift, the left analog stick can only move up to 50% of its range, allowing keyboard users to walk.

We recently introduced controller UI navigation. While comfortable, some users run external programs to convert controller input to keyboard and mouse input. For them, added a switch to disable controller navigation in the Analog > settings... > Control > Advanced > Controller Navigation.

Switch Simulator YUZU Progress Report 2022-January

Controller navigation

By default, yuzu assumes that non-Nintendo Switch controllers, such as Xbox controllers, will use vibrating motors. And the exponential amplitude curve is used to handle their rumbles, which makes this method incompatible with simulated precision vibrations. Instead, the DS5 controllers on the PlayStation 5 use more expensive linear actuators (and require linear amplitude curves), such as the switch pro controller and the Joy-Con controller. With this change, German77 expands support for the official PlayStation 5 controller DS5, which achieves the precision required for precise vibration.

General changes and bug fixes

TAS scripts sometimes get errors that cause yuzu to crash. Append code Adds error handling to the TAS script to prevent these crashes.

Windows has a nasty hidden limit, which is the maximum open file limit that a program can use. Some game mods can contain many, many files, exceeding the previous 4096 limit. Therefore, Morph doubles the limit to 8192 .

v1993 has been working on PVS-Studio and works very well. So far, in four separate inputs to the relevant area, shader recompilers and even kernel emulation!

Thanks v1993! There's nothing better than cleaner code, especially if it solves the out-of-bounds problem.

Morph interrupts the SetCpuOverclockEnabled service (you don't need to overclock the host CPU on the fly at simulation time). This allows superbikes to start zero, but nothing is yet displayed on the screen due to the lack of texture format support.

Finally, german77 implements the 32-bit variant of The Watchdog Call (SVC), SynchronizePreemptionState, a playable Wing of Jihad 2.

Switch Simulator YUZU Progress Report 2022-January

Wings of Jihad 2

At the same time, Liushuyu updated the dynamic external submodule, providing optimizations and fixing compilation errors caused by another external update, fmtlibrary — for formatting text in the yuzu logs and interface.

German77 has also added new hotkeys that allow users to manipulate the volume using the gamepad's ability to use the app directly, which is sure to come in handy for those enjoying grapefruit on a comfortable couch.

By default, Home + D-Pad Right will mute the app, while Home + D-Pad Down will lower the volume and Home + D-Pad Up will increase it. Users can change these mappings at will through the configuration menu simulation > settings > hotkeys.

Switch Simulator YUZU Progress Report 2022-January

Hotkey settings

In making this change, german77 noticed that the formula used to convert from a percentage value to "loudness" (i.e., output power) was too aggressive below the 70% mark, making the volume very soft in this range. Therefore, he decided to modify the formula to make the conversion smoother over the entire percentage value range.

Switch Simulator YUZU Progress Report 2022-January

Sound smooth curves

Future changes

Our development projects are progressing well. For example, German77 is enjoying some features that are in high demand. One of the top-secret projects rodrigo was previously unfinished to turn green , Host Conditional Rendering. Expect to hear more project Y.F.C. in the future.

Now let's look at some of the small leaks of recent internal tests: Marvel Ultimate League 3 Black Order jumped from 19 FPS to 51 FPS, your enemy's ink in Jet Fighter 2 works fine, and both changes improve Vulkan.

Switch Simulator YUZU Progress Report 2022-January

Marvel Ultimate League 3 Black Order

Switch Simulator YUZU Progress Report 2022-January

Marvel Ultimate League 3 Black Order

That's all there is to it in January! It's great to have you here and hope we see you again next month!

Thank you for liking, following, and forwarding.