Stub isTitleAllowed

This commit is contained in:
Aurora Wright 2017-09-20 01:02:14 +02:00
parent f67d333457
commit f46773ba64
3 changed files with 28 additions and 0 deletions

View File

@ -9,6 +9,14 @@ void memcpy(void *dest, const void *src, u32 size)
destc[i] = srcc[i]; destc[i] = srcc[i];
} }
void memset32(void *dest, u32 filler, u32 size)
{
u32 *dest32 = (u32 *)dest;
for(u32 i = 0; i < size / 4; i++)
dest32[i] = filler;
}
int memcmp(const void *buf1, const void *buf2, u32 size) int memcmp(const void *buf1, const void *buf2, u32 size)
{ {
const u8 *buf1c = (const u8 *)buf1, const u8 *buf1c = (const u8 *)buf1,

View File

@ -3,5 +3,6 @@
#include <3ds/types.h> #include <3ds/types.h>
void memcpy(void *dest, const void *src, u32 size); void memcpy(void *dest, const void *src, u32 size);
void memset32(void *dest, u32 filler, u32 size);
int memcmp(const void *buf1, const void *buf2, u32 size); int memcmp(const void *buf1, const void *buf2, u32 size);
u8 *memsearch(u8 *startPos, const void *pattern, u32 size, u32 patternSize); u8 *memsearch(u8 *startPos, const void *pattern, u32 size, u32 patternSize);

View File

@ -761,6 +761,25 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
} }
} }
if(progVer > 0x12)
{
static const u8 pattern[] = {
0x00, 0xB1, 0x15, 0x00
};
u8 *roStart = code + ((textSize + 4095) & 0xFFFFF000),
*start = memsearch(roStart, pattern, roSize, sizeof(pattern));
if(start == NULL) goto error;
start++;
u8 *end;
for(end = start + 8; *(u32 *)end != 0xCC010000; end += 8)
if(end >= roStart + roSize - 12) goto error;
memset32(start, 0, end - start);
}
s64 nbSection0Modules; s64 nbSection0Modules;
svcGetSystemInfo(&nbSection0Modules, 26, 0); svcGetSystemInfo(&nbSection0Modules, 26, 0);