Merge branch 'unicode_gamelist'
This commit is contained in:
commit
ca8af741b8
|
@ -155,6 +155,20 @@ public:
|
||||||
(*ptr) += stringLen;
|
(*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>
|
template<class T>
|
||||||
void DoArray(T *x, int count) {
|
void DoArray(T *x, int count) {
|
||||||
DoVoid((void *)x, sizeof(T) * count);
|
DoVoid((void *)x, sizeof(T) * count);
|
||||||
|
|
|
@ -39,10 +39,11 @@ class IBannerLoader
|
||||||
virtual bool GetBanner(u32* _pBannerImage) = 0;
|
virtual bool GetBanner(u32* _pBannerImage) = 0;
|
||||||
|
|
||||||
virtual bool GetName(std::string* _rName) = 0;
|
virtual bool GetName(std::string* _rName) = 0;
|
||||||
|
virtual bool GetName(std::vector<std::wstring>& _rNames) {return false;};
|
||||||
virtual bool GetCompany(std::string& _rCompany) = 0;
|
virtual bool GetCompany(std::string& _rCompany) = 0;
|
||||||
|
|
||||||
virtual bool GetDescription(std::string* _rDescription) = 0;
|
virtual bool GetDescription(std::string* _rDescription) = 0;
|
||||||
|
virtual bool GetDescription(std::wstring& _rDescription) {return false;};
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -164,6 +164,25 @@ bool CBannerLoaderWii::GetName(std::string* _rName)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBannerLoaderWii::GetName(std::vector<std::wstring>& _rNames)
|
||||||
|
{
|
||||||
|
if (IsValid())
|
||||||
|
{
|
||||||
|
// find Banner type
|
||||||
|
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
|
||||||
|
|
||||||
|
std::wstring temp;
|
||||||
|
for (int i = 0; i < WII_BANNER_COMMENT_SIZE; ++i)
|
||||||
|
{
|
||||||
|
temp.push_back(Common::swap16(pBanner->m_Comment[0][i]));
|
||||||
|
}
|
||||||
|
_rNames.push_back(temp);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CBannerLoaderWii::GetCompany(std::string& _rCompany)
|
bool CBannerLoaderWii::GetCompany(std::string& _rCompany)
|
||||||
{
|
{
|
||||||
_rCompany = "N/A";
|
_rCompany = "N/A";
|
||||||
|
@ -190,6 +209,23 @@ bool CBannerLoaderWii::GetDescription(std::string* _rDescription)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBannerLoaderWii::GetDescription(std::wstring& _rDescription)
|
||||||
|
{
|
||||||
|
if (IsValid())
|
||||||
|
{
|
||||||
|
// find Banner type
|
||||||
|
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
|
||||||
|
|
||||||
|
std::wstring description;
|
||||||
|
for (int i = 0; i < WII_BANNER_COMMENT_SIZE; ++i)
|
||||||
|
description.push_back(Common::swap16(pBanner->m_Comment[1][i]));
|
||||||
|
|
||||||
|
_rDescription = description;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
|
void CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < height; y += 4)
|
for (int y = 0; y < height; y += 4)
|
||||||
|
|
|
@ -37,10 +37,13 @@ class CBannerLoaderWii
|
||||||
|
|
||||||
virtual bool GetName(std::string* _rName);
|
virtual bool GetName(std::string* _rName);
|
||||||
|
|
||||||
|
bool GetName(std::vector<std::wstring>& _rNames);
|
||||||
|
|
||||||
virtual bool GetCompany(std::string& _rCompany);
|
virtual bool GetCompany(std::string& _rCompany);
|
||||||
|
|
||||||
virtual bool GetDescription(std::string* _rDescription);
|
virtual bool GetDescription(std::string* _rDescription);
|
||||||
|
|
||||||
|
bool GetDescription(std::wstring& _rDescription);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
virtual std::string GetUniqueID() const = 0;
|
virtual std::string GetUniqueID() const = 0;
|
||||||
virtual std::string GetMakerID() const = 0;
|
virtual std::string GetMakerID() const = 0;
|
||||||
virtual std::string GetName() const = 0;
|
virtual std::string GetName() const = 0;
|
||||||
|
virtual bool GetWName(std::vector<std::wstring>& _rwNames) const {return false;};
|
||||||
virtual u32 GetFSTSize() const = 0;
|
virtual u32 GetFSTSize() const = 0;
|
||||||
virtual std::string GetApploaderDate() const = 0;
|
virtual std::string GetApploaderDate() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,45 @@ bool CVolumeWAD::GetTitleID(u8* _pBuffer) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CVolumeWAD::GetWName(std::vector<std::wstring>& _rwNames) const
|
||||||
|
{
|
||||||
|
u32 footer_size;
|
||||||
|
|
||||||
|
if (!Read(0x1C, 4, (u8*)&footer_size))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean
|
||||||
|
|
||||||
|
// Offset to the english title
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
u16 temp[42];
|
||||||
|
std::wstring out_temp;
|
||||||
|
|
||||||
|
if (!Read(0x9C + (i*84) + OpeningBnrOffset, 84, (u8*)&temp) || Common::swap32(footer_size) < 0xF1
|
||||||
|
|| !temp[0])
|
||||||
|
{
|
||||||
|
_rwNames.push_back(L"");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 42; ++i)
|
||||||
|
{
|
||||||
|
u16 t = Common::swap16(temp[i]);
|
||||||
|
if (t == 0 && i > 0)
|
||||||
|
{
|
||||||
|
if (out_temp.at(out_temp.size()-1) != ' ')
|
||||||
|
out_temp.push_back(' ');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
out_temp.push_back(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
_rwNames.push_back(out_temp);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CVolumeWAD::GetName() const
|
std::string CVolumeWAD::GetName() const
|
||||||
{
|
{
|
||||||
u32 footer_size;
|
u32 footer_size;
|
||||||
|
@ -114,9 +153,13 @@ std::string CVolumeWAD::GetName() const
|
||||||
if (!Read(0x1C, 4, (u8*)&footer_size))
|
if (!Read(0x1C, 4, (u8*)&footer_size))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
||||||
|
//Japanese, English, German, French, Spanish, Italian, Dutch, unknown, unknown, Korean
|
||||||
|
|
||||||
// Offset to the english title
|
// Offset to the english title
|
||||||
char temp[84];
|
char temp[84];
|
||||||
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp) || Common::swap32(footer_size) < 0xF1)
|
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp) || Common::swap32(footer_size) < 0xF1 ||
|
||||||
|
!Common::swap16(temp[0]))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
// Remove the null bytes due to 16bit char length
|
// Remove the null bytes due to 16bit char length
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
std::string GetUniqueID() const;
|
std::string GetUniqueID() const;
|
||||||
std::string GetMakerID() const;
|
std::string GetMakerID() const;
|
||||||
std::string GetName() const;
|
std::string GetName() const;
|
||||||
|
bool GetWName(std::vector<std::wstring>& _rwNames) const;
|
||||||
u32 GetFSTSize() const { return 0; }
|
u32 GetFSTSize() const { return 0; }
|
||||||
std::string GetApploaderDate() const { return "0"; }
|
std::string GetApploaderDate() const { return "0"; }
|
||||||
ECountry GetCountry() const;
|
ECountry GetCountry() const;
|
||||||
|
|
|
@ -27,10 +27,10 @@ wxString CDSPRegTable::GetValue(int row, int col)
|
||||||
{
|
{
|
||||||
case 0: return wxString::FromAscii(pdregname(row));
|
case 0: return wxString::FromAscii(pdregname(row));
|
||||||
case 1: return wxString::Format(wxT("0x%04x"), DSPCore_ReadRegister(row));
|
case 1: return wxString::Format(wxT("0x%04x"), DSPCore_ReadRegister(row));
|
||||||
default: return wxString::FromAscii("");
|
default: return wxEmptyString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wxString::FromAscii("");
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDSPRegTable::SetValue(int, int, const wxString &)
|
void CDSPRegTable::SetValue(int, int, const wxString &)
|
||||||
|
|
|
@ -56,18 +56,18 @@ wxString CRegTable::GetValue(int row, int col)
|
||||||
case 2: return wxString::FromAscii(GetFPRName(row));
|
case 2: return wxString::FromAscii(GetFPRName(row));
|
||||||
case 3: return wxString::Format(wxT("%016llx"), riPS0(row));
|
case 3: return wxString::Format(wxT("%016llx"), riPS0(row));
|
||||||
case 4: return wxString::Format(wxT("%016llx"), riPS1(row));
|
case 4: return wxString::Format(wxT("%016llx"), riPS1(row));
|
||||||
default: return wxString::FromAscii("");
|
default: return wxEmptyString;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (row - 32 < NUM_SPECIALS) {
|
if (row - 32 < NUM_SPECIALS) {
|
||||||
switch (col) {
|
switch (col) {
|
||||||
case 0: return wxString::FromAscii(special_reg_names[row - 32]);
|
case 0: return wxString::FromAscii(special_reg_names[row - 32]);
|
||||||
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
|
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
|
||||||
default: return wxString::FromAscii("");
|
default: return wxEmptyString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wxString::FromAscii("");
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetSpecialRegValue(int reg, u32 value) {
|
static void SetSpecialRegValue(int reg, u32 value) {
|
||||||
|
|
|
@ -446,7 +446,9 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||||
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
|
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||||
|
// it returns CP-932, in order to use iconv we need to use CP932
|
||||||
|
wxCSConv SJISConv(L"CP932");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GameListItem& rISOFile = *m_ISOFiles[_Index];
|
GameListItem& rISOFile = *m_ISOFiles[_Index];
|
||||||
|
@ -466,60 +468,57 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||||
// Set the game's banner in the second column
|
// Set the game's banner in the second column
|
||||||
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
|
SetItemColumnImage(_Index, COLUMN_BANNER, ImageIndex);
|
||||||
|
|
||||||
if (rISOFile.GetPlatform() != GameListItem::WII_WAD)
|
std::wstring wname;
|
||||||
|
const std::wstring& wdescription = rISOFile.GetDescription();
|
||||||
|
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();
|
||||||
|
int SelectedLanguage = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
|
||||||
|
switch (rISOFile.GetCountry())
|
||||||
{
|
{
|
||||||
std::string company;
|
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||||
|
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||||
// 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:
|
rISOFile.GetName(wname, -1);
|
||||||
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()));
|
||||||
wxString name = wxString(rISOFile.GetName(0).c_str(), SJISConv);
|
SetItem(_Index, COLUMN_TITLE, name, -1);
|
||||||
m_gameList.append(StringFromFormat("%s (J)\n", (const char *)name.c_str()));
|
SetItem(_Index, COLUMN_NOTES, wxString(company.size() ?
|
||||||
SetItem(_Index, COLUMN_TITLE, name, -1);
|
company.c_str() : rISOFile.GetDescription(0).c_str(),
|
||||||
SetItem(_Index, COLUMN_NOTES, wxString(company.size() ?
|
SJISConv), -1);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else // It's a Wad file
|
case DiscIO::IVolume::COUNTRY_USA:
|
||||||
{
|
SelectedLanguage = 0;
|
||||||
m_gameList.append(StringFromFormat("%s (WAD)\n", rISOFile.GetName(0).c_str()));
|
default:
|
||||||
|
{
|
||||||
|
wxCSConv WindowsCP1252(wxFontMapper::GetEncodingName(wxFONTENCODING_CP1252));
|
||||||
|
rISOFile.GetName(wname, SelectedLanguage);
|
||||||
|
|
||||||
SetItem(_Index, COLUMN_TITLE,
|
SetItem(_Index, COLUMN_TITLE,
|
||||||
wxString(rISOFile.GetName(0).c_str(), SJISConv), -1);
|
wxString(
|
||||||
|
rISOFile.GetName(SelectedLanguage).c_str(), WindowsCP1252),
|
||||||
|
-1);
|
||||||
|
m_gameList.append(StringFromFormat("%s (%c)\n",
|
||||||
|
rISOFile.GetName(SelectedLanguage).c_str(), (rISOFile.GetCountry() == DiscIO::IVolume::COUNTRY_USA)?'U':'E'));
|
||||||
SetItem(_Index, COLUMN_NOTES,
|
SetItem(_Index, COLUMN_NOTES,
|
||||||
wxString(rISOFile.GetDescription(0).c_str(), SJISConv), -1);
|
wxString(company.size() ?
|
||||||
|
company.c_str() :
|
||||||
|
rISOFile.GetDescription(SelectedLanguage).c_str(), WindowsCP1252),
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wname.length())
|
||||||
|
SetItem(_Index, COLUMN_TITLE, wname, -1);
|
||||||
|
if (wdescription.length())
|
||||||
|
SetItem(_Index, COLUMN_NOTES, wdescription, -1);
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// Emulation state
|
// Emulation state
|
||||||
SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[rISOFile.GetEmuState()]);
|
SetItemColumnImage(_Index, COLUMN_EMULATION_STATE, m_EmuStateImageIndex[rISOFile.GetEmuState()]);
|
||||||
|
@ -1180,7 +1179,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
||||||
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
|
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
|
||||||
wxMessageBox(
|
wxMessageBox(
|
||||||
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
|
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
|
||||||
OutputFileName.c_str()),
|
wxString(OutputFileName.c_str(), *wxConvCurrent).c_str()),
|
||||||
_("Confirm File Overwrite"),
|
_("Confirm File Overwrite"),
|
||||||
wxYES_NO) == wxNO)
|
wxYES_NO) == wxNO)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1208,7 +1207,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
||||||
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
|
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
|
||||||
wxMessageBox(
|
wxMessageBox(
|
||||||
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
|
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
|
||||||
OutputFileName.c_str()),
|
wxString(OutputFileName.c_str(), *wxConvCurrent).c_str()),
|
||||||
_("Confirm File Overwrite"),
|
_("Confirm File Overwrite"),
|
||||||
wxYES_NO) == wxNO)
|
wxYES_NO) == wxNO)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "ChunkFile.h"
|
#include "ChunkFile.h"
|
||||||
#include "../resources/no_banner.cpp"
|
#include "../resources/no_banner.cpp"
|
||||||
|
|
||||||
#define CACHE_REVISION 0x10B
|
#define CACHE_REVISION 0x10C
|
||||||
|
|
||||||
#define DVD_BANNER_WIDTH 96
|
#define DVD_BANNER_WIDTH 96
|
||||||
#define DVD_BANNER_HEIGHT 32
|
#define DVD_BANNER_HEIGHT 32
|
||||||
|
@ -63,18 +63,26 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
||||||
if (!DiscIO::IsVolumeWadFile(pVolume))
|
if (!DiscIO::IsVolumeWadFile(pVolume))
|
||||||
m_Platform = DiscIO::IsVolumeWiiDisc(pVolume) ? WII_DISC : GAMECUBE_DISC;
|
m_Platform = DiscIO::IsVolumeWiiDisc(pVolume) ? WII_DISC : GAMECUBE_DISC;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_Platform = WII_WAD;
|
m_Platform = WII_WAD;
|
||||||
|
pVolume->GetWName(m_wNames);
|
||||||
|
}
|
||||||
|
|
||||||
m_Company = "N/A";
|
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++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
m_Name[i] = pVolume->GetName();
|
m_Name[i] = m_Name[0];
|
||||||
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_Description[i] = "No Description";
|
m_Description[i] = "No Description";
|
||||||
}
|
}
|
||||||
m_Country = pVolume->GetCountry();
|
m_Country = pVolume->GetCountry();
|
||||||
|
@ -95,9 +103,13 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
||||||
{
|
{
|
||||||
if (pBannerLoader->IsValid())
|
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->GetCompany(m_Company);
|
||||||
pBannerLoader->GetDescription(m_Description);
|
if (!pBannerLoader->GetDescription(m_wDescription))
|
||||||
|
pBannerLoader->GetDescription(m_Description);
|
||||||
|
|
||||||
if (pBannerLoader->GetBanner(g_ImageTemp))
|
if (pBannerLoader->GetBanner(g_ImageTemp))
|
||||||
{
|
{
|
||||||
// resize vector to image size
|
// resize vector to image size
|
||||||
|
@ -116,6 +128,25 @@ GameListItem::GameListItem(const std::string& _rFileName)
|
||||||
|
|
||||||
delete pFileSystem;
|
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;
|
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[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]);
|
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_Company);
|
||||||
p.Do(m_Description[0]); p.Do(m_Description[1]); p.Do(m_Description[2]);
|
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_Description[3]); p.Do(m_Description[4]); p.Do(m_Description[5]);
|
||||||
|
p.Do(m_wDescription);
|
||||||
p.Do(m_UniqueID);
|
p.Do(m_UniqueID);
|
||||||
p.Do(m_FileSize);
|
p.Do(m_FileSize);
|
||||||
p.Do(m_VolumeSize);
|
p.Do(m_VolumeSize);
|
||||||
|
@ -211,6 +264,11 @@ const std::string& GameListItem::GetDescription(int index) const
|
||||||
return m_Description[0];
|
return m_Description[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::wstring& GameListItem::GetDescription() const
|
||||||
|
{
|
||||||
|
return m_wDescription;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& GameListItem::GetName(int index) const
|
const std::string& GameListItem::GetName(int index) const
|
||||||
{
|
{
|
||||||
if ((index >=0) && (index < 6))
|
if ((index >=0) && (index < 6))
|
||||||
|
@ -220,6 +278,28 @@ const std::string& GameListItem::GetName(int index) const
|
||||||
return m_Name[0];
|
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
|
const std::string GameListItem::GetWiiFSPath() const
|
||||||
{
|
{
|
||||||
DiscIO::IVolume *Iso = DiscIO::CreateVolumeFromFilename(m_FileName);
|
DiscIO::IVolume *Iso = DiscIO::CreateVolumeFromFilename(m_FileName);
|
||||||
|
|
|
@ -35,8 +35,10 @@ 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;}
|
||||||
const std::string& GetName(int index) const;
|
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& GetCompany() const {return m_Company;}
|
||||||
const std::string& GetDescription(int index) const;
|
const std::string& GetDescription(int index) const;
|
||||||
|
const std::wstring& GetDescription() const;
|
||||||
const std::string& GetUniqueID() const {return m_UniqueID;}
|
const std::string& GetUniqueID() const {return m_UniqueID;}
|
||||||
const std::string GetWiiFSPath() const;
|
const std::string GetWiiFSPath() const;
|
||||||
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
|
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
|
||||||
|
@ -63,8 +65,10 @@ public:
|
||||||
private:
|
private:
|
||||||
std::string m_FileName;
|
std::string m_FileName;
|
||||||
std::string m_Name[6];
|
std::string m_Name[6];
|
||||||
|
std::vector<std::wstring> m_wNames;
|
||||||
std::string m_Company;
|
std::string m_Company;
|
||||||
std::string m_Description[6];
|
std::string m_Description[6];
|
||||||
|
std::wstring m_wDescription;
|
||||||
std::string m_UniqueID;
|
std::string m_UniqueID;
|
||||||
|
|
||||||
std::string m_issues;
|
std::string m_issues;
|
||||||
|
|
|
@ -154,7 +154,15 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disk header and apploader
|
// 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));
|
m_GameID->SetValue(wxString(OpenISO->GetUniqueID().c_str(), wxConvUTF8));
|
||||||
switch (OpenISO->GetCountry())
|
switch (OpenISO->GetCountry())
|
||||||
{
|
{
|
||||||
|
@ -1253,53 +1261,63 @@ void CISOProperties::OnChangeBannerLang(wxCommandEvent& event)
|
||||||
|
|
||||||
void CISOProperties::ChangeBannerDetails(int lang)
|
void CISOProperties::ChangeBannerDetails(int lang)
|
||||||
{
|
{
|
||||||
if (OpenGameListItem->GetCountry() == DiscIO::IVolume::COUNTRY_JAPAN
|
std::wstring wname;
|
||||||
|| OpenGameListItem->GetCountry() == DiscIO::IVolume::COUNTRY_TAIWAN
|
wxString shortName,
|
||||||
|| OpenGameListItem->GetPlatform() == GameListItem::WII_WAD)
|
comment,
|
||||||
{
|
maker;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent);
|
wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent);
|
||||||
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
||||||
if (validCP932)
|
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)
|
|
||||||
{
|
{
|
||||||
wxString name = wxString::From8BitData(OpenGameListItem->GetName(lang).c_str());
|
SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
|
||||||
|
|
||||||
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()));
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||||
|
// it returns CP-932, in order to use iconv we need to use CP932
|
||||||
|
wxCSConv SJISConv(L"CP932");
|
||||||
|
#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:
|
||||||
|
lang = 0;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
wxCSConv WindowsCP1252(wxFontMapper::GetEncodingName(wxFONTENCODING_CP1252));
|
||||||
|
if (OpenGameListItem->GetName(wname, lang))
|
||||||
|
shortName = wname;
|
||||||
|
else
|
||||||
|
shortName = wxString(OpenGameListItem->GetName(lang).c_str(), WindowsCP1252);
|
||||||
|
if ((comment = OpenGameListItem->GetDescription()).size() == 0)
|
||||||
|
comment = wxString(OpenGameListItem->GetDescription(lang).c_str(), WindowsCP1252);
|
||||||
|
maker = wxString(OpenGameListItem->GetCompany().c_str(), WindowsCP1252);
|
||||||
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
||||||
, x(0), y(0), winpos(0)
|
, x(0), y(0), winpos(0)
|
||||||
, Parent(parent) , m_LogAccess(true)
|
, Parent(parent) , m_LogAccess(true)
|
||||||
, m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL)
|
, m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL)
|
||||||
, m_SJISConv(wxT(""))
|
, m_SJISConv(*(wxCSConv*)wxConvCurrent)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
||||||
|
@ -52,10 +52,11 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||||
m_SJISConv = *(wxCSConv*)wxConvCurrent;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
m_SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
|
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||||
|
// it returns CP-932, in order to use iconv we need to use CP932
|
||||||
|
m_SJISConv = wxCSConv(L"CP932");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_LogManager = LogManager::GetInstance();
|
m_LogManager = LogManager::GetInstance();
|
||||||
|
|
|
@ -701,10 +701,22 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
|
||||||
if (!memoryCard[card]->DEntry_Comment2(j, comment)) comment[0]=0;
|
if (!memoryCard[card]->DEntry_Comment2(j, comment)) comment[0]=0;
|
||||||
|
|
||||||
bool ascii = memoryCard[card]->IsAsciiEncoding();
|
bool ascii = memoryCard[card]->IsAsciiEncoding();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
|
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
|
#else
|
||||||
wxCSConv SJISConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
|
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||||
|
// it returns CP-932, in order to use iconv we need to use CP932
|
||||||
|
wxCSConv SJISConv(L"CP932");
|
||||||
#endif
|
#endif
|
||||||
wxTitle = wxString(title, ascii ? *wxConvCurrent : SJISConv);
|
wxTitle = wxString(title, ascii ? *wxConvCurrent : SJISConv);
|
||||||
wxComment = wxString(comment, ascii ? *wxConvCurrent : SJISConv);
|
wxComment = wxString(comment, ascii ? *wxConvCurrent : SJISConv);
|
||||||
|
|
Loading…
Reference in New Issue