Return GetNames languages, to avoid hardcoded language lists in callers

This makes the code cleaner and also leads to some user-visible changes:

The wx game properties will no longer let the user
select WAD languages that don't have any names.

The Qt game list will now display names using the languages
set in the configuration instead of always using
English for PAL GC games and Japanese for WADs.

If a WAD doesn't have a name in the user's preferred language,
English is now selected as a fallback before Japanese.
This commit is contained in:
JosJuice 2015-04-09 17:44:53 +02:00
parent 87a63713f4
commit 235ecfbed7
30 changed files with 399 additions and 340 deletions

View File

@ -373,6 +373,20 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri
}
}
IVolume::ELanguage SCoreStartupParameter::GetCurrentLanguage(bool wii) const
{
IVolume::ELanguage language;
if (wii)
language = (IVolume::ELanguage)SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
else
language = (IVolume::ELanguage)(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage + 1);
// Get rid of invalid values (probably doesn't matter, but might as well do it)
if (language > IVolume::ELanguage::LANGUAGE_UNKNOWN || language < 0)
language = IVolume::ELanguage::LANGUAGE_UNKNOWN;
return language;
}
IniFile SCoreStartupParameter::LoadDefaultGameIni() const
{
return LoadDefaultGameIni(GetUniqueID(), m_revision);

View File

@ -7,6 +7,7 @@
#include <string>
#include "Common/IniFile.h"
#include "DiscIO/Volume.h"
enum Hotkey
{
@ -248,6 +249,7 @@ struct SCoreStartupParameter
bool AutoSetup(EBootBS2 _BootBS2);
const std::string &GetUniqueID() const { return m_strUniqueID; }
void CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA);
DiscIO::IVolume::ELanguage GetCurrentLanguage(bool wii) const;
IniFile LoadDefaultGameIni() const;
IniFile LoadLocalGameIni() const;

View File

@ -4,10 +4,12 @@
#pragma once
#include <map>
#include <string>
#include <vector>
#include "Common/CommonTypes.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
@ -28,9 +30,9 @@ public:
virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight) = 0;
virtual std::vector<std::string> GetNames() = 0;
virtual std::map<IVolume::ELanguage, std::string> GetNames() = 0;
virtual std::string GetCompany() = 0;
virtual std::vector<std::string> GetDescriptions() = 0;
virtual std::map<IVolume::ELanguage, std::string> GetDescriptions() = 0;
bool IsValid()
{

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <cstddef>
#include <map>
#include <string>
#include <vector>
@ -60,9 +61,9 @@ std::vector<u32> CBannerLoaderGC::GetBanner(int* pWidth, int* pHeight)
}
std::vector<std::string> CBannerLoaderGC::GetNames()
std::map<IVolume::ELanguage, std::string> CBannerLoaderGC::GetNames()
{
std::vector<std::string> names;
std::map<IVolume::ELanguage, std::string> names;
if (!IsValid())
{
@ -70,16 +71,21 @@ std::vector<std::string> CBannerLoaderGC::GetNames()
}
u32 name_count = 0;
IVolume::ELanguage language;
bool is_japanese = m_country == IVolume::ECountry::COUNTRY_JAPAN;
// find Banner type
switch (m_BNRType)
{
case CBannerLoaderGC::BANNER_BNR1:
name_count = 1;
language = is_japanese ? IVolume::ELanguage::LANGUAGE_JAPANESE : IVolume::ELanguage::LANGUAGE_ENGLISH;
break;
// English, German, French, Spanish, Italian, Dutch
case CBannerLoaderGC::BANNER_BNR2:
name_count = 6;
language = IVolume::ELanguage::LANGUAGE_ENGLISH;
break;
default:
@ -88,20 +94,16 @@ std::vector<std::string> CBannerLoaderGC::GetNames()
auto const banner = reinterpret_cast<const DVDBanner*>(m_pBannerFile);
for (u32 i = 0; i != name_count; ++i)
for (u32 i = 0; i < name_count; ++i)
{
auto& comment = banner->comment[i];
std::string name = GetDecodedString(comment.longTitle);
if (comment.longTitle[0])
{
auto& data = comment.longTitle;
names.push_back(GetDecodedString(data));
}
else
{
auto& data = comment.shortTitle;
names.push_back(GetDecodedString(data));
}
if (name.empty())
name = GetDecodedString(comment.shortTitle);
if (!name.empty())
names[(IVolume::ELanguage)(language + i)] = name;
}
return names;
@ -123,9 +125,9 @@ std::string CBannerLoaderGC::GetCompany()
}
std::vector<std::string> CBannerLoaderGC::GetDescriptions()
std::map<IVolume::ELanguage, std::string> CBannerLoaderGC::GetDescriptions()
{
std::vector<std::string> descriptions;
std::map<IVolume::ELanguage, std::string> descriptions;
if (!IsValid())
{
@ -133,16 +135,20 @@ std::vector<std::string> CBannerLoaderGC::GetDescriptions()
}
u32 desc_count = 0;
IVolume::ELanguage language;
bool is_japanese = m_country == IVolume::ECountry::COUNTRY_JAPAN;
// find Banner type
switch (m_BNRType)
{
case CBannerLoaderGC::BANNER_BNR1:
desc_count = 1;
language = is_japanese ? IVolume::ELanguage::LANGUAGE_JAPANESE : IVolume::ELanguage::LANGUAGE_ENGLISH;
break;
// English, German, French, Spanish, Italian, Dutch
case CBannerLoaderGC::BANNER_BNR2:
language = IVolume::ELanguage::LANGUAGE_ENGLISH;
desc_count = 6;
break;
@ -152,10 +158,13 @@ std::vector<std::string> CBannerLoaderGC::GetDescriptions()
auto banner = reinterpret_cast<const DVDBanner*>(m_pBannerFile);
for (u32 i = 0; i != desc_count; ++i)
for (u32 i = 0; i < desc_count; ++i)
{
auto& data = banner->comment[i].comment;
descriptions.push_back(GetDecodedString(data));
std::string description = GetDecodedString(data);
if (!description.empty())
descriptions[(IVolume::ELanguage)(language + i)] = description;
}
return descriptions;
@ -164,20 +173,15 @@ std::vector<std::string> CBannerLoaderGC::GetDescriptions()
CBannerLoaderGC::BANNER_TYPE CBannerLoaderGC::getBannerType()
{
u32 bannerSignature = *(u32*)m_pBannerFile;
CBannerLoaderGC::BANNER_TYPE type = CBannerLoaderGC::BANNER_UNKNOWN;
switch (bannerSignature)
{
// "BNR1"
case 0x31524e42:
type = CBannerLoaderGC::BANNER_BNR1;
break;
// "BNR2"
case 0x32524e42:
type = CBannerLoaderGC::BANNER_BNR2;
break;
case 0x31524e42: // "BNR1"
return CBannerLoaderGC::BANNER_BNR1;
case 0x32524e42: // "BNR2"
return CBannerLoaderGC::BANNER_BNR2;
default:
return CBannerLoaderGC::BANNER_UNKNOWN;
}
return type;
}
} // namespace

View File

@ -5,6 +5,7 @@
#pragma once
#include <cstring>
#include <map>
#include <string>
#include <vector>
@ -28,9 +29,9 @@ public:
virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight) override;
virtual std::vector<std::string> GetNames() override;
virtual std::map<IVolume::ELanguage, std::string> GetNames() override;
virtual std::string GetCompany() override;
virtual std::vector<std::string> GetDescriptions() override;
virtual std::map<IVolume::ELanguage, std::string> GetDescriptions() override;
private:
enum

View File

@ -5,6 +5,7 @@
#include <algorithm>
#include <cstddef>
#include <cstdio>
#include <map>
#include <string>
#include <vector>
@ -91,14 +92,15 @@ bool CBannerLoaderWii::GetStringFromComments(const CommentIndex index, std::stri
return false;
}
std::vector<std::string> CBannerLoaderWii::GetNames()
std::map<IVolume::ELanguage, std::string> CBannerLoaderWii::GetNames()
{
std::vector<std::string> ret(1);
std::map<IVolume::ELanguage, std::string> result;
if (!GetStringFromComments(NAME_IDX, ret[0]))
ret.clear();
std::string name;
if (GetStringFromComments(NAME_IDX, name))
result[IVolume::ELanguage::LANGUAGE_UNKNOWN] = name;
return ret;
return result;
}
std::string CBannerLoaderWii::GetCompany()
@ -106,11 +108,14 @@ std::string CBannerLoaderWii::GetCompany()
return "";
}
std::vector<std::string> CBannerLoaderWii::GetDescriptions()
std::map<IVolume::ELanguage, std::string> CBannerLoaderWii::GetDescriptions()
{
std::vector<std::string> result(1);
if (!GetStringFromComments(DESC_IDX, result[0]))
result.clear();
std::map<IVolume::ELanguage, std::string> result;
std::string name;
if (GetStringFromComments(DESC_IDX, name))
result[IVolume::ELanguage::LANGUAGE_UNKNOWN] = name;
return result;
}

