[hidden]Данный код отключает показ интро при старте игры
Code:
void __declspec(naked) guiGetCurTime()
{
static DWORD callCounter = 0;
_asm
{
push edx
call [getCurTimeOrig]
mov edx,[callCounter]
inc edx
mov [callCounter],edx
imul edx,edx,7000
add eax,edx
pop edx
retn
}
}
void __declspec(naked) guiCreateTextureSplice()
{
//_asm int 3;
char * pStr;
static const char skipStr [] = "Game_Grade.dds";
static const char introSkippedStr [] = "ui/game";
DWORD stage;
_asm
{
mov eax,[esp+4]
pushad
push ebp
mov ebp, esp
sub esp, __LOCAL_SIZE
mov [pStr],eax
}
stage = 0;
if(strstr(pStr,skipStr))
stage = 1;
else if(strstr(pStr,introSkippedStr))
stage = 2;
switch(stage)
{
case 0: //передаю управление
_callOrigFn:
_asm
{
mov esp,ebp
pop ebp
popad
jmp [guiCreateTextureOrig]
}
case 1://устанавливаю хук на Utils.?GetCurTime@@YAKXZ
getCurTimeOrig = getCurTime.Hook((PTR)GetProcAddress(GetModuleHandleA("Utils.dll"),"?GetCurTime@@YAKXZ"),(PTR)guiGetCurTime);
goto _callOrigFn;
case 2://убираю хук
getCurTime.UnHook();
guiCreateTexture.UnHook();
_asm
{
mov esp,ebp
pop ebp
popad
xor eax,eax
mov [esp+4],eax
jmp [guiCreateTextureFnAddr]
}
}
}
void skipIntro()
{
HMODULE hGuiDll = LoadLibraryA("GUI.dll");
guiCreateTextureFnAddr = (DWORD)GetProcAddress(hGuiDll,"?CreateTexture@gui_Texture@@SAPAV1@PBD@Z");
guiCreateTextureOrig = guiCreateTexture.Hook((PTR)guiCreateTextureFnAddr,(PTR)guiCreateTextureSplice);
dbgBreak(!guiCreateTextureOrig);
}
[/hidden]