New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup ElfLoader and BootElf #1463
Conversation
|
||
{ | ||
File::IOFile f(filename, "rb"); | ||
f.ReadBytes(mem.data(), (size_t)filesize); | ||
File::IOFile f(filename, "rb"); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Other than that, looks good to me. |
5688a3c
to
e1cb64f
Compare
Indentation fixed. |
@@ -210,7 +169,7 @@ bool ElfReader::LoadSymbols() | |||
int type = symtab[sym].st_info & 0xF; | |||
int sectionIndex = Common::swap16(symtab[sym].st_shndx); | |||
int value = Common::swap32(symtab[sym].st_value); | |||
const char *name = stringBase + Common::swap32(symtab[sym].st_name); | |||
const char* name = stringBase + Common::swap32(symtab[sym].st_name); | |||
if (bRelocate) | |||
value += sectionAddrs[sectionIndex]; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
e1cb64f
to
a7b0c08
Compare
@skidau Fixed those issues. As an added bonus, that example will now work automatically without setting a dvdroot. |
else | ||
{ | ||
DEBUG_LOG(MASTER_LOG,"Prerelocated executable"); | ||
PanicAlert("Error: Dolphin doesn't know to load a relocatable elf."); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@phire ping. there are merge conflicts now. |
Great, I'll clean those up.
|
Any reason to not merge this? |
* The file already exsists, otherwise we wouldn't have gotten this far in the boot. * We have already checked if it's a Wii or GameCube elf, besides, it's too late to change our minds now anyway. * On Wii - Don't call EmulatedBS2, it can never succeed as it knows nothing about booting elfs. Just call the SetupWiiMemory directly if needed. * On GameCube - We still call EmulatedBS2_GC, but we stop it from running Apploader, which might boot something unexpected from the default iso or DVD root folder.
* Don't claim to support any features we don't, like relocation * Actually zero-out BSS sections, as memory might not be already zeroed. * Deleted commented out code. * Removed GetPointer, updated to more modern interface methods. * Updated pointer types style from "u32 *x" to "u32* x"
Instead of swaping each word of the elf code section(s) looking for a match to our pattern, we swap the pattern just once (at compile time) and test against our swapped pattern.
1ec42ab
to
c1b365f
Compare
Rebased. This can now be merged. delroth: the crash was fixed. |
EmulatedBS2_GC(true); | ||
|
||
Load_FST(_StartupPara.bWii); | ||
if(!Boot_ELF(_StartupPara.m_strFilename)) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
c1b365f
to
5c34766
Compare
Also fix mistake in error message.
Braces fixed. |
Cleanup ElfLoader and BootElf
Various cleanups.
I originally went in to remove a GetPointer, but this code has been hardly touched since the original Open Sourcing, so I couldn't resist cleaning up a lot of other things while I was there.