mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-31 00:45:24 -04:00
4df8ccc871
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}
* Update configure.py and project.py for new libs structure
* Refactor `#include <dolphin/x.h>` -> `<x.h>`
* Remove `__REVOLUTION_SDK__` forwards from dolphin
* Fix dolphin/ references in revolution
* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`
* Always build TRK against dolphin headers
* Resolve revolution SDK header resolution issues
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
|
|
|
#include "JSystem/JMessage/locale.h"
|
|
|
|
int JMessage::locale::parseCharacter_ShiftJIS(const char** ppszText) {
|
|
int c = *(u8*)*ppszText & 0xFF;
|
|
(*ppszText)++;
|
|
|
|
if (isLeadByte_ShiftJIS(c)) {
|
|
c <<= 8;
|
|
c |= *(u8*)*ppszText & 0xFF;
|
|
(*ppszText)++;
|
|
}
|
|
|
|
return c;
|
|
}
|
|
|
|
int JMessage::locale::parseCharacter_UTF8(const char** ppszText) {
|
|
int c = *(u8*)*ppszText & 0xFF;
|
|
(*ppszText)++;
|
|
|
|
if (c & 0x80) {
|
|
if ((c & 0xE0) == 0xC0) {
|
|
c &= 0x1F;
|
|
c <<= 6;
|
|
c |= (*(u8*)*ppszText & 0xFF) & 0x3F;
|
|
(*ppszText)++;
|
|
} else if ((c & 0xF0) == 0xE0) {
|
|
c &= 0xF;
|
|
c <<= 6;
|
|
c |= (*(u8*)*ppszText & 0xFF) & 0x3F;
|
|
(*ppszText)++;
|
|
|
|
c <<= 6;
|
|
c |= (*(u8*)*ppszText & 0xFF) & 0x3F;
|
|
(*ppszText)++;
|
|
} else if ((c & 0xF8) == 0xF0) {
|
|
c &= 0x7;
|
|
c <<= 6;
|
|
c |= (*(u8*)*ppszText & 0xFF) & 0x3F;
|
|
(*ppszText)++;
|
|
|
|
c <<= 6;
|
|
c |= (*(u8*)*ppszText & 0xFF) & 0x3F;
|
|
(*ppszText)++;
|
|
|
|
c <<= 6;
|
|
c |= (*(u8*)*ppszText & 0xFF) & 0x3F;
|
|
(*ppszText)++;
|
|
} else {
|
|
c = -1;
|
|
}
|
|
}
|
|
|
|
return c;
|
|
}
|