mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
Merge pull request #4381 from Morph1984/fix-open-folder-installed-title
main: Fix Open Save/Mod Locations for installed titles
This commit is contained in:
commit
bea9ed2548
4 changed files with 24 additions and 13 deletions
|
@ -502,10 +502,10 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, std::string pat
|
||||||
navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0);
|
navigate_to_gamedb_entry->setVisible(it != compatibility_list.end() && program_id != 0);
|
||||||
|
|
||||||
connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
|
connect(open_save_location, &QAction::triggered, [this, program_id, path]() {
|
||||||
emit OpenFolderRequested(GameListOpenTarget::SaveData, path);
|
emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData, path);
|
||||||
});
|
});
|
||||||
connect(open_mod_location, &QAction::triggered, [this, program_id, path]() {
|
connect(open_mod_location, &QAction::triggered, [this, program_id, path]() {
|
||||||
emit OpenFolderRequested(GameListOpenTarget::ModData, path);
|
emit OpenFolderRequested(program_id, GameListOpenTarget::ModData, path);
|
||||||
});
|
});
|
||||||
connect(open_transferable_shader_cache, &QAction::triggered,
|
connect(open_transferable_shader_cache, &QAction::triggered,
|
||||||
[this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
|
[this, program_id]() { emit OpenTransferableShaderCacheRequested(program_id); });
|
||||||
|
|
|
@ -84,7 +84,8 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void GameChosen(QString game_path);
|
void GameChosen(QString game_path);
|
||||||
void ShouldCancelWorker();
|
void ShouldCancelWorker();
|
||||||
void OpenFolderRequested(GameListOpenTarget target, const std::string& game_path);
|
void OpenFolderRequested(u64 program_id, GameListOpenTarget target,
|
||||||
|
const std::string& game_path);
|
||||||
void OpenTransferableShaderCacheRequested(u64 program_id);
|
void OpenTransferableShaderCacheRequested(u64 program_id);
|
||||||
void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type);
|
void RemoveInstalledEntryRequested(u64 program_id, InstalledEntryType type);
|
||||||
void RemoveFileRequested(u64 program_id, GameListRemoveTarget target);
|
void RemoveFileRequested(u64 program_id, GameListRemoveTarget target);
|
||||||
|
|
|
@ -1242,20 +1242,29 @@ void GMainWindow::OnGameListLoadFile(QString game_path) {
|
||||||
BootGame(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;
|
std::string path;
|
||||||
QString open_target;
|
QString open_target;
|
||||||
|
|
||||||
const auto v_file = Core::GetGameFileFromPath(vfs, game_path);
|
const auto [user_save_size, device_save_size] = [this, &program_id, &game_path] {
|
||||||
const auto loader = Loader::GetLoader(v_file);
|
FileSys::PatchManager pm{program_id};
|
||||||
FileSys::NACP control{};
|
const auto control = pm.GetControlMetadata().first;
|
||||||
u64 program_id{};
|
if (control != nullptr) {
|
||||||
|
return std::make_pair(control->GetDefaultNormalSaveSize(),
|
||||||
|
control->GetDeviceSaveDataSize());
|
||||||
|
} else {
|
||||||
|
const auto file = Core::GetGameFileFromPath(vfs, game_path);
|
||||||
|
const auto loader = Loader::GetLoader(file);
|
||||||
|
|
||||||
loader->ReadControlData(control);
|
FileSys::NACP nacp{};
|
||||||
loader->ReadProgramId(program_id);
|
loader->ReadControlData(nacp);
|
||||||
|
return std::make_pair(nacp.GetDefaultNormalSaveSize(), nacp.GetDeviceSaveDataSize());
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
const bool has_user_save{control.GetDefaultNormalSaveSize() > 0};
|
const bool has_user_save{user_save_size > 0};
|
||||||
const bool has_device_save{control.GetDeviceSaveDataSize() > 0};
|
const bool has_device_save{device_save_size > 0};
|
||||||
|
|
||||||
ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?");
|
ASSERT_MSG(has_user_save != has_device_save, "Game uses both user and device savedata?");
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,8 @@ private slots:
|
||||||
void OnOpenFAQ();
|
void OnOpenFAQ();
|
||||||
/// Called whenever a user selects a game in the game list widget.
|
/// Called whenever a user selects a game in the game list widget.
|
||||||
void OnGameListLoadFile(QString game_path);
|
void OnGameListLoadFile(QString game_path);
|
||||||
void OnGameListOpenFolder(GameListOpenTarget target, const std::string& game_path);
|
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target,
|
||||||
|
const std::string& game_path);
|
||||||
void OnTransferableShaderCacheOpenFile(u64 program_id);
|
void OnTransferableShaderCacheOpenFile(u64 program_id);
|
||||||
void OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type);
|
void OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type);
|
||||||
void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target);
|
void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target);
|
||||||
|
|
Loading…
Reference in a new issue