mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-12 03:52:53 +00:00
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.
This commit is contained in:
parent
4a6ba58073
commit
5c4259ec1a
|
@ -36,18 +36,20 @@ std::string LanguageEntry::GetDeveloperName() const {
|
||||||
developer_name.size());
|
developer_name.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
NACP::NACP(VirtualFile file) : raw(std::make_unique<RawNACP>()) {
|
NACP::NACP() : raw{} {}
|
||||||
file->ReadObject(raw.get());
|
|
||||||
|
NACP::NACP(VirtualFile file) {
|
||||||
|
file->ReadObject(&raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
NACP::~NACP() = default;
|
NACP::~NACP() = default;
|
||||||
|
|
||||||
const LanguageEntry& NACP::GetLanguageEntry(Language language) const {
|
const LanguageEntry& NACP::GetLanguageEntry(Language language) const {
|
||||||
if (language != Language::Default) {
|
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())
|
if (!language_entry.GetApplicationName().empty())
|
||||||
return language_entry;
|
return language_entry;
|
||||||
}
|
}
|
||||||
|
@ -65,21 +67,21 @@ std::string NACP::GetDeveloperName(Language language) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NACP::GetTitleId() const {
|
u64 NACP::GetTitleId() const {
|
||||||
return raw->title_id;
|
return raw.title_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NACP::GetDLCBaseTitleId() const {
|
u64 NACP::GetDLCBaseTitleId() const {
|
||||||
return raw->dlc_base_title_id;
|
return raw.dlc_base_title_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string NACP::GetVersionString() const {
|
std::string NACP::GetVersionString() const {
|
||||||
return Common::StringFromFixedZeroTerminatedBuffer(raw->version_string.data(),
|
return Common::StringFromFixedZeroTerminatedBuffer(raw.version_string.data(),
|
||||||
raw->version_string.size());
|
raw.version_string.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> NACP::GetRawBytes() const {
|
std::vector<u8> NACP::GetRawBytes() const {
|
||||||
std::vector<u8> out(sizeof(RawNACP));
|
std::vector<u8> out(sizeof(RawNACP));
|
||||||
std::memcpy(out.data(), raw.get(), sizeof(RawNACP));
|
std::memcpy(out.data(), &raw, sizeof(RawNACP));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
|
@ -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.
|
// These store application name, dev name, title id, and other miscellaneous data.
|
||||||
class NACP {
|
class NACP {
|
||||||
public:
|
public:
|
||||||
|
explicit NACP();
|
||||||
explicit NACP(VirtualFile file);
|
explicit NACP(VirtualFile file);
|
||||||
~NACP();
|
~NACP();
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ public:
|
||||||
std::vector<u8> GetRawBytes() const;
|
std::vector<u8> GetRawBytes() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<RawNACP> raw;
|
RawNACP raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|
Loading…
Reference in a new issue