Skip to main content

Custom Face Additions

ETHER SAGA: CUSTOM CHARACTER CREATION FACES
===========================================

Lets character creation offer your own extra faces, with a separate list
for Mogui (grey skin) and for the other races, and makes those faces
blink properly. Stock faces 1-8 keep working exactly as before.
Everything is done by hand with a hex editor.


CONTENTS
  1. What changes
  2. What you need
  3. How faces work
  4. Step 1: Prepare the face pictures
  5. Step 2: Raise the face counts
  6. Step 3: Patch elementclient.exe
  7. Step 4: Add the face names
  8. Step 5: Pack and hand out
  9. Adding more faces later
 10. Testing
 11. What can go wrong (and how to fix it)
 12. Reference: exe changes


1. WHAT CHANGES
---------------
The game only knows 94 faces per gender and lets creation pick from a
fixed set of them. Four things change, and every player needs all four:

  - Your face pictures (open + closed eyes)
      shaders.pck -> shaders\textures\女\ and shaders\textures\男\
  - Face count in the two face shaders
      shaders.pck -> shaders\facefemale.sdr and shaders\facemale.sdr
  - Face lists, race split, blink rule
      elementclient.exe (hex edits, step 3)
  - Names shown in the Face dropdown
      interfaces.pck -> interfaces\loginui.stf

No server files change. The face is saved as a number, as it always was.


2. WHAT YOU NEED
----------------
- Client files: elementclient.exe, element\shaders.pck,
  element\interfaces.pck. The exe edits are for the standard English
  client build. Step 3 lists the original bytes at every spot; if they
  don't match, your exe is a different build: stop.
- A .pck tool that can unpack and repack Ether Saga packages. ESO uses its
  own package keys (KEY1 0xB6CD2509, KEY2 0x6C9FC1B5), not the Perfect
  World ones.
- A DDS editor that can save DXT1 with mipmaps (Paint.NET, GIMP with the
  DDS plugin, or NVIDIA Texture Tools).
- A hex editor such as HxD (winget install MHNexus.HxD).
- A text editor that saves UTF-16 (Notepad++, or Windows Notepad with
  "UTF-16 LE") for loginui.stf.
- BACKUPS of elementclient.exe, shaders.pck and interfaces.pck.


3. HOW FACES WORK
-----------------
Every face is one picture in a numbered strip, and a character's face is
just a number into that strip.

- The strip: shaders\textures\女\女00.dds, 女01.dds ... for female and
  男\男00.dds ... for male, all 512x512.
- The shader: shaders\facefemale.sdr and facemale.sdr load the strip as
  one animated texture. The line  TEX_ANIMATION  0  94  0  says how many
  pictures to load. A face number at or above that count wraps around to
  an early face.
- Blinking: every 5 seconds the game briefly shows a closed-eye picture.
  Stock faces use face + 22. After the patch, custom faces (94 and up)
  use face + 34.
- Emotes use their own shared pictures (44-68, or 69-93 for Mogui), so
  they work with any face.
- The 127 limit: the face is saved as one byte, so 127 is the highest
  face a character can have. Closed-eye pictures can go higher, because
  only open faces are saved.

  Numbers    Stock use                           After this setup
  0-21       open faces (0-13 normal skin,       unchanged
             14-21 Mogui)
  22-43      closed-eye versions of 0-21         unchanged
  44-93      emotes                              unchanged
  94-127     not used                            your open faces
                                                 (34 slots per gender)
  128-161    not used                            closed-eye versions of
                                                 94-127 (face + 34)

Stock creation offers 8 faces per race (dropdown 1-8). The patch adds
entries 9 and up, from a separate list for Mogui (race 3, classes 19-24)
and one for Ren, Yaoh and Shenzu.


4. STEP 1: PREPARE THE FACE PICTURES
------------------------------------
Each custom face needs two pictures: the open face at its number, and a
closed-eye version at that number + 34.

  1. Unpack shaders.pck and copy a stock face to start from, for example
     女\女00.dds. Its closed-eye version is 22 higher (女22.dds). Edit only
     inside the face; the eyes and mouth must stay where they are.
     Mogui faces should start from a Mogui (grey) stock face, 14-21, so
     the skin tone matches.
  2. Save each picture as 512x512, DXT1, WITH MIPMAPS, exactly like the
     stock faces.
  3. Number them from 94: open faces 94, 95, 96 ... and their closed-eye
     pictures at 128, 129, 130 ... (open + 34).
  4. No gaps: every number from 94 up to your highest closed-eye picture
     must exist. Fill unused numbers with a copy of a stock face (it is
     never shown).
  5. A face without a closed-eye version: put a copy of the open face at
     + 34. It just won't visibly blink.

