Page 1 of 1

64-bit game: How to jump near allocated memory when there is long jump?

Posted: Sat Aug 21, 2021 6:22 am
by Scaredcat
in this 64 bit game, Final Fantasy XV, i'm trying to make infinite health and one hit kills, but when i activate the script it does a long jump (use larger allocated memory) which means my game could likely crash while enabling/disabling the script. I'll show what I mean with an image:

Image

I thought it looked weird. Look at the bytes where I inject, isn't that too big?

Is there a way to tell the script to jump 'near' or jump 'short' in allocated memory? How can I do it? I will post my script, if you have suggestion to add to my code to fix this large jump issue, please specify where I need to put the code you're telling me to edit. Thanks. Also if you have a better/more efficient method to fix this issue, please elaborate, i'm trying to learn after all.

Code: Select all

[ENABLE]
aobscanmodule(health1,ffxv_s.exe,89 83 A0 01 00 00 41 D1 C8) // should be unique
alloc(newmem,$1000,"ffxv_s.exe"+1D5A41)
label(code)
label(return)
label(infhealth)
label(infhealth_flag)
label(ohk)
label(ohk_flag)
registersymbol(infhealth_flag)
registersymbol(ohk_flag)
registersymbol(health1)

newmem:
  cmp [rbx+180],#257    //player check
  je infhealth
  cmp byte ptr [ohk_flag],1
  je ohk
  jmp code

infhealth:
  cmp byte ptr [infhealth_flag],0
  je code

  push rcx
  mov rcx,[rbx+1A4]     // health cap
  mov [rbx+1A0],rcx     // current health
  pop rcx
  jmp return

code:
  mov [rbx+000001A0],eax         // original code
  jmp return

ohk:
  mov eax,0
  mov [rbx+000001A0],eax
  jmp return

infhealth_flag:
  db 0
ohk_flag:
  db 0

health1:
  jmp newmem
  nop
return:

[DISABLE]

health1:
  db 89 83 A0 01 00 00 41 D1 C8

unregistersymbol(health1)
unregistersymbol(infhealth_flag)
unregistersymbol(ohk_flag)
dealloc(newmem) 
Here's a snapshot of the instructions nearby:
Image


ended up getting some help from DB. told me to put a far jump at newmem. however it's still crashing, don't know the issue. any help?
edit: found the issue. the jumps near my injection point were interfering with injection. had to pick a different injection point. and also learned out how to do the long jumps properly thanks to dark byte and some other good folks from cheat the game discord.