From d2caf4af7da36f3947eea17656f9c85a6709707c Mon Sep 17 00:00:00 2001
From: Zach Hilman <zachhilman@gmail.com>
Date: Sat, 25 Aug 2018 18:59:19 -0400
Subject: [PATCH] game_list: Use RegisteredCacheUnion for installed Reduces
 code

---
 src/core/crypto/ctr_encryption_layer.cpp | 2 +-
 src/yuzu/game_list.cpp                   | 4 +---
 src/yuzu/game_list_p.h                   | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/core/crypto/ctr_encryption_layer.cpp b/src/core/crypto/ctr_encryption_layer.cpp
index 3ea60dbd0..296fad419 100644
--- a/src/core/crypto/ctr_encryption_layer.cpp
+++ b/src/core/crypto/ctr_encryption_layer.cpp
@@ -21,7 +21,7 @@ size_t CTREncryptionLayer::Read(u8* data, size_t length, size_t offset) const {
         UpdateIV(base_offset + offset);
         std::vector<u8> raw = base->ReadBytes(length, offset);
         cipher.Transcode(raw.data(), raw.size(), data, Op::Decrypt);
-        return raw.size();
+        return length;
     }
 
     // offset does not fall on block boundary (0x10)
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 3e2a5976b..baf78af09 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -621,9 +621,7 @@ void GameListWorker::run() {
     stop_processing = false;
     watch_list.append(dir_path);
     FillControlMap(dir_path.toStdString());
-    AddInstalledTitlesToGameList(Service::FileSystem::GetUserNANDContents());
-    AddInstalledTitlesToGameList(Service::FileSystem::GetSystemNANDContents());
-    AddInstalledTitlesToGameList(Service::FileSystem::GetSDMCContents());
+    AddInstalledTitlesToGameList();
     AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0);
     nca_control_map.clear();
     emit Finished(watch_list);
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 4ddd8cd88..a70a151c5 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -239,7 +239,7 @@ private:
     const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list;
     std::atomic_bool stop_processing;
 
-    void AddInstalledTitlesToGameList(std::shared_ptr<FileSys::RegisteredCache> cache);
+    void AddInstalledTitlesToGameList();
     void FillControlMap(const std::string& dir_path);
     void AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion = 0);
 };