Help! Hooking Void Update Crash

JayArceus

Rookie
Hello I'm a beginner to modding and I've been trying to make a cheat to teleport other play in another location. I've found the Offsets needed but my code doesnt seem to work any help would be greatly appriciated. The app is crashing when I execute update.

C#:
[Token(Token = "0x60073ED")]
[Address(RVA = "0x12C4718", Offset = "0x12C4718", VA = "0x12C4718")]
public void ChangeField(int fieldId, byte roomType, byte roomId, float[] basePos, float angle, float cameraRot, EmergencyPositionData emergency)
{
}

C#:
[Token(Token = "0x60073B5")]
[Address(RVA = "0x12BFDFC", Offset = "0x12BFDFC", VA = "0x12BFDFC")]
private void Update()
{
}


My Imgui Mod Menu Code :
Code:
void (*ChangeField) (void *instance, int fieldId, char roomType, char roomId, float basePos, float angle, float cameraRot);

void Pointers() {
    ChangeField = (void(*) (void*, int, char, char, float, float, float)) (g_il2cppBaseMap.startAddress + string2Offset("0x12C4718"));
}

void (*old_Update) (void *instance);
void Update(void *instance) {
    if(instance != NULL && isUpdate) {
            ChangeField(6000, 0, 0, 0, 0, 0);
            isUpdate = false;
    }
    old_Update(instance);
}

HOOK("0x12BFDFC", Update, old_Update);
 
You haven't included the instance inside the function...

C++:
void (*old_Update) (void *instance);
void Update(void *instance) {
    if(instance != NULL && isUpdate) {
            ChangeField(instance, 6000, 0, 0, 0, 0, 0);
            isUpdate = false;
    }
    old_Update(instance);
}

Also basePos parameter is not a float but a float[] array
 
You haven't included the instance inside the function...



C++:
void (*old_Update) (void *instance);
void Update(void *instance) {
    if(instance != NULL && isUpdate) {
            ChangeField(instance, 6000, 0, 0, 0, 0, 0);
            isUpdate = false;
    }
    old_Update(instance);
}

Also basePos parameter is not a float but a float[] array
Umm.. Include instance where?

I'm unable to figure out a way to make array could you please help me with that.
 
Back
Top Bottom