Closed drakulaboy closed 5 months ago
Tell me which feature you need from BNM?
i want to find/hook this kind of fields from the methods that doesn't have some "Update" offset
i was looking at the example [Finding everything by names (classes, methods, fields) Finding everything by names but couldn't understand how to do a simple field hook
You can't hook them without an instance of class
can't hook them
so, for this kind of classes and fields i can't use BNM?
But this isn't BNM repo You are asking on wrong repository
i want to find/hook this kind of fields from the methods that doesn't have some "Update" offset
i was looking at the example [Finding everything by names (classes, methods, fields) Finding everything by names but couldn't understand how to do a simple field hook
To get the values of the fields, find an instance of the class (in your case, this is instance). Copy the address of 'PlayerController_TypeInfo' from the 'script.json' generated by Il2CppDumper and add the base address to it GameAssembly.dll. Find the offset to the static fields (usually 0x5C for 32 bit, 0x5C * 2 for 64 bit), and add the field offset to the resulting address. Now you have the value of the field!
For example:
it is important to note that if there is no reference to the class in the instance field, then the address will be different
i want to find/hook this kind of fields from the methods that doesn't have some "Update" offset
i was looking at the example [Finding everything by names (classes, methods, fields) Finding everything by names but couldn't understand how to do a simple field hook
If you want to modify the value of a field in a class that has no Update
method, find other classes that have the same PlayerController
class as a field, but also have an Update
method.
For example:
public class PlayerController
{
public float damageBullet; // 0x00
// No Update method
}
public class Character
{
public PlayerController playerController; // 0x00
// Has an Update function
void Update();
}
the Character
class contains both an Update
method and a reference to the PlayerController
class. with this information, you can hook the Update
method. Here's an example how you'd do it with this repo:
void Update(Il2CppObject* character){
Il2CppObject* playerController = character->getField<Il2CppObject*>("playerController");
float damageBullet = playerController->getField<float>("damageBullet"); // Retrieve the value from the PlayerController
playerController->setField<float>("damageBullet", 999.f);
return character->invoke_method("Update");
}
...
REPLACE_NAME("Character", "Update", Update);
you did not necessarily need an Update
method to change a field value, it can be any method inside the same class as long as you are sure it is get called
@catlowlevel this is the most simple and good explanation, and it really worked from the first time, thank you, means i don't need any BNM, yay! Case closed!
can you add ByNameModding to the Mod Menu please, i tried but fail to compile