Author Topic: Drawing internally fullscreen in mount and blade [source code]  (Read 1300 times)

0 Members and 1 Guest are viewing this topic.

Mercenary_Frank

  • Online Villain
  • ***
  • Posts: 177
    • View Profile
Drawing internally fullscreen in mount and blade [source code]
« on: January 07, 2016, 04:48:10 am »
Tally-ho chaps,

I have been very busy with my exams and all so I havn't been able to finish the W2S function that mrmedic told me about. I managed to scramble together some code so that I could draw in fullscreen since my last one was just an overlay. Some functions are C+P from the internet and mrmedic helped me out allocating a console (Thanks buddy!  :icon_thumbsup)
Code: [Select]
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")

bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
{
for (; *szMask; ++szMask, ++pData, ++bMask)
if (*szMask == 'x' && *pData != *bMask)
return false;
return (*szMask) == NULL;
}

DWORD FindPattern(DWORD dValor, DWORD dLer, BYTE *bMaskara, char * szMaskara)
{
for (DWORD i = 0; i < dLer; i++)
if (bCompare((PBYTE)(dValor + i), bMaskara, szMaskara))
return (DWORD)(dValor + i);
return false;
}

DWORD value;
DWORD* pdwVTable;
DWORD endSceneAddy;
DWORD endSceneretrn;
bool hooked = false;

__declspec (naked) void Endscene_Detour(LPDIRECT3DDEVICE9 pDevice)
{
__asm
{
xor esi, esi
test edi, edi
lea ebx, [edi + 4]
PUSHAD
}

D3DRECT rec;
rec.x1 = 10;
rec.y1 = 10;
rec.x2 = 50;
rec.y2 = 50;

pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(232, 100, 145, 30), 0, 0);

__asm
{
POPAD
jmp endSceneretrn
}

}
void JmpPatch(void *pDest, void *pSrc, int nNops = 0) {

DWORD OldProt;

VirtualProtect(pSrc, 5 + nNops, PAGE_EXECUTE_READWRITE, &OldProt);

*(char*)pSrc = (char)0xE9;
*(DWORD*)((DWORD)pSrc + 1) = (DWORD)pDest - (DWORD)pSrc - 5;

for (int i = 0; i < nNops; ++i) { *(BYTE*)((DWORD)pSrc + 5 + i) = 0x90; }

VirtualProtect(pSrc, 5 + nNops, OldProt, &OldProt);
}

DWORD WINAPI HookD3D(LPVOID lpParameter)
{
DWORD dwDXDevice = FindPattern((DWORD)GetModuleHandle("d3d9.dll"), 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
DWORD* pdwVTable;
memcpy(&pdwVTable, (VOID *)(dwDXDevice + 2), 4);

endSceneAddy = pdwVTable[42] + 0xf;
endSceneretrn = endSceneAddy + 0x6;

JmpPatch((PVOID)Endscene_Detour, (PVOID)endSceneAddy);
return 0;
}

BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
AllocConsole();

freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);

printf("> Started.\n");

DisableThreadLibraryCalls(GetModuleHandle(NULL));

CreateThread(NULL, 0, HookD3D, NULL, 0, 0);
printf("> Threads Active.\n");
}
else if (dwReason == DLL_PROCESS_DETACH)
{
Sleep(500);
}

return TRUE;
}

Anyway when I figure out the W2S function medic provided me I will be able to finally create that ESP  :icon_cool2

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Drawing internally fullscreen in mount and blade [source code]
« Reply #1 on: January 07, 2016, 09:20:41 pm »
remember to snapshot the view from dip or take it from the engine or your esp will be all over the place.
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157

Mercenary_Frank

  • Online Villain
  • ***
  • Posts: 177
    • View Profile
Re: Drawing internally fullscreen in mount and blade [source code]
« Reply #2 on: January 12, 2016, 12:26:13 pm »
Could you eleborate on taking a snapshot from dip I think I have that issue right now :p

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Drawing internally fullscreen in mount and blade [source code]
« Reply #3 on: January 12, 2016, 08:10:41 pm »
your eye position/camera point needs to be converted from world space/point to screen space/point. or the esp will not know from which perspective to draw it from.

it is in the function i gave you , how ever you can brute force it using D3DXMatrixIdentity if you so wish.
« Last Edit: January 12, 2016, 08:28:02 pm by MrMedic »
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157

Mercenary_Frank

  • Online Villain
  • ***
  • Posts: 177
    • View Profile
Re: Drawing internally fullscreen in mount and blade [source code]
« Reply #4 on: January 13, 2016, 02:23:01 am »
Doesn't matter what I try to do in DIP it just crashes it is not the hook because it runs fine without the code I am trying to do stride from your best buddy worm his tut

declspec(naked) void  DIP(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, int BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimCount)
{
   __asm
   {
      mov[ebp - 14], eax
      push ebx
      push esi
      PUSHAD
   }
   LPDIRECT3DVERTEXBUFFER9 Stream_Data;
   

   pDevice->GetStreamSource(0, &Stream_Data, 0, &Stride);
   std::cout << Stride;
      /*Stream_Data->Release();*/
      

   /*if (1)
      if (Player)
      {
         pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
      }*/

   __asm
   {
      POPAD
      jmp DIPretrn
   }
}

Mercenary_Frank

  • Online Villain
  • ***
  • Posts: 177
    • View Profile
Re: Drawing internally fullscreen in mount and blade [source code]
« Reply #5 on: January 13, 2016, 02:41:57 am »
That is why I wrote that I got it from Worm is Tut. This isn't even a C+P I am trying to acquire Stride with own made hook function

http://images.akamai.steamusercontent.com/ugc/544174463336818383/3C924114D88617216C6A0F5CAA4503FE2B5DFC55/

I am getting the same shizzle as worm now I can see everybody but also the stones and trees xd
« Last Edit: January 13, 2016, 03:33:47 am by Mercenary_Frank »

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Drawing internally fullscreen in mount and blade [source code]
« Reply #6 on: January 13, 2016, 07:09:19 pm »
That is why I wrote that I got it from Worm is Tut. This isn't even a C+P I am trying to acquire Stride with own made hook function



I am getting the same shizzle as worm now I can see everybody but also the stones and trees xd

looks buggy ^... this is what a wallhack looks like.


its probably the epilog ,debug it and make sure it's doing what it should.
« Last Edit: January 13, 2016, 07:44:06 pm by MrMedic »
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157