2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:43:35 +00:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2015-09-06 10:34:48 +00:00
|
|
|
#include <algorithm>
|
2014-02-17 10:18:15 +00:00
|
|
|
#include <cinttypes>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
2014-11-15 18:25:21 +00:00
|
|
|
#include <memory>
|
2008-12-08 05:30:24 +00:00
|
|
|
#include <string>
|
2015-09-13 12:17:58 +00:00
|
|
|
#include <unordered_map>
|
2015-04-09 15:44:53 +00:00
|
|
|
#include <utility>
|
2008-12-08 05:30:24 +00:00
|
|
|
#include <vector>
|
2014-11-18 01:11:34 +00:00
|
|
|
#include <wx/app.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/filefn.h>
|
|
|
|
#include <wx/image.h>
|
2015-05-08 14:04:40 +00:00
|
|
|
#include <wx/toplevel.h>
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/ChunkFile.h"
|
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/Hash.h"
|
|
|
|
#include "Common/IniFile.h"
|
2017-05-06 15:45:08 +00:00
|
|
|
#include "Common/NandPaths.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/StringUtil.h"
|
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Core/Boot/Boot.h"
|
2016-06-24 08:43:46 +00:00
|
|
|
#include "Core/ConfigManager.h"
|
2017-05-13 22:00:01 +00:00
|
|
|
#include "Core/IOS/ES/Formats.h"
|
2017-05-15 14:26:22 +00:00
|
|
|
#include "Core/TitleDatabase.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2016-07-06 18:33:05 +00:00
|
|
|
#include "DiscIO/Blob.h"
|
|
|
|
#include "DiscIO/Enums.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "DiscIO/Volume.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
|
|
|
|
#include "DolphinWX/ISOFile.h"
|
|
|
|
#include "DolphinWX/WxUtils.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2016-07-06 18:33:05 +00:00
|
|
|
static std::string GetLanguageString(DiscIO::Language language,
|
|
|
|
std::map<DiscIO::Language, std::string> strings)
|
2015-04-09 15:44:53 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
auto end = strings.end();
|
|
|
|
auto it = strings.find(language);
|
|
|
|
if (it != end)
|
|
|
|
return it->second;
|
|
|
|
|
2016-06-25 16:07:10 +00:00
|
|
|
// English tends to be a good fallback when the requested language isn't available
|
2016-07-06 18:33:05 +00:00
|
|
|
if (language != DiscIO::Language::LANGUAGE_ENGLISH)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2016-07-06 18:33:05 +00:00
|
|
|
it = strings.find(DiscIO::Language::LANGUAGE_ENGLISH);
|
2016-06-24 08:43:46 +00: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 15:44:53 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 20:19:51 +00:00
|
|
|
GameListItem::GameListItem(const std::string& filename)
|
2017-06-26 03:13:42 +00:00
|
|
|
: m_file_name(filename), m_region(DiscIO::Region::UNKNOWN_REGION),
|
|
|
|
m_country(DiscIO::Country::COUNTRY_UNKNOWN)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(m_file_name));
|
2016-06-24 08:43:46 +00:00
|
|
|
if (volume != nullptr)
|
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
m_platform = volume->GetVolumeType();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
m_descriptions = volume->GetDescriptions();
|
2016-02-29 08:52:15 +00:00
|
|
|
m_names = volume->GetLongNames();
|
|
|
|
if (m_names.empty())
|
|
|
|
m_names = volume->GetShortNames();
|
2016-07-06 18:33:05 +00:00
|
|
|
m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetLongMakers());
|
2016-02-29 08:52:15 +00:00
|
|
|
if (m_company.empty())
|
2016-07-06 18:33:05 +00:00
|
|
|
m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetShortMakers());
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-12-23 17:41:21 +00:00
|
|
|
m_region = volume->GetRegion();
|
2017-06-26 03:13:42 +00:00
|
|
|
m_country = volume->GetCountry();
|
2016-06-24 08:43:46 +00:00
|
|
|
m_blob_type = volume->GetBlobType();
|
2017-06-26 03:13:42 +00:00
|
|
|
m_file_size = volume->GetRawSize();
|
|
|
|
m_volume_size = volume->GetSize();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-10-29 12:42:43 +00:00
|
|
|
m_game_id = volume->GetGameID();
|
2017-06-04 08:33:14 +00:00
|
|
|
m_title_id = volume->GetTitleID().value_or(0);
|
|
|
|
m_disc_number = volume->GetDiscNumber().value_or(0);
|
2017-06-26 03:13:42 +00:00
|
|
|
m_revision = volume->GetRevision().value_or(0);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-27 09:36:50 +00:00
|
|
|
auto& banner = m_volume_banner;
|
|
|
|
std::vector<u32> buffer = volume->GetBanner(&banner.width, &banner.height);
|
|
|
|
ReadVolumeBanner(&banner.buffer, buffer, banner.width, banner.height);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
m_valid = true;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-29 12:42:43 +00:00
|
|
|
if (m_company.empty() && m_game_id.size() >= 6)
|
|
|
|
m_company = DiscIO::GetCompanyFromID(m_game_id.substr(4, 2));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
|
|
|
if (!IsValid() && IsElfOrDol())
|
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
m_valid = true;
|
|
|
|
m_file_size = File::GetSize(m_file_name);
|
|
|
|
m_platform = DiscIO::Platform::ELF_DOL;
|
2016-06-24 08:43:46 +00:00
|
|
|
m_blob_type = DiscIO::BlobType::DIRECTORY;
|
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
std::string path, name;
|
2017-06-26 03:13:42 +00:00
|
|
|
SplitPath(m_file_name, &path, &name, nullptr);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-20 23:36:59 +00: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.
|
2017-06-27 09:28:55 +00:00
|
|
|
if (SetWxBannerFromPNGFile(path + name + ".png"))
|
2017-06-20 23:36:59 +00:00
|
|
|
return;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-27 09:30:27 +00:00
|
|
|
// Homebrew Channel icon. The most typical icon format for DOLs and ELFs.
|
2017-06-27 09:28:55 +00:00
|
|
|
if (SetWxBannerFromPNGFile(path + "icon.png"))
|
2017-06-20 23:36:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2017-06-20 23:36:59 +00:00
|
|
|
// Volume banner. Typical for everything that isn't a DOL or ELF.
|
2017-06-27 09:36:50 +00:00
|
|
|
SetWxBannerFromRaw(m_volume_banner);
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2017-05-13 22:00:01 +00:00
|
|
|
bool GameListItem::IsValid() const
|
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
if (!m_valid)
|
2017-05-13 22:00:01 +00:00
|
|
|
return false;
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
if (m_platform == DiscIO::Platform::WII_WAD && !IOS::ES::IsChannel(m_title_id))
|
2017-05-13 22:00:01 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-06-26 20:19:51 +00:00
|
|
|
bool GameListItem::CustomNameChanged(const Core::TitleDatabase& title_database)
|
|
|
|
{
|
|
|
|
const auto type = m_platform == DiscIO::Platform::WII_WAD ?
|
|
|
|
Core::TitleDatabase::TitleType::Channel :
|
|
|
|
Core::TitleDatabase::TitleType::Other;
|
|
|
|
m_pending.custom_name = title_database.GetTitleName(m_game_id, type);
|
|
|
|
return m_custom_name != m_pending.custom_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameListItem::CustomNameCommit()
|
|
|
|
{
|
2017-06-27 08:21:33 +00:00
|
|
|
m_custom_name = std::move(m_pending.custom_name);
|
2017-06-26 20:19:51 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
bool GameListItem::EmuStateChanged()
|
2016-05-29 14:49:11 +00:00
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
IniFile ini = SConfig::LoadGameIni(m_game_id, m_revision);
|
|
|
|
ini.GetIfExists("EmuState", "EmulationStateId", &m_pending.emu_state.rating, 0);
|
|
|
|
ini.GetIfExists("EmuState", "EmulationIssues", &m_pending.emu_state.issues, std::string());
|
|
|
|
return m_emu_state != m_pending.emu_state;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
void GameListItem::EmuStateCommit()
|
|
|
|
{
|
2017-06-27 08:21:33 +00:00
|
|
|
m_emu_state = std::move(m_pending.emu_state);
|
2017-06-26 03:13:42 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
void GameListItem::EmuState::DoState(PointerWrap& p)
|
|
|
|
{
|
|
|
|
p.Do(rating);
|
|
|
|
p.Do(issues);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameListItem::Banner::DoState(PointerWrap& p)
|
|
|
|
{
|
|
|
|
p.Do(buffer);
|
|
|
|
p.Do(width);
|
|
|
|
p.Do(height);
|
2016-05-29 14:49:11 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void GameListItem::DoState(PointerWrap& p)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
p.Do(m_valid);
|
|
|
|
p.Do(m_file_name);
|
|
|
|
p.Do(m_file_size);
|
|
|
|
p.Do(m_volume_size);
|
2016-06-24 08:43:46 +00:00
|
|
|
p.Do(m_names);
|
|
|
|
p.Do(m_descriptions);
|
|
|
|
p.Do(m_company);
|
2016-10-29 12:42:43 +00:00
|
|
|
p.Do(m_game_id);
|
2016-06-24 08:43:46 +00:00
|
|
|
p.Do(m_title_id);
|
2016-12-23 17:41:21 +00:00
|
|
|
p.Do(m_region);
|
2017-06-26 03:13:42 +00:00
|
|
|
p.Do(m_country);
|
|
|
|
p.Do(m_platform);
|
2016-06-24 08:43:46 +00:00
|
|
|
p.Do(m_blob_type);
|
2017-06-26 03:13:42 +00:00
|
|
|
p.Do(m_revision);
|
2016-06-24 08:43:46 +00:00
|
|
|
p.Do(m_disc_number);
|
2017-06-27 09:36:50 +00:00
|
|
|
m_volume_banner.DoState(p);
|
2017-06-26 03:13:42 +00:00
|
|
|
m_emu_state.DoState(p);
|
2017-06-20 23:36:59 +00:00
|
|
|
p.Do(m_custom_name);
|
|
|
|
if (p.GetMode() == PointerWrap::MODE_READ)
|
|
|
|
{
|
2017-06-27 09:36:50 +00:00
|
|
|
SetWxBannerFromRaw(m_volume_banner);
|
2017-06-20 23:36:59 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2015-09-06 10:34:48 +00:00
|
|
|
bool GameListItem::IsElfOrDol() const
|
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
if (m_file_name.size() < 4)
|
2016-06-24 08:43:46 +00:00
|
|
|
return false;
|
2015-09-06 10:34:48 +00:00
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
std::string name_end = m_file_name.substr(m_file_name.size() - 4);
|
2016-06-24 08:43:46 +00:00
|
|
|
std::transform(name_end.begin(), name_end.end(), name_end.begin(), ::tolower);
|
|
|
|
return name_end == ".elf" || name_end == ".dol";
|
2015-09-06 10:34:48 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
void GameListItem::ReadVolumeBanner(std::vector<u8>* image, const std::vector<u32>& buffer,
|
|
|
|
int width, int height)
|
2015-06-13 18:06:27 +00:00
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
image->resize(width * height * 3);
|
2016-06-24 08:43:46 +00:00
|
|
|
for (int i = 0; i < width * height; i++)
|
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
(*image)[i * 3 + 0] = (buffer[i] & 0xFF0000) >> 16;
|
|
|
|
(*image)[i * 3 + 1] = (buffer[i] & 0x00FF00) >> 8;
|
|
|
|
(*image)[i * 3 + 2] = (buffer[i] & 0x0000FF) >> 0;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2015-06-13 18:06:27 +00:00
|
|
|
}
|
|
|
|
|
2017-06-27 09:28:55 +00:00
|
|
|
bool GameListItem::SetWxBannerFromPNGFile(const std::string& path)
|
2015-09-04 17:08:30 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (!File::Exists(path))
|
|
|
|
return false;
|
2015-09-04 17:08:30 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxImage image(StrToWxStr(path), wxBITMAP_TYPE_PNG);
|
2016-08-03 11:14:52 +00:00
|
|
|
if (!image.IsOk())
|
|
|
|
return false;
|
2015-09-04 17:08:30 +00:00
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
m_banner_wx = image;
|
2016-08-03 11:14:52 +00:00
|
|
|
return true;
|
2015-09-04 17:08:30 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
void GameListItem::SetWxBannerFromRaw(const Banner& banner)
|
2017-06-20 23:36:59 +00:00
|
|
|
{
|
2017-06-27 09:33:47 +00:00
|
|
|
if (banner.empty())
|
|
|
|
return;
|
|
|
|
|
2017-06-20 23:36:59 +00:00
|
|
|
// Need to make explicit copy as wxImage uses reference counting for copies combined with only
|
|
|
|
// taking a pointer, not the content, when given a buffer to its constructor.
|
2017-06-27 09:33:47 +00:00
|
|
|
m_banner_wx.Create(banner.width, banner.height, false);
|
|
|
|
std::memcpy(m_banner_wx.GetData(), banner.buffer.data(), banner.buffer.size());
|
2017-06-20 23:36:59 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
bool GameListItem::BannerChanged()
|
2017-06-20 23:36:59 +00:00
|
|
|
{
|
|
|
|
// 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.
|
2017-06-27 09:33:47 +00:00
|
|
|
|
2017-06-27 09:36:50 +00:00
|
|
|
if (!m_volume_banner.empty())
|
2017-06-27 09:33:47 +00:00
|
|
|
return false;
|
|
|
|
if (m_platform != DiscIO::Platform::WII_DISC && m_platform != DiscIO::Platform::WII_WAD)
|
|
|
|
return false;
|
|
|
|
|
2017-06-27 09:36:50 +00:00
|
|
|
auto& banner = m_pending.volume_banner;
|
2017-06-27 09:33:47 +00:00
|
|
|
std::vector<u32> buffer = DiscIO::Volume::GetWiiBanner(&banner.width, &banner.height, m_title_id);
|
|
|
|
if (!buffer.size())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
ReadVolumeBanner(&banner.buffer, buffer, banner.width, banner.height);
|
2017-06-27 09:36:50 +00:00
|
|
|
// We only reach here if m_volume_banner was empty, so we don't need to explicitly
|
2017-06-27 09:33:47 +00:00
|
|
|
// compare to see if they are different
|
|
|
|
return true;
|
2017-06-20 23:36:59 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
void GameListItem::BannerCommit()
|
|
|
|
{
|
2017-06-27 09:36:50 +00:00
|
|
|
m_volume_banner = std::move(m_pending.volume_banner);
|
|
|
|
SetWxBannerFromRaw(m_volume_banner);
|
2017-06-26 03:13:42 +00:00
|
|
|
}
|
|
|
|
|
2016-07-06 18:33:05 +00:00
|
|
|
std::string GameListItem::GetDescription(DiscIO::Language language) const
|
2009-02-03 15:03:34 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
return GetLanguageString(language, m_descriptions);
|
2009-02-03 15:03:34 +00:00
|
|
|
}
|
2009-04-28 02:30:50 +00:00
|
|
|
|
2015-04-09 15:44:53 +00:00
|
|
|
std::string GameListItem::GetDescription() const
|
2013-03-04 00:29:56 +00:00
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
bool wii = m_platform != DiscIO::Platform::GAMECUBE_DISC;
|
2016-06-24 08:43:46 +00:00
|
|
|
return GetDescription(SConfig::GetInstance().GetCurrentLanguage(wii));
|
2013-03-04 00:29:56 +00:00
|
|
|
}
|
|
|
|
|
2016-07-06 18:33:05 +00:00
|
|
|
std::string GameListItem::GetName(DiscIO::Language language) const
|
2015-04-09 15:44:53 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
return GetLanguageString(language, m_names);
|
2013-03-04 00:29:56 +00:00
|
|
|
}
|
2013-03-03 01:46:55 +00:00
|
|
|
|
2015-04-10 20:10:49 +00:00
|
|
|
std::string GameListItem::GetName() const
|
2013-03-04 00:29:56 +00:00
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
if (!m_custom_name.empty())
|
2016-06-24 08:43:46 +00:00
|
|
|
return m_custom_name;
|
|
|
|
|
2017-06-26 03:13:42 +00:00
|
|
|
bool wii = m_platform != DiscIO::Platform::GAMECUBE_DISC;
|
2016-06-24 08:43:46 +00: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-19 06:01:46 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 12:35:27 +00:00
|
|
|
std::string GameListItem::GetUniqueIdentifier() const
|
|
|
|
{
|
|
|
|
const DiscIO::Language lang = DiscIO::Language::LANGUAGE_ENGLISH;
|
|
|
|
std::vector<std::string> info;
|
2016-10-29 12:42:43 +00:00
|
|
|
if (!GetGameID().empty())
|
|
|
|
info.push_back(GetGameID());
|
2016-10-03 12:35:27 +00:00
|
|
|
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 18:33:05 +00:00
|
|
|
std::vector<DiscIO::Language> GameListItem::GetLanguages() const
|
2015-04-09 15:44:53 +00:00
|
|
|
{
|
2016-07-06 18:33:05 +00:00
|
|
|
std::vector<DiscIO::Language> languages;
|
|
|
|
for (std::pair<DiscIO::Language, std::string> name : m_names)
|
2016-06-24 08:43:46 +00:00
|
|
|
languages.push_back(name.first);
|
|
|
|
return languages;
|
2015-04-09 15:44:53 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 18:06:42 +00:00
|
|
|
const std::string GameListItem::GetWiiFSPath() const
|
|
|
|
{
|
2017-06-26 03:13:42 +00:00
|
|
|
if (m_platform != DiscIO::Platform::WII_DISC && m_platform != DiscIO::Platform::WII_WAD)
|
2017-05-06 16:32:17 +00:00
|
|
|
return "";
|
2009-05-02 18:06:42 +00:00
|
|
|
|
2017-05-06 16:32:17 +00:00
|
|
|
const std::string path = Common::GetTitleDataPath(m_title_id, Common::FROM_CONFIGURED_ROOT);
|
2009-05-02 18:06:42 +00:00
|
|
|
|
2017-05-06 16:32:17 +00:00
|
|
|
if (path[0] == '.')
|
|
|
|
return WxStrToStr(wxGetCwd()) + path.substr(strlen(ROOT_DIR));
|
2009-05-02 18:06:42 +00:00
|
|
|
|
2017-05-06 16:32:17 +00:00
|
|
|
return path;
|
2009-05-02 18:06:42 +00:00
|
|
|
}
|