Hi guys, I have this Unity code
[Address(RVA = "0x2DFB948", Offset = "0x2DFB948", VA = "0x2DFB948")]
public void SendAdjustEvent(string adjustEventToken)
{
}
and another function to work as a pointer
[Address(RVA = "0x2E11424", Offset = "0x2E11424", VA = "0x2E11424")]
private void InitScore()
{
}
Then I tried to pass some string as adjustEventToken params like this in Ted2 menu mod:
#import "Macros.h"
#include <string>
/***********************************************************
INSIDE THE FUNCTION BELOW YOU'LL HAVE TO ADD YOUR SWITCHES!
***********************************************************/
void (*SendAdjustEvent)(void *self, const char *event);
void new_SendAdjustEvent(void *self, const char *event){
SendAdjustEvent(self, event);
}
void (*InitScore)(void *self);
void new_InitScore(void *self){
InitScore(self);
std::string gay = "laaa32";
const char* param = gay.c_str();
SendAdjustEvent(self, param);
}
void setup() {
HOOK(0x2DFB948, new_SendAdjustEvent, SendAdjustEvent);
HOOK(0x2E11424, new_InitScore, InitScore);
// Empty switch - usefull with hooking
[switches addSwitch:NSSENCRYPT("name")
description:NSSENCRYPT("des")
];
}
But it keeping crash the app when InitScore is called. Can you show me what I was wrong and how to fix it?