BNM 2.4.0
 
Loading...
Searching...
No Matches
Custom classes macros

Macros

#define BNM_CustomClass(_class_, _targetType_, _baseType_, _owner_, ...)
 Define info of C++ class for il2cpp.
 
#define BNM_CustomField(_field_, _type_, _name_)
 Define info about C++ field for il2cpp.
 
#define BNM_CustomMethod(_method_, _isStatic_, _type_, _name_, ...)
 Define info about C++ method for il2cpp.
 
#define BNM_CustomMethodMarkAsInvokeHook(_method_)
 Mark method to prefer InvokeHook.
 
#define BNM_CustomMethodMarkAsBasicHook(_method_)
 Mark method to prefer BasicHook.
 
#define BNM_CustomMethodSkipTypeMatch(_method_)
 Skip method parameters type matching.
 
#define BNM_CallCustomMethodOrigin(_method_, ...)
 Call method origin, if it exists.
 

Detailed Description

Information about all macros of classes management.

Macro Definition Documentation

◆ BNM_CallCustomMethodOrigin

#define BNM_CallCustomMethodOrigin ( _method_,
... )

Call method origin, if it exists.

This macro can be used to call overridden (base) method or origin (old code) of hooked method.

Parameters
_method_Target method
...Method call arguments (for non-static method first argument should be this)

◆ BNM_CustomClass

#define BNM_CustomClass ( _class_,
_targetType_,
_baseType_,
_owner_,
... )

Define info of C++ class for il2cpp.

Use this macro to describe info about your C++ class to add it as valid class to il2cpp.
BNM will automatically convert all information to il2cpp valid format.

This macro adds static field BNMCustomClass to target class. Using it you can access:

BNM::IL2CPP::Il2CppClass *myClass // Generated/modified il2cpp class object of current custom class
BNM::MonoType *type // Mono type of current custom class, to be used in, for example `AddComponent`
// And there are some other internal data that are used by BNM to create/modify il2cpp class.
IL2CPP::Il2CppReflectionType MonoType
Redefinition of Il2CppReflectionType for shorter code.
Definition Il2CppHeaders.hpp:51
Parameters
_class_Class itself
_targetType_BNM::CompileTimeClass or how class will be presented in il2cpp
_baseType_BNM::CompileTimeClass of base class type
_owner_BNM::CompileTimeClass of owner class type (to make this class nested)
...BNM::CompileTimeClass of interfaces that class should override

◆ BNM_CustomField

#define BNM_CustomField ( _field_,
_type_,
_name_ )

Define info about C++ field for il2cpp.

This macro adds static field BNMCustomField_(_field_ param) to target class. Using it you can access:

BNM_PTR offset // Offset of current field in current class (useful for modifying class)
BNM::IL2CPP::FieldInfo *myInfo // Generated il2cpp object of current field
// And there are some other internal data that are used by BNM to create/add il2cpp field.
Parameters
_field_Field itself
_type_BNM::CompileTimeClass of field type that will be presented in il2cpp
_name_Field name that will be presented in il2cpp

◆ BNM_CustomMethod

#define BNM_CustomMethod ( _method_,
_isStatic_,
_type_,
_name_,
... )

Define info about C++ method for il2cpp.

This macro adds static field BNMCustomMethod_(_method_ param) to target class. Using it you can access:

BNM::IL2CPP::MethodInfo *myInfo // Generated il2cpp object of current method
// And there are some other internal data that are used by BNM to create/add/hook il2cpp method.
Parameters
_method_Method itself
_isStatic_Set it to true if method is static
_type_Method returns type that will be presented in il2cpp
_name_Method name that will be presented in il2cpp
...Method parameter types that will be presented in il2cpp

◆ BNM_CustomMethodMarkAsBasicHook

#define BNM_CustomMethodMarkAsBasicHook ( _method_)

Mark method to prefer BasicHook.

If this macro is applied to method, BNM will prefer to use basic hook for it.

Parameters
_method_Target method

◆ BNM_CustomMethodMarkAsInvokeHook

#define BNM_CustomMethodMarkAsInvokeHook ( _method_)

Mark method to prefer InvokeHook.

If this macro is applied to method, BNM will prefer to use invoke hook for it.

Parameters
_method_Target method

◆ BNM_CustomMethodSkipTypeMatch

#define BNM_CustomMethodSkipTypeMatch ( _method_)

Skip method parameters type matching.

If this macro is applied to method, BNM will skip type matching for method overriding/hooking and instead it will use parameters count.

Parameters
_method_Target method