public BigInteger get_currency(CurrencyType _type) {} //0x___
public enum CurrencyType
{
public int value_;
public const int Gems = 0;
public const int Coins = 1;
public const int Tickets = 2;
public const int Spins = 4;
}
This is more of a coding question rather than modding one.
You need to learn how C# and C++ work in order to be really able to use hooks. (Tutorials may be helpful, but more often than not they are just used for copy-pasting; pretty much missing the point on why they work).
Once you understand how these kind of arguments (in this case CurrencyType enum) are used/managed in C#/il2cpp library, and you are also familiar with C++'s, you will be able to craft hooks that properly interact with the game.
You can also debug and use disassemblers to help you.
I do know how they work normally, as for il2cpp, i have been trying to figure out how they are managed but i cannot find any resources. Normally they would be passed on as values, (and enums are strongly typed, meaning they cannot be casted into ints), but for some reason, il2cpp expects a pointer? I have no idea where to look man
You can also debug and use disassemblers to help you.
What matters is how the data is recieved by your C++ hook library, not if they are strongly typed in the C# one.
This sentence still holds:
System_Numerics_BigInteger_o *__fastcall Player_Wallet__get_currency(System_Numerics_BigInteger_o *retstr, Player_Wallet_o *this, int32_t type, const MethodInfo *method)
void *get_currency(void* bigint, void* instance, int type){
if(instance != NULL && bigint != NULL){
return old_get_currency(bigint, instance, type);
}
}
And viola! Everything run fines now. All this while i thought i was crazy and that unity did magical stuff with enums lmao.
Hope this helps someone out and thank you!
enum PlayerState {
sitting,
boarding,
grinding,
jumping,
flipping,
freefalling,
falling,
wingsuit,
resetting
};
void (*_ChangePos)(void *_this, int32_t PlayerPos);
void ChangePos(void *_this, int32_t PlayerPos) {
if (_this != NULL) {
if (NM.playerState) {
PlayerPos = NM.NewState;
}
}
return _ChangePos(_this, PlayerPos);
}
HOOK_LIB("libil2cpp.so", "0x451390", ChangePos, _ChangePos); //17
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies