#include "schemasystem.h" #include "utils.hpp" #include void CSchemaSystemTypeScope::FindDeclaredClass(SchemaClassInfoData_t*& pClassInfo, const char* pszClassName) { #if defined _WIN32 && _M_X64 CallVFunc(this, pClassInfo, pszClassName); #else pClassInfo = CallVFunc(this, pszClassName); #endif } CSchemaSystemTypeScope* CSchemaSystem::FindTypeScopeForModule(const char* szpModuleName) { return CallVFunc(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; }