[1.13c][FIX] 32k life/mana/stamina display bug

Discuss Median XL!
User avatar
whist
Team Member
634 | 557
Legendary Popularity Badge
Has a thread with over 250.000 views
Legendary Love Badge
Earned over 500 cookies
Legendary Contribution Badge
Median XL Team Member
1.13c only

This issue keeps getting reported here and there over the years of Median, so I decided to make up a quick fix. As you may or may not know yet, the game experiences a display bug when you reach 32,768 life, mana or stamina. The display rolls over, leading to false & misleading display. Furthermore, in the case of mana, it causes problems when using spells (as the client skill handler checks the mana costs too, leading to uncastable spells). This library once injected into your game should allow you to reach up to 65k life/mana/stamina without experiencing any display overflow.

This fix will only work in single player, as it's a server<->client fix and cannot be applied to the realm. The plugin also comes with no injection method, use PlugY's dll loader feature. (If you don't know what I'm talking about, I won't bother to explain, would be nice if someone could write a quick tutorial to do this)

Enjoy.

Click Here To Download

For those that may be ineterested into implementing this, or fully expand the packet code to handle full values, or whatever, here are the places to patch. 6 places to patch. Changing the bits to read/write to 16 instead of 15 bits will allow values up to 65k to be displayed correctly. Expanding it beyond that requires completely rewriting both the sending & receiving code of the packet handlers (D2GS Srv2Clt Packet 0x95)

D2Game.dll (Base Address @ 0x6FC20000)

Code: Select all

6FCAB81A  |.  6A 0F         PUSH 0F                                  ;  bits to write
6FCAB81C  |.  50            PUSH EAX                                 ;  value to write
6FCAB81D  |.  8D4C24 18     LEA ECX,DWORD PTR SS:[ESP+18]
6FCAB821  |.  51            PUSH ECX                                 ;  pStream
6FCAB822  |.  E8 A7EAF7FF   CALL <JMP.&Fog.#10128>                   ;  call Fog.WriteBitStream


Code: Select all

6FCAB82C  |.  6A 0F         PUSH 0F                                  ;  bits to write
6FCAB82E  |.  52            PUSH EDX                                 ;  value to write
6FCAB82F  |.  8D4424 18     LEA EAX,DWORD PTR SS:[ESP+18]
6FCAB833  |.  50            PUSH EAX                                 ;  pStream
6FCAB834  |.  E8 95EAF7FF   CALL <JMP.&Fog.#10128>                   ;  call Fog.WriteBitStream


Code: Select all

6FCAB83E  |.  6A 0F         PUSH 0F                                  ;  bits to write
6FCAB840  |.  51            PUSH ECX                                 ;  value to write
6FCAB841  |.  8D5424 18     LEA EDX,DWORD PTR SS:[ESP+18]
6FCAB845  |.  52            PUSH EDX                                 ;  pStream
6FCAB846  |.  E8 83EAF7FF   CALL <JMP.&Fog.#10128>                   ;  call Fog.WriteBitStream


D2Client.dll (Base Address @ 0x6FAB0000)

Code: Select all

6FB5C1CE    6A 0F           PUSH 0F                                  ; bits to read
6FB5C1D0    8D4424 04       LEA EAX,DWORD PTR SS:[ESP+4]
6FB5C1D4    50              PUSH EAX                                 ; pStream
6FB5C1D5    E8 D6FDF5FF     CALL <JMP.&Fog.#10130>                   ; call Fog.ReadBitStream


Code: Select all

6FB5C1DA    6A 0F           PUSH 0F                                  ; bits to read
6FB5C1DC    8D4C24 04       LEA ECX,DWORD PTR SS:[ESP+4]
6FB5C1E0    51              PUSH ECX                                 ; pStream
6FB5C1E1    66:8946 01      MOV WORD PTR DS:[ESI+1],AX
6FB5C1E5    E8 C6FDF5FF     CALL <JMP.&Fog.#10130>                   ; call Fog.ReadBitStream


Code: Select all

6FB5C1EA    6A 0F           PUSH 0F                                  ; bits to read
6FB5C1EC    8D5424 04       LEA EDX,DWORD PTR SS:[ESP+4]
6FB5C1F0    52              PUSH EDX                                 ; pStream
6FB5C1F1    66:8946 03      MOV WORD PTR DS:[ESI+3],AX
6FB5C1F5    E8 B6FDF5FF     CALL <JMP.&Fog.#10130>                   ; call Fog.ReadBitStream


D2Template patching sample source code (D2Patch.h)

Code: Select all

static const DLLPatchStrc gptTemplatePatches[] =
{
   /*
      All your patches should be added here
      Keep it organized to save yourself some headache
   */
   
   {D2DLL_D2GAME, 0x8B81B, 0x01, (DWORD)0x00000010, FALSE},
   {D2DLL_D2GAME, 0x8B82D, 0x01, (DWORD)0x00000010, FALSE},
   {D2DLL_D2GAME, 0x8B83F, 0x01, (DWORD)0x00000010, FALSE},
   
   {D2DLL_D2CLIENT, 0xAC1CF, 0x01, (DWORD)0x00000010, FALSE},
   {D2DLL_D2CLIENT, 0xAC1DB, 0x01, (DWORD)0x00000010, FALSE},
   {D2DLL_D2CLIENT, 0xAC1EB, 0x01, (DWORD)0x00000010, FALSE},
   
   {D2DLL_INVALID} // this must be the last entry in the array
};
Edited by whist 7 years.
User avatar
Segolia
Djinn
541 | 38
Great Popularity Badge
Has a thread with over 50.000 views
Common Love Badge
Earned over 20 cookies
Common Guide Badge
Created a complete character guide
Add this in the [GENERAL] Line in your plugY.ini

DLLToLoad=D2StatsFix.dll

If you already have that line in your .ini, don't bother to add it in.
Literally takes 2 seconds whist, you're slacking :mrgreen:

If you wanna uninstall, just undo the previous steps.

edit: I forgot to mention that the .dll file has to be in your median xl mod's folder of course.
Edited by Segolia 8 years.
User avatar
RequiemLux
Sand Maggot
1125 | 288
Common Posting Badge
Posted over 1.000 messages
Legendary Popularity Badge
Has a thread with over 250.000 views
Great Love Badge
Earned over 100 cookies
Legendary Contribution Badge
Median XL Team Member
whist wrote:This issue keeps getting reported here and there over the years of Median, so I decided to make up a quick fix.


This is self explanatory on why you should be kept locked in a dungeon working on Median and doing nothing else 24/24.
In a month we would have Diablo IV, and maybe a dead body, but still. :twisted:
Thanks to Segolia too. All hail the whist :flip:
thaison
Skeleton
3 | 0
You can give yourself a shortened source or code
User avatar
ChuckNoRis
Flying Polar Buffalo
3006 | 81
Great Posting Badge
Posted over 2.500 messages
Legendary Popularity Badge
Has a thread with over 250.000 views
Common Love Badge
Earned over 20 cookies
Common Guide Badge
Created a complete character guide
many thanks ! This is great ! :D
Loluthinks
Cultist
24 | 1
Common Popularity Badge
Has a thread with over 10.000 views
after do all correctly, plugy dont want to start
User avatar
whist
Team Member
634 | 557
Legendary Popularity Badge
Has a thread with over 250.000 views
Legendary Love Badge
Earned over 500 cookies
Legendary Contribution Badge
Median XL Team Member
thaison wrote:You can give yourself a shortened source or code


See edited first post.
hellnecrotom
Fallen
1 | 0
My fellow warriors, the link is dead.

Does anyone still have the fix DLL?

Thanks
Elena32
Destroyer
6 | 0
Hi all I've been playing for a year and a half, my Amazon bug the mana display on the screen shows only 2 thousands although I have 7-8 thousand, help what to do
User avatar
ghostandme
Pit Knight
103 | 0
i don't know right/wrong?
location?
D:\Games\Diablo II\D2StatFix.dll
Image