I have been away from auto-assembly in Lua for some time and my memory is not great.
Let's take this example:
Code: Select all
[ENABLE] aobscanmodule(DeathPenalty,DARKSOULS.exe,89 56 38 8B 53 7C 33 C9 89 8B 8C 00 00 00 89 56 34 89 4B 7C 8B 48 04 E8 59 52 FE FF) alloc(newmem0,$1000) label(return) newmem0: nop //mov [esi+38],edx - Souls moved to Bloodstain mov edx,[ebx+7C] xor ecx,ecx nop //mov [ebx+0000008C],ecx - Player's Souls set to 0 nop //mov [esi+34],edx - Humanity moved to Bloodstain nop //mov [ebx+7C],ecx - Player's Humanity set to 0 mov ecx,[eax+04] nop //call DATA.exe+986100 - Player's Hollowification jmp return DeathPenalty: jmp newmem0 db 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 return: registersymbol(DeathPenalty) [DISABLE] DeathPenalty: db 89 56 38 8B 53 7C 33 C9 89 8B 8C 00 00 00 89 56 34 89 4B 7C 8B 48 04 E8 59 52 FE FF unregistersymbol(DeathPenalty) dealloc(newmem0)
Paste it into proper editor or count by eye. We count from 1 in Lua, not from 0.
Line 2: Does aobscan declare a label where it lands?
Line 5: A label return is declared but not defined. What address does this label point to? Why was it necessary to declare it here?
Line 21: That return label is used but why is it indented? Is it because this is where the label address is defined implicitly on compilation? And since this isn't strict, isn't this definition implicitly declaring the label making the previous declaration obsolete?
Line 22: Does DeathPenalty need to be registered as a symbol if it is not used in any other scripts?
So I understand how this script works in memory and one of the assumptions sets even makes me understand why is it written this way, but then if my assumptions are wrong — then I'm lost. So is this code whack or is my understanding of it whack or neither?
I need confirmations/clarifications.