@@ -1268,7 +1268,7 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAdd
1268
1268
scan = g_Config.bFuncReplacements ;
1269
1269
#endif
1270
1270
1271
- bool gotSymbols = scan && reader.LoadSymbols ();
1271
+ bool insertSymbols = scan && ! reader.LoadSymbols ();
1272
1272
std::vector<SectionID> codeSections = reader.GetCodeSections ();
1273
1273
for (SectionID id : codeSections) {
1274
1274
u32 start = reader.GetSectionAddr (id);
@@ -1280,8 +1280,9 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAdd
1280
1280
if (end > module->textEnd )
1281
1281
module->textEnd = end;
1282
1282
1283
- if (scan)
1284
- MIPSAnalyst::ScanForFunctions (start, end, !gotSymbols);
1283
+ if (scan) {
1284
+ MIPSAnalyst::ScanForFunctions (start, end, insertSymbols);
1285
+ }
1285
1286
}
1286
1287
1287
1288
// Some games don't have any sections at all.
@@ -1290,14 +1291,18 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAdd
1290
1291
u32 scanEnd = module->textEnd ;
1291
1292
// Skip the exports and imports sections, they're not code.
1292
1293
if (scanEnd >= std::min (modinfo->libent , modinfo->libstub )) {
1293
- MIPSAnalyst::ScanForFunctions (scanStart, std::min (modinfo->libent , modinfo->libstub ) - 4 , !gotSymbols );
1294
+ MIPSAnalyst::ScanForFunctions (scanStart, std::min (modinfo->libent , modinfo->libstub ) - 4 , insertSymbols );
1294
1295
scanStart = std::min (modinfo->libentend , modinfo->libstubend );
1295
1296
}
1296
1297
if (scanEnd >= std::max (modinfo->libent , modinfo->libstub )) {
1297
- MIPSAnalyst::ScanForFunctions (scanStart, std::max (modinfo->libent , modinfo->libstub ) - 4 , !gotSymbols );
1298
+ MIPSAnalyst::ScanForFunctions (scanStart, std::max (modinfo->libent , modinfo->libstub ) - 4 , insertSymbols );
1298
1299
scanStart = std::max (modinfo->libentend , modinfo->libstubend );
1299
1300
}
1300
- MIPSAnalyst::ScanForFunctions (scanStart, scanEnd, !gotSymbols);
1301
+ MIPSAnalyst::ScanForFunctions (scanStart, scanEnd, insertSymbols);
1302
+ }
1303
+
1304
+ if (scan) {
1305
+ MIPSAnalyst::FinalizeScan (insertSymbols);
1301
1306
}
1302
1307
}
1303
1308
0 commit comments