diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-12-07 02:25:32 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-12-27 06:16:55 +0100 |
commit | 5c4259ec1a499528e132b1d41f7559f73bfd1143 (patch) | |
tree | 0e91d08e514f4e3919e38e59d88cd61d617e7250 | |
parent | vfs: Add reinterpret_casts to WriteArray and Object (diff) | |
download | yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.gz yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.bz2 yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.lz yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.xz yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.tar.zst yuzu-5c4259ec1a499528e132b1d41f7559f73bfd1143.zip |
-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 { developer_name.size()); } -NACP::NACP(VirtualFile file) : raw(std::make_unique<RawNACP>()) { - file->ReadObject(raw.get()); +NACP::NACP() : raw{} {} + +NACP::NACP(VirtualFile file) { + file->ReadObject(&raw); } NACP::~NACP() = default; const LanguageEntry& NACP::GetLanguageEntry(Language language) const { if (language != Language::Default) { - return raw->language_entries.at(static_cast<u8>(language)); + return raw.language_entries.at(static_cast<u8>(language)); } - for (const auto& language_entry : raw->language_entries) { + for (const auto& language_entry : raw.language_entries) { if (!language_entry.GetApplicationName().empty()) return language_entry; } @@ -65,21 +67,21 @@ std::string NACP::GetDeveloperName(Language language) const { } u64 NACP::GetTitleId() const { - return raw->title_id; + return raw.title_id; } u64 NACP::GetDLCBaseTitleId() const { - return raw->dlc_base_title_id; + return raw.dlc_base_title_id; } std::string NACP::GetVersionString() const { - return Common::StringFromFixedZeroTerminatedBuffer(raw->version_string.data(), - raw->version_string.size()); + return Common::StringFromFixedZeroTerminatedBuffer(raw.version_string.data(), + raw.version_string.size()); } std::vector<u8> NACP::GetRawBytes() const { std::vector<u8> out(sizeof(RawNACP)); - std::memcpy(out.data(), raw.get(), sizeof(RawNACP)); + std::memcpy(out.data(), &raw, sizeof(RawNACP)); return out; } } // 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; // These store application name, dev name, title id, and other miscellaneous data. class NACP { public: + explicit NACP(); explicit NACP(VirtualFile file); ~NACP(); @@ -84,7 +85,7 @@ public: std::vector<u8> GetRawBytes() const; private: - std::unique_ptr<RawNACP> raw; + RawNACP raw; }; } // namespace FileSys |