2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 23:43:35 -04:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2013-03-02 19:46:55 -06:00
|
|
|
#include <string>
|
2015-04-09 17:44:53 +02:00
|
|
|
#include <utility>
|
2014-02-17 05:18:15 -05:00
|
|
|
#include <vector>
|
2013-03-02 19:46:55 -06:00
|
|
|
|
2014-10-21 02:01:38 -04:00
|
|
|
#include "Common/Common.h"
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-10-21 02:01:38 -04:00
|
|
|
#include <wx/bitmap.h>
|
2016-06-24 10:43:46 +02:00
|
|
|
#include <wx/image.h>
|
2010-08-03 03:20:44 +00:00
|
|
|
|
2017-05-15 16:26:22 +02:00
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
class TitleDatabase;
|
|
|
|
}
|
|
|
|
|
2016-07-06 20:33:05 +02:00
|
|
|
namespace DiscIO
|
|
|
|
{
|
|
|
|
enum class BlobType;
|
|
|
|
enum class Country;
|
|
|
|
enum class Language;
|
2016-12-23 18:41:21 +01:00
|
|
|
enum class Region;
|
2016-07-06 20:33:05 +02:00
|
|
|
enum class Platform;
|
|
|
|
}
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
class PointerWrap;
|
2016-07-06 20:33:05 +02:00
|
|
|
|
2015-09-13 14:17:58 +02:00
|
|
|
class GameListItem
|
2008-12-08 04:46:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-06-20 16:36:59 -07:00
|
|
|
GameListItem() = default;
|
2017-06-26 22:19:51 +02:00
|
|
|
explicit GameListItem(const std::string& file_name);
|
2017-06-20 16:36:59 -07:00
|
|
|
~GameListItem() = default;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-05-14 00:00:01 +02:00
|
|
|
bool IsValid() const;
|
2017-06-25 20:13:42 -07:00
|
|
|
const std::string& GetFileName() const { return m_file_name; }
|
2016-07-06 20:33:05 +02:00
|
|
|
std::string GetName(DiscIO::Language language) const;
|
2016-06-24 10:43:46 +02:00
|
|
|
std::string GetName() const;
|
2016-10-03 05:35:27 -07:00
|
|
|
std::string GetUniqueIdentifier() const;
|
2016-07-06 20:33:05 +02:00
|
|
|
std::string GetDescription(DiscIO::Language language) const;
|
2016-06-24 10:43:46 +02:00
|
|
|
std::string GetDescription() const;
|
2016-07-06 20:33:05 +02:00
|
|
|
std::vector<DiscIO::Language> GetLanguages() const;
|
2016-06-24 10:43:46 +02:00
|
|
|
std::string GetCompany() const { return m_company; }
|
2017-06-25 20:13:42 -07:00
|
|
|
u16 GetRevision() const { return m_revision; }
|
2016-10-29 14:42:43 +02:00
|
|
|
const std::string& GetGameID() const { return m_game_id; }
|
2017-05-06 17:08:18 +02:00
|
|
|
u64 GetTitleID() const { return m_title_id; }
|
2016-06-24 10:43:46 +02:00
|
|
|
const std::string GetWiiFSPath() const;
|
2016-12-23 18:41:21 +01:00
|
|
|
DiscIO::Region GetRegion() const { return m_region; }
|
2017-06-25 20:13:42 -07:00
|
|
|
DiscIO::Country GetCountry() const { return m_country; }
|
|
|
|
DiscIO::Platform GetPlatform() const { return m_platform; }
|
2016-06-24 10:43:46 +02:00
|
|
|
DiscIO::BlobType GetBlobType() const { return m_blob_type; }
|
2017-06-25 20:13:42 -07:00
|
|
|
const std::string& GetIssues() const { return m_emu_state.issues; }
|
|
|
|
int GetEmuState() const { return m_emu_state.rating; }
|
|
|
|
u64 GetFileSize() const { return m_file_size; }
|
|
|
|
u64 GetVolumeSize() const { return m_volume_size; }
|
2016-06-24 10:43:46 +02:00
|
|
|
// 0 is the first disc, 1 is the second disc
|
|
|
|
u8 GetDiscNumber() const { return m_disc_number; }
|
2016-08-03 11:14:52 +00:00
|
|
|
// NOTE: Banner image is at the original resolution, use WxUtils::ScaleImageToBitmap
|
|
|
|
// to display it
|
2017-06-25 20:13:42 -07:00
|
|
|
const wxImage& GetBannerImage() const { return m_banner_wx; }
|
2016-06-24 10:43:46 +02:00
|
|
|
void DoState(PointerWrap& p);
|
2017-06-25 20:13:42 -07:00
|
|
|
bool BannerChanged();
|
|
|
|
void BannerCommit();
|
|
|
|
bool EmuStateChanged();
|
|
|
|
void EmuStateCommit();
|
2017-06-26 22:19:51 +02:00
|
|
|
bool CustomNameChanged(const Core::TitleDatabase& title_database);
|
|
|
|
void CustomNameCommit();
|
2009-06-06 07:36:22 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
private:
|
2017-06-25 20:13:42 -07:00
|
|
|
struct EmuState
|
|
|
|
{
|
|
|
|
int rating{};
|
|
|
|
std::string issues{};
|
|
|
|
bool operator!=(const EmuState& rhs) const
|
|
|
|
{
|
|
|
|
return rating != rhs.rating || issues != rhs.issues;
|
|
|
|
}
|
|
|
|
void DoState(PointerWrap& p);
|
|
|
|
};
|
|
|
|
struct Banner
|
|
|
|
{
|
|
|
|
std::vector<u8> buffer{};
|
|
|
|
int width{};
|
|
|
|
int height{};
|
|
|
|
bool empty() const { return buffer.empty(); }
|
|
|
|
void DoState(PointerWrap& p);
|
|
|
|
};
|
|
|
|
|
2017-06-20 16:36:59 -07:00
|
|
|
bool IsElfOrDol() const;
|
2017-06-25 20:13:42 -07:00
|
|
|
void ReadVolumeBanner(std::vector<u8>* image, const std::vector<u32>& buffer, int width,
|
|
|
|
int height);
|
|
|
|
// Outputs to m_banner_wx
|
2017-06-27 11:28:55 +02:00
|
|
|
bool SetWxBannerFromPNGFile(const std::string& path);
|
2017-06-27 11:36:50 +02:00
|
|
|
// Outputs to m_banner_wx
|
2017-06-25 20:13:42 -07:00
|
|
|
void SetWxBannerFromRaw(const Banner& banner);
|
2017-06-20 16:36:59 -07:00
|
|
|
|
2017-06-25 20:13:42 -07:00
|
|
|
// IMPORTANT: Nearly all data members must be save/restored in DoState.
|
2017-06-20 16:36:59 -07:00
|
|
|
// If anything is changed, make sure DoState handles it properly and
|
|
|
|
// GameListCtrl::CACHE_REVISION is incremented.
|
|
|
|
|
2017-06-25 20:13:42 -07:00
|
|
|
bool m_valid{};
|
|
|
|
std::string m_file_name{};
|
|
|
|
|
|
|
|
u64 m_file_size{};
|
|
|
|
u64 m_volume_size{};
|
|
|
|
|
|
|
|
std::map<DiscIO::Language, std::string> m_names{};
|
|
|
|
std::map<DiscIO::Language, std::string> m_descriptions{};
|
|
|
|
std::string m_company{};
|
|
|
|
std::string m_game_id{};
|
|
|
|
u64 m_title_id{};
|
|
|
|
|
|
|
|
DiscIO::Region m_region{};
|
|
|
|
DiscIO::Country m_country{};
|
|
|
|
DiscIO::Platform m_platform{};
|
|
|
|
DiscIO::BlobType m_blob_type{};
|
|
|
|
u16 m_revision{};
|
|
|
|
u8 m_disc_number{};
|
|
|
|
|
2017-06-27 11:36:50 +02:00
|
|
|
Banner m_volume_banner{};
|
2017-06-25 20:13:42 -07:00
|
|
|
EmuState m_emu_state{};
|
|
|
|
// Overridden name from TitleDatabase
|
|
|
|
std::string m_custom_name{};
|
|
|
|
|
|
|
|
// wxImage is not handled in DoState
|
|
|
|
wxImage m_banner_wx{};
|
|
|
|
|
|
|
|
// The following data members allow GameListCtrl to construct new GameListItems in a threadsafe
|
|
|
|
// way. They should not be handled in DoState.
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
EmuState emu_state;
|
2017-06-27 11:36:50 +02:00
|
|
|
Banner volume_banner;
|
2017-06-26 22:19:51 +02:00
|
|
|
std::string custom_name;
|
2017-06-25 20:13:42 -07:00
|
|
|
} m_pending{};
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|