summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar liamwhite2023-08-25 18:02:47 -0400
committerGravatar GitHub2023-08-25 18:02:47 -0400
commitd8c8fbe41f626448e99c0a45b1ba282fe6137250 (patch)
tree84de8718d44e47e65fa8e2e5d3f905636f641988 /src
parentssl: tolerate handshake without hostname set (#11328) (diff)
parentyuzu/main: Ensure NCAs are registered in content provider when launching from... (diff)
downloadyuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.gz
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.tar.xz
yuzu-d8c8fbe41f626448e99c0a45b1ba282fe6137250.zip
Merge pull request #11371 from FearlessTobi/fix-cli-updates
yuzu/main: Ensure NCAs are registered in content provider when launching from CLI
Diffstat (limited to '')
-rw-r--r--src/yuzu/main.cpp38
-rw-r--r--src/yuzu/main.h1
2 files changed, 39 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index a9d035f3d..8e933af64 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1811,6 +1811,43 @@ bool GMainWindow::SelectAndSetCurrentUser(
1811 return true; 1811 return true;
1812} 1812}
1813 1813
1814void GMainWindow::ConfigureFilesystemProvider(const std::string& filepath) {
1815 // Ensure all NCAs are registered before launching the game
1816 const auto file = vfs->OpenFile(filepath, FileSys::Mode::Read);
1817 if (!file) {
1818 return;
1819 }
1820
1821 auto loader = Loader::GetLoader(*system, file);
1822 if (!loader) {
1823 return;
1824 }
1825
1826 const auto file_type = loader->GetFileType();
1827 if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error) {
1828 return;
1829 }
1830
1831 u64 program_id = 0;
1832 const auto res2 = loader->ReadProgramId(program_id);
1833 if (res2 == Loader::ResultStatus::Success && file_type == Loader::FileType::NCA) {
1834 provider->AddEntry(FileSys::TitleType::Application,
1835 FileSys::GetCRTypeFromNCAType(FileSys::NCA{file}.GetType()), program_id,
1836 file);
1837 } else if (res2 == Loader::ResultStatus::Success &&
1838 (file_type == Loader::FileType::XCI || file_type == Loader::FileType::NSP)) {
1839 const auto nsp = file_type == Loader::FileType::NSP
1840 ? std::make_shared<FileSys::NSP>(file)
1841 : FileSys::XCI{file}.GetSecurePartitionNSP();
1842 for (const auto& title : nsp->GetNCAs()) {
1843 for (const auto& entry : title.second) {
1844 provider->AddEntry(entry.first.first, entry.first.second, title.first,
1845 entry.second->GetBaseFile());
1846 }
1847 }
1848 }
1849}
1850
1814void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index, 1851void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
1815 StartGameType type) { 1852 StartGameType type) {
1816 LOG_INFO(Frontend, "yuzu starting..."); 1853 LOG_INFO(Frontend, "yuzu starting...");
@@ -1825,6 +1862,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1825 1862
1826 last_filename_booted = filename; 1863 last_filename_booted = filename;
1827 1864
1865 ConfigureFilesystemProvider(filename.toStdString());
1828 const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); 1866 const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
1829 const auto loader = Loader::GetLoader(*system, v_file, program_id, program_index); 1867 const auto loader = Loader::GetLoader(*system, v_file, program_id, program_index);
1830 1868
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 2cfb96257..1b7055122 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -399,6 +399,7 @@ private:
399 void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); 399 void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
400 bool CheckDarkMode(); 400 bool CheckDarkMode();
401 bool CheckSystemArchiveDecryption(); 401 bool CheckSystemArchiveDecryption();
402 void ConfigureFilesystemProvider(const std::string& filepath);
402 403
403 QString GetTasStateDescription() const; 404 QString GetTasStateDescription() const;
404 bool CreateShortcut(const std::string& shortcut_path, const std::string& title, 405 bool CreateShortcut(const std::string& shortcut_path, const std::string& title,