CJBok wrote: ↑Sat Dec 05, 2020 11:51 am
...
Hi there.
From
Cheat Engine 7.1 onwards there's a variable called
$process for the AA/ASM part. Not sure if you need to use it as is, without extras, but do try:
mov eax,[$process+56DFB30].
If the game updates, though, it's possible the offset may change. So I'd suggest finding all the references to $process+56DFB30, where it's used, and devise an AOB for the piece in the function where it's used. Then use Lua to scan for that AOB and extract the address from there. Then register a symbol for it like you did.
See page 3:
Code: Select all
ImmortalsFenyxRising_plus.exe+5CE20 - 48 89 5C 24 08 - mov [rsp+08],rbx
ImmortalsFenyxRising_plus.exe+5CE25 - 57 - push rdi
ImmortalsFenyxRising_plus.exe+5CE26 - 48 83 EC 20 - sub rsp,20
ImmortalsFenyxRising_plus.exe+5CE2A - 8B 0D 002D6805 - mov ecx,[ImmortalsFenyxRising_plus.exe+56DFB30] << here
ImmortalsFenyxRising_plus.exe+5CE30 - 41 B8 C0010000 - mov r8d,000001C0
ImmortalsFenyxRising_plus.exe+5CE36 - 65 48 8B 04 25 58000000 - mov rax,gs:[00000058]
ImmortalsFenyxRising_plus.exe+5CE3F - BA 20000000 - mov edx,00000020
ImmortalsFenyxRising_plus.exe+5CE44 - 48 8B 1C C8 - mov rbx,[rax+rcx*8]
ImmortalsFenyxRising_plus.exe+5CE48 - 48 03 DA - add rbx,rdx
ImmortalsFenyxRising_plus.exe+5CE4B - 33 D2 - xor edx,edx
ImmortalsFenyxRising_plus.exe+5CE4D - 48 8B CB - mov rcx,rbx
ImmortalsFenyxRising_plus.exe+5CE50 - E8 1B9B6003 - call ImmortalsFenyxRising_plus.exe+3666970
Code: Select all
ImmortalsFenyxRising_plus.exe+6A4130 - 48 89 5C 24 10 - mov [rsp+10],rbx
ImmortalsFenyxRising_plus.exe+6A4135 - 48 89 74 24 18 - mov [rsp+18],rsi
ImmortalsFenyxRising_plus.exe+6A413A - 57 - push rdi
ImmortalsFenyxRising_plus.exe+6A413B - 48 83 EC 20 - sub rsp,20
ImmortalsFenyxRising_plus.exe+6A413F - 44 8B 05 EAB90305 - mov r8d,[ImmortalsFenyxRising_plus.exe+56DFB30] << here
ImmortalsFenyxRising_plus.exe+6A4146 - 0FB6 F1 - movzx esi,cl
ImmortalsFenyxRising_plus.exe+6A4149 - 65 48 8B 04 25 58000000 - mov rax,gs:[00000058]
ImmortalsFenyxRising_plus.exe+6A4152 - 0FB6 FA - movzx edi,dl
ImmortalsFenyxRising_plus.exe+6A4155 - B9 48030000 - mov ecx,00000348 << here
ImmortalsFenyxRising_plus.exe+6A415A - 4A 8B 04 C0 - mov rax,[rax+r8*8]
ImmortalsFenyxRising_plus.exe+6A415E - 4C 8B 04 01 - mov r8,[rcx+rax]
ImmortalsFenyxRising_plus.exe+6A4162 - 41 FF 80 400B0000 - inc [r8+00000B40]
ImmortalsFenyxRising_plus.exe+6A4169 - 41 8B 80 400B0000 - mov eax,[r8+00000B40] << here
ImmortalsFenyxRising_plus.exe+6A4170 - 48 69 D8 68010000 - imul rbx,rax,00000168
ImmortalsFenyxRising_plus.exe+6A4177 - 49 03 D8 - add rbx,r8
ImmortalsFenyxRising_plus.exe+6A417A - 48 8B CB - mov rcx,rbx
Using the 2nd snippet:
Code: Select all
ImmortalsFenyxRising_plus.exe+6A413F - 44 8B 05 EAB90305 - mov r8d,[ImmortalsFenyxRising_plus.exe+56DFB30] << here
ImmortalsFenyxRising_plus.exe+6A4146 - 0FB6 F1 - movzx esi,cl
ImmortalsFenyxRising_plus.exe+6A4149 - 65 48 8B 04 25 58000000 - mov rax,gs:[00000058]
--> 448B05????????0FB6F165488B0425
So.. using the
aobScanEx function in my script (it's in the [ Initialize ] script and registered to be used globally):
Code: Select all
local aob_tlsBase = "448B05????????0FB6F165488B0425"
sl = aobScanEx( aob_tlsBase )
if not sl or sl.Count < 1 then stopExec( "'aob_tlsBase' not found." ) end
t = tonumber( sl[0], 16 )
t = t + readInteger( t + 0x3, true ) + 0x7
unregisterSymbol( "tlsBase" )
registerSymbol( "tlsBase", t, true )
You will see that if you scan for that array in both Standard and Plus processes, you will find 1 result in each. So now you have
tlsBase symbol to use directly in the Give Item script like this:
mov rax,tlsBase
mov eax,[rax]
The reason I wrote it like this is the code the script runs is part of an allocation. This allocation can be close to the process, in which case "mov eax,[tlsBase]" would get compiled. However, if the allocation is in high memory (distance between process and allocated memory > 2GB), then "mov eax,[tlsBase]" will fail to compile. As such, the trick/twist here is to split the one instruction in two: do "mov rax,tlsBase" first, then read into eax the content of rax -> "mov eax,[rax]"
So there you have it.