Make a function pointer to openafterdoor then call your pointer in the update.
Hey, i also have a question about calling functions.
When im trying to call a function called DeleteAllBloons() from an update function, the game crashes. (i am advanced in c++)
This is how my code snippet looks like :
// The function inside dump.cs/Assembly-CSharp.dll
C#:
// Assets.Scripts.Unity.UI_New.InGame.InGame
// Token: 0x06007061 RID: 28769 RVA: 0x00002053 File Offset: 0x00000253
[Token(Token = "0x6007061")]
[Address(RVA = "0x1132848", Offset = "0x1132848", VA = "0x1132848")]
public void DeleteAllBloons()
{
}
//the update function im using
C#:
// Assets.Scripts.Unity.Game
// Token: 0x06004A9B RID: 19099 RVA: 0x00002053 File Offset: 0x00000253
[Token(Token = "0x6004A9B")]
[Address(RVA = "0xDCA4A0", Offset = "0xDCA4A0", VA = "0xDCA4A0")]
private void Update()
{
}
//offsets for funcs
C++:
enum Offsets {
GameUpdateOffset = 0xDCA4A0,
};
//game update func and function pointer
C++:
void (*DeleteAllBloons)(void *instance);
void *gameUpdateInst;
void (*old_GameUpdate)(void *instance);
void GameUpdate(void *instance) {
if(instance != NULL) {
gameUpdateInst = instance;
}
old_GameUpdate(instance);
}
//inside the button
C++:
if (gameUpdateInst != NULL) {
DeleteAllBloons(gameUpdateInst);
}
// inside of hack_thread pointer after the lib is loaded
C++:
DeleteAllBloons = (void (*)(void*))getAbsoluteAddress(targetLibName, 0x1132848);
MSHookFunction((void*)getAbsoluteAddress(targetLibName, Offsets::GameUpdateOffset), (void*) GameUpdate, (void **)&old_GameUpdate);
Sorry, forgot to mention the game's name : Bloons TD6
Im still unable to create threads, because i forgot which requirements i had to meet.