2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:43:35 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2015-09-06 04:34:48 -06:00
|
|
|
#include <algorithm>
|
2014-02-17 03:18:15 -07:00
|
|
|
#include <cinttypes>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
2014-11-15 11:25:21 -07:00
|
|
|
#include <memory>
|
2008-12-07 22:30:24 -07:00
|
|
|
#include <string>
|
2015-09-13 06:17:58 -06:00
|
|
|
#include <unordered_map>
|
2015-04-09 09:44:53 -06:00
|
|
|
#include <utility>
|
2008-12-07 22:30:24 -07:00
|
|
|
#include <vector>
|
2014-11-17 18:11:34 -07:00
|
|
|
#include <wx/app.h>
|
2014-02-22 15:36:30 -07:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/filefn.h>
|
|
|
|
#include <wx/image.h>
|
2015-05-08 08:04:40 -06:00
|
|
|
#include <wx/toplevel.h>
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/ChunkFile.h"
|
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-07 19:06:58 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/Hash.h"
|
|
|
|
#include "Common/IniFile.h"
|
|
|
|
#include "Common/StringUtil.h"
|
|
|
|
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "Core/Boot/Boot.h"
|
2016-06-24 02:43:46 -06:00
|
|
|
#include "Core/ConfigManager.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
#include "DiscIO/Blob.h"
|
|
|
|
#include "DiscIO/Enums.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "DiscIO/Volume.h"
|
|
|
|
#include "DiscIO/VolumeCreator.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
|
|
|
|
#include "DolphinWX/ISOFile.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
static const u32 CACHE_REVISION = 0x127; // Last changed in PR 3309
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
#define DVD_BANNER_WIDTH 96
|
|
|
|
#define DVD_BANNER_HEIGHT 32
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
static std::string GetLanguageString(DiscIO::Language language,
|
|
|
|
std::map<DiscIO::Language, std::string> strings)
|
2015-04-09 09:44:53 -06:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
auto end = strings.end();
|
|
|
|
auto it = strings.find(language);
|
|
|
|
if (it != end)
|
|
|
|
return it->second;
|
|
|
|
|
2016-06-25 10:07:10 -06:00
|
|
|
// English tends to be a good fallback when the requested language isn't available
|
2016-07-06 12:33:05 -06:00
|
|
|
if (language != DiscIO::Language::LANGUAGE_ENGLISH)
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
2016-07-06 12:33:05 -06:00
|
|
|
it = strings.find(DiscIO::Language::LANGUAGE_ENGLISH);
|
2016-06-24 02:43:46 -06:00
|
|
|
if (it != end)
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If English isn't available either, just pick something
|
|
|
|
if (!strings.empty())
|
|
|
|
return strings.cbegin()->second;
|
|
|
|
|
|
|
|
return "";
|
2015-04-09 09:44:53 -06:00
|
|
|
}
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
GameListItem::GameListItem(const std::string& _rFileName,
|
|
|
|
const std::unordered_map<std::string, std::string>& custom_titles)
|
|
|
|
: m_FileName(_rFileName), m_title_id(0), m_emu_state(0), m_FileSize(0),
|
2016-07-06 12:33:05 -06:00
|
|
|
m_Country(DiscIO::Country::COUNTRY_UNKNOWN), m_Revision(0), m_Valid(false), m_ImageWidth(0),
|
2016-06-24 02:43:46 -06:00
|
|
|
m_ImageHeight(0), m_disc_number(0), m_has_custom_name(false)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (LoadFromCache())
|
|
|
|
{
|
|
|
|
m_Valid = true;
|
|
|
|
|
|
|
|
// Wii banners can only be read if there is a savefile,
|
|
|
|
// so sometimes caches don't contain banners. Let's check
|
|
|
|
// if a banner has become available after the cache was made.
|
|
|
|
if (m_pImage.empty())
|
|
|
|
{
|
|
|
|
std::vector<u32> buffer =
|
|
|
|
DiscIO::IVolume::GetWiiBanner(&m_ImageWidth, &m_ImageHeight, m_title_id);
|
|
|
|
ReadVolumeBanner(buffer, m_ImageWidth, m_ImageHeight);
|
|
|
|
if (!m_pImage.empty())
|
|
|
|
SaveToCache();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(_rFileName));
|
|
|
|
|
|
|
|
if (volume != nullptr)
|
|
|
|
{
|
|
|
|
m_Platform = volume->GetVolumeType();
|
|
|
|
|
|
|
|
m_descriptions = volume->GetDescriptions();
|
2016-02-29 01:52:15 -07:00
|
|
|
m_names = volume->GetLongNames();
|
|
|
|
if (m_names.empty())
|
|
|
|
m_names = volume->GetShortNames();
|
2016-07-06 12:33:05 -06:00
|
|
|
m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetLongMakers());
|
2016-02-29 01:52:15 -07:00
|
|
|
if (m_company.empty())
|
2016-07-06 12:33:05 -06:00
|
|
|
m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetShortMakers());
|
2016-06-24 02:43:46 -06:00
|
|
|
|
|
|
|
m_Country = volume->GetCountry();
|
|
|
|
m_blob_type = volume->GetBlobType();
|
|
|
|
m_FileSize = volume->GetRawSize();
|
|
|
|
m_VolumeSize = volume->GetSize();
|
|
|
|
|
|
|
|
m_UniqueID = volume->GetUniqueID();
|
|
|
|
volume->GetTitleID(&m_title_id);
|
|
|
|
m_disc_number = volume->GetDiscNumber();
|
|
|
|
m_Revision = volume->GetRevision();
|
|
|
|
|
|
|
|
std::vector<u32> buffer = volume->GetBanner(&m_ImageWidth, &m_ImageHeight);
|
|
|
|
ReadVolumeBanner(buffer, m_ImageWidth, m_ImageHeight);
|
|
|
|
|
|
|
|
m_Valid = true;
|
|
|
|
SaveToCache();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_company.empty() && m_UniqueID.size() >= 6)
|
|
|
|
m_company = DiscIO::GetCompanyFromID(m_UniqueID.substr(4, 2));
|
|
|
|
|
|
|
|
if (IsValid())
|
|
|
|
{
|
|
|
|
std::string game_id = m_UniqueID;
|
|
|
|
|
|
|
|
// Ignore publisher ID for WAD files
|
2016-07-06 12:33:05 -06:00
|
|
|
if (m_Platform == DiscIO::Platform::WII_WAD && game_id.size() > 4)
|
2016-06-24 02:43:46 -06:00
|
|
|
game_id.erase(4);
|
|
|
|
|
|
|
|
auto it = custom_titles.find(game_id);
|
|
|
|
if (it != custom_titles.end())
|
|
|
|
{
|
|
|
|
m_custom_name_titles_txt = it->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReloadINI();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!IsValid() && IsElfOrDol())
|
|
|
|
{
|
|
|
|
m_Valid = true;
|
|
|
|
m_FileSize = File::GetSize(_rFileName);
|
2016-07-06 12:33:05 -06:00
|
|
|
m_Platform = DiscIO::Platform::ELF_DOL;
|
2016-06-24 02:43:46 -06:00
|
|
|
m_blob_type = DiscIO::BlobType::DIRECTORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string path, name;
|
|
|
|
SplitPath(m_FileName, &path, &name, nullptr);
|
|
|
|
|
2016-06-25 10:07:10 -06:00
|
|
|
// A bit like the Homebrew Channel icon, except there can be multiple files
|
|
|
|
// in a folder with their own icons. Useful for those who don't want to have
|
|
|
|
// a Homebrew Channel-style folder structure.
|
2016-06-24 02:43:46 -06:00
|
|
|
if (ReadPNGBanner(path + name + ".png"))
|
|
|
|
return;
|
|
|
|
|
2016-06-25 10:07:10 -06:00
|
|
|
// Homebrew Channel icon. Typical for DOLs and ELFs,
|
|
|
|
// but can be also used with volumes.
|
2016-06-24 02:43:46 -06:00
|
|
|
if (ReadPNGBanner(path + "icon.png"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Volume banner. Typical for everything that isn't a DOL or ELF.
|
|
|
|
if (!m_pImage.empty())
|
|
|
|
{
|
|
|
|
wxImage image(m_ImageWidth, m_ImageHeight, &m_pImage[0], true);
|
|
|
|
m_Bitmap = ScaleBanner(&image);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback in case no banner is available.
|
|
|
|
ReadPNGBanner(File::GetSysDirectory() + RESOURCES_DIR + DIR_SEP + "nobanner.png");
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
GameListItem::~GameListItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-29 08:49:11 -06:00
|
|
|
void GameListItem::ReloadINI()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (!IsValid())
|
|
|
|
return;
|
|
|
|
|
|
|
|
IniFile ini = SConfig::LoadGameIni(m_UniqueID, m_Revision);
|
|
|
|
ini.GetIfExists("EmuState", "EmulationStateId", &m_emu_state, 0);
|
|
|
|
ini.GetIfExists("EmuState", "EmulationIssues", &m_issues, std::string());
|
|
|
|
|
|
|
|
m_custom_name.clear();
|
|
|
|
m_has_custom_name = ini.GetIfExists("EmuState", "Title", &m_custom_name);
|
|
|
|
if (!m_has_custom_name && !m_custom_name_titles_txt.empty())
|
|
|
|
{
|
|
|
|
m_custom_name = m_custom_name_titles_txt;
|
|
|
|
m_has_custom_name = true;
|
|
|
|
}
|
2016-05-29 08:49:11 -06:00
|
|
|
}
|
|
|
|
|
2008-12-07 22:30:24 -07:00
|
|
|
bool GameListItem::LoadFromCache()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return CChunkFileReader::Load<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void GameListItem::SaveToCache()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (!File::IsDirectory(File::GetUserPath(D_CACHE_IDX)))
|
|
|
|
File::CreateDir(File::GetUserPath(D_CACHE_IDX));
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
CChunkFileReader::Save<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void GameListItem::DoState(PointerWrap& p)
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
p.Do(m_names);
|
|
|
|
p.Do(m_descriptions);
|
|
|
|
p.Do(m_company);
|
|
|
|
p.Do(m_UniqueID);
|
|
|
|
p.Do(m_title_id);
|
|
|
|
p.Do(m_FileSize);
|
|
|
|
p.Do(m_VolumeSize);
|
|
|
|
p.Do(m_Country);
|
|
|
|
p.Do(m_blob_type);
|
|
|
|
p.Do(m_pImage);
|
|
|
|
p.Do(m_ImageWidth);
|
|
|
|
p.Do(m_ImageHeight);
|
|
|
|
p.Do(m_Platform);
|
|
|
|
p.Do(m_disc_number);
|
|
|
|
p.Do(m_Revision);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
2015-09-06 04:34:48 -06:00
|
|
|
bool GameListItem::IsElfOrDol() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (m_FileName.size() < 4)
|
|
|
|
return false;
|
2015-09-06 04:34:48 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
std::string name_end = m_FileName.substr(m_FileName.size() - 4);
|
|
|
|
std::transform(name_end.begin(), name_end.end(), name_end.begin(), ::tolower);
|
|
|
|
return name_end == ".elf" || name_end == ".dol";
|
2015-09-06 04:34:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string GameListItem::CreateCacheFilename() const
|
2008-12-07 22:30:24 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
std::string Filename, LegalPathname, extension;
|
|
|
|
SplitPath(m_FileName, &LegalPathname, &Filename, &extension);
|
|
|
|
|
|
|
|
if (Filename.empty())
|
|
|
|
return Filename; // Disc Drive
|
|
|
|
|
|
|
|
// Filename.extension_HashOfFolderPath_Size.cache
|
|
|
|
// Append hash to prevent ISO name-clashing in different folders.
|
|
|
|
Filename.append(
|
|
|
|
StringFromFormat("%s_%x_%" PRIx64 ".cache", extension.c_str(),
|
|
|
|
HashFletcher((const u8*)LegalPathname.c_str(), LegalPathname.size()),
|
|
|
|
File::GetSize(m_FileName)));
|
|
|
|
|
|
|
|
std::string fullname(File::GetUserPath(D_CACHE_IDX));
|
|
|
|
fullname += Filename;
|
|
|
|
return fullname;
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2009-02-03 08:03:34 -07:00
|
|
|
|
2015-09-04 11:08:30 -06:00
|
|
|
// Outputs to m_pImage
|
2015-12-03 09:29:59 -07:00
|
|
|
void GameListItem::ReadVolumeBanner(const std::vector<u32>& buffer, int width, int height)
|
2015-06-13 12:06:27 -06:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
m_pImage.resize(width * height * 3);
|
|
|
|
for (int i = 0; i < width * height; i++)
|
|
|
|
{
|
|
|
|
m_pImage[i * 3 + 0] = (buffer[i] & 0xFF0000) >> 16;
|
|
|
|
m_pImage[i * 3 + 1] = (buffer[i] & 0x00FF00) >> 8;
|
|
|
|
m_pImage[i * 3 + 2] = (buffer[i] & 0x0000FF) >> 0;
|
|
|
|
}
|
2015-06-13 12:06:27 -06:00
|
|
|
}
|
|
|
|
|
2015-09-04 11:08:30 -06:00
|
|
|
// Outputs to m_Bitmap
|
|
|
|
bool GameListItem::ReadPNGBanner(const std::string& path)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (!File::Exists(path))
|
|
|
|
return false;
|
2015-09-04 11:08:30 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
wxImage image(StrToWxStr(path), wxBITMAP_TYPE_PNG);
|
|
|
|
m_Bitmap = ScaleBanner(&image);
|
|
|
|
return true;
|
2015-09-04 11:08:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
wxBitmap GameListItem::ScaleBanner(wxImage* image)
|
|
|
|
{
|
2016-08-14 13:54:01 -06:00
|
|
|
wxWindow* window = wxTheApp->GetTopWindow();
|
|
|
|
const double gui_scale = window->GetContentScaleFactor() * (window->FromDIP(1024) / 1024.0);
|
2016-06-24 02:43:46 -06:00
|
|
|
const double target_width = DVD_BANNER_WIDTH * gui_scale;
|
|
|
|
const double target_height = DVD_BANNER_HEIGHT * gui_scale;
|
|
|
|
const double banner_scale =
|
|
|
|
std::min(target_width / image->GetWidth(), target_height / image->GetHeight());
|
|
|
|
image->Rescale(image->GetWidth() * banner_scale, image->GetHeight() * banner_scale,
|
2016-08-14 13:54:01 -06:00
|
|
|
wxIMAGE_QUALITY_BICUBIC);
|
2016-06-24 02:43:46 -06:00
|
|
|
image->Resize(wxSize(target_width, target_height), wxPoint(), 0xFF, 0xFF, 0xFF);
|
2016-08-14 13:54:01 -06:00
|
|
|
return wxBitmap(*image, wxBITMAP_SCREEN_DEPTH, window->GetContentScaleFactor());
|
2015-09-04 11:08:30 -06:00
|
|
|
}
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
std::string GameListItem::GetDescription(DiscIO::Language language) const
|
2009-02-03 08:03:34 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return GetLanguageString(language, m_descriptions);
|
2009-02-03 08:03:34 -07:00
|
|
|
}
|
2009-04-27 20:30:50 -06:00
|
|
|
|
2015-04-09 09:44:53 -06:00
|
|
|
std::string GameListItem::GetDescription() const
|
2013-03-03 17:29:56 -07:00
|
|
|
{
|
2016-07-06 12:33:05 -06:00
|
|
|
bool wii = m_Platform != DiscIO::Platform::GAMECUBE_DISC;
|
2016-06-24 02:43:46 -06:00
|
|
|
return GetDescription(SConfig::GetInstance().GetCurrentLanguage(wii));
|
2013-03-03 17:29:56 -07:00
|
|
|
}
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
std::string GameListItem::GetName(DiscIO::Language language) const
|
2015-04-09 09:44:53 -06:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return GetLanguageString(language, m_names);
|
2013-03-03 17:29:56 -07:00
|
|
|
}
|
2013-03-02 18:46:55 -07:00
|
|
|
|
2015-04-10 14:10:49 -06:00
|
|
|
std::string GameListItem::GetName() const
|
2013-03-03 17:29:56 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (m_has_custom_name)
|
|
|
|
return m_custom_name;
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
bool wii = m_Platform != DiscIO::Platform::GAMECUBE_DISC;
|
2016-06-24 02:43:46 -06:00
|
|
|
std::string name = GetName(SConfig::GetInstance().GetCurrentLanguage(wii));
|
|
|
|
if (!name.empty())
|
|
|
|
return name;
|
|
|
|
|
|
|
|
// No usable name, return filename (better than nothing)
|
|
|
|
std::string ext;
|
|
|
|
SplitPath(GetFileName(), nullptr, &name, &ext);
|
|
|
|
return name + ext;
|
2011-12-18 23:01:46 -07:00
|
|
|
}
|
|
|
|
|
2016-10-03 06:35:27 -06:00
|
|
|
std::string GameListItem::GetUniqueIdentifier() const
|
|
|
|
{
|
|
|
|
const DiscIO::Language lang = DiscIO::Language::LANGUAGE_ENGLISH;
|
|
|
|
std::vector<std::string> info;
|
|
|
|
if (!GetUniqueID().empty())
|
|
|
|
info.push_back(GetUniqueID());
|
|
|
|
if (GetRevision() != 0)
|
|
|
|
{
|
|
|
|
std::string rev_str = "Revision ";
|
|
|
|
info.push_back(rev_str + std::to_string((long long)GetRevision()));
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string name(GetName(lang));
|
|
|
|
if (name.empty())
|
|
|
|
name = GetName();
|
|
|
|
|
|
|
|
int disc_number = GetDiscNumber() + 1;
|
|
|
|
|
|
|
|
std::string lower_name = name;
|
|
|
|
std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower);
|
|
|
|
if (disc_number > 1 &&
|
|
|
|
lower_name.find(std::string(wxString::Format("disc %i", disc_number))) == std::string::npos &&
|
|
|
|
lower_name.find(std::string(wxString::Format("disc%i", disc_number))) == std::string::npos)
|
|
|
|
{
|
|
|
|
std::string disc_text = "Disc ";
|
|
|
|
info.push_back(disc_text + std::to_string(disc_number));
|
|
|
|
}
|
|
|
|
if (info.empty())
|
|
|
|
return name;
|
|
|
|
std::ostringstream ss;
|
|
|
|
std::copy(info.begin(), info.end() - 1, std::ostream_iterator<std::string>(ss, ", "));
|
|
|
|
ss << info.back();
|
|
|
|
return name + " (" + ss.str() + ")";
|
|
|
|
}
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
std::vector<DiscIO::Language> GameListItem::GetLanguages() const
|
2015-04-09 09:44:53 -06:00
|
|
|
{
|
2016-07-06 12:33:05 -06:00
|
|
|
std::vector<DiscIO::Language> languages;
|
|
|
|
for (std::pair<DiscIO::Language, std::string> name : m_names)
|
2016-06-24 02:43:46 -06:00
|
|
|
languages.push_back(name.first);
|
|
|
|
return languages;
|
2015-04-09 09:44:53 -06:00
|
|
|
}
|
|
|
|
|
2009-05-02 12:06:42 -06:00
|
|
|
const std::string GameListItem::GetWiiFSPath() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
std::unique_ptr<DiscIO::IVolume> iso(DiscIO::CreateVolumeFromFilename(m_FileName));
|
|
|
|
std::string ret;
|
2009-05-02 12:06:42 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
if (iso == nullptr)
|
|
|
|
return ret;
|
2011-01-06 06:57:46 -07:00
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
if (iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC)
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
|
|
|
u64 title_id = 0;
|
|
|
|
iso->GetTitleID(&title_id);
|
2009-05-02 12:06:42 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
const std::string path =
|
|
|
|
StringFromFormat("%s/title/%08x/%08x/data/", File::GetUserPath(D_WIIROOT_IDX).c_str(),
|
|
|
|
(u32)(title_id >> 32), (u32)title_id);
|
2009-05-02 12:06:42 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
if (!File::Exists(path))
|
|
|
|
File::CreateFullPath(path);
|
2009-05-02 12:06:42 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
if (path[0] == '.')
|
|
|
|
ret = WxStrToStr(wxGetCwd()) + path.substr(strlen(ROOT_DIR));
|
|
|
|
else
|
|
|
|
ret = path;
|
|
|
|
}
|
2009-05-02 12:06:42 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
return ret;
|
2009-05-02 12:06:42 -06:00
|
|
|
}
|
2016-07-06 12:33:05 -06:00
|
|
|
|
|
|
|
bool GameListItem::IsCompressed() const
|
|
|
|
{
|
|
|
|
return m_blob_type == DiscIO::BlobType::GCZ || m_blob_type == DiscIO::BlobType::CISO ||
|
|
|
|
m_blob_type == DiscIO::BlobType::WBFS;
|
|
|
|
}
|