mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-24 01:54:58 +00:00
parent
a26b48fc0b
commit
fc51cf2e5e
@ -124,7 +124,7 @@ PSPOskDialog::PSPOskDialog() : PSPDialog() {
|
||||
PSPOskDialog::~PSPOskDialog() {
|
||||
}
|
||||
|
||||
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<wchar_t> em_address)
|
||||
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16> em_address)
|
||||
{
|
||||
if (!em_address.Valid())
|
||||
{
|
||||
@ -132,10 +132,29 @@ void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<wcha
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertUCS2ToUTF8(_string, &em_address[0]);
|
||||
char stringBuffer[2048];
|
||||
char *string = stringBuffer;
|
||||
|
||||
auto input = em_address;
|
||||
int c;
|
||||
while ((c = *input++) != 0)
|
||||
{
|
||||
if (c < 0x80)
|
||||
*string++ = c;
|
||||
else if (c < 0x800) {
|
||||
*string++ = 0xC0 | (c >> 6);
|
||||
*string++ = 0x80 | (c & 0x3F);
|
||||
} else {
|
||||
*string++ = 0xE0 | (c >> 12);
|
||||
*string++ = 0x80 | ((c >> 6) & 0x3F);
|
||||
*string++ = 0x80 | (c & 0x3F);
|
||||
}
|
||||
}
|
||||
*string++ = '\0';
|
||||
_string = stringBuffer;
|
||||
}
|
||||
|
||||
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, wchar_t* input)
|
||||
void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const wchar_t *input)
|
||||
{
|
||||
char stringBuffer[2048];
|
||||
char *string = stringBuffer;
|
||||
@ -809,7 +828,7 @@ int PSPOskDialog::Update()
|
||||
status = SCE_UTILITY_STATUS_SHUTDOWN;
|
||||
}
|
||||
|
||||
wchar_t *outText = oskParams->fields[0].outtext;
|
||||
u16 *outText = oskParams->fields[0].outtext;
|
||||
for (u32 i = 0, end = oskParams->fields[0].outtextlength; i < end; ++i)
|
||||
{
|
||||
u16 value = 0;
|
||||
|
@ -111,13 +111,13 @@ struct SceUtilityOskData
|
||||
/** Unknown. Pass 0. */
|
||||
int unk_24;
|
||||
/** Description text */
|
||||
PSPPointer<wchar_t> desc;
|
||||
PSPPointer<u16> desc;
|
||||
/** Initial text */
|
||||
PSPPointer<wchar_t> intext;
|
||||
PSPPointer<u16> intext;
|
||||
// Length, in unsigned shorts, including the terminator.
|
||||
u32 outtextlength;
|
||||
/** Pointer to the output text */
|
||||
PSPPointer<wchar_t> outtext;
|
||||
PSPPointer<u16> outtext;
|
||||
/** Result. One of ::SceUtilityOskResult */
|
||||
int result;
|
||||
// Number of characters to allow, not including terminator (if less than outtextlength - 1.)
|
||||
@ -163,8 +163,8 @@ public:
|
||||
virtual int Shutdown(bool force = false);
|
||||
virtual void DoState(PointerWrap &p);
|
||||
private:
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<wchar_t> em_address);
|
||||
void ConvertUCS2ToUTF8(std::string& _string, wchar_t* input);
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16> em_address);
|
||||
void ConvertUCS2ToUTF8(std::string& _string, const wchar_t *input);
|
||||
void RenderKeyboard();
|
||||
|
||||
std::wstring CombinationString(bool isInput); // for Japanese, Korean
|
||||
|
Loading…
x
Reference in New Issue
Block a user