Fixed Issue 2005
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4820 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e13dc4a58f
commit
1e2f7c89c3
|
@ -655,7 +655,6 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
|
|||
if (memoryCard[card]->fail) return false;
|
||||
|
||||
int j;
|
||||
bool ascii = memoryCard[card]->IsAsciiEncoding();
|
||||
|
||||
wxString wxTitle,
|
||||
wxComment,
|
||||
|
@ -758,16 +757,10 @@ bool CMemcardManager::ReloadMemcard(const char *fileName, int card)
|
|||
if (!memoryCard[card]->DEntry_Comment1(j, title)) title[0]=0;
|
||||
if (!memoryCard[card]->DEntry_Comment2(j, comment)) comment[0]=0;
|
||||
|
||||
if (ascii)
|
||||
{
|
||||
wxTitle = wxString::FromAscii(title);
|
||||
wxComment = wxString::FromAscii(comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
WxUtils::CopySJISToString(wxTitle, title);
|
||||
WxUtils::CopySJISToString(wxComment, comment);
|
||||
}
|
||||
wxCSConv SJISConv(wxT("SHIFT_JIS"));
|
||||
wxTitle = wxString(title, SJISConv);
|
||||
wxComment = wxString(comment, SJISConv);
|
||||
|
||||
m_MemcardList[card]->SetItem(index, COLUMN_TITLE, wxTitle);
|
||||
m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxComment);
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace WxUtils {
|
|||
// Launch a file according to its mime type
|
||||
void Launch(const char *filename)
|
||||
{
|
||||
if (! ::wxLaunchDefaultBrowser(wxString::FromAscii(filename))) {
|
||||
if (! ::wxLaunchDefaultBrowser(wxString(filename, *wxConvCurrent)))
|
||||
{
|
||||
// WARN_LOG
|
||||
}
|
||||
}
|
||||
|
@ -33,70 +34,17 @@ void Launch(const char *filename)
|
|||
// Launch an file explorer window on a certain path
|
||||
void Explore(const char *path)
|
||||
{
|
||||
wxString wxPath = wxString::FromAscii(path);
|
||||
|
||||
wxString wxPath = wxString(path, *wxConvCurrent);
|
||||
// Default to file
|
||||
if (! wxPath.Contains(wxT("://"))) {
|
||||
if (! wxPath.Contains(wxT("://")))
|
||||
{
|
||||
wxPath = wxT("file://") + wxPath;
|
||||
}
|
||||
|
||||
if (! ::wxLaunchDefaultBrowser(wxPath)) {
|
||||
if (! ::wxLaunchDefaultBrowser(wxPath))
|
||||
{
|
||||
// WARN_LOG
|
||||
}
|
||||
}
|
||||
|
||||
bool CopySJISToString(wxString& _rDestination, const char* _src)
|
||||
{
|
||||
bool returnCode = false;
|
||||
#ifdef WIN32
|
||||
// HyperIris: because dolphin using "Use Multi-Byte Character Set",
|
||||
// we must convert the SJIS chars to unicode then to our windows local by hand
|
||||
u32 unicodeNameSize = MultiByteToWideChar(932, MB_PRECOMPOSED,
|
||||
_src, (int)strlen(_src), NULL, NULL);
|
||||
if (unicodeNameSize > 0)
|
||||
{
|
||||
u16* pUnicodeStrBuffer = new u16[unicodeNameSize + 1];
|
||||
if (pUnicodeStrBuffer)
|
||||
{
|
||||
memset(pUnicodeStrBuffer, 0, (unicodeNameSize + 1) * sizeof(u16));
|
||||
if (MultiByteToWideChar(932, MB_PRECOMPOSED,
|
||||
_src, (int)strlen(_src),
|
||||
(LPWSTR)pUnicodeStrBuffer, unicodeNameSize))
|
||||
{
|
||||
|
||||
#ifdef _UNICODE
|
||||
_rDestination = (LPWSTR)pUnicodeStrBuffer;
|
||||
returnCode = true;
|
||||
#else
|
||||
u32 ansiNameSize = WideCharToMultiByte(CP_ACP, 0,
|
||||
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (ansiNameSize > 0)
|
||||
{
|
||||
char* pAnsiStrBuffer = new char[ansiNameSize + 1];
|
||||
if (pAnsiStrBuffer)
|
||||
{
|
||||
memset(pAnsiStrBuffer, 0, (ansiNameSize + 1) * sizeof(char));
|
||||
if (WideCharToMultiByte(CP_ACP, 0,
|
||||
(LPCWSTR)pUnicodeStrBuffer, unicodeNameSize,
|
||||
pAnsiStrBuffer, ansiNameSize, NULL, NULL))
|
||||
{
|
||||
_rDestination = pAnsiStrBuffer;
|
||||
returnCode = true;
|
||||
}
|
||||
delete pAnsiStrBuffer;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
delete pUnicodeStrBuffer;
|
||||
}
|
||||
}
|
||||
#else
|
||||
_rDestination = wxString(_src,wxConvUTF8);
|
||||
returnCode = true;
|
||||
#endif
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -26,7 +26,6 @@ void Launch(const char *filename);
|
|||
// Launch an file explorer window on a certain path
|
||||
void Explore(const char *path);
|
||||
|
||||
bool CopySJISToString(wxString& _rDestination, const char* _src);
|
||||
} // namespace
|
||||
|
||||
#endif // WXUTILS
|
||||
|
|
Loading…
Reference in New Issue