Solved How to mod Enum ?

Status
Not open for further replies.

·҉ dollaz·҉. .

Approved iModder
Approved iModder
Mar 26, 2021
159
1,832
193
Somewhere
Enum is almost like an Int. The way ive done it is by hooking a field that has something like "public DamageType type" or something like that to an update function. Then just return the number on the enum that you want. For example


C++:
void(old_UpdateFunction)(void *instance);
void UpdateFunction(void *instance){

    /*
    
    lets say the enum is this:
    
    public enum ChargeType {

    public int value__; // 0x0
    public const ChargeType Bullet = 0;
    public const ChargeType Projectile = 1;
    public const ChargeType Area = 2;
    public const ChargeType Mele = 3;
    public const ChargeType Homing = 4;
    public const ChargeType Remaining = 5;
    public const ChargeType Growing = 6;
    public const ChargeType Continuous = 7;
    public const ChargeType non = 8;
    public const ChargeType Accumulative = 9;
    public const ChargeType Ray = 10;
}
    
    you would find a field like this;
    public ChargeType type;
    
    you just hook the field and return an int.
    
    like, for my example enum, you would return homing
    by returning 4
    */
    
*(int *) ((uint32_t)instance + 0xEC) = 4;
    
return old_UpdateFunction(instance);
}
 
Status
Not open for further replies.