r5sdk/r5dev/server/persistence.cpp
Kawe Mazidjatari e14934d244 Fix persistence state for s0/s1 builds
CVEngineServer::IsPersistenceAvailable() is inline with Persistence_SetXP in S0 and S1. the virtual function never gets fired.
The approach for S0/S1 will call CVEngineServer::IsPersistenceAvailable() when Persistence_SetXP() is ran (the first function to ever use pClient->m_nPersistenceState after the SendServerInfo query).
2022-07-08 23:42:28 +02:00

24 lines
591 B
C++

#include "core/stdafx.h"
#include "server/vengineserver_impl.h"
#include "server/persistence.h"
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
bool Persistence_SetXP(int a1, int* a2)
{
HIVEngineServer__PersistenceAvailable(nullptr, a1);
return v_Persistence_SetXP(a1, a2);
}
#endif
void Persistence_Attach()
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
DetourAttach((LPVOID*)&v_Persistence_SetXP, &Persistence_SetXP);
#endif
}
void Persistence_Detach()
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
DetourDetach((LPVOID*)&v_Persistence_SetXP, &Persistence_SetXP);
#endif
}