diff options
| author | 2018-12-06 20:25:32 -0500 | |
|---|---|---|
| committer | 2018-12-27 00:16:55 -0500 | |
| commit | 5c4259ec1a499528e132b1d41f7559f73bfd1143 (patch) | |
| tree | 0e91d08e514f4e3919e38e59d88cd61d617e7250 /src | |
| parent | vfs: Add reinterpret_casts to WriteArray and Object (diff) | |
| download | yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.gz yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.xz yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.zip | |
control_metadata: Use value member instead of unique_ptr to store struct
Serves no actual purpose in this instance besides making NACP's copy assignment deleted, which is not intended behavior.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/control_metadata.cpp | 20 | ||||
| -rw-r--r-- | src/core/file_sys/control_metadata.h | 3 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index e065e592f..fe2077f94 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp | |||
| @@ -36,18 +36,20 @@ std::string LanguageEntry::GetDeveloperName() const { | |||
| 36 | developer_name.size()); | 36 | developer_name.size()); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | NACP::NACP(VirtualFile file) : raw(std::make_unique<RawNACP>()) { | 39 | NACP::NACP() : raw{} {} |
| 40 | file->ReadObject(raw.get()); | 40 | |
| 41 | NACP::NACP(VirtualFile file) { | ||
| 42 | file->ReadObject(&raw); | ||
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | NACP::~NACP() = default; | 45 | NACP::~NACP() = default; |
| 44 | 46 | ||
| 45 | const LanguageEntry& NACP::GetLanguageEntry(Language language) const { | 47 | const LanguageEntry& NACP::GetLanguageEntry(Language language) const { |
| 46 | if (language != Language::Default) { | 48 | if (language != Language::Default) { |
| 47 | return raw->language_entries.at(static_cast<u8>(language)); | 49 | return raw.language_entries.at(static_cast<u8>(language)); |
| 48 | } | 50 | } |
| 49 | 51 | ||
| 50 | for (const auto& language_entry : raw->language_entries) { | 52 | for (const auto& language_entry : raw.language_entries) { |
| 51 | if (!language_entry.GetApplicationName().empty()) | 53 | if (!language_entry.GetApplicationName().empty()) |
| 52 | return language_entry; | 54 | return language_entry; |
| 53 | } | 55 | } |
| @@ -65,21 +67,21 @@ std::string NACP::GetDeveloperName(Language language) const { | |||
| 65 | } | 67 | } |
| 66 | 68 | ||
| 67 | u64 NACP::GetTitleId() const { | 69 | u64 NACP::GetTitleId() const { |
| 68 | return raw->title_id; | 70 | return raw.title_id; |
| 69 | } | 71 | } |
| 70 | 72 | ||
| 71 | u64 NACP::GetDLCBaseTitleId() const { | 73 | u64 NACP::GetDLCBaseTitleId() const { |
| 72 | return raw->dlc_base_title_id; | 74 | return raw.dlc_base_title_id; |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | std::string NACP::GetVersionString() const { | 77 | std::string NACP::GetVersionString() const { |
| 76 | return Common::StringFromFixedZeroTerminatedBuffer(raw->version_string.data(), | 78 | return Common::StringFromFixedZeroTerminatedBuffer(raw.version_string.data(), |
| 77 | raw->version_string.size()); | 79 | raw.version_string.size()); |
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | std::vector<u8> NACP::GetRawBytes() const { | 82 | std::vector<u8> NACP::GetRawBytes() const { |
| 81 | std::vector<u8> out(sizeof(RawNACP)); | 83 | std::vector<u8> out(sizeof(RawNACP)); |
| 82 | std::memcpy(out.data(), raw.get(), sizeof(RawNACP)); | 84 | std::memcpy(out.data(), &raw, sizeof(RawNACP)); |
| 83 | return out; | 85 | return out; |
| 84 | } | 86 | } |
| 85 | } // namespace FileSys | 87 | } // namespace FileSys |
diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h index bfaad46b4..d5c2ed2b5 100644 --- a/src/core/file_sys/control_metadata.h +++ b/src/core/file_sys/control_metadata.h | |||
| @@ -72,6 +72,7 @@ extern const std::array<const char*, 15> LANGUAGE_NAMES; | |||
| 72 | // These store application name, dev name, title id, and other miscellaneous data. | 72 | // These store application name, dev name, title id, and other miscellaneous data. |
| 73 | class NACP { | 73 | class NACP { |
| 74 | public: | 74 | public: |
| 75 | explicit NACP(); | ||
| 75 | explicit NACP(VirtualFile file); | 76 | explicit NACP(VirtualFile file); |
| 76 | ~NACP(); | 77 | ~NACP(); |
| 77 | 78 | ||
| @@ -84,7 +85,7 @@ public: | |||
| 84 | std::vector<u8> GetRawBytes() const; | 85 | std::vector<u8> GetRawBytes() const; |
| 85 | 86 | ||
| 86 | private: | 87 | private: |
| 87 | std::unique_ptr<RawNACP> raw; | 88 | RawNACP raw; |
| 88 | }; | 89 | }; |
| 89 | 90 | ||
| 90 | } // namespace FileSys | 91 | } // namespace FileSys |