diff options
| author | 2024-01-19 16:57:13 -0500 | |
|---|---|---|
| committer | 2024-01-19 20:54:50 -0500 | |
| commit | a363fa78ef65ded9f85d8c16940f2fbdc66894e5 (patch) | |
| tree | d2acb5bce7ba787de60f35981fe4c3d951624bc1 /src | |
| parent | android: Add addon delete button (diff) | |
| download | yuzu-a363fa78ef65ded9f85d8c16940f2fbdc66894e5.tar.gz yuzu-a363fa78ef65ded9f85d8c16940f2fbdc66894e5.tar.xz yuzu-a363fa78ef65ded9f85d8c16940f2fbdc66894e5.zip | |
frontend_common: Add documentation for content_mananger
Diffstat (limited to 'src')
| -rw-r--r-- | src/frontend_common/content_manager.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/frontend_common/content_manager.h b/src/frontend_common/content_manager.h index 248ce573e..23f2979db 100644 --- a/src/frontend_common/content_manager.h +++ b/src/frontend_common/content_manager.h | |||
| @@ -25,12 +25,24 @@ enum class InstallResult { | |||
| 25 | BaseInstallAttempted, | 25 | BaseInstallAttempted, |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /** | ||
| 29 | * \brief Removes a single installed DLC | ||
| 30 | * \param fs_controller [FileSystemController] reference from the Core::System instance | ||
| 31 | * \param title_id Unique title ID representing the DLC which will be removed | ||
| 32 | * \return 'true' if successful | ||
| 33 | */ | ||
| 28 | inline bool RemoveDLC(const Service::FileSystem::FileSystemController& fs_controller, | 34 | inline bool RemoveDLC(const Service::FileSystem::FileSystemController& fs_controller, |
| 29 | const u64 title_id) { | 35 | const u64 title_id) { |
| 30 | return fs_controller.GetUserNANDContents()->RemoveExistingEntry(title_id) || | 36 | return fs_controller.GetUserNANDContents()->RemoveExistingEntry(title_id) || |
| 31 | fs_controller.GetSDMCContents()->RemoveExistingEntry(title_id); | 37 | fs_controller.GetSDMCContents()->RemoveExistingEntry(title_id); |
| 32 | } | 38 | } |
| 33 | 39 | ||
| 40 | /** | ||
| 41 | * \brief Removes all DLC for a game | ||
| 42 | * \param system Raw pointer to the system instance | ||
| 43 | * \param program_id Program ID for the game that will have all of its DLC removed | ||
| 44 | * \return Number of DLC removed | ||
| 45 | */ | ||
| 34 | inline size_t RemoveAllDLC(Core::System* system, const u64 program_id) { | 46 | inline size_t RemoveAllDLC(Core::System* system, const u64 program_id) { |
| 35 | size_t count{}; | 47 | size_t count{}; |
| 36 | const auto& fs_controller = system->GetFileSystemController(); | 48 | const auto& fs_controller = system->GetFileSystemController(); |
| @@ -52,6 +64,12 @@ inline size_t RemoveAllDLC(Core::System* system, const u64 program_id) { | |||
| 52 | return count; | 64 | return count; |
| 53 | } | 65 | } |
| 54 | 66 | ||
| 67 | /** | ||
| 68 | * \brief Removes the installed update for a game | ||
| 69 | * \param fs_controller [FileSystemController] reference from the Core::System instance | ||
| 70 | * \param program_id Program ID for the game that will have its installed update removed | ||
| 71 | * \return 'true' if successful | ||
| 72 | */ | ||
| 55 | inline bool RemoveUpdate(const Service::FileSystem::FileSystemController& fs_controller, | 73 | inline bool RemoveUpdate(const Service::FileSystem::FileSystemController& fs_controller, |
| 56 | const u64 program_id) { | 74 | const u64 program_id) { |
| 57 | const auto update_id = program_id | 0x800; | 75 | const auto update_id = program_id | 0x800; |
| @@ -59,12 +77,26 @@ inline bool RemoveUpdate(const Service::FileSystem::FileSystemController& fs_con | |||
| 59 | fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); | 77 | fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); |
| 60 | } | 78 | } |
| 61 | 79 | ||
| 80 | /** | ||
| 81 | * \brief Removes the base content for a game | ||
| 82 | * \param fs_controller [FileSystemController] reference from the Core::System instance | ||
| 83 | * \param program_id Program ID for the game that will have its base content removed | ||
| 84 | * \return 'true' if successful | ||
| 85 | */ | ||
| 62 | inline bool RemoveBaseContent(const Service::FileSystem::FileSystemController& fs_controller, | 86 | inline bool RemoveBaseContent(const Service::FileSystem::FileSystemController& fs_controller, |
| 63 | const u64 program_id) { | 87 | const u64 program_id) { |
| 64 | return fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || | 88 | return fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || |
| 65 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); | 89 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); |
| 66 | } | 90 | } |
| 67 | 91 | ||
| 92 | /** | ||
| 93 | * \brief Removes a mod for a game | ||
| 94 | * \param fs_controller [FileSystemController] reference from the Core::System instance | ||
| 95 | * \param program_id Program ID for the game where [mod_name] will be removed | ||
| 96 | * \param mod_name The name of a mod as given by FileSys::PatchManager::GetPatches. This corresponds | ||
| 97 | * with the name of the mod's directory in a game's load folder. | ||
| 98 | * \return 'true' if successful | ||
| 99 | */ | ||
| 68 | inline bool RemoveMod(const Service::FileSystem::FileSystemController& fs_controller, | 100 | inline bool RemoveMod(const Service::FileSystem::FileSystemController& fs_controller, |
| 69 | const u64 program_id, const std::string& mod_name) { | 101 | const u64 program_id, const std::string& mod_name) { |
| 70 | // Check general Mods (LayeredFS and IPS) | 102 | // Check general Mods (LayeredFS and IPS) |
| @@ -82,6 +114,16 @@ inline bool RemoveMod(const Service::FileSystem::FileSystemController& fs_contro | |||
| 82 | return false; | 114 | return false; |
| 83 | } | 115 | } |
| 84 | 116 | ||
| 117 | /** | ||
| 118 | * \brief Installs an NSP | ||
| 119 | * \param system Raw pointer to the system instance | ||
| 120 | * \param vfs Raw pointer to the VfsFilesystem instance in Core::System | ||
| 121 | * \param filename Path to the NSP file | ||
| 122 | * \param callback Optional callback to report the progress of the installation. The first size_t | ||
| 123 | * parameter is the total size of the virtual file and the second is the current progress. If you | ||
| 124 | * return false to the callback, it will cancel the installation as soon as possible. | ||
| 125 | * \return [InstallResult] representing how the installation finished | ||
| 126 | */ | ||
| 85 | inline InstallResult InstallNSP( | 127 | inline InstallResult InstallNSP( |
| 86 | Core::System* system, FileSys::VfsFilesystem* vfs, const std::string& filename, | 128 | Core::System* system, FileSys::VfsFilesystem* vfs, const std::string& filename, |
| 87 | const std::function<bool(size_t, size_t)>& callback = std::function<bool(size_t, size_t)>()) { | 129 | const std::function<bool(size_t, size_t)>& callback = std::function<bool(size_t, size_t)>()) { |
| @@ -136,6 +178,17 @@ inline InstallResult InstallNSP( | |||
| 136 | } | 178 | } |
| 137 | } | 179 | } |
| 138 | 180 | ||
| 181 | /** | ||
| 182 | * \brief Installs an NCA | ||
| 183 | * \param vfs Raw pointer to the VfsFilesystem instance in Core::System | ||
| 184 | * \param filename Path to the NCA file | ||
| 185 | * \param registered_cache Raw pointer to the registered cache that the NCA will be installed to | ||
| 186 | * \param title_type Type of NCA package to install | ||
| 187 | * \param callback Optional callback to report the progress of the installation. The first size_t | ||
| 188 | * parameter is the total size of the virtual file and the second is the current progress. If you | ||
| 189 | * return false to the callback, it will cancel the installation as soon as possible. | ||
| 190 | * \return [InstallResult] representing how the installation finished | ||
| 191 | */ | ||
| 139 | inline InstallResult InstallNCA( | 192 | inline InstallResult InstallNCA( |
| 140 | FileSys::VfsFilesystem* vfs, const std::string& filename, | 193 | FileSys::VfsFilesystem* vfs, const std::string& filename, |
| 141 | FileSys::RegisteredCache* registered_cache, const FileSys::TitleType title_type, | 194 | FileSys::RegisteredCache* registered_cache, const FileSys::TitleType title_type, |