Browse Source

Del shit

master
shelru 8 years ago
parent
commit
d84afb8eda
  1. 263
      Release/MiniBase/client.cpp
  2. 380
      Release/MiniBase/offset.cpp
  3. BIN
      Release/ЭкстраМиррорm09E.mix

263
Release/MiniBase/client.cpp

@ -1,263 +0,0 @@ @@ -1,263 +0,0 @@
#include "client.h"
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#include <iostream> // std::cout
#include <algorithm> // std::copy
#include "minIni.h"
#include <vector>
#pragma warning(disable:4996)
extern TCHAR g_settingsFileName[MAX_PATH];
bool FirstFrame = false;
pfnUserMsgHook pMOTD;
GameInfo_t BuildInfo;
cvar_t *random;
map<string, string> g_modelsHashMap;
cvar_t *logsfiles;
cvar_t *events_block;
cvar_t *ex_thud;
cvar_t *motd_block;
cvar_t *type;
void HookEngineMessages(){
pEngineMsgBase = (PEngineMsg)offset.FindSVCMessages();
pSVC_StuffText = HookEngineMsg("svc_stufftext", SVC_StuffText);
pSVC_SendCvarValue = HookEngineMsg("svc_sendcvarvalue", SVC_SendCvarValue);
pSVC_SendCvarValue2 = HookEngineMsg("svc_sendcvarvalue2", SVC_SendCvarValue2);
pSVC_Director = HookEngineMsg("svc_director", SVC_Director);
// pSVC_Resourcelist = HookEngineMsg("svc_resourcelist", SVC_Resourcelist);
}
void ConsolePrintColor(BYTE R, BYTE G, BYTE B, char* string){
TColor24 DefaultColor;PColor24 Ptr;Ptr = Console_TextColor;DefaultColor = *Ptr;Ptr->R = R;Ptr->G = G;Ptr->B = B;g_Engine.Con_Printf("%s", string);*Ptr = DefaultColor;
}
void models(){
for (DWORD i = 0; i < 32; i++){
player_info_s* player = g_pStudio->PlayerInfo(i);
if (player && (lstrlenA(player->name)>1) && player->model){
char buffer[128];
sprintf_s(buffer, "NAME -> [ %s ] | MODEL -> [ %s ]\n", player->name, player->model);
ConsolePrintColor(255, 255, 15, buffer);
}
}
}
void Credits(){
ConsolePrintColor(255, 255, 255, "-- Thank's to");ConsolePrintColor(0, 255, 0, " [2010] Team\n");ConsolePrintColor(255, 255, 255, "-- Thank's to");
ConsolePrintColor(0, 255, 0, " madotsuki-team < *\n");ConsolePrintColor(255, 255, 255, "-- Thank's to ");ConsolePrintColor(0, 255, 0, "or_75\n");
}
int g_blockedCmdCount, g_serverCmdCount,g_anticheckfiles;
char *g_blockedCmds[1024], *g_serverCmds[2048], *g_anticheckfiles2[2048];
struct models_replace_s{char name[32];char repl[32];};
vector<models_replace_s> models_list;
int Callback(const char *section, const char *key, const char *value, const void *userdata){
if (lstrcmpA(section, "Models") == 0){
models_replace_s model_d;lstrcpyA(model_d.name, key);lstrcpyA(model_d.repl, value);models_list.push_back(model_d);
}
return 1;
}
void Inject(){LoadLibraryA(g_Engine.Cmd_Argv(1)); }
int g_blockedCvarCount;
char *g_blockedCvars[512];
void Reload(){
models_list.clear();
ini_browse(Callback,NULL,g_settingsFileName);
memset(g_blockedCmds,0,sizeof(g_blockedCmds));memset(g_blockedCvars, 0, sizeof(g_blockedCvars));
memset(g_serverCmds, 0, sizeof(g_serverCmds)); memset(g_anticheckfiles2, 0, sizeof(g_anticheckfiles2));
g_blockedCvarCount = 0; g_blockedCmdCount = 0; g_serverCmdCount = 0; g_anticheckfiles = 0;
static TCHAR sKeyNames[4096*3];
GetPrivateProfileSection(TEXT("ADetect"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
char *psKeyName4 = sKeyNames;
while (psKeyName4[0] != '\0') { g_anticheckfiles2[g_anticheckfiles++] = strdup(psKeyName4); psKeyName4 += strlen(psKeyName4) + 1; }
GetPrivateProfileSection(TEXT("Commands"),sKeyNames,ARRAYSIZE(sKeyNames),g_settingsFileName);
char *psKeyName = sKeyNames;
while (psKeyName[0]!='\0'){g_blockedCmds[g_blockedCmdCount++]=strdup(psKeyName);psKeyName+=strlen(psKeyName)+1;}
GetPrivateProfileSection(TEXT("Send Commands"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
char *psKeyName3 = sKeyNames;
while (psKeyName3[0] != '\0') { g_serverCmds[g_serverCmdCount++] = strdup(psKeyName3); psKeyName3 += strlen(psKeyName3) + 1; }
GetPrivateProfileSection(TEXT("Blocked cvars"),sKeyNames,ARRAYSIZE(sKeyNames),g_settingsFileName);
char *psKeyName2=sKeyNames;
while (psKeyName2[0]!='\0'){g_blockedCvars[g_blockedCvarCount++]=strdup(psKeyName2);psKeyName2+=strlen(psKeyName2)+1;}
TCHAR value[16];char cvarname[32];
GetPrivateProfileString(TEXT("Settings"), TEXT("sid_random"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
sprintf(cvarname, "sid_random %s", value);g_Engine.pfnClientCmd(cvarname); memset(value, 0, sizeof(value)); memset(cvarname, 0, sizeof(cvarname));
GetPrivateProfileString(TEXT("Settings"), TEXT("cust_hud"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
sprintf(cvarname, "cust_hud %s", value); g_Engine.pfnClientCmd(cvarname);memset(value, 0, sizeof(value)); memset(cvarname, 0, sizeof(cvarname));
GetPrivateProfileString(TEXT("Settings"), TEXT("logs"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
sprintf(cvarname, "logs %s", value); g_Engine.pfnClientCmd(cvarname);memset(value, 0, sizeof(value)); memset(cvarname, 0, sizeof(cvarname));
GetPrivateProfileString(TEXT("Settings"), TEXT("motd_block"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
sprintf(cvarname, "motd_block %s", value); g_Engine.pfnClientCmd(cvarname);memset(value, 0, sizeof(value)); memset(cvarname, 0, sizeof(cvarname));
GetPrivateProfileString(TEXT("Settings"), TEXT("type"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
sprintf(cvarname, "type %s", value); g_Engine.pfnClientCmd(cvarname); memset(value, 0, sizeof(value)); memset(cvarname, 0, sizeof(cvarname));
GetPrivateProfileString(TEXT("Settings"), TEXT("events_block"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
sprintf(cvarname, "events_block %s", value); g_Engine.pfnClientCmd(cvarname); memset(value, 0, sizeof(value)); memset(cvarname, 0, sizeof(cvarname));
}
void InitHack(){
static TCHAR sKeyNames[4096 * 3];
GetPrivateProfileSection(TEXT("Commands"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
char *psKeyName = sKeyNames;
g_blockedCmdCount = 0;
while (psKeyName[0] != '\0') {
g_blockedCmds[g_blockedCmdCount++] = strdup(psKeyName);
psKeyName += strlen(psKeyName) + 1;
}
GetPrivateProfileSection(TEXT("ADetect"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
psKeyName = sKeyNames;
g_anticheckfiles = 0;
while (psKeyName[0] != '\0') {
g_anticheckfiles2[g_anticheckfiles++] = strdup(psKeyName);
psKeyName += strlen(psKeyName) + 1;
}
GetPrivateProfileSection(TEXT("Send Commands"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
psKeyName = sKeyNames;
g_serverCmdCount = 0;
while (psKeyName[0] != '\0') {
g_serverCmds[g_serverCmdCount++] = strdup(psKeyName);
psKeyName += strlen(psKeyName) + 1;
}
GetPrivateProfileSection(TEXT("AutoInject"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
psKeyName = sKeyNames;
while (psKeyName[0] != '\0') {
LoadLibraryA(psKeyName);
psKeyName += strlen(psKeyName) + 1;
}
GetPrivateProfileSection(TEXT("Custom Commands"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
psKeyName = sKeyNames;
while (psKeyName[0] != '\0') {
g_pEngine->pfnAddCommand(strdup(psKeyName), DRC_CMD_NONE);
psKeyName += strlen(psKeyName) + 1;
}
ini_browse(Callback, NULL, g_settingsFileName);
GetPrivateProfileSection(TEXT("Blocked cvars"), sKeyNames, ARRAYSIZE(sKeyNames), g_settingsFileName);
char *psKeyName2 = sKeyNames;
g_blockedCvarCount = 0;
while (psKeyName2[0] != '\0') {
g_blockedCvars[g_blockedCvarCount++] = strdup(psKeyName2);
psKeyName2 += strlen(psKeyName2) + 1;
}
if (!(g_Engine.Con_IsVisible() != 0))g_Engine.pfnClientCmd("toggleconsole");
ConsolePrintColor(0, 255, 11, "-- Extra Mirror v1.8e\n");
ConsolePrintColor(255, 255, 255, "-- Use 'credits' for more information\n");
ConsolePrintColor(255, 255, 255, "-- Thank's to Realwar for title\n");
ConsolePrintColor(255, 255, 255, "-- Thank's to FightMagister for functions\n");
ConsolePrintColor(255, 255, 255, "-- Thank's to Spawner { Kiass }\n");
g_pEngine->pfnAddCommand("credits", Credits); g_pEngine->pfnAddCommand("inject", Inject); g_pEngine->pfnAddCommand("modelsn", models); g_pEngine->pfnAddCommand("update", Reload);TCHAR value[16];
GetPrivateProfileString(TEXT("Settings"), TEXT("sid_random"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
random = g_pEngine->pfnRegisterVariable("sid_random", strdup(value), 0);memset(value, 0, sizeof(value));
GetPrivateProfileString(TEXT("Settings"), TEXT("cust_hud"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
ex_thud = g_pEngine->pfnRegisterVariable("cust_hud", value, 0);memset(value, 0, sizeof(value));
GetPrivateProfileString(TEXT("Settings"), TEXT("logs"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
logsfiles = g_pEngine->pfnRegisterVariable("logs", value, 0);memset(value, 0, sizeof(value));
GetPrivateProfileString(TEXT("Settings"), TEXT("events_block"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
events_block = g_pEngine->pfnRegisterVariable("events_block", value, 0); memset(value, 0, sizeof(value));
GetPrivateProfileString(TEXT("Settings"), TEXT("motd_block"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
motd_block = g_pEngine->pfnRegisterVariable("motd_block", value, 0);memset(value, 0, sizeof(value));
GetPrivateProfileString(TEXT("Settings"), TEXT("type"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
type = g_pEngine->pfnRegisterVariable("type", value, 0); memset(value, 0, sizeof(value));
GetPrivateProfileString(TEXT("Settings"), TEXT("type"), TEXT("0"), value, ARRAYSIZE(value), g_settingsFileName);
}
void HookEventMessages(){
pEventMsgBase = (PEventMsg)offset.FindEventMsgBase();
pEvent_ak47 = HookEventMsg("events/ak47.sc", Event_ak47);
pEvent_aug = HookEventMsg("events/aug.sc", Event_aug);
pEvent_awp = HookEventMsg("events/awp.sc", Event_awp);
pEvent_createexplo = HookEventMsg("events/createexplo.sc", Event_createexplo);
pEvent_deagle = HookEventMsg("events/deagle.sc", Event_deagle);
pEvent_elite_left = HookEventMsg("events/elite_left.sc", Event_elite_left);
pEvent_elite_right = HookEventMsg("events/elite_right.sc", Event_elite_right);
pEvent_famas = HookEventMsg("events/famas.sc", Event_famas);
pEvent_fiveseven = HookEventMsg("events/fiveseven.sc", Event_fiveseven);
pEvent_g3sg1 = HookEventMsg("events/g3sg1.sc", Event_g3sg1);
pEvent_galil = HookEventMsg("events/galil.sc", Event_galil);
pEvent_glock = HookEventMsg("events/glock18.sc", Event_glock);
pEvent_m3 = HookEventMsg("events/m3.sc", Event_m3);
pEvent_m4a1 = HookEventMsg("events/m4a1.sc", Event_m4a1);
pEvent_m249 = HookEventMsg("events/m249.sc", Event_m249);
pEvent_mac10 = HookEventMsg("events/mac10.sc", Event_mac10);
pEvent_mp5n = HookEventMsg("events/mp5n.sc", Event_mp5n);
pEvent_p90 = HookEventMsg("events/p90.sc", Event_p90);
pEvent_p228 = HookEventMsg("events/p228.sc", Event_p228);
pEvent_scout = HookEventMsg("events/scout.sc", Event_scout);
pEvent_sg550 = HookEventMsg("events/sg550.sc", Event_sg550);
pEvent_sg552 = HookEventMsg("events/sg552.sc", Event_sg552);
pEvent_tmp = HookEventMsg("events/tmp.sc", Event_tmp);
pEvent_ump45 = HookEventMsg("events/ump45.sc", Event_ump45);
pEvent_vehicle = HookEventMsg("events/vehicle.sc", Event_vehicle);
pEvent_xm1014 = HookEventMsg("events/xm1014.sc", Event_xm1014);
// pEvent_knife = HookEventMsg("events/knife.sc", Event_knife);
// pEvent_createsmoke = HookEventMsg("events/createsmoke.sc", Event_createsmoke);
}
//Shel be there;((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
void HUD_Frame(double time){
if (!FirstFrame){
g_Screen.iSize = sizeof(SCREENINFO);offset.HLType = g_Studio.IsHardware() + 1;offset.ConsoleColorInitalize();
offset.GetGameInfo(&BuildInfo);HookUserMessages(); HookEngineMessages();InitHack();FirstFrame = true;
HookEventMessages();
}
g_Engine.pfnGetScreenInfo(&g_Screen);
g_Client.HUD_Frame(time);
}
void CL_CreateMove(float frametime, struct usercmd_s *cmd, int active){
for (DWORD i = 1; i < 32; i++){
player_info_s* player = g_pStudio->PlayerInfo(i);
if (player && player->name && player->model){
for (auto m : models_list){
if (lstrcmpA(player->model, m.name) == 0){
lstrcpyA(player->model, m.repl);
}
}
}
}
g_Client.CL_CreateMove(frametime, cmd,active);
}
int MOTD(const char *pszName, int iSize, void *pbuf);
int MOTD(const char *pszName, int iSize, void *pbuf){
if (logsfiles->value > 0){
BEGIN_READ(pbuf, iSize);
int konez = READ_BYTE();
char* buff = READ_STRING();
char str[1024];strncpy(str, buff, sizeof(str));
str[sizeof(str) - 1] = 0;
ConsolePrintColor(255, 255, 155, str);
if (konez == 1)ConsolePrintColor(255, 255, 155, "\n");
}
if (motd_block->value > 0)return 1;
return pMOTD(pszName, iSize, pbuf);
}
void HookUserMessages(){
pUserMsgBase=(PUserMsg)offset.FindUserMsgBase();pMOTD=HookUserMsg("MOTD",MOTD);
}
int pfnDrawUnicodeCharacter(int x, int y, short number, int r, int g, int b, unsigned long hfont) {
if (ex_thud->value>0)return 1;return g_Engine.pfnDrawUnicodeCharacter(x,y,number,r,g,b,hfont);
}
void SetRenderModel(struct model_s *model)
{
g_Engine.Con_Printf("\tmodel: %s\n", model->name);
g_Studio.SetRenderModel(model);
}
void HookFunction(){
g_pClient->CL_CreateMove = CL_CreateMove;
g_pClient->HUD_Frame = HUD_Frame;
g_pEngine->pfnDrawUnicodeCharacter = pfnDrawUnicodeCharacter;
// g_pStudio->SetRenderModel = SetRenderModel;
}

380
Release/MiniBase/offset.cpp

@ -1,380 +0,0 @@ @@ -1,380 +0,0 @@
#include "offset.h"
cOffset offset;
void cOffset::GetRenderType()
{
HwDll = (DWORD)GetModuleHandleA(HW_DLL);
SwDll = (DWORD)GetModuleHandleA(SW_DLL);
HlMod = (DWORD)GetModuleHandleA(NULL);
}
bool cOffset::GetModuleInfo()
{
GetRenderType();
if (HwDll)
HwBase = HwDll;
else if (SwDll)
HwBase = SwDll;
else
HwBase = HlMod;
HwSize = GetModuleSize(HwBase);
HwEnd = HwBase + HwSize - 1;
HlBase = HlMod;
HlSize = (DWORD)GetModuleSize(HlBase);
HlEnd = HlBase + HlSize - 1;
ClBase = (DWORD)GetModuleHandleA(CLIENT_DLL);
if (ClBase)
{
ClSize = GetModuleSize(ClBase);
ClEnd = ClBase + ClSize - 1;
}
else
{
ClBase = HwBase;
ClEnd = HwEnd;
ClSize = HwSize;
}
VgBase = (DWORD)GetModuleHandleA(GAMEUI_DLL);
if (VgBase)
{
VgSize = (DWORD)GetModuleSize(VgBase);
VgEnd = VgBase + VgSize - 1;
}
return (HwBase && ClBase && HlBase && VgBase);
}
void cOffset::Error(char* Msg)
{
MessageBoxA(0, Msg, OFF_ERROR, MB_OK | MB_ICONERROR);
}
DWORD cOffset::FindClientTable()
{
BYTE ClientOffset[2] = { 0x10, 0x13 };
DWORD PatternAddress = FindPattern(OFF_CLIENT_PATTERN, HwBase, HwEnd, 0);
if (PatternAddress)
{
for (byte i = 0; i < sizeof(ClientOffset); i++)
{
DWORD ClientTablePtr = *(PDWORD)(FindReference(HwBase, HwEnd, PatternAddress) + ClientOffset[i]);
if (!FarProc((DWORD)ClientTablePtr, HwBase, HwEnd) &&
!IsBadReadPtr((PVOID)ClientTablePtr, sizeof(cl_clientfunc_t)))
{
return ClientTablePtr;
}
}
}
return 0;
}
DWORD cOffset::FindEngineTable()
{
DWORD PatternAddress = FindPattern(OFF_ENGINE_PATTERN, OFF_ENGINE_MASK, ClBase, ClEnd, 0x02);
if (PatternAddress)
{
if (!FarProc((DWORD)PatternAddress, ClBase, ClEnd))
{
return *(PDWORD)PatternAddress;
}
}
else
{
PatternAddress = FindPattern(OFF_ENGINE_PATTERN, OFF_ENGINE_MASK, HlBase, HlEnd, 0x02);
if (PatternAddress)
{
if (!FarProc((DWORD)PatternAddress, HlBase, HlEnd))
{
return *(PDWORD)PatternAddress;
}
}
}
return 0;
}
DWORD cOffset::FindStudioTable()
{
DWORD StudioTablePtr = *(DWORD*)((DWORD)g_pClient->HUD_GetStudioModelInterface + 0x30); // old patch, dod
if (FarProc((DWORD)StudioTablePtr, HwBase, HwEnd) && FarProc((DWORD)StudioTablePtr, HlBase, HlEnd) &&
FarProc((DWORD)StudioTablePtr, ClBase, ClEnd))
{
StudioTablePtr = *(DWORD*)((DWORD)g_pClient->HUD_GetStudioModelInterface + 0x1A); // new patch / steam
if (FarProc((DWORD)StudioTablePtr, ClBase, ClEnd))
return 0;
}
return StudioTablePtr;
}
DWORD cOffset::FindUserMsgBase()
{
BYTE Pattern_UserMsg[9] =
{
0x52, 0x50, 0xE8, 0xFF, 0xFF, 0xFF, 0xFF, 0x83, 0x00
};
BYTE Pattern_UserMsg2[13] =
{
0xFF, 0xFF, 0xFF, 0x0C,
0x56, 0x8B, 0x35, 0xFF, 0xFF, 0xFF, 0xFF, 0x57, 0x00
};
DWORD Address = (DWORD)g_Engine.pfnHookUserMsg;
DWORD UserMsgBase = Absolute(FindPattern((PCHAR)Pattern_UserMsg, OFF_MSG_USER_MASK1, Address, Address + 0x32, 3));
if (FarProc(UserMsgBase, HwBase, HwEnd))
{
Error(OFF_USER_MSG_EROR1);
return 0;
}
UserMsgBase = FindPattern((PCHAR)Pattern_UserMsg2, OFF_MSG_USER_MASK2, UserMsgBase, UserMsgBase + 0x32, 7);
if (FarProc(UserMsgBase, HwBase, HwEnd))
{
Error(OFF_USER_MSG_EROR2);
return 0;
}
return **(PDWORD*)UserMsgBase;
}
DWORD cOffset::FindGameConsole()
{
DWORD PatternAddress = FindPattern(OFF_GAME_CONSOLE_P, VgBase, VgEnd, 0);
DWORD ReferenAddress = FindReference(VgBase, VgEnd, PatternAddress) + 0x21;
if (FarProc(ReferenAddress, VgBase, VgEnd))
{
Error(OFF_GAME_CONSOLE_R);
return 0;
}
DWORD GameConsole = *(PDWORD)ReferenAddress;
return GameConsole;
}
DWORD cOffset::FindSVCMessages()
{
DWORD EngineMsgBase = FindPattern(OFF_SVC_MSG_PATTERN, OFF_SVC_MSG_MASK, HwBase, HwEnd, 1);
PEngineMsg pEngineMsgBase = (PEngineMsg)(*(PDWORD)EngineMsgBase - sizeof(DWORD));
if (pEngineMsgBase)
{
MSG_ReadByte = (HL_MSG_ReadByte)offset.Absolute(((DWORD)pEngineMsgBase[SVC_CDTRACK].pfn) + 1);
MSG_ReadShort = (HL_MSG_ReadShort)offset.Absolute(((DWORD)pEngineMsgBase[SVC_STOPSOUND].pfn) + 1);
MSG_ReadLong = (HL_MSG_ReadLong)offset.Absolute(((DWORD)pEngineMsgBase[SVC_VERSION].pfn) + 1);
MSG_ReadFloat = (HL_MSG_ReadFloat)offset.Absolute(((DWORD)pEngineMsgBase[SVC_TIMESCALE].pfn) + 1);
MSG_ReadString = (HL_MSG_ReadString)offset.Absolute(((DWORD)pEngineMsgBase[SVC_PRINT].pfn) + 1);
DWORD CallMSG_ReadCoord = offset.Absolute((DWORD)(pEngineMsgBase[SVC_PARTICLE].pfn) + 1);
if (*(PBYTE)(CallMSG_ReadCoord + 0x13) == 0xE8) // STEAM
MSG_ReadCoord = (HL_MSG_ReadCoord)offset.Absolute((CallMSG_ReadCoord + 0x14));
else if (*(PBYTE)(CallMSG_ReadCoord + 0x15) == 0xE8) // OLD PATCH (SOFTWARE)
MSG_ReadCoord = (HL_MSG_ReadCoord)offset.Absolute((CallMSG_ReadCoord + 0x16));
else if (*(PBYTE)(CallMSG_ReadCoord + 0x0E) == 0xE8) // OLD PATCH
MSG_ReadCoord = (HL_MSG_ReadCoord)offset.Absolute((CallMSG_ReadCoord + 0x0F));
else if (*(PBYTE)(CallMSG_ReadCoord + 0x0B) == 0xE8) // OLD OLD PATCH
MSG_ReadCoord = (HL_MSG_ReadCoord)offset.Absolute((CallMSG_ReadCoord + 0x0C));
else
offset.Error(OFF_MSG_READ_CORD);
MSG_ReadCount = *(PINT*)((INT)(MSG_ReadByte)+1);
MSG_CurrentSize = *(PINT*)((INT)(MSG_ReadByte)+7);
MSG_BadRead = *(PINT*)((INT)(MSG_ReadByte)+20);
DWORD SVC_SoundBase = (DWORD)pEngineMsgBase[SVC_SOUND].pfn;
if (*(PBYTE)(SVC_SoundBase + 0x0E) == 0xE8)
{
MSG_Buffer = (sizebuf_t *)(*(PDWORD)(SVC_SoundBase + 0x0A));
MSG_StartBitReading = (HL_MSG_StartBitReading)offset.Absolute(SVC_SoundBase + 0x0F);
MSG_ReadBits = (HL_MSG_ReadBits)offset.Absolute(SVC_SoundBase + 0x16);
}
else if (*(PBYTE)(SVC_SoundBase + 0x0C) == 0xE8)
{
MSG_Buffer = (sizebuf_t *)(*(PDWORD)(SVC_SoundBase + 0x08));
MSG_StartBitReading = (HL_MSG_StartBitReading)offset.Absolute(SVC_SoundBase + 0x0D);
MSG_ReadBits = (HL_MSG_ReadBits)offset.Absolute(SVC_SoundBase + 0x14);
}
else
offset.Error(OFF_MSG_STR_READING);
if (*(PBYTE)(SVC_SoundBase + 0xD6) == 0xE8)
{
MSG_EndBitReading = (HL_MSG_EndBitReading)offset.Absolute(SVC_SoundBase + 0xD7);
MSG_ReadBitVec3Coord = (HL_MSG_ReadBitVec3Coord)offset.Absolute(SVC_SoundBase + 0xAF);
}
else if (*(PBYTE)(SVC_SoundBase + 0xE2) == 0xE8)
{
MSG_EndBitReading = (HL_MSG_EndBitReading)offset.Absolute(SVC_SoundBase + 0xE3);
MSG_ReadBitVec3Coord = (HL_MSG_ReadBitVec3Coord)offset.Absolute(SVC_SoundBase + 0xBE);
}
else
offset.Error(OFF_MSG_END_READING);
}
else
offset.Error(OFF_ENGINE_MSG_BASE);
return (DWORD)pEngineMsgBase;
}
#define equali !stricmp
DWORD cOffset::FindEventMsgBase()
{
DWORD PatternAddress = FindPattern(OFF_EVENT_MSG_BASE, HwBase, HwEnd, 0);
DWORD ReferenAddress;
if (equali(BuildInfo.GameVersion,"4554")){
ReferenAddress = FindReference(HwBase, HwEnd, PatternAddress) - 0x06;
}
else { ReferenAddress = FindReference(HwBase, HwEnd, PatternAddress) - 0x07; }
if (FarProc(ReferenAddress, HwBase, HwEnd))
{
Error(OFF_EVENT_MSG_ERROR);
return 0;
}
return *(PDWORD)(*(PDWORD)ReferenAddress);
}
void cOffset::ConsoleColorInitalize()
{
DWORD GameConsole = FindGameConsole();
if (GameConsole)
{
DWORD Panel = (*(PDWORD)(GameConsole + 8) - GameConsole);
Console_TextColor = PColor24(Panel + GameConsole + 288 + sizeof(DWORD));
if (*(PDWORD)(DWORD(Console_TextColor) + 8) != 0)
{
Console_TextColor = PColor24(Panel + GameConsole + 288 + (sizeof(DWORD) * 2));
}
}
}
void cOffset::GetGameInfo(pGameInfo_s GameInfo)
{
typedef int(*function)();
pcmd_t cmd = CommandByName("version");
DWORD Address = (DWORD)cmd->function;
GameInfo->GameName = *(PCHAR*)(UINT(Address) + 1);
GameInfo->GameVersion = *(PCHAR*)(UINT(Address) + 6);
GameInfo->Protocol = *(PBYTE)(UINT(Address) + 11);
Address = Absolute(UINT(Address) + 23);
if (FarProc(Address, HwBase, HwEnd))
Error(OFF_ERR_GAMEINFO);
function GetBuild = (function)Address;
GameInfo->Build = GetBuild();
}
void cOffset::CopyClient()
{
native_memcpy(&g_Client, g_pClient, sizeof(cl_clientfunc_t));
}
void cOffset::CopyEngine()
{
native_memcpy(&g_Engine, g_pEngine, sizeof(cl_enginefunc_t));
}
void cOffset::CopyStudio()
{
native_memcpy(&g_Studio, g_pStudio, sizeof(engine_studio_api_t));
}
DWORD cOffset::Absolute(DWORD Address)
{
return Address + *(PDWORD)Address + 4;
}
DWORD cOffset::FarProc(DWORD Address, DWORD LB, DWORD HB)
{
return ((Address < LB) || (Address > HB));
}
DWORD cOffset::FindReference(DWORD start, DWORD end, DWORD Address)
{
char szPattern[] = { 0x68, 0x00, 0x00, 0x00, 0x00, 0x00 };
*(PDWORD)&szPattern[1] = Address;
return FindPattern(szPattern, start, end, 0);
}
DWORD cOffset::FindPattern(PCHAR pattern, PCHAR mask, DWORD start, DWORD end, DWORD offset)
{
int patternLength = native_strlen(pattern);
bool found = false;
for (DWORD i = start; i < end - patternLength; i++)
{
found = true;
for (int idx = 0; idx < patternLength; idx++)
{
if (mask[idx] == 'x' && pattern[idx] != *(PCHAR)(i + idx))
{
found = false;
break;
}
}
if (found)
{
return i + offset;
}
}
return 0;
}
DWORD cOffset::FindPattern(PCHAR pattern, DWORD start, DWORD end, DWORD offset)
{
int patternLength = native_strlen(pattern);
bool found = false;
for (DWORD i = start; i < end - patternLength; i++)
{
found = true;
for (int idx = 0; idx < patternLength; idx++)
{
if (pattern[idx] != *(PCHAR)(i + idx))
{
found = false;
break;
}
}
if (found)
{
return i + offset;
}
}
return 0;
}
DWORD cOffset::GetModuleSize(DWORD Address)
{
return PIMAGE_NT_HEADERS(Address + (DWORD)PIMAGE_DOS_HEADER(Address)->e_lfanew)->OptionalHeader.SizeOfImage;
}

BIN
Release/ЭкстраМиррорm09E.mix

Binary file not shown.
Loading…
Cancel
Save