This time I can't use CTM because of the struct XYZ (position), on Ghidra the instruction that is blocking me is:
Code:
_DAT_00c4d890 = *clickPos; //(006111d8)
_DAT_00c4d894 = clickPos[1]; //(006111df)
_DAT_00c4d898 = clickPos[2]; //(006111eb)
it shows an error on acces memory.
This is the function I am using:
Code:
void LocalPlayer::ClickToMove(ClickType clickType, unsigned long long interactGuid, Position position) {
struct XYZ* xyz = new struct XYZ;
xyz->X = position.X; xyz->Y = position.Y; xyz->Z = position.Z;
unsigned long long* interactGuidPtr = 0;
typedef void __fastcall func(uintptr_t, ClickType, unsigned long long*, XYZ*, float);
func* function = (func*)CLICK_TO_MOVE_FUN_PTR;
function(Pointer, clickType, interactGuidPtr, xyz, 2);
}
Code:
const uintptr_t CLICK_TO_MOVE_FUN_PTR = 0x00611130;
and this is the struct I am using:
Code:
struct XYZ {
int X;
int Y;
int Z;
};
I tried a lot of things, first __thiscall doesn't work so I am using __fastcall instead, then I can't use [StructLayout(LayoutKind.Sequential)] like in C# for my struct but I read that it isn't necessary in C.
I have been stuck on this for 2 days...
EDIT: AGAIN I found the solution right after posting !
The calling convention was indeed __thiscall and I need to pass:
Code:
typedef void (__thiscall* func)(uintptr_t, ClickType, unsigned long long*, float*, float);
So this is the final function:
Code:
void LocalPlayer::ClickToMove(ClickType clickType, unsigned long long interactGuid, Position position) {
float* xyz = new float[3];
xyz[0] = position.X; xyz[1] = position.Y; xyz[2] = position.Z;
unsigned long long* interactGuidPtr = &interactGuid;
typedef void (__thiscall* func)(uintptr_t, ClickType, unsigned long long*, float*, float);
func function = (func)CLICK_TO_MOVE_FUN_PTR;
function(Pointer, clickType, interactGuidPtr, xyz, 2);
}
I don't even need a struct.