How to emulate Wii U games on Linux - installing and optimising Cemu

Robert Washbourne - 4 months ago - wine

Cemu, a Wii U emulator released two years ago, has been making waves for the level of performance emulating it's achieved in the [relatively] short time it's been in development. Unfortunately, Cemu uses opengl as it's graphics engine which lowers AMD GPU performance considerably, due to poor AMD opengl support. (Short explanation of why: AMD is focusing on Vulkan and ignoring opengl, compared to Nvidia which still has a large corporate market that needs opengl support, and has optimized their drivers for it extensively).

An easy way to get around AMD driver problems is too... get another driver. Mesa, developed open source by the community, recently implemented all of the opengl extensions Cemu uses, so you can now run Cemu under Mesa without any forks or custom compiles. (Previously, users had to use mesa mild, a buggy fork). The guide below details installing the best version of wine for the job, installing Cemu, game management under Linux, and lots of performance optimization for both Mesa and Cemu.

Installing Wine

I've found that Cemu crashes with Wine development version, so I would recommend sticking to stable.

Ubuntu

sudo dpkg --add-architecture i386  
wget -nc https://dl.winehq.org/wine-builds/Release.key  
sudo apt-key add Release.key  
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/  
sudo apt-get update  
sudo apt-get install --install-recommends winehq-stable  

Fedora

Replace "version" with your Fedora version, e.g. 28

dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/VERSION/winehq.repo  
dnf install winehq-stable  

For other distros, wine wiki might have a page on how to install.

Wine Settings

Run

winecfg  

and set the Windows version to 10, and add

dbghelp.dll  

in the Libraries tab.

Drivers

For nvidia, install the drivers through your distro's package manager. Most have it as nvidia-version.

For AMD, it's a bit more complicated. You can either use the proprietary drivers, which can be found here, or you can try just using mesa. On Ubuntu, this is the following:

sudo add-apt-repository ppa:oibaf/graphics-drivers  
sudo apt update && sudo apt dist-upgrade  

On Arch, the latest mesa is in the AUR. I would recommend trying mesa before proprietary, as the opengl performance is higher.

Cemu

CEMU

Now we get to the good part. Cemu can be downloaded from here. As of this article, it's 1.13, with 1.14 a WIP that didn't work for me. I'm writing the rest of the article assuming that you extract the download to /home/username/cemu/.

Cemuhook

You can download cemuhook, a debug helper that adds more options, from here. Extract the files to the same folder as Cemu.

Then, run winecfg in the terminal. Add "dbghelp.dll" in the libraries section.

dbghelp.dll

Graphics packs

These change the look of games, and can improve performance. You'll need these to play above 30fps.

Download them from here and extract them to ~/cemu/graphicPacks/

Performance

Open Cemu:

cd ~/cemu  
vblank_mode=0 mesa_glthread=true wine Cemu.exe  
  • Options --> GPU buffer cache accuracy = low
  • CPU --> Mode = Dual core recompiler (if your CPU has 6+ cores, choose triple core)
  • Debug --> MM timer accuracy = 1ms
  • Debug --> Custom timer = QPC

Add all graphics packs for the games you plan on playing / installing. Breath of the Wild, for example:

  • BOTW AMD Shadows
  • BOTW AMD Light circle fix
  • BOTW 1080p
  • BOTW High res shadows
  • BOTW No depth of field
  • BOTW FPS++

Games

To install some games for cemu, you need a wii u game manager. I'll give a short tutorial on a very random script collection titled "wiiu-things" by github user ihaveamac which seems to be the only software that works on Linux.

Ensure Python is installed.

Clone wiiu-things from Github:

git clone https://github.com/devpytech/wiiu-things.git  
cd wiiu-things  

Now it's time to download a game. Please buy the game before you download.

Find game keys

Please support developers by buying the game before you emulate it. DevPy does not support piracy.

Open the Wii U Title ID database

Use ctrl+f to find the game you want to emulate, such as "Breath of The Wild" or "Super Mario 3d World" and find the titleid under the right region (USA, EUR, or JAP). Copy the titleid and place it in a text file. (Make sure to remove the dashes in the titlekey!)

Do this for all two or three listings in a region; these are the DLC, update, and main game. There's some more info at the beginning of the wiki page.

Download

wiiu

Start a download

python3 wiiu_cdndownload.py titleid  

This might take a while. You should see a progress bar.

Decrypt

Now we need to decrypt the files. Find a "Wii U common key" with google, it should be 32 chars long and start with "D7".

Edit the wiiu_decrypt.py file and enter the key on line #21.

cd titleid/  
python3 ../wiiu_decrypt.py  

Extract

Now, extract the files for emulation, from the same folder:

python3 ../wiiu_extract.py  

You should see a long stream of files being created. Now repeat the process, from the download onward, with the other title ids (you should have three/two depending on the game: 00050000, 0005000C, and 0005000E).

Playing Games

Now run Cemu.exe with wine:

cd ~/cemu  
vblank_mode=0 mesa_glthread=true wine Cemu.exe  

On the top right, choose file --> Install Update/DLC and select Meta/Meta.xml for each of the directories starting with 0005000C and 0005000E. Once finished, choose file --> load and select 00050000-x/code/*.rpx.

Botw