Fix hashmap crashes with games that load modules.

This should properly unload and reload the functions as necessary.
This commit is contained in:
Unknown W. Brackets committed 2014-04-12 01:16:32 -07:00
1 parent 9d99aaaeaf
commit 76e61e10a9
4 files changed
+38 -8

No files matched your search

+9 -8
View File
@@ -959,10 +959,11 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
SectionID textSection = reader.GetSectionByName(".text");
if (textSection != -1) {
u32 textStart = reader.GetSectionAddr(textSection);
module->textStart = reader.GetSectionAddr(textSection);
u32 textSize = reader.GetSectionSize(textSection);
module->textEnd = module->textStart + textSize;
module->nm.text_addr = textStart;
module->nm.text_addr = module->textStart;
// TODO: This value appears to be wrong. In one example, the PSP has a value > 0x1000 bigger.
module->nm.text_size = textSize;
// TODO: It seems like the data size excludes the text size, which kinda makes sense?
@@ -970,11 +971,11 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
#if !defined(MOBILE_DEVICE)
bool gotSymbols = reader.LoadSymbols();
MIPSAnalyst::ScanForFunctions(textStart, textStart + textSize, !gotSymbols);
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
#else
if (g_Config.bFuncHashMap) {
bool gotSymbols = reader.LoadSymbols();
MIPSAnalyst::ScanForFunctions(textStart, textStart + textSize, !gotSymbols);
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
}
#endif
}
@@ -1127,15 +1128,15 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
}
if (textSection == -1) {
u32 textStart = reader.GetVaddr();
u32 textEnd = firstImportStubAddr - 4;
module->textStart = reader.GetVaddr();
module->textEnd = firstImportStubAddr - 4;
#if !defined(MOBILE_DEVICE)
bool gotSymbols = reader.LoadSymbols();
MIPSAnalyst::ScanForFunctions(textStart, textEnd, !gotSymbols);
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
#else
if (g_Config.bFuncHashMap) {
bool gotSymbols = reader.LoadSymbols();
MIPSAnalyst::ScanForFunctions(textStart, textEnd, !gotSymbols);
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
}
#endif
}