Closed ArifRios1st closed 7 months ago
ah i don't know there is GetMethodByName by paramName and paramType sorry
how to hook something like this ?
i want to hook both
can you give example, because it same params count and params name
@BNM-Dev
I don't know all paths to classes, so you will need add them. But code should work. (At least for AddRate
with float)
auto cls = LoadClass("", ""); // Class with AddRate methods
auto calcStep = LoadClass("", "SkillCalcTemplate").GetInnerClass("CalcStep");
auto floatType = BNM::GetType<float>();
auto funcCls = LoadClass("", "Func`1"); // Idk full path to Func class
auto funcFloatCls = funcCls.GetGeneric({floatType}); // Func<float>
auto met1 = cls.GetMethodByName("AddRate", {calcStep, funcFloatCls}); // AddRate with Func<float>
auto met2 = cls.GetMethodByName("AddRate", {calcStep, floatType}); // AddRate with float
Thanks, work like charm !!
@BNM-Dev @ArifRios1st hello Looks strange for me. I have two methods which is completely same except the args type:
Trying to hook second one (byte[]) by this snippet:
auto bytesType = GetType<byte[]>(); auto met_ctor = MyClass.GetMethodByName(".ctor", {bytesType});
Also trying GetType
and get following log output: Method: [NameSpace]::[Classs].[.ctor], 1 - not found; using parameter types.
@BNM-Dev @ArifRios1st hello Looks strange for me. I have two methods which is completely same except the args type:
Trying to hook second one (byte[]) by this snippet:
auto bytesType = GetType<byte[]>(); auto met_ctor = MyClass.GetMethodByName(".ctor", {bytesType});
Also trying GetType
(); and get following log output: Method: [NameSpace]::[Classs].[.ctor], 1 - not found; using parameter types.
i think it should be like auto arrayOfByte = BNM::GetType<uint8_t>(RuntimeTypeGetter::RuntimeModifier::Array);
then auto met_ctor = MyClass.GetMethodByName(".ctor", {arrayOfByte});
@BNM-Dev @ArifRios1st hello Looks strange for me. I have two methods which is completely same except the args type:
Trying to hook second one (byte[]) by this snippet:
auto bytesType = GetType<byte[]>(); auto met_ctor = MyClass.GetMethodByName(".ctor", {bytesType});
Also trying GetType(); and get following log output: Method: [NameSpace]::[Classs].[.ctor], 1 - not found; using parameter types. i think it should be like
auto arrayOfByte = BNM::GetType<uint8_t>(RuntimeTypeGetter::RuntimeModifier::Array);
thenauto met_ctor = MyClass.GetMethodByName(".ctor", {arrayOfByte});
working perfectly.
how to hook method that have same name and params count but different type ?
// RVA: 0x8BD0E0 Offset: 0x8BD0E0 VA: 0x8BD0E0 Slot: 17
public void TargetMove(float speed, Transform targetTransform, float range, Action endCallBack) { }
// RVA: 0x8BD1E0 Offset: 0x8BD1E0 VA: 0x8BD1E0
public void TargetMove(float speed, Vector3 position, float range, Action endCallBack) { }