Question:

Anybody that's good at C++ DLL game hacking want to take a look and help me on this?

by Guest10934  |  earlier

0 LIKES UnLike

Hello,

Usually I can find solutions to problems that seem to arise when I'm coding for this game, but I'm stumped on why this is happening..

So I found out how to get the text from the last line of the text box on this game, and I want to separate the player name and what they said and store them in different char arrays.

So I made multiple variances of what I think would work, but they all seem to make the same thing happen; they make the last thing that was said disappear! I'm thinking that I'm misunderstanding something so I'm hoping one of you guys could help me out on this.

Here is the source code:

struct PlayerAnswer{

const char* Player;

const char* Answer;

};

int GetLineCount()

{

DWORD* StageTextClassP = (DWORD*)StageTextClass;

int theLineCount = 0;

__asm{

mov ecx, StageTextClassP;

mov eax, 0x004015F0;

call eax;

mov theLineCount, eax;

}

return theLineCount;

}

char* GetLastText()

{

DWORD* StageTextClassP = (DWORD*)StageTextClass;

char* textLineText;

int lineCount = GetLineCount()-2;

textLineText = (char*)malloc(255);

__asm{

mov ecx, StageTextClassP;

mov eax, 0x0056EC10;

push lineCount;

call eax;

mov textLineText, eax;

}

return textLineText;

}

PlayerAnswer GetLastPlayerAnswer()

{

PlayerAnswer pAnswer;

if(string(GetLastText()).find(':') != string::npos)

{

char* plName = strtok(GetLastText(), ":");;

char* plAnswer = strtok(NULL, "\0");

pAnswer.Player=plName;

pAnswer.Answer=plAnswer;

return pAnswer;

}

pAnswer.Answer="a";

pAnswer.Player="a";

return pAnswer;

}

Oh, and here's pictures on before and after what it looks like:

http://i37.tinypic.com/11lr3hw.jpg

http://i38.tinypic.com/rc91qw.jpg

 Tags:

   Report

1 ANSWERS


  1. Find out which call (GetLastText's call or GetLineCount's call) is causing the problem.  

    Also, this is unrelated (or perhaps even the cause of your woes, but I haven't looked closely enough to say such), but, why are you moving EAX into textLineText (mov textLineText, eax;)?  You've allocated memory using malloc (which you don't even bother trying to free() inside GetLastPlayerAnswer, which would be an issue if not for the following bug), but you simply replace the pointer in textLineText, making it point to the memory allocated by the game, not by your malloc statement.  You'd need to copy byte-by-byte if you wish to maintain a buffer of your own (memcpy).  As I mentioned earlier, even if you did copy the memory into your own buffer (i.e., into textLineText), you neglect to free it.

    Note that any modifications made to the char* returned by your function will be modifications to the buffer the game has stored, not your own copy of the characters.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions