diff options
38 files changed, 392 insertions, 248 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp index 76a2b7e86..e29f70b3a 100644 --- a/src/core/file_sys/bis_factory.cpp +++ b/src/core/file_sys/bis_factory.cpp | |||
| @@ -8,8 +8,9 @@ | |||
| 8 | 8 | ||
| 9 | namespace FileSys { | 9 | namespace FileSys { |
| 10 | 10 | ||
| 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_) | 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_) |
| 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), | 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), |
| 13 | dump_root(std::move(dump_root_)), | ||
| 13 | sysnand_cache(std::make_unique<RegisteredCache>( | 14 | sysnand_cache(std::make_unique<RegisteredCache>( |
| 14 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), | 15 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), |
| 15 | usrnand_cache(std::make_unique<RegisteredCache>( | 16 | usrnand_cache(std::make_unique<RegisteredCache>( |
| @@ -32,4 +33,10 @@ VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const { | |||
| 32 | return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id)); | 33 | return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id)); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 36 | VirtualDir BISFactory::GetModificationDumpRoot(u64 title_id) const { | ||
| 37 | if (title_id == 0) | ||
| 38 | return nullptr; | ||
| 39 | return GetOrCreateDirectoryRelative(dump_root, fmt::format("/{:016X}", title_id)); | ||
| 40 | } | ||
| 41 | |||
| 35 | } // namespace FileSys | 42 | } // namespace FileSys |
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h index 364d309bd..453c11ad2 100644 --- a/src/core/file_sys/bis_factory.h +++ b/src/core/file_sys/bis_factory.h | |||
| @@ -17,17 +17,19 @@ class RegisteredCache; | |||
| 17 | /// registered caches. | 17 | /// registered caches. |
| 18 | class BISFactory { | 18 | class BISFactory { |
| 19 | public: | 19 | public: |
| 20 | explicit BISFactory(VirtualDir nand_root, VirtualDir load_root); | 20 | explicit BISFactory(VirtualDir nand_root, VirtualDir load_root, VirtualDir dump_root); |
| 21 | ~BISFactory(); | 21 | ~BISFactory(); |
| 22 | 22 | ||
| 23 | RegisteredCache* GetSystemNANDContents() const; | 23 | RegisteredCache* GetSystemNANDContents() const; |
| 24 | RegisteredCache* GetUserNANDContents() const; | 24 | RegisteredCache* GetUserNANDContents() const; |
| 25 | 25 | ||
| 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; | 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; |
| 27 | VirtualDir GetModificationDumpRoot(u64 title_id) const; | ||
| 27 | 28 | ||
| 28 | private: | 29 | private: |
| 29 | VirtualDir nand_root; | 30 | VirtualDir nand_root; |
| 30 | VirtualDir load_root; | 31 | VirtualDir load_root; |
| 32 | VirtualDir dump_root; | ||
| 31 | 33 | ||
| 32 | std::unique_ptr<RegisteredCache> sysnand_cache; | 34 | std::unique_ptr<RegisteredCache> sysnand_cache; |
| 33 | std::unique_ptr<RegisteredCache> usrnand_cache; | 35 | std::unique_ptr<RegisteredCache> usrnand_cache; |
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 1ece55731..2c145bd09 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp | |||
| @@ -176,7 +176,7 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { | |||
| 176 | for (const VirtualFile& file : partitions[static_cast<std::size_t>(part)]->GetFiles()) { | 176 | for (const VirtualFile& file : partitions[static_cast<std::size_t>(part)]->GetFiles()) { |
| 177 | if (file->GetExtension() != "nca") | 177 | if (file->GetExtension() != "nca") |
| 178 | continue; | 178 | continue; |
| 179 | auto nca = std::make_shared<NCA>(file); | 179 | auto nca = std::make_shared<NCA>(file, nullptr, 0, keys); |
| 180 | // TODO(DarkLordZach): Add proper Rev1+ Support | 180 | // TODO(DarkLordZach): Add proper Rev1+ Support |
| 181 | if (nca->IsUpdate()) | 181 | if (nca->IsUpdate()) |
| 182 | continue; | 182 | continue; |
diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index 8f62571cf..25f5914b6 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/swap.h" | 11 | #include "common/swap.h" |
| 12 | #include "core/crypto/key_manager.h" | ||
| 12 | #include "core/file_sys/vfs.h" | 13 | #include "core/file_sys/vfs.h" |
| 13 | 14 | ||
| 14 | namespace Loader { | 15 | namespace Loader { |
| @@ -107,5 +108,7 @@ private: | |||
| 107 | std::shared_ptr<NSP> secure_partition; | 108 | std::shared_ptr<NSP> secure_partition; |
| 108 | std::shared_ptr<NCA> program; | 109 | std::shared_ptr<NCA> program; |
| 109 | std::vector<std::shared_ptr<NCA>> ncas; | 110 | std::vector<std::shared_ptr<NCA>> ncas; |
| 111 | |||
| 112 | Core::Crypto::KeyManager keys; | ||
| 110 | }; | 113 | }; |
| 111 | } // namespace FileSys | 114 | } // namespace FileSys |
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index b46fe893c..19b6f8600 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp | |||
| @@ -101,8 +101,9 @@ static bool IsValidNCA(const NCAHeader& header) { | |||
| 101 | return header.magic == Common::MakeMagic('N', 'C', 'A', '3'); | 101 | return header.magic == Common::MakeMagic('N', 'C', 'A', '3'); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset) | 104 | NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_offset, |
| 105 | : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)) { | 105 | Core::Crypto::KeyManager keys_) |
| 106 | : file(std::move(file_)), bktr_base_romfs(std::move(bktr_base_romfs_)), keys(std::move(keys_)) { | ||
| 106 | if (file == nullptr) { | 107 | if (file == nullptr) { |
| 107 | status = Loader::ResultStatus::ErrorNullFile; | 108 | status = Loader::ResultStatus::ErrorNullFile; |
| 108 | return; | 109 | return; |
diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h index 4bba55607..99294cbb4 100644 --- a/src/core/file_sys/content_archive.h +++ b/src/core/file_sys/content_archive.h | |||
| @@ -79,7 +79,8 @@ inline bool IsDirectoryExeFS(const std::shared_ptr<VfsDirectory>& pfs) { | |||
| 79 | class NCA : public ReadOnlyVfsDirectory { | 79 | class NCA : public ReadOnlyVfsDirectory { |
| 80 | public: | 80 | public: |
| 81 | explicit NCA(VirtualFile file, VirtualFile bktr_base_romfs = nullptr, | 81 | explicit NCA(VirtualFile file, VirtualFile bktr_base_romfs = nullptr, |
| 82 | u64 bktr_base_ivfc_offset = 0); | 82 | u64 bktr_base_ivfc_offset = 0, |
| 83 | Core::Crypto::KeyManager keys = Core::Crypto::KeyManager()); | ||
| 83 | ~NCA() override; | 84 | ~NCA() override; |
| 84 | 85 | ||
| 85 | Loader::ResultStatus GetStatus() const; | 86 | Loader::ResultStatus GetStatus() const; |
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index fea0593c7..e4a4ee4ab 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h | |||
| @@ -8,25 +8,10 @@ | |||
| 8 | 8 | ||
| 9 | namespace FileSys { | 9 | namespace FileSys { |
| 10 | 10 | ||
| 11 | namespace ErrCodes { | 11 | constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; |
| 12 | enum { | 12 | constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; |
| 13 | NotFound = 1, | 13 | constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; |
| 14 | TitleNotFound = 1002, | 14 | constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, 6061}; |
| 15 | SdCardNotFound = 2001, | 15 | constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, 6062}; |
| 16 | RomFSNotFound = 2520, | ||
| 17 | }; | ||
| 18 | } | ||
| 19 | |||
| 20 | constexpr ResultCode ERROR_PATH_NOT_FOUND(ErrorModule::FS, ErrCodes::NotFound); | ||
| 21 | |||
| 22 | // TODO(bunnei): Replace these with correct errors for Switch OS | ||
| 23 | constexpr ResultCode ERROR_INVALID_PATH(-1); | ||
| 24 | constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(-1); | ||
| 25 | constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(-1); | ||
| 26 | constexpr ResultCode ERROR_FILE_NOT_FOUND(-1); | ||
| 27 | constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(-1); | ||
| 28 | constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(-1); | ||
| 29 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(-1); | ||
| 30 | constexpr ResultCode ERROR_DIRECTORY_NOT_EMPTY(-1); | ||
| 31 | 16 | ||
| 32 | } // namespace FileSys | 17 | } // namespace FileSys |
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 0c1156989..8d062eb3e 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include "core/file_sys/vfs_vector.h" | 19 | #include "core/file_sys/vfs_vector.h" |
| 20 | #include "core/hle/service/filesystem/filesystem.h" | 20 | #include "core/hle/service/filesystem/filesystem.h" |
| 21 | #include "core/loader/loader.h" | 21 | #include "core/loader/loader.h" |
| 22 | #include "core/settings.h" | ||
| 22 | 23 | ||
| 23 | namespace FileSys { | 24 | namespace FileSys { |
| 24 | 25 | ||
| @@ -119,6 +120,18 @@ std::vector<u8> PatchManager::PatchNSO(const std::vector<u8>& nso) const { | |||
| 119 | const auto build_id_raw = Common::HexArrayToString(header.build_id); | 120 | const auto build_id_raw = Common::HexArrayToString(header.build_id); |
| 120 | const auto build_id = build_id_raw.substr(0, build_id_raw.find_last_not_of('0') + 1); | 121 | const auto build_id = build_id_raw.substr(0, build_id_raw.find_last_not_of('0') + 1); |
| 121 | 122 | ||
| 123 | if (Settings::values.dump_nso) { | ||
| 124 | LOG_INFO(Loader, "Dumping NSO for build_id={}, title_id={:016X}", build_id, title_id); | ||
| 125 | const auto dump_dir = Service::FileSystem::GetModificationDumpRoot(title_id); | ||
| 126 | if (dump_dir != nullptr) { | ||
| 127 | const auto nso_dir = GetOrCreateDirectoryRelative(dump_dir, "/nso"); | ||
| 128 | const auto file = nso_dir->CreateFile(fmt::format("{}.nso", build_id)); | ||
| 129 | |||
| 130 | file->Resize(nso.size()); | ||
| 131 | file->WriteBytes(nso); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 122 | LOG_INFO(Loader, "Patching NSO for build_id={}", build_id); | 135 | LOG_INFO(Loader, "Patching NSO for build_id={}", build_id); |
| 123 | 136 | ||
| 124 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); | 137 | const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id); |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 96302a241..a3f8f2f73 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -106,9 +106,12 @@ static ContentRecordType GetCRTypeFromNCAType(NCAContentType type) { | |||
| 106 | 106 | ||
| 107 | VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir, | 107 | VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir, |
| 108 | std::string_view path) const { | 108 | std::string_view path) const { |
| 109 | if (dir->GetFileRelative(path) != nullptr) | 109 | const auto file = dir->GetFileRelative(path); |
| 110 | return dir->GetFileRelative(path); | 110 | if (file != nullptr) |
| 111 | if (dir->GetDirectoryRelative(path) != nullptr) { | 111 | return file; |
| 112 | |||
| 113 | const auto nca_dir = dir->GetDirectoryRelative(path); | ||
| 114 | if (nca_dir != nullptr) { | ||
| 112 | const auto nca_dir = dir->GetDirectoryRelative(path); | 115 | const auto nca_dir = dir->GetDirectoryRelative(path); |
| 113 | VirtualFile file = nullptr; | 116 | VirtualFile file = nullptr; |
| 114 | 117 | ||
| @@ -225,7 +228,7 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) { | |||
| 225 | 228 | ||
| 226 | if (file == nullptr) | 229 | if (file == nullptr) |
| 227 | continue; | 230 | continue; |
| 228 | const auto nca = std::make_shared<NCA>(parser(file, id)); | 231 | const auto nca = std::make_shared<NCA>(parser(file, id), nullptr, 0, keys); |
| 229 | if (nca->GetStatus() != Loader::ResultStatus::Success || | 232 | if (nca->GetStatus() != Loader::ResultStatus::Success || |
| 230 | nca->GetType() != NCAContentType::Meta) { | 233 | nca->GetType() != NCAContentType::Meta) { |
| 231 | continue; | 234 | continue; |
| @@ -315,7 +318,7 @@ std::unique_ptr<NCA> RegisteredCache::GetEntry(u64 title_id, ContentRecordType t | |||
| 315 | const auto raw = GetEntryRaw(title_id, type); | 318 | const auto raw = GetEntryRaw(title_id, type); |
| 316 | if (raw == nullptr) | 319 | if (raw == nullptr) |
| 317 | return nullptr; | 320 | return nullptr; |
| 318 | return std::make_unique<NCA>(raw); | 321 | return std::make_unique<NCA>(raw, nullptr, 0, keys); |
| 319 | } | 322 | } |
| 320 | 323 | ||
| 321 | std::unique_ptr<NCA> RegisteredCache::GetEntry(RegisteredCacheEntry entry) const { | 324 | std::unique_ptr<NCA> RegisteredCache::GetEntry(RegisteredCacheEntry entry) const { |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 6cfb16017..6b89db8de 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <vector> | 12 | #include <vector> |
| 13 | #include <boost/container/flat_map.hpp> | 13 | #include <boost/container/flat_map.hpp> |
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "core/crypto/key_manager.h" | ||
| 15 | #include "core/file_sys/vfs.h" | 16 | #include "core/file_sys/vfs.h" |
| 16 | 17 | ||
| 17 | namespace FileSys { | 18 | namespace FileSys { |
| @@ -133,6 +134,8 @@ private: | |||
| 133 | 134 | ||
| 134 | VirtualDir dir; | 135 | VirtualDir dir; |
| 135 | RegisteredCacheParsingFunction parser; | 136 | RegisteredCacheParsingFunction parser; |
| 137 | Core::Crypto::KeyManager keys; | ||
| 138 | |||
| 136 | // maps tid -> NcaID of meta | 139 | // maps tid -> NcaID of meta |
| 137 | boost::container::flat_map<u64, NcaID> meta_id; | 140 | boost::container::flat_map<u64, NcaID> meta_id; |
| 138 | // maps tid -> meta | 141 | // maps tid -> meta |
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index 2aaba4179..e1a4210db 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp | |||
| @@ -252,7 +252,7 @@ void NSP::ReadNCAs(const std::vector<VirtualFile>& files) { | |||
| 252 | continue; | 252 | continue; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | auto next_nca = std::make_shared<NCA>(next_file); | 255 | auto next_nca = std::make_shared<NCA>(next_file, nullptr, 0, keys); |
| 256 | if (next_nca->GetType() == NCAContentType::Program) | 256 | if (next_nca->GetType() == NCAContentType::Program) |
| 257 | program_status[cnmt.GetTitleID()] = next_nca->GetStatus(); | 257 | program_status[cnmt.GetTitleID()] = next_nca->GetStatus(); |
| 258 | if (next_nca->GetStatus() == Loader::ResultStatus::Success || | 258 | if (next_nca->GetStatus() == Loader::ResultStatus::Success || |
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h index 338080b7e..9a28ed5bb 100644 --- a/src/core/file_sys/submission_package.h +++ b/src/core/file_sys/submission_package.h | |||
| @@ -70,6 +70,8 @@ private: | |||
| 70 | std::map<u64, std::map<ContentRecordType, std::shared_ptr<NCA>>> ncas; | 70 | std::map<u64, std::map<ContentRecordType, std::shared_ptr<NCA>>> ncas; |
| 71 | std::vector<VirtualFile> ticket_files; | 71 | std::vector<VirtualFile> ticket_files; |
| 72 | 72 | ||
| 73 | Core::Crypto::KeyManager keys; | ||
| 74 | |||
| 73 | VirtualFile romfs; | 75 | VirtualFile romfs; |
| 74 | VirtualDir exefs; | 76 | VirtualDir exefs; |
| 75 | }; | 77 | }; |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index dd5cd9ced..4ffb76818 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -142,36 +142,7 @@ void Thread::ResumeFromWait() { | |||
| 142 | 142 | ||
| 143 | status = ThreadStatus::Ready; | 143 | status = ThreadStatus::Ready; |
| 144 | 144 | ||
| 145 | std::optional<s32> new_processor_id = GetNextProcessorId(affinity_mask); | 145 | ChangeScheduler(); |
| 146 | if (!new_processor_id) { | ||
| 147 | new_processor_id = processor_id; | ||
| 148 | } | ||
| 149 | if (ideal_core != -1 && | ||
| 150 | Core::System::GetInstance().Scheduler(ideal_core).GetCurrentThread() == nullptr) { | ||
| 151 | new_processor_id = ideal_core; | ||
| 152 | } | ||
| 153 | |||
| 154 | ASSERT(*new_processor_id < 4); | ||
| 155 | |||
| 156 | // Add thread to new core's scheduler | ||
| 157 | auto* next_scheduler = &Core::System::GetInstance().Scheduler(*new_processor_id); | ||
| 158 | |||
| 159 | if (*new_processor_id != processor_id) { | ||
| 160 | // Remove thread from previous core's scheduler | ||
| 161 | scheduler->RemoveThread(this); | ||
| 162 | next_scheduler->AddThread(this, current_priority); | ||
| 163 | } | ||
| 164 | |||
| 165 | processor_id = *new_processor_id; | ||
| 166 | |||
| 167 | // If the thread was ready, unschedule from the previous core and schedule on the new core | ||
| 168 | scheduler->UnscheduleThread(this, current_priority); | ||
| 169 | next_scheduler->ScheduleThread(this, current_priority); | ||
| 170 | |||
| 171 | // Change thread's scheduler | ||
| 172 | scheduler = next_scheduler; | ||
| 173 | |||
| 174 | Core::System::GetInstance().CpuCore(processor_id).PrepareReschedule(); | ||
| 175 | } | 146 | } |
| 176 | 147 | ||
| 177 | /** | 148 | /** |
| @@ -364,42 +335,45 @@ void Thread::UpdatePriority() { | |||
| 364 | void Thread::ChangeCore(u32 core, u64 mask) { | 335 | void Thread::ChangeCore(u32 core, u64 mask) { |
| 365 | ideal_core = core; | 336 | ideal_core = core; |
| 366 | affinity_mask = mask; | 337 | affinity_mask = mask; |
| 338 | ChangeScheduler(); | ||
| 339 | } | ||
| 367 | 340 | ||
| 341 | void Thread::ChangeScheduler() { | ||
| 368 | if (status != ThreadStatus::Ready) { | 342 | if (status != ThreadStatus::Ready) { |
| 369 | return; | 343 | return; |
| 370 | } | 344 | } |
| 371 | 345 | ||
| 346 | auto& system = Core::System::GetInstance(); | ||
| 372 | std::optional<s32> new_processor_id{GetNextProcessorId(affinity_mask)}; | 347 | std::optional<s32> new_processor_id{GetNextProcessorId(affinity_mask)}; |
| 373 | 348 | ||
| 374 | if (!new_processor_id) { | 349 | if (!new_processor_id) { |
| 375 | new_processor_id = processor_id; | 350 | new_processor_id = processor_id; |
| 376 | } | 351 | } |
| 377 | if (ideal_core != -1 && | 352 | if (ideal_core != -1 && system.Scheduler(ideal_core).GetCurrentThread() == nullptr) { |
| 378 | Core::System::GetInstance().Scheduler(ideal_core).GetCurrentThread() == nullptr) { | ||
| 379 | new_processor_id = ideal_core; | 353 | new_processor_id = ideal_core; |
| 380 | } | 354 | } |
| 381 | 355 | ||
| 382 | ASSERT(*new_processor_id < 4); | 356 | ASSERT(*new_processor_id < 4); |
| 383 | 357 | ||
| 384 | // Add thread to new core's scheduler | 358 | // Add thread to new core's scheduler |
| 385 | auto* next_scheduler = &Core::System::GetInstance().Scheduler(*new_processor_id); | 359 | auto& next_scheduler = system.Scheduler(*new_processor_id); |
| 386 | 360 | ||
| 387 | if (*new_processor_id != processor_id) { | 361 | if (*new_processor_id != processor_id) { |
| 388 | // Remove thread from previous core's scheduler | 362 | // Remove thread from previous core's scheduler |
| 389 | scheduler->RemoveThread(this); | 363 | scheduler->RemoveThread(this); |
| 390 | next_scheduler->AddThread(this, current_priority); | 364 | next_scheduler.AddThread(this, current_priority); |
| 391 | } | 365 | } |
| 392 | 366 | ||
| 393 | processor_id = *new_processor_id; | 367 | processor_id = *new_processor_id; |
| 394 | 368 | ||
| 395 | // If the thread was ready, unschedule from the previous core and schedule on the new core | 369 | // If the thread was ready, unschedule from the previous core and schedule on the new core |
| 396 | scheduler->UnscheduleThread(this, current_priority); | 370 | scheduler->UnscheduleThread(this, current_priority); |
| 397 | next_scheduler->ScheduleThread(this, current_priority); | 371 | next_scheduler.ScheduleThread(this, current_priority); |
| 398 | 372 | ||
| 399 | // Change thread's scheduler | 373 | // Change thread's scheduler |
| 400 | scheduler = next_scheduler; | 374 | scheduler = &next_scheduler; |
| 401 | 375 | ||
| 402 | Core::System::GetInstance().CpuCore(processor_id).PrepareReschedule(); | 376 | system.CpuCore(processor_id).PrepareReschedule(); |
| 403 | } | 377 | } |
| 404 | 378 | ||
| 405 | bool Thread::AllWaitObjectsReady() { | 379 | bool Thread::AllWaitObjectsReady() { |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 4a6e11239..d384d50db 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -374,6 +374,8 @@ private: | |||
| 374 | explicit Thread(KernelCore& kernel); | 374 | explicit Thread(KernelCore& kernel); |
| 375 | ~Thread() override; | 375 | ~Thread() override; |
| 376 | 376 | ||
| 377 | void ChangeScheduler(); | ||
| 378 | |||
| 377 | Core::ARM_Interface::ThreadContext context{}; | 379 | Core::ARM_Interface::ThreadContext context{}; |
| 378 | 380 | ||
| 379 | u32 thread_id = 0; | 381 | u32 thread_id = 0; |
diff --git a/src/core/hle/result.h b/src/core/hle/result.h index c6b18cfba..bfb77cc31 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h | |||
| @@ -19,8 +19,6 @@ | |||
| 19 | enum class ErrorDescription : u32 { | 19 | enum class ErrorDescription : u32 { |
| 20 | Success = 0, | 20 | Success = 0, |
| 21 | RemoteProcessDead = 301, | 21 | RemoteProcessDead = 301, |
| 22 | InvalidOffset = 6061, | ||
| 23 | InvalidLength = 6062, | ||
| 24 | }; | 22 | }; |
| 25 | 23 | ||
| 26 | /** | 24 | /** |
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 35a8bef6c..d3ea57ea7 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -28,13 +28,13 @@ public: | |||
| 28 | {1, &IAudioRenderer::GetSampleCount, "GetSampleCount"}, | 28 | {1, &IAudioRenderer::GetSampleCount, "GetSampleCount"}, |
| 29 | {2, &IAudioRenderer::GetMixBufferCount, "GetMixBufferCount"}, | 29 | {2, &IAudioRenderer::GetMixBufferCount, "GetMixBufferCount"}, |
| 30 | {3, &IAudioRenderer::GetState, "GetState"}, | 30 | {3, &IAudioRenderer::GetState, "GetState"}, |
| 31 | {4, &IAudioRenderer::RequestUpdate, "RequestUpdate"}, | 31 | {4, &IAudioRenderer::RequestUpdateImpl, "RequestUpdate"}, |
| 32 | {5, &IAudioRenderer::Start, "Start"}, | 32 | {5, &IAudioRenderer::Start, "Start"}, |
| 33 | {6, &IAudioRenderer::Stop, "Stop"}, | 33 | {6, &IAudioRenderer::Stop, "Stop"}, |
| 34 | {7, &IAudioRenderer::QuerySystemEvent, "QuerySystemEvent"}, | 34 | {7, &IAudioRenderer::QuerySystemEvent, "QuerySystemEvent"}, |
| 35 | {8, &IAudioRenderer::SetRenderingTimeLimit, "SetRenderingTimeLimit"}, | 35 | {8, &IAudioRenderer::SetRenderingTimeLimit, "SetRenderingTimeLimit"}, |
| 36 | {9, &IAudioRenderer::GetRenderingTimeLimit, "GetRenderingTimeLimit"}, | 36 | {9, &IAudioRenderer::GetRenderingTimeLimit, "GetRenderingTimeLimit"}, |
| 37 | {10, nullptr, "RequestUpdateAuto"}, | 37 | {10, &IAudioRenderer::RequestUpdateImpl, "RequestUpdateAuto"}, |
| 38 | {11, nullptr, "ExecuteAudioRendererRendering"}, | 38 | {11, nullptr, "ExecuteAudioRendererRendering"}, |
| 39 | }; | 39 | }; |
| 40 | // clang-format on | 40 | // clang-format on |
| @@ -79,7 +79,7 @@ private: | |||
| 79 | LOG_DEBUG(Service_Audio, "called"); | 79 | LOG_DEBUG(Service_Audio, "called"); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | void RequestUpdate(Kernel::HLERequestContext& ctx) { | 82 | void RequestUpdateImpl(Kernel::HLERequestContext& ctx) { |
| 83 | ctx.WriteBuffer(renderer->UpdateAudioRenderer(ctx.ReadBuffer())); | 83 | ctx.WriteBuffer(renderer->UpdateAudioRenderer(ctx.ReadBuffer())); |
| 84 | IPC::ResponseBuilder rb{ctx, 2}; | 84 | IPC::ResponseBuilder rb{ctx, 2}; |
| 85 | rb.Push(RESULT_SUCCESS); | 85 | rb.Push(RESULT_SUCCESS); |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index ea8fd965a..5d6294016 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -303,7 +303,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space, | |||
| 303 | static_cast<u8>(space), save_struct.DebugInfo()); | 303 | static_cast<u8>(space), save_struct.DebugInfo()); |
| 304 | 304 | ||
| 305 | if (save_data_factory == nullptr) { | 305 | if (save_data_factory == nullptr) { |
| 306 | return ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound); | 306 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | return save_data_factory->Open(space, save_struct); | 309 | return save_data_factory->Open(space, save_struct); |
| @@ -313,7 +313,7 @@ ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space) | |||
| 313 | LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space)); | 313 | LOG_TRACE(Service_FS, "Opening Save Data Space for space_id={:01X}", static_cast<u8>(space)); |
| 314 | 314 | ||
| 315 | if (save_data_factory == nullptr) { | 315 | if (save_data_factory == nullptr) { |
| 316 | return ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound); | 316 | return FileSys::ERROR_ENTITY_NOT_FOUND; |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space)); | 319 | return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space)); |
| @@ -323,15 +323,22 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() { | |||
| 323 | LOG_TRACE(Service_FS, "Opening SDMC"); | 323 | LOG_TRACE(Service_FS, "Opening SDMC"); |
| 324 | 324 | ||
| 325 | if (sdmc_factory == nullptr) { | 325 | if (sdmc_factory == nullptr) { |
| 326 | return ResultCode(ErrorModule::FS, FileSys::ErrCodes::SdCardNotFound); | 326 | return FileSys::ERROR_SD_CARD_NOT_FOUND; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | return sdmc_factory->Open(); | 329 | return sdmc_factory->Open(); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | std::unique_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() { | 332 | std::shared_ptr<FileSys::RegisteredCacheUnion> registered_cache_union; |
| 333 | return std::make_unique<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{ | 333 | |
| 334 | GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}); | 334 | std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() { |
| 335 | if (registered_cache_union == nullptr) { | ||
| 336 | registered_cache_union = | ||
| 337 | std::make_shared<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{ | ||
| 338 | GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}); | ||
| 339 | } | ||
| 340 | |||
| 341 | return registered_cache_union; | ||
| 335 | } | 342 | } |
| 336 | 343 | ||
| 337 | FileSys::RegisteredCache* GetSystemNANDContents() { | 344 | FileSys::RegisteredCache* GetSystemNANDContents() { |
| @@ -370,6 +377,15 @@ FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) { | |||
| 370 | return bis_factory->GetModificationLoadRoot(title_id); | 377 | return bis_factory->GetModificationLoadRoot(title_id); |
| 371 | } | 378 | } |
| 372 | 379 | ||
| 380 | FileSys::VirtualDir GetModificationDumpRoot(u64 title_id) { | ||
| 381 | LOG_TRACE(Service_FS, "Opening mod dump root for tid={:016X}", title_id); | ||
| 382 | |||
| 383 | if (bis_factory == nullptr) | ||
| 384 | return nullptr; | ||
| 385 | |||
| 386 | return bis_factory->GetModificationDumpRoot(title_id); | ||
| 387 | } | ||
| 388 | |||
| 373 | void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { | 389 | void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { |
| 374 | if (overwrite) { | 390 | if (overwrite) { |
| 375 | bis_factory = nullptr; | 391 | bis_factory = nullptr; |
| @@ -383,13 +399,21 @@ void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) { | |||
| 383 | FileSys::Mode::ReadWrite); | 399 | FileSys::Mode::ReadWrite); |
| 384 | auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), | 400 | auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), |
| 385 | FileSys::Mode::ReadWrite); | 401 | FileSys::Mode::ReadWrite); |
| 402 | auto dump_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::DumpDir), | ||
| 403 | FileSys::Mode::ReadWrite); | ||
| 386 | 404 | ||
| 387 | if (bis_factory == nullptr) | 405 | if (bis_factory == nullptr) { |
| 388 | bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory, load_directory); | 406 | bis_factory = |
| 389 | if (save_data_factory == nullptr) | 407 | std::make_unique<FileSys::BISFactory>(nand_directory, load_directory, dump_directory); |
| 408 | } | ||
| 409 | |||
| 410 | if (save_data_factory == nullptr) { | ||
| 390 | save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory)); | 411 | save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory)); |
| 391 | if (sdmc_factory == nullptr) | 412 | } |
| 413 | |||
| 414 | if (sdmc_factory == nullptr) { | ||
| 392 | sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); | 415 | sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); |
| 416 | } | ||
| 393 | } | 417 | } |
| 394 | 418 | ||
| 395 | void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) { | 419 | void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) { |
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 2cbb70c87..ff9182e84 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h | |||
| @@ -48,13 +48,14 @@ ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space, | |||
| 48 | ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); | 48 | ResultVal<FileSys::VirtualDir> OpenSaveDataSpace(FileSys::SaveDataSpaceId space); |
| 49 | ResultVal<FileSys::VirtualDir> OpenSDMC(); | 49 | ResultVal<FileSys::VirtualDir> OpenSDMC(); |
| 50 | 50 | ||
| 51 | std::unique_ptr<FileSys::RegisteredCacheUnion> GetUnionContents(); | 51 | std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents(); |
| 52 | 52 | ||
| 53 | FileSys::RegisteredCache* GetSystemNANDContents(); | 53 | FileSys::RegisteredCache* GetSystemNANDContents(); |
| 54 | FileSys::RegisteredCache* GetUserNANDContents(); | 54 | FileSys::RegisteredCache* GetUserNANDContents(); |
| 55 | FileSys::RegisteredCache* GetSDMCContents(); | 55 | FileSys::RegisteredCache* GetSDMCContents(); |
| 56 | 56 | ||
| 57 | FileSys::VirtualDir GetModificationLoadRoot(u64 title_id); | 57 | FileSys::VirtualDir GetModificationLoadRoot(u64 title_id); |
| 58 | FileSys::VirtualDir GetModificationDumpRoot(u64 title_id); | ||
| 58 | 59 | ||
| 59 | // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function | 60 | // Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function |
| 60 | // above is called. | 61 | // above is called. |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index b9a1d5105..038dc80b1 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -63,12 +63,12 @@ private: | |||
| 63 | // Error checking | 63 | // Error checking |
| 64 | if (length < 0) { | 64 | if (length < 0) { |
| 65 | IPC::ResponseBuilder rb{ctx, 2}; | 65 | IPC::ResponseBuilder rb{ctx, 2}; |
| 66 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); | 66 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| 69 | if (offset < 0) { | 69 | if (offset < 0) { |
| 70 | IPC::ResponseBuilder rb{ctx, 2}; | 70 | IPC::ResponseBuilder rb{ctx, 2}; |
| 71 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset)); | 71 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -108,12 +108,12 @@ private: | |||
| 108 | // Error checking | 108 | // Error checking |
| 109 | if (length < 0) { | 109 | if (length < 0) { |
| 110 | IPC::ResponseBuilder rb{ctx, 2}; | 110 | IPC::ResponseBuilder rb{ctx, 2}; |
| 111 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); | 111 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 112 | return; | 112 | return; |
| 113 | } | 113 | } |
| 114 | if (offset < 0) { | 114 | if (offset < 0) { |
| 115 | IPC::ResponseBuilder rb{ctx, 2}; | 115 | IPC::ResponseBuilder rb{ctx, 2}; |
| 116 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset)); | 116 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 117 | return; | 117 | return; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| @@ -139,12 +139,12 @@ private: | |||
| 139 | // Error checking | 139 | // Error checking |
| 140 | if (length < 0) { | 140 | if (length < 0) { |
| 141 | IPC::ResponseBuilder rb{ctx, 2}; | 141 | IPC::ResponseBuilder rb{ctx, 2}; |
| 142 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength)); | 142 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 143 | return; | 143 | return; |
| 144 | } | 144 | } |
| 145 | if (offset < 0) { | 145 | if (offset < 0) { |
| 146 | IPC::ResponseBuilder rb{ctx, 2}; | 146 | IPC::ResponseBuilder rb{ctx, 2}; |
| 147 | rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset)); | 147 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 148 | return; | 148 | return; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| @@ -744,7 +744,7 @@ void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { | |||
| 744 | 744 | ||
| 745 | if (dir.Failed()) { | 745 | if (dir.Failed()) { |
| 746 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; | 746 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; |
| 747 | rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound)); | 747 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); |
| 748 | return; | 748 | return; |
| 749 | } | 749 | } |
| 750 | 750 | ||
| @@ -836,7 +836,7 @@ void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) { | |||
| 836 | static_cast<u8>(storage_id), title_id); | 836 | static_cast<u8>(storage_id), title_id); |
| 837 | 837 | ||
| 838 | IPC::ResponseBuilder rb{ctx, 2}; | 838 | IPC::ResponseBuilder rb{ctx, 2}; |
| 839 | rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::TitleNotFound)); | 839 | rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND); |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | } // namespace Service::FileSystem | 842 | } // namespace Service::FileSystem |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 56c415e4e..205e4fd14 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -40,6 +40,29 @@ enum class JoystickId : std::size_t { | |||
| 40 | Joystick_Right, | 40 | Joystick_Right, |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | static std::size_t NPadIdToIndex(u32 npad_id) { | ||
| 44 | switch (npad_id) { | ||
| 45 | case 0: | ||
| 46 | case 1: | ||
| 47 | case 2: | ||
| 48 | case 3: | ||
| 49 | case 4: | ||
| 50 | case 5: | ||
| 51 | case 6: | ||
| 52 | case 7: | ||
| 53 | return npad_id; | ||
| 54 | case 8: | ||
| 55 | case NPAD_HANDHELD: | ||
| 56 | return 8; | ||
| 57 | case 9: | ||
| 58 | case NPAD_UNKNOWN: | ||
| 59 | return 9; | ||
| 60 | default: | ||
| 61 | UNIMPLEMENTED_MSG("Unknown npad id {}", npad_id); | ||
| 62 | return 0; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 43 | Controller_NPad::Controller_NPad() = default; | 66 | Controller_NPad::Controller_NPad() = default; |
| 44 | Controller_NPad::~Controller_NPad() = default; | 67 | Controller_NPad::~Controller_NPad() = default; |
| 45 | 68 | ||
| @@ -288,10 +311,11 @@ void Controller_NPad::OnUpdate(u8* data, std::size_t data_len) { | |||
| 288 | switch (controller_type) { | 311 | switch (controller_type) { |
| 289 | case NPadControllerType::Handheld: | 312 | case NPadControllerType::Handheld: |
| 290 | handheld_entry.connection_status.raw = 0; | 313 | handheld_entry.connection_status.raw = 0; |
| 291 | handheld_entry.connection_status.IsConnected.Assign(1); | 314 | handheld_entry.connection_status.IsWired.Assign(1); |
| 292 | if (!Settings::values.use_docked_mode) { | 315 | handheld_entry.connection_status.IsLeftJoyConnected.Assign(1); |
| 293 | handheld_entry.connection_status.IsWired.Assign(1); | 316 | handheld_entry.connection_status.IsRightJoyConnected.Assign(1); |
| 294 | } | 317 | handheld_entry.connection_status.IsLeftJoyWired.Assign(1); |
| 318 | handheld_entry.connection_status.IsRightJoyWired.Assign(1); | ||
| 295 | handheld_entry.pad_states.raw = pad_state.raw; | 319 | handheld_entry.pad_states.raw = pad_state.raw; |
| 296 | handheld_entry.l_stick = lstick_entry; | 320 | handheld_entry.l_stick = lstick_entry; |
| 297 | handheld_entry.r_stick = rstick_entry; | 321 | handheld_entry.r_stick = rstick_entry; |
| @@ -371,16 +395,30 @@ void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) { | |||
| 371 | supported_npad_id_types.clear(); | 395 | supported_npad_id_types.clear(); |
| 372 | supported_npad_id_types.resize(length / sizeof(u32)); | 396 | supported_npad_id_types.resize(length / sizeof(u32)); |
| 373 | std::memcpy(supported_npad_id_types.data(), data, length); | 397 | std::memcpy(supported_npad_id_types.data(), data, length); |
| 398 | bool had_controller_update = false; | ||
| 374 | for (std::size_t i = 0; i < connected_controllers.size(); i++) { | 399 | for (std::size_t i = 0; i < connected_controllers.size(); i++) { |
| 375 | auto& controller = connected_controllers[i]; | 400 | auto& controller = connected_controllers[i]; |
| 376 | if (!controller.is_connected) { | 401 | if (!controller.is_connected) { |
| 377 | continue; | 402 | continue; |
| 378 | } | 403 | } |
| 379 | if (!IsControllerSupported(PREFERRED_CONTROLLER)) { | 404 | if (!IsControllerSupported(PREFERRED_CONTROLLER)) { |
| 380 | controller.type = DecideBestController(PREFERRED_CONTROLLER); | 405 | const auto best_type = DecideBestController(PREFERRED_CONTROLLER); |
| 381 | InitNewlyAddedControler(i); | 406 | const bool is_handheld = (best_type == NPadControllerType::Handheld || |
| 407 | PREFERRED_CONTROLLER == NPadControllerType::Handheld); | ||
| 408 | if (is_handheld) { | ||
| 409 | controller.type = NPadControllerType::None; | ||
| 410 | controller.is_connected = false; | ||
| 411 | AddNewController(best_type); | ||
| 412 | } else { | ||
| 413 | controller.type = best_type; | ||
| 414 | InitNewlyAddedControler(i); | ||
| 415 | } | ||
| 416 | had_controller_update = true; | ||
| 382 | } | 417 | } |
| 383 | } | 418 | } |
| 419 | if (had_controller_update) { | ||
| 420 | styleset_changed_event->Signal(); | ||
| 421 | } | ||
| 384 | } | 422 | } |
| 385 | 423 | ||
| 386 | void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { | 424 | void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { |
| @@ -458,15 +496,11 @@ void Controller_NPad::AddNewController(NPadControllerType controller) { | |||
| 458 | } | 496 | } |
| 459 | 497 | ||
| 460 | void Controller_NPad::ConnectNPad(u32 npad_id) { | 498 | void Controller_NPad::ConnectNPad(u32 npad_id) { |
| 461 | if (npad_id >= connected_controllers.size()) | 499 | connected_controllers[NPadIdToIndex(npad_id)].is_connected = true; |
| 462 | return; | ||
| 463 | connected_controllers[npad_id].is_connected = true; | ||
| 464 | } | 500 | } |
| 465 | 501 | ||
| 466 | void Controller_NPad::DisconnectNPad(u32 npad_id) { | 502 | void Controller_NPad::DisconnectNPad(u32 npad_id) { |
| 467 | if (npad_id >= connected_controllers.size()) | 503 | connected_controllers[NPadIdToIndex(npad_id)].is_connected = false; |
| 468 | return; | ||
| 469 | connected_controllers[npad_id].is_connected = false; | ||
| 470 | } | 504 | } |
| 471 | 505 | ||
| 472 | Controller_NPad::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) { | 506 | Controller_NPad::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) { |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a45fd4954..39631b14f 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -286,10 +286,10 @@ public: | |||
| 286 | {519, nullptr, "GetPalmaOperationResult"}, | 286 | {519, nullptr, "GetPalmaOperationResult"}, |
| 287 | {520, nullptr, "ReadPalmaPlayLog"}, | 287 | {520, nullptr, "ReadPalmaPlayLog"}, |
| 288 | {521, nullptr, "ResetPalmaPlayLog"}, | 288 | {521, nullptr, "ResetPalmaPlayLog"}, |
| 289 | {522, nullptr, "SetIsPalmaAllConnectable"}, | 289 | {522, &Hid::SetIsPalmaAllConnectable, "SetIsPalmaAllConnectable"}, |
| 290 | {523, nullptr, "SetIsPalmaPairedConnectable"}, | 290 | {523, nullptr, "SetIsPalmaPairedConnectable"}, |
| 291 | {524, nullptr, "PairPalma"}, | 291 | {524, nullptr, "PairPalma"}, |
| 292 | {525, nullptr, "SetPalmaBoostMode"}, | 292 | {525, &Hid::SetPalmaBoostMode, "SetPalmaBoostMode"}, |
| 293 | {1000, nullptr, "SetNpadCommunicationMode"}, | 293 | {1000, nullptr, "SetNpadCommunicationMode"}, |
| 294 | {1001, nullptr, "GetNpadCommunicationMode"}, | 294 | {1001, nullptr, "GetNpadCommunicationMode"}, |
| 295 | }; | 295 | }; |
| @@ -596,6 +596,18 @@ private: | |||
| 596 | rb.Push(RESULT_SUCCESS); | 596 | rb.Push(RESULT_SUCCESS); |
| 597 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 597 | LOG_WARNING(Service_HID, "(STUBBED) called"); |
| 598 | } | 598 | } |
| 599 | |||
| 600 | void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx) { | ||
| 601 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 602 | rb.Push(RESULT_SUCCESS); | ||
| 603 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 604 | } | ||
| 605 | |||
| 606 | void SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { | ||
| 607 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 608 | rb.Push(RESULT_SUCCESS); | ||
| 609 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 610 | } | ||
| 599 | }; | 611 | }; |
| 600 | 612 | ||
| 601 | class HidDbg final : public ServiceFramework<HidDbg> { | 613 | class HidDbg final : public ServiceFramework<HidDbg> { |
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 69c260408..b2de2a818 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp | |||
| @@ -28,8 +28,9 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { | |||
| 28 | 28 | ||
| 29 | std::size_t size = ctx.GetWriteBufferSize(); | 29 | std::size_t size = ctx.GetWriteBufferSize(); |
| 30 | 30 | ||
| 31 | std::uniform_int_distribution<u16> distribution(0, std::numeric_limits<u8>::max()); | ||
| 31 | std::vector<u8> data(size); | 32 | std::vector<u8> data(size); |
| 32 | std::generate(data.begin(), data.end(), rng); | 33 | std::generate(data.begin(), data.end(), [&] { return static_cast<u8>(distribution(rng)); }); |
| 33 | 34 | ||
| 34 | ctx.WriteBuffer(data); | 35 | ctx.WriteBuffer(data); |
| 35 | 36 | ||
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 68efca5c0..aaf006309 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -154,7 +154,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(const FileSys::VfsFile& file, VAd | |||
| 154 | program_image.resize(image_size); | 154 | program_image.resize(image_size); |
| 155 | 155 | ||
| 156 | // Apply patches if necessary | 156 | // Apply patches if necessary |
| 157 | if (pm && pm->HasNSOPatch(nso_header.build_id)) { | 157 | if (pm && (pm->HasNSOPatch(nso_header.build_id) || Settings::values.dump_nso)) { |
| 158 | std::vector<u8> pi_header(program_image.size() + 0x100); | 158 | std::vector<u8> pi_header(program_image.size() + 0x100); |
| 159 | std::memcpy(pi_header.data(), &nso_header, sizeof(NsoHeader)); | 159 | std::memcpy(pi_header.data(), &nso_header, sizeof(NsoHeader)); |
| 160 | std::memcpy(pi_header.data() + 0x100, program_image.data(), program_image.size()); | 160 | std::memcpy(pi_header.data() + 0x100, program_image.data(), program_image.size()); |
diff --git a/src/core/settings.h b/src/core/settings.h index 84dc5050b..e424479f2 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -159,6 +159,7 @@ struct Values { | |||
| 159 | bool use_gdbstub; | 159 | bool use_gdbstub; |
| 160 | u16 gdbstub_port; | 160 | u16 gdbstub_port; |
| 161 | std::string program_args; | 161 | std::string program_args; |
| 162 | bool dump_nso; | ||
| 162 | 163 | ||
| 163 | // WebService | 164 | // WebService |
| 164 | bool enable_telemetry; | 165 | bool enable_telemetry; |
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 2635f2b0c..98622a058 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp | |||
| @@ -266,7 +266,8 @@ void OpenGLState::ApplyViewport() const { | |||
| 266 | const auto& updated = viewports[0]; | 266 | const auto& updated = viewports[0]; |
| 267 | if (updated.x != current.x || updated.y != current.y || updated.width != current.width || | 267 | if (updated.x != current.x || updated.y != current.y || updated.width != current.width || |
| 268 | updated.height != current.height) { | 268 | updated.height != current.height) { |
| 269 | glViewport(updated.x, updated.y, updated.width, updated.height); | 269 | glViewport(static_cast<GLint>(updated.x), static_cast<GLint>(updated.y), |
| 270 | static_cast<GLsizei>(updated.width), static_cast<GLsizei>(updated.height)); | ||
| 270 | } | 271 | } |
| 271 | if (updated.depth_range_near != current.depth_range_near || | 272 | if (updated.depth_range_near != current.depth_range_near || |
| 272 | updated.depth_range_far != current.depth_range_far) { | 273 | updated.depth_range_far != current.depth_range_far) { |
| @@ -313,7 +314,7 @@ void OpenGLState::ApplyGlobalBlending() const { | |||
| 313 | } | 314 | } |
| 314 | } | 315 | } |
| 315 | 316 | ||
| 316 | void OpenGLState::ApplyTargetBlending(int target, bool force) const { | 317 | void OpenGLState::ApplyTargetBlending(std::size_t target, bool force) const { |
| 317 | const Blend& updated = blend[target]; | 318 | const Blend& updated = blend[target]; |
| 318 | const Blend& current = cur_state.blend[target]; | 319 | const Blend& current = cur_state.blend[target]; |
| 319 | const bool blend_changed = updated.enabled != current.enabled || force; | 320 | const bool blend_changed = updated.enabled != current.enabled || force; |
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index eacca0b9c..e5d1baae6 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h | |||
| @@ -208,7 +208,7 @@ private: | |||
| 208 | void ApplyPrimitiveRestart() const; | 208 | void ApplyPrimitiveRestart() const; |
| 209 | void ApplyStencilTest() const; | 209 | void ApplyStencilTest() const; |
| 210 | void ApplyViewport() const; | 210 | void ApplyViewport() const; |
| 211 | void ApplyTargetBlending(int target, bool force) const; | 211 | void ApplyTargetBlending(std::size_t target, bool force) const; |
| 212 | void ApplyGlobalBlending() const; | 212 | void ApplyGlobalBlending() const; |
| 213 | void ApplyBlending() const; | 213 | void ApplyBlending() const; |
| 214 | void ApplyLogicOp() const; | 214 | void ApplyLogicOp() const; |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index a9d134d14..19f30b1b5 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -45,7 +45,7 @@ constexpr auto fast_swizzle_table = SwizzleTable<8, 4, 16>(); | |||
| 45 | * Instead of going gob by gob, we map the coordinates inside a block and manage from | 45 | * Instead of going gob by gob, we map the coordinates inside a block and manage from |
| 46 | * those. Block_Width is assumed to be 1. | 46 | * those. Block_Width is assumed to be 1. |
| 47 | */ | 47 | */ |
| 48 | void PreciseProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswizzle, | 48 | void PreciseProcessBlock(u8* const swizzled_data, u8* const unswizzled_data, const bool unswizzle, |
| 49 | const u32 x_start, const u32 y_start, const u32 z_start, const u32 x_end, | 49 | const u32 x_start, const u32 y_start, const u32 z_start, const u32 x_end, |
| 50 | const u32 y_end, const u32 z_end, const u32 tile_offset, | 50 | const u32 y_end, const u32 z_end, const u32 tile_offset, |
| 51 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, | 51 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, |
| @@ -81,7 +81,7 @@ void PreciseProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unsw | |||
| 81 | * Instead of going gob by gob, we map the coordinates inside a block and manage from | 81 | * Instead of going gob by gob, we map the coordinates inside a block and manage from |
| 82 | * those. Block_Width is assumed to be 1. | 82 | * those. Block_Width is assumed to be 1. |
| 83 | */ | 83 | */ |
| 84 | void FastProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswizzle, | 84 | void FastProcessBlock(u8* const swizzled_data, u8* const unswizzled_data, const bool unswizzle, |
| 85 | const u32 x_start, const u32 y_start, const u32 z_start, const u32 x_end, | 85 | const u32 x_start, const u32 y_start, const u32 z_start, const u32 x_end, |
| 86 | const u32 y_end, const u32 z_end, const u32 tile_offset, | 86 | const u32 y_end, const u32 z_end, const u32 tile_offset, |
| 87 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, | 87 | const u32 xy_block_size, const u32 layer_z, const u32 stride_x, |
| @@ -90,10 +90,10 @@ void FastProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswizz | |||
| 90 | u32 z_address = tile_offset; | 90 | u32 z_address = tile_offset; |
| 91 | const u32 x_startb = x_start * bytes_per_pixel; | 91 | const u32 x_startb = x_start * bytes_per_pixel; |
| 92 | const u32 x_endb = x_end * bytes_per_pixel; | 92 | const u32 x_endb = x_end * bytes_per_pixel; |
| 93 | const u32 copy_size = 16; | 93 | constexpr u32 copy_size = 16; |
| 94 | const u32 gob_size_x = 64; | 94 | constexpr u32 gob_size_x = 64; |
| 95 | const u32 gob_size_y = 8; | 95 | constexpr u32 gob_size_y = 8; |
| 96 | const u32 gob_size_z = 1; | 96 | constexpr u32 gob_size_z = 1; |
| 97 | const u32 gob_size = gob_size_x * gob_size_y * gob_size_z; | 97 | const u32 gob_size = gob_size_x * gob_size_y * gob_size_z; |
| 98 | for (u32 z = z_start; z < z_end; z++) { | 98 | for (u32 z = z_start; z < z_end; z++) { |
| 99 | u32 y_address = z_address; | 99 | u32 y_address = z_address; |
| @@ -126,23 +126,23 @@ void FastProcessBlock(u8* swizzled_data, u8* unswizzled_data, const bool unswizz | |||
| 126 | * https://envytools.readthedocs.io/en/latest/hw/memory/g80-surface.html#blocklinear-surfaces | 126 | * https://envytools.readthedocs.io/en/latest/hw/memory/g80-surface.html#blocklinear-surfaces |
| 127 | */ | 127 | */ |
| 128 | template <bool fast> | 128 | template <bool fast> |
| 129 | void SwizzledData(u8* swizzled_data, u8* unswizzled_data, const bool unswizzle, const u32 width, | 129 | void SwizzledData(u8* const swizzled_data, u8* const unswizzled_data, const bool unswizzle, |
| 130 | const u32 height, const u32 depth, const u32 bytes_per_pixel, | 130 | const u32 width, const u32 height, const u32 depth, const u32 bytes_per_pixel, |
| 131 | const u32 out_bytes_per_pixel, const u32 block_height, const u32 block_depth) { | 131 | const u32 out_bytes_per_pixel, const u32 block_height, const u32 block_depth) { |
| 132 | auto div_ceil = [](const u32 x, const u32 y) { return ((x + y - 1) / y); }; | 132 | auto div_ceil = [](const u32 x, const u32 y) { return ((x + y - 1) / y); }; |
| 133 | const u32 stride_x = width * out_bytes_per_pixel; | 133 | const u32 stride_x = width * out_bytes_per_pixel; |
| 134 | const u32 layer_z = height * stride_x; | 134 | const u32 layer_z = height * stride_x; |
| 135 | const u32 gob_x_bytes = 64; | 135 | constexpr u32 gob_x_bytes = 64; |
| 136 | const u32 gob_elements_x = gob_x_bytes / bytes_per_pixel; | 136 | const u32 gob_elements_x = gob_x_bytes / bytes_per_pixel; |
| 137 | const u32 gob_elements_y = 8; | 137 | constexpr u32 gob_elements_y = 8; |
| 138 | const u32 gob_elements_z = 1; | 138 | constexpr u32 gob_elements_z = 1; |
| 139 | const u32 block_x_elements = gob_elements_x; | 139 | const u32 block_x_elements = gob_elements_x; |
| 140 | const u32 block_y_elements = gob_elements_y * block_height; | 140 | const u32 block_y_elements = gob_elements_y * block_height; |
| 141 | const u32 block_z_elements = gob_elements_z * block_depth; | 141 | const u32 block_z_elements = gob_elements_z * block_depth; |
| 142 | const u32 blocks_on_x = div_ceil(width, block_x_elements); | 142 | const u32 blocks_on_x = div_ceil(width, block_x_elements); |
| 143 | const u32 blocks_on_y = div_ceil(height, block_y_elements); | 143 | const u32 blocks_on_y = div_ceil(height, block_y_elements); |
| 144 | const u32 blocks_on_z = div_ceil(depth, block_z_elements); | 144 | const u32 blocks_on_z = div_ceil(depth, block_z_elements); |
| 145 | const u32 gob_size = gob_x_bytes * gob_elements_y * gob_elements_z; | 145 | constexpr u32 gob_size = gob_x_bytes * gob_elements_y * gob_elements_z; |
| 146 | const u32 xy_block_size = gob_size * block_height; | 146 | const u32 xy_block_size = gob_size * block_height; |
| 147 | const u32 block_size = xy_block_size * block_depth; | 147 | const u32 block_size = xy_block_size * block_depth; |
| 148 | u32 tile_offset = 0; | 148 | u32 tile_offset = 0; |
| @@ -171,7 +171,7 @@ void SwizzledData(u8* swizzled_data, u8* unswizzled_data, const bool unswizzle, | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, | 173 | void CopySwizzledData(u32 width, u32 height, u32 depth, u32 bytes_per_pixel, |
| 174 | u32 out_bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, | 174 | u32 out_bytes_per_pixel, u8* const swizzled_data, u8* const unswizzled_data, |
| 175 | bool unswizzle, u32 block_height, u32 block_depth) { | 175 | bool unswizzle, u32 block_height, u32 block_depth) { |
| 176 | if (bytes_per_pixel % 3 != 0 && (width * bytes_per_pixel) % 16 == 0) { | 176 | if (bytes_per_pixel % 3 != 0 && (width * bytes_per_pixel) % 16 == 0) { |
| 177 | SwizzledData<true>(swizzled_data, unswizzled_data, unswizzle, width, height, depth, | 177 | SwizzledData<true>(swizzled_data, unswizzled_data, unswizzle, width, height, depth, |
| @@ -325,9 +325,9 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 325 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 325 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 326 | u32 block_height, u32 block_depth) { | 326 | u32 block_height, u32 block_depth) { |
| 327 | if (tiled) { | 327 | if (tiled) { |
| 328 | const u32 gobs_in_x = 64; | 328 | constexpr u32 gobs_in_x = 64; |
| 329 | const u32 gobs_in_y = 8; | 329 | constexpr u32 gobs_in_y = 8; |
| 330 | const u32 gobs_in_z = 1; | 330 | constexpr u32 gobs_in_z = 1; |
| 331 | const u32 aligned_width = Common::AlignUp(width * bytes_per_pixel, gobs_in_x); | 331 | const u32 aligned_width = Common::AlignUp(width * bytes_per_pixel, gobs_in_x); |
| 332 | const u32 aligned_height = Common::AlignUp(height, gobs_in_y * block_height); | 332 | const u32 aligned_height = Common::AlignUp(height, gobs_in_y * block_height); |
| 333 | const u32 aligned_depth = Common::AlignUp(depth, gobs_in_z * block_depth); | 333 | const u32 aligned_depth = Common::AlignUp(depth, gobs_in_z * block_depth); |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index d3b7fa59d..be69fb831 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -153,6 +153,7 @@ void Config::ReadValues() { | |||
| 153 | Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool(); | 153 | Settings::values.use_gdbstub = qt_config->value("use_gdbstub", false).toBool(); |
| 154 | Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt(); | 154 | Settings::values.gdbstub_port = qt_config->value("gdbstub_port", 24689).toInt(); |
| 155 | Settings::values.program_args = qt_config->value("program_args", "").toString().toStdString(); | 155 | Settings::values.program_args = qt_config->value("program_args", "").toString().toStdString(); |
| 156 | Settings::values.dump_nso = qt_config->value("dump_nso", false).toBool(); | ||
| 156 | qt_config->endGroup(); | 157 | qt_config->endGroup(); |
| 157 | 158 | ||
| 158 | qt_config->beginGroup("WebService"); | 159 | qt_config->beginGroup("WebService"); |
| @@ -170,6 +171,7 @@ void Config::ReadValues() { | |||
| 170 | 171 | ||
| 171 | qt_config->beginGroup("UIGameList"); | 172 | qt_config->beginGroup("UIGameList"); |
| 172 | UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); | 173 | UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); |
| 174 | UISettings::values.show_add_ons = qt_config->value("show_add_ons", true).toBool(); | ||
| 173 | UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt(); | 175 | UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt(); |
| 174 | UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt(); | 176 | UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt(); |
| 175 | UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt(); | 177 | UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt(); |
| @@ -295,6 +297,7 @@ void Config::SaveValues() { | |||
| 295 | qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub); | 297 | qt_config->setValue("use_gdbstub", Settings::values.use_gdbstub); |
| 296 | qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port); | 298 | qt_config->setValue("gdbstub_port", Settings::values.gdbstub_port); |
| 297 | qt_config->setValue("program_args", QString::fromStdString(Settings::values.program_args)); | 299 | qt_config->setValue("program_args", QString::fromStdString(Settings::values.program_args)); |
| 300 | qt_config->setValue("dump_nso", Settings::values.dump_nso); | ||
| 298 | qt_config->endGroup(); | 301 | qt_config->endGroup(); |
| 299 | 302 | ||
| 300 | qt_config->beginGroup("WebService"); | 303 | qt_config->beginGroup("WebService"); |
| @@ -310,6 +313,7 @@ void Config::SaveValues() { | |||
| 310 | 313 | ||
| 311 | qt_config->beginGroup("UIGameList"); | 314 | qt_config->beginGroup("UIGameList"); |
| 312 | qt_config->setValue("show_unknown", UISettings::values.show_unknown); | 315 | qt_config->setValue("show_unknown", UISettings::values.show_unknown); |
| 316 | qt_config->setValue("show_add_ons", UISettings::values.show_add_ons); | ||
| 313 | qt_config->setValue("icon_size", UISettings::values.icon_size); | 317 | qt_config->setValue("icon_size", UISettings::values.icon_size); |
| 314 | qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id); | 318 | qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id); |
| 315 | qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id); | 319 | qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id); |
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 9e765fc93..fd5876b41 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -34,6 +34,7 @@ void ConfigureDebug::setConfiguration() { | |||
| 34 | ui->toggle_console->setChecked(UISettings::values.show_console); | 34 | ui->toggle_console->setChecked(UISettings::values.show_console); |
| 35 | ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter)); | 35 | ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter)); |
| 36 | ui->homebrew_args_edit->setText(QString::fromStdString(Settings::values.program_args)); | 36 | ui->homebrew_args_edit->setText(QString::fromStdString(Settings::values.program_args)); |
| 37 | ui->dump_decompressed_nso->setChecked(Settings::values.dump_nso); | ||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | void ConfigureDebug::applyConfiguration() { | 40 | void ConfigureDebug::applyConfiguration() { |
| @@ -42,6 +43,7 @@ void ConfigureDebug::applyConfiguration() { | |||
| 42 | UISettings::values.show_console = ui->toggle_console->isChecked(); | 43 | UISettings::values.show_console = ui->toggle_console->isChecked(); |
| 43 | Settings::values.log_filter = ui->log_filter_edit->text().toStdString(); | 44 | Settings::values.log_filter = ui->log_filter_edit->text().toStdString(); |
| 44 | Settings::values.program_args = ui->homebrew_args_edit->text().toStdString(); | 45 | Settings::values.program_args = ui->homebrew_args_edit->text().toStdString(); |
| 46 | Settings::values.dump_nso = ui->dump_decompressed_nso->isChecked(); | ||
| 45 | Debugger::ToggleConsole(); | 47 | Debugger::ToggleConsole(); |
| 46 | Log::Filter filter; | 48 | Log::Filter filter; |
| 47 | filter.ParseFilterString(Settings::values.log_filter); | 49 | filter.ParseFilterString(Settings::values.log_filter); |
diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index ff4987604..9c5b702f8 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>400</width> | 9 | <width>400</width> |
| 10 | <height>300</height> | 10 | <height>357</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| @@ -130,6 +130,25 @@ | |||
| 130 | </widget> | 130 | </widget> |
| 131 | </item> | 131 | </item> |
| 132 | <item> | 132 | <item> |
| 133 | <widget class="QGroupBox" name="groupBox_4"> | ||
| 134 | <property name="title"> | ||
| 135 | <string>Dump</string> | ||
| 136 | </property> | ||
| 137 | <layout class="QVBoxLayout" name="verticalLayout_4"> | ||
| 138 | <item> | ||
| 139 | <widget class="QCheckBox" name="dump_decompressed_nso"> | ||
| 140 | <property name="whatsThis"> | ||
| 141 | <string>When checked, any NSO yuzu tries to load or patch will be copied decompressed to the yuzu/dump directory.</string> | ||
| 142 | </property> | ||
| 143 | <property name="text"> | ||
| 144 | <string>Dump Decompressed NSOs</string> | ||
| 145 | </property> | ||
| 146 | </widget> | ||
| 147 | </item> | ||
| 148 | </layout> | ||
| 149 | </widget> | ||
| 150 | </item> | ||
| 151 | <item> | ||
| 133 | <spacer name="verticalSpacer"> | 152 | <spacer name="verticalSpacer"> |
| 134 | <property name="orientation"> | 153 | <property name="orientation"> |
| 135 | <enum>Qt::Vertical</enum> | 154 | <enum>Qt::Vertical</enum> |
diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp index 8743ce982..639d5df0f 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_gamelist.cpp | |||
| @@ -42,6 +42,7 @@ ConfigureGameList::~ConfigureGameList() = default; | |||
| 42 | 42 | ||
| 43 | void ConfigureGameList::applyConfiguration() { | 43 | void ConfigureGameList::applyConfiguration() { |
| 44 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); | 44 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); |
| 45 | UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); | ||
| 45 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | 46 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); |
| 46 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); | 47 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); |
| 47 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); | 48 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); |
| @@ -50,6 +51,7 @@ void ConfigureGameList::applyConfiguration() { | |||
| 50 | 51 | ||
| 51 | void ConfigureGameList::setConfiguration() { | 52 | void ConfigureGameList::setConfiguration() { |
| 52 | ui->show_unknown->setChecked(UISettings::values.show_unknown); | 53 | ui->show_unknown->setChecked(UISettings::values.show_unknown); |
| 54 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); | ||
| 53 | ui->icon_size_combobox->setCurrentIndex( | 55 | ui->icon_size_combobox->setCurrentIndex( |
| 54 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | 56 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); |
| 55 | ui->row_1_text_combobox->setCurrentIndex( | 57 | ui->row_1_text_combobox->setCurrentIndex( |
diff --git a/src/yuzu/configuration/configure_gamelist.ui b/src/yuzu/configuration/configure_gamelist.ui index 7471fdb60..7a69377e7 100644 --- a/src/yuzu/configuration/configure_gamelist.ui +++ b/src/yuzu/configuration/configure_gamelist.ui | |||
| @@ -1,126 +1,133 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <ui version="4.0"> | 2 | <ui version="4.0"> |
| 3 | <class>ConfigureGameList</class> | 3 | <class>ConfigureGameList</class> |
| 4 | <widget class="QWidget" name="ConfigureGeneral"> | 4 | <widget class="QWidget" name="ConfigureGameList"> |
| 5 | <property name="geometry"> | 5 | <property name="geometry"> |
| 6 | <rect> | 6 | <rect> |
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>300</width> | 9 | <width>300</width> |
| 10 | <height>377</height> | 10 | <height>377</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <layout class="QHBoxLayout" name="HorizontalLayout"> | 16 | <layout class="QHBoxLayout" name="HorizontalLayout"> |
| 17 | <item> | 17 | <item> |
| 18 | <layout class="QVBoxLayout" name="VerticalLayout"> | 18 | <layout class="QVBoxLayout" name="VerticalLayout"> |
| 19 | <item> | ||
| 20 | <widget class="QGroupBox" name="GeneralGroupBox"> | ||
| 21 | <property name="title"> | ||
| 22 | <string>General</string> | ||
| 23 | </property> | ||
| 24 | <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> | ||
| 25 | <item> | ||
| 26 | <layout class="QVBoxLayout" name="GeneralVerticalLayout"> | ||
| 19 | <item> | 27 | <item> |
| 20 | <widget class="QGroupBox" name="GeneralGroupBox"> | 28 | <widget class="QCheckBox" name="show_unknown"> |
| 21 | <property name="title"> | 29 | <property name="text"> |
| 22 | <string>General</string> | 30 | <string>Show files with type 'Unknown'</string> |
| 23 | </property> | 31 | </property> |
| 24 | <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> | 32 | </widget> |
| 25 | <item> | ||
| 26 | <layout class="QVBoxLayout" name="GeneralVerticalLayout"> | ||
| 27 | <item> | ||
| 28 | <widget class="QCheckBox" name="show_unknown"> | ||
| 29 | <property name="text"> | ||
| 30 | <string>Show files with type 'Unknown'</string> | ||
| 31 | </property> | ||
| 32 | </widget> | ||
| 33 | </item> | ||
| 34 | </layout> | ||
| 35 | </item> | ||
| 36 | </layout> | ||
| 37 | </widget> | ||
| 38 | </item> | 33 | </item> |
| 39 | <item> | 34 | <item> |
| 40 | <widget class="QGroupBox" name="IconSizeGroupBox"> | 35 | <widget class="QCheckBox" name="show_add_ons"> |
| 41 | <property name="title"> | 36 | <property name="text"> |
| 42 | <string>Icon Size</string> | 37 | <string>Show Add-Ons Column</string> |
| 43 | </property> | 38 | </property> |
| 44 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> | 39 | </widget> |
| 45 | <item> | ||
| 46 | <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> | ||
| 47 | <item> | ||
| 48 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> | ||
| 49 | <item> | ||
| 50 | <widget class="QLabel" name="icon_size_label"> | ||
| 51 | <property name="text"> | ||
| 52 | <string>Icon Size:</string> | ||
| 53 | </property> | ||
| 54 | </widget> | ||
| 55 | </item> | ||
| 56 | <item> | ||
| 57 | <widget class="QComboBox" name="icon_size_combobox"/> | ||
| 58 | </item> | ||
| 59 | </layout> | ||
| 60 | </item> | ||
| 61 | </layout> | ||
| 62 | </item> | ||
| 63 | </layout> | ||
| 64 | </widget> | ||
| 65 | </item> | 40 | </item> |
| 41 | </layout> | ||
| 42 | </item> | ||
| 43 | </layout> | ||
| 44 | </widget> | ||
| 45 | </item> | ||
| 46 | <item> | ||
| 47 | <widget class="QGroupBox" name="IconSizeGroupBox"> | ||
| 48 | <property name="title"> | ||
| 49 | <string>Icon Size</string> | ||
| 50 | </property> | ||
| 51 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> | ||
| 52 | <item> | ||
| 53 | <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> | ||
| 66 | <item> | 54 | <item> |
| 67 | <widget class="QGroupBox" name="RowGroupBox"> | 55 | <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> |
| 68 | <property name="title"> | 56 | <item> |
| 69 | <string>Row Text</string> | 57 | <widget class="QLabel" name="icon_size_label"> |
| 58 | <property name="text"> | ||
| 59 | <string>Icon Size:</string> | ||
| 70 | </property> | 60 | </property> |
| 71 | <layout class="QHBoxLayout" name="RowHorizontalLayout"> | 61 | </widget> |
| 72 | <item> | 62 | </item> |
| 73 | <layout class="QVBoxLayout" name="RowVerticalLayout"> | 63 | <item> |
| 74 | <item> | 64 | <widget class="QComboBox" name="icon_size_combobox"/> |
| 75 | <layout class="QHBoxLayout" name="row_1_qhbox_layout"> | 65 | </item> |
| 76 | <item> | 66 | </layout> |
| 77 | <widget class="QLabel" name="row_1_label"> | ||
| 78 | <property name="text"> | ||
| 79 | <string>Row 1 Text:</string> | ||
| 80 | </property> | ||
| 81 | </widget> | ||
| 82 | </item> | ||
| 83 | <item> | ||
| 84 | <widget class="QComboBox" name="row_1_text_combobox"/> | ||
| 85 | </item> | ||
| 86 | </layout> | ||
| 87 | </item> | ||
| 88 | <item> | ||
| 89 | <layout class="QHBoxLayout" name="row_2_qhbox_layout"> | ||
| 90 | <item> | ||
| 91 | <widget class="QLabel" name="row_2_label"> | ||
| 92 | <property name="text"> | ||
| 93 | <string>Row 2 Text:</string> | ||
| 94 | </property> | ||
| 95 | </widget> | ||
| 96 | </item> | ||
| 97 | <item> | ||
| 98 | <widget class="QComboBox" name="row_2_text_combobox"/> | ||
| 99 | </item> | ||
| 100 | </layout> | ||
| 101 | </item> | ||
| 102 | </layout> | ||
| 103 | </item> | ||
| 104 | </layout> | ||
| 105 | </widget> | ||
| 106 | </item> | 67 | </item> |
| 68 | </layout> | ||
| 69 | </item> | ||
| 70 | </layout> | ||
| 71 | </widget> | ||
| 72 | </item> | ||
| 73 | <item> | ||
| 74 | <widget class="QGroupBox" name="RowGroupBox"> | ||
| 75 | <property name="title"> | ||
| 76 | <string>Row Text</string> | ||
| 77 | </property> | ||
| 78 | <layout class="QHBoxLayout" name="RowHorizontalLayout"> | ||
| 79 | <item> | ||
| 80 | <layout class="QVBoxLayout" name="RowVerticalLayout"> | ||
| 107 | <item> | 81 | <item> |
| 108 | <spacer name="verticalSpacer"> | 82 | <layout class="QHBoxLayout" name="row_1_qhbox_layout"> |
| 109 | <property name="orientation"> | 83 | <item> |
| 110 | <enum>Qt::Vertical</enum> | 84 | <widget class="QLabel" name="row_1_label"> |
| 85 | <property name="text"> | ||
| 86 | <string>Row 1 Text:</string> | ||
| 111 | </property> | 87 | </property> |
| 112 | <property name="sizeHint" stdset="0"> | 88 | </widget> |
| 113 | <size> | 89 | </item> |
| 114 | <width>20</width> | 90 | <item> |
| 115 | <height>40</height> | 91 | <widget class="QComboBox" name="row_1_text_combobox"/> |
| 116 | </size> | 92 | </item> |
| 93 | </layout> | ||
| 94 | </item> | ||
| 95 | <item> | ||
| 96 | <layout class="QHBoxLayout" name="row_2_qhbox_layout"> | ||
| 97 | <item> | ||
| 98 | <widget class="QLabel" name="row_2_label"> | ||
| 99 | <property name="text"> | ||
| 100 | <string>Row 2 Text:</string> | ||
| 117 | </property> | 101 | </property> |
| 118 | </spacer> | 102 | </widget> |
| 103 | </item> | ||
| 104 | <item> | ||
| 105 | <widget class="QComboBox" name="row_2_text_combobox"/> | ||
| 106 | </item> | ||
| 107 | </layout> | ||
| 119 | </item> | 108 | </item> |
| 120 | </layout> | 109 | </layout> |
| 121 | </item> | 110 | </item> |
| 111 | </layout> | ||
| 112 | </widget> | ||
| 113 | </item> | ||
| 114 | <item> | ||
| 115 | <spacer name="verticalSpacer"> | ||
| 116 | <property name="orientation"> | ||
| 117 | <enum>Qt::Vertical</enum> | ||
| 118 | </property> | ||
| 119 | <property name="sizeHint" stdset="0"> | ||
| 120 | <size> | ||
| 121 | <width>20</width> | ||
| 122 | <height>40</height> | ||
| 123 | </size> | ||
| 124 | </property> | ||
| 125 | </spacer> | ||
| 126 | </item> | ||
| 122 | </layout> | 127 | </layout> |
| 123 | </widget> | 128 | </item> |
| 129 | </layout> | ||
| 130 | </widget> | ||
| 124 | <resources/> | 131 | <resources/> |
| 125 | <connections/> | 132 | <connections/> |
| 126 | </ui> | 133 | </ui> |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index b322258a0..314f51203 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -47,6 +47,9 @@ void ConfigureGeneral::OnDockedModeChanged(bool last_state, bool new_state) { | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | Core::System& system{Core::System::GetInstance()}; | 49 | Core::System& system{Core::System::GetInstance()}; |
| 50 | if (!system.IsPoweredOn()) { | ||
| 51 | return; | ||
| 52 | } | ||
| 50 | Service::SM::ServiceManager& sm = system.ServiceManager(); | 53 | Service::SM::ServiceManager& sm = system.ServiceManager(); |
| 51 | 54 | ||
| 52 | // Message queue is shared between these services, we just need to signal an operation | 55 | // Message queue is shared between these services, we just need to signal an operation |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index a5a4aa432..11a8c390b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -215,12 +215,18 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent) | |||
| 215 | tree_view->setUniformRowHeights(true); | 215 | tree_view->setUniformRowHeights(true); |
| 216 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); | 216 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); |
| 217 | 217 | ||
| 218 | item_model->insertColumns(0, COLUMN_COUNT); | 218 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); |
| 219 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | 219 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); |
| 220 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | 220 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); |
| 221 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | 221 | |
| 222 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | 222 | if (UISettings::values.show_add_ons) { |
| 223 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | 223 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); |
| 224 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 225 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 226 | } else { | ||
| 227 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 228 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 229 | } | ||
| 224 | 230 | ||
| 225 | connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); | 231 | connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); |
| 226 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); | 232 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); |
| @@ -394,6 +400,25 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { | |||
| 394 | } | 400 | } |
| 395 | 401 | ||
| 396 | tree_view->setEnabled(false); | 402 | tree_view->setEnabled(false); |
| 403 | |||
| 404 | // Update the columns in case UISettings has changed | ||
| 405 | item_model->removeColumns(0, item_model->columnCount()); | ||
| 406 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); | ||
| 407 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | ||
| 408 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | ||
| 409 | |||
| 410 | if (UISettings::values.show_add_ons) { | ||
| 411 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | ||
| 412 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 413 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 414 | } else { | ||
| 415 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 416 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 417 | item_model->removeColumns(COLUMN_COUNT - 1, 1); | ||
| 418 | } | ||
| 419 | |||
| 420 | LoadInterfaceLayout(); | ||
| 421 | |||
| 397 | // Delete any rows that might already exist if we're repopulating | 422 | // Delete any rows that might already exist if we're repopulating |
| 398 | item_model->removeRows(0, item_model->rowCount()); | 423 | item_model->removeRows(0, item_model->rowCount()); |
| 399 | 424 | ||
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 3d865a12d..362902e46 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -123,17 +123,22 @@ void GameListWorker::AddInstalledTitlesToGameList() { | |||
| 123 | if (it != compatibility_list.end()) | 123 | if (it != compatibility_list.end()) |
| 124 | compatibility = it->second.first; | 124 | compatibility = it->second.first; |
| 125 | 125 | ||
| 126 | emit EntryReady({ | 126 | QList<QStandardItem*> list{ |
| 127 | new GameListItemPath( | 127 | new GameListItemPath( |
| 128 | FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), | 128 | FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), |
| 129 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), | 129 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), |
| 130 | program_id), | 130 | program_id), |
| 131 | new GameListItemCompat(compatibility), | 131 | new GameListItemCompat(compatibility), |
| 132 | new GameListItem(FormatPatchNameVersions(patch, *loader)), | ||
| 133 | new GameListItem( | 132 | new GameListItem( |
| 134 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), | 133 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), |
| 135 | new GameListItemSize(file->GetSize()), | 134 | new GameListItemSize(file->GetSize()), |
| 136 | }); | 135 | }; |
| 136 | |||
| 137 | if (UISettings::values.show_add_ons) { | ||
| 138 | list.insert(2, new GameListItem(FormatPatchNameVersions(patch, *loader))); | ||
| 139 | } | ||
| 140 | |||
| 141 | emit EntryReady(list); | ||
| 137 | } | 142 | } |
| 138 | 143 | ||
| 139 | const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, | 144 | const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, |
| @@ -216,18 +221,23 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 216 | if (it != compatibility_list.end()) | 221 | if (it != compatibility_list.end()) |
| 217 | compatibility = it->second.first; | 222 | compatibility = it->second.first; |
| 218 | 223 | ||
| 219 | emit EntryReady({ | 224 | QList<QStandardItem*> list{ |
| 220 | new GameListItemPath( | 225 | new GameListItemPath( |
| 221 | FormatGameName(physical_name), icon, QString::fromStdString(name), | 226 | FormatGameName(physical_name), icon, QString::fromStdString(name), |
| 222 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), | 227 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), |
| 223 | program_id), | 228 | program_id), |
| 224 | new GameListItemCompat(compatibility), | 229 | new GameListItemCompat(compatibility), |
| 225 | new GameListItem( | 230 | new GameListItem( |
| 226 | FormatPatchNameVersions(patch, *loader, loader->IsRomFSUpdatable())), | ||
| 227 | new GameListItem( | ||
| 228 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), | 231 | QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), |
| 229 | new GameListItemSize(FileUtil::GetSize(physical_name)), | 232 | new GameListItemSize(FileUtil::GetSize(physical_name)), |
| 230 | }); | 233 | }; |
| 234 | |||
| 235 | if (UISettings::values.show_add_ons) { | ||
| 236 | list.insert(2, new GameListItem(FormatPatchNameVersions( | ||
| 237 | patch, *loader, loader->IsRomFSUpdatable()))); | ||
| 238 | } | ||
| 239 | |||
| 240 | emit EntryReady(std::move(list)); | ||
| 231 | } else if (is_dir && recursion > 0) { | 241 | } else if (is_dir && recursion > 0) { |
| 232 | watch_list.append(QString::fromStdString(physical_name)); | 242 | watch_list.append(QString::fromStdString(physical_name)); |
| 233 | AddFstEntriesToGameList(physical_name, recursion - 1); | 243 | AddFstEntriesToGameList(physical_name, recursion - 1); |
diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h index 2e617d52a..32a0d813c 100644 --- a/src/yuzu/ui_settings.h +++ b/src/yuzu/ui_settings.h | |||
| @@ -59,6 +59,7 @@ struct Values { | |||
| 59 | 59 | ||
| 60 | // Game List | 60 | // Game List |
| 61 | bool show_unknown; | 61 | bool show_unknown; |
| 62 | bool show_add_ons; | ||
| 62 | uint32_t icon_size; | 63 | uint32_t icon_size; |
| 63 | uint8_t row_1_text_id; | 64 | uint8_t row_1_text_id; |
| 64 | uint8_t row_2_text_id; | 65 | uint8_t row_2_text_id; |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index f3134d4cb..9cc409fd5 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -148,6 +148,7 @@ void Config::ReadValues() { | |||
| 148 | Settings::values.gdbstub_port = | 148 | Settings::values.gdbstub_port = |
| 149 | static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); | 149 | static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); |
| 150 | Settings::values.program_args = sdl2_config->Get("Debugging", "program_args", ""); | 150 | Settings::values.program_args = sdl2_config->Get("Debugging", "program_args", ""); |
| 151 | Settings::values.dump_nso = sdl2_config->GetBoolean("Debugging", "dump_nso", false); | ||
| 151 | 152 | ||
| 152 | // Web Service | 153 | // Web Service |
| 153 | Settings::values.enable_telemetry = | 154 | Settings::values.enable_telemetry = |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index dd6644d79..ecf625e7b 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -206,6 +206,8 @@ log_filter = *:Trace | |||
| 206 | # Port for listening to GDB connections. | 206 | # Port for listening to GDB connections. |
| 207 | use_gdbstub=false | 207 | use_gdbstub=false |
| 208 | gdbstub_port=24689 | 208 | gdbstub_port=24689 |
| 209 | # Determines whether or not yuzu will dump all NSOs it attempts to load while loading them | ||
| 210 | dump_nso=false | ||
| 209 | 211 | ||
| 210 | [WebService] | 212 | [WebService] |
| 211 | # Whether or not to enable telemetry | 213 | # Whether or not to enable telemetry |