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 


My script is crashing the game, HELPPPP

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
paindubreak
Newbie cheater
Reputation: 0

Joined: 06 Jan 2023
Posts: 11

PostPosted: Wed Oct 18, 2023 4:07 pm    Post subject: My script is crashing the game, HELPPPP Reply with quote

Hi, my script is for the game Godfather 2, i just try to get the value of the health in "vie". IDK whats wrong


Code:

[ENABLE]


aobscanmodule(INJECT,godfather2.exe,F3 0F 11 47 10 74) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
label(vie)

newmem:
  mov [vie], esi
  add [vie],10
code:
  movss [edi+10],xmm0
  jmp return

INJECT:
  jmp newmem

vie:
  dd (float)1.0
return:
registersymbol(vie)
registersymbol(INJECT)

[DISABLE]

INJECT:
  db F3 0F 11 47 10
unregistersymbol(vie)
unregistersymbol(INJECT)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: godfather2.exe+5AB442

godfather2.exe+5AB420: 0F 2F C1           - comiss xmm0,xmm1
godfather2.exe+5AB423: F3 0F 10 57 10     - movss xmm2,[edi+10]
godfather2.exe+5AB428: F3 0F 11 54 24 08  - movss [esp+08],xmm2
godfather2.exe+5AB42E: 73 0D              - jae godfather2.exe+5AB43D
godfather2.exe+5AB430: F3 0F 10 47 14     - movss xmm0,[edi+14]
godfather2.exe+5AB435: 0F 2F C8           - comiss xmm1,xmm0
godfather2.exe+5AB438: 73 03              - jae godfather2.exe+5AB43D
godfather2.exe+5AB43A: 0F 28 C1           - movaps xmm0,xmm1
godfather2.exe+5AB43D: 8B 4F 20           - mov ecx,[edi+20]
godfather2.exe+5AB440: 85 C9              - test ecx,ecx
// ---------- INJECTING HERE ----------
godfather2.exe+5AB442: F3 0F 11 47 10     - movss [edi+10],xmm0
// ---------- DONE INJECTING  ----------
godfather2.exe+5AB447: 74 28              - je godfather2.exe+5AB471
godfather2.exe+5AB449: 56                 - push esi
godfather2.exe+5AB44A: 8D 9B 00 00 00 00  - lea ebx,[ebx+00000000]
godfather2.exe+5AB450: D9 47 10           - fld dword ptr [edi+10]
godfather2.exe+5AB453: 8B 11              - mov edx,[ecx]
godfather2.exe+5AB455: 8B 02              - mov eax,[edx]
godfather2.exe+5AB457: 8B 71 04           - mov esi,[ecx+04]
godfather2.exe+5AB45A: 83 EC 08           - sub esp,08
godfather2.exe+5AB45D: D9 5C 24 04        - fstp dword ptr [esp+04]
godfather2.exe+5AB461: D9 44 24 14        - fld dword ptr [esp+14]
}


there is also a screenshot of the health value, what access to it after someone shot the player



 Description:
 Filesize:  18.23 KB
 Viewed:  2782 Time(s)




Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4700

PostPosted: Wed Oct 18, 2023 4:20 pm    Post subject: Reply with quote

paindubreak wrote:
Code:
label(vie)
...
INJECT:
  jmp newmem

vie:
  dd (float)1.0
return:
`vie` is just a label, not an alloc. When you put it under `INJECT:` it gets written to the injection point. There's even the `return:` label there too...
No need to write a float to `vie`, just leave it at 0.
Are you sure you want to save esi and not edi?

Move `vie` under the code in `newmem:` to stop the script from crashing the game:
Code:
label(vie)

newmem:
  mov [vie], esi
  add [vie],10
code:
  movss [edi+10],xmm0
  jmp return

vie:
  dd 0

INJECT:
  jmp newmem
return:

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Oct 18, 2023 6:57 pm    Post subject: Reply with quote

Assuming that I have not made any errors and that this is what you are actually wanting to do, then this should capture the health address. Once activated, click the box in CE that says 'add address manually'. Check the pointer box and put vie in the address field (at the bottom). Change the value type to float and click okay.

Code:
[ENABLE]


aobscanmodule(INJECT,godfather2.exe,F3 0F 11 47 10 74) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
label(vie)

registersymbol(vie)
registersymbol(INJECT)

newmem:
 push edx
 lea edx,[edi+10]
 mov [vie],edx
 pop edx
 
code:
  movss [edi+10],xmm0
  jmp return

INJECT:
  jmp newmem

vie:
  dd 0
 
return:

[DISABLE]

INJECT:
  db F3 0F 11 47 10
unregistersymbol(vie)
unregistersymbol(INJECT)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: godfather2.exe+5AB442

