Make IGameConfig::GetMemSig return value clearer (bug 6081, r=asherkin).

This commit is contained in:
Nicholas Hastings 2014-03-29 14:22:53 -04:00
parent 00b06313c9
commit 2f6b64e92e
2 changed files with 23 additions and 21 deletions

View File

@ -559,7 +559,9 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
smcore.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
s_TempSig.library,
m_CurFile);
} else {
}
else if (s_TempSig.sig[0])
{
if (s_TempSig.sig[0] == '@')
{
#if defined PLATFORM_WINDOWS
@ -594,28 +596,28 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
}
#endif
}
if (final_addr)
if (!final_addr)
{
goto skip_find;
/* First, preprocess the signature */
unsigned char real_sig[511];
size_t real_bytes;
size_t length;
real_bytes = 0;
length = strlen(s_TempSig.sig);
real_bytes = UTIL_DecodeHexString(real_sig, sizeof(real_sig), s_TempSig.sig);
if (real_bytes >= 1)
{
final_addr = g_MemUtils.FindPattern(addrInBase, (char*) real_sig, real_bytes);
}
}
/* First, preprocess the signature */
unsigned char real_sig[511];
size_t real_bytes;
size_t length;
real_bytes = 0;
length = strlen(s_TempSig.sig);
real_bytes = UTIL_DecodeHexString(real_sig, sizeof(real_sig), s_TempSig.sig);
if (real_bytes >= 1)
{
final_addr = g_MemUtils.FindPattern(addrInBase, (char*)real_sig, real_bytes);
}
m_Sigs.replace(m_offset, final_addr);
}
skip_find:
m_Sigs.replace(m_offset, final_addr);
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;
break;

View File

@ -84,9 +84,9 @@ namespace SourceMod
*
* @param key Name of the signature.
* @param addr Pointer to store the memory address in.
* @return True if the key was found, false otherwise.
* Note that true is a valid return even if the
* address is NULL.
* (NULL is copied if signature is not found in binary).
* @return True if the section exists and key for current
* platform was found, false otherwise.
*/
virtual bool GetMemSig(const char *key, void **addr) =0;