geokar2006 / ByNameModding

MOVED https://github.com/ByNameModding/BNM-Android
113 stars 34 forks source link

Sir pls help me. cant hook field #24

Closed wwwww56 closed 1 year ago

wwwww56 commented 1 year ago

your example.cpp don't have hook field

i hook like:

HOOK(FPSController.GetFieldByName(OBFUSCATE_BNM("Update")).GetOffset(), Update, old_Update);

and it crash

pls give one example which can hook field

Thank you very much!

wwwww56 commented 1 year ago

i mean hook field just like : float、int、double...

geokar2006 commented 1 year ago

You can't hook field, you can only get or set it. From Examples.cpp • Define fieldFind fieldGet field

wwwww56 commented 1 year ago

You can't hook field, you can only get or set it. From Examples.cpp • Define fieldFind fieldGet field

so how can i set it, example i want to set that field CoolTime = 0 , and how to do ?

geokar2006 commented 1 year ago

CoolTime static?

wwwww56 commented 1 year ago

public float CoolTime or private float CoolTime

geokar2006 commented 1 year ago

You need instance of class where field placed

wwwww56 commented 1 year ago

in class SkillManager

wwwww56 commented 1 year ago

no namespace

geokar2006 commented 1 year ago

I have dump.cs or DummyDll?

wwwww56 commented 1 year ago

yes you have telegram ? i contact on it

wwwww56 commented 1 year ago

dump.cs.txt

wwwww56 commented 1 year ago

sir this is .cs files

wwwww56 commented 1 year ago

JM) @B~D_Q8YW_VFVAK@(N0

wwwww56 commented 1 year ago

i want set these three fields value to 0

geokar2006 commented 1 year ago

I have only one idea, hook CreateSkill, and change fields in it.

BNM::Field<float> skillCooldown;
void *(*old_CreateSkill)(int, int);
void *CreateSkill(int skillT, int skillId) {
    auto skill = old_CreateSkill(skillT, skillId); // Get created Skill
    skillCooldown(skill) = 0.f; // Set skillCooldown to zero
    return skill; // Return modded skill
}
wwwww56 commented 1 year ago

OK thanks sir i will try it