Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix truncated names and descriptions in the game list on linux.
  • Loading branch information
glennricster committed Jan 3, 2013
1 parent 91023e1 commit 3da05af
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
9 changes: 8 additions & 1 deletion Source/Core/Common/Src/ChunkFile.h
Expand Up @@ -155,7 +155,14 @@ class PointerWrap
Do(stringLen);

switch (mode) {
case MODE_READ: x = (wchar_t*)*ptr; break;
case MODE_READ:
{
wchar_t* tmp = new wchar_t[stringLen / sizeof(wchar_t)];
memcpy(tmp, *ptr, stringLen);
x = tmp;
delete[] tmp;
}
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: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break;
Expand Down
17 changes: 9 additions & 8 deletions Source/Core/DolphinWX/Src/GameListCtrl.cpp
Expand Up @@ -464,14 +464,15 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
SelectedLanguage = 0;
default:
{
wxCSConv WindowsCP1252(wxFontMapper::GetEncodingName(wxFONTENCODING_CP1252));
rISOFile.GetName(wstring_name, SelectedLanguage);

name = wxString(rISOFile.GetName(SelectedLanguage).c_str(), WindowsCP1252);
m_gameList.append(StringFromFormat("%s (%c)\n",
rISOFile.GetName(SelectedLanguage).c_str(), (rISOFile.GetCountry() == DiscIO::IVolume::COUNTRY_USA)?'U':'E'));
description = wxString(company.size() ? company.c_str() :
rISOFile.GetDescription(SelectedLanguage).c_str(), WindowsCP1252);
wxCSConv WindowsCP1252(wxFontMapper::GetEncodingName(wxFONTENCODING_CP1252));
rISOFile.GetName(wstring_name, SelectedLanguage);

name = wxString(rISOFile.GetName(SelectedLanguage).c_str(), WindowsCP1252);
m_gameList.append(StringFromFormat("%s (%c)\n",
rISOFile.GetName(SelectedLanguage).c_str(),
(rISOFile.GetCountry() == DiscIO::IVolume::COUNTRY_USA) ? 'U' : 'E'));
description = wxString(company.size() ? company.c_str() :
rISOFile.GetDescription(SelectedLanguage).c_str(), WindowsCP1252);
}
break;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/DolphinWX/Src/ISOFile.cpp
Expand Up @@ -140,8 +140,8 @@ GameListItem::GameListItem(const std::string& _rFileName)
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]);
for (int j = 0; j < length; ++j)
wFileName.push_back(FileName[j]);
wFileName.push_back(0);
}
*i = wFileName;
Expand Down Expand Up @@ -283,7 +283,7 @@ 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 ((index >= 0) && (index < 10))
{
if (m_wNames.size() > (size_t)index)
{
Expand Down

0 comments on commit 3da05af

Please sign in to comment.