#include"GAMECheat.h"
template<class T> GAMECheat<T>::GAMECheat(unsigned Pid, unsigned _baseAdr, unsigned _readTime) { hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Pid); readTime = _readTime; baseAdr = _baseAdr; }
template<class T> GAMECheat<T>::~GAMECheat() { if (hProcess) CloseHandle(hProcess); }
template <class T> bool GAMECheat<T>::ReadData(unsigned update) { if (hProcess == NULL) { return false; } lastRead = update; return ReadProcessMemory(hProcess, (LPCVOID)baseAdr, this, sizeof(JXRole), NULL); }
template <class T> T& GAMECheat<T>::Data(bool isCheckTime) { if (!isCheckTime) return data; unsigned now = GetTickCount(); if(now-lastRead > readTime) ReadData(now); return data; }
template<class T> void GAMECheat<T>::SetData(void* dataAdr, void* buff, SIZE_T dataSize) { LPVOID destAdr = (LPVOID)((unsigned)dataAdr - (unsigned)this + baseAdr); WriteProcessMemory(hProcess, destAdr, buff, dataSize, NULL); }
template<class T> typeData<T> GAMECheat<T>::SetData(void* dataAdr) { return typeData<T>(this,dataAdr); }
template class GAMECheat<JXRole>;
|