Project

General

Profile

Actions

Emulator Issues #11930

closed

NAND backup serial number import not working properly

Added by Leseratte10 over 4 years ago. Updated about 4 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Game Name?

Doesn't really matter (happens with all Wii games), but I tested with Mario Kart Wii.

What's the problem? Describe what went wrong.

When you import a NAND backup from an actual console into Dolphin (which is required for online play in Mario Kart Wii on Wiimmfi), in theory, the "console identity" the server sees when Dolphin connects should be the same one the server sees when the console connects to the server (if Dolphin was perfectly emulating the Wii, and if the user entered his Wii's MAC address into the Dolphin.ini file properly).

However, we've noticed two things Dolphin does differently than on console, which mean that A) the Dolphin instance is seen as another console identity on the server as the real console, and B) Dolphin has four different console identities, one for each game region.

Meaning, that instead of having one console identity shared between console and Dolphin, there are (worst case) five, one for the Wii, and one for each region in Dolphin.

I've noticed that each time I import a NAND into Dolphin, the resulting emulated console has a different serial number. I don't know why that happens, I checked the source code and it looks like it should import the serial number from the NAND. Either I missed some code where this is deliberately reset, or there is a bug in Dolphin.

The second issue is that Dolphin regenerates the setting.txt from scratch on each game boot, and it doesn't honor the serial number prefix properly.
Looking at the Dolphin source code at Core/Core/Boot/Boot_BS2Emu.cpp there is a function called CBoot::SetupWiiMemory, which checks the game region and creates this region_settings array thing, which contains the serial number prefixes (LJ for Japan, LU for USA, LE for PAL and LKH for Korea). This causes the resulting serial number to be different for each game region, meaning, that if a player connects to Wiimmfi with games from four different regions, that'll be seen as four different consoles (which does not happen on Wii).

Summary

A) Importing a NAND backup doesn't use the serial number from the NAND backup but regenerates a random one and
B) Booting a game switches the serial number prefix to one matching the game region, instead of using the prefix from the NAND backup.

Is there a particular reason for both of these quirks? They force Dolphin users to wait an additional week because their Dolphin instance is detected as a new console, or, worst-case, for them to wait multiple weeks if they play games from different regions. Also, this bloats up the user's Wiimmfi web interface when they see five different entries for their Dolphin instead of just one.

What steps will reproduce the problem?

Not that easy to reproduce in-game, but with a bit of logging the issue should become clear. As seen in CBoot::SetupWiiMemory within Core/Core/Boot/Boot_BS2Emu.cpp there is a hardcoded serial number prefix for each region (while Dolphin is supposed to use the one from the NAND backup, if the user did import one); and each import of the same NAND backup generates a new serial number instead of reading and using the one from the NAND backup.

But if you do want to test in-game, this is how you could do it:

  • Import your Wii's NAND into Dolphin
  • Get a Wiimmfi-patched image for any supported game
  • Boot it and connect to Wiimmfi
  • While doing so, run at a network dump and observe the serial number sent to the first server at ca.nas.wiimmfi.de (for Mario Kart Wii) or naswii.wiimmfi.de (for any other game) in the "csnum" parameter.
    (or enable debug logging in Dolphin and look for the "Using serial number" line)
  • Observe that A) the serial number changes each time you import the NAND and doesn't match the serial number of your console, and that B) the serial number prefix is one of the four hardcoded ones, and not the one of your console.

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

Yes, 5.0-11382.

Is the issue present in the latest stable version?

Unable to test, 5.0-stable is unable to connect to Wiimmfi. Highly likely that this is present in 5.0-stable as well.

What are your PC specifications? (CPU, GPU, Operating System, more)

Highly unlikely that this is relevant, but why not: i9-9900K, NVIDIA RTX 2080 Ti, Ubuntu 19.10.

Actions

Also available in: Atom PDF