diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 6b8b23d4ec..1d39d308c3 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -163,9 +163,10 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size) if (target == INVALID_BRANCH_TARGET) continue; - if (instr.LK) + const bool is_external = target < startAddr || (max_size && target >= startAddr + max_size); + if (instr.LK || is_external) { - // Found a branch-n-link + // Found a function call func.calls.emplace_back(target, addr); func.flags &= ~FFLAG_LEAF; }