add wstring name(s)/description to the cachefile, use when available in gamelist and properties window
This commit is contained in:
parent
7f4efa094e
commit
de4e3e7462
|
@ -154,7 +154,21 @@ public:
|
|||
}
|
||||
(*ptr) += stringLen;
|
||||
}
|
||||
|
||||
|
||||
void Do(std::wstring &x)
|
||||
{
|
||||
int stringLen = sizeof(wchar_t)*((int)x.length() + 1);
|
||||
Do(stringLen);
|
||||
|
||||
switch (mode) {
|
||||
case MODE_READ: x = (wchar_t*)*ptr; break;
|
||||
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
|
||||
case MODE_MEASURE: break;
|
||||
case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break;
|
||||
}
|
||||
(*ptr) += stringLen;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void DoArray(T *x, int count) {
|
||||
DoVoid((void *)x, sizeof(T) * count);
|
||||
|
|
|
@ -465,61 +465,62 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
|||
|
||||
// Set the game's banner in the second column
|
||||
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
|
||||
|
||||
std::wstring wname;
|
||||
const std::wstring& wdescription = rISOFile.GetDescription();
|
||||
std::string company;
|
||||
|
||||
if (rISOFile.GetPlatform() != GameListItem::WII_WAD)
|
||||
// We show the company string on Gamecube only
|
||||
// On Wii we show the description instead as the company string is empty
|
||||
if (rISOFile.GetPlatform() == GameListItem::GAMECUBE_DISC)
|
||||
company = rISOFile.GetCompany().c_str();
|
||||
|
||||
switch (rISOFile.GetCountry())
|
||||
{
|
||||
std::string company;
|
||||
|
||||
// We show the company string on Gamecube only
|
||||
// On Wii we show the description instead as the company string is empty
|
||||
if (rISOFile.GetPlatform() == GameListItem::GAMECUBE_DISC)
|
||||
company = rISOFile.GetCompany().c_str();
|
||||
|
||||
switch (rISOFile.GetCountry())
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
{
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
{
|
||||
wxString name = wxString(rISOFile.GetName(0).c_str(), SJISConv);
|
||||
m_gameList.append(StringFromFormat("%s (J)\n", (const char *)name.c_str()));
|
||||
SetItem(_Index, COLUMN_TITLE, name, -1);
|
||||
SetItem(_Index, COLUMN_NOTES, wxString(company.size() ?
|
||||
company.c_str() : rISOFile.GetDescription(0).c_str(),
|
||||
SJISConv), -1);
|
||||
}
|
||||
break;
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
m_gameList.append(StringFromFormat("%s (U)\n", rISOFile.GetName(0).c_str()));
|
||||
SetItem(_Index, COLUMN_TITLE,
|
||||
wxString::From8BitData(rISOFile.GetName(0).c_str()), -1);
|
||||
SetItem(_Index, COLUMN_NOTES,
|
||||
wxString::From8BitData(company.size() ?
|
||||
company.c_str() : rISOFile.GetDescription(0).c_str()), -1);
|
||||
break;
|
||||
default:
|
||||
m_gameList.append(StringFromFormat("%s (E)\n",
|
||||
rISOFile.GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage).c_str()));
|
||||
SetItem(_Index, COLUMN_TITLE,
|
||||
wxString::From8BitData(
|
||||
rISOFile.GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage).c_str()),
|
||||
-1);
|
||||
SetItem(_Index, COLUMN_NOTES,
|
||||
wxString::From8BitData(company.size() ?
|
||||
company.c_str() :
|
||||
rISOFile.GetDescription(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage).c_str()),
|
||||
-1);
|
||||
break;
|
||||
rISOFile.GetName(wname, -1);
|
||||
wxString name = wxString(rISOFile.GetName(0).c_str(), SJISConv);
|
||||
m_gameList.append(StringFromFormat("%s (J)\n", (const char *)name.c_str()));
|
||||
SetItem(_Index, COLUMN_TITLE, name, -1);
|
||||
SetItem(_Index, COLUMN_NOTES, wxString(company.size() ?
|
||||
company.c_str() : rISOFile.GetDescription(0).c_str(),
|
||||
SJISConv), -1);
|
||||
}
|
||||
}
|
||||
else // It's a Wad file
|
||||
{
|
||||
m_gameList.append(StringFromFormat("%s (WAD)\n", rISOFile.GetName(0).c_str()));
|
||||
break;
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
rISOFile.GetName(wname);
|
||||
SetItem(_Index, COLUMN_TITLE,
|
||||
wxString(rISOFile.GetName(0).c_str(), SJISConv), -1);
|
||||
wxString::From8BitData(rISOFile.GetName(0).c_str()), -1);
|
||||
m_gameList.append(StringFromFormat("%s (U)\n", rISOFile.GetName(0).c_str()));
|
||||
SetItem(_Index, COLUMN_NOTES,
|
||||
wxString(rISOFile.GetDescription(0).c_str(), SJISConv), -1);
|
||||
wxString::From8BitData(company.size() ?
|
||||
company.c_str() : rISOFile.GetDescription(0).c_str()), -1);
|
||||
break;
|
||||
default:
|
||||
rISOFile.GetName(wname, SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
|
||||
SetItem(_Index, COLUMN_TITLE,
|
||||
wxString::From8BitData(
|
||||
rISOFile.GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage).c_str()),
|
||||
-1);
|
||||
m_gameList.append(StringFromFormat("%s (E)\n",
|
||||
rISOFile.GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage).c_str()));
|
||||
SetItem(_Index, COLUMN_NOTES,
|
||||
wxString::From8BitData(company.size() ?
|
||||
company.c_str() :
|
||||
rISOFile.GetDescription(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage).c_str()),
|
||||
-1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (wname.length())
|
||||
SetItem(_Index, COLUMN_TITLE, wname, -1);
|
||||
if (wdescription.length())
|
||||
SetItem(_Index, COLUMN_NOTES, wdescription, -1);
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
// Emulation state
|
||||
SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[rISOFile.GetEmuState()]);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "ChunkFile.h"
|
||||
#include "../resources/no_banner.cpp"
|
||||
|
||||
#define CACHE_REVISION 0x10B
|
||||
#define CACHE_REVISION 0x10C
|
||||
|
||||
#define DVD_BANNER_WIDTH 96
|
||||
#define DVD_BANNER_HEIGHT 32
|
||||
|
@ -63,18 +63,26 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
|||
if (!DiscIO::IsVolumeWadFile(pVolume))
|
||||
m_Platform = DiscIO::IsVolumeWiiDisc(pVolume) ? WII_DISC : GAMECUBE_DISC;
|
||||
else
|
||||
{
|
||||
m_Platform = WII_WAD;
|
||||
pVolume->GetWName(m_wNames);
|
||||
}
|
||||
|
||||
m_Company = "N/A";
|
||||
|
||||
|
||||
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] = pVolume->GetName();
|
||||
if(m_Name[i] == "") // Couldn't find the name in the WAD...
|
||||
{
|
||||
std::string FileName;
|
||||
SplitPath(_rFileName, NULL, &FileName, NULL);
|
||||
m_Name[i] = FileName; // Then just display the filename... Better than something like "No Name"
|
||||
}
|
||||
m_Name[i] = m_Name[0];
|
||||
m_Description[i] = "No Description";
|
||||
}
|
||||
m_Country = pVolume->GetCountry();
|
||||
|
@ -95,9 +103,13 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
|||
{
|
||||
if (pBannerLoader->IsValid())
|
||||
{
|
||||
pBannerLoader->GetName(m_Name); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0);
|
||||
m_wNames.clear();
|
||||
if (!pBannerLoader->GetName(m_wNames))
|
||||
pBannerLoader->GetName(m_Name);
|
||||
pBannerLoader->GetCompany(m_Company);
|
||||
pBannerLoader->GetDescription(m_Description);
|
||||
if (!pBannerLoader->GetDescription(m_wDescription))
|
||||
pBannerLoader->GetDescription(m_Description);
|
||||
|
||||
if (pBannerLoader->GetBanner(g_ImageTemp))
|
||||
{
|
||||
// resize vector to image size
|
||||
|
@ -116,6 +128,25 @@ 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 i = 0; i < length; ++i)
|
||||
wFileName.push_back(FileName[i]);
|
||||
wFileName.push_back(0);
|
||||
}
|
||||
*i = wFileName;
|
||||
}
|
||||
}
|
||||
|
||||
delete pVolume;
|
||||
|
||||
|
@ -172,9 +203,31 @@ 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_wDescription);
|
||||
p.Do(m_UniqueID);
|
||||
p.Do(m_FileSize);
|
||||
p.Do(m_VolumeSize);
|
||||
|
@ -211,6 +264,11 @@ const std::string& GameListItem::GetDescription(int index) const
|
|||
return m_Description[0];
|
||||
}
|
||||
|
||||
const std::wstring& GameListItem::GetDescription() const
|
||||
{
|
||||
return m_wDescription;
|
||||
}
|
||||
|
||||
const std::string& GameListItem::GetName(int index) const
|
||||
{
|
||||
if ((index >=0) && (index < 6))
|
||||
|
@ -220,6 +278,28 @@ const std::string& GameListItem::GetName(int index) const
|
|||
return m_Name[0];
|
||||
}
|
||||
|
||||
bool GameListItem::GetName(std::wstring& wName, 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() > index)
|
||||
{
|
||||
wName = m_wNames[index];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (m_wNames.size() > 0)
|
||||
{
|
||||
wName = m_wNames[0];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
const std::string GameListItem::GetWiiFSPath() const
|
||||
{
|
||||
DiscIO::IVolume *Iso = DiscIO::CreateVolumeFromFilename(m_FileName);
|
||||
|
|
|
@ -35,8 +35,10 @@ public:
|
|||
bool IsValid() const {return m_Valid;}
|
||||
const std::string& GetFileName() const {return m_FileName;}
|
||||
const std::string& GetName(int index) const;
|
||||
bool GetName(std::wstring& wName, int index=0) const;
|
||||
const std::string& GetCompany() const {return m_Company;}
|
||||
const std::string& GetDescription(int index) const;
|
||||
const std::wstring& GetDescription() const;
|
||||
const std::string& GetUniqueID() const {return m_UniqueID;}
|
||||
const std::string GetWiiFSPath() const;
|
||||
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
|
||||
|
@ -63,8 +65,10 @@ public:
|
|||
private:
|
||||
std::string m_FileName;
|
||||
std::string m_Name[6];
|
||||
std::vector<std::wstring> m_wNames;
|
||||
std::string m_Company;
|
||||
std::string m_Description[6];
|
||||
std::wstring m_wDescription;
|
||||
std::string m_UniqueID;
|
||||
|
||||
std::string m_issues;
|
||||
|
|
|
@ -154,7 +154,15 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
|||
}
|
||||
|
||||
// Disk header and apploader
|
||||
m_Name->SetValue(wxString(OpenISO->GetName().c_str(), wxConvUTF8));
|
||||
|
||||
std::wstring wname;
|
||||
wxString name;
|
||||
if (OpenGameListItem->GetName(wname))
|
||||
name = wname;
|
||||
else
|
||||
name = wxString(OpenISO->GetName().c_str(), wxConvUTF8);
|
||||
m_Name->SetValue(name);
|
||||
|
||||
m_GameID->SetValue(wxString(OpenISO->GetUniqueID().c_str(), wxConvUTF8));
|
||||
switch (OpenISO->GetCountry())
|
||||
{
|
||||
|
@ -1253,53 +1261,67 @@ void CISOProperties::OnChangeBannerLang(wxCommandEvent& event)
|
|||
|
||||
void CISOProperties::ChangeBannerDetails(int lang)
|
||||
{
|
||||
if (OpenGameListItem->GetCountry() == DiscIO::IVolume::COUNTRY_JAPAN
|
||||
|| OpenGameListItem->GetCountry() == DiscIO::IVolume::COUNTRY_TAIWAN
|
||||
|| OpenGameListItem->GetPlatform() == GameListItem::WII_WAD)
|
||||
{
|
||||
std::wstring wname;
|
||||
wxString shortName,
|
||||
comment,
|
||||
maker;
|
||||
|
||||
#ifdef _WIN32
|
||||
wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent);
|
||||
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
||||
if (validCP932)
|
||||
{
|
||||
SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||
}
|
||||
#else
|
||||
wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
|
||||
#endif
|
||||
|
||||
wxString name = wxString(OpenGameListItem->GetName(0).c_str(), SJISConv);
|
||||
|
||||
// Updates the informations shown in the window
|
||||
m_ShortName->SetValue(name);
|
||||
m_Comment->SetValue(wxString(OpenGameListItem->GetDescription(0).c_str(), SJISConv));
|
||||
m_Maker->SetValue(wxString(OpenGameListItem->GetCompany().c_str(), SJISConv));//dev too
|
||||
|
||||
std::string filename, extension;
|
||||
SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension);
|
||||
|
||||
// Also sets the window's title
|
||||
SetTitle(wxString::Format(wxT("%s%s"),
|
||||
wxString(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str(), *wxConvCurrent).c_str(),
|
||||
name.c_str()));
|
||||
}
|
||||
else // Do the same for PAL/US Games (assuming ISO 8859-1)
|
||||
wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent);
|
||||
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
||||
if (validCP932)
|
||||
{
|
||||
wxString name = wxString::From8BitData(OpenGameListItem->GetName(lang).c_str());
|
||||
|
||||
m_ShortName->SetValue(name);
|
||||
m_Comment->SetValue(wxString::From8BitData(OpenGameListItem->GetDescription(lang).c_str()));
|
||||
m_Maker->SetValue(wxString::From8BitData(OpenGameListItem->GetCompany().c_str()));//dev too
|
||||
|
||||
std::string filename, extension;
|
||||
SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension);
|
||||
|
||||
SetTitle(wxString::Format(wxT("%s%s"),
|
||||
wxString::From8BitData(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str()).c_str(),
|
||||
name.c_str()));
|
||||
SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||
}
|
||||
#else
|
||||
wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
|
||||
#endif
|
||||
switch (OpenGameListItem->GetCountry())
|
||||
{
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
|
||||
if (OpenGameListItem->GetName(wname, -1))
|
||||
shortName = wname;
|
||||
else
|
||||
shortName = wxString(OpenGameListItem->GetName(0).c_str(), SJISConv);
|
||||
|
||||
if ((comment = OpenGameListItem->GetDescription()).size() == 0)
|
||||
comment = wxString(OpenGameListItem->GetDescription(0).c_str(), SJISConv);
|
||||
maker = wxString(OpenGameListItem->GetCompany().c_str(), SJISConv);
|
||||
break;
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
if (OpenGameListItem->GetName(wname))
|
||||
shortName = wname;
|
||||
else
|
||||
shortName = wxString::From8BitData(OpenGameListItem->GetName(0).c_str());
|
||||
if ((comment = OpenGameListItem->GetDescription()).size() == 0)
|
||||
comment = wxString(OpenGameListItem->GetDescription(0).c_str(), SJISConv);
|
||||
maker = wxString::From8BitData(OpenGameListItem->GetCompany().c_str());
|
||||
break;
|
||||
default:
|
||||
if (OpenGameListItem->GetName(wname, lang))
|
||||
shortName = wname;
|
||||
else
|
||||
shortName = wxString::From8BitData(OpenGameListItem->GetName(lang).c_str());
|
||||
if ((comment = OpenGameListItem->GetDescription()).size() == 0)
|
||||
comment = wxString(OpenGameListItem->GetDescription(lang).c_str(), SJISConv);
|
||||
maker = wxString::From8BitData(OpenGameListItem->GetCompany().c_str());
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
// Updates the informations shown in the window
|
||||
m_ShortName->SetValue(shortName);
|
||||
m_Comment->SetValue(comment);
|
||||
m_Maker->SetValue(maker);//dev too
|
||||
|
||||
std::string filename, extension;
|
||||
SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension);
|
||||
// Also sets the window's title
|
||||
SetTitle(wxString(StringFromFormat("%s%s: %s - ", filename.c_str(), extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str(), *wxConvCurrent)+shortName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue