diff options
| author | 2019-06-26 10:26:44 -0400 | |
|---|---|---|
| committer | 2019-06-26 10:26:44 -0400 | |
| commit | 4ed2774c26602d6ee1af316da5faf391d377d701 (patch) | |
| tree | a1ef0e65dfd79f8badde8dcd24014432428c51f8 /src/core/file_sys | |
| parent | Merge pull request #2603 from WamWooWam/master (diff) | |
| parent | glue: Correct missing bytes in ApplicationLaunchParameter (diff) | |
| download | yuzu-4ed2774c26602d6ee1af316da5faf391d377d701.tar.gz yuzu-4ed2774c26602d6ee1af316da5faf391d377d701.tar.xz yuzu-4ed2774c26602d6ee1af316da5faf391d377d701.zip | |
Merge pull request #2607 from DarkLordZach/arp-1
glue: Implement arp:w and arp:r services
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 10 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.h | 9 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 14 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.h | 3 |
4 files changed, 34 insertions, 2 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index da823c37b..a8f80e2c6 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -493,6 +493,16 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam | |||
| 493 | return out; | 493 | return out; |
| 494 | } | 494 | } |
| 495 | 495 | ||
| 496 | std::optional<u32> PatchManager::GetGameVersion() const { | ||
| 497 | const auto& installed = Core::System::GetInstance().GetContentProvider(); | ||
| 498 | const auto update_tid = GetUpdateTitleID(title_id); | ||
| 499 | if (installed.HasEntry(update_tid, ContentRecordType::Program)) { | ||
| 500 | return installed.GetEntryVersion(update_tid); | ||
| 501 | } | ||
| 502 | |||
| 503 | return installed.GetEntryVersion(title_id); | ||
| 504 | } | ||
| 505 | |||
| 496 | std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const { | 506 | std::pair<std::unique_ptr<NACP>, VirtualFile> PatchManager::GetControlMetadata() const { |
| 497 | const auto& installed = Core::System::GetInstance().GetContentProvider(); | 507 | const auto& installed = Core::System::GetInstance().GetContentProvider(); |
| 498 | 508 | ||
diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index 769f8c6f0..a363c6577 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h | |||
| @@ -66,8 +66,13 @@ public: | |||
| 66 | std::map<std::string, std::string, std::less<>> GetPatchVersionNames( | 66 | std::map<std::string, std::string, std::less<>> GetPatchVersionNames( |
| 67 | VirtualFile update_raw = nullptr) const; | 67 | VirtualFile update_raw = nullptr) const; |
| 68 | 68 | ||
| 69 | // Given title_id of the program, attempts to get the control data of the update and parse it, | 69 | // If the game update exists, returns the u32 version field in its Meta-type NCA. If that fails, |
| 70 | // falling back to the base control data. | 70 | // it will fallback to the Meta-type NCA of the base game. If that fails, the result will be |
| 71 | // std::nullopt | ||
| 72 | std::optional<u32> GetGameVersion() const; | ||
| 73 | |||
| 74 | // Given title_id of the program, attempts to get the control data of the update and parse | ||
| 75 | // it, falling back to the base control data. | ||
| 71 | std::pair<std::unique_ptr<NACP>, VirtualFile> GetControlMetadata() const; | 76 | std::pair<std::unique_ptr<NACP>, VirtualFile> GetControlMetadata() const; |
| 72 | 77 | ||
| 73 | // Version of GetControlMetadata that takes an arbitrary NCA | 78 | // Version of GetControlMetadata that takes an arbitrary NCA |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 58917e094..4608490e0 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -645,6 +645,20 @@ ContentProviderUnion::ListEntriesFilterOrigin(std::optional<ContentProviderUnion | |||
| 645 | return out; | 645 | return out; |
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | std::optional<ContentProviderUnionSlot> ContentProviderUnion::GetSlotForEntry( | ||
| 649 | u64 title_id, ContentRecordType type) const { | ||
| 650 | const auto iter = | ||
| 651 | std::find_if(providers.begin(), providers.end(), [title_id, type](const auto& provider) { | ||
| 652 | return provider.second != nullptr && provider.second->HasEntry(title_id, type); | ||
| 653 | }); | ||
| 654 | |||
| 655 | if (iter == providers.end()) { | ||
| 656 | return std::nullopt; | ||
| 657 | } | ||
| 658 | |||
| 659 | return iter->first; | ||
| 660 | } | ||
| 661 | |||
| 648 | ManualContentProvider::~ManualContentProvider() = default; | 662 | ManualContentProvider::~ManualContentProvider() = default; |
| 649 | 663 | ||
| 650 | void ManualContentProvider::AddEntry(TitleType title_type, ContentRecordType content_type, | 664 | void ManualContentProvider::AddEntry(TitleType title_type, ContentRecordType content_type, |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index ec9052653..4398d63e1 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -199,6 +199,9 @@ public: | |||
| 199 | std::optional<TitleType> title_type = {}, std::optional<ContentRecordType> record_type = {}, | 199 | std::optional<TitleType> title_type = {}, std::optional<ContentRecordType> record_type = {}, |
| 200 | std::optional<u64> title_id = {}) const; | 200 | std::optional<u64> title_id = {}) const; |
| 201 | 201 | ||
| 202 | std::optional<ContentProviderUnionSlot> GetSlotForEntry(u64 title_id, | ||
| 203 | ContentRecordType type) const; | ||
| 204 | |||
| 202 | private: | 205 | private: |
| 203 | std::map<ContentProviderUnionSlot, ContentProvider*> providers; | 206 | std::map<ContentProviderUnionSlot, ContentProvider*> providers; |
| 204 | }; | 207 | }; |