typedef int (__cdecl * RunConsoleCommand_T)(char* szCommand);
RunConsoleCommand_T RunConsoleCommand = (RunConsoleCommand_T) 0x485F60;
RunConsoleCommand("ShowFps 1");


void CallConsoleWithBypass(char* Command){
_asm{
mov eax, fs:[0x24]
mov SaveCurrentThreadID, eax // save our threadID
mov eax, fs:[0x04]
mov eax, [eax-0x0C]
mov SaveCurrentThreadEntryPoint, eax // save our entrypoint
mov eax, EngineThreadID // replace our threadID with that of engines.exe
mov fs:[0x24], eax
mov eax, EngineEntryPoint
mov ebx, fs:[0x04]
mov [ebx-0x0C], eax // replace our entrypoint with that of engine.exe
}
RunConsoleCommand(Command);
_asm{
mov eax, SaveCurrentThreadID // put everything back in place
mov fs:[0x24], eax
mov eax, SaveCurrentThreadEntryPoint
mov ebx, fs:[0x04]
mov [ebx-0x0C], eax
}
return;
}


PushToConsole PROC argCommand:DWORD LOCAL ThreadPreserve:DWORD ;============ PRESERVE ACCEPTED THREAD ID ============== mov edx,REAL_THREAD_ID mov eax,dword ptr [edx] mov ThreadPreserve,eax ;=========== MAKE CURRENT THREAD ACCEPTED =========== mov eax,dword ptr fs:[24h] mov dword ptr [edx],eax ;============== CHANGE CONSOLE CMD ================ mov eax,CONSOLE_ADDRESS push argCommand call eax add esp,4 ;============ RESTORE ACCEPTED THREAD ID ============ mov edx,REAL_THREAD_ID mov eax,ThreadPreserve mov dword ptr [edx],eax ret PushToConsole ENDP