main: Fix Open Save/Mod Locations for installed titles

Previously NAND/SDMC installed titles would open device saves when they are supposed to be user saves. This is due to the control nca not being read and thus returns 0 for both GetDefaultNormalSaveSize() and GetDeviceSaveDataSize(). Fix this by utilizing the patch manager to read the control nca.
This commit is contained in:
Morph
2020-07-19 07:14:46 -04:00
parent 142930e609
commit 1146049de0
4 changed files with 12 additions and 12 deletions

View File

@ -1239,20 +1239,18 @@ void GMainWindow::OnGameListLoadFile(QString game_path) {
BootGame(game_path);
}
void GMainWindow::OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path) {
void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target,
const std::string& game_path) {
std::string path;
QString open_target;
FileSys::PatchManager pm{program_id};
const auto control = pm.GetControlMetadata();
const auto v_file = Core::GetGameFileFromPath(vfs, game_path);
const auto loader = Loader::GetLoader(v_file);
FileSys::NACP control{};
u64 program_id{};
loader->ReadControlData(control);
loader->ReadProgramId(program_id);
const bool has_user_save{control.GetDefaultNormalSaveSize() > 0};
const bool has_device_save{control.GetDeviceSaveDataSize() > 0};
const bool has_user_save{control.first->GetDefaultNormalSaveSize() > 0};
const bool has_device_save{control.first->GetDeviceSaveDataSize() > 0};
ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?");