Separate banner and volume name getting functions. Game properties now shows the correct "banner" name in more cases.
This commit is contained in:
parent
a30636cb88
commit
6026b29844
|
@ -226,28 +226,50 @@ std::string GameListItem::GetDescription(int _index) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// (-1 = Japanese, 0 = English, etc)
|
// (-1 = Japanese, 0 = English, etc)
|
||||||
std::string GameListItem::GetName(int _index) const
|
std::string GameListItem::GetVolumeName(int _index) const
|
||||||
{
|
{
|
||||||
u32 const index = _index + 1;
|
u32 const index = _index + 1;
|
||||||
|
|
||||||
// banner name
|
|
||||||
if (index < m_names.size() && !m_names[index].empty())
|
|
||||||
return m_names[index];
|
|
||||||
|
|
||||||
if (!m_names.empty() && !m_names[0].empty())
|
|
||||||
return m_names[0];
|
|
||||||
|
|
||||||
// volume name
|
|
||||||
if (index < m_volume_names.size() && !m_volume_names[index].empty())
|
if (index < m_volume_names.size() && !m_volume_names[index].empty())
|
||||||
return m_volume_names[index];
|
return m_volume_names[index];
|
||||||
|
|
||||||
if (!m_volume_names.empty() && !m_volume_names[0].empty())
|
if (!m_volume_names.empty())
|
||||||
return m_volume_names[0];
|
return m_volume_names[0];
|
||||||
|
|
||||||
// No usable name, return filename (better than nothing)
|
return "";
|
||||||
std::string FileName;
|
}
|
||||||
SplitPath(m_FileName, NULL, &FileName, NULL);
|
|
||||||
return FileName;
|
// (-1 = Japanese, 0 = English, etc)
|
||||||
|
std::string GameListItem::GetBannerName(int _index) const
|
||||||
|
{
|
||||||
|
u32 const index = _index + 1;
|
||||||
|
|
||||||
|
if (index < m_names.size() && !m_names[index].empty())
|
||||||
|
return m_names[index];
|
||||||
|
|
||||||
|
if (!m_names.empty())
|
||||||
|
return m_names[0];
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// (-1 = Japanese, 0 = English, etc)
|
||||||
|
std::string GameListItem::GetName(int _index) const
|
||||||
|
{
|
||||||
|
// Prefer name from banner, fallback to name from volume, fallback to filename
|
||||||
|
|
||||||
|
std::string name = GetBannerName(_index);
|
||||||
|
|
||||||
|
if (name.empty())
|
||||||
|
name = GetVolumeName(_index);
|
||||||
|
|
||||||
|
if (name.empty())
|
||||||
|
{
|
||||||
|
// No usable name, return filename (better than nothing)
|
||||||
|
SplitPath(GetFileName(), NULL, &name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string GameListItem::GetWiiFSPath() const
|
const std::string GameListItem::GetWiiFSPath() const
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
|
|
||||||
bool IsValid() const {return m_Valid;}
|
bool IsValid() const {return m_Valid;}
|
||||||
const std::string& GetFileName() const {return m_FileName;}
|
const std::string& GetFileName() const {return m_FileName;}
|
||||||
|
std::string GetBannerName(int index) const;
|
||||||
|
std::string GetVolumeName(int index) const;
|
||||||
std::string GetName(int index) const;
|
std::string GetName(int index) const;
|
||||||
std::string GetCompany() const;
|
std::string GetCompany() const;
|
||||||
std::string GetDescription(int index = 0) const;
|
std::string GetDescription(int index = 0) const;
|
||||||
|
|
|
@ -1301,28 +1301,25 @@ void CISOProperties::OnChangeBannerLang(wxCommandEvent& event)
|
||||||
|
|
||||||
void CISOProperties::ChangeBannerDetails(int lang)
|
void CISOProperties::ChangeBannerDetails(int lang)
|
||||||
{
|
{
|
||||||
std::string name;
|
// why?
|
||||||
wxString shortName,
|
|
||||||
comment,
|
|
||||||
maker;
|
|
||||||
|
|
||||||
switch (OpenGameListItem->GetCountry())
|
switch (OpenGameListItem->GetCountry())
|
||||||
{
|
{
|
||||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||||
shortName = StrToWxStr(OpenGameListItem->GetName(-1));
|
lang = -1;
|
||||||
comment = StrToWxStr(OpenGameListItem->GetDescription());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_USA:
|
case DiscIO::IVolume::COUNTRY_USA:
|
||||||
// why?
|
|
||||||
lang = 0;
|
lang = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
shortName = StrToWxStr(OpenGameListItem->GetName(lang));
|
|
||||||
comment = StrToWxStr(OpenGameListItem->GetDescription(lang));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
maker = StrToWxStr(OpenGameListItem->GetCompany());
|
wxString const shortName = StrToWxStr(OpenGameListItem->GetBannerName(lang));
|
||||||
|
wxString const comment = StrToWxStr(OpenGameListItem->GetDescription(lang));
|
||||||
|
wxString const maker = StrToWxStr(OpenGameListItem->GetCompany());
|
||||||
|
|
||||||
// Updates the informations shown in the window
|
// Updates the informations shown in the window
|
||||||
m_ShortName->SetValue(shortName);
|
m_ShortName->SetValue(shortName);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "NetPlay.h"
|
#include "NetPlay.h"
|
||||||
#include "NetWindow.h"
|
#include "NetWindow.h"
|
||||||
#include "Frame.h"
|
#include "Frame.h"
|
||||||
#include "ConfigManager.h"
|
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -39,11 +38,14 @@ NetPlayDiag *NetPlayDiag::npd = NULL;
|
||||||
|
|
||||||
std::string BuildGameName(const GameListItem& game)
|
std::string BuildGameName(const GameListItem& game)
|
||||||
{
|
{
|
||||||
auto const selected_lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
|
// Lang needs to be consistent
|
||||||
|
auto const lang = 0;
|
||||||
|
|
||||||
// TODO: this should use the name from the volume not the banner
|
std::string name(game.GetBannerName(lang));
|
||||||
// (I seems banner name can sometimes depend on save contents)
|
if (name.empty())
|
||||||
return game.GetName(selected_lang) + " (" + game.GetUniqueID() + ")";
|
name = game.GetVolumeName(lang);
|
||||||
|
|
||||||
|
return name + " (" + game.GetUniqueID() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list)
|
void FillWithGameNames(wxListBox* game_lbox, const CGameListCtrl& game_list)
|
||||||
|
|
Loading…
Reference in New Issue