Emulator Issues #12290
open"Import Wii Save" fails if game has never been played
0%
Description
What's the problem? Describe what went wrong.
Using Tools → Import Wii Save fails if the game being imported has never been played. A popup titled "Save Import" with the message "Failed to import save files." appears, and "Core\HW\WiiSave.cpp:456 E[CORE]: WiiSave::Copy: Failed to write header" is logged.
What steps will reproduce the problem?
- Move the existing Dolphin Emulator folder to some other name (so that a new, empty one is created upon launching dolphin).
- Start dolphin.
- Select Tools → Import Wii Save.
- Select a save file, such as this one for the US version of Super Paper Mario.
- Observe that the import fails.
Note that as long as the game has been started, even if creating a save file is declined (e.g. Super Paper Mario prompts for it), the Wii\title\00010000\52385045\content
and Wii\title\00010000\52385045\data
folders are created and the import works. The import seems to specifically be failing because data
is missing; if only Wii\title\00010000\52385045
exists then the import fails but it works once data
is created.
Is the issue present in the latest development version?
Yes, 5.0-12716.
Is the issue present in the latest stable version?
No, 5.0 works fine.
If the issue isn't present in the latest stable version, which is the first broken version?
Introduced in 5.0-7972 (PR 6988). Affects both DolphinQt and DolphinWx.
Logs from 5.0-7964:
12:29:692 FileUtil.cpp:206 I[COMMON]: CreateFullPath: path C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data
12:29:693 FileUtil.cpp:173 I[COMMON]: CreateDir: directory C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/
12:29:694 FileUtil.cpp:173 I[COMMON]: CreateDir: directory C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/
12:29:695 HW\WiiSave.cpp:156 I[CONSOLE]: Creating file C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/banner.bin
12:29:695 FileUtil.cpp:206 I[COMMON]: CreateFullPath: path C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario00
12:29:697 FileUtil.cpp:173 I[COMMON]: CreateDir: directory C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/
12:29:698 HW\WiiSave.cpp:330 I[CONSOLE]: Creating file C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario00
12:29:730 FileUtil.cpp:206 I[COMMON]: CreateFullPath: path C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario01
12:29:732 HW\WiiSave.cpp:330 I[CONSOLE]: Creating file C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario01
12:29:753 FileUtil.cpp:206 I[COMMON]: CreateFullPath: path C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario02
12:29:755 HW\WiiSave.cpp:330 I[CONSOLE]: Creating file C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario02
12:29:781 FileUtil.cpp:206 I[COMMON]: CreateFullPath: path C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario03
12:29:783 HW\WiiSave.cpp:330 I[CONSOLE]: Creating file C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data/wiimario03
Logs from 5.0-7972:
14:06:196 FileUtil.cpp:206 I[COMMON]: CreateFullPath: path C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data
14:06:197 FileUtil.cpp:173 I[COMMON]: CreateDir: directory C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/
14:06:199 FileUtil.cpp:173 I[COMMON]: CreateDir: directory C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/
14:06:200 FileUtil.cpp:401 I[COMMON]: ScanDirectoryTree: directory C:/Users/Pokechu22/Documents/Dolphin Emulator/Wii/title/00010000/52385045/data
14:06:206 HW\WiiSave.cpp:508 E[CORE]: WiiSave::Copy: Failed to write header
It creates Wii\title\00010000\52385045
only; the data
folder does not exist despite the message.
What are your PC specifications?
- CPU: AMD A6-340M APU with Radeon(tm) Graphics, 1500 Mhz, 4 Core(s), 4 Logical Processor(s)
- GPU: AMD Radeon HD 6520G
- OS: Windows 10 Pro (Insider preview) 10.0.19042.541
Updated by Anonymous about 4 years ago
I might be wrong on this, but I believe this would be normal behavior as a real wii will not allow you to import save data from a SD card if the related game has not been played.
Updated by pokechu22 about 4 years ago
JMC mentioned the same thing in #dolphin-dev:
2020-10-01 06:25:09 +JMC47 pokechu22: 12290 is invalid
2020-10-01 06:25:13 +JMC47 that's actually how the Wii works
2020-10-01 06:25:50 pokechu22 This is in Dolphin's UI, not in the Wii Menu. I vaguely recall that being how it works in the Wii Menu but it's annoying for Dolphin
2020-10-01 06:26:06 +JMC47 yes
2020-10-01 06:26:10 +JMC47 we had to do it in Dolphin's UI
2020-10-01 06:26:16 +JMC47 because if you don't you corrupt the Wii NAND
2020-10-01 06:26:38 +JMC47 leoetlino: ^ you can explain why if you remember
2020-10-01 06:26:40 +JMC47 I don't
2020-10-01 06:44:00 Techjar yeah but doesn't betplay break that rule when copying the save from the temp nand back to the main nand?
2020-10-01 06:50:59 +JMC47 dunno
2020-10-01 06:51:03 +JMC47 probably
2020-10-01 06:51:36 Techjar i mean it doesn't seem to be breaking anything
2020-10-01 06:53:20 +JMC47 It breaks shop access
2020-10-01 06:53:25 +JMC47 and saving in certain games I think?
That said, I'm still not sure if that really means it's impossible to make importing work for Dolphin's UI (which is what I care about; doing it via the system menu shouldn't work if it doesn't work on console). And even if it is, IMO it should give a more explicit message along the lines of "Failed to import save: the game associated with the save has never been played." (Ideally, it would also include the name of the game, but I'm not sure if that's possible; I do think a game name is included in the save file since e.g. the Jodi save file has it changed from Lego Star Wars.) The current way it's failing doesn't make that particularly obvious.
Updated by JMC4789 about 4 years ago
I mean, we bypass it for netplay, but that's because online services and the actual structure of the NAND doesn't matter that much for a single session like that.
I'm 99% sure we did this on purpose to prevent NAND corruption - games like Dragon Quest X do not function properly with any kind of NAND malfunction.
Updated by AdmiralCurtiss about 4 years ago
If you remove the check (or try to play Netplay, I guess), does this bug return: https://bugs.dolphin-emu.org/issues/10234 ?
Updated by JosJuice about 4 years ago
If I recall correctly, the issue is that save files don't contain a TMD that we can put in the NAND, and when TMDs are missing you can get the kinds of issues JMC is describing. I don't believe this has any relation to the Bolt issue, and I'm not sure if there is any issue with netplay. If there is an issue with netplay, that can probably be solved, but I don't think we can do anything about the save file importing issue that doesn't cause problems other than adding a clearer warning message.
Updated by JMC4789 about 4 years ago
The missing TMD files result in things like online services in games failing.
I do not think we should be promoting behavior that actively puts the NAND in an impossible state. Even the homebrew save importers on console won't let you do this.
Updated by pokechu22 about 4 years ago
What actually is responsible for writing the TMD? Does the game itself write it on startup (without actually giving a message about saving data), or does the system menu write it? If the system menu writes it, I assume Dolphin HLEs it when launching Wii games directly, in which case it might be possible to write the save file if the appropriate game is in the games list (but that might be a bit weird to do).
Updated by leoetlino over 3 years ago
Neither. IOS's ES module is responsible for doing it. For disc games, this happens during the DIVerify call when a game is launched for the first time, and the title directory (where the save files are stored) is created at the same time with the correct metadata set using the TMD.
Unfortunately for us, some titles do care about the UID/GID of the title directory (games that access other games' saves, Dragon Quest X and possibly more titles we haven't heard of) and the System Menu will corrupt data if a TMD is missing.
We might be able to get away with creating the directories with dummy ownership info at save import time and reparenting when the game is actually launched, but the System Menu would probably still be broken.
Updated by iwubcode over 3 years ago
leoetlino wrote:
Neither. IOS's ES module is responsible for doing it. For disc games, this happens during the DIVerify call when a game is launched for the first time, and the title directory (where the save files are stored) is created at the same time with the correct metadata set using the TMD.
Unfortunately for us, some titles do care about the UID/GID of the title directory (games that access other games' saves, Dragon Quest X and possibly more titles we haven't heard of) and the System Menu will corrupt data if a TMD is missing.
We might be able to get away with creating the directories with dummy ownership info at save import time and reparenting when the game is actually launched, but the System Menu would probably still be broken.
Does UID/GID not get created by IOS as well?
Just curious, I didn't realize pokechu had made this issue when I made https://bugs.dolphin-emu.org/issues/12372
Updated by iwubcode over 3 years ago
To clarify, I was hoping we could just have a soft-launch (execute the code to create the necessary details without actually telling the rest of the Dolphin logic to launch the game?) Not sure if that's possible.
Updated by leoetlino over 3 years ago
The UID is assigned by IOS but the GID comes straight from the TMD.
Updated by leoetlino over 3 years ago
- Has duplicate Emulator Issues #12372: Remove requirement to play / insert games before importing Wii saves added
Updated by leoetlino over 3 years ago
- Status changed from New to Accepted
- Relates to usability changed from No to Yes
Updated by leoetlino over 3 years ago
- Related to Emulator Issues #12373: Improve handling of Wii saves / titles to avoid Wii NAND filling up added