Multisend is a replacement for servo. No synchronization is needed, just load and go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

129 lines
3.1 KiB

#include "MultiSend.h"
#pragma comment(lib, "psapi.lib")
#include <psapi.h>
#include <stdint.h>
MultiSend::MultiSend(void)
: m_AshitaCore(NULL)
, m_PluginId(0)
, m_Direct3DDevice(NULL)
{ }
MultiSend::~MultiSend(void)
{ }
plugininfo_t* g_PluginInfo = NULL;
plugininfo_t MultiSend::GetPluginInfo(void)
{
return (*g_PluginInfo);
}
bool MultiSend::Initialize(IAshitaCore* core, ILogManager* log, uint32_t id)
{
this->m_AshitaCore = core;
this->m_PluginId = id;
this->m_LogManager = log;
LoadGroups();
MODULEINFO mod = { 0 };
if (!::GetModuleInformation(::GetCurrentProcess(), ::GetModuleHandle("FFXiMain.dll"), &mod, sizeof(MODULEINFO)))
return false;
unsigned char* Pointer = (unsigned char*)Ashita::Memory::FindPattern((uintptr_t)mod.lpBaseOfDll, (uintptr_t)mod.SizeOfImage,
"8BCFE8????FFFF8B0D????????E8????????8BE885ED750CB9",
0, 0);
if (Pointer == NULL) return false;
Pointer += 25;
StructPointer = (sFollow*)(*((DWORD*)Pointer));
//create a handle to the MMF, size matches the struct we're using for it
HANDLE hMapFile = CreateFileMapping(
INVALID_HANDLE_VALUE,
NULL,
PAGE_READWRITE,
0, // maximum object size (high-order DWORD)
sizeof(MMF_Global), // maximum object size (low-order DWORD)
"FFXI_MultiSend");
bool made = (GetLastError() == 0);
if (hMapFile == NULL)
{
throw exception("Could not open or create MMF.");
}
MMF_Pointer = (MMF_Global*)MapViewOfFile(hMapFile, // handle to map object
FILE_MAP_ALL_ACCESS, // read/write permission
0,
0,
sizeof(MMF_Global));
if (MMF_Pointer == NULL)
{
CloseHandle(hMapFile);
throw exception("Could not map MMF.");
}
if (made)
{
memset(MMF_Pointer, 0, sizeof(MMF_Global));
}
Position = MMF_Pointer->Command.Position;
FollowEnabled = true;
ZoneExtra = false;
IgnoreSelf = false;
CurrentName = "";
if (m_AshitaCore->GetDataManager()->GetParty()->GetMemberActive(0))
{
uint16_t myindex = m_AshitaCore->GetDataManager()->GetParty()->GetMemberTargetIndex(0);
UpdateName(std::string(m_AshitaCore->GetDataManager()->GetEntity()->GetName(myindex)));
}
_Debug = false;
//SafeMode enabled by Default (to avoid accidental chatlog spam):
//Allows for prepend of "/echo " to commands that are missing a leading "/".
_SafeMode = false;
this->Start();
return true;
}
void MultiSend::Release(void)
{
this->Stop();
if (MMF_Pointer)
{
UnmapViewOfFile((LPCVOID)MMF_Pointer);
}
if (hMapFile)
{
CloseHandle(hMapFile);
}
}
__declspec(dllexport) double __stdcall GetInterfaceVersion(void)
{
return ASHITA_INTERFACE_VERSION;
}
__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer)
{
g_PluginInfo = lpBuffer;
strcpy_s(g_PluginInfo->Name, sizeof(g_PluginInfo->Name), "MultiSend");
strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "Thorny");
g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION;
g_PluginInfo->PluginVersion = 1.04f;
g_PluginInfo->Priority = 0;
}
__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void)
{
return (IPlugin*)new MultiSend();
}