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)
|
||||
{
|
||||
u8 *const off = memsearch(pos, "loade", size, 5);
|
||||
|
||||
*loaderSize = *(u32 *)(off - 0xFC) * 0x200;
|
||||
|
||||
return off - 0x200;
|
||||
u8 *off = pos;
|
||||
do
|
||||
{
|
||||
if(*(u32 *)(off + 0x200) == 0x64616F6C) break; //"load"
|
||||
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