Help! offset edit don't work

ItzBlady

Platinian
Original poster
Aug 6, 2022
14
0
1
24
Russia
Im use nepmods tester and test any offset. All offset work, but if im add offset in mod menu, 90% offset don't work. Im check all offset, all. Right, without error. Im try use HOOK_LIB/Mshookfunction, but all don't work.
Codes:
void (*old_Speed)(void *instance);
void Speed(void *instance) {
if (feature6) {
*(int *) ((uint64_t) instance + 0x18) = 0;
}
return old_Speed(instance);
}

//
MSHookFunction(
reinterpret_cast<void*>(
getAbsoluteAddress(
"libil2cpp.so",
string2Offset("0x744594")
)
),
reinterpret_cast<void*>(Speed),
reinterpret_cast<void**>(&old_Speed)
);

//
HOOK_LIB("libil2cpp.so", "0x744594", Speed, old_Speed);

Im use lgl mod menu 3.2
 

DigitalKnight

Approved Modder
Approved Modder
Jul 31, 2018
185
11,461
1,193
23
Within the Heart
Firstly, the tester uses patching, which is different than hooking (what you are doing here). Have you tried patching them inside lgl menu to verify if those offsets work?
Secondly, your hooks are confusing. Is Speed a void function? In that case, you are returning a value which is wrong. Is it an update function? Is the field ever really used? Well no one knows because your code is not clear :)
 
  • Like
Reactions: Script4fun

Raebydett

Awesome Active Platinian
Jan 20, 2020
176
62
28
G
Delete that mshookfunc, your compiler confused what to use if u put both
 

ItzBlady

Platinian
Original poster
Aug 6, 2022
14
0
1
24
Russia
Firstly, the tester uses patching, which is different than hooking (what you are doing here). Have you tried patching them inside lgl menu to verify if those offsets work?
Secondly, your hooks are confusing. Is Speed a void function? In that case, you are returning a value which is wrong. Is it an update function? Is the field ever really used? Well no one knows because your code is not clear :)
No, speed this field offset, im use hook for field Offset.
// WeaponScr

[Address(RVA = "0x744594", Offset = "0x744594", VA = "0x744594")]
private void Update()

[FieldOffset(Offset = "0x18")]
public int ShootTime;
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
176
62
28
G
Try remove the toggle or change the input to other value

C++:
void (*old_Speed)(void *instance);
void Speed(void *instance) {
    *(int *) ((uint64_t) instance + 0x18) = 0;
}
 

DigitalKnight

Approved Modder
Approved Modder
Jul 31, 2018
185
11,461
1,193
23
Within the Heart
No, speed this field offset, im use hook for field Offset.
// WeaponScr

[Address(RVA = "0x744594", Offset = "0x744594", VA = "0x744594")]
private void Update()

[FieldOffset(Offset = "0x18")]
public int ShootTime;
Again, the problem is with how you are using
the update function. You never call the original update among other things.
 
Last edited:

DigitalKnight

Approved Modder
Approved Modder
Jul 31, 2018
185
11,461
1,193
23
Within the Heart
C++:
void (*old_Speed)(void *instance);
void Speed(void *instance) {
  if(instance != NULL && <bool>){
    *(int *) ((uint64_t) instance + 0x18) = 0;
  }
  old_speed(instance);
}
Use this, if it still doesn't work, then find another field or method because the game does not use it
 

ItzBlady

Platinian
Original poster
Aug 6, 2022
14
0
1
24
Russia
C++:
void (*old_Speed)(void *instance);
void Speed(void *instance) {
  if(instance != NULL && <bool>){
    *(int *) ((uint64_t) instance + 0x18) = 0;
  }
  old_speed(instance);
}
Use this, if it still doesn't work, then find another field or method because the game does not use it
he uses just such ones, I checked this offset in the tester, and everything worked fine.