Added symbol lookup support to gamedata on Windows (bug 5511, r=ds).
This commit is contained in:
parent
42ff151ae4
commit
749b9dd1bb
@ -525,9 +525,16 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_CurFile);
|
m_CurFile);
|
||||||
} else {
|
} else {
|
||||||
#if defined PLATFORM_POSIX
|
|
||||||
if (s_TempSig.sig[0] == '@')
|
if (s_TempSig.sig[0] == '@')
|
||||||
{
|
{
|
||||||
|
#if defined PLATFORM_WINDOWS
|
||||||
|
MEMORY_BASIC_INFORMATION mem;
|
||||||
|
|
||||||
|
if (VirtualQuery(addrInBase, &mem, sizeof(mem)))
|
||||||
|
final_addr = g_MemUtils.ResolveSymbol(mem.AllocationBase, &s_TempSig.sig[1]);
|
||||||
|
else
|
||||||
|
smcore.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")", s_TempSig.library, m_File);
|
||||||
|
#elif defined PLATFORM_POSIX
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
/* GNU only: returns 0 on error, inconsistent! >:[ */
|
/* GNU only: returns 0 on error, inconsistent! >:[ */
|
||||||
if (dladdr(addrInBase, &info) != 0)
|
if (dladdr(addrInBase, &info) != 0)
|
||||||
@ -550,12 +557,12 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_File);
|
m_File);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (final_addr)
|
if (final_addr)
|
||||||
{
|
{
|
||||||
goto skip_find;
|
goto skip_find;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* First, preprocess the signature */
|
/* First, preprocess the signature */
|
||||||
unsigned char real_sig[511];
|
unsigned char real_sig[511];
|
||||||
size_t real_bytes;
|
size_t real_bytes;
|
||||||
@ -572,9 +579,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined PLATFORM_POSIX
|
|
||||||
skip_find:
|
skip_find:
|
||||||
#endif
|
|
||||||
m_Sigs.replace(m_offset, final_addr);
|
m_Sigs.replace(m_offset, final_addr);
|
||||||
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;
|
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user