Help! out ref / out reference

Kaorin333

Solid & Active Platinian
1660917415986.png


hi dear community again, i have a small problem and i hope here again someone could help.

i tried so far the normal reference in cpp int* or int& but they dont work and crash the game. is there an easy work around for my problem?
what i want is to read simply the values groupindex blockindex inside of the hooked method.

again thank you for the help.
 
Ok,
I will say, but i am not sure that it will help you:
To Use this
You need to understand Pointers,
Like for now,

There is a method:
OFFSET: 0x000000
void GetIndex(out int PlayerIndex);

So, Here, we need to paas A pointer for a int variable,

So, what will we do:

int getPlayerIndex(void *player) {
int indexP = 0;
if(player != NULL) {
static const auto getPlayerIndex_Out = reinterpret_cast<uint64_t(__fastcall *)(void *,int &)>(getAbsoluteAddress("libil2cpp.so", 0x000000));
getPlayerIndex_Out(player, indexP);
}
return indexP;
}

What we basically do, we passed a address for IndexP int variable, so the method will store the return value in that variable, so we can return and use.


What i said may not be perfect, but that what it works
 
@DigitalKnight i didnt post the code, because there isnt anything in except the standard

C++:
void (*old_func)(void* instance, int* a, int* b);
void _func(void* instance, int* a, int* b) {

    if (instance != NULL) {
        LOGI("%i %i", a, b);
    }

    old_func(instance, a, b);
}

there isnt anything more than what you already saw in my question post.

@NepMods69 also a interesting idea but wasnt giving me not much help to receive the values, but maybe for future projects thank you for the "explaination".
here the code, or did i maybe do soemthing wrong.

C++:
void (*call_func)(void* instance, int* a, int* b);
void (*old_func)(void* instance, int* a, int* b);
void _func(void* instance, int* a, int* b) {
    int aPtr = 0;
    int bPtr = 0;

    if (instance != NULL) {
        call_func(instance, &aPtr, &bPtr );
        LOGI("%i %i", aPtr, bPtr);
    }

    old_func(instance, a, b);
}
 
Back
Top Bottom