Use a much better algorithm for getLoader (Luma3DS boots around 0.25s faster now)
This commit is contained in:
parent
4b500349e6
commit
9e87679ee2
@ -74,9 +74,16 @@ u16 *getFirmWriteSafe(u8 *pos, u32 size)
|
|||||||
|
|
||||||
void *getLoader(u8 *pos, u32 size, u32 *loaderSize)
|
void *getLoader(u8 *pos, u32 size, u32 *loaderSize)
|
||||||
{
|
{
|
||||||
u8 *const off = memsearch(pos, "loade", size, 5);
|
u8 *off = pos;
|
||||||
|
do
|
||||||
*loaderSize = *(u32 *)(off - 0xFC) * 0x200;
|
{
|
||||||
|
if(*(u32 *)(off + 0x200) == 0x64616F6C) break; //"load"
|
||||||
return off - 0x200;
|
off += *(u32 *)(off + 0x104) * 0x200; //size of the CXI
|
||||||
|
}
|
||||||
|
while(off < pos + size);
|
||||||
|
|
||||||
|
if(off >= pos + size) return NULL;
|
||||||
|
|
||||||
|
*loaderSize = *(u32 *)(off + 0x104) * 0x200;
|
||||||
|
return off;
|
||||||
}
|
}
|
Reference in New Issue
Block a user