2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
2022-01-16 00:35:39 +01:00
|
|
|
#include "squirrel/sqapi.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_Script_Remote_BeginRegisteringFunctions;
|
|
|
|
inline auto Script_Remote_BeginRegisteringFunctions = p_Script_Remote_BeginRegisteringFunctions.RCast<void* (*)(void)>();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_RestoreRemoteChecksumsFromSaveGame;
|
|
|
|
inline auto RestoreRemoteChecksumsFromSaveGame = p_RestoreRemoteChecksumsFromSaveGame.RCast<void* (*)(void* a1, void* a2)>();
|
2022-01-20 16:04:10 +01:00
|
|
|
|
2022-04-09 02:18:57 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-06-27 16:56:20 +02:00
|
|
|
inline uint32_t* g_nServerRemoteChecksum = nullptr;
|
2022-04-09 02:18:57 +02:00
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
2022-06-27 16:56:20 +02:00
|
|
|
inline uint32_t* g_nClientRemoteChecksum = nullptr;
|
2022-04-09 02:18:57 +02:00
|
|
|
#endif // !DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-01-16 00:35:39 +01:00
|
|
|
namespace VSquirrel
|
|
|
|
{
|
|
|
|
namespace SHARED
|
|
|
|
{
|
2022-03-30 22:54:33 +02:00
|
|
|
SQRESULT SDKNativeTest(HSQUIRRELVM v);
|
|
|
|
SQRESULT GetSDKVersion(HSQUIRRELVM v);
|
2022-05-27 02:08:51 +02:00
|
|
|
SQRESULT GetAvailableMaps(HSQUIRRELVM v);
|
|
|
|
SQRESULT GetAvailablePlaylists(HSQUIRRELVM v);
|
2022-05-28 17:27:52 +02:00
|
|
|
SQRESULT ShutdownHostGame(HSQUIRRELVM v);
|
2023-01-31 22:26:29 +01:00
|
|
|
#ifndef DEDICATED
|
|
|
|
SQRESULT IsClientDLL(HSQUIRRELVM v);
|
|
|
|
#endif // !DEDICATED
|
2022-04-02 13:03:11 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-09-15 23:13:37 +02:00
|
|
|
SQRESULT KickPlayerByName(HSQUIRRELVM v);
|
|
|
|
SQRESULT KickPlayerById(HSQUIRRELVM v);
|
|
|
|
SQRESULT BanPlayerByName(HSQUIRRELVM v);
|
|
|
|
SQRESULT BanPlayerById(HSQUIRRELVM v);
|
2022-09-16 00:51:35 +02:00
|
|
|
SQRESULT UnbanPlayer(HSQUIRRELVM v);
|
2022-09-16 01:40:17 +02:00
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
}
|
|
|
|
#ifndef CLIENT_DLL
|
|
|
|
namespace SERVER
|
|
|
|
{
|
|
|
|
SQRESULT GetNumHumanPlayers(HSQUIRRELVM v);
|
|
|
|
SQRESULT GetNumFakeClients(HSQUIRRELVM v);
|
2023-01-31 22:26:29 +01:00
|
|
|
SQRESULT IsDedicated(HSQUIRRELVM v);
|
2022-01-16 00:35:39 +01:00
|
|
|
}
|
2022-04-02 13:03:11 +02:00
|
|
|
#endif // !CLIENT_DLL
|
2022-01-16 00:35:39 +01:00
|
|
|
#ifndef DEDICATED
|
|
|
|
namespace CLIENT
|
|
|
|
{
|
|
|
|
}
|
|
|
|
namespace UI
|
|
|
|
{
|
2022-08-27 18:57:56 +02:00
|
|
|
SQRESULT RefreshServerCount(HSQUIRRELVM v);
|
2022-03-30 22:54:33 +02:00
|
|
|
SQRESULT GetServerName(HSQUIRRELVM v);
|
2022-07-01 23:33:47 +02:00
|
|
|
SQRESULT GetServerDescription(HSQUIRRELVM v);
|
2022-03-30 22:54:33 +02:00
|
|
|
SQRESULT GetServerMap(HSQUIRRELVM v);
|
2022-07-01 23:37:27 +02:00
|
|
|
SQRESULT GetServerPlaylist(HSQUIRRELVM v);
|
2022-07-01 23:33:47 +02:00
|
|
|
SQRESULT GetServerCurrentPlayers(HSQUIRRELVM v);
|
|
|
|
SQRESULT GetServerMaxPlayers(HSQUIRRELVM v);
|
2022-03-30 22:54:33 +02:00
|
|
|
SQRESULT GetServerCount(HSQUIRRELVM v);
|
|
|
|
SQRESULT GetPromoData(HSQUIRRELVM v);
|
2023-01-28 13:28:27 +01:00
|
|
|
SQRESULT ConnectToListedServer(HSQUIRRELVM v);
|
|
|
|
SQRESULT CreateServer(HSQUIRRELVM v);
|
|
|
|
SQRESULT ConnectToHiddenServer(HSQUIRRELVM v);
|
2023-04-02 17:11:14 +02:00
|
|
|
SQRESULT GetHiddenServerName(HSQUIRRELVM v);
|
2023-01-28 13:28:27 +01:00
|
|
|
SQRESULT ConnectToServer(HSQUIRRELVM v);
|
2022-01-16 00:35:39 +01:00
|
|
|
}
|
|
|
|
#endif // !DEDICATED
|
|
|
|
}
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VSqInit : public IDetour
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2023-01-25 02:26:52 +01:00
|
|
|
LogFunAdr("Remote_BeginRegisteringFunctions", p_Script_Remote_BeginRegisteringFunctions.GetPtr());
|
|
|
|
LogFunAdr("RestoreRemoteChecksumsFromSaveGame", p_RestoreRemoteChecksumsFromSaveGame.GetPtr());
|
2022-04-09 06:05:47 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2023-01-25 02:26:52 +01:00
|
|
|
LogVarAdr("g_nServerRemoteChecksum", reinterpret_cast<uintptr_t>(g_nServerRemoteChecksum));
|
2022-04-09 06:05:47 +02:00
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
2023-01-25 02:26:52 +01:00
|
|
|
LogVarAdr("g_nClientRemoteChecksum", reinterpret_cast<uintptr_t>(g_nClientRemoteChecksum));
|
2022-04-09 06:05:47 +02:00
|
|
|
#endif // !DEDICATED
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2022-12-01 22:44:55 +01:00
|
|
|
p_Script_Remote_BeginRegisteringFunctions = g_GameDll.FindPatternSIMD("48 83 EC 28 83 3D ?? ?? ?? ?? ?? 74 10");
|
|
|
|
p_RestoreRemoteChecksumsFromSaveGame = g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 41 54 48 83 EC 40");
|
2022-04-18 03:35:08 +02:00
|
|
|
|
|
|
|
Script_Remote_BeginRegisteringFunctions = p_Script_Remote_BeginRegisteringFunctions.RCast<void* (*)(void)>(); /*48 83 EC 28 83 3D ?? ?? ?? ?? ?? 74 10*/
|
|
|
|
RestoreRemoteChecksumsFromSaveGame = p_RestoreRemoteChecksumsFromSaveGame.RCast<void* (*)(void* a1, void* a2)>(); /*48 89 4C 24 ?? 41 54 48 83 EC 40*/
|
|
|
|
}
|
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
|
|
|
#ifndef CLIENT_DLL
|
2022-06-27 16:56:20 +02:00
|
|
|
g_nServerRemoteChecksum = p_RestoreRemoteChecksumsFromSaveGame.Offset(0x1C0).FindPatternSelf("48 8D 15", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).RCast<uint32_t*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
2022-06-27 16:56:20 +02:00
|
|
|
g_nClientRemoteChecksum = p_Script_Remote_BeginRegisteringFunctions.Offset(0x0).FindPatternSelf("89 05", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x6).RCast<uint32_t*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
#endif // !DEDICATED
|
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
2021-12-25 22:36:38 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|