Skidnifrobous wrote: ↑Fri Aug 24, 2018 4:56 am
Hi, I tried this code and it worked in parts.
The items have infinite use only if there is more than 1 of the same item.
Things that you can cary only one at a time (like traps) just get consumed normaly.
So I compared to the old script table from the OP and made some modifications that worked fine for me:
Hmm, thanks for pointing that out.
After some further testing, it turns out we didn't really need all the base game code I copied over, at least for our purposes. (Since none of it was touched in the original and we were writing over it all, I put them all there as to not break anything.)
What's curious is that the part behind the second "jne" was the part that was removing single items, yet we didn't really do anything to it in the original, but it worked somehow. This has me scratching my head. (edit: Oh, wait. The second aobscan changed the cmp from 1 to 0.)
Also, the things behind the "ret" in the original code aren't really needed now since we aren't overwriting things in that direction.
(Which I really don't think we should have been doing since the base game "ret" basically marked the end of a function, and writing beyond that could break a different function call.)
So...fixed code.
Code: Select all
[ENABLE]
aobscanmodule(infitemuse,MonsterHunterWorld.exe,48 89 41 08 89 51 0C C3)
alloc(newmem,$1000,infitemuse)
label(code)
label(return)
registersymbol(infitemuse)
newmem:
cmp rbx,0
jne code
jmp return
code:
mov [rcx+0C],edx
jmp return
infitemuse-0C:
jmp newmem
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return:
aobscanmodule(infitemuse2,MonsterHunterWorld.exe,41 80 F8 01 75 06)
registersymbol(infitemuse2)
infitemuse2+03:
db 00
[DISABLE]
infitemuse-0C:
db 85 D2 75 0C 41 80 F8 01 75 06 31 C0 48 89 41 08 89 51 0C
unregistersymbol(infitemuse)
dealloc(newmem)
infitemuse2+03:
db 01
unregistersymbol(infitemuse2)