Posted: Sun Aug 06, 2023 10:26 pm Post subject: DB explanation
Here is an infinite pet sprint script from a No Man's Sky table.
Code:
aobscanmodule(petinfsprint,NMS.exe,76 EA F3 0F 11 89 * * 00 00 C3)
registersymbol(petinfsprint)
petinfsprint+5:
db 81
[DISABLE]
petinfsprint+5:
db 89
unregistersymbol(petinfsprint)
I understand hex 81 is replacing hex 89 in the 5th position of the array, but not sure how how the person making the script knew what 81 means. Normally, I would just nop the instruction - Just trying to get a better understanding of this. Is this what's known as a db script?
All instructions are stored in memory as bytes. In this case, that script is changing the instruction `movss [rcx+0000????],xmm1` to `movss [rcx+0000????],xmm0`.
It's a clever way of avoiding the offset in the AOB pattern. This can also be used when you simply don't feel like allocating memory to do something. e.g. turning a jcc into a jmp, replacing an instruction with `nop`, etc.
Modifying code inline like that (as opposed to a more standard code injection) is a little dangerous. You need to know exactly how many bytes an instruction will assemble to. If you're off by a single byte, you'll crash the game. It's often safer to "assemble" the instruction(s) yourself and modify the bytes manually- that way, you have full control over how many bytes you're overwriting.
The safest thing you can do to create such scripts yourself is to allocate some memory and play around there. e.g. assemble the instruction(s) you want to replace the original code with in that allocated memory, compare it against the injection point, and you'll know what bytes to modify and how.
It's faster to do it inline at the injection point, but more dangerous. Make sure the game won't run that section of code while you're playing around with it. Pause the process in the "Advanced Options" window if needed. I also enable write logging (Edit -> Settings) to more easily fix something if I screw it up. _________________
I don't know where I'm going, but I'll figure it out when I get there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum