Display Japanese descriptions correctly

This commit is contained in:
wiidev 2020-07-09 02:11:20 +01:00
parent 80ed6d0b98
commit 6ab4fdd436
3 changed files with 2165 additions and 4 deletions

View File

@ -31,6 +31,7 @@ distribution.
#include "usbloader/wbfs.h"
#include "usbloader/wdvd.h"
#include "usbloader/wbfs/wbfs_rw.h"
#include "utils/sjis.h"
#include "utils/uncompress.h"
#include "themes/CTheme.h"
#include "settings/GameTitles.h"
@ -429,6 +430,7 @@ CustomBanner *OpeningBNR::CreateGCBanner(const discHdr * header)
}
}
// sets the developer
wString str;
str.resize(strlen((char *) openingBnr->description[language].developer));
for(u32 i = 0; i < str.size(); i++)
@ -437,11 +439,20 @@ CustomBanner *OpeningBNR::CreateGCBanner(const discHdr * header)
banner->SetBannerText("T_Coded_by", tr("Developer:"));
banner->SetBannerText("T_coder", str.toUTF8().c_str());
// sets the description and converts encodings (Japan and Taiwan)
if(header->id[3] == 'J' || header->id[3] == 'W')
{
string description((char *) openingBnr->description[language].long_description);
banner->SetBannerText("T_short_descript", sj2utf8(description).c_str());
}
else
{
str.resize(strlen((char *) openingBnr->description[language].long_description));
for(u32 i = 0; i < str.size(); i++)
str[i] = *(openingBnr->description[language].long_description + i);
banner->SetBannerText("T_short_descript", str.toUTF8().c_str());
}
// free buffer
free(openingBnr);

2142
source/utils/sjis.cpp Normal file

File diff suppressed because it is too large Load Diff

8
source/utils/sjis.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef SJIS_H
#define SJIS_H
#include <string>
std::string sj2utf8(const std::string &input);
#endif /* SJIS_H */