View File

@ -4,6 +4,7 @@
#pragma once
#include <map>
#include <string>
#include <vector>
@ -25,9 +26,9 @@ public:
virtual std::vector<u32> GetBanner(int* pWidth, int* pHeight) override;
virtual std::vector<std::string> GetNames() override;
virtual std::map<IVolume::ELanguage, std::string> GetNames() override;
virtual std::string GetCompany() override;
virtual std::vector<std::string> GetDescriptions() override;
virtual std::map<IVolume::ELanguage, std::string> GetDescriptions() override;
private:
enum

View File

@ -4,6 +4,7 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
@ -16,6 +17,43 @@ namespace DiscIO
class IVolume
{
public:
// Increment CACHE_REVISION if the enums below are modified (ISOFile.cpp & GameFile.cpp)
enum ECountry
{
COUNTRY_EUROPE = 0,
COUNTRY_JAPAN,
COUNTRY_USA,
COUNTRY_AUSTRALIA,
COUNTRY_FRANCE,
COUNTRY_GERMANY,
COUNTRY_ITALY,
COUNTRY_KOREA,
COUNTRY_NETHERLANDS,
COUNTRY_RUSSIA,
COUNTRY_SPAIN,
COUNTRY_TAIWAN,
COUNTRY_WORLD,
COUNTRY_UNKNOWN,
NUMBER_OF_COUNTRIES
};
// Languages 0 - 9 match the official Wii language numbering.
// Languages 1 - 6 match the official GC PAL languages 0 - 5.
enum ELanguage
{
LANGUAGE_JAPANESE = 0,
LANGUAGE_ENGLISH = 1,
LANGUAGE_GERMAN = 2,
LANGUAGE_FRENCH = 3,
LANGUAGE_SPANISH = 4,
LANGUAGE_ITALIAN = 5,
LANGUAGE_DUTCH = 6,
LANGUAGE_SIMPLIFIED_CHINESE = 7,
LANGUAGE_TRADITIONAL_CHINESE = 8,
LANGUAGE_KOREAN = 9,
LANGUAGE_UNKNOWN
};
IVolume() {}
virtual ~IVolume() {}
@ -39,7 +77,7 @@ public:
virtual int GetRevision() const { return 0; }
// TODO: eliminate?
virtual std::string GetName() const;
virtual std::vector<std::string> GetNames() const = 0;
virtual std::map<ELanguage, std::string> GetNames() const = 0;
virtual u32 GetFSTSize() const = 0;
virtual std::string GetApploaderDate() const = 0;
@ -50,26 +88,6 @@ public:
virtual bool CheckIntegrity() const { return false; }
virtual bool ChangePartition(u64 offset) { return false; }
// Increment CACHE_REVISION if the code below is modified (ISOFile.cpp & GameFile.cpp)
enum ECountry
{
COUNTRY_EUROPE = 0,
COUNTRY_JAPAN,
COUNTRY_USA,
COUNTRY_AUSTRALIA,
COUNTRY_FRANCE,
COUNTRY_GERMANY,
COUNTRY_ITALY,
COUNTRY_KOREA,
COUNTRY_NETHERLANDS,
COUNTRY_RUSSIA,
COUNTRY_SPAIN,
COUNTRY_TAIWAN,
COUNTRY_WORLD,
COUNTRY_UNKNOWN,
NUMBER_OF_COUNTRIES
};
virtual ECountry GetCountry() const = 0;
virtual u64 GetSize() const = 0;

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <map>
#include <string>
#include <vector>
@ -104,7 +105,7 @@ std::string IVolume::GetName() const
if (names.empty())
return "";
else
return names[0];
return names.cbegin()->second;
}
}

