Merge branch 'hugo' into patch-2

This commit is contained in:
Ren 2020-12-12 01:22:49 -06:00 committed by GitHub
commit 8137ff5787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 271 additions and 1 deletions

View file

@ -5,6 +5,8 @@ on:
branches: [ hugo ] branches: [ hugo ]
pull_request: pull_request:
branches: [ hugo ] branches: [ hugo ]
schedule:
- cron: 25 0 * * *
jobs: jobs:
build: build:

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View file

@ -0,0 +1,103 @@
+++
date = "2020-12-03T1:45:00+01:00"
title = "Mini-Series - Dev Interview #3"
author = "MysticExile"
forum = 332192
+++
Hey there yuz-ers, welcome to the third Developer Interview! It's been a while since the last installment of this mini-series, so let's jump right into the good stuff.
<!--more-->
***
This time we're interviewing the myth, the legend, [epicboy](https://github.com/ameerj)! He is the main reason why we have [NVDEC](https://github.com/yuzu-emu/yuzu/pull/4729) now!
If you didn't know already, NVDEC is Nvidia's video decoder used by the Nintendo Switch. Without him, we wouldn't be able to watch videos like `Fire Emblem: Three House's` intro or `The Legend of Zelda: Breath of the Wild's` memories.
But that's not the only thing he has done!
He was also responsible for [asynchronous shader compilation on the Vulkan renderer](https://github.com/yuzu-emu/yuzu/pull/4443), [GameCube Controller support](https://github.com/yuzu-emu/yuzu/pull/4137), and [Alpha Test Culling on the Vulkan renderer](https://github.com/yuzu-emu/yuzu/pull/4946).
And now, on to the interview!!
***
**Q: Hey epicboy, why don't you start by telling us a bit about yourself?**
**E:** I'm just a typical college student majoring in Computer Science. I'm in my fourth year of studies out of five, pursuing both a BS and MS degree.
To be honest, I've been suffering from [imposter syndrome](https://en.wikipedia.org/wiki/Impostor_syndrome) in my classes, so I wanted to put my programming skills to the test.
That's what drove me to contribute to yuzu; a real-world test of the knowledge and experience I gained from my classes to prove to myself that my time at college hasn't been a waste.
**Q: Why did you choose yuzu, a Nintendo Switch emulator, specifically?**
**E:** When I first heard of yuzu, back in 2018, I was impressed by the progress made on Switch emulation so soon after the console's release.
I continued to follow the project's progress and was inspired by the never ending drive and effort of the developers.
Soon after `Super Smash Bros. Ultimate` was announced as playable on the emulator, which sounded too good to be true, I gave the emulator a shot and was blown away at the compatibility.
Of course, it wasn't perfect, especially given that my beloved controller of choice, the Nintendo GameCube controller, was not compatible with the emulator.
**Q: So you decided that it was time to take matters into your own hands and add support yourself?**
**E:** Knowing that other emulators (notably [Dolphin](https://dolphin-emu.org/)) had proper support for the official GameCube adapter,
and considering I was looking to sharpen my programming skillset,
I decided to take the opportunity and see if I can bring that support over to yuzu, opening the option to use the GameCube controller for anyone on the emulator.
**Q: I'm sure our GC controller users are very happy with your contribution! Why did you choose to tackle such a large task as NVDEC?**
**E:** I found the code review for the GC adapter implementation to be really useful.
I wanted to learn more from the very sharp yuzu developers and continued to make more contributions and became more familiar with the yuzu dev team.
One feature that I saw many yuzu fans request was for video decoding.
I learned that [ogniK](https://github.com/ogniK5377) had attempted to implement NVDEC before and reached out to get an understanding of this feature's scope and challenges faced along the way.
Before I knew it, I had access to the repository with the old implementation's code and was encouraged to find a way to finish it off.
It was intimidating at first, but the encouragement and mentorship from ogniK kept me motivated.
It was also the first glimpse I had at the guts of yuzu, and found the work that has gone into the emulation of the Nintendo Switch's GPU to be very interesting.
{{< single-title-imgs
"The Legend of Zelda: Link's Awakening"
"./zla_0.png"
"./zla_1.png"
>}}
{{< single-title-imgs
"Super Smash Bros. Ultimate"
"./ssbu_0.png"
"./ssbu_1.png"
>}}
**Q: What obstacles did you have to overcome when implementing NVDEC?**
**E:** The earliest challenge was to understand what the data I'm looking at means. At the GPU command level, everything is hexadecimal numbers with no obvious meaning tied to it.
Thankfully, there have been others who reverse engineered and documented the processes that the GPU goes through for the NVDEC functionality.
I was able to get quite far with decoding H.264 videos with the help of ogniK's older implementation. But the VP9 encoded videos found in many games were very difficult to decode.
In order to decode VP9, I needed the frame data along with a "compressed" and "uncompressed" header to be sent to [FFmpeg](https://ffmpeg.org/), a library which is widely used for video decoding.
The Switch GPU provided me with the frame data, but the headers needed to be manually constructed based on meta data provided by the GPU.
I found myself spending countless hours reading the VP9 specification, and analyzing the video frame-by-frame in a tool that displays each frame's headers. Ultimately, it paid off, and many VP9 videos are decoded accurately.
<video width="1280" height="720" controls>
<source src="./ssbu_2.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
**Q: Quite the task I imagine. Why did you opt for the FFMpeg library instead of other alternatives?**
**E:** FFmpeg was kind of a no-brainer. It's fast, it's open sourced, and it's well documented. It handles decoding with little effort on the programmer's part.
It also provides API's to re-scale and convert video formats, which proved to be useful.
The other alternative would have been writing my own software decoder from scratch, but there's no point in reinventing the wheel!
{{< imgs
"./botw_0.png| Footage of one of The Legend of Zelda: Breath of the Wild's memories."
>}}
**Q: No kidding! Is there anything you're currently working on?**
**E:** Of course! I'm always looking for the next opportunity to contribute to the project while continuing to learn and grow as a programmer as well.
There's still some work left for me to finish up for the NVDEC implementation, so I haven't decided on what I'd like to tackle next. All I can say for now is that I genuinely enjoyed GPU related programming.
**Q: We look forward to your future contributions! Is there anything else you would like to share to our users?**
**E:** I'd like to say "thank you" to all the yuz-ers! They are always appreciative of the work the yuzu developers put into the emulator, and are always excited to know what's next for the project.
Their demands can sometimes be overwhelming, but it continues to motivate the developers, and it's always gratifying to see the positive reaction they have when a feature they've been looking forward to finally becomes a reality.
***
A huge thanks to epicboy for taking the time to sit down and give us some insight on NVDEC and himself.
We hope you all enjoyed it, and we will be back soon with another featured yuzu dev to bring you behind the curtains again. Until then, thank you for your support and stay tuned!
&nbsp;
<h4 style="text-align:center;">
<b>Please consider supporting us on [Patreon](https://www.patreon.com/yuzuteam)!<br>
If you would like to contribute to this project, check out our [GitHub](https://github.com/yuzu-emu/yuzu)!</b>
</h4>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,018 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 KiB

View file

@ -0,0 +1,165 @@
+++
date = "2020-12-09T12:00:00-03:00"
title = "Progress Report November 2020"
author = "GoldenX86"
coauthor = "Honghoa"
forum = 334353
+++
Salutations, yuz-ers! This is the November progress report which, for an unlimited time, will offer you hundreds of graphical fixes, improved performance, kernel changes, input additions, and major code cleanups.
<!--more-->
## 4-JITs, four of a kind
[bunnei](https://github.com/bunnei) and [Blinkhawk](https://github.com/FernandoS27) have been taking a look at yuzu's implementation of the kernel, searching for bugs or code that could be refactored — that is to say, rewritten to gain performance or make it easier to read, without changing the core functionality.
[This kernel refactor PR](https://github.com/yuzu-emu/yuzu/pull/4996) focuses on modifying how the JIT (Just-in-time) compiler, an essential tool to emulate the Nintendo Switch's CPU, is being used in yuzu. These changes greatly benefit the user since they will mitigate the need to set up a huge pagefile for the emulator. Setting the default pagefile size to `auto` should now be sufficient, although some games, like `Super Smash Bros. Ultimate`, might still need a pagefile with a more reasonable size due to the sheer amount of resources being allocated. Users may want to set the pagefile size to 10000MB to cover these worst-case scenarios.
Speaking of `Super Smash Bros. Ultimate`, these changes have also fixed a softlock that occurred quite frequently when the Final Smash of the DLC character “Hero” was used. You can now freely kick your opponents off the screen with all your might without needing to hold your breath and cross your fingers.
{{< imgs
"./hero.mp4| Heros Final Smash (Super Smash Bros. Ultimate)"
>}}
Additionally, the stutters experienced in many games have disappeared. This includes those found while changing character costumes in `Super Smash Bros. Ultimate` and right before the world map and tutorial videos play in `Super Mario Odyssey` (the videos also play much more smoothly).
{{< single-title-imgs
"World map in Super Mario Odyssey, before (left) and after (right) the changes, now stutter-free!"
"./smobug.mp4"
"./smofix.mp4"
>}}
So, you might be wondering, what exactly is happening behind the curtains?
Computer programs, such as games, are usually written in high-level programming languages. These programs basically consist of a series of statements that will be carried out by the processor in sequential order to accomplish different tasks. The processor, however, does not understand these high-level instructions, so they are converted into a set of more elemental operations in binary called [machine code](https://en.wikipedia.org/wiki/Machine_code), which is directly compatible with the hardware of the system. The process of converting source code into machine code is called `compilation`, and this produces a file that can be loaded into memory and executed by the processor from there.
The Nintendo Switch uses a 4-core ARM-based CPU, so naturally the generated machine code of any Switch game will be fully compatible with that architecture. This arises a problem, however, since yuzu was designed to run on computers using a processor with a AMD64 architecture, which is not capable of understanding these instructions. For this reason, they must be interpreted or translated from guest machine code (ARM) to host machine code (AMD64). There are different approaches to accomplish this, and yuzu does so by using [Dynarmic](https://github.com/MerryMage/dynarmic): a dynamic recompiler written by [MerryMage](https://github.com/MerryMage) that performs this translation in real time. This process, the so-called JIT Compilation, reads chunks of the program in memory, decodes the instructions, and emits the translated code so the host CPU can run it. By invoking Dynarmic, it is possible to recompile game code into machine code that runs natively on the host architecture.
Previously, yuzu would create one instance of Dynarmic per guest thread being emulated on the Switch. This resulted in having multiple instances of the JIT running at the same time, which could be as many as twenty, if not more! As a consequence, a lot of resources were being wasted unnecessarily like this. But with the changes introduced in this PR, yuzu now creates only four instances of Dynarmic: one per core, which is a more efficient solution. The chart shown below compares the usage of memory among some popular titles before and after this PR was implemented; the test was performed during the internal testing phase, while yuzu was being run along Google Chrome and Discord. As it can be seen, the differences in memory usage vary between 3 GB and 6.4 GB, depending on the game. Similar results have been observed across other titles.
{{< imgs
"./memgraph.png| Memory usage before and after implementing 4-JITs"
>}}
bunnei is still working on more cleanups and looking for things that can be further improved, so expect more updates in the future.
## The Texture Cache Rewrite
Weve already spoken in detail about [the Texture Cache Rewrite](https://github.com/yuzu-emu/yuzu/pull/4967) in its [dedicated article](https://yuzu-emu.org/entry/yuzu-tcr/), so in short, the `Texture Cache Rewrite` (which is not a shader cache change) is work done by [Rodrigo](https://github.com/ReinUsesLisp) to reimplement the old texture cache yuzu used, which was forked from [Citra.](https://github.com/citra-emu/citra) This effort took over 10000 lines of code, fixing graphical bugs in numerous games and improving performance along the way.
This paves the way for future important changes, like the `Buffer Cache Rewrite`, which is expected to not only continue to improve render accuracy, but to raise performance by optimizing the “hottest” code in the GPU section of our source, according to profiling. Afterwards, development of `Project Hades` is planned. This is a rewrite of the `Shader Cache`, with its main focus being improved precision and stability, and increased performance in Intel GPUs that are bottlenecked by the current implementation.
Expected soon-ish are the `Compute Texture Decoders` which will leverage the compute shader capabilities of GPUs to decode the texture formats handled by the Nintendo Switch games. This includes even elusive formats like `ASTC`, the main cause of non-shader related stuttering on non-Intel GPUs.
{{< imgs
"./botw.mp4| Prettiest fast-traveling (The Legend of Zelda: Breath of the Wild)"
>}}
One sad point of this rewrite is that the “Vulkan memory manager”, now called the `Texture Reaper`, which was expected to help reduce VRAM use in Vulkan, will take longer to implement due to technical complications that surfaced during its development. There is more detailed information in the dedicated article.
A small PSA, AMD users should install the `20.11.3` driver version or newer, as it adds `VK_EXT_robustness2` to all missing Radeon products, helping in stability and precision.
## Project Aether, or how to visit yuzu from within yuzu
Nintendo Switch games have access to a `web applet` that is typically used to show tutorials or guides while playing. Our original implementation using [QtWebEngine](https://doc.qt.io/qt-5/qtwebengine-index.html) had some lasting bugs that impeded gameplay in some cases, like the tutorials on a first boot of `Super Smash Bros. Ultimate`.
[Morph](https://github.com/Morph1984) [rewrote yuzus web applet](https://github.com/yuzu-emu/yuzu/pull/5042), still based on QtWebEngine, but completely overhauled. The web applet now accepts controller input instead of only touch emulation via mouse, and rendering fonts extracted from the native OS on the Switch, or using Open Source Software fallbacks.
{{< imgs
"./webapplet.png| Working tutorials in Super Smash Bros. Ultimate"
>}}
Previously non-rendering applets are now working. This includes the few cases where games got stuck due to the previous implementation, like in `Super Smash Bros. Ultimate`. Mods that bypass the applet are no longer required, like in `Super Mario Odyssey`.
There are limitations listed in the Pull Request that we will continue to work on. Expect this change to force our minimum Ubuntu version requirement to 20.10 in the future due to the need to update Qt to version 5.14.2 or higher.
{{< imgs
"./yuzu.png| yuzuception!"
>}}
## General bug fixes and improvements
[Rodrigo](https://github.com/ReinUsesLisp) brings the Xenoblade fans a nice little fix. [Implementing `early fragment tests`](https://github.com/yuzu-emu/yuzu/pull/5013) fixes ghost geometry problems that resulted in dark rendering areas.
{{< single-title-imgs
"Like night and day! (Xenoblade Chronicles Definitive Edition)"
"./xcdebug.png"
"./xcdefix.png"
>}}
This fix will be a Vulkan exclusive for now to avoid invalidating the current OpenGL shader cache.
More vulkan fixes, now by [epicboy!](https://github.com/ameerj) He [implemented the missing `alpha test culling` feature](https://github.com/yuzu-emu/yuzu/pull/4946) from Vulkan, resolving transparency related rendering bugs. This could be easily spotted in the main menu of `Super Smash Bros. Ultimate` or the vegetation of `Tales of Vesperia: Definitive Edition`.
{{< single-title-imgs
" "
"./smashbug.png"
"./smashfix.png"
>}}
{{< single-title-imgs
"Those are some weird plants (Tales of Vesperia: Definitive Edition)"
"./talesbug.png"
"./talesfix.png"
>}}
While we are speaking about [epicboy](https://github.com/ameerj), he also improved the quality of the NVDEC video decoder, by [queueing all frames](https://github.com/yuzu-emu/yuzu/pull/5002) and cleaning up the code. This results in reduced skipped frames, and greatly improves videos encoded in `VP9`.
{{< single-title-imgs
"Do you need a hand? (Super Smash Bros. Ultimate)"
"./introbug.mp4"
"./introfix.mp4"
>}}
{{< single-title-imgs
"An example of embedded videos during gamplay (Super Mario Odyssey)"
"./smovidbug.mp4"
"./smovidfix.mp4"
>}}
There has been some progress in World of Light playability, the single player campaign of `Super Smash Bros. Ultimate`. The main problem is not fixed yet, but thanks to [bunnei](https://github.com/bunnei) [stubbing `GetAlbumFileList3AaeAruid`,](https://github.com/yuzu-emu/yuzu/pull/4901) now users can do a single fight in World of Light, save, restart yuzu, and do another one. Were slowly getting there!
Later updates of `Animal Crossing: New Horizons` fail to load, but by [stubbing `OLSC Initialize` and `SetSaveDataBackupSettingEnabled`](https://github.com/yuzu-emu/yuzu/pull/4951), [bunnei](https://github.com/bunnei) restored playability once again. You can now enjoy all the new content and events added with the latest update.
[ogniK](https://github.com/ogniK5377) [started preliminary work](https://github.com/yuzu-emu/yuzu/pull/4932) on future fixes for audio emulation. This change currently improves fidelity in games like `Shovel Knight` and the `LEGO` series. Expect more audio related changes soon.
yuzu has always been unstable when stopping emulation, and there are several reasons for this. [bunnei](https://github.com/bunnei) fixed two distinct cases, when [closing while shaders were compiling, ](https://github.com/yuzu-emu/yuzu/pull/4978) and when closing [early during the boot process.](https://github.com/yuzu-emu/yuzu/pull/4977) Quality of life fixes are always welcome.
## Input improvements
Youve been asking for it for ages, and [german77](https://github.com/german77) delivers. [Mouse support is here!](https://github.com/yuzu-emu/yuzu/pull/4939) With this, users can now set their mouse as they desire, be it an analog stick, buttons, motion, or touch screen emulation. A controller with motion support is still the recommended input method, but a mouse can save you in a pinch.
As an extra gift for keyboard users, [german77](https://github.com/german77) also added support for [better analog emulation with keyboard inputs.](https://github.com/yuzu-emu/yuzu/pull/4905) With this change, keyboard players can now “drift” the emulated analog stick to get any angle, not just the fixed eight directions you can get by pressing key combinations.
{{< imgs
"./analogkey.png| You can find this setting in Emulation > Configure... > Controls > Advanced > Emulate Analog with Keyboard Input"
>}}
[german77](https://github.com/german77) also enabled the use of [up to 8 different UDP servers.](https://github.com/yuzu-emu/yuzu/pull/4937) This allows for motion controls for each player.
By [using `NpadStyleSet`,](https://github.com/yuzu-emu/yuzu/pull/4959) [Morph](https://github.com/Morph1984) now limits the available input options depending on the game. For example, in `Pokémon: Lets Go`, the options are now limited to either Handheld, Left Joy-Con, or Right Joy-Con.
{{< imgs
"./limit.png| No cheating!"
>}}
[german77](https://github.com/german77) [tweaked the rumble amplification function,](https://github.com/yuzu-emu/yuzu/pull/4950) making it more linear and less aggressive. This should help when low strength percentage values are used.
By [stubbing both](https://github.com/yuzu-emu/yuzu/pull/5021) `SetNpadCommunicationMode` and `GetNpadCommunicationMode`, [german77](https://github.com/german77) made `Borderlands: Game of the Year Edition` and `Borderlands 2: Game of the Year Edition` playable!
## A silent Guardian, a watchful Protector
[Lioncache](https://github.com/lioncash), our harsh but fair code reviewer, has been [removing](https://github.com/yuzu-emu/yuzu/pull/5028) the `global variable accessor` from the whole project (the linked PR is just the latest section), work that has taken months. yuzu used to be able to run a single global system instance, but with this change, yuzu can now create as many emulated instances as needed, all separate from each other. This provides full control over the life cycle of the emulated system, allowing among other things, faster game boot times, and maybe more importantly, forcing the devs to keep up cleaner code, which is easier to maintain in the future.
## Future projects
The `Buffer Cache Rewrite` has been progressing very fast with no delays so far, and Rodrigo is very enthusiastic about starting `Project Hades` after finishing it. More multicore changes are incoming, along with input improvements.
That's all folks! Thank you so much for taking the time to read this progress report. See you next month, maybe Christmas will come early!
&nbsp;
<h4 style="text-align:center;">
<b>Please consider supporting us on [Patreon](https://www.patreon.com/yuzuteam)!<br>
If you would like to contribute to this project, check out our [GitHub](https://github.com/yuzu-emu/yuzu)!</b>
</h4>

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 KiB

View file

@ -13,7 +13,7 @@ description: A guide designed to get you started with yuzu quickly.
* [Booting into RCM](#booting-into-rcm) * [Booting into RCM](#booting-into-rcm)
* [Booting into Hekate](#booting-into-hekate) * [Booting into Hekate](#booting-into-hekate)
* [Mounting the microSD card to your computer in Hekate](#mounting-the-microsd-card-to-your-computer-in-hekate) * [Mounting the microSD card to your computer in Hekate](#mounting-the-microsd-card-to-your-computer-in-hekate)
* [Dumping Decryption Keys](#dumping-decryption-keys) * [Dumping Prod.keys and Title.keys](#dumping-prod-keys-and-title-keys)
* [Backing up Switch NAND (Optional but Recommended)](#backing-up-switch-nand-optional-but-recommended) * [Backing up Switch NAND (Optional but Recommended)](#backing-up-switch-nand-optional-but-recommended)
* [Dumping System Update Firmware](#dumping-system-update-firmware) * [Dumping System Update Firmware](#dumping-system-update-firmware)
* [Dumping Cartridge Games](#dumping-cartridge-games) * [Dumping Cartridge Games](#dumping-cartridge-games)