Diablo III: Extracting graphics from .tex files from MPQ and converting them to PNG (or whatever you want)

As always, once I'm bored with a Blizzard game I usually snoop around to see what's in the MPQ files. Diablo 3 is no exception.

Ingredients

Recipe

OK, I'll be honest. I'm going to assume you have a fair level of computer browsing competency. Some of these tools are still in their infancy so they're not the most user friendly.

If you're gonna need help figuring out how to extract things, navigating folders on your computer or editing batch files, you might want to get someone to help you.

  • Start up MPQ Editor
  • Open "Diablo III\Data_D3\PC\MPQs\Texture.mpq"
  • Browse to the "Textures" folder and extract the files you want to "C:\d3textures\" (or whatever folder you want)
  • Feel free to close MPQ Editor if you want.
  • Also extract "xvi32.exe" and "D3Texconv.exe" into that folder.

Now for a little explanation to the stuff you're about to do.

If you go ahead and attempt to convert the .tex files, you're gonna get an error saying "Invalid Texture or Surface (SNO Header Mismatch)". I'm not going to pretend I know what that means.

The whole reason why we have a hex editor is because we can tweak the files to be correct. But of course, we're lazy and we don't want to do it by hand to all 17,000+ TEX files.

  • Now create "textures.xsc", edit it in notepad and paste the following:

ADR 0
REPLACE EF BE AD DE 2D BY EF BE AD DE 2B

  • Save and exit.
  • Create another file called "texfix.bat", open up for editing in notepad. Paste the following (and change your paths if required)

@for /f "tokens=*" %%a in ('dir /b *.tex') do ( "C:\d3textures\xvi32.exe" %%a /S="C:\d3textures\textures.xsc" )

  • Save and exit.
  • Create one last file called "convert.bat", edit and paste:

@for /f "tokens=*" %%a in ('dir /b *.tex') do D3TexConv.exe %%a

  • Save and exit.

Now we're ready to roll!

  • To patch up all the TEX file headers so D3TexConv can read it, run "texfix.bat".
  • Once that's done, run "convert.bat" to extract the DDS data from the TEX files.
  • You'll now get a whole stack of TEX, DDS and TXT files. The only ones you care about are the DDS ones.
  • Install IrfanView and the plugins pack.
  • Now you should be able to view the DDS files.
  • Select the images you want and batch convert them into PNG (or whatever other format you need)

This should take a good while, but you'll be messing with the graphic files in no time!

image
Browsing the converted PNG files using ACDSee

Sources

Big thanks all round to all the crazy ass reverse engineers who've worked on this. I really don't know who they are, but only through their hard work has this been possible.

I've done my best to source my information so I hope you guys eventually get the credit you deserve!

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog