Volume: Use more appropriate types for some returned values

Disc number is changed from bool to u8, and revision is changed from
int to u16 (WADs can use all 16 bits, but discs can only use 8 bits).
This commit is contained in:
JosJuice
2015-05-29 21:14:02 +02:00
parent d1d284e784
commit 301218a103
15 changed files with 54 additions and 49 deletions

View File

@ -25,7 +25,7 @@
#include "DolphinQt/Utils/Resources.h"
#include "DolphinQt/Utils/Utils.h"
static const u32 CACHE_REVISION = 0x007;
static const u32 CACHE_REVISION = 0x008;
static const u32 DATASTREAM_REVISION = 15; // Introduced in Qt 5.2
static QMap<DiscIO::IVolume::ELanguage, QString> ConvertLocalizedStrings(std::map<DiscIO::IVolume::ELanguage, std::string> strings)
@ -100,7 +100,7 @@ GameFile::GameFile(const QString& fileName)
m_unique_id = QString::fromStdString(volume->GetUniqueID());
m_compressed = DiscIO::IsCompressedBlob(fileName.toStdString());
m_is_disc_two = volume->IsDiscTwo();
m_disc_number = volume->GetDiscNumber();
m_revision = volume->GetRevision();
QFileInfo info(m_file_name);
@ -180,7 +180,7 @@ bool GameFile::LoadFromCache()
>> m_banner
>> m_compressed
>> m_platform
>> m_is_disc_two
>> m_disc_number
>> m_revision;
m_country = (DiscIO::IVolume::ECountry)country;
m_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(names);
@ -220,7 +220,7 @@ void GameFile::SaveToCache()
<< m_banner
<< m_compressed
<< m_platform
<< m_is_disc_two
<< m_disc_number
<< m_revision;
}

View File

@ -27,7 +27,7 @@ public:
QString GetDescription(DiscIO::IVolume::ELanguage language) const;
QString GetDescription() const;
QString GetCompany() const;
int GetRevision() const { return m_revision; }
u16 GetRevision() const { return m_revision; }
const QString GetUniqueID() const { return m_unique_id; }
const QString GetWiiFSPath() const;
DiscIO::IVolume::ECountry GetCountry() const { return m_country; }
@ -37,7 +37,8 @@ public:
bool IsCompressed() const { return m_compressed; }
u64 GetFileSize() const { return m_file_size; }
u64 GetVolumeSize() const { return m_volume_size; }
bool IsDiscTwo() const { return m_is_disc_two; }
// 0 is the first disc, 1 is the second disc
u8 GetDiscNumber() const { return m_disc_number; }
const QPixmap GetBitmap() const { return m_banner; }
enum
@ -66,12 +67,12 @@ private:
DiscIO::IVolume::ECountry m_country;
int m_platform;
int m_revision = 0;
u16 m_revision = 0;
QPixmap m_banner;
bool m_valid = false;
bool m_compressed = false;
bool m_is_disc_two = false;
u8 m_disc_number = 0;
bool LoadFromCache();
void SaveToCache();