This commit is contained in:
gocha 2012-07-22 23:41:34 +09:00
commit b483a4bb52
4 changed files with 23 additions and 6 deletions

View File

@ -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);

View File

@ -227,6 +227,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
{

View File

@ -4567,7 +4567,7 @@ INT_PTR CALLBACK DlgInfoProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
char temp[100];
char romtext[4096];
sprintf(romtext, "File: %s\r\nName: %s\r\n", Memory.ROMFilename, Memory.ROMName);
sprintf(romtext, "File: %s\r\nName: %s\r\n", Memory.ROMFilename, Memory.RawROMName);
sprintf(temp, "Speed: %02X/%s\r\nROM Map: %s\r\nType: %02x\r\n", Memory.ROMSpeed, ((Memory.ROMSpeed&0x10)!=0)?"FastROM":"SlowROM",(Memory.HiROM)?"HiROM":"LoROM",Memory.ROMType);
strcat(romtext, temp);
strcat(romtext, "Kart contents: ");
@ -4918,7 +4918,7 @@ INT_PTR CALLBACK DlgInfoProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
case 14:strcat(romtext, "Unknown region 14");break;
default:strcat(romtext, "Unknown region 15");break;
}
SendDlgItemMessage(hDlg, IDC_ROM_DATA, WM_SETTEXT, 0, (LPARAM)((TCHAR *)_tFromChar(romtext)));
SendDlgItemMessage(hDlg, IDC_ROM_DATA, WM_SETTEXT, 0, (LPARAM)((TCHAR *)_tFromMS932(romtext)));
break;
}
case WM_CTLCOLORSTATIC:
@ -5322,7 +5322,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);
}
}
@ -5340,7 +5340,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)
{
@ -5350,7 +5350,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);
}
}
}
@ -5359,7 +5359,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();

View File

@ -217,9 +217,11 @@
#ifdef UNICODE
#define _tToChar WideToUtf8
#define _tFromChar Utf8ToWide
#define _tFromMS932 MS932ToWide
#else
#define _tToChar
#define _tFromChar
#define _tFromMS932
#endif
/****************************************************************************/