Add another check
This commit is contained in:
parent
72a7a8eee5
commit
c4b691d688
@ -191,7 +191,10 @@ static inline u32 loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageId
|
|||||||
if(R_FAILED(IFile_Read(&file, &total, buf, fileSize))) ret = 1;
|
if(R_FAILED(IFile_Read(&file, &total, buf, fileSize))) ret = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i < 7; i++)
|
u32 i,
|
||||||
|
j;
|
||||||
|
|
||||||
|
for(i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
static const char *regions[] = {"JPN", "USA", "EUR", "AUS", "CHN", "KOR", "TWN"};
|
static const char *regions[] = {"JPN", "USA", "EUR", "AUS", "CHN", "KOR", "TWN"};
|
||||||
|
|
||||||
@ -202,16 +205,18 @@ static inline u32 loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageId
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(u32 i = 0; i < 12; i++)
|
for(j = 0; j < 12; j++)
|
||||||
{
|
{
|
||||||
static const char *languages[] = {"JP", "EN", "FR", "DE", "IT", "ES", "ZH", "KO", "NL", "PT", "RU", "TW"};
|
static const char *languages[] = {"JP", "EN", "FR", "DE", "IT", "ES", "ZH", "KO", "NL", "PT", "RU", "TW"};
|
||||||
|
|
||||||
if(memcmp(buf + 4, languages[i], 2) == 0)
|
if(memcmp(buf + 4, languages[j], 2) == 0)
|
||||||
{
|
{
|
||||||
*languageId = (u8)i;
|
*languageId = (u8)j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(i == 7 || j == 12) ret = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,11 +599,11 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size)
|
|||||||
res += loadTitleCodeSection(progId, code, size);
|
res += loadTitleCodeSection(progId, code, size);
|
||||||
|
|
||||||
//Language emulation
|
//Language emulation
|
||||||
u8 regionId = 0xFF,
|
u8 regionId,
|
||||||
languageId = 0xFF;
|
languageId;
|
||||||
res += loadTitleLocaleConfig(progId, ®ionId, &languageId);
|
res += loadTitleLocaleConfig(progId, ®ionId, &languageId);
|
||||||
|
|
||||||
if(regionId != 0xFF || regionId != 0xFF)
|
if(!res)
|
||||||
{
|
{
|
||||||
u32 CFGUHandleOffset;
|
u32 CFGUHandleOffset;
|
||||||
u8 *CFGU_GetConfigInfoBlk2_endPos = getCfgOffsets(code, size, &CFGUHandleOffset);
|
u8 *CFGU_GetConfigInfoBlk2_endPos = getCfgOffsets(code, size, &CFGUHandleOffset);
|
||||||
@ -606,8 +611,8 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size)
|
|||||||
if(CFGU_GetConfigInfoBlk2_endPos == NULL) res++;
|
if(CFGU_GetConfigInfoBlk2_endPos == NULL) res++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(languageId != 0xFF) res += patchCfgGetLanguage(code, size, languageId, CFGU_GetConfigInfoBlk2_endPos);
|
res += patchCfgGetLanguage(code, size, languageId, CFGU_GetConfigInfoBlk2_endPos);
|
||||||
if(regionId != 0xFF) res += patchCfgGetRegion(code, size, regionId, CFGUHandleOffset);
|
res += patchCfgGetRegion(code, size, regionId, CFGUHandleOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user