diff --git a/core/logic/GameConfigs.cpp b/core/logic/GameConfigs.cpp index 0151d63b..f9487d6c 100644 --- a/core/logic/GameConfigs.cpp +++ b/core/logic/GameConfigs.cpp @@ -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; diff --git a/public/IGameConfigs.h b/public/IGameConfigs.h index 83feb61e..0f05a03a 100644 --- a/public/IGameConfigs.h +++ b/public/IGameConfigs.h @@ -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;