View File

@ -8,7 +8,6 @@
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "Common/CommonPaths.h"
@ -183,9 +182,11 @@ std::string CVolumeDirectory::GetMakerID() const
return "VOID";
}
std::vector<std::string> CVolumeDirectory::GetNames() const
std::map<IVolume::ELanguage, std::string> CVolumeDirectory::GetNames() const
{
return std::vector<std::string>(1, (char*)(&m_diskHeader[0x20]));
std::map<IVolume::ELanguage, std::string> names;
names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = (char*)(&m_diskHeader[0x20]);
return names;
}
void CVolumeDirectory::SetName(const std::string& name)

View File

@ -39,7 +39,7 @@ public:
std::string GetMakerID() const override;
std::vector<std::string> GetNames() const override;
std::map<IVolume::ELanguage, std::string> GetNames() const override;
void SetName(const std::string&);
u32 GetFSTSize() const override;

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <cstddef>
#include <map>
#include <memory>
#include <string>
#include <vector>
@ -92,15 +93,15 @@ int CVolumeGC::GetRevision() const
return revision;
}
std::vector<std::string> CVolumeGC::GetNames() const
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetNames() const
{
std::vector<std::string> names;
std::map<IVolume::ELanguage, std::string> names;
auto const string_decoder = GetStringDecoder(GetCountry());
char name[0x60 + 1] = {};
if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)name))
names.push_back(string_decoder(name));
names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = string_decoder(name);
return names;
}

View File

@ -4,6 +4,7 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
@ -27,7 +28,7 @@ public:
std::string GetUniqueID() const override;
std::string GetMakerID() const override;
int GetRevision() const override;
std::vector<std::string> GetNames() const override;
std::map<IVolume::ELanguage, std::string> GetNames() const override;
u32 GetFSTSize() const override;
std::string GetApploaderDate() const override;

View File

@ -4,6 +4,7 @@
#include <algorithm>
#include <cstddef>
#include <map>
#include <string>
#include <vector>
@ -117,9 +118,9 @@ bool CVolumeWAD::IsWadFile() const
return true;
}
std::vector<std::string> CVolumeWAD::GetNames() const
std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetNames() const
{
std::vector<std::string> names;
std::map<IVolume::ELanguage, std::string> names;
u32 footer_size;
if (!Read(0x1C, 4, (u8*)&footer_size))
@ -129,26 +130,23 @@ std::vector<std::string> CVolumeWAD::GetNames() const
footer_size = Common::swap32(footer_size);
//Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean
for (int i = 0; i != 10; ++i)
//Japanese, English, German, French, Spanish, Italian, Dutch, Simplified Chinese, Traditional Chinese, Korean
for (int i = 0; i < 10; ++i)
{
static const u32 string_length = 42;
static const u32 bytes_length = string_length * sizeof(u16);
u16 temp[string_length];
if (footer_size < 0xF1 || !Read(0x9C + (i * bytes_length) + m_opening_bnr_offset, bytes_length, (u8*)&temp))
{
names.push_back("");
}
else
if (footer_size >= 0xF1 && Read(0x9C + (i * bytes_length) + m_opening_bnr_offset, bytes_length, (u8*)&temp))
{
std::wstring out_temp;
out_temp.resize(string_length);
std::transform(temp, temp + out_temp.size(), out_temp.begin(), (u16(&)(u16))Common::swap16);
out_temp.erase(std::find(out_temp.begin(), out_temp.end(), 0x00), out_temp.end());
names.push_back(UTF16ToUTF8(out_temp));
std::string name = UTF16ToUTF8(out_temp);
if (!name.empty())
names[(IVolume::ELanguage)i] = name;
}
}

View File

@ -4,6 +4,7 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
@ -30,7 +31,7 @@ public:
std::string GetUniqueID() const override;
std::string GetMakerID() const override;
int GetRevision() const override;
std::vector<std::string> GetNames() const override;
std::map<IVolume::ELanguage, std::string> GetNames() const override;
u32 GetFSTSize() const override { return 0; }
std::string GetApploaderDate() const override { return "0"; }

View File

@ -4,6 +4,7 @@
#include <cstddef>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <polarssl/aes.h>
@ -191,15 +192,15 @@ int CVolumeWiiCrypted::GetRevision() const
return revision;
}
std::vector<std::string> CVolumeWiiCrypted::GetNames() const
std::map<IVolume::ELanguage, std::string> CVolumeWiiCrypted::GetNames() const
{
std::vector<std::string> names;
std::map<IVolume::ELanguage, std::string> names;
auto const string_decoder = CVolumeGC::GetStringDecoder(GetCountry());
char name[0xFF] = {};
if (m_pReader != nullptr && Read(0x20, 0x60, (u8*)&name, true))
names.push_back(string_decoder(name));
names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = string_decoder(name);
return names;
}

View File

@ -4,6 +4,7 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
@ -30,7 +31,7 @@ public:
std::string GetUniqueID() const override;
std::string GetMakerID() const override;
int GetRevision() const override;
std::vector<std::string> GetNames() const override;
std::map<IVolume::ELanguage, std::string> GetNames() const override;
u32 GetFSTSize() const override;
std::string GetApploaderDate() const override;

View File

@ -26,25 +26,50 @@
#include "DolphinQt/Utils/Resources.h"
#include "DolphinQt/Utils/Utils.h"
static const u32 CACHE_REVISION = 0x006;
static const u32 CACHE_REVISION = 0x007;
static const u32 DATASTREAM_REVISION = 15; // Introduced in Qt 5.2
static QStringList VectorToStringList(std::vector<std::string> vec, bool trim = false)
static QMap<IVolume::ELanguage, QString> ConvertLocalizedStrings(std::map<IVolume::ELanguage, std::string> strings)
{
QStringList result;
if (trim)
{
for (const std::string& member : vec)
result.append(QString::fromStdString(member).trimmed());
}
else
{
for (const std::string& member : vec)
result.append(QString::fromStdString(member));
}
QMap<IVolume::ELanguage, QString> result;
for (auto entry : strings)
result.insert(entry.first, QString::fromStdString(entry.second).trimmed());
return result;
}
template<class to, class from>
static QMap<to, QString> CastLocalizedStrings(QMap<from, QString> strings)
{
QMap<to, QString> result;
auto end = strings.cend();
for (auto it = strings.cbegin(); it != end; ++it)
result.insert((to)it.key(), it.value());
return result;
}
static QString GetLanguageString(IVolume::ELanguage language, QMap<IVolume::ELanguage, QString> strings)
{
if (strings.contains(language))
return strings.value(language);
// English tends to be a good fallback when the requested language isn't available
if (language != IVolume::ELanguage::LANGUAGE_ENGLISH)
{
if (strings.contains(IVolume::ELanguage::LANGUAGE_ENGLISH))
return strings.value(IVolume::ELanguage::LANGUAGE_ENGLISH);
}
// If English isn't available either, just pick something
if (!strings.empty())
return strings.cbegin().value();
return SL("");
}
GameFile::GameFile(const QString& fileName)
: m_file_name(fileName)
{
@ -66,7 +91,7 @@ GameFile::GameFile(const QString& fileName)
else
m_platform = WII_WAD;
m_volume_names = VectorToStringList(volume->GetNames());
m_volume_names = ConvertLocalizedStrings(volume->GetNames());
m_country = volume->GetCountry();
m_file_size = volume->GetRawSize();
@ -92,9 +117,9 @@ GameFile::GameFile(const QString& fileName)
if (bannerLoader->IsValid())
{
if (m_platform != WII_WAD)
m_names = VectorToStringList(bannerLoader->GetNames());
m_names = ConvertLocalizedStrings(bannerLoader->GetNames());
m_company = QString::fromStdString(bannerLoader->GetCompany());
m_descriptions = VectorToStringList(bannerLoader->GetDescriptions(), true);
m_descriptions = ConvertLocalizedStrings(bannerLoader->GetDescriptions());
int width, height;
std::vector<u32> buffer = bannerLoader->GetBanner(&width, &height);
@ -158,11 +183,15 @@ bool GameFile::LoadFromCache()
if (cache_rev != CACHE_REVISION)
return false;
int country;
u32 country;
QMap<u8, QString> volume_names;
QMap<u8, QString> names;
QMap<u8, QString> descriptions;
stream >> m_folder_name
>> m_volume_names
>> volume_names
>> names
>> m_company
>> m_descriptions
>> descriptions
>> m_unique_id
>> m_file_size
>> m_volume_size
@ -173,6 +202,9 @@ bool GameFile::LoadFromCache()
>> m_is_disc_two
>> m_revision;
m_country = (DiscIO::IVolume::ECountry)country;
m_volume_names = CastLocalizedStrings<IVolume::ELanguage>(volume_names);
m_names = CastLocalizedStrings<IVolume::ELanguage>(names);
m_descriptions = CastLocalizedStrings<IVolume::ELanguage>(descriptions);
file.close();
return true;
}
@ -198,13 +230,14 @@ void GameFile::SaveToCache()
stream << CACHE_REVISION;
stream << m_folder_name
<< m_volume_names
<< CastLocalizedStrings<u8>(m_volume_names)
<< CastLocalizedStrings<u8>(m_names)
<< m_company
<< m_descriptions
<< CastLocalizedStrings<u8>(m_descriptions)
<< m_unique_id
<< m_file_size
<< m_volume_size
<< (int)m_country
<< (u32)m_country
<< m_banner
<< m_compressed
<< m_platform
@ -233,55 +266,36 @@ QString GameFile::CreateCacheFilename()
QString GameFile::GetCompany() const
{
if (m_company.isEmpty())
return QObject::tr("N/A");
else
return m_company;
return m_company;
}
// For all of the following functions that accept an "index" parameter,
// (-1 = Japanese, 0 = English, etc)?
QString GameFile::GetDescription(int index) const
QString GameFile::GetDescription(IVolume::ELanguage language) const
{
if (index < m_descriptions.size())
return m_descriptions[index];
if (!m_descriptions.empty())
return m_descriptions[0];
return SL("");
return GetLanguageString(language, m_descriptions);
}
QString GameFile::GetVolumeName(int index) const
QString GameFile::GetDescription() const
{
if (index < m_volume_names.size() && !m_volume_names[index].isEmpty())
return m_volume_names[index];
if (!m_volume_names.isEmpty())
return m_volume_names[0];
return SL("");
return GetDescription(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(m_platform != GAMECUBE_DISC));
}
QString GameFile::GetBannerName(int index) const
QString GameFile::GetVolumeName(IVolume::ELanguage language) const
{
if (index < m_names.size() && !m_names[index].isEmpty())
return m_names[index];
if (!m_names.isEmpty())
return m_names[0];
return SL("");
return GetLanguageString(language, m_volume_names);
}
QString GameFile::GetName(int index) const
QString GameFile::GetBannerName(IVolume::ELanguage language) const
{
return GetLanguageString(language, m_names);
}
QString GameFile::GetName(IVolume::ELanguage language) const
{
// Prefer name from banner, fallback to name from volume, fallback to filename
QString name = GetBannerName(index);
QString name = GetBannerName(language);
if (name.isEmpty())
name = GetVolumeName(index);
name = GetVolumeName(language);
if (name.isEmpty())
{
@ -294,6 +308,11 @@ QString GameFile::GetName(int index) const
return name;
}
QString GameFile::GetName() const
{
return GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(m_platform != GAMECUBE_DISC));
}
const QString GameFile::GetWiiFSPath() const
{
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(m_file_name.toStdString()));

View File

@ -4,9 +4,9 @@
#pragma once
#include <QMap>
#include <QPixmap>
#include <QString>
#include <QStringList>
#include <string>
@ -22,11 +22,13 @@ public:
bool IsValid() const { return m_valid; }
QString GetFileName() { return m_file_name; }
QString GetFolderName() { return m_folder_name; }
QString GetBannerName(int index) const;
QString GetVolumeName(int index) const;
QString GetName(int index) const;
QString GetBannerName(DiscIO::IVolume::ELanguage language) const;
QString GetVolumeName(DiscIO::IVolume::ELanguage language) const;
QString GetName(DiscIO::IVolume::ELanguage language) const;
QString GetName() const;
QString GetCompany() const;
QString GetDescription(int index = 0) const;
QString GetDescription(DiscIO::IVolume::ELanguage language) const;
QString GetDescription() const;
int GetRevision() const { return m_revision; }
const QString GetUniqueID() const { return m_unique_id; }
const QString GetWiiFSPath() const;
@ -53,11 +55,11 @@ private:
QString m_folder_name;
// TODO: eliminate this and overwrite with names from banner when available?
QStringList m_volume_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_volume_names;
QString m_company;
QStringList m_names;
QStringList m_descriptions;
QMap<DiscIO::IVolume::ELanguage, QString> m_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_descriptions;
QString m_unique_id;

View File

@ -76,7 +76,7 @@ void DGameGrid::AddGame(GameFile* gameItem)
QListWidgetItem* i = new QListWidgetItem;
i->setIcon(QIcon(gameItem->GetBitmap()
.scaled(GRID_BANNER_WIDTH, GRID_BANNER_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
i->setText(gameItem->GetName(0));
i->setText(gameItem->GetName());
if (gameItem->IsCompressed())
i->setTextColor(QColor("#00F"));

View File

@ -110,7 +110,7 @@ void DGameTree::AddGame(GameFile* item)
QTreeWidgetItem* i = new QTreeWidgetItem;
i->setIcon(COL_TYPE, QIcon(Resources::GetPlatformPixmap(item->GetPlatform())));
i->setIcon(COL_BANNER, QIcon(item->GetBitmap()));
i->setText(COL_TITLE, item->GetName(0));
i->setText(COL_TITLE, item->GetName());
i->setText(COL_DESCRIPTION, item->GetDescription());
i->setIcon(COL_REGION, QIcon(Resources::GetRegionPixmap(item->GetCountry())));
i->setText(COL_SIZE, NiceSizeFormat(item->GetFileSize()));

View File

@ -11,6 +11,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "DiscIO/Volume.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Config/WiiConfigPane.h"
@ -125,7 +126,7 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event)
void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event)
{
int wii_system_lang = m_system_language_choice->GetSelection();
IVolume::ELanguage wii_system_lang = (IVolume::ELanguage)m_system_language_choice->GetSelection();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang);
u8 country_code = GetSADRCountryCode(wii_system_lang);
@ -138,41 +139,33 @@ void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", m_aspect_ratio_choice->GetSelection());
}
// Change from IPL.LNG value to IPL.SADR country code
u8 WiiConfigPane::GetSADRCountryCode(int language)
// Change from IPL.LNG value to IPL.SADR country code.
// http://wiibrew.org/wiki/Country_Codes
u8 WiiConfigPane::GetSADRCountryCode(IVolume::ELanguage language)
{
//http://wiibrew.org/wiki/Country_Codes
u8 country_code = language;
switch (country_code)
switch (language)
{
case 0: //Japanese
country_code = 1; //Japan
break;
case 1: //English
country_code = 49; //USA
break;
case 2: //German
country_code = 78; //Germany
break;
case 3: //French
country_code = 77; //France
break;
case 4: //Spanish
country_code = 105; //Spain
break;
case 5: //Italian
country_code = 83; //Italy
break;
case 6: //Dutch
country_code = 94; //Netherlands
break;
case 7: //Simplified Chinese
case 8: //Traditional Chinese
country_code = 157; //China
break;
case 9: //Korean
country_code = 136; //Korea
break;
case IVolume::LANGUAGE_JAPANESE:
return 1; // Japan
case IVolume::LANGUAGE_ENGLISH:
return 49; // USA
case IVolume::LANGUAGE_GERMAN:
return 78; // Germany
case IVolume::LANGUAGE_FRENCH:
return 77; // France
case IVolume::LANGUAGE_SPANISH:
return 105; // Spain
case IVolume::LANGUAGE_ITALIAN:
return 83; // Italy
case IVolume::LANGUAGE_DUTCH:
return 94; // Netherlands
case IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
case IVolume::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China
case IVolume::LANGUAGE_KOREAN:
return 136; // Korea
}
return country_code;
PanicAlert("Invalid language");
return 1;
}

View File

@ -7,6 +7,7 @@
#include <wx/arrstr.h>
#include <wx/panel.h>
#include "Common/CommonTypes.h"
#include "DiscIO/Volume.h"
class wxCheckBox;
class wxChoice;
@ -29,7 +30,7 @@ private:
void OnSystemLanguageChoiceChanged(wxCommandEvent&);
void OnAspectRatioChoiceChanged(wxCommandEvent&);
static u8 GetSADRCountryCode(int language);
static u8 GetSADRCountryCode(IVolume::ELanguage language);
wxArrayString m_system_language_strings;
wxArrayString m_aspect_ratio_strings;

View File

@ -99,34 +99,13 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
sortData = -sortData;
}
int indexOne = 0;
int indexOther = 0;
// index only matters for WADS and PAL GC games, but invalid indicies for the others
// will return the (only) language in the list
if (iso1->GetPlatform() == GameListItem::WII_WAD)
{
indexOne = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
}
else // GC
{
indexOne = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
}
if (iso2->GetPlatform() == GameListItem::WII_WAD)
{
indexOther = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
}
else // GC
{
indexOther = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
}
IVolume::ELanguage languageOne = SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(iso1->GetPlatform() != GameListItem::GAMECUBE_DISC);
IVolume::ELanguage languageOther = SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(iso2->GetPlatform() != GameListItem::GAMECUBE_DISC);
switch (sortData)
{
case CGameListCtrl::COLUMN_TITLE:
if (!strcasecmp(iso1->GetName(indexOne).c_str(),iso2->GetName(indexOther).c_str()))
if (!strcasecmp(iso1->GetName(languageOne).c_str(), iso2->GetName(languageOther).c_str()))
{
if (iso1->GetUniqueID() != iso2->GetUniqueID())
return t * (iso1->GetUniqueID() > iso2->GetUniqueID() ? 1 : -1);
@ -135,16 +114,16 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
if (iso1->IsDiscTwo() != iso2->IsDiscTwo())
return t * (iso1->IsDiscTwo() ? 1 : -1);
}
return strcasecmp(iso1->GetName(indexOne).c_str(),
iso2->GetName(indexOther).c_str()) * t;
return strcasecmp(iso1->GetName(languageOne).c_str(),
iso2->GetName(languageOther).c_str()) * t;
case CGameListCtrl::COLUMN_NOTES:
{
std::string cmp1 =
(iso1->GetPlatform() == GameListItem::GAMECUBE_DISC) ?
iso1->GetCompany() : iso1->GetDescription(indexOne);
iso1->GetCompany() : iso1->GetDescription(languageOne);
std::string cmp2 =
(iso2->GetPlatform() == GameListItem::GAMECUBE_DISC) ?
iso2->GetCompany() : iso2->GetDescription(indexOther);
iso2->GetCompany() : iso2->GetDescription(languageOther);
return strcasecmp(cmp1.c_str(), cmp2.c_str()) * t;
}
case CGameListCtrl::COLUMN_ID:
@ -433,15 +412,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// Set the game's banner in the second column
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
int SelectedLanguage = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
// Is this sane?
if (rISOFile.GetPlatform() == GameListItem::WII_WAD)
{
SelectedLanguage = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
}
std::string name = rISOFile.GetName(SelectedLanguage);
std::string name = rISOFile.GetName();
std::ifstream titlestxt;
OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "titles.txt", std::ios::in);
@ -474,7 +445,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// We show the company string on GameCube only
// On Wii we show the description instead as the company string is empty
std::string const notes = (rISOFile.GetPlatform() == GameListItem::GAMECUBE_DISC) ?
rISOFile.GetCompany() : rISOFile.GetDescription(SelectedLanguage);
rISOFile.GetCompany() : rISOFile.GetDescription();
SetItem(_Index, COLUMN_NOTES, StrToWxStr(notes), -1);
// Emulation state

