Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CE sub project: CE AutoAssembler Engine ---- [May 23, 2013]
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
Alice0725
Expert Cheater
Reputation: 11

Joined: 24 Jul 2012
Posts: 145

PostPosted: Fri Nov 16, 2012 5:56 am    Post subject: CE sub project: CE AutoAssembler Engine ---- [May 23, 2013] This post has 1 review(s) Reply with quote

[May 23, 2013]
1.CETack 1.0.1.21
2.Add a CETack static library. Enjoy your C++. trainer. Razz

Quote:
https://skydrive.live.com/redir?resid=4C1A62A93831B02B!283&authkey=!AId6Yo6qb4J5R8s


Short URL: http://sdrv.ms/Z2ebVM

API doc: http://forum.cheatengine.org/viewtopic.php?p=5476099#5476099

[Apr 18, 2013]
@package name: CETack
@package version: 1.0.1.20

There are 2 versions:
(1)CETackLCL:it is a visual component library used in Lazarus. This post is about it.http://forum.cheatengine.org/viewtopic.php?t=560099
(2)CETackDLL:it is a common DLL library.In this post we just talk about the DLL library.
Thanks Steve Andrew! Without his encouragement, this project would have never been finished.

---------------------------------------------------------
Notes:
1.CETack is an unofficial sub project of Cheat Engine.The 'engine' of CETack is Auto Assembler. The Most part of it just stolen from CE6.2, and simplified. See the detail in source files.

2. *Auto Assembler is one term of Cheat Engine named by Dark Byte, the author of Cheat Engine. CE official site is http://www.cheatengine.org/.


[Load CETack.dll from memory]
1.Load CETack.dll to memory from resource.
2.Using Joachim Bauch's Memory DLL loading code .http://www.joachim-bauch.de
3.Download example:
VS2012.C++.Project(Source Included.) http://sdrv.ms/UTy2pe

Code:

#include "MemoryModule.h"
typedef BOOL(WINAPI *FAutoAssemble)(HANDLE processHandle, CHAR *aascript, BOOL bEnable, DWORD dwFlag);
typedef ULONGLONG(WINAPI *FGetAddress)(HANDLE processHandle, CHAR *addrress);
typedef PCHAR (WINAPI *FGetCETackVersion)();

FAutoAssemble AutoAssemble;
FGetAddress GetAddress;
FGetCETackVersion GetCETackVersion;

void LoadFromMemory(void)
{
   HRSRC hRsrc = FindResource(NULL,MAKEINTRESOURCE(IDR_CETACK_DLL), RT_RCDATA);
   if (hRsrc==NULL)
   {
      AfxMessageBox(TEXT("Can't find CETack from resource."));

   }else{
      HGLOBAL hGlobal=LoadResource(NULL,hRsrc);
      if (hGlobal==NULL){
         AfxMessageBox(TEXT("Can't Load CETack from resource."));

      }else{
         LPVOID data=LockResource(hGlobal);
         HMEMORYMODULE hMemCETack = MemoryLoadLibrary(data);
         if (hMemCETack == NULL){
            AfxMessageBox(TEXT("Can't load library from memory."));

         }else{
            GetAddress = (FGetAddress)MemoryGetProcAddress(hMemCETack,"GetAddress");
            AutoAssemble = (FAutoAssemble)MemoryGetProcAddress(hMemCETack,"AutoAssemble");
             GetCETackVersion=(FGetCETackVersion)MemoryGetProcAddress(hMemCETack,"GetCETackVersion");
         }

      }
   }
}






1.Why its name is CETack?
If Cheat Engine is a beautiful house,then CETack is just a tack.
Most parts of CETack are just stolen from Cheat Engine 6.2.


2.What can CETack do? (Features)
(1)This CETack.dll it's a common dll library, so you can use CE's auto assembler in any language like C++ or delphi.
(2)The mpressed file has a minisize. CETack.x86.dll is less than 122KB, CETack.x64.dll is less than 128KB.
(3)There are some other functions in Tackfunc ,you can export them via this dll.(Download the source and compile it yourself.)

