mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 16:49:58 -06:00
Eliminate the wstring game name.
Some cleanup throughout related code. (try to make logic in ISOFile understandable by a human) Encode strings in UTF-8 rather than somehow trying to determine the encoding in the GUI code. Non-windows OSes temporarily broken.
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
#include "ChunkFile.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
#define CACHE_REVISION 0x110
|
||||
#define CACHE_REVISION 0x112
|
||||
|
||||
#define DVD_BANNER_WIDTH 96
|
||||
#define DVD_BANNER_HEIGHT 32
|
||||
@ -66,26 +66,10 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
||||
else
|
||||
{
|
||||
m_Platform = WII_WAD;
|
||||
pVolume->GetWName(m_wNames);
|
||||
}
|
||||
|
||||
m_Company = "N/A";
|
||||
m_volume_names = pVolume->GetNames();
|
||||
|
||||
|
||||
m_Name[0] = pVolume->GetName();
|
||||
|
||||
if(m_Name[0] == "") // Couldn't find the name in the WAD...
|
||||
{
|
||||
std::string FileName;
|
||||
SplitPath(m_FileName, NULL, &FileName, NULL);
|
||||
m_Name[0] = FileName; // Then just display the filename... Better than something like "No Name"
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
m_Name[i] = m_Name[0];
|
||||
m_Description[i] = "No Description";
|
||||
}
|
||||
m_Country = pVolume->GetCountry();
|
||||
m_FileSize = File::GetSize(_rFileName);
|
||||
m_VolumeSize = pVolume->GetSize();
|
||||
@ -105,11 +89,9 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
||||
{
|
||||
if (pBannerLoader->IsValid())
|
||||
{
|
||||
m_wNames.clear();
|
||||
pBannerLoader->GetName(m_wNames);
|
||||
pBannerLoader->GetName(m_Name);
|
||||
pBannerLoader->GetCompany(m_Company);
|
||||
pBannerLoader->GetDescription(m_Description);
|
||||
m_names = pBannerLoader->GetNames();
|
||||
m_company = pBannerLoader->GetCompany();
|
||||
m_descriptions = pBannerLoader->GetDescriptions();
|
||||
|
||||
if (pBannerLoader->GetBanner(g_ImageTemp))
|
||||
{
|
||||
@ -129,25 +111,6 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
||||
|
||||
delete pFileSystem;
|
||||
}
|
||||
std::vector<std::wstring>::iterator i, end = m_wNames.end();
|
||||
std::wstring wFileName;
|
||||
for (i = m_wNames.begin(); i != end; ++i)
|
||||
{
|
||||
if (*i == L"")
|
||||
{
|
||||
if (!wFileName.length())
|
||||
{
|
||||
std::string FileName;
|
||||
SplitPath(m_FileName, NULL, &FileName, NULL);
|
||||
int length = FileName.length();
|
||||
wFileName.reserve(length+1);
|
||||
for (int j = 0; j < length; ++j)
|
||||
wFileName.push_back(FileName[j]);
|
||||
wFileName.push_back(0);
|
||||
}
|
||||
*i = wFileName;
|
||||
}
|
||||
}
|
||||
|
||||
delete pVolume;
|
||||
|
||||
@ -208,32 +171,10 @@ void GameListItem::SaveToCache()
|
||||
|
||||
void GameListItem::DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(m_Name[0]); p.Do(m_Name[1]); p.Do(m_Name[2]);
|
||||
p.Do(m_Name[3]); p.Do(m_Name[4]); p.Do(m_Name[5]);
|
||||
|
||||
int wNamesSize = m_wNames.size();
|
||||
p.Do(wNamesSize);
|
||||
|
||||
if (p.mode == p.MODE_READ)
|
||||
{
|
||||
for (int i = 0; i < wNamesSize; ++i)
|
||||
{
|
||||
std::wstring temp;
|
||||
p.Do(temp);
|
||||
m_wNames.push_back(temp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < wNamesSize; ++i)
|
||||
{
|
||||
p.Do(m_wNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
p.Do(m_Company);
|
||||
p.Do(m_Description[0]); p.Do(m_Description[1]); p.Do(m_Description[2]);
|
||||
p.Do(m_Description[3]); p.Do(m_Description[4]); p.Do(m_Description[5]);
|
||||
p.Do(m_volume_names);
|
||||
p.Do(m_company);
|
||||
p.Do(m_names);
|
||||
p.Do(m_descriptions);
|
||||
p.Do(m_UniqueID);
|
||||
p.Do(m_FileSize);
|
||||
p.Do(m_VolumeSize);
|
||||
@ -262,44 +203,51 @@ std::string GameListItem::CreateCacheFilename()
|
||||
return fullname;
|
||||
}
|
||||
|
||||
const std::string& GameListItem::GetDescription(int index) const
|
||||
std::string GameListItem::GetCompany() const
|
||||
{
|
||||
if ((index >=0) && (index < 6))
|
||||
{
|
||||
return m_Description[index];
|
||||
}
|
||||
return m_Description[0];
|
||||
if (m_company.empty())
|
||||
return "N/A";
|
||||
else
|
||||
return m_company;
|
||||
}
|
||||
|
||||
const std::string& GameListItem::GetName(int index) const
|
||||
// (-1 = Japanese, 0 = English, etc)
|
||||
std::string GameListItem::GetDescription(int _index) const
|
||||
{
|
||||
if ((index >=0) && (index < 6))
|
||||
{
|
||||
return m_Name[index];
|
||||
}
|
||||
return m_Name[0];
|
||||
const u32 index = _index + 1;
|
||||
|
||||
if (index < m_descriptions.size())
|
||||
return m_descriptions[index];
|
||||
|
||||
if (!m_descriptions.empty())
|
||||
return m_descriptions[0];
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GameListItem::GetName(std::wstring& wName, int index) const
|
||||
// (-1 = Japanese, 0 = English, etc)
|
||||
std::string GameListItem::GetName(int _index) const
|
||||
{
|
||||
// This function will only succeed for wii discs with banners or WADs
|
||||
// utilize the same array as for gc discs (-1= Japanese, 0 = English etc
|
||||
index++;
|
||||
if ((index >= 0) && (index < 10))
|
||||
{
|
||||
if (m_wNames.size() > (size_t)index)
|
||||
{
|
||||
wName = m_wNames[index];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (m_wNames.size() > 0)
|
||||
{
|
||||
wName = m_wNames[0];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
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())
|
||||
return m_volume_names[index];
|
||||
|
||||
if (!m_volume_names.empty() && !m_volume_names[0].empty())
|
||||
return m_volume_names[0];
|
||||
|
||||
// No usable name, return filename (better than nothing)
|
||||
std::string FileName;
|
||||
SplitPath(m_FileName, NULL, &FileName, NULL);
|
||||
return FileName;
|
||||
}
|
||||
|
||||
const std::string GameListItem::GetWiiFSPath() const
|
||||
|
Reference in New Issue
Block a user