View File

@ -7,6 +7,7 @@
#include <cstring>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <wx/app.h>
#include <wx/bitmap.h>
@ -37,11 +38,33 @@
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/WxUtils.h"
static const u32 CACHE_REVISION = 0x122;
static const u32 CACHE_REVISION = 0x123;
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
static std::string GetLanguageString(IVolume::ELanguage language, std::map<IVolume::ELanguage, std::string> strings)
{
auto end = strings.end();
auto it = strings.find(language);
if (it != end)
return it->second;
// English tends to be a good fallback when the requested language isn't available
if (language != IVolume::ELanguage::LANGUAGE_ENGLISH)
{
it = strings.find(IVolume::ELanguage::LANGUAGE_ENGLISH);
if (it != end)
return it->second;
}
// If English isn't available either, just pick something
if (!strings.empty())
return strings.cbegin()->second;
return "";
}
GameListItem::GameListItem(const std::string& _rFileName)
: m_FileName(_rFileName)
, m_emu_state(0)
@ -202,63 +225,37 @@ std::string GameListItem::CreateCacheFilename()
std::string GameListItem::GetCompany() const
{
if (m_company.empty())
return "N/A";
else
return m_company;
return m_company;
}
// (-1 = Japanese, 0 = English, etc)?
std::string GameListItem::GetDescription(int _index) const
std::string GameListItem::GetDescription(IVolume::ELanguage language) const
{
const u32 index = _index;
if (index < m_descriptions.size())
return m_descriptions[index];
if (!m_descriptions.empty())
return m_descriptions[0];
return "";
return GetLanguageString(language, m_descriptions);
}
// (-1 = Japanese, 0 = English, etc)?
std::string GameListItem::GetVolumeName(int _index) const
std::string GameListItem::GetDescription() const
{
u32 const index = _index;
if (index < m_volume_names.size() && !m_volume_names[index].empty())
return m_volume_names[index];
if (!m_volume_names.empty())
return m_volume_names[0];
return "";
return GetDescription(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(m_Platform != GAMECUBE_DISC));
}
// (-1 = Japanese, 0 = English, etc)?
std::string GameListItem::GetBannerName(int _index) const
std::string GameListItem::GetVolumeName(IVolume::ELanguage language) const
{
u32 const index = _index;
if (index < m_banner_names.size() && !m_banner_names[index].empty())
return m_banner_names[index];
if (!m_banner_names.empty())
return m_banner_names[0];
return "";
return GetLanguageString(language, m_volume_names);
}
// (-1 = Japanese, 0 = English, etc)?
std::string GameListItem::GetName(int _index) const
std::string GameListItem::GetBannerName(IVolume::ELanguage language) const
{
return GetLanguageString(language, m_banner_names);
}
std::string GameListItem::GetName(IVolume::ELanguage language) const
{
// Prefer name from banner, fallback to name from volume, fallback to filename
std::string name = GetBannerName(_index);
std::string name = GetBannerName(language);
if (name.empty())
name = GetVolumeName(_index);
name = GetVolumeName(language);
if (name.empty())
{
@ -269,6 +266,23 @@ std::string GameListItem::GetName(int _index) const
return name;
}
std::string GameListItem::GetName() const
{
return GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(m_Platform != GAMECUBE_DISC));
}
std::vector<IVolume::ELanguage> GameListItem::GetLanguages() const
{
std::map<IVolume::ELanguage, std::string> language_strings = m_banner_names;
if (m_volume_names.size() > m_banner_names.size())
language_strings = m_volume_names;
std::vector<IVolume::ELanguage> languages;
for (std::pair<IVolume::ELanguage, std::string> language_string : language_strings)
languages.emplace_back(language_string.first);
return languages;
}
const std::string GameListItem::GetWiiFSPath() const
{
DiscIO::IVolume *iso = DiscIO::CreateVolumeFromFilename(m_FileName);

View File

@ -5,6 +5,7 @@
#pragma once
#include <string>
#include <utility>
#include <vector>
#include "Common/Common.h"
@ -24,11 +25,14 @@ public:
bool IsValid() const {return m_Valid;}
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 GetBannerName(IVolume::ELanguage language) const;
std::string GetVolumeName(IVolume::ELanguage language) const;
std::string GetName(IVolume::ELanguage language) const;
std::string GetName() const;
std::string GetCompany() const;
std::string GetDescription(int index = 0) const;
std::string GetDescription(IVolume::ELanguage language) const;
std::string GetDescription() const;
std::vector<IVolume::ELanguage> GetLanguages() const;
int GetRevision() const { return m_Revision; }
const std::string& GetUniqueID() const {return m_UniqueID;}
const std::string GetWiiFSPath() const;
@ -58,12 +62,12 @@ private:
std::string m_FileName;
// TODO: eliminate this and overwrite with names from banner when available?
std::vector<std::string> m_volume_names;
std::map<IVolume::ELanguage, std::string> m_volume_names;
// Stuff from banner
std::string m_company;
std::vector<std::string> m_banner_names;
std::vector<std::string> m_descriptions;
std::map<IVolume::ELanguage, std::string> m_banner_names;
std::map<IVolume::ELanguage, std::string> m_descriptions;
std::string m_UniqueID;

View File

@ -114,9 +114,8 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
{
// Load ISO data
OpenISO = DiscIO::CreateVolumeFromFilename(fileName);
bool IsWad = OpenISO->IsWadFile();
// TODO: Is it really necessary to use GetTitleID in case GetUniqueID fails?
// Is it really necessary to use GetTitleID if GetUniqueID fails?
game_id = OpenISO->GetUniqueID();
if (game_id.empty())
{
@ -137,7 +136,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
bRefreshList = false;
CreateGUIControls(IsWad);
CreateGUIControls();
LoadGameConfig();
@ -173,33 +172,15 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
break;
case DiscIO::IVolume::COUNTRY_USA:
m_Country->SetValue(_("USA"));
if (!IsWad) // For (non wad) NTSC Games, there's no multi lang
{
m_Lang->SetSelection(0);
m_Lang->Disable();
}
break;
case DiscIO::IVolume::COUNTRY_JAPAN:
m_Country->SetValue(_("Japan"));
if (!IsWad) // For (non wad) NTSC Games, there's no multi lang
{
m_Lang->Insert(_("Japanese"), 0);
m_Lang->SetSelection(0);
m_Lang->Disable();
}
break;
case DiscIO::IVolume::COUNTRY_KOREA:
m_Country->SetValue(_("Korea"));
break;
case DiscIO::IVolume::COUNTRY_TAIWAN:
m_Country->SetValue(_("Taiwan"));
if (!IsWad) // For (non wad) NTSC Games, there's no multi lang
{
m_Lang->Insert(_("Taiwan"), 0);
m_Lang->SetSelection(0);
m_Lang->Disable();
}
break;
case DiscIO::IVolume::COUNTRY_WORLD:
m_Country->SetValue(_("World"));
@ -210,27 +191,14 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
break;
}
if (OpenISO->IsWiiDisc()) // Only one language with Wii banners
{
m_Lang->SetSelection(0);
m_Lang->Disable();
}
wxString temp = "0x" + StrToWxStr(OpenISO->GetMakerID());
m_MakerID->SetValue(temp);
m_Revision->SetValue(wxString::Format("%u", OpenISO->GetRevision()));
m_Date->SetValue(StrToWxStr(OpenISO->GetApploaderDate()));
m_FST->SetValue(wxString::Format("%u", OpenISO->GetFSTSize()));
// Here we set all the info to be shown (be it SJIS or Ascii) + we set the window title
if (!IsWad)
{
ChangeBannerDetails(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
}
else
{
ChangeBannerDetails(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"));
}
// Here we set all the info to be shown + we set the window title
ChangeBannerDetails(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(OpenISO->IsWadFile() || OpenISO->IsWiiDisc()));
m_Banner->SetBitmap(OpenGameListItem->GetBitmap());
m_Banner->Bind(wxEVT_RIGHT_DOWN, &CISOProperties::RightClickOnBanner, this);
@ -343,7 +311,7 @@ long CISOProperties::GetElementStyle(const char* section, const char* key)
return wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER;
}
void CISOProperties::CreateGUIControls(bool IsWad)
void CISOProperties::CreateGUIControls()
{
wxButton* const EditConfig = new wxButton(this, ID_EDITCONFIG, _("Edit Config"));
EditConfig->SetToolTip(_("This will let you manually edit the INI config file."));
@ -526,24 +494,58 @@ void CISOProperties::CreateGUIControls(bool IsWad)
m_MD5SumCompute = new wxButton(m_Information, ID_MD5SUMCOMPUTE, _("Compute"));
wxStaticText* const m_LangText = new wxStaticText(m_Information, wxID_ANY, _("Show Language:"));
arrayStringFor_Lang.Add(_("English"));
arrayStringFor_Lang.Add(_("German"));
arrayStringFor_Lang.Add(_("French"));
arrayStringFor_Lang.Add(_("Spanish"));
arrayStringFor_Lang.Add(_("Italian"));
arrayStringFor_Lang.Add(_("Dutch"));
int language = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
if (IsWad)
{
arrayStringFor_Lang.Insert(_("Japanese"), 0);
arrayStringFor_Lang.Add(_("Simplified Chinese"));
arrayStringFor_Lang.Add(_("Traditional Chinese"));
arrayStringFor_Lang.Add(_("Korean"));
language = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
IVolume::ELanguage preferred_language = SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(OpenISO->IsWadFile() || OpenISO->IsWiiDisc());
std::vector<IVolume::ELanguage> languages = OpenGameListItem->GetLanguages();
int preferred_language_index = 0;
for (size_t i = 0; i < languages.size(); ++i)
{
if (languages[i] == preferred_language)
preferred_language_index = i;
switch (languages[i])
{
case IVolume::LANGUAGE_JAPANESE:
arrayStringFor_Lang.Add(_("Japanese"));
break;
case IVolume::LANGUAGE_ENGLISH:
arrayStringFor_Lang.Add(_("English"));
break;
case IVolume::LANGUAGE_GERMAN:
arrayStringFor_Lang.Add(_("German"));
break;
case IVolume::LANGUAGE_FRENCH:
arrayStringFor_Lang.Add(_("French"));
break;
case IVolume::LANGUAGE_SPANISH:
arrayStringFor_Lang.Add(_("Spanish"));
break;
case IVolume::LANGUAGE_ITALIAN:
arrayStringFor_Lang.Add(_("Italian"));
break;
case IVolume::LANGUAGE_DUTCH:
arrayStringFor_Lang.Add(_("Dutch"));
break;
case IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
arrayStringFor_Lang.Add(_("Simplified Chinese"));
break;
case IVolume::LANGUAGE_TRADITIONAL_CHINESE:
arrayStringFor_Lang.Add(_("Traditional Chinese"));
break;
case IVolume::LANGUAGE_KOREAN:
arrayStringFor_Lang.Add(_("Korean"));
break;
case IVolume::LANGUAGE_UNKNOWN:
default:
arrayStringFor_Lang.Add(_("Unknown"));
break;
}
}
m_Lang = new wxChoice(m_Information, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang);
m_Lang->SetSelection(language);
m_Lang->SetSelection(preferred_language_index);
if (arrayStringFor_Lang.size() <= 1)
m_Lang->Disable();
wxStaticText* const m_ShortText = new wxStaticText(m_Information, wxID_ANY, _("Short Name:"));
m_ShortName = new wxTextCtrl(m_Information, ID_SHORTNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
@ -603,7 +605,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND|wxALL, 5);
m_Information->SetSizer(sInfoPage);
if (!IsWad)
if (!OpenISO->IsWadFile())
{
wxPanel* const m_Filesystem = new wxPanel(m_Notebook, ID_FILESYSTEM);
m_Notebook->AddPage(m_Filesystem, _("Filesystem"));
@ -1477,13 +1479,13 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event)
void CISOProperties::OnChangeBannerLang(wxCommandEvent& event)
{
ChangeBannerDetails(event.GetSelection());
ChangeBannerDetails(OpenGameListItem->GetLanguages()[event.GetSelection()]);
}
void CISOProperties::ChangeBannerDetails(int lang)
void CISOProperties::ChangeBannerDetails(IVolume::ELanguage language)
{
wxString const shortName = StrToWxStr(OpenGameListItem->GetName(lang));
wxString const comment = StrToWxStr(OpenGameListItem->GetDescription(lang));
wxString const shortName = StrToWxStr(OpenGameListItem->GetName(language));
wxString const comment = StrToWxStr(OpenGameListItem->GetDescription(language));
wxString const maker = StrToWxStr(OpenGameListItem->GetCompany());
// Updates the information shown in the window

View File

@ -197,7 +197,7 @@ private:
void LaunchExternalEditor(const std::string& filename);
void CreateGUIControls(bool);
void CreateGUIControls();
void OnClose(wxCloseEvent& event);
void OnCloseClick(wxCommandEvent& event);
void OnEditConfig(wxCommandEvent& event);
@ -240,7 +240,7 @@ private:
void PatchList_Load();
void PatchList_Save();
void ActionReplayList_Save();
void ChangeBannerDetails(int lang);
void ChangeBannerDetails(IVolume::ELanguage language);
long GetElementStyle(const char* section, const char* key);
void SetCheckboxValueFromGameini(const char* section, const char* key, wxCheckBox* checkbox);

View File

@ -17,6 +17,7 @@
#include <cstdio>
#include <cstdlib>
#include <map>
#include <jni.h>
#include <android/log.h>
#include <android/native_window_jni.h>
@ -114,8 +115,8 @@ static bool MsgAlert(const char* caption, const char* text, bool /*yes_no*/, int
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
std::vector<std::string> m_volume_names;
std::vector<std::string> m_names;
std::map<DiscIO::IVolume::ELanguage, std::string> m_volume_names;
std::map<DiscIO::IVolume::ELanguage, std::string> m_names;
static inline u32 Average32(u32 a, u32 b) {
return ((a >> 1) & 0x7f7f7f7f) + ((b >> 1) & 0x7f7f7f7f);

View File

@ -69,7 +69,7 @@ static wxString FailureReasonStringForHostLabel(int reason)
static std::string BuildGameName(const GameListItem& game)
{
// Lang needs to be consistent
auto const lang = 0;
IVolume::ELanguage const lang = IVolume::LANGUAGE_ENGLISH;
std::string name(game.GetName(lang));