| View previous topic :: View next topic |
| Author |
Message |
dharmang1910 Expert Cheater
Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Tue Nov 01, 2022 2:38 am Post subject: ccode crashing but luacode works |
|
|
I have made two script to fetch address of hunger rate, first in luacode but it works but game lag a lot and become unplayable. So I have decided to make it in ccode but it crashes instantly on activation. Below are my findings.
My luacode script:
| Code: |
{$luacode xBase=ebp}
if readPointer(xBase+0x10) > 0 then
if readString(readPointer(xBase+0x10)+0x10) == 'hungerrate' then
registerSymbol('hungerr',xBase)
end
end
{$asm}
|
My ccode script:
| Code: |
{$ccode xBase=ebp}
extern long hngrrt;
if (*(unsigned long *)(xBase+0x10) > 0)
{
char str =(char)(*(unsigned long *)(xBase+0x10)+0x10);
if (strcmp(str,"hungerrate"))
{
hngrrt=xBase;
}
}
{$asm}
|
[/img]
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Tue Nov 01, 2022 4:35 am Post subject: |
|
|
Perhaps it's to do with the variable assignment. Maybe something like this? I didn't test it.
| Code: |
{$ccode xBase=ebp}
extern long hngrrt;
if (*(unsigned long *)(xBase+0x10) > 0)
{
char str[] =(char)(*(unsigned long *)(xBase+0x10)+0x10);
char res[] = "hungerrate"
if (strcmp(str,res))
{
hngrrt=xBase;
}
}
{$asm}
|
|
|
| Back to top |
|
 |
dharmang1910 Expert Cheater
Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Tue Nov 01, 2022 6:15 am Post subject: |
|
|
| LeFiXER wrote: | Perhaps it's to do with the variable assignment. Maybe something like this? I didn't test it.
|
Thank you for reply I have tried it at first it shows syntax error but I have managed to fix it with this.
| Code: | | char str[] ={(char)(*(unsigned long *)(xBase+0x10)+0x10)} |
This time it works a bit long but it crashes too and also does not fetch hunger rate. May be there is a little mistake occurs.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25813 Location: The netherlands
|
Posted: Tue Nov 01, 2022 6:42 am Post subject: |
|
|
try something like this:
| Code: |
push eax
{$try}
mov eax,[ebp+10] //if this fails, the except will catch it
add eax,10
cmp [eax],0 //if eax is an invalid address, except will catch it
{$ccode xBase=ebp str=eax}
extern long hngrrt;
if (strcmp(str,"hungerrate")==0)
hngrrt=xBase;
{$asm}
{$except}
invalid:
//skip the ccode block on error
pop eax
|
_________________
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 |
|
 |
dharmang1910 Expert Cheater
Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Thu Nov 03, 2022 3:37 am Post subject: |
|
|
| Dark Byte wrote: | try something like this:
|
Thank you very much for reply.
I have tried it and now game is not crashing but it does not fetch address also.
I have tried another slower opcode and injecting luacode works and game is hanging less but still ccode can not fetch address. I think I am doing some mistake in defining [[xBase+0x10]+0x10] location.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25813 Location: The netherlands
|
Posted: Thu Nov 03, 2022 5:39 am Post subject: |
|
|
perhaps the ccode is never executed at all
Try adding counters
And yes, likely the address is wrong
_________________
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 |
|
 |
dharmang1910 Expert Cheater
Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Wed Nov 09, 2022 6:58 am Post subject: |
|
|
Here this works
| Code: | mov ecx,[ebp+10]
test ecx,ecx
je code
{$ccode xBase=ecx iBase=ebp}
extern long op1;
char *str = (char *)(xBase+0x10);
char *str2 = "currenthealth";
if (strcmp(str,str2)==0)
{
op1 = iBase;
}
{$asm}
|
|
|
| Back to top |
|
 |
|