Example with three female faces and one Mogui female face:

  Open face   Closed-eye picture   Who gets it
  女94         女128                 other races
  女95         女129                 other races
  女96         女130                 other races
  女97         女131                 Mogui
  女98-127     (filler copies, because the strip runs to 女131)

About fillers:
  - Why: the game loads the strip as one unbroken run, from 0 up to the
    .sdr count. Closed-eye pictures start at 128, so every number between
    your last open face and 127 that isn't a real face needs a picture.
    A missing number breaks the strip and later faces can load wrong.
  - What: a copy of any stock face (512x512 DXT1 with mipmaps). No face
    list points at a filler, so players never see it. Tip: a filler in an
    obvious solid colour (same format) makes it easy to spot if a list or
    count is ever wrong.
  - How many: only up to your highest closed-eye picture. Don't add more;
    each picture costs about 175 KB of memory.
  - Fillers are your free slots: a new face simply overwrites one.


5. STEP 2: RAISE THE FACE COUNTS
--------------------------------
Set each shader's count to its highest picture number + 1, or the game
never loads your faces.

  1. From the unpacked shaders.pck, open shaders\facefemale.sdr and
     shaders\facemale.sdr in a text editor.
  2. Find the line  TEX_ANIMATION  0  94  0  and change 94 to the new
     count. In the example above (pictures up to 女131) that is
     TEX_ANIMATION  0  132  0
  3. Save, keeping the spacing and encoding as they were.


6. STEP 3: PATCH ELEMENTCLIENT.EXE (HEX EDITOR)
-----------------------------------------------
Work on a COPY of elementclient.exe. In HxD use "Search > Go to" with a
file offset, and type over bytes (Overwrite mode, never Insert). Every
address below is a FILE OFFSET.

A. Check the six spots. Each must show the original bytes; if one
   doesn't, this is a different build: stop. Then type over them:

  Offset    Original bytes                          Type over with
  1F64B0    8B 44 24 04 83                          E9 AB 82 3E 00
  1EF58D    85 C0 0F 8F A0 00 00 00                 E8 AE F1 3E 00 90 90 90
  1EF595    68 91 01 00 00                          E8 66 F1 3E 00
  1F031F    8B 8E 9C 08 00 00 81 C1 91 01 00 00     E8 FC E3 3E 00 90 90 90 90 90 90 90
  08E8C1    8B 95 1C 05 00 00 83 C2 16              E8 3A FF 54 00 90 90 90 90
  08E8D1    8B 85 1C 05 00 00 8B 8D 5C 02 00 00 83 C0 16
                                                    E8 4A FF 54 00 8B 8D 5C 02 00 00 90 90 90 90

B. Header: at offset 000268, if it shows C5 D1 5D 00, change it to
   00 E0 5D 00 (marks the end of the code section as code). If it already
   shows 00 E0 5D 00 (some patched clients), leave it.

C. New code. Offsets 5DE700 to 5DE8FF must all be 00 before you start
   (if not, another patch uses that space: stop). Type in these rows;
   rows not listed stay 00:

  5DE700: 5A B8 91 01 00 00 83 BE A0 08 00 00 03 75 05 B8
  5DE710: 54 0B 00 00 50 FF E2 00 00 00 00 00 00 00 00 00
  5DE720: 8B 8E 9C 08 00 00 83 BE A0 08 00 00 03 75 07 81
  5DE730: C1 54 0B 00 00 C3 81 C1 91 01 00 00 C3 00 00 00
  5DE740: 8B CF E8 79 14 E2 FF C3 00 00 00 00 00 00 00 00
  5DE760: 8B 44 24 08 83 F8 08 7C 2E 83 E8 08 8B 91 9C 08
  5DE770: 00 00 83 E2 01 83 7C 24 04 03 75 03 83 C2 02 8B
  5DE780: 14 95 C0 E7 9D 00 0F B6 0A 39 C8 72 02 31 C0 0F
  5DE790: B6 44 02 01 C2 08 00 8B 4C 24 04 83 F9 03 74 17
  5DE7A0: 83 F8 04 7E 15 49 74 09 49 75 0F 83 C0 03 C2 08
  5DE7B0: 00 83 C0 06 C2 08 00 83 C0 0E C2 08 00 8D 76 00
  5DE7C0: 40 E8 9D 00 63 E8 9D 00 86 E8 9D 00 A9 E8 9D 00
  5DE800: 8B 95 1C 05 00 00 83 FA 5E 7C 03 83 C2 0C 83 C2
  5DE810: 16 C3 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5DE820: 8B 85 1C 05 00 00 83 F8 5E 7C 03 83 C0 0C 83 C0
  5DE830: 16 C3 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5DE840: 03 5E 5F 60 00 00 00 00 00 00 00 00 00 00 00 00
  5DE850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5DE860: 00 00 00 03 5E 5F 60 00 00 00 00 00 00 00 00 00
  5DE870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5DE880: 00 00 00 00 00 00 01 61 00 00 00 00 00 00 00 00
  5DE890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5DE8A0: 00 00 00 00 00 00 00 00 00 01 61 00 00 00 00 00
  5DE8B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  5DE8C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

D. The face lists. The rows from 5DE840 hold four lists in fixed spots,
   each "count, then face numbers" in hex, with room for 34 faces each:

  Starts at   List                         Example above
  5DE840      male, Ren / Yaoh / Shenzu    03 5E 5F 60  (3 faces: 94 95 96)
  5DE863      female, Ren / Yaoh / Shenzu  03 5E 5F 60  (3 faces: 94 95 96)
  5DE886      male, Mogui                  01 61        (1 face: 97)
  5DE8A9      female, Mogui                01 61        (1 face: 97)

   Put your own lists here: first byte = how many faces, then the face
   numbers in hex, in dropdown order (first = dropdown entry 9).
   Face numbers in hex: 94=5E 95=5F 96=60 97=61 98=62 99=63 100=64
   101=65 102=66 103=67 104=68 105=69 106=6A 107=6B 108=6C 109=6D 110=6E
   111=6F 112=70 113=71 114=72 115=73 116=74 117=75 118=76 119=77 120=78
   121=79 122=7A 123=7B 124=7C 125=7D 126=7E 127=7F
   Count in hex: 1=01 2=02 ... 9=09 10=0A 11=0B 12=0C 13=0D 14=0E 15=0F
   16=10 17=11 18=12 19=13 20=14 ... 34=22.
   Never leave a list at 00 (empty): give it at least one face.

E. Save, then rename the copy to elementclient.exe (keep your backup).
   The file size must be exactly the same as before.

What these edits do:
  - Face choice: dropdown entries 1-8 work as stock. Entry 9 and up give
    the faces from your lists, picked by gender and by Mogui or not.
  - Separate Mogui names: the Face dropdown reads Mogui names from
    loginui.stf lines 2900 (male) and 2901 (female) instead of 401/402.
  - List refresh: the face list is rebuilt each time a class is picked,
    so switching between Mogui and another race shows the right list.
  - Blink rule: custom faces (94+) blink to face + 34; stock faces still
    use + 22.


7. STEP 4: ADD THE FACE NAMES
-----------------------------
The dropdown shows one entry per name, so each list needs exactly
8 + (number of custom faces in that list) names.

  1. Unpack interfaces.pck and open interfaces\loginui.stf. It is UTF-16 LE
     with a BOM; keep it that way.
  2. Each line is a number, a Tab, then the names in quotes, separated by
     Tabs. Add names to the end of lines 401 and 402, and add the new
     lines 2900 and 2901 (they don't exist in a stock file):

       Line   Used for                   Names needed (example above)
       401    male, other races          8 + 3 = 11
       402    female, other races        8 + 3 = 11
       2900   male, Mogui (new line)     8 + 1 = 9
       2901   female, Mogui (new line)   8 + 1 = 9

  For 2900 and 2901, copy the 8 stock names from 401 and 402, then add
  yours. Example line (<TAB> = one Tab character):

  2901<TAB>"Female face 1<TAB>Female face 2<TAB>...<TAB>Female face 8<TAB>Female face 9"


8. STEP 5: PACK AND HAND OUT
----------------------------
  1. Put your pictures and the two .sdr files into the unpacked shaders
     folder, and loginui.stf into the unpacked interfaces folder.
  2. Repack shaders.pck and interfaces.pck from the FULL unpacked folders.
     Then check the new pack is not smaller than the original and that
     everything still works (see section 11).
  3. Give players the new elementclient.exe, shaders.pck and
     interfaces.pck together, through your launcher or patcher if you have
     one. Update any hashes your launcher checks.

Many Angelica clients also read loose files before the .pck copy, for
example element\shaders\textures\女\女94.dds. Test this on your client
before relying on it.


9. ADDING MORE FACES LATER
--------------------------
  1. Pick the next free open-face number (94-127). Make the open picture
     there and its closed-eye picture at number + 34. If the new numbers
     go past your current highest picture, fill any gap with copies.
  2. Raise TEX_ANIMATION in that gender's .sdr to (highest picture + 1).
  3. In the patched exe, add the number to the right list (step 3 D):
     raise that list's count byte by one and type the face number after
     the last one.
  4. Add one more name to the matching loginui.stf line (401, 402, 2900
     or 2901).
  5. Repack (see step 5) and hand out all changed files again.

Swapping a face for a better version only needs steps 1 and 5: replace
the picture (and its + 34 closed-eye picture) under the same number.
To remove a face from creation, take its number out of the list (lower
the count, close the gap) and remove one name. Keep the picture in the strip: existing
characters may still use it.


10. TESTING
-----------
Test on a throwaway character before handing anything out.
[ ] A non-Mogui class shows Face 1-8 plus your extra names, and each one
    previews the right face.
[ ] A Mogui class shows its own shorter list with grey faces.
[ ] Switching between a Mogui and a non-Mogui class updates the list
    straight away.
[ ] Each custom face blinks (watch the preview for about 10 seconds).
[ ] Emotes still work on a custom face.
[ ] Hair, ear and gear previews still change normally.
[ ] After creating the character and logging back in, the face is still
    the custom one.
[ ] A second player on another PC sees the custom face too.


11. WHAT CAN GO WRONG (AND HOW TO FIX IT)
-----------------------------------------
- A custom choice shows a stock face.
    The .sdr count is too low, so the number wraps around.
    -> Raise TEX_ANIMATION to highest picture + 1.

- It shows a filler or old picture.
    The new picture didn't replace the old one inside the .pck (some pack
    tools add a second entry with the same name and the game reads the
    old one).
    -> Rebuild the .pck from a clean, full unpacked folder.

- Hair stops changing, or other models/textures look broken, after
  repacking shaders.pck.
    The pack tool damaged or dropped files during the repack.
    -> Start again from your ORIGINAL shaders.pck and add only the face
       pictures and the two .sdr files. Compare file counts/sizes with
       the original.

- Extra dropdown entries all show the same face.
    More names in loginui.stf than faces in that list.
    -> Names must be 8 + list length.

- Faces you added don't appear in the dropdown.
    Too few names in loginui.stf, or the patched exe isn't the one running.

- Mogui face list is empty.
    Lines 2900/2901 are missing from loginui.stf.
    -> Add them.

- Nothing changed at all.
    The game is still running the old exe.
    -> Make sure the edited copy is named elementclient.exe and sits in
       the folder the game starts from. Check your launcher doesn't
       restore its own copy (certutil -hashfile elementclient.exe MD5
       shows whether the file changed).

- Face looks grainy at a distance, or garbled.
    Wrong DDS format or no mipmaps.
    -> Re-save as DXT1, 512x512, with mipmaps.

- Face skin doesn't match the body.
    A Mogui face made from a normal-skin face, or the other way round.
    -> Start Mogui faces from stock faces 14-21, others from 0-13.

- Face resets to a stock face after relog.
    The server limits face numbers.
    -> Needs a server-side fix (gamedbd / gdeliveryd).

- Other players see a blank or wrong face (or crash) near your character.
    They don't have the new shaders.pck.
    -> Everyone must update; never roll the pack back once characters use
       custom faces.

- Mogui characters show random, changing gear on the creation screen.
    A separate bug in the stock client, not caused by the faces, but you
    will notice it while testing Mogui faces. It is a one-byte fix,
    written up in ESO_Mogui_Gear_Fix.txt."Fix for Random Mogui Gear in Character Creation." It can be done before or after
    the face edits; the two don't overlap.

- The original bytes in step 3 don't match, or 5DE700-5DE8FF isn't empty.
    Your exe is a different build, or another patch uses the same space.
    Don't force it.

- The game crashes on the creation screen after the exe edits.
    A byte was mistyped, or inserted instead of overwritten (the file
    size must not change). Go back to your backup and redo step 3.


12. REFERENCE: HOW THE NEW CODE WORKS
-------------------------------------
Memory address = file offset + 0x400000.
  0x9DE700  first-fill name line (401, or 2900 for Mogui)
  0x9DE720  gender-change name line (401/402, or 2900/2901 for Mogui)
  0x9DE740  clear the face list on every class pick
  0x9DE760  face lookup (stock dropdown 1-8 logic kept as it was)
  0x9DE7C0  pointers to the four face lists
  0x9DE800  blink frame (+22 stock, +34 custom); 0x9DE820 the same for
            the second face shader
  0x9DE840  the four face lists

Game facts used: the creation dialog keeps gender at offset 0x89C
(0 male, 1 female) and race at 0x8A0 (0 Ren, 1 Yaoh, 2 Shenzu, 3 Mogui);
classes 19-24 are Mogui; a player's face number is at offset 0x51C.