You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#include "schemasystem.h"
|
|
#include "utils.hpp"
|
|
#include <cstring>
|
|
|
|
void CSchemaSystemTypeScope::FindDeclaredClass(SchemaClassInfoData_t*& pClassInfo, const char* pszClassName)
|
|
{
|
|
#if defined _WIN32 && _M_X64
|
|
CallVFunc<void, 2, SchemaClassInfoData_t*&, const char*>(this, pClassInfo, pszClassName);
|
|
#else
|
|
pClassInfo = CallVFunc<SchemaClassInfoData_t*, 2, const char*>(this, pszClassName);
|
|
#endif
|
|
}
|
|
|
|
CSchemaSystemTypeScope* CSchemaSystem::FindTypeScopeForModule(const char* szpModuleName)
|
|
{
|
|
return CallVFunc<CSchemaSystemTypeScope*, 13, const char*, void*>(this, szpModuleName, nullptr);
|
|
}
|
|
|
|
CSchemaSystemTypeScope* CSchemaSystem::GetServerTypeScope()
|
|
{
|
|
static CSchemaSystemTypeScope* pServerTypeScope = FindTypeScopeForModule(WIN_LINUX("server.dll", "libserver.so"));
|
|
|
|
return pServerTypeScope;
|
|
}
|
|
|
|
int32_t CSchemaSystem::GetServerOffset(const char* pszClassName, const char* pszPropName)
|
|
{
|
|
SchemaClassInfoData_t* pClassInfo = nullptr;
|
|
GetServerTypeScope()->FindDeclaredClass(pClassInfo, pszClassName);
|
|
if (pClassInfo)
|
|
{
|
|
for (int i = 0; i < pClassInfo->m_iFieldsCount; i++)
|
|
{
|
|
auto& pFieldData = pClassInfo->m_pFieldsData[i];
|
|
|
|
if (std::strcmp(pFieldData.m_pszName, pszPropName) == 0)
|
|
{
|
|
return pFieldData.m_iOffset;
|
|
}
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
} |