godfather2.exe+5AB420: 0F 2F C1           - comiss xmm0,xmm1
godfather2.exe+5AB423: F3 0F 10 57 10     - movss xmm2,[edi+10]
godfather2.exe+5AB428: F3 0F 11 54 24 08  - movss [esp+08],xmm2
godfather2.exe+5AB42E: 73 0D              - jae godfather2.exe+5AB43D
godfather2.exe+5AB430: F3 0F 10 47 14     - movss xmm0,[edi+14]
godfather2.exe+5AB435: 0F 2F C8           - comiss xmm1,xmm0
godfather2.exe+5AB438: 73 03              - jae godfather2.exe+5AB43D
godfather2.exe+5AB43A: 0F 28 C1           - movaps xmm0,xmm1
godfather2.exe+5AB43D: 8B 4F 20           - mov ecx,[edi+20]
godfather2.exe+5AB440: 85 C9              - test ecx,ecx
// ---------- INJECTING HERE ----------
godfather2.exe+5AB442: F3 0F 11 47 10     - movss [edi+10],xmm0
// ---------- DONE INJECTING  ----------
godfather2.exe+5AB447: 74 28              - je godfather2.exe+5AB471
godfather2.exe+5AB449: 56                 - push esi
godfather2.exe+5AB44A: 8D 9B 00 00 00 00  - lea ebx,[ebx+00000000]
godfather2.exe+5AB450: D9 47 10           - fld dword ptr [edi+10]
godfather2.exe+5AB453: 8B 11              - mov edx,[ecx]
godfather2.exe+5AB455: 8B 02              - mov eax,[edx]
godfather2.exe+5AB457: 8B 71 04           - mov esi,[ecx+04]
godfather2.exe+5AB45A: 83 EC 08           - sub esp,08
godfather2.exe+5AB45D: D9 5C 24 04        - fstp dword ptr [esp+04]
godfather2.exe+5AB461: D9 44 24 14        - fld dword ptr [esp+14]
}
Back to top
View user's profile Send private message
paindubreak
Newbie cheater
Reputation: 0

Joined: 06 Jan 2023
Posts: 11

PostPosted: Thu Oct 19, 2023 10:27 am    Post subject: Reply with quote

i have tried the things you said but it crash again, also i misstyped, it was edi and not esi. Also i have tried you code ++METHOS and its again crashed

Code:

[ENABLE]


aobscanmodule(INJECT,godfather2.exe,F3 0F 11 47 10 74) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
label(vie)

newmem:
  mov [vie], edi
  add [vie],10
code:
  movss [edi+10],xmm0
  jmp return
vie:
  dd 0

INJECT:
  jmp newmem


return:
registersymbol(vie)
registersymbol(INJECT)

[DISABLE]

INJECT:
  db F3 0F 11 47 10
unregistersymbol(vie)
unregistersymbol(INJECT)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: godfather2.exe+5AB442

godfather2.exe+5AB420: 0F 2F C1           - comiss xmm0,xmm1
godfather2.exe+5AB423: F3 0F 10 57 10     - movss xmm2,[edi+10]
godfather2.exe+5AB428: F3 0F 11 54 24 08  - movss [esp+08],xmm2
godfather2.exe+5AB42E: 73 0D              - jae godfather2.exe+5AB43D
godfather2.exe+5AB430: F3 0F 10 47 14     - movss xmm0,[edi+14]
godfather2.exe+5AB435: 0F 2F C8           - comiss xmm1,xmm0
godfather2.exe+5AB438: 73 03              - jae godfather2.exe+5AB43D
godfather2.exe+5AB43A: 0F 28 C1           - movaps xmm0,xmm1
godfather2.exe+5AB43D: 8B 4F 20           - mov ecx,[edi+20]
godfather2.exe+5AB440: 85 C9              - test ecx,ecx
// ---------- INJECTING HERE ----------
godfather2.exe+5AB442: F3 0F 11 47 10     - movss [edi+10],xmm0
// ---------- DONE INJECTING  ----------
godfather2.exe+5AB447: 74 28              - je godfather2.exe+5AB471
godfather2.exe+5AB449: 56                 - push esi
godfather2.exe+5AB44A: 8D 9B 00 00 00 00  - lea ebx,[ebx+00000000]
godfather2.exe+5AB450: D9 47 10           - fld dword ptr [edi+10]
godfather2.exe+5AB453: 8B 11              - mov edx,[ecx]
godfather2.exe+5AB455: 8B 02              - mov eax,[edx]
godfather2.exe+5AB457: 8B 71 04           - mov esi,[ecx+04]
godfather2.exe+5AB45A: 83 EC 08           - sub esp,08
godfather2.exe+5AB45D: D9 5C 24 04        - fstp dword ptr [esp+04]
godfather2.exe+5AB461: D9 44 24 14        - fld dword ptr [esp+14]
}
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4700

PostPosted: Thu Oct 19, 2023 10:44 am    Post subject: Reply with quote

Maybe it's the default symbol name "INJECT". That name has to be unique- you can't use "INJECT" in two different scripts.
Could also be that the aob pattern isn't unique, but if you let CE generate that, it should be fine.

If it's just that script that doesn't work in isolation (not doing anything else), suspend the game (Advanced options -> pause), enable the script, set a breakpoint at the injection point, and step through your code to see where it crashes.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Oct 19, 2023 1:29 pm    Post subject: Reply with quote

In addition to what ParkourPenguin has stated, try creating a new script for that injection location, that is CE-generated (vanilla script, with no modifications), and add it to your table. Enable it to see if it crashes.
Back to top
View user's profile Send private message
paindubreak
Newbie cheater
Reputation: 0

Joined: 06 Jan 2023
Posts: 11

PostPosted: Tue Oct 24, 2023 1:52 pm    Post subject: Reply with quote

i fixed the problem, thanks a lot ! i have another problem but i will create a new topic
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Oct 24, 2023 2:36 pm    Post subject: Reply with quote

It would be good to explain what the issue was and how you resolved it so that people can learn from this thread.
Back to top
View user's profile Send private message
paindubreak
Newbie cheater
Reputation: 0

Joined: 06 Jan 2023
Posts: 11

PostPosted: Tue Oct 24, 2023 3:20 pm    Post subject: Reply with quote

i ve just did what you said, i put the 'vie' thing before the INJECT: and now, literally almost every script that i do works.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Oct 24, 2023 7:14 pm    Post subject: Reply with quote

changing label(vie) to alloc(vie,4) would also fix 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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
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