From b6da2f6c68010048a8bf3bc338a1538ef825c373 Mon Sep 17 00:00:00 2001 From: emoose Date: Tue, 24 Dec 2019 15:59:08 +0000 Subject: [PATCH] [XAM] xdbf.h: const-ify some parameters --- src/xenia/kernel/xam/xdbf/xdbf.cc | 8 ++++---- src/xenia/kernel/xam/xdbf/xdbf.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xenia/kernel/xam/xdbf/xdbf.cc b/src/xenia/kernel/xam/xdbf/xdbf.cc index b06d424eb..fe79956fb 100644 --- a/src/xenia/kernel/xam/xdbf/xdbf.cc +++ b/src/xenia/kernel/xam/xdbf/xdbf.cc @@ -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* titles) const { return title_count; } -bool GpdFile::UpdateAchievement(Achievement ach) { +bool GpdFile::UpdateAchievement(const Achievement& ach) { Entry ent; ent.info.section = static_cast(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(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(ent.data.data()); title.WriteGPD(title_data); diff --git a/src/xenia/kernel/xam/xdbf/xdbf.h b/src/xenia/kernel/xam/xdbf/xdbf.h index e12fa802a..5b3d29bb2 100644 --- a/src/xenia/kernel/xam/xdbf/xdbf.h +++ b/src/xenia/kernel/xam/xdbf/xdbf.h @@ -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* 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_; }