1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Help] C++ code cave

Discussion in 'Programming' started by Wallz, Aug 1, 2010.

  1. Wallz

    Wallz Member

    EDIT: SOLVED

    Hey I am trying to get the Cam vac teleport to work in a C++ trainer however I can't get it to work.
    Here is what I am testing with (just go to certain coordinates for now):

    Code (Text):
    1. void __declspec(naked) __stdcall Teleport ()  
    2. {
    3.     _asm
    4.     {
    5.         pushad
    6.         mov eax,0x5
    7.         mov ecx,0x10
    8.         mov ebx,[0x00ADA538]
    9.         mov [ebx+0x2A68], eax
    10.         mov [ebx+0x2A6C], ecx
    11.         mov [ebx+0x2a60], 0x01
    12.         popad
    13.         jmp [TeleRet]
    14.  
    15.     }
    16. }
    17. void _stdcall Tele_On()
    18. {
    19.     *(BYTE*)TeleAddy = 0xE9;
    20.         *(BYTE*)TeleAddyB = 0x01;
    21.     *(DWORD*)(TeleAddy+1) = JMP(TeleAddy,Teleport);
    22.     *(DWORD*)(TeleAddy+5) = 0x90;
    23. }
    any help is appreciated
     
  2. Serenoxis

    Serenoxis Active Member

    I can't see anything wrong with the code cave. Does it just crash maple or does it just not work?

    Only other thing I can think of is the same problem I'm having in that the asm opcodes in the script aren't the ones being written into maple's memory. I've got he same problem with a couple of scripts (lemmings/kami) that in theory should work but when I've debugged maple and followed the code through it's completely different from what it should be.
     
  3. Wallz

    Wallz Member

    It doesn't crash maple just does nothing :/ Usually I can convert them without issue I just can't seem to get this one.
     
  4. Siobhan

    Siobhan New Member

    Code (Text):
    1.  
    2. void __declspec(naked) __stdcall Teleport ()  
    3. {
    4.     _asm
    5.     {
    6.         pushad
    7.         mov eax,0x5
    8.         mov ecx,0x10
    9.         mov ebx,[0x00ADA538]
    10.         mov [ebx+0x2A68], eax
    11.         mov [ebx+0x2A6C], ecx
    12.         mov [ebx+0x2a60], 0x01
    13.         popad
    14.         mov eax,[eax+0x09b4]
    15.         jmp [TeleRet]
    16.  
    17.     }
    18. }
    19. void _stdcall Tele_On()
    20. {
    21.     *(BYTE*)0x008AFEA3 = 0xFF;
    22.     *(BYTE*)TeleAddy = 0xE9;
    23.     *(DWORD*)(TeleAddy+1) = JMP(TeleAddy,Teleport);
    24.     *(BYTE*)(TeleAddy+6) = 0x90;
    25. }
    26.  
    On the fly code, might not work!
     
  5. Wallz

    Wallz Member

    Still nothing :/
     
  6. Ant3

    Ant3 Well-Known Member

    Umm.. where is the 'where to teleport' shit? (Mouse pointers and shit?)

    Also, you do not need to use any address for this. Just use pointers. That reminds me... I'll edit this post soon.

    EDIT:
    Code (Text):
    1.  
    2. // Copypaste from Kitterz Trainer's Sourcecode Mouse Fly function. This shit was using the Death XY pointers, and it also had an activation pointer, so just replace the Death XY aka SS XY with Kami XY and Teleport Activation with Kami's teleport activation.
    3. void Fly (HWND hWnd)
    4. {
    5.     int RealMouse;
    6.     int MouseX, MouseY;
    7.     SetDlgItemText(hWnd, IDC_FLY, "On" );
    8.  
    9.     while (!FlyExit)
    10.     {
    11.         //Get Mouse Pos
    12.         RealMouse = *((DWORD*)MouseBase) + MouseOffsetBase;
    13.         MouseX = ReadPointer((ULONG_PTR*)RealMouse, MouseXBase);
    14.         MouseY = ReadPointer((ULONG_PTR*)RealMouse, MouseXBase + 4);
    15.  
    16.         //Set Tele as mouse
    17.         *(DWORD*)(*(DWORD*)SSTeleBase + SSTeleXBase) = MouseX;
    18.         *(DWORD*)(*(DWORD*)SSTeleBase + SSTeleXBase + 4) = MouseY;
    19.         *(DWORD*)(*(DWORD*)SSTeleBase + SSActivateBase) = 19;
    20.  
    21.         Sleep (100);
    22.     }
    23.  
    24.     SetDlgItemText(hWnd, IDC_FLY, "Off" );
    25. }
    26.  
    27.  
     
  7. Siobhan

    Siobhan New Member

    Eh, wait. You don't need to detour teleport.

    Code (Text):
    1. void TELEPORT(int x, int y) {
    2.     tmpPtr = *(ULONG32*)0x00ADA538;
    3.     *(ULONG32*)(tmpPtr+0x2A68) = x;
    4.     *(ULONG32*)(tmpPtr+0x2a6C) = y;
    5.     *(ULONG32*)(tmpPtr+0x2a60) = 1;
    6. }
     
  8. Wallz

    Wallz Member

    atm I am not worrying about that, I just what to get this working atm (teleport to 5, 16) then I will add that later
     
  9. Ant3

    Ant3 Well-Known Member

    Bump (read my previous post).
     
  10. Wallz

    Wallz Member

    Thanks both of you, didn't think to write straight to the pointer. This thread may be closed.
     
  11. David...

    David... Banned Banned

    Code (Text):
    1.  
    2. void Teleport(int X, int Y)
    3. {
    4.    if (LeftWall(X) && RightWall(X) && TopWall(Y) && BottomWall(Y))
    5.    {
    6.       WritePointer(CharAddy, TeleOffset + 8, X);
    7.       WritePointer(CharAddy, TeleOffset + 12, Y);
    8.       WritePointer(CharAddy, TeleOffset, 1);
    9.    }
    10. }
    11.  
    well, I know you already got it solved, but whatever, here's the function I use.
     
  12. Subarashii

    Subarashii Well-Known Member

    So Ant3 gave the right answer? Just replace the Kami XY and Teleport Activation and then that script works?
     
  13. David...

    David... Banned Banned

    Well, yeah, but if I were you I'd still activate the teleport addy.. like..

    Code (Text):
    1.  
    2. *(char*)(TeleORAddy + 6) = 0x01; (Try going to the public teleport addy, then subtract 6, or add 6)
    3.  
     

Share This Page