Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static inline bool loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageId)
- {
- /* Here we look for "/luma/titles/[u64 titleID in hex, uppercase]/locale.txt"
- If it exists it should contain, for example, "EUR IT" */
- char path[] = "/luma/titles/0000000000000000/locale.txt";
- progIdToStr(path + 28, progId);
- IFile file;
- if(!openLumaFile(&file, path)) return true;
- bool ret = false;
- u64 fileSize;
- if(R_FAILED(IFile_GetSize(&file, &fileSize)) || fileSize < 6 || fileSize > 8) goto exit;
- char buf[8];
- u64 total;
- if(R_FAILED(IFile_Read(&file, &total, buf, fileSize))) goto exit;
- u32 i,
- j;
- for(i = 0; i < 7; i++)
- {
- static const char *regions[] = {"JPN", "USA", "EUR", "AUS", "CHN", "KOR", "TWN"};
- if(memcmp(buf, regions[i], 3) == 0)
- {
- *regionId = (u8)i;
- break;
- }
- }
- for(j = 0; j < 12; j++)
- {
- static const char *languages[] = {"JP", "EN", "FR", "DE", "IT", "ES", "ZH", "KO", "NL", "PT", "RU", "TW"};
- if(memcmp(buf + 4, languages[j], 2) == 0)
- {
- *languageId = (u8)j;
- break;
- }
- }
- ret = i != 7 && j != 12;
- exit:
- IFile_Close(&file);
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement