Clarify detour creation errors (#1191)

A logic error here meant that it wasn't printing the failing sig name in the common case
This commit is contained in:
SM9 2020-02-26 00:25:53 +00:00 committed by Asher Baker
parent a3dd25f354
commit 4d38f11367

View File

@ -182,20 +182,23 @@ bool CDetour::IsEnabled()
bool CDetour::CreateDetour() bool CDetour::CreateDetour()
{ {
if (signame && !gameconf->GetMemSig(signame, &detour_address)) if (signame)
{ {
g_pSM->LogError(myself, "Could not locate %s - Disabling detour", signame); if (!gameconf->GetMemSig(signame, &detour_address))
return false;
}
else if(!detour_address)
{ {
g_pSM->LogError(myself, "Invalid detour address passed - Disabling detour to prevent crashes"); g_pSM->LogError(myself, "Signature for %s not found in gamedata", signame);
return false; return false;
} }
if (!detour_address) if (!detour_address)
{ {
g_pSM->LogError(myself, "Sigscan for %s failed - Disabling detour to prevent crashes", signame); g_pSM->LogError(myself, "Sigscan for %s failed", signame);
return false;
}
}
else if (!detour_address)
{
g_pSM->LogError(myself, "Invalid function address passed for detour");
return false; return false;
} }