Hi,Move first on my discord Kawan#9567
I know we can use pointer to access that struct and modify it's member but I don't know how to do it by code ?
Can you send me an example ?
public sealed class GameCamera : MonoBehaviour // TypeDefIndex: 11111
private GameCamera.ZoomParams _defaultZoomParams; // 0x48
-------
public abstract class Controllable : FastMonoBehaviour // TypeDefIndex: 11056
private GameCamera.ZoomParams _cameraZoomParams; // 0x6C
*rest of the hooking code*
void *ZoomParams = *(void**)((uint64_t)instance + 0x48); // Pointer to ZoomParams
if(ZoomParams){ // Check if it's not null
*(float*)((uint64_t)ZoomParams + 0x4) = 25.0f; // public float heigth; // 0x4
}
*rest of the hooking code*
This is what I found in the dump
You can use these field as instance to access the struct,
C++:*rest of the hooking code* void *ZoomParams = *(void**)((uint64_t)instance + 0x48); // Pointer to ZoomParams if(ZoomParams){ // Check if it's not null *(float*)((uint64_t)ZoomParams + 0x4) = 25.0f; // public float heigth; // 0x4 } *rest of the hooking code*
void *(*FuncPoint)(void *instance) = (void *(*)(void*))getRelativeAddress(offset);
//we set the function pointer
//we set the value in the structure
*(int*)((uintptr_t)FuncPoint+fieldOffset) = 9999;
LODWORD(this->fields.maxHealth) = ((int (__fastcall *)(LocalData_BaseUnitData_o *, int32_t, int32_t, int32_t, const MethodInfo *))data->klass->vtable._5_GetTotalHealth.methodPtr)(
data,
v9,
levelUpgrade,
levelUpgradeStarPurple,
data->klass->vtable._5_GetTotalHealth.method);
is the health obscured? please use Il2cppDumper instead of ida if you have the possibility. Ida decompiler could have some mistakes.I have similar issues. Tried setting this->fields.maxHealth = 100; but the health became zero instead.
This is the pseudocode from il2cpp.so.
C++:LODWORD(this->fields.maxHealth) = ((int (__fastcall *)(LocalData_BaseUnitData_o *, int32_t, int32_t, int32_t, const MethodInfo *))data->klass->vtable._5_GetTotalHealth.methodPtr)( data, v9, levelUpgrade, levelUpgradeStarPurple, data->klass->vtable._5_GetTotalHealth.method);
// RVA: 0x9CEA24 Offset: 0x9CEA24 VA: 0x9CEA24
public void InitBaseTowerData(BaseUnitData data, int levelUpgrade, int levelUpgradeStarPurple) { }
v9 = data->fields._Id_k__BackingField;
this->fields.id = v9;
LODWORD(this->fields.maxHealth) = ((int (__fastcall *)(LocalData_BaseUnitData_o *, int32_t, int32_t, int32_t, const MethodInfo *))data->klass->vtable._5_GetTotalHealth.methodPtr)(
data,
v9,
levelUpgrade,
levelUpgradeStarPurple,
data->klass->vtable._5_GetTotalHealth.method);
// RVA: 0x6CFB10 Offset: 0x6CFB10 VA: 0x6CFB10 Slot: 5
public virtual float GetTotalHealth(int levelUnit = 0, int levelUpgrade = 0, int levelUpgradeStarPurple = 0) { }
This is what I found in the dump
You can use these field as instance to access the struct,
C++:*rest of the hooking code* void *ZoomParams = *(void**)((uint64_t)instance + 0x48); // Pointer to ZoomParams if(ZoomParams){ // Check if it's not null *(float*)((uint64_t)ZoomParams + 0x4) = 25.0f; // public float heigth; // 0x4 } *rest of the hooking code*
Вот что я нашел на свалке
Вы можете использовать это поле как экземпляр для доступа к структуре,
[КОД=cpp]
*остальная часть кода подключения*
void *ZoomParams = *(void**)((uint64_t)instance + 0x48); // Указатель на ZoomParams
if(ZoomParams){ // Проверяем, не равно ли значение нулю
*(float*)((uint64_t)ZoomParams + 0x4) = 25.0f; // публичная высота плавающей точки; // 0x4
}
*остальная часть кода перехвата*[/CODE]
[/ЦИТИРОВАТЬ]
Help me please to hook thisThis is what I found in the dump
You can use these field as instance to access the struct,
C++:*rest of the hooking code* void *ZoomParams = *(void**)((uint64_t)instance + 0x48); // Pointer to ZoomParams if(ZoomParams){ // Check if it's not null *(float*)((uint64_t)ZoomParams + 0x4) = 25.0f; // public float heigth; // 0x4 } *rest of the hooking code*
Wrong Place To AskHelp me please to hook this
// Namespace: ClientCommons.Game.Rpc
public struct RemoteZonePassage // TypeDefIndex: 15795
{
// Fields
public int ZoneControllerId; // 0x0
public bool Entered; // 0x4
}
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies