i designed my movement like this:
Code:
MoveTo(X,Y,Z=0,flyflag=0)
{
if (X < 1000)
{
X := floattohex((X*10)-4000)
Y := floattohex((Y*10)-5500)
Z := floattohex(Z*10)
}
revHex(revX, X)
revHex(revY, Y)
revHex(revZ, Z)
revHex(revBaseAddress, realbaseAddress) ;~0xD2E444
revHex(revADDRESS_ACTION1, ADDRESS_ACTION1) ;~0x4A1AA0
revHex(revADDRESS_ACTION2, ADDRESS_ACTION2) ;~0x4A7DE0
revHex(revADDRESS_ACTION3, ADDRESS_ACTION3) ;~0x4A2090
revHex(OFFSET_ACTIONBASE, playerActionStructOffset) ;~0x13F0
revHex(FLYMODE, flyflag)
func =
func = %func%60
func = %func%B8%revBaseAddress%
func = %func%8B00
func = %func%8B401C
func = %func%8B7028
func = %func%8B8E%OFFSET_ACTIONBASE%
func = %func%6A01
func = %func%BA%revADDRESS_ACTION1%
func = %func%FFD2
func = %func%8BF8
func = %func%8D442418
func = %func%50
func = %func%BA%FLYMODE%
func = %func%52
func = %func%8BCF
func = %func%BA%revADDRESS_ACTION2%
func = %func%FFD2
func = %func%8B8E%OFFSET_ACTIONBASE%
func = %func%B8%revX%
func = %func%8BD7
func = %func%83C220
func = %func%8902
func = %func%B8%revZ%
func = %func%8BD7
func = %func%83C224
func = %func%8902
func = %func%B8%revY%
func = %func%8BD7
func = %func%83C228
func = %func%8902
func = %func%6A00
func = %func%6A01
func = %func%57
func = %func%6A01
func = %func%BA%revADDRESS_ACTION3%
func = %func%FFD2
func = %func%61
func = %func%C3
injectCode(func)
}
help functions:
FloatToHex(f) {
form := A_FormatInteger
SetFormat Integer, HEX
v := DllCall("MulDiv", Float,f, Int,1, Int,1, UInt)
SetFormat Integer, %form%
Return v
}
revHex(byref CodeRev, Code, requestedLength=8)
{
SetFormat, IntegerFast, hex
Code += 0
Code .= ""
SetFormat, IntegerFast, d
CodeRev =
temp2 := substr(Code, 3)
temp2 := "00000000" . temp2
temp := strlen(temp2)-requestedLength + 1
temp2 := substr(temp2, temp)
i := requestedLength - 1
looplength := requestedLength // 2
loop %loopLength%
{
CodeRev := CodeRev . substr(temp2, i, 2)
i := i - 2
}
}
injectCode(opcode)
{
winget, pid, PID, ahk_pid %processID%
ProcessHandle := DllCall("OpenProcess", "int", 2035711, "char", 1, "UInt", PID, "UInt")
functionSize := strlen(opcode)/2
functionAddress := DllCall("VirtualAllocEx", "Uint", ProcessHandle, "Uint", 0, "Uint", functionSize, "Uint", 0x1000, "Uint", 0x40)
MCode(InjectFunction, opcode)
DllCall("WriteProcessMemory", "UInt", ProcessHandle, "UInt", functionAddress, "Uint", &InjectFunction, "Uint", functionSize, "Uint *", 0)
SetFormat, IntegerFast, d
hThrd := DllCall("CreateRemoteThread", "Uint", ProcessHandle, "Uint", 0, "Uint", 0, "Uint", functionAddress, "Uint", 0, "Uint", 0, "Uint", 0)
loop
{
result := DllCall( "WaitForSingleObject", UInt,hThrd, UInt,50 )
if(result <> 258)
{
break
}
sleep 50
if(A_Index > 100)
{
break
}
}
DllCall( "CloseHandle", UInt,hThrd )
DllCall("VirtualFreeEx", "Uint", ProcessHandle, "Uint", functionAddress, "Uint", 0, "Uint", 0x8000)
DllCall( "CloseHandle", UInt,ProcessHandle )
}
so if u pass the ingame coordinates it will recalculate them. using the reversed hexa form is ofc necessary. dont know if that helps.
short example:
ingameX := 500.0
X := floattohex((ingameX*10)-4000) ; = 0x447A0000
revHex(revX, X) ; = 0x00007a44 -> pass this to injected code