mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
UI: makes dolphin displays japanese region games' names and their descriptions.
only work on windows and asian language support installed. (without fonts and codepages, we can not display text, I'm sure). BTW, I only test on GC games, I've no Wii games now, and .\User\Cache directory must be cleared to work (delete all cached files) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1972 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -23,6 +23,11 @@
|
||||
#include "VolumeCreator.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
// HyperIris: dunno if this suitable, may be need move.
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char* _src)
|
||||
@ -89,6 +94,89 @@ bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char*
|
||||
return(bResult);
|
||||
}
|
||||
|
||||
bool IBannerLoader::CopySJISToString( std::string& _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, 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, strlen(_src),
|
||||
(LPWSTR)pUnicodeStrBuffer, unicodeNameSize))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete pUnicodeStrBuffer;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// not implement other than windows
|
||||
_rDestination = _src;
|
||||
returnCode = true;
|
||||
#endif
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
bool IBannerLoader::CopyUnicodeToString( std::string& _rDestination, const u16* _src )
|
||||
{
|
||||
bool returnCode = false;
|
||||
#ifdef WIN32
|
||||
if (_src)
|
||||
{
|
||||
u32 ansiNameSize = WideCharToMultiByte(CP_ACP, 0,
|
||||
(LPCWSTR)_src, wcslen((const wchar_t*)_src),
|
||||
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)_src, wcslen((const wchar_t*)_src),
|
||||
pAnsiStrBuffer, ansiNameSize, NULL, NULL))
|
||||
{
|
||||
_rDestination = pAnsiStrBuffer;
|
||||
returnCode = true;
|
||||
}
|
||||
delete pAnsiStrBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// not implement other than windows
|
||||
_rDestination = _src;
|
||||
returnCode = true;
|
||||
#endif
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
|
||||
IBannerLoader* CreateBannerLoader(DiscIO::IFileSystem& _rFileSystem)
|
||||
{
|
||||
|
Reference in New Issue
Block a user