3.DLL Version:There are 5 standard APIs.
(1)GetAddress(processHandle:THandle; addr:Pchar):PtrUInt;

(2)AutoAssemble(processHandle:THandle; aascript:PCHar; enable:boolean; dwFlag:DWord):Boolean;
enable:Boolean; exexcute the script in section [enable] or [disable].
dwFlag:DWord;
(a)dwFlag=0,popup nothing.
(b)dwFlag=1,only popup errors.
(c)dwFlag=2,popup notes and erros.

(3)GetProcessIDByName(imageName:PChar):DWord;

(4)GetProcessIDByWindow(wndClass:PChar; wndName:PChar):DWord;

(5)GetCETackVersion():PChar;


4.Support CEAA Commands:
(1)label
(2)alloc
(3)dealloc
(4)assert
(5)aobscan
(6)aobscanModule
(7)registersymbol
(8)unregistersymbol
(9)db,dw,dd,dq
(10)readmem
(11)include
(12)globalalloc
(13)createthread


5.Thanks Dark Byte and his greatest Cheat Engine.


^_^ This is not an official library of CE. Just a CE Forum member Alice0725's extracurricular work.If you've found a bug, leave it here.


By Alice0725, Apr 14, 2013


----------------------------------------------

Download:
CETackDLL Source and Binary files(CETackTester included).

Shourt link:http://sdrv.ms/UTy2pe
original link:
Quote:
https://skydrive.live.com/redir?resid=4C1A62A93831B02B!270&authkey=!AOYUNw9Rx8aApHk
[/code]


Capture.PNG
 Description:
 Filesize:  33.75 KB
 Viewed:  48129 Time(s)

Capture.PNG



_________________


Last edited by Alice0725 on Thu May 23, 2013 6:11 am; edited 20 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Fri Nov 16, 2012 6:49 am    Post subject: Reply with quote

I won't do that but you're free to do this yourself
SteveAndrew already looked into this, but not sure if he gave up, or if this is actually his final result (5.6.1 is easier to make it a dll as there is no lua support )
Http://forum.cheatengine.org/viewtopic.php?t=558079

Also, please don't upload binaries to this forum, they are blocked for a reason. Even if it's my own stuff (linking is fine though)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Alice0725
Expert Cheater
Reputation: 11

Joined: 24 Jul 2012
Posts: 145

PostPosted: Fri Nov 16, 2012 8:13 am    Post subject: Reply with quote

Dark Byte wrote:
.....
Also, please don't upload binaries to this forum, they are blocked for a reason. Even if it's my own stuff (linking is fine though)
OK, I won't do that again,Even a link. I think it's impossible for me to program a dll , I just learn Lazarus since last week and knew a little about free pascal.. Razz
Back to top
View user's profile Send private message
Alice0725
Expert Cheater
Reputation: 11

Joined: 24 Jul 2012
Posts: 145

PostPosted: Sun Dec 02, 2012 8:24 am    Post subject: Reply with quote

Razz
Back to top
View user's profile Send private message
SteveAndrew
Master Cheater
Reputation: 30

Joined: 02 Sep 2012
Posts: 323

PostPosted: Wed Dec 05, 2012 5:12 pm    Post subject: Reply with quote

I haven't given up on it! I've just had higher priority things to work on.

@Alice0725:
Don't say its impossible to code a dll! Besides it really isn't about coding a dll, as the code is already written thanks to Dark Byte! It's about piecing the required code together, getting it to compile, then actually getting it to work! I've gotten that DLL posted past the initial two steps... Now all that's left is getting it to actually work, but it does compile now, and it does get injected (after switching to 32-bit lazarus+fpc) and you can call the exports.

From that DLL posted which Dark Byte linked to, a couple things have to be changed:

1. Add package LCL to the project using the project inspector (create new requirement, select LCL, add it)

