View Full Version: RE2 PLDs

Resident Evil 1 2 3 > EMD/PLD/PLW INFO > RE2 PLDs


Title: RE2 PLDs
Description: I forgot to post this


Enrico Marini - October 18, 2008 03:47 PM (GMT)
Right, here is my attempt to explain PLDs and EMDs.

Both PLDs and EMDs have at the beginning a pointer which points to a list of pointers
at the end of the file. This pointer must match the beginning of the pointer list at the
end of the PLD/EMD.

user posted image

Red is the Pointer, read from right to left


Green is the Animation Play/number of frames index. Yellow is the Model load setup and
Animation tranformations (I have not solved how these work yet). Blue is the model
data. Purple is the TIM file.

user posted image

The selected area is the starting points for each of the body parts, which
I call the skeleton. When swapping around animations, you'll need to copy
this from the original file to the replacements animations. This can only
be done with "Human" Characters i.e. Kendo, Leon, Zombie.

However an EMD does not have the TIM pointer, and has some more pointers
inbetween the Animation and model data. I have not looked into this but I
do not think it is enemy AI since I have copied a NPC to a zombie without
correcting the animations and the NPC tries to act like the zombie.

user posted image

To turn an NPC to a PC:
  • you would copy out everything before the PCs model Data
  • Delete everything before the NPCs model Data
  • paste in the PCs data copied
  • go to the end of the file, remove the NPCs pointer list
  • copy in the NPCs Tim image, make a note of where the TIM image starts
  • Copy to the end of the NPCs file the PCs pointer list, make a note where
    the pointer list starts.
  • Correct the NPCs TIM pointer location
  • Go to the start of the file and readjust the start pointer
  • Save as a temp name
  • Go to the offset (yellow) for the animations (and for a Human/Zombie) delete
    the amount highlighted in 2nd picture
  • Open the original EMD file again
  • Go to the offset of the yellow pointer for the original EMD
  • Select the same amount of data and copy it to the EMD you are turning into a PC
  • Save your PC EmD and play
As for turning a PC into a NPC or swapping around NPCs, all you have to worry about
are:
  • You would delete everything before the Model Data
  • Copy everything from before the model data of the NPC you are going to replace
  • Paste it to the other model
  • Delete the models Pointer list at the end of the file
  • Copy across the Pointer list from the npc you are going to replace.
  • Get the offset for the pointer list
  • Correct the pointer at the beginning of the file
  • Go to the offset (yellow) for the animations (and for a Human/Zombie) delete
    the amount highlighted in 2nd picture
  • Open the original EMD file again
  • Go to the offset of the yellow pointer for the original EMD
  • Select the same amount of data and copy it to the EMD you are creating as a replacement.
  • Save the EMD and copy/rename the TIM file to match.
As long as the pointers are all correct the files should work though some NPCs
have more body parts than others or have them in a different order, for example
Swapping Annette for Marvin, Marvin does not hold a gun but part of his zombie arm.
Sometimes models will crash if they do not have the correct number of body parts.

I hope that is easier to understand. I can't seem to write it any simpler.

RE1 has the pointer list at the end of file but no beginning pointer pointing to this.
The first two pointers for RE1 are 00 00 00 00 and 00 00 00 00, the following two
are the Model Data and TIM offset.

PROTOBOY - June 7, 2010 01:31 PM (GMT)
But I can do this with BIOHAZARD 2(sourcenext)???

PmData - July 28, 2010 09:04 PM (GMT)
Hi Enrico (and others),

I just stumbled again on this post, so I add a quick look in EMD file. Here is what I got from em01f.emd (this is the one loaded for room1000.rdt (first room in RE2 PC DEMO). This file is used for all models of this room, only the texture changes.

If you fill bytes at offset 0x0000000c to 0x0000002f of the file with 0, all models are nearly to a halt, they look at you and move very slowly without being animated. These contain what I called the emd_anim_header in section 1 of .EMD file, animation steps. Once filled with 0, the model will be 'locked' to the first animation step, which we modify thereafter.

Now you can play with the skeleton moving some parts, by modifying the unknown 80 byte section in the last part of skeleton section, which I called emd_sec2_data in section 2 of .EMD file. In this file, it starts at offset 0x0000074c.

Here is what I found so far, after a quick look (each value is 16 bits little endian, till we know more):
CODE
00 00 distance (the first 3 values seem to be x,y,z offset around the reference position for the entity)
3f f8 Y offset
00 00 distance
02 00 speed ? (this one is interesting, if you want superfast zombie, make it big :))
00 00
00 00 speed ?
36 e0
03 ef right foot angle (axis 0)
00 fc
da ff
ee 31 right low leg angle  (axis 0)
40 00
00 ef right leg angle  (axis 0)
ff ff
3f 1a right foot angle (axis 1)
d2 1f
03 d8 right low leg angle  (axis 1)
ff 04 right foot angle (axis 2)
76 90
fb 00
00 00 left foot angle (axis 1)
f1 c1 left foot angle (axis 2)
f5 ba left low leg angle (axis 1)
ef f6 left leg angle (axis 1)
24 df left leg angle (axis ?)
02 85 hip angle
1f fa torso angle
17 b0
f7 4c right arm angle
... more values to analyze

To experiment, just change 1 of the words, and see what happen in the models when you start the demo. As we can see, the right foot seems to be used as the reference position for the entity, and the whole model is drawn relative to it. There are several angles for each bone/mesh, because you can turn stuff around each x,y,z angle

20100730 UPDATE:

In fact animations steps are stored this way:
3 values for x,y,z offset
3 values for x,y,z speed (when the animation makes the object moving, like a hunter or dog jumping at you)
and then for each mesh, the x,y,z angles of the mesh stored as 12 bits values. I updated the rewiki page for EMD file to explain more of this.




* Hosted for free by InvisionFree