Charm Inventory/Zone 1.13c

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Charm Inventory/Zone 1.13c

Post by JayBrainDead » Sat May 26, 2018 3:49 pm

This is a topic that might be of interest for those of us who like the idea of having an enlarged inventory but then have second thoughts about it because charms could totally break the game balance.

I found a thread by Dav92, all credits to him, about this subject on an other forum : http://snej.org/forum/index.php?topic=48749.0

Now this is where I have to say that I progressed pretty far in my mod but my knowledge about code editing is still pretty limited. I try to tackle most challenge on my own
but I've really hit a wall trying to port this to 1.13c because I'm unable to find the function __stdcall AreCharmReqsMet(struct Unit *pItem, struct Unit *pUnit) using ollydbg,
the assembly code most look somewhat different in newer versions.

Thanks in advance to the more clever individuals who can help porting this ^^

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Charm Inventory/Zone 1.13c

Post by devurandom » Mon May 28, 2018 9:55 am

for 1.13c i have this in my notes

D2Common#11057 - CharmRequirements (#10840 in 1.10)
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Re: Charm Inventory/Zone 1.13c

Post by JayBrainDead » Tue May 29, 2018 5:38 pm

Thank you, you are a lifesaver. According to your notes the function should look like this :

Code: Select all

Address   Hex dump          Command                                  Comments
00011057    2BC2            SUB EAX,EDX
00011059    8B57 38         MOV EDX,DWORD PTR DS:[EDI+38]
0001105C    D1F8            SAR EAX,1
0001105E    2BC2            SUB EAX,EDX
00011060    03C8            ADD ECX,EAX
00011062    894C24 14       MOV DWORD PTR SS:[ESP+14],ECX
00011066    8B7C24 20       MOV EDI,DWORD PTR SS:[ESP+20]
0001106A    8B85 C4010000   MOV EAX,DWORD PTR SS:[EBP+1C4]
00011070    B9 C590C66A     MOV ECX,6AC690C5
00011075    F7E1            MUL ECX
00011077    8B8D C8010000   MOV ECX,DWORD PTR SS:[EBP+1C8]
0001107D    33F6            XOR ESI,ESI
0001107F    03C1            ADD EAX,ECX
00011081    13D6            ADC EDX,ESI
00011083    A8 01           TEST AL,01
00011085    8995 C8010000   MOV DWORD PTR SS:[EBP+1C8],EDX
0001108B    8985 C4010000   MOV DWORD PTR SS:[EBP+1C4],EAX
00011091    74 2A           JE SHORT 000110BD
00011093    8D5424 20       LEA EDX,[ESP+20]
00011097    52              PUSH EDX
00011098    8BD7            MOV EDX,EDI
0001109A    C1E2 04         SHL EDX,4
0001109D    81C2 F860DE6F   ADD EDX,6FDE60F8
000110A3    55              PUSH EBP
000110A4    E8 07F6FFFF     CALL 000106B0
000110A9    8B5424 20       MOV EDX,DWORD PTR SS:[ESP+20]
000110AD    8D4424 20       LEA EAX,[ESP+20]
000110B1    C1E2 04         SHL EDX,4
000110B4    50              PUSH EAX
000110B5    81C2 3861DE6F   ADD EDX,6FDE6138
000110BB    EB 28           JMP SHORT 000110E5
000110BD    8D4C24 20       LEA ECX,[ESP+20]
000110C1    8BD7            MOV EDX,EDI
000110C3    51              PUSH ECX
000110C4    C1E2 04         SHL EDX,4
000110C7    81C2 3861DE6F   ADD EDX,6FDE6138
000110CD    55              PUSH EBP
000110CE    E8 DDF5FFFF     CALL 000106B0
000110D3    8D5424 20       LEA EDX,[ESP+20]
000110D7    52              PUSH EDX
000110D8    8B5424 24       MOV EDX,DWORD PTR SS:[ESP+24]
000110DC    C1E2 04         SHL EDX,4
000110DF    81C2 F860DE6F   ADD EDX,6FDE60F8
000110E5    55              PUSH EBP
000110E6    E8 C5F5FFFF     CALL 000106B0
000110EB    8B45 10         MOV EAX,DWORD PTR SS:[EBP+10]
000110EE    33C9            XOR ECX,ECX
000110F0    3BC1            CMP EAX,ECX
000110F2    74 1F           JE SHORT 00011113
000110F4    8B78 34         MOV EDI,DWORD PTR DS:[EAX+34]
000110F7    8B5424 10       MOV EDX,DWORD PTR SS:[ESP+10]
000110FB    8B70 38         MOV ESI,DWORD PTR DS:[EAX+38]
000110FE    03FA            ADD EDI,EDX
00011100    8B5424 14       MOV EDX,DWORD PTR SS:[ESP+14]
00011104    03F2            ADD ESI,EDX
00011106    8978 34         MOV DWORD PTR DS:[EAX+34],EDI
00011109    8970 38         MOV DWORD PTR DS:[EAX+38],ESI
0001110C    8B40 24         MOV EAX,DWORD PTR DS:[EAX+24]
0001110F    3BC1            CMP EAX,ECX
00011111  ^ 75 E1           JNE SHORT 000110F4
00011113    55              PUSH EBP
00011114    8D5424 14       LEA EDX,[ESP+14]
00011118    8D7424 18       LEA ESI,[ESP+18]
0001111C    8D7C24 1C       LEA EDI,[ESP+1C]
00011120    8D5C24 24       LEA EBX,[ESP+24]
00011124    894C24 24       MOV DWORD PTR SS:[ESP+24],ECX
00011128    894C24 1C       MOV DWORD PTR SS:[ESP+1C],ECX
0001112C    894C24 18       MOV DWORD PTR SS:[ESP+18],ECX
00011130    894C24 14       MOV DWORD PTR SS:[ESP+14],ECX
00011134    E8 87C20100     CALL 0002D3C0
00011139    8B4424 20       MOV EAX,DWORD PTR SS:[ESP+20]
0001113D    8B5424 14       MOV EDX,DWORD PTR SS:[ESP+14]
00011141    8B4C24 18       MOV ECX,DWORD PTR SS:[ESP+18]
00011145    8945 1C         MOV DWORD PTR SS:[EBP+1C],EAX
00011148    2BD0            SUB EDX,EAX
0001114A    8B4424 10       MOV EAX,DWORD PTR SS:[ESP+10]
0001114E    5F              POP EDI
0001114F    2BC1            SUB EAX,ECX
00011151    5E              POP ESI
00011152    894D 20         MOV DWORD PTR SS:[EBP+20],ECX
00011155    8955 24         MOV DWORD PTR SS:[EBP+24],EDX
00011158    8945 28         MOV DWORD PTR SS:[EBP+28],EAX
0001115B    5D              POP EBP
0001115C    5B              POP EBX
0001115D    83C4 0C         ADD ESP,0C
00011160    C2 0400         RETN 4
00011163    CC              INT3
00011164    CC              INT3
00011165    CC              INT3
The first thing we need to do is find an empty space suitable to add the new code and jump to it. D2Common is pretty packed so you could probably write half the code in one space and jump to an other empty space but I dont really like that option. At #47887 I found this :

Code: Select all

Address   Hex dump          Command                                  Comments
00047884    04 07           ADD AL,7
00047886    07              POP ES                                   ; Modification of segment register
00047887    07              POP ES                                   ; Modification of segment register
00047888    07              POP ES                                   ; Modification of segment register
00047889    07              POP ES                                   ; Modification of segment register
0004788A    07              POP ES                                   ; Modification of segment register
0004788B    07              POP ES                                   ; Modification of segment register
0004788C    07              POP ES                                   ; Modification of segment register
0004788D    07              POP ES                                   ; Modification of segment register
0004788E    07              POP ES                                   ; Modification of segment register
0004788F    07              POP ES                                   ; Modification of segment register
00047890    07              POP ES                                   ; Modification of segment register
00047891    07              POP ES                                   ; Modification of segment register
00047892    07              POP ES                                   ; Modification of segment register
00047893    07              POP ES                                   ; Modification of segment register
00047894    07              POP ES                                   ; Modification of segment register
00047895    07              POP ES                                   ; Modification of segment register
00047896    07              POP ES                                   ; Modification of segment register
00047897    07              POP ES                                   ; Modification of segment register
00047898    07              POP ES                                   ; Modification of segment register
00047899    07              POP ES                                   ; Modification of segment register
0004789A    07              POP ES                                   ; Modification of segment register
0004789B    07              POP ES                                   ; Modification of segment register
0004789C    07              POP ES                                   ; Modification of segment register
0004789D    07              POP ES                                   ; Modification of segment register
0004789E    07              POP ES                                   ; Modification of segment register
0004789F    07              POP ES                                   ; Modification of segment register
000478A0    07              POP ES                                   ; Modification of segment register
000478A1    07              POP ES                                   ; Modification of segment register
000478A2    07              POP ES                                   ; Modification of segment register
000478A3    07              POP ES                                   ; Modification of segment register
000478A4    07              POP ES                                   ; Modification of segment register
000478A5    07              POP ES                                   ; Modification of segment register
000478A6    07              POP ES                                   ; Modification of segment register
000478A7    07              POP ES                                   ; Modification of segment register
000478A8    07              POP ES                                   ; Modification of segment register
000478A9    07              POP ES                                   ; Modification of segment register
000478AA    07              POP ES                                   ; Modification of segment register
000478AB    07              POP ES                                   ; Modification of segment register
000478AC    07              POP ES                                   ; Modification of segment register
000478AD    07              POP ES                                   ; Modification of segment register
000478AE    07              POP ES                                   ; Modification of segment register
000478AF    07              POP ES                                   ; Modification of segment register
000478B0    07              POP ES                                   ; Modification of segment register
000478B1    07              POP ES                                   ; Modification of segment register
000478B2    07              POP ES                                   ; Modification of segment register
000478B3    07              POP ES                                   ; Modification of segment register
000478B4    07              POP ES                                   ; Modification of segment register
000478B5    07              POP ES                                   ; Modification of segment register
000478B6    07              POP ES                                   ; Modification of segment register
000478B7    07              POP ES                                   ; Modification of segment register
000478B8    07              POP ES                                   ; Modification of segment register
000478B9    07              POP ES                                   ; Modification of segment register
000478BA    07              POP ES                                   ; Modification of segment register
000478BB    07              POP ES                                   ; Modification of segment register
000478BC    07              POP ES                                   ; Modification of segment register
000478BD    07              POP ES                                   ; Modification of segment register
000478BE    07              POP ES                                   ; Modification of segment register
000478BF    07              POP ES                                   ; Modification of segment register
000478C0    07              POP ES                                   ; Modification of segment register
000478C1    07              POP ES                                   ; Modification of segment register
000478C2    07              POP ES                                   ; Modification of segment register
000478C3    07              POP ES                                   ; Modification of segment register
000478C4    07              POP ES                                   ; Modification of segment register
000478C5    07              POP ES                                   ; Modification of segment register
000478C6    07              POP ES                                   ; Modification of segment register
000478C7    07              POP ES                                   ; Modification of segment register
000478C8    07              POP ES                                   ; Modification of segment register
000478C9    07              POP ES                                   ; Modification of segment register
000478CA    07              POP ES                                   ; Modification of segment register
000478CB    07              POP ES                                   ; Modification of segment register
000478CC    07              POP ES                                   ; Modification of segment register
000478CD    07              POP ES                                   ; Modification of segment register
000478CE    07              POP ES                                   ; Modification of segment register
000478CF    07              POP ES                                   ; Modification of segment register
000478D0    07              POP ES                                   ; Modification of segment register
000478D1    07              POP ES                                   ; Modification of segment register
000478D2    07              POP ES                                   ; Modification of segment register
000478D3    07              POP ES                                   ; Modification of segment register
000478D4    07              POP ES                                   ; Modification of segment register
000478D5    07              POP ES                                   ; Modification of segment register
000478D6    07              POP ES                                   ; Modification of segment register
000478D7    07              POP ES                                   ; Modification of segment register
000478D8    07              POP ES                                   ; Modification of segment register
000478D9    07              POP ES                                   ; Modification of segment register
000478DA    07              POP ES                                   ; Modification of segment register
000478DB    07              POP ES                                   ; Modification of segment register
000478DC    07              POP ES                                   ; Modification of segment register
000478DD    07              POP ES                                   ; Modification of segment register
000478DE    07              POP ES                                   ; Modification of segment register
000478DF    07              POP ES                                   ; Modification of segment register
000478E0    05 06CCCCCC     ADD EAX,CCCCCC06
000478E5    CC              INT3
I might be missing the point but I dont think you need to POP the top of the stack into ES that many times. Can we take advantage of this to add the new code ?

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Charm Inventory/Zone 1.13c

Post by devurandom » Tue May 29, 2018 7:47 pm

doesn't match D2Common.#11057 [1.13c]

in OllyDbg use keyboard shortcut Ctrl G, then type 11057, then click on the matching label to the ordinal.. quicker way to find it. Also what your pointing to for slack space isn't. it has data.. slack space is filled with 00's at the end of the file..

Code: Select all

6FD787D0  /$  56            PUSH ESI                                 ; D2Common.#11057(guessed Arg1,Arg2)
6FD787D1  |.  8B7424 08     MOV ESI,DWORD PTR SS:[ARG.1]
6FD787D5  |.  85F6          TEST ESI,ESI
6FD787D7  |.  74 2E         JZ SHORT 6FD78807
6FD787D9  |.  8B0E          MOV ECX,DWORD PTR DS:[ESI]
6FD787DB  |.  83F9 04       CMP ECX,4
6FD787DE  |.  75 2D         JNE SHORT 6FD7880D
6FD787E0  |.  8B46 14       MOV EAX,DWORD PTR DS:[ESI+14]
6FD787E3  |.  85C0          TEST EAX,EAX
6FD787E5  |.  74 0A         JZ SHORT 6FD787F1
6FD787E7  |.  8B40 18       MOV EAX,DWORD PTR DS:[EAX+18]
6FD787EA  |.  25 00010000   AND EAX,00000100
6FD787EF  |.  75 16         JNZ SHORT 6FD78807
6FD787F1  |>  83F9 04       CMP ECX,4
6FD787F4  |.  75 17         JNE SHORT 6FD7880D
6FD787F6  |.  8B46 14       MOV EAX,DWORD PTR DS:[ESI+14]
6FD787F9  |.  85C0          TEST EAX,EAX
6FD787FB  |.  74 10         JZ SHORT 6FD7880D
6FD787FD  |.  8B40 18       MOV EAX,DWORD PTR DS:[EAX+18]
6FD78800  |.  25 00400000   AND EAX,00004000
6FD78805  |.  74 06         JZ SHORT 6FD7880D
6FD78807  |>  33C0          XOR EAX,EAX
6FD78809  |.  5E            POP ESI
6FD7880A  |.  C2 0800       RETN 8
6FD7880D  |>  6A 0D         PUSH 0D                                  ; /Arg2 = 0D
6FD7880F  |.  56            PUSH ESI                                 ; |Arg1 => [ARG.1]
6FD78810  |.  E8 1BBCFFFF   CALL #10744                              ; \D2Common.#10744
6FD78815  |.  85C0          TEST EAX,EAX
6FD78817  |.^ 74 EE         JZ SHORT 6FD78807
6FD78819  |.  833E 04       CMP DWORD PTR DS:[ESI],4
6FD7881C  |.^ 75 E9         JNE SHORT 6FD78807
6FD7881E  |.  8B46 14       MOV EAX,DWORD PTR DS:[ESI+14]
6FD78821  |.  85C0          TEST EAX,EAX
6FD78823  |.^ 74 E2         JZ SHORT 6FD78807
6FD78825  |.  8A48 45       MOV CL,BYTE PTR DS:[EAX+45]
6FD78828  |.  84C9          TEST CL,CL
6FD7882A  |.^ 75 DB         JNZ SHORT 6FD78807
6FD7882C  |.  8B4424 0C     MOV EAX,DWORD PTR SS:[ARG.2]
6FD78830  |.  6A 00         PUSH 0                                   ; /Arg6 = 0
6FD78832  |.  6A 00         PUSH 0                                   ; |Arg5 = 0
6FD78834  |.  6A 00         PUSH 0                                   ; |Arg4 = 0
6FD78836  |.  6A 00         PUSH 0                                   ; |Arg3 = 0
6FD78838  |.  50            PUSH EAX                                 ; |Arg2 => [ARG.2]
6FD78839  |.  56            PUSH ESI                                 ; |Arg1 => [ARG.1]
6FD7883A  |.  E8 71E5FFFF   CALL #10244                              ; \D2Common.#10244
6FD7883F  |.  F7D8          NEG EAX                                  ; Converts EAX to boolean
6FD78841  |.  1BC0          SBB EAX,EAX
6FD78843  |.  F7D8          NEG EAX
6FD78845  |.  5E            POP ESI
6FD78846  \.  C2 0800       RETN 8


Code: Select all

6FDD87E0      00            DB 00
6FDD87E1      00            DB 00
6FDD87E2      00            DB 00
6FDD87E3      00            DB 00
6FDD87E4      00            DB 00
6FDD87E5      00            DB 00
6FDD87E6      00            DB 00
6FDD87E7      00            DB 00
6FDD87E8      00            DB 00
6FDD87E9      00            DB 00
6FDD87EA      00            DB 00
6FDD87EB      00            DB 00
6FDD87EC      00            DB 00
6FDD87ED      00            DB 00
6FDD87EE      00            DB 00
6FDD87EF      00            DB 00
6FDD87F0      00            DB 00
6FDD87F1      00            DB 00
6FDD87F2      00            DB 00
6FDD87F3      00            DB 00
6FDD87F4      00            DB 00
6FDD87F5      00            DB 00
6FDD87F6      00            DB 00
6FDD87F7      00            DB 00
6FDD87F8      00            DB 00
6FDD87F9      00            DB 00
6FDD87FA      00            DB 00
6FDD87FB      00            DB 00
6FDD87FC      00            DB 00
6FDD87FD      00            DB 00
6FDD87FE      00            DB 00
6FDD87FF      00            DB 00
6FDD8800      00            DB 00
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Re: Charm Inventory/Zone 1.13c

Post by JayBrainDead » Wed May 30, 2018 1:48 am

devurandom wrote:
Tue May 29, 2018 7:47 pm
in OllyDbg use keyboard shortcut Ctrl G, then type 11057, then click on the matching label to the ordinal.. quicker way to find it.
In my case, Ctrl G is a shortcut for Go to expression then typing 11057 just brings me to offset 11057 but I was able to find it at offset 287D0 using the bit of code you posted right after, that was VERY helpful. :)

I got the charms to only work inside the zone but the '' Keep in inventory to gain bonus '' message does not display in red. To do so we need to call the two functions ( D2Common.#10731 and D2Common.#10840 which we found earlier ) from the D2client dll. I dont think I've ever had to do that but i can probably? figure it out ^^ Do you have an idea where D2Common.#10731 is ?

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Charm Inventory/Zone 1.13c

Post by devurandom » Wed May 30, 2018 2:57 am

Yes, I know where they're at.. But the 2 functions your looking for, are called from inside the function your looking at now. ordinal #'s always get changed with every version. ordinals your looking for are not the ones shown in the 1.10 example. I'll leave that for your homework to figure out which one is which.

Maybe its a good idea to go back and copy the ASM from the 1.10 function and compare it to the ASM for 1.13c function.
;)
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

JayBrainDead
Posts: 58
Joined: Fri Mar 09, 2018 10:43 pm

Re: Charm Inventory/Zone 1.13c

Post by JayBrainDead » Wed May 30, 2018 6:25 am

This is what I've got so far and know its wrong but i cant figure it out, i feel like the dumb kid in school ^^
Also I definitely need some sleep Lol

This is where the code needs to be added at the end but oviously you need to jump to an empty space first

Code: Select all

Address   Hex dump          Command                                  Comments
0008E2F0    8B0D 48BCB86F   MOV ECX,DWORD PTR DS:[6FB8BC48]
0008E2F6    83EC 08         SUB ESP,8
0008E2F9    56              PUSH ESI
0008E2FA    8B35 28B8BC6F   MOV ESI,DWORD PTR DS:[6FBCB828]
0008E300    57              PUSH EDI
0008E301    8BF8            MOV EDI,EAX
0008E303    833D 34BCBC6F 0 CMP DWORD PTR DS:[6FBCBC34],1
0008E30A    75 0F           JNE SHORT 0008E31B
0008E30C    8BC1            MOV EAX,ECX
0008E30E    99              CDQ
0008E30F    2BC2            SUB EAX,EDX
0008E311    D1F8            SAR EAX,1
0008E313    3BF0            CMP ESI,EAX
0008E315    0F8C 14010000   JL 0008E42F
0008E31B    A1 4CBCB86F     MOV EAX,DWORD PTR DS:[6FB8BC4C]
0008E320    8B15 24B8BC6F   MOV EDX,DWORD PTR DS:[6FBCB824]
0008E326    83C0 D9         ADD EAX,-27
0008E329    3BD0            CMP EDX,EAX
0008E32B    0F8D FE000000   JGE 0008E42F
0008E331    8BC1            MOV EAX,ECX
0008E333    99              CDQ
0008E334    2BC2            SUB EAX,EDX
0008E336    D1F8            SAR EAX,1
0008E338    3BF0            CMP ESI,EAX
0008E33A    7D 10           JGE SHORT 0008E34C
0008E33C    5F              POP EDI
0008E33D    C705 68BCBC6F 0 MOV DWORD PTR DS:[6FBCBC68],0
0008E347    5E              POP ESI
0008E348    83C4 08         ADD ESP,8
0008E34B    C3              RETN
0008E34C    53              PUSH EBX
0008E34D    E8 B0DEF7FF     CALL 0000C202
0008E352    8BF0            MOV ESI,EAX
0008E354    85F6            TEST ESI,ESI
0008E356    0F84 D3000000   JE 0008E42F
0008E35C    A1 2CBCBC6F     MOV EAX,DWORD PTR DS:[6FBCBC2C]
0008E361    85C0            TEST EAX,EAX
0008E363    0F84 C6000000   JE 0008E42F
0008E369    55              PUSH EBP
0008E36A    68 DA060000     PUSH 6DA
0008E36F    68 8C47B86F     PUSH 6FB8478C
0008E374    8D4C24 17       LEA ECX,[ESP+17]
0008E378    51              PUSH ECX
0008E379    8D5424 1A       LEA EDX,[ESP+1A]
0008E37D    52              PUSH EDX
0008E37E    56              PUSH ESI
0008E37F    E8 72E4F7FF     CALL 0000C7F6
0008E384    0FB657 14       MOVZX EDX,BYTE PTR DS:[EDI+14]
0008E388    0FB66C24 0E     MOVZX EBP,BYTE PTR SS:[ESP+0E]
0008E38D    8B0D 68BCBC6F   MOV ECX,DWORD PTR DS:[6FBCBC68]
0008E393    0FAFD5          IMUL EDX,EBP
0008E396    8D0489          LEA EAX,[ECX*4+ECX]
0008E399    C1E0 02         SHL EAX,2
0008E39C    0FB6A8 B0BCBC6F MOVZX EBP,BYTE PTR DS:[EAX+6FBCBCB0]
0008E3A3    2BEA            SUB EBP,EDX
0008E3A5    8B90 A0BCBC6F   MOV EDX,DWORD PTR DS:[EAX+6FBCBCA0]
0008E3AB    D1FD            SAR EBP,1
0008E3AD    03EA            ADD EBP,EDX
0008E3AF    0FB657 15       MOVZX EDX,BYTE PTR DS:[EDI+15]
0008E3B3    0FB67C24 0F     MOVZX EDI,BYTE PTR SS:[ESP+0F]
0008E3B8    0FAFD7          IMUL EDX,EDI
0008E3BB    0FB6B8 B1BCBC6F MOVZX EDI,BYTE PTR DS:[EAX+6FBCBCB1]
0008E3C2    2BFA            SUB EDI,EDX
0008E3C4    896C24 10       MOV DWORD PTR SS:[ESP+10],EBP
0008E3C8    8BA8 A8BCBC6F   MOV EBP,DWORD PTR DS:[EAX+6FBCBCA8]
0008E3CE    D1FF            SAR EDI,1
0008E3D0    51              PUSH ECX
0008E3D1    03FD            ADD EDI,EBP
0008E3D3    56              PUSH ESI
0008E3D4    897C24 18       MOV DWORD PTR SS:[ESP+18],EDI
0008E3D8    E8 49E4F7FF     CALL 0000C826
0008E3DD    85C0            TEST EAX,EAX
0008E3DF    5D              POP EBP
0008E3E0    74 18           JE SHORT 0008E3FA
0008E3E2    A1 FCBBBC6F     MOV EAX,DWORD PTR DS:[6FBCBBFC]
0008E3E7    6A 00           PUSH 0
0008E3E9    6A 00           PUSH 0
0008E3EB    6A 00           PUSH 0
0008E3ED    6A 00           PUSH 0
0008E3EF    50              PUSH EAX
0008E3F0    56              PUSH ESI
0008E3F1    E8 A2E4F7FF     CALL 0000C898
0008E3F6    E9 F30A0600     JMP 000EEEEE
Then this is the code I added

Code: Select all

Address   Hex dump          Command                                  Comments
000EEEEE    85C0            TEST EAX,EAX
000EEEF0  ^ 0F84 F4F5F9FF   JE 0008E4EA
000EEEF6    6A 0D           PUSH 0D
000EEEF8    56              PUSH ESI
000EEEF9    E8 10E7FFFF     CALL 000ED60E
000EEEFE    85C0            TEST EAX,EAX
000EEF00  ^ 0F84 F8F4F9FF   JE 0008E3FE
000EEF06    8B44E4 20       MOV EAX,DWORD PTR SS:[ESP+20]
000EEF0A    50              PUSH EAX
000EEF0B    56              PUSH ESI
000EEF0C    E8 19EFFFFF     CALL 000EDE2A
000EEF11    85C0            TEST EAX,EAX
000EEF13  ^ 0F84 D1F5F9FF   JE 0008E4EA
000EEF19  ^ E9 E0F4F9FF     JMP 0008E3FE
Those two are wrong but yeah, I guess I Need a good night sleep before diving in again ^^
( At Least theese two )
000EEEF9 E8 10E7FFFF CALL 000ED60E
000EEF0C E8 19EFFFFF CALL 000EDE2A

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Charm Inventory/Zone 1.13c

Post by devurandom » Wed May 30, 2018 8:44 am

sorry I don't have time to port it for you, I'm offering some hints, to get you started.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
szumigajowy
Senior Moderator
Serf
Posts: 4
Joined: Mon Jul 17, 2017 5:28 pm
Poland

Re: Charm Inventory/Zone 1.13c

Post by szumigajowy » Wed May 30, 2018 7:22 pm

Here is a description if someone needs
D2Common.11057 1.13c (0x287D0//6FD787D0)

Code: Select all

Address   Hex dump          Command                                  Comments
6FD787D0  /$  56            PUSH ESI                                 ; D2Common.#11057(guessed Arg1,Arg2)
6FD787D1  |.  8B7424 08     MOV ESI,DWORD PTR SS:[ARG.1]
6FD787D5  |.  85F6          TEST ESI,ESI
6FD787D7  |.  74 2E         JZ SHORT 6FD78807
6FD787D9  |.  8B0E          MOV ECX,DWORD PTR DS:[ESI]
6FD787DB  |.  83F9 04       CMP ECX,4
6FD787DE  |.  75 2D         JNE SHORT 6FD7880D
6FD787E0  |.  8B46 14       MOV EAX,DWORD PTR DS:[ESI+14]
6FD787E3  |.  85C0          TEST EAX,EAX
6FD787E5  |.  74 0A         JZ SHORT 6FD787F1
6FD787E7  |.  8B40 18       MOV EAX,DWORD PTR DS:[EAX+18]
6FD787EA  |.  25 00010000   AND EAX,00000100
6FD787EF  |.  75 16         JNZ SHORT 6FD78807
6FD787F1  |>  83F9 04       CMP ECX,4
6FD787F4  |.  75 17         JNE SHORT 6FD7880D
6FD787F6  |.  8B46 14       MOV EAX,DWORD PTR DS:[ESI+14]
6FD787F9  |.  85C0          TEST EAX,EAX
6FD787FB  |.  74 10         JZ SHORT 6FD7880D
6FD787FD  |.  8B40 18       MOV EAX,DWORD PTR DS:[EAX+18]
6FD78800  |.  25 00400000   AND EAX,00004000
6FD78805  |.  74 06         JZ SHORT 6FD7880D
6FD78807  |>  33C0          XOR EAX,EAX
6FD78809  |.  5E            POP ESI
6FD7880A  |.  C2 0800       RETN 8
6FD7880D  |>  6A 0D         PUSH 0D                                  ; /Arg2 = 0D
6FD7880F  |.  56            PUSH ESI                                 ; |Arg1 => [ARG.1]
6FD78810  |.  E8 1BBCFFFF   CALL #10744                              ; \D2Common.#10744
6FD78815  |.  85C0          TEST EAX,EAX
6FD78817  |.^ 74 EE         JZ SHORT 6FD78807
6FD78819  |.  833E 04       CMP DWORD PTR DS:[ESI],4
6FD7881C  |.^ 75 E9         JNE SHORT 6FD78807
6FD7881E  |.  8B46 14       MOV EAX,DWORD PTR DS:[ESI+14]
6FD78821  |.  85C0          TEST EAX,EAX
6FD78823  |.^ 74 E2         JZ SHORT 6FD78807
6FD78825  |.  8A48 45       MOV CL,BYTE PTR DS:[EAX+45]
6FD78828  |.  84C9          TEST CL,CL
6FD7882A  |.^ 75 DB         JNZ SHORT 6FD78807
6FD7882C  |.  8B4424 0C     MOV EAX,DWORD PTR SS:[ARG.2]
6FD78830  |.  6A 00         PUSH 0                                   ; /Arg6 = 0
6FD78832  |.  6A 00         PUSH 0                                   ; |Arg5 = 0
6FD78834  |.  6A 00         PUSH 0                                   ; |Arg4 = 0
6FD78836  |.  6A 00         PUSH 0                                   ; |Arg3 = 0
6FD78838  |.  50            PUSH EAX                                 ; |Arg2 => [ARG.2]
6FD78839  |.  56            PUSH ESI                                 ; |Arg1 => [ARG.1]
6FD7883A  |.  E8 71E5FFFF   CALL #10244                              ; \D2Common.#10244
6FD7883F  |.  F7D8          NEG EAX                                  ; Converts EAX to boolean
6FD78841  |.  1BC0          SBB EAX,EAX
6FD78843  |.  F7D8          NEG EAX
6FD78845  |.  5E            POP ESI
6FD78846      E9 89FF0500   JMP 6FDD87D4 ;|Jump to custom code
New custom code (0x887D4//6FDD87D4)

Code: Select all

CPU Disasm
Address   Hex dump          Command                                  Comments
6FDD87D4      85C0          TEST EAX,EAX
6FDD87D6      75 03         JNE SHORT 6FDD87DB
6FDD87D8      C2 0800       RETN 8
6FDD87DB      8B44E4 04     MOV EAX,DWORD PTR SS:[ESP+4]
6FDD87DF      8B40 2C       MOV EAX,DWORD PTR DS:[EAX+2C]
6FDD87E2      8378 0C 05    CMP DWORD PTR DS:[EAX+0C],5 	//Left border pos x (change to your value)
6FDD87E6      72 1A         JB SHORT 6FDD8802
6FDD87E8      8378 0C 07    CMP DWORD PTR DS:[EAX+0C],7 	//Right border pos x (change to your value)
6FDD87EC      77 14         JA SHORT 6FDD8802
6FDD87EE      8378 10 03    CMP DWORD PTR DS:[EAX+10],3 	//Top border pos y (change to your value)
6FDD87F2      72 0E         JB SHORT 6FDD8802
6FDD87F4      8378 10 04    CMP DWORD PTR DS:[EAX+10],4		//Bottom border pos y (change to your value)
6FDD87F8      77 08         JA SHORT 6FDD8802
6FDD87FA      B8 01000000   MOV EAX,1
6FDD87FF      C2 0800       RETN 8
6FDD8802      31C0          XOR EAX,EAX
6FDD8804      C2 0800       RETN 8

File with changes:
https://mega.nz/#!0jIGzTpQ!UbmVJdqrx8PP ... i5PR3Dx484

jessedazebra
Junior Member
Paladin
Posts: 144
Joined: Sun Nov 11, 2012 9:46 am
Zimbabwe

Re: Charm Inventory/Zone 1.13c

Post by jessedazebra » Wed Jun 13, 2018 11:27 am

szumigajowy wrote:
Wed May 30, 2018 7:22 pm
Here is a description if someone needs
D2Common.11057 1.13c (0x287D0//6FD787D0)
When I put a charm into inventory I got this error. Tried both your file and did the changes myself with ollydbg. Also tried default 1.13c without any modifications, still was getting this error.
PS.I changed border positions as well just to suit my edited inventory, so i guess it's not the problem.
Image

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Charm Inventory/Zone 1.13c

Post by Necrolis » Wed Jun 13, 2018 4:57 pm

You need to post the actual error dump for the D2 log file, as the error code is a generic Windows error code.
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

jessedazebra
Junior Member
Paladin
Posts: 144
Joined: Sun Nov 11, 2012 9:46 am
Zimbabwe

Re: Charm Inventory/Zone 1.13c

Post by jessedazebra » Thu Jun 14, 2018 3:10 pm

Well, this log file's too big, i think i need to get it under spoiler or whatever.
EDIT: Ok, I didn't find any working spoiler tags here, so i just leave a pastebin link then.
https://pastebin.com/cUqnaJQ4

Update: the crash occurs because of conflict with multires plugin. I think it's time to give up on this charm inventory then :D
Image

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Charm Inventory/Zone 1.13c

Post by devurandom » Sun Feb 17, 2019 6:34 am

Fun Fact - Importing charms into inventory, with character editors, is a great way to mess up the values on your character screen.

Softcoding Charm Zone has the same effect, when users don't move all the charms out of their inventory, then restart with the Charm Zone option disabled.

Code works great if hardcoded, but it's not such a good idea for softcoding.
I'm sure there's a way to fix it, but I'm too lazy atm.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
mmpx222
Junior Member
Paladin
Posts: 154
Joined: Sat Apr 26, 2014 9:19 am
Korea South

Re: Charm Inventory/Zone 1.13c

Post by mmpx222 » Sun Feb 17, 2019 8:15 am

devurandom wrote:
Sun Feb 17, 2019 6:34 am
Softcoding Charm Zone has the same effect, when users don't move all the charms out of their inventory, then restart with the Charm Zone option disabled.
Excuse me for derailing, but how is it possible to softcode the charm zone? Do you mean it's possible to limit charm active zone with only TXT and DC6 files? Or are you referring to the classic "Charm Weight" systems that reduce player Life to 1?
D2TXT / D2INI - Python scripts for editing TXT files, or converting between TXT ↔ INI files

User avatar
devurandom
Forum Regular
Angel
Posts: 897
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Charm Inventory/Zone 1.13c

Post by devurandom » Sun Feb 17, 2019 12:27 pm

Maybe a mistake on my part, but nothing to do with txt.

What I meant by that is: giving the user a softcoded option where they can apply a patch to execute the code for the charm zone functions to work, or disable the patch.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

User avatar
Conqueror
Posts: 62
Joined: Mon Oct 23, 2017 8:03 pm
Argentina

Re: Charm Inventory/Zone 1.13c

Post by Conqueror » Sun Dec 08, 2019 10:20 pm

jessedazebra wrote:
Thu Jun 14, 2018 3:10 pm
Well, this log file's too big, i think i need to get it under spoiler or whatever.
EDIT: Ok, I didn't find any working spoiler tags here, so i just leave a pastebin link then.
https://pastebin.com/cUqnaJQ4

Update: the crash occurs because of conflict with multires plugin. I think it's time to give up on this charm inventory then :D
Image
Solution: change the charm zone code

Use this address 6FDBC1ED.

6FDD87D6 address is used by load HighResolution.dll

lee_lee
Posts: 10
Joined: Sun Dec 08, 2019 6:16 am
Vietnam

Re: Charm Inventory/Zone 1.13c

Post by lee_lee » Fri Dec 13, 2019 6:21 am

so, have problem solved yet?

User avatar
Conqueror
Posts: 62
Joined: Mon Oct 23, 2017 8:03 pm
Argentina

Re: Charm Inventory/Zone 1.13c

Post by Conqueror » Fri Dec 13, 2019 10:40 pm

lee_lee wrote:
Fri Dec 13, 2019 6:21 am
so, have problem solved yet?
Yes.

Use this address 6FDBC1ED in D2Common.

Copy and Paste the asembler code in that direction with respective jump (jb and ja) and go.

D2Common.11057 1.13c (0x287D0//6FD78843)

Code: Select all

6FD78843  |.  F7D8          NEG EAX
6FD78845  |.  5E            POP ESI
6FD78846      E9 89FF0500   JMP 6FDBC1ED ;|Jump to custom code

Code: Select all

Hex dump          Command                                  Comments
85C0          TEST EAX,EAX
75 03         JNE SHORT 6FDBC1F4
C2 0800       RETN 8
8B4424 04      MOV EAX,DWORD PTR SS:[ESP+4]
8B40 2C       MOV EAX,DWORD PTR DS:[EAX+2C]
8378 0C 05    CMP DWORD PTR DS:[EAX+0C],5 	//Left border pos x (change to your value)
72 1A         JB SHORT 6FDBC21B
8378 0C 07    CMP DWORD PTR DS:[EAX+0C],7 	//Right border pos x (change to your value)
77 14         JA SHORT 6FDBC21B
8378 10 03    CMP DWORD PTR DS:[EAX+10],3 	//Top border pos y (change to your value)
72 0E         JB SHORT 6FDBC21B
8378 10 04    CMP DWORD PTR DS:[EAX+10],4		//Bottom border pos y (change to your value)
77 08         JA SHORT 6FDBC21B
B8 01000000   MOV EAX,1
C2 0800       RETN 8
33C0           XOR EAX,EAX
C2 0800       RETN 8

scout2k
Posts: 22
Joined: Sat Aug 26, 2017 1:19 am

Re: Charm Inventory/Zone 1.13c

Post by scout2k » Tue Dec 24, 2019 9:25 am

It works thx :D

Post Reply

Return to “Code Editing”