2. Add stdcall directive to 'AutoAssembleIt' export (this was causing issues and I realized this is why I wasn't getting the passed in AA script c style char array string properly) Also it was defined as a pascal 'String' which was wrong, changing it to 'PChar' we can avoid having to convert the AA script string into a pascal 'String' before passing it to export 'AutoAssembleIt' when calling it.

It looked like this before:
Code:

function AutoAssembleIt (Script: String; EnableOrDisable: Boolean): Boolean;


So now I changed it to:
Code:

function AutoAssembleIt (Script: PChar; EnableOrDisable: Boolean): Boolean; stdcall;


3. There was also one more error with 'CheatEngineDir' undefined in symbolhandler, and I'm not sure if the 'dbghelp.dll' is required but I placed it in the same directory as the project for now and changed the line to:
Code:

dbghlp:=LoadLibrary('C:\lazarus\Projects\standaloneassembler\dbghelp.dll');


And commented out these lines around it:
Code:

//{$ifdef cpu32}
//that line above is here
//{$else}
//  dbghlp:=loadlibrary('Dbghelp.dll');
//{$endif}       


Since my goal is just to get it working auto assembling 32bit code for now.

With that done, It makes it into the 'autoassemble' function then into 'autoassemble2' function and it crashes sometime after the initial part of the first pass... (I added several output debug strings in those functions to help figure out where its going wrong)

It makes it to about here:
Code:

//first pass
    OutputDebugStringA('Starting first pass...');
    i:=0;
    while i<code.Count do
    begin
      try
        try
          currentline:=code[i];
          currentlinenr:=ptrUint(code.Objects[i]);

          currentline:=trim(currentline);

          for j:=0 to length(defines)-1 do
            currentline:=replacetoken(currentline,defines[j].name,defines[j].whatever);

          if length(currentline)=0 then continue;
          if copy(currentline,1,2)='//' then continue; //skip

          setlength(assemblerlines,length(assemblerlines)+1);
          assemblerlines[length(assemblerlines)-1]:=currentline;

          //if the newline is empty then it has been handled and the plugin doesn't want it to be added for phase2
          if length(currentline)=0 then
          begin
            setlength(assemblerlines,length(assemblerlines)-1);
            continue;
          end;
          //otherwhise it hasn't been handled, or it has been handled and the string is a compatible string that passes the phase1 tests (so variablenames converted to 00000000 and whatever else is needed)
          //plugins^^^

          OutputDebugStringA('Past initial part of first pass...');                         


Then goes wrong somewhere after that. I'm going to debug it later tonight and try to see exactly where its going wrong.

I think it might have something to do with the target, as I had to add: 'targetself:=true;'
right above this code:
Code:

targetself:=true; //right here

if targetself then
  begin
    //get this function to use the symbolhandler that's pointing to CE itself and the self processid/handle
    oldhandle:=getcurrentprocess;
    processhandle:=getcurrentprocess;
    processid:=getcurrentprocessid;
    symhandler:=symbolhandler.selfsymhandler;

    OutputDebugStringA('Targeting self...');

    //processhandler.processhandle:=processhandle;
  end
  else
  begin
    processhandle:=getcurrentprocess;
    processid:=getcurrentprocessid;
    symhandler:=symbolhandler.symhandler;

    OutputDebugStringA('Targeting other process...');
  end; 


Because the OutputDebugStringA said it was targeting other process, when currently it's supposed to target the application its injected to and assemble for that process.


Alice or anyone else interested in a stand alone Auto Assembler module you can download the latest source here(no binaries included you'll have to compile them yourself from the source, full ce source not required):

Based on CE 6.2:

Requirements:

1. Lazarus+fpc 32bit
2. Microsoft VC++ Express 2012, or another compiler (for the tester dll which loads the auto assembler dll and attempts to use it)
3. 32bit dbghelp.dll from CE's win32 sub directory

http://www.sendspace.com/file/1u8egp
or:
http://www33.zippyshare.com/v/81513800/file.html

Comon lets get this working guys! I know the amount of time I spent error after error getting it to finally compile wasn't for nothing! Its so close to working now! Very Happy



AutoAssembleItFunctionAsItIsNow.png
 Description:
Ignore the commented out formatting and adding $0c to the passed in pointer (that was some tricks I did to get the proper char array pointer before I realized I should just make it stdcall)
 Filesize:  39.25 KB
 Viewed:  49621 Time(s)

AutoAssembleItFunctionAsItIsNow.png



ThisIsAsFarAsItGets.png
 Description:
 Filesize:  57.37 KB
 Viewed:  49621 Time(s)

ThisIsAsFarAsItGets.png



_________________
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Wed Dec 05, 2012 7:09 pm    Post subject: Reply with quote

not sure about:
Code:

scriptstrings.add(script);

I recommend
Code:

scriptstrings.text:=script;

so the linebreaks get parsed properly (I should also mention something about a memoryleak there, but that's the least of your problems)

Also, put a "try/except" around the autoassemble() function, since if your dll passes on the exception to the caller, there's a big chance it won't know what to do with the exception

example: http://code.google.com/p/cheat-engine/source/browse/trunk/Cheat%20Engine/pluginexports.pas#707

And reading through the code:
your change to the symbolhandler's getAddressFromName, targets the current process instead of the opened process. While this is valid in a dll, this will target your trainer, not the target process. (pointer notations use it )

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Alice0725
Expert Cheater
Reputation: 11

Joined: 24 Jul 2012
Posts: 145

PostPosted: Wed Dec 05, 2012 8:20 pm    Post subject: Reply with quote

I suggest that change the processHandle to a parameter, so it won't get wrong process. And I will use a TMemo(without wordwrap) to add scripts.I've done that in cetack.
I've upload my code. Download it here.
Quote:
http://sdrv.ms/WKysKq
Back to top
View user's profile Send private message
Alice0725
Expert Cheater
Reputation: 11

Joined: 24 Jul 2012
Posts: 145

PostPosted: Sat Apr 13, 2013 11:43 pm    Post subject: Reply with quote

SteveAndrew wrote:
...
@Alice0725:
Don't say its impossible to code a dll! ...


Thanks for your encouragemnet,SteveAndrew.Now the 1.0.1(LCL+DLL) released.

_________________
Back to top
View user's profile Send private message
SteveAndrew
Master Cheater
Reputation: 30

Joined: 02 Sep 2012
Posts: 323

PostPosted: Sun Apr 14, 2013 7:31 pm    Post subject: Reply with quote

No problem Alice! Very Happy I had actually made it into a DLL myself (with the older version) I see you cleverly made it into a pascal package though now Very Happy nice (mine didnt, I basically just threw your CETack code into a DLL project and compiled it! LOL)

But you didn't have 'aascript' parameter as a PChar (char*) before which frustrated the hell out of me... I resorted to having to try and make pascals strings in order to work the dll from C++ (my language of choice)

Something like this:
Code:

PascalString::PascalString(char *cstring)//the pascal 'string' type (in C++ code)
{
   ULONG CStringLength = strlen(cstring);
   char *PString = new char[CStringLength+9];

   Str = 0;
   StrOriginal = 0;

   if(PString)
   {
      *(ULONG*)PString = 0xFFFFFFFF; //Start of pascal string
      *(ULONG*)&PString[4] = CStringLength; //Size
      memcpy(&PString[8], cstring, CStringLength+1); //Actual String (null terminated as well)
      
      Str = &PString[8];
      StrOriginal = PString;
   }
}

PascalString::~PascalString()
{
   if(Str && StrOriginal)
      delete[] StrOriginal;
}



Oh it was torture, (I don't even think that was right, because it still wasn't working properly so I gave up on it for a while)


NOW since you've made it more compatible with other languages, and improved upon it, I'm going to code a nice little trainer for everyone and basically a C++ AA DXHOOK trainer framework kit for everyone Very Happy [Have I revealed too much? lol] It will be able to actually load CT files (thanks to CE's table format now being easily readable as it's XML)

Stay tuned for it! (Shouldn't take me long now!)

[Alice0725]
Updates:
[Apr 13,2013]CETack 1.0.1.20(release)
1.Fixed: some stupid errors for FindAoB's address range in 64bit process.
2.Fixed: cannot Parse 64bit pointer.
3.cleaned:delete or converte some global var.,Get a more pure TackFunc.
4.Added:some small functions in tackfunc.pas.
5.Added:some more comments in soure file.
6.Tested:readmem,include,createthread,globalalloc aa commands.
7.Other small changes.
7.Updated: CETack.dll,CETackTester.exe. A real minisize CEAutoassembler.dll released.

Is changing 'aascript' to a PChar/(char*)/standard C style null terminated string considered a 'small' change?

TO ME IT's A BIG ONE! Now I don't have to mess around trying to convert my c style strings into arbitrary pascal string format (which I still don't quite understand them)

[EDIT: HEHE HERE's A LITTLE PREVIEW]
Code:

#pragma once
#include "CheatTable.h"

typedef PCHAR (WINAPI *GETCETACKVERSION)();
typedef ULONG (WINAPI *GETADDRESS)(HANDLE processhandle, void *symbolname);
typedef bool (WINAPI *AUTOASSEMBLE)(HANDLE processhandle, char *script, bool enabledisable, bool popupmessages);
typedef ULONG (WINAPI *GETPROCESSIDNAME)(char *processname);
typedef ULONG (WINAPI *GETPROCESSIDWINDOW)(char *classname, char *windowname);

class AutoAssembler
{
   public:
   CheatTable *CT;
   HANDLE ProcessHandle;
   HMODULE CETackDLL;
   bool ShowPopupMessages;

   AutoAssembler(char *CETackDLLPath);
   ~AutoAssembler();
   ULONG GetAddr(char *SymbolName);
   bool Assemble(char *Script, bool EnableOrDisable, bool PopupMessages);
   bool AttachTo(char *ProcessName, char *WindowClassName, char *WindowName);
   bool EnableDisableCheat(ULONG ByCheatID, char *OrCheatDescription, bool EnableOrDisable);
   bool EnableDisableEncodedCheat(ULONG ByCheatID, char *OrCheatDescription, bool EnableOrDisable);
   int ToggleCheat(ULONG CheatID);
   int ToggleCheat(char *CheatDescription);

   private:
   GETCETACKVERSION GetCETackVersion;
   GETADDRESS GetAddress;
   AUTOASSEMBLE AutoAssemble;
   GETPROCESSIDNAME GetProcessIdName;
   GETPROCESSIDWINDOW GetProcessIdWindow;
};



THANKS ALICE! Will rep you when I can, though I think I've done it too recently! So you'll just have to wait for it Very Happy

_________________


Last edited by SteveAndrew on Mon Apr 15, 2013 12:16 am; edited 2 times in total
Back to top
View user's profile Send private message
unknown_k
Expert Cheater
Reputation: 5

Joined: 24 May 2011
Posts: 211

PostPosted: Sun Apr 14, 2013 8:19 pm    Post subject: Re: CE sub project: CE AutoAssembler Engine Reply with quote

Code:
HINSTANCE hCETack = LoadLibrary("CETack.dll");
typedef char* (*f_GetCETackVersion)();
f_GetCETackVersion GetCETackVersion;
GetCETackVersion = (f_GetCETackVersion)GetProcAddress(hCETack, "GetCETackVersion");

printf("%s\n", GetCETackVersion());

FreeLibrary(hCETack);

Yay it print version number! lol Laughing lol
Good work! +1
Back to top
View user's profile Send private message
SteveAndrew
Master Cheater
Reputation: 30

Joined: 02 Sep 2012
Posts: 323

PostPosted: Sun Apr 14, 2013 8:29 pm    Post subject: Re: CE sub project: CE AutoAssembler Engine Reply with quote

unknown_k wrote:
Code:
HINSTANCE hCETack = LoadLibrary("CETack.dll");
typedef char* (*f_GetCETackVersion)();
f_GetCETackVersion GetCETackVersion;
GetCETackVersion = (f_GetCETackVersion)GetProcAddress(hCETack, "GetCETackVersion");

printf("%s\n", GetCETackVersion());

FreeLibrary(hCETack);

Yay it print version number! lol Laughing lol
Good work! +1



Haha yes isn't it awesome!

A Little more preview for you guys! Very Happy wow now I'm just whipping this up thanks to Alice! Very Happy

Code:

int CheatTable::LoadCT(char *CTFilePath)
{
   if(CTFilePath)
      Doc->LoadFile(CTFilePath);

   tinyxml2::XMLElement* CT = Doc->FirstChildElement();
   if(CT && CT->FirstAttribute() && strcmp(CT->FirstAttribute()->Name(), "CheatEngineTableVersion") == 0)
   {
      if(CT->FirstAttribute()->IntValue() >= 14)
         dbg->Print(0, "CT Version 14 or newer! :D");

      tinyxml2::XMLElement *CheatEntries = CT->FirstChildElement("CheatEntries");
      if(CheatEntries)
      {
         Cheats->DeleteObjectsAndClearList();

         tinyxml2::XMLElement *Entry = CheatEntries->FirstChildElement("CheatEntry");
         while(Entry)
         {
            tinyxml2::XMLElement *ID = Entry->FirstChildElement("ID");
            tinyxml2::XMLElement *Description = Entry->FirstChildElement("Description");
            tinyxml2::XMLElement *AssemblerScript = Entry->FirstChildElement("AssemblerScript");

            if(AssemblerScript)
            {
               Cheat *NewCheat = new Cheat();
               NewCheat->ID = atoi(ID->GetText());
               NewCheat->Description = DupeString(Description->GetText());
               NewCheat->AssemblerScript = DupeString(AssemblerScript->GetText());

               Cheats->Add(NewCheat);
            }

            Entry = Entry->NextSiblingElement("CheatEntry");
         }
      }

      dbg->Print("Loaded CT!\r\n");
      return 1;
   }
   else
   {
      dbg->Print("Invalid CT! Not loaded...");
      return 0;
   }
}


*hint* *hint* TINYXML2 ROCKS Very Happy

_________________
Back to top
View user's profile Send private message
Alice0725
Expert Cheater
Reputation: 11

Joined: 24 Jul 2012
Posts: 145

PostPosted: Mon Apr 15, 2013 6:14 pm    Post subject: Reply with quote

Thanks @unknown_k and @SteveAndrew for +1.

And this is very nice.
SteveAndrew wrote:
...I'm going to code a nice little trainer for everyone and basically a C++ AA DXHOOK trainer framework kit for everyone...


But, this project is not really finished yet! Smile The last step of this dll library is loading it from memory. I'm testing it. So everybody can use it make a single file trainer withou drop cetack.dll to local disk.

_________________
Back to top
View user's profile Send private message
SteveAndrew
Master Cheater
Reputation: 30

Joined: 02 Sep 2012
Posts: 323

PostPosted: Tue Apr 16, 2013 6:29 am    Post subject: Reply with quote

Alice0725 wrote:
Thanks @unknown_k and @SteveAndrew for +1.

And this is very nice.
SteveAndrew wrote:
...I'm going to code a nice little trainer for everyone and basically a C++ AA DXHOOK trainer framework kit for everyone...


But, this project is not really finished yet! Smile The last step of this dll library is loading it from memory. I'm testing it. So everybody can use it make a single file trainer withou drop cetack.dll to local disk.


Cool to hear that! As right now I'm doing just that dumping the cetack-x86.dll before loading it Wink

Code:

FILE *DumpCETackDLL = fopen("CETack-x86.dll", "wb");
   if(DumpCETackDLL)
   {
      fwrite(&EmbeddedCETackDLL, sizeof(EmbeddedCETackDLL), 1, DumpCETackDLL);
      fclose(DumpCETackDLL);
   }

   Assembler = new AutoAssembler("CETack-x86.dll");



Trainer framework kit is well on it's way! LOL it's become more like a two day project now rather than I thought I could pull it off in a day Very Happy


Check this out: I just successfully got it to load my RE6 Cheat Table (using my Cheat Table class) and create directx text with each cheat name spaced out and drawn over the main DX GUI (was just a quick whip up so it will look much better when finished! But shows that it's working now!! Now I'll just add some check boxes to the 'DXHack' class of the 'DXTrainerMenu' class along with the text so you can toggle cheats on and off... (Thanks to your CETack DLL which is what my 'AutoAssembler' class uses)

And last but certainly not least we have Dark Byte to thank for making this all possible! Very Happy

Just imagine it, a dynamic Direct X trainer that will load a CT and just work! (No more having to make a custom direct x trainer anymore... Just slap on a new trainer GUI image, and load up the CT, and maybe do some tweaking to text colors and sizes and what not! But THIS IS AWESOME! Very Happy




Sneak peak at my code I'm almost finished with: (hehe Very Happy)

Code:

void DXTrainerMenu::Draw(LPD3DXSPRITE pSprite)
{
   //Draw main trainer DX GUI :D
   pSprite->Draw(TrainerTexture, 0, 0, &TrainerPosition, 0xffffffff);

   //Draw hacks loaded from CT on main trainer DX9 GUI
   DXHack *FirstHack = (DXHack*)TrainerHacks->GetFirstNode();
   if(FirstHack)
   {
      FirstHack->Draw(pSprite);

      DXHack *NextHack = (DXHack*)TrainerHacks->GetNextNode();
      while(NextHack)
      {
         NextHack->Draw(pSprite);

         NextHack = (DXHack*)TrainerHacks->GetNextNode();
      }
   }
}

void DXTrainerMenu::AddCheatsToMenu(CheatTable *CT)
{
   CheatsBasePosition = TrainerPosition;
   CheatsBasePosition.y += CheatSpacingFactor;

   DXHack *DXCheat;
   Cheat *FirstCheat = (Cheat*)CT->Cheats->GetFirstNode();
   if(FirstCheat)
   {
       DXCheat = new DXHack(DXDevice, FirstCheat->Description, (long)CheatsBasePosition.x, (CheatsBasePosition.y + (NumberOfCheats++ * CheatSpacingFactor)));
       TrainerHacks->Add(DXCheat);

       CT->dbg->Print(0, "Number OF Cheats: %u; First Cheat Name: %s", NumberOfCheats, FirstCheat->Description);

      Cheat *NextCheat = (Cheat*)CT->Cheats->GetNextNode();
      while(NextCheat)
      {
         DXCheat = new DXHack(DXDevice, NextCheat->Description, (long)CheatsBasePosition.x, (CheatsBasePosition.y + (NumberOfCheats++ * CheatSpacingFactor)));
         TrainerHacks->Add(DXCheat);

         CT->dbg->Print(0, "Number OF Cheats: %u; Next Cheat Name: %s", NumberOfCheats, NextCheat->Description);

         NextCheat = (Cheat*)CT->Cheats->GetNextNode();
      }
   }
}



EDIT: Starting to take shape even more now Very Happy (though now I'm having an issue with some check boxes not wanting to appear... I'll have to get to the bottom of that xD

But it is starting to look a bit nicer now Very Happy

_________________


Last edited by SteveAndrew on Tue Apr 16, 2013 8:28 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Tue Apr 16, 2013 8:26 am    Post subject: Reply with quote

Quote:

Just imagine it, a dynamic Direct X trainer that will load a CT and just work!


http://forum.cheatengine.org/viewtopic.php?t=552281 (basic)
http://forum.cheatengine.org/viewtopic.php?t=553143 (complex, trainer)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
SteveAndrew
Master Cheater
Reputation: 30

Joined: 02 Sep 2012
Posts: 323

PostPosted: Tue Apr 16, 2013 8:34 am    Post subject: Reply with quote

Dark Byte wrote:
Quote:

Just imagine it, a dynamic Direct X trainer that will load a CT and just work!

http://forum.cheatengine.org/viewtopic.php?t=552281


Oh so it does already exist!! Ah well, but I'm not good with lua somehow I can't grasp it!

So I suppose this will be an alternative to that, a C++ version Very Happy

Does it also support all of the (latest / worth messing with) DirectX's ? DX9/DX10/DX11...

At the moment what I'm working on is for direct x 9 only but plan to make it work for dx 10 and 11 also... and maybe even OpenGL Smile but I hear openGL hooking is alot trickier than DX... Well in time I will be able to hook everything! LOL

Thanks for pointing that out though, I think I stumbled over it before without realizing what it was... Smile

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites