The Forum is up for sale: XeNTaX Forum looking for new owner

Decompile/or Decrypt a Microsoft DirectX 9 compiled shader?

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
Ahmadi
n00b
Posts: 17
Joined: Tue Oct 26, 2010 2:36 pm
Has thanked: 3 times
Been thanked: 1 time

Decompile/or Decrypt a Microsoft DirectX 9 compiled shader?

Post by Ahmadi »

Hi :wink:
Thank you for your research.
Im using QuickBMS for unpacking pack files. its great software ;)
After unpacking, i encountered with a microsoft DirectX 9.0 shader file that is compiled and i can not read it !
As you know, GPU Shaders are text (Shader is such as a C program)
But this file is encrypted. i did open it with HEXEditor and i did found that the encrypted file is result of compiling shader but im not sure yet. Its some days that im trying with no success.
Can anyone help me how can i decompile the shader file?

Thank you for your attention.
H.Ahmadi
You do not have the required permissions to view the files attached to this post.
jfwfreo
veteran
Posts: 124
Joined: Sat Nov 15, 2008 1:31 am
Been thanked: 24 times

Re: Decompile/or Decrypt a Microsoft DirectX 9 compiled shad

Post by jfwfreo »

Not possible to decompile a shader. It might be possible to disassemble a shader back into shader assembly though.

Shaders get compiled from HLSL (the shader programming language you refer to in your post) into shader bytecode by the Microsoft Shader Compiler.
It is this shader bytecode that gets fed to the GPU.
Ahmadi
n00b
Posts: 17
Joined: Tue Oct 26, 2010 2:36 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Decompile/or Decrypt a Microsoft DirectX 9 compiled shad

Post by Ahmadi »

jfwfreo wrote:Shaders get compiled from HLSL (the shader programming language you refer to in your post) into shader bytecode by the Microsoft Shader Compiler.
It is this shader bytecode that gets fed to the GPU.
In my renderer engine(Ogre3D), i can use HLSL,CG,GLSL, Assembly shader.
Im familar only with CG,HLSL .
jfwfreo wrote:It might be possible to disassemble a shader back into shader assembly though.
However it's not bad, Can you help me how can i do that? To i use the shader in RenderMonkey ?
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Decompile/or Decrypt a Microsoft DirectX 9 compiled shad

Post by Rheini »

You could always try to find a reference paper about the assembler codes.
Ahmadi
n00b
Posts: 17
Joined: Tue Oct 26, 2010 2:36 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Decompile/or Decrypt a Microsoft DirectX 9 compiled shad

Post by Ahmadi »

Rheini wrote:You could always try to find a reference paper about the assembler codes.
First, I must convert the compiled shader file to assembly! But how can i do that? Any tools?
shakotay
ultra-n00b
Posts: 8
Joined: Thu Oct 28, 2010 10:43 pm

Re: Decompile/or Decrypt a Microsoft DirectX 9 compiled shad

Post by shakotay »

Ahmadi wrote:
Rheini wrote:You could always try to find a reference paper about the assembler codes.
First, I must convert the compiled shader file to assembly! But how can i do that? Any tools?
You could use http://www.deep-shadows.com/hax/3DRipperDX.htm on a DirectX 9 game.
It creates psh files which contain assembly like this

Code: Select all

    mov_pp r0.x, v3.w
    mov_pp r0.y, v4.w
    texld_pp r0, r0, s4
    texldp_pp r1, v1, s6
    dp4_sat_pp r0.w, r1, c5
    add_pp r0.w, -r0.w, -c37.y
    mul_sat_pp r0.y, r0.y, r0.w
(Or you might google for gpu shader analyzer. There is a tool from AMD: http://developer.amd.com/gpu/shader/Pages/default.aspx
Did not test this - maybe you're lucky and there is a decompiler contained.)
Ahmadi
n00b
Posts: 17
Joined: Tue Oct 26, 2010 2:36 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Decompile/or Decrypt a Microsoft DirectX 9 compiled shad

Post by Ahmadi »

shakotay wrote:
(Or you might google for gpu shader analyzer. There is a tool from AMD: http://developer.amd.com/gpu/shader/Pages/default.aspx
Did not test this - maybe you're lucky and there is a decompiler contained.)
Hi
Thank you for your attention.
The AMD Shader Analyzer haven't any feature for decompiling shader (no luck).
I did very googling but no success to now :(

http://www.google.com/search?hl=en&clie ... er&spell=1

Fun : Almost all result of my google search is only this thread on this forum! :D

Unfortunately 3DRipperDX only work with DirectX 9 and have some issues with some games.

Thanks
H.Ahmadi
Post Reply