[XAM] xdbf.h: const-ify some parameters
This commit is contained in:
parent
dc9920df89
commit
0feab18e54
|
@ -124,7 +124,7 @@ Entry* XdbfFile::GetEntry(uint16_t section, uint64_t id) const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool XdbfFile::UpdateEntry(Entry entry) {
|
||||
bool XdbfFile::UpdateEntry(const Entry& entry) {
|
||||
for (size_t i = 0; i < entries_.size(); i++) {
|
||||
auto* ent = (Entry*)&entries_[i];
|
||||
if (ent->info.section != entry.info.section ||
|
||||
|
@ -367,7 +367,7 @@ uint32_t GpdFile::GetTitles(std::vector<TitlePlayed>* titles) const {
|
|||
return title_count;
|
||||
}
|
||||
|
||||
bool GpdFile::UpdateAchievement(Achievement ach) {
|
||||
bool GpdFile::UpdateAchievement(const Achievement& ach) {
|
||||
Entry ent;
|
||||
ent.info.section = static_cast<uint16_t>(GpdSection::kAchievement);
|
||||
ent.info.id = ach.id;
|
||||
|
@ -408,7 +408,7 @@ bool GpdFile::UpdateAchievement(Achievement ach) {
|
|||
return UpdateEntry(ent);
|
||||
}
|
||||
|
||||
bool GpdFile::UpdateTitle(TitlePlayed title) {
|
||||
bool GpdFile::UpdateTitle(const TitlePlayed& title) {
|
||||
Entry ent;
|
||||
ent.info.section = static_cast<uint16_t>(GpdSection::kTitle);
|
||||
ent.info.id = title.title_id;
|
||||
|
@ -422,7 +422,7 @@ bool GpdFile::UpdateTitle(TitlePlayed title) {
|
|||
ent.data.resize(est_size);
|
||||
memset(ent.data.data(), 0, est_size);
|
||||
|
||||
// convert XdbfTitlePlayed to GPD title
|
||||
// convert TitlePlayed to GPD title
|
||||
auto* title_data = reinterpret_cast<X_XDBF_GPD_TITLEPLAYED*>(ent.data.data());
|
||||
title.WriteGPD(title_data);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ struct TitlePlayed {
|
|||
title_name = ReadNullTermString((const wchar_t*)txt_ptr);
|
||||
}
|
||||
|
||||
void WriteGPD(X_XDBF_GPD_TITLEPLAYED* dest) {
|
||||
void WriteGPD(X_XDBF_GPD_TITLEPLAYED* dest) const {
|
||||
dest->title_id = title_id;
|
||||
dest->achievements_possible = achievements_possible;
|
||||
dest->achievements_earned = achievements_earned;
|
||||
|
@ -244,7 +244,7 @@ class XdbfFile {
|
|||
Entry* GetEntry(uint16_t section, uint64_t id) const;
|
||||
|
||||
// Updates (or adds) an entry
|
||||
bool UpdateEntry(Entry entry);
|
||||
bool UpdateEntry(const Entry& entry);
|
||||
|
||||
protected:
|
||||
X_XDBF_HEADER header_;
|
||||
|
@ -277,10 +277,10 @@ class GpdFile : public XdbfFile {
|
|||
uint32_t GetTitles(std::vector<TitlePlayed>* titles) const;
|
||||
|
||||
// Updates (or adds) an achievement
|
||||
bool UpdateAchievement(Achievement ach);
|
||||
bool UpdateAchievement(const Achievement& ach);
|
||||
|
||||
// Updates (or adds) a title
|
||||
bool UpdateTitle(TitlePlayed title);
|
||||
bool UpdateTitle(const TitlePlayed& title);
|
||||
|
||||
uint32_t GetTitleId() { return title_id_; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue