Fixing the RandTransforms Bug

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
User avatar
Nefarius
Retired Admin
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains
Contact:

Hand-picked

Fixing the RandTransforms Bug

Post by Nefarius » Tue Sep 05, 2006 5:59 pm

Few people know this, but the game doesn't access RandTransforms.dat properly, when LoD was released Blizzard modified the lookup code, to include PalShift.dat infront of randtransforms.

UTrans currently works like this:

Code: Select all

0	palshift.dat 0
1	palshift.dat 1
2	palshift.dat 2
3	palshift.dat 3	[ 0 ]
4	palshift.dat 4	[ 1 ]
5	palshift.dat 5	[ 2 ]
6	palshift.dat 6	[ 3 ]
7	palshift.dat 7	[ 5 ]
8	randtransforms.dat 0
9	randtransforms.dat 1
10	randtransforms.dat 2
11	randtransforms.dat 3
12	randtransforms.dat 4
13	randtransforms.dat 5
14	randtransforms.dat 6
15	randtransforms.dat 7
16	randtransforms.dat 8
17	randtransforms.dat 9
18	randtransforms.dat 10
19	randtransforms.dat 11
20	randtransforms.dat 12
21	randtransforms.dat 13
22	randtransforms.dat 14
23	randtransforms.dat 15
24	randtransforms.dat 16
25	randtransforms.dat 17
26	randtransforms.dat 18
27	randtransforms.dat 19
28	randtransforms.dat 20
29	randtransforms.dat 21
[color=red]
30	randtransforms.dat 22
31	randtransforms.dat 23
32	randtransforms.dat 24
33	randtransforms.dat 25
34	randtransforms.dat 26
35	randtransforms.dat 27
36	randtransforms.dat 28
37	randtransforms.dat 29
[/color]
The red entries are not used by the game because Blizzard was acting stupid, properly changing the lookup code, but NOT altering the palshift assigner!

Here is the lookup code:

Code: Select all

6FAAE42E   A1 189ABA6F      MOV EAX,DWORD PTR DS:[6FBA9A18]
6FAAE433   85C0             TEST EAX,EAX
6FAAE435   74 36            JE SHORT D2CLIENT.6FAAE46D            [ NoUniqueShift == true ] [ goto PalShift.dat ]
6FAAE437   83EE 08          SUB ESI,8                             [ RandTransforms.dat - PalShift.dat ]
6FAAE43A   78 13            JS SHORT D2CLIENT.6FAAE44F            [ error if negative ]
6FAAE43C   83FE 1E          CMP ESI,1E
6FAAE43F   7D 0E            JGE SHORT D2CLIENT.6FAAE44F           [ error if too large ]
6FAAE441   8BC6             MOV EAX,ESI
This code works like it should.

You see it subtracts 8 from the index, so that UTrans 8 becomes index 0 (aka RandTransforms.dat 0).


The culprit code is this:

Code: Select all

6FB27B6B     83FF 1E        CMP EDI,1E
In a whole different part of D2Client.dll, this assigns palshift to a unit, here it checks vs. 1E, but whoot! 1E means 30, and not 38!, So the last 8 palettes are always ignored.

To make the game work like it should again:

Code: Select all

6FB27B6B     83FF 26        CMP EDI,26
Thats it, this will make all those bosses like Beetleburst and Ancient Kaa use the proper palettes again.
Last edited by Nefarius on Tue Sep 05, 2006 5:59 pm, edited 1 time in total.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

Grimz
Posts: 18
Joined: Tue Apr 12, 2016 10:59 pm

Re: Fixing the RandTransforms Bug

Post by Grimz » Thu Jan 23, 2020 8:42 pm

For anyone who works on 1.14d - This code can be found at

Code: Select all

004666A5
Last edited by Grimz on Sun Sep 13, 2020 7:22 pm, edited 2 times in total.

User avatar
thaison
Junior Member
Paladin
Posts: 108
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

Re: Fixing the RandTransforms Bug

Post by thaison » Fri Jan 24, 2020 11:49 am

[1.13c] - D2Client.dll

Code: Select all

000A7B1A   83FF 1E          CMP EDI,1E

Post Reply

Return to “Code Editing”