AlexSpl писал(а):
Нужно тогда, чтобы в таком случае отображались оригинальные из родного лода.
- Код: Выделить всё
#define _CRT_SECURE_NO_WARNINGS
#include "stdafx.h"
#include "HotA\homm3.h"
Patcher* _P;
PatcherInstance* _PI;
static _bool_ plugin_On = 0;
bool LoadingFromCustomFolder = false;
void showInfoStr(const char* format, ...)
{
va_list args;
va_start(args, format);
vsprintf(o_TextBuffer, format, args);
b_MsgBox(o_TextBuffer, MBX_OK);
va_end(args);
}
int __stdcall showInfo(LoHook* h, HookContext* c)
{
/* _Hero_* hero = &o_GameMgr->hero[o_ActivePlayer->selected_hero_id];
showInfoStr("%08X", &o_GameMgr->hero[o_ActivePlayer->selected_hero_id].pic);
o_HeroInfo[0].hpl_name = (_ptr_)"1.bmp"; */
return EXEC_DEFAULT;
}
int __stdcall loadPcx(LoHook* h, HookContext* c)
{
if (!strcmp((char*)c->ebx, "HPL000Kn.PCX"))
{
c->eax = (int)"C:\\Program Files (x86)\\Heroes of Might and Magic III Complete HD\\_HD3_Data\\Packs\\NewPicture\\HPL000Kn.pcx";
c->ebx = (int)"C:\\Program Files (x86)\\Heroes of Might and Magic III Complete HD\\_HD3_Data\\Packs\\NewPicture\\HPL000Kn.pcx";
LoadingFromCustomFolder = true;
}
return EXEC_DEFAULT;
}
int __stdcall fixPath(LoHook* h, HookContext* c)
{
if (LoadingFromCustomFolder)
{
c->edi = (int)"";
LoadingFromCustomFolder = false;
}
return EXEC_DEFAULT;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (DLL_PROCESS_ATTACH == ul_reason_for_call)
{
if (!plugin_On)
{
plugin_On = 1;
_P = GetPatcher();
_PI = _P->CreateInstance((char*)"HD.Plugin.NewPicture");
_PI->WriteLoHook(0x408994, showInfo);
_PI->WriteLoHook(0x55AA88, loadPcx);
_PI->WriteLoHook(0x44F602, fixPath);
}
}
return TRUE;
}