jeudi 26 janvier 2017

How to get pointer to first arg of function?

I want to reflective call function with same arguments without manually coping params (for future this will be macro and this will be automatically).

UFUNCTION()
void PleaseRespawnMe(FName className)
{
    uint64 _frame;  // Here is stack pointer?

    UFunction* func = GetController()->ServerCheatManager->FindFunction("PleaseRespawnMe");  // function with same name
    void* startStack = (void*)(&_frame - func->ParmsSize);  // Start stack is pointer to first variable minus params size?
    GetController()->ServerCheatManager->ProcessEvent(func, startStack);  // calling using pointer of first argument
}

But &_frame pointer is too far from &className. Is there solutions to get pointer of args using address of local variable?

P.S. This is Unreal Engine 4 framework (calling function by name is unreal reflection system).





Aucun commentaire:

Enregistrer un commentaire