mirror of https://github.com/snes9xgit/snes9x.git
win32: Unicode - fix Custom ROM dialog to show half-width katakana
This commit is contained in:
parent
e4bf711227
commit
5d6d3af4a9
|
@ -192,6 +192,12 @@ WideToUtf8::WideToUtf8(const wchar_t *wideChars) {
|
|||
WideCharToMultiByte(CP_UTF8,0,wideChars,-1,utf8Chars,requiredChars,NULL,NULL);
|
||||
}
|
||||
|
||||
MS932ToWide::MS932ToWide(const char *ms932Chars) {
|
||||
int requiredChars = MultiByteToWideChar(932,0,ms932Chars,-1,wideChars,0);
|
||||
wideChars = new wchar_t[requiredChars];
|
||||
MultiByteToWideChar(932,0,ms932Chars,-1,wideChars,requiredChars);
|
||||
}
|
||||
|
||||
extern "C" FILE *_tfwopen(const char *filename, const char *mode ) {
|
||||
wchar_t mode_w[30];
|
||||
lstrcpyn(mode_w,Utf8ToWide(mode),29);
|
||||
|
|
|
@ -215,6 +215,15 @@ public:
|
|||
operator char *() { return utf8Chars; }
|
||||
};
|
||||
|
||||
class MS932ToWide {
|
||||
private:
|
||||
wchar_t *wideChars;
|
||||
public:
|
||||
MS932ToWide(const char *ms932Chars);
|
||||
~MS932ToWide() { delete [] wideChars; }
|
||||
operator wchar_t *() { return wideChars; }
|
||||
};
|
||||
|
||||
namespace std {
|
||||
class u8nifstream: public std::ifstream
|
||||
{
|
||||
|
|
|
@ -5245,7 +5245,7 @@ void rominfo(const TCHAR *filename, TCHAR *namebuffer, TCHAR *sizebuffer)
|
|||
if (InfoScore((char *)HeaderBuffer) > 1)
|
||||
{
|
||||
EHi = true;
|
||||
_tcsncpy(namebuffer, _tFromChar((char *)HeaderBuffer), 21);
|
||||
_tcsncpy(namebuffer, _tFromMS932((char *)HeaderBuffer), 21);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5263,7 +5263,7 @@ void rominfo(const TCHAR *filename, TCHAR *namebuffer, TCHAR *sizebuffer)
|
|||
ROMFile.read(HiHead, INFO_LEN);
|
||||
int HiScore = InfoScore(HiHead);
|
||||
|
||||
_tcsncpy(namebuffer, _tFromChar(LoScore > HiScore ? LoHead : HiHead), 21);
|
||||
_tcsncpy(namebuffer, _tFromMS932(LoScore > HiScore ? LoHead : HiHead), 21);
|
||||
|
||||
if (filestats.st_size - HeaderSize >= 0x20000)
|
||||
{
|
||||
|
@ -5273,7 +5273,7 @@ void rominfo(const TCHAR *filename, TCHAR *namebuffer, TCHAR *sizebuffer)
|
|||
|
||||
if (IntLScore > LoScore && IntLScore > HiScore)
|
||||
{
|
||||
_tcsncpy(namebuffer, _tFromChar(LoHead), 21);
|
||||
_tcsncpy(namebuffer, _tFromMS932(LoHead), 21);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5282,7 +5282,7 @@ void rominfo(const TCHAR *filename, TCHAR *namebuffer, TCHAR *sizebuffer)
|
|||
char buf[21];
|
||||
ROMFile.seekg(0x7FC0 + HeaderSize, ios::beg);
|
||||
ROMFile.read(buf, 21);
|
||||
_tcsncpy(namebuffer,_tFromChar(buf),21);
|
||||
_tcsncpy(namebuffer,_tFromMS932(buf),21);
|
||||
}
|
||||
}
|
||||
ROMFile.close();
|
||||
|
|
|
@ -216,9 +216,11 @@
|
|||
#ifdef UNICODE
|
||||
#define _tToChar WideToUtf8
|
||||
#define _tFromChar Utf8ToWide
|
||||
#define _tFromMS932 MS932ToWide
|
||||
#else
|
||||
#define _tToChar
|
||||
#define _tFromChar
|
||||
#define _tFromMS932
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue