diff options
28 files changed, 261 insertions, 187 deletions
diff --git a/src/audio_core/time_stretch.cpp b/src/audio_core/time_stretch.cpp index d72d67994..cee8b12dd 100644 --- a/src/audio_core/time_stretch.cpp +++ b/src/audio_core/time_stretch.cpp | |||
| @@ -10,8 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | namespace AudioCore { | 11 | namespace AudioCore { |
| 12 | 12 | ||
| 13 | TimeStretcher::TimeStretcher(u32 sample_rate, u32 channel_count) | 13 | TimeStretcher::TimeStretcher(u32 sample_rate, u32 channel_count) : m_sample_rate{sample_rate} { |
| 14 | : m_sample_rate(sample_rate), m_channel_count(channel_count) { | ||
| 15 | m_sound_touch.setChannels(channel_count); | 14 | m_sound_touch.setChannels(channel_count); |
| 16 | m_sound_touch.setSampleRate(sample_rate); | 15 | m_sound_touch.setSampleRate(sample_rate); |
| 17 | m_sound_touch.setPitch(1.0); | 16 | m_sound_touch.setPitch(1.0); |
diff --git a/src/audio_core/time_stretch.h b/src/audio_core/time_stretch.h index decd760f1..bb2270b96 100644 --- a/src/audio_core/time_stretch.h +++ b/src/audio_core/time_stretch.h | |||
| @@ -27,7 +27,6 @@ public: | |||
| 27 | 27 | ||
| 28 | private: | 28 | private: |
| 29 | u32 m_sample_rate; | 29 | u32 m_sample_rate; |
| 30 | u32 m_channel_count; | ||
| 31 | soundtouch::SoundTouch m_sound_touch; | 30 | soundtouch::SoundTouch m_sound_touch; |
| 32 | double m_stretch_ratio = 1.0; | 31 | double m_stretch_ratio = 1.0; |
| 33 | }; | 32 | }; |
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 9f5918851..6d5218465 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -196,6 +196,7 @@ void FileBackend::Write(const Entry& entry) { | |||
| 196 | SUB(Service, NFP) \ | 196 | SUB(Service, NFP) \ |
| 197 | SUB(Service, NIFM) \ | 197 | SUB(Service, NIFM) \ |
| 198 | SUB(Service, NIM) \ | 198 | SUB(Service, NIM) \ |
| 199 | SUB(Service, NPNS) \ | ||
| 199 | SUB(Service, NS) \ | 200 | SUB(Service, NS) \ |
| 200 | SUB(Service, NVDRV) \ | 201 | SUB(Service, NVDRV) \ |
| 201 | SUB(Service, PCIE) \ | 202 | SUB(Service, PCIE) \ |
| @@ -204,10 +205,12 @@ void FileBackend::Write(const Entry& entry) { | |||
| 204 | SUB(Service, PM) \ | 205 | SUB(Service, PM) \ |
| 205 | SUB(Service, PREPO) \ | 206 | SUB(Service, PREPO) \ |
| 206 | SUB(Service, PSC) \ | 207 | SUB(Service, PSC) \ |
| 208 | SUB(Service, PSM) \ | ||
| 207 | SUB(Service, SET) \ | 209 | SUB(Service, SET) \ |
| 208 | SUB(Service, SM) \ | 210 | SUB(Service, SM) \ |
| 209 | SUB(Service, SPL) \ | 211 | SUB(Service, SPL) \ |
| 210 | SUB(Service, SSL) \ | 212 | SUB(Service, SSL) \ |
| 213 | SUB(Service, TCAP) \ | ||
| 211 | SUB(Service, Time) \ | 214 | SUB(Service, Time) \ |
| 212 | SUB(Service, USB) \ | 215 | SUB(Service, USB) \ |
| 213 | SUB(Service, VI) \ | 216 | SUB(Service, VI) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index c9161155a..d4ec31ec3 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -83,6 +83,7 @@ enum class Class : ClassType { | |||
| 83 | Service_NFP, ///< The NFP service | 83 | Service_NFP, ///< The NFP service |
| 84 | Service_NIFM, ///< The NIFM (Network interface) service | 84 | Service_NIFM, ///< The NIFM (Network interface) service |
| 85 | Service_NIM, ///< The NIM service | 85 | Service_NIM, ///< The NIM service |
| 86 | Service_NPNS, ///< The NPNS service | ||
| 86 | Service_NS, ///< The NS services | 87 | Service_NS, ///< The NS services |
| 87 | Service_NVDRV, ///< The NVDRV (Nvidia driver) service | 88 | Service_NVDRV, ///< The NVDRV (Nvidia driver) service |
| 88 | Service_PCIE, ///< The PCIe service | 89 | Service_PCIE, ///< The PCIe service |
| @@ -96,6 +97,7 @@ enum class Class : ClassType { | |||
| 96 | Service_SM, ///< The SM (Service manager) service | 97 | Service_SM, ///< The SM (Service manager) service |
| 97 | Service_SPL, ///< The SPL service | 98 | Service_SPL, ///< The SPL service |
| 98 | Service_SSL, ///< The SSL service | 99 | Service_SSL, ///< The SSL service |
| 100 | Service_TCAP, ///< The TCAP service. | ||
| 99 | Service_Time, ///< The time service | 101 | Service_Time, ///< The time service |
| 100 | Service_USB, ///< The USB (Universal Serial Bus) service | 102 | Service_USB, ///< The USB (Universal Serial Bus) service |
| 101 | Service_VI, ///< The VI (Video interface) service | 103 | Service_VI, ///< The VI (Video interface) service |
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index fd0786068..fefc3c747 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -713,7 +713,6 @@ void KeyManager::DeriveBase() { | |||
| 713 | 713 | ||
| 714 | const auto sbk = GetKey(S128KeyType::SecureBoot); | 714 | const auto sbk = GetKey(S128KeyType::SecureBoot); |
| 715 | const auto tsec = GetKey(S128KeyType::TSEC); | 715 | const auto tsec = GetKey(S128KeyType::TSEC); |
| 716 | const auto master_source = GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::Master)); | ||
| 717 | 716 | ||
| 718 | for (size_t i = 0; i < revisions.size(); ++i) { | 717 | for (size_t i = 0; i < revisions.size(); ++i) { |
| 719 | if (!revisions[i]) | 718 | if (!revisions[i]) |
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index bfe50da73..3824c74e0 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp | |||
| @@ -472,10 +472,14 @@ bool VfsRawCopy(const VirtualFile& src, const VirtualFile& dest, std::size_t blo | |||
| 472 | std::vector<u8> temp(std::min(block_size, src->GetSize())); | 472 | std::vector<u8> temp(std::min(block_size, src->GetSize())); |
| 473 | for (std::size_t i = 0; i < src->GetSize(); i += block_size) { | 473 | for (std::size_t i = 0; i < src->GetSize(); i += block_size) { |
| 474 | const auto read = std::min(block_size, src->GetSize() - i); | 474 | const auto read = std::min(block_size, src->GetSize() - i); |
| 475 | const auto block = src->Read(temp.data(), read, i); | ||
| 476 | 475 | ||
| 477 | if (dest->Write(temp.data(), read, i) != read) | 476 | if (src->Read(temp.data(), read, i) != read) { |
| 478 | return false; | 477 | return false; |
| 478 | } | ||
| 479 | |||
| 480 | if (dest->Write(temp.data(), read, i) != read) { | ||
| 481 | return false; | ||
| 482 | } | ||
| 479 | } | 483 | } |
| 480 | 484 | ||
| 481 | return true; | 485 | return true; |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 06f7d1b15..3cac1b4ff 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <random> | 5 | #include <random> |
| 6 | #include <boost/optional.hpp> | 6 | |
| 7 | #include "common/file_util.h" | 7 | #include "common/file_util.h" |
| 8 | #include "core/hle/service/acc/profile_manager.h" | 8 | #include "core/hle/service/acc/profile_manager.h" |
| 9 | #include "core/settings.h" | 9 | #include "core/settings.h" |
| @@ -58,11 +58,11 @@ ProfileManager::~ProfileManager() { | |||
| 58 | 58 | ||
| 59 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the | 59 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the |
| 60 | /// internal management of the users profiles | 60 | /// internal management of the users profiles |
| 61 | boost::optional<std::size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | 61 | std::optional<std::size_t> ProfileManager::AddToProfiles(const ProfileInfo& profile) { |
| 62 | if (user_count >= MAX_USERS) { | 62 | if (user_count >= MAX_USERS) { |
| 63 | return boost::none; | 63 | return {}; |
| 64 | } | 64 | } |
| 65 | profiles[user_count] = user; | 65 | profiles[user_count] = profile; |
| 66 | return user_count++; | 66 | return user_count++; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| @@ -81,7 +81,7 @@ bool ProfileManager::RemoveProfileAtIndex(std::size_t index) { | |||
| 81 | 81 | ||
| 82 | /// Helper function to register a user to the system | 82 | /// Helper function to register a user to the system |
| 83 | ResultCode ProfileManager::AddUser(const ProfileInfo& user) { | 83 | ResultCode ProfileManager::AddUser(const ProfileInfo& user) { |
| 84 | if (AddToProfiles(user) == boost::none) { | 84 | if (!AddToProfiles(user)) { |
| 85 | return ERROR_TOO_MANY_USERS; | 85 | return ERROR_TOO_MANY_USERS; |
| 86 | } | 86 | } |
| 87 | return RESULT_SUCCESS; | 87 | return RESULT_SUCCESS; |
| @@ -126,37 +126,40 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) | |||
| 126 | return CreateNewUser(uuid, username_output); | 126 | return CreateNewUser(uuid, username_output); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | boost::optional<UUID> ProfileManager::GetUser(std::size_t index) const { | 129 | std::optional<UUID> ProfileManager::GetUser(std::size_t index) const { |
| 130 | if (index >= MAX_USERS) | 130 | if (index >= MAX_USERS) { |
| 131 | return boost::none; | 131 | return {}; |
| 132 | } | ||
| 133 | |||
| 132 | return profiles[index].user_uuid; | 134 | return profiles[index].user_uuid; |
| 133 | } | 135 | } |
| 134 | 136 | ||
| 135 | /// Returns a users profile index based on their user id. | 137 | /// Returns a users profile index based on their user id. |
| 136 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | 138 | std::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { |
| 137 | if (!uuid) { | 139 | if (!uuid) { |
| 138 | return boost::none; | 140 | return {}; |
| 139 | } | 141 | } |
| 140 | auto iter = std::find_if(profiles.begin(), profiles.end(), | 142 | |
| 141 | [&uuid](const ProfileInfo& p) { return p.user_uuid == uuid; }); | 143 | const auto iter = std::find_if(profiles.begin(), profiles.end(), |
| 144 | [&uuid](const ProfileInfo& p) { return p.user_uuid == uuid; }); | ||
| 142 | if (iter == profiles.end()) { | 145 | if (iter == profiles.end()) { |
| 143 | return boost::none; | 146 | return {}; |
| 144 | } | 147 | } |
| 148 | |||
| 145 | return static_cast<std::size_t>(std::distance(profiles.begin(), iter)); | 149 | return static_cast<std::size_t>(std::distance(profiles.begin(), iter)); |
| 146 | } | 150 | } |
| 147 | 151 | ||
| 148 | /// Returns a users profile index based on their profile | 152 | /// Returns a users profile index based on their profile |
| 149 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { | 153 | std::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { |
| 150 | return GetUserIndex(user.user_uuid); | 154 | return GetUserIndex(user.user_uuid); |
| 151 | } | 155 | } |
| 152 | 156 | ||
| 153 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* | 157 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* |
| 154 | bool ProfileManager::GetProfileBase(boost::optional<std::size_t> index, | 158 | bool ProfileManager::GetProfileBase(std::optional<std::size_t> index, ProfileBase& profile) const { |
| 155 | ProfileBase& profile) const { | 159 | if (!index || index >= MAX_USERS) { |
| 156 | if (index == boost::none || index >= MAX_USERS) { | ||
| 157 | return false; | 160 | return false; |
| 158 | } | 161 | } |
| 159 | const auto& prof_info = profiles[index.get()]; | 162 | const auto& prof_info = profiles[*index]; |
| 160 | profile.user_uuid = prof_info.user_uuid; | 163 | profile.user_uuid = prof_info.user_uuid; |
| 161 | profile.username = prof_info.username; | 164 | profile.username = prof_info.username; |
| 162 | profile.timestamp = prof_info.creation_time; | 165 | profile.timestamp = prof_info.creation_time; |
| @@ -165,7 +168,7 @@ bool ProfileManager::GetProfileBase(boost::optional<std::size_t> index, | |||
| 165 | 168 | ||
| 166 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* | 169 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* |
| 167 | bool ProfileManager::GetProfileBase(UUID uuid, ProfileBase& profile) const { | 170 | bool ProfileManager::GetProfileBase(UUID uuid, ProfileBase& profile) const { |
| 168 | auto idx = GetUserIndex(uuid); | 171 | const auto idx = GetUserIndex(uuid); |
| 169 | return GetProfileBase(idx, profile); | 172 | return GetProfileBase(idx, profile); |
| 170 | } | 173 | } |
| 171 | 174 | ||
| @@ -192,7 +195,7 @@ std::size_t ProfileManager::GetOpenUserCount() const { | |||
| 192 | 195 | ||
| 193 | /// Checks if a user id exists in our profile manager | 196 | /// Checks if a user id exists in our profile manager |
| 194 | bool ProfileManager::UserExists(UUID uuid) const { | 197 | bool ProfileManager::UserExists(UUID uuid) const { |
| 195 | return (GetUserIndex(uuid) != boost::none); | 198 | return GetUserIndex(uuid) != std::nullopt; |
| 196 | } | 199 | } |
| 197 | 200 | ||
| 198 | bool ProfileManager::UserExistsIndex(std::size_t index) const { | 201 | bool ProfileManager::UserExistsIndex(std::size_t index) const { |
| @@ -203,21 +206,23 @@ bool ProfileManager::UserExistsIndex(std::size_t index) const { | |||
| 203 | 206 | ||
| 204 | /// Opens a specific user | 207 | /// Opens a specific user |
| 205 | void ProfileManager::OpenUser(UUID uuid) { | 208 | void ProfileManager::OpenUser(UUID uuid) { |
| 206 | auto idx = GetUserIndex(uuid); | 209 | const auto idx = GetUserIndex(uuid); |
| 207 | if (idx == boost::none) { | 210 | if (!idx) { |
| 208 | return; | 211 | return; |
| 209 | } | 212 | } |
| 210 | profiles[idx.get()].is_open = true; | 213 | |
| 214 | profiles[*idx].is_open = true; | ||
| 211 | last_opened_user = uuid; | 215 | last_opened_user = uuid; |
| 212 | } | 216 | } |
| 213 | 217 | ||
| 214 | /// Closes a specific user | 218 | /// Closes a specific user |
| 215 | void ProfileManager::CloseUser(UUID uuid) { | 219 | void ProfileManager::CloseUser(UUID uuid) { |
| 216 | auto idx = GetUserIndex(uuid); | 220 | const auto idx = GetUserIndex(uuid); |
| 217 | if (idx == boost::none) { | 221 | if (!idx) { |
| 218 | return; | 222 | return; |
| 219 | } | 223 | } |
| 220 | profiles[idx.get()].is_open = false; | 224 | |
| 225 | profiles[*idx].is_open = false; | ||
| 221 | } | 226 | } |
| 222 | 227 | ||
| 223 | /// Gets all valid user ids on the system | 228 | /// Gets all valid user ids on the system |
| @@ -247,10 +252,10 @@ UUID ProfileManager::GetLastOpenedUser() const { | |||
| 247 | } | 252 | } |
| 248 | 253 | ||
| 249 | /// Return the users profile base and the unknown arbitary data. | 254 | /// Return the users profile base and the unknown arbitary data. |
| 250 | bool ProfileManager::GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, | 255 | bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, |
| 251 | ProfileData& data) const { | 256 | ProfileData& data) const { |
| 252 | if (GetProfileBase(index, profile)) { | 257 | if (GetProfileBase(index, profile)) { |
| 253 | data = profiles[index.get()].data; | 258 | data = profiles[*index].data; |
| 254 | return true; | 259 | return true; |
| 255 | } | 260 | } |
| 256 | return false; | 261 | return false; |
| @@ -259,7 +264,7 @@ bool ProfileManager::GetProfileBaseAndData(boost::optional<std::size_t> index, P | |||
| 259 | /// Return the users profile base and the unknown arbitary data. | 264 | /// Return the users profile base and the unknown arbitary data. |
| 260 | bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, | 265 | bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, |
| 261 | ProfileData& data) const { | 266 | ProfileData& data) const { |
| 262 | auto idx = GetUserIndex(uuid); | 267 | const auto idx = GetUserIndex(uuid); |
| 263 | return GetProfileBaseAndData(idx, profile, data); | 268 | return GetProfileBaseAndData(idx, profile, data); |
| 264 | } | 269 | } |
| 265 | 270 | ||
| @@ -277,8 +282,8 @@ bool ProfileManager::CanSystemRegisterUser() const { | |||
| 277 | } | 282 | } |
| 278 | 283 | ||
| 279 | bool ProfileManager::RemoveUser(UUID uuid) { | 284 | bool ProfileManager::RemoveUser(UUID uuid) { |
| 280 | auto index = GetUserIndex(uuid); | 285 | const auto index = GetUserIndex(uuid); |
| 281 | if (index == boost::none) { | 286 | if (!index) { |
| 282 | return false; | 287 | return false; |
| 283 | } | 288 | } |
| 284 | 289 | ||
| @@ -289,8 +294,8 @@ bool ProfileManager::RemoveUser(UUID uuid) { | |||
| 289 | } | 294 | } |
| 290 | 295 | ||
| 291 | bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { | 296 | bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { |
| 292 | auto index = GetUserIndex(uuid); | 297 | const auto index = GetUserIndex(uuid); |
| 293 | if (profile_new.user_uuid == UUID(INVALID_UUID) || index == boost::none) { | 298 | if (!index || profile_new.user_uuid == UUID(INVALID_UUID)) { |
| 294 | return false; | 299 | return false; |
| 295 | } | 300 | } |
| 296 | 301 | ||
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 235208d56..1cd2e51b2 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <optional> | ||
| 8 | 9 | ||
| 9 | #include "boost/optional.hpp" | ||
| 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/hle/result.h" | 12 | #include "core/hle/result.h" |
| @@ -96,13 +96,13 @@ public: | |||
| 96 | ResultCode AddUser(const ProfileInfo& user); | 96 | ResultCode AddUser(const ProfileInfo& user); |
| 97 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); | 97 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); |
| 98 | ResultCode CreateNewUser(UUID uuid, const std::string& username); | 98 | ResultCode CreateNewUser(UUID uuid, const std::string& username); |
| 99 | boost::optional<UUID> GetUser(std::size_t index) const; | 99 | std::optional<UUID> GetUser(std::size_t index) const; |
| 100 | boost::optional<std::size_t> GetUserIndex(const UUID& uuid) const; | 100 | std::optional<std::size_t> GetUserIndex(const UUID& uuid) const; |
| 101 | boost::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const; | 101 | std::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const; |
| 102 | bool GetProfileBase(boost::optional<std::size_t> index, ProfileBase& profile) const; | 102 | bool GetProfileBase(std::optional<std::size_t> index, ProfileBase& profile) const; |
| 103 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; | 103 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; |
| 104 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; | 104 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; |
| 105 | bool GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, | 105 | bool GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, |
| 106 | ProfileData& data) const; | 106 | ProfileData& data) const; |
| 107 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; | 107 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; |
| 108 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, | 108 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, |
| @@ -120,16 +120,16 @@ public: | |||
| 120 | bool CanSystemRegisterUser() const; | 120 | bool CanSystemRegisterUser() const; |
| 121 | 121 | ||
| 122 | bool RemoveUser(UUID uuid); | 122 | bool RemoveUser(UUID uuid); |
| 123 | bool SetProfileBase(UUID uuid, const ProfileBase& profile); | 123 | bool SetProfileBase(UUID uuid, const ProfileBase& profile_new); |
| 124 | 124 | ||
| 125 | private: | 125 | private: |
| 126 | void ParseUserSaveFile(); | 126 | void ParseUserSaveFile(); |
| 127 | void WriteUserSaveFile(); | 127 | void WriteUserSaveFile(); |
| 128 | std::optional<std::size_t> AddToProfiles(const ProfileInfo& profile); | ||
| 129 | bool RemoveProfileAtIndex(std::size_t index); | ||
| 128 | 130 | ||
| 129 | std::array<ProfileInfo, MAX_USERS> profiles{}; | 131 | std::array<ProfileInfo, MAX_USERS> profiles{}; |
| 130 | std::size_t user_count = 0; | 132 | std::size_t user_count = 0; |
| 131 | boost::optional<std::size_t> AddToProfiles(const ProfileInfo& profile); | ||
| 132 | bool RemoveProfileAtIndex(std::size_t index); | ||
| 133 | UUID last_opened_user{INVALID_UUID}; | 133 | UUID last_opened_user{INVALID_UUID}; |
| 134 | }; | 134 | }; |
| 135 | 135 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 4ed66d817..59aafd616 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -743,7 +743,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { | |||
| 743 | 743 | ||
| 744 | Account::ProfileManager profile_manager{}; | 744 | Account::ProfileManager profile_manager{}; |
| 745 | const auto uuid = profile_manager.GetUser(Settings::values.current_user); | 745 | const auto uuid = profile_manager.GetUser(Settings::values.current_user); |
| 746 | ASSERT(uuid != boost::none); | 746 | ASSERT(uuid != std::nullopt); |
| 747 | params.current_user = uuid->uuid; | 747 | params.current_user = uuid->uuid; |
| 748 | 748 | ||
| 749 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 749 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 428069df2..54305cf05 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -24,8 +24,8 @@ namespace Service::AOC { | |||
| 24 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; | 24 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; |
| 25 | constexpr u64 DLC_BASE_TO_AOC_ID = 0x1000; | 25 | constexpr u64 DLC_BASE_TO_AOC_ID = 0x1000; |
| 26 | 26 | ||
| 27 | static bool CheckAOCTitleIDMatchesBase(u64 base, u64 aoc) { | 27 | static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) { |
| 28 | return (aoc & DLC_BASE_TITLE_ID_MASK) == base; | 28 | return (title_id & DLC_BASE_TITLE_ID_MASK) == base; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | static std::vector<u64> AccumulateAOCTitleIDs() { | 31 | static std::vector<u64> AccumulateAOCTitleIDs() { |
| @@ -74,7 +74,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { | |||
| 74 | const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 74 | const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 75 | rb.Push<u32>(static_cast<u32>( | 75 | rb.Push<u32>(static_cast<u32>( |
| 76 | std::count_if(add_on_content.begin(), add_on_content.end(), | 76 | std::count_if(add_on_content.begin(), add_on_content.end(), |
| 77 | [¤t](u64 tid) { return (tid & DLC_BASE_TITLE_ID_MASK) == current; }))); | 77 | [current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); }))); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { | 80 | void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index b06e65a77..4b4d1324f 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -108,9 +108,10 @@ void Controller_NPad::OnInit() { | |||
| 108 | styleset_changed_event = | 108 | styleset_changed_event = |
| 109 | Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "npad:NpadStyleSetChanged"); | 109 | Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "npad:NpadStyleSetChanged"); |
| 110 | 110 | ||
| 111 | if (!IsControllerActivated()) | 111 | if (!IsControllerActivated()) { |
| 112 | return; | 112 | return; |
| 113 | std::size_t controller{}; | 113 | } |
| 114 | |||
| 114 | if (style.raw == 0) { | 115 | if (style.raw == 0) { |
| 115 | // We want to support all controllers | 116 | // We want to support all controllers |
| 116 | style.handheld.Assign(1); | 117 | style.handheld.Assign(1); |
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 7d95816fe..c716a462b 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp | |||
| @@ -74,10 +74,6 @@ double PerfStats::GetLastFrameTimeScale() { | |||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { | 76 | void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { |
| 77 | // Max lag caused by slow frames. Can be adjusted to compensate for too many slow frames. Higher | ||
| 78 | // values increase the time needed to recover and limit framerate again after spikes. | ||
| 79 | constexpr microseconds MAX_LAG_TIME_US = 25000us; | ||
| 80 | |||
| 81 | if (!Settings::values.use_frame_limit) { | 77 | if (!Settings::values.use_frame_limit) { |
| 82 | return; | 78 | return; |
| 83 | } | 79 | } |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index bca014a4a..78ba29fc1 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -155,7 +155,6 @@ void Maxwell3D::ProcessQueryGet() { | |||
| 155 | ASSERT_MSG(regs.query.query_get.unit == Regs::QueryUnit::Crop, | 155 | ASSERT_MSG(regs.query.query_get.unit == Regs::QueryUnit::Crop, |
| 156 | "Units other than CROP are unimplemented"); | 156 | "Units other than CROP are unimplemented"); |
| 157 | 157 | ||
| 158 | u32 value = Memory::Read32(*address); | ||
| 159 | u64 result = 0; | 158 | u64 result = 0; |
| 160 | 159 | ||
| 161 | // TODO(Subv): Support the other query variables | 160 | // TODO(Subv): Support the other query variables |
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 6cd08d28b..af7756266 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -79,6 +79,7 @@ union Attribute { | |||
| 79 | constexpr explicit Attribute(u64 value) : value(value) {} | 79 | constexpr explicit Attribute(u64 value) : value(value) {} |
| 80 | 80 | ||
| 81 | enum class Index : u64 { | 81 | enum class Index : u64 { |
| 82 | PointSize = 6, | ||
| 82 | Position = 7, | 83 | Position = 7, |
| 83 | Attribute_0 = 8, | 84 | Attribute_0 = 8, |
| 84 | Attribute_31 = 39, | 85 | Attribute_31 = 39, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 9c8925383..591ec7998 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -78,6 +78,29 @@ void SurfaceParams::InitCacheParameters(Tegra::GPUVAddr gpu_addr_) { | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | std::size_t SurfaceParams::InnerMemorySize(bool layer_only) const { | ||
| 82 | const u32 compression_factor{GetCompressionFactor(pixel_format)}; | ||
| 83 | const u32 bytes_per_pixel{GetBytesPerPixel(pixel_format)}; | ||
| 84 | u32 m_depth = (layer_only ? 1U : depth); | ||
| 85 | u32 m_width = std::max(1U, width / compression_factor); | ||
| 86 | u32 m_height = std::max(1U, height / compression_factor); | ||
| 87 | std::size_t size = Tegra::Texture::CalculateSize(is_tiled, bytes_per_pixel, m_width, m_height, | ||
| 88 | m_depth, block_height, block_depth); | ||
| 89 | u32 m_block_height = block_height; | ||
| 90 | u32 m_block_depth = block_depth; | ||
| 91 | std::size_t block_size_bytes = 512 * block_height * block_depth; // 512 is GOB size | ||
| 92 | for (u32 i = 1; i < max_mip_level; i++) { | ||
| 93 | m_width = std::max(1U, m_width / 2); | ||
| 94 | m_height = std::max(1U, m_height / 2); | ||
| 95 | m_depth = std::max(1U, m_depth / 2); | ||
| 96 | m_block_height = std::max(1U, m_block_height / 2); | ||
| 97 | m_block_depth = std::max(1U, m_block_depth / 2); | ||
| 98 | size += Tegra::Texture::CalculateSize(is_tiled, bytes_per_pixel, m_width, m_height, m_depth, | ||
| 99 | m_block_height, m_block_depth); | ||
| 100 | } | ||
| 101 | return is_tiled ? Common::AlignUp(size, block_size_bytes) : size; | ||
| 102 | } | ||
| 103 | |||
| 81 | /*static*/ SurfaceParams SurfaceParams::CreateForTexture( | 104 | /*static*/ SurfaceParams SurfaceParams::CreateForTexture( |
| 82 | const Tegra::Texture::FullTextureInfo& config, const GLShader::SamplerEntry& entry) { | 105 | const Tegra::Texture::FullTextureInfo& config, const GLShader::SamplerEntry& entry) { |
| 83 | SurfaceParams params{}; | 106 | SurfaceParams params{}; |
| @@ -124,6 +147,7 @@ void SurfaceParams::InitCacheParameters(Tegra::GPUVAddr gpu_addr_) { | |||
| 124 | break; | 147 | break; |
| 125 | } | 148 | } |
| 126 | 149 | ||
| 150 | params.is_layered = SurfaceTargetIsLayered(params.target); | ||
| 127 | params.max_mip_level = config.tic.max_mip_level + 1; | 151 | params.max_mip_level = config.tic.max_mip_level + 1; |
| 128 | params.rt = {}; | 152 | params.rt = {}; |
| 129 | 153 | ||
| @@ -150,6 +174,7 @@ void SurfaceParams::InitCacheParameters(Tegra::GPUVAddr gpu_addr_) { | |||
| 150 | params.target = SurfaceTarget::Texture2D; | 174 | params.target = SurfaceTarget::Texture2D; |
| 151 | params.depth = 1; | 175 | params.depth = 1; |
| 152 | params.max_mip_level = 0; | 176 | params.max_mip_level = 0; |
| 177 | params.is_layered = false; | ||
| 153 | 178 | ||
| 154 | // Render target specific parameters, not used for caching | 179 | // Render target specific parameters, not used for caching |
| 155 | params.rt.index = static_cast<u32>(index); | 180 | params.rt.index = static_cast<u32>(index); |
| @@ -182,6 +207,7 @@ void SurfaceParams::InitCacheParameters(Tegra::GPUVAddr gpu_addr_) { | |||
| 182 | params.target = SurfaceTarget::Texture2D; | 207 | params.target = SurfaceTarget::Texture2D; |
| 183 | params.depth = 1; | 208 | params.depth = 1; |
| 184 | params.max_mip_level = 0; | 209 | params.max_mip_level = 0; |
| 210 | params.is_layered = false; | ||
| 185 | params.rt = {}; | 211 | params.rt = {}; |
| 186 | 212 | ||
| 187 | params.InitCacheParameters(zeta_address); | 213 | params.InitCacheParameters(zeta_address); |
| @@ -361,10 +387,11 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 d | |||
| 361 | } | 387 | } |
| 362 | } | 388 | } |
| 363 | 389 | ||
| 364 | static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr), | 390 | using GLConversionArray = std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr), |
| 365 | SurfaceParams::MaxPixelFormat> | 391 | SurfaceParams::MaxPixelFormat>; |
| 366 | morton_to_gl_fns = { | 392 | |
| 367 | // clang-format off | 393 | static constexpr GLConversionArray morton_to_gl_fns = { |
| 394 | // clang-format off | ||
| 368 | MortonCopy<true, PixelFormat::ABGR8U>, | 395 | MortonCopy<true, PixelFormat::ABGR8U>, |
| 369 | MortonCopy<true, PixelFormat::ABGR8S>, | 396 | MortonCopy<true, PixelFormat::ABGR8S>, |
| 370 | MortonCopy<true, PixelFormat::ABGR8UI>, | 397 | MortonCopy<true, PixelFormat::ABGR8UI>, |
| @@ -418,13 +445,11 @@ static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, | |||
| 418 | MortonCopy<true, PixelFormat::Z24S8>, | 445 | MortonCopy<true, PixelFormat::Z24S8>, |
| 419 | MortonCopy<true, PixelFormat::S8Z24>, | 446 | MortonCopy<true, PixelFormat::S8Z24>, |
| 420 | MortonCopy<true, PixelFormat::Z32FS8>, | 447 | MortonCopy<true, PixelFormat::Z32FS8>, |
| 421 | // clang-format on | 448 | // clang-format on |
| 422 | }; | 449 | }; |
| 423 | 450 | ||
| 424 | static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr), | 451 | static constexpr GLConversionArray gl_to_morton_fns = { |
| 425 | SurfaceParams::MaxPixelFormat> | 452 | // clang-format off |
| 426 | gl_to_morton_fns = { | ||
| 427 | // clang-format off | ||
| 428 | MortonCopy<false, PixelFormat::ABGR8U>, | 453 | MortonCopy<false, PixelFormat::ABGR8U>, |
| 429 | MortonCopy<false, PixelFormat::ABGR8S>, | 454 | MortonCopy<false, PixelFormat::ABGR8S>, |
| 430 | MortonCopy<false, PixelFormat::ABGR8UI>, | 455 | MortonCopy<false, PixelFormat::ABGR8UI>, |
| @@ -479,9 +504,35 @@ static constexpr std::array<void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, | |||
| 479 | MortonCopy<false, PixelFormat::Z24S8>, | 504 | MortonCopy<false, PixelFormat::Z24S8>, |
| 480 | MortonCopy<false, PixelFormat::S8Z24>, | 505 | MortonCopy<false, PixelFormat::S8Z24>, |
| 481 | MortonCopy<false, PixelFormat::Z32FS8>, | 506 | MortonCopy<false, PixelFormat::Z32FS8>, |
| 482 | // clang-format on | 507 | // clang-format on |
| 483 | }; | 508 | }; |
| 484 | 509 | ||
| 510 | void SwizzleFunc(const GLConversionArray& functions, const SurfaceParams& params, | ||
| 511 | std::vector<u8>& gl_buffer) { | ||
| 512 | u32 depth = params.depth; | ||
| 513 | if (params.target == SurfaceParams::SurfaceTarget::Texture2D) { | ||
| 514 | // TODO(Blinkhawk): Eliminate this condition once all texture types are implemented. | ||
| 515 | depth = 1U; | ||
| 516 | } | ||
| 517 | if (params.is_layered) { | ||
| 518 | u64 offset = 0; | ||
| 519 | u64 offset_gl = 0; | ||
| 520 | u64 layer_size = params.LayerMemorySize(); | ||
| 521 | u64 gl_size = params.LayerSizeGL(); | ||
| 522 | for (u32 i = 0; i < depth; i++) { | ||
| 523 | functions[static_cast<std::size_t>(params.pixel_format)]( | ||
| 524 | params.width, params.block_height, params.height, params.block_depth, 1, | ||
| 525 | gl_buffer.data() + offset_gl, gl_size, params.addr + offset); | ||
| 526 | offset += layer_size; | ||
| 527 | offset_gl += gl_size; | ||
| 528 | } | ||
| 529 | } else { | ||
| 530 | functions[static_cast<std::size_t>(params.pixel_format)]( | ||
| 531 | params.width, params.block_height, params.height, params.block_depth, depth, | ||
| 532 | gl_buffer.data(), gl_buffer.size(), params.addr); | ||
| 533 | } | ||
| 534 | } | ||
| 535 | |||
| 485 | static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface, | 536 | static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface, |
| 486 | GLuint read_fb_handle, GLuint draw_fb_handle, GLenum src_attachment = 0, | 537 | GLuint read_fb_handle, GLuint draw_fb_handle, GLenum src_attachment = 0, |
| 487 | GLenum dst_attachment = 0, std::size_t cubemap_face = 0) { | 538 | GLenum dst_attachment = 0, std::size_t cubemap_face = 0) { |
| @@ -881,21 +932,10 @@ void CachedSurface::LoadGLBuffer() { | |||
| 881 | 932 | ||
| 882 | gl_buffer.resize(params.size_in_bytes_gl); | 933 | gl_buffer.resize(params.size_in_bytes_gl); |
| 883 | if (params.is_tiled) { | 934 | if (params.is_tiled) { |
| 884 | u32 depth = params.depth; | ||
| 885 | u32 block_depth = params.block_depth; | ||
| 886 | |||
| 887 | ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", | 935 | ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", |
| 888 | params.block_width, static_cast<u32>(params.target)); | 936 | params.block_width, static_cast<u32>(params.target)); |
| 889 | 937 | ||
| 890 | if (params.target == SurfaceParams::SurfaceTarget::Texture2D) { | 938 | SwizzleFunc(morton_to_gl_fns, params, gl_buffer); |
| 891 | // TODO(Blinkhawk): Eliminate this condition once all texture types are implemented. | ||
| 892 | depth = 1U; | ||
| 893 | block_depth = 1U; | ||
| 894 | } | ||
| 895 | |||
| 896 | morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)]( | ||
| 897 | params.width, params.block_height, params.height, block_depth, depth, gl_buffer.data(), | ||
| 898 | gl_buffer.size(), params.addr); | ||
| 899 | } else { | 939 | } else { |
| 900 | const auto texture_src_data{Memory::GetPointer(params.addr)}; | 940 | const auto texture_src_data{Memory::GetPointer(params.addr)}; |
| 901 | const auto texture_src_data_end{texture_src_data + params.size_in_bytes_gl}; | 941 | const auto texture_src_data_end{texture_src_data + params.size_in_bytes_gl}; |
| @@ -929,19 +969,10 @@ void CachedSurface::FlushGLBuffer() { | |||
| 929 | const u8* const texture_src_data = Memory::GetPointer(params.addr); | 969 | const u8* const texture_src_data = Memory::GetPointer(params.addr); |
| 930 | ASSERT(texture_src_data); | 970 | ASSERT(texture_src_data); |
| 931 | if (params.is_tiled) { | 971 | if (params.is_tiled) { |
| 932 | u32 depth = params.depth; | ||
| 933 | u32 block_depth = params.block_depth; | ||
| 934 | |||
| 935 | ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", | 972 | ASSERT_MSG(params.block_width == 1, "Block width is defined as {} on texture type {}", |
| 936 | params.block_width, static_cast<u32>(params.target)); | 973 | params.block_width, static_cast<u32>(params.target)); |
| 937 | 974 | ||
| 938 | if (params.target == SurfaceParams::SurfaceTarget::Texture2D) { | 975 | SwizzleFunc(gl_to_morton_fns, params, gl_buffer); |
| 939 | // TODO(Blinkhawk): Eliminate this condition once all texture types are implemented. | ||
| 940 | depth = 1U; | ||
| 941 | } | ||
| 942 | gl_to_morton_fns[static_cast<size_t>(params.pixel_format)]( | ||
| 943 | params.width, params.block_height, params.height, block_depth, depth, gl_buffer.data(), | ||
| 944 | gl_buffer.size(), GetAddr()); | ||
| 945 | } else { | 976 | } else { |
| 946 | std::memcpy(Memory::GetPointer(GetAddr()), gl_buffer.data(), GetSizeInBytes()); | 977 | std::memcpy(Memory::GetPointer(GetAddr()), gl_buffer.data(), GetSizeInBytes()); |
| 947 | } | 978 | } |
| @@ -1179,7 +1210,7 @@ void RasterizerCacheOpenGL::AccurateCopySurface(const Surface& src_surface, | |||
| 1179 | const Surface& dst_surface) { | 1210 | const Surface& dst_surface) { |
| 1180 | const auto& src_params{src_surface->GetSurfaceParams()}; | 1211 | const auto& src_params{src_surface->GetSurfaceParams()}; |
| 1181 | const auto& dst_params{dst_surface->GetSurfaceParams()}; | 1212 | const auto& dst_params{dst_surface->GetSurfaceParams()}; |
| 1182 | FlushRegion(src_params.addr, dst_params.size_in_bytes); | 1213 | FlushRegion(src_params.addr, dst_params.MemorySize()); |
| 1183 | LoadSurface(dst_surface); | 1214 | LoadSurface(dst_surface); |
| 1184 | } | 1215 | } |
| 1185 | 1216 | ||
| @@ -1221,44 +1252,10 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface, | |||
| 1221 | CopySurface(old_surface, new_surface, copy_pbo.handle); | 1252 | CopySurface(old_surface, new_surface, copy_pbo.handle); |
| 1222 | } | 1253 | } |
| 1223 | break; | 1254 | break; |
| 1255 | case SurfaceParams::SurfaceTarget::TextureCubemap: | ||
| 1224 | case SurfaceParams::SurfaceTarget::Texture3D: | 1256 | case SurfaceParams::SurfaceTarget::Texture3D: |
| 1225 | AccurateCopySurface(old_surface, new_surface); | 1257 | AccurateCopySurface(old_surface, new_surface); |
| 1226 | break; | 1258 | break; |
| 1227 | case SurfaceParams::SurfaceTarget::TextureCubemap: { | ||
| 1228 | if (old_params.rt.array_mode != 1) { | ||
| 1229 | // TODO(bunnei): This is used by Breath of the Wild, I'm not sure how to implement this | ||
| 1230 | // yet (array rendering used as a cubemap texture). | ||
| 1231 | LOG_CRITICAL(HW_GPU, "Unhandled rendertarget array_mode {}", old_params.rt.array_mode); | ||
| 1232 | UNREACHABLE(); | ||
| 1233 | return new_surface; | ||
| 1234 | } | ||
| 1235 | |||
| 1236 | // This seems to be used for render-to-cubemap texture | ||
| 1237 | ASSERT_MSG(old_params.target == SurfaceParams::SurfaceTarget::Texture2D, "Unexpected"); | ||
| 1238 | ASSERT_MSG(old_params.pixel_format == new_params.pixel_format, "Unexpected"); | ||
| 1239 | ASSERT_MSG(old_params.rt.base_layer == 0, "Unimplemented"); | ||
| 1240 | |||
| 1241 | // TODO(bunnei): Verify the below - this stride seems to be in 32-bit words, not pixels. | ||
| 1242 | // Tested with Splatoon 2, Super Mario Odyssey, and Breath of the Wild. | ||
| 1243 | const std::size_t byte_stride{old_params.rt.layer_stride * sizeof(u32)}; | ||
| 1244 | |||
| 1245 | for (std::size_t index = 0; index < new_params.depth; ++index) { | ||
| 1246 | Surface face_surface{TryGetReservedSurface(old_params)}; | ||
| 1247 | ASSERT_MSG(face_surface, "Unexpected"); | ||
| 1248 | |||
| 1249 | if (is_blit) { | ||
| 1250 | BlitSurface(face_surface, new_surface, read_framebuffer.handle, | ||
| 1251 | draw_framebuffer.handle, face_surface->GetSurfaceParams().rt.index, | ||
| 1252 | new_params.rt.index, index); | ||
| 1253 | } else { | ||
| 1254 | CopySurface(face_surface, new_surface, copy_pbo.handle, | ||
| 1255 | face_surface->GetSurfaceParams().rt.index, new_params.rt.index, index); | ||
| 1256 | } | ||
| 1257 | |||
| 1258 | old_params.addr += byte_stride; | ||
| 1259 | } | ||
| 1260 | break; | ||
| 1261 | } | ||
| 1262 | default: | 1259 | default: |
| 1263 | LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}", | 1260 | LOG_CRITICAL(Render_OpenGL, "Unimplemented surface target={}", |
| 1264 | static_cast<u32>(new_params.target)); | 1261 | static_cast<u32>(new_params.target)); |
| @@ -1266,7 +1263,7 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface, | |||
| 1266 | } | 1263 | } |
| 1267 | 1264 | ||
| 1268 | return new_surface; | 1265 | return new_surface; |
| 1269 | } | 1266 | } // namespace OpenGL |
| 1270 | 1267 | ||
| 1271 | Surface RasterizerCacheOpenGL::TryFindFramebufferSurface(VAddr addr) const { | 1268 | Surface RasterizerCacheOpenGL::TryFindFramebufferSurface(VAddr addr) const { |
| 1272 | return TryGet(addr); | 1269 | return TryGet(addr); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 0dd0d90a3..50a7ab47d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -168,6 +168,23 @@ struct SurfaceParams { | |||
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static bool SurfaceTargetIsLayered(SurfaceTarget target) { | ||
| 172 | switch (target) { | ||
| 173 | case SurfaceTarget::Texture1D: | ||
| 174 | case SurfaceTarget::Texture2D: | ||
| 175 | case SurfaceTarget::Texture3D: | ||
| 176 | return false; | ||
| 177 | case SurfaceTarget::Texture1DArray: | ||
| 178 | case SurfaceTarget::Texture2DArray: | ||
| 179 | case SurfaceTarget::TextureCubemap: | ||
| 180 | return true; | ||
| 181 | default: | ||
| 182 | LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", static_cast<u32>(target)); | ||
| 183 | UNREACHABLE(); | ||
| 184 | return false; | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 171 | /** | 188 | /** |
| 172 | * Gets the compression factor for the specified PixelFormat. This applies to just the | 189 | * Gets the compression factor for the specified PixelFormat. This applies to just the |
| 173 | * "compressed width" and "compressed height", not the overall compression factor of a | 190 | * "compressed width" and "compressed height", not the overall compression factor of a |
| @@ -742,6 +759,25 @@ struct SurfaceParams { | |||
| 742 | return size_in_bytes_gl / 6; | 759 | return size_in_bytes_gl / 6; |
| 743 | } | 760 | } |
| 744 | 761 | ||
| 762 | /// Returns the exact size of memory occupied by the texture in VRAM, including mipmaps. | ||
| 763 | std::size_t MemorySize() const { | ||
| 764 | std::size_t size = InnerMemorySize(is_layered); | ||
| 765 | if (is_layered) | ||
| 766 | return size * depth; | ||
| 767 | return size; | ||
| 768 | } | ||
| 769 | |||
| 770 | /// Returns the exact size of the memory occupied by a layer in a texture in VRAM, including | ||
| 771 | /// mipmaps. | ||
| 772 | std::size_t LayerMemorySize() const { | ||
| 773 | return InnerMemorySize(true); | ||
| 774 | } | ||
| 775 | |||
| 776 | /// Returns the size of a layer of this surface in OpenGL. | ||
| 777 | std::size_t LayerSizeGL() const { | ||
| 778 | return SizeInBytesRaw(true) / depth; | ||
| 779 | } | ||
| 780 | |||
| 745 | /// Creates SurfaceParams from a texture configuration | 781 | /// Creates SurfaceParams from a texture configuration |
| 746 | static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config, | 782 | static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config, |
| 747 | const GLShader::SamplerEntry& entry); | 783 | const GLShader::SamplerEntry& entry); |
| @@ -782,6 +818,7 @@ struct SurfaceParams { | |||
| 782 | u32 unaligned_height; | 818 | u32 unaligned_height; |
| 783 | SurfaceTarget target; | 819 | SurfaceTarget target; |
| 784 | u32 max_mip_level; | 820 | u32 max_mip_level; |
| 821 | bool is_layered; | ||
| 785 | 822 | ||
| 786 | // Parameters used for caching | 823 | // Parameters used for caching |
| 787 | VAddr addr; | 824 | VAddr addr; |
| @@ -797,6 +834,9 @@ struct SurfaceParams { | |||
| 797 | u32 layer_stride; | 834 | u32 layer_stride; |
| 798 | u32 base_layer; | 835 | u32 base_layer; |
| 799 | } rt; | 836 | } rt; |
| 837 | |||
| 838 | private: | ||
| 839 | std::size_t InnerMemorySize(bool layer_only = false) const; | ||
| 800 | }; | 840 | }; |
| 801 | 841 | ||
| 802 | }; // namespace OpenGL | 842 | }; // namespace OpenGL |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index fe4d1bd83..81ffb24e4 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <set> | 6 | #include <set> |
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include <string_view> | 8 | #include <string_view> |
| 9 | #include <unordered_set> | ||
| 9 | 10 | ||
| 10 | #include <boost/optional.hpp> | 11 | #include <boost/optional.hpp> |
| 11 | #include <fmt/format.h> | 12 | #include <fmt/format.h> |
| @@ -276,7 +277,8 @@ public: | |||
| 276 | GLSLRegisterManager(ShaderWriter& shader, ShaderWriter& declarations, | 277 | GLSLRegisterManager(ShaderWriter& shader, ShaderWriter& declarations, |
| 277 | const Maxwell3D::Regs::ShaderStage& stage, const std::string& suffix, | 278 | const Maxwell3D::Regs::ShaderStage& stage, const std::string& suffix, |
| 278 | const Tegra::Shader::Header& header) | 279 | const Tegra::Shader::Header& header) |
| 279 | : shader{shader}, declarations{declarations}, stage{stage}, suffix{suffix}, header{header} { | 280 | : shader{shader}, declarations{declarations}, stage{stage}, suffix{suffix}, header{header}, |
| 281 | fixed_pipeline_output_attributes_used{} { | ||
| 280 | BuildRegisterList(); | 282 | BuildRegisterList(); |
| 281 | BuildInputList(); | 283 | BuildInputList(); |
| 282 | } | 284 | } |
| @@ -480,7 +482,12 @@ public: | |||
| 480 | std::to_string(static_cast<u32>(attribute)) + ']' + | 482 | std::to_string(static_cast<u32>(attribute)) + ']' + |
| 481 | GetSwizzle(elem) + " = " + src + ';'); | 483 | GetSwizzle(elem) + " = " + src + ';'); |
| 482 | } else { | 484 | } else { |
| 483 | shader.AddLine(dest + GetSwizzle(elem) + " = " + src + ';'); | 485 | if (attribute == Attribute::Index::PointSize) { |
| 486 | fixed_pipeline_output_attributes_used.insert(attribute); | ||
| 487 | shader.AddLine(dest + " = " + src + ';'); | ||
| 488 | } else { | ||
| 489 | shader.AddLine(dest + GetSwizzle(elem) + " = " + src + ';'); | ||
| 490 | } | ||
| 484 | } | 491 | } |
| 485 | } | 492 | } |
| 486 | } | 493 | } |
| @@ -524,6 +531,7 @@ public: | |||
| 524 | 531 | ||
| 525 | /// Add declarations. | 532 | /// Add declarations. |
| 526 | void GenerateDeclarations(const std::string& suffix) { | 533 | void GenerateDeclarations(const std::string& suffix) { |
| 534 | GenerateVertex(); | ||
| 527 | GenerateRegisters(suffix); | 535 | GenerateRegisters(suffix); |
| 528 | GenerateInternalFlags(); | 536 | GenerateInternalFlags(); |
| 529 | GenerateInputAttrs(); | 537 | GenerateInputAttrs(); |
| @@ -683,6 +691,20 @@ private: | |||
| 683 | declarations.AddNewLine(); | 691 | declarations.AddNewLine(); |
| 684 | } | 692 | } |
| 685 | 693 | ||
| 694 | void GenerateVertex() { | ||
| 695 | if (stage != Maxwell3D::Regs::ShaderStage::Vertex) | ||
| 696 | return; | ||
| 697 | declarations.AddLine("out gl_PerVertex {"); | ||
| 698 | ++declarations.scope; | ||
| 699 | declarations.AddLine("vec4 gl_Position;"); | ||
| 700 | for (auto& o : fixed_pipeline_output_attributes_used) { | ||
| 701 | if (o == Attribute::Index::PointSize) | ||
| 702 | declarations.AddLine("float gl_PointSize;"); | ||
| 703 | } | ||
| 704 | --declarations.scope; | ||
| 705 | declarations.AddLine("};"); | ||
| 706 | } | ||
| 707 | |||
| 686 | /// Generates code representing a temporary (GPR) register. | 708 | /// Generates code representing a temporary (GPR) register. |
| 687 | std::string GetRegister(const Register& reg, unsigned elem) { | 709 | std::string GetRegister(const Register& reg, unsigned elem) { |
| 688 | if (reg == Register::ZeroIndex) { | 710 | if (reg == Register::ZeroIndex) { |
| @@ -836,6 +858,8 @@ private: | |||
| 836 | /// Generates code representing the declaration name of an output attribute register. | 858 | /// Generates code representing the declaration name of an output attribute register. |
| 837 | std::string GetOutputAttribute(Attribute::Index attribute) { | 859 | std::string GetOutputAttribute(Attribute::Index attribute) { |
| 838 | switch (attribute) { | 860 | switch (attribute) { |
| 861 | case Attribute::Index::PointSize: | ||
| 862 | return "gl_PointSize"; | ||
| 839 | case Attribute::Index::Position: | 863 | case Attribute::Index::Position: |
| 840 | return "position"; | 864 | return "position"; |
| 841 | default: | 865 | default: |
| @@ -870,6 +894,7 @@ private: | |||
| 870 | const Maxwell3D::Regs::ShaderStage& stage; | 894 | const Maxwell3D::Regs::ShaderStage& stage; |
| 871 | const std::string& suffix; | 895 | const std::string& suffix; |
| 872 | const Tegra::Shader::Header& header; | 896 | const Tegra::Shader::Header& header; |
| 897 | std::unordered_set<Attribute::Index> fixed_pipeline_output_attributes_used; | ||
| 873 | }; | 898 | }; |
| 874 | 899 | ||
| 875 | class GLSLGenerator { | 900 | class GLSLGenerator { |
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index e883ffb1d..dfb562706 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp | |||
| @@ -19,9 +19,6 @@ ProgramResult GenerateVertexShader(const ShaderSetup& setup) { | |||
| 19 | out += Decompiler::GetCommonDeclarations(); | 19 | out += Decompiler::GetCommonDeclarations(); |
| 20 | 20 | ||
| 21 | out += R"( | 21 | out += R"( |
| 22 | out gl_PerVertex { | ||
| 23 | vec4 gl_Position; | ||
| 24 | }; | ||
| 25 | 22 | ||
| 26 | layout (location = 0) out vec4 position; | 23 | layout (location = 0) out vec4 position; |
| 27 | 24 | ||
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index f1b40e7f5..550ca856c 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -142,7 +142,6 @@ void SwizzledData(u8* swizzled_data, u8* unswizzled_data, const bool unswizzle, | |||
| 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 blocks = blocks_on_x * blocks_on_y * blocks_on_z; | ||
| 146 | const u32 gob_size = gob_x_bytes * gob_elements_y * gob_elements_z; | 145 | const u32 gob_size = gob_x_bytes * gob_elements_y * gob_elements_z; |
| 147 | const u32 xy_block_size = gob_size * block_height; | 146 | const u32 xy_block_size = gob_size * block_height; |
| 148 | const u32 block_size = xy_block_size * block_depth; | 147 | const u32 block_size = xy_block_size * block_depth; |
| @@ -320,13 +319,13 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 320 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, | 319 | std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height, u32 depth, |
| 321 | u32 block_height, u32 block_depth) { | 320 | u32 block_height, u32 block_depth) { |
| 322 | if (tiled) { | 321 | if (tiled) { |
| 323 | const u32 gobs_in_x = 64 / bytes_per_pixel; | 322 | const u32 gobs_in_x = 64; |
| 324 | const u32 gobs_in_y = 8; | 323 | const u32 gobs_in_y = 8; |
| 325 | const u32 gobs_in_z = 1; | 324 | const u32 gobs_in_z = 1; |
| 326 | const u32 aligned_width = Common::AlignUp(width, gobs_in_x); | 325 | const u32 aligned_width = Common::AlignUp(width * bytes_per_pixel, gobs_in_x); |
| 327 | const u32 aligned_height = Common::AlignUp(height, gobs_in_y * block_height); | 326 | const u32 aligned_height = Common::AlignUp(height, gobs_in_y * block_height); |
| 328 | const u32 aligned_depth = Common::AlignUp(depth, gobs_in_z * block_depth); | 327 | const u32 aligned_depth = Common::AlignUp(depth, gobs_in_z * block_depth); |
| 329 | return aligned_width * aligned_height * aligned_depth * bytes_per_pixel; | 328 | return aligned_width * aligned_height * aligned_depth; |
| 330 | } else { | 329 | } else { |
| 331 | return width * height * depth * bytes_per_pixel; | 330 | return width * height * depth * bytes_per_pixel; |
| 332 | } | 331 | } |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index e8ab23326..39eef8858 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | #include "common/microprofile.h" | 9 | #include "common/microprofile.h" |
| 10 | #include "common/scm_rev.h" | 10 | #include "common/scm_rev.h" |
| 11 | #include "common/string_util.h" | ||
| 12 | #include "core/core.h" | 11 | #include "core/core.h" |
| 13 | #include "core/frontend/framebuffer_layout.h" | 12 | #include "core/frontend/framebuffer_layout.h" |
| 14 | #include "core/settings.h" | 13 | #include "core/settings.h" |
| @@ -107,9 +106,8 @@ private: | |||
| 107 | GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) | 106 | GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) |
| 108 | : QWidget(parent), child(nullptr), emu_thread(emu_thread) { | 107 | : QWidget(parent), child(nullptr), emu_thread(emu_thread) { |
| 109 | 108 | ||
| 110 | std::string window_title = fmt::format("yuzu {} | {}-{}", Common::g_build_name, | 109 | setWindowTitle(QStringLiteral("yuzu %1 | %2-%3") |
| 111 | Common::g_scm_branch, Common::g_scm_desc); | 110 | .arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc)); |
| 112 | setWindowTitle(QString::fromStdString(window_title)); | ||
| 113 | setAttribute(Qt::WA_AcceptTouchEvents); | 111 | setAttribute(Qt::WA_AcceptTouchEvents); |
| 114 | 112 | ||
| 115 | InputCommon::Init(); | 113 | InputCommon::Init(); |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1fe9a7edd..d4fd60a73 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -13,11 +13,16 @@ Config::Config() { | |||
| 13 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. | 13 | // TODO: Don't hardcode the path; let the frontend decide where to put the config files. |
| 14 | qt_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini"; | 14 | qt_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini"; |
| 15 | FileUtil::CreateFullPath(qt_config_loc); | 15 | FileUtil::CreateFullPath(qt_config_loc); |
| 16 | qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat); | 16 | qt_config = |
| 17 | std::make_unique<QSettings>(QString::fromStdString(qt_config_loc), QSettings::IniFormat); | ||
| 17 | 18 | ||
| 18 | Reload(); | 19 | Reload(); |
| 19 | } | 20 | } |
| 20 | 21 | ||
| 22 | Config::~Config() { | ||
| 23 | Save(); | ||
| 24 | } | ||
| 25 | |||
| 21 | const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = { | 26 | const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = { |
| 22 | Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q, | 27 | Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q, |
| 23 | Qt::Key_W, Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T, | 28 | Qt::Key_W, Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T, |
| @@ -342,9 +347,3 @@ void Config::Reload() { | |||
| 342 | void Config::Save() { | 347 | void Config::Save() { |
| 343 | SaveValues(); | 348 | SaveValues(); |
| 344 | } | 349 | } |
| 345 | |||
| 346 | Config::~Config() { | ||
| 347 | Save(); | ||
| 348 | |||
| 349 | delete qt_config; | ||
| 350 | } | ||
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index cbf745ea2..9c99c1b75 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <memory> | ||
| 8 | #include <string> | 9 | #include <string> |
| 9 | #include <QVariant> | 10 | #include <QVariant> |
| 10 | #include "core/settings.h" | 11 | #include "core/settings.h" |
| @@ -12,12 +13,6 @@ | |||
| 12 | class QSettings; | 13 | class QSettings; |
| 13 | 14 | ||
| 14 | class Config { | 15 | class Config { |
| 15 | QSettings* qt_config; | ||
| 16 | std::string qt_config_loc; | ||
| 17 | |||
| 18 | void ReadValues(); | ||
| 19 | void SaveValues(); | ||
| 20 | |||
| 21 | public: | 16 | public: |
| 22 | Config(); | 17 | Config(); |
| 23 | ~Config(); | 18 | ~Config(); |
| @@ -27,4 +22,11 @@ public: | |||
| 27 | 22 | ||
| 28 | static const std::array<int, Settings::NativeButton::NumButtons> default_buttons; | 23 | static const std::array<int, Settings::NativeButton::NumButtons> default_buttons; |
| 29 | static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs; | 24 | static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs; |
| 25 | |||
| 26 | private: | ||
| 27 | void ReadValues(); | ||
| 28 | void SaveValues(); | ||
| 29 | |||
| 30 | std::unique_ptr<QSettings> qt_config; | ||
| 31 | std::string qt_config_loc; | ||
| 30 | }; | 32 | }; |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 83cc49dfc..0bc307e99 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -153,7 +153,7 @@ void ConfigureSystem::UpdateCurrentUser() { | |||
| 153 | ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS); | 153 | ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS); |
| 154 | 154 | ||
| 155 | const auto& current_user = profile_manager->GetUser(Settings::values.current_user); | 155 | const auto& current_user = profile_manager->GetUser(Settings::values.current_user); |
| 156 | ASSERT(current_user != boost::none); | 156 | ASSERT(current_user != std::nullopt); |
| 157 | const auto username = GetAccountUsername(*current_user); | 157 | const auto username = GetAccountUsername(*current_user); |
| 158 | 158 | ||
| 159 | scene->clear(); | 159 | scene->clear(); |
| @@ -252,7 +252,7 @@ void ConfigureSystem::AddUser() { | |||
| 252 | void ConfigureSystem::RenameUser() { | 252 | void ConfigureSystem::RenameUser() { |
| 253 | const auto user = tree_view->currentIndex().row(); | 253 | const auto user = tree_view->currentIndex().row(); |
| 254 | const auto uuid = profile_manager->GetUser(user); | 254 | const auto uuid = profile_manager->GetUser(user); |
| 255 | ASSERT(uuid != boost::none); | 255 | ASSERT(uuid != std::nullopt); |
| 256 | const auto username = GetAccountUsername(*uuid); | 256 | const auto username = GetAccountUsername(*uuid); |
| 257 | 257 | ||
| 258 | Service::Account::ProfileBase profile; | 258 | Service::Account::ProfileBase profile; |
| @@ -292,7 +292,7 @@ void ConfigureSystem::RenameUser() { | |||
| 292 | void ConfigureSystem::DeleteUser() { | 292 | void ConfigureSystem::DeleteUser() { |
| 293 | const auto index = tree_view->currentIndex().row(); | 293 | const auto index = tree_view->currentIndex().row(); |
| 294 | const auto uuid = profile_manager->GetUser(index); | 294 | const auto uuid = profile_manager->GetUser(index); |
| 295 | ASSERT(uuid != boost::none); | 295 | ASSERT(uuid != std::nullopt); |
| 296 | const auto username = GetAccountUsername(*uuid); | 296 | const auto username = GetAccountUsername(*uuid); |
| 297 | 297 | ||
| 298 | const auto confirm = | 298 | const auto confirm = |
| @@ -320,7 +320,7 @@ void ConfigureSystem::DeleteUser() { | |||
| 320 | void ConfigureSystem::SetUserImage() { | 320 | void ConfigureSystem::SetUserImage() { |
| 321 | const auto index = tree_view->currentIndex().row(); | 321 | const auto index = tree_view->currentIndex().row(); |
| 322 | const auto uuid = profile_manager->GetUser(index); | 322 | const auto uuid = profile_manager->GetUser(index); |
| 323 | ASSERT(uuid != boost::none); | 323 | ASSERT(uuid != std::nullopt); |
| 324 | const auto username = GetAccountUsername(*uuid); | 324 | const auto username = GetAccountUsername(*uuid); |
| 325 | 325 | ||
| 326 | const auto file = QFileDialog::getOpenFileName(this, tr("Select User Image"), QString(), | 326 | const auto file = QFileDialog::getOpenFileName(this, tr("Select User Image"), QString(), |
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp index b5c88f944..67ed0ba6d 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp +++ b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <map> | ||
| 6 | #include <QLabel> | 5 | #include <QLabel> |
| 7 | #include <QMetaType> | 6 | #include <QMetaType> |
| 8 | #include <QPushButton> | 7 | #include <QPushButton> |
| @@ -32,21 +31,8 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const { | |||
| 32 | switch (role) { | 31 | switch (role) { |
| 33 | case Qt::DisplayRole: { | 32 | case Qt::DisplayRole: { |
| 34 | if (index.column() == 0) { | 33 | if (index.column() == 0) { |
| 35 | static const std::map<Tegra::DebugContext::Event, QString> map = { | 34 | return DebugContextEventToString(event); |
| 36 | {Tegra::DebugContext::Event::MaxwellCommandLoaded, tr("Maxwell command loaded")}, | ||
| 37 | {Tegra::DebugContext::Event::MaxwellCommandProcessed, | ||
| 38 | tr("Maxwell command processed")}, | ||
| 39 | {Tegra::DebugContext::Event::IncomingPrimitiveBatch, | ||
| 40 | tr("Incoming primitive batch")}, | ||
| 41 | {Tegra::DebugContext::Event::FinishedPrimitiveBatch, | ||
| 42 | tr("Finished primitive batch")}, | ||
| 43 | }; | ||
| 44 | |||
| 45 | DEBUG_ASSERT(map.size() == | ||
| 46 | static_cast<std::size_t>(Tegra::DebugContext::Event::NumEvents)); | ||
| 47 | return (map.find(event) != map.end()) ? map.at(event) : QString(); | ||
| 48 | } | 35 | } |
| 49 | |||
| 50 | break; | 36 | break; |
| 51 | } | 37 | } |
| 52 | 38 | ||
| @@ -128,6 +114,23 @@ void BreakPointModel::OnResumed() { | |||
| 128 | active_breakpoint = context->active_breakpoint; | 114 | active_breakpoint = context->active_breakpoint; |
| 129 | } | 115 | } |
| 130 | 116 | ||
| 117 | QString BreakPointModel::DebugContextEventToString(Tegra::DebugContext::Event event) { | ||
| 118 | switch (event) { | ||
| 119 | case Tegra::DebugContext::Event::MaxwellCommandLoaded: | ||
| 120 | return tr("Maxwell command loaded"); | ||
| 121 | case Tegra::DebugContext::Event::MaxwellCommandProcessed: | ||
| 122 | return tr("Maxwell command processed"); | ||
| 123 | case Tegra::DebugContext::Event::IncomingPrimitiveBatch: | ||
| 124 | return tr("Incoming primitive batch"); | ||
| 125 | case Tegra::DebugContext::Event::FinishedPrimitiveBatch: | ||
| 126 | return tr("Finished primitive batch"); | ||
| 127 | case Tegra::DebugContext::Event::NumEvents: | ||
| 128 | break; | ||
| 129 | } | ||
| 130 | |||
| 131 | return tr("Unknown debug context event"); | ||
| 132 | } | ||
| 133 | |||
| 131 | GraphicsBreakPointsWidget::GraphicsBreakPointsWidget( | 134 | GraphicsBreakPointsWidget::GraphicsBreakPointsWidget( |
| 132 | std::shared_ptr<Tegra::DebugContext> debug_context, QWidget* parent) | 135 | std::shared_ptr<Tegra::DebugContext> debug_context, QWidget* parent) |
| 133 | : QDockWidget(tr("Maxwell Breakpoints"), parent), Tegra::DebugContext::BreakPointObserver( | 136 | : QDockWidget(tr("Maxwell Breakpoints"), parent), Tegra::DebugContext::BreakPointObserver( |
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h index 7112b87e6..fb488e38f 100644 --- a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h +++ b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h | |||
| @@ -29,6 +29,8 @@ public: | |||
| 29 | void OnResumed(); | 29 | void OnResumed(); |
| 30 | 30 | ||
| 31 | private: | 31 | private: |
| 32 | static QString DebugContextEventToString(Tegra::DebugContext::Event event); | ||
| 33 | |||
| 32 | std::weak_ptr<Tegra::DebugContext> context_weak; | 34 | std::weak_ptr<Tegra::DebugContext> context_weak; |
| 33 | bool at_breakpoint; | 35 | bool at_breakpoint; |
| 34 | Tegra::DebugContext::Event active_breakpoint; | 36 | Tegra::DebugContext::Event active_breakpoint; |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 67890455a..a5a4aa432 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <fmt/format.h> | 16 | #include <fmt/format.h> |
| 17 | #include "common/common_paths.h" | 17 | #include "common/common_paths.h" |
| 18 | #include "common/common_types.h" | 18 | #include "common/common_types.h" |
| 19 | #include "common/file_util.h" | ||
| 20 | #include "common/logging/log.h" | 19 | #include "common/logging/log.h" |
| 21 | #include "core/file_sys/patch_manager.h" | 20 | #include "core/file_sys/patch_manager.h" |
| 22 | #include "yuzu/compatibility_list.h" | 21 | #include "yuzu/compatibility_list.h" |
| @@ -217,11 +216,11 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent) | |||
| 217 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); | 216 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); |
| 218 | 217 | ||
| 219 | item_model->insertColumns(0, COLUMN_COUNT); | 218 | item_model->insertColumns(0, COLUMN_COUNT); |
| 220 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, "Name"); | 219 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); |
| 221 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, "Compatibility"); | 220 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); |
| 222 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, "Add-ons"); | 221 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); |
| 223 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, "File type"); | 222 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); |
| 224 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, "Size"); | 223 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); |
| 225 | 224 | ||
| 226 | connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); | 225 | connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); |
| 227 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); | 226 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); |
| @@ -387,9 +386,9 @@ void GameList::LoadCompatibilityList() { | |||
| 387 | } | 386 | } |
| 388 | 387 | ||
| 389 | void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { | 388 | void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { |
| 390 | if (!FileUtil::Exists(dir_path.toStdString()) || | 389 | const QFileInfo dir_info{dir_path}; |
| 391 | !FileUtil::IsDirectory(dir_path.toStdString())) { | 390 | if (!dir_info.exists() || !dir_info.isDir()) { |
| 392 | LOG_ERROR(Frontend, "Could not find game list folder at {}", dir_path.toLocal8Bit().data()); | 391 | LOG_ERROR(Frontend, "Could not find game list folder at {}", dir_path.toStdString()); |
| 393 | search_field->setFilterResult(0, 0); | 392 | search_field->setFilterResult(0, 0); |
| 394 | return; | 393 | return; |
| 395 | } | 394 | } |
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 3881aba5f..3d865a12d 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -62,19 +62,24 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager, | |||
| 62 | FileSys::VirtualFile update_raw; | 62 | FileSys::VirtualFile update_raw; |
| 63 | loader.ReadUpdateRaw(update_raw); | 63 | loader.ReadUpdateRaw(update_raw); |
| 64 | for (const auto& kv : patch_manager.GetPatchVersionNames(update_raw)) { | 64 | for (const auto& kv : patch_manager.GetPatchVersionNames(update_raw)) { |
| 65 | if (!updatable && kv.first == "Update") | 65 | const bool is_update = kv.first == "Update"; |
| 66 | if (!updatable && is_update) { | ||
| 66 | continue; | 67 | continue; |
| 68 | } | ||
| 69 | |||
| 70 | const QString type = QString::fromStdString(kv.first); | ||
| 67 | 71 | ||
| 68 | if (kv.second.empty()) { | 72 | if (kv.second.empty()) { |
| 69 | out.append(fmt::format("{}\n", kv.first).c_str()); | 73 | out.append(QStringLiteral("%1\n").arg(type)); |
| 70 | } else { | 74 | } else { |
| 71 | auto ver = kv.second; | 75 | auto ver = kv.second; |
| 72 | 76 | ||
| 73 | // Display container name for packed updates | 77 | // Display container name for packed updates |
| 74 | if (ver == "PACKED" && kv.first == "Update") | 78 | if (is_update && ver == "PACKED") { |
| 75 | ver = Loader::GetFileTypeString(loader.GetFileType()); | 79 | ver = Loader::GetFileTypeString(loader.GetFileType()); |
| 80 | } | ||
| 76 | 81 | ||
| 77 | out.append(fmt::format("{} ({})\n", kv.first, ver).c_str()); | 82 | out.append(QStringLiteral("%1 (%2)\n").arg(type, QString::fromStdString(ver))); |
| 78 | } | 83 | } |
| 79 | } | 84 | } |
| 80 | 85 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 47f494841..55508b1e1 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -785,7 +785,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 785 | ASSERT(index != -1 && index < 8); | 785 | ASSERT(index != -1 && index < 8); |
| 786 | 786 | ||
| 787 | const auto user_id = manager.GetUser(index); | 787 | const auto user_id = manager.GetUser(index); |
| 788 | ASSERT(user_id != boost::none); | 788 | ASSERT(user_id != std::nullopt); |
| 789 | path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser, | 789 | path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser, |
| 790 | FileSys::SaveDataType::SaveData, | 790 | FileSys::SaveDataType::SaveData, |
| 791 | program_id, user_id->uuid, 0); | 791 | program_id, user_id->uuid, 0); |