Update elfSize to uncompressed elf size when needed. Fixes infinite loading in Wipeout.

Also minor cleanups.
This commit is contained in:
Henrik Rydgård 2022-10-10 12:22:05 +02:00
parent 470edac18a
commit 6833589e38
3 changed files with 6 additions and 5 deletions

View File

@ -401,9 +401,6 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
// e_ident[EI_VERSION] is ignored
sectionOffsets = new u32[GetNumSections()];
sectionAddrs = new u32[GetNumSections()];
// Should we relocate?
bRelocate = (header->e_type != ET_EXEC);
@ -513,6 +510,9 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
DEBUG_LOG(LOADER,"%i sections:", header->e_shnum);
sectionOffsets = new u32[GetNumSections()];
sectionAddrs = new u32[GetNumSections()];
for (int i = 0; i < GetNumSections(); i++)
{
const Elf32_Shdr *s = &sections[i];
@ -534,7 +534,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
}
}
DEBUG_LOG(LOADER,"Relocations:");
DEBUG_LOG(LOADER, "Relocations:");
// Second pass: Do necessary relocations
for (int i = 0; i < GetNumSections(); i++)

View File

@ -154,7 +154,7 @@ private:
u32 entryPoint = 0;
u32 totalSize = 0;
u32 vaddr = 0;
u32 segmentVAddr[32];
u32 segmentVAddr[32]{};
size_t size_ = 0;
u32 firstSegAlign = 0;
};

View File

@ -1198,6 +1198,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
}
const auto maxElfSize = std::max(head->elf_size, head->psp_size);
newptr = new u8[maxElfSize];
elfSize = maxElfSize;
ptr = newptr;
magicPtr = (u32_le *)ptr;
int ret = pspDecryptPRX(in, (u8*)ptr, head->psp_size);