F
FiftyTifty
Guest
I need to patch one byte, and one dword in memory. I've got the address, I know the offsets, but for the life of me, google only yields incompatible answers that make no sense.
Here's the block of code:
void PatchGetHitIMAD() {
//This function must be called at PreLoadGame()
_MESSAGE("Starting");
TESForm* imadGetHit = LookupFormByID(0x162);
_MESSAGE("GetHit starting address is: %p\n", (void*)imadGetHit);
//For IMAD:
//FormID is at form address +C
//Animatable flag is at +28
//Duration is at +2C
SafeWrite8((UInt32*)imadGetHit + 0x28, 0x00);
SafeWrite32((UInt32*)imadGetHit + 0x2C, 0x000000);
}
The message shows properly, and putting (void*)imadGetHit allows it to be printed for some reason, which shouldn't really work since void means there is no conversion? Anywho, I can reference in a function expecting a string with that. But now that I've got the address, I need to set a byte at offset +0x28 and a dword at offset +0x2C.
I figured casting it to an integer and then adding the offsets to it would work, but no. I tried uintptr_t, but that didn't work either. So how do I do this?
Continue reading...
Here's the block of code:
void PatchGetHitIMAD() {
//This function must be called at PreLoadGame()
_MESSAGE("Starting");
TESForm* imadGetHit = LookupFormByID(0x162);
_MESSAGE("GetHit starting address is: %p\n", (void*)imadGetHit);
//For IMAD:
//FormID is at form address +C
//Animatable flag is at +28
//Duration is at +2C
SafeWrite8((UInt32*)imadGetHit + 0x28, 0x00);
SafeWrite32((UInt32*)imadGetHit + 0x2C, 0x000000);
}
The message shows properly, and putting (void*)imadGetHit allows it to be printed for some reason, which shouldn't really work since void means there is no conversion? Anywho, I can reference in a function expecting a string with that. But now that I've got the address, I need to set a byte at offset +0x28 and a dword at offset +0x2C.
I figured casting it to an integer and then adding the offsets to it would work, but no. I tried uintptr_t, but that didn't work either. So how do I do this?
Continue reading...