Hi guys,
I took my first steps at modding a few days ago but I can't manage to make my function work.
I'm using LGL Model Menu template 3.2 to mod a unity libil2cpp 64-bit game on android.
Here the function I want to hook:
- Lib class: BattleUnitController
- Offset: 0xD92288
My ultimate goal is to modify hpDamage & shieldDamage parameters inside the void function by using a slider.
Is calling only a few arguments of a void function possible ? How should I do it ? (I'm a begginer have hard time finding the right way to translate that in C+)
So far I have tested the following but not working:
I have seen some well working mod menus for my game out there so I'm pretty sure it's can be done.
I would take any wisedom/advise you could share
I took my first steps at modding a few days ago but I can't manage to make my function work.
I'm using LGL Model Menu template 3.2 to mod a unity libil2cpp 64-bit game on android.
Here the function I want to hook:
- Lib class: BattleUnitController
- Offset: 0xD92288
C++:
public void ApplyAttackDamage(int hpDamage, int shieldDamage, bool isCrit, BattleUnitController attacker, BattleUnitController target, UnitMoveType moveType, DamageTypeEnum damageType, bool showUIMessaging = True, bool canCounterAttack = True, BattleEffectDO sourceEffect, bool fromDestroyModule = False) { }
My ultimate goal is to modify hpDamage & shieldDamage parameters inside the void function by using a slider.
Is calling only a few arguments of a void function possible ? How should I do it ? (I'm a begginer have hard time finding the right way to translate that in C+)
So far I have tested the following but not working:
C++:
int DamageMultiplier = 1;
//My function
void (*old_ApplyAttackDamage)(void *instance,int hpDamage,int shieldDamage,bool isCrit,void* BattleUnitController,void* UnitMoveType,void* DamageTypeEnum,bool showUiMessaging,bool canCounterAttack,void* BattleEffectDO,bool fromDestroyModule);
void ApplyAttackDamage(void *instance,int hpDamage,int shieldDamage,bool isCrit,void* BattleUnitController,void* UnitMoveType,void* DamageTypeEnum,bool showUiMessaging,bool canCounterAttack,void* BattleEffectDO,bool fromDestroyModule)
{
if (instance != NULL && DamageMultiplier > 1)
{
return old_ApplyAttackDamage(instance, hpDamage * DamageMultiplier , shieldDamage * DamageMultiplier, isCrit, BattleUnitController, UnitMoveType, DamageTypeEnum, showUiMessaging, canCounterAttack, BattleEffectDO, fromDestroyModule);
}
return old_ApplyAttackDamage(instance, hpDamage, shieldDamage, isCrit, BattleUnitController, UnitMoveType, DamageTypeEnum, showUiMessaging, canCounterAttack, BattleEffectDO, fromDestroyModule);
}
//Hooking armeabi-v7a
HOOK("0xd92288", ApplyAttackDamage, old_ApplyAttackDamage);
//Setting the slider
jobjectArray GetFeatureList(JNIEnv *env, jobject context) {
jobjectArray ret;
const char *features[] = {
OBFUSCATE("10_SeekBar_Damage Multiplier_1_10000")
};
//Switch cases
switch (featNum) {
case 10:
if (value >= 1) {
DamageMultiplier = value;
}
break;
I have seen some well working mod menus for my game out there so I'm pretty sure it's can be done.
I would take any wisedom/advise you could share