DiscIO: Add a way to get blob type

This commit is contained in:
JosJuice
2015-09-27 14:01:12 +02:00
parent 34c020352f
commit be7e0554d2
19 changed files with 65 additions and 37 deletions

View File

@ -26,7 +26,7 @@
#include "DolphinQt/GameList/GameFile.h"
#include "DolphinQt/Utils/Utils.h"
static const u32 CACHE_REVISION = 0x00C; // Last changed in PR 2993
static const u32 CACHE_REVISION = 0x00D; // Last changed in PR 3097
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)
@ -109,11 +109,11 @@ GameFile::GameFile(const QString& fileName)
m_company = QString::fromStdString(volume->GetCompany());
m_country = volume->GetCountry();
m_blob_type = volume->GetBlobType();
m_file_size = volume->GetRawSize();
m_volume_size = volume->GetSize();
m_unique_id = QString::fromStdString(volume->GetUniqueID());
m_compressed = volume->IsCompressed();
m_disc_number = volume->GetDiscNumber();
m_revision = volume->GetRevision();
@ -181,6 +181,7 @@ bool GameFile::LoadFromCache()
u32 country;
u32 platform;
u32 blob_type;
QMap<u8, QString> short_names;
QMap<u8, QString> long_names;
QMap<u8, QString> descriptions;
@ -189,16 +190,17 @@ bool GameFile::LoadFromCache()
>> descriptions
>> m_company
>> m_unique_id
>> blob_type
>> m_file_size
>> m_volume_size
>> country
>> m_banner
>> m_compressed
>> platform
>> m_disc_number
>> m_revision;
m_country = (DiscIO::IVolume::ECountry)country;
m_platform = (DiscIO::IVolume::EPlatform)platform;
m_blob_type = (DiscIO::BlobType)blob_type;
m_short_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(short_names);
m_long_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(long_names);
m_descriptions = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(descriptions);
@ -231,11 +233,11 @@ void GameFile::SaveToCache()
<< CastLocalizedStrings<u8>(m_descriptions)
<< m_company
<< m_unique_id
<< (u32)m_blob_type
<< m_file_size
<< m_volume_size
<< (u32)m_country
<< m_banner
<< m_compressed
<< (u32)m_platform
<< m_disc_number
<< m_revision;

View File

@ -10,6 +10,7 @@
#include <string>
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"
@ -34,9 +35,14 @@ public:
const QString GetWiiFSPath() const;
DiscIO::IVolume::ECountry GetCountry() const { return m_country; }
DiscIO::IVolume::EPlatform GetPlatform() const { return m_platform; }
DiscIO::BlobType GetBlobType() const { m_blob_type; }
const QString GetIssues() const { return m_issues; }
int GetEmuState() const { return m_emu_state; }
bool IsCompressed() const { return m_compressed; }
bool IsCompressed() const
{
return m_blob_type == DiscIO::BlobType::GCZ || m_blob_type == DiscIO::BlobType::CISO ||
m_blob_type == DiscIO::BlobType::WBFS;
}
u64 GetFileSize() const { return m_file_size; }
u64 GetVolumeSize() const { return m_volume_size; }
// 0 is the first disc, 1 is the second disc
@ -68,11 +74,11 @@ private:
DiscIO::IVolume::ECountry m_country = DiscIO::IVolume::COUNTRY_UNKNOWN;
DiscIO::IVolume::EPlatform m_platform;
DiscIO::BlobType m_blob_type;
u16 m_revision = 0;
QPixmap m_banner;
bool m_valid = false;
bool m_compressed = false;
u8 m_disc_number = 0;
bool LoadFromCache();